From eb98b1b33eb30cc7c04c64ae910b1fde6fde9b03 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Jan 2025 11:37:47 -0500 Subject: [PATCH] Move MAM, MATRIX, CARMA, GAAS, ACHEM to separate repos --- .github/CODEOWNERS | 4 - .gitignore | 15 + CARMAchem_GridComp/CARMA/CHANGES | 417 - CARMAchem_GridComp/CARMA/Makefile | 164 - CARMAchem_GridComp/CARMA/README | 122 - .../CARMA/bin/f90doc-0.4.0/LICENSE | 22 - .../CARMA/bin/f90doc-0.4.0/README | 36 - .../CARMA/bin/f90doc-0.4.0/expr_parse.pl | 793 - .../CARMA/bin/f90doc-0.4.0/expr_parse.y | 234 - .../CARMA/bin/f90doc-0.4.0/f90doc | 160 - .../CARMA/bin/f90doc-0.4.0/htmling.pl | 376 - .../CARMA/bin/f90doc-0.4.0/stmts.pl | 891 - .../CARMA/bin/f90doc-0.4.0/typing.pl | 516 - .../CARMA/bin/f90doc-0.4.0/utils.pl | 87 - CARMAchem_GridComp/CARMA/doc/ChangeLog | 351 - .../CARMA/doc/ChangeLog_template | 19 - CARMAchem_GridComp/CARMA/doc/index.html | 148 - CARMAchem_GridComp/CARMA/make-carma.csh | 75 - CARMAchem_GridComp/CARMA/run-all.csh | 93 - CARMAchem_GridComp/CARMA/run-carma.csh | 110 - CARMAchem_GridComp/CARMA/run-regress.csh | 81 - CARMAchem_GridComp/CARMA/source/base/Makefile | 319 - .../CARMA/source/base/actdropl.F90 | 106 - .../CARMA/source/base/adgaquad_mod.F90 | 3573 --- .../CARMA/source/base/adgaquad_types_mod.F90 | 39 - .../CARMA/source/base/bhmie.F90 | 182 - .../CARMA/source/base/calcrs.F90 | 111 - .../CARMA/source/base/carma_constants_mod.F90 | 134 - .../CARMA/source/base/carma_enums_mod.F90 | 147 - .../CARMA/source/base/carma_globaer.h | 327 - .../CARMA/source/base/carma_mod.F90 | 1498 -- .../CARMA/source/base/carma_precision_mod.F90 | 47 - .../CARMA/source/base/carma_types_mod.F90 | 823 - .../CARMA/source/base/carmaelement_mod.F90 | 267 - .../CARMA/source/base/carmagas_mod.F90 | 208 - .../CARMA/source/base/carmagroup_mod.F90 | 732 - .../CARMA/source/base/carmasolute_mod.F90 | 176 - .../CARMA/source/base/carmastate_mod.F90 | 1697 -- .../CARMA/source/base/coagl.F90 | 105 - .../CARMA/source/base/coagp.F90 | 266 - .../CARMA/source/base/csolve.F90 | 61 - .../CARMA/source/base/detrain.F90 | 51 - .../CARMA/source/base/downgevapply.F90 | 52 - .../CARMA/source/base/downgxfer.F90 | 146 - .../CARMA/source/base/evap_ingrp.F90 | 53 - .../CARMA/source/base/evap_mono.F90 | 109 - .../CARMA/source/base/evap_poly.F90 | 141 - .../CARMA/source/base/evapp.F90 | 199 - .../source/base/fractal_meanfield_mod.F90 | 1475 -- .../CARMA/source/base/freezaerl_koop2000.F90 | 210 - .../source/base/freezaerl_mohler2010.F90 | 185 - .../source/base/freezaerl_tabazadeh2000.F90 | 311 - .../CARMA/source/base/freezdropl.F90 | 74 - .../source/base/freezglaerl_murray2010.F90 | 138 - .../CARMA/source/base/gasexchange.F90 | 146 - .../CARMA/source/base/growevapl.F90 | 256 - .../CARMA/source/base/growp.F90 | 50 - .../CARMA/source/base/gsolve.F90 | 101 - .../CARMA/source/base/hetnucl.F90 | 163 - .../CARMA/source/base/lusolvec_mod.F90 | 213 - .../CARMA/source/base/maxconc.F90 | 47 - .../CARMA/source/base/melticel.F90 | 74 - .../CARMA/source/base/microfast.F90 | 280 - .../CARMA/source/base/microslow.F90 | 61 - CARMAchem_GridComp/CARMA/source/base/mie.F90 | 143 - .../CARMA/source/base/miess.F90 | 496 - .../CARMA/source/base/newstate.F90 | 245 - .../CARMA/source/base/newstate_calc.F90 | 292 - .../CARMA/source/base/nsubsteps.F90 | 191 - .../CARMA/source/base/pfastdmdt.F90 | 68 - .../CARMA/source/base/pheat.F90 | 373 - .../CARMA/source/base/planck.F90 | 326 - .../CARMA/source/base/prestep.F90 | 105 - .../CARMA/source/base/psolve.F90 | 86 - .../source/base/rhoice_heymsfield2010.F90 | 101 - .../CARMA/source/base/rhopart.F90 | 209 - .../CARMA/source/base/setupatm.F90 | 146 - .../CARMA/source/base/setupbdif.F90 | 114 - .../CARMA/source/base/setupbins.F90 | 235 - .../CARMA/source/base/setupckern.F90 | 523 - .../CARMA/source/base/setupcoag.F90 | 388 - .../CARMA/source/base/setupgkern.F90 | 324 - .../CARMA/source/base/setupgrow.F90 | 131 - .../CARMA/source/base/setupnuc.F90 | 97 - .../CARMA/source/base/setupvdry.F90 | 106 - .../CARMA/source/base/setupvf.F90 | 186 - .../source/base/setupvf_heymsfield2010.F90 | 90 - .../CARMA/source/base/setupvf_std.F90 | 138 - .../CARMA/source/base/setupvf_std_shape.F90 | 281 - .../CARMA/source/base/smallconc.F90 | 63 - CARMAchem_GridComp/CARMA/source/base/step.F90 | 37 - .../CARMA/source/base/sulfate_utils.F90 | 655 - .../CARMA/source/base/sulfhetnucrate.F90 | 98 - .../CARMA/source/base/sulfnuc.F90 | 131 - .../CARMA/source/base/sulfnucrate.F90 | 318 - .../CARMA/source/base/supersat.F90 | 107 - .../CARMA/source/base/totalcondensate.F90 | 88 - .../CARMA/source/base/tsolve.F90 | 115 - .../CARMA/source/base/upgxfer.F90 | 142 - .../CARMA/source/base/vaporp.F90 | 62 - .../CARMA/source/base/vaporp_h2o_buck1981.F90 | 66 - .../CARMA/source/base/vaporp_h2o_goff1946.F90 | 65 - .../source/base/vaporp_h2o_murphy2005.F90 | 59 - .../source/base/vaporp_h2so4_ayers1980.F90 | 91 - .../CARMA/source/base/versol.F90 | 143 - .../CARMA/source/base/versub.F90 | 127 - .../CARMA/source/base/vertadv.F90 | 256 - .../CARMA/source/base/vertdif.F90 | 125 - .../CARMA/source/base/vertical.F90 | 110 - CARMAchem_GridComp/CARMA/source/base/wetr.F90 | 311 - .../CARMA/source/base/zeromicro.F90 | 52 - CARMAchem_GridComp/CARMA/tests/Makefile | 90 - .../CARMA/tests/atmosphere_mod.F90 | 194 - .../CARMA/tests/carma_bc2gtest.F90 | 369 - .../CARMA/tests/carma_bcoctest.F90 | 390 - .../CARMA/tests/carma_coagtest.F90 | 332 - .../CARMA/tests/carma_drydeptest.F90 | 291 - .../CARMA/tests/carma_falltest.F90 | 304 - .../CARMA/tests/carma_growclrtest.F90 | 386 - .../CARMA/tests/carma_growintest.F90 | 384 - .../CARMA/tests/carma_growsubtest.F90 | 374 - .../CARMA/tests/carma_growtest.F90 | 324 - .../CARMA/tests/carma_history.F90 | 193 - .../CARMA/tests/carma_inittest.F90 | 165 - .../CARMA/tests/carma_mietest.F90 | 185 - .../CARMA/tests/carma_nuc2test.F90 | 363 - .../CARMA/tests/carma_nuctest.F90 | 419 - .../CARMA/tests/carma_pheattest.F90 | 359 - .../CARMA/tests/carma_scfalltest.F90 | 423 - .../CARMA/tests/carma_sigmadrydeptest.F90 | 337 - .../CARMA/tests/carma_sigmafalltest.F90 | 519 - .../CARMA/tests/carma_sulfatetest.F90 | 392 - .../CARMA/tests/carma_swelltest.F90 | 348 - CARMAchem_GridComp/CARMA/tests/carma_test.F90 | 270 - .../CARMA/tests/carma_testutils.F90 | 105 - .../CARMA/tests/carma_vdiftest.F90 | 309 - .../CARMA/tests/read_bc2gtest.pro | 166 - .../CARMA/tests/read_bcoctest.pro | 134 - .../CARMA/tests/read_coagtest.pro | 85 - .../CARMA/tests/read_drydeptest.pro | 131 - .../CARMA/tests/read_falltest.pro | 108 - .../CARMA/tests/read_growclrtest.pro | 216 - .../CARMA/tests/read_growintest.pro | 215 - .../CARMA/tests/read_growsubtest.pro | 215 - .../CARMA/tests/read_growtest.pro | 197 - .../CARMA/tests/read_mietest.pro | 97 - .../CARMA/tests/read_nuc2test.pro | 203 - .../CARMA/tests/read_nuctest.pro | 203 - .../CARMA/tests/read_pheattest.pro | 201 - .../CARMA/tests/read_scfalltest.pro | 108 - .../CARMA/tests/read_sigmadrydeptest.pro | 131 - .../CARMA/tests/read_sigmafalltest.pro | 108 - .../CARMA/tests/read_sulfatetest.pro | 193 - .../CARMA/tests/read_swelltest.pro | 132 - .../CARMA/tests/read_vdiftest.pro | 108 - CARMAchem_GridComp/CARMA/view-bench.csh | 85 - CARMAchem_GridComp/CARMA_GridComp.F90 | 1591 -- CARMAchem_GridComp/CARMA_UtilMod.F90 | 2709 --- CARMAchem_GridComp/CARMAchem_GridCompMod.F90 | 1936 -- .../CARMAchem_GridComp_ExtData.rc | 27 - .../CARMAchem_GridComp_ExtData.yaml | 87 - CARMAchem_GridComp/CARMAchem_MieRegistry.rc | 513 - CARMAchem_GridComp/CARMAchem_Registry.rc | 483 - .../CARMAchem_Registry.rc.MIXED | 483 - CARMAchem_GridComp/CARMAchem_Registry.rc.SU | 483 - CARMAchem_GridComp/CMakeLists.txt | 37 - CARMAchem_GridComp/ut_CARMA.F90 | 664 - CHANGELOG.md | 13 +- CMakeLists.txt | 9 +- GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.rc | 9 - GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.yaml | 33 - GAAS_GridComp/CMakeLists.txt | 23 - GAAS_GridComp/GAAS_AerRegistry.rc | 325 - GAAS_GridComp/GAAS_AodRegistry.rc | 154 - GAAS_GridComp/GAAS_GridComp.rc | 58 - GAAS_GridComp/GAAS_GridCompMod.F90 | 899 - GAAS_GridComp/GAAS_GridComp_ExtData.rc | 9 - GAAS_GridComp/GAAS_GridComp_ExtData.yaml | 33 - GAAS_GridComp/GAAS_Mie.rc | 45 - GAAS_GridComp/GAAS_Registry.rc | 81 - GAAS_GridComp/LDE_Mod.F90 | 1482 -- GAAS_GridComp/ana_lde.F90 | 251 - GAAS_GridComp/ana_lde.py | 156 - GAAS_GridComp/lde.rc | 85 - GEOS_ChemGridComp.F90 | 6 +- .../AMIP.20C/GEOS_AChemGridComp.rc | 44 - .../AMIP.20C/GEOSachem_ExtData.rc | 60 - GEOSachem_GridComp/AMIP/GEOS_AChemGridComp.rc | 44 - GEOSachem_GridComp/AMIP/GEOSachem_ExtData.rc | 60 - .../AMIP/GEOSachem_ExtData.yaml | 140 - GEOSachem_GridComp/CMakeLists.txt | 48 - GEOSachem_GridComp/GACL_ConstantsMod.F90 | 81 - GEOSachem_GridComp/GACL_DryDepositionMod.F90 | 285 - GEOSachem_GridComp/GACL_EmissionsMod.F90 | 908 - GEOSachem_GridComp/GACL_ReactionRatesMod.F90 | 287 - GEOSachem_GridComp/GEOS_AChemGridComp.rc | 43 - GEOSachem_GridComp/GEOS_AChemGridCompMod.F90 | 3871 ---- GEOSachem_GridComp/GEOSachem_ExtData.rc | 60 - GEOSachem_GridComp/GEOSachem_ExtData.yaml | 138 - GEOSachem_GridComp/GEOSachem_Registry.rc | 219 - .../kpp/gas/Makefile_kpp_achem_gas | 178 - GEOSachem_GridComp/kpp/gas/kpp_achem_gas.def | 30 - GEOSachem_GridComp/kpp/gas/kpp_achem_gas.eqn | 64 - GEOSachem_GridComp/kpp/gas/kpp_achem_gas.kpp | 17 - GEOSachem_GridComp/kpp/gas/kpp_achem_gas.spc | 16 - .../kpp/gas/kpp_achem_gas_Function.f90 | 81 - .../kpp/gas/kpp_achem_gas_Global.f90 | 81 - .../kpp/gas/kpp_achem_gas_Hessian.f90 | 153 - .../kpp/gas/kpp_achem_gas_HessianSP.f90 | 39 - .../kpp/gas/kpp_achem_gas_Initialize.f90 | 92 - .../kpp/gas/kpp_achem_gas_Integrator.f90 | 3468 --- .../kpp/gas/kpp_achem_gas_Jacobian.f90 | 161 - .../kpp/gas/kpp_achem_gas_JacobianSP.f90 | 48 - .../kpp/gas/kpp_achem_gas_LinearAlgebra.f90 | 1160 - .../kpp/gas/kpp_achem_gas_Main.f90 | 89 - .../kpp/gas/kpp_achem_gas_Model.f90 | 22 - .../kpp/gas/kpp_achem_gas_Monitor.f90 | 52 - .../kpp/gas/kpp_achem_gas_Parameters.f90 | 97 - .../kpp/gas/kpp_achem_gas_Precision.f90 | 17 - .../kpp/gas/kpp_achem_gas_Rates.f90 | 274 - .../kpp/gas/kpp_achem_gas_Stoichiom.f90 | 228 - .../kpp/gas/kpp_achem_gas_StoichiomSP.f90 | 63 - .../kpp/gas/kpp_achem_gas_Util.f90 | 231 - .../kpp/gas/kpp_achem_gas_mex_Fun.f90 | 45 - .../kpp/gas/kpp_achem_gas_mex_Hessian.f90 | 45 - .../kpp/gas/kpp_achem_gas_mex_Jac_SP.f90 | 44 - MAMchem_GridComp/CMakeLists.txt | 77 - MAMchem_GridComp/ChangeLog | 42 - MAMchem_GridComp/MAM3_DataMod.F90 | 125 - MAMchem_GridComp/MAM7_DataMod.F90 | 212 - MAMchem_GridComp/MAM7_ExtData.rc | 45 - MAMchem_GridComp/MAM7_ExtData.yaml | 112 - MAMchem_GridComp/MAML_CoagulationMod.F90 | 703 - MAMchem_GridComp/MAML_DryDepositionMod.F90 | 372 - MAMchem_GridComp/MAML_DryRemovalMod.F90 | 362 - .../MAML_GasAerosolExchangeMod.F90 | 823 - MAMchem_GridComp/MAML_NucleationMod.F90 | 421 - MAMchem_GridComp/MAML_OpticsMod.F90 | 676 - MAMchem_GridComp/MAML_OpticsTableMod.F90 | 589 - MAMchem_GridComp/MAML_SettlingMod.F90 | 790 - MAMchem_GridComp/MAML_SizeMod.F90 | 366 - MAMchem_GridComp/MAML_WetRemovalMod.F90 | 558 - MAMchem_GridComp/MAM_BaseMod.F90 | 2268 -- MAMchem_GridComp/MAM_BlackCarbonMod.F90 | 545 - MAMchem_GridComp/MAM_CoagulationMod.F90 | 801 - MAMchem_GridComp/MAM_ComponentsDataMod.F90 | 108 - MAMchem_GridComp/MAM_ConstituentsDataMod.F90 | 63 - MAMchem_GridComp/MAM_DryRemovalMod.F90 | 331 - MAMchem_GridComp/MAM_DustMod.F90 | 525 - .../MAM_GasAerosolExchangeMod.F90 | 656 - MAMchem_GridComp/MAM_NucleationMod.F90 | 379 - MAMchem_GridComp/MAM_OrganicCarbonMod.F90 | 547 - MAMchem_GridComp/MAM_SeasaltMod.F90 | 525 - MAMchem_GridComp/MAM_SizeMod.F90 | 361 - MAMchem_GridComp/MAM_SulfateMod.F90 | 519 - MAMchem_GridComp/MAM_WetRemovalMod.F90 | 181 - MAMchem_GridComp/MAMchem_GridComp.rc | 102 - MAMchem_GridComp/MAMchem_GridCompMod.F90 | 5107 ----- MAMchem_GridComp/MAMchem_Registry.rc | 259 - MAMchem_GridComp/README | 0 MAMchem_GridComp/TODO | 39 - MAMchem_GridComp/mam_optics_calculator.F90 | 773 - MAMchem_GridComp/mam_optics_calculator.csh | 139 - MAMchem_GridComp/mam_optics_calculator.py | 125 - MAMchem_GridComp/mam_optics_calculator.rc | 62 - MAMchem_GridComp/microphysics/abortutils.F90 | 39 - MAMchem_GridComp/microphysics/cam_logfile.F90 | 21 - MAMchem_GridComp/microphysics/chem_mods.F90 | 67 - .../microphysics/constituents.F90 | 450 - MAMchem_GridComp/microphysics/infnan.F90 | 35 - .../microphysics/modal_aero_amicphys.F90 | 6256 ------ .../microphysics/modal_aero_calcsize.F90 | 1611 -- .../microphysics/modal_aero_coag.F90 | 3778 ---- .../microphysics/modal_aero_data.F90 | 470 - .../microphysics/modal_aero_gasaerexch.F90 | 1487 -- .../modal_aero_initialize_data.F90 | 1386 -- .../microphysics/modal_aero_newnuc.F90 | 1774 -- .../microphysics/modal_aero_rename.F90 | 684 - .../microphysics/modal_aero_wateruptake.F90 | 747 - .../microphysics/module_data_mosaic_aero.F90 | 437 - .../microphysics/module_data_mosaic_asect.F90 | 401 - .../module_data_mosaic_asecthp.F90 | 401 - .../microphysics/module_data_mosaic_cloud.F90 | 25 - .../module_data_mosaic_constants.F90 | 9 - .../microphysics/module_data_mosaic_gas.F90 | 105 - .../microphysics/module_data_mosaic_kind.F90 | 11 - .../microphysics/module_data_mosaic_main.F90 | 104 - .../microphysics/module_mosaic_astem.F90 | 3934 ---- .../module_mosaic_box_aerchem.F90 | 1893 -- .../microphysics/module_mosaic_cam_init.F90 | 132 - .../microphysics/module_mosaic_ext.F90 | 5874 ----- .../microphysics/module_mosaic_init.F90 | 3173 --- .../module_mosaic_init_aerpar.F90 | 3173 --- .../microphysics/module_mosaic_lsode.F90 | 27 - .../microphysics/module_mosaic_support.F90 | 64 - MAMchem_GridComp/optics/CMakeLists.txt | 34 - MAMchem_GridComp/optics/gads.py | 216 - .../optics/mam7-optics.lut.batch.csh | 88 - MAMchem_GridComp/optics/mam7-optics.lut.py | 149 - MAMchem_GridComp/optics/mie.F90 | 525 - MAMchem_GridComp/optics/miev/ErrPack.f | 94 - MAMchem_GridComp/optics/miev/MIEV.doc | 509 - MAMchem_GridComp/optics/miev/MIEV0.F | 2291 -- MAMchem_GridComp/optics/radiation.py | 848 - MAMchem_GridComp/optics/tests/ut_gads.py | 297 - MAMchem_GridComp/optics/tests/ut_mie.F90 | 107 - MAMchem_GridComp/optics/tests/ut_mie.py | 113 - MATRIXchem_GridComp/CMakeLists.txt | 38 - MATRIXchem_GridComp/ChangeLog | 7 - MATRIXchem_GridComp/MATRIXchem_GridComp.rc | 17 - .../MATRIXchem_GridCompMod.F90 | 1270 -- MATRIXchem_GridComp/MATRIXchem_Registry.rc | 226 - MATRIXchem_GridComp/README | 20 - MATRIXchem_GridComp/microphysics/CONST.F | 235 - MATRIXchem_GridComp/microphysics/TRAMP_actv.F | 504 - MATRIXchem_GridComp/microphysics/TRAMP_coag.F | 1204 - .../microphysics/TRAMP_config.F90 | 771 - MATRIXchem_GridComp/microphysics/TRAMP_depv.F | 180 - MATRIXchem_GridComp/microphysics/TRAMP_diam.F | 129 - .../microphysics/TRAMP_dicrete.F | 635 - MATRIXchem_GridComp/microphysics/TRAMP_drv.F | 713 - .../microphysics/TRAMP_eqsam_v03d.F90 | 700 - MATRIXchem_GridComp/microphysics/TRAMP_init.F | 562 - .../microphysics/TRAMP_isocom2.F | 16625 -------------- .../microphysics/TRAMP_isofwd2.F | 18710 ---------------- .../microphysics/TRAMP_isorev2.F | 11871 ---------- .../microphysics/TRAMP_matrix.F | 1330 -- .../microphysics/TRAMP_nomicrophysics.F | 193 - MATRIXchem_GridComp/microphysics/TRAMP_npf.F | 1479 -- .../microphysics/TRAMP_param.F | 420 - MATRIXchem_GridComp/microphysics/TRAMP_quad.F | 283 - MATRIXchem_GridComp/microphysics/TRAMP_rad.F | 665 - .../microphysics/TRAMP_setup.F | 1613 -- MATRIXchem_GridComp/microphysics/TRAMP_subs.F | 247 - .../microphysics/TRAMP_thermo_eqsam.F | 162 - .../microphysics/TRAMP_thermo_isorr2.F | 168 - MATRIXchem_GridComp/microphysics/isrpia.inc | 109 - .../microphysics/rundeck_opts.h | 21 - 338 files changed, 28 insertions(+), 190916 deletions(-) delete mode 100644 CARMAchem_GridComp/CARMA/CHANGES delete mode 100644 CARMAchem_GridComp/CARMA/Makefile delete mode 100644 CARMAchem_GridComp/CARMA/README delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/LICENSE delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/README delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.pl delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.y delete mode 100755 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/f90doc delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/htmling.pl delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/stmts.pl delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/typing.pl delete mode 100644 CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/utils.pl delete mode 100644 CARMAchem_GridComp/CARMA/doc/ChangeLog delete mode 100644 CARMAchem_GridComp/CARMA/doc/ChangeLog_template delete mode 100644 CARMAchem_GridComp/CARMA/doc/index.html delete mode 100755 CARMAchem_GridComp/CARMA/make-carma.csh delete mode 100755 CARMAchem_GridComp/CARMA/run-all.csh delete mode 100755 CARMAchem_GridComp/CARMA/run-carma.csh delete mode 100755 CARMAchem_GridComp/CARMA/run-regress.csh delete mode 100644 CARMAchem_GridComp/CARMA/source/base/Makefile delete mode 100644 CARMAchem_GridComp/CARMA/source/base/actdropl.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/adgaquad_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/adgaquad_types_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/bhmie.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/calcrs.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_constants_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_enums_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_globaer.h delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_precision_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carma_types_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carmaelement_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carmagas_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carmagroup_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carmasolute_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/carmastate_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/coagl.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/coagp.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/csolve.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/detrain.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/downgevapply.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/downgxfer.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/evap_ingrp.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/evap_mono.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/evap_poly.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/evapp.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/fractal_meanfield_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/freezaerl_koop2000.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/freezaerl_mohler2010.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/freezaerl_tabazadeh2000.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/freezdropl.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/freezglaerl_murray2010.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/gasexchange.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/growevapl.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/growp.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/gsolve.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/hetnucl.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/lusolvec_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/maxconc.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/melticel.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/microfast.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/microslow.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/mie.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/miess.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/newstate.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/newstate_calc.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/nsubsteps.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/pfastdmdt.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/pheat.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/planck.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/prestep.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/psolve.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/rhoice_heymsfield2010.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/rhopart.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupatm.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupbdif.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupbins.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupckern.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupcoag.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupgkern.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupgrow.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupnuc.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupvdry.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupvf.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupvf_heymsfield2010.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupvf_std.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/setupvf_std_shape.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/smallconc.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/step.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/sulfate_utils.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/sulfhetnucrate.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/sulfnuc.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/sulfnucrate.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/supersat.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/totalcondensate.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/tsolve.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/upgxfer.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vaporp.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_buck1981.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_goff1946.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_murphy2005.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vaporp_h2so4_ayers1980.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/versol.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/versub.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vertadv.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vertdif.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/vertical.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/wetr.F90 delete mode 100644 CARMAchem_GridComp/CARMA/source/base/zeromicro.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/Makefile delete mode 100644 CARMAchem_GridComp/CARMA/tests/atmosphere_mod.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_bc2gtest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_bcoctest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_coagtest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_drydeptest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_falltest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_growclrtest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_growintest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_growsubtest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_growtest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_history.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_inittest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_mietest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_nuc2test.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_nuctest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_pheattest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_scfalltest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_sigmadrydeptest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_sigmafalltest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_sulfatetest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_swelltest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_test.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_testutils.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/carma_vdiftest.F90 delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_bc2gtest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_bcoctest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_coagtest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_drydeptest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_falltest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_growclrtest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_growintest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_growsubtest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_growtest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_mietest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_nuc2test.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_nuctest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_pheattest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_scfalltest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_sigmadrydeptest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_sigmafalltest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_sulfatetest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_swelltest.pro delete mode 100644 CARMAchem_GridComp/CARMA/tests/read_vdiftest.pro delete mode 100755 CARMAchem_GridComp/CARMA/view-bench.csh delete mode 100644 CARMAchem_GridComp/CARMA_GridComp.F90 delete mode 100644 CARMAchem_GridComp/CARMA_UtilMod.F90 delete mode 100644 CARMAchem_GridComp/CARMAchem_GridCompMod.F90 delete mode 100644 CARMAchem_GridComp/CARMAchem_GridComp_ExtData.rc delete mode 100644 CARMAchem_GridComp/CARMAchem_GridComp_ExtData.yaml delete mode 100755 CARMAchem_GridComp/CARMAchem_MieRegistry.rc delete mode 100644 CARMAchem_GridComp/CARMAchem_Registry.rc delete mode 100644 CARMAchem_GridComp/CARMAchem_Registry.rc.MIXED delete mode 100644 CARMAchem_GridComp/CARMAchem_Registry.rc.SU delete mode 100644 CARMAchem_GridComp/CMakeLists.txt delete mode 100644 CARMAchem_GridComp/ut_CARMA.F90 delete mode 100644 GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.rc delete mode 100644 GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.yaml delete mode 100644 GAAS_GridComp/CMakeLists.txt delete mode 100644 GAAS_GridComp/GAAS_AerRegistry.rc delete mode 100644 GAAS_GridComp/GAAS_AodRegistry.rc delete mode 100644 GAAS_GridComp/GAAS_GridComp.rc delete mode 100644 GAAS_GridComp/GAAS_GridCompMod.F90 delete mode 100644 GAAS_GridComp/GAAS_GridComp_ExtData.rc delete mode 100644 GAAS_GridComp/GAAS_GridComp_ExtData.yaml delete mode 100644 GAAS_GridComp/GAAS_Mie.rc delete mode 100644 GAAS_GridComp/GAAS_Registry.rc delete mode 100644 GAAS_GridComp/LDE_Mod.F90 delete mode 100644 GAAS_GridComp/ana_lde.F90 delete mode 100755 GAAS_GridComp/ana_lde.py delete mode 100644 GAAS_GridComp/lde.rc delete mode 100644 GEOSachem_GridComp/AMIP.20C/GEOS_AChemGridComp.rc delete mode 100644 GEOSachem_GridComp/AMIP.20C/GEOSachem_ExtData.rc delete mode 100644 GEOSachem_GridComp/AMIP/GEOS_AChemGridComp.rc delete mode 100644 GEOSachem_GridComp/AMIP/GEOSachem_ExtData.rc delete mode 100644 GEOSachem_GridComp/AMIP/GEOSachem_ExtData.yaml delete mode 100644 GEOSachem_GridComp/CMakeLists.txt delete mode 100644 GEOSachem_GridComp/GACL_ConstantsMod.F90 delete mode 100644 GEOSachem_GridComp/GACL_DryDepositionMod.F90 delete mode 100644 GEOSachem_GridComp/GACL_EmissionsMod.F90 delete mode 100644 GEOSachem_GridComp/GACL_ReactionRatesMod.F90 delete mode 100644 GEOSachem_GridComp/GEOS_AChemGridComp.rc delete mode 100644 GEOSachem_GridComp/GEOS_AChemGridCompMod.F90 delete mode 100755 GEOSachem_GridComp/GEOSachem_ExtData.rc delete mode 100644 GEOSachem_GridComp/GEOSachem_ExtData.yaml delete mode 100644 GEOSachem_GridComp/GEOSachem_Registry.rc delete mode 100644 GEOSachem_GridComp/kpp/gas/Makefile_kpp_achem_gas delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas.def delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas.eqn delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas.kpp delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas.spc delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Function.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Global.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Hessian.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_HessianSP.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Initialize.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Integrator.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Jacobian.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_JacobianSP.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_LinearAlgebra.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Main.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Model.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Monitor.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Parameters.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Precision.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Rates.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Stoichiom.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_StoichiomSP.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Util.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Fun.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Hessian.f90 delete mode 100644 GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Jac_SP.f90 delete mode 100644 MAMchem_GridComp/CMakeLists.txt delete mode 100644 MAMchem_GridComp/ChangeLog delete mode 100644 MAMchem_GridComp/MAM3_DataMod.F90 delete mode 100644 MAMchem_GridComp/MAM7_DataMod.F90 delete mode 100755 MAMchem_GridComp/MAM7_ExtData.rc delete mode 100644 MAMchem_GridComp/MAM7_ExtData.yaml delete mode 100644 MAMchem_GridComp/MAML_CoagulationMod.F90 delete mode 100644 MAMchem_GridComp/MAML_DryDepositionMod.F90 delete mode 100644 MAMchem_GridComp/MAML_DryRemovalMod.F90 delete mode 100644 MAMchem_GridComp/MAML_GasAerosolExchangeMod.F90 delete mode 100644 MAMchem_GridComp/MAML_NucleationMod.F90 delete mode 100644 MAMchem_GridComp/MAML_OpticsMod.F90 delete mode 100644 MAMchem_GridComp/MAML_OpticsTableMod.F90 delete mode 100644 MAMchem_GridComp/MAML_SettlingMod.F90 delete mode 100644 MAMchem_GridComp/MAML_SizeMod.F90 delete mode 100644 MAMchem_GridComp/MAML_WetRemovalMod.F90 delete mode 100644 MAMchem_GridComp/MAM_BaseMod.F90 delete mode 100644 MAMchem_GridComp/MAM_BlackCarbonMod.F90 delete mode 100644 MAMchem_GridComp/MAM_CoagulationMod.F90 delete mode 100644 MAMchem_GridComp/MAM_ComponentsDataMod.F90 delete mode 100644 MAMchem_GridComp/MAM_ConstituentsDataMod.F90 delete mode 100644 MAMchem_GridComp/MAM_DryRemovalMod.F90 delete mode 100644 MAMchem_GridComp/MAM_DustMod.F90 delete mode 100644 MAMchem_GridComp/MAM_GasAerosolExchangeMod.F90 delete mode 100644 MAMchem_GridComp/MAM_NucleationMod.F90 delete mode 100644 MAMchem_GridComp/MAM_OrganicCarbonMod.F90 delete mode 100644 MAMchem_GridComp/MAM_SeasaltMod.F90 delete mode 100644 MAMchem_GridComp/MAM_SizeMod.F90 delete mode 100644 MAMchem_GridComp/MAM_SulfateMod.F90 delete mode 100644 MAMchem_GridComp/MAM_WetRemovalMod.F90 delete mode 100644 MAMchem_GridComp/MAMchem_GridComp.rc delete mode 100644 MAMchem_GridComp/MAMchem_GridCompMod.F90 delete mode 100644 MAMchem_GridComp/MAMchem_Registry.rc delete mode 100644 MAMchem_GridComp/README delete mode 100644 MAMchem_GridComp/TODO delete mode 100644 MAMchem_GridComp/mam_optics_calculator.F90 delete mode 100755 MAMchem_GridComp/mam_optics_calculator.csh delete mode 100644 MAMchem_GridComp/mam_optics_calculator.py delete mode 100644 MAMchem_GridComp/mam_optics_calculator.rc delete mode 100644 MAMchem_GridComp/microphysics/abortutils.F90 delete mode 100644 MAMchem_GridComp/microphysics/cam_logfile.F90 delete mode 100644 MAMchem_GridComp/microphysics/chem_mods.F90 delete mode 100644 MAMchem_GridComp/microphysics/constituents.F90 delete mode 100644 MAMchem_GridComp/microphysics/infnan.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_amicphys.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_calcsize.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_coag.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_data.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_gasaerexch.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_initialize_data.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_newnuc.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_rename.F90 delete mode 100644 MAMchem_GridComp/microphysics/modal_aero_wateruptake.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_aero.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_asect.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_asecthp.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_cloud.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_constants.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_gas.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_kind.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_data_mosaic_main.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_astem.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_box_aerchem.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_cam_init.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_ext.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_init.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_init_aerpar.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_lsode.F90 delete mode 100644 MAMchem_GridComp/microphysics/module_mosaic_support.F90 delete mode 100644 MAMchem_GridComp/optics/CMakeLists.txt delete mode 100644 MAMchem_GridComp/optics/gads.py delete mode 100755 MAMchem_GridComp/optics/mam7-optics.lut.batch.csh delete mode 100644 MAMchem_GridComp/optics/mam7-optics.lut.py delete mode 100644 MAMchem_GridComp/optics/mie.F90 delete mode 100644 MAMchem_GridComp/optics/miev/ErrPack.f delete mode 100644 MAMchem_GridComp/optics/miev/MIEV.doc delete mode 100644 MAMchem_GridComp/optics/miev/MIEV0.F delete mode 100644 MAMchem_GridComp/optics/radiation.py delete mode 100755 MAMchem_GridComp/optics/tests/ut_gads.py delete mode 100644 MAMchem_GridComp/optics/tests/ut_mie.F90 delete mode 100755 MAMchem_GridComp/optics/tests/ut_mie.py delete mode 100644 MATRIXchem_GridComp/CMakeLists.txt delete mode 100644 MATRIXchem_GridComp/ChangeLog delete mode 100644 MATRIXchem_GridComp/MATRIXchem_GridComp.rc delete mode 100644 MATRIXchem_GridComp/MATRIXchem_GridCompMod.F90 delete mode 100644 MATRIXchem_GridComp/MATRIXchem_Registry.rc delete mode 100644 MATRIXchem_GridComp/README delete mode 100644 MATRIXchem_GridComp/microphysics/CONST.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_actv.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_coag.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_config.F90 delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_depv.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_diam.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_dicrete.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_drv.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_eqsam_v03d.F90 delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_init.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_isocom2.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_isofwd2.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_isorev2.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_matrix.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_nomicrophysics.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_npf.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_param.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_quad.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_rad.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_setup.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_subs.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_thermo_eqsam.F delete mode 100644 MATRIXchem_GridComp/microphysics/TRAMP_thermo_isorr2.F delete mode 100644 MATRIXchem_GridComp/microphysics/isrpia.inc delete mode 100644 MATRIXchem_GridComp/microphysics/rundeck_opts.h diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3a8ecfb7..522ab7e3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,10 +8,6 @@ # The Aerosol Team is CODEOWNER of some directories along with Chem Gatekeepers DNA_GridComp/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers -GAAS_GridComp/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers -GEOSachem_GridComp/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers -MAMchem_GridComp/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers -MATRIXchem_GridComp/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers Shared/Chem_Base/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers Shared/Chem_Shared/ @GEOS-ESM/aerosol-team @GEOS-ESM/chemistry-gatekeepers diff --git a/.gitignore b/.gitignore index 57a6a953..ab14a897 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,18 @@ GEOSCHEMchem_GridComp/geos-chem@ /@StratChem/ /StratChem/ /StratChem@/ +/@MAM/ +/MAM/ +/MAM@/ +/@MATRIX/ +/MATRIX/ +/MATRIX@/ +/@CARMA/ +/CARMA/ +/CARMA@/ +/@GAAS/ +/GAAS/ +/GAAS@/ +/@ACHEM/ +/ACHEM/ +/ACHEM@/ diff --git a/CARMAchem_GridComp/CARMA/CHANGES b/CARMAchem_GridComp/CARMA/CHANGES deleted file mode 100644 index fa2d0aaa..00000000 --- a/CARMAchem_GridComp/CARMA/CHANGES +++ /dev/null @@ -1,417 +0,0 @@ -carma PRC 10/17/2007 -- add SSFALLTEST to Makefile for offline/SLOD Seasalt falltest - passing rh and rhFlag from SLOD through. -- Also changed sense of FALLTEST a little by letting model compute - own fall velocity and then output bin 15 (vf ~ 1 cm/s) to falltest.txt - -carma PRC 10/9/2007 -- added hooks to pass relative humidity (assumed scaled 0 - 1) from - hostmodel through to CARMA; check value of rhFlag and in setupvf - adjust the fall velocity as though we deal with either - Fitzgerald (rhFlag = 1) or Gerber (rhFlag = 2) parameterization - for swelling of seasalt aerosols. If rhFlag = 0, do nothing. - -carma PRC 10/4/2007 -- first crack at merging with GEOS, initial commit to sourcemotel -- mv SLOD_GridComp.F90 -> SLOD.F90 -- mv SLOD_GridCompCoupler.F90 -> SLOD_Coupler.F90 -- mv SLOD_GridComp.h -> SLOD.h -- mv carma_main.F90 -> carma_main_mod.F90 -- mv Chem_Mod.F90 -> SLOD_ChemMod.F90, used only in SLOD -- make carma_main_mod a module, included in SLOD_Coupler - -carma_0r30 PRC 8/22/2007 -- extensive comments to SLOD and some rearrangement, add SLOD_GridComp.h -- add carma_bins.F90, which extracts the bin creation from setupbins -- change how size bins set up in SLOD, carma_create, and setupbins to use - carma_bins - -carma_0r29 PRC 8/21/2007 -- Add the SLODfluxout to the SLOD and put some code in SLOD_GridCompCoupler - to compute output fluxes. -- Note: this may be an outstanding problem, there is an error in how the - radii are provided in the SLOD vs. how defined in CARMA, so small - error in how fluxes, e.g., are reported. - -carma_0r28 PRC 8/16/2007 -- I want to pass r/rlow/rup or rmin/rmrat from host model - -carma_0r27 JAS 8/15/2007 -- Changed COAGTEST output to mimic FALLTEST output -- Added IDL readers (read_falltest.pro and read_coagtest.pro) for the output - from these tests -- Added IDL readers to make tar in Makefile -- Added cvsnotes.txt to make tar in Makefile -- rm carma.p and *.out in make clean in Makefile -- rm falltest.txt and coagtest.txt in make clean in Makefile - -carma_0r26 PRC/JAS 8/15/2007 -- generalize code so it works in g95/ifort/gfortran by - (i) making locally generated arrays defined allocatable or by passed dimension - (ii) changing output filenames for, e.g., LUNORAD, etc. - (iii) fixing order of precedence in calculation of coagpe in coagp.F90 -- also correct float underflow by checking pc against FEW_PC in coagp & coagl -- fix bounds error on printing of "re" in setupvf -- fix bounds error in metric-ization of dkx & dky ... this is significant - as it differs from CARMA_2.2 ... dkx and dky now have NZ levels (not NZP1) -- remove old FALLTEST (using CARMA definition of sigma levels) -- rename FALLTESThost tag to FALLTEST -- move i/o for FALLTEST to SLOD, consistent with COAGTEST -- now internal to CARMA: - (i) FALLTEST sets ifall = 1 and fixed fall velocity of 0.01 m s-1 - (ii) COAGTEST sets do_vtran false, do_coag true, and picks a fixed - coagulation kernel - -carma_0r25 PRC/JAS 8/15/2007 -- intermediary tag - -carma_0r24 JAS 8/10/2007 - -- Trying to check in new code and tag it properly. -- Here's a new comment that I'm going to commit and then try to move - tag carma_0r24 to contain this new comment - -JAS 8/10/2007 - -I'm having problems tagging and committing. These comments in this file -are what I think I'm doing. They do not reflect what CVS is doing to the -$#?! code. I guess it's all user error in the end, so some day the CHANGES -file will hopefully represent the code accurately. - -carma_0r22 JAS 8/10/2007 - -- Remove hacks on cvert_tbnd and cvert_bbnd in vertical - -carma_0r21 JAS 8/9/2007 - -- Added -DCOAGTEST to Makefile. This runs coagulation of initiallly mono- - disperse aerosol as presented in Figure 2 of: - - Jacobson et al., Atmospheric Environment 28, 1327-1338, 1994 - -- This test generates an output file called coagtest.txt. The four columns - contain the time in seconds, the particle radii in meters, the number - concentration (m**-3), and dN/dlogD (m**-3). Comparison to Jacobson's - figure is a little difficult because we do not know exactly what his - bin edges are for the calculation of the various particle size - distributions. If you put 10**12 m**-3 in the first bin of r = 3 nm - (d = 6 nm), then you get roughly the same size distribution given in the - paper for volume ratio spacing of 2, which is slightly more diffusive than - the analytical expression by Smoluchowski. I say the distribution is - roughly the same because it's rather difficult to figure out where a bin - diameter goes exactly on a log axis. - - Here are some numbers for comparison at t = 12 h. - - r = 3.0 nm, N = 5.67e9 m**-3, dN/dlogD = 5.75e10 m**-3 - 3.8 8.35e9 8.47e10 - 4.8 1.31e10 1.33e11 - 6.0 1.72e10 1.74e11 - 7.6 1.63e10 1.66e11 - 12.0 2.74e9 2.78e10 - 15.1 3.43e8 3.48e9 - 19.0 1.71e7 1.74e8 - 24.0 3.42e5 3.47e6 (roughly the x-int in Fig. 2) - -- SLOD_GridComp: add dr to calc dN/dlogD for coag test - add endtime, ntime for coag test - add ibun to refer to bin inside of chem bundle - change r(1,1) to 50 nm for fun - change bin mixing ratios in vertical test to be ~ 1 ppm - (instead of 1 kg / m**3) - commented output of levels, altitudes, and number - concentrations - added all sorts of code to do the coag test and write - out coagtest.txt - added output of initial and final mixing ratios of - particle bins -- init: set default value of do_coag to true - set all switches appropriately if doing the coag test -- initaer: removed legacy comments - added comment about NZ and top and coordinates; should talk to Pete - about the sense of fluxes that he mentions below in 0r20 -- setupaer: switch to const coag kernels if doing the coag test -- vertical: moved comments from CPP directives to elminate warning messages - during compile - -carma_0r20 PRC 8/8/2007 -- modify vertical, vertadv, versol routines: - in versol: change sense of fluxes so that ftop always goes with level NZ - and fbot always goes with level 1 (regardless of I_SIG or I_CART) - in vertical: impose definition of cvert_Xbnd /= 0 - in vertadv: add discontinuity test - as a hack, don't like linear assumptions in edge layers so - impose vertadvu(d) = vtrans as appropriate for 1,2 & NZ-1, NZ -- modify initatm for have data statements in g_ll_sig for 28, 32, and 72 - layer models, selected now if not doing hostmodel and km is one of those -- modify initaer initial particle distribution for not doing hostmodel -- modify init to have default timestep of 1800 sec. and set aerosols to have - I_FIXED_CONC boundary condition -- add diagnostic tests for -DFALLTEST & -DFALLTESThost to Makefile and - carma_main.F90, SLOD_GridCompCoupler.F90, SLOD_GridComp - - -carma_0r19 PRC 8/2/2007 -- fix a nagging precision problem in vertadv -- begin to implement -DFALLTEST definition in Makefile and beyond - -carma_0r18 PRC 8/1/2007 -- something went wrong in the merge and I had to re-add JAS code - added on his branch (coagl.F90 etc) -- light editing - -carma_0r17 PRC/JAS 8/1/2007 -- merge carma_0r15_branch with carma_0r16 -- coag is implemented, long live coag! - -carma 0r16 PRC 6/28/2007 -- some bug fixes in carma_types_mod, initatm -- correct sense of fall velocity in sigma coordinates -- add comments to versol -- add cvsnotes.txt document to cheat some notes - -carma_0r15_branch JAS 7/30/2007 - -- Removed temporary code used for coag testing - -carma_0r15_branch JAS 7/27/2007 - -- Redid coag test of Jacobson et al 1994. Distribution matches. -- Conserves mass, too - -carma_0r15_branch JAS 7/20/2007 - -- switched to single precision -- started setting up coag test to compare to Jacobsen et al. -- started passing n (the hostmodel time index) in case it's necessary. -- calling init every step, so that atm and particle grid get assigned - correctly. Ugh! -- fixed weirdness in setupckern. first time through it ran fine, but on - subsequent runs, the data would not reload into the local arrays. Thus, - when the data were rescaled to the model units, this rescaling happened - again and again each time, causing data_e to take a log of a negative - number and data_r to keep shrinking. Now, there are two copies of these - local arrays: orig_e and orig_r and data_e and data_r. The orig_* - versions never get modified, so the the scaled data_* versions are correct. - -carma_0r15_branch JAS 7/20/2007 -- fixed qa => q_array mapping in SLOD_GridCompCoupler - qa( nbeg...nend ) => q_array( ibin, ielem ) - use this for the index conversion: - nbeg + ( ielem - 1 ) * NBIN + ibin - 1 ) -- changed some key vars to all caps, e.g. NX, NY, NZ - -carma_0r15_branch JAS 7/20/2007 - -- Coagulation works qualitatively. Stiil need quantitative check. -- Added prestep and smallconc -- Modifed the following files: -Makefile: -- added prestep and smallconc -SLOD_GridComp: -- changed dtime and initial mass mixing ratios for coag test -carma_main: -- converted pc to #/m3 for jasofil.p -coagl: -- added local LUNOJAS for writing to jasofil.p -csolve: -- extra line, so I removed the change -init: -- use dtime from hostmodel if do_hostmodel -microslow: -- added local LUNOJAS -- removed/changed excessive ! -newstate: -- added local LUNOJAS -step: -- uncomment call prestep - -!-- - -carma_0r15_branch JAS 7/10/2007 - -- NSOLUTE should be known by CARMA only; hardwiring for now in carma_main -- Not passing q from SLOD anymore; will make it inside CARMA for coag test -- comment do_vtran = .true. in init - - -carma_0r15_branch JAS 7/10/2007 - -- Moved around some argument lists for readability in: - SLOD_GridComp.F90 - SLOD_GridCompCoupler.F90 - carma_main.F90 - - -carma_0r15_branch JAS 7/9/2007 -- SLOD_GridComp.F90 - SLOD_GridCompCoupler.F90 - carma_main.F90 - - SLOD now handles multiple elements so I can start testing coag - - SLOD does not need to know about NSOLUTE - - Argument lists changed to reflect these changes - - -carma_0r15_branch JAS 6/29/2007 -- Makefile: - - commented #CPPFLAGS= -DDEBUG - - added subroutine setupckern.F90 - - added subroutine setupcoag.F90 -- SLOD_GridComp.F90: - - commented debug output -- carma_globaer.h and carma_types_mod: - - rearranged code order in carma_types_mod.F90 and carma_globaer.h to more - accurately reflect order of vars in legacy globaer.h. Sorry, Pete. This - seems like a lot of work and change for nothing, but I was going nuts - using the legacy globaer.h as a template when adding new stuff. -- carma_types_mod.F90: - - changed type carmakernel to carmakerneltype - - changed rmu and thcond to be type carmakerneltype so that these properties - can have horizontal variability just like vf. - - added ckernel and pkernel as vars of type carmakerneltype -- initatm.F90: - - changed rmu and thcond to point at correct column of carmakerneltype - in three of the many possible atmospheres (g_cart_cart, g_cart_sig, and - g_ll_sig) - - corrected horizontal metrics for g_ll_cart and made a comment -- setupaer.F90: - - change icoag so that all coag kernels would be calculated - - add comment explaining some icoag funkiness - - add calls to setupckern and setupcoag -- setupvf.F90: - - update to reflect new declaration of rmu - - add some comments to document equations - - clean up literal constants and parentheses -- added microslow.F90, coagl.F90, coagp.F90, and csolve.F90 -- code builds and runs -- need to test it - - -carma 0r15 PRC 6/12/2007 -- implemented a way to request host model to transfer meteorology - to CARMA; SLOD passes parameters as optional arguments to call - carma_main and optional logical "do_hostmodel"; carma_main passes - to carma_create which does some light checking of optional arguments - for consistency. Currently, SLOD does not pass grid type igridv or - igridh, which are hard set in call to carma_create if doing hostmodel, - setup as if for sig/LL run -- modified initatm to accept the do_hostmodel in setting grids. Currently - only the g_cart_cart, g_cart_sig, and g_ll_sig methods implemented. - Others require map projection code but are less likely to find use. -- the host model calling fixes the meteorology, but is currently not - really set up for gases and particles. You need to know something - about the particle properties (rmass, specifically) to map q to pc - and this would need to be consistent with CARMA. At the moment, if - I want the host model to pass q I need also to pass r and rhop, but - I don't (a) turn off reinitialization of pc in initaer and (b) don't - enforce r and rhop consistency in CARMA setup routines. Same would - go for gc. -- A note about the vertical grid. For sigma vertical I have forced/changed - the sense of sigma from the original carma implementation. Instead of - sigma = (p - ptop) / (psurf-ptop) - I use - sigma = p / psurf - As a practical matter I'm not sure how much this matters for hostmodel - calls, but the former way enforced sigma = 0 at the model top, which - mucked up with the logarithmic definition of the mid-point pressure. - Furthermore, I turn off the call to hydrostat. I suspect that the - temperature profile I pass from the host model is simply not in balance - in this coordinate system, but first efforts to check that screw up - the temperature profile. A couple of questions: what is hydrostat - really doing? what is the ptc really mean? - -carma_0r14 PRC 5/30/2007 -- note I skip 0r13 to piss JAS off -- bug fix in vaporp -- bug fix to apply metrics in initatm - -carma_0r12 PRC 5/24/2007 -- implement initaer & initgas (vaporp, supersat) -- completes initnew except for coag and growth kernels in setupaer -- other notes from 0r10 still stand... - o need to clean up the type definition so things are in order with - comments and make sense - o need to clean up carma_globaer.h in much the same way - o pointer definitions in carma_globaer.h should be initialized to point - at null() - - -carma_0r11 PRC 5/23/2007 -- implement JAS kernel type in carma_types_mod. My implementation is - somewhat different than JAS wanted. Here each relevant is a type - carmakernel and you allocate data2d, data3d, etc., as neccessary for - the particular variable -- use the carmakernel type for vf, bpm, and re, and so implement in - setupvf and vertical -- reverted vertical, versol, vertdif, vertadv to all require the carma - object. This changes the passed arguments -- update some units information -- other notes from 0r10 still stand... - o need to clean up the type definition so things are in order with - comments and make sense - o need to clean up carma_globaer.h in much the same way - o pointer definitions in carma_globaer.h should be initialized to point - at null() - - -carma_0r10 PRC 5/22/2007 -- Things to do at this point: - o implement Jamie's kernel ideas - o need to clean up the type definition so things are in order with - comments and make sense - o need to clean up carma_globaer.h in much the same way - o pointer definitions in carma_globaer.h should be initialized to point - at null() - o note that variables dimensions NXYZ have been reconfigured NX,NY,NZ - o revisit versol, vertadv, and vertdiff to pass the object instead of - extraneous garbage -- introduce setupaer routine, much of definitions and all calls are commented - out for now -- add to secondary model variable block in type and globaer - -carma_0r9 PRC 5/21/2007 -- init now calls through to initatm/g_cart_cart -- mods in some places to consistency in type def, etc. - -carma_0r8 PRC 5/21/2007 -- I introduce prtsep and setuperr routines -- Turn on call to init.F90 -- Make CARMA_SlodGridComp consistent with example problem set up in CARMA 2.2 - e.g., NGROUP, NELEM, etc. -- init overwrites logical definitions in carma_create (in the future, this will - want to be changed to initialize from a resource file) -- now will generate carma.p output file; pipe all other outputs to /dev/null -- not yet implemented next levels of init or outprt routines - -carma_0r7 PRC 5/18/2007 -- move hard settings (for now) into carma_create; these will be things eventually - specified in a resource file from the host model (e.g., do_vtran, mapping arrays) -- introduce model options & control section of globaer, which defines most - of growth/coag arrays and lots of logical flags -- change sense of associations in carma_globaer to be pointers to carma object - -carma_0r6 PRC 5/14/2007 -- more clean up of type -- introduce vertdif routine back in -- plug everything in and activate step/newstate -- introduce some flags into type (e.g., do_vtran) and initialize in carma_globaer.h - -carma_0r5 PRC 5/14/2007 -- clean up carma_globaer.h definition -- clean up codes/error handling in carma_types_mod -- get the vertical routines updated to handle carma object - -carma_0r4 PRC 5/11/2007 -- mods to pass q into carma_main, create & destroy pc, rhoa, etc. in carma type -- introduce SINGLE/DEBUG CPP flags into Makefile and code parts - -carma_0r3 PRC 5/11/2007 -- mods to SLOD_GridCompCoupler and carma_main to pass t, rhoa, delp, q variables - -carma_0r2 PRC 5/11/2007 -- mods to work on SLOD -- SLOD calls CARMA like a column model - -carma_0r1 JAS 05/10/2007 --Initial check-in of CARMAGEOS - diff --git a/CARMAchem_GridComp/CARMA/Makefile b/CARMAchem_GridComp/CARMA/Makefile deleted file mode 100644 index b9c8b0cf..00000000 --- a/CARMAchem_GridComp/CARMA/Makefile +++ /dev/null @@ -1,164 +0,0 @@ -# Yippee! This is my very own makefile. -# Jamison A. Smith, AKA JAS -# April 26, 2007 - -FORTRAN = ifort -#FORTRAN = pgf90 -#FORTRAN = pathf90 -#FORTRAN = gfortran -#FORTRAN = g95 -#FORTRAN = xlf90 - -F90DOC = ../../bin/f90doc-0.4.0/f90doc - -PACKAGE = CARMA -TGZ = CARMA.tar - -FFLAGS = -#FFLAGS += -DSINGLE # for single precision -#FFLAGS += -DDEBUG # for debug print statements - - -# Add options for the Intel Fortran compiler. -ifeq ($(FORTRAN),ifort) -# FFLAGS += -ftz -fp-model precise - FFLAGS += -fp-model precise - - # Work around for an incompatibility with some versions of ifort and OSX. -# FFLAGS += -use-asm - - # Debug options. - FFLAGS += -g -O0 -traceback -fp-stack-check -check bounds -check uninit -fpe0 -ftrapuv - - # Open/MP - FFLAGS += -qopenmp - - # The no_pie flags also the executable to work with idb. - LDFLAGS = $(FFLAGS) -no_pie -endif - -# Add options for the Portland Group compiler. -ifeq ($(FORTRAN),pgf90) - FFLAGS += - - # Debug options. -# FFLAGS += -g -O0 -Mbounds - - # Open/MP -# FFLAGS += -mp - - LDFLAGS = $(FFLAGS) -endif - -# Add options for the g95 compiler. -ifeq ($(FORTRAN),g95) -# FFLAGS += -fzero -ffree-line-length-huge - FFLAGS += -ffree-line-length-huge - - # Debug options. -# FFLAGS += -g -fbounds-check -ftrace=full - - # Open/MP - # - # NOTE: g95 does not support Open/MP directives. This will cause one - # test (carma_test) to fail to link. - - LDFLAGS = $(FFLAGS) -endif - -# Add options for the IBM XL Fortran compiler. -# -# NOTE: It doesn't support float to zero. -ifeq ($(FORTRAN),xlf90) - FFLAGS += -q64 -qarch=auto -qspillsize=2500 -g -qfullpath - - # Debug options. - FFLAGS += -qinitauto=7FF7FFFF -qflttrap=ov:zero:inv:en -C - - # Open/MP -# FFLAGS += -qsmp=omp -# FFLAGS += -qsmp=omp:noopt - - LDFLAGS = $(FFLAGS) -endif - - -# Overridning the implicit rules, which would try to use m2c to -# create the .mod. -%.mod : %.o ; -%.o : %.F90 ; -%.html : %.F90 ; $(F90DOC) -cs $< - -# Add the directories where the source files are located. -VPATH := ../../source/base ../../tests - -# These makefiles have the object lists and dependence information -# for the respective components. -# -# NOTE: In the future it might be nice to generate this dependency -# try automatically. -include ../../source/base/Makefile -include ../../tests/Makefile - -# Rules for each executable that could be build. -CARMA.exe : $(CARMA_OBJ) carma_test.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o CARMA.exe carma_test.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -FALLTEST.exe : $(CARMA_OBJ) carma_falltest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -no_pie -o FALLTEST.exe carma_falltest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -SIGMAFALLTEST.exe : $(CARMA_OBJ) carma_sigmafalltest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o SIGMAFALLTEST.exe carma_sigmafalltest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -COAGTEST.exe : $(CARMA_OBJ) carma_coagtest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o COAGTEST.exe carma_coagtest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -BCOCTEST.exe : $(CARMA_OBJ) carma_bcoctest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o BCOCTEST.exe carma_bcoctest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -BC2GTEST.exe : $(CARMA_OBJ) carma_bc2gtest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o BC2GTEST.exe carma_bc2gtest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -GROWTEST.exe : $(CARMA_OBJ) carma_growtest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o GROWTEST.exe carma_growtest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -GROWCLRTEST.exe : $(CARMA_OBJ) carma_growclrtest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o GROWCLRTEST.exe carma_growclrtest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -GROWINTEST.exe : $(CARMA_OBJ) carma_growintest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o GROWINTEST.exe carma_growintest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -GROWSUBTEST.exe : $(CARMA_OBJ) carma_growsubtest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o GROWSUBTEST.exe carma_growsubtest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -INITTEST.exe : $(CARMA_OBJ) carma_inittest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o INITTEST.exe carma_inittest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -MIETEST.exe : $(CARMA_OBJ) carma_mietest.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o MIETEST.exe carma_mietest.o carma_testutils.o $(CARMA_OBJ) -NUCTEST.exe : $(CARMA_OBJ) carma_nuctest.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o NUCTEST.exe carma_nuctest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -NUC2TEST.exe : $(CARMA_OBJ) carma_nuc2test.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o NUC2TEST.exe carma_nuc2test.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -PHEATTEST.exe : $(CARMA_OBJ) carma_pheattest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o PHEATTEST.exe carma_pheattest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -SWELLTEST.exe : $(CARMA_OBJ) carma_swelltest.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o SWELLTEST.exe carma_swelltest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -VDIFTEST.exe : $(CARMA_OBJ) carma_vdiftest.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o VDIFTEST.exe carma_vdiftest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -DRYDEPTEST.exe : $(CARMA_OBJ) carma_drydeptest.o carma_testutils.o - $(FORTRAN) $(LDFLAGS) -o DRYDEPTEST.exe carma_drydeptest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -SIGMADRYDEPTEST.exe : $(CARMA_OBJ) carma_sigmadrydeptest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o SIGMADRYDEPTEST.exe carma_sigmadrydeptest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -SCFALLTEST.exe : $(CARMA_OBJ) carma_scfalltest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o SCFALLTEST.exe carma_scfalltest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) -SULFATETEST.exe : $(CARMA_OBJ) carma_sulfatetest.o carma_testutils.o atmosphere_mod.o - $(FORTRAN) $(LDFLAGS) -o SULFATETEST.exe carma_sulfatetest.o carma_testutils.o atmosphere_mod.o $(CARMA_OBJ) - -# Compile everything. -all : FALLTEST.exe COAGTEST.exe BCOCTEST.exe BC2GTEST.exe GROWTEST.exe INITTEST.exe \ -MIETEST.exe NUCTEST.exe SIGMAFALLTEST.exe SWELLTEST.exe VDIFTEST.exe DRYDEPTEST.exe \ -SIGMADRYDEPTEST.exe PHEATTEST.exe SCFALLTEST.exe CARMA.exe GROWSUBTEST.exe \ -SULFATETEST.exe NUC2TEST.exe GROWINTEST.exe GROWCLRTEST.exe - -# Compile all of the documentation. -doc : $(CARMA_DOC) $(TEST_DOC) - -clean: - /bin/rm -f *.o *.mod *.exe *.txt *.html - -# The Mac creates .DS_Store files that we don't want in the tar file, so -# exclude them. -tar: - tar --directory ../.. -cvf $(TGZ) --exclude .DS_Store --exclude .svn \ - Makefile make-carma.csh run-carma.csh README run-regress.csh view-bench.csh run-all.csh \ - source tests bin doc/ChangeLog doc/ChangeLog_template doc/index.html diff --git a/CARMAchem_GridComp/CARMA/README b/CARMAchem_GridComp/CARMA/README deleted file mode 100644 index 5df1908b..00000000 --- a/CARMAchem_GridComp/CARMA/README +++ /dev/null @@ -1,122 +0,0 @@ -This project contains files to build version 3.0 of the Community Aerosol and -Radiation Model for Atmospheres (CARMA) that is based off of the 2.3 release, -but has been ported to Fortran 90 and repackaged so that it can be used as a -cloud and aerosol physics package embedded into GCMs. The project consists of -4 components that are each located in their own subdirectories: - - - bin : the F90doc documentation generation tool - - doc : the change log and HTML based documentation - - source : the CARMA microphysics layer - - tests : the test routines & benchmark results - -Two script files have been provided to build and run the model or its -components. To build carma and the test cases, issue the following command -rom the root directory: - - make-carma.csh - -This will build all the files in a subdirectory called build/carma. To run -a sample carma model, execute the following command from the root directory: - - run-carma.csh - -This will copy the CARMA.exe executable to the directory run/carma and then -will execute it with all output going to the run/carma directory. The -dependency hierarchy is set up in the make files, so rebuilding should only -rebuild what is necessary. There are only two #defines that can be set in the -makefile to control the build. One specifies the precision (SINGLE) and the other -is used to build a version with extra debug information (DEBUG). The scripts can -also be used to build individual executables. For example, to build and run the -NUCTEST test routine and to have the run performed in a directory named nuctest -(this part is optional) execute: - - make-carma.csh NUCTESTexe - run-carma.csh NUCTEST.exe - -NOTE: bash and ksh users will need to use export rather than setenv. - -Plotting routines have been created for each test in IDL. If you set CARMA_IDL -to be the path to your copy of IDL, then IDL should be launched automatical, and -the messages will indicate the program that you should run. On the Mac, you would -set a path like: - - setenv CARMA_IDL /Applications/itt/idl/idl80/bin/idl - -After exectuing - - run-carma.csh NUCTEST.exe - -you should see an IDL prompt that looks like this: - - - ** Finished at Wed Jul 13 20:41:11 MDT 2011 ** - - Running the IDL analysis routine read_nuctest.pro - To run the test, in IDL you need to type the command: .r read_nuctest.pro - To exit IDL, type the command: exit - - IDL Version 8.0, Mac OS X (darwin x86_64 m64). (c) 2010, ITT Visual Information Solutions - Installation number: 95183-2518. - Licensed for use by: ACD:acd-license:Linux.FL - - IDL> - -Type: - - .r read_nuctest.pro - -and you should get a plot generated showing the results of the test. - - -Documentation of the code is generated automatically by the make scripts using -the program f90doc, which is located in the bin directory. The generated -documentation is stored as html files in the directory doc/f90doc. To start -browsing the documentation, open the file doc/index.html. - - -The model supports OPEN/MP, which will allow the model to use multiple -processors if the model is called with multiple columns. You need to add -a compiler directive to enable OPEN/MP (-openmp for ifort) and you need -to specify the number of threads when you run. The run script uses the -CARMA_THREADS flag to determine how many threads to allow during execution. -The dault is 1 thread. To run with 4 threads issue the command - - setenv CARMA_THREADS 4 - -before using the run script. - -Several test cases have been developed to show how the CARMA model -can be used and to test that the model physics is performing correctly. The -source code for these tests are located in the tests subdirectory. - -To run all of the tests interactively, use the command - - run-all.csh - -To run all of the tests in the background and compare the results to -benchmark results, use the command - - run-regress.csh - -The benchmarks are stored in tests/bench and were created on a Mac -using the Intel Fortran compiler. You may get slightly different -results on other platforms or with other compilers. - - -The entire project can be put into a tar file, using the command - - make-carma.csh tar - -This will create a tar file called CARMA.tar in the current build directory, -which defaults to build/carma. NOTE: This tar file does not contain the -contents of the build, doc or run directories since they are -products of the make and run scripts. - -CARMA has a ChangeLog in the doc directory. It contains the revision history -of CARMA. When changes are made, please prepend the ChangeLog with a -description of the change based upon filling out the ChangeLog_template -which is also stored in the doc directory. - - -Chuck Bardeen, Pete Colarco and Jamie Smith -Jul-2011 diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/LICENSE b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/LICENSE deleted file mode 100644 index 63d8ce9b..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -f90doc is distributed according to the MIT License; see also - http://www.opensource.org/licenses/mit-license.php - -Copyright (c) 1997-2006 Erik D. Demaine - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/README b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/README deleted file mode 100644 index fdd0f1b2..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/README +++ /dev/null @@ -1,36 +0,0 @@ -This is f90doc version 0.4.0, a documentation tool for Fortran 90. For -more information (e.g., documentation), see - - http://theory.lcs.mit.edu/~edemaine/f90doc - -or contact Erik Demaine (edemaine@mit.edu). Comments, suggestions, -criticisms, and bug reports go to this e-mail address. If you modify f90doc or -use it in a serious way, please contact me (I'd be interested). - -COPYRIGHT - -f90doc is freeware. If you use it in a research or commercial project, you -must acknowledge the software and its author. I would also appreciate it if -you contact me -- I'd like to know how f90doc is used. If you base code on -f90doc, you must acknowledge this. Again, please let me know if you think your -changes would be at all useful to the rest of the world (even if you are not -willing to share it, the ideas may be useful). - -This information must accompany any copy of f90doc. - -INSTALLATION - -You shouldn't have to compile anything. You can put the file f90doc in -a more accessible place, but the .pl files have to be in the same directory. -Alternatively, you can create a symlink to the real f90doc, where the .pl -files are held. For example, - - ln -s /usr/local/lib/f90doc-0.4.0/f90doc /usr/local/bin/f90doc - -If you don't have a command /usr/bin/env, you'll need to replace the first line -of f90doc with - - #!/path/to/perl5/bin/perl -w - -Otherwise, Perl version 5.003 or higher must be the first program called "perl" -in your path. diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.pl b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.pl deleted file mode 100644 index 3e831337..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.pl +++ /dev/null @@ -1,793 +0,0 @@ -$yysccsid = "@(#)yaccpar 1.8 (Berkeley) 01/20/91 (Perl 2.0 12/31/92)"; -#define YYBYACC 1 -#line 2 "expr_parse.y" -package expr_parse; - -;# On failure, print out this as the line we were working on. -$expr_parse::line = ""; - -;# Portion of line left to parse -$expr_parse::left = ""; -#line 12 "y.tab.pl" -$COMMA=257; -$LPAREN=258; -$RPAREN=259; -$NOT=260; -$OR=261; -$AND=262; -$EQV=263; -$NEQV=264; -$COMPARISON=265; -$DBLSLASH=266; -$PERCENT=267; -$PLUS=268; -$MINUS=269; -$UPLUS=270; -$UMINUS=271; -$ASTERIK=272; -$SLASH=273; -$DBLASTERIK=274; -$CONST=275; -$NAME=276; -$COLON=277; -$LARRAY=278; -$RARRAY=279; -$EQUALS=280; -$YYERRCODE=256; -@yylhs = ( -1, - 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 5, 5, 5, 5, 5, 4, 4, 7, 6, - 6, 3, 3, 3, 8, 8, 9, 9, 10, 10, - 10, 12, 11, 11, 11, 11, -); -@yylen = ( 2, - 1, 2, 1, 1, 1, 3, 2, 2, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 1, 3, 1, 3, 3, 3, 1, 1, 5, - 7, 1, 3, 4, 0, 1, 3, 1, 1, 1, - 1, 3, 1, 2, 2, 3, -); -@yydefred = ( 0, - 0, 0, 0, 0, 3, 32, 0, 0, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 28, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 10, 0, 6, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 38, 40, 41, 33, - 23, 0, 26, 25, 27, 0, 0, 0, 34, 0, - 0, 0, 0, 37, 0, 0, 0, 0, 0, -); -@yydgoto = ( 8, - 19, 10, 11, 20, 15, 63, 21, 55, 56, 57, - 58, 59, -); -@yysindex = ( -212, - -157, -212, -212, -212, 0, 0, -212, 0, -137, 0, - -246, -241, -29, -234, -235, -19, -223, -223, -29, -257, - 0, 0, -212, -212, -212, -212, -212, -212, -212, -212, - -212, -212, -212, -216, -229, -267, -222, 0, -212, 0, - -255, -19, 227, 227, 236, -164, -223, -223, -233, -233, - -233, -205, -212, -76, -174, -162, 0, 0, 0, 0, - 0, -180, 0, 0, 0, -212, -29, -212, 0, -216, - -212, -29, -29, 0, -118, -212, -95, -212, -29, -); -@yyrindex = ( 0, - 0, 0, 0, 0, 0, 0, 0, 0, 106, 0, - 1, -59, 0, -43, 0, 163, 77, 96, -242, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -152, 0, 0, 0, 0, 0, 0, - 191, 172, 199, 208, 182, 153, 115, 134, 20, 39, - 58, -175, -219, -214, 0, -146, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -192, -188, 0, 0, - 0, -183, -178, 0, 0, 0, -145, 0, -143, -); -@yygindex = ( 0, - 2, 116, 0, 0, 0, 85, 84, 0, 0, 60, - 0, 0, -); -$YYTABLESIZE=510; -@yytable = ( 39, - 5, 9, 13, 16, 17, 18, 24, 61, 62, 27, - 28, 34, 29, 30, 29, 36, 31, 32, 33, 12, - 35, 40, 37, 38, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 54, 29, 43, 13, 43, - 33, 1, 39, 2, 39, 1, 60, 2, 31, 32, - 33, 3, 4, 62, 67, 3, 4, 11, 5, 52, - 53, 7, 5, 6, 45, 7, 45, 72, 44, 73, - 44, 54, 75, 42, 66, 42, 7, 77, 46, 79, - 46, 32, 32, 32, 69, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 70, 8, 32, 32, 32, 71, - 1, 32, 2, 29, 30, 1, 35, 31, 32, 33, - 3, 4, 36, 30, 14, 31, 14, 12, 6, 22, - 7, 64, 65, 23, 24, 25, 26, 27, 28, 74, - 29, 30, 0, 15, 31, 32, 33, 0, 76, 0, - 0, 0, 23, 24, 25, 26, 27, 28, 0, 29, - 30, 0, 16, 31, 32, 33, 0, 0, 0, 0, - 0, 78, 9, 0, 0, 23, 24, 25, 26, 27, - 28, 18, 29, 30, 0, 0, 31, 32, 33, 0, - 0, 17, 0, 0, 23, 24, 25, 26, 27, 28, - 19, 29, 30, 0, 0, 31, 32, 33, 20, 22, - 68, 3, 3, 3, 3, 3, 3, 21, 3, 3, - 0, 0, 3, 3, 3, 24, 0, 4, 4, 4, - 4, 4, 4, 0, 4, 4, 0, 0, 4, 4, - 4, 23, 24, 25, 26, 27, 28, 0, 29, 30, - 0, 0, 31, 32, 33, 27, 28, 0, 29, 30, - 0, 0, 31, 32, 33, 0, 0, 5, 0, 5, - 0, 5, 5, 5, 5, 5, 5, 0, 5, 5, - 0, 0, 5, 5, 5, 0, 12, 5, 12, 5, - 12, 12, 12, 12, 12, 12, 0, 12, 12, 0, - 0, 12, 12, 0, 0, 13, 12, 13, 12, 13, - 13, 13, 13, 13, 13, 0, 13, 13, 0, 0, - 13, 13, 0, 0, 11, 13, 11, 13, 11, 11, - 11, 11, 11, 11, 0, 11, 11, 0, 0, 11, - 11, 0, 0, 7, 11, 7, 11, 7, 7, 7, - 7, 7, 7, 0, 7, 7, 0, 0, 0, 0, - 0, 0, 8, 7, 8, 7, 8, 8, 8, 8, - 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, - 0, 14, 8, 14, 8, 14, 14, 14, 14, 14, - 14, 0, 14, 14, 0, 0, 0, 0, 0, 0, - 15, 14, 15, 14, 15, 15, 15, 15, 15, 15, - 0, 15, 15, 0, 0, 0, 0, 0, 0, 16, - 15, 16, 15, 16, 16, 16, 16, 16, 16, 9, - 0, 9, 0, 9, 9, 9, 9, 0, 18, 16, - 18, 16, 18, 18, 18, 18, 0, 0, 17, 9, - 17, 9, 17, 17, 17, 17, 0, 19, 18, 19, - 18, 19, 0, 19, 19, 20, 0, 20, 17, 0, - 17, 20, 20, 0, 21, 0, 21, 19, 0, 19, - 21, 21, 0, 0, 0, 20, 0, 20, 0, 0, - 0, 0, 0, 0, 21, 0, 21, 23, 24, 0, - 0, 27, 28, 0, 29, 30, 0, 0, 31, 32, - 33, 28, 0, 29, 30, 0, 0, 31, 32, 33, -); -@yycheck = ( 257, - 0, 0, 1, 2, 3, 4, 262, 275, 276, 265, - 266, 258, 268, 269, 257, 257, 272, 273, 274, 0, - 267, 279, 257, 259, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 279, 257, 0, 259, - 274, 258, 257, 260, 259, 258, 276, 260, 272, 273, - 274, 268, 269, 276, 53, 268, 269, 0, 275, 276, - 277, 278, 275, 276, 257, 278, 259, 66, 257, 68, - 259, 70, 71, 257, 280, 259, 0, 76, 257, 78, - 259, 257, 258, 259, 259, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 257, 0, 272, 273, 274, 280, - 258, 277, 260, 268, 269, 0, 259, 272, 273, 274, - 268, 269, 259, 259, 0, 259, 1, 275, 276, 257, - 278, 37, 39, 261, 262, 263, 264, 265, 266, 70, - 268, 269, -1, 0, 272, 273, 274, -1, 257, -1, - -1, -1, 261, 262, 263, 264, 265, 266, -1, 268, - 269, -1, 0, 272, 273, 274, -1, -1, -1, -1, - -1, 257, 0, -1, -1, 261, 262, 263, 264, 265, - 266, 0, 268, 269, -1, -1, 272, 273, 274, -1, - -1, 0, -1, -1, 261, 262, 263, 264, 265, 266, - 0, 268, 269, -1, -1, 272, 273, 274, 0, 259, - 277, 261, 262, 263, 264, 265, 266, 0, 268, 269, - -1, -1, 272, 273, 274, 259, -1, 261, 262, 263, - 264, 265, 266, -1, 268, 269, -1, -1, 272, 273, - 274, 261, 262, 263, 264, 265, 266, -1, 268, 269, - -1, -1, 272, 273, 274, 265, 266, -1, 268, 269, - -1, -1, 272, 273, 274, -1, -1, 257, -1, 259, - -1, 261, 262, 263, 264, 265, 266, -1, 268, 269, - -1, -1, 272, 273, 274, -1, 257, 277, 259, 279, - 261, 262, 263, 264, 265, 266, -1, 268, 269, -1, - -1, 272, 273, -1, -1, 257, 277, 259, 279, 261, - 262, 263, 264, 265, 266, -1, 268, 269, -1, -1, - 272, 273, -1, -1, 257, 277, 259, 279, 261, 262, - 263, 264, 265, 266, -1, 268, 269, -1, -1, 272, - 273, -1, -1, 257, 277, 259, 279, 261, 262, 263, - 264, 265, 266, -1, 268, 269, -1, -1, -1, -1, - -1, -1, 257, 277, 259, 279, 261, 262, 263, 264, - 265, 266, -1, 268, 269, -1, -1, -1, -1, -1, - -1, 257, 277, 259, 279, 261, 262, 263, 264, 265, - 266, -1, 268, 269, -1, -1, -1, -1, -1, -1, - 257, 277, 259, 279, 261, 262, 263, 264, 265, 266, - -1, 268, 269, -1, -1, -1, -1, -1, -1, 257, - 277, 259, 279, 261, 262, 263, 264, 265, 266, 257, - -1, 259, -1, 261, 262, 263, 264, -1, 257, 277, - 259, 279, 261, 262, 263, 264, -1, -1, 257, 277, - 259, 279, 261, 262, 263, 264, -1, 257, 277, 259, - 279, 261, -1, 263, 264, 257, -1, 259, 277, -1, - 279, 263, 264, -1, 257, -1, 259, 277, -1, 279, - 263, 264, -1, -1, -1, 277, -1, 279, -1, -1, - -1, -1, -1, -1, 277, -1, 279, 261, 262, -1, - -1, 265, 266, -1, 268, 269, -1, -1, 272, 273, - 274, 266, -1, 268, 269, -1, -1, 272, 273, 274, -); -$YYFINAL=8; -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -$YYMAXTOKEN=280; -#if YYDEBUG -@yyname = ( -"end-of-file",'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','', -'','','','','','','','','','','','','','','','','','','','','','','',"COMMA","LPAREN","RPAREN","NOT", -"OR","AND","EQV","NEQV","COMPARISON","DBLSLASH","PERCENT","PLUS","MINUS", -"UPLUS","UMINUS","ASTERIK","SLASH","DBLASTERIK","CONST","NAME","COLON","LARRAY", -"RARRAY","EQUALS", -); -@yyrule = ( -"\$accept : expr_with_abort", -"expr_with_abort : expr", -"expr_with_abort : expr COMMA", -"expr : CONST", -"expr : expr_without_const", -"expr_without_const : chain", -"expr_without_const : LARRAY array RARRAY", -"expr_without_const : PLUS expr", -"expr_without_const : MINUS expr", -"expr_without_const : NOT expr", -"expr_without_const : LPAREN potential_complex_or_implied_do RPAREN", -"expr_without_const : expr DBLASTERIK expr", -"expr_without_const : expr ASTERIK expr", -"expr_without_const : expr SLASH expr", -"expr_without_const : expr PLUS expr", -"expr_without_const : expr MINUS expr", -"expr_without_const : expr DBLSLASH expr", -"expr_without_const : expr COMPARISON expr", -"expr_without_const : expr AND expr", -"expr_without_const : expr OR expr", -"expr_without_const : expr EQV expr", -"expr_without_const : expr NEQV expr", -"potential_complex_or_implied_do : CONST", -"potential_complex_or_implied_do : CONST COMMA CONST", -"potential_complex_or_implied_do : expr_without_const", -"potential_complex_or_implied_do : expr_without_const COMMA do_args", -"potential_complex_or_implied_do : CONST COMMA do_args", -"array : array COMMA array_piece", -"array : array_piece", -"array_piece : expr", -"do_args : NAME EQUALS expr COMMA expr", -"do_args : NAME EQUALS expr COMMA expr COMMA expr", -"chain : NAME", -"chain : chain PERCENT NAME", -"chain : chain LPAREN exprlist RPAREN", -"exprlist :", -"exprlist : exprlist_ne", -"exprlist_ne : exprlist_ne COMMA argument", -"exprlist_ne : argument", -"argument : expr", -"argument : colonexpr", -"argument : namedargument", -"namedargument : NAME EQUALS expr", -"colonexpr : COLON", -"colonexpr : expr COLON", -"colonexpr : COLON expr", -"colonexpr : expr COLON expr", -); -#endif -sub yyclearin { $yychar = -1; } -sub yyerrok { $yyerrflag = 0; } -$YYSTACKSIZE = $YYSTACKSIZE || $YYMAXDEPTH || 500; -$YYMAXDEPTH = $YYMAXDEPTH || $YYSTACKSIZE || 500; -$yyss[$YYSTACKSIZE] = 0; -$yyvs[$YYSTACKSIZE] = 0; -sub YYERROR { ++$yynerrs; &yy_err_recover; } -sub yy_err_recover -{ - if ($yyerrflag < 3) - { - $yyerrflag = 3; - while (1) - { - if (($yyn = $yysindex[$yyss[$yyssp]]) && - ($yyn += $YYERRCODE) >= 0 && - $yycheck[$yyn] == $YYERRCODE) - { -#if YYDEBUG - print "yydebug: state $yyss[$yyssp], error recovery shifting", - " to state $yytable[$yyn]\n" if $yydebug; -#endif - $yyss[++$yyssp] = $yystate = $yytable[$yyn]; - $yyvs[++$yyvsp] = $yylval; - next yyloop; - } - else - { -#if YYDEBUG - print "yydebug: error recovery discarding state ", - $yyss[$yyssp], "\n" if $yydebug; -#endif - return(1) if $yyssp <= 0; - --$yyssp; - --$yyvsp; - } - } - } - else - { - return (1) if $yychar == 0; -#if YYDEBUG - if ($yydebug) - { - $yys = ''; - if ($yychar <= $YYMAXTOKEN) { $yys = $yyname[$yychar]; } - if (!$yys) { $yys = 'illegal-symbol'; } - print "yydebug: state $yystate, error recovery discards ", - "token $yychar ($yys)\n"; - } -#endif - $yychar = -1; - next yyloop; - } -0; -} # yy_err_recover - -sub yyparse -{ -#ifdef YYDEBUG - if ($yys = $ENV{'YYDEBUG'}) - { - $yydebug = int($1) if $yys =~ /^(\d)/; - } -#endif - - $yynerrs = 0; - $yyerrflag = 0; - $yychar = (-1); - - $yyssp = 0; - $yyvsp = 0; - $yyss[$yyssp] = $yystate = 0; - -yyloop: while(1) - { - yyreduce: { - last yyreduce if ($yyn = $yydefred[$yystate]); - if ($yychar < 0) - { - if (($yychar = &yylex) < 0) { $yychar = 0; } -#if YYDEBUG - if ($yydebug) - { - $yys = ''; - if ($yychar <= $#yyname) { $yys = $yyname[$yychar]; } - if (!$yys) { $yys = 'illegal-symbol'; }; - print "yydebug: state $yystate, reading $yychar ($yys)\n"; - } -#endif - } - if (($yyn = $yysindex[$yystate]) && ($yyn += $yychar) >= 0 && - $yycheck[$yyn] == $yychar) - { -#if YYDEBUG - print "yydebug: state $yystate, shifting to state ", - $yytable[$yyn], "\n" if $yydebug; -#endif - $yyss[++$yyssp] = $yystate = $yytable[$yyn]; - $yyvs[++$yyvsp] = $yylval; - $yychar = (-1); - --$yyerrflag if $yyerrflag > 0; - next yyloop; - } - if (($yyn = $yyrindex[$yystate]) && ($yyn += $yychar) >= 0 && - $yycheck[$yyn] == $yychar) - { - $yyn = $yytable[$yyn]; - last yyreduce; - } - if (! $yyerrflag) { - &yyerror('syntax error'); - ++$yynerrs; - } - return(1) if &yy_err_recover; - } # yyreduce -#if YYDEBUG - print "yydebug: state $yystate, reducing by rule ", - "$yyn ($yyrule[$yyn])\n" if $yydebug; -#endif - $yym = $yylen[$yyn]; - $yyval = $yyvs[$yyvsp+1-$yym]; - switch: - { -if ($yyn == 1) { -#line 29 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; return 1; -last switch; -} } -if ($yyn == 2) { -#line 30 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-1]; return "s,"; -last switch; -} } -if ($yyn == 3) { -#line 33 "expr_parse.y" -{ $yyval = [ "%const", @{$yyvs[$yyvsp-0]} ]; -last switch; -} } -if ($yyn == 4) { -#line 34 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 5) { -#line 37 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 6) { -#line 38 "expr_parse.y" -{ $yyval = [ "%array", @{$yyvs[$yyvsp-1]} ]; -last switch; -} } -if ($yyn == 7) { -#line 39 "expr_parse.y" -{ $yyval = [ "u+", $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 8) { -#line 40 "expr_parse.y" -{ $yyval = [ "u-", $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 9) { -#line 41 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 10) { -#line 43 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-1]; -last switch; -} } -if ($yyn == 11) { -#line 44 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 12) { -#line 45 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 13) { -#line 46 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 14) { -#line 47 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 15) { -#line 48 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 16) { -#line 49 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 17) { -#line 50 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 18) { -#line 51 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 19) { -#line 52 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 20) { -#line 53 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 21) { -#line 54 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 22) { -#line 57 "expr_parse.y" -{ $yyval = [ "%const", @{$yyvs[$yyvsp-0]} ]; -last switch; -} } -if ($yyn == 23) { -#line 59 "expr_parse.y" -{ my ($type1, $val1) = @{$yyvs[$yyvsp-2]}; - my ($type2, $val2) = @{$yyvs[$yyvsp-0]}; - $yyval = ["%const", typing::make_complex_type ($type1, $type2), - [$val1, $val2]]; - -last switch; -} } -if ($yyn == 24) { -#line 64 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 25) { -#line 66 "expr_parse.y" -{ $yyval = [ "%do", $yyvs[$yyvsp-2], @{$yyvs[$yyvsp-0]} ]; -last switch; -} } -if ($yyn == 26) { -#line 68 "expr_parse.y" -{ $yyval = [ "%do", [ "%const", @{$yyvs[$yyvsp-2]} ], @{$yyvs[$yyvsp-0]} ]; - -last switch; -} } -if ($yyn == 27) { -#line 72 "expr_parse.y" -{ $yyval = [ @{$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 28) { -#line 73 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 29) { -#line 76 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 30) { -#line 80 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-4], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 31) { -#line 82 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-6], $yyvs[$yyvsp-4], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 32) { -#line 85 "expr_parse.y" -{ $yyval = [ "%var", $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 33) { -#line 86 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-1], $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 34) { -#line 87 "expr_parse.y" -{ $yyval = [ "%call", $yyvs[$yyvsp-3], @{$yyvs[$yyvsp-1]} ]; -last switch; -} } -if ($yyn == 35) { -#line 90 "expr_parse.y" -{ $yyval = []; -last switch; -} } -if ($yyn == 36) { -#line 91 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 37) { -#line 94 "expr_parse.y" -{ $yyval = [ @{$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 38) { -#line 95 "expr_parse.y" -{ $yyval = [ $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 39) { -#line 98 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 40) { -#line 99 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 41) { -#line 100 "expr_parse.y" -{ $yyval = $yyvs[$yyvsp-0]; -last switch; -} } -if ($yyn == 42) { -#line 103 "expr_parse.y" -{ $yyval = [ "%namedarg", $yyvs[$yyvsp-2], $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 43) { -#line 106 "expr_parse.y" -{ $yyval = [ "%colon", "", "" ]; -last switch; -} } -if ($yyn == 44) { -#line 107 "expr_parse.y" -{ $yyval = [ "%colon", $yyvs[$yyvsp-1], "" ]; -last switch; -} } -if ($yyn == 45) { -#line 108 "expr_parse.y" -{ $yyval = [ "%colon", "", $yyvs[$yyvsp-0] ]; -last switch; -} } -if ($yyn == 46) { -#line 109 "expr_parse.y" -{ $yyval = [ "%colon", $yyvs[$yyvsp-2], $yyvs[$yyvsp-1] ]; -last switch; -} } -#line 624 "y.tab.pl" - } # switch - $yyssp -= $yym; - $yystate = $yyss[$yyssp]; - $yyvsp -= $yym; - $yym = $yylhs[$yyn]; - if ($yystate == 0 && $yym == 0) - { -#if YYDEBUG - print "yydebug: after reduction, shifting from state 0 ", - "to state $YYFINAL\n" if $yydebug; -#endif - $yystate = $YYFINAL; - $yyss[++$yyssp] = $YYFINAL; - $yyvs[++$yyvsp] = $yyval; - if ($yychar < 0) - { - if (($yychar = &yylex) < 0) { $yychar = 0; } -#if YYDEBUG - if ($yydebug) - { - $yys = ''; - if ($yychar <= $#yyname) { $yys = $yyname[$yychar]; } - if (!$yys) { $yys = 'illegal-symbol'; } - print "yydebug: state $YYFINAL, reading $yychar ($yys)\n"; - } -#endif - } - return(0) if $yychar == 0; - next yyloop; - } - if (($yyn = $yygindex[$yym]) && ($yyn += $yystate) >= 0 && - $yyn <= $#yycheck && $yycheck[$yyn] == $yystate) - { - $yystate = $yytable[$yyn]; - } else { - $yystate = $yydgoto[$yym]; - } -#if YYDEBUG - print "yydebug: after reduction, shifting from state ", - "$yyss[$yyssp] to state $yystate\n" if $yydebug; -#endif - $yyss[++$yyssp] = $yystate; - $yyvs[++$yyvsp] = $yyval; - } # yyloop -} # yyparse -#line 112 "expr_parse.y" - -sub yylex { - $expr_parse::left =~ s/^\s*//; - return 0 if $expr_parse::left eq ""; - my ($ncharsread, $token, $value) = expr_parse::good_yylex ($expr_parse::left); - # print "yylex: token eof\n" unless $ncharsread; - return 0 unless $ncharsread; - # print "yylex: token $token (" . substr ($expr_parse::left, 0, $ncharsread) . ") with value $value\n"; - # print join (";", @$value) . "\n"; - $expr_parse::left = substr ($expr_parse::left, $ncharsread); - $yylval = $value; - return $token; -} - -# returns (ncharsread, token, value) -sub good_yylex { - my ($s) = @_; - my ($c) = substr ($s, 0, 1); - - if ($c eq "") { - return 0; - } elsif ($s =~ /^(\d+(?:\.\d*)?|\.\d+)D[+-]?\d+/i) { - return (length ($&), $CONST, [$typing::double_precision, $&]); - } elsif ($s =~ /^(\d+E[+-]?\d+|(?:\d+\.\d*|\.\d+)(?:E[+-]?\d+)?)(_\w+)?/i) { - if (defined $2) { - return (length ($&), $CONST, [typing::make_type ('real', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'real'}, $1]); - } - } elsif ($s =~ /^(\d+)(_\w+)?/) { - if ($2) { - return (length ($&), $CONST, [typing::make_type ('integer', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'integer'}, $1]); - } - } elsif ($s =~ /^(\.true\.|\.false\.)(_\w+)?/i) { - if (defined $2) { - return (length ($&), $CONST, [typing::make_type ('logical', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'logical'}, $1]); - } - } elsif ($s =~ /^'(\d+)'(_\w+)?/) { - # Interior of string is digits because it has been grabbed already. - my ($str) = stmts::get_string ($1); - if (defined $2) { - return (length ($&), $CONST, [typing::make_character_type (substr ($2, 1), length ($str)), $str]); - } else { - return (length ($&), $CONST, [typing::make_character_type ($typing::default_character_kind, length ($str)), $str]); - } - } elsif ($s =~ /^\w+/) { - return (length ($&), $NAME, $&); - } else { - switch: { - $s =~ /^==/ && return (2, $COMPARISON, "=="); - $s =~ /^<=/ && return (2, $COMPARISON, "<="); - $s =~ /^>=/ && return (2, $COMPARISON, ">="); - $s =~ /^/ && return (1, $COMPARISON, ">"); - $s =~ /^\/=/ && return (2, $COMPARISON, "/="); - $s =~ /^=/ && return (1, $EQUALS, "="); - $s =~ /^\.eq\./i && return (4, $COMPARISON, "=="); - $s =~ /^\.le\./i && return (4, $COMPARISON, "<="); - $s =~ /^\.ge\./i && return (4, $COMPARISON, ">="); - $s =~ /^\.lt\./i && return (4, $COMPARISON, "<"); - $s =~ /^\.gt\./i && return (4, $COMPARISON, ">"); - $s =~ /^\.ne\./i && return (4, $COMPARISON, "/="); - $s =~ /^\.neqv\./i && return (6, $NEQV, ".neqv."); - $s =~ /^\.eqv\./i && return (5, $EQV, ".eqv."); - $s =~ /^\.and\./i && return (5, $AND, ".and."); - $s =~ /^\.or\./i && return (4, $OR, ".or."); - $s =~ /^\.not\./i && return (5, $NOT, ".not."); - $s =~ /^\*\*/ && return (2, $DBLASTERIK, "**"); - $s =~ /^\/\// && return (2, $DBLSLASH, "//"); - $s =~ /^\(\// && return (2, $LARRAY, "(/"); - $s =~ /^\/\)/ && return (2, $RARRAY, "/)"); - $c eq "," && return (1, $COMMA, ","); - $c eq "+" && return (1, $PLUS, "+"); - $c eq "-" && return (1, $MINUS, "-"); - $c eq "*" && return (1, $ASTERIK, "*"); - $c eq "/" && return (1, $SLASH, "/"); - $c eq "(" && return (1, $LPAREN, "("); - $c eq ")" && return (1, $RPAREN, ")"); - $c eq "%" && return (1, $PERCENT, "%"); - $c eq ":" && return (1, $COLON, ":"); - } - die "Lexer failed on `$s'"; - } -} - -##### -# Takes a string that consists entirely of an expression, and returns a -# reference to the parse tree it defines. -##### -sub parse_expr { - my ($s) = @_; - # print "parsing string: $s.\n"; - $expr_parse::left = $expr_parse::line = $s; - die "Expression `$expr_parse::line' has trailing garbage `$1$expr_parse::left'" - if yyparse () =~ /^s(.*)$/; - return $yyval; -} - -##### -# Takes a string that consists partly of an expression. (The first part -# is an expression.) Returns (parse tree ref, rest string, separator string). -##### -sub parse_part_as_expr { - my ($s) = @_; - # print "parsing part of string: $s.\n"; - $expr_parse::left = $expr_parse::line = $s; - if (yyparse () =~ /^s(.*)$/) { - return ($yyval, $expr_parse::left, $1); - } else { - return ($yyval); - } -} - -sub yyerror { - my ($s) = @_; - die "yyerror: $s during parsing of F90 code `$expr_parse::line'"; -} - -1; -#line 794 "y.tab.pl" diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.y b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.y deleted file mode 100644 index 94070cfc..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/expr_parse.y +++ /dev/null @@ -1,234 +0,0 @@ -%{ -package expr_parse; - -# On failure, print out this as the line we were working on. -$expr_parse::line = ""; - -# Portion of line left to parse -$expr_parse::left = ""; -%} - -%token COMMA LPAREN RPAREN NOT OR AND EQV NEQV COMPARISON DBLSLASH PERCENT -%token PLUS MINUS UPLUS UMINUS ASTERIK SLASH DBLASTERIK CONST NAME COLON -%token LARRAY RARRAY EQUALS - -%left EQV NEQV -%left OR -%left AND -%nonassoc NOT -%nonassoc COMPARISON -%left DBLSLASH -%left PLUS MINUS -%nonassoc UPLUS UMINUS -%left ASTERIK SLASH -%right DBLASTERIK -%left PERCENT - -%% - -expr_with_abort: expr { $$ = $1; return 1; } - | expr COMMA { $$ = $1; return "s,"; } - -expr: - CONST { $$ = [ "%const", @{$1} ]; } - | expr_without_const { $$ = $1; } - -expr_without_const: - chain { $$ = $1; } - | LARRAY array RARRAY { $$ = [ "%array", @{$2} ]; } - | PLUS expr %prec UPLUS { $$ = [ "u+", $2 ]; } - | MINUS expr %prec UMINUS { $$ = [ "u-", $2 ]; } - | NOT expr { $$ = [ $1, $2 ]; } - | LPAREN potential_complex_or_implied_do RPAREN - { $$ = $2; } - | expr DBLASTERIK expr { $$ = [ $2, $1, $3 ]; } - | expr ASTERIK expr { $$ = [ $2, $1, $3 ]; } - | expr SLASH expr { $$ = [ $2, $1, $3 ]; } - | expr PLUS expr { $$ = [ $2, $1, $3 ]; } - | expr MINUS expr { $$ = [ $2, $1, $3 ]; } - | expr DBLSLASH expr { $$ = [ $2, $1, $3 ]; } - | expr COMPARISON expr { $$ = [ $2, $1, $3 ]; } - | expr AND expr { $$ = [ $2, $1, $3 ]; } - | expr OR expr { $$ = [ $2, $1, $3 ]; } - | expr EQV expr { $$ = [ $2, $1, $3 ]; } - | expr NEQV expr { $$ = [ $2, $1, $3 ]; } - -potential_complex_or_implied_do: - CONST { $$ = [ "%const", @{$1} ]; } - | CONST COMMA CONST - { my ($type1, $val1) = @{$1}; - my ($type2, $val2) = @{$3}; - $$ = ["%const", typing::make_complex_type ($type1, $type2), - [$val1, $val2]]; - } - | expr_without_const { $$ = $1; } - | expr_without_const COMMA do_args - { $$ = [ "%do", $1, @{$3} ]; } - | CONST COMMA do_args - { $$ = [ "%do", [ "%const", @{$1} ], @{$3} ]; - } - -array: - array COMMA array_piece { $$ = [ @{$1}, $3 ]; } - | array_piece { $$ = [ $1 ]; } - -array_piece: - expr { $$ = $1; } -# | implied_do is handled within expr - -do_args: - NAME EQUALS expr COMMA expr { $$ = [ $1, $3, $5 ]; } - | NAME EQUALS expr COMMA expr COMMA expr - { $$ = [ $1, $3, $5, $7 ]; } - -chain: - NAME { $$ = [ "%var", $1 ]; } - | chain PERCENT NAME { $$ = [ $2, $1, $3 ]; } - | chain LPAREN exprlist RPAREN { $$ = [ "%call", $1, @{$3} ]; } - -exprlist: - { $$ = []; } - | exprlist_ne { $$ = $1; } - -exprlist_ne: - exprlist_ne COMMA argument { $$ = [ @{$1}, $3 ]; } - | argument { $$ = [ $1 ]; } - -argument: - expr { $$ = $1; } - | colonexpr { $$ = $1; } - | namedargument { $$ = $1; } - -namedargument: - NAME EQUALS expr { $$ = [ "%namedarg", $1, $3 ]; } - -colonexpr: - COLON { $$ = [ "%colon", "", "" ]; } - | expr COLON { $$ = [ "%colon", $1, "" ]; } - | COLON expr { $$ = [ "%colon", "", $2 ]; } - | expr COLON expr { $$ = [ "%colon", $1, $2 ]; } - -%% - -sub yylex { - $expr_parse::left =~ s/^\s*//; - return 0 if $expr_parse::left eq ""; - my ($ncharsread, $token, $value) = expr_parse::good_yylex ($expr_parse::left); - # print "yylex: token eof\n" unless $ncharsread; - return 0 unless $ncharsread; - # print "yylex: token $token (" . substr ($expr_parse::left, 0, $ncharsread) . ") with value $value\n"; - # print join (";", @$value) . "\n"; - $expr_parse::left = substr ($expr_parse::left, $ncharsread); - $yylval = $value; - return $token; -} - -# returns (ncharsread, token, value) -sub good_yylex { - my ($s) = @_; - my ($c) = substr ($s, 0, 1); - - if ($c eq "") { - return 0; - } elsif ($s =~ /^(\d+(?:\.\d*)?|\.\d+)D[+-]?\d+/i) { - return (length ($&), $CONST, [$typing::double_precision, $&]); - } elsif ($s =~ /^(\d+E[+-]?\d+|(?:\d+\.\d*|\.\d+)(?:E[+-]?\d+)?)(_\w+)?/i) { - if (defined $2) { - return (length ($&), $CONST, [typing::make_type ('real', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'real'}, $1]); - } - } elsif ($s =~ /^(\d+)(_\w+)?/) { - if ($2) { - return (length ($&), $CONST, [typing::make_type ('integer', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'integer'}, $1]); - } - } elsif ($s =~ /^(\.true\.|\.false\.)(_\w+)?/i) { - if (defined $2) { - return (length ($&), $CONST, [typing::make_type ('logical', substr ($2, 1)), $1]); - } else { - return (length ($&), $CONST, [$typing::default_type{'logical'}, $1]); - } - } elsif ($s =~ /^'(\d+)'(_\w+)?/) { - # Interior of string is digits because it has been grabbed already. - my ($str) = stmts::get_string ($1); - if (defined $2) { - return (length ($&), $CONST, [typing::make_character_type (substr ($2, 1), length ($str)), $str]); - } else { - return (length ($&), $CONST, [typing::make_character_type ($typing::default_character_kind, length ($str)), $str]); - } - } elsif ($s =~ /^\w+/) { - return (length ($&), $NAME, $&); - } else { - switch: { - $s =~ /^==/ && return (2, $COMPARISON, "=="); - $s =~ /^<=/ && return (2, $COMPARISON, "<="); - $s =~ /^>=/ && return (2, $COMPARISON, ">="); - $s =~ /^/ && return (1, $COMPARISON, ">"); - $s =~ /^\/=/ && return (2, $COMPARISON, "/="); - $s =~ /^=/ && return (1, $EQUALS, "="); - $s =~ /^\.eq\./i && return (4, $COMPARISON, "=="); - $s =~ /^\.le\./i && return (4, $COMPARISON, "<="); - $s =~ /^\.ge\./i && return (4, $COMPARISON, ">="); - $s =~ /^\.lt\./i && return (4, $COMPARISON, "<"); - $s =~ /^\.gt\./i && return (4, $COMPARISON, ">"); - $s =~ /^\.ne\./i && return (4, $COMPARISON, "/="); - $s =~ /^\.neqv\./i && return (6, $NEQV, ".neqv."); - $s =~ /^\.eqv\./i && return (5, $EQV, ".eqv."); - $s =~ /^\.and\./i && return (5, $AND, ".and."); - $s =~ /^\.or\./i && return (4, $OR, ".or."); - $s =~ /^\.not\./i && return (5, $NOT, ".not."); - $s =~ /^\*\*/ && return (2, $DBLASTERIK, "**"); - $s =~ /^\/\// && return (2, $DBLSLASH, "//"); - $s =~ /^\(\// && return (2, $LARRAY, "(/"); - $s =~ /^\/\)/ && return (2, $RARRAY, "/)"); - $c eq "," && return (1, $COMMA, ","); - $c eq "+" && return (1, $PLUS, "+"); - $c eq "-" && return (1, $MINUS, "-"); - $c eq "*" && return (1, $ASTERIK, "*"); - $c eq "/" && return (1, $SLASH, "/"); - $c eq "(" && return (1, $LPAREN, "("); - $c eq ")" && return (1, $RPAREN, ")"); - $c eq "%" && return (1, $PERCENT, "%"); - $c eq ":" && return (1, $COLON, ":"); - } - die "Lexer failed on `$s'"; - } -} - -##### -# Takes a string that consists entirely of an expression, and returns a -# reference to the parse tree it defines. -##### -sub parse_expr { - my ($s) = @_; - # print "parsing string: $s.\n"; - $expr_parse::left = $expr_parse::line = $s; - die "Expression `$expr_parse::line' has trailing garbage `$1$expr_parse::left'" - if yyparse () =~ /^s(.*)$/; - return $yyval; -} - -##### -# Takes a string that consists partly of an expression. (The first part -# is an expression.) Returns (parse tree ref, rest string, separator string). -##### -sub parse_part_as_expr { - my ($s) = @_; - # print "parsing part of string: $s.\n"; - $expr_parse::left = $expr_parse::line = $s; - if (yyparse () =~ /^s(.*)$/) { - return ($yyval, $expr_parse::left, $1); - } else { - return ($yyval); - } -} - -sub yyerror { - my ($s) = @_; - die "yyerror: $s during parsing of F90 code `$expr_parse::line'"; -} - -1; diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/f90doc b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/f90doc deleted file mode 100755 index 0afe6daf..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/f90doc +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env perl -eval 'exec perl $0 ${1+"$@"}' - if 0; -warn ("Perl 5 not detected, likely a big problem") if $] < 5.0; -warn "Less than Perl 5.003. You may witness mysterious segmentation faults." - if $] < 5.003; - -use strict; - -BEGIN { - my $zero = $0; - while (-l $zero) { - my $nextzero = readlink $zero; - if (substr ($nextzero, 0, 1) eq "/") { - $zero = $nextzero; - } elsif ($zero =~ m#^(.*)/#) { - $zero = "$1/$nextzero"; - } else { - $zero = $nextzero; - } - } - if ($zero =~ m#(.*)/\w+#) { - push @INC, "$1/../common/", $1; - } else { - push @INC, "../common/", "."; - } -} - -require "htmling.pl"; -require "stmts.pl"; -require "utils.pl"; -#require "expr_parse.pl"; -#require "typing.pl"; - -#################### - -if (! @ARGV) { - print <$part in module $1"); - } else { - push (@::see_list, "module $1"); - } - } elsif ($macro =~ /^author\s+/i) { - push (@::authors, $'); - } elsif ($macro =~ /^version\s+/i) { - die "Two versions in a single !! block" if $::version_num; - $::version_num = $'; - } else { - die "Unrecognized macro $macro"; - } -} diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/htmling.pl b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/htmling.pl deleted file mode 100644 index 537a50cc..00000000 --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/htmling.pl +++ /dev/null @@ -1,376 +0,0 @@ -package htmling; - -use strict; - -### CONSTANTS -$htmling::dblspace = " "; -$htmling::indentspace = $htmling::dblspace x 2; -$htmling::headerspace = $htmling::indentspace; -$htmling::comment_indent = $htmling::indentspace x 2; - -### PUBLIC GLOBALS -$htmling::comments_type = "smart"; -$htmling::suppress_calls = 0; -$htmling::calls_make_links = 1; -$htmling::html_filenames_original_case = 0; - -### GLOBALS -$htmling::htmlfile = ""; -$htmling::indent = 0; - -# Return the name of the HTML file for the specified PROGRAM or MODULE -sub html_filename { - my ($name) = @_; - $name = lc $name unless $htmling::html_filenames_original_case; - return $name . ".html"; -} - -# This is the main calling point from f90doc. -# Takes all top-level objects: programs, subroutines, functions, and modules. -# Warns if given something else. -sub do_toplevel { - my ($top, $outfile) = @_; - - my $type = $top->{'type'}; - unless ($type eq 'module' || $type eq 'subroutine' || $type eq 'function' || - $type eq 'program') { - warn "Warning: Unrecognized top-level object $type will not be documented.\n"; - return; - } - - # A positive-length name. Necessary because programs may not have names. - if (defined $outfile) { - $htmling::htmlfile = $outfile; - } else { - $htmling::htmlfile = html_filename ( - ($top->{'name'} eq '' ? $type : $top->{'name'})); - } - print "Generating $htmling::htmlfile...\n"; - open OUT, ">$htmling::htmlfile"; - - print OUT "\n"; - print OUT "\n"; - print OUT " $type $top->{'name'} (generated by f90doc) \n"; - print OUT "\n"; - print OUT "

", ucfirst ($type), " $top->{'name'}

\n"; - print OUT "
$type $top->{'name'}\n";
-
-  list_uses (@{$top->{'uses'}});
-  list_calls (1, keys %{$top->{'calls'}}) if exists $top->{'calls'};
-  list_html ("Types", map (($_->{'type'} eq "type" ? ($_) : ()), @{$top->{'ocontains'}}));
-  list_html ("Variables", map (($_->{'type'} eq "var" ? ($_) : ()), @{$top->{'ocontains'}}));
-  list_html ("Interfaces", map (($_->{'type'} eq "interface" ? ($_) : ()), @{$top->{'ocontains'}}));
-  list_html ("Subroutines and functions", map (($_->{'type'} eq "subroutine" || $_->{'type'} eq "function" ? ($_) : ()), @{$top->{'ocontains'}}));
-
-  print OUT "\nend $type $top->{'name'}\n";
-  do_comments ($top->{'comments'}, 1);
-
-  my @list;
-  @list = map (($_->{'type'} eq "type" ? ($_) : ()), @{$top->{'ocontains'}});
-  print OUT "\n

Description of Types

\n" if @list; - do_html (@list); - @list = map (($_->{'type'} eq "var" ? ($_) : ()), @{$top->{'ocontains'}}); - print OUT "\n

Description of Variables

\n" if @list; - do_html (@list); - @list = map (($_->{'type'} eq "interface" ? ($_) : ()), @{$top->{'ocontains'}}); - print OUT "\n

Description of Interfaces

\n" if @list; - do_html (@list); - @list = map (($_->{'type'} eq "subroutine" || $_->{'type'} eq "function" ? ($_) : ()), @{$top->{'ocontains'}}); - print OUT "\n

Description of Subroutines and Functions

\n" if @list; - do_html (@list); - - print OUT "\n"; - close OUT; -} - -sub list_uses { - if (@_) { - print OUT "\n${htmling::indentspace}${htmling::headerspace}! Uses\n"; - my ($use); - foreach $use (@_) { - my ($module, $extra) = @$use; - $extra = defined $extra ? ", $extra" : ""; - print OUT "${htmling::indentspace}", - "use $module$extra\n"; - } - } -} - -sub list_calls { - return if $htmling::suppress_calls; - my ($big, @calls) = (@_); - if (@calls) { - @calls = sort @calls; - @calls = map { "$_" } @calls - if $htmling::calls_make_links; - if ($big) { - print OUT join ("\n", - "\n${htmling::indentspace}${htmling::headerspace}! Calls", - (map { "${htmling::indentspace}call $_" } @calls), ""); - } else { - print OUT "${htmling::indentspace}! Calls: ", join (", ", @calls), "\n"; - } - } -} - -sub list_html { - my ($title) = shift; - - if (@_) { - print OUT "\n${htmling::indentspace}${htmling::headerspace}! $title\n"; - my ($struct); - foreach $struct (@_) { - my ($name, $type) = (txt2html ($struct->{'name'}), $struct->{'type'}); - my ($href) = "$name"; - print OUT $htmling::indentspace; - if ($type eq "var") { - print OUT var2str ($struct, $href) . "\n"; - } elsif ($type eq "subroutine" || - $type eq "function") { - print OUT join (" ", attriblist ($struct), ""); - print OUT typing::type_to_f90 ($struct->{'rtype'}) . " " - if exists $struct->{'rtype'}; - my $flag; - for $flag ('recursive', 'elemental', 'pure') { - print OUT "$flag " if $struct->{$flag}; - } - print OUT "$type $href"; - print OUT " (" . join (", ", @{$struct->{'parms'}}) . ")"; - print OUT " result ($struct->{'result'})" - if exists $struct->{'result'} && !exists $struct->{'rtype'}; - print OUT "\n"; - } else { - print OUT join (" ", attriblist ($struct), ""); - print OUT "$type $href\n"; - } - } - } -} - -sub do_html { - if (@_) { - my ($struct); - - foreach $struct (@_) { - my ($name, $type) = (txt2html ($struct->{'name'}), $struct->{'type'}); - if (! $htmling::indent) { - print OUT "

$name

\n"; - print OUT "
";
-         }
-
-         print OUT $htmling::indentspace x $htmling::indent;
-         if ($type eq "var") {
-             print OUT var2str ($struct) . "\n";
-         } elsif ($type eq "mprocedure") {
-             die "do_html: bare module procedure $struct->{'name'} (no enclosing module)"
-                 unless exists $struct->{'bind'};
-             print OUT
-                 "module procedure {'bind'}->{'type'}_" .
-                 lc ($struct->{'name'}) . "\">$name\n";
-         } elsif ($type eq "subroutine" || $type eq "function") {
-             print OUT join (" ", attriblist ($struct), "");
-             print OUT typing::type_to_f90 ($struct->{'rtype'}) . " "
-                 if exists $struct->{'rtype'} && !exists $struct->{'result'};
-             my $flag;
-             for $flag ('recursive', 'elemental', 'pure') {
-               print OUT "$flag " if $struct->{$flag};
-             }
-             print OUT "$type $name";
-             print OUT " (" . join (", ", @{$struct->{'parms'}}) . ")";
-             print OUT " result ($struct->{'result'})"
-               if exists $struct->{'result'};
-             print OUT "\n";
-         } else {
-             print OUT join (" ", attriblist ($struct), "");
-             print OUT "$type $name\n";
-         }
-
-         $htmling::indent++;
-
-         if ($type eq "var" || $type eq "mprocedure") {
-         } elsif ($type eq "type") {
-           print OUT $htmling::indentspace x $htmling::indent, "private\n"
-             if exists $struct->{'privatetype'};
-           print OUT $htmling::indentspace x $htmling::indent, "sequence\n"
-             if exists $struct->{'sequencetype'};
-           do_html (@{$struct->{'ocontains'}});
-         } elsif ($type eq "interface") {
-           do_html (@{$struct->{'ocontains'}});
-         } elsif ($type eq "subroutine" || $type eq "function") {
-           my @interest = @{$struct->{'parms'}};
-           push @interest, $struct->{'result'} if exists $struct->{'result'};
-           push @interest, $name
-             if $type eq "function" && !exists $struct->{'result'} &&
-               !exists $struct->{'rtype'};
-           my $arg;
-           foreach $arg (@interest) {
-             my (@things) = values %{$struct->{'contains'}->{lc $arg}};
-             die "Confused by/no declaration for parameter $arg of $type $name"
-               if scalar @things != 1;
-             do_html ($things[0]);
-           }
-         } else {
-           die "do: I don't know what a $type is";
-         }
-
-         list_calls (0, keys %{$struct->{'calls'}}) if exists $struct->{'calls'};
-
-         $htmling::indent--;
-
-         if ($type ne "var" && $type ne "mprocedure") {
-            print OUT $htmling::indentspace x $htmling::indent . "end $type $name\n";
-         }
-
-         do_comments ($struct->{'comments'}, ! $htmling::indent);
-      }
-   }
-}
-
-# Pass comments and a flag saying if you want to end the current 
 block.
-sub do_comments {
-   my ($comments, $endpre) = @_;
-   if ($comments eq "") {
-      print OUT "
\n" if $endpre; - return; - } - - #print OUT "\n" unless $htmling::indent; - - if ($htmling::comments_type eq "preformatted") { - my ($s) = $htmling::indentspace x $htmling::indent . $htmling::comment_indent; - $comments =~ s/^/$s/m if $htmling::indent; - $comments =~ s/^\n*//s; - $comments =~ s/\n*$//s; - print OUT $comments, "\n"; - print OUT "
\n" if $endpre; - } else { - print OUT "
\n"; - print OUT "
\n" if $htmling::indent; - if ($htmling::comments_type eq "html") { - } elsif ($htmling::comments_type eq "smart") { - my @newcomments = (); - my $verbmode = 0; - my @listmode = (); - my $line; - foreach $line (split ("\n", $comments)) { - if ($verbmode) { - if ($line =~ /^>/) { - warn "`$line' found while already in verbatim mode"; - substr ($line, 0, 1) = " "; - push @newcomments, $line; - } elsif ($line =~ /^"; - } elsif ($line =~ /^v/) { - warn "`$line' found while already in verbatim mode"; - substr ($line, 0, 1) = " "; - push @newcomments, $line; - } else { - push @newcomments, $line; - } - next; - } - - # _italic_ and *bold* - while ($line =~ /(\A|\W)_(\w|\w.*?\w)_(\Z|\W)/) { - my ($left, $mid, $right) = ("$`$1", $2, "$3$'"); - $mid =~ s/_/ /g; - $line = $left . $mid . $right; - } - while ($line =~ /(\A|\W)\*(\w|\w.*?\w)\*(\Z|\W)/) { - my ($left, $mid, $right) = ("$`$1", $2, "$3$'"); - $mid =~ s/\*/ /g; - $line = $left . $mid . $right; - } - - # Lists - if ($line =~ /^( *)-/) { - if (! @listmode || length ($1) > $listmode[$#listmode]) { - push @listmode, length $1; - push @newcomments, $1 . "
    "; - } else { - while ($listmode[$#listmode] != length ($1)) { - push @newcomments, " " x $listmode[$#listmode] . "
"; - pop @listmode; - die "Unindented to invalid position in `$line'" - unless @listmode; - } - } - push @newcomments, $1 . "
  • " . substr ($line, length ($&)); - } elsif ($line =~ /^>/) { - #warn "Verbatim mode started in list mode" if @listmode; - $verbmode = 1; - substr ($line, 0, 1) = " "; - push @newcomments, "
    " . $line;
    -            # Ignore $line =~ /^$line
    "; - } elsif ($line =~ /^\s*$/) { - push @newcomments, "

    "; - } elsif (@listmode) { - $line =~ /^( *)(\t?)/; - warn "Tabs have strange effects on indentation detection" - if length ($2) > 0; - while (@listmode && $listmode[$#listmode] > length ($1)) { - push @newcomments, " " x $listmode[$#listmode] . ""; - pop @listmode; - } - push @newcomments, $line; - } else { - push @newcomments, $line; - } - } - my $list; - foreach $list (@listmode) { - push @newcomments, " " x $list . ""; - } - $comments = join ("\n", @newcomments); - } else { - die "Unsupported comments type `$htmling::comments_type'"; - } - $comments =~ s/

    \n(

    \n)+/

    \n/g; - $comments =~ s/

    \n$//; - $comments =~ s/^

    \n//; - $comments =~ s/

    /

    /g if $htmling::indent; - print OUT $comments . "\n"; - print OUT "
  • \n" if $htmling::indent; - print OUT "
    " unless $endpre;
    -   }
    -}
    -
    -sub var2str {
    -    my ($var, $href) = @_;
    -
    -    my ($typestr) = typing::type_to_f90 ($var->{'vartype'});
    -    my ($initial) = (!exists $var->{'initial'} ? ""
    -          : " $var->{'initop'} " . typing::expr_to_f90 ($var->{'initial'}));
    -    $href = txt2html ($var->{'name'}) unless $href;
    -    return $typestr . join (", ", "", attriblist ($var)) . " :: $href$initial";
    -}
    -
    -sub txt2html {
    -    my ($txt) = @_;
    -    $txt =~ s//>/g;
    -    return $txt;
    -}
    -
    -sub attriblist {
    -    my ($struct) = @_;
    -    my @attribs = ();
    -
    -    push @attribs, $struct->{'vis'} if exists $struct->{'vis'};
    -    push @attribs, "optional" if exists $struct->{'optional'};
    -    push @attribs, @{$struct->{'tempattribs'}}
    -        if exists $struct->{'tempattribs'};
    -
    -    return @attribs;
    -}
    -
    -1;
    diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/stmts.pl b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/stmts.pl
    deleted file mode 100644
    index f014bd6f..00000000
    --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/stmts.pl
    +++ /dev/null
    @@ -1,891 +0,0 @@
    -package stmts;
    -
    -use strict;
    -
    -require "expr_parse.pl";
    -require "typing.pl";
    -require "utils.pl";
    -
    -#########################################################################
    -# PUBLIC GLOBALS
    -
    -# Set to a reference to a routine to take !! comments if !! comments are
    -# to be caught.
    -$stmts::bangbang = "";
    -
    -# Set to a reference to a routine to return accumulated comments if !! comments
    -# are caught.  You should reset them after each time you call read_line or
    -# read_stmt.
    -$stmts::comments = "";
    -
    -# Set this to disable warnings.  Don't use this for a compiler!  Suitable for
    -# something like f90doc though.  This shouldn't be used once stmts supports
    -# all Fortran 90 statements and attributes; until then, it's pretty much
    -# needed; after then, it should be removed.
    -$stmts::diable_warns = 0;
    -
    -# Set this to use fixed-form Fortran, like good old Fortran 77.
    -$stmts::fixed_form = 0;
    -
    -#########################################################################
    -# PRIVATE GLOBALS
    -
    -# A "left-over" piece of a statement is stored here when semi-colons are
    -# encountered.
    -$stmts::leftover = "";
    -
    -# Number of opened files.
    -$stmts::nfile = 0;
    -
    -# List of string's values.
    -@stmts::strings = ();
    -
    -# List of structure pointers that we're currently nested in.
    -# topnest stores the top of the stack.
    -@stmts::nesting = ();
    -$stmts::topnest = undef;
    -
    -# List of structure pointers that we're currently nested in, but for a
    -# specified type.
    -%stmts::nesting_by = ();
    -
    -#########################################################################
    -# ROUTINES
    -
    -#####
    -# Reads an entire file, and returns all the top-level structures found.
    -# If specified, a given function will be called after every statement
    -# (usually this is for resetting !! comments and such).
    -#####
    -sub read_file {
    -  my ($filename, $every_stmt) = @_;
    -  stmts::open_file ($filename);
    -
    -  my ($stmt, $struct, @rval);
    -  my @toplevel = ();
    -  while ((@rval = stmts::read_stmt ()) [0]) {
    -    push @toplevel, $rval[1] if !defined $stmts::topnest && ref $rval[1];
    -    &$every_stmt () if defined $every_stmt;
    -  }
    -
    -  return @toplevel;
    -}
    -
    -#####
    -# Starts reading the specified filename.
    -#####
    -sub open_file {
    -   my ($filename) = @_;
    -   $stmts::FILE = "";
    -
    -   open IN, $filename
    -     or die "Couldn't open $filename";
    -   $stmts::{'FILE' . $stmts::nfile} = $stmts::{'IN'};
    -}
    -
    -#####
    -# Cleans up from reading the current file.
    -# This is automatically called by read_line, so most don't have to worry
    -# about it.
    -# Returns false if there are no files left.
    -#####
    -sub close_file {
    -   close IN;
    -   $stmts::nfile--;
    -   if ($stmts::nfile > 0) {
    -      # CHECK--does this still do the desired thing, in light of open_file?
    -      $stmts::{'IN'} = $stmts::{'FILE' . $stmts::nfile};
    -      return 1;
    -   } else {
    -      # Clean up strings.
    -      @stmts::strings = ();
    -      return 0;
    -   }
    -}
    -
    -#####
    -# Reads a line of Fortran 90 doing whatever it takes.  This may involve
    -# reading multiple lines from the current file, walking into files, etc.
    -# INCLUDE is parsed at this level.
    -# Note that the returned string may have various cases (lc isn't called).
    -#####
    -sub read_line {
    -
    -ALLOVERAGAIN:
    -  my $line;
    -  if ($stmts::leftover ne '') {
    -    $line = $stmts::leftover;
    -    $stmts::leftover = '';
    -  } else {
    -    $line = ;
    -    until (defined $line) {
    -      return "" unless close_file ();
    -      $line = ;
    -    }
    -    chomp $line;
    -
    -    substr ($line, 0, 1) = '!' if $stmts::fixed_form && $line =~ /^\S/;
    -  }
    -
    -  # This is used for fixed-form continuations.
    -  my $lastlen = length $line;
    -
    -  my $continue = 0;
    -
    -  while (1) {
    -    # Grab doubled comments (!!) if requested.
    -    if ($stmts::bangbang && $line =~ /^([^"'!]|('[^']*')|("[^"]*"))*(!!.*)$/) {
    -      $line = substr ($line, 0, length ($line) - length ($4));
    -      &$stmts::bangbang ($4);
    -    }
    -
    -    # Delete comments.
    -    elsif ($line =~ /^([^"'!]|(\'[^']*')|("[^"]*"))*(!.*)$/) {
    -      $line = substr ($line, 0, length ($line) - length ($4));
    -    }
    -
    -    # Fixed-form continuations.
    -    if ($stmts::fixed_form) {
    -
    -      # Check next line for continuation mark.
    -      $stmts::leftover = ;
    -      $stmts::leftover = '' unless defined $stmts::leftover;
    -      chomp $stmts::leftover;
    -      substr ($stmts::leftover, 0, 1) = '!' if $stmts::leftover =~ /^\S/;
    -      if ($stmts::leftover =~ /^\s....\S/) {
    -
    -        # Pad previous line with spaces if it had less than 72 characters.
    -        $line .= ' ' x (72-$lastlen) if $lastlen < 72;
    -
    -        # Add next (continuation) line to the line.
    -        $line .= substr ($stmts::leftover, 6);
    -        $lastlen = length $stmts::leftover;
    -        
    -        # Continue on to check the next line.
    -        $stmts::leftover = '';
    -        next;
    -      }
    -      
    -    # Free-form continuations.
    -    } elsif ($continue || $line =~ /&\s*$/) {
    -      $line = $` if $line =~ /&\s*$/;
    -      my $rest = ;
    -      chomp $rest;
    -      $rest = $' if $rest =~ /^\s*&/;
    -      $line = "$line$rest";
    -      # Blank lines don't stop the continuation.
    -      $continue = ($rest =~ /^\s*(?:!.*)?$/);
    -      next;
    -    }
    -
    -    last;
    -  }
    -
    -  # Semicolons.
    -  if ($line =~ /^([^;]*);(.*)$/) {
    -    $line = $1;
    -    if ($stmts::leftover eq '') {
    -      $stmts::leftover = $2;
    -    } else {
    -      $stmts::leftover .= ";$2";
    -    }
    -  }
    -
    -  # Replace strings to avoid confusion.
    -  my @quotes;
    -  while ($line =~ / " ([^"]|"")* " | ' ([^']|'')* ' /xg) {
    -    push @quotes, [length $`, length $&, $&];
    -  }
    -  for my $quote (reverse @quotes) {
    -    ## Process in reverse order so that $start is preserved despite replacement
    -    my ($start, $length, $string) = @$quote;
    -    push @stmts::strings, $string;
    -    substr ($line, $start, $length) = "\'" . $#stmts::strings . "\'";
    -  }
    -
    -  # Get rid of spaces on either end.
    -  $line = utils::trim ($line);
    -
    -  goto ALLOVERAGAIN if $line eq '';
    -
    -  #print "read line `$line'\n";
    -
    -  return $line;
    -}
    -
    -#####
    -# Returns the physical value for the given string number.
    -#####
    -sub get_string {
    -   my ($n) = @_;
    -   return $stmts::strings[$n];
    -}
    -
    -#####
    -# Reads a Fortran 90 statement from the current input.
    -# Checks for proper nesting, etc., and keeps tracks of what's in what.
    -# Possible results:
    -#    ('?', $the_line)
    -#    ('program', \%structure)
    -#    ('endprogram', \%structure)
    -#    ('module', \%structure)
    -#    ('endmodule', \%structure)
    -#    ('subroutine', \%structure)
    -#    ('endsubroutine', \%structure)
    -#    ('function', \%structure)
    -#    ('endfunction', \%structure)
    -#    ('program', \%structure)
    -#    ('endprogram', \%structure)
    -#    ('type', \%structure)
    -#    ('endtype', \%structure)
    -#    ('interface', \%structure)
    -#    ('endinterface', \%structure)
    -#    ('var', \%struct1, \%struct2, ...)
    -#    ('contains', \%parent)
    -#    ('public', $name1, $name2, ...)          empty means global default
    -#    ('private', $name1, $name2, ...)         empty means global default
    -#    ('optional', $name1, $name2, ...)
    -#    ('call', $arg1, $arg2, ...)              currently args are unparsed
    -#####
    -sub read_stmt {
    -   my ($line) = read_line ();
    -   if (! $line) {
    -      die "File ended while still nested" if @stmts::nesting;
    -      return ("", "");
    -   }
    -
    -   # MODULE PROCEDURE (must be before module)
    -   if ($line =~ /^module\s+procedure\s+(\w.*)$/i) {
    -      die "module procedure outside of interface block" unless defined $stmts::topnest && $stmts::topnest->{'type'} eq "interface" && $stmts::topnest->{'name'} ne "";
    -      my (@list) = split (/\s*,\s*/, utils::trim ($1));
    -      my ($p);
    -      foreach $p (@list) {
    -         die "Invalid module procedure `$p'" unless $p =~ /^\w+$/;
    -         new_struct ({
    -            'type'   => "mprocedure",
    -            'name'   => $p,
    -            hashed_comments ()
    -         });
    -      }
    -      return ("mprocedure", @list);
    -   }
    -
    -   # MODULE/PROGRAM
    -   elsif ($line =~ /^(module|program)(?:\s+(\w+))?$/i) {
    -      die "$1 begun not at top level" if defined $stmts::topnest;
    -      return new_nest ({
    -         'type' => lc $1,
    -         'name' => (defined $2 ? $2 : ''),
    -         hashed_comments ()
    -      });
    -   }
    -
    -   # END MODULE/SUBROUTINE/FUNCTION/PROGRAM/TYPE/INTERFACE, or general END
    -   elsif ($line =~ /^end\s*(?:(module|subroutine|function|program|type|interface)(?:\s+(\w+))?)?$/i) {
    -      die "END statement outside of any nesting" unless defined $stmts::topnest;
    -      my $top = $stmts::topnest;
    -
    -      # We do some special "fixing up" for modules, which resolves named
    -      # references (module procedures) and computes publicity.
    -      #
    -      # Note that end_nest will ensure that the type of thing ended matches
    -      # the thing the user says it is ending, so we don't have to worry about
    -      # that.
    -      if ($top->{'type'} eq "module") {
    -
    -        # Set publicity (visibility) of objects within the module.
    -
    -        # First, the explicitly set ones.
    -        my $name;
    -        foreach $name (@{$top->{'publiclist'}}) {
    -          do_attrib ($name, "vis", 'public', "visibility");
    -        }
    -        foreach $name (@{$top->{'privatelist'}}) {
    -          do_attrib ($name, "vis", 'private', "visibility");
    -        }
    -
    -        # Second, the globally set ones (those obeying the default).
    -        my $obj;
    -        $top->{'defaultvis'} = "public" unless exists $top->{'defaultvis'};
    -        foreach $obj (@{$top->{'ocontains'}}) {
    -          $obj->{'vis'} = $top->{'defaultvis'} unless exists $obj->{'vis'};
    -        }
    -
    -        # Traverse (arbitrarily deeply) nested structures.
    -        sub traverse {
    -          my ($node) = @_;
    -          my $top = $stmts::topnest;   # HAVE NO IDEA WHY THIS IS NEEDED
    -          
    -          # Graduate nested MODULE PROCEDURE (mprocedure) to point to the
    -          # appropriate thing (either a function or a subroutine with that
    -          # name).
    -          if ($node->{'type'} eq "mprocedure") {
    -            die "Couldn't find module procedure $node->{'name'} (nothing with that name in module $top->{'name'})"
    -              unless exists $top->{'contains'}->{lc $node->{'name'}};
    -            
    -            my ($possibles) =
    -              $top->{'contains'}->{lc $node->{'name'}};
    -            die "Couldn't find module procedure $node->{'name'} in module $top->{'name'} (wrong type)"
    -              if !exists $possibles->{'subroutine'}
    -              && !exists $possibles->{'function'};
    -            die "Found both a subroutine and function to match module procedure $node->{'name'} in module $top->{'name'}"
    -              if exists $possibles->{'subroutine'}
    -              && exists $possibles->{'function'};
    -            
    -            if (exists $possibles->{'subroutine'}) {
    -              $node->{'bind'} = $possibles->{'subroutine'};
    -            } else {
    -              $node->{'bind'} = $possibles->{'function'};
    -            }
    -          }
    -
    -          # Recurse.
    -          map { traverse ($_) } @{$node->{'ocontains'}}
    -          if exists $node->{'ocontains'};
    -        }
    -        map { traverse ($_) } @{$top->{'ocontains'}};
    -      }
    -
    -      my @return_val = end_nest ($1, $2);
    -
    -      # Subroutines and functions in interface blocks must be noted at the
    -      # top level.  We do this with "interface" structures with the names
    -      # of the actual contained routines (unless this is already the
    -      # case).  Make sense?
    -      if ($top->{'type'} eq "interface" && $top->{'name'} eq "") {
    -          my $sub;
    -          foreach $sub (@{$top->{'ocontains'}}) {
    -              next if $sub->{'name'} eq $top->{'name'} ||
    -                      $sub->{'type'} eq "mprocedure";
    -
    -              my %copy = %$top;
    -              $copy{'name'} = $sub->{'name'};
    -              new_nest (\%copy);
    -              my $old_within = $sub->{'within'};
    -              new_struct ($sub);
    -              $sub->{'within'} = $old_within;
    -              end_nest ('interface', $sub->{'name'});
    -          }
    -      }
    -
    -      return @return_val;
    -   }
    -
    -   # SUBROUTINE/FUNCTION
    -   elsif ($line =~ /^(?:(.+?)\s+)?(subroutine|function)\s+(\w+)\s*(\([^()]*\))?(?:\s*result\s*\(\s*(\w+)\s*\))?$/i) {
    -      my ($type, $name, $parmstr, $rtype, $result) =
    -         (lc $2, $3,    $4,       $1,     $5);
    -
    -      die "Start of $type $name before `contains' section of $stmts::topnest->{'type'} $stmts::topnest->{'name'}"
    -          if defined $stmts::topnest && ! $stmts::topnest->{'incontains'} &&
    -             $stmts::topnest->{'type'} ne "interface";
    -      if (exists $stmts::nesting_by{'subroutine'} ||
    -          exists $stmts::nesting_by{'function'}) {
    -         my $n = 0;
    -         $n += scalar @{$stmts::nesting_by{'subroutine'}}
    -            if exists $stmts::nesting_by{'subroutine'};
    -         $n += scalar @{$stmts::nesting_by{'function'}}
    -            if exists $stmts::nesting_by{'function'};
    -         die "Routine nested in routine nested in routine" if $n > 1;
    -      }
    -
    -      $parmstr = "()" unless defined $parmstr;
    -      $parmstr = utils::trim (substr ($parmstr, 1, length ($parmstr) - 2));
    -      my (@parms);
    -      if ($parmstr) {
    -         @parms = split (/\s*,\s*/, $parmstr);
    -         my ($parm);
    -         foreach $parm (@parms) {
    -            die "Parameter `$parm' is not just a word or *"
    -              unless $parm =~ /^\w+|\*$/;
    -            ## * as a final argument allows the calling to specify a statement
    -            ## to jump as an alternative return address.  (Legacy Fortran!)
    -            ## Thanks to Art Olin for this info.
    -         }
    -      } else {
    -         @parms = ();
    -      }
    -
    -      my $struct = {
    -         'type'      => $type,
    -         'name'      => $name,
    -         'parms'     => \@parms,
    -         hashed_comments ()
    -      };
    -      new_nest ($struct);
    -
    -      $struct->{'result'} = $result if defined $result;
    -
    -      $rtype = "" unless defined $rtype;
    -      while ($rtype =~ /(?:^|\s+)(recursive|pure|elemental)$/i ||
    -             $rtype =~ /^(recursive|pure|elemental)(?:\s+|$)/i) {
    -        $rtype = $` . $'; # actually whichever is not blank
    -        $struct->{lc $1} = 1;
    -      }
    -      if ($rtype ne '') {
    -        $struct->{'rtype'} = parse_type ($rtype);
    -        new_struct ({
    -          'type'        => 'var',
    -          'name'        => (defined $result ? $result : $name),
    -          'vartype'     => $struct->{'rtype'},
    -          'comments'    => ''
    -        });
    -      }
    -
    -      return ($type, $struct);
    -   }
    -
    -   # TYPE definition (must go before variable declarations)
    -   elsif ($line =~ /^type(?:\s+|\s*(,.*)?::\s*)(\w+)$/i) {
    -     my $struct = new_nest ({
    -       'type' => 'type',
    -       'name' => $2,
    -       hashed_comments ()
    -     });
    -     if (defined $1) {
    -       my $attrib = utils::trim (substr ($1, 1));
    -       if ($attrib =~ /^(public|private)$/i) {
    -         $struct->{'vis'} = lc $attrib;
    -       } elsif ($attrib) {
    -         warn "Invalid attribute `$attrib' for derived-type declaration--should be just public or private";
    -       }
    -     }
    -     return $struct;
    -   }
    -
    -   # INTERFACE block (for overloading) or statement (for definition of external)
    -   elsif ($line =~ /^interface(?:\s+(\S.+))?$/i) {
    -       return new_nest ({
    -           'type' => 'interface',
    -           'name' => (defined $1 ? $1 : ""),
    -           hashed_comments ()
    -       });
    -   }
    -
    -   # CONTAINS
    -   elsif ($line =~ /^contains$/i) {
    -      die "`contains' found at top level" unless defined $stmts::topnest;
    -      die "`contains' found in $stmts::topnest->{'type'} $stmts::topnest->{'name'}" unless exists $stmts::topnest->{'incontains'};
    -      die "Multiple `contains' found in same scope"
    -         if $stmts::topnest->{'incontains'};
    -      die "`contains' found in interface definition"
    -         if $stmts::topnest->{'interface'};
    -      $stmts::topnest->{'incontains'} = 1;
    -      return ("contains", $stmts::topnest);
    -   }
    -
    -   # PUBLIC/PRIVATE/SEQUENCE
    -   elsif ($line =~ /^(public|private|sequence)(?=\s+[^=(]|::|$)(\s*::\s*)?/i) {
    -     my ($what, $rest) = (lc $1, $');
    -
    -     if (defined $stmts::topnest && $stmts::topnest->{'type'} eq "type") {
    -       die "public statement not allowed in a type declaration"
    -         if $what eq 'public';
    -       die "$1 cannot be qualified inside type declaration" if $rest;
    -       $stmts::topnest->{$what . 'type'} = 1;
    -       return ($what);
    -     } else {
    -       die "sequence statement only allowed immediately inside type declaration"
    -         if $1 eq 'sequence';
    -
    -       die "$1 statement not immediately inside a module or type declaration"
    -         unless defined $stmts::topnest && $stmts::topnest->{'type'} eq "module";
    -       if ($rest eq "") {  # Unqualified
    -         die "Unqualified $what in addition to unqualified " .
    -           $stmts::topnest->{'defaultvis'}
    -         if exists $stmts::topnest->{'defaultvis'};
    -         $stmts::topnest->{'defaultvis'} = $what;
    -         return ($what);
    -         
    -       } else {  # Qualified
    -         my @namelist = map {
    -           die "Invalid name `$_' specified in $what statement"
    -             unless /^\s*(\w+)(?:\s*(\([^()]+\)))?\s*$/i;
    -           $1 . (defined $2 ? $2 : "");
    -         } (split ',', $rest);
    -         push @{$stmts::topnest->{"${what}list"}}, @namelist;
    -         return ($what, @namelist);
    -       }
    -     }
    -   }
    -
    -    # OPTIONAL
    -    elsif ($line =~ /^optional(\s+|\s*::\s*)((\w|\s|,)+)$/i) {
    -        my $name;
    -        my @namelist = split (/\s*,\s*/, utils::trim ($2));
    -        foreach $name (@namelist) {
    -            do_attrib ($name, "optional", 1, "optional attribute");
    -        }
    -        return ('optional', @namelist);
    -    }
    -
    -   # Variable declarations
    -   elsif ($line =~ /^(integer|real|double\s*precision|character|complex|logical|type)\s*(\(|\s\w|[:,*])/i) {
    -      my ($vartype, $rest) = parse_part_as_type ($line);
    -      my (@attribs, @right);
    -      if ($rest =~ /^(.*)\:\:(.*)/) {
    -         my ($a, $b) = ($1, $2);
    -         @attribs = map (( utils::trim ($_) ), utils::balsplit (",", $a));
    -         @right = map (( utils::trim ($_) ), utils::balsplit (",", $b));
    -      } else {
    -         @attribs = ();
    -         @right = map (( &utils::trim ($_) ), utils::balsplit (",", $rest));
    -      }
    -      my ($r, @structs);
    -      foreach $r (@right) {
    -          my ($rl, $rassign) = &utils::balsplit ("=", $r);
    -          my ($rll, $starpart) = &utils::balsplit ("*", $rl);
    -          if (defined $starpart) {
    -            die "Sorry, I don't support 'character var*kind' yet; use 'character*kind var' instead";
    -          }
    -          $rll =~ /^ (\w+) (\s* \(.*\))? \s* $/x
    -              or die "Invalid variable declaration `$rll'";
    -          my ($name, $dimension) = ($1, $2);
    -          my ($initop, $initial);
    -          if (defined $rassign) {
    -            # implicit lead =
    -            $rassign =~ /^ (>?) \s* (.*) $/x
    -              or die "Invalid variable initialization `= $rassign'";
    -            ($initop, $initial) = ("=" . $1, $2);
    -          }
    -
    -          my $struct;
    -          $struct = {
    -              'type'        => 'var',
    -              'name'        => $name,
    -              'vartype'     => $vartype,
    -              hashed_comments ()
    -          };
    -          if (defined $initial) {
    -            $struct->{'initop'} = $initop;
    -            $struct->{'initial'} = expr_parse::parse_expr ($initial);
    -          }
    -          new_struct ($struct);
    -          push @structs, $struct;
    -
    -          my @attribs_copy = @attribs;
    -          push @attribs_copy, "dimension $dimension" if defined $dimension;
    -
    -          my ($attrib, @tempattribs);
    -          foreach $attrib (@attribs_copy) {
    -              if ($attrib =~ /^(public|private)$/i) {
    -                  $attrib = lc $attrib;
    -                  $struct->{'vis'} = $attrib;
    -              } elsif ($attrib =~ /^optional$/i) {
    -                  $attrib = lc $attrib;
    -                  $struct->{$attrib} = 1;
    -              } elsif ($attrib) {
    -                  warn "Unrecognized attribute `$attrib'"
    -                      unless $stmts::disable_warns;
    -                  push @tempattribs, $attrib;
    -              }
    -          }
    -
    -          $struct->{'tempattribs'} = \@tempattribs;
    -      }
    -
    -      return ('var', @structs);
    -   }
    -
    -   # USE
    -   elsif ($line =~ /^use\s+(\w+)($|,\s*)/i) {
    -      die "`use' found at top level" unless defined $stmts::topnest;
    -      die "`use' found in $stmts::topnest->{'type'} $stmts::topnest->{'name'}" unless exists $stmts::topnest->{'uses'};
    -      my $extra = length $' ? $' : undef;
    -      push @{$stmts::topnest->{'uses'}}, [$1, $extra];
    -
    -      return ('use', $1, $extra);
    -   }
    -   
    -   # CALL or IF (...) CALL [hack--xxx]
    -   elsif ($line =~ /^(?:if\s*\(.*\)\s*)?call\s+(\w+)\s*(?:\(\s*(.*?)\s*\))?$/i) {
    -      die "`call' found at top level" unless defined $stmts::topnest;
    -      die "`call' found in $stmts::topnest->{'type'} $stmts::topnest->{'name'}" unless exists $stmts::topnest->{'calls'};
    -      $stmts::topnest->{'calls'}->{$1} = 1;
    -      my @args = ();
    -      @args = split /\s*,\s*/, $2 if defined $2;
    -      return ('call', @args);
    -   }
    -   
    -   # Unrecognized statement
    -   else {
    -      if ($line =~ /^\w+/) {
    -         warn "Unrecognized statement beginning with word $&" unless $stmts::disable_warns;
    -      } else {
    -         warn "Unrecognized statement" unless $stmts::disable_warns;
    -      }
    -      return ('?', $line);
    -   }
    -}
    -
    -#####
    -# Returns a list that would fit right into a hash table you're making.  If
    -# there are no comments, returns the empty list.  The entry is called
    -# 'comments'.
    -#####
    -sub hashed_comments {
    -   if ($stmts::comments) {
    -      return ( 'comments', &$stmts::comments () );
    -   } else {
    -      return ();
    -   }
    -}
    -
    -#####
    -# Makes note of a new structure.  Called by new_nest, for example.
    -#####
    -sub new_struct {
    -   my ($struct) = @_;
    -   my $type = $struct->{'type'};
    -
    -   die "Basic structure must be found at a nesting level"
    -     unless defined $stmts::topnest;
    -
    -   if (exists ($stmts::topnest->{'contains'}->{lc $struct->{'name'}})) {
    -      die "Redefinition of $type $struct->{'name'} in $stmts::topnest->{'type'} $stmts::topnest->{'name'}"
    -         if exists ($stmts::topnest->{'contains'}->{lc $struct->{'name'}}->{$type});
    -      $stmts::topnest->{'contains'}->{lc $struct->{'name'}}->{$type} = $struct;
    -   } else {
    -      $stmts::topnest->{'contains'}->{lc $struct->{'name'}} =
    -         { $type => $struct };
    -   }
    -   push @{$stmts::topnest->{'ocontains'}}, $struct;
    -   $struct->{'within'} = $stmts::topnest;
    -}
    -
    -#####
    -# Starts a new nesting level represented by the given structure.  The
    -# structure must define the 'type' and 'name' entries.  You should not
    -# define the 'contains' or 'defaultvis' entry.
    -#####
    -sub new_nest {
    -   my ($struct) = @_;
    -   my ($type) = $struct->{'type'};
    -
    -   $struct->{'contains'} = { };
    -   $struct->{'ocontains'} = [ ];
    -
    -   # Program unit
    -   if ($type eq "subroutine" || $type eq "function" || $type eq "module" || $type eq "program") {
    -     $struct->{'incontains'} = 0;
    -     $struct->{'uses'} = [ ];
    -     $struct->{'interface'} = 0 if $type eq "subroutine" || $type eq "function";
    -   }
    -
    -   # Program unit with code
    -   if ($type eq "subroutine" || $type eq "function" || $type eq "program") {
    -     $struct->{'calls'} = { };
    -   }
    -
    -   if (defined $stmts::topnest) {
    -      my ($toptype) = $stmts::topnest->{'type'};
    -      if ($toptype eq "interface" && ($struct->{'type'} eq "subroutine" || $struct->{'type'} eq "function")) {
    -         $struct->{'interface'} = 1;
    -      } else {
    -         die "Nesting in $toptype not allowed" unless $toptype eq "subroutine" || $toptype eq "function" || $toptype eq "module" || $toptype eq "program";
    -      }
    -      new_struct ($struct) unless $struct->{'name'} eq "";
    -   }
    -   push @stmts::nesting, $struct;
    -   if (exists ($stmts::nesting_by{$type})) {
    -      push @{$stmts::nesting_by{$type}}, $struct;
    -   } else {
    -      $stmts::nesting_by{$type} = [ $struct ];
    -   }
    -   $stmts::topnest = $struct;
    -   return ( $type, $struct );
    -}
    -
    -#####
    -# Ends the current nesting level.  Optionally, you can pass the 'type' that
    -# it's supposed to be as the first argument.  Optionally, you can pass the
    -# 'name' it should have after that (as the second argument).
    -#####
    -sub end_nest {
    -  my ($type, $name) = @_;
    -  $type = lc $type if defined $type;
    -  unless (defined $stmts::topnest) {
    -    if (defined $name && defined $type) {
    -      die "Ended $type $name at top level";
    -    } elsif (defined $type) {
    -      die "Ended unnamed $type at top level";
    -    } else {
    -      die "END statement at top level";
    -    }
    -  }
    -  my ($struct) = pop @stmts::nesting;
    -  die "Ended $type while in $struct->{'type'} $struct->{'name'}"
    -    if defined $type && $type ne $struct->{'type'};
    -  die "Ended $name while in $struct->{'type'} $struct->{'name'}"
    -    if defined $name && $name !~ /^\Q$struct->{'name'}\E$/i;
    -  if (@stmts::nesting) {
    -    $stmts::topnest = $stmts::nesting[$#stmts::nesting];
    -  } else {
    -    $stmts::topnest = undef;
    -  }
    -  pop @{$stmts::nesting_by{$struct->{'type'}}};
    -  return ( "end" . (defined $type ? $type : ''), $struct );
    -}
    -
    -#####
    -# Parses the basic type that prefixes the given string.
    -# Returns (parsed type, string portion remaining).
    -#####
    -sub parse_part_as_type {
    -  my ($str) = @_;
    -
    -  $str =~ /^integer|real|double\s*precision|character|complex|logical|type/i
    -    or die "parse_part_as_type: Invalid input `$str'";
    -  my ($base, $rest) = ($&, $');
    -
    -  my $level = 0;
    -  ## Wait till we are outside of all parens and see a letter, colon, or comma.
    -  while ($rest =~ /[()a-zA-Z_:,]/g) {
    -    if ($& eq '(') {
    -      $level++;
    -    } elsif ($& eq ')') {
    -      $level--;
    -      die "Unbalanced parens (too many )'s)" if $level < 0;
    -    } elsif ($level == 0) {
    -      return (parse_type ($base . $`), $& . $');
    -    }
    -  }
    -  
    -  die "Couldn't split into type and rest for `$str'";
    -
    -# Some old, presumably less-efficient code:
    -#  my ($level, $len) = (0, length ($str));
    -#  my ($i, $c);
    -#  for ($i = length ($&); $i < $len; $i++) {
    -#    $c = substr ($str, $i, 1);
    -#    if ($c eq "(") {
    -#      $level++;
    -#    } elsif ($c eq ")") {
    -#      $level--;
    -#      die "Unbalanced parens (too many )'s)" if $level < 0;
    -#    } elsif ($level == 0 && $c =~ /^\w|:|,$/) {
    -#      last;
    -#    }
    -#  }
    -#  return (parse_type (substr ($str, 0, $i)), substr ($str, $i));
    -}
    -
    -#####
    -# Parses a basic type, creating a type structure for it:
    -#     integer [( [kind=] kind_val )]
    -#     real [( [kind=] kind_val )]
    -#     double precision                  (no kind is allowed)
    -#     complex [( [kind=] kind_val )]
    -#     character [( char_stuff )]
    -#     logical [( [kind=] kind_val )]
    -#     type (type_name)
    -#
    -# integer*number, real*number, complex*number, and logical*number are also
    -# supported as nonstandard Fortran extensions for kind specification.
    -# "number" can either be a direct integer or an expression in parentheses.
    -# 
    -# char_stuff is empty or (stuff), where stuff is one of:
    -#     len_val [, [kind=] kind_val]
    -#     kind=kind_val [, [len=] len_val]
    -#     len=len_val [, kind=kind_val]
    -# kind_val and len_val are expressions; len_val can also be just `*'.
    -# 
    -# The length can also be specified using the nonstandard Fortran extension
    -# character*number.  If number is `*', it must be in parentheses (indeed,
    -# any expression other than a number must be in parentheses).
    -#####
    -sub parse_type {
    -  my ($str) = @_;
    -
    -  # print "Parsing type: $str\n";
    -
    -  $str = utils::trim ($str);
    -  $str =~ /^(integer|real|double\s*precision|complex|character|logical|type)
    -    \s* (?: \( (.*) \) | \* \s* (\d+ | \(.*\)) )?$/ix
    -    or die "Invalid type `$str'";
    -  my $base = lc $1;
    -
    -  if ($base =~ /^double\s*precision$/) {
    -    die "double precision cannot have kind specification"
    -      if defined $2 || defined $3;
    -    return $typing::double_precision;
    -  }
    -
    -  if (defined $2 || defined $3) {
    -    my $star = defined $3;
    -    my $args = utils::trim ($star ? $3 : $2);
    -
    -    if ($base eq 'type') {
    -      die "type$args invalid--use type($args)" if $star;
    -      die "type(w) for non-word w" unless $args =~ /^\w+$/;
    -      return typing::make_type ($base, $args);
    -    } elsif ($base eq 'character') {
    -      my ($kind, $len, $rest);
    -      if ($star) {
    -        if ($args =~ /^\(\s*\*\s*\)$/) {
    -          $len = '*';
    -        } else {
    -          $len = expr_parse::parse_expr ($args);
    -        }
    -      } elsif ($args =~ /^kind\s*=\s*/i) {
    -        $args = substr ($args, length ($&));
    -        ($kind, $rest) = expr_parse::parse_part_as_expr ($args);
    -        if (defined $rest) {
    -          $rest = utils::trim ($rest);
    -          $rest =~ s/^len\s*=\s*//i;
    -          $len = ($rest eq '*' ? '*' : expr_parse::parse_expr ($rest));
    -        }
    -      } elsif ($args =~ /^len\s*=\s*/i) {
    -        $args = substr ($args, length ($&));
    -        if (substr ($args, 0, 1) eq '*') {
    -          $len = '*';
    -          $rest = $args;
    -          $rest =~ s/^\*\s*,// or $rest = undef;
    -        } else {
    -          ($len, $rest) = expr_parse::parse_part_as_expr ($args);
    -        }
    -        if (defined $rest) {
    -          $rest = utils::trim ($rest);
    -          $rest =~ /^kind\s*=\s*/
    -            or die "kind= specifier needed when len= specifier is given";
    -          $rest = substr ($rest, length ($&));
    -          $kind = expr_parse::parse_expr ($rest);
    -        }
    -      } else {  # len
    -        if (substr ($args, 0, 1) eq '*') {
    -          $len = "*";
    -          $rest = $args;
    -          $rest =~ s/^\*\s*,// or $rest = undef;
    -        } else {
    -          ($len, $rest) = expr_parse::parse_part_as_expr ($args);
    -        }
    -        if (defined $rest) {
    -          $rest = utils::trim ($rest);
    -          $rest = substr ($rest, length ($&)) if $rest =~ /^kind\s*=\s*/i;
    -          $kind = expr_parse::parse_expr ($rest);
    -        }
    -      }
    -      return typing::make_character_type ($kind, $len);
    -    } else {
    -      $args =~ s/^kind\s*=\s*//i unless $star;
    -      return typing::make_type ($base, expr_parse::parse_expr ($args));
    -    }
    -  } else {
    -    die "type without (type-name) after it" if $base eq 'type';
    -    die "No default type for `$base'"
    -      unless exists $typing::default_type{$base};
    -    return $typing::default_type{$base};
    -  }
    -}
    -
    -sub do_attrib {
    -    my ($name, $attrib, $val, $attribname) = @_;
    -    my ($struct);
    -    foreach $struct (values %{$stmts::topnest->{'contains'}->{lc $name}}) {
    -        die "Redefining $attribname of $struct->{'type'} $name from " .
    -            "$struct->{$attrib} to $val" if exists $struct->{$attrib};
    -        $struct->{$attrib} = $val;
    -    }
    -}
    -
    -1;
    diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/typing.pl b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/typing.pl
    deleted file mode 100644
    index 3c140fb7..00000000
    --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/typing.pl
    +++ /dev/null
    @@ -1,516 +0,0 @@
    -package typing;
    -
    -use strict;
    -
    -# Stores the type of each variable.
    -$typing::typeof = "";
    -# Stack: one typeof per scope.
    -@typing::typeofs = ();
    -
    -# Stores the definition of each type.
    -$typing::typedef = "";
    -# Stack: one typedef per scope.
    -@typing::typedefs = ();
    -
    -# Stores the definition of each function/operator.
    -$typing::code = "";
    -# Stack: one code per scope.
    -@typing::codes = ();
    -
    -
    -# DOUBLE PRECISION type.
    -$typing::double_precision = typing::make_type ('real', 8, "double precision");
    -
    -# Default character kind.
    -$typing::default_character_kind = 1;
    -
    -# Default types.
    -%typing::default_type = (
    -  'complex' => typing::make_type ('complex', 8, "complex"),
    -  'integer' => typing::make_type ('integer', 4, "integer"),
    -  'logical' => typing::make_type ('logical', 1, "logical"),
    -  'real'    => typing::make_type ('real', 4, "real"),
    -);
    -$typing::default_type{'character'} = typing::make_character_type ();
    -
    -# Types with wild sub and any other info (just a base defined).
    -$typing::wild_type = {
    -   'complex'   => typing::make_type ('complex'),
    -   'real'      => typing::make_type ('real'),
    -   'integer'   => typing::make_type ('integer'),
    -   'logical'   => typing::make_type ('logical'),
    -   'character' => typing::make_type ('character')
    -};
    -
    -
    -# Precedence of operations; based on that which is in expr_parse.y.
    -# Higher precedence indicated by larger number.
    -$typing::precedence = {
    -  '.eqv.'  => 1,
    -  '.neqv.' => 1,
    -  '.or.'   => 2,
    -  '.and.'  => 3,
    -  '.not.'  => 4,
    -  '<'      => 5,
    -  '>'      => 5,
    -  '<='     => 5,
    -  '>='     => 5,
    -  '=='     => 5,
    -  '/='     => 5,
    -  '//'     => 6,
    -  '+'      => 7,
    -  '-'      => 7,
    -  'u+'     => 8,
    -  'u-'     => 8,
    -  '*'      => 9,
    -  '/'      => 9,
    -  '**'     => 10,
    -  '%'      => 11,
    -  '%call'  => 11,
    -  '%colon' => 30, # this is a guess
    -  '%namedarg' => 30, # this is a guess
    -  '%array' => 40,    # as in "forty days and forty nights," which means
    -  '%const' => 40,    #    "a long time," here we use 40 as an approx. to infty.
    -  '%var'   => 40,
    -  '%do'    => 40,
    -};
    -
    -#####
    -# Starts a new scope.  If this is a top-level scope, initializes the codes
    -# to intrinsics and the like.
    -#####
    -sub new_scope {
    -   my ($newtypeof, $newtypedef, $newcode);
    -
    -   if (@typing::typeofs) {
    -      $typing::typeof = utils::copy_hash ($typing::typeof);
    -      $typing::typedef = utils::copy_hash ($typing::typedef);
    -      $typing::code = utils::copy_hash ($typing::code);
    -   } else {
    -      $typing::typeof = {};
    -      $typing::typedef = {};
    -      $typing::code = {};
    -      $typing::code{"//"} = [ {
    -         'parms' => [ $typing::wild_type{'character'},
    -                      $typing::wild_type{'character'} ],
    -         'return' => $typing::wild_type{'character'}
    -      } ];
    -      my ($int, $real, $logical, $char) = ( $typing::wild_type{'integer'},
    -         $typing::wild_type{'real'}, $typing::wild_type{'logical'},
    -         $typing::wild_type{'character'} );
    -      my ($op);
    -      foreach $op ("+", "-", "*", "/") {
    -         $typing::code->{$op} = [
    -            { 'parms' => [ $int, $int ], 'return' => $int },
    -            { 'parms' => [ $real, $int ], 'return' => $real },
    -            { 'parms' => [ $int, $real ], 'return' => $real },
    -            { 'parms' => [ $real, $real ], 'return' => $real }
    -         ];
    -      }
    -      $typing::code->{"**"} = [
    -         { 'parms' => [ $int, $int ], 'return' => $int },
    -         { 'parms' => [ $real, $int ], 'return' => $real },
    -         { 'parms' => [ $int, $real ], 'return' => $real },
    -         { 'parms' => [ $real, $real ], 'return' => $real },
    -      ];
    -      foreach $op ("u+", "u-") {
    -         $typing::code->{$op} = [
    -            { 'parms' => [ $int ], 'return' => $int },
    -            { 'parms' => [ $real ], 'return' => $real }
    -         ];
    -      }
    -      foreach $op ("<", "<=", "==", "/=", ">", ">=") {
    -         $typing::code->{$op} = [
    -            { 'parms' => [ $int, $int ], 'return' => $logical },
    -            { 'parms' => [ $real, $int ], 'return' => $logical },
    -            { 'parms' => [ $int, $real ], 'return' => $logical },
    -            { 'parms' => [ $real, $real ], 'return' => $logical },
    -            { 'parms' => [ $char, $char ], 'return' => $logical }
    -         ];
    -      }
    -      foreach $op (".or.", ".and.", ".eqv.", ".neqv.") {
    -         $typing::code->{$op} = [
    -            { 'parms' => [ $logical, $logical ], 'return' => $logical }
    -         ];
    -      }
    -      $typing::code->{".not."} = [
    -         { 'parms' => [ $logical ], 'return' => $logical }
    -      ];
    -      $typing::code->{"//"} = [
    -         { 'parms' => [ $char, $char ], 'return' => $char }
    -      ];
    -   }
    -
    -   push @typing::typeofs, $typing::typeof;
    -   push @typing::typedefs, $typing::typedef;
    -   push @typing::codes, $typing::code;
    -}
    -
    -#####
    -# Ends an old scope.
    -#####
    -sub end_scope {
    -   pop @typing::typeofs;
    -   pop @typing::typedefs;
    -   pop @typing::codes;
    -
    -   if ($typing::typeofs) {
    -      $typing::typeof = $typing::typeofs[$#typing::typeofs];
    -      $typing::typedef = $typing::typedefs[$#typing::typedefs];
    -      $typing::code = $typing::codes[$#typing::codes];
    -   }
    -}
    -
    -#####
    -# Creates a new type with specified base and sub.
    -# Note that sub corresponds to kind for built-in types.
    -# sub can be left out for a wild type.
    -# A third argument, print, can specify how the type should print.  Used for
    -# default types, double precision, etc.
    -#####
    -sub make_type {
    -  my ($base, $sub, $print) = @_;
    -  my $type = { 'base' => $base };
    -  $type->{'sub'} = $sub if $sub;
    -  $type->{'print'} = $print;
    -  return $type;
    -}
    -
    -#####
    -# Creates a new complex type with specified types of "sides."
    -#####
    -sub make_complex_type {
    -  my ($type1, $type2) = @_;
    -  my ($base1, $base2) = ($type1->{'base'}, $type2->{'base'});
    -  die "Complex constant must have real and/or integer parts, but I found types $base1 and $base2"
    -    unless ($base1 eq 'integer' || $base1 eq 'real') &&
    -           ($base2 eq 'integer' || $base2 eq 'real');
    -  my $which;
    -  # From Metcalf and Reed's Fortran 90 Explained, if one of the types is an
    -  # integer then the kind of the complex is the kind of the other type.
    -  if ($base1 eq 'integer') {
    -    $which = $type2;
    -  } elsif ($base2 eq 'integer') {
    -    $which = $type1;
    -  } else {
    -    if ($type1->{'sub'} > $type2->{'sub'}) {
    -      $which = $type1;
    -    } else {
    -      $which = $type2;
    -    }
    -  }
    -  return {
    -    'base'    => 'complex',
    -    'sub'     => $which
    -  };
    -}
    -
    -#####
    -# Creates a new character type with specified sub (kind) and len.
    -#####
    -sub make_character_type {
    -  my ($sub, $len) = @_;
    -  $sub = $typing::default_character_kind unless defined $sub;
    -  $sub = [ "%const", $typing::default_type{'integer'}, $sub ] unless ref $sub;
    -  $len = "1" unless defined $len;
    -  $len = [ "%const", $typing::default_type{'integer'}, $len ]
    -    unless ref $len || $len eq "*";
    -  return {
    -    'base' => 'character',
    -    'sub'  => $sub,
    -    'len'  => $len
    -  };
    -}
    -
    -#####
    -# Returns true iff the given type was created to be the default of its kind.
    -# This has no meaning for compound types (hence it returns false).  For
    -# characters, there's a slight bug in that it will say that the type was
    -# created default even if you specify the default explicitly.  No biggie.
    -# Note that the defaultness is only for the KIND, not the LENGTH.
    -# 
    -# I could fix the above-mentioned problem by storing a 'default' entry just for
    -# the default types.  Then is_default_kind just translates to an exists test.
    -# This is much simpler and avoids the wierd checks for double precision numbers
    -# (0.0d0 ==> don't show a kind.  This is really "default").  This would be
    -# kinda nice but 'default' is probably the wrong word.
    -#####
    -sub is_default_kind {
    -   my ($type) = @_;
    -
    -   if ($type->{'base'} eq "character") {
    -     my ($top, @rest) = @{$type->{'sub'}};
    -     return ($top eq "%const" && $rest[0] eq $typing::default_type{'integer'}
    -          && $rest[1] == $typing::default_character_kind);
    -   } else {
    -      return (exists $typing::default_type{$type->{'base'}} && $typing::default_type{$type->{'base'}} eq $type);
    -   }
    -}
    -
    -#####
    -# Converts the given type to a string, written in Fortran 90 code.
    -# Only displays the kind if it was specified explicitly.  Slight bug:
    -# if you say character (kind=1) :: c, then it will print character :: c.
    -# (This is only for characters with default kind.  For other types with
    -# default kind explicitly specified, it is printed.)
    -#####
    -sub type_to_f90 {
    -  my ($type) = @_;
    -
    -  # This covers the case where the kind is the default, except for characters.
    -  return $type->{'print'} if defined $type->{'print'};
    -
    -  my $mods = "";
    -  if ($type->{'base'} eq "character") {
    -    if ($type->{'len'} eq "*") {
    -      $mods = "len=*";
    -    } elsif ($type->{'len'}->[0] ne "%const" ||
    -             $type->{'len'}->[1] != $typing::default_type{'integer'} ||
    -             $type->{'len'}->[2] ne "1") {
    -      $mods = "len=" . expr_to_f90 ($type->{'len'});
    -    }
    -    unless (is_default_kind ($type)) {
    -      $mods .= ", " unless $mods eq '';
    -      $mods .= "kind=" . expr_to_f90 ($type->{'sub'});
    -    }
    -  } elsif ($type->{'base'} eq "type") {
    -    $mods = "$type->{'sub'}";
    -  } else {
    -    $mods = "kind=" . expr_to_f90 ($type->{'sub'});
    -  }
    -  $mods = " ($mods)" unless $mods eq '';
    -  return $type->{'base'} . $mods;
    -}
    -
    -#####
    -# Converts an expression right back to a string, doing "no" conversion (i.e.,
    -# output is in Fortran 90).  Optionally returns the precedence of the outmost
    -# operation in the expression (see $typing::precedence).
    -#####
    -sub expr_to_f90 {
    -  my ($exprptr) = @_;
    -  my ($op, @children) = @$exprptr;
    -
    -  die "Unrecognized operation $op",%$op," (has no precedence?)"
    -    unless exists $typing::precedence->{$op};
    -  my $prec = $typing::precedence->{$op};
    -
    -  my $answer;
    -  if ($op eq "%") {
    -    my ($struct, $elem) = @children;
    -    my ($s, $sprec) = expr_to_f90 ($struct);
    -    $s = "($s)" if $prec > $sprec;
    -    $answer = "$s%$elem";
    -  } elsif ($op eq "%var") {
    -    $answer = $children[0];
    -  } elsif ($op eq "%const") {
    -    my ($type, $val) = @children;
    -    if ($type->{'base'} eq 'complex') {
    -      if (!is_default_kind ($type->{'sub'})) {
    -        my ($k1, $k2) = ("", "");
    -        $k1 = "_$type->{'sub'}->{'sub'}" unless $val->[0] =~ /D[+-]?\d+$/i;
    -        $k2 = "_$type->{'sub'}->{'sub'}" unless $val->[1] =~ /D[+-]?\d+$/i;
    -        $answer = "($val->[0]$k1, $val->[1]$k2)";
    -      } else {
    -        $answer = "($val->[0], $val->[1])";
    -      }
    -    } elsif (is_default_kind ($type) || $val =~ /D[+-]?\d+$/i) {
    -      $answer = $val;
    -    } else {
    -      $answer = "${val}_$type->{'sub'}";
    -    }
    -  } elsif ($op eq "%array") {
    -    $answer = "(/ " . join (", ", map { (expr_to_f90 ($_))[0] } @children)
    -            . " /)";
    -  } elsif ($op eq "%colon") {
    -    my ($left, $right) = @children;
    -    $left = (expr_to_f90 ($left))[0] if $left ne '';
    -    $right = (expr_to_f90 ($right))[0] if $right ne '';
    -    $answer = $left . ":" . $right;  # : has ultimately low precedence
    -  } elsif ($op eq "%namedarg") {
    -    my ($left, $right) = @children;
    -    $answer = $left . " = " .
    -              (expr_to_f90 ($right))[0];  # = has ultimately low precedence
    -  } elsif ($op eq "%do") {
    -    my ($child, $var, @args) = @children;
    -    $answer = "(" . expr_to_f90 ($child) . ", " . $var . " = " .
    -              join (", ", map { (expr_to_f90 ($_))[0] } @args) . ")";
    -  } elsif ($op eq "%call") {
    -    ($op, @children) = @children;
    -    my ($s, $sprec) = expr_to_f90 ($op);
    -    $s = "($s)" if $prec > $sprec;
    -    $answer = "$s (" . join (", ", map ((expr_to_f90 ($_))[0], @children))
    -      . ")";
    -  } elsif (scalar @children == 1) {
    -    $op = substr ($op, 1) if substr ($op, 0, 1) eq 'u';
    -    my ($s, $sprec) = expr_to_f90 ($children[0]);
    -    $s = "($s)" if $prec > $sprec;
    -    $answer = "$op$s";
    -  } elsif (scalar @children == 2) {
    -    my ($s1, $sprec1) = expr_to_f90 ($children[0]);
    -    $s1 = "($s1)" if $prec > $sprec1;
    -    my ($s2, $sprec2) = expr_to_f90 ($children[1]);
    -    $s2 = "($s2)" if $prec > $sprec2;
    -    $answer = "$s1 $op $s2";
    -  } else {
    -    die "expr_to_f90: Unrecognized operation $op with " . (scalar @children) .
    -      " children";
    -  }
    -
    -  if (wantarray) {
    -    return ($answer, $prec);
    -  } else {
    -    return $answer;
    -  }
    -}
    -
    -#####
    -# Computes the type of the given expression (which is passed by reference).
    -# Returns a reference to the actual type.
    -#####
    -sub expr_type {
    -   my ($exprptr) = @_;
    -   my ($op, @children) = @$exprptr;
    -
    -   if ($op eq "%") {
    -      my ($struct, $elem) = @children;
    -      my ($type) = expr_type ($struct);
    -      die "expr_type: \%$elem failed: left part is not a compound type" unless $type->{'base'} eq "type";
    -      my ($typedef) = $typing::typedef->{$type->{'sub'}};
    -      my ($elemtype) = $typedef->{$elem};
    -      die "expr_type: \%$elem failed: left part does not include $elem" unless $elemtype;
    -      return $elemtype;
    -   } elsif ($op eq "%var") {
    -      my ($var) = @children;
    -      my ($vartype) = $typing::typeof->{$var};
    -      die "expr_type: Variable $var undefined" unless $vartype;
    -      return $vartype;
    -   } elsif ($op eq "%const") {
    -      my ($type, $val) = @children;
    -      return $type;
    -   } elsif ($op eq "%array") {
    -      # HERE
    -   } elsif ($op eq "%colon") {
    -      my ($string, $left, $right) = @children;
    -      my ($stringtype) = expr_type ($string);
    -      die "expr_type: colon notation for non-character string" if $stringtype->{'base'} ne "character";
    -      die "expr_type: colon notation for character array" if $stringtype->{'dimension'};
    -      return typing::make_character_type ($stringtype->{'sub'}, "*");
    -   } elsif ($op eq "%call") {
    -      ($op, @children) = @children;
    -      my ($subop, @subchildren) = @$op;
    -      if ($subop eq "%var") {
    -         ($op) = @subchildren;
    -         # Fall through: we allow overloaded function name in this special case.
    -      } else {
    -         # Function call without overloading or an array reference.
    -         my ($optype) = expr_type ($op);
    -
    -         if ($optype->{'dimension'}) {  # array reference
    -            return make_type ($optype->{'base'}, $optype->{'sub'});
    -         } else {
    -            die "expr_type: Array/function call for something that is neither" unless $optype->{'base'} eq "interface";
    -            # HERE function call without overloading.
    -         }
    -      }
    -   }
    -
    -   my ($opcodes) = $typing::code->{$op};
    -   die "Operation/function $op undefined" unless $opcodes;
    -   my (@childtypes) = ();
    -   my ($child);
    -   foreach $child (@children) {
    -      print "childtypes was: @childtypes\n";
    -      print "type of $child is ", expr_type ($child), "\n";
    -      push @childtypes, expr_type ($child);
    -      print "childtypes is now: @childtypes\n";
    -   }
    -   my ($opcode);
    -   foreach $opcode (@$opcodes) {
    -      print "children: @children\n";
    -      print "childtypes: @childtypes\n";
    -      if (typing::subtypes_list (\@childtypes, $opcode->{'parms'})) {
    -         my ($parm);
    -         my ($ret) = $opcode->{'return'};
    -         if ($ret->{'base'} eq "character" && ! $ret->{'len'}) {
    -            $ret->{'len'} = 0;
    -find_len:
    -            foreach $parm (@$opcode->{'parms'}) {
    -               if ($parm->{'base'} eq $ret->{'base'}) {
    -                  if ($parm->{'len'} eq "*") {
    -                     $ret->{'len'} = "*";
    -                     last find_len;
    -                  } else {
    -                     $ret->{'len'} += $parm->{'len'};
    -                  }
    -               }
    -            }
    -         }
    -         if ($ret->{'sub'}) {
    -            return $ret;
    -         } else {
    -            # Make intrinsic type's kind: look for all parameters with the same
    -            # base type, and use the maximum kind out of those.
    -            my ($maxkind) = -1;
    -            foreach $parm (@$opcode->{'parms'}) {
    -               if ($parm->{'base'} eq $ret->{'base'}) {
    -                  $maxkind = $parm->{'sub'} if $maxkind < $parm->{'sub'};
    -               }
    -            }
    -            die "expr_type: Internal error caused by new_scope" if $maxkind < 0;
    -            return { %$ret, 'sub' => $maxkind };
    -         }
    -      }
    -   }
    -   die "Operation/function $op defined but not for this (these) type(s)";
    -}
    -
    -#####
    -# Returns if first type is a subtype of the second type.
    -# This currently only supports intrinsic types (integer*4 subtypes integer*?).
    -#####
    -sub subtypes {
    -   my ($t1, $t2) = @_;
    -   return 0 if $t1->{'base'} ne $t2->{'base'};
    -   if ($t1->{'base'} eq "type") {
    -      return 0 if $t1->{'sub'} eq $t2->{'sub'};
    -   } else {
    -      if ($t1->{'base'} eq "character") {
    -         if ($t1->{'len'}) {
    -            return 0 unless $t1->{'len'};
    -            return 0 if $t2->{'len'} != $t1->{'len'};
    -         }
    -      }
    -      if ($t1->{'base'} eq "interface") {
    -         # HERE fill this in when I do function types ("interface").
    -      }
    -      if ($t1->{'sub'}) {
    -         return 0 unless $t1->{'sub'};
    -         return 0 if $t2->{'sub'} ne $t1->{'sub'};
    -      }
    -   }
    -   return 1;
    -}
    -
    -#####
    -# Returns if first type is a subtype of the second type, where the first
    -# and second type are (conceptually) tuples.  That is, the lengths must be
    -# equal, and each element must subtype the corresponding element.
    -# The lists are passed as references.
    -#####
    -sub subtypes_list {
    -   my ($l1ptr, $l2ptr) = @_;
    -   my (@l1) = @$l1ptr;
    -   my (@l2) = @$l2ptr;
    -   return 0 if $#l1 != $#l2;
    -
    -   print "l1 is: @l1\n";
    -   print "l2 is: @l2\n";
    -
    -   my ($i);
    -   for ($i = 0; $i <= $#l1; $i++) {
    -      print "calling subtypes with $l1[$i] and $l2[$i]\n";
    -      return 0 unless typing::subtypes ($l1[$i], $l2[$i]);
    -   }
    -   return 1;
    -}
    diff --git a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/utils.pl b/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/utils.pl
    deleted file mode 100644
    index 8e409f0d..00000000
    --- a/CARMAchem_GridComp/CARMA/bin/f90doc-0.4.0/utils.pl
    +++ /dev/null
    @@ -1,87 +0,0 @@
    -package utils;
    -
    -use strict;
    -
    -sub copy_list {
    -   my ($listref) = @_;
    -   my @list;
    -   @list = @$listref;
    -   \@list;
    -}
    -
    -sub copy_hash {
    -   my ($hashref) = @_;
    -   my %hash;
    -   %hash = %$hashref;
    -   \%hash;
    -}
    -
    -sub hash2str {
    -   my ($hash) = @_;
    -   my ($key, $s);
    -   $s = "{\n";
    -   foreach $key (keys %$hash) {
    -      $s .= "   $key => $hash->{$key}\n";
    -   }
    -   $s .= "}";
    -}
    -
    -sub trim {
    -   my ($s) = @_;
    -   $s =~ s/^\s*//;
    -   $s =~ s/\s*$//;
    -   $s;
    -}
    -
    -# balsplit (sep, string) splits string into pieces divided by sep when
    -# sep is "outside" ()s.  Returns a list just like split.
    -sub balsplit {
    -   my ($sep, $str) = @_;
    -   my ($i, $c);
    -   my ($len, $level, $left) = (length ($str), 0, 0);
    -   my (@list) = ();
    -
    -   for ($i = 0; $i < $len; $i++) {
    -      $c = substr ($str, $i, 1);
    -      if ($c eq "(") {
    -         $level++;
    -      } elsif ($c eq ")") {
    -         $level--;
    -         die "balsplit: Unbalanced parens (too many )'s)" if $level < 0;
    -      } elsif ($c eq $sep && $level == 0) {
    -         push (@list, substr ($str, $left, $i-$left));
    -         $left = $i + 1;
    -      }
    -   }
    -
    -   push (@list, substr ($str, $left));
    -   return @list;
    -}
    -
    -# Takes the first word of each element of the list.
    -sub leftword {
    -   my ($listref) = @_;
    -   my @out = ();
    -   my ($x);
    -   foreach $x (@$listref) {
    -      $x =~ s/^\s*//;
    -      $x =~ /^\w*/;
    -      push (@out, $&);
    -   }
    -   @out;
    -}
    -
    -sub remove_blanks {
    -   my ($listref) = @_;
    -   my @out = ();
    -   my ($x);
    -   foreach $x (@$listref) {
    -      push (@out, $x) unless $x =~ /^\s*$/;
    -   }
    -   @out;
    -}
    -
    -sub do_nothing {
    -}
    -
    -1;
    diff --git a/CARMAchem_GridComp/CARMA/doc/ChangeLog b/CARMAchem_GridComp/CARMA/doc/ChangeLog
    deleted file mode 100644
    index b3cc10e4..00000000
    --- a/CARMAchem_GridComp/CARMA/doc/ChangeLog
    +++ /dev/null
    @@ -1,351 +0,0 @@
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen, Mike Mills
    -Date: March 18, 2013
    -
    -One-line Summary:
    -
    -Some bug fixes related to sulfates, to evaporation, mie code
    -and coagulation kernels.
    -
    -Purpose of changes:
    -
    -The wet radius for sulfates was not being calculated properly, since
    -it was missing a dry particle density term. The new wet radius will be
    -roughly twice what it was before. Also made some changes to allow specification
    -of sulfuric acid in CARMASTATE_CreateFromReference, so that initialization
    -from a reference profile can be used with sulfate models. Put some limits
    -on calculations in sulfate utilities for practical temperature ranges.
    -
    -Fixed a problem with total evaporation that affected some models.
    -
    -Fixed a problem with types in the optical properties calculation when
    -using Bohren and Huffman.
    -
    -Fixed a problem with the way the coagulation due to convection was
    -being calculated that caused asymmetric coagulation kernels.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: September 7, 2012
    -
    -One-line Summary:
    -
    -Fix bug in pheat.F90 when no solute is specified.
    -
    -Purpose of changes:
    -
    -A check to exclude a calculation in the particle growth code when
    -no solutes are present was coded incorrectly causing the model
    -to crash when growth is enabled, core elements exist in the group
    -and no solutes are defined for the cores.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: January 26, 2011
    -
    -One-line Summary:
    -
    -Add capability for clear sky processing when using in-cloud
    -and gridbox average particles.
    -
    -Purpose of changes:
    -
    -Allows two sets of microphysical calculations to be done in one
    -Step call. One is for the fraction of the grid box that is
    -in-cloud and the other is for the remaining clear sky portion.
    -The entire mass of particle groups that are "cloud" are only
    -processed in the in-cloud portion. Other groups can also
    -condense liquid, but be over the entire gridbox. These would
    -have "is cloud" as false and will be processed in both the
    -in-cloud and clear sky portions of the grid box. Sedimentation
    -is only done once on the gridbox average values, but coagulation
    -and growth are done twice.
    -
    -Two tests have been added for this :
    -  - GROWINTEST  = in-cloud test
    -  - GROWCLRTEST = in-cloud & clear sky test
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen, Mike Mills
    -Date: December 1, 2011
    -
    -One-line Summary:
    -
    -Bug fixes for sulfate aerosols and some additional diagnostic
    -information.
    -
    -Purpose of changes:
    -
    -Fixes problems found while trying to test sulfates aerosols in
    -WACCM/CARMA, where every cold temperatures are possible. Also
    -Also producing some additional diagnostics to help diagnose the
    -sulfate physics.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: November 8, 2011
    -
    -One-line Summary:
    -
    -Allow configurable selection of aerosol freezing method and cleanup
    -error messages.
    -
    -Purpose of changes:
    -
    -Made nucproc a bit field, so that the aerosol freezing method can
    -be specified without needing to modify the code, and so that it can
    -be combined with nucleation of glassy aerosols. Also surpress an
    -error message from negative temperature unless it is the last
    -retry. Added a test case (NUC2TEST.exe) to see at what supersaturation
    -aerosol freezing begins.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen, Mike Mills
    -Date: October 9, 2011
    -
    -One-line Summary:
    -
    -Fixes to support high (thermospheric) temperatures in the sulfate
    -code.
    -
    -Purpose of changes:
    -
    -Modified some of the sulfate code to handle temperatures that
    -result in 0 wtpct. This was causing WACCM to crash with the
    -sulfate model.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen, Tianyi Fan
    -Date: September 3, 2011
    -
    -One-line Summary:
    -
    -Added sulfate aerosols.
    -
    -Purpose of changes:
    -
    -Added support for sulfuric acid and sulfate aerosols. Also fixed
    -some problems with the way latent and particle heats were applied
    -when substepping was being used. Made the convergence criteria
    -more configurable. The sulfate aerosol code is a significantly
    -modified version of code from that provided by Tianyi Fan. Her
    -code started with work done by Mike Mills and then was modified
    -by Jason English, Tianyi Fan and Chuck Bardeen.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: August 19, 2011
    -
    -One-line Summary:
    -
    -Bug fixes and enhancements to the particle heating code.
    -
    -Purpose of changes:
    -
    -Fixed a few bugs found running in the debugger, and changed
    -dry deposition so that surface friction and aerodynamic resistance
    -are provided and used per land surface type.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: August 9, 2011
    -
    -One-line Summary:
    -
    -Enhancements to the particle heating code.
    -
    -Purpose of changes:
    -
    -Added band integrals for the planck function to provide a more
    -accurate estimate of outgoing radiation for particle heating. Also
    -modified the test case to start the SW band at a non-zero wavelength.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: August 4, 2011
    -
    -One-line Summary:
    -
    -Enhancements to the particle heating code.
    -
    -Purpose of changes:
    -
    -Added the ability to flag overlap bands in for the particle heating
    -calculation. These are bands which have added energy coming in; however,
    -the emission should only be done in one of the bands. This is needed
    -for the CAM radiation bands. Added the Bohren and Huffman mie routine,
    -to provide a routine that handles a broader array of sizes and refractive
    -indicies. Also changed the output from particle temperature to the difference
    -in particle temperature, since that is more relevant to the impact on
    -growth rates and temperatures may change for other reasons making it hard
    -to do the difference later.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: July 14, 2011
    -
    -One-line Summary:
    -
    -Setup tests to be run as regression tests.
    -
    -Purpose of changes:
    -
    -Added two new scripts run-all.csh and run-regress.csh. run-regress.csh
    -runs the tests and then compares the answer to previously generated
    -results in tests/bench. An error is generated if the results differ.
    -To make this usable, all of the tests have be modified to have minimal
    -output to the screen for normal operation.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: July 13, 2011
    -
    -One-line Summary:
    -
    -Support for particle heating and some bug fixes
    -
    -Purpose of changes:
    -
    -Added support for passing radiative intensity into CARMA and
    -having that affect the particle growth rates and partcile
    -temperature.This is exercised by carma_pheattest.F90. Changed
    -initialization, so pkernel is only calcualted once to speed
    -things up a little. Made area ratio and radius ratio group
    -properties, so there is more flexibility for setting group
    -shape.
    -
    -===============================================================
    -Tag name: 
    -Originator(s): Charles Bardeen
    -Date: June 8, 2011
    -
    -One-line Summary:
    -
    -Support for PGI and g95 compilers
    -
    -Purpose of changes:
    -
    -Some Fortran compilers have preprocessors that failed to correctly handle
    -the macros because they recursively tried to replace the name multiple
    -times. To prevent this, the field names have been changes to have f_XXX
    -so they don't conflict with the macro name XXX.
    -
    -===============================================================
    -
    -Tag name: 3.0.1
    -Originator(s): Tianyi Fan, Charles Bardeen
    -Date: December 1, 2010
    -
    -One-line Summary:
    -
    -Add wet deposition to sedimentation.
    -
    -Purpose of changes:
    -
    -Added support for dry deposition to the sedimentation routine in CARMA.
    -Surface friction and land fraction are supplied by the parent model.
    -
    -===============================================================
    -
    -Tag name: 3.0.0
    -Originator(s): Charles Bardeen
    -Date: August 11, 2010
    -
    -One-line Summary:
    -
    -Initial release of the F90 version of CARMA based upon F77 CARMA 2.3
    -
    -Purpose of changes:
    -
    -A major revision of CARMA 2.3, with design goals of porting it to
    -Fortran 90, and designing it to be embedded in other models like CAM
    -and GEOS.
    -
    -Changes for F90:
    -- All code converted to F90 (wrappers to keep core code similar to F77 code)
    -- Use modules to replace common blocks
    -- Dynamic memory allocation
    -- Thread safe
    -- Use array operations when possible
    -- Use implicit none
    -
    -Changes for embedded models:
    -- Single column
    -- Programmatic interface to define microphysical model
    -- Initialize from parent model state (mks units)
    -- Step() can be multithreaded
    -- Generate optical properties (mie coefficients)
    -- Scale for cloud fraction
    -- Detrain particles
    -- Store information about CARMA needed for parent models (e.g. wet deposition coefficients, diagnostic group, ...)
    -- Allow a fixed defintion of latent heat, consitent with parent model
    -
    -Updated algortihms:
    -- Aerosol freezing (Koop 2000)
    -- Water saturation vapor pressure (Murphy & Koop 2005)
    -
    -New algorithms:
    -- Nucleation of glassy aerosols (Murray et al. 2010)
    -- Ice particle density as a function of size (Heymsfield & Schmitt, 2010)
    -- Ice fall velocity (Heymsfield & Westbrook, 2010)
    -- Particle swelling with relative humidity, wet radius (Gerber 1985; Fitzgerald 1975)
    -- Brownian Diffusion
    -
    -New features:
    -- Allow specification of minimum mass rather than just radius
    -- Variable density (per bin) within an element
    -- Determine sedimentation to the surface
    -- Dynamically allocate ACAP in miess based upon NXM1
    -
    -Performance:
    -- Only initialize the components needed for the model configuration
    -- Add retry logic to newstate/microfast, to minimize the number of substeps needed
    -- Reduce size of data structures used by CARMA
    -- Reorder some operations for faster array access
    -- Optional initialization to a fixed reference temperature profile
    -- Optional explicit sedimentation (substepped)
    -- Reuse allocated memory in CARMASTATE to reduce memory allocation
    -
    -Bugs fixed:
    -- Mass & energy conservation
    -- Various bugs in fall velocity calculation
    -- Scaling problems with rlheat
    -- Optional Initialize every timestep for maximum accuracy
    -- Various problems with setting up the model configuration (nucleation tables, scrit, nucgas, ...)
    -- Improved growth stability and convergence
    -- Improved stability of aerosol freezing (tabazadeh 2000)
    -- Evaporation bugs (cmf not getting set, total evaporation ncore=0)
    -- Modified growth equation for better approximation
    -- Correct usage of SMALL_PC and FEW_PC
    -
    -Algorithms eliminated:
    -- Horizontal advection
    -- Hydrostatic approximation
    -- Eddy diffusion
    -- Mixed phase particles
    -- Radiative Transfer
    -
    -Known Issues:
    -- PPM advection code has noisy sedimentation when using hybrid coordinates
    -- Growth code is not mass or energy conserving, so rlheat and gc are recalculated based upon condensed mass change
    -- PPM advection code does not return fluxes out the top and bottom of the column, so a kludge was added to get flux out the bottom as column difference
    -- Estimates for the number of substeps needed (ntsubsteps) are not very accurate
    -- Full initialization (rather than to reference T) can be very slow, particularly for coagulation
    -- Parameterizations for latent heats give odd values at low temperatures, use fixed values instead
    -- Standard fall velocity routine has odd kinks in areas where it transitions between different Reynolds regimes
    -- Standard shape fall velocity routine is not handling all shapes and aspect ratios correctly
    -- Mie calculation code can still exceed IACAP estimates even though dynamically allocating ACAP
    -- Core mass is sometimes larger than total mass, can happen from parent model advection, but perhaps other sources
    -===============================================================
    diff --git a/CARMAchem_GridComp/CARMA/doc/ChangeLog_template b/CARMAchem_GridComp/CARMA/doc/ChangeLog_template
    deleted file mode 100644
    index 25557657..00000000
    --- a/CARMAchem_GridComp/CARMA/doc/ChangeLog_template
    +++ /dev/null
    @@ -1,19 +0,0 @@
    -===============================================================
    -
    -Tag name: 
    -Originator(s): 
    -Date:
    -
    -One-line Summary:
    -
    -Purpose of changes:
    -
    -Bugs fixed:
    -
    -List all subroutines eliminated:
    -
    -List all subroutines added and what they do:
    -
    -List all existing files that have been modified, and describe the changes:
    -
    -===============================================================
    diff --git a/CARMAchem_GridComp/CARMA/doc/index.html b/CARMAchem_GridComp/CARMA/doc/index.html
    deleted file mode 100644
    index caf007cf..00000000
    --- a/CARMAchem_GridComp/CARMA/doc/index.html
    +++ /dev/null
    @@ -1,148 +0,0 @@
    -
    -
    -
    -	CARMA 3.0
    -	
    -
    -
    -
    -

    Community Aerosol and Radiation Model for Atmospheres

    -

    Version 3.0

    -
    - -

    Documentation

    -The following documentation is automatically generated from the comments in the -source code by f90doc. It contains a description of all the routines, but doesn't contain -the actual code. - -

    1) Model Definition

    -The model is initialized by using carma_mod.F90, which contains lists of groups, elements, -solutes and gases. This is how the specific microphysical model to be implemented is -described. - - -

    2) Atmospheric State & Model Execution

    -The atmospheric state is captured via the state object. Once the state is entered -and initialized, then the Step method advances the atmospheric state to the next time step. -Multiple threads can be used by creating multiple state objects (one per thread) and initializing -each of them with a different column. See the test example carma_test.F90 -for an example of how to use multiple threads. - - -

    3) Constants, Enumerations, Types & Precision

    - - -

    4) Algorithms

    -The algortihms look very much like the Fortran 77 code from CARMA 2.3. This was -done to make it easier to transition code to the Fortran 90 framework and so that the -Fortran 90 code would look familiar to CARMA 2.3 developers. The common block variables have -been replaced by structures; however, the file carma_globaer.h -uses macros to map the old common bloack names to the new structure elements. You must -be careful not to try to use the names defined in carma_globaer.h as locally declared variables. - - -

    5) Tests

    -The test cases exercise the CARMA code. The tests are located in the tests subdirectory. -Each test creates a file named carma_xxxtest.txt with the results and has a read_xxxtest.pro -IDL file that is used to analyze and plot the test results. The tests can be executed -interactively using run-carma.csh <executable name> or all can be run in batch mode -(without display) using the script run-regress.csh. Standard results for each test are -located in tests/bench. -
      -
    • carma_bc2gtest.F90
    • -
    • carma_bcoctest.F90
    • -
    • carma_coagtest.F90
    • -
    • carma_drydeptest.F90
    • -
    • carma_falltest.F90
    • -
    • carma_growtest.F90
    • -
    • carma_inittest.F90
    • -
    • carma_mietest.F90
    • -
    • carma_nuctest.F90
    • -
    • carma_pheattest.F90
    • -
    • carma_scfalltest.F90
    • -
    • carma_sigmadrydeptest.F90
    • -
    • carma_sigmafalltest.F90
    • -
    • carma_swelltest.F90
    • -
    • carma_vdiftest.F90
    • - - diff --git a/CARMAchem_GridComp/CARMA/make-carma.csh b/CARMAchem_GridComp/CARMA/make-carma.csh deleted file mode 100755 index 5b2a58a3..00000000 --- a/CARMAchem_GridComp/CARMA/make-carma.csh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/tcsh -f - -# An entry point for build the CARMA code, which creates the build directory -# and populates it with the base makefile. -# -# NOTE: This script could be easily enhanced to manage multiple targets and -# multiple build directories, which may be useful as part of an automated test -# suite. -# -# Usage -# make-carma.csh [build target] -# -# build target - target label for the make -# -# Environment Variables -# CARMA_BUILD [carma] -# The subdirectory in which the build will be performed. - -# Look for gmake first, but if not found then just use make. -setenv MAKETOOL "`which gmake`" -echo $MAKETOOL -if ("`echo $MAKETOOL | grep 'not found'`" != "") then - setenv MAKETOOL "`which make`" -endif - -echo "Using : " $MAKETOOL -echo "" - -# By default, build all of the targets in a directory named build. -set bldtgt=all - -if ($# == 1) then - set bldtgt="$1" -endif - -if (! $?CARMA_BUILD ) then - setenv CARMA_BUILD carma -endif - -set blddir=build/$CARMA_BUILD -set docdir=doc/f90doc - -# Create a directory for the build. -echo "Building the target $bldtgt in the directory $blddir" -mkdir -p $blddir - -# Copy the makefile to the build directory. -cp Makefile $blddir/Makefile - -# In MacOSX, the tar command will try to store off the resource fork as an -# extra file which is the same name as the original file with a ._ prefix. -# This flag stops that behavior -if ($bldtgt == tar) then - setenv COPYFILE_DISABLE TRUE -endif - -# Execute the make file in the build directory. -cd $blddir -$MAKETOOL $bldtgt - -# Create the documentation. -if ($bldtgt != tar) then - echo "Creating the documentation in the directory $docdir" - - # Create a directory for the build. - cd ../.. - mkdir -p $docdir - - # Copy the makefile to the doc directory. - cp Makefile $docdir/Makefile - - cd $docdir - $MAKETOOL doc -endif - diff --git a/CARMAchem_GridComp/CARMA/run-all.csh b/CARMAchem_GridComp/CARMA/run-all.csh deleted file mode 100755 index ededa766..00000000 --- a/CARMAchem_GridComp/CARMA/run-all.csh +++ /dev/null @@ -1,93 +0,0 @@ -#! /bin/tcsh -f -# An entry point for running all of the carma tests. It creates a run directory -# copies in the executables and then runs all of the test executables. -# -# -# Usage -# run-carma.csh - -# Environment Variables -# CARMA_BUILD [carma] -# The subdirectory in which the build was performed. - -# By default, run the single column model -if (! $?CARMA_BUILD ) then - setenv CARMA_BUILD carma -endif - -if (! $?CARMA_CASE ) then - setenv CARMA_CASE $CARMA_BUILD -endif - -if (! $?CARMA_THREADS ) then - setenv CARMA_THREADS 1 -endif - -if (! $?CARMA_IDL ) then - setenv CARMA_IDL idl -endif - -set runtgt=CARMATEST.exe - -if ($# == 1) then - set runtgt="$1" -endif - -set blddir=build/$CARMA_BUILD -set rundir=run/$CARMA_CASE -set testdir=tests - -# Create a directory for the build. -mkdir -p $rundir - -# Copy the executable to the run directory. -cp $blddir/*TEST.exe $rundir - - -# Prepare for multiple threads, assuming Intel Compiler. -setenv OMP_NUM_THREADS $CARMA_THREADS -setenv KMP_STACKSIZE 128M - -# Execute the tests. -cd $rundir - -echo `ls -1 *TEST.exe` -foreach runtgt (`ls -1 *TEST.exe`) - echo " ** Started $runtgt at `date` **" - ./$runtgt || echo ' *** Run Failed ***' && exit -1 - echo " ** Finished at `date` **" - echo "" - - set idlfile="read_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.pro" - set outfile="carma_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.txt" - - if (! -f $idlfile) then - cp -p ../../$testdir/$idlfile . - endif - - if (-f $idlfile) then - - if (-f $outfile) then - echo "" - echo "Running the IDL analysis routine $idlfile" - - if ($?IDL_WARNING) then - echo "" - echo "$IDL_WARNING" - echo "" - endif - - echo " To run the test, in IDL you need to type the command: .r $idlfile" - echo " To exit IDL, type the command: exit" - - # NOTE: If your invokation of IDL fails, check to see whether idl - # is really on you path or if it is just an alias. Aliases don't work - # properly in scripts, but this is how IDL is setup be default. You - # can add the idl bin directory to your path so that this will work. - echo "" - $CARMA_IDL - endif - endif -end - - diff --git a/CARMAchem_GridComp/CARMA/run-carma.csh b/CARMAchem_GridComp/CARMA/run-carma.csh deleted file mode 100755 index c8191faf..00000000 --- a/CARMAchem_GridComp/CARMA/run-carma.csh +++ /dev/null @@ -1,110 +0,0 @@ -#! /bin/tcsh -f -# An entry point for running the CARMA code, which creates a run directory -# copies in the executable and the then runs the executable. -# -# NOTE: This script could be easily enhanced to manage mutliple executables and -# multiple run directories, which my be useful as part of an automated test -# suite. -# -# Usage -# run-carma.csh [test] -# -# test - the name of an executable test case -# - -# Environment Variables -# CARMA_BUILD [carma] -# The subdirectory in which the build was performed. - -# By default, run the single column model -if (! $?CARMA_BUILD ) then - setenv CARMA_BUILD carma -endif - -if (! $?CARMA_CASE ) then - setenv CARMA_CASE $CARMA_BUILD -endif - -if (! $?CARMA_THREADS ) then - setenv CARMA_THREADS 1 -endif - -if (! $?CARMA_IDL ) then - setenv CARMA_IDL idl -endif - -set runtgt=CARMATEST.exe - -if ($# == 1) then - set runtgt="$1" -endif - -set blddir=build/$CARMA_BUILD -set rundir=run/$CARMA_CASE -set testdir=tests -set idlfile="read_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.pro" -set outfile="carma_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.txt" - -echo $idlfile -echo $outfile - -# Create a directory for the build. -echo "Running $blddir/$runtgt in the directory $rundir using $CARMA_THREADS thread(s) ..." -mkdir -p $rundir - -# Copy the executable to the run directory. -cp $blddir/$runtgt $rundir - -if (-f $testdir/$idlfile) then - - # Don't overwrite the file in the run directory if it is newer than - # the one in the test directory. - # - # NOTE: For the test on modification date to work, the copy must - # preserve the modify date and time. - if (-f $rundir/$idlfile) then - if (-M "$rundir/$idlfile" > -M "$testdir/$idlfile") then - setenv IDL_WARNING " WARNING: $idlfile not copied, since $rundir/$idlfile is newer than $testdir/$idlfile" - else - cp -p $testdir/$idlfile $rundir - endif - else - cp -p $testdir/$idlfile $rundir - endif -endif - -# Prepare for multiple threads, assuming Intel Compiler. -setenv OMP_NUM_THREADS $CARMA_THREADS -setenv KMP_STACKSIZE 128M - -# Execute the make file in the build directory. -cd $rundir -echo " ** Started at `date` **" -./$runtgt || echo ' *** Run Failed ***' && exit -1 -echo " ** Finished at `date` **" - -if (-f $idlfile) then - - if (-f $outfile) then - echo "" - echo "Running the IDL analysis routine $idlfile" - - if ($?IDL_WARNING) then - echo "" - echo "$IDL_WARNING" - echo "" - endif - - echo " To run the test, in IDL you need to type the command: .r $idlfile" - echo " To exit IDL, type the command: exit" - - # NOTE: If your invokation of IDL fails, check to see whether idl - # is really on you path or if it is just an alias. Aliases don't work - # properly in scripts, but this is how IDL is setup be default. You - # can add the idl bin directory to your path so that this will work. - echo "" - $CARMA_IDL - endif -endif - - diff --git a/CARMAchem_GridComp/CARMA/run-regress.csh b/CARMAchem_GridComp/CARMA/run-regress.csh deleted file mode 100755 index e9f7c0f3..00000000 --- a/CARMAchem_GridComp/CARMA/run-regress.csh +++ /dev/null @@ -1,81 +0,0 @@ -#! /bin/tcsh -f -# An entry point for running all of the carma regression tests. It creates -# a run directory, copies in the executables, runs all of the test executables, -# and then compares the results to the previous "benchmark" result. -# -# The benchmark results are run on a Mac using ifort -# -# -# Usage -# run-carma.csh - -# Environment Variables -# CARMA_BUILD [carma] -# The subdirectory in which the build was performed. - -# By default, run the single column model -if (! $?CARMA_BUILD ) then - setenv CARMA_BUILD carma -endif - -if (! $?CARMA_CASE ) then - setenv CARMA_CASE $CARMA_BUILD -endif - -if (! $?CARMA_THREADS ) then - setenv CARMA_THREADS 1 -endif - -if (! $?CARMA_IDL ) then - setenv CARMA_IDL idl -endif - -set runtgt=CARMATEST.exe - -if ($# == 1) then - set runtgt="$1" -endif - -set blddir=build/$CARMA_BUILD -set rundir=run/$CARMA_CASE -set testdir=tests -set benchdir=tests/bench - -# Create a directory for the build. -mkdir -p $rundir - -# Copy the executable to the run directory. -cp $blddir/*TEST.exe $rundir - -# Prepare for multiple threads, assuming Intel Compiler. -setenv OMP_NUM_THREADS $CARMA_THREADS -setenv KMP_STACKSIZE 128M - -# Execute the tests. -cd $rundir - -foreach runtgt (`ls -1 *TEST.exe`) - echo "" - echo "" - echo " ** Starting $runtgt at `date` **" - ./$runtgt || echo ' *** Run Failed ***' && exit -1 - echo " ** Finished at `date` **" - echo "" - - set outfile="carma_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.txt" - - setenv FDIFF -sqw - - # The diff on AIX doesn't have the -q option ..." - if (`uname` == AIX ) then - setenv FDIFF -sw - endif - - if (-f $outfile) diff $FDIFF $outfile ../../$benchdir/$outfile || exit(-1) -end - -echo "" -echo "" -echo "All Tests Passed!" - - diff --git a/CARMAchem_GridComp/CARMA/source/base/Makefile b/CARMAchem_GridComp/CARMA/source/base/Makefile deleted file mode 100644 index b51164a5..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/Makefile +++ /dev/null @@ -1,319 +0,0 @@ -# Sub makefile for CARMA files - -# This is intended to be included by another makefile to actually -# build the system. It has all the dependency information for the -# files in the CARMA tree. - -# NOTE: In the future (or in parnet models) this could be replaced -# by automatic dependency generation and/or by building CARMA as a -# library. - -CARMA_OBJ = carma_constants_mod.o carma_precision_mod.o carma_types_mod.o \ -carmagroup_mod.o carmagas_mod.o carmaelement_mod.o carmasolute_mod.o \ -carmastate_mod.o carma_mod.o coagl.o coagp.o csolve.o setupbins.o \ -setupatm.o sulfate_utils.o wetr.o setupvf.o microslow.o newstate.o prestep.o setupckern.o \ -setupcoag.o smallconc.o step.o supersat.o vaporp.o vertadv.o \ -vertdif.o vertical.o versol.o rhopart.o psolve.o zeromicro.o \ -nsubsteps.o setupgrow.o setupgkern.o setupnuc.o growevapl.o microfast.o \ -gsolve.o actdropl.o freezglaerl_murray2010.o growp.o downgxfer.o \ -gasexchange.o melticel.o upgxfer.o freezdropl.o pfastdmdt.o \ -downgevapply.o evapp.o evap_poly.o evap_mono.o \ -evap_ingrp.o tsolve.o miess.o vaporp_h2o_buck1981.o \ -vaporp_h2o_murphy2005.o maxconc.o setupbdif.o setupvf_std.o \ -setupvf_std_shape.o totalcondensate.o versub.o freezaerl_tabazadeh2000.o \ -freezaerl_koop2000.o rhoice_heymsfield2010.o setupvf_heymsfield2010.o \ -freezaerl_mohler2010.o setupvdry.o calcrs.o vaporp_h2o_goff1946.o \ -pheat.o planck.o bhmie.o mie.o vaporp_h2so4_ayers1980.o \ -sulfnuc.o sulfnucrate.o hetnucl.o newstate_calc.o \ -fractal_meanfield_mod.o lusolvec_mod.o adgaquad_types_mod.o adgaquad_mod.o \ -sulfhetnucrate.o - -CARMA_DOC = carma_constants_mod.html carma_types_mod.html carma_enums_mod.html \ -carmagroup_mod.html carmagas_mod.html carmaelement_mod.html carmasolute_mod.html \ -carmastate_mod.html carma_mod.html coagl.html coagp.html csolve.html setupbins.html \ -setupatm.html setupvf.html microslow.html newstate.html prestep.html setupckern.html \ -setupcoag.html smallconc.html step.html supersat.html vaporp.html vertadv.html \ -vertdif.html vertical.html versol.html rhopart.html psolve.html zeromicro.html \ -nsubsteps.html setupgrow.html setupgkern.html setupnuc.html growevapl.html microfast.html \ -gsolve.html actdropl.html freezglaerl_murray2010.html growp.html downgxfer.html \ -gasexchange.html melticel.html upgxfer.html freezdropl.html \ -downgevapply.html evapp.html evap_poly.html evap_mono.html \ -evap_ingrp.html tsolve.html miess.html vaporp_h2o_buck1981.html wetr.html \ -vaporp_h2o_murphy2005.html maxconc.html setupbdif.html setupvf_std.html \ -setupvf_std_shape.html totalcondensate.html versub.html freezaerl_tabazadeh2000.html \ -freezaerl_koop2000.html rhoice_heymsfield2010.html setupvf_heymsfield2010.html \ -freezaerl_mohler2010.html setupvdry.html calcrs.html vaporp_h2o_goff1946.html \ -pheat.html planck.html bhmie.html mie.html vaporp_h2so4_ayers1980.html \ -sulfate_utils.html sulfnuc.html sulfnucrate.html hetnucl.html newstate_calc.html \ -fractal_meanfield_mod.html lusolvec_mod.html adgaquad_types_mod.html adgaquad_mod.html \ -sulfhetnucrate.html - -carma_precision_mod.o : carma_precision_mod.F90 - $(FORTRAN) $(FFLAGS) -c $< - -carma_enums_mod.o : carma_enums_mod.F90 - $(FORTRAN) $(FFLAGS) -c $< - -carma_constants_mod.o : carma_constants_mod.F90 carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_types_mod.o : carma_types_mod.F90 carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carmagroup_mod.o : carmagroup_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carmagas_mod.o : carmagas_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carmaelement_mod.o : carmaelement_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carmasolute_mod.o : carmasolute_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carmastate_mod.o : carmastate_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_mod.o : carma_mod.F90 carma_globaer.h carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -adgaquad_types_mod.o : adgaquad_types_mod.F90 carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -lusolvec_mod.o : lusolvec_mod.F90 carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -adgaquad_mod.o : adgaquad_mod.F90 carma_precision_mod.mod adgaquad_types_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - - -# The following files make use of the preprocessor to map the old CARMA names to the new CARMA strucutre members via carma_globaer.h. Some -# compilers (e.g. Portland Group) have versions of the cpp that they use with Fortran that do not properly handle recursion. Because of them, -# we first invoke a conforming cpp and then compile the Fortran file. -# -# NOTE: The ifort and AIX compilers do not have this problem. -actdropl.o : actdropl.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -bhmie.o : bhmie.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -calcrs.o : calcrs.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -coagl.o : coagl.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -coagp.o : coagp.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -csolve.o : csolve.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -detrain.o : detrain.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -downgevapply.o : downgevapply.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -downgxfer.o : downgxfer.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -evap_ingrp.o : evap_ingrp.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -evap_mono.o : evap_mono.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -evap_poly.o : evap_poly.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -evapp.o : evapp.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -freezaerl_tabazadeh2000.o : freezaerl_tabazadeh2000.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -freezaerl_koop2000.o : freezaerl_koop2000.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -freezaerl_mohler2010.o : freezaerl_mohler2010.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -freezglaerl_murray2010.o : freezglaerl_murray2010.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -freezdropl.o : freezdropl.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -gasexchange.o : gasexchange.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -growevapl.o : growevapl.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -growp.o : growp.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -gsolve.o : gsolve.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -pfastdmdt.o : pfastdmdt.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -fractal_meanfield_mod.o : fractal_meanfield_mod.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod adgaquad_mod.mod lusolvec_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -hetnucl.o : hetnucl.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -maxconc.o : maxconc.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -melticel.o : melticel.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -microfast.o : microfast.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -microslow.o : microslow.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -mie.o : mie.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod fractal_meanfield_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -miess.o : miess.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -newstate.o : newstate.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -newstate_calc.o : newstate_calc.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -nsubsteps.o : nsubsteps.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -pheat.o : pheat.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod planck.mod - $(FORTRAN) $(FFLAGS) -c $< - -planck.o : planck.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -prestep.o : prestep.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -psolve.o : psolve.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -rhoice_heymsfield2010.o : rhoice_heymsfield2010.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -rhopart.o : rhopart.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod sulfate_utils.mod wetr.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupatm.o : setupatm.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupbdif.o : setupbdif.F90 carma_globaer.h carma_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupbins.o : setupbins.F90 carma_globaer.h carma_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupckern.o : setupckern.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupcoag.o : setupcoag.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupgkern.o : setupgkern.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod sulfate_utils.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupgrow.o : setupgrow.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupnuc.o : setupnuc.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupvf.o : setupvf.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupvdry.o : setupvdry.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupvf_heymsfield2010.o : setupvf_heymsfield2010.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupvf_std.o : setupvf_std.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -setupvf_std_shape.o : setupvf_std_shape.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -smallconc.o : smallconc.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -step.o : step.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -sulfate_utils.o : sulfate_utils.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -sulfnuc.o : sulfnuc.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -sulfhetnucrate.o : sulfhetnucrate.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -sulfnucrate.o : sulfnucrate.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -supersat.o : supersat.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -totalcondensate.o : totalcondensate.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -tsolve.o : tsolve.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -upgxfer.o : upgxfer.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vaporp.o : vaporp.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vaporp_h2so4_ayers1980.o : vaporp_h2so4_ayers1980.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vaporp_h2o_buck1981.o : vaporp_h2o_buck1981.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vaporp_h2o_goff1946.o : vaporp_h2o_goff1946.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vaporp_h2o_murphy2005.o : vaporp_h2o_murphy2005.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -versol.o : versol.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -versub.o : versub.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vertadv.o : vertadv.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vertdif.o : vertdif.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -vertical.o : vertical.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -wetr.o : wetr.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -zeromicro.o : zeromicro.F90 carma_globaer.h carma_mod.mod carmastate_mod.mod carma_types_mod.mod carma_constants_mod.mod carma_enums_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< diff --git a/CARMAchem_GridComp/CARMA/source/base/actdropl.F90 b/CARMAchem_GridComp/CARMA/source/base/actdropl.F90 deleted file mode 100644 index 068146df..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/actdropl.F90 +++ /dev/null @@ -1,106 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! droplet activation only. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! To avoid nucleation into an evaporating bin, this subroutine must -!! be called after growp, which evaluates evaporation loss rates . -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine actdropl(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igas !! gas index - integer :: igroup !! group index - integer :: ibin !! bin index - integer :: iepart !! element for condensing group index - integer :: inuc !! nucleating element index - integer :: ienucto !! index of target nucleation element - integer :: ignucto !! index of target nucleation group - integer :: inucto !! index of target nucleation bin - logical :: evapfrom_nucto !! .true. when target droplets are evaporating - - - ! This calculation is only necessary for temperatures greater - ! than -40C. - if( t(iz) .ge. (T0 - 40._f) ) then - - ! Loop over particle groups. - do igroup = 1,NGROUP - - ! Bypass calculation if few particles are present - if( pconmax(iz,igroup) .gt. FEW_PC )then - - igas = inucgas(igroup) ! condensing gas - iepart = ienconc( igroup ) ! particle number density element - - if( igas .ne. 0 )then - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - do inuc = 1,nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - if( ienucto .ne. 0 )then - ignucto = igelem( ienucto ) - else - ignucto = 0 - endif - - ! Only compute nucleation rate for droplet activation - if( inucproc(iepart,ienucto) .eq. I_DROPACT ) then - - ! Loop over particle bins. Loop from largest to smallest for - ! evaluation of index of smallest bin nucleated during time step . - do ibin = NBIN, 1, -1 - - if( ignucto .ne. 0 )then - inucto = inuc2bin(ibin,igroup,ignucto) - else - inucto = 0 - endif - - ! Set to .true. when target droplets are evaporating - if( inucto .ne. 0 )then - evapfrom_nucto = evaplg(inucto,ignucto) .gt. 0._f - else - evapfrom_nucto = .false. - endif - - if( (supsatl(iz,igas) .gt. scrit(iz,ibin,igroup)) .and. & - (.not. evapfrom_nucto) .and. & - (pc(iz,ibin,iepart) .gt. SMALL_PC) )then - - rnuclg(ibin,igroup,ignucto) = 1.e3_f - endif - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPACT - enddo ! inuc = 1,nnuc2elem(iepart) - endif ! (igas = inucgas(igroup)) .ne. 0 - endif ! pconmax(iz,igroup) .gt. FEW_PC - enddo ! igroup = 1,NGROUP - endif ! t(iz) .ge. T0-40. - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/adgaquad_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/adgaquad_mod.F90 deleted file mode 100644 index 3cc91de5..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/adgaquad_mod.F90 +++ /dev/null @@ -1,3573 +0,0 @@ -!! ****************************************************************** -!! The routines listed in this file "adgaquad_mod.F90" are performing -!! Numerical Integrations using some kind of -!! adaptive Gauss quadrature. -!! They are taken from the Internet (http://www.netlib.org) -!! and parts of different software packages / libraries. -!! ****************************************************************** -!! For any restrictions on the use of the routines, please see -!! the original web site. -!! ****************************************************************** -!! Changes: calls to error handler 'xerror()' replaced by -!! WRITE(7,*) - statements. -!! ****************************************************************** -!! list of routines and the libraries they are taken from: -!! dqag calling routine, bounded integration interval -!! QUADPACK; calls: dqage -!! dqage the integration routine, bounded interval -!! QUADPACK; calls: sd1mach,dqk15,dqk21,dqk31, -!! dqk41,dqk51,dqk61,dqpsrt -!! dqagi calling routine, unbounded (semi-infinite or -!! infinite) integration interval -!! QUADPACK; calls: dqagie -!! dqagie the integration routine, unbounded interval -!! QUADPACK; calls: sd1mach,dqelg,dqk15i,dqpsrt -!! ------------------------------------------------------------------ -!! dqk15 QUADPACK; calls: sd1mach -!! dqk21 QUADPACK; calls: sd1mach -!! dqk31 QUADPACK; calls: sd1mach -!! dqk41 QUADPACK; calls: sd1mach -!! dqk51 QUADPACK; calls: sd1mach -!! dqk61 QUADPACK; calls: sd1mach -!! dqpsrt QUADPACK; calls: none -!! dqk15i QUADPACK; calls: sd1mach -!! dqelg QUADPACK; calls: sd1mach -!! ------------------------------------------------------------------ -!! xerror Error handling routine -!! ALLIANT (/quad); calls: xerrwv -!! xerrwv Error handling routine -!! SODEPACK; calls: none -!! d1mach determine machine parameters (accuracies) -!! BLAS; calls: none -!! ------------------------------------------------------------------ - -module adgaquad_mod - - use carma_precision_mod - use adgaquad_types_mod - - implicit none - - private - - public :: dqag - public :: dqage - public :: dqagi - public :: dqagie - - contains - - !!***begin prologue dqag - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a1 - !!***keywords automatic integrator, general-purpose, - !! integrand examinator, globally adaptive, - !! gauss-kronrod - !!***author piessens,robert,appl. math. & progr. div - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose the routine calculates an approximation result to a given - !! definite integral i = integral of f over (a,b), - !! hopefully satisfying following claim for accuracy - !! abs(i-result)le.max(epsabs,epsrel*abs(i)). - !!***description - !! - !! computation of a definite integral - !! standard fortran subroutine - !! double precision version - !! - !! fx - double precision - !! function subprogam defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the driver program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! epsabs - double precision - !! absolute accoracy requested - !! epsrel - double precision - !! relative accuracy requested - !! if epsabs.le.0 - !! and epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! the routine will end with ier = 6. - !! - !! key - integer - !! key for choice of local integration rule - !! a gauss-kronrod pair is used with - !! 7 - 15 points if key.lt.2, - !! 10 - 21 points if key = 2, - !! 15 - 31 points if key = 3, - !! 20 - 41 points if key = 4, - !! 25 - 51 points if key = 5, - !! 30 - 61 points if key.gt.5. - !! - !! on return - !! result - double precision - !! approximation to the integral - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed abs(i-result) - !! - !! neval - integer - !! number of integrand evaluations - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine - !! the estimates for result and error are - !! less reliable. it is assumed that the - !! requested accuracy has not been achieved. - !! error messages - !! ier = 1 maximum number of subdivisions allowed - !! has been achieved. one can allow more - !! subdivisions by increasing the value of - !! limit (and taking the according dimension - !! adjustments into account). however, if - !! this yield no improvement it is advised - !! to analyze the integrand in order to - !! determine the integration difficulaties. - !! if the position of a local difficulty can - !! be determined (i.e.singularity, - !! discontinuity within the interval) one - !! will probably gain from splitting up the - !! interval at this point and calling the - !! integrator on the subranges. if possible, - !! an appropriate special-purpose integrator - !! should be used which is designed for - !! handling the type of difficulty involved. - !! = 2 the occurrence of roundoff error is - !! detected, which prevents the requested - !! tolerance from being achieved. - !! = 3 extremely bad integrand behaviour occurs - !! at some points of the integration - !! interval. - !! = 6 the input is invalid, because - !! (epsabs.le.0 and - !! epsrel.lt.max(50*rel.mach.acc.,0.5d-28)) - !! or limit.lt.1 or lenw.lt.limit*4. - !! result, abserr, neval, last are set - !! to zero. - !! except when lenw is invalid, iwork(1), - !! work(limit*2+1) and work(limit*3+1) are - !! set to zero, work(1) is set to a and - !! work(limit+1) to b. - !! = 9 failure in sd1mach determining machine parameters - !! - !! dimensioning parameters - !! limit - integer - !! dimensioning parameter for iwork - !! limit determines the maximum number of subintervals - !! in the partition of the given integration interval - !! (a,b), limit.ge.1. - !! if limit.lt.1, the routine will end with ier = 6. - !! - !! lenw - integer - !! dimensioning parameter for work - !! lenw must be at least limit*4. - !! if lenw.lt.limit*4, the routine will end with - !! ier = 6. - !! - !! last - integer - !! on return, last equals the number of subintervals - !! produced in the subdiviosion process, which - !! determines the number of significant elements - !! actually in the work arrays. - !! - !! work arrays - !! iwork - integer - !! vector of dimension at least limit, the first k - !! elements of which contain pointers to the error - !! estimates over the subintervals, such that - !! work(limit*3+iwork(1)),... , work(limit*3+iwork(k)) - !! form a decreasing sequence with k = last if - !! last.le.(limit/2+2), and k = limit+1-last otherwise - !! - !! work - double precision - !! vector of dimension at least lenw - !! on return - !! work(1), ..., work(last) contain the left end - !! points of the subintervals in the partition of - !! (a,b), - !! work(limit+1), ..., work(limit+last) contain the - !! right end points, - !! work(limit*2+1), ..., work(limit*2+last) contain - !! the integral approximations over the subintervals, - !! work(limit*3+1), ..., work(limit*3+last) contain - !! the error estimates. - !! - !!***references (none) - !!***routines called dqage,xerror - !!***end prologue dqag - subroutine dqag(fx,fx_vars,a,b,epsabs,epsrel,key,result,abserr,neval,ier, & - limit,lenw,last,iwork,work) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: epsabs - real(kind=f) :: epsrel - integer :: key - real(kind=f) :: result - real(kind=f) :: abserr - integer :: neval - integer :: ier - integer :: limit - integer :: lenw - integer :: last - integer :: iwork(limit) - real(kind=f) :: work(lenw) - - ! Local declarations - integer :: lvl,l1,l2,l3 - - ! check validity of lenw. - ! - !***first executable statement dqag - ier = 6 - neval = 0 - last = 0 - result = 0.0_f - abserr = 0.0_f - if(limit.lt.1.or.lenw.lt.limit*4) go to 10 - - ! prepare call for dqage. - - l1 = limit+1 - l2 = limit+l1 - l3 = limit+l2 - - call dqage(fx,fx_vars,a,b,epsabs,epsrel,key,limit,result,abserr,neval, & - ier,work(1),work(l1),work(l2),work(l3),iwork,last) - - ! call error handler if necessary. - - lvl = 0 -10 if(ier.eq.6) lvl = 1 - if(ier.ne.0) then - write(*,*) "ERROR: abnormal return from dqag" - write(*,*) " ifail=",ier," level=",lvl - endif - return - end subroutine dqag - - - - !!***begin prologue dqage - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a1 - !!***keywords automatic integrator, general-purpose, - !! integrand examinator, globally adaptive, - !! gauss-kronrod - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose the routine calculates an approximation result to a given - !! definite integral i = integral of f over (a,b), - !! hopefully satisfying following claim for accuracy - !! abs(i-reslt).le.max(epsabs,epsrel*abs(i)). - !!***description - !! - !! computation of a definite integral - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the driver program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! epsabs - double precision - !! absolute accuracy requested - !! epsrel - double precision - !! relative accuracy requested - !! if epsabs.le.0 - !! and epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! the routine will end with ier = 6. - !! - !! key - integer - !! key for choice of local integration rule - !! a gauss-kronrod pair is used with - !! 7 - 15 points if key.lt.2, - !! 10 - 21 points if key = 2, - !! 15 - 31 points if key = 3, - !! 20 - 41 points if key = 4, - !! 25 - 51 points if key = 5, - !! 30 - 61 points if key.gt.5. - !! - !! limit - integer - !! gives an upperbound on the number of subintervals - !! in the partition of (a,b), limit.ge.1. - !! - !! on return - !! result - double precision - !! approximation to the integral - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed abs(i-result) - !! - !! neval - integer - !! number of integrand evaluations - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine - !! the estimates for result and error are - !! less reliable. it is assumed that the - !! requested accuracy has not been achieved. - !! error messages - !! ier = 1 maximum number of subdivisions allowed - !! has been achieved. one can allow more - !! subdivisions by increasing the value - !! of limit. - !! however, if this yields no improvement it - !! is rather advised to analyze the integrand - !! in order to determine the integration - !! difficulties. if the position of a local - !! difficulty can be determined(e.g. - !! singularity, discontinuity within the - !! interval) one will probably gain from - !! splitting up the interval at this point - !! and calling the integrator on the - !! subranges. if possible, an appropriate - !! special-purpose integrator should be used - !! which is designed for handling the type of - !! difficulty involved. - !! = 2 the occurrence of roundoff error is - !! detected, which prevents the requested - !! tolerance from being achieved. - !! = 3 extremely bad integrand behaviour occurs - !! at some points of the integration - !! interval. - !! = 6 the input is invalid, because - !! (epsabs.le.0 and - !! epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! result, abserr, neval, last, rlist(1) , - !! elist(1) and iord(1) are set to zero. - !! alist(1) and blist(1) are set to a and b - !! respectively. - !! = 9 failure in sd1mach determining machine parameters - !! - !! alist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the left - !! end points of the subintervals in the partition - !! of the given integration range (a,b) - !! - !! blist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the right - !! end points of the subintervals in the partition - !! of the given integration range (a,b) - !! - !! rlist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the - !! integral approximations on the subintervals - !! - !! elist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the moduli of the - !! absolute error estimates on the subintervals - !! - !! iord - integer - !! vector of dimension at least limit, the first k - !! elements of which are pointers to the - !! error estimates over the subintervals, - !! such that elist(iord(1)), ..., - !! elist(iord(k)) form a decreasing sequence, - !! with k = last if last.le.(limit/2+2), and - !! k = limit+1-last otherwise - !! - !! last - integer - !! number of subintervals actually produced in the - !! subdivision process - !! - !!***references (none) - !!***routines called sd1mach,dqk15,dqk21,dqk31, - !! dqk41,dqk51,dqk61,dqpsrt - !!***end prologue dqage - subroutine dqage(fx,fx_vars,a,b,epsabs,epsrel,key,limit,result,abserr, & - neval,ier,alist,blist,rlist,elist,iord,last) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: epsabs - real(kind=f) :: epsrel - integer :: limit - integer :: key - real(kind=f) :: result - real(kind=f) :: abserr - integer :: neval - integer :: ier - real(kind=f) :: alist(limit) - real(kind=f) :: blist(limit) - real(kind=f) :: rlist(limit) - real(kind=f) :: elist(limit) - integer :: iord(limit) - integer :: last - - ! Local declarations - real(kind=f) :: area, area1, area12, area2, a1, a2 - real(kind=f) :: b1, b2, dabs, defabs, defab1, defab2, dmax1, epmach - real(kind=f) :: errbnd,errmax,error1,error2,erro12,errsum,resabs,uflow - integer :: iroff1,iroff2,k,keyf,maxerr,nrmax - - - ! list of major variables - ! ----------------------- - ! - ! alist - list of left end points of all subintervals - ! considered up to now - ! blist - list of right end points of all subintervals - ! considered up to now - ! rlist(i) - approximation to the integral over - ! (alist(i),blist(i)) - ! elist(i) - error estimate applying to rlist(i) - ! maxerr - pointer to the interval with largest - ! error estimate - ! errmax - elist(maxerr) - ! area - sum of the integrals over the subintervals - ! errsum - sum of the errors over the subintervals - ! errbnd - requested accuracy max(epsabs,epsrel* - ! abs(result)) - ! *****1 - variable for the left subinterval - ! *****2 - variable for the right subinterval - ! last - index for subdivision - ! - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !***first executable statement dqage - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - - ! test on validity of parameters - ! ------------------------------ - ! - ier = 0 - neval = 0 - last = 0 - result = 0.0_f - abserr = 0.0_f - alist(1) = a - blist(1) = b - rlist(1) = 0.0_f - elist(1) = 0.0_f - iord(1) = 0 - if(epsabs.le.0.0_f.and.epsrel.lt.dmax1(0.5e2_f*epmach,0.5e-28_f)) ier = 6 - if(ier.eq.6) go to 999 - - ! first approximation to the integral - ! ----------------------------------- - ! - keyf = key - if(key.le.0) keyf = 1 - if(key.ge.7) keyf = 6 - neval = 0 - if(keyf.eq.1) call dqk15(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - if(keyf.eq.2) call dqk21(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - if(keyf.eq.3) call dqk31(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - if(keyf.eq.4) call dqk41(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - if(keyf.eq.5) call dqk51(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - if(keyf.eq.6) call dqk61(fx,fx_vars,a,b,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - last = 1 - rlist(1) = result - elist(1) = abserr - iord(1) = 1 - ! - ! test on accuracy. - ! - errbnd = dmax1(epsabs,epsrel*dabs(result)) - if(abserr.le.0.5e2_f*epmach*defabs.and.abserr.gt.errbnd) ier = 2 - if(limit.eq.1) ier = 1 - if(ier.ne.0.or.(abserr.le.errbnd.and.abserr.ne.resabs).or.abserr.eq.0.0d+00) go to 60 - ! - ! initialization - ! -------------- - ! - errmax = abserr - maxerr = 1 - area = result - errsum = abserr - nrmax = 1 - iroff1 = 0 - iroff2 = 0 - ! - ! main do-loop - ! ------------ - ! - do last = 2,limit - ! - ! bisect the subinterval with the largest error estimate. - ! - a1 = alist(maxerr) - b1 = 0.5_f*(alist(maxerr)+blist(maxerr)) - a2 = b1 - b2 = blist(maxerr) - if(keyf.eq.1) call dqk15(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.2) call dqk21(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.3) call dqk31(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.4) call dqk41(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.5) call dqk51(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.6) call dqk61(fx,fx_vars,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - if(keyf.eq.1) call dqk15(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - if(keyf.eq.2) call dqk21(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - if(keyf.eq.3) call dqk31(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - if(keyf.eq.4) call dqk41(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - if(keyf.eq.5) call dqk51(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - if(keyf.eq.6) call dqk61(fx,fx_vars,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - ! improve previous approximations to integral - ! and error and test for accuracy. - ! - ! neval = neval+1 - area12 = area1+area2 - erro12 = error1+error2 - errsum = errsum+erro12-errmax - area = area+area12-rlist(maxerr) - if(defab1.eq.error1.or.defab2.eq.error2) go to 5 - if(dabs(rlist(maxerr)-area12).le.0.1e-4_f*dabs(area12).and.erro12.ge.0.99_f*errmax) iroff1 = iroff1+1 - if(last.gt.10.and.erro12.gt.errmax) iroff2 = iroff2+1 - 5 rlist(maxerr) = area1 - rlist(last) = area2 - errbnd = dmax1(epsabs,epsrel*dabs(area)) - if(errsum.le.errbnd) go to 8 - ! - ! test for roundoff error and eventually set error flag. - ! - if(iroff1.ge.6.or.iroff2.ge.20) ier = 2 - ! - ! set error flag in the case that the number of subintervals - ! equals limit. - ! - if(last.eq.limit) ier = 1 - ! - ! set error flag in the case of bad integrand behaviour - ! at a point of the integration range. - ! - if(dmax1(dabs(a1),dabs(b2)).le.(0.1e1_f+0.1e3_f*epmach)*(dabs(a2)+0.1e4_f*uflow)) ier = 3 - ! - ! append the newly-created intervals to the list. - ! - 8 if(error2.gt.error1) go to 10 - alist(last) = a2 - blist(maxerr) = b1 - blist(last) = b2 - elist(maxerr) = error1 - elist(last) = error2 - go to 20 - 10 alist(maxerr) = a2 - alist(last) = a1 - blist(last) = b1 - rlist(maxerr) = area2 - rlist(last) = area1 - elist(maxerr) = error2 - elist(last) = error1 - ! - ! call subroutine dqpsrt to maintain the descending ordering - ! in the list of error estimates and select the subinterval - ! with the largest error estimate (to be bisected next). - ! - 20 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax) - ! ***jump out of do-loop - if(ier.ne.0.or.errsum.le.errbnd) go to 40 - end do - ! - ! compute final result. - ! --------------------- - ! - 40 result = 0.0_f - do k=1,last - result = result+rlist(k) - end do - abserr = errsum - 60 if(keyf.ne.1) neval = (10*keyf+1)*(2*neval+1) - if(keyf.eq.1) neval = 30*neval+15 -999 return - end subroutine dqage - - - !!***begin prologue dqagi - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a3a1,h2a4a1 - !!***keywords automatic integrator, infinite intervals, - !! general-purpose, transformation, extrapolation, - !! globally adaptive - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. -k.u.leuven - !!***purpose the routine calculates an approximation result to a given - !! integral i = integral of f over (bound,+infinity) - !! or i = integral of f over (-infinity,bound) - !! or i = integral of f over (-infinity,+infinity) - !! hopefully satisfying following claim for accuracy - !! abs(i-result).le.max(epsabs,epsrel*abs(i)). - !!***description - !! - !! integration over infinite intervals - !! standard fortran subroutine - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the driver program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! bound - double precision - !! finite bound of integration range - !! (has no meaning if interval is doubly-infinite) - !! - !! inf - integer - !! indicating the kind of integration range involved - !! inf = 1 corresponds to (bound,+infinity), - !! inf = -1 to (-infinity,bound), - !! inf = 2 to (-infinity,+infinity). - !! - !! epsabs - double precision - !! absolute accuracy requested - !! epsrel - double precision - !! relative accuracy requested - !! if epsabs.le.0 - !! and epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! the routine will end with ier = 6. - !! - !! - !! on return - !! result - double precision - !! approximation to the integral - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed abs(i-result) - !! - !! neval - integer - !! number of integrand evaluations - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! - ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! error messages - !! ier = 1 maximum number of subdivisions allowed - !! has been achieved. one can allow more - !! subdivisions by increasing the value of - !! limit (and taking the according dimension - !! adjustments into account). however, if - !! this yields no improvement it is advised - !! to analyze the integrand in order to - !! determine the integration difficulties. if - !! the position of a local difficulty can be - !! determined (e.g. singularity, - !! discontinuity within the interval) one - !! will probably gain from splitting up the - !! interval at this point and calling the - !! integrator on the subranges. if possible, - !! an appropriate special-purpose integrator - !! should be used, which is designed for - !! handling the type of difficulty involved. - !! = 2 the occurrence of roundoff error is - !! detected, which prevents the requested - !! tolerance from being achieved. - !! the error may be under-estimated. - !! = 3 extremely bad integrand behaviour occurs - !! at some points of the integration - !! interval. - !! = 4 the algorithm does not converge. - !! roundoff error is detected in the - !! extrapolation table. - !! it is assumed that the requested tolerance - !! cannot be achieved, and that the returned - !! result is the best which can be obtained. - !! = 5 the integral is probably divergent, or - !! slowly convergent. it must be noted that - !! divergence can occur with any other value - !! of ier. - !! = 6 the input is invalid, because - !! (epsabs.le.0 and - !! epsrel.lt.max(50*rel.mach.acc.,0.5d-28)) - !! or limit.lt.1 or leniw.lt.limit*4. - !! result, abserr, neval, last are set to - !! zero. exept when limit or leniw is - !! invalid, iwork(1), work(limit*2+1) and - !! work(limit*3+1) are set to zero, work(1) - !! is set to a and work(limit+1) to b. - !! = 9 failure in sd1mach determining machine parameters - !! - !! dimensioning parameters - !! limit - integer - !! dimensioning parameter for iwork - !! limit determines the maximum number of subintervals - !! in the partition of the given integration interval - !! (a,b), limit.ge.1. - !! if limit.lt.1, the routine will end with ier = 6. - !! - !! lenw - integer - !! dimensioning parameter for work - !! lenw must be at least limit*4. - !! if lenw.lt.limit*4, the routine will end - !! with ier = 6. - !! - !! last - integer - !! on return, last equals the number of subintervals - !! produced in the subdivision process, which - !! determines the number of significant elements - !! actually in the work arrays. - !! - !! work arrays - !! iwork - integer - !! vector of dimension at least limit, the first - !! k elements of which contain pointers - !! to the error estimates over the subintervals, - !! such that work(limit*3+iwork(1)),... , - !! work(limit*3+iwork(k)) form a decreasing - !! sequence, with k = last if last.le.(limit/2+2), and - !! k = limit+1-last otherwise - !! - !! work - double precision - !! vector of dimension at least lenw - !! on return - !! work(1), ..., work(last) contain the left - !! end points of the subintervals in the - !! partition of (a,b), - !! work(limit+1), ..., work(limit+last) contain - !! the right end points, - !! work(limit*2+1), ...,work(limit*2+last) contain the - !! integral approximations over the subintervals, - !! work(limit*3+1), ..., work(limit*3) - !! contain the error estimates. - !!***references (none) - !!***routines called dqagie,xerror - !!***end prologue dqagi - !! - subroutine dqagi(fx,fx_vars,bound,inf,epsabs,epsrel,result,abserr,neval, & - ier,limit,lenw,last,iwork,work) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: bound - integer :: inf - real(kind=f) :: epsabs - real(kind=f) :: epsrel - real(kind=f) :: result - real(kind=f) :: abserr - integer :: neval - integer :: ier - integer :: limit - integer :: lenw - integer :: last - integer :: iwork(limit) - real(kind=f) :: work(lenw) - - ! Local declarations - integer lvl,l1,l2,l3 - - ! - ! check validity of limit and lenw. - ! - !***first executable statement dqagi - ier = 6 - neval = 0 - last = 0 - result = 0.0_f - abserr = 0.0_f - if(limit.lt.1.or.lenw.lt.limit*4) go to 10 - ! - ! prepare call for dqagie. - ! - l1 = limit+1 - l2 = limit+l1 - l3 = limit+l2 - - call dqagie(fx,fx_vars,bound,inf,epsabs,epsrel,limit,result,abserr, & - neval,ier,work(1),work(l1),work(l2),work(l3),iwork,last) - ! - ! call error handler if necessary. - ! - lvl = 0 -10 if(ier.eq.6) lvl = 1 - if(ier.ne.0) then - write(*,*) "ERROR: abnormal return from dqagi" - write(*,*) " ifail=",ier," level=",lvl - endif - return - end subroutine dqagi - - - !!***begin prologue dqagie - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a3a1,h2a4a1 - !!***keywords automatic integrator, infinite intervals, - !! general-purpose, transformation, extrapolation, - !! globally adaptive - !!***author piessens,robert,appl. math & progr. div - k.u.leuven - !! de doncker,elise,appl. math & progr. div - k.u.leuven - !!***purpose the routine calculates an approximation result to a given - !! integral i = integral of f over (bound,+infinity) - !! or i = integral of f over (-infinity,bound) - !! or i = integral of f over (-infinity,+infinity), - !! hopefully satisfying following claim for accuracy - !! abs(i-result).le.max(epsabs,epsrel*abs(i)) - !!***description - !! - !! integration over infinite intervals - !! standard fortran subroutine - !! - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the driver program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! bound - double precision - !! finite bound of integration range - !! (has no meaning if interval is doubly-infinite) - !! - !! inf - double precision - !! indicating the kind of integration range involved - !! inf = 1 corresponds to (bound,+infinity), - !! inf = -1 to (-infinity,bound), - !! inf = 2 to (-infinity,+infinity). - !! - !! epsabs - double precision - !! absolute accuracy requested - !! epsrel - double precision - !! relative accuracy requested - !! if epsabs.le.0 - !! and epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! the routine will end with ier = 6. - !! - !! limit - integer - !! gives an upper bound on the number of subintervals - !! in the partition of (a,b), limit.ge.1 - !! - !! on return - !! result - double precision - !! approximation to the integral - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed abs(i-result) - !! - !! neval - integer - !! number of integrand evaluations - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! - ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! error messages - !! ier = 1 maximum number of subdivisions allowed - !! has been achieved. one can allow more - !! subdivisions by increasing the value of - !! limit (and taking the according dimension - !! adjustments into account). however,if - !! this yields no improvement it is advised - !! to analyze the integrand in order to - !! determine the integration difficulties. - !! if the position of a local difficulty can - !! be determined (e.g. singularity, - !! discontinuity within the interval) one - !! will probably gain from splitting up the - !! interval at this point and calling the - !! integrator on the subranges. if possible, - !! an appropriate special-purpose integrator - !! should be used, which is designed for - !! handling the type of difficulty involved. - !! = 2 the occurrence of roundoff error is - !! detected, which prevents the requested - !! tolerance from being achieved. - !! the error may be under-estimated. - !! = 3 extremely bad integrand behaviour occurs - !! at some points of the integration - !! interval. - !! = 4 the algorithm does not converge. - !! roundoff error is detected in the - !! extrapolation table. - !! it is assumed that the requested tolerance - !! cannot be achieved, and that the returned - !! result is the best which can be obtained. - !! = 5 the integral is probably divergent, or - !! slowly convergent. it must be noted that - !! divergence can occur with any other value - !! of ier. - !! = 6 the input is invalid, because - !! (epsabs.le.0 and - !! epsrel.lt.max(50*rel.mach.acc.,0.5d-28), - !! result, abserr, neval, last, rlist(1), - !! elist(1) and iord(1) are set to zero. - !! alist(1) and blist(1) are set to 0 - !! and 1 respectively. - !! = 9 failure in sd1mach determining machine parameters - !! - !! alist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the left - !! end points of the subintervals in the partition - !! of the transformed integration range (0,1). - !! - !! blist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the right - !! end points of the subintervals in the partition - !! of the transformed integration range (0,1). - !! - !! rlist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the integral - !! approximations on the subintervals - !! - !! elist - double precision - !! vector of dimension at least limit, the first - !! last elements of which are the moduli of the - !! absolute error estimates on the subintervals - !! - !! iord - integer - !! vector of dimension limit, the first k - !! elements of which are pointers to the - !! error estimates over the subintervals, - !! such that elist(iord(1)), ..., elist(iord(k)) - !! form a decreasing sequence, with k = last - !! if last.le.(limit/2+2), and k = limit+1-last - !! otherwise - !! - !! last - integer - !! number of subintervals actually produced - !! in the subdivision process - !! - !!***references (none) - !!***routines called sd1mach,dqelg,dqk15i,dqpsrt - !!***end prologue dqagie - subroutine dqagie(fx,fx_vars,bound,inf,epsabs,epsrel,limit,result,abserr,neval,ier,alist,blist,rlist,elist,iord,last) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: bound - integer :: inf - real(kind=f) :: epsabs - real(kind=f) :: epsrel - integer :: limit - real(kind=f) :: result - real(kind=f) :: abserr - integer :: neval - integer :: ier - real(kind=f) :: alist(limit) - real(kind=f) :: blist(limit) - real(kind=f) :: rlist(limit) - real(kind=f) :: elist(limit) - integer :: iord(limit) - integer :: last - - ! Local declartions - real(kind=f) :: abseps, area, area1, area12, area2 - real(kind=f) :: a1, a2, b1, b2, correc - real(kind=f) :: defabs, defab1, defab2 - real(kind=f) :: dmax1, dres, epmach, erlarg, erlast - real(kind=f) :: errbnd, errmax, error1, error2, erro12, errsum - real(kind=f) :: ertest, oflow, resabs, reseps, res3la(3), rlist2(52) - real(kind=f) :: small, uflow, boun - - integer :: id, ierro, iroff1, iroff2, iroff3, jupbnd, k, ksgn - integer :: ktmin, maxerr, nres, nrmax, numrl2 - logical :: extrap, noext - - - ! - ! the dimension of rlist2 is determined by the value of - ! limexp in subroutine dqelg. - ! - ! list of major variables - ! ----------------------- - ! - ! alist - list of left end points of all subintervals - ! considered up to now - ! blist - list of right end points of all subintervals - ! considered up to now - ! rlist(i) - approximation to the integral over - ! (alist(i),blist(i)) - ! rlist2 - array of dimension at least (limexp+2), - ! containing the part of the epsilon table - ! wich is still needed for further computations - ! elist(i) - error estimate applying to rlist(i) - ! maxerr - pointer to the interval with largest error - ! estimate - ! errmax - elist(maxerr) - ! erlast - error on the interval currently subdivided - ! (before that subdivision has taken place) - ! area - sum of the integrals over the subintervals - ! errsum - sum of the errors over the subintervals - ! errbnd - requested accuracy max(epsabs,epsrel* - ! abs(result)) - ! *****1 - variable for the left subinterval - ! *****2 - variable for the right subinterval - ! last - index for subdivision - ! nres - number of calls to the extrapolation routine - ! numrl2 - number of elements currently in rlist2. if an - ! appropriate approximation to the compounded - ! integral has been obtained, it is put in - ! rlist2(numrl2) after numrl2 has been increased - ! by one. - ! small - length of the smallest interval considered up - ! to now, multiplied by 1.5 - ! erlarg - sum of the errors over the intervals larger - ! than the smallest interval considered up to now - ! extrap - logical variable denoting that the routine - ! is attempting to perform extrapolation. i.e. - ! before subdividing the smallest interval we - ! try to decrease the value of erlarg. - ! noext - logical variable denoting that extrapolation - ! is no longer allowed (true-value) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! oflow is the largest positive magnitude. - ! - !***first executable statement dqagie - - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - ! - ! test on validity of parameters - ! ----------------------------- - ! - ier = 0 - neval = 0 - last = 0 - result = 0.0_f - abserr = 0.0_f - alist(1) = 0.0_f - blist(1) = 0.1e1_f - rlist(1) = 0.0_f - elist(1) = 0.0_f - iord(1) = 0 - if(epsabs.le.0.0_f.and.epsrel.lt.dmax1(0.5e2_f*epmach,0.5e-28_f)) ier = 6 - if(ier.eq.6) go to 999 - ! - ! - ! first approximation to the integral - ! ----------------------------------- - ! - ! determine the interval to be mapped onto (0,1). - ! if inf = 2 the integral is computed as i = i1+i2, where - ! i1 = integral of f over (-infinity,0), - ! i2 = integral of f over (0,+infinity). - ! - boun = bound - if(inf.eq.2) boun = 0.0_f - call dqk15i(fx,fx_vars,boun,inf,0.0_f,0.1e1_f,result,abserr,defabs,resabs,ier) - if(ier.eq.9) return - ! - ! test on accuracy - ! - last = 1 - rlist(1) = result - elist(1) = abserr - iord(1) = 1 - dres = dabs(result) - errbnd = dmax1(epsabs,epsrel*dres) - if(abserr.le.1.0e2_f*epmach*defabs.and.abserr.gt.errbnd) ier = 2 - if(limit.eq.1) ier = 1 - if(ier.ne.0.or.(abserr.le.errbnd.and.abserr.ne.resabs).or.abserr.eq.0.0_f) go to 130 - ! - ! initialization - ! -------------- - ! - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - call sd1mach(2,oflow,ier) - if(ier.eq.9) return - - !uflow = d1mach(1) - !oflow = d1mach(2) - rlist2(1) = result - errmax = abserr - maxerr = 1 - area = result - errsum = abserr - abserr = oflow - nrmax = 1 - nres = 0 - ktmin = 0 - numrl2 = 2 - extrap = .false. - noext = .false. - ierro = 0 - iroff1 = 0 - iroff2 = 0 - iroff3 = 0 - ksgn = -1 - if(dres.ge.(0.1e1_f-0.5e2_f*epmach)*defabs) ksgn = 1 - ! - ! main do-loop - ! ------------ - ! - do 90 last = 2,limit - ! - ! bisect the subinterval with nrmax-th largest error estimate. - ! - a1 = alist(maxerr) - b1 = 0.5_f*(alist(maxerr)+blist(maxerr)) - a2 = b1 - b2 = blist(maxerr) - erlast = errmax - call dqk15i(fx,fx_vars,boun,inf,a1,b1,area1,error1,resabs,defab1,ier) - if(ier.eq.9) return - call dqk15i(fx,fx_vars,boun,inf,a2,b2,area2,error2,resabs,defab2,ier) - if(ier.eq.9) return - ! - ! improve previous approximations to integral - ! and error and test for accuracy. - ! - area12 = area1+area2 - erro12 = error1+error2 - errsum = errsum+erro12-errmax - area = area+area12-rlist(maxerr) - if(defab1.eq.error1.or.defab2.eq.error2)go to 15 - if(dabs(rlist(maxerr)-area12).gt.0.1e-4_f*dabs(area12).or.erro12.lt.0.99_f*errmax) go to 10 - if(extrap) iroff2 = iroff2+1 - if(.not.extrap) iroff1 = iroff1+1 - 10 if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1 - 15 rlist(maxerr) = area1 - rlist(last) = area2 - errbnd = dmax1(epsabs,epsrel*dabs(area)) - ! - ! test for roundoff error and eventually set error flag. - ! - if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2 - if(iroff2.ge.5) ierro = 3 - ! - ! set error flag in the case that the number of - ! subintervals equals limit. - ! - if(last.eq.limit) ier = 1 - ! - ! set error flag in the case of bad integrand behaviour - ! at some points of the integration range. - ! - if(dmax1(dabs(a1),dabs(b2)).le.(0.1e1_f+0.1e3_f*epmach)*(dabs(a2)+0.1e4_f*uflow)) ier = 4 - ! - ! append the newly-created intervals to the list. - ! - if(error2.gt.error1) go to 20 - alist(last) = a2 - blist(maxerr) = b1 - blist(last) = b2 - elist(maxerr) = error1 - elist(last) = error2 - go to 30 - 20 alist(maxerr) = a2 - alist(last) = a1 - blist(last) = b1 - rlist(maxerr) = area2 - rlist(last) = area1 - elist(maxerr) = error2 - elist(last) = error1 - ! - ! call subroutine dqpsrt to maintain the descending ordering - ! in the list of error estimates and select the subinterval - ! with nrmax-th largest error estimate (to be bisected next). - ! - 30 call dqpsrt(limit,last,maxerr,errmax,elist,iord,nrmax) - if(errsum.le.errbnd) go to 115 - if(ier.ne.0) go to 100 - if(last.eq.2) go to 80 - if(noext) go to 90 - erlarg = erlarg-erlast - if(dabs(b1-a1).gt.small) erlarg = erlarg+erro12 - if(extrap) go to 40 - ! - ! test whether the interval to be bisected next is the - ! smallest interval. - ! - if(dabs(blist(maxerr)-alist(maxerr)).gt.small) go to 90 - extrap = .true. - nrmax = 2 - 40 if(ierro.eq.3.or.erlarg.le.ertest) go to 60 - ! - ! the smallest interval has the largest error. - ! before bisecting decrease the sum of the errors over the - ! larger intervals (erlarg) and perform extrapolation. - ! - id = nrmax - jupbnd = last - if(last.gt.(2+limit/2)) jupbnd = limit+3-last - do k = id,jupbnd - maxerr = iord(nrmax) - errmax = elist(maxerr) - if(dabs(blist(maxerr)-alist(maxerr)).gt.small) go to 90 - nrmax = nrmax+1 - end do - ! - ! perform extrapolation. - ! - 60 numrl2 = numrl2+1 - rlist2(numrl2) = area - call dqelg(numrl2,rlist2,reseps,abseps,res3la,nres, ier) - if(ier.eq.9) return - ktmin = ktmin+1 - if(ktmin.gt.5.and.abserr.lt.0.1e-2_f*errsum) ier = 5 - if(abseps.ge.abserr) go to 70 - ktmin = 0 - abserr = abseps - result = reseps - correc = erlarg - ertest = dmax1(epsabs,epsrel*dabs(reseps)) - if(abserr.le.ertest) go to 100 - ! - ! prepare bisection of the smallest interval. - ! - 70 if(numrl2.eq.1) noext = .true. - if(ier.eq.5) go to 100 - maxerr = iord(1) - errmax = elist(maxerr) - nrmax = 1 - extrap = .false. - small = small*0.5_f - erlarg = errsum - go to 90 - 80 small = 0.375_f - erlarg = errsum - ertest = errbnd - rlist2(2) = area - 90 continue - ! - ! set final result and error estimate. - ! ------------------------------------ - ! -100 if(abserr.eq.oflow) go to 115 - if((ier+ierro).eq.0) go to 110 - if(ierro.eq.3) abserr = abserr+correc - if(ier.eq.0) ier = 3 - if(result.ne.0.0_f.and.area.ne.0.0_f)go to 105 - if(abserr.gt.errsum)go to 115 - if(area.eq.0.0_f) go to 130 - go to 110 -105 if(abserr/dabs(result).gt.errsum/dabs(area))go to 115 - ! - ! test on divergence - ! -110 if(ksgn.eq.(-1).and.dmax1(dabs(result),dabs(area)).le.defabs*0.1e-1_f) go to 130 - if(0.1e-1_f.gt.(result/area).or.(result/area).gt.0.1e3_f.or.errsum.gt.dabs(area)) ier = 6 - go to 130 - ! - ! compute global integral sum. - ! -115 result = 0.0_f - do k = 1,last - result = result+rlist(k) - end do - abserr = errsum -130 neval = 30*last-15 - if(inf.eq.2) neval = 2*neval - if(ier.gt.2) ier=ier-1 -999 return - end subroutine dqagie - - - !!***begin prologue dqk15 - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 15-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div - k.u.leuven - !!***purpose to compute i = integral of f over (a,b), with error - !! estimate - !! j = integral of abs(f) over (a,b) - !!***description - !! - !! integration rules - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code! - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 15-point - !! kronrod rule (resk) obtained by optimal addition - !! of abscissae to the7-point gauss rule(resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should not exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of abs(f-i/(b-a)) - !! over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk15 - !! - subroutine dqk15(fx,fx_vars,a,b,result,abserr,resabs,resasc,ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local Declarations - real(kind=f) :: absc, centr, dabs, dhlgth, dmax2, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(7), fv2(7), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(4), wgk(8), xgk(8) - integer :: j,jtw,jtwm1 - - ! - ! - ! the abscissae and weights are given for the interval (-1,1). - ! because of symmetry only the positive abscissae and their - ! corresponding weights are given. - ! - ! xgk - abscissae of the 15-point kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 7-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 7-point gauss rule - ! - ! wgk - weights of the 15-point kronrod rule - ! - ! wg - weights of the 7-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.129484966168869693270611432679082_f / - data wg ( 2) / 0.279705391489276667901467771423780_f / - data wg ( 3) / 0.381830050505118944950369775488975_f / - data wg ( 4) / 0.417959183673469387755102040816327_f / - - data xgk ( 1) / 0.991455371120812639206854697526329_f / - data xgk ( 2) / 0.949107912342758524526189684047851_f / - data xgk ( 3) / 0.864864423359769072789712788640926_f / - data xgk ( 4) / 0.741531185599394439863864773280788_f / - data xgk ( 5) / 0.586087235467691130294144838258730_f / - data xgk ( 6) / 0.405845151377397166906606412076961_f / - data xgk ( 7) / 0.207784955007898467600689403773245_f / - data xgk ( 8) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.022935322010529224963732008058970_f / - data wgk ( 2) / 0.063092092629978553290700663189204_f / - data wgk ( 3) / 0.104790010322250183839876322541518_f / - data wgk ( 4) / 0.140653259715525918745189590510238_f / - data wgk ( 5) / 0.169004726639267902826583426598550_f / - data wgk ( 6) / 0.190350578064785409913256402421014_f / - data wgk ( 7) / 0.204432940075298892414161999234649_f / - data wgk ( 8) / 0.209482141084727828012999174891714_f / - - ! - ! - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc - abscissa - ! fval* - function value - ! resg - result of the 7-point gauss formula - ! resk - result of the 15-point kronrod formula - ! reskh - approximation to the mean value of f over (a,b), - ! i.e. to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !***first executable statement dqk15 - !epmach = d1mach(4) - !uflow = d1mach(1) - - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 15-point kronrod approximation to - ! the integral, and estimate the absolute error. - ! - fc = fx(centr,fx_vars) - resg = fc*wg(4) - resk = fc*wgk(8) - resabs = dabs(resk) - do j=1,3 - jtw = j*2 - absc = hlgth*xgk(jtw) - fval1 = fx(centr-absc,fx_vars) - fval2 = fx(centr+absc,fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j = 1,4 - jtwm1 = j*2-1 - absc = hlgth*xgk(jtwm1) - fval1 = fx(centr-absc,fx_vars) - fval2 = fx(centr+absc,fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(8)*dabs(fc-reskh) - do j=1,7 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0.0_f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk15 - - !! - !!***begin prologue dqk21 - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 21-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose to compute i = integral of f over (a,b), with error - !! estimate - !! j = integral of abs(f) over (a,b) - !!***description - !! - !! integration rules - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the driver program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 21-point - !! kronrod rule (resk) obtained by optimal addition - !! of abscissae to the 10-point gauss rule (resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should not exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of abs(f-i/(b-a)) - !! over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk21 - !! - subroutine dqk21(fx,fx_vars,a,b,result,abserr,resabs,resasc, ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declarations - real(kind=f) :: absc, centr, dabs, dhlgth, dmax1, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(10), fv2(10), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(5), wgk(11),xgk(11) - integer :: j,jtw,jtwm1 - - ! - ! the abscissae and weights are given for the interval (-1,1). - ! because of symmetry only the positive abscissae and their - ! corresponding weights are given. - ! - ! xgk - abscissae of the 21-point kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 10-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 10-point gauss rule - ! - ! wgk - weights of the 21-point kronrod rule - ! - ! wg - weights of the 10-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.066671344308688137593568809893332_f / - data wg ( 2) / 0.149451349150580593145776339657697_f / - data wg ( 3) / 0.219086362515982043995534934228163_f / - data wg ( 4) / 0.269266719309996355091226921569469_f / - data wg ( 5) / 0.295524224714752870173892994651338_f / - - data xgk ( 1) / 0.995657163025808080735527280689003_f / - data xgk ( 2) / 0.973906528517171720077964012084452_f / - data xgk ( 3) / 0.930157491355708226001207180059508_f / - data xgk ( 4) / 0.865063366688984510732096688423493_f / - data xgk ( 5) / 0.780817726586416897063717578345042_f / - data xgk ( 6) / 0.679409568299024406234327365114874_f / - data xgk ( 7) / 0.562757134668604683339000099272694_f / - data xgk ( 8) / 0.433395394129247190799265943165784_f / - data xgk ( 9) / 0.294392862701460198131126603103866_f / - data xgk ( 10) / 0.148874338981631210884826001129720_f / - data xgk ( 11) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.011694638867371874278064396062192_f / - data wgk ( 2) / 0.032558162307964727478818972459390_f / - data wgk ( 3) / 0.054755896574351996031381300244580_f / - data wgk ( 4) / 0.075039674810919952767043140916190_f / - data wgk ( 5) / 0.093125454583697605535065465083366_f / - data wgk ( 6) / 0.109387158802297641899210590325805_f / - data wgk ( 7) / 0.123491976262065851077958109831074_f / - data wgk ( 8) / 0.134709217311473325928054001771707_f / - data wgk ( 9) / 0.142775938577060080797094273138717_f / - data wgk ( 10) / 0.147739104901338491374841515972068_f / - data wgk ( 11) / 0.149445554002916905664936468389821_f / - - ! - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc - abscissa - ! fval* - function value - ! resg - result of the 10-point gauss formula - ! resk - result of the 21-point kronrod formula - ! reskh - approximation to the mean value of f over (a,b), - ! i.e. to i/(b-a) - ! - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !***first executable statement dqk21 - !epmach = d1mach(4) - !uflow = d1mach(1) - - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 21-point kronrod approximation to - ! the integral, and estimate the absolute error. - ! - resg = 0.0_f - fc = fx(centr, fx_vars) - resk = wgk(11)*fc - resabs = dabs(resk) - do j=1,5 - jtw = 2*j - absc = hlgth*xgk(jtw) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j = 1,5 - jtwm1 = 2*j-1 - absc = hlgth*xgk(jtwm1) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(11)*dabs(fc-reskh) - do j=1,10 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0.0_f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk21 - - !!***begin prologue dqk31 - !!***date written 800101 (yymmdd) - !!***revision date 130519 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 31-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose to compute i = integral of f over (a,b) with error - !! estimate - !! j = integral of abs(f) over (a,b) - !!***description - !! - !! integration rules - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code! - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 31-point - !! gauss-kronrod rule (resk), obtained by optimal - !! addition of abscissae to the 15-point gauss - !! rule (resg). - !! - !! abserr - double precison - !! estimate of the modulus of the modulus, - !! which should not exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of abs(f-i/(b-a)) - !! over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk31 - subroutine dqk31(fx,fx_vars,a,b,result,abserr,resabs,resasc, ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declarations - real(kind=f) :: absc, centr, dabs, dhlgth, dmax1, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(15), fv2(15), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(8), wgk(16), xgk(16) - integer :: j,jtw,jtwm1 - - ! - ! - ! the abscissae and weights are given for the interval (-1,1). - ! because of symmetry only the positive abscissae and their - ! corresponding weights are given. - ! - ! xgk - abscissae of the 31-point kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 15-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 15-point gauss rule - ! - ! wgk - weights of the 31-point kronrod rule - ! - ! wg - weights of the 15-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.030753241996117268354628393577204_f / - data wg ( 2) / 0.070366047488108124709267416450667_f / - data wg ( 3) / 0.107159220467171935011869546685869_f / - data wg ( 4) / 0.139570677926154314447804794511028_f / - data wg ( 5) / 0.166269205816993933553200860481209_f / - data wg ( 6) / 0.186161000015562211026800561866423_f / - data wg ( 7) / 0.198431485327111576456118326443839_f / - data wg ( 8) / 0.202578241925561272880620199967519_f / - - data xgk ( 1) / 0.998002298693397060285172840152271_f / - data xgk ( 2) / 0.987992518020485428489565718586613_f / - data xgk ( 3) / 0.967739075679139134257347978784337_f / - data xgk ( 4) / 0.937273392400705904307758947710209_f / - data xgk ( 5) / 0.897264532344081900882509656454496_f / - data xgk ( 6) / 0.848206583410427216200648320774217_f / - data xgk ( 7) / 0.790418501442465932967649294817947_f / - data xgk ( 8) / 0.724417731360170047416186054613938_f / - data xgk ( 9) / 0.650996741297416970533735895313275_f / - data xgk ( 10) / 0.570972172608538847537226737253911_f / - data xgk ( 11) / 0.485081863640239680693655740232351_f / - data xgk ( 12) / 0.394151347077563369897207370981045_f / - data xgk ( 13) / 0.299180007153168812166780024266389_f / - data xgk ( 14) / 0.201194093997434522300628303394596_f / - data xgk ( 15) / 0.101142066918717499027074231447392_f / - data xgk ( 16) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.005377479872923348987792051430128_f / - data wgk ( 2) / 0.015007947329316122538374763075807_f / - data wgk ( 3) / 0.025460847326715320186874001019653_f / - data wgk ( 4) / 0.035346360791375846222037948478360_f / - data wgk ( 5) / 0.044589751324764876608227299373280_f / - data wgk ( 6) / 0.053481524690928087265343147239430_f / - data wgk ( 7) / 0.062009567800670640285139230960803_f / - data wgk ( 8) / 0.069854121318728258709520077099147_f / - data wgk ( 9) / 0.076849680757720378894432777482659_f / - data wgk ( 10) / 0.083080502823133021038289247286104_f / - data wgk ( 11) / 0.088564443056211770647275443693774_f / - data wgk ( 12) / 0.093126598170825321225486872747346_f / - data wgk ( 13) / 0.096642726983623678505179907627589_f / - data wgk ( 14) / 0.099173598721791959332393173484603_f / - data wgk ( 15) / 0.100769845523875595044946662617570_f / - data wgk ( 16) / 0.101330007014791549017374792767493_f / - ! - ! - ! list of major variables - ! ----------------------- - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc - abscissa - ! fval* - function value - ! resg - result of the 15-point gauss formula - ! resk - result of the 31-point kronrod formula - ! reskh - approximation to the mean value of f over (a,b), - ! i.e. to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - !***first executable statement dqk31 - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 31-point kronrod approximation to - ! the integral, and estimate the absolute error. - ! - fc = fx(centr, fx_vars) - resg = wg(8)*fc - resk = wgk(16)*fc - resabs = dabs(resk) - do j=1,7 - jtw = j*2 - absc = hlgth*xgk(jtw) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j = 1,8 - jtwm1 = j*2-1 - absc = hlgth*xgk(jtwm1) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(16)*dabs(fc-reskh) - do j=1,15 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0.0_f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk31 - - - - !!***begin prologue dqk41 - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 41-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose to compute i = integral of f over (a,b), with error - !! estimate - !! j = integral of abs(f) over (a,b) - !!***description - !! - !! integration rules - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 41-point - !! gauss-kronrod rule (resk) obtained by optimal - !! addition of abscissae to the 20-point gauss - !! rule (resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should not exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integal of abs(f-i/(b-a)) - !! over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk41 - !! - subroutine dqk41(fx,fx_vars,a,b,result,abserr,resabs,resasc, ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declarations - real(kind=f) :: absc, centr, dabs, dhlgth, dmax1, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(20), fv2(20), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(10), wgk(21), xgk(21) - integer :: j, jtw, jtwm1 - - ! - ! the abscissae and weights are given for the interval (-1,1). - ! because of symmetry only the positive abscissae and their - ! corresponding weights are given. - ! - ! xgk - abscissae of the 41-point gauss-kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 20-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 20-point gauss rule - ! - ! wgk - weights of the 41-point gauss-kronrod rule - ! - ! wg - weights of the 20-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.017614007139152118311861962351853_f / - data wg ( 2) / 0.040601429800386941331039952274932_f / - data wg ( 3) / 0.062672048334109063569506535187042_f / - data wg ( 4) / 0.083276741576704748724758143222046_f / - data wg ( 5) / 0.101930119817240435036750135480350_f / - data wg ( 6) / 0.118194531961518417312377377711382_f / - data wg ( 7) / 0.131688638449176626898494499748163_f / - data wg ( 8) / 0.142096109318382051329298325067165_f / - data wg ( 9) / 0.149172986472603746787828737001969_f / - data wg ( 10) / 0.152753387130725850698084331955098_f / - - data xgk ( 1) / 0.998859031588277663838315576545863_f / - data xgk ( 2) / 0.993128599185094924786122388471320_f / - data xgk ( 3) / 0.981507877450250259193342994720217_f / - data xgk ( 4) / 0.963971927277913791267666131197277_f / - data xgk ( 5) / 0.940822633831754753519982722212443_f / - data xgk ( 6) / 0.912234428251325905867752441203298_f / - data xgk ( 7) / 0.878276811252281976077442995113078_f / - data xgk ( 8) / 0.839116971822218823394529061701521_f / - data xgk ( 9) / 0.795041428837551198350638833272788_f / - data xgk ( 10) / 0.746331906460150792614305070355642_f / - data xgk ( 11) / 0.693237656334751384805490711845932_f / - data xgk ( 12) / 0.636053680726515025452836696226286_f / - data xgk ( 13) / 0.575140446819710315342946036586425_f / - data xgk ( 14) / 0.510867001950827098004364050955251_f/ - data xgk ( 15) / 0.443593175238725103199992213492640_f / - data xgk ( 16) / 0.373706088715419560672548177024927_f / - data xgk ( 17) / 0.301627868114913004320555356858592_f / - data xgk ( 18) / 0.227785851141645078080496195368575_f / - data xgk ( 19) / 0.152605465240922675505220241022678_f / - data xgk ( 20) / 0.076526521133497333754640409398838_f / - data xgk ( 21) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.003073583718520531501218293246031_f / - data wgk ( 2) / 0.008600269855642942198661787950102_f / - data wgk ( 3) / 0.014626169256971252983787960308868_f / - data wgk ( 4) / 0.020388373461266523598010231432755_f / - data wgk ( 5) / 0.025882133604951158834505067096153_f / - data wgk ( 6) / 0.031287306777032798958543119323801_f / - data wgk ( 7) / 0.036600169758200798030557240707211_f / - data wgk ( 8) / 0.041668873327973686263788305936895_f / - data wgk ( 9) / 0.046434821867497674720231880926108_f / - data wgk ( 10) / 0.050944573923728691932707670050345_f / - data wgk ( 11) / 0.055195105348285994744832372419777_f / - data wgk ( 12) / 0.059111400880639572374967220648594_f / - data wgk ( 13) / 0.062653237554781168025870122174255_f / - data wgk ( 14) / 0.065834597133618422111563556969398_f / - data wgk ( 15) / 0.068648672928521619345623411885368_f / - data wgk ( 16) / 0.071054423553444068305790361723210_f / - data wgk ( 17) / 0.073030690332786667495189417658913_f / - data wgk ( 18) / 0.074582875400499188986581418362488_f / - data wgk ( 19) / 0.075704497684556674659542775376617_f / - data wgk ( 20) / 0.076377867672080736705502835038061_f / - data wgk ( 21) / 0.076600711917999656445049901530102_f / - - ! - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc - abscissa - ! fval* - function value - ! resg - result of the 20-point gauss formula - ! resk - result of the 41-point kronrod formula - ! reskh - approximation to mean value of f over (a,b), i.e. - ! to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !***first executable statement dqk41 - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 41-point gauss-kronrod approximation to - ! the integral, and estimate the absolute error. - ! - resg = 0.0_f - fc = fx(centr, fx_vars) - resk = wgk(21)*fc - resabs = dabs(resk) - do j=1,10 - jtw = j*2 - absc = hlgth*xgk(jtw) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j = 1,10 - jtwm1 = j*2-1 - absc = hlgth*xgk(jtwm1) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(21)*dabs(fc-reskh) - do j=1,20 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0._f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk41 - - - !!***begin prologue dqk51 - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 51-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math & progr. div. - k.u.leuven - !!***purpose to compute i = integral of f over (a,b) with error - !! estimate - !! j = integral of abs(f) over (a,b) - !!***description - !! - !! integration rules - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! function subroutine defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 51-point - !! kronrod rule (resk) obtained by optimal addition - !! of abscissae to the 25-point gauss rule (resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should not exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of abs(f-i/(b-a)) - !! over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk51 - !! - subroutine dqk51(fx,fx_vars,a,b,result,abserr,resabs,resasc,ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declarations - real(kind=f) :: absc, centr, dabs, dhlgth, dmax1, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(25), fv2(25), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(13),wgk(26), xgk(26) - integer j,jtw,jtwm1 - - ! - ! the abscissae and weights are given for the interval (-1,1). - ! because of symmetry only the positive abscissae and their - ! corresponding weights are given. - ! - ! xgk - abscissae of the 51-point kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 25-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 25-point gauss rule - ! - ! wgk - weights of the 51-point kronrod rule - ! - ! wg - weights of the 25-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.011393798501026287947902964113235_f / - data wg ( 2) / 0.026354986615032137261901815295299_f / - data wg ( 3) / 0.040939156701306312655623487711646_f / - data wg ( 4) / 0.054904695975835191925936891540473_f / - data wg ( 5) / 0.068038333812356917207187185656708_f / - data wg ( 6) / 0.080140700335001018013234959669111_f / - data wg ( 7) / 0.091028261982963649811497220702892_f / - data wg ( 8) / 0.100535949067050644202206890392686_f / - data wg ( 9) / 0.108519624474263653116093957050117_f / - data wg ( 10) / 0.114858259145711648339325545869556_f / - data wg ( 11) / 0.119455763535784772228178126512901_f / - data wg ( 12) / 0.122242442990310041688959518945852_f / - data wg ( 13) / 0.123176053726715451203902873079050_f / - - data xgk ( 1) / 0.999262104992609834193457486540341_f / - data xgk ( 2) / 0.995556969790498097908784946893902_f / - data xgk ( 3) / 0.988035794534077247637331014577406_f / - data xgk ( 4) / 0.976663921459517511498315386479594_f / - data xgk ( 5) / 0.961614986425842512418130033660167_f / - data xgk ( 6) / 0.942974571228974339414011169658471_f / - data xgk ( 7) / 0.920747115281701561746346084546331_f / - data xgk ( 8) / 0.894991997878275368851042006782805_f / - data xgk ( 9) / 0.865847065293275595448996969588340_f / - data xgk ( 10) / 0.833442628760834001421021108693570_f / - data xgk ( 11) / 0.797873797998500059410410904994307_f / - data xgk ( 12) / 0.759259263037357630577282865204361_f / - data xgk ( 13) / 0.717766406813084388186654079773298_f / - data xgk ( 14) / 0.673566368473468364485120633247622_f / - data xgk ( 15) / 0.626810099010317412788122681624518_f / - data xgk ( 16) / 0.577662930241222967723689841612654_f / - data xgk ( 17) / 0.526325284334719182599623778158010_f / - data xgk ( 18) / 0.473002731445714960522182115009192_f / - data xgk ( 19) / 0.417885382193037748851814394594572_f / - data xgk ( 20) / 0.361172305809387837735821730127641_f / - data xgk ( 21) / 0.303089538931107830167478909980339_f / - data xgk ( 22) / 0.243866883720988432045190362797452_f / - data xgk ( 23) / 0.183718939421048892015969888759528_f / - data xgk ( 24) / 0.122864692610710396387359818808037_f / - data xgk ( 25) / 0.061544483005685078886546392366797_f / - data xgk ( 26) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.001987383892330315926507851882843_f / - data wgk ( 2) / 0.005561932135356713758040236901066_f / - data wgk ( 3) / 0.009473973386174151607207710523655_f / - data wgk ( 4) / 0.013236229195571674813656405846976_f / - data wgk ( 5) / 0.016847817709128298231516667536336_f / - data wgk ( 6) / 0.020435371145882835456568292235939_f / - data wgk ( 7) / 0.024009945606953216220092489164881_f / - data wgk ( 8) / 0.027475317587851737802948455517811_f / - data wgk ( 9) / 0.030792300167387488891109020215229_f / - data wgk ( 10) / 0.034002130274329337836748795229551_f / - data wgk ( 11) / 0.037116271483415543560330625367620_f / - data wgk ( 12) / 0.040083825504032382074839284467076_f / - data wgk ( 13) / 0.042872845020170049476895792439495_f / - data wgk ( 14) / 0.045502913049921788909870584752660_f / - data wgk ( 15) / 0.047982537138836713906392255756915_f / - data wgk ( 16) / 0.050277679080715671963325259433440_f / - data wgk ( 17) / 0.052362885806407475864366712137873_f / - data wgk ( 18) / 0.054251129888545490144543370459876_f / - data wgk ( 19) / 0.055950811220412317308240686382747_f / - data wgk ( 20) / 0.057437116361567832853582693939506_f / - data wgk ( 21) / 0.058689680022394207961974175856788_f / - data wgk ( 22) / 0.059720340324174059979099291932562_f / - data wgk ( 23) / 0.060539455376045862945360267517565_f / - data wgk ( 24) / 0.061128509717053048305859030416293_f / - data wgk ( 25) / 0.061471189871425316661544131965264_f / - ! note: wgk (26) was calculated from the values of wgk(1..25) - data wgk ( 26) / 0.061580818067832935078759824240066_f / - - ! - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc - abscissa - ! fval* - function value - ! resg - result of the 25-point gauss formula - ! resk - result of the 51-point kronrod formula - ! reskh - approximation to the mean value of f over (a,b), - ! i.e. to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !***first executable statement dqk51 - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 51-point kronrod approximation to - ! the integral, and estimate the absolute error. - ! - fc = fx(centr, fx_vars) - resg = wg(13)*fc - resk = wgk(26)*fc - resabs = dabs(resk) - do j=1,12 - jtw = j*2 - absc = hlgth*xgk(jtw) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j = 1,13 - jtwm1 = j*2-1 - absc = hlgth*xgk(jtwm1) - fval1 = fx(centr-absc, fx_vars) - fval2 = fx(centr+absc, fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(26)*dabs(fc-reskh) - do j=1,25 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0.0_f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk51 - - !!***begin prologue dqk61 - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a1a2 - !!***keywords 61-point gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose to compute i = integral of f over (a,b) with error - !! estimate - !! j = integral of dabs(f) over (a,b) - !!***description - !! - !! integration rule - !! standard fortran subroutine - !! double precision version - !! - !! - !! parameters - !! on entry - !! fx - double precision - !! function subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code - !! - !! a - double precision - !! lower limit of integration - !! - !! b - double precision - !! upper limit of integration - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 61-point - !! kronrod rule (resk) obtained by optimal addition of - !! abscissae to the 30-point gauss rule (resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed dabs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of dabs(f-i/(b-a)) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk61 - !! - subroutine dqk61(fx,fx_vars,a,b,result,abserr,resabs,resasc, ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declartions - real(kind=f) :: dabsc, centr, dabs, dhlgth, dmax1, dmin1 - real(kind=f) :: epmach, fc, fsum, fval1, fval2, fv1(30), fv2(30), hlgth - real(kind=f) :: resg, resk, reskh, uflow, wg(15) ,wgk(31), xgk(31) - integer :: j, jtw, jtwm1 - - ! - ! the abscissae and weights are given for the - ! interval (-1,1). because of symmetry only the positive - ! abscissae and their corresponding weights are given. - ! - ! xgk - abscissae of the 61-point kronrod rule - ! xgk(2), xgk(4) ... abscissae of the 30-point - ! gauss rule - ! xgk(1), xgk(3) ... optimally added abscissae - ! to the 30-point gauss rule - ! - ! wgk - weights of the 61-point kronrod rule - ! - ! wg - weigths of the 30-point gauss rule - ! - ! - ! gauss quadrature weights and kronron quadrature abscissae and weights - ! as evaluated with 80 decimal digit arithmetic by l. w. fullerton, - ! bell labs, nov. 1981. - ! - data wg ( 1) / 0.007968192496166605615465883474674_f / - data wg ( 2) / 0.018466468311090959142302131912047_f / - data wg ( 3) / 0.028784707883323369349719179611292_f / - data wg ( 4) / 0.038799192569627049596801936446348_f / - data wg ( 5) / 0.048402672830594052902938140422808_f / - data wg ( 6) / 0.057493156217619066481721689402056_f / - data wg ( 7) / 0.065974229882180495128128515115962_f / - data wg ( 8) / 0.073755974737705206268243850022191_f / - data wg ( 9) / 0.080755895229420215354694938460530_f / - data wg ( 10) / 0.086899787201082979802387530715126_f / - data wg ( 11) / 0.092122522237786128717632707087619_f / - data wg ( 12) / 0.096368737174644259639468626351810_f / - data wg ( 13) / 0.099593420586795267062780282103569_f / - data wg ( 14) / 0.101762389748405504596428952168554_f / - data wg ( 15) / 0.102852652893558840341285636705415_f / - - data xgk ( 1) / 0.999484410050490637571325895705811_f / - data xgk ( 2) / 0.996893484074649540271630050918695_f / - data xgk ( 3) / 0.991630996870404594858628366109486_f / - data xgk ( 4) / 0.983668123279747209970032581605663_f / - data xgk ( 5) / 0.973116322501126268374693868423707_f / - data xgk ( 6) / 0.960021864968307512216871025581798_f / - data xgk ( 7) / 0.944374444748559979415831324037439_f / - data xgk ( 8) / 0.926200047429274325879324277080474_f / - data xgk ( 9) / 0.905573307699907798546522558925958_f / - data xgk ( 10) / 0.882560535792052681543116462530226_f / - data xgk ( 11) / 0.857205233546061098958658510658944_f / - data xgk ( 12) / 0.829565762382768397442898119732502_f / - data xgk ( 13) / 0.799727835821839083013668942322683_f / - data xgk ( 14) / 0.767777432104826194917977340974503_f / - data xgk ( 15) / 0.733790062453226804726171131369528_f / - data xgk ( 16) / 0.697850494793315796932292388026640_f / - data xgk ( 17) / 0.660061064126626961370053668149271_f / - data xgk ( 18) / 0.620526182989242861140477556431189_f / - data xgk ( 19) / 0.579345235826361691756024932172540_f / - data xgk ( 20) / 0.536624148142019899264169793311073_f / - data xgk ( 21) / 0.492480467861778574993693061207709_f / - data xgk ( 22) / 0.447033769538089176780609900322854_f / - data xgk ( 23) / 0.400401254830394392535476211542661_f / - data xgk ( 24) / 0.352704725530878113471037207089374_f / - data xgk ( 25) / 0.304073202273625077372677107199257_f / - data xgk ( 26) / 0.254636926167889846439805129817805_f / - data xgk ( 27) / 0.204525116682309891438957671002025_f / - data xgk ( 28) / 0.153869913608583546963794672743256_f / - data xgk ( 29) / 0.102806937966737030147096751318001_f / - data xgk ( 30) / 0.051471842555317695833025213166723_f / - data xgk ( 31) / 0.000000000000000000000000000000000_f / - - data wgk ( 1) / 0.001389013698677007624551591226760_f / - data wgk ( 2) / 0.003890461127099884051267201844516_f / - data wgk ( 3) / 0.006630703915931292173319826369750_f / - data wgk ( 4) / 0.009273279659517763428441146892024_f / - data wgk ( 5) / 0.011823015253496341742232898853251_f / - data wgk ( 6) / 0.014369729507045804812451432443580_f / - data wgk ( 7) / 0.016920889189053272627572289420322_f / - data wgk ( 8) / 0.019414141193942381173408951050128_f / - data wgk ( 9) / 0.021828035821609192297167485738339_f / - data wgk ( 10) / 0.024191162078080601365686370725232_f / - data wgk ( 11) / 0.026509954882333101610601709335075_f / - data wgk ( 12) / 0.028754048765041292843978785354334_f / - data wgk ( 13) / 0.030907257562387762472884252943092_f / - data wgk ( 14) / 0.032981447057483726031814191016854_f / - data wgk ( 15) / 0.034979338028060024137499670731468_f / - data wgk ( 16) / 0.036882364651821229223911065617136_f / - data wgk ( 17) / 0.038678945624727592950348651532281_f / - data wgk ( 18) / 0.040374538951535959111995279752468_f / - data wgk ( 19) / 0.041969810215164246147147541285970_f / - data wgk ( 20) / 0.043452539701356069316831728117073_f / - data wgk ( 21) / 0.044814800133162663192355551616723_f / - data wgk ( 22) / 0.046059238271006988116271735559374_f / - data wgk ( 23) / 0.047185546569299153945261478181099_f / - data wgk ( 24) / 0.048185861757087129140779492298305_f / - data wgk ( 25) / 0.049055434555029778887528165367238_f / - data wgk ( 26) / 0.049795683427074206357811569379942_f / - data wgk ( 27) / 0.050405921402782346840893085653585_f / - data wgk ( 28) / 0.050881795898749606492297473049805_f / - data wgk ( 29) / 0.051221547849258772170656282604944_f / - data wgk ( 30) / 0.051426128537459025933862879215781_f / - data wgk ( 31) / 0.051494729429451567558340433647099_f / - - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! dabsc - abscissa - ! fval* - function value - ! resg - result of the 30-point gauss rule - ! resk - result of the 61-point kronrod rule - ! reskh - approximation to the mean value of f - ! over (a,b), i.e. to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! a uflow is the smallest positive magnitude. - ! - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - - centr = 0.5_f*(b+a) - hlgth = 0.5_f*(b-a) - dhlgth = dabs(hlgth) - ! - ! compute the 61-point kronrod approximation to the - ! integral, and estimate the absolute error. - ! - !***first executable statement dqk61 - resg = 0.0_f - fc = fx(centr, fx_vars) - resk = wgk(31)*fc - resabs = dabs(resk) - do j=1,15 - jtw = j*2 - dabsc = hlgth*xgk(jtw) - fval1 = fx(centr-dabsc, fx_vars) - fval2 = fx(centr+dabsc, fx_vars) - fv1(jtw) = fval1 - fv2(jtw) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(jtw)*fsum - resabs = resabs+wgk(jtw)*(dabs(fval1)+dabs(fval2)) - end do - do j=1,15 - jtwm1 = j*2-1 - dabsc = hlgth*xgk(jtwm1) - fval1 = fx(centr-dabsc, fx_vars) - fval2 = fx(centr+dabsc, fx_vars) - fv1(jtwm1) = fval1 - fv2(jtwm1) = fval2 - fsum = fval1+fval2 - resk = resk+wgk(jtwm1)*fsum - resabs = resabs+wgk(jtwm1)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(31)*dabs(fc-reskh) - do j=1,30 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resabs = resabs*dhlgth - resasc = resasc*dhlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0.0_f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk61 - - !! - !!***begin prologue dqpsrt - !!***refer to dqage,dqagie,dqagpe,dqawse - !!***routines called (none) - !!***revision date 130319 (yymmdd) - !!***keywords sequential sorting - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose this routine maintains the descending ordering in the - !! list of the local error estimated resulting from the - !! interval subdivision process. at each call two error - !! estimates are inserted using the sequential search - !! method, top-down for the largest error estimate and - !! bottom-up for the smallest error estimate. - !!***description - !! - !! ordering routine - !! standard fortran subroutine - !! double precision version - !! - !! parameters (meaning at output) - !! limit - integer - !! maximum number of error estimates the list - !! can contain - !! - !! last - integer - !! number of error estimates currently in the list - !! - !! maxerr - integer - !! maxerr points to the nrmax-th largest error - !! estimate currently in the list - !! - !! ermax - double precision - !! nrmax-th largest error estimate - !! ermax = elist(maxerr) - !! - !! elist - double precision - !! vector of dimension last containing - !! the error estimates - !! - !! iord - integer - !! vector of dimension last, the first k elements - !! of which contain pointers to the error - !! estimates, such that - !! elist(iord(1)),..., elist(iord(k)) - !! form a decreasing sequence, with - !! k = last if last.le.(limit/2+2), and - !! k = limit+1-last otherwise - !! - !! nrmax - integer - !! maxerr = iord(nrmax) - !! - !!***end prologue dqpsrt - !! - subroutine dqpsrt(limit,last,maxerr,ermax,elist,iord,nrmax) - - ! Arguments - integer :: limit - integer :: last - integer :: maxerr - real(kind=f) :: ermax - real(kind=f) :: elist(last) - integer :: iord(last) - integer :: nrmax - - ! Local declarations - real(kind=f) :: errmax, errmin - integer :: i, ibeg, ido, isucc, j, jbnd, jupbn, k - - ! - ! check whether the list contains more than - ! two error estimates. - ! - !***first executable statement dqpsrt - if(last.gt.2) go to 10 - iord(1) = 1 - iord(2) = 2 - go to 90 - ! - ! this part of the routine is only executed if, due to a - ! difficult integrand, subdivision increased the error - ! estimate. in the normal case the insert procedure should - ! start after the nrmax-th largest error estimate. - ! - 10 errmax = elist(maxerr) - if(nrmax.eq.1) go to 30 - ido = nrmax-1 - do i = 1,ido - isucc = iord(nrmax-1) - ! ***jump out of do-loop - if(errmax.le.elist(isucc)) go to 30 - iord(nrmax) = isucc - nrmax = nrmax-1 - end do - ! - ! compute the number of elements in the list to be maintained - ! in descending order. this number depends on the number of - ! subdivisions still allowed. - ! - 30 jupbn = last - if(last.gt.(limit/2+2)) jupbn = limit+3-last - errmin = elist(last) - ! - ! insert errmax by traversing the list top-down, - ! starting comparison from the element elist(iord(nrmax+1)). - ! - jbnd = jupbn-1 - ibeg = nrmax+1 - if(ibeg.gt.jbnd) go to 50 - do i=ibeg,jbnd - isucc = iord(i) - ! ***jump out of do-loop - if(errmax.ge.elist(isucc)) go to 60 - iord(i-1) = isucc - end do - 50 iord(jbnd) = maxerr - iord(jupbn) = last - go to 90 - ! - ! insert errmin by traversing the list bottom-up. - ! - 60 iord(i-1) = maxerr - k = jbnd - do j=i,jbnd - isucc = iord(k) - ! ***jump out of do-loop - if(errmin.lt.elist(isucc)) go to 80 - iord(k+1) = isucc - k = k-1 - end do - iord(i) = last - go to 90 - 80 iord(k+1) = last - ! - ! set maxerr and ermax. - ! - 90 maxerr = iord(nrmax) - ermax = elist(maxerr) - return - end subroutine dqpsrt - - !! - !!***begin prologue dqk15i - !!***date written 800101 (yymmdd) - !!***revision date 130319 (yymmdd) - !!***category no. h2a3a2,h2a4a2 - !!***keywords 15-point transformed gauss-kronrod rules - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math. & progr. div. - k.u.leuven - !!***purpose the original (infinite integration range is mapped - !! onto the interval (0,1) and (a,b) is a part of (0,1). - !! it is the purpose to compute - !! i = integral of transformed integrand over (a,b), - !! j = integral of abs(transformed integrand) over (a,b). - !!***description - !! - !! integration rule - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! on entry - !! fx - double precision - !! fuction subprogram defining the integrand - !! function f(x). the actual name for f needs to be - !! declared e x t e r n a l in the calling program. - !! - !! fx_vars- structure containing variables need for integration - !! specific to fractal meanfield scattering code! - !! - !! boun - double precision - !! finite bound of original integration - !! range (set to zero if inf = +2) - !! - !! inf - integer - !! if inf = -1, the original interval is - !! (-infinity,bound), - !! if inf = +1, the original interval is - !! (bound,+infinity), - !! if inf = +2, the original interval is - !! (-infinity,+infinity) and - !! the integral is computed as the sum of two - !! integrals, one over (-infinity,0) and one over - !! (0,+infinity). - !! - !! a - double precision - !! lower limit for integration over subrange - !! of (0,1) - !! - !! b - double precision - !! upper limit for integration over subrange - !! of (0,1) - !! - !! on return - !! result - double precision - !! approximation to the integral i - !! result is computed by applying the 15-point - !! kronrod rule(resk) obtained by optimal addition - !! of abscissae to the 7-point gauss rule(resg). - !! - !! abserr - double precision - !! estimate of the modulus of the absolute error, - !! which should equal or exceed abs(i-result) - !! - !! resabs - double precision - !! approximation to the integral j - !! - !! resasc - double precision - !! approximation to the integral of - !! abs((transformed integrand)-i/(b-a)) over (a,b) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !!***references (none) - !!***routines called sd1mach - !!***end prologue dqk15i - subroutine dqk15i(fx,fx_vars,boun,inf,a,b,result,abserr,resabs,resasc, ier) - - ! Arguments - interface - function fx(centr, vars) - use carma_precision_mod, only : f - use adgaquad_types_mod - real(kind=f), intent(in) :: centr - type(adgaquad_vars_type), intent(inout) :: vars - real(kind=f) :: fx - end function fx - end interface - type(adgaquad_vars_type) :: fx_vars - real(kind=f) :: boun - integer :: inf - real(kind=f) :: a - real(kind=f) :: b - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: resabs - real(kind=f) :: resasc - integer :: ier - - ! Local declarations - real(kind=f) :: absc, absc1, absc2, centr, dabs, dinf - real(kind=f) :: dmax1, dmin1, epmach, fc, fsum, fval1, fval2, fv1(7) ,fv2(7), hlgth - real(kind=f) :: resg, resk, reskh, tabsc1, tabsc2, uflow, wg(8), wgk(8), xgk(8) - integer :: j - - ! - ! the abscissae and weights are supplied for the interval - ! (-1,1). because of symmetry only the positive abscissae and - ! their corresponding weights are given. - ! - ! xgk - abscissae of the 15-point kronrod rule - ! xgk(2), xgk(4), ... abscissae of the 7-point - ! gauss rule - ! xgk(1), xgk(3), ... abscissae which are optimally - ! added to the 7-point gauss rule - ! - ! wgk - weights of the 15-point kronrod rule - ! - ! wg - weights of the 7-point gauss rule, corresponding - ! to the abscissae xgk(2), xgk(4), ... - ! wg(1), wg(3), ... are set to zero. - ! - data wg(1) / 0.0_f / - data wg(2) / 0.129484966168869693270611432679082_f / - data wg(3) / 0.0_f / - data wg(4) / 0.279705391489276667901467771423780_f / - data wg(5) / 0.0_f / - data wg(6) / 0.381830050505118944950369775488975_f / - data wg(7) / 0.0_f / - data wg(8) / 0.417959183673469387755102040816327_f / - - data xgk(1) / 0.991455371120812639206854697526329_f / - data xgk(2) / 0.949107912342758524526189684047851_f / - data xgk(3) / 0.864864423359769072789712788640926_f / - data xgk(4) / 0.741531185599394439863864773280788_f / - data xgk(5) / 0.586087235467691130294144838258730_f / - data xgk(6) / 0.405845151377397166906606412076961_f / - data xgk(7) / 0.207784955007898467600689403773245_f / - data xgk(8) / 0.000000000000000000000000000000000_f / - - data wgk(1) / 0.022935322010529224963732008058970_f / - data wgk(2) / 0.063092092629978553290700663189204_f / - data wgk(3) / 0.104790010322250183839876322541518_f / - data wgk(4) / 0.140653259715525918745189590510238_f / - data wgk(5) / 0.169004726639267902826583426598550_f / - data wgk(6) / 0.190350578064785409913256402421014_f / - data wgk(7) / 0.204432940075298892414161999234649_f / - data wgk(8) / 0.209482141084727828012999174891714_f / - ! - ! - ! list of major variables - ! ----------------------- - ! - ! centr - mid point of the interval - ! hlgth - half-length of the interval - ! absc* - abscissa - ! tabsc* - transformed abscissa - ! fval* - function value - ! resg - result of the 7-point gauss formula - ! resk - result of the 15-point kronrod formula - ! reskh - approximation to the mean value of the transformed - ! integrand over (a,b), i.e. to i/(b-a) - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! uflow is the smallest positive magnitude. - ! - !*** first executable statement dqk15i - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(1,uflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !uflow = d1mach(1) - dinf = min0(1,inf) - - centr = 0.5_f*(a+b) - hlgth = 0.5_f*(b-a) - tabsc1 = boun+dinf*(0.1e1_f-centr)/centr - fval1 = fx(tabsc1, fx_vars) - if(inf.eq.2) fval1 = fval1+fx(-tabsc1, fx_vars) - fc = (fval1/centr)/centr - ! - ! compute the 15-point kronrod approximation to - ! the integral, and estimate the error. - ! - resg = wg(8)*fc - resk = wgk(8)*fc - resabs = dabs(resk) - do j=1,7 - absc = hlgth*xgk(j) - absc1 = centr-absc - absc2 = centr+absc - tabsc1 = boun+dinf*(0.1d+01-absc1)/absc1 - tabsc2 = boun+dinf*(0.1d+01-absc2)/absc2 - fval1 = fx(tabsc1, fx_vars) - fval2 = fx(tabsc2, fx_vars) - if(inf.eq.2) fval1 = fval1+fx(-tabsc1, fx_vars) - if(inf.eq.2) fval2 = fval2+fx(-tabsc2, fx_vars) - fval1 = (fval1/absc1)/absc1 - fval2 = (fval2/absc2)/absc2 - fv1(j) = fval1 - fv2(j) = fval2 - fsum = fval1+fval2 - resg = resg+wg(j)*fsum - resk = resk+wgk(j)*fsum - resabs = resabs+wgk(j)*(dabs(fval1)+dabs(fval2)) - end do - reskh = resk*0.5_f - resasc = wgk(8)*dabs(fc-reskh) - do j=1,7 - resasc = resasc+wgk(j)*(dabs(fv1(j)-reskh)+dabs(fv2(j)-reskh)) - end do - result = resk*hlgth - resasc = resasc*hlgth - resabs = resabs*hlgth - abserr = dabs((resk-resg)*hlgth) - if(resasc.ne.0.0_f.and.abserr.ne.0._f) abserr = resasc*dmin1(0.1e1_f,(0.2e3_f*abserr/resasc)**1.5_f) - if(resabs.gt.uflow/(0.5e2_f*epmach)) abserr = dmax1((epmach*0.5e2_f)*resabs,abserr) -999 return - end subroutine dqk15i - - !! - !!***begin prologue dqelg - !!***refer to dqagie,dqagoe,dqagpe,dqagse - !!***routines called sd1mach - !!***revision date 130319 (yymmdd) - !!***keywords epsilon algorithm, convergence acceleration, - !! extrapolation - !!***author piessens,robert,appl. math. & progr. div. - k.u.leuven - !! de doncker,elise,appl. math & progr. div. - k.u.leuven - !!***purpose the routine determines the limit of a given sequence of - !! approximations, by means of the epsilon algorithm of - !! p.wynn. an estimate of the absolute error is also given. - !! the condensed epsilon table is computed. only those - !! elements needed for the computation of the next diagonal - !! are preserved. - !!***description - !! - !! epsilon algorithm - !! standard fortran subroutine - !! double precision version - !! - !! parameters - !! n - integer - !! epstab(n) contains the new element in the - !! first column of the epsilon table. - !! - !! epstab - double precision - !! vector of dimension 52 containing the elements - !! of the two lower diagonals of the triangular - !! epsilon table. the elements are numbered - !! starting at the right-hand corner of the - !! triangle. - !! - !! result - double precision - !! resulting approximation to the integral - !! - !! abserr - double precision - !! estimate of the absolute error computed from - !! result and the 3 previous results - !! - !! res3la - double precision - !! vector of dimension 3 containing the last 3 - !! results - !! - !! nres - integer - !! number of calls to the routine - !! (should be zero at first call) - !! - !! ier - integer - !! ier = 0 normal and reliable termination of the - !! routine. it is assumed that the requested - !! accuracy has been achieved. - !! ier.gt.0 abnormal termination of the routine. the - !! estimates for result and error are less - !! reliable. it is assumed that the requested - !! accuracy has not been achieved. - !! - !!***end prologue dqelg - !! - subroutine dqelg(n,epstab,result,abserr,res3la,nres,ier) - - ! Arguments - integer :: n - real(kind=f) :: epstab(52) - real(kind=f) :: result - real(kind=f) :: abserr - real(kind=f) :: res3la(3) - integer :: nres - integer :: ier - - ! Local declarations - real(kind=f) :: dabs, delta1, delta2, delta3, dmax1 - real(kind=f) :: epmach, epsinf, error, err1, err2, err3, e0, e1, e1abs, e2, e3 - real(kind=f) :: oflow, res, ss, tol1, tol2, tol3 - integer :: i, ib, ib2, ie, indx, k1, k2, k3, limexp, newelm, num - ! - ! list of major variables - ! ----------------------- - ! - ! e0 - the 4 elements on which the computation of a new - ! e1 element in the epsilon table is based - ! e2 - ! e3 e0 - ! e3 e1 new - ! e2 - ! newelm - number of elements to be computed in the new - ! diagonal - ! error - error = abs(e1-e0)+abs(e2-e1)+abs(new-e2) - ! result - the element in the new diagonal with least value - ! of error - ! - ! machine dependent constants - ! --------------------------- - ! - ! epmach is the largest relative spacing. - ! oflow is the largest positive magnitude. - ! limexp is the maximum number of elements the epsilon - ! table can contain. if this number is reached, the upper - ! diagonal of the epsilon table is deleted. - ! - !***first executable statement dqelg - call sd1mach(4,epmach,ier) - if(ier.eq.9) return - call sd1mach(2,oflow,ier) - if(ier.eq.9) return - - !epmach = d1mach(4) - !oflow = d1mach(2) - nres = nres+1 - abserr = oflow - result = epstab(n) - if(n.lt.3) go to 100 - limexp = 50 - epstab(n+2) = epstab(n) - newelm = (n-1)/2 - epstab(n) = oflow - num = n - k1 = n - do 40 i = 1,newelm - k2 = k1-1 - k3 = k1-2 - res = epstab(k1+2) - e0 = epstab(k3) - e1 = epstab(k2) - e2 = res - e1abs = dabs(e1) - delta2 = e2-e1 - err2 = dabs(delta2) - tol2 = dmax1(dabs(e2),e1abs)*epmach - delta3 = e1-e0 - err3 = dabs(delta3) - tol3 = dmax1(e1abs,dabs(e0))*epmach - if(err2.gt.tol2.or.err3.gt.tol3) go to 10 - ! - ! if e0, e1 and e2 are equal to within machine - ! accuracy, convergence is assumed. - ! result = e2 - ! abserr = abs(e1-e0)+abs(e2-e1) - ! - result = res - abserr = err2+err3 - ! ***jump out of do-loop - go to 100 - 10 e3 = epstab(k1) - epstab(k1) = e1 - delta1 = e1-e3 - err1 = dabs(delta1) - tol1 = dmax1(e1abs,dabs(e3))*epmach - ! - ! if two elements are very close to each other, omit - ! a part of the table by adjusting the value of n - ! - if(err1.le.tol1.or.err2.le.tol2.or.err3.le.tol3) go to 20 - ss = 0.1e1_f/delta1+0.1e1_f/delta2-0.1e1_f/delta3 - epsinf = dabs(ss*e1) - ! - ! test to detect irregular behaviour in the table, and - ! eventually omit a part of the table adjusting the value - ! of n. - ! - if(epsinf.gt.0.1e-3_f) go to 30 - 20 n = i+i-1 - ! ***jump out of do-loop - go to 50 - ! - ! compute a new element and eventually adjust - ! the value of result. - ! - 30 res = e1+0.1e1_f/ss - epstab(k1) = res - k1 = k1-2 - error = err2+dabs(res-e2)+err3 - if(error.gt.abserr) go to 40 - abserr = error - result = res - 40 continue - ! - ! shift the table. - ! - 50 if(n.eq.limexp) n = 2*(limexp/2)-1 - ib = 1 - if((num/2)*2.eq.num) ib = 2 - ie = newelm+1 - do 60 i=1,ie - ib2 = ib+2 - epstab(ib) = epstab(ib2) - ib = ib2 - 60 continue - if(num.eq.n) go to 80 - indx = num-n+1 - do 70 i = 1,n - epstab(i)= epstab(indx) - indx = indx+1 - 70 continue - 80 if(nres.ge.4) go to 90 - res3la(nres) = result - abserr = oflow - go to 100 - ! - ! compute error estimate - ! - 90 abserr = dabs(result-res3la(3))+dabs(result-res3la(2))+dabs(result-res3la(1)) - res3la(1) = res3la(2) - res3la(2) = res3la(3) - res3la(3) = result -100 abserr = dmax1(abserr,0.5e1_f*epmach*dabs(result)) -999 return - end subroutine dqelg - - !! - !! ********************************************************* - !! taken from BLAS library - !! (http://netlib.bell-labs.com/netlib/blas) - !! ********************************************************* - SUBROUTINE SD1MACH(I,D1MACH_OUT,IER) - INTEGER, INTENT(in) :: I - REAL(kind=f), INTENT(out) :: D1MACH_OUT - INTEGER, INTENT(out) :: IER - ! - ! DOUBLE-PRECISION MACHINE CONSTANTS - ! D1MACH( 1) = B**(EMIN-1), THE SMALLEST POSITIVE MAGNITUDE. - ! D1MACH( 2) = B**EMAX*(1 - B**(-T)), THE LARGEST MAGNITUDE. - ! D1MACH( 3) = B**(-T), THE SMALLEST RELATIVE SPACING. - ! D1MACH( 4) = B**(1-T), THE LARGEST RELATIVE SPACING. - ! D1MACH( 5) = LOG10(B) - ! - INTEGER :: SMALL(2) - INTEGER :: LARGE(2) - INTEGER :: RIGHT(2) - INTEGER :: DIVER(2) - INTEGER :: LOG10(2) - INTEGER :: SC, CRAY1(38), J - SAVE SMALL, LARGE, RIGHT, DIVER, LOG10, SC - REAL(kind=f) :: DMACH(5) - EQUIVALENCE (DMACH(1),SMALL(1)) - EQUIVALENCE (DMACH(2),LARGE(1)) - EQUIVALENCE (DMACH(3),RIGHT(1)) - EQUIVALENCE (DMACH(4),DIVER(1)) - EQUIVALENCE (DMACH(5),LOG10(1)) - ! THIS VERSION ADAPTS AUTOMATICALLY TO MOST CURRENT MACHINES. - ! R1MACH CAN HANDLE AUTO-DOUBLE COMPILING, BUT THIS VERSION OF - ! D1MACH DOES NOT, BECAUSE WE DO NOT HAVE QUAD CONSTANTS FOR - ! MANY MACHINES YET. - ! TO COMPILE ON OLDER MACHINES, ADD A C IN COLUMN 1 - ! ON THE NEXT LINE - DATA SC/0/ - ! AND REMOVE THE C FROM COLUMN 1 IN ONE OF THE SECTIONS BELOW. - ! CONSTANTS FOR EVEN OLDER MACHINES CAN BE OBTAINED BY - ! mail netlib@research.bell-labs.com - ! send old1mach from blas - ! PLEASE SEND CORRECTIONS TO dmg OR ehg@bell-labs.com. - ! - ! MACHINE CONSTANTS FOR THE HONEYWELL DPS 8/70 SERIES. - ! DATA SMALL(1),SMALL(2) / O402400000000, O000000000000 / - ! DATA LARGE(1),LARGE(2) / O376777777777, O777777777777 / - ! DATA RIGHT(1),RIGHT(2) / O604400000000, O000000000000 / - ! DATA DIVER(1),DIVER(2) / O606400000000, O000000000000 / - ! DATA LOG10(1),LOG10(2) / O776464202324, O117571775714 /, SC/987/ - ! - ! MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING - ! 32-BIT INTEGERS. - ! DATA SMALL(1),SMALL(2) / 8388608, 0 / - ! DATA LARGE(1),LARGE(2) / 2147483647, -1 / - ! DATA RIGHT(1),RIGHT(2) / 612368384, 0 / - ! DATA DIVER(1),DIVER(2) / 620756992, 0 / - ! DATA LOG10(1),LOG10(2) / 1067065498, -2063872008 /, SC/987/ - ! - ! MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. - ! DATA SMALL(1),SMALL(2) / O000040000000, O000000000000 / - ! DATA LARGE(1),LARGE(2) / O377777777777, O777777777777 / - ! DATA RIGHT(1),RIGHT(2) / O170540000000, O000000000000 / - ! DATA DIVER(1),DIVER(2) / O170640000000, O000000000000 / - ! DATA LOG10(1),LOG10(2) / O177746420232, O411757177572 /, SC/987/ - ! - ! ON FIRST CALL, IF NO DATA UNCOMMENTED, TEST MACHINE TYPES. - IER = 0 - IF (SC .NE. 987) THEN - DMACH(1) = 1.e13_f - IF ( SMALL(1) .EQ. 1117925532 .AND. SMALL(2) .EQ. -448790528) THEN - ! *** IEEE BIG ENDIAN *** - SMALL(1) = 1048576 - SMALL(2) = 0 - LARGE(1) = 2146435071 - LARGE(2) = -1 - RIGHT(1) = 1017118720 - RIGHT(2) = 0 - DIVER(1) = 1018167296 - DIVER(2) = 0 - LOG10(1) = 1070810131 - LOG10(2) = 1352628735 - ELSE IF ( SMALL(2) .EQ. 1117925532 .AND. SMALL(1) .EQ. -448790528) THEN - ! *** IEEE LITTLE ENDIAN *** - SMALL(2) = 1048576 - SMALL(1) = 0 - LARGE(2) = 2146435071 - LARGE(1) = -1 - RIGHT(2) = 1017118720 - RIGHT(1) = 0 - DIVER(2) = 1018167296 - DIVER(1) = 0 - LOG10(2) = 1070810131 - LOG10(1) = 1352628735 - ELSE IF ( SMALL(1) .EQ. -2065213935 .AND. SMALL(2) .EQ. 10752) THEN - ! *** VAX WITH D_FLOATING *** - SMALL(1) = 128 - SMALL(2) = 0 - LARGE(1) = -32769 - LARGE(2) = -1 - RIGHT(1) = 9344 - RIGHT(2) = 0 - DIVER(1) = 9472 - DIVER(2) = 0 - LOG10(1) = 546979738 - LOG10(2) = -805796613 - ELSE IF ( SMALL(1) .EQ. 1267827943 .AND. SMALL(2) .EQ. 704643072) THEN - ! *** IBM MAINFRAME *** - SMALL(1) = 1048576 - SMALL(2) = 0 - LARGE(1) = 2147483647 - LARGE(2) = -1 - RIGHT(1) = 856686592 - RIGHT(2) = 0 - DIVER(1) = 873463808 - DIVER(2) = 0 - LOG10(1) = 1091781651 - LOG10(2) = 1352628735 - ELSE IF ( SMALL(1) .EQ. 1120022684 .AND. SMALL(2) .EQ. -448790528) THEN - ! *** CONVEX C-1 *** - SMALL(1) = 1048576 - SMALL(2) = 0 - LARGE(1) = 2147483647 - LARGE(2) = -1 - RIGHT(1) = 1019215872 - RIGHT(2) = 0 - DIVER(1) = 1020264448 - DIVER(2) = 0 - LOG10(1) = 1072907283 - LOG10(2) = 1352628735 - ELSE IF ( SMALL(1) .EQ. 815547074 .AND. SMALL(2) .EQ. 58688) THEN - ! *** VAX G-FLOATING *** - SMALL(1) = 16 - SMALL(2) = 0 - LARGE(1) = -32769 - LARGE(2) = -1 - RIGHT(1) = 15552 - RIGHT(2) = 0 - DIVER(1) = 15568 - DIVER(2) = 0 - LOG10(1) = 1142112243 - LOG10(2) = 2046775455 - ELSE - DMACH(2) = 1.e27_f + 1 - DMACH(3) = 1.e27_f - LARGE(2) = LARGE(2) - RIGHT(2) - IF (LARGE(2) .EQ. 64 .AND. SMALL(2) .EQ. 0) THEN - CRAY1(1) = 67291416 - DO J = 1, 20 - CRAY1(J+1) = CRAY1(J) + CRAY1(J) - END DO - CRAY1(22) = CRAY1(21) + 321322 - DO J = 22, 37 - CRAY1(J+1) = CRAY1(J) + CRAY1(J) - END DO - IF (CRAY1(38) .EQ. SMALL(1)) THEN - ! *** CRAY *** - CALL I1MCRY(SMALL(1), J, 8285, 8388608, 0) - SMALL(2) = 0 - CALL I1MCRY(LARGE(1), J, 24574, 16777215, 16777215) - CALL I1MCRY(LARGE(2), J, 0, 16777215, 16777214) - CALL I1MCRY(RIGHT(1), J, 16291, 8388608, 0) - RIGHT(2) = 0 - CALL I1MCRY(DIVER(1), J, 16292, 8388608, 0) - DIVER(2) = 0 - CALL I1MCRY(LOG10(1), J, 16383, 10100890, 8715215) - CALL I1MCRY(LOG10(2), J, 0, 16226447, 9001388) - ELSE - IER=9 - END IF - ELSE - IER=9 - END IF - END IF - SC = 987 - END IF - ! SANITY CHECK - IF (DMACH(4) .GE. 1.0D0) IER=9 - IF (I .LT. 1 .OR. I .GT. 5) THEN - IER=9 - END IF - D1MACH_OUT = DMACH(I) - RETURN - END SUBROUTINE SD1MACH - - SUBROUTINE I1MCRY(A, A1, B, C, D) - !*** SPECIAL COMPUTATION FOR OLD CRAY MACHINES **** - INTEGER A, A1, B, C, D - A1 = 16777216*B + C - A = 16777216*A1 + D - END SUBROUTINE I1MCRY - - - -end module adgaquad_mod diff --git a/CARMAchem_GridComp/CARMA/source/base/adgaquad_types_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/adgaquad_types_mod.F90 deleted file mode 100644 index a4f9dd7e..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/adgaquad_types_mod.F90 +++ /dev/null @@ -1,39 +0,0 @@ -module adgaquad_types_mod - use carma_precision_mod - - integer, public, parameter :: nf=50 !! Number of factorials in fact table. - - - !! The the functions that are being integrated may need some extra - !! data. In the F77, these were stored in common blocks. To make the - !! code thread safe, we need to move them into passed parameters. For - !! convenience, we put all of these variables into one structure and - !! pass the entire structure to all functions that could be integrated - !! by these routines. - - type, public :: adgaquad_vars_type - - ! alpha packing coefficient - ! nb number of monomers - ! a monomer size - ! df fractal dimension - ! k absolute value of wavevector = 2*pi/wavelength - - real(kind=f) :: fact(0:nf) - integer :: u1 - integer :: u2 - integer :: u3 - integer :: u4 - integer :: u5 - integer :: u6 - integer :: pbes - real(kind=f) :: kbes - real(kind=f) :: alpha - real(kind=f) :: nb - real(kind=f) :: a - real(kind=f) :: df - real(kind=f) :: k - real(kind=f) :: zed - real(kind=f) :: coeff - end type adgaquad_vars_type -end module \ No newline at end of file diff --git a/CARMAchem_GridComp/CARMA/source/base/bhmie.F90 b/CARMAchem_GridComp/CARMA/source/base/bhmie.F90 deleted file mode 100644 index b2cf8de6..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/bhmie.F90 +++ /dev/null @@ -1,182 +0,0 @@ -!! See Bohren and Huffman, "Absorption and Scattering of Light by -!! Small Particles", 1983, pg 480 (in Appendix A). -!! -!! Subroutine bhmie calculates amplitude scattering matrix -!! elements and efficiencies for extinction, total scattering -!! and backscattering for a given size parameter and -!! relative refractive index. -!! -!! From the main program: -!! refrel = cmplx(refre,refim) / refmed -!! -!! @author Chuck Bardeen -!! @version 2011 -subroutine bhmie(carma, x, refrel, nang, s1, s2, Qext, Qsca, Qback, gfac, rc) - - ! types - use carma_precision_mod - use carma_enums_mod, only : RC_ERROR - use carma_types_mod, only : carma_type - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: x !! radius / wavelength - complex(kind=f), intent(in) :: refrel !! refractive index particle / reference refractive index - integer, intent(in) :: nang !! number of angles in s1 and s2 - complex(kind=f), intent(out) :: s1(2*nang-1) !! CORE RADIUS - complex(kind=f), intent(out) :: s2(2*nang-1) !! REAL PART OF THE CORE INDEX OF REFRACTION - real(kind=f), intent(out) :: Qext !! EFFICIENCY FACTOR FOR EXTINCTION - real(kind=f), intent(out) :: Qsca !! EFFICIENCY FACTOR FOR SCATTERING - real(kind=f), intent(out) :: Qback !! BACK SCATTER CROSS SECTION. - real(kind=f), intent(out) :: gfac !! asymmetry factor - integer, intent(inout) :: rc !! return code, negative indicates failure - - - real(kind=f) :: amu(100), theta(100), pi(100), tau(100), pi0(100), pi1(100) - complex(kind=f) :: y, xi, xi0, xi1, an, bn - complex(kind=f), allocatable :: d(:) - complex(kind=f) :: ccan, ccbn, anmi1, bnmi1 - real(kind=f) :: psi0, psi1, psi, dn, dx, chi0, chi1, apsi0, apsi1, g1, g2 - real(kind=f) :: dang, fn, ffn, apsi, chi, p, t, xstop, ymod - integer :: j, jj, n, nn, rn, nmx, nstop - - - ! Mie x and y values. - dx = x - y = x * refrel - - ! Series terminated after nstop terms - xstop = x + 4._f * x**0.3333_f + 2.0_f - nstop = xstop - - ! Will loop over nang angles. - ymod = int(abs(y)) - nmx = max(xstop, ymod) + 15 - dang = 1.570796327_f / real(nang - 1, kind=f) - allocate(d(nmx)) - - do j = 1, nang - theta(j) = (real(j, kind=f) - 1._f) * dang - amu(j) = cos(theta(j)) - end do - - ! Logarithmic derivative d(j) calculated by downword - ! recurrence beginning with initial value 0.0 + i*0.0 - ! at j = nmx - d(nmx) = cmplx(0.0_f, 0.0_f, kind=f) - nn = nmx-1 -! write(*,*) 'nmx=',nmx,' d(nmx)=',d(nmx), ' nn=',nn - - do n = 1, nn - rn = nmx - n + 1 - d(nmx-n) = (rn/y) - (1._f / (d(nmx - n + 1) + rn / y)) - -! write(*,*) 'n=',n,' rn=',rn,' y=', y,' d(nmx-n)=',d(nmx-n) -! write(*,*) 'rn/y=',rn/y, 'd(nmx-n+1)=',d(nmx-n+1),'(d(nmx-n+1)+rn/y)', & -! (d(nmx-n+1)+rn/y),'1./(d(nmx-n+1)+rn/y)',1./(d(nmx-n+1)+rn/y) - end do - - pi0(1:nang) = 0.0_f - pi1(1:nang) = 1.0_f - - nn = 2 * nang-1 - s1(1:nn) = cmplx(0.0_f, 0.0_f, kind=f) - s2(1:nn) = cmplx(0.0_f, 0.0_f, kind=f) - - ! Riccati-Bessel functions with real argument x - ! calculated by upward recurrence - psi0 = cos(dx) - psi1 = sin(dx) - chi0 = -sin(x) - chi1 = cos(x) - apsi0 = psi0 - apsi1 = psi1 - xi0 = cmplx(apsi0,-chi0, kind=f) - xi1 = cmplx(apsi1,-chi1, kind=f) - Qsca = 0.0_f - g1 = 0.0_f - g2 = 0.0_f - n = 1 - - ! Loop over the terms n in the Mie series - do while (.true.) - dn = n - rn = n - fn = (2._f * rn + 1._f) / (rn * (rn + 1._f)) - ffn = (rn - 1._f) * (rn + 1._f) / rn - psi = (2._f * dn - 1._f) * psi1 / dx - psi0 - apsi = psi - chi = (2._f * rn - 1._f) * chi1 / x - chi0 - xi = cmplx(apsi, -chi, kind=f) -! write(*,*) 'n=', n -! write(*,*) 'd(n)=',d(n),' refrel=',refrel,' rn=',rn, ' x=',x,'apsi=',apsi,' apsi1=',apsi1 - - an = (d(n) / refrel + rn / x) * apsi - apsi1 -! write(*,*) 'an=',an,' xi=',xi,' xi1=',xi1 - - an = an / ((d(n) / refrel + rn / x) * xi - xi1) - bn = (refrel * d(n) + rn / x) * apsi - apsi1 - bn = bn / ((refrel * d(n) + rn / x) * xi - xi1) - ccan = conjg(an) - ccbn = conjg(bn) - g2 = g2 + fn * real(an * ccbn) - - if (n-1 > 0) then - g1 = g1 + ffn * real(anmi1 * ccan + bnmi1 * ccbn) - end if - Qsca = Qsca + (2._f * rn + 1._f) * (abs(an) * abs(an) + abs(bn) * abs(bn)) - - do j = 1, nang - jj = 2 * nang-j - pi(j) = pi1(j) - tau(j) = rn * amu(j) * pi(j) - (rn + 1._f) * pi0(j) - p = (-1._f)**(n-1) -! write(*,*) 'fn=',fn,' an=',an,' bn=',bn,' pi(j)=',pi(j),' tau(j)=',tau(j) - - s1(j) = s1(j) + fn * (an * pi(j) + bn * tau(j)) - t = (-1._f)**n - s2(j) = s2(j) + fn * (an * tau(j) + bn * pi(j)) - - if (j.ne.jj) then - s1(jj)=s1(jj) + fn*(an*pi(j)*p+bn*tau(j)*t) - s2(jj)=s2(jj) + fn*(an*tau(j)*t+bn*pi(j)*p) -! write(*,*) 'j=',j,' s1(j)=',s1(j),' s2(j)=',s2(j) - end if - end do - - psi0 = psi1 - psi1 = psi - apsi1 = psi1 - chi0 = chi1 - chi1 = chi - xi1 = cmplx(apsi1, -chi1, kind=f) - n = n+1 - rn = n - - do j = 1, nang - pi1(j) = ((2._f * rn - 1._f) / (rn - 1._f)) * amu(j) * pi(j) - pi1(j) = pi1(j) -rn * pi0(j) / (rn - 1._f) - pi0(j) = pi(j) - end do - - anmi1 = an - bnmi1 = bn - - if (n - 1 - nstop >= 0) exit - - end do - - Qsca = (2._f / (x * x)) * Qsca - gfac = (4._f / (x * x * Qsca)) * (g1+g2) - Qext = (4._f / (x * x)) * real(s1(1)) - Qback = (4._f / (x * x)) * abs(s1(2 * nang - 1)) * abs(s1(2 * nang - 1)) - -! write(*,*) 'x',x,' s1(1)=',s1(1),' real(s1(1))=',real(s1(1)) -! write(*,*) 'Qsca=',Qsca,' gfac=',gfac,' Qext=',Qext,'Qback=',Qback - - deallocate(d) - - return -end subroutine bhmie diff --git a/CARMAchem_GridComp/CARMA/source/base/calcrs.F90 b/CARMAchem_GridComp/CARMA/source/base/calcrs.F90 deleted file mode 100644 index ae75276a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/calcrs.F90 +++ /dev/null @@ -1,111 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - - -!!----------------------------------------------------------------------- -!! -!! Purpose: Calculating the surface resistance, using the PBL parameter. -!! -!! Method: Zhang(2001), Atmospheric Environment -!! -!! -!! @author Tianyi Fan -!! @version Nov-2010 -!! - -subroutine calcrs(carma, cstate, ustar, tmp, radi, cc, vfall, rs, landidx, rc) - use carma_precision_mod - use carmastate_mod - use carma_enums_mod - use carma_types_mod - use carma_mod - use carma_constants_mod, only: BK, PI, GRAV -!----------------------------------------------------------------------- - implicit none -!----------------------------------------------------------------------- -! -! Arguments: -! - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(in) :: cstate !! the carma state object - real(kind=f), intent(in) :: ustar !! friction velocity [cm/s] - real(kind=f), intent(in) :: tmp !! temperature [K] - real(kind=f), intent(in) :: radi !! radius of the constitutent [cm] - real(kind=f), intent(in) :: cc !! slip correction factor - real(kind=f), intent(in) :: vfall !! gravitational settling velocity, [cm/s] - real(kind=f), intent(out) :: rs !! surface resistance [s/cm] - integer, intent(in) :: landidx !! landscape index, 1=land, 2=ocean, 3=sea ice - integer, intent(inout) :: rc !! return code, negative indicates failure - - - -! Local variables - real(kind=f) :: ebrn ! Brownian diffusion collection efficiency - real(kind=f) :: eimp ! Impaction collection efficiency - real(kind=f) :: eint ! Interception collection efficiency - real(kind=f) :: db ! Brownian diffusivity - real(kind=f) :: sc ! Schmidt number - real(kind=f) :: st ! Stokes number - real(kind=f) :: rhoadry ! dry air density [g/cm3] - real(kind=f) :: eta ! kinematic viscosity of air [cm2/s] - real(kind=f), parameter :: xkar = 0.4_f ! Von Karman's constant - real(kind=f), parameter :: eps0 = 3._f ! empirical constant for rs, 3.0 in [Zhang, 2001], 1.0 in [Seinfeld and Pandis] - - ! exponent in the eb dependence on sc, 2/3 in [Seinfeld and Pandis, 1998], 1/2 in [Lewis and Schwartz, 2004] - real(kind=f) :: lam - - integer :: ibot - - if (igridv .eq. I_CART) then - ibot = 1 - else - ibot = NZ - end if - - ! Unit conversion - rhoadry = rhoa(ibot) / zmet(ibot) / xmet(ibot) / ymet(ibot) ! [g/cm3] - eta = rmu(ibot) / rhoadry ! rmu, aerodynamic viscosity of air [g/cm/s] - - if (landidx .eq. 1) then - lam = 2._f / 3._f - else - lam = 1._f / 2._f - end if - - ! Surface Resistance = Brownian + Impaction + Interception - - ! ** Brownian diffusion - db = BK * tmp * cc / (6._f * PI * rmu(ibot) * radi) ! [cm2/s] - - sc = eta / db ! [-] - ebrn = sc**(-lam) - - ! ** Impaction - st = vfall * ustar**2 / (GRAV * eta) ! [-] - - ! [Slinn, 1982] - ! eimp = 10. ** (-3._f/st) - - ! [Peters and Eiden, 1992] - eimp = (st / (0.8_f + st))**2 -! eimp = max(eimp, 1.e-10_f) - - ! ** Interception - ! - ! NOTE: Interception is not currently considered for ocean and ice. - if (landidx .eq. 1) then -! eint = 0.3_f * (0.01_f * radi * 1.e-2_f / (radi * 1.e-2_f + 1.e-5_f) + 0.99_f *radi*1.e-2_f / (radi*1.e-2_f + 8.e-4_f)) - eint = 0.3_f * (0.01_f * radi / (radi + 1.e-3_f) + 0.99_f * radi / (radi + 8.e-2_f)) - else - eint = 0._f - end if - - if (ustar > 0._f) then - rs = 1._f / (eps0 * ustar * (ebrn + eimp + eint )) ! [s/cm] - else - rs = 0._f - end if - - return -end subroutine calcrs diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_constants_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carma_constants_mod.F90 deleted file mode 100644 index 88258201..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_constants_mod.F90 +++ /dev/null @@ -1,134 +0,0 @@ -module carma_constants_mod - - use carma_precision_mod - - implicit none - - !-- - ! Physical constants - - ! Meter-Kilogram-Second (MKS) convention for units - ! This convention is different from CARMA's original - ! Centimeter-Gram-Second (CGS) convention. Be wary of - ! this conversion to the new convention. - - ! Use the _f for all literal constants, e.g. 1.2e_f. - ! If you omit the _f in the initialization, a compiler may cast this - ! number into single precision and then store it as _f precision. - - !! Define triple-point temperature (K) - real(kind=f), parameter :: T0 = 273.16_f - - ! Define constants for circles and trig - real(kind=f), parameter :: PI = 3.14159265358979_f - real(kind=f), parameter :: DEG2RAD = PI / 180._f - real(kind=f), parameter :: RAD2DEG = 180._f / PI - - !! Acceleration of gravity near Earth surface [ cm/s^2 ] - real(kind=f), parameter :: GRAV = 980.6_f - - !! Define planet equatorial radius [ cm ] - real(kind=f), parameter :: REARTH = 6.37e+8_f - - !! Define avogadro's number [ # particles / mole ] - real(kind=f), parameter :: AVG = 6.02252e+23_f - - !! Define Boltzmann's constant [ erg / deg_K ] - real(kind=f), parameter :: BK = 1.38054e-16_f - - !! Define Loschmidt's number [ mole / cm^3, @ STP ] - real(kind=f), parameter :: ALOS = 2.68719e+19_f - - !! Define molecular weight of dry air [ g / mole ] - real(kind=f), parameter :: WTMOL_AIR = 28.966_f - - !! Define molecular weight of water vapor [ g / mole ] - real(kind=f), parameter :: WTMOL_H2O = 18.016_f - - !! Define molecular weight of sulphuric acid [ g / mole ] - real(kind=f), parameter :: WTMOL_H2SO4 = 98.078479_f - - !! Define molecular weight of sulfur dioxide [ g / mole ] - real(kind=f), parameter :: WTMOL_SO2 = 64.066_f - - !! Define molecular weight of nitric acid [ g / mole ] - real(kind=f), parameter :: WTMOL_HNO3 = 62.996_f - - !! Define reference pressure, e.g. for potential temp calcs [ dyne / cm^2 ] - real(kind=f), parameter :: PREF = 1000.e+3_f - - !! Define conversion factor for mb to cgs [ dyne / cm^2 ] units - real(kind=f), parameter :: RMB2CGS = 1000.e+0_f - - !! Define conversion factor for Pa to cgs [ dyne / cm^2 ] units - real(kind=f), parameter :: RPA2CGS = 10.e+0_f - - !! Define conversion factor for m to cgs [ cm ] units - real(kind=f), parameter :: RM2CGS = 100.0_f - - !! Define universal gas constant [ erg / deg_K / mole ] - real(kind=f), parameter :: RGAS = 8.31430e+07_f - - !! Define gas constant for dry air [ erg / deg_K / mole ] - real(kind=f), parameter :: R_AIR = RGAS / WTMOL_AIR - - !! Define number of seconds per the planet's day [ s / d ] - real(kind=f), parameter :: SCDAY = 86400._f - - !! Define specific heat at constant pres of dry air [ cm^2 / s^2 / deg_K ] - real(kind=f), parameter :: CP = 1.004e7_f - - !! Define ratio of gas constant for dry air and specific heat - real(kind=f), parameter :: RKAPPA = R_AIR / CP - - !! Define mass density of liquid water [ g / cm^3 ] - real(kind=f), parameter :: RHO_W = 1._f - - !! Define mass density of water ice [ g / cm^3 ] - real(kind=f), parameter :: RHO_I = 0.93_f - - !! Latent heat of evaporation for gas [cm^2/s^2] - real(kind=f), parameter :: RLHE_CNST = 2.501e10_f - - !! Latent heat of ice melting for gas [cm^2/s^2] - real(kind=f), parameter :: RLHM_CNST = 3.337e9_f - - !! The dimension of THETD, ELTRMX, CSTHT, PI, TAU, SI2THT. - !! IT must correspond exactly to the second dimension of ELTRMX. - integer, parameter :: IT = 1 - - !! String length of names - integer, parameter :: CARMA_NAME_LEN = 255 - - !! String length of short names - integer, parameter :: CARMA_SHORT_NAME_LEN = 6 - - !! Fill value indicating no value is being returned - integer, parameter :: CAM_FILL = -999 - - - !! Define small particle number concentration - !! [ # / x_units / y_units / z_units ] -! real(kind=f), parameter :: SMALL_PC = 1e-50_f -! PRC: Try this instead - real(kind=f), parameter :: SMALL_PC = 1e-30_f -! real(kind=f), parameter :: SMALL_PC = tiny( ONE ) - - !! Define particle number concentration [ # / ? ] - !! used to decide whether to bypass microphysical processes. - !! - !! Set it to SMALL_PC/xmet/ymet/zmet to never bypass the calculations. - - real(kind=f), parameter :: FEW_PC = SMALL_PC * 1e6_f -! real(kind=f), parameter :: FEW_PC = tiny(ONE) * 1e6_f - - !! Define core fraction (for core mass and second moment) used - !! when particle number concentrations are limited to SMALL_PC - real(kind=f), parameter :: FIX_COREF = 0.1_f - - !! Minimum Cloud Fraction - real(kind=f), parameter :: CLDFRC_MIN = 1e-4_f - - !! Incloud Cloud Fraction Threshold for statistics - real(kind=f), parameter :: CLDFRC_INCLOUD = 0.10_f -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_enums_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carma_enums_mod.F90 deleted file mode 100644 index 76854dd6..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_enums_mod.F90 +++ /dev/null @@ -1,147 +0,0 @@ -!! This module is part of the CARMA module and contains enumerations that are part of -!! the CARMA and CARMASTATE objects. -!! -!! @author Chuck Bardeen -!! @ version July-2009 -module carma_enums_mod - - !-- - ! Index values of CARMA's flags. In a given list, begin with 1 - ! (instead of 0) so that undefined flags will produce an error. - ! - ! For example: - ! if( itype(ielem) .eq. I_INVOLATILE )then - ! - ! If itype(ielem) hasn't been defined (and is still 0), we do not want - ! to execute the statements that follow. - - ! Define values of flag used for vertical transport - ! boundary conditions (ixxxbnd_pc) - integer, public, parameter :: I_FIXED_CONC = 1 !! Fixed Concentration - integer, public, parameter :: I_FLUX_SPEC = 2 !! Flux Specification - - ! Define values of flag used for particle element - ! type specification (itype). - integer, public, parameter :: I_INVOLATILE = 1 !! Involatile particle - integer, public, parameter :: I_VOLATILE = 2 !! Volatile particle - integer, public, parameter :: I_COREMASS = 3 !! Core Mass - integer, public, parameter :: I_VOLCORE = 4 !! Voltile Core - integer, public, parameter :: I_CORE2MOM = 5 !! Core Mass - 2 Moments - - !! Define values of flag used for nucleation process - !! specification (inucproc). - !! - !! NOTE: Some of these can be used in combination, so for aerosol freezing this is treated - !! as a bit mask. When setting for one (or more) of the Aerosol freezing methods, use: - !! IAERFREEZE + I_AF_xxx + I_AF_yyy + ... - integer, public, parameter :: I_AF_TABAZADEH_2000 = 1 !! Aerosol Freezing, Tabazadeh[2000] - integer, public, parameter :: I_AF_KOOP_2000 = 2 !! Aerosol Freezing, Koop[2000] - integer, public, parameter :: I_AF_MOHLER_2010 = 4 !! Aerosol Freezing, Mohler[2010] - integer, public, parameter :: I_AF_MURRAY_2010 = 8 !! Glassy Aerosol Freezing, Murray[2010] - integer, public, parameter :: I_DROPACT = 256 !! Droplet Activation - integer, public, parameter :: I_AERFREEZE = 512 !! Aerosol Freezing - integer, public, parameter :: I_DROPFREEZE = 1024 !! Droplet Freezing - integer, public, parameter :: I_ICEMELT = 2048 !! Ice Melting - integer, public, parameter :: I_HETNUC = 4096 !! Heterogeneous Nucleation - integer, public, parameter :: I_HOMNUC = 8192 !! Binary homogeneous gas-to-particle nucleation - integer, public, parameter :: I_HETNUCSULF = 16384 !! Binary homogeneous gas-to-particle nucleation - - ! Define values of flag used for collection process (icollec) - integer, public, parameter :: I_COLLEC_CONST = 1 !! Constant Collection Efficiency - integer, public, parameter :: I_COLLEC_FUCHS = 2 !! Binwise Maxima of Fuchs' and Langmuir's Efficiencies - integer, public, parameter :: I_COLLEC_DATA = 3 !! Input Data - - ! Define values of flag used for coagulation operation (icoagop) - integer, public, parameter :: I_COAGOP_CONST = 1 !! Constant Coagulation Kernel - integer, public, parameter :: I_COAGOP_CALC = 2 !! Calculate Coagulation Kernel - - ! Define values of flag used for particle shape (ishape) - integer, public, parameter :: I_SPHERE = 1 !! spherical - integer, public, parameter :: I_HEXAGON = 2 !! hexagonal prisms or plates - integer, public, parameter :: I_CYLINDER = 3 !! circular disks, cylinders, or spheroids - - ! Define values of flag used for particle swelling parameterization (irhswell) - integer, public, parameter :: I_NO_SWELLING = 0 !! No swelling - integer, public, parameter :: I_FITZGERALD = 1 !! Fitzgerald - integer, public, parameter :: I_GERBER = 2 !! Gerber - integer, public, parameter :: I_WTPCT_H2SO4 = 3 !! The weight percent method for sulfate aerosol - integer, public, parameter :: I_WTPCT_STS = 4 !! The weight percent method for sts - - ! Define vallues of flag used for particle swelling composition (Fiztgerald) - integer, public, parameter :: I_SWF_NH42SO4 = 1 !! (NH4)2SO4 - integer, public, parameter :: I_SWF_NH4NO3 = 2 !! NH4NO3 - integer, public, parameter :: I_SWF_NANO3 = 3 !! NaNO3 - integer, public, parameter :: I_SWF_NH4CL = 4 !! NH4Cl - integer, public, parameter :: I_SWF_CACL2 = 5 !! CaCl2 - integer, public, parameter :: I_SWF_NABR = 6 !! NaBr - integer, public, parameter :: I_SWF_NACL = 7 !! NaCl - integer, public, parameter :: I_SWF_MGCL2 = 8 !! MgCl2 - integer, public, parameter :: I_SWF_LICL = 9 !! LiCl - - ! Define vallues of flag used for particle swelling composition (Gerber) - integer, public, parameter :: I_SWG_NH42SO4 = 11 !! (NH4)2SO4 - integer, public, parameter :: I_SWG_SEA_SALT = 12 !! Sea Salt - integer, public, parameter :: I_SWG_URBAN = 13 !! Urban - integer, public, parameter :: I_SWG_RURAL = 14 !! Rural - - ! Routines to calculate gas vapor pressures - integer, public, parameter :: I_VAPRTN_NULL = -1 !! For non-condensing gases - integer, public, parameter :: I_VAPRTN_H2O_BUCK1981 = 1 !! H2O, Buck[1981] - integer, public, parameter :: I_VAPRTN_H2O_MURPHY2005 = 2 !! H2O, Murphy & Koop [2005] - integer, public, parameter :: I_VAPRTN_H2O_GOFF1946 = 3 !! H2O, Goff & Gratch [1946], used in CAM - integer, public, parameter :: I_VAPRTN_H2SO4_AYERS1980 = 4 !! H2SO4, Ayers [1980] & Kumala [1990] - - ! Routines to calculate fall velocities - integer, public, parameter :: I_FALLRTN_STD = 1 !! Standard CARMA 2.3 routine (spherical only) - integer, public, parameter :: I_FALLRTN_STD_SHAPE = 2 !! Optional CARMA 2.3 routine (supports shapes) - integer, public, parameter :: I_FALLRTN_HEYMSFIELD2010 = 3 !! Heymsfield & Westbrook [2010] (ice only) - - ! Routines to calculate mie optical properties - integer, public, parameter :: I_MIERTN_TOON1981 = 1 !! Shell/Core, Toon & Ackerman [1981] - integer, public, parameter :: I_MIERTN_BOHREN1983 = 2 !! Homogeneous Sphere, Bohren & Huffman [1983] - integer, public, parameter :: I_MIERTN_BOTET1997 = 3 !! Fractal mean-field, Botet et al. [1997] - - ! Gas Composition - integer, public, parameter :: I_GCOMP_H2O = 1 !! Water Vapor - integer, public, parameter :: I_GCOMP_H2SO4 = 2 !! Sulphuric Acid - integer, public, parameter :: I_GCOMP_SO2 = 3 !! Sulfer Dioxide - integer, public, parameter :: I_GCOMP_HNO3 = 4 !! Nitric Acid - - ! How is the CARMA group represented in the parent model - integer, public, parameter :: I_CNSTTYPE_PROGNOSTIC = 1 !! Prognostic, advected constituent for each bin - integer, public, parameter :: I_CNSTTYPE_DIAGNOSTIC = 2 !! Diagnostic, bins diagonosed from model state - - ! Return Codes - ! - ! NOTE: Also see error handling macros in globaer.h. - integer, public, parameter :: RC_OK = 0 !! Success - integer, public, parameter :: RC_ERROR = -1 !! Failure - integer, public, parameter :: RC_WARNING = 1 !! Warning - integer, public, parameter :: RC_WARNING_RETRY = 2 !! Warning, Retry Suggested - integer, public, parameter :: RC_WARNING_PFAST = 3 !! Warning, Parameterization Suggested - - - ! Define values of symbols used to specify horizontal & vertical grid type. - ! Grid selection is made by defining each of the variables - ! and to one of the grid types known to the model. - ! - ! Possible values for igridv: - ! I_CART cartesian - ! I_SIG sigma - ! I_HYBRID hybrid - ! - ! Possible values for igridh: - ! I_CART cartesian - ! I_LL longitude_latitude - ! I_LC lambert_conformal - ! I_PS polar_stereographic - ! I_ME mercator - integer, public, parameter :: I_CART = 1 !! Cartesian - integer, public, parameter :: I_SIG = 2 !! Sigma - integer, public, parameter :: I_LL = 3 !! Longitude & Latitude - integer, public, parameter :: I_LC = 4 !! Lambert Conformal - integer, public, parameter :: I_PS = 5 !! Polar Sterographic - integer, public, parameter :: I_ME = 6 !! Mercator - integer, public, parameter :: I_HYBRID = 7 !! Hybrid -end module - diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_globaer.h b/CARMAchem_GridComp/CARMA/source/base/carma_globaer.h deleted file mode 100644 index ea0cf831..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_globaer.h +++ /dev/null @@ -1,327 +0,0 @@ -! CARMA Type aliases -! --------------------- -! This file containts shortcut names that map the variable names that -! were traditionally used in the common blocks by the Fortran 77 version -! of CARMA (globeaer.h), to the corresponding structure members in the -! Fortran 90 version of CARMA. This allows the older code to be -! converted to F90 with minimal changes, but without adding any -! processing overhead. -! --------------------------------------------- - -! NOTE: Using macros causes some limitations: -! -! 1) You can not have another #define as a parameter to a macro. This causes -! multiple expansions of the parameter. To prevent this, assign the parameter -! to a varaible and use the variable in the macro. -! -! 2) You can not have comments on the same line as a macro. Put comments on the -! line before the one with the macro. -! -! 3) Not all fortran preprocessors support the CPP's handling of recursion for -! macro names. To work out of the box with the broadest number of fortran -! compilers this requires making the field name different from the macro -! or it will recursively try to replace the macro again (or report an -! error message about recursion. Intel and IBM compilers handle it properly, -! but Portland Group does not. To work around this problem, fields in the -! cstate and carma structure are preceeded by f_ to make their names unique. - -#define NZ cstate%f_NZ -#define NZP1 cstate%f_NZP1 -#define NGAS carma%f_NGAS -#define NBIN carma%f_NBIN -#define NGROUP carma%f_NGROUP -#define NELEM carma%f_NELEM -#define NSOLUTE carma%f_NSOLUTE -#define NWAVE carma%f_NWAVE - -! Model logical units for I/O -#define LUNOPRT carma%f_LUNOPRT - -! Model startup control variables -#define do_print carma%f_do_print - -! Gridding Information -#define igridv cstate%f_igridv -#define igridh cstate%f_igridh -#define xmet cstate%f_xmet -#define ymet cstate%f_ymet -#define zmet cstate%f_zmet -#define zmetl cstate%f_zmetl -#define xc cstate%f_xc -#define yc cstate%f_yc -#define zc cstate%f_zc -#define dx cstate%f_dx -#define dy cstate%f_dy -#define dz cstate%f_dz -#define zl cstate%f_zl -#define lon cstate%f_lon -#define lat cstate%f_lat - -! Element object -#define elemname(ielem) carma%f_element(ielem)%f_name -#define rhoelem(ibin, ielem) carma%f_element(ielem)%f_rho(ibin) -#define igelem(ielem) carma%f_element(ielem)%f_igroup -#define itype(ielem) carma%f_element(ielem)%f_itype -#define icomp(ielem) carma%f_element(ielem)%f_icomposition -#define isolelem(ielem) carma%f_element(ielem)%f_isolute - -! Gas object -#define gasname(igas) carma%f_gas(igas)%f_name -#define gwtmol(igas) carma%f_gas(igas)%f_wtmol -#define ivaprtn(igas) carma%f_gas(igas)%f_ivaprtn -#define igcomp(igas) carma%f_gas(igas)%f_icomposition -#define dgc_threshold(igas) carma%f_gas(igas)%f_dgc_threshold -#define ds_threshold(igas) carma%f_gas(igas)%f_ds_threshold - -! Group object -#define groupname(igroup) carma%f_group(igroup)%f_name -#define nelemg(igroup) carma%f_group(igroup)%f_nelem -#define ncore(igroup) carma%f_group(igroup)%f_ncore -#define ishape(igroup) carma%f_group(igroup)%f_ishape -#define ienconc(igroup) carma%f_group(igroup)%f_ienconc -#define imomelem(igroup) carma%f_group(igroup)%f_imomelem -#define solfac(igroup) carma%f_group(igroup)%f_solface -#define scavcoef(igroup) carma%f_group(igroup)%f_scavcoef -#define if_sec_mom(igroup) carma%f_group(igroup)%f_if_sec_mom -#define is_grp_fractal(igroup) carma%f_group(igroup)%f_is_fractal -#define is_grp_ice(igroup) carma%f_group(igroup)%f_is_ice -#define is_grp_cloud(igroup) carma%f_group(igroup)%f_is_cloud -#define is_grp_sulfate(igroup) carma%f_group(igroup)%f_is_sulfate -#define grp_do_vtran(igroup) carma%f_group(igroup)%f_grp_do_vtran -#define grp_do_drydep(igroup) carma%f_group(igroup)%f_grp_do_drydep -#define irhswell(igroup) carma%f_group(igroup)%f_irhswell -#define irhswcomp(igroup) carma%f_group(igroup)%f_irhswcomp -#define rmrat(igroup) carma%f_group(igroup)%f_rmrat -#define eshape(igroup) carma%f_group(igroup)%f_eshape -#define r(ibin,igroup) carma%f_group(igroup)%f_r(ibin) -#define rmass(ibin,igroup) carma%f_group(igroup)%f_rmass(ibin) -#define vol(ibin,igroup) carma%f_group(igroup)%f_vol(ibin) -#define dr(ibin,igroup) carma%f_group(igroup)%f_dr(ibin) -#define dm(ibin,igroup) carma%f_group(igroup)%f_dm(ibin) -#define rmassup(ibin,igroup) carma%f_group(igroup)%f_rmassup(ibin) -#define rmin(igroup) carma%f_group(igroup)%f_rmin -#define rmassmin(igroup) carma%f_group(igroup)%f_rmassmin -#define rup(ibin,igroup) carma%f_group(igroup)%f_rup(ibin) -#define rlow(ibin,igroup) carma%f_group(igroup)%f_rlow(ibin) -#define icorelem(icore,igroup) carma%f_group(igroup)%f_icorelem(icore) -#define ifallrtn(igroup) carma%f_group(igroup)%f_ifallrtn -#define arat(ibin,igroup) carma%f_group(igroup)%f_arat(ibin) -#define rrat(ibin,igroup) carma%f_group(igroup)%f_rrat(ibin) -#define rprat(ibin,igroup) carma%f_group(igroup)%f_rprat(ibin) -#define qext(iwave,ibin,igroup) carma%f_group(igroup)%f_qext(iwave,ibin) -#define ssa(iwave,ibin,igroup) carma%f_group(igroup)%f_ssa(iwave,ibin) -#define do_mie(igroup) carma%f_group(igroup)%f_do_mie -#define imiertn(igroup) carma%f_group(igroup)%f_imiertn -#define dpc_threshold(igroup) carma%f_group(igroup)%f_dpc_threshold -#define rmon(igroup) carma%f_group(igroup)%f_rmon -#define df(ibin,igroup) carma%f_group(igroup)%f_df(ibin) -#define nmon(ibin,igroup) carma%f_group(igroup)%f_nmon(ibin) -#define falpha(igroup) carma%f_group(igroup)%f_falpha -#define neutral_volfrc(igroup) carma%f_group(igroup)%f_neutral_volfrc - -! Solute object -#define solname(isolute) carma%f_solute(isolute)%f_name -#define sol_ions(isolute) carma%f_solute(isolute)%f_ions -#define solwtmol(isolute) carma%f_solute(isolute)%f_wtmol -#define rhosol(isolute) carma%f_solute(isolute)%f_rho - -! Optical properties -#define wave carma%f_wave -#define dwave carma%f_dwave -#define do_wave_emit carma%f_do_wave_emit - -! Model option & control variables -#define do_clearsky carma%f_do_clearsky -#define do_cnst_rlh carma%f_do_cnst_rlh -#define do_coag carma%f_do_coag -#define do_detrain carma%f_do_detrain -#define do_fixedinit carma%f_do_fixedinit -#define do_grow carma%f_do_grow -#define do_explised carma%f_do_explised -#define do_incloud carma%f_do_incloud -#define do_partialinit carma%f_do_partialinit -#define do_pheat carma%f_do_pheat -#define do_pheatatm carma%f_do_pheatatm -#define do_print_init carma%f_do_print_init -#define do_step carma%f_do_step -#define do_substep carma%f_do_substep -#define do_pfast carma%f_do_pfast -#define do_thermo carma%f_do_thermo -#define do_vdiff carma%f_do_vdiff -#define do_vtran carma%f_do_vtran -#define do_drydep carma%f_do_drydep -#define if_nuc carma%f_if_nuc -#define time cstate%f_time -#define dtime cstate%f_dtime -#define dtime_orig cstate%f_dtime_orig -#define nretries cstate%f_nretries -#define dtmin carma%f_dtmin -#define dtmax carma%f_dtmax -#define conmax carma%f_conmax -#define maxsubsteps carma%f_maxsubsteps -#define minsubsteps carma%f_minsubsteps -#define maxretries carma%f_maxretries -#define ifall carma%f_ifall -#define icoagop carma%f_icoagop -#define icollec carma%f_icollec -#define itbnd_pc carma%f_itbnd_pc -#define ibbnd_pc carma%f_ibbnd_pc -#define inucgas carma%f_inucgas -#define igrowgas carma%f_igrowgas -#define nnuc2elem carma%f_nnuc2elem -#define ievp2elem carma%f_ievp2elem -#define nnucelem carma%f_nnucelem -#define inucproc carma%f_inucproc -#define inuc2elem carma%f_inuc2elem -#define inucelem carma%f_inucelem -#define inuc2bin carma%f_inuc2bin -#define ievp2bin carma%f_ievp2bin -#define nnucbin carma%f_nnucbin -#define inucbin carma%f_inucbin -#define dt_threshold carma%f_dt_threshold -#define igash2o carma%f_igash2o -#define igash2so4 carma%f_igash2so4 -#define igashno3 carma%f_igashno3 -#define igasso2 carma%f_igasso2 -#define tstick carma%f_tstick -#define gsticki carma%f_gsticki -#define gstickl carma%f_gstickl -#define cstick carma%f_cstick - -#define max_nsubstep cstate%f_max_nsubstep -#define max_nretry cstate%f_max_nretry -#define nstep cstate%f_nstep -#define nsubstep cstate%f_nsubstep -#define nretry cstate%f_nretry -#define zsubsteps cstate%f_zsubsteps - -! Particle grid structure -#define diffmass carma%f_diffmass -#define rhop cstate%f_rhop -#define r_wet cstate%f_r_wet -#define rlow_wet cstate%f_rlow_wet -#define rup_wet cstate%f_rup_wet -#define rhop_wet cstate%f_rhop_wet -#define r_ref cstate%f_r_ref -#define rhop_ref cstate%f_rhop_ref - -! Atmospheric structure -#define rhoa cstate%f_rhoa -#define rhoa_wet cstate%f_rhoa_wet -#define t cstate%f_t -#define p cstate%f_p -#define pl cstate%f_pl -#define relhum cstate%f_relhum -#define wtpct cstate%f_wtpct -#define told cstate%f_told -#define rmu cstate%f_rmu -#define thcond cstate%f_thcond -#define thcondnc cstate%f_thcondnc -#define dkz cstate%f_dkz - -! Model primary vars -#define pc cstate%f_pc -#define pcd cstate%f_pcd -#define pc_surf cstate%f_pc_surf -#define gc cstate%f_gc -#define sedimentationflux cstate%f_sedimentationflux -#define cldfrc cstate%f_cldfrc -#define rhcrit cstate%f_rhcrit - -! Model secondary variables -#define pcl cstate%f_pcl -#define gcl cstate%f_gcl -#define d_gc cstate%f_d_gc -#define d_t cstate%f_d_t -#define dpc_sed cstate%f_dpc_sed -#define pconmax cstate%f_pconmax -#define coaglg cstate%f_coaglg -#define coagpe cstate%f_coagpe -#define rnuclg cstate%f_rnuclg -#define rnucpe cstate%f_rnucpe -#define rhompe cstate%f_rhompe -#define pc_nucl cstate%f_pc_nucl -#define growpe cstate%f_growpe -#define evappe cstate%f_evappe -#define coreavg cstate%f_coreavg -#define coresig cstate%f_coresig -#define evdrop cstate%f_evdrop -#define evcore cstate%f_evcore -#define growlg cstate%f_growlg -#define evaplg cstate%f_evaplg -#define gasprod cstate%f_gasprod -#define rlheat cstate%f_rlheat -#define cmf cstate%f_cmf -#define totevap cstate%f_totevap -#define pc_topbnd cstate%f_pc_topbnd -#define pc_botbnd cstate%f_pc_botbnd -#define ftoppart cstate%f_ftoppart -#define fbotpart cstate%f_fbotpart -#define cmf cstate%f_cmf -#define totevap cstate%f_totevap -#define too_small cstate%f_too_small -#define too_big cstate%f_too_big -#define nuc_small cstate%f_nuc_small -#define rlprod cstate%f_rlprod -#define phprod cstate%f_phprod - -! Coagulation kernels and bin pair mapping -#define ck0 carma%f_ck0 -#define grav_e_coll0 carma%f_grav_e_coll0 -#define icoag carma%f_icoag -#define icoagelem carma%f_icoagelem -#define icoagelem_cm carma%f_icoagelem_cm -#define kbin carma%f_kbin - -#define ckernel cstate%f_ckernel -#define pkernel carma%f_pkernel - -#define volx carma%f_volx -#define ilow carma%f_ilow -#define jlow carma%f_jlow -#define iup carma%f_iup -#define jup carma%f_jup -#define npairl carma%f_npairl -#define npairu carma%f_npairu - -! Coagulation group pair mapping -#define iglow carma%f_iglow -#define jglow carma%f_jglow -#define igup carma%f_igup -#define jgup carma%f_jgup - -! Particle fall velocities, transport rates, and coagulation kernels -#define bpm cstate%f_bpm -#define vf cstate%f_vf -#define re cstate%f_re -#define vf_const carma%f_vf_const -#define vd cstate%f_vd - -! Condensational growth parameters -#define diffus cstate%f_diffus -#define rlhe cstate%f_rlhe -#define rlhm cstate%f_rlhm -#define pvapl cstate%f_pvapl -#define pvapi cstate%f_pvapi -#define surfctwa cstate%f_surfctwa -#define surfctiw cstate%f_surfctiw -#define surfctia cstate%f_surfctia -#define akelvin cstate%f_akelvin -#define akelvini cstate%f_akelvini -#define ft cstate%f_ft -#define gro cstate%f_gro -#define gro1 cstate%f_gro1 -#define gro2 cstate%f_gro2 -#define supsatl cstate%f_supsatl -#define supsati cstate%f_supsati -#define supsatlold cstate%f_supsatlold -#define supsatiold cstate%f_supsatiold -#define scrit cstate%f_scrit -#define rlh_nuc carma%f_rlh_nuc -#define radint cstate%f_radint -#define partheat cstate%f_partheat -#define dtpart cstate%f_dtpart -#define pratt carma%f_pratt -#define prat carma%f_prat -#define pden1 carma%f_pden1 -#define palr carma%f_palr diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carma_mod.F90 deleted file mode 100644 index ebb7f11f..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_mod.F90 +++ /dev/null @@ -1,1498 +0,0 @@ -!! The CARMA module contains an interface to the Community Aerosol and Radiation -!! Model for Atmospheres (CARMA) bin microphysical model [Turco et al. 1979; -!! Toon et al. 1988]. This implementation has been customized to work within -!! other model frameworks, so although it can be provided with an array of -!! columns, it does not do horizontal transport and just does independent 1-D -!! calculations upon each column. -!! -!! The typical usage for the CARMA and CARMASTATE objects within a model would be: -!!> -!! ! This first section of code is done during the parent model's initialzation, -!! ! and there should be a unique CARMA object created for each thread of -!! ! execution. -!! -!! ! Create the CARMA object. -!! call CARMA_Create(carma, ...) -!! -!! ! Define the microphysical components. -!! call CARMAGROUP_Create(carma, ...) ! One or more calls -!! -!! call CARMAELEMENT_Create(carma, ...) ! One or more calls -!! -!! call CARMASOLUTE_Create(carma, ...) ! Zero or more calls -!! -!! call CARMAGAS_Create(carma, ...) ! Zero or more calls -!! -!! ! Define the relationships for the microphysical processes. -!! call CARMA_AddCoagulation(carma, ...) ! Zero or more calls -!! call CARMA_AddGrowth(carma, ...) ! Zero or more calls -!! call CARMA_AddNucleation(carma, ...) ! Zero or more calls -!! -!! ! Initialize things that are state and timestep independent. -!! call CARMA_Initialize(carma, ...) -!! -!! ... -!! -!! ! This section of code is within the parent model's timing loop. -!! ! -!! ! NOTE: If using OPEN/MP, then each thread will execute one of -!! ! of these loops per column of data. To avoid having to destroy -!! ! the CARMASTATE object, a pool of CARMASTATE objects could be -!! ! created so that there is one per thread and then the -!! ! CARMA_Destroy() could be called after all columns have been -!! ! processed. -!! -!! ! Initialize CARMA for this model state and timestep. -!! call CARMASTATE_Create(cstate, carma, ...) -!! -!! ! Set the model state for each bin and gas. -!! call CARMASTATE_SetBin(cstate, ...) ! One call for each bin -!! call CARMASTATE_SetGas(cstate, ...) ! One call for each gas -!! -!! ! Calculate the new state -!! call CARMASTATE_Step(cstate, ...) -!! -!! ! Get the results to return back to the parent model. -!! call CARMASTATE_GetBin(cstate, ...) ! One call for each Bin -!! call CARMASTATE_GetGas(cstate, ...) ! One call for each gas -!! call CARMASTATE_GetState(cstate, ...) ! Zero or one calls -!! -!! ! (optional) Deallocate arrays that are not needed beyond this timestep. -!! call CARMASTATE_Destroy(cstate) -!! -!! ... -!! -!! ! This section of code is done during the parent model's cleanup. -!! -!! ! Deallocate all arrays. -!! call CARMA_Destroy(carma) -!!< -!! -!! @version Feb-2009 -!! @author Chuck Bardeen, Pete Colarco, Jamie Smith -! -! NOTE: Documentation for this code can be generated automatically using f90doc, -! which is freely available from: -! http://erikdemaine.org/software/f90doc/ -! Comment lines with double comment characters are processed by f90doc, and there are -! some special characters added to the comments to control the documentation process. -! In addition to the special characters mentioned in the f990doc documentation, html -! formatting tags (e.g. , , ...) can also be added to the f90doc -! comments. -module carma_mod - - ! This module maps the parents models constants into the constants need by CARMA. NOTE: CARMA - ! constants are in CGS units, while the parent models are typically in MKS units. - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! CARMA explicitly declares all variables. - implicit none - - ! All CARMA variables and procedures are private except those explicitly declared to be public. - private - - ! Declare the public methods. - public CARMA_AddCoagulation - public CARMA_AddGrowth - public CARMA_AddNucleation - public CARMA_Create - public CARMA_Destroy - public CARMA_Get - public CARMA_Initialize - -contains - - ! These are the methods that provide the interface between the parent model and the CARMA - ! microphysical model. There are many other methods that are not in this file that are - ! used to implement the microphysical calculations needed by the CARMA model. These other - ! methods are in effect private methods of the CARMA module, but are in individual files - ! since that is the way that CARMA has traditionally been structured and where users may - ! want to extend or replace code to affect the microphysics. - - !! Creates the CARMA object and allocates arrays to store configuration information - !! that will follow from the CARMA_AddXXX() methods. When the CARMA object is no longer - !! needed, the CARMA_Destroy() method should be used to clean up any allocations - !! that have happened. If LUNOPRT is specified, then the logical unit should be open and - !! ready for output. The caller is responsible for closing the LUNOPRT logical unit - !! after the CARMA object has been destroyed. - !! - !! @version Feb-2009 - !! @author Chuck Bardeen - subroutine CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, & - LUNOPRT, wave, dwave, do_wave_emit) - - type(carma_type), intent(out) :: carma !! the carma object - integer, intent(in) :: NBIN !! number of radius bins per group - integer, intent(in) :: NELEM !! total number of elements - integer, intent(in) :: NGROUP !! total number of groups - integer, intent(in) :: NSOLUTE !! total number of solutes - integer, intent(in) :: NGAS !! total number of gases - integer, intent(in) :: NWAVE !! number of wavelengths - integer, intent(out) :: rc !! return code, negative indicates failure - integer, intent(in), optional :: LUNOPRT !! logical unit number for output - real(kind=f), intent(in), optional :: wave(NWAVE) !! wavelength centers (cm) - real(kind=f), intent(in), optional :: dwave(NWAVE) !! wavelength width (cm) - logical, intent(in), optional :: do_wave_emit(NWAVE) !! do emission in band? - - ! Local Varaibles - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Save off the logic unit used for output if one was provided. If one was provided, - ! then assume that CARMA can print output. - if (present(LUNOPRT)) then - carma%f_LUNOPRT = LUNOPRT - carma%f_do_print = .TRUE. - end if - - ! Save the defintion of the number of comonents involved in the microphysics. - carma%f_NGROUP = NGROUP - carma%f_NELEM = NELEM - carma%f_NBIN = NBIN - carma%f_NGAS = NGAS - carma%f_NSOLUTE = NSOLUTE - carma%f_NWAVE = NWAVE - - - ! Allocate tables for the groups. - allocate( & - carma%f_group(NGROUP), & - carma%f_icoag(NGROUP, NGROUP), & - carma%f_inucgas(NGROUP), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating groups, NGROUP=", & - carma%f_NGROUP, ", status=", ier - rc = RC_ERROR - return - endif - - ! Initialize - carma%f_icoag(:, :) = 0 - carma%f_inucgas(:) = 0 - - ! Allocate tables for the elements. - allocate( & - carma%f_element(NELEM), & - carma%f_igrowgas(NELEM), & - carma%f_inuc2elem(NELEM, NELEM), & - carma%f_inucproc(NELEM, NELEM), & - carma%f_ievp2elem(NELEM), & - carma%f_nnuc2elem(NELEM), & - carma%f_nnucelem(NELEM), & - carma%f_inucelem(NELEM,NELEM*NGROUP), & - carma%f_if_nuc(NELEM,NELEM), & - carma%f_rlh_nuc(NELEM, NELEM), & - carma%f_icoagelem(NELEM, NGROUP), & - carma%f_icoagelem_cm(NELEM, NGROUP), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating elements, NELEM=", & - carma%f_NELEM, ", status=", ier - rc = RC_ERROR - return - endif - - ! Initialize - carma%f_igrowgas(:) = 0 - carma%f_inuc2elem(:,:) = 0 - carma%f_inucproc(:,:) = 0 - carma%f_ievp2elem(:) = 0 - carma%f_nnuc2elem(:) = 0 - carma%f_nnucelem(:) = 0 - carma%f_inucelem(:,:) = 0 - carma%f_if_nuc(:,:) = .FALSE. - carma%f_rlh_nuc(:,:) = 0._f - carma%f_icoagelem(:,:) = 0 - carma%f_icoagelem_cm(:,:) = 0 - - - ! Allocate tables for the bins. - allocate( & - carma%f_inuc2bin(NBIN,NGROUP,NGROUP), & - carma%f_ievp2bin(NBIN,NGROUP,NGROUP), & - carma%f_nnucbin(NGROUP,NBIN,NGROUP), & - carma%f_inucbin(NBIN*NGROUP,NGROUP,NBIN,NGROUP), & - carma%f_diffmass(NBIN, NGROUP, NBIN, NGROUP), & - carma%f_volx(NGROUP,NGROUP,NGROUP,NBIN,NBIN), & - carma%f_ilow(NGROUP,NBIN,NBIN*NBIN), & - carma%f_jlow(NGROUP,NBIN,NBIN*NBIN), & - carma%f_iup(NGROUP,NBIN,NBIN*NBIN), & - carma%f_jup(NGROUP,NBIN,NBIN*NBIN), & - carma%f_npairl(NGROUP,NBIN), & - carma%f_npairu(NGROUP,NBIN), & - carma%f_iglow(NGROUP,NBIN,NBIN*NBIN), & - carma%f_jglow(NGROUP,NBIN,NBIN*NBIN), & - carma%f_igup(NGROUP,NBIN,NBIN*NBIN), & - carma%f_jgup(NGROUP,NBIN,NBIN*NBIN), & - carma%f_kbin(NGROUP,NGROUP,NGROUP,NBIN,NBIN), & - carma%f_pkernel(NBIN,NBIN,NGROUP,NGROUP,NGROUP,6), & - carma%f_pratt(3,NBIN,NGROUP), & - carma%f_prat(4,NBIN,NGROUP), & - carma%f_pden1(NBIN,NGROUP), & - carma%f_palr(4,NGROUP), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating bins, NBIN=", & - carma%f_NBIN, ", status=", ier - rc = RC_ERROR - return - endif - - ! Initialize - carma%f_inuc2bin(:,:,:) = 0 - carma%f_ievp2bin(:,:,:) = 0 - carma%f_nnucbin(:,:,:) = 0 - carma%f_inucbin(:,:,:,:) = 0 - carma%f_diffmass(:, :, :, :) = 0._f - carma%f_volx(:,:,:,:,:) = 0._f - carma%f_ilow(:,:,:) = 0 - carma%f_jlow(:,:,:) = 0 - carma%f_iup(:,:,:) = 0 - carma%f_jup(:,:,:) = 0 - carma%f_npairl(:,:) = 0 - carma%f_npairu(:,:) = 0 - carma%f_iglow(:,:,:) = 0 - carma%f_jglow(:,:,:) = 0 - carma%f_igup(:,:,:) = 0 - carma%f_jgup(:,:,:) = 0 - carma%f_kbin(:,:,:,:,:) = 0._f - carma%f_pkernel(:,:,:,:,:,:) = 0._f - carma%f_pratt(:,:,:) = 0._f - carma%f_prat(:,:,:) = 0._f - carma%f_pden1(:,:) = 0._f - carma%f_palr(:,:) = 0._f - - - ! Allocate tables for solutes, if any are needed. - if (NSOLUTE > 0) then - allocate( & - carma%f_solute(NSOLUTE), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating solutes, NSOLUTE=", & - carma%f_NSOLUTE, ", status=", ier - rc = RC_ERROR - return - endif - end if - - - ! Allocate tables for gases, if any are needed. - if (NGAS > 0) then - allocate( & - carma%f_gas(NGAS), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating gases, NGAS=", & - carma%f_NGAS, ", status=", ier - rc = RC_ERROR - return - endif - end if - - - ! Allocate tables for optical properties, if any are needed. - if (NWAVE > 0) then - allocate( & - carma%f_wave(NWAVE), & - carma%f_dwave(NWAVE), & - carma%f_do_wave_emit(NWAVE), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Create: ERROR allocating wavelengths, NWAVE=", & - carma%f_NWAVE, ", status=", ier - rc = RC_ERROR - return - endif - - ! Initialize - carma%f_do_wave_emit(:) = .TRUE. - - if (present(wave)) carma%f_wave(:) = wave(:) - if (present(dwave)) carma%f_dwave(:) = dwave(:) - if (present(do_wave_emit)) carma%f_do_wave_emit(:) = do_wave_emit(:) - end if - - return - end subroutine CARMA_Create - - !! Called after the CARMA object has been created and the microphysics description has been - !! configured. The optional flags control which microphysical processes are enabled and all of - !! them default to FALSE. For a microphysical process to be active it must have been both - !! configured (using a CARMA_AddXXX() method) and enabled here. - !! - !! NOTE: After initialization, the structure of the particle size bins is determined, and - !! the resulting r, dr, rmass and dm can be retrieved with the CARMA_GetGroup() method. - !! - !! @version Feb-2009 - !! @author Chuck Bardeen - subroutine CARMA_Initialize(carma, rc, do_cnst_rlh, do_coag, do_detrain, do_fixedinit, & - do_grow, do_incloud, do_explised, do_print_init, do_substep, do_pfast, do_thermo, do_vdiff, & - do_vtran, do_drydep, vf_const, minsubsteps, maxsubsteps, maxretries, conmax, & - do_pheat, do_pheatatm, dt_threshold, cstick, gsticki, gstickl, tstick, do_clearsky, & - do_partialinit) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(out) :: rc !! return code, negative indicates failure - logical, intent(in), optional :: do_cnst_rlh !! use constant values for latent heats - !! (instead of varying with temperature)? - logical, intent(in), optional :: do_coag !! do coagulation? - logical, intent(in), optional :: do_detrain !! do detrainement? - logical, intent(in), optional :: do_fixedinit !! do initialization from reference atm? - logical, intent(in), optional :: do_grow !! do nucleation, growth and evaporation? - logical, intent(in), optional :: do_incloud !! do incloud growth and coagulation? - logical, intent(in), optional :: do_explised !! do sedimentation with substepping - logical, intent(in), optional :: do_substep !! do substepping - logical, intent(in), optional :: do_pfast !! do parameterized microfast - logical, intent(in), optional :: do_print_init !! do prinit initializtion information - logical, intent(in), optional :: do_thermo !! do thermodynamics - logical, intent(in), optional :: do_vdiff !! do Brownian diffusion - logical, intent(in), optional :: do_vtran !! do sedimentation - logical, intent(in), optional :: do_drydep !! do dry deposition - real(kind=f), intent(in), optional :: vf_const !! if specified and non-zero, - !! constant fall velocity for all particles [cm/s] - integer, intent(in), optional :: minsubsteps !! minimum number of substeps, default = 1 - integer, intent(in), optional :: maxsubsteps !! maximum number of substeps, default = 1 - integer, intent(in), optional :: maxretries !! maximum number of substep retries, default = 5 - real(kind=f), intent(in), optional :: conmax !! minimum relative concentration to consider, default = 1e-1 - logical, intent(in), optional :: do_pheat !! do particle heating - logical, intent(in), optional :: do_pheatatm !! do particle heating of atmosphere - real(kind=f), intent(in), optional :: dt_threshold !! convergence criteria for temperature [fraction] - real(kind=f), intent(in), optional :: cstick !! accommodation coefficient - coagulation, default = 1.0 - real(kind=f), intent(in), optional :: gsticki !! accommodation coefficient - growth (ice), default = 0.93 - real(kind=f), intent(in), optional :: gstickl !! accommodation coefficient - growth (liquid), default = 1.0 - real(kind=f), intent(in), optional :: tstick !! accommodation coefficient - temperature, default = 1.0 - logical, intent(in), optional :: do_clearsky !! do clear sky growth and coagulation? - logical, intent(in), optional :: do_partialinit !! do initialization of coagulation from reference atm (requires do_fixedinit)? - - ! Assume success. - rc = RC_OK - - ! Set default values for control flags. - carma%f_do_cnst_rlh = .FALSE. - carma%f_do_coag = .FALSE. - carma%f_do_detrain = .FALSE. - carma%f_do_fixedinit = .FALSE. - carma%f_do_grow = .FALSE. - carma%f_do_incloud = .FALSE. - carma%f_do_explised = .FALSE. - carma%f_do_pheat = .FALSE. - carma%f_do_pheatatm = .FALSE. - carma%f_do_print_init = .FALSE. - carma%f_do_substep = .FALSE. - carma%f_do_pfast = .FALSE. - carma%f_do_thermo = .FALSE. - carma%f_do_vdiff = .FALSE. - carma%f_do_vtran = .FALSE. - carma%f_do_drydep = .FALSE. - carma%f_dt_threshold = 0._f - carma%f_cstick = 1._f - carma%f_gsticki = 0.93_f - carma%f_gstickl = 1._f - carma%f_tstick = 1._f - carma%f_do_clearsky = .FALSE. - carma%f_do_partialinit = .FALSE. - - ! Store off any control flag values that have been supplied. - if (present(do_cnst_rlh)) carma%f_do_cnst_rlh = do_cnst_rlh - if (present(do_coag)) carma%f_do_coag = do_coag - if (present(do_detrain)) carma%f_do_detrain = do_detrain - if (present(do_fixedinit)) carma%f_do_fixedinit = do_fixedinit - if (present(do_grow)) carma%f_do_grow = do_grow - if (present(do_incloud)) carma%f_do_incloud = do_incloud - if (present(do_explised)) carma%f_do_explised = do_explised - if (present(do_pheat)) carma%f_do_pheat = do_pheat - if (present(do_pheatatm)) carma%f_do_pheatatm = do_pheatatm - if (present(do_print_init)) carma%f_do_print_init = (do_print_init .and. carma%f_do_print) - if (present(do_substep)) carma%f_do_substep = do_substep - if (present(do_pfast)) carma%f_do_pfast = do_pfast - if (present(do_thermo)) carma%f_do_thermo = do_thermo - if (present(do_vdiff)) carma%f_do_vdiff = do_vdiff - if (present(do_vtran)) carma%f_do_vtran = do_vtran - if (present(do_drydep)) carma%f_do_drydep = do_drydep - if (present(dt_threshold)) carma%f_dt_threshold = dt_threshold - if (present(cstick)) carma%f_cstick = cstick - if (present(gsticki)) carma%f_gsticki = gsticki - if (present(gstickl)) carma%f_gstickl = gstickl - if (present(tstick)) carma%f_tstick = tstick - if (present(do_clearsky)) carma%f_do_clearsky = do_clearsky - if (present(do_partialinit)) carma%f_do_partialinit = do_partialinit - - - ! Setup the bin structure. - call setupbins(carma, rc) - if (rc < 0) return - - ! Substepping - carma%f_minsubsteps = 1 ! minimum number of substeps - carma%f_maxsubsteps = 1 ! maximum number of substeps - carma%f_maxretries = 1 ! maximum number of retries - carma%f_conmax = 1.e-1_f - - if (present(minsubsteps)) carma%f_minsubsteps = minsubsteps - if (present(maxsubsteps)) carma%f_maxsubsteps = maxsubsteps - if (present(maxretries)) carma%f_maxretries = maxretries - if (present(conmax)) carma%f_conmax = conmax - - carma%f_do_step = .TRUE. - - ! Calculate the Optical Properties - ! - ! NOTE: This is only needed by CARMA if particle heating is being used. For - ! fractal particle the optics can be very slow, so only do it if necessary, - if (carma%f_do_pheat) then - call CARMA_InitializeOptics(carma, rc) - if (rc < 0) return - end if - - ! If any of the processes have initialization that can be done without the state - ! information, then perform that now. This will mostly be checking the configuration - ! and setting up any tables based upon the configuration. - if (carma%f_do_vtran .or. carma%f_do_coag) then - call CARMA_InitializeVertical(carma, rc, vf_const) - if (rc < 0) return - end if - - if (carma%f_do_coag) then - call setupcoag(carma, rc) - if (rc < 0) return - end if - - if (carma%f_do_grow) then - call CARMA_InitializeGrowth(carma, rc) - if (rc < 0) return - end if - - if (carma%f_do_thermo) then - call CARMA_InitializeThermo(carma, rc) - if (rc < 0) return - end if - - return - end subroutine CARMA_Initialize - - - subroutine CARMA_InitializeGrowth(carma, rc) - type(carma_type), intent(inout) :: carma - integer, intent(out) :: rc - - ! Local Variables - integer :: i - logical :: bad_grid - integer :: igroup ! group index - integer :: igas ! gas index - integer :: isol ! solute index - integer :: ielem ! element index - integer :: ibin ! bin index - integer :: igfrom - integer :: igto - integer :: ibto - integer :: ieto - integer :: ifrom - integer :: iefrom - integer :: jefrom - integer :: ip - integer :: jcore - integer :: iecore - integer :: im - integer :: jnucelem - integer :: inuc2 - integer :: neto - integer :: jfrom - integer :: j - integer :: nnucb - - ! Define formats - 1 format(a,': ',12i6) - 2 format(/,a,': ',i6) - 3 format(a,a) - 4 format(a,': ',1pe12.3) - 5 format(/,'Particle nucleation mapping arrays (setupnuc):') - 7 format(/,'Warning: nucleation cannot occur from group',i3, & - ' bin',i3,' into group',i3,' ( is zero)') - - - ! Assume success. - rc = RC_OK - - ! Compute radius-dependent terms used in PPM advection scheme - do igroup = 1, carma%f_NGROUP - do i = 2,carma%f_NBIN-1 - carma%f_pratt(1,i,igroup) = carma%f_group(igroup)%f_dm(i) / & - ( carma%f_group(igroup)%f_dm(i-1) + carma%f_group(igroup)%f_dm(i) + carma%f_group(igroup)%f_dm(i+1) ) - carma%f_pratt(2,i,igroup) = ( 2._f*carma%f_group(igroup)%f_dm(i-1) + carma%f_group(igroup)%f_dm(i) ) / & - ( carma%f_group(igroup)%f_dm(i+1) + carma%f_group(igroup)%f_dm(i) ) - carma%f_pratt(3,i,igroup) = ( 2._f*carma%f_group(igroup)%f_dm(i+1) + carma%f_group(igroup)%f_dm(i) ) / & - ( carma%f_group(igroup)%f_dm(i-1) + carma%f_group(igroup)%f_dm(i) ) - enddo - - do i = 2,carma%f_NBIN-2 - carma%f_prat(1,i,igroup) = carma%f_group(igroup)%f_dm(i) / & - ( carma%f_group(igroup)%f_dm(i) + carma%f_group(igroup)%f_dm(i+1) ) - carma%f_prat(2,i,igroup) = 2._f * carma%f_group(igroup)%f_dm(i+1) * carma%f_group(igroup)%f_dm(i) / & - ( carma%f_group(igroup)%f_dm(i) + carma%f_group(igroup)%f_dm(i+1) ) - carma%f_prat(3,i,igroup) = ( carma%f_group(igroup)%f_dm(i-1) + carma%f_group(igroup)%f_dm(i) ) / & - ( 2._f*carma%f_group(igroup)%f_dm(i) + carma%f_group(igroup)%f_dm(i+1) ) - carma%f_prat(4,i,igroup) = ( carma%f_group(igroup)%f_dm(i+2) + carma%f_group(igroup)%f_dm(i+1) ) / & - ( 2._f*carma%f_group(igroup)%f_dm(i+1) + carma%f_group(igroup)%f_dm(i) ) - carma%f_pden1(i,igroup) = carma%f_group(igroup)%f_dm(i-1) + carma%f_group(igroup)%f_dm(i) + & - carma%f_group(igroup)%f_dm(i+1) + carma%f_group(igroup)%f_dm(i+2) - enddo - - if( carma%f_NBIN .gt. 1 )then - carma%f_palr(1,igroup) = & - (carma%f_group(igroup)%f_rmassup(1)-carma%f_group(igroup)%f_rmass(1)) / & - (carma%f_group(igroup)%f_rmass(2)-carma%f_group(igroup)%f_rmass(1)) - carma%f_palr(2,igroup) = & - (carma%f_group(igroup)%f_rmassup(1)/carma%f_group(igroup)%f_rmrat-carma%f_group(igroup)%f_rmass(1)) / & - (carma%f_group(igroup)%f_rmass(2)-carma%f_group(igroup)%f_rmass(1)) - carma%f_palr(3,igroup) = & - (carma%f_group(igroup)%f_rmassup(carma%f_NBIN-1)-carma%f_group(igroup)%f_rmass(carma%f_NBIN-1)) & - / (carma%f_group(igroup)%f_rmass(carma%f_NBIN)-carma%f_group(igroup)%f_rmass(carma%f_NBIN-1)) - carma%f_palr(4,igroup) = & - (carma%f_group(igroup)%f_rmassup(carma%f_NBIN)-carma%f_group(igroup)%f_rmass(carma%f_NBIN-1)) & - / (carma%f_group(igroup)%f_rmass(carma%f_NBIN)-carma%f_group(igroup)%f_rmass(carma%f_NBIN-1)) - endif - end do - - - ! Check the nucleation mapping. - ! - ! NOTE: This code was moved from setupnuc, because it is not dependent on the model's - ! state. A small part of setupnuc which deals with scrit is state specific, and that was - ! left in setupnuc. - - ! Bin mapping for nucleation : nucleation would transfer mass from particles - ! in into target bin in group - ! . The target bin is the smallest bin in the target size grid with - ! mass exceeding that of nucleated particle. - do igfrom = 1,carma%f_NGROUP ! nucleation source group - do igto = 1,carma%f_NGROUP ! nucleation target group - do ifrom = 1,carma%f_NBIN ! nucleation source bin - - carma%f_inuc2bin(ifrom,igfrom,igto) = 0 - - do ibto = carma%f_NBIN,1,-1 ! nucleation target bin - - if( carma%f_group(igto)%f_rmass(ibto) .ge. carma%f_group(igfrom)%f_rmass(ifrom) )then - carma%f_inuc2bin(ifrom,igfrom,igto) = ibto - endif - enddo - enddo - enddo - enddo - - ! Mappings for nucleation sources: - ! - ! is the number of particle elements that nucleate to - ! particle element . - ! - ! are the particle elements that - ! nucleate to particle element , where - ! jefrom = 1,nnucelem(ielem). - ! - ! is true if nucleation transfers mass from element - ! to element . - ! - ! is the number of particle bins that nucleate - ! to particles in bin from group . - ! - ! are the particle bins - ! that nucleate to particles in bin , where - ! jfrom = 1,nnucbin(igfrom,ibin,igto). - ! - ! - ! First, calculate and - ! based on - do iefrom = 1,carma%f_NELEM - do ieto = 1,carma%f_NELEM - carma%f_if_nuc(iefrom,ieto) = .false. - enddo - enddo - - do ielem = 1,carma%f_NELEM - carma%f_nnuc2elem(ielem) = 0 - - do jefrom = 1,carma%f_NGROUP - if( carma%f_inuc2elem(jefrom,ielem) .ne. 0 ) then - carma%f_nnuc2elem(ielem) = carma%f_nnuc2elem(ielem) + 1 - carma%f_if_nuc(ielem,carma%f_inuc2elem(jefrom,ielem)) = .true. - - - ! Also check for cases where neither the source or destinaton don't have cores (e.g. - ! melting ice to water drops). - if ((carma%f_group(carma%f_element(ielem)%f_igroup)%f_ncore .eq. 0) .and. & - (carma%f_group(carma%f_element(carma%f_inuc2elem(jefrom,ielem))%f_igroup)%f_ncore .eq. 0)) then - - ! For particle concentration target elements, only count source elements - ! that are also particle concentrations. - carma%f_nnucelem(carma%f_inuc2elem(jefrom,ielem)) = carma%f_nnucelem(carma%f_inuc2elem(jefrom,ielem)) + 1 - carma%f_inucelem(carma%f_nnucelem(carma%f_inuc2elem(jefrom,ielem)),carma%f_inuc2elem(jefrom,ielem)) = ielem - end if - endif - enddo - enddo - - ! Next, enumerate and count elements that nucleate to cores. - do igroup = 1,carma%f_NGROUP - - ip = carma%f_group(igroup)%f_ienconc ! target particle number concentration element - - do jcore = 1,carma%f_group(igroup)%f_ncore - - iecore = carma%f_group(igroup)%f_icorelem(jcore) ! target core element -! carma%f_nnucelem(iecore) = 0 - - do iefrom = 1,carma%f_NELEM - - if( carma%f_if_nuc(iefrom,iecore) ) then - carma%f_nnucelem(iecore) = carma%f_nnucelem(iecore) + 1 - carma%f_inucelem(carma%f_nnucelem(iecore),iecore) = iefrom - endif - enddo ! iefrom=1,NELEM - enddo ! jcore=1,ncore - enddo ! igroup=1,NGROUP - - - ! Now enumerate and count elements nucleating to particle concentration - ! (itype=I_INVOLATILE and itype=I_VOLATILE) and core second moment - ! (itype=I_COREMASS). Elements with itype = I_VOLATILE are special because all - ! nucleation sources for core elements in same group are also sources - ! for the itype = I_VOLATILE element. - do igroup = 1,carma%f_NGROUP - - ip = carma%f_group(igroup)%f_ienconc ! target particle number concentration element - im = carma%f_group(igroup)%f_imomelem ! target core second moment element - -! carma%f_nnucelem(ip) = 0 -! if( im .ne. 0 )then -! carma%f_nnucelem(im) = 0 -! endif - - do jcore = 1,carma%f_group(igroup)%f_ncore - - iecore = carma%f_group(igroup)%f_icorelem(jcore) ! target core mass element - - do jnucelem = 1,carma%f_nnucelem(iecore) ! elements nucleating to cores - - iefrom = carma%f_inucelem(jnucelem,iecore) ! source - - ! For particle concentration target elements, only count source elements - ! that are also particle concentrations. - carma%f_nnucelem(ip) = carma%f_nnucelem(ip) + 1 - carma%f_inucelem(carma%f_nnucelem(ip),ip) = carma%f_group(carma%f_element(iefrom)%f_igroup)%f_ienconc - - if( im .ne. 0 )then - carma%f_nnucelem(im) = carma%f_nnucelem(im) + 1 - carma%f_inucelem(carma%f_nnucelem(im),im) = iefrom - endif - enddo - enddo ! jcore=1,ncore - enddo ! igroup=1,NGROUP - - - ! Now enumerate and count nucleating bins. - do igroup = 1,carma%f_NGROUP ! target group - do ibin = 1,carma%f_NBIN ! target bin - do igfrom = 1,carma%f_NGROUP ! source group - - carma%f_nnucbin(igfrom,ibin,igroup) = 0 - - do ifrom = 1,carma%f_NBIN ! source bin - - if( carma%f_inuc2bin(ifrom,igfrom,igroup) .eq. ibin ) then - carma%f_nnucbin(igfrom,ibin,igroup) = carma%f_nnucbin(igfrom,ibin,igroup) + 1 - carma%f_inucbin(carma%f_nnucbin(igfrom,ibin,igroup),igfrom,ibin,igroup) = ifrom - endif - enddo - enddo ! igfrom=1,NGROUP - enddo ! ibin=1,NBIN=1,NGROUP - enddo ! igroup=1,NGROUP - - if (carma%f_do_print_init) then - - ! Report nucleation mapping arrays (should be 'write' stmts, of course) - - write(carma%f_LUNOPRT,*) ' ' - write(carma%f_LUNOPRT,*) 'Nucleation mapping arrays (setupnuc):' - write(carma%f_LUNOPRT,*) ' ' - write(carma%f_LUNOPRT,*) 'Elements mapping:' - - do ielem = 1,carma%f_NELEM - write(carma%f_LUNOPRT,*) 'ielem,nnucelem=',ielem,carma%f_nnucelem(ielem) - - if(carma%f_nnucelem(ielem) .gt. 0) then - do jfrom = 1,carma%f_nnucelem(ielem) - write(carma%f_LUNOPRT,*) 'jfrom,inucelem= ',jfrom,carma%f_inucelem(jfrom,ielem) - enddo - endif - enddo - - write(carma%f_LUNOPRT,*) ' ' - write(carma%f_LUNOPRT,*) 'Bin mapping:' - - do igfrom = 1,carma%f_NGROUP - do igroup = 1,carma%f_NGROUP - write(carma%f_LUNOPRT,*) ' ' - write(carma%f_LUNOPRT,*) 'Groups (from, to) = ', igfrom, igroup - - do ibin = 1,carma%f_NBIN - nnucb = carma%f_nnucbin(igfrom,ibin,igroup) - if(nnucb .eq. 0) write(carma%f_LUNOPRT,*) ' None for bin ',ibin - if(nnucb .gt. 0) then - write(carma%f_LUNOPRT,*) ' ibin,nnucbin=',ibin,nnucb - write(carma%f_LUNOPRT,*) ' inucbin=',(carma%f_inucbin(j,igfrom,ibin,igroup),j=1,nnucb) - endif - enddo - enddo - enddo - endif - - - ! Check that values are valid. - do ielem = 1, carma%f_NELEM - - if( carma%f_element(ielem)%f_isolute .gt. carma%f_NSOLUTE )then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - component of isolute > NSOLUTE' - rc = RC_ERROR - return - endif - - if( carma%f_ievp2elem(ielem) .gt. carma%f_NELEM )then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - component of ievp2elem > NELEM' - rc = RC_ERROR - return - endif - - ! Check that is consistent with . - if( carma%f_ievp2elem(ielem) .ne. 0 .and. carma%f_element(ielem)%f_itype .eq. I_COREMASS )then - if( carma%f_element(ielem)%f_isolute .ne. carma%f_element(carma%f_ievp2elem(ielem))%f_isolute)then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - isolute and ievp2elem are inconsistent' - rc = RC_ERROR - return - endif - endif - - ! Check that is consistent with . -! igas = carma%f_inucgas( carma%f_element(ielem)%f_igroup ) -! if( igas .ne. 0 )then -! if( carma%f_element(ielem)%f_itype .eq. I_COREMASS .and. carma%f_element(ielem)%f_isolute .eq. 0 )then -! if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - inucgas ne 0 but isolute eq 0' -! rc = RC_ERROR -! return -! endif -! endif - enddo - - do ielem = 1, carma%f_NELEM - if( carma%f_nnuc2elem(ielem) .gt. 0 ) then - do inuc2 = 1, carma%f_nnuc2elem(ielem) - if( carma%f_inuc2elem(inuc2,ielem) .gt. carma%f_NELEM )then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - component of inuc2elem > NELEM' - rc = RC_ERROR - return - endif - enddo - endif - enddo - - ! Particle grids are incompatible if there is no target bin with enough - ! mass to accomodate nucleated particle. - bad_grid = .false. - - do iefrom = 1,carma%f_NELEM ! source element - - igfrom = carma%f_element(iefrom)%f_igroup - neto = carma%f_nnuc2elem(iefrom) - - if( neto .gt. 0 )then - - do inuc2 = 1,neto - ieto = carma%f_inuc2elem(inuc2,iefrom) - igto = carma%f_element(ieto)%f_igroup - - do ifrom = 1,carma%f_NBIN ! source bin - if( carma%f_inuc2bin(ifrom,igfrom,igto) .eq. 0 )then - if ((carma%f_do_print) .and. (carma%f_do_print_init)) write(carma%f_LUNOPRT,7) igfrom,ifrom,igto - bad_grid = .true. - endif - enddo - enddo - endif - enddo - - if (carma%f_do_print_init) then - - if( bad_grid )then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::Warning - incompatible grids for nucleation' - endif - - ! Report some initialization values! - write(carma%f_LUNOPRT,5) - write(carma%f_LUNOPRT,1) 'inucgas ',(carma%f_inucgas(i),i=1,carma%f_NGROUP) - write(carma%f_LUNOPRT,1) 'inuc2elem',(carma%f_inuc2elem(1,i),i=1,carma%f_NELEM) - write(carma%f_LUNOPRT,1) 'ievp2elem',(carma%f_ievp2elem(i),i=1,carma%f_NELEM) - write(carma%f_LUNOPRT,1) 'isolute ',(carma%f_element(i)%f_isolute,i=1,carma%f_NELEM) - - do isol = 1,carma%f_NSOLUTE - write(carma%f_LUNOPRT,2) 'solute number ',isol - write(carma%f_LUNOPRT,3) 'solute name: ',carma%f_solute(isol)%f_name - write(carma%f_LUNOPRT,4) 'molecular weight',carma%f_solute(isol)%f_wtmol - write(carma%f_LUNOPRT,4) 'mass density ',carma%f_solute(isol)%f_rho - enddo - endif - - - ! Initialize indexes for the gases and check to make sure if H2SO4 is used - ! that it occurs after H2O. This is necessary for supersaturation calculations. - carma%f_igash2o = 0 - carma%f_igash2so4 = 0 - carma%f_igasso2 = 0 - carma%f_igashno3 = 0 - - do igas = 1, carma%f_NGAS - if (carma%f_gas(igas)%f_icomposition == I_GCOMP_H2O) then - carma%f_igash2o = igas - else if (carma%f_gas(igas)%f_icomposition == I_GCOMP_H2SO4) then - carma%f_igash2so4 = igas - else if (carma%f_gas(igas)%f_icomposition == I_GCOMP_SO2) then - carma%f_igasso2 = igas - else if (carma%f_gas(igas)%f_icomposition == I_GCOMP_HNO3) then - carma%f_igashno3 = igas - end if - end do - - if ((carma%f_igash2so4 /= 0) .and. (carma%f_igash2o > carma%f_igash2so4)) then - if (carma%f_do_print) write(carma%f_LUNOPRT,*) 'CARMA_InitializeGrowth::ERROR - H2O gas must come before H2SO4.' - rc = RC_ERROR - return - end if - - return - end subroutine CARMA_InitializeGrowth - - !! Calculate the optical properties for each particle bin at each of - !! the specified wavelengths. The optical properties include the - !! extinction efficiency, the single scattering albedo and the - !! asymmetry factor. - !! - !! NOTE: For these calculations, the particles are assumed to be spheres and - !! Mie code is used to calculate the optical properties. - !! - !! @author Chuck Bardeen - !! @version May-2009 - subroutine CARMA_InitializeOptics(carma, rc) - type(carma_type), intent(inout) :: carma - integer, intent(out) :: rc - - integer :: igroup ! group index - integer :: iwave ! wavelength index - integer :: ibin ! bin index - real(kind=f) :: Qext - real(kind=f) :: Qsca - real(kind=f) :: asym - - - ! Assume success. - rc = RC_OK - - ! Were any wavelengths specified? - do iwave = 1, carma%f_NWAVE - do igroup = 1, carma%f_NGROUP - - ! Should we calculate mie properties for this group? - if (carma%f_group(igroup)%f_do_mie) then - - do ibin = 1, carma%f_NBIN - - ! Assume the particle is homogeneous (no core). - ! - ! NOTE: The miess does not converge over as broad a - ! range of input parameters as bhmie, but it can handle - ! coated spheres. - - call mie(carma, & - carma%f_group(igroup)%f_imiertn, & - carma%f_group(igroup)%f_r(ibin), & - carma%f_wave(iwave), & - carma%f_group(igroup)%f_nmon(ibin), & - carma%f_group(igroup)%f_df(ibin), & - carma%f_group(igroup)%f_rmon, & - carma%f_group(igroup)%f_falpha, & - carma%f_group(igroup)%f_refidx(iwave), & - Qext, & - Qsca, & - asym, & - rc) - - if (rc < RC_OK) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "CARMA_InitializeOptics::& - &Mie failed for (band, wavelength, group, bin)", & - iwave, carma%f_wave(iwave), igroup, ibin - end if - return - end if - - carma%f_group(igroup)%f_qext(iwave, ibin) = Qext - carma%f_group(igroup)%f_ssa(iwave, ibin) = Qsca / Qext - carma%f_group(igroup)%f_asym(iwave, ibin) = asym - - end do - end if - end do - end do - - return - end subroutine CARMA_InitializeOptics - - !! Perform initialization of variables related to thermodynamical calculations that - !! are not dependent on the model state. - !! - !! @author Chuck Bardeen - !! @version May-2009 - subroutine CARMA_InitializeThermo(carma, rc) - type(carma_type), intent(inout) :: carma - integer, intent(out) :: rc - - ! Assume success. - rc = RC_OK - - return - end subroutine CARMA_InitializeThermo - - !! Perform initialization of variables related to vertical transport that are not dependent - !! on the model state. - !! - !! @author Chuck Bardeen - !! @version May-2009 - subroutine CARMA_InitializeVertical(carma, rc, vf_const) - type(carma_type), intent(inout) :: carma - integer, intent(out) :: rc - real(kind=f), intent(in), optional :: vf_const - - ! Assume success. - rc = RC_OK - - ! Was a constant vertical velocity specified? - carma%f_ifall = 1 - carma%f_vf_const = 0._f - - if (present(vf_const)) then - if (vf_const /= 0._f) then - carma%f_ifall = 0 - carma%f_vf_const = vf_const - end if - end if - - ! Specify the boundary conditions for vertical transport. - carma%f_itbnd_pc = I_FIXED_CONC - carma%f_ibbnd_pc = I_FIXED_CONC - - return - end subroutine CARMA_InitializeVertical - - !! The routine should be called when the carma object is no longer needed. It deallocates - !! any memory allocations made by CARMA (during CARMA_Create()), and failure to call this - !!routine could result in memory leaks. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMA_Create - subroutine CARMA_Destroy(carma, rc) - use carmaelement_mod - use carmagas_mod - use carmagroup_mod - use carmasolute_mod - - type(carma_type), intent(inout) :: carma - integer, intent(out) :: rc - - ! Local variables - integer :: ier - integer :: igroup - integer :: ielem - integer :: isolute - integer :: igas - - ! Assume success. - rc = RC_OK - - ! If allocated, deallocate all the variables that were allocated in the Create() method. - if (allocated(carma%f_group)) then - do igroup = 1, carma%f_NGROUP - call CARMAGROUP_Destroy(carma, igroup, rc) - if (rc < 0) return - end do - - deallocate( & - carma%f_group, & - carma%f_icoag, & - carma%f_inucgas, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating groups, status=", ier - rc = RC_ERROR - endif - endif - - if (allocated(carma%f_element)) then - do ielem = 1, carma%f_NELEM - call CARMAELEMENT_Destroy(carma, ielem, rc) - if (rc < RC_OK) return - end do - - deallocate( & - carma%f_element, & - carma%f_igrowgas, & - carma%f_inuc2elem, & - carma%f_inucproc, & - carma%f_ievp2elem, & - carma%f_nnuc2elem, & - carma%f_nnucelem, & - carma%f_inucelem, & - carma%f_if_nuc, & - carma%f_rlh_nuc, & - carma%f_icoagelem, & - carma%f_icoagelem_cm, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating elements, status=", ier - rc = RC_ERROR - endif - endif - - if (allocated(carma%f_inuc2bin)) then - deallocate( & - carma%f_inuc2bin, & - carma%f_ievp2bin, & - carma%f_nnucbin, & - carma%f_inucbin, & - carma%f_diffmass, & - carma%f_volx, & - carma%f_ilow, & - carma%f_jlow, & - carma%f_iup, & - carma%f_jup, & - carma%f_npairl, & - carma%f_npairu, & - carma%f_iglow, & - carma%f_jglow, & - carma%f_igup, & - carma%f_jgup, & - carma%f_kbin, & - carma%f_pkernel, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating bins, status=", ier - rc = RC_ERROR - endif - endif - - if (carma%f_NSOLUTE > 0) then - do isolute = 1, carma%f_NSOLUTE - call CARMASOLUTE_Destroy(carma, isolute, rc) - if (rc < RC_OK) return - end do - - if (allocated(carma%f_solute)) then - deallocate( & - carma%f_solute, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating solutes, status=", ier - rc = RC_ERROR - endif - endif - end if - - if (carma%f_NGAS > 0) then - do igas = 1, carma%f_NGAS - call CARMAGAS_Destroy(carma, igas, rc) - if (rc < RC_OK) return - end do - - if (allocated(carma%f_gas)) then - deallocate( & - carma%f_gas, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating gases, status=", ier - rc = RC_ERROR - endif - endif - end if - - if (carma%f_NWAVE > 0) then - if (allocated(carma%f_wave)) then - deallocate( & - carma%f_wave, & - carma%f_dwave, & - carma%f_do_wave_emit, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_Destroy: ERROR deallocating wavelengths, status=", ier - rc = RC_ERROR - return - endif - endif - endif - - return - end subroutine CARMA_Destroy - - ! Configuration - - !! Add a coagulation process between two groups (igroup1 and igroup2), with the resulting - !! particle being in the destination group (igroup3). If ck0 is specifed, then a constant - !! coagulation kernel will be used. - subroutine CARMA_AddCoagulation(carma, igroup1, igroup2, igroup3, icollec, rc, ck0, grav_e_coll0) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igroup1 !! first source group - integer, intent(in) :: igroup2 !! second source group - integer, intent(in) :: igroup3 !! destination group - integer, intent(in) :: icollec !! collection technique [I_COLLEC_CONST | I_COLLEC_FUCHS | I_COLLEC_DATA] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), intent(in), optional :: ck0 !! if specified, forces a constant coagulation kernel - real(kind=f), intent(in), optional :: grav_e_coll0 !! if icollec is I_COLLEC_CONST - !! the constant gravitational collection efficiency - - ! Assume success. - rc = RC_OK - - ! Make sure the groups exists. - if (igroup1 > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, '(a,i3,a,i3,a)') "CARMA_AddCoagulation:: ERROR - The specifed group (", & - igroup1, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - if (igroup2 > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, '(a,i3,a,i3,a)') "CARMA_AddCoagulation:: ERROR - The specifed group (", & - igroup2, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - if (igroup3 > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, '(a,i3,a,i3,a)') "CARMA_AddCoagulation:: ERROR - The specifed group (", & - igroup3, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - ! Indicate that the groups coagulate together. - carma%f_icoag(igroup1, igroup2) = igroup3 - - ! If ck0 was specified, then we use a fixed coagulation rate of ck0. - if (present(ck0)) then - carma%f_ck0 = ck0 - carma%f_icoagop = I_COAGOP_CONST - else - carma%f_icoagop = I_COAGOP_CALC - end if - - ! What collection technique is specified. - if (icollec > I_COLLEC_DATA) then - if (carma%f_do_print) write(carma%f_LUNOPRT, '(a,i3,a)') "CARMA_AddCoagulation:: ERROR - The specifed collection method (", & - icollec, ") is unknown." - rc = RC_ERROR - return - end if - - if (icollec == I_COLLEC_CONST) then - if (present(grav_e_coll0)) then - carma%f_grav_e_coll0 = grav_e_coll0 - else - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "CARMA_AddCoagulation::& - &ERROR - A constant gravitational collection was requests, & - &but grav_e_coll0 was not provided." - end if - rc = RC_ERROR - return - end if - end if - - carma%f_icollec = icollec - - return - end subroutine CARMA_AddCoagulation - - !! Add a growth process between the element (ielem) and gas (igas) specifed. The element - !! and gas should have already been defined using CARMA_AddElement() and CARMA_AddGas(). - !! - !! NOTE: Each element can only have one volatile component. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMA_AddElement - !! @see CARMA_AddGas - subroutine CARMA_AddGrowth(carma, ielem, igas, rc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: ielem !! the element index - integer, intent(in) :: igas !! the gas index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Assume success. - rc = RC_OK - - ! Make sure the element exists. - if (ielem > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddGrowth:: ERROR - The specifed element (", & - ielem, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough gases allocated. - if (igas > carma%f_NGAS) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddGrowth:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - ! If not already defined, indicate that the element can grow with the specified gas. - if (carma%f_igrowgas(ielem) /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddGrowth:: ERROR - The specifed element (", & - ielem, ") already has gas (", carma%f_igrowgas(ielem), ") condensing on it." - rc = RC_ERROR - return - else - carma%f_igrowgas(ielem) = igas - end if - - return - end subroutine CARMA_AddGrowth - - !! Add a nucleation process that nucleates one element (elemfrom) to another element (elemto) - !! using the specified gas (igas). The elements and gas should have already been defined - !! using CARMA_AddElement() and CARMA_AddGas(). The nucleation scheme is indicated by - !! inucproc, and can be one of: - !! - !! - I_DROPACT - !! - I_AERFREEZE - !! - I_DROPFREEZE - !! - I_ICEMELT - !! - I_HETNUC - !! - I_HOMNUC - !! - !! There are multiple parameterizations for I_AERFREEZE, so when that is selected the - !! particular parameterization needs to be indicated by adding it to I_AERFREEZE. The - !! specific routines are: - !! - !! - I_AF_TABAZADEH_2000 - !! - I_AF_KOOP_2000 - !! - I_AF_MOHLER_2010 - !! - I_AF_MURRAY_2010 - !! - !! One or more of these routines may be selected, but in general one of the first - !! three should be selected and then it can optionally be combined with the glassy - !! aerosols (I_AF_MURRAY_2010). - !! - !! Total evaporation transfers particle mass from the destination element back to the - !! element indicated by ievp2elem. This relationship is not automatically generated, - !! because multiple elements can nucleate to a particular element and therefore the - !! reverse mapping is not unique. - !! - !! NOTE: The gas used for nucleation must be the same for all nucleation defined from - !! elements of the same group. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see I_DROPACT - !! @see I_AERFREEZE - !! @see I_DROPFREEZE - !! @see I_ICEMELT - !! @see I_HETNUC - !! @see I_HOMNUC - !! @see I_AF_TABAZADEH_2000 - !! @see I_AF_KOOP_2000 - !! @see I_AF_MOHLER_2010 - !! @see I_AF_MURRAY_2010 - !! @see CARMA_AddElement - !! @see CARMA_AddGas - subroutine CARMA_AddNucleation(carma, ielemfrom, ielemto, inucproc, & - rlh_nuc, rc, igas, ievp2elem) - - use carmaelement_mod, only : CARMAELEMENT_Get - - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: ielemfrom !! the source element - integer, intent(in) :: ielemto !! the destination element - integer, intent(in) :: inucproc !! the nucleation process - !! [I_DROPACT | I_AERFREEZE | I_ICEMELT | I_HETNUC | I_HOMNUC] - real(kind=f), intent(in) :: rlh_nuc !! the latent heat of nucleation [cm2/s2] - integer, intent(out) :: rc !! return code, negative indicated failure - integer, optional, intent(in) :: igas !! the gas - integer, optional, intent(in) :: ievp2elem !! the element created upon evaporation - - integer :: igroup !! group for source element - - ! Assume success. - rc = RC_OK - - ! Make sure the elements exist. - if (ielemfrom > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddNucleation:: ERROR - The specifed element (", & - ielemfrom, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - if (ielemto > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddNucleation:: ERROR - The specifed element (", & - ielemto, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - if (present(ievp2elem)) then - if (ievp2elem > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddNucleation:: ERROR - The specifed element (", & - ievp2elem, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - end if - - - ! Make sure there are enough gases allocated. - if (present(igas)) then - if (igas > carma%f_NGAS) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMA_AddNucleation:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - end if - - - ! If aerosol freezing is selected, but no I_AF_xxx sub-method is selected, then indicate an error. - if (inucproc == I_AERFREEZE) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "CARMA_AddNucleation::& - &ERROR - I_AERFREEZE was specified without an I_AF_xxx value." - end if - return - end if - - - ! Array maps a particle group to its associated gas for nucleation: - ! Nucleation from group is associated with gas - ! Set to zero if particles are not subject to nucleation. - if (present(igas)) then - call CARMAELEMENT_Get(carma, ielemfrom, rc, igroup=igroup) - - if (rc >= RC_OK) then - carma%f_inucgas(igroup) = igas - end if - end if - - - ! Nucleation transfers particle mass from element to element - ! , where ranges from 0 to the number of elements - ! nucleating from . -! carma%f_nnucelem(ielemto) = carma%f_nnucelem(ielemto) + 1 -! carma%f_inucelem(carma%f_nnucelem(ielemto), ielemto) = ielemfrom - carma%f_nnuc2elem(ielemfrom) = carma%f_nnuc2elem(ielemfrom) + 1 - carma%f_inuc2elem(carma%f_nnuc2elem(ielemfrom), ielemfrom) = ielemto -! carma%f_if_nuc(ielemfrom,carma%f_inuc2elem(carma%f_nnuc2elem(ielemfrom), ielemfrom)) = .true. - - ! specifies what nucleation process nucleates - ! particles from element to element : - ! I_DROPACT: Aerosol activation to droplets - ! I_AERFREEZE: Aerosol homogeneous freezing - ! I_DROPFREEZE: Droplet homogeneous freezing - ! I_GLFREEZE: Glassy Aerosol heteroogeneous freezing - ! I_GLAERFREEZE: Glassy & Aerosol freezing - carma%f_inucproc(ielemfrom, ielemto) = inucproc - - - ! Total evaporation mapping: total evaporation transfers particle mass from - ! element to element . - ! - ! NOTE: This array is not automatically derived from because multiple - ! elements can nucleate to a particular element (reverse mapping is not - ! unique). - if (present(ievp2elem)) carma%f_ievp2elem(ielemto) = ievp2elem - - - ! is the latent heat released by nucleation - ! from element to element [cm^2/s^2]. - carma%f_rlh_nuc(ielemfrom,ielemto) = rlh_nuc - - return - end subroutine - - - ! Query, Control and State I/O - - !! Gets the information about the carma object. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMA_Create - subroutine CARMA_Get(carma, rc, LUNOPRT, NBIN, NELEM, NGAS, NGROUP, NSOLUTE, NWAVE, do_detrain, & - do_drydep, do_fixedinit, do_grow, do_print, do_print_init, do_thermo, wave, dwave, do_wave_emit, & - do_partialinit) - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(out) :: rc !! return code, negative indicates failure - integer, optional, intent(out) :: NBIN !! number of radius bins per group - integer, optional, intent(out) :: NELEM !! total number of elements - integer, optional, intent(out) :: NGROUP !! total number of groups - integer, optional, intent(out) :: NSOLUTE !! total number of solutes - integer, optional, intent(out) :: NGAS !! total number of gases - integer, optional, intent(out) :: NWAVE !! number of wavelengths - integer, optional, intent(out) :: LUNOPRT !! logical unit number for output - logical, optional, intent(out) :: do_detrain !! do detrainement? - logical, optional, intent(out) :: do_drydep !! do dry deposition? - logical, optional, intent(out) :: do_fixedinit !! do initialization from reference atm? - logical, optional, intent(out) :: do_grow !! do condensational growth? - logical, optional, intent(out) :: do_partialinit !! do initialization of coagulation from reference atm? - logical, optional, intent(out) :: do_print !! do print output? - logical, optional, intent(out) :: do_print_init !! do print initialization output? - logical, optional, intent(out) :: do_thermo !! do thermodynamics? - real(kind=f), optional, intent(out) :: wave(carma%f_NWAVE) !! the wavelengths centers (cm) - real(kind=f), optional, intent(out) :: dwave(carma%f_NWAVE) !! the wavelengths widths (cm) - logical, optional, intent(out) :: do_wave_emit(carma%f_NWAVE) !! do emission in this band? - - ! Assume success. - rc = RC_OK - - if (present(LUNOPRT)) LUNOPRT = carma%f_LUNOPRT - if (present(NBIN)) NBIN = carma%f_NBIN - if (present(NELEM)) NELEM = carma%f_NELEM - if (present(NGAS)) NGAS = carma%f_NGAS - if (present(NGROUP)) NGROUP = carma%f_NGROUP - if (present(NSOLUTE)) NSOLUTE = carma%f_NSOLUTE - if (present(NWAVE)) NWAVE = carma%f_NWAVE - - if (present(do_detrain)) do_detrain = carma%f_do_detrain - if (present(do_drydep)) do_drydep = carma%f_do_drydep - if (present(do_grow)) do_grow = carma%f_do_grow - if (present(do_fixedinit)) do_fixedinit = carma%f_do_fixedinit - if (present(do_partialinit)) do_partialinit = carma%f_do_partialinit - if (present(do_print)) do_print = carma%f_do_print - if (present(do_print_init)) do_print_init = carma%f_do_print_init - if (present(do_thermo)) do_thermo = carma%f_do_thermo - - if (present(wave)) wave(:) = carma%f_wave(:) - if (present(dwave)) dwave(:) = carma%f_dwave(:) - if (present(do_wave_emit)) do_wave_emit(:) = carma%f_do_wave_emit(:) - - return - end subroutine CARMA_Get - -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_precision_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carma_precision_mod.F90 deleted file mode 100644 index a8835982..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_precision_mod.F90 +++ /dev/null @@ -1,47 +0,0 @@ -module carma_precision_mod - - implicit none - -#ifdef SINGLE - - ! For floats commonly referred to as 'real' - ! -at least 6 places of precision past the decimal - ! -must span at least 10**(-37) to 10**(37) - integer, parameter :: f = selected_real_kind(6,37) - real(kind=f), parameter :: powmax = 85._f - -#else - - ! For floats commonly referred to as 'double precision' - ! -at least 15 places of precision past the decimal - ! -must span at least 10**(-307) to 10**(307) - - integer, parameter :: f = selected_real_kind(15,307) - real(kind=f), parameter :: powmax = 706._f - -#endif - - ! Precision control strategy - ! JAS CU-Boulder June 8, 2006 - ! - ! I imagine using these statements bracketed with some CPP statements - ! to control the overall precision of a model. All variables would be - ! declared as real(f). All physical constants would have a - ! a suffix of _f, e.g. 2._f, to force them into the proper precision. - ! - ! I do wonder if it would be more accurate to declare variables as - ! real( kind=f ), but real(f) is how Chivers and Sleightholme - ! declare in their F90 text. - ! - ! Both real(f) and real( kind=f ) seem to work, but I'm more comfortable - ! with real( kind=f ), so I'm using that in all declarations. - - !-- - ! Numerical constants - !! Define 1 in the specified precision. - real(kind=f), parameter :: ONE = 1._f - - !! Define smallest possible number such that ONE + ALMOST_ZERO > ONE - real(kind=f), parameter :: ALMOST_ZERO = epsilon( ONE ) - real(kind=f), parameter :: ALMOST_ONE = ONE - ALMOST_ZERO -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carma_types_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carma_types_mod.F90 deleted file mode 100644 index 7aa834ca..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carma_types_mod.F90 +++ /dev/null @@ -1,823 +0,0 @@ -!! This module defines types used in the CARMA module. The types need to be defined here -!! to avoid circular references between different modules (e.g. carma_mod and -!! carmastate_mod). -!! -!! NOTE: All the field members are prefixed by f_. This is done because of the macros that -!! are used to map between the older F77 common block names for variables to the newer F90 -!! structure member names for the fields. This is done in carma_globaer.h to keep the core -!! CARMA code looking similar to the F77 code to make it easier for scientists with CARMA -!! experience to port their code. Some compilers (e.g Portland Group) have preprocessors -!! that will fail to handle the macros in carma_globaer.h properly resulting in recursion -!! errors during compiling. By making the field member name different, the recursion -!! problems should be avoided. -!! -!! @version July-2009 -!! @author Chuck Bardeen -module carma_types_mod - use carma_precision_mod - use carma_constants_mod - - !! The CARMAELEMENT data type represents one of the components of a cloud or aerosol particle. - !! - !! The procedure for adding a variable to the CARMAELEMENT data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the appropriate create or initialization routine. - !! - Deallocate the variable in the approprate finalize and destroy routines. - !! - Add an alias for the variable to carma_globaer.h and associate it with the variable - !! in this typedef. - !! - !! NOTE: While the carmaelement_type is public, routines outside of the CARMA module should not look - !! at or manuipulate fields of this structure directly. There should be CARMAELEMENT_XXX methods - !! to do anything that is needed with this structure, and use of these methods will allow - !! the CARMAELEMENT data type structure to evolve without impacting code in the parent model. - !! The contents of the structure had to be made public, since the CARMA microphysics - !! routines are implemented in separate files outside of this model; however, logically - !! they are part of the model and are the only routines outside of this module that should - !! access fields of this structure directly. - type, public :: carmaelement_type - - ! name Name of the element - ! shortname Short name of the element - ! rho Mass density of particle element [g/cm^3] - ! igroup Group to which the element belongs - ! itype Particle type specification - ! icomposition Particle compound specification - ! isolute Index of solute for the particle element - ! - character(len=CARMA_NAME_LEN) :: f_name - character(len=CARMA_SHORT_NAME_LEN) :: f_shortname - real(kind=f), allocatable, dimension(:) :: f_rho ! (NBIN) - integer :: f_igroup - integer :: f_itype - integer :: f_icomposition - integer :: f_isolute - end type carmaelement_type - - - !! The CARMAGAS data type represents a gas. - !! - !! The procedure for adding a variable to the CARMAGAS data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the appropriate create or initialization routine. - !! - Deallocate the variable in the approprate finalize and destroy routines. - !! - Add an alias for the variable to carma_globaer.h and associate it with the variable - !! in this typedef. - !! - !! NOTE: While the carmagas_type is public, routines outside of the CARMA module should not look - !! at or manuipulate fields of this structure directly. There should be CARMAGAS_XXX methods - !! to do anything that is needed with this structure, and use of these methods will allow - !! the CARMAGAS data type structure to evolve without impacting code in the parent model. - !! The contents of the structure had to be made public, since the CARMA microphysics - !! routines are implemented in separate files outside of this model; however, logically - !! they are part of the model and are the only routines outside of this module that should - !! access fields of this structure directly. - type, public :: carmagas_type - - ! name Name of the gas - ! shortname Short name of the gas - ! wtmol Molecular weight for the gas [g/mol] - ! ivaprtn vapor pressure routine for the gas - ! dgc_threshold convergence criteria for gas concentration [fraction] - ! ds_threshold convergence criteria for gas saturation [fraction] - ! - character(len=CARMA_NAME_LEN) :: f_name - character(len=CARMA_SHORT_NAME_LEN) :: f_shortname - real(kind=f) :: f_wtmol - integer :: f_ivaprtn - integer :: f_icomposition - real(kind=f) :: f_dgc_threshold - real(kind=f) :: f_ds_threshold - end type carmagas_type - - - !! The CARMAGROUP data type represents a cloud or aerosol partcile. - !! - !! The procedure for adding a variable to the CARMAGROUP data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the appropriate create or initialization routine. - !! - Deallocate the variable in the approprate finalize and destroy routines. - !! - Add an alias for the variable to carma_globaer.h and associate it with the variable - !! in this typedef. - !! - !! NOTE: While the carmagroup_type is public, routines outside of the CARMA module should not look - !! at or manuipulate fields of this structure directly. There should be CARMAGROUP_XXX methods - !! to do anything that is needed with this structure, and use of these methods will allow - !! the CARMAGROUP data type structure to evolve without impacting code in the parent model. - !! The contents of the structure had to be made public, since the CARMA microphysics - !! routines are implemented in separate files outside of this model; however, logically - !! they are part of the model and are the only routines outside of this module that should - !! access fields of this structure directly. - type, public :: carmagroup_type - - ! name Name of the particle - ! shortname Short name of the particle - ! cnsttype constituent type [I_CNSTTYPE_PROGNOSTIC | I_CNSTTYPE_DIAGNOSTIC] - ! maxbin the last prognostic bin in the group - ! nelem Number of elements in group - ! ncore Number of core elements (itype = 2) in group - ! ishape Describes particle shape for group - ! ienconc Particle number conc. element for group - ! imomelem Scondary moment element for group - ! icorelem Core elements (itype = 2) in group - ! solfac Solubility factor for wet deposition - ! is_fractal If .true. then particle is fractal - ! is_ice If .true. then ice particle - ! is_cloud If .true. then cloud particle - ! is_sulfate If .true. then sulfate particle - ! do_mie If .true. then do mie calculations - ! do_wetdep If .true. then do wet deposition - ! grp_do_drydep If .true. then do dry deposition - ! grp_do_vtran If .true. then do sedimentation - ! scavcoef Scavenging coefficient for wet deopistion (1/mm) - ! if_sec_mom If .true. then core second moment (itype = 3) used {setupgrow} - ! irhswell Indicates method for swelling particles from RH - ! irhswcomp Indicates composition for swelling particles from RH - ! rmin Radius of particle in first bin [cm] - ! rmassmin Mass of particle in first bin [g] - ! rmrat Ratio of masses of particles in consecutive bins - ! eshape Ratio of particle length / diameter - ! r Radius bins [cm] - ! rmass Mass bins [g] - ! rrat Ratio of maximum diameter to diameter of equivalent sphere - ! rprat Ratio of mobility diameter of a porous particle to diameter of equivlent sphere - ! arat Ratio of projected area to projected area of containing sphere - ! vol Particle volume [cm^3] - ! dr Width of bins in radius space [cm] - ! dm Width of bins in mass space [g] - ! rmassup Upper bin boundary mass [g] - ! rup Upper bin boundary radius [cm] - ! rlow Lower bin boundary radius [cm] - ! refidx refractive index - ! qext extinction efficiency - ! ssa single scattering albedo - ! asym asymmetry factor - ! ifallrtn routine to use to calculate fall velocity [I_FALLRTN_...] - ! imiertn mie routine for optical properties [I_MIERTN_...] - ! dpc_threshold convergence criteria for particle concentration [fraction] - ! rmon monomer radius of fractal particles [cm] - ! df fractal dimension for fractal particles - ! nmon number of monomers per particle - ! falpha fractal packing coefficient - ! neutral_volfrc volume fraction of core mass to neutralize the particle - - character(len=CARMA_NAME_LEN) :: f_name - character(len=CARMA_SHORT_NAME_LEN) :: f_shortname - integer :: f_cnsttype - integer :: f_maxbin - integer :: f_nelem - integer :: f_ncore - integer :: f_ishape - integer :: f_ienconc - integer :: f_imomelem - real(kind=f) :: f_solfac - real(kind=f) :: f_scavcoef - logical :: f_if_sec_mom - logical :: f_is_fractal - logical :: f_is_ice - logical :: f_is_cloud - logical :: f_is_sulfate - logical :: f_do_mie - logical :: f_do_wetdep - logical :: f_grp_do_drydep - logical :: f_grp_do_vtran - integer :: f_irhswell - integer :: f_irhswcomp - integer :: f_ifallrtn - integer :: f_imiertn - real(kind=f) :: f_rmin - real(kind=f) :: f_rmassmin - real(kind=f) :: f_rmrat - real(kind=f) :: f_eshape - real(kind=f), allocatable, dimension(:) :: f_r ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rmass ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_vol ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_dr ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_dm ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rmassup ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rup ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rlow ! (NBIN) - complex(kind=f), allocatable, dimension(:) :: f_refidx ! (NWAVE) - real(kind=f), allocatable, dimension(:,:) :: f_qext ! (NWAVE,NBIN) - real(kind=f), allocatable, dimension(:,:) :: f_ssa ! (NWAVE,NBIN) - real(kind=f), allocatable, dimension(:,:) :: f_asym ! (NWAVE,NBIN) - integer, allocatable, dimension(:) :: f_icorelem ! (NELEM) - real(kind=f), allocatable, dimension(:) :: f_arat ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rrat ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_rprat ! (NBIN) - real(kind=f) :: f_dpc_threshold - real(kind=f) :: f_rmon - real(kind=f), allocatable, dimension(:) :: f_df ! (NBIN) - real(kind=f), allocatable, dimension(:) :: f_nmon ! (NBIN) - real(kind=f) :: f_falpha - real(kind=f) :: f_neutral_volfrc - end type carmagroup_type - - - !! The CARMASOLUTE data type represents a gas. - !! - !! The procedure for adding a variable to the CARMASOLUTE data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the appropriate create or initialization routine. - !! - Deallocate the variable in the approprate finalize and destroy routines. - !! - Add an alias for the variable to carma_globaer.h and associate it with the variable - !! in this typedef. - !! - !! NOTE: While the carmagas_type is public, routines outside of the CARMA module should not look - !! at or manuipulate fields of this structure directly. There should be CARMASOLUTE_XXX methods - !! to do anything that is needed with this structure, and use of these methods will allow - !! the CARMASOLUTE data type structure to evolve without impacting code in the parent model. - !! The contents of the structure had to be made public, since the CARMA microphysics - !! routines are implemented in separate files outside of this model; however, logically - !! they are part of the model and are the only routines outside of this module that should - !! access fields of this structure directly. - type, public :: carmasolute_type - - ! name Name of the solute - ! shortname Short name of the solute - ! ions Number of ions solute dissociates into - ! wtmol Molecular weight of solute - ! rho Mass density of solute - ! - character(len=CARMA_NAME_LEN) :: f_name - character(len=CARMA_SHORT_NAME_LEN) :: f_shortname - integer :: f_ions - real(kind=f) :: f_wtmol - real(kind=f) :: f_rho - end type carmasolute_type - - - !! The CARMA data type replaces the common blocks that were used in the F77 version of - !! CARMA. This allows the code to be written to allow for multiple threads to call CARMA - !! routines simulataneously. This thread safety is necessary for to run CARMA under OPEN/MP. - !! - !! The procedure for adding a variable to the CARMA data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the appropriate create or initialization routine. - !! - Deallocate the variable in the approprate finalize and destroy routines. - !! - Add an alias for the variable to carma_globaer.h and associate it with the variable - !! in this typedef. - !! - !! NOTE: While the carmatype is public, routines outside of the CARMA module should not look - !! at or manuipulate fields of this structure directly. There should be CARMA_XXX methods - !! to do anything that is needed with this structure, and use of these methods will allow - !! the CARMA data type structure to evolve without impacting code in the parent model. - !! The contents of the structure had to be made public, since the CARMA microphysics - !! rountines are implemented in separate files outside of this model; however, logically - !! they are part of the model and are the only routines outside of this module that should - !! access fields of this structure directly. - type, public :: carma_type - - ! Model Dimensions - ! - ! NGROUP number of particle groups - ! NELEM number of particle components (elements) - ! NBIN number of size bins per element - ! NGAS number of gases (may be 0) - ! NSOLUTE number of solutes (may be 0) - ! NWAVE number of wavelength bands (may be 0) - ! - integer :: f_NGROUP - integer :: f_NELEM - integer :: f_NBIN - integer :: f_NGAS - integer :: f_NSOLUTE - integer :: f_NWAVE - - ! Output logical unit numbers - ! - ! NOTE: CARMA will not directly access files or keep track of file names. It is the - ! parent model's responsibility to provide the logical unit number to be used for - ! model output. - ! - integer :: f_LUNOPRT ! output print file - - ! Model startup control variables - ! - ! do_print .t. if print output is desired - ! - logical :: f_do_print - - - ! Configuration Objects - ! - ! These are all other objects that are parts of the CARMA model. This is - ! an attempt to break up the large common block that has historically been - ! the structure of CARMA so the code is easier to understand and to - ! maintain. - ! - ! element Particle component - ! gas Gas - ! group Particle - ! solute Element solute - ! - ! NOTE: In the future, it may make sense to create objects that represent - ! the CARMA processes. This would encapsulate all the variables related to - ! a particular process into one structure. Candidate processes include: - ! transport, growth, nucleation, coagulation, ... - ! - type(carmaelement_type), allocatable, dimension(:) :: f_element ! (NELEM) - type(carmagas_type), allocatable, dimension(:) :: f_gas ! (NGAS) - type(carmagroup_type), allocatable, dimension(:) :: f_group ! (NGROUP) - type(carmasolute_type), allocatable, dimension(:) :: f_solute ! (NSOLUTE) - - - - ! Model option & control variables - ! - ! conmax Minumum relative concentration to consider in varstep {prestep} - ! icoag Coagulation mapping array {setupcoag} - ! icoagelem Coagulation element mapping array {setupcoag} - ! icoagelem_cm Coagulation element mapping array for second mom {setupcoag} - ! ifall Fall velocity options {setupvfall} - ! icoagop Coagulation kernel options {setupckern} - ! icollec Gravitational collection options {setupckern} - ! itbnd_pc Top boundary condition flag for particles {init} - ! ibbnd_pc Bottom boundary condition flag for particles {init} - ! do_vdiff If .true. then do Brownian diffusion {init} - ! do_coag If .true. then do coagulation {init} - ! do_detrain If .true. then do detrainment {init} - ! do_drydep If .true. then do dry deposition {init} - ! do_fixedinitIf .true. then do initialize from reference atm {init} - ! do_grow If .true. then do condensational growth and evap. {init} - ! do_clearsky If .true. then do clear sky growth and coagulation {init} - ! do_incloud If .true. then do incloud growth and coagulation {init} - ! do_explised If .true. then do sedimentation with substepping {init} - ! do_partialinit If .true. then do initialize coagulation from reference atm {init} - ! do_pheat If .true. then do particle heating for growth rates {init} - ! do_pheatatm If .true. then do particle heating on atmosphere {init} - ! do_print_init If .true. then do print initializtion info {init} - ! do_step if .true. then varstepping succeeded {init} - ! do_substep if .true. then use substepping {init} - ! do_pfast if .true. then use microfast parameterization {init} - ! do_thermo if .true. then do solve thermodynamic equation {init} - ! do_vdiff If .true. then do Brownian diffusion {init} - ! do_vtran If .true. then do vertical transport {init} - ! do_cnst_rlh If .true. then uses constants for rlhe and rlhm {setupgrow} - ! igrowgas Gas that condenses into a particle element {setupgrow} - ! inucgas Gas that nucleates a particle group {setupnuc} - ! if_nuc Nucleation conditional array {setupaer} - ! inucproc Nucleation conditional array {setupaer} - ! nnuc2elem Number of elements that nucleate to element {setupnuc} - ! inuc2elem Nucleation transfers particles into element inuc2elem {setupnuc} - ! ievp2elem Total evap. transfers particles into group ievp2elem {setupnuc} - ! ievp2bin Total evap. transfers particles into bin ievp2bin {setupnuc} - ! inuc2bin Nucleation transfers particles into bin inuc2bin {setupnuc} - ! maxsubsteps Maximum number of time substeps allowed - ! minsubsteps Maximum number of time substeps allowed - ! maxretries Maximum number of substepping retries allowed - ! igash2o gas index for H2O - ! igash2so4 gas index for H2SO4 - ! igasso2 gas index for SO2 - ! dt_threshold convergence criteria for temperature [fraction] - ! cstick accommodation coefficient - coagulation - ! gsticki accommodation coefficient - growth (ice), default = 0.93 - ! gstickl accommodation coefficient - growth (liquid), default = 1.0 - ! tstick accommodation coefficient - temperature, default = 1.0 - ! - logical :: f_do_vdiff - logical :: f_do_drydep - logical :: f_do_coag - logical :: f_do_detrain - logical :: f_do_fixedinit - logical :: f_do_grow - logical :: f_do_clearsky - logical :: f_do_incloud - logical :: f_do_vtran - logical :: f_do_explised - logical :: f_do_partialinit - logical :: f_do_pheat - logical :: f_do_pheatatm - logical :: f_do_print_init - logical :: f_do_step - logical :: f_do_substep - logical :: f_do_pfast - logical :: f_do_thermo - logical :: f_do_cnst_rlh - logical, allocatable, dimension(:,:) :: f_if_nuc !(NELEM,NELEM) - real(kind=f) :: f_conmax - integer :: f_igash2o - integer :: f_igash2so4 - integer :: f_igasso2 - integer :: f_igashno3 - integer :: f_maxsubsteps - integer :: f_minsubsteps - integer :: f_maxretries - integer :: f_ifall - integer :: f_icoagop - integer :: f_icollec - integer :: f_itbnd_pc - integer :: f_ibbnd_pc - integer, allocatable, dimension(:) :: f_inucgas ! NGROUP - integer, allocatable, dimension(:) :: f_igrowgas ! NELEM - integer, allocatable, dimension(:) :: f_nnuc2elem ! NELEM - integer, allocatable, dimension(:) :: f_ievp2elem ! NELEM - integer, allocatable, dimension(:) :: f_nnucelem ! NELEM - integer, allocatable, dimension(:,:) :: f_icoag ! (NGROUP,NGROUP) - integer, allocatable, dimension(:,:) :: f_inucproc ! (NELEM,NELEM) - integer, allocatable, dimension(:,:) :: f_inuc2elem ! (NELEM,NELEM) - integer, allocatable, dimension(:,:) :: f_icoagelem ! (NELEM,NGROUP) - integer, allocatable, dimension(:,:) :: f_icoagelem_cm ! (NELEM,NGROUP) - integer, allocatable, dimension(:,:) :: f_inucelem ! (NELEM,NELEM*NGROUP) - integer, allocatable, dimension(:,:,:) :: f_inuc2bin ! (NBIN,NGROUP,NGROUP) - integer, allocatable, dimension(:,:,:) :: f_ievp2bin ! (NBIN,NGROUP,NGROUP) - integer, allocatable, dimension(:,:,:) :: f_nnucbin ! (NGROUP,NBIN,NGROUP) - integer, allocatable, dimension(:,:,:,:) :: f_inucbin ! (NBIN*NGROUP,NGROUP,NBIN,NGROUP) - real(kind=f) :: f_dt_threshold - real(kind=f) :: f_tstick - real(kind=f) :: f_gsticki - real(kind=f) :: f_gstickl - real(kind=f) :: f_cstick - - - ! Particle bin structure - ! - ! diffmass Difference between values - ! - real(kind=f), allocatable, dimension(:,:,:,:) :: f_diffmass ! (NBIN,NGROUP,NBIN,NGROUP) - - ! Coagulation kernels and bin pair mapping - ! - ! ck0 Constant coagulation kernel {setupaer} - ! grav_e_coll0 Constant value for collection effic. {setupaer} - ! volx Coagulation subdivision variable {setupcoag} - ! ilow Bin pairs for coagulation production {setupcoag} - ! jlow Bin pairs for coagulation production {setupcoag} - ! iup Bin pairs for coagulation production {setupcoag} - ! jup Bin pairs for coagulation production {setupcoag} - ! npairl Bin pair indices {setupcoag} - ! npairu Bin pair indices {setupcoag} - ! kbin lower bin for coagulation {setupcoag} - ! pkernel Coagulation production variables {setupcoag} - ! - real(kind=f) :: f_ck0 - real(kind=f) :: f_grav_e_coll0 - real(kind=f), allocatable, dimension(:,:,:,:,:) :: f_volx ! (NGROUP,NGROUP,NGROUP,NBIN,NBIN) - integer, allocatable, dimension(:,:,:) :: f_ilow ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_jlow ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_iup ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_jup ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:) :: f_npairl ! (NGROUP,NBIN) - integer, allocatable, dimension(:,:) :: f_npairu ! (NGROUP,NBIN) - integer, allocatable, dimension(:,:,:,:,:) :: f_kbin ! (NGROUP,NGROUP,NGROUP,NBIN,NBIN) - real(kind=f), allocatable, dimension(:,:,:,:,:,:) :: f_pkernel ! (NBIN,NBIN,NGROUP,NGROUP,NGROUP,6) - - ! Coagulation group pair mapping - ! - ! iglow Group pairs for coagulation production {setupcoag} - ! jglow Group pairs for coagulation production {setupcoag} - ! igup Group pairs for coagulation production {setupcoag} - ! jgup Group pairs for coagulation production {setupcoag} - ! - integer, allocatable, dimension(:,:,:) :: f_iglow ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_jglow ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_igup ! (NGROUP,NBIN,NBIN*NBIN) - integer, allocatable, dimension(:,:,:) :: f_jgup ! (NGROUP,NBIN,NBIN*NBIN) - - ! Particle fall velocities - ! - ! vf_const Constant vertical fall velocity when ifall=0 {setupaer} - ! - real(kind=f) :: f_vf_const - - - ! Condensational growth parameters - ! - ! NOTE: Some of these variables are used for storing intermediate values in - ! the calculations. They may no longer be necessary, when the code is - ! implemented as F90 and values as passed as parameters between subroutines. - ! - ! rlh_nuc Latent heat released by nucleation [cm^2/s^2] {setupaer} - ! pratt Terms in PPM advection scheme for condensation {setupgkern} - ! prat - ! pden1 - ! palr - real(kind=f), allocatable, dimension(:,:) :: f_rlh_nuc ! (NELEM,NELEM) - real(kind=f), allocatable, dimension(:,:,:) :: f_pratt ! (3,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_prat ! (4,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_pden1 ! (NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_palr ! (4,NGROUP) - - ! Optical Properties - ! wave Bin-center wavelengths [cm] - ! dwave width of radiation bands [cm] - ! do_wave_emit If true, emission should be calculated the band - ! - real(kind=f), allocatable, dimension(:) :: f_wave ! (NWAVE) - real(kind=f), allocatable, dimension(:) :: f_dwave ! (NWAVE) - logical, allocatable, dimension(:) :: f_do_wave_emit ! (NWAVE) - end type carma_type - - - !! The cstate data type replaces portions of the common blocks that were used - !! in the F77 version of CARMA. This allows the code to be written to allow for - !! multiple threads to call CARMA routines simulataneously. This thread safety is - !! necessary for to run CARMA under OPEN/MP. - !! - !! The procedure for adding a variable to the cstate data type is: - !! - Add the variable as a scalar or allocatable in the type definition. - !! - If the new variable is dynamic, - !! - Allocate the variable in the create routine. - !! - Deallocate the variable in the destroy routines. - !! - Add an alias for the variable to cstate.h and associate it with the - !! variable in this typedef. - !! - !! NOTE: While the carmastate_type is public, routines outside of the CARMA module - !! should not look at or manuipulate fields of this structure directly. There should - !! be CARMASTATE_XXX methods to do anything that is needed with this structure, and - !! use of these methods will allow the cstate data type structure to evolve without - !! impacting code in the parent model. The contents of the structure had to be made - !! public, since the CARMA microphysics rountines are implemented in separate files - !! outside of this model; however, logically they are part of the model and are the - !! only routines outside of this module that should access fields of this structure - !! directly. - type, public :: carmastate_type - - ! Parent CARMA object - type(carma_type), pointer :: f_carma - - ! Model Dimensions - ! - ! NZ number of grid points in the column - ! NZP1 NZ+1 - ! NGROUP number of particle groups - ! NELEM number of particle components (elements) - ! NBIN number of size bins per element - ! NGAS number of gases (may be 0) - ! - integer :: f_NZ - integer :: f_NZP1 - - ! Model option & control variables - ! - ! time Simulation time at end of current timestep [s] - ! dtime Substep Timestep size [s] - ! dtime_orig Original Timestep size [s] - ! nretries Number of substepping retries attempted - real(kind=f) :: f_time - real(kind=f) :: f_dtime - real(kind=f) :: f_dtime_orig - real(kind=f) :: f_nretries - - ! max_nretry Maximum number of retries in a step - ! nstep Total number of steps taken - ! nsubstep Total number of substeps taken - ! nretry Total number of retries taken - integer :: f_max_nsubstep - real(kind=f) :: f_max_nretry - real(kind=f) :: f_nstep - integer :: f_nsubstep - real(kind=f) :: f_nretry - - real(kind=f), allocatable, dimension(:) :: f_zsubsteps ! (NZ) - - - ! Model Grid - ! - ! igridv flag to specify desired vertical grid coord system {initatm} - ! igridh flag to specify desired horizontal grid coord system {initatm} - ! xmet Horizontal ds/dx (ds is metric distance) {initatm} - ! ymet Horizontal ds/dy (ds is metric distance) {initatm} - ! zmet Vertical ds/dz (ds is metric distance) {initatm} - ! zmetl Vertical ds/dz at edges (ds is metric distance) {initatm} - ! xc Horizontal position at center of box {initatm} - ! yc Horizontal position at center of box {initatm} - ! zc Altitude at layer mid-point {initatm} - ! dx Horizontal grid spacing {initatm} - ! dy Horizontal grid spacing {initatm} - ! dz Thickness of vertical layers {initatm} - ! zl Altitude at top of layer {initatm} - ! lon Longitude [deg] at xc, yc {initatm} - ! lat Latitude [deg] at xc, yc {initatm} - ! - integer :: f_igridv - integer :: f_igridh - real(kind=f), allocatable, dimension(:) :: f_xmet ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_ymet ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_zmet ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_zmetl ! (NZP1) - real(kind=f), allocatable, dimension(:) :: f_xc ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_yc ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_zc ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_dx ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_dy ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_dz ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_zl ! (NZP1) - real(kind=f) :: f_lon - real(kind=f) :: f_lat - - ! Particle bin structure - ! - ! rhop Mass density of particle groups [g/cm^3] - ! r_wet Wet particle radius from RH swelling [cm] {setupvfall} - ! rlow_wet Wet particle radius (lower bound) from RH swelling [cm] {setupvfall} - ! rup_wet Wet particle radius (upper bound) from RH swelling [cm] {setupvfall} - ! rhop_wet Wet Mass density of particle groups [g/cm^3] - ! r_ref Reference wet particle radius from RH swelling [cm] {setupvfall} - ! rhop_ref Reference wet Mass density of particle groups [g/cm^3] - ! - real(kind=f), allocatable, dimension(:,:,:) :: f_rhop ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_rhop_wet ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_r_wet ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_rlow_wet ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_rup_wet ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_r_ref ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_rhop_ref ! (NZ,NBIN,NGROUP) - - ! Primary model state variables - ! - ! pc Particle concentration [/x_units/y_units/z_units] {initaer} - ! pcd Detrained particle concentration [/x_units/y_units/z_units] {initaer} - ! pc_surf Particles on surface [/cm2] {initaer} - ! sedimentationflux Particles sedimented to surface [/cm2/s] {initaer} - ! gc Gas concentration [g/x_units/y_units/z_units] {initgas} - ! cldfrc Cloud fraction [fraction] - ! rhcrit Relative humidity for onset of liquid clouds [fraction] - ! - real(kind=f), allocatable, dimension(:,:,:) :: f_pc ! (NZ,NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:,:) :: f_pcd ! (NZ,NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_pc_surf ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_sedimentationflux ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_gc ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:) :: f_cldfrc ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_rhcrit ! (NZ) - - ! Secondary model variables - ! - ! NOTE: Some of these variables are used for storing intermediate values in - ! the calculations. They may no longer be necessary, when the code is - ! implemented as F90 and values as passed as parameters between subroutines. - ! - ! pcl Particle concentration at beginning of time-step - ! pconmax Maximum particle concentration for each grid point - ! gcl Gas concentration at beginning of time-step - ! d_gc Change in gas concentration due to transport - ! d_t Change in temperature due to transport - ! dpc_sed Change in particle concentration due to sedimentation - ! coaglg Total particle loss rate due to coagulation for group - ! coagpe Particle production due to coagulation - ! rnuclg Total particle loss rate due to nucleation for group - ! rnucpe Particle production due to nucleation - ! rhompe Particle production due to homogeneous nucleation - ! pc_nucl Particles produced due to nucleation (for the whole step, not just the substep) - ! growlg Total particle loss rate due to growth for group - ! growle Partial particle loss rate due to growth for element - ! growpe Particle production due to growth - ! evaplg Total particle loss rate due to evaporation for group - ! evapls Partial particle loss rate due to evaporation for element - ! evappe Particle production due to evaporation - ! coreavg Average total core mass in bin - ! coresig logarithm^2 of std dev of core distribution - ! evdrop Particle production of droplet number - ! evcore Particle production of core elements - ! gasprod Gas production term - ! rlheat Latent heating rate (per step) [deg_K/s] - ! ftoppart Downward particle flux across top boundary of model - ! fbotpart Upward flux particle across bottom boundary of model - ! pc_topbnd Particle concentration assumed just above the top boundary - ! pc_botbnd Particle concentration assumed just below the bottom boundary - ! cmf Core mass fraction in a droplet - ! totevap .true. if droplets are totally evaporating to CN - ! too_small .true. if cores are smaller than smallest CN - ! too_big .true. if cores are larger than largest CN - ! nuc_small .true. if cores are smaller than smallest nucleated CN - ! rlprod Latent heat production (per substep) (K/s) - ! - real(kind=f), allocatable, dimension(:,:,:) :: f_pcl ! (NZ,NBIN,NELEM - real(kind=f), allocatable, dimension(:,:) :: f_gcl ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_d_gc ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:) :: f_d_t ! (NZ) - real(kind=f), allocatable, dimension(:,:) :: f_dpc_sed ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_pconmax ! (NZ,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_coaglg ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_coagpe ! (NZ,NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:,:) :: f_rnuclg ! (NBIN,NGROUP,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_rnucpe ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_rhompe ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:,:) :: f_pc_nucl ! (NZ,NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_growpe ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_evappe ! (NBIN,NELEM) - real(kind=f) :: f_coreavg - real(kind=f) :: f_coresig - real(kind=f) :: f_evdrop - real(kind=f), allocatable, dimension(:) :: f_evcore ! (NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_growlg ! (NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_evaplg ! (NBIN,NGROUP) - real(kind=f), allocatable, dimension(:) :: f_gasprod ! (NGAS) - real(kind=f), allocatable, dimension(:) :: f_rlheat ! (NZ) - real(kind=f), allocatable, dimension(:,:) :: f_ftoppart ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_fbotpart ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_pc_topbnd ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_pc_botbnd ! (NBIN,NELEM) - real(kind=f), allocatable, dimension(:,:) :: f_cmf ! (NBIN,NGROUP) - logical, allocatable, dimension(:,:) :: f_totevap ! (NBIN,NGROUP) - logical :: f_too_small - logical :: f_too_big - logical :: f_nuc_small - real(kind=f) :: f_rlprod - - ! Coagulation kernels and bin pair mapping - ! - ! ckernel Coagulation kernels [cm^3/s] {setupckern} - ! - real(kind=f), allocatable, dimension(:,:,:,:,:) :: f_ckernel ! (NZ,NBIN,NBIN,NGROUP,NGROUP) - - ! Particle fall velocities and diffusivities - ! - ! bpm Corrects for non-sphericity and non-continuum effects {setupvfall} - ! vf Fall velocities at layer endge {setupvfall} - ! re Reynolds' number based on {setupvfall} - ! dkz Vert Brownian diffusion coef at layer boundary [z_units^2/s] {setupbdif} - ! vd Particle dry deposition velocity [z_units/s] {setupvdry} - ! - real(kind=f), allocatable, dimension(:,:,:) :: f_bpm ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_vf ! (NZP1,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_re ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_dkz ! (NZP1,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_vd ! (NBIN,NGROUP) - - ! Atmospheric Structure - ! - ! rhoa Air density at layer mid-pt [g/x_units/y_units/z_units] {initatm} - ! rhoa_wet Wet Air density averaged over grid box [g/x_units/y_units/z_units] {initatm} - ! t Air temperature at layer mid-pt [deg_K] {initatm} - ! p Atmospheric pressure at layer mid-pt [dyne/cm^2] {initatm} - ! pl Atmospheric pressure at layer edge [dyne/cm^2] {initatm} - ! rmu Air viscosity at layer mid-pt [g/cm/s] {initatm} - ! thcond Thermal conductivity of dry air [erg/cm/sec/deg_K] {initatm} - ! thcondnc Adjusted thermal conductivity of dry air [erg/cm/sec/deg_K] {initatm} - ! told Temperature at beginning of time-step - ! relhum Hacked in relative humidity from hostmodel - ! wtpct Sulfate weight percent - ! - real(kind=f), allocatable, dimension(:) :: f_rhoa ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_rhoa_wet ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_t ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_p ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_pl ! (NZP1) - real(kind=f), allocatable, dimension(:) :: f_rmu ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_thcond ! (NZ) - real(kind=f), allocatable, dimension(:,:,:) :: f_thcondnc ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:) :: f_told ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_relhum ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_wtpct ! (NZ) - - ! Condensational growth parameters - ! - ! NOTE: Some of these variables are used for storing intermediate values in - ! the calculations. They may no longer be necessary, when the code is - ! implemented as F90 and values as passed as parameters between subroutines. - ! - ! diffus Diffusivity of gas in air [cm^2/s] {setupgrow} - ! rlhe Latent heat of evaporation for gas [cm^2/s^2] {setupgrow} - ! rlhm Latent heat of ice melting for gas [cm^2/s^2] {setupgrow} - ! pvapl Saturation vapor pressure over water [dyne/cm^2] {vaporp} - ! pvapi Saturation vapor pressure over ice [dyne/cm^2] {vaporp} - ! surfctwa Surface tension of water-air interface {setupgkern} - ! surfctiw Surface tension of water-ice interface {setupgkern} - ! surfctia Surface tension of ice-air interface {setupgkern} - ! akelvin Exponential arg. in curvature term for growth {setupgkern} - ! akelvini Curvature term for ice {setupgkern} - ! ft Ventilation factor {setupgkern} - ! gro Growth kernel [UNITS?] {setupgkern} - ! gro1 Growth kernel conduction term [UNITS?] {setupgkern} - ! gro2 Growth kernel radiation term [UNITS?] {setupgkern} - ! supsatl Supersaturation of vapor w.r.t. liquid water [dimless] - ! supsati Supersaturation of vapor w.r.t. ice [dimless] - ! supsatlold Supersaturation (liquid) before time-step {prestep} - ! supsatiold Supersaturation (ice) before time-step {prestep} - ! scrit Critical supersaturation for nucleation [dimless] {setupnuc} - ! radint Incoming radiative intensity [erg/cm2/sr/s/um] - ! partheat Diffusional heating from particles (step) [K/s] - ! dtpart Delta particle temperature [K] - ! phprod Particle heating production (substep) [K/s] - ! - real(kind=f), allocatable, dimension(:,:) :: f_diffus ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_rlhe ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_rlhm ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_pvapl ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_pvapi ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:) :: f_surfctwa ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_surfctiw ! (NZ) - real(kind=f), allocatable, dimension(:) :: f_surfctia ! (NZ) - real(kind=f), allocatable, dimension(:,:) :: f_akelvin ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_akelvini ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:,:) :: f_ft ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_gro ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:,:) :: f_gro1 ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_gro2 ! (NZ,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_supsatl ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_supsati ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_supsatlold ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:) :: f_supsatiold ! (NZ,NGAS) - real(kind=f), allocatable, dimension(:,:,:) :: f_scrit ! (NZ,NBIN,NGROUP) - real(kind=f), allocatable, dimension(:,:) :: f_radint ! (NZ,NWAVE) - real(kind=f), allocatable, dimension(:) :: f_partheat ! (NZ) - real(kind=f), allocatable, dimension(:,:,:) :: f_dtpart ! (NZ,NBIN,NGROUP) - real(kind=f) :: f_phprod - end type carmastate_type -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carmaelement_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carmaelement_mod.F90 deleted file mode 100644 index b1ef11f0..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carmaelement_mod.F90 +++ /dev/null @@ -1,267 +0,0 @@ -!! The CARMAELEMENT module contains configuration information about a particle -!! element used by CARMA. -!! -!! @version March-2010 -!! @author Chuck Bardeen -module CARMAELEMENT_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! CARMA explicitly declares all variables. - implicit none - - ! All CARMA variables and procedures are private except those explicitly declared to be public. - private - - ! Declare the public methods. - public CARMAELEMENT_Create - public CARMAELEMENT_Destroy - public CARMAELEMENT_Get - public CARMAELEMENT_Print - -contains - - !! Defines a gas used by CARMA for nucleation and growth of cloud and - !! aerosol particles. - !! - !! NOTE: The element density can be specifeid per bin using rhobin; however, - !! if only the bulk density is provided (rho) then the same value will be used - !! for all bins. The bulk density allows for backward compatability and ease of - !! configuration. If rhobin is provided, then rho is ignored. - !! - !! @author Chuck Bardeen - !! @version March-2010 - !! - !! @see CARMA_AddGas - !! @see CARMAELEMENT_Destroy - subroutine CARMAELEMENT_Create(carma, ielement, igroup, name, rho, itype, icomposition, rc, & - shortname, isolute, rhobin, arat) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: ielement !! the element index - integer, intent(in) :: igroup !! Group to which the element belongs - character(*), intent(in) :: name !! the element name, maximum of 255 characters - real(kind=f), intent(in) :: rho !! bulk mass density of particle element [g/cm^3] - integer, intent(in) :: itype !! Particle type specification - integer, intent(in) :: icomposition !! Particle compound specification - integer, intent(out) :: rc !! return code, negative indicates failure - character(*), optional, intent(in) :: shortname !! the element shortname, maximum of 6 characters - integer, optional, intent(in) :: isolute !! Index of solute for the particle element - real(kind=f), optional, intent(in) :: rhobin(carma%f_NBIN) !! mass density per bin of particle element [g/cm^3] - real(kind=f), optional, intent(in) :: arat(carma%f_NBIN) !! projected area ratio - - ! Local variables - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough elements allocated. - if (ielement > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Create:: ERROR - The specifed element (", & - ielement, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough groups allocated. - if (igroup > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Create:: ERROR - The specifed group (", & - igroup, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - allocate( & - carma%f_element(ielement)%f_rho(carma%f_NBIN), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Add: ERROR allocating, status=", ier - rc = RC_ERROR - return - end if - - ! Save off the settings. - carma%f_element(ielement)%f_igroup = igroup - carma%f_element(ielement)%f_name = name - carma%f_element(ielement)%f_rho(:) = rho - carma%f_element(ielement)%f_itype = itype - carma%f_element(ielement)%f_icomposition = icomposition - - - ! Defaults for optional parameters - carma%f_element(ielement)%f_shortname = "" - carma%f_element(ielement)%f_isolute = 0 - - ! Set optional parameters. - if (present(shortname)) carma%f_element(ielement)%f_shortname = shortname - if (present(isolute)) then - - ! Make sure there are enough solutes allocated. - if (isolute > carma%f_NSOLUTE) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Create:: ERROR - The specifed solute (", & - isolute, ") is larger than the number of solutes (", carma%f_NSOLUTE, ")." - rc = RC_ERROR - return - end if - - carma%f_element(ielement)%f_isolute = isolute - end if - if (present(rhobin)) carma%f_element(ielement)%f_rho(:) = rhobin(:) - - ! If the area ratio is specfied (usually along with rhobin), then set this - ! for the group. - if (present(arat)) carma%f_group(igroup)%f_arat(:) = arat(:) - - ! Keep track of the fact that another element has been added to the group. - carma%f_group(igroup)%f_nelem = carma%f_group(igroup)%f_nelem + 1 - - return - end subroutine CARMAELEMENT_Create - - - !! Deallocates the memory associated with a CARMAELEMENT object. - !! - !! @author Chuck Bardeen - !! @version March-2010 - !! - !! @see CARMAELEMENT_Create - subroutine CARMAELEMENT_Destroy(carma, ielement, rc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: ielement !! the element index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough elements allocated. - if (ielement > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Destroy:: ERROR - The specifed element (", & - ielement, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - if (allocated(carma%f_element(ielement)%f_rho)) then - deallocate( & - carma%f_element(ielement)%f_rho, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Destroy: ERROR deallocating, status=", ier - rc = RC_ERROR - return - endif - endif - - return - end subroutine CARMAELEMENT_Destroy - - - !! Gets information about a particle element. - !! - !! The group name and other properties are available after a call to - !! CARMAELEMENT_Create(). - !! - !! @author Chuck Bardeen - !! @version March-2010 - !! - !! @see CARMAELEMENT_Create - !! @see CARMA_GetElement - subroutine CARMAELEMENT_Get(carma, ielement, rc, igroup, name, shortname, rho, itype, icomposition, isolute) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: ielement !! the element index - integer, intent(out) :: rc !! return code, negative indicates failure - integer, optional, intent(out) :: igroup !! Group to which the element belongs - character(len=*), optional, intent(out) :: name !! the element name - character(len=*), optional, intent(out) :: shortname !! the element short name - real(kind=f), optional, intent(out) :: rho(carma%f_NBIN) !! Mass density of particle element [g/cm^3] - integer, optional, intent(out) :: itype !! Particle type specification - integer, optional, intent(out) :: icomposition !! Particle compound specification - integer, optional, intent(out) :: isolute !! Index of solute for the particle element - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough elements allocated. - if (ielement > carma%f_NELEM) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAELEMENT_Get:: ERROR - The specifed element (", & - ielement, ") is larger than the number of elements (", carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Return any requested properties of the group. - if (present(igroup)) igroup = carma%f_element(ielement)%f_igroup - if (present(name)) name = carma%f_element(ielement)%f_name - if (present(shortname)) shortname = carma%f_element(ielement)%f_shortname - if (present(rho)) rho(:) = carma%f_element(ielement)%f_rho(:) - if (present(itype)) itype = carma%f_element(ielement)%f_itype - if (present(icomposition)) icomposition = carma%f_element(ielement)%f_icomposition - if (present(isolute)) isolute = carma%f_element(ielement)%f_isolute - - return - end subroutine CARMAELEMENT_Get - - - !! Prints information about an element. - !! - !! @author Chuck Bardeen - !! @version March-2010 - !! - !! @see CARMAELEMENT_Get - subroutine CARMAELEMENT_Print(carma, ielement, rc) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: ielement !! the element index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - character(len=CARMA_NAME_LEN) :: name ! name - character(len=CARMA_SHORT_NAME_LEN) :: shortname ! shortname - real(kind=f) :: rho(carma%f_NBIN) ! density (g/cm3) - integer :: igroup ! Group to which the element belongs - integer :: itype ! Particle type specification - integer :: icomposition ! Particle compound specification - integer :: isolute ! Index of solute for the particle element - - ! Assume success. - rc = RC_OK - - ! Test out the Get method. - if (carma%f_do_print) then - call CARMAELEMENT_Get(carma, ielement, rc, name=name, shortname=shortname, igroup=igroup, & - itype=itype, icomposition=icomposition, rho=rho, isolute=isolute) - if (rc < 0) return - - - write(carma%f_LUNOPRT,*) " name : ", trim(name) - write(carma%f_LUNOPRT,*) " igroup : ", igroup - write(carma%f_LUNOPRT,*) " shortname : ", trim(shortname) - write(carma%f_LUNOPRT,*) " rho : ", rho, " (g/cm3)" - - select case(itype) - case (I_INVOLATILE) - write(carma%f_LUNOPRT,*) " itype : involatile" - case (I_VOLATILE) - write(carma%f_LUNOPRT,*) " itype : volatile" - case (I_COREMASS) - write(carma%f_LUNOPRT,*) " itype : core mass" - case (I_VOLCORE) - write(carma%f_LUNOPRT,*) " itype : volatile core" - case (I_CORE2MOM) - write(carma%f_LUNOPRT,*) " itype : core mass - second moment" - case default - write(carma%f_LUNOPRT,*) " itype : unknown, ", itype - end select - - write(carma%f_LUNOPRT,*) " icomposition : ", icomposition - write(carma%f_LUNOPRT,*) " isolute : ", isolute - end if - - return - end subroutine CARMAELEMENT_Print -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carmagas_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carmagas_mod.F90 deleted file mode 100644 index e446db01..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carmagas_mod.F90 +++ /dev/null @@ -1,208 +0,0 @@ -!! The CARMAGAS module contains configuration information about a gas used by CARMA. -!! -!! @version May-2009 -!! @author Chuck Bardeen -module carmagas_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! CARMA explicitly declares all variables. - implicit none - - ! All CARMA variables and procedures are private except those explicitly declared to be public. - private - - ! Declare the public methods. - public CARMAGAS_Create - public CARMAGAS_Destroy - public CARMAGAS_Get - public CARMAGAS_Print - -contains - - !! Defines a gas used by CARMA for nucleation and growth of cloud and - !! aerosol particles. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMA_AddGas - !! @see CARMAGAS_Destroy - subroutine CARMAGAS_Create(carma, igas, name, wtmol, ivaprtn, icomposition, & - rc, shortname, dgc_threshold, ds_threshold) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igas !! the gas index - character(*), intent(in) :: name !! the gas name, maximum of 255 characters - real(kind=f), intent(in) :: wtmol !! the gas molecular weight [g/mol] - integer, intent(in) :: ivaprtn !! vapor pressure routine for this gas - integer, intent(in) :: icomposition !! gas compound specification - integer, intent(out) :: rc !! return code, negative indicates failure - character(*), optional, intent(in) :: shortname !! the gas shortname, maximum of 6 characters - real(kind=f), optional, intent(in) :: dgc_threshold !! convergence criteria for gas concentration - !! [0 : off; > 0 : percentage change] - real(kind=f), optional, intent(in) :: ds_threshold !! convergence criteria for gas saturation - !! [0 : off; > 0 : percentage change; < 0 : amount past 0 crossing] - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough gases allocated. - if (igas > carma%f_NGAS) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGAS_GetCreate:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - ! Save off the settings. - carma%f_gas(igas)%f_name = name - carma%f_gas(igas)%f_wtmol = wtmol - carma%f_gas(igas)%f_ivaprtn = ivaprtn - carma%f_gas(igas)%f_icomposition = icomposition - - - ! Defaults for optional parameters - carma%f_gas(igas)%f_shortname = "" - carma%f_gas(igas)%f_dgc_threshold = 0._f - carma%f_gas(igas)%f_ds_threshold = 0._f - - ! Set optional parameters. - if (present(shortname)) carma%f_gas(igas)%f_shortname = shortname - if (present(dgc_threshold)) carma%f_gas(igas)%f_dgc_threshold = dgc_threshold - if (present(ds_threshold)) carma%f_gas(igas)%f_ds_threshold = ds_threshold - - return - end subroutine CARMAGAS_Create - - - !! Deallocates the memory associated with a CARMAGAS object. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGAS_Create - subroutine CARMAGAS_Destroy(carma, igas, rc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igas !! the gas index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough gases allocated. - if (igas > carma%f_NGAS) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGAS_Destroy:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - return - end subroutine CARMAGAS_Destroy - - - !! Gets information about a gas. - !! - !! The group name and other properties are available after a call to - !! CARMAGAS_Create(). - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGAS_Create - !! @see CARMA_GetGas - subroutine CARMAGAS_Get(carma, igas, rc, name, shortname, wtmol, ivaprtn, icomposition, dgc_threshold, ds_threshold) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: igas !! the gas index - integer, intent(out) :: rc !! return code, negative indicates failure - character(len=*), optional, intent(out) :: name !! the gas name - character(len=*), optional, intent(out) :: shortname !! the gas short name - real(kind=f), optional, intent(out) :: wtmol !! the gas molecular weight [g/mol] - integer, optional, intent(out) :: ivaprtn !! vapor pressure routine for this gas - integer, optional, intent(out) :: icomposition !! gas compound specification - real(kind=f), optional, intent(out) :: dgc_threshold !! convergence criteria for gas concentration [fraction] - real(kind=f), optional, intent(out) :: ds_threshold !! convergence criteria for gas saturation [fraction] - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough gases allocated. - if (igas > carma%f_NGAS) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGAS_Get:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - ! Return any requested properties of the group. - if (present(name)) name = carma%f_gas(igas)%f_name - if (present(shortname)) shortname = carma%f_gas(igas)%f_shortname - if (present(wtmol)) wtmol = carma%f_gas(igas)%f_wtmol - if (present(ivaprtn)) ivaprtn = carma%f_gas(igas)%f_ivaprtn - if (present(icomposition)) icomposition = carma%f_gas(igas)%f_icomposition - if (present(dgc_threshold)) dgc_threshold = carma%f_gas(igas)%f_dgc_threshold - if (present(ds_threshold)) ds_threshold = carma%f_gas(igas)%f_ds_threshold - - return - end subroutine CARMAGAS_Get - - - !! Prints information about a gas. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGAS_Get - subroutine CARMAGAS_Print(carma, igas, rc) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: igas !! the gas index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - character(len=CARMA_NAME_LEN) :: name !! name - character(len=CARMA_SHORT_NAME_LEN) :: shortname !! shortname - real(kind=f) :: wtmol !! molecular weight (g/mol) - integer :: ivaprtn !! vapor pressure routine for this gas - integer :: icomposition !! gas compound specification - real(kind=f) :: dgc_threshold !! convergence criteria for gas concentration [fraction] - real(kind=f) :: ds_threshold !! convergence criteria for gas saturation [fraction] - - ! Assume success. - rc = RC_OK - - ! Test out the Get method. - if (carma%f_do_print) then - call CARMAGAS_Get(carma, igas, rc, name=name, shortname=shortname, wtmol=wtmol, & - ivaprtn=ivaprtn, icomposition=icomposition) - if (rc < RC_OK) return - - - write(carma%f_LUNOPRT,*) " name : ", trim(name) - write(carma%f_LUNOPRT,*) " shortname : ", trim(shortname) - write(carma%f_LUNOPRT,*) " wtmol : ", wtmol, " (g/mol)" - write(carma%f_LUNOPRT,*) " dgc_threshold : ", dgc_threshold - write(carma%f_LUNOPRT,*) " ds_threshold : ", ds_threshold - - select case(ivaprtn) - case (I_VAPRTN_H2O_BUCK1981) - write(carma%f_LUNOPRT,*) " ivaprtn : Buck [1981]" - case (I_VAPRTN_H2O_MURPHY2005) - write(carma%f_LUNOPRT,*) " ivaprtn : Murphy & Koop [2005]" - case default - write(carma%f_LUNOPRT,*) " ivaprtn : unknown, ", ivaprtn - end select - - select case(icomposition) - case (I_GCOMP_H2O) - write(carma%f_LUNOPRT,*) " icomposition : H2O" - case default - write(carma%f_LUNOPRT,*) " icomposition : unknown, ", icomposition - end select - end if - - return - end subroutine CARMAGAS_Print -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carmagroup_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carmagroup_mod.F90 deleted file mode 100644 index a707e845..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carmagroup_mod.F90 +++ /dev/null @@ -1,732 +0,0 @@ -!! The CARMAGROUP module contains configuration information about a CARMA partcile. -!! -!! NOTE: Because of the way Fortran handles pointers and allocations, it is much -!! simpiler to have these methods directly access the group array that is in the -!! CARMA object rather than having this as its own objects. Some compilers (like -!! IBM on AIX do not by default automatically deallocate automatically created -!! derived types that contain allocations. This can result in memory leaks that -!! are difficult to find. -!! -!! These calls are written like they are part of CARMA, but they are called -!! CARMAGROUP and kept by themselves in their own file to make it easier to keep -!! track of what is required when adding an attribute to a group. -!! -!! @version July-2009 -!! @author Chuck Bardeen -module carmagroup_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! CARMA explicitly declares all variables. - implicit none - - ! All CARMA variables and procedures are private except those explicitly declared to be public. - private - - ! Declare the public methods. - public CARMAGROUP_Create - public CARMAGROUP_Destroy - public CARMAGROUP_Get - public CARMAGROUP_Print - -contains - - subroutine CARMAGROUP_Create(carma, igroup, name, rmin, rmrat, ishape, eshape, is_ice, rc, is_fractal, & - irhswell, irhswcomp, refidx, do_mie, do_wetdep, do_drydep, do_vtran, solfac, scavcoef, shortname, & - cnsttype, maxbin, ifallrtn, is_cloud, rmassmin, imiertn, is_sulfate, dpc_threshold, rmon, df, falpha, & - neutral_volfrc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igroup !! the group index - character(*), intent(in) :: name !! the group name, maximum of 255 characters - real(kind=f), intent(in) :: rmin !! the minimum radius, can be specified [cm] - real(kind=f), intent(in) :: rmrat !! the volume ratio between bins - integer, intent(in) :: ishape !! the type of the particle shape - !! [I_SPHERE | I_HEXAGON | I_CYLINDER] - real(kind=f), intent(in) :: eshape !! the aspect ratio of the particle shape (length/diameter) - logical, intent(in) :: is_ice !! is this an ice particle? - integer, intent(out) :: rc !! return code, negative indicates failure - logical, optional, intent(in) :: is_fractal !! is this a fractal particle? - integer, optional, intent(in) :: irhswell !! the parameterization for particle swelling - !! from relative humidity [I_FITZGERALD | I_GERBER] - integer, optional, intent(in) :: irhswcomp !! the composition for particle swelling - !! from relative humidity [I_FITZGERALD | I_GERBER] - complex(kind=f), optional, intent(in) :: refidx(carma%f_NWAVE) !! refractive index for the particle - logical, optional, intent(in) :: do_mie !! do mie calculations? - logical, optional, intent(in) :: do_wetdep !! do wet deposition for this particle? - logical, optional, intent(in) :: do_drydep !! do dry deposition for this particle? - logical, optional, intent(in) :: do_vtran !! do sedimentation for this particle? - real(kind=f), intent(in), optional :: solfac !! the solubility factor for wet deposition - real(kind=f), intent(in), optional :: scavcoef !! the scavenging coefficient for wet deposition - character(*), optional, intent(in) :: shortname !! the group shortname, maximum of 6 characters - integer, optional, intent(in) :: cnsttype !! constituent type in parent model - !! [I_CNSTTYPE_PROGNOSTIC | I_CNSTTYPE_DIAGNOSTIC] - integer, optional, intent(in) :: maxbin !! bin number of the last prognostic bin - !! the remaining bins are diagnostic - integer, optional, intent(in) :: ifallrtn !! fall velocity routine [I_FALLRTN_STD - !! | I_FALLRTN_STD_SHAPE | I_FALLRTN_HEYMSFIELD2010 - !! | I_FALLRTN_ACKERMAN_DROP | I_FALLRTN_ACKERMAN_ICE] - logical, optional, intent(in) :: is_cloud !! is this a cloud particle? - real(kind=f), optional, intent(in) :: rmassmin !! the minimum mass, when used overrides rmin[g] - integer, optional, intent(in) :: imiertn !! mie routine [I_MIERTN_TOON1981 | I_MIERTN_BOHREN1983 - !! | I_MIERTN_BOTET1997] - logical, optional, intent(in) :: is_sulfate !! is this a sulfate particle? - real(kind=f), optional, intent(in) :: dpc_threshold !! convergence criteria for particle concentration - !! [fraction] - real(kind=f), optional, intent(in) :: rmon !! monomer radius for fractal particles [cm] - real(kind=f), optional, intent(in) :: df(carma%f_NBIN) !! fractal dimension - real(kind=f), optional, intent(in) :: falpha !! fractal packing coefficient - real(kind=f), optional, intent(in) :: neutral_volfrc !! volume fraction of core mass for neutralization - - ! Local variables - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough groups allocated. - if (igroup > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Add:: ERROR - The specifed group (", & - igroup, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - allocate( & - carma%f_group(igroup)%f_r(carma%f_NBIN), & - carma%f_group(igroup)%f_rmass(carma%f_NBIN), & - carma%f_group(igroup)%f_vol(carma%f_NBIN), & - carma%f_group(igroup)%f_dr(carma%f_NBIN), & - carma%f_group(igroup)%f_dm(carma%f_NBIN), & - carma%f_group(igroup)%f_rmassup(carma%f_NBIN), & - carma%f_group(igroup)%f_rup(carma%f_NBIN), & - carma%f_group(igroup)%f_rlow(carma%f_NBIN), & - carma%f_group(igroup)%f_icorelem(carma%f_NELEM), & - carma%f_group(igroup)%f_arat(carma%f_NBIN), & - carma%f_group(igroup)%f_rrat(carma%f_NBIN), & - carma%f_group(igroup)%f_rprat(carma%f_NBIN), & - carma%f_group(igroup)%f_df(carma%f_NBIN), & - carma%f_group(igroup)%f_nmon(carma%f_NBIN), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Add: ERROR allocating, status=", ier - rc = RC_ERROR - return - end if - - ! Initialize - carma%f_group(igroup)%f_r(:) = 0._f - carma%f_group(igroup)%f_rmass(:) = 0._f - carma%f_group(igroup)%f_vol(:) = 0._f - carma%f_group(igroup)%f_dr(:) = 0._f - carma%f_group(igroup)%f_dm(:) = 0._f - carma%f_group(igroup)%f_rmassup(:) = 0._f - carma%f_group(igroup)%f_rup(:) = 0._f - carma%f_group(igroup)%f_rlow(:) = 0._f - carma%f_group(igroup)%f_icorelem(:) = 0 - carma%f_group(igroup)%f_ifallrtn = I_FALLRTN_STD - carma%f_group(igroup)%f_imiertn = I_MIERTN_TOON1981 - carma%f_group(igroup)%f_is_fractal = .false. - carma%f_group(igroup)%f_is_cloud = .false. - carma%f_group(igroup)%f_is_sulfate = .false. - carma%f_group(igroup)%f_dpc_threshold = 0._f - carma%f_group(igroup)%f_rmon = 0._f - carma%f_group(igroup)%f_df(:) = 3.0_f - carma%f_group(igroup)%f_nmon(:) = 1.0_f - carma%f_group(igroup)%f_falpha = 1.0_f - carma%f_group(igroup)%f_neutral_volfrc = 0.0_f - - ! Any optical properties? - if (carma%f_NWAVE > 0) then - allocate( & - carma%f_group(igroup)%f_refidx(carma%f_NWAVE), & - carma%f_group(igroup)%f_qext(carma%f_NWAVE,carma%f_NBIN), & - carma%f_group(igroup)%f_ssa(carma%f_NWAVE,carma%f_NBIN), & - carma%f_group(igroup)%f_asym(carma%f_NWAVE,carma%f_NBIN), & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Add: ERROR allocating, status=", ier - rc = RC_ERROR - return - endif - - ! Initialize - carma%f_group(igroup)%f_refidx(:) = (0._f, 0._f) - carma%f_group(igroup)%f_qext(:,:) = 0._f - carma%f_group(igroup)%f_ssa(:,:) = 0._f - carma%f_group(igroup)%f_asym(:,:) = 0._f - end if - - - ! Save off the settings. - carma%f_group(igroup)%f_name = name - carma%f_group(igroup)%f_rmin = rmin - carma%f_group(igroup)%f_rmrat = rmrat - carma%f_group(igroup)%f_ishape = ishape - carma%f_group(igroup)%f_eshape = eshape - carma%f_group(igroup)%f_is_ice = is_ice - - - ! Defaults for optional parameters - carma%f_group(igroup)%f_irhswell = 0 - carma%f_group(igroup)%f_irhswcomp = I_SWF_NH42SO4 - carma%f_group(igroup)%f_do_mie = .false. - carma%f_group(igroup)%f_do_wetdep = .false. - carma%f_group(igroup)%f_grp_do_drydep = .false. - carma%f_group(igroup)%f_grp_do_vtran = .true. - carma%f_group(igroup)%f_solfac = 0.3_f - carma%f_group(igroup)%f_scavcoef = 0.1_f - carma%f_group(igroup)%f_shortname = "" - carma%f_group(igroup)%f_cnsttype = I_CNSTTYPE_PROGNOSTIC - carma%f_group(igroup)%f_maxbin = carma%f_NBIN - carma%f_group(igroup)%f_rmassmin = 0.0_f - - ! Set optional parameters. - if (present(irhswell)) carma%f_group(igroup)%f_irhswell = irhswell - if (present(irhswcomp)) carma%f_group(igroup)%f_irhswcomp = irhswcomp - if (present(refidx)) carma%f_group(igroup)%f_refidx(:) = refidx(:) - if (present(do_mie)) carma%f_group(igroup)%f_do_mie = do_mie - if (present(do_wetdep)) carma%f_group(igroup)%f_do_wetdep = do_wetdep - if (present(do_drydep)) carma%f_group(igroup)%f_grp_do_drydep = do_drydep - if (present(do_vtran)) carma%f_group(igroup)%f_grp_do_vtran = do_vtran - if (present(solfac)) carma%f_group(igroup)%f_solfac = solfac - if (present(scavcoef)) carma%f_group(igroup)%f_scavcoef = scavcoef - if (present(shortname)) carma%f_group(igroup)%f_shortname = shortname - if (present(cnsttype)) carma%f_group(igroup)%f_cnsttype = cnsttype - if (present(maxbin)) carma%f_group(igroup)%f_maxbin = maxbin - if (present(ifallrtn)) carma%f_group(igroup)%f_ifallrtn = ifallrtn - if (present(is_cloud)) carma%f_group(igroup)%f_is_cloud = is_cloud - if (present(is_fractal)) carma%f_group(igroup)%f_is_fractal = is_fractal - if (present(rmassmin)) carma%f_group(igroup)%f_rmassmin = rmassmin - if (present(imiertn)) carma%f_group(igroup)%f_imiertn = imiertn - if (present(is_sulfate)) carma%f_group(igroup)%f_is_sulfate = is_sulfate - if (present(dpc_threshold)) carma%f_group(igroup)%f_dpc_threshold = dpc_threshold - if (present(rmon)) carma%f_group(igroup)%f_rmon = rmon - if (present(df)) carma%f_group(igroup)%f_df(:) = df(:) - if (present(falpha)) carma%f_group(igroup)%f_falpha = falpha - if (present(neutral_volfrc)) carma%f_group(igroup)%f_neutral_volfrc = neutral_volfrc - - ! Initialize other properties. - carma%f_group(igroup)%f_nelem = 0 - carma%f_group(igroup)%f_if_sec_mom = .FALSE. - carma%f_group(igroup)%f_ncore = 0 - carma%f_group(igroup)%f_ienconc = 0 - carma%f_group(igroup)%f_imomelem = 0 - - - ! The area ratio is the ratio of the area of the shape to the area of the - ! circumscribing circle. The radius ratio is the ratio between the radius - ! of the longest dimension and the radius of the enclosing sphere. - if (ishape .eq. I_HEXAGON) then - carma%f_group(igroup)%f_arat(:) = 3._f * sqrt(3._f) / 2._f / PI - carma%f_group(igroup)%f_rrat(:) = ((4._f * PI / 9._f / sqrt(3._f)) ** (1._f / 3._f)) * eshape**(-1._f / 3._f) - else if (ishape .eq. I_CYLINDER) then - carma%f_group(igroup)%f_arat(:) = 1.0_f - carma%f_group(igroup)%f_rrat(:) = ((2._f / 3._f) ** (1._f / 3._f)) * eshape**(-1._f / 3._f) - else - - ! Default to a sphere. - ! - ! NOTE: Should add code here to handle oblate and prolate spheroids. - carma%f_group(igroup)%f_arat(:) = 1.0_f - carma%f_group(igroup)%f_rrat(:) = 1.0_f - end if - - carma%f_group(igroup)%f_rprat(:) = 1.0_f - - !! Dry fractal aggregate aerosols composed of nmon identical spheres of radius rmon - !! can be treated by enabling the switch is_fractal = .true. Optical properties of dry - !! fractal aggregates can be computed using option imiertn = I_MIERTN_FRACTAL. - !! To use either of these options, the user must define the fractal dimension, df(NBIN), - !! monomer size (rmon), and packing coefficient (falpha) when creating the CARMA group. - !! - !! For aerosol particles fractal dimensions (df) are typically near 2.0, but can vary as a function - !! of size/number of monomers contained withing. The packing coefficient (falpha) is expected to be near - !! unity. falpha > 1 implies a more tightly packed fractal aggregate and vice-versa. - !! - !! If the user desires to use fractal optical properties calculation (I_MIERTN_BOTET1997), then - !! the user must also have fractal microphysics enabled (is_fractal = .true.). However, note that - !! if fractal microphysics are enabled, the user is free to select a standard Mie optical property calculation. - !! - ! - ! Check consistency for fractal optical property calculation - if ((carma%f_group(igroup)%f_imiertn == I_MIERTN_BOTET1997) .and. & - .not. carma%f_group(igroup)%f_is_fractal) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "CARMAGROUP_Create:& - &ERROR, fractal optics selected without fractal microphysics enabled." - end if - rc = RC_ERROR - return - end if - - ! Check input consistency for fractal physics - if (carma%f_group(igroup)%f_is_fractal .or. & - (carma%f_group(igroup)%f_imiertn == I_MIERTN_BOTET1997)) then - if (.not. (present(rmon) .and. present(df) .and. present(falpha))) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "CARMAGROUP_Create:& - &ERROR, for fractal physics must set rmon,df,falpha" - end if - rc = RC_ERROR - return - end if - end if - - return - end subroutine CARMAGROUP_Create - - - !! Deallocates the memory associated with a CARMAGROUP object. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGROUP_Create - subroutine CARMAGROUP_Destroy(carma, igroup, rc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igroup !! the group index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough groups allocated. - if (igroup > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Destroy:: ERROR - The specifed group (", & - igroup, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - if (allocated(carma%f_group(igroup)%f_refidx)) then - deallocate( & - carma%f_group(igroup)%f_refidx, & - carma%f_group(igroup)%f_qext, & - carma%f_group(igroup)%f_ssa, & - carma%f_group(igroup)%f_asym, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Destroy: ERROR deallocating, status=", ier - rc = RC_ERROR - return - endif - endif - - ! Allocate dynamic data. - if (allocated(carma%f_group(igroup)%f_r)) then - deallocate( & - carma%f_group(igroup)%f_r, & - carma%f_group(igroup)%f_rmass, & - carma%f_group(igroup)%f_vol, & - carma%f_group(igroup)%f_dr, & - carma%f_group(igroup)%f_dm, & - carma%f_group(igroup)%f_rmassup, & - carma%f_group(igroup)%f_rup, & - carma%f_group(igroup)%f_rlow, & - carma%f_group(igroup)%f_icorelem, & - carma%f_group(igroup)%f_arat, & - carma%f_group(igroup)%f_rrat, & - carma%f_group(igroup)%f_rprat, & - carma%f_group(igroup)%f_df, & - carma%f_group(igroup)%f_nmon, & - stat=ier) - if(ier /= 0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Destroy: ERROR deallocating, status=", ier - rc = RC_ERROR - return - endif - endif - - return - end subroutine CARMAGROUP_Destroy - - - !! Gets information about a group. - !! - !! The group name and most other properties are available after a call to - !! CARMAGROUP_Create(). After a call to CARMA_Initialize(), the bin - !! dimensions and optical properties can be retrieved. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGROUP_Create - !! @see CARMA_GetGroup - !! @see CARMA_Initialize - subroutine CARMAGROUP_Get(carma, igroup, rc, name, shortname, rmin, rmrat, ishape, eshape, is_ice, is_fractal, & - irhswell, irhswcomp, cnsttype, r, rlow, rup, dr, rmass, dm, vol, qext, ssa, asym, do_mie, & - do_wetdep, do_drydep, do_vtran, solfac, scavcoef, ienconc, refidx, ncore, icorelem, maxbin, & - ifallrtn, is_cloud, rmassmin, arat, rrat, rprat, imiertn, is_sulfate, dpc_threshold, rmon, df, & - nmon, falpha, neutral_volfrc) - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: igroup !! the group index - integer, intent(out) :: rc !! return code, negative indicates failure - character(len=*), optional, intent(out) :: name !! the group name - character(len=*), optional, intent(out) :: shortname !! the group short name - real(kind=f), optional, intent(out) :: rmin !! the minimum radius [cm] - real(kind=f), optional, intent(out) :: rmrat !! the volume ratio between bins - integer, optional, intent(out) :: ishape !! the type of the particle shape - real(kind=f), optional, intent(out) :: eshape !! the aspect ratio of the particle shape - logical, optional, intent(out) :: is_ice !! is this an ice particle? - logical, optional, intent(out) :: is_fractal !! is this a fractal? - integer, optional, intent(out) :: irhswell !! the parameterization for particle swelling - !! from relative humidity - integer, optional, intent(out) :: irhswcomp !! the composition for particle swelling - !! from relative humidity - integer, optional, intent(out) :: cnsttype !! constituent type in the parent model - real(kind=f), intent(out), optional :: r(carma%f_NBIN) !! the bin radius [cm] - real(kind=f), intent(out), optional :: rlow(carma%f_NBIN) !! the bin radius lower bound [cm] - real(kind=f), intent(out), optional :: rup(carma%f_NBIN) !! the bin radius upper bound [cm] - real(kind=f), intent(out), optional :: dr(carma%f_NBIN) !! the bin width in radius space [cm] - real(kind=f), intent(out), optional :: rmass(carma%f_NBIN) !! the bin mass [g] - real(kind=f), intent(out), optional :: dm(carma%f_NBIN) !! the bin width in mass space [g] - real(kind=f), intent(out), optional :: vol(carma%f_NBIN) !! the bin volume [cm3] - real(kind=f), intent(out), optional :: arat(carma%f_NBIN) !! the projected area ratio - !! (area / area enclosing sphere) - real(kind=f), intent(out), optional :: rrat(carma%f_NBIN) !! the radius ratio - !! (maximum dimension / radius of enclosing sphere) - real(kind=f), intent(out), optional :: rprat(carma%f_NBIN) !! the porusity radius ratio - !! (scaled porosity radius / equiv. sphere) - complex(kind=f), intent(out), optional :: refidx(carma%f_NWAVE) !! the refractive index at each wavelength - real(kind=f), intent(out), optional :: qext(carma%f_NWAVE,carma%f_NBIN) !! extinction efficiency - real(kind=f), intent(out), optional :: ssa(carma%f_NWAVE,carma%f_NBIN) !! single scattering albedo - real(kind=f), intent(out), optional :: asym(carma%f_NWAVE,carma%f_NBIN) !! asymmetry factor - logical, optional, intent(out) :: do_mie !! do mie calculations? - logical, optional, intent(out) :: do_wetdep !! do wet deposition for this particle? - logical, optional, intent(out) :: do_drydep !! do dry deposition for this particle? - logical, optional, intent(out) :: do_vtran !! do sedimentation for this particle? - real(kind=f), intent(out), optional :: solfac !! the solubility factor for wet deposition - real(kind=f), intent(out), optional :: scavcoef !! the scavenging coefficient for wet deposition - integer, intent(out), optional :: ienconc !! Particle number conc. element for group - integer, intent(out), optional :: ncore !! Number of core mass elements for group - integer, intent(out), optional :: icorelem(carma%f_NELEM) !! Element index of core mass elements for group - integer, optional, intent(out) :: maxbin !! the last prognostic bin in the group - integer, optional, intent(out) :: ifallrtn !! fall velocity routine [I_FALLRTN_STD - !! | I_FALLRTN_STD_SHAPE | I_FALLRTN_HEYMSFIELD2010 - !! | I_FALLRTN_ACKERMAN_DROP - !! | I_FALLRTN_ACKERMAN_ICE] - logical, optional, intent(out) :: is_cloud !! is this a cloud particle? - real(kind=f), optional, intent(out) :: rmassmin !! the minimum mass [g] - integer, optional, intent(out) :: imiertn !! mie routine [I_MIERTN_TOON1981 - !! | I_MIERTN_BOHREN1983 | I_MIERTN_BOTET1997] - logical, optional, intent(out) :: is_sulfate !! is this a sulfate particle? - real(kind=f), optional, intent(out) :: dpc_threshold !! convergence criteria for particle concentration - !! [fraction] - real(kind=f), optional, intent(out) :: rmon !! monomer radius for fractal particles - real(kind=f), optional, intent(out) :: df(carma%f_NBIN) !! fractal dimension - real(kind=f), optional, intent(out) :: nmon(carma%f_NBIN) !! number of monomers per - real(kind=f), optional, intent(out) :: falpha !! fractal packing coefficient - real(kind=f), optional, intent(out) :: neutral_volfrc !! volume fraction of core mass for neutralization - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough groups allocated. - if (igroup > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Get:: ERROR - The specifed group (", & - igroup, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - ! Return any requested properties of the group. - if (present(name)) name = carma%f_group(igroup)%f_name - if (present(shortname)) shortname = carma%f_group(igroup)%f_shortname - if (present(rmin)) rmin = carma%f_group(igroup)%f_rmin - if (present(rmrat)) rmrat = carma%f_group(igroup)%f_rmrat - if (present(ishape)) ishape = carma%f_group(igroup)%f_ishape - if (present(eshape)) eshape = carma%f_group(igroup)%f_eshape - if (present(is_ice)) is_ice = carma%f_group(igroup)%f_is_ice - if (present(is_fractal)) is_fractal = carma%f_group(igroup)%f_is_fractal - if (present(irhswell)) irhswell = carma%f_group(igroup)%f_irhswell - if (present(irhswcomp)) irhswcomp = carma%f_group(igroup)%f_irhswcomp - if (present(cnsttype)) cnsttype = carma%f_group(igroup)%f_cnsttype - if (present(r)) r(:) = carma%f_group(igroup)%f_r(:) - if (present(rlow)) rlow(:) = carma%f_group(igroup)%f_rlow(:) - if (present(rup)) rup(:) = carma%f_group(igroup)%f_rup(:) - if (present(dr)) dr(:) = carma%f_group(igroup)%f_dr(:) - if (present(rmass)) rmass(:) = carma%f_group(igroup)%f_rmass(:) - if (present(rrat)) rrat(:) = carma%f_group(igroup)%f_rrat(:) - if (present(arat)) arat(:) = carma%f_group(igroup)%f_arat(:) - if (present(rprat)) rprat(:) = carma%f_group(igroup)%f_rprat(:) - if (present(dm)) dm(:) = carma%f_group(igroup)%f_dm(:) - if (present(vol)) vol(:) = carma%f_group(igroup)%f_vol(:) - if (present(do_mie)) do_mie = carma%f_group(igroup)%f_do_mie - if (present(do_wetdep)) do_wetdep = carma%f_group(igroup)%f_do_wetdep - if (present(do_drydep)) do_drydep = carma%f_group(igroup)%f_grp_do_drydep - if (present(do_vtran)) do_vtran = carma%f_group(igroup)%f_grp_do_vtran - if (present(solfac)) solfac = carma%f_group(igroup)%f_solfac - if (present(scavcoef)) scavcoef = carma%f_group(igroup)%f_scavcoef - if (present(ienconc)) ienconc = carma%f_group(igroup)%f_ienconc - if (present(ncore)) ncore = carma%f_group(igroup)%f_ncore - if (present(icorelem)) icorelem = carma%f_group(igroup)%f_icorelem(:) - if (present(maxbin)) maxbin = carma%f_group(igroup)%f_maxbin - if (present(ifallrtn)) ifallrtn = carma%f_group(igroup)%f_ifallrtn - if (present(is_cloud)) is_cloud = carma%f_group(igroup)%f_is_cloud - if (present(rmassmin)) rmassmin = carma%f_group(igroup)%f_rmassmin - if (present(imiertn)) imiertn = carma%f_group(igroup)%f_imiertn - if (present(is_sulfate)) is_sulfate = carma%f_group(igroup)%f_is_sulfate - if (present(dpc_threshold)) dpc_threshold = carma%f_group(igroup)%f_dpc_threshold - if (present(rmon)) rmon = carma%f_group(igroup)%f_rmon - if (present(df)) df(:) = carma%f_group(igroup)%f_df(:) - if (present(nmon)) nmon(:) = carma%f_group(igroup)%f_nmon(:) - if (present(falpha)) falpha = carma%f_group(igroup)%f_falpha - if (present(neutral_volfrc)) neutral_volfrc = carma%f_group(igroup)%f_neutral_volfrc - - if (carma%f_NWAVE == 0) then - if (present(refidx) .or. present(qext) .or. present(ssa) .or. present(asym)) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Get: ERROR no optical properties defined." - rc = RC_ERROR - return - end if - else - if (present(refidx)) refidx(:) = carma%f_group(igroup)%f_refidx(:) - if (present(qext)) qext(:,:) = carma%f_group(igroup)%f_qext(:,:) - if (present(ssa)) ssa(:,:) = carma%f_group(igroup)%f_ssa(:,:) - if (present(asym)) asym(:,:) = carma%f_group(igroup)%f_asym(:,:) - end if - - return - end subroutine CARMAGROUP_Get - - - - !! Prints information about a group. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMAGROUP_Get - subroutine CARMAGROUP_Print(carma, igroup, rc) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: igroup !! the group index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - integer :: i - character(len=CARMA_NAME_LEN) :: name ! name - character(len=CARMA_SHORT_NAME_LEN) :: shortname ! shortname - real(kind=f) :: rmin ! the minimum radius [cm] - real(kind=f) :: rmrat ! the volume ratio between bins - integer :: ishape ! the type of the particle shape - real(kind=f) :: eshape ! the aspect ratio of the particle shape - logical :: is_ice ! is this an ice particle? - logical :: is_fractal ! is this a fractal? - integer :: irhswell ! the parameterization for particle swelling - ! from relative humidity - integer :: irhswcomp ! the composition for particle swelling - ! from relative humidity - integer :: cnsttype ! constituent type in the parent model - real(kind=f) :: r(carma%f_NBIN) ! the bin radius [m] - real(kind=f) :: dr(carma%f_NBIN) ! the bin width in radius space [m] - real(kind=f) :: rmass(carma%f_NBIN) ! the bin mass [kg] - real(kind=f) :: dm(carma%f_NBIN) ! the bin width in mass space [kg] - real(kind=f) :: vol(carma%f_NBIN) ! the bin volume [m3] - integer :: ifallrtn ! fall velocity routine [I_FALLRTN_STD - ! | I_FALLRTN_STD_SHAPE | I_FALLRTN_HEYMSFIELD2010 - ! | I_FALLRTN_ACKERMAN_DROP | I_FALLRTN_ACKERMAN_ICE] - logical :: is_cloud ! is this a cloud particle? - real(kind=f) :: rmassmin ! the minimum mass [g] - logical :: do_mie ! do mie calculations? - logical :: do_wetdep ! do wet deposition for this particle? - logical :: do_drydep ! do dry deposition for this particle? - logical :: do_vtran ! do sedimentation for this particle? - integer :: imiertn ! mie scattering routine - logical :: is_sulfate ! is this a sulfate particle? - real(kind=f) :: dpc_threshold ! convergence criteria for particle concentration - ! [fraction] - real(kind=f) :: neutral_volfrc ! volume fraction of core mass for neutralization - - ! Assume success. - rc = RC_OK - - ! Test out the Get method. - if (carma%f_do_print) then - call CARMAGROUP_Get(carma, igroup, rc, name=name, shortname=shortname, & - rmin=rmin, rmrat=rmrat, ishape=ishape, eshape=eshape, & - is_ice=is_ice, is_fractal=is_fractal, is_cloud=is_cloud, & - irhswell=irhswell, irhswcomp=irhswcomp, cnsttype=cnsttype, & - r=r, dr=dr, rmass=rmass, dm=dm, vol=vol, ifallrtn=ifallrtn, & - rmassmin=rmassmin, do_mie=do_mie, do_wetdep=do_wetdep, & - do_drydep=do_drydep, do_vtran=do_vtran, imiertn=imiertn, & - neutral_volfrc=neutral_volfrc) - if (rc < 0) return - - - write(carma%f_LUNOPRT,*) " name : ", trim(name) - write(carma%f_LUNOPRT,*) " shortname : ", trim(shortname) - write(carma%f_LUNOPRT,*) " rmin : ", rmin, " (cm)" - write(carma%f_LUNOPRT,*) " rmassmin : ", rmassmin, " (g)" - write(carma%f_LUNOPRT,*) " rmrat : ", rmrat - write(carma%f_LUNOPRT,*) " dpc_threshold : ", dpc_threshold - - select case(ishape) - case (I_SPHERE) - write(carma%f_LUNOPRT,*) " ishape : spherical" - case (I_HEXAGON) - write(carma%f_LUNOPRT,*) " ishape : hexagonal" - case (I_CYLINDER) - write(carma%f_LUNOPRT,*) " ishape : cylindrical" - case default - write(carma%f_LUNOPRT,*) " ishape : unknown, ", ishape - end select - - write(carma%f_LUNOPRT,*) " eshape : ", eshape - write(carma%f_LUNOPRT,*) " is_ice : ", is_ice - write(carma%f_LUNOPRT,*) " is_fractal : ", is_fractal - write(carma%f_LUNOPRT,*) " is_cloud : ", is_cloud - write(carma%f_LUNOPRT,*) " is_sulfate : ", is_sulfate - - write(carma%f_LUNOPRT,*) " do_drydep : ", do_drydep - write(carma%f_LUNOPRT,*) " do_mie : ", do_mie - write(carma%f_LUNOPRT,*) " do_vtran : ", do_vtran - write(carma%f_LUNOPRT,*) " do_wetdep : ", do_wetdep - write(carma%f_LUNOPRT,*) " neutral_volfrc: ", neutral_volfrc - - select case(irhswell) - case (0) - write(carma%f_LUNOPRT,*) " irhswell : none" - case (I_FITZGERALD) - write(carma%f_LUNOPRT,*) " irhswell : Fitzgerald" - case (I_GERBER) - write(carma%f_LUNOPRT,*) " irhswell : Gerber" - case default - write(carma%f_LUNOPRT,*) " irhswell : unknown, ", irhswell - end select - - select case(irhswcomp) - case (0) - write(carma%f_LUNOPRT,*) " irhswcomp : none" - - case (I_SWF_NH42SO4) - write(carma%f_LUNOPRT,*) " irhswcomp : (NH4)2SO4 (Fitzgerald)" - case (I_SWF_NH4NO3) - write(carma%f_LUNOPRT,*) " irhswcomp : NH4NO3 (Fitzgerald)" - case (I_SWF_NANO3) - write(carma%f_LUNOPRT,*) " irhswcomp : NaNO3 (Fitzgerald)" - case (I_SWF_NH4CL) - write(carma%f_LUNOPRT,*) " irhswcomp : NH4Cl (Fitzgerald)" - case (I_SWF_CACL2) - write(carma%f_LUNOPRT,*) " irhswcomp : CaCl2 (Fitzgerald)" - case (I_SWF_NABR) - write(carma%f_LUNOPRT,*) " irhswcomp : NaBr (Fitzgerald)" - case (I_SWF_NACL) - write(carma%f_LUNOPRT,*) " irhswcomp : NaCl (Fitzgerald)" - case (I_SWF_MGCL2) - write(carma%f_LUNOPRT,*) " irhswcomp : MgCl2 (Fitzgerald)" - case (I_SWF_LICL) - write(carma%f_LUNOPRT,*) " irhswcomp : LiCl (Fitzgerald)" - - case (I_SWG_NH42SO4) - write(carma%f_LUNOPRT,*) " irhswcomp : (NH4)2SO4 (Gerber)" - case (I_SWG_RURAL) - write(carma%f_LUNOPRT,*) " irhswcomp : Rural (Gerber)" - case (I_SWG_SEA_SALT) - write(carma%f_LUNOPRT,*) " irhswcomp : Sea Salt (Gerber)" - case (I_SWG_URBAN) - write(carma%f_LUNOPRT,*) " irhswcomp : Urban (Gerber)" - - case default - write(carma%f_LUNOPRT,*) " irhswell : unknown, ", irhswcomp - end select - - select case(cnsttype) - case (0) - write(carma%f_LUNOPRT,*) " cnsttype : none" - case (I_CNSTTYPE_PROGNOSTIC) - write(carma%f_LUNOPRT,*) " cnsttype : prognostic" - case (I_CNSTTYPE_DIAGNOSTIC) - write(carma%f_LUNOPRT,*) " cnsttype : diagnostic" - case default - write(carma%f_LUNOPRT,*) " cnsttype : unknown, ", cnsttype - end select - - select case(ifallrtn) - case (I_FALLRTN_STD) - write(carma%f_LUNOPRT,*) " ifallrtn : standard" - case (I_FALLRTN_STD_SHAPE) - write(carma%f_LUNOPRT,*) " ifallrtn : standard (shape)" - case (I_FALLRTN_HEYMSFIELD2010) - write(carma%f_LUNOPRT,*) " ifallrtn : Heymsfield & Westbrook, 2010" - case default - write(carma%f_LUNOPRT,*) " ifallrtn : unknown, ", ifallrtn - end select - - select case(imiertn) - case (I_MIERTN_TOON1981) - write(carma%f_LUNOPRT,*) " imiertn : Toon & Ackerman, 1981" - case (I_MIERTN_BOHREN1983) - write(carma%f_LUNOPRT,*) " imiertn : Bohren & Huffman, 1983" - case (I_MIERTN_BOTET1997) - write(carma%f_LUNOPRT,*) " imiertn : Botet, Rannou & Cabane, 1997" - case default - write(carma%f_LUNOPRT,*) " imiertn : unknown, ", imiertn - end select - - write(carma%f_LUNOPRT,*) - write(carma%f_LUNOPRT,"(' ', a4, 5a12)") "bin", "r", "dr", "rmass", "dm", "vol" - write(carma%f_LUNOPRT,"(' ', a4, 5a12)") "", "(cm)", "(cm)", "(g)", "(g)", "(cm3)" - - do i = 1, carma%f_NBIN - write(carma%f_LUNOPRT, "(' ', i4, 5g12.3)") i, r(i), dr(i), rmass(i), dm(i), vol(i) - end do - end if - - return - end subroutine CARMAGROUP_Print - - !! Sets information about a group. - !! - !! Group optical properties may not be set by the CARMA initialization and - !! may instead be specified by an outside source (e.g. read in from a file). - !! - !! @author Chuck Bardeen - !! @version May-2013 - !! - !! @see CARMAGROUP_Create - !! @see CARMA_GetGroup - !! @see CARMA_Initialize - subroutine CARMAGROUP_Set(carma, igroup, rc, qext, ssa, asym) - - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: igroup !! the group index - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), intent(in), optional :: qext(carma%f_NWAVE,carma%f_NBIN) !! extinction efficiency - real(kind=f), intent(in), optional :: ssa(carma%f_NWAVE,carma%f_NBIN) !! single scattering albedo - real(kind=f), intent(in), optional :: asym(carma%f_NWAVE,carma%f_NBIN) !! asymmetry factor - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough groups allocated. - if (igroup > carma%f_NGROUP) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Set:: ERROR - The specifed group (", & - igroup, ") is larger than the number of groups (", carma%f_NGROUP, ")." - rc = RC_ERROR - return - end if - - ! Set any requested properties of the group. - if (carma%f_NWAVE == 0) then - if (present(qext) .or. present(ssa) .or. present(asym)) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMAGROUP_Get: ERROR no optical properties defined." - rc = RC_ERROR - return - end if - else - if (present(qext)) carma%f_group(igroup)%f_qext(:,:) = qext(:,:) - if (present(ssa)) carma%f_group(igroup)%f_ssa(:,:) = ssa(:,:) - if (present(asym)) carma%f_group(igroup)%f_asym(:,:) = asym(:,:) - end if - - return - end subroutine CARMAGROUP_Set - -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carmasolute_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carmasolute_mod.F90 deleted file mode 100644 index 17274f57..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carmasolute_mod.F90 +++ /dev/null @@ -1,176 +0,0 @@ -!! The CARMASOLUTE module contains configuration information about a solute used by CARMA. -!! -!! @version May-2009 -!! @author Chuck Bardeen -module carmasolute_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! CARMA explicitly declares all variables. - implicit none - - ! All CARMA variables and procedures are private except those explicitly declared to be public. - private - - ! Declare the public methods. - public CARMASOLUTE_Create - public CARMASOLUTE_Destroy - public CARMASOLUTE_Get - public CARMASOLUTE_Print - -contains - - !! Defines a solute used by CARMA for nucleation and growth of cloud and - !! aerosol particles. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMA_AddGas - !! @see CARMASOLUTE_Destroy - subroutine CARMASOLUTE_Create(carma, isolute, name, ions, wtmol, rho, rc, shortname) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: isolute !! the solute index - character(*), intent(in) :: name !! the solute name, maximum of 255 characters - integer, intent(in) :: ions !! Number of ions solute dissociates into - real(kind=f), intent(in) :: wtmol !! the solute molecular weight [g/mol] - real(kind=f), intent(in) :: rho !! Mass density of solute - integer, intent(out) :: rc !! return code, negative indicates failure - character(*), optional, intent(in) :: shortname !! the solute shortname, maximum of 6 characters - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough solutes allocated. - if (isolute > carma%f_NSOLUTE) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMASOLUTE_Create:: ERROR - The specifed solute (", & - isolute, ") is larger than the number of solutes (", carma%f_NSOLUTE, ")." - rc = RC_ERROR - return - end if - - ! Save off the settings. - carma%f_solute(isolute)%f_name = name - carma%f_solute(isolute)%f_ions = ions - carma%f_solute(isolute)%f_wtmol = wtmol - carma%f_solute(isolute)%f_rho = rho - - - ! Defaults for optional parameters - carma%f_solute(isolute)%f_shortname = "" - - ! Set optional parameters. - if (present(shortname)) carma%f_solute(isolute)%f_shortname = shortname - - return - end subroutine CARMASOLUTE_Create - - - !! Deallocates the memory associated with a CARMASOLUTE object. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMASOLUTE_Create - subroutine CARMASOLUTE_Destroy(carma, isolute, rc) - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(in) :: isolute !! the solute index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough solutes allocated. - if (isolute > carma%f_NSOLUTE) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMASOLUTE_Destroy:: ERROR - The specifed solute (", & - isolute, ") is larger than the number of solutes (", carma%f_NSOLUTE, ")." - rc = RC_ERROR - return - end if - - return - end subroutine CARMASOLUTE_Destroy - - - !! Gets information about a solute. - !! - !! The group name and other properties are available after a call to - !! CARMASOLUTE_Create(). - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMASOLUTE_Create - !! @see CARMA_GetGas - subroutine CARMASOLUTE_Get(carma, isolute, rc, name, shortname, ions, wtmol, rho) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: isolute !! the solute index - integer, intent(out) :: rc !! return code, negative indicates failure - character(len=*), optional, intent(out) :: name !! the solute name - character(len=*), optional, intent(out) :: shortname !! the solute short name - integer, optional, intent(out) :: ions !! Number of ions solute dissociates into - real(kind=f), optional, intent(out) :: wtmol !! the solute molecular weight [g/mol] - real(kind=f), optional, intent(out) :: rho !! Mass density of solute - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough solutes allocated. - if (isolute > carma%f_NSOLUTE) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "CARMASOLUTE_Get:: ERROR - The specifed solute (", & - isolute, ") is larger than the number of solutes (", carma%f_NSOLUTE, ")." - rc = RC_ERROR - return - end if - - ! Return any requested properties of the group. - if (present(name)) name = carma%f_solute(isolute)%f_name - if (present(shortname)) shortname = carma%f_solute(isolute)%f_shortname - if (present(ions)) ions = carma%f_solute(isolute)%f_ions - if (present(wtmol)) wtmol = carma%f_solute(isolute)%f_wtmol - if (present(rho)) rho = carma%f_solute(isolute)%f_rho - - return - end subroutine CARMASOLUTE_Get - - - !! Prints information about a solute. - !! - !! @author Chuck Bardeen - !! @version May-2009 - !! - !! @see CARMASOLUTE_Get - subroutine CARMASOLUTE_Print(carma, isolute, rc) - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: isolute !! the solute index - integer, intent(out) :: rc !! return code, negative indicates failure - - ! Local variables - character(len=CARMA_NAME_LEN) :: name !! name - character(len=CARMA_SHORT_NAME_LEN) :: shortname !! shortname - integer :: ions !! Number of ions solute dissociates into - real(kind=f) :: wtmol !! the solute molecular weight [g/mol] - real(kind=f) :: rho !! Mass density of solute - - ! Assume success. - rc = RC_OK - - ! Test out the Get method. - if (carma%f_do_print) then - call CARMASOLUTE_Get(carma, isolute, rc, name=name, shortname=shortname, ions=ions, wtmol=wtmol, rho=rho) - if (rc < 0) return - - - write(carma%f_LUNOPRT,*) " name : ", trim(name) - write(carma%f_LUNOPRT,*) " shortname : ", trim(shortname) - write(carma%f_LUNOPRT,*) " ions : ", ions - write(carma%f_LUNOPRT,*) " wtmol : ", wtmol, " (g/mol)" - write(carma%f_LUNOPRT,*) " rho : ", rho, " (g/cm3)" - end if - - return - end subroutine CARMASOLUTE_Print -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/carmastate_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/carmastate_mod.F90 deleted file mode 100644 index 0d110b25..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/carmastate_mod.F90 +++ /dev/null @@ -1,1697 +0,0 @@ -!! The CARMA state module contains the atmospheric data for use with the CARMA -!! module. This implementation has been customized to work within other model -!! frameworks. CARMA adds a lot of extra state information (atmospheric -!! properties, fall velocities, coagulation kernels, growth kernels, ...) and -!! thus has a large memory footprint. Because only one column will be operated -!! upon at a time per thread, only one cstate object needs to be instantiated -!! at a time and each cstate object only represents one column. This keeps -!! the memory requirements of CARMA to a minimum. -!! -!! @version Feb-2009 -!! @author Chuck Bardeen, Pete Colarco, Jamie Smith -! -! NOTE: Documentation for this code can be generated automatically using f90doc, -! which is freely available from: -! http://erikdemaine.org/software/f90doc/ -! Comment lines with double comment characters are processed by f90doc, and there are -! some special characters added to the comments to control the documentation process. -! In addition to the special characters mentioned in the f990doc documentation, html -! formatting tags (e.g. , , ...) can also be added to the f90doc -! comments. -module carmastate_mod - - ! This module maps the parents models constants into the constants need by CARMA. - ! NOTE: CARMA constants are in CGS units, while the parent models are typically in - ! MKS units. - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - - ! cstate explicitly declares all variables. - implicit none - - ! All cstate variables and procedures are private except those explicitly - ! declared to be public. - private - - ! Declare the public methods. - public CARMASTATE_Create - public CARMASTATE_CreateFromReference - public CARMASTATE_Destroy - public CARMASTATE_Get - public CARMASTATE_GetBin - public CARMASTATE_GetDetrain - public CARMASTATE_GetGas - public CARMASTATE_GetState - public CARMASTATE_SetBin - public CARMASTATE_SetDetrain - public CARMASTATE_SetGas - public CARMASTATE_SetState - public CARMASTATE_Step - -contains - - ! These are the methods that provide the interface between the parent model and - ! the atmospheric state data of the CARMA microphysical model. There are many other - ! methods that are not in this file that are used to implement the microphysical - ! calculations needed by the CARMA model. These other methods are in effect private - ! methods of the CARMA module, but are in individual files since that is the way that - ! CARMA has traditionally been structured and where users may want to extend or - ! replace code to affect the microphysics. - - !! Create the CARMASTATE object, which contains information about the - !! atmospheric state. Internally, CARMA uses CGS units, but this interface uses - !! MKS units which are more commonly used in parent models. The units and grid - !! orientation depend on the grid type: - !! - !! - igridh - !! - I_CART : Cartesian coordinates, units in [m] - !! - I_LL : Lat/Lon coordinates, units in [degrees] - !! - !! - igridv - !! - I_CART : Cartesian coordinates, units in [m], bottom at NZ=1 - !! - I_SIG : Sigma coordinates, unitless [P/P0], top at NZ=1 - !! - I_HYBRID : Hybrid coordinates, unitless [~P/P0], top at NZ=1 - !! - !! NOTE: The supplied CARMA object should already have been created, configured, - !! and initialized. - !! - !! NOTE: The relative humidity is optional, but needs to be supplied if particles - !! are subject to swelling based upon relative humidity. The specific humdity can - !! can be specified instead. If both are specified, then the realtive humidity is - !! used. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_Create - !! @see CARMA_Initialize - !! @see CARMASTATE_Destroy - subroutine CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, igridv, igridh, & - lat, lon, xc, dx, yc, dy, zc, zl, p, pl, t, rc, qh2o, relhum, told, radint) - type(carmastate_type), intent(inout) :: cstate !! the carma state object - type(carma_type), pointer, intent(in) :: carma_ptr !! (in) the carma object - real(kind=f), intent(in) :: time !! the model time [s] - real(kind=f), intent(in) :: dtime !! the timestep size [s] - integer, intent(in) :: NZ !! the number of vertical grid points - integer, intent(in) :: igridv !! vertical grid type - integer, intent(in) :: igridh !! horizontal grid type - real(kind=f), intent(in) :: lat !! latitude at center [degrees north] - real(kind=f), intent(in) :: lon !! longitude at center [degrees east] - real(kind=f), intent(in) :: xc(NZ) !! x at center - real(kind=f), intent(in) :: dx(NZ) !! ix width - real(kind=f), intent(in) :: yc(NZ) !! y at center - real(kind=f), intent(in) :: dy(NZ) !! y width - real(kind=f), intent(in) :: zc(NZ) !! z at center - real(kind=f), intent(in) :: zl(NZ+1) !! z at edge - real(kind=f), intent(in) :: p(NZ) !! pressure at center [Pa] - real(kind=f), intent(in) :: pl(NZ+1) !! presssure at edge [Pa] - real(kind=f), intent(in) :: t(NZ) !! temperature at center [K] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), intent(in) , optional :: qh2o(NZ) !! specific humidity at center [mmr] - real(kind=f), intent(in) , optional :: relhum(NZ) !! relative humidity at center [fraction] - real(kind=f), intent(in) , optional :: told(NZ) !! previous temperature at center [K] - real(kind=f), intent(in) , optional :: radint(NZ,carma_ptr%f_NWAVE) !! radiative intensity [W/m2/sr/cm] - - integer :: iz - real(kind=f) :: rvap - real(kind=f) :: pvap_liq - real(kind=f) :: pvap_ice - real(kind=f) :: gc_cgs - - ! Assume success. - rc = RC_OK - - ! Save the defintion of the number of comonents involved in the microphysics. - cstate%f_carma => carma_ptr - - ! Save the model timing. - cstate%f_time = time - cstate%f_dtime_orig = dtime - cstate%f_dtime = dtime - cstate%f_nretries = 0 - - ! Save the grid dimensions. - cstate%f_NZ = NZ - cstate%f_NZP1 = NZ+1 - - ! Save the grid definition. - cstate%f_igridv = igridv - cstate%f_igridh = igridh - - ! Store away the grid location information. - cstate%f_lat = lat - cstate%f_lon = lon - - ! Allocate all the dynamic variables related to state. - call CARMASTATE_Allocate(cstate, rc) - if (rc < 0) return - - cstate%f_xc(:) = xc(:) - cstate%f_dx(:) = dx(:) - cstate%f_yc(:) = yc(:) - cstate%f_dy(:) = dy(:) - cstate%f_zc(:) = zc(:) - cstate%f_zl(:) = zl(:) - - ! Store away the grid state, doing any necessary unit conversions from MKS to CGS. - cstate%f_p(:) = p(:) * RPA2CGS - cstate%f_pl(:) = pl(:) * RPA2CGS - cstate%f_t(:) = t(:) - - cstate%f_pcd(:,:,:) = 0._f - - if (carma_ptr%f_do_substep) then - if (present(told)) then - cstate%f_told(:) = told - else - if (carma_ptr%f_do_print) write(carma_ptr%f_LUNOPRT,*) "CARMASTATE_Create: Error - Need to specify told when substepping." - rc = RC_ERROR - - return - end if - end if - - ! Calculate the metrics, ... - ! if Cartesian coordinates were specifed, then the units need to be converted - ! from MKS to CGS. - if (cstate%f_igridh == I_CART) then - cstate%f_xc = cstate%f_xc * RM2CGS - cstate%f_dx = cstate%f_dx * RM2CGS - cstate%f_yc = cstate%f_yc * RM2CGS - cstate%f_dy = cstate%f_dy * RM2CGS - end if - - if (cstate%f_igridv == I_CART) then - cstate%f_zc = cstate%f_zc * RM2CGS - cstate%f_zl = cstate%f_zl * RM2CGS - end if - - ! Initialize the state of the atmosphere. - call setupatm(carma_ptr, cstate, carma_ptr%f_do_fixedinit, rc) - if (rc < 0) return - - ! Set the realtive humidity. If necessary, it will be calculated from - ! the specific humidity. - if (present(relhum)) then - cstate%f_relhum(:) = relhum(:) - else if (present(qh2o)) then - - ! Define gas constant for this gas - rvap = RGAS/WTMOL_H2O - - ! Calculate relative humidity - do iz = 1, NZ - call vaporp_h2o_murphy2005(carma_ptr, cstate, iz, rc, pvap_liq, pvap_ice) - if (rc < 0) return - - gc_cgs = qh2o(iz)*cstate%f_rhoa_wet(iz) / (cstate%f_zmet(iz)*cstate%f_xmet(iz)*cstate%f_ymet(iz)) - cstate%f_relhum(iz) = ( gc_cgs * rvap * t(iz)) / pvap_liq - enddo - end if - - ! Need for vertical transport. - ! - ! NOTE: How should these be set? Optional parameters? - if (carma_ptr%f_do_vtran) then - cstate%f_ftoppart(:,:) = 0._f - cstate%f_fbotpart(:,:) = 0._f - cstate%f_pc_topbnd(:,:) = 0._f - cstate%f_pc_botbnd(:,:) = 0._f - end if - - ! Radiative intensity for particle heating. - ! - ! W/m2/sr/cm -> erg/s/cm2/sr/cm - if (carma_ptr%f_do_grow) then - if (present(radint)) cstate%f_radint(:,:) = radint(:,:) * 1e7_f / 1e4_f - end if - - return - end subroutine CARMASTATE_Create - - - !! Create the CARMASTATE object, which contains information about the - !! atmospheric state. - !! - !! This call is similar to CARMASTATE_Create, but differs in that all the - !! initialization happens here based on the the fixed state information provided rather - !! than occurring in CARMASTATE_Step. - !! - !! This call should be done before CARMASTATE_Create when do_fixedinit has been - !! specified. The temperatures and pressures specified here should be the reference - !! state used for all columns, not an actual column from the model. - !! - !! A water vapor profile is optional, but is used whenever either qh2o (preferred) - !! or relhum have been provided. If this is not provided, then initialization will - !! be done on a dry profile. If particle swelling occurs, initialization will be - !! done on the wet radius; however, most of the initialized values will not get - !! recalculated as the wet radius changes. - !! - !! CARMASTATE_Create should still be called again after this call with the actual - !! column of state information from the model. The initialization will be done once - !! from the reference state, but the microphysical calculations will be done on the - !! model state. Multiple CARMASTATE_Create ... CARMASTATE_Step calls can be done - !! before a CARMASTATE_Destroy. This reduces the amount of memory allocations and - !! when used with do_fixedinit, reduces the amount of time spent initializing. - !! - !! @author Chuck Bardeen - !! @version June-2010 - !! @see CARMA_Create - !! @see CARMA_Initialize - !! @see CARMASTATE_Destroy - subroutine CARMASTATE_CreateFromReference(cstate, carma_ptr, time, dtime, NZ, igridv, igridh, & - lat, lon, xc, dx, yc, dy, zc, zl, p, pl, t, rc, qh2o, relhum, qh2so4) - type(carmastate_type), intent(inout) :: cstate !! the carma state object - type(carma_type), pointer, intent(in) :: carma_ptr !! (in) the carma object - real(kind=f), intent(in) :: time !! the model time [s] - real(kind=f), intent(in) :: dtime !! the timestep size [s] - integer, intent(in) :: NZ !! the number of vertical grid points - integer, intent(in) :: igridv !! vertical grid type - integer, intent(in) :: igridh !! horizontal grid type - real(kind=f), intent(in) :: lat !! latitude at center [degrees north] - real(kind=f), intent(in) :: lon !! longitude at center [degrees east] - real(kind=f), intent(in) :: xc(NZ) !! x at center - real(kind=f), intent(in) :: dx(NZ) !! ix width - real(kind=f), intent(in) :: yc(NZ) !! y at center - real(kind=f), intent(in) :: dy(NZ) !! y width - real(kind=f), intent(in) :: zc(NZ) !! z at center - real(kind=f), intent(in) :: zl(NZ+1) !! z at edge - real(kind=f), intent(in) :: p(NZ) !! pressure at center [Pa] - real(kind=f), intent(in) :: pl(NZ+1) !! presssure at edge [Pa] - real(kind=f), intent(in) :: t(NZ) !! temperature at center [K] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), intent(in) , optional :: qh2o(NZ) !! specific humidity at center [mmr] - real(kind=f), intent(in) , optional :: relhum(NZ) !! relative humidity at center [fraction] - real(kind=f), intent(in) , optional :: qh2so4(NZ) !! H2SO4 mass mixing ratio at center [mmr] - - integer :: iz - integer :: igas - real(kind=f) :: rvap - real(kind=f) :: pvap_liq - real(kind=f) :: pvap_ice - real(kind=f) :: gc_cgs - - ! Assume success. - rc = RC_OK - - ! Save the defintion of the number of comonents involved in the microphysics. - cstate%f_carma => carma_ptr - - ! Save the model timing. - cstate%f_time = time - cstate%f_dtime_orig = dtime - cstate%f_dtime = dtime - cstate%f_nretries = 0 - - ! Save the grid dimensions. - cstate%f_NZ = NZ - cstate%f_NZP1 = NZ+1 - - ! Save the grid definition. - cstate%f_igridv = igridv - cstate%f_igridh = igridh - - ! Store away the grid location information. - cstate%f_lat = lat - cstate%f_lon = lon - - ! Allocate all the dynamic variables related to state. - call CARMASTATE_Allocate(cstate, rc) - if (rc < 0) return - - cstate%f_xc(:) = xc(:) - cstate%f_dx(:) = dx(:) - cstate%f_yc(:) = yc(:) - cstate%f_dy(:) = dy(:) - cstate%f_zc(:) = zc(:) - cstate%f_zl(:) = zl(:) - - ! Store away the grid state, doing any necessary unit conversions from MKS to CGS. - cstate%f_p(:) = p(:) * RPA2CGS - cstate%f_pl(:) = pl(:) * RPA2CGS - cstate%f_t(:) = t(:) - - cstate%f_pcd(:,:,:) = 0._f - - ! Calculate the metrics, ... - ! if Cartesian coordinates were specifed, then the units need to be converted - ! from MKS to CGS. - if (cstate%f_igridh == I_CART) then - cstate%f_xc = cstate%f_xc * RM2CGS - cstate%f_dx = cstate%f_dx * RM2CGS - cstate%f_yc = cstate%f_yc * RM2CGS - cstate%f_dy = cstate%f_dy * RM2CGS - end if - - if (cstate%f_igridv == I_CART) then - cstate%f_zc = cstate%f_zc * RM2CGS - cstate%f_zl = cstate%f_zl * RM2CGS - end if - - ! Initialize the state of the atmosphere. - call setupatm(carma_ptr, cstate, .false., rc) - if (rc < 0) return - - ! If the model uses a gas it is useful to initialize to some value - if(cstate%f_carma%f_NGAS > 0) then - do iz = 1, cstate%f_NZ - do igas = 1, cstate%f_carma%f_NGAS - cstate%f_gc(iz,igas) = 1.e-30_f - enddo - enddo - endif - - ! If the model uses a gas, then set the relative and - ! specific humidities. - if (carma_ptr%f_igash2o /= 0) then - - if (present(qh2o)) then - cstate%f_gc(:, carma_ptr%f_igash2o) = qh2o(:) * cstate%f_rhoa_wet(:) - - ! Define gas constant for this gas - rvap = RGAS/WTMOL_H2O - - ! Calculate relative humidity - do iz = 1, NZ - call vaporp_h2o_murphy2005(carma_ptr, cstate, iz, rc, pvap_liq, pvap_ice) - if (rc < 0) return - - gc_cgs = qh2o(iz) * cstate%f_rhoa_wet(iz) / (cstate%f_zmet(iz)*cstate%f_xmet(iz)*cstate%f_ymet(iz)) - cstate%f_relhum(iz) = (gc_cgs * rvap * t(iz)) / pvap_liq - enddo - - else if (present(relhum)) then - cstate%f_relhum(:) = relhum - - ! Define gas constant for this gas - rvap = RGAS/WTMOL_H2O - - ! Calculate specific humidity - do iz = 1, NZ - call vaporp_h2o_murphy2005(carma_ptr, cstate, iz, rc, pvap_liq, pvap_ice) - if (rc < 0) return - - gc_cgs = (rvap * t(iz)) / (pvap_liq * relhum(iz)) - cstate%f_gc(iz, carma_ptr%f_igash2o) = gc_cgs * & - (cstate%f_zmet(iz)*cstate%f_xmet(iz)*cstate%f_ymet(iz)) / & - cstate%f_rhoa_wet(iz) - enddo - end if - end if - - ! If the model uses sulfuric acid, then set that gas concentration. - if (carma_ptr%f_igash2so4 /= 0) then - if (present(qh2so4)) then - cstate%f_gc(:, carma_ptr%f_igash2so4) = qh2so4(:) * cstate%f_rhoa_wet(:) - end if - end if - - ! Determine the gas supersaturations. - do iz = 1, cstate%f_NZ - do igas = 1, cstate%f_carma%f_NGAS - call supersat(cstate%f_carma, cstate, iz, igas, rc) - if (rc < 0) return - end do - end do - - ! Need for vertical transport. - ! - ! NOTE: How should these be set? Optional parameters? - if (carma_ptr%f_do_vtran) then - cstate%f_ftoppart(:,:) = 0._f - cstate%f_fbotpart(:,:) = 0._f - cstate%f_pc_topbnd(:,:) = 0._f - cstate%f_pc_botbnd(:,:) = 0._f - end if - - - ! Now do the initialization that is normally done in CARMASTATE_Step. However - ! here it is done using the reference atmosphere. - - ! Determine the particle densities. - call rhopart(cstate%f_carma, cstate, rc) - if (rc < 0) return - - ! Save off the wet radius and wet density as reference values to be used - ! later to scale process rates based upon changes to the wet radius and - ! wet density when particle swelling is used. - cstate%f_r_ref(:,:,:) = cstate%f_r_wet(:,:,:) - cstate%f_rhop_ref(:,:,:) = cstate%f_rhop_wet(:,:,:) - - ! If configured for fixed initialization, then we will lose some accuracy - ! in the calculation of the fall velocities, growth kernels, ... and in return - ! will gain a significant performance by not having to initialize as often. - - ! Initialize the vertical transport. - if (cstate%f_carma%f_do_vtran .or. cstate%f_carma%f_do_coag .or. cstate%f_carma%f_do_grow) then - call setupvf(cstate%f_carma, cstate, rc) - - if (cstate%f_carma%f_do_vdiff) then - call setupbdif(cstate%f_carma, cstate, rc) - end if - end if - - ! Intialize the nucleation, growth and evaporation. - if (cstate%f_carma%f_do_grow) then - call setupgrow(cstate%f_carma, cstate, rc) - if (rc < 0) return - - call setupgkern(cstate%f_carma, cstate, rc) - if (rc < 0) return - - call setupnuc(cstate%f_carma, cstate, rc) - if (rc < 0) return - end if - - ! Initialize the coagulation. - if (cstate%f_carma%f_do_coag) then - call setupckern(cstate%f_carma, cstate, rc) - if (rc < 0) return - end if - - return - end subroutine CARMASTATE_CreateFromReference - - - subroutine CARMASTATE_Allocate(cstate, rc) - type(carmastate_type), intent(inout) :: cstate - integer, intent(out) :: rc - - ! Local Variables - integer :: ier - integer :: NZ - integer :: NZP1 - integer :: NGROUP - integer :: NELEM - integer :: NBIN - integer :: NGAS - integer :: NWAVE - - ! Assume success. - rc = RC_OK - - ! Check to see if the arrays are already allocated. If so, just reuse the - ! existing allocations. - - ! Allocate the variables needed for setupatm. - if (.not. (allocated(cstate%f_xmet))) then - - NZ = cstate%f_NZ - NZP1 = cstate%f_NZP1 - NGROUP = cstate%f_carma%f_NGROUP - NELEM = cstate%f_carma%f_NELEM - NBIN = cstate%f_carma%f_NBIN - NGAS = cstate%f_carma%f_NGAS - NWAVE = cstate%f_carma%f_NWAVE - - allocate( & - cstate%f_xmet(NZ), & - cstate%f_ymet(NZ), & - cstate%f_zmet(NZ), & - cstate%f_zmetl(NZP1), & - cstate%f_xc(NZ), & - cstate%f_yc(NZ), & - cstate%f_zc(NZ), & - cstate%f_dx(NZ), & - cstate%f_dy(NZ), & - cstate%f_dz(NZ), & - cstate%f_zl(NZP1), & - cstate%f_pc(NZ,NBIN,NELEM), & - cstate%f_pcd(NZ,NBIN,NELEM), & - cstate%f_pc_surf(NBIN,NELEM), & - cstate%f_sedimentationflux(NBIN,NELEM), & - cstate%f_gc(NZ,NGAS), & - cstate%f_cldfrc(NZ), & - cstate%f_rhcrit(NZ), & - cstate%f_rhop(NZ,NBIN,NGROUP), & - cstate%f_r_wet(NZ,NBIN,NGROUP), & - cstate%f_rlow_wet(NZ,NBIN,NGROUP), & - cstate%f_rup_wet(NZ,NBIN,NGROUP), & - cstate%f_rhop_wet(NZ,NBIN,NGROUP), & - cstate%f_r_ref(NZ,NBIN,NGROUP), & - cstate%f_rhop_ref(NZ,NBIN,NGROUP), & - cstate%f_rhoa(NZ), & - cstate%f_rhoa_wet(NZ), & - cstate%f_t(NZ), & - cstate%f_p(NZ), & - cstate%f_pl(NZP1), & - cstate%f_relhum(NZ), & - cstate%f_wtpct(NZ), & - cstate%f_rmu(NZ), & - cstate%f_thcond(NZ), & - cstate%f_thcondnc(NZ,NBIN,NGROUP), & - cstate%f_dpc_sed(NBIN,NELEM), & - cstate%f_pconmax(NZ,NGROUP), & - cstate%f_pcl(NZ,NBIN,NELEM), & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - &ERROR allocating atmosphere arrays, status=", ier - end if - rc = RC_ERROR - return - end if - - cstate%f_relhum(:) = 0._f - cstate%f_pc(:,:,:) = 0._f - cstate%f_pcd(:,:,:) = 0._f - cstate%f_pc_surf(:,:) = 0._f - cstate%f_sedimentationflux(:,:) = 0._f - cstate%f_cldfrc(:) = 1._f - cstate%f_rhcrit(:) = 1._f - - ! Allocate the last fields if they are needed for substepping. - if (cstate%f_carma%f_do_substep) then - allocate( & - cstate%f_gcl(NZ,NGAS), & - cstate%f_d_gc(NZ,NGAS), & - cstate%f_told(NZ), & - cstate%f_d_t(NZ), & - cstate%f_zsubsteps(NZ), & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - &ERROR allocating stepping arrays, status=", ier - end if - rc = RC_ERROR - return - endif - - ! Initialize - cstate%f_gcl(:,:) = 0._f - cstate%f_d_gc(:,:) = 0._f - cstate%f_told(:) = 0._f - cstate%f_d_t(:) = 0._f - cstate%f_zsubsteps(:) = 0._f - - ! When substepping is enabled, we want to initialize these statistics once for - ! the life of the object. - cstate%f_max_nsubstep = 0 - cstate%f_max_nretry = 0._f - cstate%f_nstep = 0._f - cstate%f_nsubstep = 0 - cstate%f_nretry = 0._f - endif - - - ! Allocate the variables needed for setupvf. - ! - ! NOTE: Coagulation and dry deposition also need bpm, vf and re. - if (cstate%f_carma%f_do_vtran .or. cstate%f_carma%f_do_coag .or. & - cstate%f_carma%f_do_grow .or. cstate%f_carma%f_do_drydep) then - allocate( & - cstate%f_bpm(NZ,NBIN,NGROUP), & - cstate%f_vf(NZP1,NBIN,NGROUP), & - cstate%f_re(NZ,NBIN,NGROUP), & - cstate%f_dkz(NZP1,NBIN,NGROUP), & - cstate%f_ftoppart(NBIN,NELEM), & - cstate%f_fbotpart(NBIN,NELEM), & - cstate%f_pc_topbnd(NBIN,NELEM), & - cstate%f_pc_botbnd(NBIN,NELEM), & - cstate%f_vd(NBIN, NGROUP), & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - &ERROR allocating vertical transport arrays, status=", ier - end if - rc = RC_ERROR - return - endif - - ! Initialize - cstate%f_bpm(:,:,:) = 0._f - cstate%f_vf(:,:,:) = 0._f - cstate%f_re(:,:,:) = 0._f - cstate%f_dkz(:,:,:) = 0._f - cstate%f_ftoppart(:,:) = 0._f - cstate%f_fbotpart(:,:) = 0._f - cstate%f_pc_topbnd(:,:) = 0._f - cstate%f_pc_botbnd(:,:) = 0._f - cstate%f_vd(:, :) = 0._f - end if - - - - if (cstate%f_carma%f_NGAS > 0) then - allocate( & - cstate%f_pvapl(NZ,NGAS), & - cstate%f_pvapi(NZ,NGAS), & - cstate%f_supsatl(NZ,NGAS), & - cstate%f_supsati(NZ,NGAS), & - cstate%f_supsatlold(NZ,NGAS), & - cstate%f_supsatiold(NZ,NGAS), & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - ERROR allocating gas arrays, status=", ier - end if - rc = RC_ERROR - return - endif - end if - - - if (cstate%f_carma%f_do_grow) then - allocate( & - cstate%f_diffus(NZ,NGAS), & - cstate%f_rlhe(NZ,NGAS), & - cstate%f_rlhm(NZ,NGAS), & - cstate%f_surfctwa(NZ), & - cstate%f_surfctiw(NZ), & - cstate%f_surfctia(NZ), & - cstate%f_akelvin(NZ,NGAS), & - cstate%f_akelvini(NZ,NGAS), & - cstate%f_ft(NZ,NBIN,NGROUP), & - cstate%f_gro(NZ,NBIN,NGROUP), & - cstate%f_gro1(NZ,NBIN,NGROUP), & - cstate%f_gro2(NZ,NGROUP), & - cstate%f_scrit(NZ,NBIN,NGROUP), & - cstate%f_rnuclg(NBIN,NGROUP,NGROUP),& - cstate%f_rhompe(NBIN,NELEM), & - cstate%f_rnucpe(NBIN,NELEM), & - cstate%f_pc_nucl(NZ,NBIN,NELEM), & - cstate%f_growpe(NBIN,NELEM), & - cstate%f_evappe(NBIN,NELEM), & - cstate%f_evcore(NELEM), & - cstate%f_growlg(NBIN,NGROUP), & - cstate%f_evaplg(NBIN,NGROUP), & - cstate%f_gasprod(NGAS), & - cstate%f_rlheat(NZ), & - cstate%f_radint(NZ,NWAVE), & - cstate%f_partheat(NZ), & - cstate%f_dtpart(NZ,NBIN,NGROUP), & - cstate%f_cmf(NBIN,NGROUP), & - cstate%f_totevap(NBIN,NGROUP), & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - &ERROR allocating growth arrays, status=", ier - end if - rc = RC_ERROR - return - endif - - cstate%f_radint(:,:) = 0._f - end if - - if (cstate%f_carma%f_do_coag) then - allocate( & - cstate%f_coaglg(NZ,NBIN,NGROUP), & - cstate%f_coagpe(NZ,NBIN,NELEM), & - cstate%f_ckernel(NZ,NBIN,NBIN,NGROUP,NGROUP), & - stat = ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Allocate::& - &ERROR allocating coag arrays, status=", ier - end if - rc = RC_ERROR - return - end if - - ! Initialize - cstate%f_coaglg(:,:,:) = 0._f - cstate%f_coagpe(:,:,:) = 0._f - cstate%f_ckernel(:,:,:,:,:) = 0._f - end if - end if - - return - end subroutine CARMASTATE_Allocate - - - !! The routine should be called when the carma state object is no longer needed. - !! It deallocates any memory allocations made by CARMA during CARMASTATE_Create(), - !! and failure to call this routine could result in memory leaks. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMASTATE_Create - subroutine CARMASTATE_Destroy(cstate, rc) - type(carmastate_type), intent(inout) :: cstate - integer, intent(out) :: rc - - ! Local variables - integer :: ier - - ! Assume success. - rc = RC_OK - - ! Check to see if the arrays are already allocated. If so, deallocate them. - - ! Allocate the variables needed for setupatm. - if (allocated(cstate%f_xmet)) then - - deallocate( & - cstate%f_xmet, & - cstate%f_ymet, & - cstate%f_zmet, & - cstate%f_zmetl, & - cstate%f_xc, & - cstate%f_yc, & - cstate%f_zc, & - cstate%f_dx, & - cstate%f_dy, & - cstate%f_dz, & - cstate%f_zl, & - cstate%f_pc, & - cstate%f_pcd, & - cstate%f_pc_surf, & - cstate%f_sedimentationflux, & - cstate%f_gc, & - cstate%f_cldfrc, & - cstate%f_rhcrit, & - cstate%f_rhop, & - cstate%f_r_wet, & - cstate%f_rlow_wet, & - cstate%f_rup_wet, & - cstate%f_rhop_wet, & - cstate%f_r_ref, & - cstate%f_rhop_ref, & - cstate%f_rhoa, & - cstate%f_rhoa_wet, & - cstate%f_t, & - cstate%f_p, & - cstate%f_pl, & - cstate%f_relhum, & - cstate%f_wtpct, & - cstate%f_rmu, & - cstate%f_thcond, & - cstate%f_thcondnc, & - cstate%f_dpc_sed, & - cstate%f_pconmax, & - cstate%f_pcl, & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating atmosphere arrays, status=", ier - end if - rc = RC_ERROR - return - end if - - ! Allocate the last fields if they are needed for substepping stepping. - if (allocated(cstate%f_gcl)) then - deallocate( & - cstate%f_gcl, & - cstate%f_d_gc, & - cstate%f_told, & - cstate%f_d_t, & - cstate%f_zsubsteps, & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating stepping arrays, status=", ier - end if - rc = RC_ERROR - return - endif - endif - - ! Allocate the variables needed for setupvf. - ! - ! NOTE: Coagulation also needs bpm, vf and re. - if (allocated(cstate%f_bpm)) then - deallocate( & - cstate%f_bpm, & - cstate%f_vf, & - cstate%f_re, & - cstate%f_dkz, & - cstate%f_ftoppart, & - cstate%f_fbotpart, & - cstate%f_pc_topbnd, & - cstate%f_pc_botbnd, & - cstate%f_vd, & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating vertical transport arrays, status=", ier - end if - rc = RC_ERROR - return - endif - end if - - if (allocated(cstate%f_diffus)) then - deallocate( & - cstate%f_diffus, & - cstate%f_rlhe, & - cstate%f_rlhm, & - cstate%f_surfctwa, & - cstate%f_surfctiw, & - cstate%f_surfctia, & - cstate%f_akelvin, & - cstate%f_akelvini, & - cstate%f_ft, & - cstate%f_gro, & - cstate%f_gro1, & - cstate%f_gro2, & - cstate%f_scrit, & - cstate%f_rnuclg,& - cstate%f_rnucpe, & - cstate%f_rhompe, & - cstate%f_pc_nucl, & - cstate%f_growpe, & - cstate%f_evappe, & - cstate%f_evcore, & - cstate%f_growlg, & - cstate%f_evaplg, & - cstate%f_gasprod, & - cstate%f_rlheat, & - cstate%f_radint, & - cstate%f_partheat, & - cstate%f_dtpart, & - cstate%f_cmf, & - cstate%f_totevap, & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating growth arrays, status=", ier - end if - rc = RC_ERROR - return - endif - end if - - if (allocated(cstate%f_pvapl)) then - deallocate( & - cstate%f_pvapl, & - cstate%f_pvapi, & - cstate%f_supsatl, & - cstate%f_supsati, & - cstate%f_supsatlold, & - cstate%f_supsatiold, & - stat=ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating gas arrays, status=", ier - end if - rc = RC_ERROR - return - endif - end if - - if (allocated(cstate%f_coaglg)) then - deallocate( & - cstate%f_coaglg, & - cstate%f_coagpe, & - cstate%f_ckernel, & - stat = ier) - if (ier /= 0) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Destroy::& - &ERROR deallocating coag arrays, status=", ier - end if - rc = RC_ERROR - return - end if - end if - end if - - return - end subroutine CARMASTATE_Destroy - - - !! The routine performs the main CARMA processing for one timestep of - !! the parent model. The state variables should have all been set before - !! calling CARMASTATE_Step(). When this routine returns, the state will - !! have been updated to reflect the changes from the CARMA microphysics. - !! If tendencies are desired, then the difference between the final and - !! initial state will need to be computed by the caller. - !! - !! NIOTE: xxxfv, xxxram and xxxfrac need to be specified for dry deposition. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - subroutine CARMASTATE_Step(cstate, rc, cldfrc, rhcrit, lndfv, ocnfv, icefv, lndram, ocnram, iceram, lndfrac, ocnfrac, icefrac) - type(carmastate_type), intent(inout) :: cstate - integer, intent(out) :: rc - real(kind=f), intent(in), optional :: cldfrc(cstate%f_NZ) !! cloud fraction [fraction] - real(kind=f), intent(in), optional :: rhcrit(cstate%f_NZ) !! relative humidity for onset of liquid clouds [fraction] - real(kind=f), intent(in), optional :: lndfv !! the surface friction velocity over land [m/s] - real(kind=f), intent(in), optional :: ocnfv !! the surface friction velocity over ocean [m/s] - real(kind=f), intent(in), optional :: icefv !! the surface friction velocity over ice [m/s] - real(kind=f), intent(in), optional :: lndram !! the aerodynamic resistance over land [s/m] - real(kind=f), intent(in), optional :: ocnram !! the aerodynamic resistance over ocean [s/m] - real(kind=f), intent(in), optional :: iceram !! the aerodynamic resistance over ice [s/m] - real(kind=f), intent(in), optional :: lndfrac !! land fraction - real(kind=f), intent(in), optional :: ocnfrac !! ocn fraction - real(kind=f), intent(in), optional :: icefrac !! ice fraction - - - integer :: iz ! vertical index - integer :: igas ! gas index - integer :: ielem - integer :: ibin - integer :: igroup - logical :: swelling ! Do any groups undergo partcile swelling? - integer :: i1, i2, j1, j2 - - ! Assume success. - rc = RC_OK - - ! Store the cloud fraction if specified - cstate%f_cldfrc(:) = 1._f - cstate%f_rhcrit(:) = 1._f - - if (present(cldfrc)) cstate%f_cldfrc(:) = cldfrc(:) - if (present(rhcrit)) cstate%f_rhcrit(:) = rhcrit(:) - - ! Determine the gas supersaturations. - do iz = 1, cstate%f_NZ - do igas = 1, cstate%f_carma%f_NGAS - call supersat(cstate%f_carma, cstate, iz, igas, rc) - if (rc < 0) return - end do - end do - - ! Determine the particle densities. - call rhopart(cstate%f_carma, cstate, rc) - if (rc < 0) return - - - ! We have to hold off initialization until now, because the particle density - ! (rhop) can not be determined until the particle masses are known (i.e. after - ! CARMASTATE_SetBin), because rhop is used to determine the fall velocity. - ! - ! NOTE: If configured for fixed initialization, then we will lose some accuracy - ! in the calculation of the fall velocities, growth kernels, ... and in return - ! will gain a significant performance by not having to initialize as often. - ! - ! NOTE: If configured for partial initialized in conjunction with fixed - ! initialization, then do the fall velocity (and growth) initialization which - ! is relatively quick, but skip the recalculation of the coagulation kernels - ! which is relatively expensive. This could be useful for particles that have - ! a wet radius that is different from the dry radius or where there are large - ! changes from the average conditions (temperature, water vapor, ...) used in - ! the fixed initialization. - if ((.not. cstate%f_carma%f_do_fixedinit) .or. & - (cstate%f_carma%f_do_partialinit)) then - - ! Initialize the vertical transport. - if (cstate%f_carma%f_do_vtran .or. cstate%f_carma%f_do_coag .or. cstate%f_carma%f_do_grow) then - call setupvf(cstate%f_carma, cstate, rc) - - if (cstate%f_carma%f_do_vdiff) then - call setupbdif(cstate%f_carma, cstate, rc) - end if - end if - - ! Initialize the nucleation, growth and evaporation. - if (cstate%f_carma%f_do_grow) then - call setupgrow(cstate%f_carma, cstate, rc) - if (rc < RC_OK) return - - call setupgkern(cstate%f_carma, cstate, rc) - if (rc < RC_OK) return - - call setupnuc(cstate%f_carma, cstate, rc) - if (rc < RC_OK) return - end if - - ! Initialize the coagulation. - if (cstate%f_carma%f_do_coag .and. & - (.not. cstate%f_carma%f_do_fixedinit)) then - call setupckern(cstate%f_carma, cstate, rc) - if (rc < RC_OK) return - end if - end if - - ! Initialize the dry deposition - ! - ! NOTE: This is tied to the surface fields that vary from column to column, - ! so it needs to get calculated here whether using fixed or full initialization. - if (cstate%f_carma%f_do_drydep) then - if (present(lndfv) .and. present(lndram) .and. present(lndfrac) .and. & - present(ocnfv) .and. present(ocnram) .and. present(ocnfrac) .and. & - present(icefv) .and. present(iceram) .and. present(icefrac)) then - - ! NOTE: Need to convert surfric and ram from mks to cgs units. - call setupvdry(cstate%f_carma, cstate, & - lndfv * 100._f, ocnfv * 100._f, icefv * 100._f, & - lndram / 100._f, ocnram / 100._f, iceram / 100._f, & - lndfrac, ocnfrac, icefrac, rc) - if (rc < RC_OK) return - else - write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_Step: & - &do_drydep requires that the optional inputs xxxfv, xxxram & - &and xxxfrac be provided." - rc = RC_ERROR - return - end if - end if - - ! Calculate the impact of microphysics upon the state. - call step(cstate%f_carma, cstate, rc) - - return - end subroutine CARMASTATE_Step - - - ! Query, Control and State I/O - - !! Gets the mass mixing ratio for the gas (igas). After a call to CARMA_Step(), - !! the new mass mixing ratio of the gas can be retrieved. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddGas - !! @see CARMA_GetGas - !! @see CARMA_Step - !! @see CARMASTATE_SetGas - subroutine CARMASTATE_Get(cstate, rc, max_nsubstep, max_nretry, nstep, nsubstep, nretry, zsubsteps, lat, lon) - type(carmastate_type), intent(in) :: cstate !! the carma state object - integer, intent(out) :: rc !! return code, negative indicates failure - integer, optional, intent(out) :: max_nsubstep !! maximum number of substeps in a step - real(kind=f), optional, intent(out) :: max_nretry !! maximum number of retries in a step - real(kind=f), optional, intent(out) :: nstep !! total number of steps taken - integer, optional, intent(out) :: nsubstep !! total number of substeps taken - real(kind=f), optional, intent(out) :: nretry !! total number of retries taken - real(kind=f), optional, intent(out) :: zsubsteps(cstate%f_NZ) !! number of substeps taken per vertical grid point - real(kind=f), optional, intent(out) :: lat !! grid center latitude [deg] - real(kind=f), optional, intent(out) :: lon !! grid center longitude [deg] - - ! Assume success. - rc = RC_OK - - if (present(max_nsubstep)) max_nsubstep = cstate%f_max_nsubstep - if (present(max_nretry)) max_nretry = cstate%f_max_nretry - if (present(nstep)) nstep = cstate%f_nstep - if (present(nsubstep)) nsubstep = cstate%f_nsubstep - if (present(nretry)) nretry = cstate%f_nretry - if (present(zsubsteps)) zsubsteps = cstate%f_zsubsteps - if (present(lat)) lat = cstate%f_lat - if (present(lon)) lon = cstate%f_lon - - return - end subroutine CARMASTATE_Get - - - !! Gets the mass of the bins (ibin) for each particle element (ielem). After the - !! CARMA_Step() call, new particle concentrations are determined. The number density - !! and the nucleation rate are only calculated if the element is the number density - !! element for the group. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddElement - !! @see CARMA_AddGroup - !! @see CARMA_Step - !! @see CARMASTATE_SetBin - subroutine CARMASTATE_GetBin(cstate, ielem, ibin, mmr, rc, & - nmr, numberDensity, areaDensity, nucleationRate, r_wet, rhop_wet, & - surface, sedimentationflux, vf, vd, dtpart) - type(carmastate_type), intent(in) :: cstate !! the carma state object - integer, intent(in) :: ielem !! the element index - integer, intent(in) :: ibin !! the bin index - real(kind=f), intent(out) :: mmr(cstate%f_NZ) !! the bin mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code negative indicates failure - real(kind=f), optional, intent(out) :: nmr(cstate%f_NZ) !! number mixing ratio [#/kg] - real(kind=f), optional, intent(out) :: numberDensity(cstate%f_NZ) !! number density [#/m3] - real(kind=f), optional, intent(out) :: areaDensity(cstate%f_NZ) !! surface area density [m2/m3] - real(kind=f), optional, intent(out) :: nucleationRate(cstate%f_NZ) !! nucleation rate [1/m3/s] - real(kind=f), optional, intent(out) :: r_wet(cstate%f_NZ) !! wet particle radius [m] - real(kind=f), optional, intent(out) :: rhop_wet(cstate%f_NZ) !! wet particle density [kg/m3] - real(kind=f), optional, intent(out) :: surface !! particle mass on the surface [kg/m2] - real(kind=f), optional, intent(out) :: sedimentationflux !! particle sedimentation mass flux to surface [kg/m2/s] - real(kind=f), optional, intent(out) :: vf(cstate%f_NZ+1) !! fall velocity [m/s] - real(kind=f), optional, intent(out) :: vd !! deposition velocity [m/s] - real(kind=f), optional, intent(out) :: dtpart(cstate%f_NZ) !! delta particle temperature [K] - - integer :: ienconc !! index of element that is the particle concentration for the group - integer :: igroup ! Group containing this bin - - ! Assume success. - rc = RC_OK - - ! Determine the particle group for the bin. - igroup = cstate%f_carma%f_element(ielem)%f_igroup - - ! Make sure there are enough elements allocated. - if (ielem > cstate%f_carma%f_NELEM) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_GetBin:: ERROR - The specifed element (", & - ielem, ") is larger than the number of elements (", cstate%f_carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough bins allocated. - if (ibin > cstate%f_carma%f_NBIN) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMA_GetBin:: ERROR - The specifed bin (", & - ibin, ") is larger than the number of bins (", cstate%f_carma%f_NBIN, ")." - rc = RC_ERROR - return - end if - - - ! Use the air density to go back to mass mixing ratio (with appropriate - ! scaling for element type -- see immediately following). mmr ends up - ! at units g/g [= kg/kg] - mmr(:) = cstate%f_pc(:, ibin, ielem) / cstate%f_rhoa_wet(:) - - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - mmr(:) = mmr(:) * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - mmr(:) = mmr(:) / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - - ! If the number of particles in the group is less than the minimum value represented - ! by CARMA, then return and mmr of 0.0 for all elements. - ienconc = cstate%f_carma%f_group(igroup)%f_ienconc -! where (cstate%f_pc(:, ibin, ienconc) <= SMALL_PC) mmr(:) = 0.0_f - - - ! Do they also want the mass concentration of particles at the surface? - if (present(surface)) then - - ! Convert from g/cm2 to kg/m2 - surface = cstate%f_pc_surf(ibin, ielem) * 1e4_f / 1e3_f - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - surface = surface * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - surface = surface / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - end if - - ! Do they also want the mass flux of particles that sediment to the surface? - if (present(sedimentationflux)) then - - ! Convert from g/cm2 to kg/m2 - sedimentationflux = cstate%f_sedimentationflux(ibin, ielem) * 1e4_f / 1e3_f - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - sedimentationflux = sedimentationflux * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - sedimentationflux = sedimentationflux / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - end if - - ! If this is the particle # element, then determine some other statistics. - if (ienconc == ielem) then - ! nmr [#/kg] - if (present(nmr)) nmr(:) = (cstate%f_pc(:, ibin, ielem) / cstate%f_rhoa_wet(:)) * 1000._f - - ! number density [#/m3] - if (present(numberDensity)) numberDensity(:) = cstate%f_pc(:, ibin, ielem) / (cstate%f_xmet(:)*cstate%f_ymet(:)*cstate%f_zmet(:)) * 1.e6_f - - ! area density [m2/m3] - if (present(areaDensity)) areaDensity(:) = 4._f*PI*(cstate%f_r_wet(:, ibin, igroup)**2) & - *cstate%f_pc(:, ibin, ielem) / (cstate%f_xmet(:)*cstate%f_ymet(:)*cstate%f_zmet(:)) * 1.e6_f / 1.e4_f - ! r_wet [m] - if (present(r_wet)) r_wet(:) = cstate%f_r_wet(:, ibin, igroup) * 0.01_f - - ! rhop_wet [kg/m3] - if (present(rhop_wet)) rhop_wet(:) = cstate%f_rhop_wet(:, ibin, igroup) * 1.e6_f / 1.e3_f - - ! vf [m/s] - if (cstate%f_carma%f_do_vtran) then - if (present(vf)) vf(:) = cstate%f_vf(:, ibin, igroup) * cstate%f_zmetl(:) * 0.01_f - else - if (present(vf)) vf(:) = CAM_FILL - end if - - ! deposition velocity [m/2] - if (cstate%f_carma%f_do_drydep) then - if (present(vd)) then - if (cstate%f_igridv .eq. I_CART) then - vd = cstate%f_vd(ibin, igroup) / cstate%f_zmetl(1) * 0.01_f - else - vd = cstate%f_vd(ibin, igroup) / cstate%f_zmetl(cstate%f_NZP1) * 0.01_f - end if - end if - else - if (present(vd)) vd = CAM_FILL - end if - - if (cstate%f_carma%f_do_grow) then - if (present(nucleationRate)) nucleationRate(:) = cstate%f_pc_nucl(:, ibin, ielem) / (cstate%f_xmet(:)*cstate%f_ymet(:)*cstate%f_zmet(:)) / cstate%f_dtime * 1.e6_f - else - if (present(nucleationRate)) nucleationRate(:) = CAM_FILL - end if - - if (cstate%f_carma%f_do_pheat) then - if (present(dtpart)) dtpart(:) = cstate%f_dtpart(:, ibin, igroup) - else - if (present(dtpart)) dtpart(:) = CAM_FILL - end if - else - if (present(nmr)) nmr(:) = CAM_FILL - if (present(numberDensity)) numberDensity(:) = CAM_FILL - if (present(areaDensity)) areaDensity(:) = CAM_FILL - if (present(nucleationRate)) nucleationRate(:) = CAM_FILL - if (present(r_wet)) r_wet(:) = CAM_FILL - if (present(rhop_wet)) rhop_wet(:) = CAM_FILL - if (present(dtpart)) dtpart(:) = CAM_FILL - if (present(vf)) vf(:) = CAM_FILL - if (present(vd)) vd = CAM_FILL - end if - - return - end subroutine CARMASTATE_GetBin - - - !! Gets the mass of the detrained condensate for the bins (ibin) for each particle - !! element (ielem) in the grid. - !! - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddElement - !! @see CARMA_AddGroup - !! @see CARMA_Step - !! @see CARMASTATE_SetDetrain - subroutine CARMASTATE_GetDetrain(cstate, ielem, ibin, mmr, rc, nmr, numberDensity, r_wet, rhop_wet) - type(carmastate_type), intent(in) :: cstate !! the carma state object - integer, intent(in) :: ielem !! the element index - integer, intent(in) :: ibin !! the bin index - real(kind=f), intent(out) :: mmr(cstate%f_NZ) !! the bin mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code negative indicates failure - real(kind=f), optional, intent(out) :: nmr(cstate%f_NZ) !! number mixing ratio [#/kg] - real(kind=f), optional, intent(out) :: numberDensity(cstate%f_NZ) !! number density [#/m3] - real(kind=f), optional, intent(out) :: r_wet(cstate%f_NZ) !! wet particle radius [m] - real(kind=f), optional, intent(out) :: rhop_wet(cstate%f_NZ) !! wet particle density [kg/m3] - - integer :: ienconc !! index of element that is the particle concentration for the group - integer :: igroup ! Group containing this bin - - ! Assume success. - rc = RC_OK - - ! Determine the particle group for the bin. - igroup = cstate%f_carma%f_element(ielem)%f_igroup - - ! Make sure there are enough elements allocated. - if (ielem > cstate%f_carma%f_NELEM) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetDetrain:: ERROR - The specifed element (", & - ielem, ") is larger than the number of elements (", cstate%f_carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough bins allocated. - if (ibin > cstate%f_carma%f_NBIN) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMA_SetDetrainin:: ERROR - The specifed bin (", & - ibin, ") is larger than the number of bins (", cstate%f_carma%f_NBIN, ")." - rc = RC_ERROR - return - end if - - - ! Use the specified mass mixing ratio and the air density to determine the mass - ! of the particles in g/x/y/z. - mmr(:) = cstate%f_pcd(:, ibin, ielem) / cstate%f_rhoa_wet(:) - - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - mmr(:) = mmr(:) * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - mmr(:) = mmr(:) / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - - ! If this is the partcile # element, then determine some other statistics. - ienconc = cstate%f_carma%f_group(igroup)%f_ienconc - if (ienconc == ielem) then - !nmr [#/kg] - if (present(nmr)) nmr(:) = (cstate%f_pcd(:, ibin, ielem) / cstate%f_rhoa_wet(:)) * 1000._f - ! number density [#/m3] - if (present(numberDensity)) numberDensity(:) = cstate%f_pcd(:, ibin, ielem) / (cstate%f_xmet(:)*cstate%f_ymet(:)*cstate%f_zmet(:)) * 1.e6_f - ! r_wet [m] - if (present(r_wet)) r_wet(:) = cstate%f_r_wet(:, ibin, igroup) * 0.01_f - ! rhop_wet [kg/m3] - if (present(rhop_wet)) rhop_wet(:) = cstate%f_rhop_wet(:, ibin, igroup) * 1.e6_f / 1.e3_f - else - if (present(nmr)) nmr(:) = CAM_FILL - if (present(numberDensity)) numberDensity(:) = CAM_FILL - end if - - return - end subroutine CARMASTATE_GetDetrain - - - !! Gets the mass mixing ratio for the gas (igas). After a call to CARMA_Step(), - !! the new mass mixing ratio of the gas can be retrieved. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddGas - !! @see CARMA_GetGas - !! @see CARMA_Step - !! @see CARMASTATE_SetGas - subroutine CARMASTATE_GetGas(cstate, igas, mmr, rc, satice, satliq, eqice, eqliq, wtpct) - type(carmastate_type), intent(in) :: cstate !! the carma state object - integer, intent(in) :: igas !! the gas index - real(kind=f), intent(out) :: mmr(cstate%f_NZ) !! the gas mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), optional, intent(out) :: satice(cstate%f_NZ) !! the gas saturation wrt ice - real(kind=f), optional, intent(out) :: satliq(cstate%f_NZ) !! the gas saturation wrt liquid - real(kind=f), optional, intent(out) :: eqice(cstate%f_NZ) !! the gas vapor pressure wrt ice - real(kind=f), optional, intent(out) :: eqliq(cstate%f_NZ) !! the gas vapor pressure wrt liquid - real(kind=f), optional, intent(out) :: wtpct(cstate%f_NZ) !! weight percent aerosol composition - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough gases allocated. - if (igas > cstate%f_carma%f_NGAS) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_GetGas:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", cstate%f_carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - ! Use the specified mass mixing ratio and the air density to determine the mass - ! of the gas in g/x/y/z. - mmr(:) = cstate%f_gc(:, igas) / cstate%f_rhoa_wet(:) - - if (present(satice)) satice(:) = cstate%f_supsati(:, igas) + 1._f - if (present(satliq)) satliq(:) = cstate%f_supsatl(:, igas) + 1._f - if (present(eqice)) eqice(:) = cstate%f_pvapi(:, igas) / cstate%f_p(:) - if (present(eqliq)) eqliq(:) = cstate%f_pvapl(:, igas) / cstate%f_p(:) - if (present(wtpct)) wtpct(:) = cstate%f_wtpct(:) - - return - end subroutine CARMASTATE_GetGas - - - !! Gets information about the state of the atmosphere. After the CARMA_Step() call, - !! a new atmospheric state is determined. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_Step - !! @see CARMASTATE_Create - subroutine CARMASTATE_GetState(cstate, rc, t, p, rhoa_wet, rlheat) - type(carmastate_type), intent(in) :: cstate !! the carma state object - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), optional, intent(out) :: t(cstate%f_NZ) !! the air temperature [K] - real(kind=f), optional, intent(out) :: p(cstate%f_NZ) !! the air pressure [Pa] - real(kind=f), optional, intent(out) :: rhoa_wet(cstate%f_NZ) !! air density [kg m-3] - real(kind=f), optional, intent(out) :: rlheat(cstate%f_NZ) !! latent heat [K/s] - - ! Assume success. - rc = RC_OK - - ! Return the temperature, pressure, and/or density. - if (present(t)) t(:) = cstate%f_t(:) - - ! DYNE -> Pa - if (present(p)) p(:) = cstate%f_p(:) / RPA2CGS - - ! Convert rhoa from the scaled units to mks. - if (present(rhoa_wet)) rhoa_wet(:) = (cstate%f_rhoa_wet(:) / & - (cstate%f_zmet(:)*cstate%f_xmet(:)*cstate%f_ymet(:))) * 1e6_f / 1e3_f - - if (present(rlheat)) rlheat(:) = cstate%f_rlheat(:) - - return - end subroutine CARMASTATE_GetState - - - !! Sets the mass of the bins (ibin) for each particle element (ielem) in the grid. - !! This call should be made after CARMASTATE_Create() and before CARMA_Step(). - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddBin - !! @see CARMA_Step - !! @see CARMASTATE_GetBin - subroutine CARMASTATE_SetBin(cstate, ielem, ibin, mmr, rc, surface) - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: ielem !! the element index - integer, intent(in) :: ibin !! the bin index - real(kind=f), intent(in) :: mmr(cstate%f_NZ) !! the bin mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), optional, intent(in) :: surface !! particles mass on the surface [kg/m2] - - integer :: igroup ! Group containing this bin - - ! Assume success. - rc = RC_OK - - ! Determine the particle group for the bin. - igroup = cstate%f_carma%f_element(ielem)%f_igroup - - ! Make sure there are enough elements allocated. - if (ielem > cstate%f_carma%f_NELEM) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetBin:: ERROR - The specifed element (", & - ielem, ") is larger than the number of elements (", cstate%f_carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough bins allocated. - if (ibin > cstate%f_carma%f_NBIN) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetBin:: ERROR - The specifed bin (", & - ibin, ") is larger than the number of bins (", cstate%f_carma%f_NBIN, ")." - rc = RC_ERROR - return - end if - - ! Use the specified mass mixing ratio and the air density to determine the mass - ! of the particles in g/x/y/z. - cstate%f_pc(:, ibin, ielem) = mmr(:) * cstate%f_rhoa_wet(:) - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - cstate%f_pc(:, ibin, ielem) = cstate%f_pc(:, ibin, ielem) / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - cstate%f_pc(:, ibin, ielem) = cstate%f_pc(:, ibin, ielem) * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - - ! If they specified an initial mass of particles on the surface, then use that - ! value. - if (present(surface)) then - - ! Convert from g/cm2 to kg/m2 - cstate%f_pc_surf(ibin, ielem) = surface / 1e4_f * 1e3_f - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - cstate%f_pc_surf(ibin, ielem) = cstate%f_pc_surf(ibin, ielem) / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - cstate%f_pc_surf(ibin, ielem) = cstate%f_pc_surf(ibin, ielem) * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - else - cstate%f_pc_surf(ibin, ielem) = 0.0_f - end if - - return - end subroutine CARMASTATE_SetBin - - - !! Sets the mass of the detrained condensate for the bins (ibin) for each particle - !! element (ielem) in the grid. This call should be made after CARMASTATE_Create() - !! and before CARMA_Step(). - !! - !! @author Chuck Bardeen - !! @version May-2010 - !! @see CARMA_AddBin - !! @see CARMA_Step - !! @see CARMASTATE_GetDetrain - subroutine CARMASTATE_SetDetrain(cstate, ielem, ibin, mmr, rc) - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: ielem !! the element index - integer, intent(in) :: ibin !! the bin index - real(kind=f), intent(in) :: mmr(cstate%f_NZ) !! the bin mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code, negative indicates failure - - integer :: igroup ! Group containing this bin - - ! Assume success. - rc = RC_OK - - ! Determine the particle group for the bin. - igroup = cstate%f_carma%f_element(ielem)%f_igroup - - ! Make sure there are enough elements allocated. - if (ielem > cstate%f_carma%f_NELEM) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetDetrain:: ERROR - The specifed element (", & - ielem, ") is larger than the number of elements (", cstate%f_carma%f_NELEM, ")." - rc = RC_ERROR - return - end if - - ! Make sure there are enough bins allocated. - if (ibin > cstate%f_carma%f_NBIN) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetDetrain:: ERROR - The specifed bin (", & - ibin, ") is larger than the number of bins (", cstate%f_carma%f_NBIN, ")." - rc = RC_ERROR - return - end if - - ! Use the specified mass mixing ratio and the air density to determine the mass - ! of the particles in g/x/y/z. - cstate%f_pcd(:, ibin, ielem) = mmr(:) * cstate%f_rhoa_wet(:) - - ! Handle the special cases for different types of elements ... - if ((cstate%f_carma%f_element(ielem)%f_itype == I_INVOLATILE) .or. & - (cstate%f_carma%f_element(ielem)%f_itype == I_VOLATILE)) then - cstate%f_pcd(:, ibin, ielem) = cstate%f_pcd(:, ibin, ielem) / cstate%f_carma%f_group(igroup)%f_rmass(ibin) - else if (cstate%f_carma%f_element(ielem)%f_itype == I_CORE2MOM) then - cstate%f_pcd(:, ibin, ielem) = cstate%f_pcd(:, ibin, ielem) * cstate%f_carma%f_group(igroup)%f_rmass(ibin) - end if - - return - end subroutine CARMASTATE_SetDetrain - - - - !! Sets the mass of the gas (igas) in the grid. This call should be made after - !! CARMASTATE_Create() and before CARMA_Step(). - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_AddGas - !! @see CARMA_GetGas - !! @see CARMA_InitializeStep - !! @see CARMA_Step - subroutine CARMASTATE_SetGas(cstate, igas, mmr, rc, mmr_old, satice_old, satliq_old) - type(carmastate_type), intent(inout) :: cstate !! the carma object - integer, intent(in) :: igas !! the gas index - real(kind=f), intent(in) :: mmr(cstate%f_NZ) !! the gas mass mixing ratio [kg/kg] - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), intent(in), optional :: mmr_old(cstate%f_NZ) !! the previous gas mass mixing ratio [kg/kg] - real(kind=f), intent(inout), optional :: satice_old(cstate%f_NZ) !! the previous gas saturation wrt ice, calculates if -1 - real(kind=f), intent(inout), optional :: satliq_old(cstate%f_NZ) !! the previous gas saturation wrt liquid, calculates if -1 - - real(kind=f) :: tnew(cstate%f_NZ) - integer :: iz - logical :: calculateOld - - ! Assume success. - rc = RC_OK - - ! Make sure there are enough gases allocated. - if (igas > cstate%f_carma%f_NGAS) then - if (cstate%f_carma%f_do_print) write(cstate%f_carma%f_LUNOPRT, *) "CARMASTATE_SetGas:: ERROR - The specifed gas (", & - igas, ") is larger than the number of gases (", cstate%f_carma%f_NGAS, ")." - rc = RC_ERROR - return - end if - - if (cstate%f_carma%f_do_substep) then - if (.not. present(mmr_old)) then - if (cstate%f_carma%f_do_print) then - write(cstate%f_carma%f_LUNOPRT,*) "CARMASTATE_SetGas: & - &Error - Need to specify mmr_old, satic_old, satliq_old when substepping." - end if - rc = RC_ERROR - - return - - else - cstate%f_gcl(:, igas) = mmr_old(:) * cstate%f_rhoa_wet(:) * cstate%f_t(:) / cstate%f_told(:) - - ! A value of -1 for the saturation ratio means that it needs to be calculated from the old temperature - ! and the old gc. - ! - ! NOTE: This is typically just a problem for the first step, so we just need to get close. - calculateOld = .false. - if (present(satice_old) .and. present(satliq_old)) then - if (any(satice_old(:) == -1._f) .or. any(satliq_old(:) == -1._f)) calculateOld = .true. - else - calculateOld = .true. - end if - - if (calculateOld) then - - ! This is a bit of a hack, because of the way CARMA has the vapor pressure and saturation - ! routines implemented. - - ! Temporarily set the temperature and gc of to the old state - - tnew(:) = cstate%f_t(:) - cstate%f_t(:) = cstate%f_told(:) - - cstate%f_gc(:, igas) = mmr_old(:) * cstate%f_rhoa_wet(:) - - do iz = 1, cstate%f_NZ - call supersat(cstate%f_carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - - if (present(satice_old)) then - if (satice_old(iz) == -1._f) then - cstate%f_supsatiold(iz, igas) = cstate%f_supsati(iz, igas) - else - cstate%f_supsatiold(iz, igas) = satice_old(iz) - 1._f - endif - else - cstate%f_supsatiold(iz, igas) = cstate%f_supsati(iz, igas) - end if - - if (present(satliq_old)) then - if (satliq_old(iz) == -1._f) then - cstate%f_supsatlold(iz, igas) = cstate%f_supsatl(iz, igas) - else - cstate%f_supsatlold(iz, igas) = satliq_old(iz) - 1._f - endif - else - cstate%f_supsatlold(iz, igas) = cstate%f_supsatl(iz, igas) - end if - end do - - cstate%f_t(:) = tnew(:) - - else - cstate%f_supsatiold(:, igas) = satice_old(:) - 1._f - cstate%f_supsatlold(:, igas) = satliq_old(:) - 1._f - end if - end if - end if - - ! Use the specified mass mixing ratio and the air density to determine the mass - ! of the gas in g/x/y/z. - cstate%f_gc(:, igas) = mmr(:) * cstate%f_rhoa_wet(:) - - return - end subroutine CARMASTATE_SetGas - - - !! Sets information about the state of the atmosphere. - !! - !! @author Chuck Bardeen - !! @version Feb-2009 - !! @see CARMA_Step - !! @see CARMASTATE_Create - subroutine CARMASTATE_SetState(cstate, rc, t, rhoa_wet) - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(out) :: rc !! return code, negative indicates failure - real(kind=f), optional, intent(in) :: t(cstate%f_NZ) !! the air temperature [K] - real(kind=f), optional, intent(in) :: rhoa_wet(cstate%f_NZ) !! air density [kg m-3] - - ! Assume success. - rc = RC_OK - - ! Return the temperature or density. - if (present(t)) cstate%f_t(:) = t(:) - - ! Convert rhoa from mks to the scaled units. - if (present(rhoa_wet)) cstate%f_rhoa_wet(:) = (rhoa_wet(:) * & - (cstate%f_zmet(:)*cstate%f_xmet(:)*cstate%f_ymet(:))) / 1e6_f * 1e3_f - - return - end subroutine CARMASTATE_SetState -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/coagl.F90 b/CARMAchem_GridComp/CARMA/source/base/coagl.F90 deleted file mode 100644 index 4362a3f5..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/coagl.F90 +++ /dev/null @@ -1,105 +0,0 @@ -#include "carma_globaer.h" - -!! This routine calculates coagulation loss rates . -!! See [Jacobson, et al., Atmos. Env., 28, 1327, 1994] for details -!! on the coagulation algorithm. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! @author Eric Jensen -!! @version Oct-1995 -subroutine coagl(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: ig - integer :: jg - integer :: je - integer :: igrp - integer :: iz - integer :: i - integer :: j - - - ! Loop over particle groups for which coagulation loss is being - ! calculated. - do ig = 1,NGROUP - - ! Loop over particle groups that particle in group ig might - ! collide with. - do jg = 1,NGROUP - - ! Element corresponding to particle number concentration - je = ienconc(jg) - - ! Particle resulting from coagulation between groups and goes - ! to group - igrp = icoag(ig,jg) - - ! Resulting particle is in same group as particle under consideration -- - ! partial loss (muliplies ). - if( igrp .eq. ig )then - - ! Loop over the column - do iz = 1, NZ - - if( pconmax(iz,jg) .gt. FEW_PC .and. & - pconmax(iz,ig) .gt. FEW_PC )then - - do i = 1, NBIN-1 - do j = 1, NBIN - - coaglg(iz,i,ig) = coaglg(iz,i,ig) & - + ckernel(iz,i,j,ig,jg) * & - pcl(iz,j,je) * volx(igrp,ig,jg,i,j) - enddo - enddo - endif - enddo ! iz - - ! Resulting particle is in a different group -- complete loss (no ). - else if( igrp .ne. ig .and. igrp .ne. 0 )then - - ! Loop over the column - do iz = 1, NZ - - ! Bypass calculation if few particles present - - if( pconmax(iz,jg) .gt. FEW_PC .and. & - pconmax(iz,ig) .gt. FEW_PC )then - - do i = 1, NBIN - do j = 1, NBIN - - coaglg(iz,i,ig) = coaglg(iz,i,ig) & - + ckernel(iz,i,j,ig,jg) * & - pcl(iz,j,je) - - enddo - enddo - endif ! pconmax(ig) * pconmax(jg) > FEW_PC ** 2 - enddo ! iz - endif ! igrp .eq. ig ? - enddo ! jg - enddo ! ig - - ! Boundary condition: Particles from bin are only lost by - ! coagulating into other elements. (This is taken care of by -1 - ! limit above) - - ! Return to caller with particle loss rates due to coagulation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/coagp.F90 b/CARMAchem_GridComp/CARMA/source/base/coagp.F90 deleted file mode 100644 index a21eff93..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/coagp.F90 +++ /dev/null @@ -1,266 +0,0 @@ -#include "carma_globaer.h" - -!! This routine calculates coagulation production terms . -!! See [Jacobson, et al., Atmos. Env., 28, 1327, 1994] for details -!! on the coagulation algorithm. -!! -!! @author Eric Jensen -!! @version Oct-1995 -subroutine coagp(carma, cstate, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: iz - integer :: igrp - integer :: i_pkern - integer :: iquad - integer :: ig - integer :: jg - integer :: i - integer :: j - integer :: iefrom - integer :: iefrom_cm - integer :: je - integer :: je_cm - integer :: ic - integer :: iecore - real(kind=f) :: totmass - real(kind=f) :: rmasscore - real(kind=f) :: fracmass - real(kind=f) :: elemass - real(kind=f) :: rmi - real(kind=f) :: rmj - - - ! Definition of i,j,k,n used in comments: colision between i and j bins - ! yields particle between bins k and k+1. Production in bin n is calculated. - - - ! Determine group that particles are produced in - igrp = igelem(ielem) - - ! Particle number production - ! - ! Coagulation between particle in group bin with particle in - ! group bin results in particle with mass between bins k and k+1. - ! First, loop over group-bin quads resulting in production in - ! bin = k+1. The set of quads is - ! defined in setupcoag. - - do iquad = 1, npairu(igrp,ibin) - - ig = igup(igrp,ibin,iquad) ! source group - jg = jgup(igrp,ibin,iquad) ! source group - i = iup(igrp,ibin,iquad) ! source bin - j = jup(igrp,ibin,iquad) ! source bin - - iefrom = icoagelem(ielem,ig) ! source element for particle - - if( if_sec_mom(igrp) )then - iefrom_cm = icoagelem_cm(ielem,ig) ! core mass moment source element - endif - - ! If = 0 then there is no contribution to production - if( iefrom .ne. 0 ) then - - je = ienconc(jg) ! source element for particle - - if( if_sec_mom(igrp) )then - je_cm = icoagelem_cm(ielem,jg) ! core mass moment source element - endif - - ! If ielem is core mass type and is a CN type and is different - ! from , then we must multiply production by mass - ! per particle () of element . (this is for all source - ! elements except particle number concentration in a multicomponent CN group). - do iz = 1, NZ - - ! Bypass calculation if few source particles present - if( pconmax(iz,ig) .gt. FEW_PC .and. & - pconmax(iz,jg) .gt. FEW_PC )then - - rmi = 1._f - i_pkern = 1 - - if( itype(ielem) .eq. I_COREMASS .or. & - itype(ielem) .eq. I_VOLCORE )then ! core mass - - i_pkern = 3 ! Use different kernel for core mass prod. - - if( ( itype(ienconc(ig)) .eq. I_INVOLATILE .or. & - itype(ienconc(ig)) .eq. I_VOLATILE ) & - .and. ig .ne. igrp ) then - - ! CN source and ig different from igrp - - if( ncore(ig) .eq. 0 )then ! No cores in source group - - if(icomp(ienconc(ig)) .eq. icomp(ielem)) then - rmi = rmass(i,ig) - else - rmi = 0._f - endif - - elseif( itype(iefrom) .eq. I_INVOLATILE .or. & - itype(iefrom) .eq. I_VOLATILE ) then - - ! Source element is number concentration elem of mixed CN group - totmass = pc(iz,i,iefrom) * rmass(i,ig) - rmasscore = pc(iz,i,icorelem(1,ig)) - - do ic = 2,ncore(ig) - iecore = icorelem(ic,ig) - rmasscore = rmasscore + pc(iz,i,iecore) - enddo - - fracmass = 1._f - rmasscore/totmass - elemass = fracmass * rmass(i,ig) - rmi = elemass - endif - endif ! ig is a CCN and not igrp - - elseif( itype(ielem) .eq. I_CORE2MOM )then ! core mass^2 - - i_pkern = 5 ! Use different kernel for core mass^2 production - rmj = 1._f - - if( itype(ienconc(ig)) .eq. I_INVOLATILE ) then - rmi = rmass(i,ig) - rmj = rmass(j,jg) - endif - - endif ! itype(ielem) is a coremass or core2mom - - ! For each spatial grid point, sum up coagulation production - ! contributions from each quad. - if( itype(ielem) .ne. I_CORE2MOM )then - coagpe(iz,ibin,ielem) = coagpe(iz,ibin,ielem) + & - pc(iz,i,iefrom)*pcl(iz,j,je)*rmi * & - ckernel(iz,i,j,ig,jg) * & - pkernel(i,j,ig,jg,igrp,i_pkern) - else - coagpe(iz,ibin,ielem) = coagpe(iz,ibin,ielem) + & - ( pc(iz,i,iefrom)*pcl(iz,j,je)*rmi**2 + & - pc(iz,i,iefrom_cm)*rmi* & - pcl(iz,j,je_cm)*rmj ) * & - ckernel(iz,i,j,ig,jg) * & - pkernel(i,j,ig,jg,igrp,i_pkern) - endif - endif ! end of ( pconmax .gt. FEW_PC ) - enddo ! iz = 1, NZ - endif ! iefrom .ne. 0 - enddo ! iquad - - ! Next, loop over group-bin quads for production in bin = k from - ! bin due to collision between bins and . - ! Production will only occur if either k != or igrp != - do iquad = 1, npairl(igrp,ibin) - - ig = iglow(igrp,ibin,iquad) - jg = jglow(igrp,ibin,iquad) - i = ilow(igrp,ibin,iquad) - j = jlow(igrp,ibin,iquad) - - iefrom = icoagelem(ielem,ig) ! source element for particle - - if( if_sec_mom(igrp) )then - iefrom_cm = icoagelem_cm(ielem,ig) ! core mass moment source element - endif - - if( iefrom .ne. 0 ) then - - je = ienconc(jg) ! source element for particle - - if( if_sec_mom(igrp) )then - je_cm = icoagelem_cm(ielem,jg) ! core mass moment source element - endif - - do iz = 1, NZ - - ! Bypass calculation if few particles present - if( pconmax(iz,ig) .gt. FEW_PC .and. & - pconmax(iz,jg) .gt. FEW_PC )then - - rmi = 1._f - i_pkern = 2 - - if( itype(ielem) .eq. I_COREMASS .or. & - itype(ielem) .eq. I_VOLCORE )then ! core mass - - i_pkern = 4 ! Use different kernel for core mass production - - if( ( itype(ienconc(ig)) .eq. I_INVOLATILE .or. & - itype(ienconc(ig)) .eq. I_VOLATILE ) & - .and. ig .ne. igrp ) then - - ! CN source and ig different from igrp - - if( ncore(ig) .eq. 0 )then ! No cores in source group - rmi = rmass(i,ig) - - elseif( itype(iefrom) .eq. I_INVOLATILE .or. & - itype(iefrom) .eq. I_VOLATILE ) then - - ! Source element is number concentration elem of mixed CN group - - totmass = pc(iz,i,iefrom) * rmass(i,ig) - rmasscore = pc(iz,i,icorelem(1,ig)) - do ic = 2,ncore(ig) - iecore = icorelem(ic,ig) - rmasscore = rmasscore + pc(iz,i,iecore) - enddo - fracmass = 1._f - rmasscore/totmass - elemass = fracmass * rmass(i,ig) - rmi = elemass - - endif ! pure CN group or CN group w/ cores - - endif ! src group is CN and different from the target group - - elseif( itype(ielem) .eq. I_CORE2MOM )then ! core mass^2 - - i_pkern = 6 ! Use different kernel for core mass^2 production - rmj = 1._f - if( itype(ienconc(ig)) .eq. I_INVOLATILE ) then - rmi = rmass(i,ig) - rmj = rmass(j,jg) - endif - endif ! itype(ielem) - - if( itype(ielem) .ne. I_CORE2MOM )then - coagpe(iz,ibin,ielem) = coagpe(iz,ibin,ielem) + & - pc(iz,i,iefrom)*pcl(iz,j,je)*rmi * & - ckernel(iz,i,j,ig,jg) * & - pkernel(i,j,ig,jg,igrp,i_pkern) - else - coagpe(iz,ibin,ielem) = coagpe(iz,ibin,ielem) + & - ( pc(iz,i,iefrom)*pcl(iz,j,je)*rmi**2 + & - pc(iz,i,iefrom_cm)*rmi* & - pcl(iz,j,je_cm)*rmj ) * & - ckernel(iz,i,j,ig,jg) * & - pkernel(i,j,ig,jg,igrp,i_pkern) - endif - endif ! end of ( pconmax .gt. FEW_PC ) - enddo ! iz = 1, NZ - endif ! end of (iefrom .ne. 0) - enddo ! iquad - - ! Return to caller with coagulation production terms evaluated. - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/csolve.F90 b/CARMAchem_GridComp/CARMA/source/base/csolve.F90 deleted file mode 100644 index c287742f..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/csolve.F90 +++ /dev/null @@ -1,61 +0,0 @@ -#include "carma_globaer.h" - -!! This routine calculates new particle concentrations from coagulation -!! microphysical processes. -!! -!! The basic form from which the solution is derived is: -!! -!! ( new_value - old_value ) / dtime = source_term - loss_rate*new_value -!! -!! This routine derived from psolve.f code, in which particle concentrations -!! due to coagulation were formerly included, before the relatively slow -!! coagulation calcs were separated from the other microphysical processes -!! so that time splitting could be applied to these fast & slow calcs. -!! -!! @author Bill McKie -!! @version Sep-1997 -subroutine csolve(carma, cstate, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: igroup - real(kind=f) :: xyzmet(NZ) - real(kind=f) :: ppd(NZ) - real(kind=f) :: pls(NZ) - - - ! Define current group & particle number concentration element indices - igroup = igelem(ielem) ! particle group - - ! Metric scaling factor - xyzmet = xmet(:) * ymet(:) * zmet(:) - - ! Compute total production rate due to coagulation - ppd = coagpe(:,ibin,ielem) / xyzmet(:) - - ! Compute total loss rate due to coagulation - pls = coaglg(:,ibin,igroup) / xyzmet(:) - - ! Update net particle number concentration during current timestep - ! due to production and loss rates for coagulation - pc(:,ibin,ielem) = ( pc(:,ibin,ielem) & - + dtime * ppd(:) ) & - / ( ONE + pls(:) * dtime ) - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/detrain.F90 b/CARMAchem_GridComp/CARMA/source/base/detrain.F90 deleted file mode 100644 index 129152ce..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/detrain.F90 +++ /dev/null @@ -1,51 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine moves condensate from the detrained bins (pcd) to the -!! particle bins. -!! -!! @author Chuck Bardeen -!! @version May 2010 -subroutine detrain(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: iz ! z index - integer :: ibin ! bin index - integer :: ielem ! element index - - rc = RC_OK - - ! Add the detrained condensate to the particle bins. - ! - ! NOTE: For now, do this all prior to the fast microphysics, but eventually it may - ! be better to move it into microfast and substep the detrained condensate. - pc(:,:,:) = pc(:,:,:) + pcd(:,:,:) - pcd(:,:,:) = 0._f - - ! Prevent particle concentrations from dropping below SMALL_PC - do iz = 1, NZ - do ibin = 1, NBIN - do ielem = 1, NELEM - call smallconc(carma, cstate, iz, ibin, ielem, rc) - end do - end do - end do - - ! Return to caller with new particle number concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/downgevapply.F90 b/CARMAchem_GridComp/CARMA/source/base/downgevapply.F90 deleted file mode 100644 index 83dbb273..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/downgevapply.F90 +++ /dev/null @@ -1,52 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine applies evaporation and nucleation production terms to -!! particle concentrations. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine downgevapply(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ibin !! bin index - integer :: ielem !! element index - - - ! Visit each radius bin for each element to compute particle production - ! due to evaporation and element transfer processes for which the source - ! element number is greater than the target element number - do ielem = 1,NELEM - do ibin = 1,NBIN - - pc(iz,ibin,ielem) = pc(iz,ibin,ielem) + & - dtime * ( evappe(ibin,ielem) + & - rnucpe(ibin,ielem) ) - - ! Prevent particle concentrations from dropping below SMALL_PC - call smallconc(carma, cstate, iz, ibin, ielem, rc) - - enddo - enddo - - - ! Return to caller with evaporation and down-grid element transfer - ! production terms applied to particle concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/downgxfer.F90 b/CARMAchem_GridComp/CARMA/source/base/downgxfer.F90 deleted file mode 100644 index fedcfb50..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/downgxfer.F90 +++ /dev/null @@ -1,146 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to particle -!! element transfer processes for which the source element number is larger -!! than the target element number. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine downgxfer(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: iepart - integer :: ibin !! bin index - integer :: ielem !! element index - integer :: i - integer :: jefrom - integer :: iefrom - integer :: igfrom - integer :: ipow_from - integer :: ipow_to - integer :: ipow - integer :: jfrom - integer :: ifrom - integer :: ic - integer :: iecore - real(kind=f) :: elemass - real(kind=f) :: totmass - real(kind=f) :: rmasscore - real(kind=f) :: fracmass - real(kind=f) :: rnucprod - - - ! Calculate nucleation source terms for which the source element - ! number is greater than the target element number - - ! Set nucleation production rates to zero to avoid double-application - ! of rates calculated in upgxfer.f - rnucpe(:,:) = 0._f - - ! Loop over particle elements and bins - do ielem = 1, NELEM - do ibin = 1, NBIN - - ! Define group & particle # concentration indices for current element - igroup = igelem(ielem) ! target particle group - iepart = ienconc(igroup) ! target particle number concentration element - - ! First calculate production terms due to nucleation . - - ! Loop over elements that nucleate to element . - do jefrom = 1,nnucelem(ielem) - - iefrom = inucelem(jefrom,ielem) ! source particle element - - ! Only calculate production rates here if is less than - ! . Otherwise, production is calculated in upgxfer.f - if( ielem .lt. iefrom ) then - igfrom = igelem(iefrom) ! source particle group - - ! is the power to which the source particle mass must be taken - ! to match the type of the target element. This ugliness could be - ! handled much more slickly in setupnuc() - if( itype(iefrom) .eq. I_INVOLATILE .or. itype(iefrom) .eq. I_VOLATILE )then - ipow_from = 0 - elseif ( itype(iefrom) .eq. I_COREMASS .or. itype(iefrom) .eq. I_VOLCORE )then - ipow_from = 1 - else - ipow_from = 2 - endif - - if( itype(ielem) .eq. I_INVOLATILE .or. itype(ielem) .eq. I_VOLATILE )then - ipow_to = 0 - elseif ( itype(ielem) .eq. I_COREMASS .or. itype(ielem) .eq. I_VOLCORE )then - ipow_to = 1 - else - ipow_to = 2 - endif - - ipow = ipow_to - ipow_from - - ! Loop over bins that nucleate to bin . - do jfrom = 1,nnucbin(igfrom,ibin,igroup) - - ifrom = inucbin(jfrom,igfrom,ibin,igroup) ! bin of source - - ! Bypass calculation if few source particles are present - if( pconmax(iz,igfrom) .gt. FEW_PC )then - if( rnuclg(ifrom,igfrom,igroup) .gt. 0._f )then - - ! First calculate mass associated with the source element - ! (this is for all source elements except particle number - ! concentration in a multicomponent particle group). - if( ncore(igfrom) .eq. 0 .or. itype(iefrom) .gt. I_VOLATILE )then - elemass = rmass(ifrom,igfrom) - else - totmass = pc(iz,ifrom,iefrom) * rmass(ifrom,igfrom) - rmasscore = pc(iz,ifrom,icorelem(1,igfrom)) - - do ic = 2,ncore(igfrom) - iecore = icorelem(ic,igfrom) - rmasscore = rmasscore + pc(iz,ifrom,iecore) - enddo - - fracmass = 1._f - rmasscore/totmass - elemass = fracmass * rmass(ifrom,igfrom) - endif - - rnucprod = rnuclg(ifrom,igfrom,igroup) * & - pc(iz,ifrom,iefrom) * elemass**ipow - - rnucpe(ibin,ielem) = rnucpe(ibin,ielem) + rnucprod - - ! Calculate latent heat associated with nucleation to - ! from -! rlprod = rlprod + rnucprod * rlh_nuc(iefrom,ielem) / & -! (CP * rhoa(iz)) * elemass - - endif ! (rnuclg > 0.) - endif ! (pconmax > FEW_PC) - enddo ! (jfrom = 1,nnucbin) - endif ! (ielem < iefrom) - enddo ! (jefrom = 1,nnucelem) - enddo ! (ibin = 1, NBIN) - enddo ! (ielem = 1, NELEM) - - ! Return to caller with down-grid production terms evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/evap_ingrp.F90 b/CARMAchem_GridComp/CARMA/source/base/evap_ingrp.F90 deleted file mode 100644 index a9fda41d..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/evap_ingrp.F90 +++ /dev/null @@ -1,53 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms of droplets -!! evaporating within a particle group. -!! -!! Distinct evaporation of cores has not been treated. -!! -!! @author Andy Ackerman -!! @version Aug-2001 -subroutine evap_ingrp(carma,cstate,iz,ibin,ig,ip,rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ig !! group index - integer, intent(in) :: ip - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ie - integer :: isub - - - ! For a single group, the core mass fraction is 0. - cmf(ibin,ig) = 0.0_f - - ! The smallest bin cannot be a source to smaller bins in same group - if( ibin .eq. 1 )then - return - endif - - ! Evaluate evaporation source term for all elements in group - do isub = 1, nelemg(ig) - ie = ip + isub - 1 - evappe(ibin-1,ie) = evappe(ibin-1,ie) + & - pc(iz,ibin,ie)*evaplg(ibin,ig) - enddo - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/evap_mono.F90 b/CARMAchem_GridComp/CARMA/source/base/evap_mono.F90 deleted file mode 100644 index bf08e8b9..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/evap_mono.F90 +++ /dev/null @@ -1,109 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to total -!! evaporation from bin group into a monodisperse -!! distribution. -!! -!! Distinct evaporation of cores has not been treated. -!! -!! @author Andy Ackerman -!! @version Aug-2001 -subroutine evap_mono(carma,cstate,iz,ibin,ig,iavg,ieto,igto,rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ig !! group index - integer, intent(in) :: iavg - integer, intent(in) :: ieto - integer, intent(in) :: igto - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ic - integer :: iecore - integer :: ie2cn - integer :: jbin - logical :: conserve_mass - real(kind=f) :: factor - real(kind=f) :: fracmass - - - ! Define option to conserve mass or number when a choice must be made - ! during monodisperse total evaporation beyond CN grid -- should be done in setupaer() - conserve_mass = .true. - - ! Set automatic flag for total evaporation used in gasexchange() - totevap(ibin,ig) = .true. - - ! Possibly put all of core mass into largest, smallest, or - ! smallest nucelated CN bin - if( too_big .or. too_small .or. nuc_small )then - - if( too_big )then - jbin = NBIN - elseif( too_small )then - jbin = 1 - else - jbin = 1 - endif - - if( conserve_mass )then - factor = coreavg/rmass(jbin,igto) - else - factor = ONE - endif - - ! First the CN number concentration element - evappe(jbin,ieto) = evappe(jbin,ieto) + factor*evdrop - - ! Now the CN cores - do ic = 2, ncore(ig) - iecore = icorelem(ic,ig) - ie2cn = ievp2elem(iecore) - evappe(jbin,ie2cn) = evappe(jbin,ie2cn) + & - factor*evcore(ic)*rmass(jbin,igto) - enddo - else - - ! Partition core mass between two CN bins, conserving total core mass - ! and number. The number will be subdivided into bins and -1. - if( iavg .le. 1 .or. iavg .gt. NBIN )then - if (do_print) write(LUNOPRT, *) "evap_mono: bad iavg = , ", iavg - rc = RC_ERROR - return - endif - - fracmass = ( rmass(iavg,igto) - coreavg ) / diffmass(iavg,igto,iavg-1,igto) -! fracmass = max( 0._f, min( ONE, fracmass ) ) - - ! First the CN number concentration element - evappe(iavg-1,ieto) = evappe(iavg-1,ieto) + evdrop*fracmass - evappe(iavg,ieto) = evappe(iavg,ieto) + evdrop*( ONE - fracmass ) - - ! Now the cores - do ic = 2, ncore(ig) - iecore = icorelem(ic,ig) - ie2cn = ievp2elem(iecore) - evappe(iavg-1,ie2cn) = evappe(iavg-1,ie2cn) + & - rmass(iavg-1,igto)*evcore(ic)*fracmass - evappe(iavg,ie2cn) = evappe(iavg,ie2cn) + & - rmass(iavg,igto)*evcore(ic)*( ONE - fracmass ) - enddo - endif - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/evap_poly.F90 b/CARMAchem_GridComp/CARMA/source/base/evap_poly.F90 deleted file mode 100644 index 1eb7117a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/evap_poly.F90 +++ /dev/null @@ -1,141 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to -!! total evaporation into a polydisperse CN distribution by assuming -!! that the pdf of core mass is log-normal skewed by mass raised to -!! the -3/2 power (which guarantees average core mass from pdf is the -!! same as average core mass). -!! -!! Distinct evaporation of cores has not been treated. -!! -!! @author Andy Ackerman -!! @version Aug-2001 -subroutine evap_poly(carma,cstate,iz,ibin,ig,iavg,ieto,igto,rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ig !! group index - integer, intent(in) :: iavg - integer, intent(in) :: ieto - integer, intent(in) :: igto - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ic - integer :: ito - integer :: kount_s - integer :: kount_l - integer :: iecore - integer :: ie2cn - real(kind=f) :: prob(NBIN) - real(kind=f) :: rn_norms - real(kind=f) :: rn_norml - real(kind=f) :: rm_norms - real(kind=f) :: rm_norml - real(kind=f) :: expon - real(kind=f) :: rmassto - real(kind=f) :: dmto - real(kind=f) :: weightl - real(kind=f) :: weights - - - ! Treat total evaporation from a polydisperse core mass distribution: - ! assume a log-normal CN size distribution and conserve number and mass as - ! described by Turco (NASA Technical Paper 1362). - ! - ! Set automatic flag for total evaporation used in gasexchange() - totevap(ibin,ig) = .true. - - ! Calculate number and mass - ! normalization factors for cores smaller and larger than . - rn_norms = 0._f - rn_norml = 0._f - rm_norms = 0._f - rm_norml = 0._f - kount_s = 0 - kount_l = 0 - - do ito = 1, NBIN - - rmassto = rmass(ito,igto) - dmto = dm(ito,igto) - - ! is probability that core mass is in CN bin . - if( coreavg .gt. 0._f .and. coresig .gt. 0._f )then - expon = -log( rmassto/coreavg )**2 / ( 2.*coresig ) - expon = max(-POWMAX, expon) - else - expon = 0._f - endif - - prob(ito) = rmassto**(-1.5_f) * exp( expon ) - - if( ito .lt. iavg )then - rn_norms = rn_norms + prob(ito)*dmto - rm_norms = rm_norms + prob(ito)*dmto*rmassto - kount_s = kount_s + 1 - else - rn_norml = rn_norml + prob(ito)*dmto - rm_norml = rm_norml + prob(ito)*dmto*rmassto - kount_l = kount_l + 1 - endif - enddo - - ! Calculate mass weighting factors for small and - ! large cores. - if( kount_s .eq. 0 )then - weightl = ONE - elseif( kount_l .eq. 0 )then - weightl = 0._f - else - rm_norms = rm_norms/rn_norms - rm_norml = rm_norml/rn_norml - weightl = (coreavg - rm_norms) / (rm_norml - rm_norms) - if( weightl .gt. ALMOST_ONE )then - weightl = ONE - elseif( weightl .lt. ALMOST_ZERO )then - weightl = 0._f - endif - endif - - weights = ONE - weightl - - ! Renormalize probability distribution function and evaluate the CN - ! evaporation source term . - do ito = 1, NBIN - -! if( ito .le. iavg )then - if( ito .lt. iavg )then ! Kevin M - prob(ito) = prob(ito)*weights/rn_norms - else - prob(ito) = prob(ito)*weightl/rn_norml - endif - - ! First the CN number concentration element - evappe(ito,ieto) = evappe(ito,ieto) + evdrop*prob(ito)*dm(ito,igto) - - ! Now the CN core elements - do ic = 2, ncore(ig) - iecore = icorelem(ic,ig) - ie2cn = ievp2elem(iecore) - evappe(ito,ie2cn) = evappe(ito,ie2cn) + & - rmass(ito,igto)*evcore(ic)*prob(ito)*dm(ito,igto) - enddo - enddo - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/evapp.F90 b/CARMAchem_GridComp/CARMA/source/base/evapp.F90 deleted file mode 100644 index 64bad71d..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/evapp.F90 +++ /dev/null @@ -1,199 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to evaporation . -!! -!! @author Andy Ackerman -!! @version Aug-2001 -subroutine evapp(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ibin !! bin index - integer :: ielem !! element index - integer :: ig !! source group index - integer :: ip !! source number concentration element - integer :: ic - integer :: ic1 !! element of first core mass in group - integer :: iecore - integer :: ieto - integer :: igto - integer :: iavg - logical :: evap_total - real(kind=f) :: sig_mono - real(kind=f) :: coretot - real(kind=f) :: coremom - real(kind=f) :: smf - integer :: nbin - - - ! Define criterion for monodisperse core mass distributions - sig_mono = sqrt( ALMOST_ZERO ) - - ! Loop over source groups (from which evaporation is being treated) - do ig = 1, NGROUP - - ip = ienconc(ig) - - ! No evaporation unless particles are volatile - if( itype(ip) .eq. I_VOLATILE )then - - ! Make sure that these always get intializaed, since they can - ! cause problems in other parts of the code if they aren't. - totevap(:,ig) = .false. - cmf(:,ig) = 0._f - - if (pconmax(iz, ig) > FEW_PC) then - - ic1 = icorelem(1,ig) - - ! Loop over source bins and calculate temporary evaporation source - ! for droplets in next smaller bin assuming no total evaporation - do ibin = 1, NBIN - evdrop = pc(iz,ibin,ip)*evaplg(ibin,ig) - - ! Check for evaporation of a sufficient number of droplets -! if( evdrop .gt. 0._f .and. pc(iz,ibin,ip) .gt. SMALL_PC )then - if( evdrop .gt. 0._f )then - - ! No cores: transfer droplets within group - if( ic1 .eq. 0 )then - call evap_ingrp(carma,cstate,iz,ibin,ig,ip,rc) - else - - ! First core is not involatile (therefore none are) - ! -- this is a hack until enforced/checked in setupbins() -- - ! transfer droplets within group - ! - if( itype(ic1) .ne. I_COREMASS )then - call evap_ingrp(carma,cstate,iz,ibin,ig,ip,rc) - else - - ! Have cores: calculate the amount of the source term - ! by number associated with total evaporation of secondary cores - coretot = pc(iz,ibin,ic1) - do ic = 2, ncore(ig) - iecore = icorelem(ic,ig) - if( itype(iecore) .eq. I_COREMASS )then - coretot = coretot + pc(iz,ibin,iecore) - endif - enddo - do ic = 2, ncore(ig) - iecore = icorelem(ic,ig) - if( itype(iecore) .eq. I_COREMASS )then - evcore(ic) = evdrop*pc(iz,ibin,iecore)/coretot - endif - enddo - - ! Calculate average particle core mass and fraction - coreavg = coretot / pc(iz,ibin,ip) - coreavg = min( rmass(ibin,ig), coreavg ) - cmf(ibin,ig) = coreavg / rmass(ibin,ig) - ! cmf(ibin,ig) = max( 0., min( ONE, cmf(ibin,ig) ) ) - - ! Get target number concentration element and group for total evaporation - ! and evaluate logical flags regarding position on CN bin and index of - ! target CN bin - ieto = ievp2elem(ic1) - - ! To treat internal mixtures, it is possible for the condensate to - ! totally evaporate and have core mass, but for there not to be another - ! group to which the core mass should go. So allow no evp2elem, but - ! always use the in group evaporation. - if (ieto == 0) then - nuc_small = .false. - else - igto = igelem(ieto) - - too_small = coreavg .lt. rmass(1,igto) - nbin = NBIN - too_big = coreavg .gt. rmass(nbin,igto) - - if( .not. (too_small .or. too_big) )then - iavg = log( coreavg / rmassmin(igto) ) / & - log( rmrat(igto) ) + 2 - iavg = min( iavg, NBIN ) - endif - - ! Only consider size of evaporating cores relative to nuc_small - ! when treating core second moment for this particle group - if( if_sec_mom(ig) )then - nuc_small = coreavg .lt. rmass(1,igto) - else - nuc_small = .false. - endif - end if - - ! Want total evaporation when - ! cores smaller than smallest nucleated - ! OR evaporating droplets are in bin 1 - ! OR droplets will be created with core mass fraction > 1 - evap_total = nuc_small .or. ibin .eq. 1 .or. & - rmrat(ig)*cmf(ibin,ig) .gt. ONE - - ! No core second moment: evaporate to monodisperse CN cores or within group.! - if( .not. if_sec_mom(ig) )then - - if( evap_total .and. (ieto /= 0) )then - call evap_mono(carma,cstate,iz,ibin,ig,iavg,ieto,igto,rc) - else - call evap_ingrp(carma,cstate,iz,ibin,ig,ip,rc) - endif - - ! Have core second moments: evaporate to mono- or polydisperse CN cores - ! or within group. First calculate average core second moment , - ! second moment fraction , and square of the logarithm of the geometric - ! standard deviation of the assumed core mass distribution . - else - - coremom = pc(iz,ibin,imomelem(ig)) / pc(iz,ibin,ip) - smf = coremom / rmass(ibin,ig)**2 - coresig = log( smf / cmf(ibin,ig)**2 ) - - ! Want total evaporation for above reasons - ! OR droplets will be created with core moment fraction > 1 - evap_total = evap_total .or. rmrat(ig)**2*smf .gt. ONE - - if( evap_total .and. (ieto /= 0) )then - - ! Want monodisperse total evaporation when - ! cores smaller than smallest nucleated - ! OR evaporating core distribution is narrow - ! Otherwise want polydisperse total evaporation - if( nuc_small .or. coresig .le. sig_mono )then - call evap_mono(carma,cstate,iz,ibin,ig,iavg,ieto,igto,rc) - else - call evap_poly(carma,cstate,iz,ibin,ig,iavg,ieto,igto,rc) - endif - - ! Droplet evaporation within group - else - call evap_ingrp(carma,cstate,iz,ibin,ig,ip,rc) - endif - endif ! if_sec_mom(ig) - endif ! itype(ic1) - endif ! ic1=0 - endif ! evaplg > 0 - enddo ! ibin=1,NBIN - endif ! enough particles - endif ! volatile particles - enddo ! ig=1,NGROUP - - ! Return to caller with evaporation production terms evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/fractal_meanfield_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/fractal_meanfield_mod.F90 deleted file mode 100644 index 5139fcd0..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/fractal_meanfield_mod.F90 +++ /dev/null @@ -1,1475 +0,0 @@ -!! This module (fractal_meanfield_mod.F90) contains the main routines -!! necessary to calculate the solution of the mean field approximation -!! for a dry fractal particle composed of identical spherical monomers. -!! This is used to generate optical properties for these paticles in CARMA. -!! -!! See Botet et al. 1997 "Mean-field approximation of Mie -!! scattering by fractal aggregates of identical spheres." -!! Applied Optics 36(33) 8791-8797 -!! -!! Original code from P. Rannou and R. Botet. -!! Translated to F90 and ported into CARMA by E. Wolf -!! -!! master: fractal_meanfield calling: cmie,ludcmpc,lubksbc,dqagi -!! -!! calculating the monomer Mie scattering -!! - SUBROUTINE cmie() calling: intmie() -!! - SUBROUTINE intmie() calling: intmie() -!! -!! calculating the matrix elements -!! - FUNCTION funa() calling: dqag,fpl -!! - FUNCTION fpl() calling: plgndr -!! - FUNCTION plgndr() -!! - FUNCTION funb_n() -!! - FUNCTION funs_n() calling: dq2agi,xfreal_n,xfimag_n -!! - FUNCTION xfreal_n() calling: besseljy,phi -!! - FUNCTION xfimag_n() calling: besseljy,phi -!! - FUNCTION BESSELJY() -!! -!! Routines to calculate the scattered wave -!! of monomer: -!! - FUNCTION fpi() calling: plgndr() -!! - FUNCTION ftau() calling: plgndr() -!! of agglomerate/cluster: -!! - FUNCTION fp1() -!! -!! Routines related to the probability distribution: -!! - FUNCTION anorm() calling: dqdagi,fdval -!! - FUNCTION fdval() -!! - FUNCTION phi() calling: fdval -!! - FUNCTION fco() calling: fdval -!! -!! @author P. Rannou, R. Botet, Eric Wolf -!! version March 2013 -module fractal_meanfield_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carma_mod - - use adgaquad_types_mod - use adgaquad_mod - use lusolvec_mod - - implicit none - - private - - public :: fractal_meanfield - - ! Private module varibles: Moved from COMMON blocks - integer, parameter :: nmi=40 - integer, parameter :: n2m = 2*nmi - - contains - - !! - !! Generate optical properties for CARMA fractal particles. - !! - !! See Botet et al. 1997 "Mean-field approximation of Mie - !! scattering by fractal aggregates of identical spheres." - !! Applied Optics 36(33) 8791-8797 - !! - !! @author P.Rannou, R.Botet, Eric Wolf - !! @version March 2013 - subroutine fractal_meanfield(carma, xl_in, xk_in, xn_in, nb_in, alpha_in, & - df_in, rmon,xv, ang, Qext, Qsca, gfac, rc) - - ! some of these may be included in carma object - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f),intent(in) :: xl_in !! Wavelength [microns] - real(kind=f),intent(in) :: xk_in !! imaginary index of refraction - real(kind=f),intent(in) :: xn_in !! real index of refraction - real(kind=f),intent(in) :: nb_in !! number of monomers - real(kind=f),intent(in) :: alpha_in !! Packing coefficient - real(kind=f),intent(in) :: df_in !! Fractal dimension - real(kind=f),intent(in) :: rmon !! monomer size [microns] - real(kind=f),intent(in) :: xv !! set to 1 - real(kind=f),intent(in) :: ang !! angle set to zero - real(kind=f),intent(out) :: Qext !! EFFICIENCY FACTOR FOR EXTINCTION - real(kind=f),intent(out) :: Qsca !! EFFICIENCY FACTOR FOR SCATTERING - real(kind=f),intent(out) :: gfac !! asymmetry factor - integer,intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer, parameter :: nth = 10001 - integer, parameter :: maxsub = 50000 - integer, parameter :: lenw = 200000 - integer :: nstop ! index with the last mie-coefficient - integer :: n1stop - integer :: pp,tt,mm - real(kind=f) :: krg,rg ! Particle structure - real(kind=f) :: sigmas,sigmae,nc1 - real(kind=f) :: sigext ! extinction cross section - real(kind=f) :: sigsca ! scattering cross section - real(kind=f) :: sigabs ! absorption cross section - real(kind=f) :: totg ! asymmetry parameter - real(kind=f) :: sigext2,sigext3 - real(kind=f) :: rems ! radius of equivalent mass sphere - real(kind=f) :: gems ! geometric cross-section of equivalent mass sphere - real(kind=f) :: dthetar,angler,weight - real(kind=f) :: sumsca - real(kind=f) :: lbd,beta ! optical characteristics - real(kind=f) :: sstest(0:nf) - real(kind=f) :: setest(0:nf) - real(kind=f) :: xl(39) ! place holder for wavelength - real(kind=f) :: xn(39) ! place holder for real index of refraction - real(kind=f) :: xk(39) ! place holder for imaginary index of refraction - real(kind=f) :: val - real(kind=f) :: funca(nmi,nmi,0:n2m) ! for storage of funa(nu,n;p) - complex(kind=f) :: res ! for storage of funs_n - complex(kind=f) :: funcs(0:n2m) - real(kind=f) :: s11(0:nth-1) - real(kind=f) :: s11_n(0:nth-1) - real(kind=f) :: xint(0:nth-1) - real(kind=f) :: wom - real(kind=f) :: pol(0:nth-1) - complex(kind=f) :: s01,s02 - complex(kind=f) :: s1(0:nth-1) - complex(kind=f) :: s2(0:nth-1) - complex(kind=f) :: ajt - complex(kind=f) :: an(nf) - complex(kind=f) :: bn(nf) - complex(kind=f) :: ni,i,id,onec,zeroc - complex(kind=f) :: d1(nmi) - complex(kind=f) :: d2(nmi) - complex(kind=f) :: Ap1(nmi,nmi) - complex(kind=f) :: Bp1(nmi,nmi) - complex(kind=f) :: dvec(n2m) ! For matrix eqn of order 2N - complex(kind=f) :: cvec(n2m) - complex(kind=f) :: EpABC(n2m,n2m) - integer :: luindx(n2m) ! For LU decomposition - real(kind=f) :: dlu - integer :: ifail - integer :: iwork(maxsub) - integer :: neval,nsubin - real(kind=f) :: work(lenw) - - ! Previously these were implicitly defined - real(kind=f) :: angle, pi, rn, ri - real(kind=f) :: deltas, deltae, xfact - real(kind=f) :: bound, errrel, p1, dp1 - real(kind=f) :: errabs, total - integer :: n2stop, n3stop, ntheta, ii, kk, nn, jj, iy, ir, q, interv - real(kind=f) :: a0, c0, a1, c1, a2, c2 - real(kind=f) :: qabs - - ! Previously these were globals, which wouldn't be thread safe. - type(adgaquad_vars_type) :: fx_vars - - ! Set the return code to default to okay. - rc = RC_OK - - ! *** Set from input arguments - fx_vars%nb = nb_in - fx_vars%df = df_in - fx_vars%alpha = alpha_in - xl(1) = xl_in - xk(1) = xk_in - xn(1) = xn_in - - ! *** Complex constants 1, 1, identity(1,1), zero(0,0) : - i = cmplx(0._f,1._f,kind=f) - onec = cmplx(1._f,0._f,kind=f) - id = cmplx(1._f,1._f,kind=f) - zeroc = cmplx(0._f,0._f,kind=f) - - ! Other initializations - funca(:,:,:) = 0.0_f - fx_vars%a = rmon *1.e-2_f ! a = r_monomer in m - beta=ang*(3.1415926_f / 180._f) ! =0 when ang=0 - Ap1(:,:) = zeroc - Bp1(:,:) = zeroc - sstest(:) = 0.0_f - setest(:) = 0.0_f - - ! **************************************************************** - ! *** Definition and calculation of factorials 0 - nf - ! *** (nf set in adgaqaud_types_mod.F90) - ! *** and storage [ real*8 fact() (double prec.) ] - ! **************************************************************** - - fx_vars%fact(0)=1._f ! factorials fact(n)=n! - do ii=1,nf - fx_vars%fact(ii) = fx_vars%fact(ii-1)*ii*1._f - end do - - pi=4._f*atan(1._f) ! 3.1415926535 - fx_vars%coeff=anorm(carma,fx_vars,rc) - if (rc < 0) return - - ! **************************************************************** - ! anorm() integrated INT_0^inf[ x**(df-1.)*exp(-x**df/2._f) dx ] - ! and occupied - ! anorm := 4 pi * INT_0^inf[ x**(df-1.)*exp(-x**df/2._f) dx ] - ! == geometric scalingfactor Eq.(10) in [Botet et al, 1995] - ! c := 0.5 - ! **************************************************************** - - kk=1 - ni=xn(kk)*1._f+i*xk(kk)*xv*1._f ! ni := complex index of refraction of monomer - ! (xv := 1 ; input parameter in file "calpha") - lbd=xl(kk)*1.e-6_f ! lbd := wavelength in m - ! (in matrix medium / material !) - fx_vars%k=2._f*pi/lbd ! k := abs.val. of wavevector in m^-1 - ! (in matrix medium / material !) - - ! *** ****************************************************************** - ! *** Calculation of Mie coefficients for monomer scattering - ! *** up to a maximum order of nf=50 - ! *** ****************************************************************** - - do ii=1,nf - an(ii) = zeroc - bn(ii) = zeroc - end do - - rn=xn(kk) ! Re(relative_n_complex,monomer) - ri=xk(kk)*xv ! Im(relative_n_complex,monomer) - ! xv should be set to 1 (sse above) - ! a = monomer sphere radius - ! lbd = wavelength in matrix medium - - ! Call Mie routine - call cmie(lbd,rn,ri,fx_vars%a,an,bn,nstop) - - do ii=1,nf - if (an(ii).ne.0._f) nstop=ii - end do - - ! nstop is now the index with the last mie-coefficient - ! (highest index i) an(i) not equal zero. - ! since all the an were set to zero before calling - ! cmie(), nstop is the termination index used in cmie() - ! or in intmie(). Usually, a termination index - ! nstop = INT( 2 + x + 4 x^(1/3) ) is used; in intmie(), - ! however, a value of - ! nstop := MAX( INT(...), |m*x| )+15 is used !??? - - sigmas=0._f - sigmae=0._f - - do nn=1,nstop - nc1=abs(an(nn))**2._f+abs(bn(nn))**2._f - nc1=nc1*(2._f*nn+1._f) - sigmas=sigmas+nc1*(2._f*3.14159265_f)/(fx_vars%k**2._f) - nc1=real(an(nn)+bn(nn)) - nc1=nc1*(2._f*nn+1._f) - sigmae=sigmae+nc1*(2._f*3.14159265_f)/(fx_vars%k**2._f) - sstest(nn)=sigmas - setest(nn)=sigmae - deltas=abs(sstest(nn-1)-sstest(nn))/sstest(nn) - deltae=abs(setest(nn-1)-setest(nn))/setest(nn) - if(deltas.gt.1.e-6_f) n2stop=nn - if(deltae.gt.1.e-6_f) n3stop=nn - end do - - n1stop=n2stop - if (n3stop.gt.n2stop) n1stop=n3stop - ! The order of the set of linear equations is chosen - ! as the number of mie coefficients where the sum yielding - ! the monomer ext./scatt. cross sections do not change more - ! than 1.D-3 compared to the values with one summand less. - - rg=fx_vars%alpha*fx_vars%nb**(1._f/fx_vars%df)*fx_vars%a ! rg := radius of gyration - krg=fx_vars%k*rg - ntheta=7800 !180-int(krg**.5*28*log10(dxk(kk))) - if (ntheta*0.5_f .eq. (ntheta/2)*1._f) ntheta=ntheta+1 - - ! *** ****************************************************************** - ! *** FIRST PART: Solution of self consistent mean field equation, - ! *** i.e. the set of linear equations (SLE) defining the - ! *** mean field coefficients d^1_1,n and d^2_1,n - ! *** according to Eq.(12) of (Botet 1997) - ! *** To do so, - ! *** - matrix elements A^1,nu_1,n and B^1,nu_1,n - ! *** are calculated with Eq.(13), using Eqns.(14)-(16) - ! *** - the set of lin. Eqns. is solved yielding the d's - ! *** ****************************************************************** - ! *** Eq.(12) of Botet et al 1997 defines a matrix eqn. of order 2N : - ! *** (since N=n1stop, 2N = 2 * n1stop = order of SLE) - ! *** - ! *** EpABC * dvec = cvec with - ! *** - ! *** dvec and cvec being the 2N-vectors - ! *** - ! *** ( d^(1)_1,1 ) ( a_1 ) - ! *** ( d^(1)_1,2 ) ( a_2 ) - ! *** ( ... ) ( ... ) - ! *** ( d^(1)_1,n ) ( a_n ) - ! *** dvec := ( d^(2)_1,1 ) and cvec := ( b_1 ) and further - ! *** ( d^(2)_1,2 ) ( b_2 ) - ! *** ( ... ) ( ... ) - ! *** ( d^(2)_1,n ) ( b_n ) - ! *** - ! *** - ! *** EpABC := 1 + AB * C where AB, 1, C are the 2N*2N - matrices - ! *** - ! *** ( a_1 0 0 ... ... 0 ) - ! *** ( 0 a_2 0 ... ... 0 ) - ! *** AB := ( 0 0 ... 0 0 0 ... 0 ) 1 := 2N*2N unity matrix - ! *** ( 0 0 ... a_n 0 0 ... 0 ) - ! *** ( 0 0 ... 0 b_1 0 ... 0 ) - ! *** ( ... ... ... 0 ) - ! *** ( ... ... 0 b_n-1 0 ) - ! *** ( 0 0 ... ... 0 0 b_n) - ! *** - ! *** and ( A B ) - ! *** C := ( ) where A and B are the two N*N matrices - ! *** ( B A ) given by Eq.(13), - ! *** including the factor (N_monomers - 1): - ! *** - ! *** A_n,nu := (N_m-1) * A_(1,n)^(1,nu) and - ! *** B_n,nu := (N_m-1) * B_(1,n)^(1,nu) - ! *** - ! *** (A_(1,n... and B_(1,n... according to Eq.(13) of Botet 1997) - ! *** ****************************************************************** - - n2stop = 2 * n1stop ! n2stop = order of SLE - - ! *** ****************************************************************** - ! *** Error handling moved from xfreal_n, xfimag_n. Calculations fail - ! *** in integration package when n2stop > 48. n2stop is related to the - ! *** number of complex mie scattering coefficients used in teh calculation - ! *** which is in turn related to the size parameter of monomers. - ! *** If nstop>48 end calculation here instead of continuing. - - if (n2stop.gt.48) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "fractal_meanfield_mod::n2stop greater & - &than 48. Size parameter (2*pi*rmon/lambda): ", & - 2._f*3.14159265_f*fx_vars%a/lbd, "Monomer Size parameter & - &must be less than ~17." - end if - rc = RC_ERROR - return - endif - - - ! *** ****************************************************************** - do ii=1,n1stop - cvec(ii) = an(ii) ! right hand side vector - cvec(n1stop+ii) = bn(ii) - dvec(ii) = zeroc ! solution vector d - dvec(n1stop+ii) = zeroc - end do - - do pp=0,n2stop !variable p - res = funs_n(carma,fx_vars,pp,rc) ! Eq.(16) S_p(k R_g) - if (rc < 0) return - funcs(pp) = res - end do - - ! Calculate terms A and B - - ! *** loops over indices nu,n,p : - do ii=1,n1stop !variable n - do jj=1,n1stop !variable nu - mm = IABS(ii-jj) - tt = ii+jj - - ! *** ****************************************************************** - ! calculation of A_(1,n)^(1,nu) according to Eq.(13) - ! *** ****************************************************************** - do pp=mm,tt - - funca(jj,ii,pp) = funa(carma,fx_vars,jj,ii,pp,rc) ! Eq.(14) a(nu,n;p)a - if (rc < 0) return - - Ap1(ii,jj) = Ap1(ii,jj) + & - ( onec * (ii*(ii+1)+jj*(jj+1)-pp*(pp+1)) ) & - * funca(jj,ii,pp) * funcs(pp) - end do ! loop over pp (variable p) - - ! scaling factors of eq.(13), factor (N_mon-1) from eq.(12) - Ap1(ii,jj) = Ap1(ii,jj) * (2._f*jj+1._f)/(jj*(jj*1._f+1._f)) - Ap1(ii,jj) = Ap1(ii,jj) * (fx_vars%nb-1._f) / (ii*(ii*1._f+1._f)) - - ! *** ****************************************************************** - ! calculation of B_(1,n)^(1,nu) according to Eq.(13) - ! *** ****************************************************************** - do pp=mm,tt - Bp1(ii,jj) = Bp1(ii,jj) + funb_n(jj,ii,pp,funca) * funcs(pp) - end do ! loop over pp (variable p) - - ! scaling factors of eq.(13), factor (N_mon-1) from eq.(12) - Bp1(ii,jj) = Bp1(ii,jj) * (2._f*jj+1._f)/(jj*(jj*1._f+1._f)) - Bp1(ii,jj) = Bp1(ii,jj) * (fx_vars%nb-1._f) * 2._f/(ii*(ii*1._f+1._f)) - end do ! loop over jj=1,n1stop (variable nu) - end do ! loop over ii=1,n1stop (variable n) - - ! *** ****************************************************************** - ! End of Calculation of terms A and B - - ! *** ****************************************************************** - ! *** Setup and solution of matrix equation of order 2N ( = n2stop ) - ! *** constituted by eq.(12) - ! *** ****************************************************************** - ! *** matrix product (AB * C) (definitions see above) - do ii=1,n1stop - do jj=1,n1stop - EpABC(ii,jj) = an(ii) * Ap1(ii,jj) - EpABC(ii,jj+n1stop) = an(ii) * Bp1(ii,jj) - EpABC(ii+n1stop,jj) = bn(ii) * Bp1(ii,jj) - EpABC(ii+n1stop,jj+n1stop) = bn(ii) * Ap1(ii,jj) - end do - end do - - ! *** ****************************************************************** - ! *** add 2N*2N unity matrix - do ii=1,n1stop - EpABC(ii,ii) = EpABC(ii,ii) + onec - EpABC(ii+n1stop,ii+n1stop) = EpABC(ii+n1stop,ii+n1stop) + onec - end do - - ! ====================================================================== - ! *** solve matrix equation using external routines (LU decomposition) - CALL LUDCMPC(EpABC,n2stop,n2m,luindx,dlu) - CALL LUBKSBC(EpABC,n2stop,n2m,luindx,cvec) - do ii=1,n1stop - d1(ii) = cvec(ii) - d2(ii) = cvec(ii+n1stop) - end do - - ! *** ****************************************************************** - ! *** SECOND PART: Recomposition of the total wave scattered by - ! *** the entire agglomerate/cluster by adding the - ! *** waves scattered by each monomer taking into - ! *** account the respective phase of the single waves. - ! *** ****************************************************************** - - ! *** ****************************************************************** - ! ---------------------------------------------------------------------- - ! 1) Calculate the amplitude functions |S1^j(th)| et |S2^j(th)| - ! of one monomer of the agglomerate/cluster: - ! ( see e.g. Bohren, Huffman (1983) p.112, Eq.(4.74) with the - ! substitutions a_n -> d^1_1,n and b_n -> d^2_1,n - ! or Rannou (1999) Eq.(1)-(6) ) - ! ---------------------------------------------------------------------- - ! *** ****************************************************************** - - do iy=0,ntheta-1,1 ! loop over angles - angle=iy*180._f/(ntheta-1) - s1(iy)=0._f - s2(iy)=0._f - wom=cos(angle*3.1415926353_f/180._f) - - do ir=1,n1stop ! loop over Mie - indices - xfact=2._f*(2._f*ir+1._f)/(ir*1._f*(ir*1._f+1._f)) - ajt=d1(ir)*fpi(ir,wom,fx_vars)+d2(ir)*tau(ir,wom,fx_vars) - s1(iy)=s1(iy)+xfact*ajt - ajt=d1(ir)*tau(ir,wom,fx_vars)+d2(ir)*fpi(ir,wom,fx_vars) - s2(iy)=s2(iy)+xfact*ajt - end do - - s11(iy)=abs(s1(iy))**2._f+abs(s2(iy))**2._f - pol(iy)=abs(s1(iy))**2._f-abs(s2(iy))**2._f - pol(iy)=pol(iy)/(abs(s1(iy))**2_f+abs(s2(iy))**2._f) - ! *** S_11(theta) = 1/2 * ( |S_1|^2 + |S_2|^2 ) - ! *** above, s1(theta) = 2 * S_1(theta) - ! *** =>S_11(theta) = 1/2 * ( |1/2*s1|^2 + |1/2*s2|^2 ) - ! = 1/8 * ( |s1|^2 + |s2|^2 ) - s11_n(iy)=.125_f*(abs(s1(iy))**2._f+abs(s2(iy))**2._f) - end do - - s01=s1(0) - s02=s2(0) - - ! *** Extinction cross section sigext( d^1_1,n , d^2_1,n ) *** - sigext=0._f - do ir=1,n1stop ! loop (sum) over Mie-indices - sigext=sigext+(2._f*ir+1._f)*REAL(d1(ir)+d2(ir)) - end do - sigext = fx_vars%nb * 2._f*pi/fx_vars%k**2._f * sigext ! Eq.(27) - - ! *** Alternatively (in a test, all values agreed with rel.acc. 1e-6), - ! *** Extinction cross section sigext( S(0 deg) ) (optical theorem) *** - ! *** (see e.g. Bohren, Huffman (1983), Eq. (4.76)) - ! *** S(0)=S_1(0)=S_2(0); sigma_ext = 4 pi / k^2 * Re(S(0)) - ! *** above, s1(theta) = 2 * S_1(theta) (factor 2 in 'xfact') - ! sigext2 = nb * 4._f*pi/k**2._f * 0.5_f*REAL(s01) - ! sigext3 = nb * 4._f*pi/k**2._f * 0.5_f*REAL(s02) - ! *** ****************************************************************** - - ! *** ****************************************************************** - ! ---------------------------------------------------------------------- - ! 2) Calculate the phase integral in Eq.(26) with P(r) already - ! substituted ( compare Eq.(10) and (Botet 1995) ) : - ! INT(0;infinity)[ sin(2XuZ) u^(d-2) f_co(u) du ] - ! taking into account the different phases of the single - ! scattered waves. - ! ---------------------------------------------------------------------- - ! *** ****************************************************************** - do q=0,ntheta-1,1 - angle=q*180._f/(ntheta-1) - if (angle .eq. 0._f) angle=0.001_f - if (angle .eq. 180._f) angle=179.999_f - fx_vars%zed=sin(angle*3.1415928353_f/180._f/2._f) - - bound=0._f - interv=1 - errrel=1e-5_f - p1=0._f - dp1=0._f - - !====================================================================== - !--- Version using the QUADPACK - routine : - !---------------------------------------------------------------------- - ifail = 0 - CALL dqagi(fp1,fx_vars,bound,interv,errabs,errrel,p1,dp1,neval,ifail,maxsub,lenw,nsubin,iwork,work) - if(ifail.ne.0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "fractal_meanfield_mod::ifail=",ifail," returned by dqagi()!" - rc = RC_ERROR - return - endif - !====================================================================== - - p1=2._f*pi * (fx_vars%nb-1._f) / (fx_vars%coeff*fx_vars%zed*krg)*p1 + 1._f - xint(q)=p1 - end do - - ! *** now, xint(theta) contains the square bracket terms in - ! *** Botet (1997) Eq.(26) or Rannou (1999) Eq.(1) - - ! *** ****************************************************************** - ! ---------------------------------------------------------------------- - ! 3) Calculation of the phase function, calculation of the optical - ! properties (asymmetrie factor g, scatt. cross section sigma_s) - ! by angular integration: INT_0^180[ ... d_theta ] - ! ---------------------------------------------------------------------- - ! *** ****************************************************************** - - total=0._f - totg=0._f - - do q=1,ntheta-2,2 - angle=(q-1)*180._f/(ntheta-1) ! angle in deg - a0=fx_vars%nb*xint(q-1)*s11(q-1)*sin(angle*3.1415926353_f/180._f) - c0=cos(angle*3.1415926353_f/180._f) - - angle=q*180._f/(ntheta-1) - a1=fx_vars%nb*xint(q)*s11(q)*sin(angle*3.1415926353_f/180._f) - c1=cos(angle*3.1415926353_f/180._f) - - angle=(q+1)*180._f/(ntheta-1) - a2=fx_vars%nb*xint(q+1)*s11(q+1)*sin(angle*3.1415926353_f/180._f) - c2=cos(angle*3.1415926353_f/180._f) - - total=total+2._f/6._f*3.1415926353_f/(ntheta-1)*(a0+4._f*a1+a2) - totg=totg+2._f/6._f*3.1415926353_f/(ntheta-1)*(a0*c0+4._f*a1*c1+a2*c2) - end do - totg=totg/total - - ! *** ****************************************************************** - ! *** angular integration of I(theta) according to - ! *** Botet (1997) Eq.(26) or Rannou (1999) Eq.(1) - ! *** I(theta) = N 2pi/k^2 * S(theta) * [ phase integral ] - ! *** with - ! *** S(theta) = s11_n(i) - ! *** [ phase i. ] = xint(i) - ! *** Perfom integration using the following rule: - ! *** Integral_0^pi[ I(theta) sin(theta) d_theta ] - ! *** - ! *** = Sum_q=1^ntheta-1{ Integral_th_(i-1)^th_i [ - ! *** - ! *** 1/2(I(th_(i-1))+I(th_i)) * sin(th) d_th ] } - ! *** - ! *** = sin(delta_theta/2) * Sum_q=1^ntheta-1{ - ! *** - ! *** ( I(th_(i-1)) + I(th_i) ) * sin(th_middle) } - ! *** - ! *** ****************************************************************** - - !dthetad = 180._f / (ntheta-1) ! angular interval in deg - dthetar = pi / (ntheta-1) ! angular interval in rad - sumsca = 0._f - do q=1,ntheta-1,1 - angler = (DBLE(q)-.5_f)*dthetar ! middle of interval in rad - weight = SIN(angler) ! integration weight - val = s11_n(q-1)*xint(q-1) + s11_n(q)*xint(q) - sumsca = sumsca + val*weight - end do - - sumsca = sin(.5_f*dthetar) * sumsca ! interval width factor - ! *** Scattering cross section - sigsca = 2._f * pi / fx_vars%k**2._f * DBLE(fx_vars%nb) * sumsca - ! Warning! sigabs is well computed using this approximation - sigabs=fx_vars%nb*(sigmae-sigmas) - ! sigext=sigabs+sigsca is better than the mean-field value - ! previously defined. This is used hereafter. (P.Rannou) - - ! *** Radius of equivalent mass sphere - rems = fx_vars%a * fx_vars%nb**(1._f/3._f) - - ! *** reference area in definition of efficiencies is the geometrical - ! *** cross section of equivalent mass sphere - gems = pi * rems**2._f - - ! *** Extinction and scattering efficiencies: - qsca = sigsca / gems - qabs = sigabs / gems - qext = qabs + qsca - - gfac = totg - - end subroutine fractal_meanfield - - !! - !! Mie-scattering routine calling interface - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - subroutine cmie(lambda,xn,xk,rad,an,bn,nstop) - - ! Arguments - real(kind=f), intent(in) :: lambda !! wavelength (microns) - real(kind=f), intent(in) :: xn !! real index of refraction - real(kind=f), intent(in) :: xk !! imaginary index of refraction - real(kind=f), intent(in) :: rad !! monomer radius (meters) - complex(kind=f), intent(out) :: an(50) !! Mie wave coefficient an - complex(kind=f), intent(out) :: bn(50) !! Mie wave coefficient bn - integer, intent(out) :: nstop !! index of last mie-coefficent - - ! Local declarations - integer, parameter :: nang = 451 ! number of angles - complex(kind=f) :: refrel ! complex index of refraction - real(kind=f) :: theta(10000) - real(kind=f) :: x,dang - - refrel=cmplx(xn,xk,kind=f) - x=2._f*3.14159265_f*rad/lambda ! size parameter of monomer - dang=1.570796327_f/real(nang-1,kind=f) - - call intmie(x,refrel,nang,an,bn,nstop) - - return - end subroutine cmie - - !! - !! Mie scattering calculations - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - SUBROUTINE intmie(x,refrel,nang,an,bn,nstop) - - ! Arguments - real(kind=f), intent(in) :: x !! size parameter of monomer - complex(kind=f), intent(in) :: refrel !! complex index of refraction - integer, intent(in) :: nang !! number of angles - complex(kind=f), intent(out) :: an(nf) !! Mie wave coefficient an - complex(kind=f), intent(out) :: bn(nf) !! Mie wave coefficient an - integer, intent(out) :: nstop !! index of last mie-coefficent - - ! Local declarations - real(kind=f) :: amu(10000),pi(10000) - real(kind=f) :: pi0(10000),pi1(10000) - complex(kind=f) :: d(3000),y,xi,xi0,xi1 - complex(kind=f) :: s1(2000),s2(2000) - real(kind=f) psi0,psi1,psi,dn,dx - integer :: nmx,nn,n,j - real(kind=f) :: rn, xstop, dang, ymod, chi0, chi1, apsi0, apsi1, fn, chi, apsi - - dx=x - y=x*refrel - - xstop=x+4._f*x**.3333_f+2._f - nstop=xstop - ymod=abs(y) - nmx=dmax1(xstop,ymod)+15 - dang=1.570796327_f/real(nang-1,kind=f) - - ! Initializations - pi0(:) = 0._f - pi1(:) = 0._f - s1(:) = cmplx(0._f,0._f,kind=f) - s2(:) = cmplx(0._f,0._f,kind=f) - amu(:) = 0.0_f - pi(:) = 0.0_f - - d(:) = cmplx(0._f,0._f,kind=f) - nn=nmx-1 - - do n=1,nn - rn=nmx-n+1 - d(nmx-n)=(rn/y)-(1._f/(d(nmx-n+1)+rn/y)) - end do - - do j=1,nang - pi0(j)=0._f ! Legendre functions - pi1(j)=1._f - end do - - nn=2*nang-1 - - do j=1,nn - s1(j)=cmplx(0._f,0._f,kind=f) - s2(j)=cmplx(0._f,0._f,kind=f) - end do - - psi0=cos(dx) ! Initialize Bessel functions - psi1=sin(dx) - chi0=-sin(x) - chi1=cos(x) - - apsi0=psi0 - apsi1=psi1 - - xi0=cmplx(apsi0,-chi0,kind=f) - xi1=cmplx(apsi1,-chi1,kind=f) - - n=1 - - ! ************* iterate over index n ************* -200 dn=n - rn=n - fn=(2._f*rn+1._f)/(rn*(rn+1._f)) - - psi=(2._f*dn-1._f)*psi1/dx-psi0 ! calculate Bessel functions - chi=(2._f*rn-1._f)*chi1/x-chi0 - apsi=psi - xi=cmplx(apsi,-chi,kind=f) - - an(n)=(d(n)/refrel+rn/x)*apsi-apsi1 - an(n)=an(n)/((d(n)/refrel+rn/x)*xi-xi1) - bn(n)=(refrel*d(n)+rn/x)*apsi-apsi1 - bn(n)=bn(n)/((refrel*d(n)+rn/x)*xi-xi1) - - psi0=psi1 - psi1=psi - apsi1=psi1 - - chi0=chi1 - chi1=chi - xi1=cmplx(apsi1,-chi1,kind=f) - - n=n+1 - rn=n - - do 999 j=1,nang - pi1(j)=((2._f*rn-1._f)/(rn-1._f))*amu(j)*pi(j) - pi1(j)=pi1(j)-rn*pi0(j)/(rn-1._f) -999 pi0(j)=pi(j) - - if (n-1-nstop) 200,300,300 -300 continue - - return - END SUBROUTINE intmie - - !! - !! - !! CALLS: FUNCTION dqag/dqdag/DADAPT_() Integration - !! FUNCTION fpl() Integrand - !! - !! Integral in eq. 14, Botet et al. 1997 - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - function funa(carma,fx_vars,nu,n,p,rc) - type(carma_type), intent(in) :: carma !! the carma object - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - integer, intent(in) :: n !! indices - integer, intent(in) :: nu !! indices - integer, intent(in) :: p !! indices - integer, intent(inout) :: rc !! return code - real(kind=f) :: funa !! - - ! Local declarations - integer, parameter :: maxsub=1000 - real(kind=f) :: r,xa,xb,era,erl - integer :: interv - integer :: ifail - integer, parameter :: lenw=4000 ! .ge. 4*maxsub - integer :: iwork(maxsub),neval,nsubin ! nsubin=last - real(kind=f) :: work(lenw) - real(kind=f) :: bound, rres, rerr - - ! Set return code assuming success. - rc = RC_OK - - ! Initializations - funa=0._f - fx_vars%u1=n - fx_vars%u2=1 - fx_vars%u3=nu - fx_vars%u4=1 - fx_vars%u5=p - fx_vars%u6=0 - xa=-1._f - xb=1._f - bound=0._f - interv=1 - era=0._f - erl=1.e-4_f - rres=0._f - rerr=0._f - - !====================================================================== - !--- Version using the QUADPACK - routine : - !---------------------------------------------------------------------- - ifail = 0 - - call dqag(fpl,fx_vars,xa,xb,era,erl,3,rres,rerr,neval,ifail,maxsub,lenw,nsubin,iwork,work) - - if (ifail.ne.0) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "funa::ifail=",ifail, & - " returned by dqag() during call of funa(",nu,",",n,",",p,")" - end if - rc = RC_ERROR - return - endif - - rres=rres-2._f ! ceci est un artifice pour eviter que - ! la routine se plante quand la fonction - ! est paire (res=0.;err=1.d-3 impossible - ! a atteindre!! j'ai fpl'=fpl+1....d'ou - ! int(fpl)=int(fpl')-2. integr de -1 a 1! - - r = (2._f*p+1._f)/2._f - funa = r * rres - - return - END FUNCTION funa - - !! - !! CALLS: FUNCTION plgndr() Legendre-Functions - !! - !! Used in funa. Integrand of eq. 14, Botet et al. 1997 - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION fpl(x, fx_vars) - - ! Arguments - real(kind=f),intent(in) :: x !! - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local declarations - real(kind=f) :: fpl - integer :: m,n,mu,nu,p,pmu - real(kind=f) :: c1,c2,c3 - - c1=plgndr(fx_vars%u1,fx_vars%u2,x,fx_vars) - c2=plgndr(fx_vars%u3,fx_vars%u4,x,fx_vars) - c3=plgndr(fx_vars%u5,fx_vars%u6,x,fx_vars) - - fpl=c1*c2*c3+1._f !this is a trick! - - return - END FUNCTION fpl - - !! - !! Adapted from FUNCTION plgndr() in: Press, Teukolsky, Vetterling, Flannery - !! "Numerical Recipes in ???" (e.g. Num.Rec.in C, 2nd Ed., Cambridge Univ.Press, 1992, page 254) - !! - !! Calculate Legendre Polynomials, used in eq. 14 Botet et al. 1997 - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION plgndr(l,m,x,fx_vars) - - ! Arguments - integer, intent(in) :: l !! indices - integer, intent(in) :: m !! indices - real(kind=f), intent(in) :: x !! return result - type(adgaquad_vars_type), intent(in) :: fx_vars !! variables for functions being integrated - - ! Local declarations - real(kind=f) :: plgndr - integer ::lbl - real(kind=f) :: pll, pmm, somx2, pmmp1 - integer :: i, ll - real(kind=f) :: fact1 - integer :: mstar - - mstar=m - - lbl=0 - plgndr=0._f - - if (mstar.lt.0)then - mstar=-m - lbl=1 - endif - - if (mstar.gt.l) then - pll=0._f - plgndr=0._f - return ! si m>l, Pl,m=0 ! - endif - - pmm=1._f - - if(mstar.gt.0) then - somx2=sqrt((1._f-x)*(1._f+x)) - fact1=1._f - do i=1,mstar - pmm=+pmm*fact1*somx2 !cghmt - en + !! - fact1=fact1+2._f - end do - endif - - if(l.eq.mstar) then - plgndr=pmm - else - pmmp1=x*(2*mstar+1)*pmm - - if(l.eq.mstar+1) then - plgndr=pmmp1 - else - do ll=mstar+2,l - pll=(x*(2*ll-1)*pmmp1-(ll+mstar-1)*pmm)/(ll-mstar) - pmm=pmmp1 - pmmp1=pll - end do - plgndr=pll - endif - endif - - if (lbl.eq.1) then - plgndr=(-1)**mstar*(fx_vars%fact(l-mstar)/fx_vars%fact(l+mstar))*plgndr - mstar=-m !restitution du parametre m!!!!! - endif - - return - END FUNCTION plgndr - - !! - !! replaces funb(nu,n,p) in original code, - !! saving n*n re-calculations of funa(nu,n,p). - !! - !! Calculates eq. 15, Botet et al. 1997 - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION funb_n(nu,n,p,funca) - - ! Arguments - integer, intent(in) :: nu !! indices - integer, intent(in) :: n !! indices - integer, intent(in) :: p !! indices - real(kind=f), intent(in) :: funca(nmi,nmi,0:n2m) !! return result - - ! Local Declarations - real(kind=f) :: funb_n - integer :: i, l, j - real(kind=f) :: var - - funb_n = 0._f - i = int((p*1._f-1._f-abs(n*1._f-nu*1._f))*1._f/2._f) - !print*,nu,n,p,i - - do l=0,i - j = p-2*l-1 - - ! omit j = -1 (when nu=n and p=l=i=0) - IF (j .GE. 0) THEN - - var = funca(nu,n,j) ! in main, a(nu,n,p) was stored in - ! funca(nu,n;p) - funb_n = funb_n + var - ENDIF - - end do - funb_n = (2._f*p+1._f) * funb_n - return - END FUNCTION funb_n - - !! Replaces funs(pp,k) in original code - !! - !! CALLS: - !! FUNCTION dqagi/dq2agi/DADAPT_() Integration - !! FUNCTION xfreal_n() Integrand - !! FUNCTION xfimag_n() Integrand - !! - !! Calculates eq. 16 , Botet et al. 1997 - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version Mar 2013 - function funs_n(carma,fx_vars,pp,rc) - - ! Arguments - type(carma_type), intent(in) :: carma !! the carma object - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - integer, intent(in) :: pp !! indices - integer, intent(inout) :: rc !! return code - - ! Local Declarations - integer, parameter :: maxsub=50000 - complex(kind=f) :: rcomplex,funs_n - real(kind=f) :: rres,ires,rerr,ierr,afun - real(kind=f) :: xa,xb - integer :: ifail - integer, parameter :: lenw=200000 ! .ge. 4*maxsub - integer :: iwork(maxsub),neval,nsubin ! nsubin=last - real(kind=f) :: work(lenw) - real(kind=f) :: rg, bound, errabs, errrel - integer :: interv - - rc = RC_OK - - rg=fx_vars%alpha*fx_vars%nb**(1._f/fx_vars%df)*fx_vars%a - - afun=(2._f*3.1415926_f)/(fx_vars%k**3._f) - - - fx_vars%pbes=pp - fx_vars%kbes=fx_vars%k - - bound=0._f - interv=1 - - errabs=0._f - errrel=1.e-3_f - - rres=0._f - !trres=0._f - rerr=0._f - !trerr=0._f - xa=0._f - xb=5._f*fx_vars%k*rg - - !====================================================================== - !--- Version using the QUADPACK - routine : - !---------------------------------------------------------------------- - ifail = 0 - CALL dqagi(xfreal_n,fx_vars,bound,interv,errabs,errrel,rres,rerr,neval,ifail,maxsub,lenw,nsubin,iwork,work) - if (ifail.ne.0) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "funs_n::ifail=",ifail, & - " returned by dqag() during call of funs(",pp, & - ") while integrating xfreal_n()" - end if - rc = RC_ERROR - return - endif - - bound=0._f - interv=1 - - ires=0._f - ierr=0._f - xa=0._f - xb=5._f*fx_vars%k*rg - - !====================================================================== - !--- Version using the QUADPACK - routine : - !---------------------------------------------------------------------- - ifail = 0 - CALL dqagi(xfimag_n,fx_vars,bound,interv,errabs,errrel,ires,ierr,neval,ifail,maxsub,lenw,nsubin,iwork,work) - if(ifail.ne.0) then - if (carma%f_do_print) then - write(carma%f_LUNOPRT, *) "funs_n::ifail=",ifail, & - " returned by dqagi() during call of funs(",pp, & - ") while integrating xfimag_n()" - end if - rc = RC_ERROR - return - endif - - rcomplex = cmplx(1._f,0._f,kind=f)*rres + cmplx(0._f,1._f,kind=f)*ires - - funs_n = afun * rcomplex - - continue - return - END FUNCTION funs_n - - !! - !! replaces xfreel(xx) in original code - !! CALLS: FUNCTION BESSELJY() Spherical Bessel functions - !! FUNCTION phi() Probability distrib. - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version Mar 2013 - FUNCTION xfreal_n(xx, fx_vars) - - ! Arguments - real(kind=f), intent(in) :: xx - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local Declarations - complex(kind=f) :: z,xj(0:nf),xjp(0:nf),xy(0:nf),xyp(0:nf) - complex(kind=f) :: jsol,ysol,hsol,hpsol - real(kind=f) :: x,r,xfreal_n - integer :: ifail,p,pc - real(kind=f) :: rg - - ifail = 0 - rg = fx_vars%alpha*fx_vars%nb**(1._f/fx_vars%df)*fx_vars%a - x = xx - if (x.GT.3000._f) x=3000._f - z = x*cmplx(1._f,0._f,kind=f) - - pc = fx_vars%pbes - if( fx_vars%pbes .eq. 0 ) pc = fx_vars%pbes + 1 - - CALL BESSELJY(z,pc,xj,xjp,xy,xyp,ifail) - - r=x/fx_vars%kbes - - xfreal_n = real( z*z*xj(fx_vars%pbes)*xj(fx_vars%pbes) * phi(r,fx_vars) ) - - return - END FUNCTION xfreal_n - - !! - !! replaces xfima(xx) in original code - !! CALLS: FUNCTION BESSELJY() Spherical Bessel functions - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version Mar 2013 - FUNCTION xfimag_n(xx, fx_vars) - - ! Arguments - real(kind=f), intent(in) :: xx - type(adgaquad_vars_type), intent(inout) :: fx_vars !! variables for functions being integrated - - ! Local Declarations - complex(kind=f) :: z,xj(0:nf),xjp(0:nf),xy(0:nf),xyp(0:nf) - real(kind=f) :: x,r,xfimag_n - integer :: ifail,p,pc - real(kind=f) :: rg - - rg = fx_vars%alpha*fx_vars%nb**(1._f/fx_vars%df)*fx_vars%a - x = xx - if (x.gt.3000._f) x=3000._f - ifail = 0 - z = x*cmplx(1._f,0._f,kind=f) - - pc = fx_vars%pbes - if( fx_vars%pbes .eq. 0 ) pc = fx_vars%pbes + 1 - - CALL BESSELJY(z,pc,xj,xjp,xy,xyp,ifail) - - r=x/fx_vars%kbes - - xfimag_n = real( z*z*xj(fx_vars%pbes)*xy(fx_vars%pbes) * phi(r,fx_vars) ) - - return - END FUNCTION xfimag_n - - - !! Spherical Bessel functions j_n(z) and y_n(z) of complex - !! argument to desired accuracy, - !! and their derivatives, up to a maximal order n=LMAX. - !! j_n(z) = SQRT(pi/2 / z) * J_(n + 1/2)(z) - !! y_n(z) = SQRT(pi/2 / z) * Y_(n + 1/2)(z) - !! Adapted from: - !! I.J.Thompson, A.R.Barnett - !! "Modified Bessel Funkctions I_v(z) and K_v(z) - !! of Real Order and Complex Argument, to Selected - !! Accuracy" - !! COMP.PHYS.COMMUN. 47 (1987) 245-57 - !! (Source code printed on page 249) - !! ****************************************************************** - !! INPUTS: - !! X argument z, dble cmplx - !! z in the upper half plane, Im(z) > -3 - !! LMAX largest desired order of Bessel functions, int - !! j_n,y_n,j_n',y_n' are calculated for n=0 to n=LMAX - !! Dimension of arrays xj,xjp,xy,xyp at least (0:LMAX) - !! XJ(M) Spher. Bessel function j_m(z), dble cmplx - !! XJP(M) Derivative of Spher. Bessel function d/dz [ j_m(z) ], - !! dble cmplx - !! XY(M) Spher. Bessel function y_m(z), dble cmplx - !! XYP(M) Derivative of Spher. Bessel function d/dz [ y_m(z) ], - !! dble cmplx - !! IFAIL error flag, int - !! = 0 if all results are satisfactory - !! = -1 for arguments out of range - !! = > 0 for results ok up to and including the - !! function of order LMAX-IFAIL - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version Mar 2013 - SUBROUTINE BESSELJY (X, LMAX, XJ, XJP, XY, XYP, IFAIL) - - ! Arguments - complex(kind=f), intent(in) :: X - integer, intent(in) :: LMAX - complex(kind=f), intent(out) :: XJ(0:LMAX) - complex(kind=f), intent(out) :: XJP(0:LMAX) - complex(kind=f), intent(out) :: XY(0:LMAX) - complex(kind=f), intent(out) :: XYP(0:LMAX) - integer, intent(out) :: IFAIL - - ! Local Declarations - INTEGER, PARAMETER :: LIMIT = 20000 - REAL(kind=f),parameter :: ZERO = 0._f - REAL(kind=f),parameter :: ONE = 1._f - REAL(kind=f),parameter :: ACCUR = 1e-12_f - REAL(kind=f),parameter :: TM30 = 1e-30_f - COMPLEX(kind=f), parameter :: CI = (0._f, 1._f) - complex(kind=f) :: XI, W, PL, B, D, FF, DEL, C, XJ0, XH1, XH1P, XTEMP - integer :: L - - IF (ABS(X).LT.ACCUR .OR. AIMAG(X) .LT. -3.d0) THEN - IFAIL=-1 - GOTO 5 - END IF - - ! *** Lentz - Algorithmus (?) : - XI = ONE/X - W = XI + XI - PL = LMAX * XI - FF = PL + XI - B = FF + FF + XI - D = ZERO - C = FF - DO 1 L=1,LIMIT - D = B - D - C = B - ONE/C - IF(ABS(D).LT. TM30) D = TM30 - IF(ABS(C).LT. TM30) C = TM30 - D = ONE / D - DEL = D * C - FF = FF * DEL - B = B + W -1 IF(ABS(DEL-ONE).LT.ACCUR) GOTO 2 - IFAIL = -2 - GOTO 5 - -2 XJ(LMAX) = TM30 - XJP(LMAX) = FF * XJ(LMAX) - - ! *** Abwaertsrekursion - DO 3 L = LMAX-1,0,-1 - XJ(L) = PL * XJ(L+1) + XJP(L+1) - XJP(L) = PL * XJ(L) - XJ(L+1) -3 PL = PL - XI - - ! *** Calculate the l=0 Besselfunktionen - XJ0 = XI * SIN(X) - XY(0) = - XI * COS(X) - XH1 = EXP(CI * X) * XI * (-CI) - XH1P = XH1 * (CI - XI) - B = XH1P - - ! *** Rescale XJ, XJP, converting to spherical Bessels - ! *** Recur XH1,XH1P as sperical Bessels - W = ONE / XJ(0) - PL = XI - DO 4 L = 0,LMAX - XJ(L) = XJ0 * (W*XJ(L)) - XJP(L) = XJ0 * (W*XJP(L)) - XI * XJ(L) - IF (L.EQ.0) GOTO 4 - XTEMP = XH1 - XH1 = (PL-XI) * XTEMP - XH1P - PL = PL + XI - XH1P = - PL * XH1 + XTEMP - XY(L) = CI * (XJ(L) - XH1) ! y_n = i * ( j_n - h^1_n ) - XYP(L) = CI * (XJP(L) - XH1P) ! und dito fuer Ableitungen -4 CONTINUE - XYP(0) = CI * (XJP(0) - B) - RETURN - -5 WRITE(*,10) IFAIL -10 FORMAT( 'ERROR in SUBR BESSELJY() : IFAIL = ', I4) - RETURN - END SUBROUTINE BESSELJY - - !! - !! Angular function pi_l( x=cos(theta) ) - !! e.g. Bohren,Huffman (1983) - !! pp.94 ff Eq.(4.46)-(4.49) - !! p.112 - !! CALLS: FUNCTION plgndr() Legendre-Functions - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version Mar 2013 - FUNCTION fpi(l,x,fx_vars) - - ! Arguments - integer, intent(in) :: l - real(kind=f), intent(in) :: x - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local declarations - real(kind=f) :: fpi - real(kind=f) :: y - real(kind=f) :: flag - - y=x - if (x.eq.1._f) y=1._f-1.e-6_f - ! alternatively, one could use Bohren,Huffman - ! p.112: pi_n(1)=tau_n(1)= 1/2 * n * (n+1) !!! - flag=plgndr(l,1,y,fx_vars) - fpi=(1._f-y**2._f)**(-0.5_f)*flag - return - END FUNCTION fpi - - !! - !! Angular function tau_l( x=cos(theta) ) - !! e.g. Bohren,Huffman (1983) - !! pp.94 ff Eq.(4.46)-(4.49) - !! p.112 - !! CALLS: FUNCTION plgndr() Legendre-Functions - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION tau(l,x,fx_vars) - - ! Arguments - integer, intent(in) :: l - real(kind=f), intent(in) :: x - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local Declarations - real(kind=f) :: fp - real(kind=f) :: tau - real(kind=f) :: flag - real(kind=f) :: y - - y=x - if (x.eq.1._f) y=1._f-1.e-6_f - ! alternatively, one could use Bohren,Huffman - ! p.112: pi_n(1)=tau_n(1)= 1/2 * n * (n+1) !!! - flag=plgndr(l,0,y,fx_vars) - fp=fpi(l,y,fx_vars) - tau=-y*fp+l*(l*1._f+1._f)*flag - return - END FUNCTION tau - - !! - !! - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - function fp1(u, fx_vars) - - ! Arguments - real(kind=f), intent(in) :: u !! - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - real(kind=f) :: fp1 !! returns - - ! Local Declarations - real(kind=f) :: krg,s1,s2,s3,rg - - rg=fx_vars%alpha*fx_vars%a*fx_vars%nb**(1._f/fx_vars%df) - krg=fx_vars%k*rg - s1=sin(2._f*krg*fx_vars%zed*u) - s2=u**(fx_vars%df-2._f) - s3=fco(u, fx_vars) - fp1=s1*s2*s3 - - return - END FUNCTION fp1 - - !! - !! CALLS: FUNCTION dqagi/dqdagi/DADAPT_() Integration - !! FUNCTION fdval() Integrand - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION anorm(carma, fx_vars, rc) - - ! arguments - type(carma_type), intent(in) :: carma !! the carma object - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - integer, intent(inout) :: rc !! return code - - ! Local Declarations - real(kind=f) :: anorm - integer :: interv - integer, parameter :: maxsub=50000 - integer :: ifail - integer, parameter :: lenw=200000 ! .ge. 4*maxsub - integer :: iwork(maxsub),neval,nsubin ! nsubin=last - real(kind=f) :: work(lenw) - real(kind=f) :: bound,errrel,errabs,b,db,c - - rc = RC_OK - - bound=0._f - interv=1 - errrel=1.e-3_f - errabs=0._f - b=0._f - db=0._f - - !====================================================================== - !--- Version using the QUADPACK - routine : - !---------------------------------------------------------------------- - ifail = 0 - CALL dqagi(fdval,fx_vars,bound,interv,errabs,errrel,b,db,neval,ifail,maxsub,lenw,nsubin,iwork,work) - if(ifail.ne.0) then - if (carma%f_do_print) write(carma%f_LUNOPRT, *) "anorm::ifail=",ifail," returned by dqagi() during call of anorm" - rc = RC_ERROR - return - endif - - c=0.5_f - anorm=b*4._f*3.1415926_f - return - END FUNCTION anorm - - !! - !! Probability distribution of monomer location within cluster - !! CALLS: FUNCTION fdval() - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION phi(x,fx_vars) - - ! Arguments - real(kind=f), intent(in) :: x - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local Declarations - real(kind=f) :: fval,pref,phi, rg, z - - rg=fx_vars%alpha*fx_vars%nb**(1._f/fx_vars%df)*fx_vars%a - z=x/rg - pref=(x/rg)**(fx_vars%df-3._f)/(fx_vars%coeff*rg**3._f) - fval=z**(1._f-fx_vars%df)*fdval(z, fx_vars) - phi=pref*fval - continue - return - END FUNCTION phi - - !! - !! Probability distribution of monomer location within cluster - !! CALLS: FUNCTION fdval() - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION fco(z, fx_vars) - - ! Arguments - real(kind=f), intent(in) :: z - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Local Declarations - real(kind=f) :: fco - real(kind=f) :: fval - - fval=z**(1._f-fx_vars%df)*fdval(z, fx_vars) - fco=fval - continue - return - END FUNCTION fco - - !! - !! @author P. Rannou, R. Botet, Eric Wolf - !! @version March 2013 - FUNCTION fdval(x, fx_vars) - - type(adgaquad_vars_type), intent(inout) :: fx_vars !! varaibles for functions being integrated - - ! Arguments - real(kind=f), intent(in) :: x - - ! Local Declarations - real(kind=f) :: fdval - - fdval=x**(fx_vars%df-1._f)*exp(-x**fx_vars%df/2._f) - return - END FUNCTION fdval - -end module - - diff --git a/CARMAchem_GridComp/CARMA/source/base/freezaerl_koop2000.F90 b/CARMAchem_GridComp/CARMA/source/base/freezaerl_koop2000.F90 deleted file mode 100644 index 0bcd0476..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/freezaerl_koop2000.F90 +++ /dev/null @@ -1,210 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! aerosol freezing only. -!! -!! The parameterization described by Koop et al., Nature 406, 611-614, 2000 -!! is used. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! To avoid nucleation into an evaporating bin, this subroutine must -!! be called after growp, which evaluates evaporation loss rates . -!! -!! @author Eric Jensen, Chuck Bardeen -!! @version Dec-2003, Apr-2010 -subroutine freezaerl_koop2000(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f), parameter :: prenuc = 2.075e33_f * RHO_W / RHO_I - real(kind=f), parameter :: kt0 = 1.6e0_f - real(kind=f), parameter :: dkt0dp = -8.8e0_f - real(kind=f), parameter :: kti = 0.22e0_f - real(kind=f), parameter :: dktidp = -0.17e0_f - - logical :: evapfrom_nucto - integer :: igas ! gas index - integer :: igroup ! group index - integer :: ibin ! bin index - integer :: iepart ! element for condensing group index - integer :: inuc ! nucleating element index - integer :: isol ! solute index of freezing particle - integer :: ienucto ! index of target nucleation element - integer :: ignucto ! index of target nucleation group - integer :: inucto ! index of target nucleation bin - real(kind=f) :: sifreeze - real(kind=f) :: aw - real(kind=f) :: CONTL - real(kind=f) :: CONTH - real(kind=f) :: H2SO4m - real(kind=f) :: WT - real(kind=f) :: volrat - real(kind=f) :: ssi - real(kind=f) :: ssl - real(kind=f) :: rjj - real(kind=f) :: rlogj - real(kind=f) :: daw - real(kind=f) :: riv - real(kind=f) :: vw0 - real(kind=f) :: awi - real(kind=f) :: rsi - real(kind=f) :: dmy - real(kind=f) :: rlnt - real(kind=f) :: td - real(kind=f) :: pp - real(kind=f) :: pp2 - real(kind=f) :: pp3 - real(kind=f) :: vi - real(kind=f) :: fkelv - real(kind=f) :: fkelvi - - ! PAC: Assuming success inside of a subroutine is a problem, any errors - ! are erased by this. - !rc = RC_OK - - ! Aerosol freezing limited to T < 240K - if (t(iz) <= 240._f) then - - ! Loop over particle groups. - do igroup = 1,NGROUP - - igas = inucgas(igroup) - iepart = ienconc(igroup) - isol = isolelem(iepart) - - if (igas .ne. 0) then - - ! Bypass calculation if few particles are present - if (pconmax(iz,igroup) .gt. FEW_PC) then - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - do inuc = 1, nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - if (ienucto /= 0) then - ignucto = igelem( ienucto ) - - ! Only compute nucleation rate for aerosol freezing - ! - ! NOTE: If heterogeneous nucleation of glassy aerosols is being used - ! as a nucleation mechanism, then both the heterogeneous nucleation and - ! the homogeneous freezing need to be considered. - if ((iand(inucproc(iepart,ienucto), I_AF_KOOP_2000) /= 0)) then - - ! Loop over particle bins. - do ibin = 1, NBIN - - ssi = supsati(iz,igas) - ssl = supsatl(iz,igas) - - ! Calculate approximate critical saturation needed for homogeneous freezing - ! of sulfate aerosols (see Jensen and Toon, GRL, 1994). - sifreeze = 0.3_f - - ! Homogeneous freezing of sulfate aerosols should only occur if SL < Scrit - ! and SI > . - if (ssi > sifreeze) then - - ! Koop et al. nucleation rate parameterization - td = t(iz) - rlnt = log(td) - ! eqn 2, potential difference [J mol-1] - dmy = 210368._f + 131.438_f * td - (3.32373e6_f / td) - 41729.1_f * rlnt - rsi = RGAS / 1.e7_f ! gas constant [J mol-1 K-1] - ! Notes (p: ambient vs. at pressure) ? - awi = exp(dmy / (rsi * td)) - - ! eqn 4 - vw0 = -230.76_f - 0.1478_f * td + (4099.2_f / td) + 48.8341_f * rlnt - ! eqn 5 - vi = 19.43_f - 2.2e-3_f * td + 1.08e-5_f * td * td - - pp = 1.e-10_f * p(iz) ! pressure [GPa] - pp2 = pp * pp * 0.5_f - pp3 = pp2 * pp / 3._f - riv = vw0 * (pp - kt0 * pp2 - dkt0dp * pp3) - vi * (pp - kti * pp2 - dktidp * pp3) ! eqn 3 - - riv = riv * 1.e3_f ! [GPa cm3 mol-1] to [Pa m3 mol-1] - - ! NOTE: The wieght percent can become negative from this parameterization, - ! which is not physicsal. With small supersaturations, the water activity - ! becomes postive (>1.013) the weight percent becomes negative. Don't allow - ! the the supsatl to be greater than 0. - ssl = max(-1.0_f, min(0._f, ssl)) - - ! Water activity - aw = 1._f + ssl ! ? - - ! Kelvin effect on water activity - fkelv = exp(akelvin(iz,igas) / r(ibin,igroup)) ! ? - aw = aw / fkelv - - ! Nucleation rate - ! - ! NOTE: This formulation is only valid for daw in the range of - ! 0.26 < daw < 0.34, so limit daw to that range. - daw = aw * exp(riv / (rsi*td)) - awi ! eqn 6 - daw = min(0.34_f, max(daw, 0.26_f)) ! eqn 7 - - rlogj = ((29180._f * daw - 26924._f) * daw + 8502._f) * daw - 906.7_f ! eqn 7 - rlogj = min(rlogj, POWMAX*0.3_f) - rjj = 10._f**(rlogj) ! [cm-3 s-1] - - - ! Calculate volume ratio of wet/dry aerosols - if (aw < 0.05_f) then - CONTL = 12.37208932_f * (aw**(-0.16125516114_f)) - 30.490657554_f * aw - 2.1133114241_f - CONTH = 13.455394705_f * (aw**(-0.1921312255_f)) - 34.285174604_f * aw - 1.7620073078_f - elseif (aw <= 0.85) then - CONTL = 11.820654354_f * (aw**(-0.20786404244_f)) - 4.807306373_f * aw - 5.1727540348_f - CONTH = 12.891938068_f * (aw**(-0.23233847708_f)) - 6.4261237757_f * aw - 4.9005471319_f - else - CONTL = -180.06541028_f * (aw**(-0.38601102592_f)) - 93.317846778_f * aw + 273.88132245_f - CONTH = -176.95814097_f * (aw**(-0.36257048154_f)) - 90.469744201_f * aw + 267.45509988_f - endif - - H2SO4m = CONTL + ((CONTH - CONTL) * (t(iz) - 190._f) / 70._f) - WT = (98.0_f * H2SO4m) / (1000._f + 98._f * H2SO4m) - WT = max(0._f, min(1._f, WT)) - WT = 100._f * WT - - ! Volume ratio of wet/dry aerosols. - if (WT <= 0._f) then - volrat = 1.e10_f - else - volrat = rhosol(isol) / RHO_W * ((100._f - WT) / WT) + 1._f - endif - - ! [s-1] - rnuclg(ibin,igroup,ignucto) = rnuclg(ibin,igroup,ignucto) + rjj * volrat * vol(ibin,igroup) - endif ! ssi > sifreeze .and. target droplets not evaporating - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPACT - endif - enddo ! inuc = 1,nnuc2elem(iepart) - endif ! pconmax .gt. FEW_PC - endif ! (igas = inucgas(igroup) .ne. 0) - enddo ! igroup = 1,NGROUP - endif - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end subroutine diff --git a/CARMAchem_GridComp/CARMA/source/base/freezaerl_mohler2010.F90 b/CARMAchem_GridComp/CARMA/source/base/freezaerl_mohler2010.F90 deleted file mode 100644 index 1796388c..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/freezaerl_mohler2010.F90 +++ /dev/null @@ -1,185 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! aerosol freezing only. -!! -!! The parameterization described by Mohler et al., presented at the AMS -!! Cloud physics workshop (2010) is used. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! To avoid nucleation into an evaporating bin, this subroutine must -!! be called after growp, which evaluates evaporation loss rates . -!! -!! @author Chuck Bardeen -!! @version Aug-2010 -subroutine freezaerl_mohler2010(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f), parameter :: prenuc = 2.075e33_f * RHO_W / RHO_I - real(kind=f), parameter :: kt0 = 1.6e0_f - real(kind=f), parameter :: dkt0dp = -8.8e0_f - real(kind=f), parameter :: kti = 0.22e0_f - real(kind=f), parameter :: dktidp = -0.17e0_f - - logical :: evapfrom_nucto - integer :: igas ! gas index - integer :: igroup ! group index - integer :: ibin ! bin index - integer :: iepart ! element for condensing group index - integer :: inuc ! nucleating element index - integer :: isol ! solute index of freezing particle - integer :: ienucto ! index of target nucleation element - integer :: ignucto ! index of target nucleation group - integer :: inucto ! index of target nucleation bin - real(kind=f) :: sifreeze - real(kind=f) :: aw - real(kind=f) :: CONTL - real(kind=f) :: CONTH - real(kind=f) :: H2SO4m - real(kind=f) :: WT - real(kind=f) :: volrat - real(kind=f) :: ssi - real(kind=f) :: ssl - real(kind=f) :: rjj - real(kind=f) :: rlogj - real(kind=f) :: daw - real(kind=f) :: riv - real(kind=f) :: vw0 - real(kind=f) :: awi - real(kind=f) :: rsi - real(kind=f) :: dmy - real(kind=f) :: rlnt - real(kind=f) :: td - real(kind=f) :: pp - real(kind=f) :: pp2 - real(kind=f) :: pp3 - real(kind=f) :: vi - real(kind=f) :: fkelv - real(kind=f) :: fkelvi - - - ! PAC: Assuming success inside of a subroutine is a problem, any errors - ! are erased by this. - !rc = RC_OK - - ! Aerosol freezing limited to T < 240K - if (t(iz) <= 240._f) then - - ! Loop over particle groups. - do igroup = 1,NGROUP - - igas = inucgas(igroup) - iepart = ienconc(igroup) - isol = isolelem(iepart) - - if (igas .ne. 0) then - - ! Bypass calculation if few particles are present - if (pconmax(iz,igroup) .gt. FEW_PC) then - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - do inuc = 1, nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - if (ienucto /= 0) then - ignucto = igelem( ienucto ) - - ! Only compute nucleation rate for aerosol freezing - ! - ! NOTE: If heterogeneous nucleation of glassy aerosols is being used - ! as a nucleation mechanism, then both the heterogeneous nucleation and - ! the homogeneous freezing need to be considered. - if (iand(inucproc(iepart,ienucto), I_AF_MOHLER_2010) /= 0) then - - ! Loop over particle bins. - do ibin = 1, NBIN - - ssi = supsati(iz,igas) - ssl = supsatl(iz,igas) - - ! Adjust ssi for the Kelvin effect. - fkelvi = exp(akelvini(iz,igas) / r(ibin,igroup)) - ssi = ssi / fkelvi - - ! Calculate approximate critical saturation needed for homogeneous freezing - ! of sulfate aerosols (see Jensen and Toon, GRL, 1994). - sifreeze = 0.3_f - - ! Homogeneous freezing of sulfate aerosols should only occur if SL < Scrit - ! and SI > . - if (ssi > sifreeze) then - - ! Mohler et al. 2010? nucleation rate parameterization - rlogj = 97.973292_f - 154.67476_f * (ssi + 1._f) - 0.84952712_f * t(iz) + 1.0049467_f * (ssi + 1._f) * t(iz) - rjj = 10._f**(rlogj) ! [cm-3 s-1] - - ! NOTE: The weight percent can become negative from this parameterization, - ! which is not physicsal. With small supersaturations, the water activity - ! becomes postive (>1.013) the weight percent becomes negative. Don't allow - ! the the supsatl to be greater than 0. - ssl = max(-1.0_f, min(0._f, ssl)) - - ! Kelvin effect on water activity - aw = 1._f + ssl ! ? - fkelv = exp(akelvin(iz,igas) / r(ibin,igroup)) - aw = aw / fkelv - - ! Calculate volume ratio of wet/dry aerosols - if (aw < 0.05_f) then - CONTL = 12.37208932_f * (aw**(-0.16125516114_f)) - 30.490657554_f * aw - 2.1133114241_f - CONTH = 13.455394705_f * (aw**(-0.1921312255_f)) - 34.285174604_f * aw - 1.7620073078_f - elseif (aw <= 0.85) then - CONTL = 11.820654354_f * (aw**(-0.20786404244_f)) - 4.807306373_f * aw - 5.1727540348_f - CONTH = 12.891938068_f * (aw**(-0.23233847708_f)) - 6.4261237757_f * aw - 4.9005471319_f - else - CONTL = -180.06541028_f * (aw**(-0.38601102592_f)) - 93.317846778_f * aw + 273.88132245_f - CONTH = -176.95814097_f * (aw**(-0.36257048154_f)) - 90.469744201_f * aw + 267.45509988_f - endif - - H2SO4m = CONTL + ((CONTH - CONTL) * (t(iz) - 190._f) / 70._f) - WT = (98.0_f * H2SO4m) / (1000._f + 98._f * H2SO4m) - WT = max(0._f, min(1._f, WT)) - WT = 100._f * WT - - ! Volume ratio of wet/dry aerosols. - if (WT <= 0._f) then - volrat = 1.e10_f - else - volrat = rhosol(isol) / RHO_W * ((100._f - WT) / WT) + 1._f - endif - - ! NOTE: Limit the rate for stability. - ! [s-1] - rnuclg(ibin,igroup,ignucto) = rnuclg(ibin,igroup,ignucto) + min(1e20_f, rjj * volrat * vol(ibin,igroup)) - endif ! ssi > sifreeze .and. target droplets not evaporating - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPACT - endif - enddo ! inuc = 1,nnuc2elem(iepart) - endif ! pconmax .gt. FEW_PC - endif ! (igas = inucgas(igroup) .ne. 0) - enddo ! igroup = 1,NGROUP - endif - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end subroutine diff --git a/CARMAchem_GridComp/CARMA/source/base/freezaerl_tabazadeh2000.F90 b/CARMAchem_GridComp/CARMA/source/base/freezaerl_tabazadeh2000.F90 deleted file mode 100644 index e692abb4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/freezaerl_tabazadeh2000.F90 +++ /dev/null @@ -1,311 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! aerosol freezing only. -!! -!! The parameterization described by Tabazadeh et al. [GRL, 27, 1111, 2000.] is -!! used. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! @author Eric Jensen, Chuck Bardeen -!! @version Mar-1995, Nov-2009 -subroutine freezaerl_tabazadeh2000(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - ! Define parameters needed for freezing nucleation calculations. -! real(kind=f), parameter :: adelf = 1.29e-12_f -! real(kind=f), parameter :: bdelf = 0.05_f - real(kind=f), parameter :: prenuc = 2.075e33_f * RHO_W / RHO_I -! real(kind=f), parameter :: rmiv = 0.6_f - - integer :: igas !! gas index - integer :: igroup !! group index - integer :: ibin !! bin index - integer :: iepart !! element for condensing group index - integer :: inuc !! nucleating element index - integer :: ienucto !! index of target nucleation element - integer :: ignucto !! index of target nucleation group - integer :: isol - real(kind=f) :: A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 - real(kind=f) :: c0, C1, C2, C3, C4, c5 - real(kind=f) :: d0, d1, d2, d3, d4, d5 - real(kind=f) :: e0, e1, e2, e3, e4, e5 - real(kind=f) :: sifreeze - real(kind=f) :: rhoibar - real(kind=f) :: rlhbar - real(kind=f) :: act - real(kind=f) :: CONTL - real(kind=f) :: CONTH - real(kind=f) :: H2SO4m - real(kind=f) :: WT - real(kind=f) :: vrat - real(kind=f) :: wtfrac - real(kind=f) :: den - real(kind=f) :: diffact - real(kind=f) :: S260, S220, S180 - real(kind=f) :: sigma - real(kind=f) :: sigsula - real(kind=f) :: sigicea - real(kind=f) :: sigsulice - real(kind=f) :: ag - real(kind=f) :: delfg - real(kind=f) :: expon - real(kind=f) :: ssl - real(kind=f) :: fkelv - - - ! Loop over particle groups. - do igroup = 1,NGROUP - - igas = inucgas(igroup) - iepart = ienconc(igroup) - isol = isolelem(iepart) - - if( igas .ne. 0 )then - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. -! if( nnuc2elem(iepart) .gt. 1 )then - do inuc = 1,nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - if( ienucto .ne. 0 )then - ignucto = igelem( ienucto ) - - ! Only compute nucleation rate for aerosol freezing. - ! - ! NOTE: If heterogeneous nucleation of glassy aerosols is being used - ! as a nucleation mechanism, then both the heterogeneous nucleation and - ! the homogeneous freezing need to be considered. - if ((iand(inucproc(iepart,ienucto), I_AF_TABAZADEH_2000) /= 0)) then - - ! Loop over particle bins. Loop from largest to smallest for - ! evaluation of index of smallest bin nucleated during time step . - do ibin =NBIN,1,-1 - - ! Bypass calculation if few particles are present - if( pconmax(iz,igroup) .gt. FEW_PC )then - - ! Calculate approximate critical saturation needed for homogeneous freezing - ! of sulfate aerosols (see Jensen and Toon, GRL, 1994). - sifreeze = 0.3_f - - ! NOTE: The wieght percent can become negative from this parameterization, - ! which is not physicsal. With small supersaturations, the water activity - ! becomes postive (>1.013) the weight percent becomes negative. Don't allow - ! the the supsatl to be greater than 0. - ssl = max(-1.0_f, min(0._f, supsatl(iz,igas))) - - - ! Homogeneous freezing of sulfate aerosols should only occur of SL < Scrit - ! and SI > . - if( supsati(iz,igas) .gt. sifreeze)then - - ! Calculate mean ice density and latent heat of freezing over temperature - ! interval [T0,T] - - rhoibar = ( 0.916_f * (t(iz)-T0) - & - 1.75e-4_f/2._f * ((t(iz)-T0)**2) - & - 5.e-7_f * ((t(iz)-T0)**3)/3._f ) / (t(iz)-T0) - - rlhbar = ( 79.7_f * (t(iz)-T0) + & - 0.485_f/2._f * (t(iz)-T0)**2 - & - 2.5e-3_f/3._f * (t(iz)-T0)**3 ) & - / (t(iz)-T0) * 4.186e7*18._f - - ! Equilibrium H2SO4 weight percent for fixed water activity - act = min(1.0_f, ssl + 1._f) - - ! Kelvin effect on water activity - fkelv = exp(akelvin(iz,igas) / r(ibin,igroup)) ! ? - act = act / fkelv - - IF(act .LT. 0.05_f) THEN - CONTL = 12.37208932_f * (act**(-0.16125516114_f)) - & - 30.490657554_f * act - 2.1133114241_f - CONTH = 13.455394705_f * (act**(-0.1921312255_f)) - & - 34.285174604_f * act - 1.7620073078_f - END IF - IF(act .GE. 0.05_f .and. act .LE. 0.85_f) THEN - CONTL = 11.820654354_f * (act**(-0.20786404244_f)) - & - 4.807306373_f * act - 5.1727540348_f - CONTH = 12.891938068_f * (act**(-0.23233847708_f)) - & - 6.4261237757_f * act - 4.9005471319_f - END IF - IF(act .GT. 0.85_f) THEN - CONTL = -180.06541028_f * (act**(-0.38601102592_f)) - & - 93.317846778_f * act + 273.88132245_f - CONTH = -176.95814097_f * (act**(-0.36257048154_f)) - & - 90.469744201_f * act + 267.45509988_f - END IF - H2SO4m = CONTL + ((CONTH - CONTL) * (t(iz) -190._f)/70._f) - WT = (98.0_f * H2SO4m)/(1000._f + 98._f * H2SO4m) - WT = 100._f * WT - - ! Volume ratio of wet/dry aerosols. - vrat = rhosol(isol)/RHO_W * ((100._f-wt)/wt) + 1._f - - ! Calculation sulfate solution density from Myhre et al. (1998). - wtfrac = WT/100._f - C1 = t(iz) - 273.15_f - C2 = C1**2 - C3 = C1**3 - C4 = C1**4 - A0 = 999.8426_f + 334.5402e-4_f*C1 - 569.1304e-5_f*C2 - A1 = 547.2659_f - 530.0445e-2_f*C1 + 118.7671e-4_f*C2 & - + 599.0008e-6_f*C3 - A2 = 526.295e+1_f + 372.0445e-1_f*C1 + 120.1909e-3_f*C2 & - - 414.8594e-5_f*C3 + 119.7973e-7_f*C4 - A3 = -621.3958e+2_f - 287.7670_f*C1 - 406.4638e-3_f*C2 & - + 111.9488e-4_f*C3 + 360.7768e-7_f*C4 - A4 = 409.0293e+3_f + 127.0854e+1_f*C1 + 326.9710e-3_f*C2 & - - 137.7435e-4*C3 - 263.3585e-7*C4 - A5 = -159.6989e+4_f - 306.2836e+1_f*C1 + 136.6499e-3_f*C2 & - + 637.3031e-5_f*C3 - A6 = 385.7411e+4_f + 408.3717e+1_f*C1 - 192.7785e-3_f*C2 - A7 = -580.8064e+4_f - 284.4401e+1_f*C1 - A8 = 530.1976e+4_f + 809.1053_f*C1 - A9 = -268.2616e+4_f - A10 = 576.4288e+3_f - den = A0 + wtfrac*A1 + wtfrac**2 * A2 + & - wtfrac**3 * A3 + wtfrac**4 * A4 - den = den + wtfrac**5 * A5 + wtfrac**6 * A6 + & - wtfrac**7 * A7 - den = den + wtfrac**8 * A8 + wtfrac**9 * A9 + & - wtfrac**10 * A10 - - ! Activation energy is based on Koop's lab data. - IF(t(iz) .GT. 220._f) then - A0 = 104525.93058_f - A1 = -1103.7644651_f - A2 = 1.070332702_f - A3 = 0.017386254322_f - A4 = -1.5506854268e-06_f - A5 = -3.2661912497e-07_f - A6 = 6.467954459e-10_f - ELSE - A0 = -17459.516183_f - A1 = 458.45827551_f - A2 = -4.8492831317_f - A3 = 0.026003658878_f - A4 = -7.1991577798e-05_f - A5 = 8.9049094618e-08_f - A6 = -2.4932257419e-11_f - END IF - - diffact = ( A0 + A1*t(iz) + A2*t(iz)**2 + & - A3*t(iz)**3 + A4*t(iz)**4 + & - A5*t(iz)**5 + A6*t(iz)**6 ) * 1.0e-13_f - - ! Surface energy - - ! Weight percent function for T = 260 K - c0 = 77.40682664_f - c1 = -0.006963123274_f - c2 = -0.009682499074_f - c3 = 0.00088797988_f - c4 = -2.384669516e-05_f - c5 = 2.095358048e-07_f - S260 = c0 + c1*wt + c2*wt**2 + c3*wt**3 + & - c4*wt**4 + c5*wt**5 - - ! Weight percent function for T = 220 K - d0 = 82.01197792_f - d1 = 0.5312072092_f - d2 = -0.1050692123_f - d3 = 0.005415260617_f - d4 = -0.0001145573827_f - d5 = 8.969257061e-07_f - S220 = d0 + d1*wt + d2*wt**2 + d3*wt**3 + & - d4*wt**4 + d5*wt**5 - - ! Weight percent function for T = 180K - e0 = 85.75507114_f - e1 = 0.09541966318_f - e2 = -0.1103647657_f - e3 = 0.007485866933_f - e4 = -0.0001912224154_f - e5 = 1.736789787e-06_f - S180 = e0 + e1*wt + e2*wt**2 + e3*wt**3 + & - e4*wt**4 + e5*wt**5 - - if( t(iz) .GE. 220._f ) then - sigma = S260 + ((260._f-t(iz))*(S220-S260))/40._f - else - sigma = S220 + ((220._f-t(iz))*(S180-S220))/40._f - endif - - sigsula = sigma - sigicea = 105._f - sigsulice = abs( sigsula - sigicea ) - - ! Critical ice germ radius formed in the sulfate solution - ag = 2._f*gwtmol(igas)*sigsulice / & - ( rlhbar * rhoibar * log(T0/t(iz)) + & - rhoibar * rgas * 0.5_f * (T0+t(iz)) * & - log(ssl+1._f) ) - - if( ag .lt. 0._f ) ag = 1.e10_f - - ! Gibbs free energy of ice germ formation in the ice/sulfate solution - delfg = 4._f/3._f*PI * sigsulice * (ag**2) - - ! Ice nucleation rate in a 0.2 micron aerosol (/sec) - expon = ( -diffact - delfg ) / BK / t(iz) - expon = max( -100._f*ONE, expon ) - rnuclg(ibin,igroup,ignucto) = prenuc * & - sqrt(sigsulice*t(iz)) * & - vrat*vol(ibin,igroup) * exp( expon ) - - ! This parameterizations has problems that sometimes yield negative nucleation - ! rates. It would be best to fix the parameterization, but at least keep negative - ! values from being return. - if (rnuclg(ibin,igroup,ignucto) < 0._f) then - rnuclg(ibin,igroup,ignucto) = 0._f - end if - - - ! xh = 0.1 * r(ibin,igroup) / ag - ! phih = sqrt( 1. - 2.*rmiv*xh + xh**2 ) - ! rath = (xh-rmiv) / phih - ! fv3h = xh**3 * ( 2.*ONE - 3.*rath + rath**3 ) - ! fv4h = 3. * rmiv * xh**2 * (rath-1.) - ! if( abs(rath) .gt. 1.e0-1.e-8 ) fv3h = 0. - ! if( abs(rath) .gt. 1.e0-1.e-10 ) fv4h = 0. - ! - ! fh = 0.5 * ( ONE + ((ONE-rmiv*xh)/phih)**3 + - ! $ fv3h + fv4h ) - ! - ! expon = ( -delfwat2ice - delfg ) / BK / t3(ixyz) - ! expon = max( -POWMAX, expon ) - endif - endif ! pconmax(ixyz,igroup) .gt. FEW_PC - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPACT - endif - enddo ! inuc = 1,nnuc2elem(iepart) -! endif ! (nnuc2elem(iepart) .gt. 1) - endif ! (igas = inucgas(igroup) .ne. 0) - enddo ! igroup = 1,NGROUP - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/freezdropl.F90 b/CARMAchem_GridComp/CARMA/source/base/freezdropl.F90 deleted file mode 100644 index f4151b4c..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/freezdropl.F90 +++ /dev/null @@ -1,74 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! droplet freezing only. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! @author Eric Jensen, Chuck Bardeen -!! @version Jan-2000, Nov-2009 -subroutine freezdropl(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup !! group index - integer :: ibin !! bin index - integer :: iepart !! element for condensing group index - integer :: inuc !! nucleating element index - integer :: ienucto !! index of target nucleation element - integer :: ignucto !! index of target nucleation group - - - ! Loop over particle groups. - do igroup = 1,NGROUP - - iepart = ienconc( igroup ) ! particle number density element - - ! Calculate nucleation loss rates. - do inuc = 1,nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - - if( ienucto .ne. 0 )then - ignucto = igelem( ienucto ) - - ! Only compute nucleation rate for droplet freezing - if( inucproc(iepart,ienucto) .eq. I_DROPFREEZE ) then - - ! Loop over particle bins. - do ibin = 1,NBIN - - ! Bypass calculation if few particles are present - if( pc(iz,ibin,iepart) .gt. FEW_PC )then - - ! Temporary simple kludge: Set to 1.e2 if T < -40C - if( t(iz) .lt. T0-40._f ) then - rnuclg(ibin,igroup,ignucto) = 1.e2_f - endif - - endif ! pc(source particles) .gt. FEW_PC - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPFREEZE - endif - enddo ! inuc = 1,nnuc2elem(iepart) - enddo ! igroup = 1,NGROUP - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/freezglaerl_murray2010.F90 b/CARMAchem_GridComp/CARMA/source/base/freezglaerl_murray2010.F90 deleted file mode 100644 index d76bc755..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/freezglaerl_murray2010.F90 +++ /dev/null @@ -1,138 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! heterogeneous nucleation of glassy aerosols only,. -!! -!! The parameterization of glass aerosols is described in Murray et al. -!! [Nature Geosciences, 2010], and is based upon measurements of the nucleation of -!! citric acid aerosols at cold temperatures. -!! -!! NOTE: This implementation assumes that the aerosol being nucleated is the total -!! aerosol population and not just the fraction of aerosols that are glassy. To -!! account for homogenous freezing of the aerosol population, the routine freezaerl -!! also needs to be called and the overall nucleation rate is the sum of -!! the rates for homogeneous freezing and for heterogenous nucleation. -!! -!! The parameter fglass is the fraction of the total aerosol population that will be -!! in a glassy state for T <= 212K. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! @author Chuck Bardeen, Eric Jensen -!! @version Apr-2010 -subroutine freezglaerl_murray2010(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - ! Define parameters needed for freezing nucleation calculations. - real(kind=f), parameter :: kice1 = 7.7211e-5_f ! Fit constant from Murray et al. - real(kind=f), parameter :: kice2 = 9.2688e-3_f ! Fit constant from Murray et al. - real(kind=f), parameter :: ssmin = 0.21_f ! Minimum supersaturation for nucleation - real(kind=f), parameter :: ssmax = 0.7_f ! Maximum supersaturation for nucleation - real(kind=f), parameter :: tglass = 212._f ! Maximum temperature for glassy state - real(kind=f), parameter :: fglass = 0.5_f ! Fraction of aerosols that can become glassy - - integer :: igas ! gas index - integer :: igroup ! group index - integer :: ibin ! bin index - integer :: iepart ! element for condensing group index - integer :: inuc ! nucleating element index - integer :: ienucto ! index of target nucleation element - integer :: ignucto ! index of target nucleation group - integer :: inucto ! index of target nucleation bin - real(kind=f) :: dfice ! difference in fraction of aerosol nucleated - real(kind=f) :: ssi, ssiold - - ! Assume success. - ! PAC: Assuming success inside of a subroutine is a problem, any errors - ! are erased by this. - !rc = RC_OK - - ! Loop over particle groups. - do igroup = 1,NGROUP - - igas = inucgas(igroup) ! condensing gas - iepart = ienconc( igroup ) ! particle number density element - - if (igas /= 0) then - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - do inuc = 1, nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - if (ienucto /= 0) then - ignucto = igelem(ienucto) - - ! Only compute nucleation rate for glassy aerosol freezing. - if ((iand(inucproc(iepart,ienucto), I_AF_MURRAY_2010) /= 0)) then - - ! Is it cold enough for aerosols to be in a glassy state. - if (t(iz) <= tglass) then - - ! Loop over particle bins. Loop from largest to smallest for - ! evaluation of index of smallest bin nucleated during time step . - do ibin = NBIN, 1, -1 - - ! Bypass calculation if few particles are present or if it isn't cold enough - ! for the aerosols to be present in a glassy state. - if (pconmax(iz,igroup) > FEW_PC) then - - ! Murray et al. [2010] doesn't really give a nucleation rate. Instead it gives - ! a fraction of glassy aerosol particles that have been nucleated as a function - ! of ice supersaturation. - ! - ! Since CARMA really wants to work with rates, use the difference in relative - ! humidity and the length of the timestep to come up with an approximation to - ! a nucleation rate. - - ! The supersaturation must be greater than .21 for heterogeneous nucleation to - ! commence. The fraction of glassy aerosol nucleated is: - ! - ! fice = 7.7211e-5 * RHi(%) - 9.2688e-3 for 121 % < RHi < 170 % - ! - ! To get a pseudo production rate, use - ! - ! rnuclg = (fice(RHi) - fice(RHi_old)) / dtime - ! - ssi = supsati(iz,igas) - ssiold = supsatiold(iz,igas) - - if ((ssi >= ssmin) .and. (ssi > ssiold)) then - dfice = kice1 * (1._f + min(ssmax, ssi)) * 100._f - kice2 - - if (ssiold >= ssmin) then - dfice = dfice - (kice1 * (1._f + min(ssmax, ssiold)) * 100._f - kice2) - endif - - ! Add the rate of heterogenous freezing to the rate of homogeneous - rnuclg(ibin,igroup,ignucto) = rnuclg(ibin,igroup,ignucto) + fglass * dfice / dtime - endif - endif - enddo - endif - endif - endif - enddo - endif - enddo - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/gasexchange.F90 b/CARMAchem_GridComp/CARMA/source/base/gasexchange.F90 deleted file mode 100644 index 14913b5b..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/gasexchange.F90 +++ /dev/null @@ -1,146 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the total production of gases due to nucleation, -!! growth, and evaporation [g/x_units/y_units/z_units/s]. -!! It also calculates the latent heating rate from a condensing gas -!! [deg_K/s] -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine gasexchange(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup !! group index - integer :: iepart - integer :: igas !! gasindex - integer :: i - integer :: i2 - integer :: ig2 - integer :: ienuc2 - integer :: ielem !! element index - real(kind=f) :: rlh - real(kind=f) :: gasgain - real(kind=f) :: gprod_nuc(NGROUP,NGAS) - real(kind=f) :: gprod_grow(NGROUP,NGAS) - - - ! Initialize local variables for keeping track of gas changes due - ! to nucleation and growth in each particle group. - gprod_nuc(:,:) = 0._f - gprod_grow(:,:) = 0._f - - ! First calculate gas loss and latent heat gain rates due to nucleation. - do igroup = 1,NGROUP - - igas = inucgas(igroup) ! condensing gas - ielem = ienconc(igroup) ! element of particle number concentration - - if( igas .ne. 0 .and. nnuc2elem(ielem) .gt. 0 )then - - do ienuc2 = 1,NELEM - - ig2 = igelem( ienuc2 ) ! target particle group - - if( if_nuc(ielem,ienuc2) ) then - - do i = 1,NBIN - - ! If there is no place for the nucleating particle bin to fit in the - ! nucleated particle, then just skip it. - ! - ! This could be an error if significant nucleation really happens from - ! these bins, but also more flexibility in setting up particle grids. - gprod_nuc(igroup,igas) = gprod_nuc(igroup,igas) - & - rhompe(i,ielem) * rmass(i,igroup) - - i2 = inuc2bin(i,igroup,ig2) ! target bin - if (i2 /= 0) then - gprod_nuc(igroup,igas) = gprod_nuc(igroup,igas) - & - pc(iz,i,ielem) * rnuclg(i,igroup,ig2) * diffmass(i2,ig2,i,igroup) - end if - enddo - - ! Latent heating rate from condensing gas: is latent heat of evaporation - ! ( + fusion, for ice deposition ) [erg/g] -! if(( inucproc(ielem,ienuc2) .eq. I_DROPACT ) .or. & -! ( inucproc(ielem,ienuc2) .eq. I_HOMNUC )) then -! rlh = rlhe(iz,igas) -! elseif(( inucproc(ielem,ienuc2) .eq. I_AERFREEZE ) .or. & -! ( inucproc(ielem,ienuc2) .eq. I_HETNUC ))then -! rlh = rlhe(iz,igas) + rlhm(iz,igas) -! endif - -! rlprod = rlprod - rlh * gprod_nuc(igroup,igas) / ( CP * rhoa(iz) ) - endif - enddo ! ienuc2 = 1,NELEM - endif ! (igas = inucgas(ielem) .ne. 0 - - ! Next calculate gas lost/gained due to and heat gained/lost from - ! growth/evaporation. - igas = igrowgas(ielem) ! condensing gas - - if( igas .ne. 0 )then - - do i = 1,NBIN-1 - - ! Calculate , mass concentration of gas gained due to evaporation - ! from each droplet in bin . First check for total evaporation. - if( totevap(i+1,igroup) )then - gasgain = ( 1._f - cmf(i+1,igroup) )*rmass(i+1,igroup) - else - gasgain = diffmass(i+1,igroup,i,igroup) - endif - - gprod_grow(igroup,igas) = gprod_grow(igroup,igas) & - + evaplg(i+1,igroup) * pc(iz,i+1,ielem) * & - gasgain & - - growlg(i,igroup) * pc(iz,i,ielem) * & - diffmass(i+1,igroup,i,igroup) - enddo - - ! Add evaporation out of smallest bin (always total evaporation). - gprod_grow(igroup,igas) = gprod_grow(igroup,igas) + & - evaplg(1,igroup) * pc(iz,1,ielem) * & - ( 1._f - cmf(1,igroup) ) * rmass(1,igroup) - - ! Latent heating rate from condensing gas: is latent heat of evaporation - ! ( + fusion, for ice deposition ) [erg/g] -! if( is_grp_ice(igroup) )then -! rlh = rlhe(iz,igas) + rlhm(iz,igas) -! else -! rlh = rlhe(iz,igas) -! endif - -! rlprod = rlprod - rlh * gprod_grow(igroup,igas) / & -! ( CP * rhoa(iz) ) - endif ! (igas = igrowgas(ielem)) .ne. 0 - enddo ! igroup=1,NGROUP - - ! Sum up gas production from nucleation and growth terms. - do igas = 1,NGAS - do igroup = 1,NGROUP - gasprod(igas) = gasprod(igas) + & - gprod_nuc(igroup,igas) + gprod_grow(igroup,igas) - enddo - enddo - - ! Return to caller with evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/growevapl.F90 b/CARMAchem_GridComp/CARMA/source/base/growevapl.F90 deleted file mode 100644 index 6190ff46..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/growevapl.F90 +++ /dev/null @@ -1,256 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluate particle loss rates due to condensational -!! growth and evaporation for all condensing gases. -!! -!! The loss rates for each group are and . -!! -!! Units are [s^-1]. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine growevapl(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup - integer :: iepart - integer :: igas - integer :: ibin - integer :: isol - integer :: nother - integer :: ieoth_rel - integer :: ieoth_abs - integer :: jother - real(kind=f) :: argsol - real(kind=f) :: othermtot - real(kind=f) :: condm - real(kind=f) :: akas - real(kind=f) :: expon - real(kind=f) :: g0 - real(kind=f) :: g1 - real(kind=f) :: g2 - real(kind=f) :: ss - real(kind=f) :: pvap - real(kind=f) :: dpc - real(kind=f) :: dpc1 - real(kind=f) :: dpcm1 - real(kind=f) :: rat1 - real(kind=f) :: rat2 - real(kind=f) :: rat3 - real(kind=f) :: rat4 - real(kind=f) :: ratt1 - real(kind=f) :: ratt2 - real(kind=f) :: ratt3 - real(kind=f) :: den1 - real(kind=f) :: test1 - real(kind=f) :: test2 - real(kind=f) :: x - integer :: ieother(NELEM) - real(kind=f) :: otherm(NELEM) - real(kind=f) :: dela(NBIN) - real(kind=f) :: delma(NBIN) - real(kind=f) :: aju(NBIN) - real(kind=f) :: ar(NBIN) - real(kind=f) :: al(NBIN) - real(kind=f) :: a6(NBIN) - real(kind=f) :: dmdt(NBIN) - real(kind=f) :: growlg_max - - - do igroup = 1,NGROUP - - ! element of particle number concentration - iepart = ienconc(igroup) - - ! condensing gas - igas = igrowgas(iepart) - - if (igas .ne. 0) then - ! Only valid for condensing liquid water and sulfric acid currently. - if ((igas /= igash2o) .and. (igas .ne. igash2so4)) then - if (do_print) write(LUNOPRT,*) 'growevapl::ERROR - Invalid gas (', igas, ').' - rc = -1 - return - endif - - ! Treat condensation of gas to/from particle group . - ! - ! Bypass calculation if few particles are present - if( pconmax(iz,igroup) .gt. FEW_PC )then - do ibin = 1,NBIN-1 - - ! Determine the growth rate (dmdt). This calculation may take into account - ! radiative effects on the particle which can affect the growth rates. - call pheat(carma, cstate, iz, igroup, iepart, ibin, igas, dmdt(ibin), rc) - - enddo ! ibin = 1,NBIN-1 - - ! Now calculate condensation/evaporation production and loss rates. - ! Use Piecewise Polynomial Method [Colela and Woodard, J. Comp. Phys., - ! 54, 174-201, 1984] - ! - ! First, use cubic fits to estimate concentration values at bin - ! boundaries - do ibin = 2,NBIN-1 - - dpc = pc(iz,ibin,iepart) / dm(ibin,igroup) - dpc1 = pc(iz,ibin+1,iepart) / dm(ibin+1,igroup) - dpcm1 = pc(iz,ibin-1,iepart) / dm(ibin-1,igroup) - ratt1 = pratt(1,ibin,igroup) - ratt2 = pratt(2,ibin,igroup) - ratt3 = pratt(3,ibin,igroup) - dela(ibin) = ratt1 * ( ratt2*(dpc1-dpc) + ratt3*(dpc-dpcm1) ) - delma(ibin) = 0._f - - if( (dpc1-dpc)*(dpc-dpcm1) .gt. 0._f ) & - delma(ibin) = min( abs(dela(ibin)), 2._f*abs(dpc-dpc1), & - 2._f*abs(dpc-dpcm1) ) * sign(1._f, dela(ibin)) - - enddo ! ibin = 2,NBIN-2 - - do ibin = 2,NBIN-2 - - dpc = pc(iz,ibin,iepart) / dm(ibin,igroup) - dpc1 = pc(iz,ibin+1,iepart) / dm(ibin+1,igroup) - dpcm1 = pc(iz,ibin-1,iepart) / dm(ibin-1,igroup) - rat1 = prat(1,ibin,igroup) - rat2 = prat(2,ibin,igroup) - rat3 = prat(3,ibin,igroup) - rat4 = prat(4,ibin,igroup) - den1 = pden1(ibin,igroup) - - ! is the estimate for concentration (dn/dm) at bin - ! boundary +1/2. - aju(ibin) = dpc + rat1*(dpc1-dpc) + 1._f/den1 * & - ( rat2*(rat3-rat4)*(dpc1-dpc) - & - dm(ibin,igroup)*rat3*delma(ibin+1) + & - dm(ibin+1,igroup)*rat4*delma(ibin) ) - enddo ! ibin = 2,NBIN-2 - - ! Now construct polynomial functions in each bin - do ibin = 3,NBIN-2 - al(ibin) = aju(ibin-1) - ar(ibin) = aju(ibin) - enddo - - ! Use linear functions in first two and last two bins - if( NBIN .gt. 1 )then - ibin = NBIN - - ar(2) = aju(2) - al(2) = pc(iz,1,iepart)/dm(1,igroup) + & - palr(1,igroup) * & - (pc(iz,2,iepart)/dm(2,igroup)- & - pc(iz,1,iepart)/dm(1,igroup)) - ar(1) = al(2) - al(1) = pc(iz,1,iepart)/dm(1,igroup) + & - palr(2,igroup) * & - (pc(iz,2,iepart)/dm(2,igroup)- & - pc(iz,1,iepart)/dm(1,igroup)) - - al(ibin-1) = aju(ibin-2) - ar(ibin-1) = pc(iz,ibin-1,iepart)/dm(ibin-1,igroup) + & - palr(3,igroup) * & - (pc(iz,ibin,iepart)/dm(ibin,igroup)- & - pc(iz,ibin-1,iepart)/dm(ibin-1,igroup)) - al(ibin) = ar(ibin-1) - ar(ibin) = pc(iz,ibin-1,iepart)/dm(ibin-1,igroup) + & - palr(4,igroup) * & - (pc(iz,ibin,iepart)/dm(ibin,igroup)- & - pc(iz,ibin-1,iepart)/dm(ibin-1,igroup)) - endif - - ! Next, ensure that polynomial functions do not deviate beyond the - ! range [,] - do ibin = 1,NBIN - - dpc = pc(iz,ibin,iepart) / dm(ibin,igroup) - - if( (ar(ibin)-dpc)*(dpc-al(ibin)) .le. 0._f )then - al(ibin) = dpc - ar(ibin) = dpc - endif - - test1 = (ar(ibin)-al(ibin))*(dpc - 0.5_f*(al(ibin)+ar(ibin))) - test2 = 1._f/6._f*(ar(ibin)-al(ibin))**2 - - if( test1 .gt. test2 )then - al(ibin) = 3._f*dpc - 2._f*ar(ibin) - elseif( test1 .lt. -test2 )then - ar(ibin) = 3._f*dpc - 2._f*al(ibin) - endif - enddo - - ! Lastly, calculate fluxes across each bin boundary. - ! - ! Use upwind advection when courant number > 1. - do ibin = 1,NBIN - dpc = pc(iz,ibin,iepart) / dm(ibin,igroup) - dela(ibin) = ar(ibin) - al(ibin) - a6(ibin) = 6._f * ( dpc - 0.5_f*(ar(ibin)+al(ibin)) ) - enddo - - do ibin = 1,NBIN-1 - - if( dmdt(ibin) .gt. 0._f .and. & - pc(iz,ibin,iepart) .gt. SMALL_PC )then - - x = dmdt(ibin)*dtime/dm(ibin,igroup) - - if( x .lt. 1._f )then - growlg(ibin,igroup) = dmdt(ibin)/pc(iz,ibin,iepart) & - * ( ar(ibin) - 0.5*dela(ibin)*x + & - (x/2._f - x**2/3._f)*a6(ibin) ) - else - growlg(ibin,igroup) = dmdt(ibin) / dm(ibin,igroup) - endif - - elseif( dmdt(ibin) .lt. 0._f .and. & - pc(iz,ibin+1,iepart) .gt. SMALL_PC )then - - x = -dmdt(ibin)*dtime/dm(ibin+1,igroup) - - if( x .lt. 1._f )then - evaplg(ibin+1,igroup) = -dmdt(ibin)/ & - pc(iz,ibin+1,iepart) & - * ( al(ibin+1) + 0.5_f*dela(ibin+1)*x + & - (x/2._f - (x**2)/3._f)*a6(ibin+1) ) - else - evaplg(ibin+1,igroup) = -dmdt(ibin) / dm(ibin+1,igroup) - endif - - ! Boundary conditions: for evaporation out of first bin (with cores), - ! use evaporation rate from second bin. -! if( ibin .eq. 1 .and. ncore(igroup) .gt. 0 )then - if( ibin .eq. 1)then - evaplg(1,igroup) = -dmdt(1) / dm(1,igroup) - endif - endif - - enddo ! ibin = 1,NBIN-1 - endif ! (pconmax .gt. FEW_PC) - endif ! (igas = igrowgas(ielem)) .ne. 0 - enddo ! igroup = 1,NGROUP - - - ! Return to caller with particle loss rates for growth and evaporation - ! evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/growp.F90 b/CARMAchem_GridComp/CARMA/source/base/growp.F90 deleted file mode 100644 index b81b1560..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/growp.F90 +++ /dev/null @@ -1,50 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to growth -!! for one particle size bin at one spatial grid point per call. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine growp(carma, cstate, iz, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: iepart - - - ! Define group & particle # concentration indices for current element - igroup = igelem(ielem) ! target particle group - iepart = ienconc(igroup) ! target particle number concentration element - - ! Calculate production terms due to condensational growth - ! only if group to which element belongs grows. - if( igrowgas(iepart) .ne. 0 .and. ibin .ne. 1 )then - - ! Bypass calculation if few droplets are present - if( pconmax(iz,igroup) .gt. FEW_PC )then - growpe(ibin,ielem) = pc(iz,ibin-1,ielem) * growlg(ibin-1,igroup) - endif - endif - - ! Return to caller with growth production terms evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/gsolve.F90 b/CARMAchem_GridComp/CARMA/source/base/gsolve.F90 deleted file mode 100644 index 6edaffc5..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/gsolve.F90 +++ /dev/null @@ -1,101 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates new gas concentrations. -!! -!! @author Andy Ackerman, Bill McKie, Chuck Bardeen -!! @version Dec-1995, Sep-1997, Nov-2009 -subroutine gsolve(carma, cstate, iz, previous_ice, previous_liquid, scale_threshold, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(in) :: previous_ice(NGAS) !! total ice at the start of substep - real(kind=f), intent(in) :: previous_liquid(NGAS) !! total liquid at the start of substep - real(kind=f) :: scale_threshold !! Scaling factor for convergence thresholds - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: igas !! gas index - real(kind=f) :: gc_cgs - real(kind=f) :: rvap - real(kind=f) :: total_ice(NGAS) ! total ice - real(kind=f) :: total_liquid(NGAS) ! total liquid - real(kind=f) :: threshold ! convergence threshold - - - 1 format(/,'gsolve::ERROR - negative gas concentration for ',a,' : iz=',i4,',lat=', & - f7.2,',lon=',f7.2,',gc=',e10.3,',gasprod=',e10.3,',supsati=',e10.3, & - ',supsatl=',e10.3,',t=',f6.2) - 2 format('gsolve::ERROR - conditions at beginning of the step : gc=',e10.3,',supsati=',e17.10, & - ',supsatl=',e17.10,',t=',f6.2,',d_gc=',e10.3,',d_t=',f6.2) - 3 format(/,'microfast::WARNING - gas concentration change exceeds threshold: ',a,' : iz=',i4,',lat=', & - f7.2,',lon=',f7.2, ', (gc-gcl)/gcl=', e10.3) - - - ! Determine the total amount of condensate for each gas. - call totalcondensate(carma, cstate, iz, total_ice, total_liquid, rc) - - do igas = 1,NGAS - - ! We do not seem to be conserving mass and energy, so rather than relying upon gasprod - ! and rlheat, recalculate the total change in condensate to determine the change - ! in gas and energy. - ! - ! This is because in the old scheme, the particles were solved for implicitly, but the - ! gas and latent heat were solved for explicitly using the same rates. - gasprod(igas) = ((previous_ice(igas) - total_ice(igas)) + (previous_liquid(igas) - total_liquid(igas))) / dtime - rlprod = rlprod - ((previous_ice(igas) - total_ice(igas)) * (rlhe(iz,igas) + rlhm(iz,igas)) + & - (previous_liquid(igas) - total_liquid(igas)) * (rlhe(iz,igas))) / (CP * rhoa(iz) * dtime) - - ! Don't let the gas concentration go negative. - gc(iz,igas) = gc(iz,igas) + dtime * gasprod(igas) - - if (gc(iz,igas) < 0.0_f) then - if (do_substep) then - if (nretries == maxretries .and. .not. do_pfast) then - if (do_print) write(LUNOPRT,1) trim(gasname(igas)), iz, lat, lon, gc(iz,igas), gasprod(igas), & - supsati(iz,igas), supsatl(iz,igas), t(iz) - if (do_print) write(LUNOPRT,2) gcl(iz,igas), supsatiold(iz,igas), supsatlold(iz,igas), told(iz), d_gc(iz,igas), d_t(iz) - end if - else - if (do_print) write(LUNOPRT,1) trim(gasname(igas)), iz, lat, lon, gc(iz,igas), gasprod(igas), & - supsati(iz, igas), supsatl(iz,igas), t(iz) - end if - - rc = RC_WARNING_RETRY - end if - - ! If gas changes by too much, then retry the calculation. - threshold = dgc_threshold(igas) / scale_threshold - - if (threshold /= 0._f) then - if ((dtime * gasprod(igas) / gc(iz,igas)) > threshold) then - if (do_substep) then - if (nretries == maxretries) then - if (do_print) write(LUNOPRT,3) trim(gasname(igas)), iz, lat, lon, dtime * gasprod(igas) / gc(iz,igas) - if (do_print) write(LUNOPRT,2) gcl(iz,igas), supsatiold(iz,igas), supsatlold(iz,igas), told(iz), d_gc(iz,igas), d_t(iz) - end if - else - if (do_print) write(LUNOPRT,3) trim(gasname(igas)), iz, lat, lon, dtime * gasprod(igas) / gc(iz,igas) - end if - - rc = RC_WARNING_RETRY - end if - end if - end do - - ! Return to caller with new gas concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/hetnucl.F90 b/CARMAchem_GridComp/CARMA/source/base/hetnucl.F90 deleted file mode 100644 index 13082e49..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/hetnucl.F90 +++ /dev/null @@ -1,163 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! heterogeneous deposition nucleation only. The parameters are adjusted -!! for mesospheric conditions, based upon the recommendations of Keesee. -!! -!! Based on expressions from ... -!! Keesee [JGR,1989] -!! Pruppacher and Klett [2000] -!! Rapp and Thomas [JASTP, 2006] -!! Trainer et al. [2008] -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! To avoid nucleation into an evaporating bin, this subroutine must -!! be called after growp, which evaluates evaporation loss rates . -!! -!! @author Eric Jensen, Chuck Bardeen -!! @version Oct-2000, Jan-2010 -subroutine hetnucl(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igas ! gas index - integer :: igroup ! group index - integer :: ibin ! bin index - integer :: iepart ! element for condensing group index - integer :: inuc ! nucleating element index - integer :: ienucto ! index of target nucleation element - integer :: ignucto ! index of target nucleation group - real(kind=f) :: rmw - real(kind=f) :: R_H2O - real(kind=f) :: rnh2o - real(kind=f) :: rlogs - real(kind=f) :: ag - real(kind=f) :: contang - real(kind=f) :: xh - real(kind=f) :: phih - real(kind=f) :: rath - real(kind=f) :: fv3h - real(kind=f) :: fv4h - real(kind=f) :: fh - real(kind=f) :: delfg - real(kind=f) :: expon - - ! Heterogeneous nucleation factors - real(kind=f), parameter :: gdes = 2.9e-13_f - real(kind=f), parameter :: gsd = 2.9e-14_f - real(kind=f), parameter :: zeld = 0.1_f - real(kind=f), parameter :: vibfreq = 1.e13_f - real(kind=f), parameter :: diflen = 0.1e-7_f - real(kind=f) :: rmiv - - rmiv = 0.95_f - - ! rmiv - Eq. 2, Trainer et al. [2008] -! rmiv = 0.94_f - (6005._f * exp(-0.065_f * max(150._f, t(iz)))) -! rmiv = max(0._f, 0.94_f - (6005._f * exp(-0.065_f * t(iz)))) - - ! Loop over particle groups. - do igroup = 1, NGROUP - - igas = inucgas(igroup) ! condensing gas - - if (igas .ne. 0) then - - iepart = ienconc(igroup) ! particle number density element - - rmw = gwtmol(igas) / AVG - R_H2O = RGAS / gwtmol(igas) - rnh2o = gc(iz,igas) * R_H2O / BK - - ! Calculate nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - ! - ! is index of target nucleation element; - ! is index of target nucleation group. - do inuc = 1, nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - - if (ienucto .ne. 0) then - ignucto = igelem(ienucto) - else - ignucto = 0 - endif - - ! Only compute nucleation rate for heterogenous nucleation - if (inucproc(iepart,ienucto) .eq. I_HETNUC) then - - ! Loop over particle bins. Loop from largest to smallest for - ! evaluation of index of smallest bin nucleated during time step . - do ibin = NBIN, 1, -1 - - ! Bypass calculation if few particles are present - if (pconmax(iz,igroup) .gt. FEW_PC) then - - ! Only proceed if ice supersaturated - ! - ! NOTE: We are only trying to model PMC partcles, so turn of nucleation - ! where the CAM microphysics takes over (~1 mb = 1000 dyne). - if ((p(iz) .lt. 1.e3_f) .and. (supsati(iz,igas) .gt. 0._f)) then - rlogs = log(supsati(iz,igas) + 1._f) - - ! Critical ice germ radius formed in the sulfate solution - ! - ! Eq. 2, Rapp & Thomas [2006] - ag = 2._f * gwtmol(igas) * surfctia(iz) / rgas / t(iz) / RHO_I / rlogs - - ! Heterogeneous nucleation geometric factor - ! - ! Eq. 9-22, Pruppacher & Klett [2000] - contang = acos(rmiv) - xh = r(ibin,igroup) / ag - phih = sqrt(1._f - 2._f * rmiv * xh + xh**2 ) - rath = (xh-rmiv) / phih - fv3h = xh**3 * (2._f - 3._f * rath + rath**3 ) - fv4h = 3._f * rmiv * xh**2 * (rath - 1._f) - - if (abs(rath) .gt. 1._f - 1.e-8_f) fv3h = 0._f - if (abs(rath) .gt. 1._f - 1.e-10_f) fv4h = 0._f - - fh = 0.5_f * (1._f + ((1._f - rmiv * xh) / phih)**3 + fv3h + fv4h) - - ! Gibbs free energy of ice germ formation in the ice/sulfate solution - ! - ! Eq. 3, Rapp & Thomas [2006] - delfg = 4._f * PI * ag**2 * surfctia(iz) - 4._f * PI * RHO_I * ag**3 *BK * t(iz) * rlogs / 3._f / rmw - - ! Ice nucleation rate in a 0.2 micron aerosol (/sec) - expon = (2._f * gdes - gsd - fh*delfg) / BK / t(iz) - - ! NOTE: Excessive nucleation makes it difficult for the substepping to find a - ! stable solution, so put a cap on really large nucleation values that can be produced. - rnuclg(ibin,igroup,ignucto) = min(1e10_f, zeld * BK * t(iz) * diflen * ag * sin(contang) * & - 4._f * PI * r(ibin,igroup)**2 * rnh2o**2 / (fh * rmw * vibfreq) * exp(expon)) - endif - endif ! pconmax(ixyz,igroup) .gt. FEW_PC - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPACT - enddo ! inuc = 1,nnuc2elem(iepart) - endif ! (igas = inucgas(igroup) .ne. 0) - enddo ! igroup = 1,NGROUP - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/lusolvec_mod.F90 b/CARMAchem_GridComp/CARMA/source/base/lusolvec_mod.F90 deleted file mode 100644 index a6018a2f..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/lusolvec_mod.F90 +++ /dev/null @@ -1,213 +0,0 @@ -!! -!! this module: lusolvec_mod Numerical solution of a set of linear -!! Equations / a matrix equation A * x = b -!! using LU decomposition, matrix A and -!! vectors b and x being double complex, -!! and inversion of A. -!! ****************************************************************** -!! Usage: -!! ====== -!! given a complex matrix A, a right hand side vector b and a -!! matrix equation A * x = b to solve for vector x. -!! -!! -!! First, call LUDCMPC(A,N,NP,INDX,D). The original Matrix A is lost -!! and substituted by its LU decomposition. -!! -!! Second, call LUBKSBC(A,N,NP,INDX,B). The original right-hand-side -!! vector ib in B is lost and replaced/returned as the solution -!! vector x ( x(i) = B(i) ). -!! Use same kind of call to solve for successive right-hand-sides. -!! -!! For Inversion of matrix A, call LUBKSBC() subsequently for each -!! column vector: -!! 1) Initialize matrix AINV(i,j) to be equal to the -!! identity matrix (AINV(i,j)=1 for i=j; =0 otherwise) -!! 2) DO jj=1,n -!! CALL LUBKSBC(A,N,NP,INDX,AINV(1,jj)) -!! END DO -!! (see textbook for further details). -!! ****************************************************************** - -module lusolvec_mod - - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - private - - ! public subroutines - public :: LUDCMPC - public :: LUBKSBC - - contains - - !! - !! SUBROUTINE LUDCMPC(A,N,NP,INDX,D) - !! - !! Given a general complex matrix A, this routine replaces it by its - !! LU decomposition of a rowwise permutation of itself. - !! This routine is used in combination with LUBKSBC(), a complex - !! extension of the routine LUBKSB() (DOUBLE COMPLEX). - !! For further details, refer to textbook (see below). - !! - !! Source: Own adaption/extension to complex matrix of the - !! Subroutine LUDCMP() taken from - !! Press et al, "Numerical Recipes in Fortran" - !! The adaption follows the statements given in section 2.3 - !! of the textbook "N.R. in C", following Eq.(2.3.16): - !! - definition of variables, vector and matrix elements - !! as complex variables (use of complex arithmetic does - !! not necessitate any adaption in fortran). - !! - complex modulus instead of absolute values in the - !! construction of the vector vv and in the search for the - !! largest pivot elements. - !! ****************************************************************** - !! Version: 28.08.2000 - !! ****************************************************************** - SUBROUTINE LUDCMPC(A,N,NP,INDX,D) - - INTEGER :: NP - COMPLEX(kind=f) :: A(NP,NP) - INTEGER :: N - INTEGER :: INDX(N) - REAL(kind=f) :: D - - INTEGER, PARAMETER :: NMAX=100 - REAL(kind=f), PARAMETER :: TINY=1.0e-20_f - REAL(kind=f) :: VV(NMAX) - REAL(kind=f) :: DUM,AAMAX - COMPLEX(kind=f) :: SUM,DUMC,ZEROC,TINYC - INTEGER I,J,K,IMAX - - D=1._f - TINYC=cmplx(TINY,0.0_f,kind=f) - ZEROC=cmplx(0.0_f,0.0_f,kind=f) - DO I=1,N - AAMAX=0._f - DO J=1,N - IF (ABS(A(I,J)).GT.AAMAX) AAMAX=ABS(A(I,J)) - END DO -! IF (AAMAX.EQ.0._f) PAUSE 'Singular matrix.' - IF (AAMAX.EQ.0._f) STOP 'Singular matrix.' - VV(I)=1./AAMAX - END DO - DO J=1,N - IF (J.GT.1) THEN - DO I=1,J-1 - SUM=A(I,J) - IF (I.GT.1)THEN - DO K=1,I-1 - SUM=SUM-A(I,K)*A(K,J) - END DO - A(I,J)=SUM - ENDIF - END DO - ENDIF - AAMAX=0._f - DO I=J,N - SUM=A(I,J) - IF (J.GT.1)THEN - DO K=1,J-1 - SUM=SUM-A(I,K)*A(K,J) - END DO - A(I,J)=SUM - ENDIF - DUM=VV(I)*ABS(SUM) - IF (DUM.GE.AAMAX) THEN - IMAX=I - AAMAX=DUM - ENDIF - END DO - IF (J.NE.IMAX)THEN - DO K=1,N - DUMC=A(IMAX,K) - A(IMAX,K)=A(J,K) - A(J,K)=DUMC - END DO - D=-D - VV(IMAX)=VV(J) - ENDIF - INDX(J)=IMAX - IF(J.NE.N)THEN - IF(A(J,J).EQ.ZEROC)A(J,J)=TINYC - DUMC=1./A(J,J) - DO I=J+1,N - A(I,J)=A(I,J)*DUMC - END DO - ENDIF - END DO - IF (A(N,N).EQ.ZEROC) A(N,N)=TINYC - RETURN - END SUBROUTINE LUDCMPC - - !! - !! SUBROUTINE LUBKSBC(A,N,NP,INDX,B) - !! - !! Solution of the set of linear equations A' * x = b where - !! A is input not as the original matrix, but as a LU decomposition - !! of some original matrix A' as determined by the subroutine - !! LUDCMPC() (matrix and vectors being of type DOUBLE COMPLEX). - !! INDX() is input as the permutation vactor returned by LUDCMPC(). - !! B() is input as the right hand side vector b of the Eqn. to solve - !! and returns with the solution vector x. - !! A, N and INDX are not modified by this routine and can be left in - !! place for successive calls with different right-hand-sides b. - !! For further details, refer to textbook (see below). - !! - !! Source: Own adaption/extension to complex matrix of the - !! Subroutine LUBKSB() taken from - !! Press et al, "Numerical Recipes in Fortran" - !! The adaption follows the statements given in section 2.3 - !! of the textbook "N.R. in C", following Eq.(2.3.16). - !! ****************************************************************** - !! Version: 28.08.2000 - !! ****************************************************************** - SUBROUTINE LUBKSBC(A,N,NP,INDX,B) - - INTEGER :: NP - COMPLEX(kind=f) :: A(NP,NP) - INTEGER :: N - INTEGER :: INDX(N) - COMPLEX(kind=f) :: B(N) - - INTEGER, PARAMETER :: NMAX=100 - REAL(kind=f), PARAMETER :: TINY=1.0e-20_f - - COMPLEX(kind=f) :: SUM,ZEROC - INTEGER :: II,LL,I,J - - II=0 - ZEROC=cmplx(0.0_f,0.0_f,kind=f) - DO I=1,N - LL=INDX(I) - SUM=B(LL) - B(LL)=B(I) - IF (II.NE.0)THEN - DO J=II,I-1 - SUM=SUM-A(I,J)*B(J) - END DO - ELSE IF (SUM.NE.ZEROC) THEN - II=I - ENDIF - B(I)=SUM - END DO - DO I=N,1,-1 - SUM=B(I) - IF(I.LT.N)THEN - DO J=I+1,N - SUM=SUM-A(I,J)*B(J) - END DO - ENDIF - B(I)=SUM/A(I,I) - END DO - RETURN - END SUBROUTINE LUBKSBC - - -end module lusolvec_mod diff --git a/CARMAchem_GridComp/CARMA/source/base/maxconc.F90 b/CARMAchem_GridComp/CARMA/source/base/maxconc.F90 deleted file mode 100644 index 0360c2a4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/maxconc.F90 +++ /dev/null @@ -1,47 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This determines the maximum particle concentration for each group in each -!! gridbox. This can be used to make calculations more efficient by skipping -!! calculations when concentrations are low -!! -!! @author Chuck Bardeen -!! @version Nov 2009 -subroutine maxconc(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Locals - integer :: igrp - integer :: iep - - - ! Find maximum particle concentration for each spatial grid box - ! (in units of cm^-3) - do igrp = 1,NGROUP - iep = ienconc(igrp) - - pconmax(iz,igrp) = maxval(pc(iz,:,iep)) - - pconmax(iz,igrp) = pconmax(iz,igrp) & - / xmet(iz) & - / ymet(iz) & - / zmet(iz) - enddo ! igrp - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/melticel.F90 b/CARMAchem_GridComp/CARMA/source/base/melticel.F90 deleted file mode 100644 index 26e1a904..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/melticel.F90 +++ /dev/null @@ -1,74 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle loss rates due to nucleation : -!! Ice crystal melting only. -!! -!! The loss rates for all particle elements in a particle group are equal. -!! -!! @author Eric Jensen, Chuck Bardeen -!! @version Jan-2000, Nov-2009 -subroutine melticel(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup !! group index - integer :: ibin !! bin index - integer :: iepart !! element for condensing group index - integer :: ienucto !! index of target nucleation element - integer :: ignucto !! index of target nucleation group - integer :: inuc !! nucleating element index - - - ! Loop over particle groups. - do igroup = 1,NGROUP - - iepart = ienconc( igroup ) ! particle number density element - - ! Calculate nucleation loss rates. - do inuc = 1,nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - - if( ienucto .ne. 0 )then - ignucto = igelem( ienucto ) - - ! Only compute nucleation rate for ice crystal melting - if( inucproc(iepart,ienucto) .eq. I_ICEMELT ) then - - ! Loop over particle bins. Loop from largest to smallest for - ! evaluation of index of smallest bin nucleated during time step . - do ibin = NBIN,1,-1 - - ! Bypass calculation if few particles are present - if( pconmax(iz,igroup) .gt. FEW_PC )then - - ! Temporary simple kludge: Set to 1.e2 if T > 0C - if( t(iz) .gt. T0 ) then - rnuclg(ibin,igroup,ignucto) = 1.e2_f - endif - endif ! pconmax(ixyz,igroup) .gt. FEW_PC - enddo ! ibin = 1,NBIN - endif ! inucproc(iepart,ienucto) .eq. I_DROPFREEZE - endif - enddo ! inuc = 1,nnuc2elem(iepart) - enddo ! igroup = 1,NGROUP - - ! Return to caller with particle loss rates due to nucleation evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/microfast.F90 b/CARMAchem_GridComp/CARMA/source/base/microfast.F90 deleted file mode 100644 index 20c47b5e..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/microfast.F90 +++ /dev/null @@ -1,280 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine drives the fast microphysics calculations. -!! -!! @author Eric Jensen, Bill McKie -!! @version Sep-1997 -subroutine microfast(carma, cstate, iz, scale_threshold, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f) :: scale_threshold !! Scaling factor for convergence thresholds - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: ielem ! element index - integer :: ibin ! bin index - integer :: igas ! gas index - real(kind=f) :: previous_ice(NGAS) ! total ice at the start of substep - real(kind=f) :: previous_liquid(NGAS) ! total liquid at the start of substep - real(kind=f) :: previous_supsatl(NGAS) ! supersaturation wrt ice at the start of substep - real(kind=f) :: previous_supsati(NGAS) ! supersaturation wrt liquid at the start of substep - real(kind=f) :: supsatold - real(kind=f) :: supsatnew - real(kind=f) :: srat - real(kind=f) :: srat1 - real(kind=f) :: srat2 - real(kind=f) :: s_threshold - - 1 format(/,'microfast::ERROR - excessive change in supersaturation for ',a,' : iz=',i4,',lat=', & - f7.2,',lon=',f7.2,',srat=',e10.3,',supsatiold=',e10.3,',supsatlold=',e10.3,',supsati=',e10.3, & - ',supsatl=',e10.3,',t=',f6.2) - 2 format('microfast::ERROR - conditions at beginning of the step : gc=',e10.3,',supsati=',e17.10, & - ',supsatl=',e17.10,',t=',f6.2,',d_gc=',e10.3,',d_t=',f6.2) - 3 format(/,'microfast::ERROR - excessive change in supersaturation for ',a,' : iz=',i4,',lat=', & - f7.2,',lon=',f7.2,',supsatiold=',e10.3,',supsatlold=',e10.3,',supsati=',e10.3, & - ',supsatl=',e10.3,',t=',f6.2) - - ! Set production and loss rates to zero. - call zeromicro(carma, cstate, iz, rc) - if (rc < RC_OK) return - - - ! Calculate (implicit) particle loss rates for nucleation, growth, - ! evaporation, melting, etc. - if (do_grow) then - - ! Save off the current condensate totals so the gas and latent heating can be - ! figured out in a way that conserves mass and energy. - call totalcondensate(carma, cstate, iz, previous_ice, previous_liquid, rc) - if (rc < RC_OK) return - - do igas = 1, NGAS - call supersat(carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - - previous_supsati(igas) = supsati(iz, igas) - previous_supsatl(igas) = supsatl(iz, igas) - end do - - ! Have water vapor and sulfuric acid been defined? - if ((igash2o /= 0) .and. (igash2so4 /= 0)) then - - ! Are both gases avaialble? - if ((gc(iz, igash2o) > 0._f) .and. (gc(iz,igash2so4) > 0._f)) then - - ! See if any sulfates will form. - call sulfnuc(carma, cstate, iz, rc) - endif - end if - - call growevapl(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call actdropl(carma, cstate, iz, rc) - if (rc < RC_OK) return - - ! The Koop, Tabazadeh and Mohler routines provide different schemes for aerosol freezing. - ! Only one of these parameterizatons should be active at one time. However, any - ! of these routines can be used in conjunction with heterogenous nucleation of glassy - ! aerosols. - call freezaerl_tabazadeh2000(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call freezaerl_koop2000(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call freezaerl_mohler2010(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call freezglaerl_murray2010(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call hetnucl(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call freezdropl(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call melticel(carma, cstate, iz, rc) - if (rc < RC_OK) return - endif - - ! Calculate particle production terms and solve for particle - ! concentrations at end of time step. - do ielem = 1,NELEM - do ibin = 1,NBIN - - if( do_grow )then - call growp(carma, cstate, iz, ibin, ielem, rc) - if (rc < RC_OK) return - - call upgxfer(carma, cstate, iz, ibin, ielem, rc) - if (rc < RC_OK) return - endif - - call psolve(carma, cstate, iz, ibin, ielem, rc) - if (rc < RC_OK) return - enddo - enddo - - ! Calculate particle production terms for evaporation; - ! gas loss rates and production terms due to particle nucleation; - ! growth, and evaporation; - ! apply evaporation production terms to particle concentrations; - ! and solve for gas concentrations at end of time step. - if (do_grow) then - call evapp(carma, cstate, iz, rc) - if (rc < RC_OK) return - - call downgxfer(carma, cstate, iz, rc) - if (rc < RC_OK) return - -! NOTE: Not needed because changes in gas concentrations and latent -! heats are now calculated later in gsolve using total condensate. -! call gasexchange(carma, cstate, iz, rc) -! if (rc < RC_OK) return - - call downgevapply(carma, cstate, iz, rc) - if (rc < RC_OK) return - - ! If this is a parameterized timestep, scale bin values to prevent gas overshoot - if (rc == RC_WARNING_PFAST) call pfastdmdt(carma, cstate, iz, rc) - - call gsolve(carma, cstate, iz, previous_ice, previous_liquid, scale_threshold, rc) - if (rc /= RC_OK .and. rc /= RC_WARNING_PFAST) return - endif - - ! Update temperature if thermal processes requested - if (do_thermo) then - call tsolve(carma, cstate, iz, scale_threshold, rc) - if (rc /= RC_OK .and. rc /= RC_WARNING_PFAST) return - endif - - ! Update saturation ratios - if (do_grow .or. do_thermo) then - do igas = 1, NGAS - call supersat(carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - - ! Check to see how much the supersaturation changed during this step. If it - ! has changed to much, then cause a retry. - if (t(iz) >= T0) then - supsatold = previous_supsatl(igas) - supsatnew = supsatl(iz,igas) - else - supsatold = previous_supsati(igas) - supsatnew = supsati(iz,igas) - end if - - ! If ds_threshold is positive, then it indicates that the criteria should - ! be based on the percentage change in saturation. - if (ds_threshold(igas) > 0._f) then - - if (supsatold >= 1.e-4_f) then - srat1 = abs(supsatnew / supsatold - 1._f) - else - srat1 = 0._f - end if - - if (supsatnew >= 1.e-4_f) then - srat2 = abs(supsatold / supsatnew - 1._f) - else - srat2 = 0._f - end if - - srat = max(srat1, srat2) - - ! Don't let one substep change the supersaturation by too much. - if (ds_threshold(igas) > 0._f) then -! if (srat >= ds_threshold(igas)) then - if ((srat >= ds_threshold(igas)) .and. (abs(supsatold - supsatnew) > 0.1_f)) then - if (do_substep) then - if (nretries == maxretries) then - if (do_print) write(LUNOPRT,1) trim(gasname(igas)), iz, & - lat, lon, srat, previous_supsati(igas), previous_supsatl(igas), & - supsati(iz, igas), supsatl(iz,igas), t(iz) - if (do_print) write(LUNOPRT,2) gcl(iz,igas), supsatiold(iz, igas), & - supsatlold(iz,igas), told(iz), d_gc(iz, igas), d_t(iz) - end if - - rc = RC_WARNING_RETRY - else - if (do_print) write(LUNOPRT,1) trim(gasname(igas)), iz, lat, lon, & - srat, previous_supsati(igas), previous_supsatl(igas), & - supsati(iz, igas), supsatl(iz,igas), t(iz) - end if - end if - end if - - - ! If ds_threshold is negative, then it indicates that the criteria is based - ! upon the supersaturation crossing 0, Indicating a shift from growth to - ! evaporation and a potential overshoot in the result. - else if (ds_threshold(igas) < 0._f) then - - ! Adjust the saturation threshold to allow a worse solution if getting a better - ! solution is taking too much time. The particular solution at any individual - ! point is probably not going to affect the overall result by too much. - s_threshold = abs(ds_threshold(igas)) - - if (nretries >= (0.8_f * maxretries)) then - s_threshold = 4._f * s_threshold - else if (nretries >= (0.7_f * maxretries)) then - s_threshold = 3.5_f * s_threshold - else if (nretries >= (0.6_f * maxretries)) then - s_threshold = 3._f * s_threshold - else if (nretries >= (0.5_f * maxretries)) then - s_threshold = 2.5_f * s_threshold - else if (nretries >= (0.4_f * maxretries)) then - s_threshold = 2._f * s_threshold - end if - - ! If the supersaturation changed signs, then we went from growth to evaporation - ! or vice versa. Don't let the new supersaturation go too far past 0 in one substep. - ! This is to prevent overshooting as growth/evaporation should normally stop when - ! the supersaturation is 0. - if (((supsatnew * supsatold) < 0._f) .and. (abs(supsatnew) > s_threshold)) then - - if (do_substep) then - if (nretries == maxretries) then - if (do_print) write(LUNOPRT,3) trim(gasname(igas)), iz, & - lat, lon, previous_supsati(igas), previous_supsatl(igas), & - supsati(iz, igas), supsatl(iz,igas), t(iz) - if (do_print) write(LUNOPRT,2) gcl(iz,igas), supsatiold(iz, igas), & - supsatlold(iz,igas), told(iz), d_gc(iz, igas), d_t(iz) - end if - else - if (do_print) write(LUNOPRT,3) trim(gasname(igas)), iz, & - lat, lon, previous_supsati(igas), previous_supsatl(igas), & - supsati(iz, igas), supsatl(iz,igas), t(iz) - end if - - rc = RC_WARNING_RETRY - end if - end if - end do - endif - - - ! Update particle densities -! if (do_grow) then -! call rhopart(carma, cstate, iz, rc) -! end if - - ! Return to caller with new particle and gas concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/microslow.F90 b/CARMAchem_GridComp/CARMA/source/base/microslow.F90 deleted file mode 100644 index 11376da0..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/microslow.F90 +++ /dev/null @@ -1,61 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine drives the potentially slower microphysics calculations. -!! -!! Originally part of microphy. Now in this separate routine to allow -!! time splitting of coagulation at a different timestep size from -!! other microphysical calcs. -!! -!! @author McKie -!! @version Sep-1997 -subroutine microslow(carma, cstate, rc) - - ! carma types defs - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Declarations - integer :: ibin - integer :: ielem - - - - ! Set production terms and loss rates due to slow microphysics - ! processes (coagulation) to zero. - coagpe(:,:,:) = 0._f - coaglg(:,:,:) = 0._f - - ! Calculate (implicit) particle loss rates for coagulation. - call coagl(carma, cstate, rc) - - ! Calculate particle production terms and solve for particle - ! concentrations at end of time step. - ! - ! NOTE: The order of elements required by CARMA to work with the - ! element loop first is: if you have a group that is both a source - ! and product of coagulation, then it needs to come after the - ! other group that participates in that coagulation in the element - ! table. For example, icoag(2,1) = 1 will not work, but - ! icoag(2,1) = 2 should work. - do ielem = 1,NELEM - do ibin = 1,NBIN - call coagp(carma, cstate, ibin, ielem, rc) - call csolve(carma, cstate, ibin, ielem, rc) - enddo - enddo - - ! Return to caller with new particle concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/mie.F90 b/CARMAchem_GridComp/CARMA/source/base/mie.F90 deleted file mode 100644 index 92758fb1..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/mie.F90 +++ /dev/null @@ -1,143 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! There are several different algorithms that can be used to solve -!! a mie calculation for the optical properties of particles. This -!! routine provides a generic front end to these different mie -!! routines. -!! -!! Current methods are: -!! miess - Original CARMA code, from Toon and Ackerman, supports core/shell -!! bhmie - Homogeneous sphere, from Bohren and Huffman, handles wider range of parameters -!! -!! @author Chuck Bardeen -!! @version 2011 -subroutine mie(carma, miertn, radius, wavelength, nmonomer, fractaldim, rmonomer, falpha_in, m, lqext, lqsca, lasym, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carma_mod - use fractal_meanfield_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: miertn !! mie routine enumeration - real(kind=f), intent(in) :: radius !! radius (cm) - real(kind=f), intent(in) :: wavelength !! wavelength (cm) - real(kind=f), intent(in) :: nmonomer !! number of monomers per aggregate [fractal particles only] - real(kind=f), intent(in) :: fractaldim !! fractal dimension [fractal particles only] - real(kind=f), intent(in) :: rmonomer !! monomer size (units?) [fractal particles only] - real(kind=f), intent(in) :: falpha_in !! packing coefficient [fractal particles only] - complex(kind=f), intent(in) :: m !! refractive index particle - real(kind=f), intent(out) :: lqext !! EFFICIENCY FACTOR FOR EXTINCTION - real(kind=f), intent(out) :: lqsca !! EFFICIENCY FACTOR FOR SCATTERING - real(kind=f), intent(out) :: lasym !! asymmetry factor - integer, intent(inout) :: rc !! return code, negative indicates failure - - - integer, parameter :: nang = 10 ! Number of angles - - real(kind=f) :: theta(IT) - real(kind=f) :: wvno - real(kind=f) :: rfr - real(kind=f) :: rfi - real(kind=f) :: x - real(kind=f) :: qback - real(kind=f) :: ctbrqs - complex(kind=f) :: s1(2*nang-1) - complex(kind=f) :: s2(2*nang-1) - real(kind=f) :: rmonomer_out - real(kind=f) :: fractaldim_out - - ! Calculate the wave number. - wvno = 2._f * PI / wavelength - - ! Select the appropriate routine. - if (miertn == I_MIERTN_TOON1981) then - - ! We only care about the forward direction. - theta(:) = 0.0_f - - rfr = real(m) - rfi = aimag(m) - - call miess(carma, & - radius, & - rfr, & - rfi, & - theta, & - 1, & - lqext, & - lqsca, & - qback,& - ctbrqs, & - 0.0_f, & - rfr, & - rfi, & - wvno, & - rc) - - lasym = ctbrqs / lqsca - - else if (miertn == I_MIERTN_BOHREN1983) then - - x = radius * wvno - - call bhmie(carma, & - x, & - m, & - nang, & - s1, & - s2, & - lqext, & - lqsca, & - qback, & - lasym, & - rc) - - else if (miertn == I_MIERTN_BOTET1997) then - - rfr = real(m) - rfi = aimag(m) - - if (radius .le. rmonomer) then - rmonomer_out = radius - fractaldim_out = 3.0_f - else - rmonomer_out = rmonomer - fractaldim_out = fractaldim - end if - - call fractal_meanfield(carma, & !! carma object - wavelength*1.0e4_f, & !! lambda in microns - rfi, & !! imaginary index of refraction - rfr, & !! real index of refraction - nmonomer, & !! number of monomers - falpha_in, & !! packing coefficient - fractaldim_out, & !! fractal dimension - rmonomer_out, & !! monomer size - 1.0_f, & !! xv,"set to 1" - 0.0_f, & !! angle, set to 0 - lqext, & !! extinction efficiency - lqsca, & !! scattering efficiency - lasym, & !! asymmetry parameter - rc) - - else - if (do_print) write(LUNOPRT, *) "mie::Unknown Mie routine specified." - rc = RC_ERROR - end if - - ! The mie code isn't perfect, so don't let it return values that aren't - ! physical. - lqext = max(lqext, 0._f) - lqsca = max(0._f, min(lqext, lqsca)) - lasym = max(-1.0_f, min(1.0_f, lasym)) - - return -end subroutine mie diff --git a/CARMAchem_GridComp/CARMA/source/base/miess.F90 b/CARMAchem_GridComp/CARMA/source/base/miess.F90 deleted file mode 100644 index 0cca466d..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/miess.F90 +++ /dev/null @@ -1,496 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This subroutine computes mie scattering by a stratified sphere, -!! i.e. a particle consisting of a spherical core surrounded by a -!! Spherical shell. The basic code used was that described in the -!! report: " Subroutines for computing the parameters of the -!! electromagnetic radiation scattered by a sphere " J.V. Dave, -!! IBM Scientific Center, Palo Alto , California. -!! Report No. 320 - 3236 .. May 1968 . -!! -!! The modifications for stratified spheres are described in -!! Toon and Ackerman, Appl. Optics, in press, 1981 -!! -!! The definitions for the output parameters can be found in "Light -!! scattering by small particles, H.C.Van de Hulst, John Wiley ' -!! Sons, Inc., New York, 1957". -!! -!! Also the subroutine computes the capital A function by making use of -!! downward recurrence relationship. -!! -!! @author Brian Toon -!! @version 1981? -SUBROUTINE miess(carma,RO,RFR,RFI,THETD,JX,QEXT,QSCAT,QBS,CTBRQS,R,RE2,TMAG2,WVNO,rc) - - ! types - use carma_precision_mod - use carma_constants_mod, only : IT, DEG2RAD - use carma_enums_mod, only : RC_ERROR - use carma_types_mod, only : carma_type - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: RO !! OUTER (SHELL) RADIUS - real(kind=f), intent(in) :: RFR !! REAL PART OF THE SHELL INDEX OF REFRACTION - real(kind=f), intent(in) :: RFI !! IMAGINARY PART OF THE SHELL INDEX OF REFRACTION - real(kind=f), intent(in) :: R !! CORE RADIUS - real(kind=f), intent(in) :: RE2 !! REAL PART OF THE CORE INDEX OF REFRACTION - real(kind=f), intent(in) :: TMAG2 !! IMAGINARY PART OF THE CORE INDEX OF REFRACTION - - !! ANGLE IN DEGREES BETWEEN THE DIRECTIONS OF THE INCIDENT - !! AND THE SCATTERED RADIATION. THETD(J) IS< OR= 90.0 - !! IF THETD(J) SHOULD HAPPEN TO BE GREATER THAN 90.0, ENTER WITH - !! SUPPLEMENTARY VALUE, SEE COMMENTS ON ELTRMX. - real(kind=f), intent(inout) :: THETD(IT) - - !! TOTAL NUMBER OF THETD FOR WHICH THE COMPUTATIONS ARE - !! REQUIRED. JX SHOULD NOT EXCEED IT UNLESS THE DIMENSIONS - !! STATEMENTS ARE APPROPRIATEDLY MODIFIED. - integer, intent(in) :: JX - - real(kind=f), intent(out) :: QEXT !! EFFICIENCY FACTOR FOR EXTINCTION,VAN DE HULST,P.14 ' 127. - real(kind=f), intent(out) :: QSCAT !! EFFICIENCY FACTOR FOR SCATTERING,V.D. HULST,P.14 ' 127. - real(kind=f), intent(out) :: QBS !! BACK SCATTER CROSS SECTION. - real(kind=f), intent(out) :: CTBRQS !! AVERAGE(COSINE THETA) * QSCAT,VAN DE HULST,P.128. - real(kind=f), intent(in) :: WVNO !! 2*PI / WAVELENGTH. - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f), parameter :: EPSILON_MIE = 1.e-14_f - - integer :: I - integer :: J - integer :: K - integer :: M - integer :: N - integer :: NN - integer :: NMX1 - integer :: NMX2 - integer :: IFLAG - integer :: IACAP - - ! FNAP, FNBP ARE THE PRECEDING VALUES OF FNA, FNB RESPECTIVELY. - complex(kind=f) :: FNAP, FNBP, & - FNA, FNB, RF, RRF, & - RRFX, WM1, FN1, FN2, & - TC1, TC2, WFN(2), Z(4), & - K1, K2, K3, & - RCR, U(8), DH1, & - DH2, DH4, P24H24, P24H21, & - PSTORE, HSTORE, DUMMY, DUMSQ - - complex(kind=f), allocatable :: ACAP(:), W(:,:) - - - ! TA(1): REAL PART OF WFN(1). TA(2): IMAGINARY PART OF WFN(1). - ! TA(3): REAL PART OF WFN(2). TA(4): IMAGINARY PART OF WFN(2). - real(kind=f) :: T(5), TA(4), & - PI(3,IT), TAU(3,IT), CSTHT(IT), SI2THT(IT), & - X, X1, X4, Y1, Y4, RX, SINX1, SINX4, COSX1, COSX4, & - EY1, E2Y1, EY4, EY1MY4, EY1PY4, AA, BB, CC, DD, DENOM, & - REALP, AMAGP, QBSR, QBSI, RMM, PIG, RXP4 - - !! ELTRMX(I,J,K): ELEMENTS OF THE TRANSFORMATION MATRIX F,V.D.HULST,P.34,45 ' 125. - !! I=1: ELEMENT M SUB 2..I=2: ELEMENT M SUB 1.. - !! I = 3: ELEMENT S SUB 21.. I = 4: ELEMENT D SUB 21.. - !! ELTRMX(I,J,1) REPRESENTS THE ITH ELEMENT OF THE MATRIX FOR - !! THE ANGLE THETD(J).. ELTRMX(I,J,2) REPRESENTS THE ITH ELEMENT - !! OF THE MATRIX FOR THE ANGLE 180.0 - THETD(J) .. - real(kind=f) :: ELTRMX(4,IT,2) - - - ! IF THE CORE IS SMALL SCATTERING IS COMPUTED FOR THE SHELL ONLY - IFLAG = 1 - if ( R/RO .LT. 1.e-6_f ) IFLAG = 2 - - if ( JX .gt. IT ) then - if (do_print) then - write(LUNOPRT, '(a,i3,a)') "miess:: The value of the argument JX=", & - JX, " is greater than IT." - end if - rc = RC_ERROR - return - endif - - RF = CMPLX( RFR, -RFI, kind=f ) - RCR = CMPLX( RE2, -TMAG2, kind=f ) - X = RO * WVNO - K1 = RCR * WVNO - K2 = RF * WVNO - K3 = CMPLX( WVNO, 0.0_f, kind=f ) - Z(1) = K2 * RO - Z(2) = K3 * RO - Z(3) = K1 * R - Z(4) = K2 * R - X1 = REAL( Z(1) ) - X4 = REAL( Z(4) ) - Y1 = aimag( Z(1) ) - Y4 = aimag( Z(4) ) - RRF = 1.0_f / RF - RX = 1.0_f / X - RRFX = RRF * RX - T(1) = ( X**2 ) * ( RFR**2 + RFI**2 ) - T(1) = SQRT( T(1) ) - NMX1 = 1.10_f * T(1) - - ! The dimension of ACAP. - ! - ! In the original program the dimension of ACAP was 7000. - ! For conserving space this should be not much higher than - ! The value, NMX1=1.1*(NREAL**2 + NIMAG**2)**.5 * X + 1 - IACAP = max(7000, int(1.5_f * NMX1)) - allocate(ACAP(IACAP)) - allocate(W(3,IACAP)) - - NMX2 = T(1) - - if ( NMX1 .le. 150 ) then - NMX1 = 150 - NMX2 = 135 - endif - - ACAP( NMX1+1 ) = ( 0.0_f, 0.0_f ) - - if ( IFLAG .ne. 2 ) then - do N = 1,3 - W( N,NMX1+1 ) = ( 0.0_f, 0.0_f ) - enddo - endif - - do N = 1,NMX1 - NN = NMX1 - N + 1 - ACAP(NN) = (NN+1) * RRFX - 1.0_f / ( (NN+1) * RRFX + ACAP(NN+1) ) - if ( IFLAG .ne. 2 ) then - do M = 1,3 - W( M,NN ) = (NN+1) / Z(M+1) - & - 1.0_f / ( (NN+1) / Z(M+1) + W( M,NN+1 ) ) - enddo - endif - enddo - - do J = 1,JX - if ( THETD(J) .lt. 0.0 ) THETD(J) = ABS( THETD(J) ) - - if ( THETD(J) .le. 0.0 ) then - CSTHT(J) = 1.0_f - SI2THT(J) = 0.0_f - else if ( THETD(J) .lt. 90.0_f ) then - T(1) = THETD(J) * DEG2RAD - CSTHT(J) = COS( T(1) ) - SI2THT(J) = 1.0_f - CSTHT(J)**2 - else if ( THETD(J) .le. 90.0_f ) then - CSTHT(J) = 0.0_f - SI2THT(J) = 1.0_f - else - if (do_print) then - write(LUNOPRT, '(a,i3)') "miess:: The value of the scattering angle & - &is greater than 90.0 Degrees. It is .", THETD(J) - end if - rc = RC_ERROR - return - end if - enddo - - do J = 1,JX - PI(1,J) = 0.0_f - PI(2,J) = 1.0_f - TAU(1,J) = 0.0_f - TAU(2,J) = CSTHT(J) - enddo - - ! INITIALIZATION OF HOMOGENEOUS SPHERE - T(1) = COS(X) - T(2) = SIN(X) - WM1 = CMPLX( T(1),-T(2), kind=f ) - WFN(1) = CMPLX( T(2), T(1), kind=f ) - TA(1) = T(2) - TA(2) = T(1) - WFN(2) = RX * WFN(1) - WM1 - TA(3) = REAL(WFN(2)) - TA(4) = aimag(WFN(2)) - - if ( IFLAG .ne. 2 ) then - N = 1 - - ! INITIALIZATION PROCEDURE FOR STRATIFIED SPHERE BEGINS HERE - SINX1 = SIN( X1 ) - SINX4 = SIN( X4 ) - COSX1 = COS( X1 ) - COSX4 = COS( X4 ) - EY1 = EXP( Y1 ) - E2Y1 = EY1 * EY1 - EY4 = EXP( Y4 ) - EY1MY4 = EXP( Y1 - Y4 ) - EY1PY4 = EY1 * EY4 - EY1MY4 = EXP( Y1 - Y4 ) - AA = SINX4 * ( EY1PY4 + EY1MY4 ) - BB = COSX4 * ( EY1PY4 - EY1MY4 ) - CC = SINX1 * ( E2Y1 + 1.0 ) - DD = COSX1 * ( E2Y1 - 1.0 ) - DENOM = 1.0_f + E2Y1 * ( 4.0_f * SINX1 * SINX1 - 2.0_f + E2Y1 ) - REALP = ( AA * CC + BB * DD ) / DENOM - AMAGP = ( BB * CC - AA * DD ) / DENOM - DUMMY = CMPLX( REALP, AMAGP, kind=f ) - AA = SINX4 * SINX4 - 0.5_f - BB = COSX4 * SINX4 - P24H24 = 0.5_f + CMPLX( AA,BB, kind=f ) * EY4 * EY4 - AA = SINX1 * SINX4 - COSX1 * COSX4 - BB = SINX1 * COSX4 + COSX1 * SINX4 - CC = SINX1 * SINX4 + COSX1 * COSX4 - DD = -SINX1 * COSX4 + COSX1 * SINX4 - P24H21 = 0.5_f * CMPLX( AA,BB, kind=f ) * EY1 * EY4 + 0.5_f * CMPLX( CC,DD, kind=f ) * EY1MY4 - DH4 = Z(4) / ( 1.0_f + ( 0.0_f, 1.0_f ) * Z(4) ) - 1.0_f / Z(4) - DH1 = Z(1) / ( 1.0_f + ( 0.0_f, 1.0_f ) * Z(1) ) - 1.0_f / Z(1) - DH2 = Z(2) / ( 1.0_f + ( 0.0_f, 1.0_f ) * Z(2) ) - 1.0_f / Z(2) - PSTORE = ( DH4 + N / Z(4) ) * ( W(3,N) + N / Z(4) ) - P24H24 = P24H24 / PSTORE - HSTORE = ( DH1 + N / Z(1) ) * ( W(3,N) + N / Z(4) ) - P24H21 = P24H21 / HSTORE - PSTORE = ( ACAP(N) + N / Z(1) ) / ( W(3,N) + N / Z(4) ) - DUMMY = DUMMY * PSTORE - DUMSQ = DUMMY * DUMMY - - ! NOTE: THE DEFINITIONS OF U(I) IN THIS PROGRAM ARE NOT THE SAME AS - ! THE USUBI DEFINED IN THE ARTICLE BY TOON AND ACKERMAN. THE - ! CORRESPONDING TERMS ARE: - ! USUB1 = U(1) USUB2 = U(5) - ! USUB3 = U(7) USUB4 = DUMSQ - ! USUB5 = U(2) USUB6 = U(3) - ! USUB7 = U(6) USUB8 = U(4) - ! RATIO OF SPHERICAL BESSEL FTN TO SPHERICAL HENKAL FTN = U(8) - - U(1) = K3 * ACAP(N) - K2 * W(1,N) - U(2) = K3 * ACAP(N) - K2 * DH2 - U(3) = K2 * ACAP(N) - K3 * W(1,N) - U(4) = K2 * ACAP(N) - K3 * DH2 - U(5) = K1 * W(3,N) - K2 * W(2,N) - U(6) = K2 * W(3,N) - K1 * W(2,N) - U(7) = ( 0.0_f, -1.0_f ) * ( DUMMY * P24H21 - P24H24 ) - U(8) = TA(3) / WFN(2) - - FNA = U(8) * ( U(1)*U(5)*U(7) + K1*U(1) - DUMSQ*K3*U(5) ) / & - ( U(2)*U(5)*U(7) + K1*U(2) - DUMSQ*K3*U(5) ) - FNB = U(8) * ( U(3)*U(6)*U(7) + K2*U(3) - DUMSQ*K2*U(6) ) / & - ( U(4)*U(6)*U(7) + K2*U(4) - DUMSQ*K2*U(6) ) - else - TC1 = ACAP(1) * RRF + RX - TC2 = ACAP(1) * RF + RX - FNA = ( TC1 * TA(3) - TA(1) ) / ( TC1 * WFN(2) - WFN(1) ) - FNB = ( TC2 * TA(3) - TA(1) ) / ( TC2 * WFN(2) - WFN(1) ) - endif - - FNAP = FNA - FNBP = FNB - T(1) = 1.50_f - - ! FROM HERE TO THE STATMENT NUMBER 90, ELTRMX(I,J,K) HAS - ! FOLLOWING MEANING: - ! ELTRMX(1,J,K): REAL PART OF THE FIRST COMPLEX AMPLITUDE. - ! ELTRMX(2,J,K): IMAGINARY PART OF THE FIRST COMPLEX AMPLITUDE. - ! ELTRMX(3,J,K): REAL PART OF THE SECOND COMPLEX AMPLITUDE. - ! ELTRMX(4,J,K): IMAGINARY PART OF THE SECOND COMPLEX AMPLITUDE. - ! K = 1 : FOR THETD(J) AND K = 2 : FOR 180.0 - THETD(J) - ! DEFINITION OF THE COMPLEX AMPLITUDE: VAN DE HULST,P.125. - FNA = T(1) * FNA - FNB = T(1) * FNB - - do J = 1,JX - TC1 = FNA * PI(2,J) + FNB * TAU(2,J) - TC2 = FNB * PI(2,J) + FNA * TAU(2,J) - ELTRMX(1,J,1) = real(TC1) - ELTRMX(2,J,1) = aimag(TC1) - ELTRMX(3,J,1) = real(TC2) - ELTRMX(4,J,1) = aimag(TC2) - TC1 = FNA * PI(2,J) - FNB * TAU(2,J) - TC2 = FNB * PI(2,J) - FNA * TAU(2,J) - ELTRMX(1,J,2) = real(TC1) - ELTRMX(2,J,2) = aimag(TC1) - ELTRMX(3,J,2) = real(TC2) - ELTRMX(4,J,2) = aimag(TC2) - enddo - - QEXT = 2.0_f * ( real(FNA) + real(FNB) ) - QSCAT = ( real(FNA)**2 + aimag(FNA)**2 + & - real(FNB)**2 + aimag(FNB)**2 ) / 0.75_f - CTBRQS = 0.0_f - TC1 = -2.0_f * (FNB - FNA) - QBSR = real(TC1) - QBSI = aimag(TC1) - RMM = -1.0_f - N = 2 - - ! Iterate until the answer converges. - T(4) = EPSILON_MIE - - do while ( T(4) .ge. EPSILON_MIE ) - - T(1) = 2*N - 1 - T(2) = N - 1 - T(3) = 2*N + 1 - - do J = 1,JX - PI(3,J) = ( T(1) * PI(2,J) * CSTHT(J) - N * PI(1,J) ) / T(2) - TAU(3,J) = CSTHT(J) * ( PI(3,J) - PI(1,J) ) - & - T(1) * SI2THT(J) * PI(2,J) + TAU(1,J) - end do - - ! HERE SET UP HOMOGENEOUS SPHERE - WM1 = WFN(1) - WFN(1) = WFN(2) - TA(1) = REAL(WFN(1)) - TA(2) = aimag(WFN(1)) - TA(4) = aimag(WFN(2)) - WFN(2) = T(1) * RX * WFN(1) - WM1 - TA(3) = REAL(WFN(2)) - - if ( IFLAG .ne. 2 ) then - - ! HERE SET UP STRATIFIED SPHERE - DH2 = - N / Z(2) + 1.0_f / ( N / Z(2) - DH2 ) - DH4 = - N / Z(4) + 1.0_f / ( N / Z(4) - DH4 ) - DH1 = - N / Z(1) + 1.0_f / ( N / Z(1) - DH1 ) - PSTORE = ( DH4 + N / Z(4) ) * ( W(3,N) + N / Z(4) ) - P24H24 = P24H24 / PSTORE - HSTORE = ( DH1 + N / Z(1) ) * ( W(3,N) + N / Z(4) ) - P24H21 = P24H21 / HSTORE - PSTORE = ( ACAP(N) + N / Z(1) ) / ( W(3,N) + N / Z(4) ) - DUMMY = DUMMY * PSTORE - DUMSQ = DUMMY * DUMMY - - U(1) = K3 * ACAP(N) - K2 * W(1,N) - U(2) = K3 * ACAP(N) - K2 * DH2 - U(3) = K2 * ACAP(N) - K3 * W(1,N) - U(4) = K2 * ACAP(N) - K3 * DH2 - U(5) = K1 * W(3,N) - K2 * W(2,N) - U(6) = K2 * W(3,N) - K1 * W(2,N) - U(7) = ( 0.0_f, -1.0_f ) * ( DUMMY * P24H21 - P24H24 ) - U(8) = TA(3) / WFN(2) - - FNA = U(8) * ( U(1)*U(5)*U(7) + K1*U(1) - DUMSQ*K3*U(5) ) / & - ( U(2)*U(5)*U(7) + K1*U(2) - DUMSQ*K3*U(5) ) - FNB = U(8) * ( U(3)*U(6)*U(7) + K2*U(3) - DUMSQ*K2*U(6) ) / & - ( U(4)*U(6)*U(7) + K2*U(4) - DUMSQ*K2*U(6) ) - endif - - TC1 = ACAP(N) * RRF + N * RX - TC2 = ACAP(N) * RF + N * RX - FN1 = ( TC1 * TA(3) - TA(1) ) / ( TC1 * WFN(2) - WFN(1) ) - FN2 = ( TC2 * TA(3) - TA(1) ) / ( TC2 * WFN(2) - WFN(1) ) - M = WVNO * R - - if ( N .ge. M ) then - if ( IFLAG .ne. 2 ) then - if ( abs( ( FN1-FNA ) / FN1 ) .LT. EPSILON_MIE .AND. & - abs( ( FN2-FNB ) / FN2 ) .LT. EPSILON_MIE ) IFLAG = 2 - - if ( IFLAG .ne. 1 ) then - FNA = FN1 - FNB = FN2 - endif - else - FNA = FN1 - FNB = FN2 - endif - endif - - T(5) = N - T(4) = T(1) / ( T(5) * T(2) ) - T(2) = ( T(2) * ( T(5) + 1.0_f ) ) / T(5) - - CTBRQS = CTBRQS + T(2) * ( real(FNAP) * real(FNA) + & - aimag(FNAP) *aimag(FNA) & - + real(FNBP) * real(FNB) + & - aimag(FNBP) *aimag(FNB) ) & - + T(4) * ( real(FNAP) * real(FNBP) + & - aimag(FNAP) *aimag(FNBP) ) - QEXT = QEXT + T(3) * ( real(FNA) + real(FNB) ) - - ! $ T(3), real(FNA), real(FNB), QEXT - T(4) = real(FNA)**2 + aimag(FNA)**2 + & - real(FNB)**2 + aimag(FNB)**2 - QSCAT = QSCAT + T(3) * T(4) - RMM = -RMM - TC1 = T(3)*RMM*(FNB - FNA) - QBSR = QBSR + real(TC1) - QBSI = QBSI + aimag(TC1) - - T(2) = N * (N+1) - T(1) = T(3) / T(2) - K = (N/2)*2 - - do J = 1,JX - TC1 = FNA * PI(3,J) + FNB * TAU(3,J) - TC2 = FNB * PI(3,J) + FNA * TAU(3,J) - ELTRMX(1,J,1) = ELTRMX(1,J,1)+T(1)* real(TC1) - ELTRMX(2,J,1) = ELTRMX(2,J,1)+T(1)*aimag(TC1) - ELTRMX(3,J,1) = ELTRMX(3,J,1)+T(1)* real(TC2) - ELTRMX(4,J,1) = ELTRMX(4,J,1)+T(1)*aimag(TC2) - - IF ( K .EQ. N ) THEN - TC1 = -FNA * PI(3,J) + FNB * TAU(3,J) - TC2 = -FNB * PI(3,J) + FNA * TAU(3,J) - ELSE - TC1 = FNA * PI(3,J) - FNB * TAU(3,J) - TC2 = FNB * PI(3,J) - FNA * TAU(3,J) - END IF - ELTRMX(1,J,2) = ELTRMX(1,J,2)+T(1)* real(TC1) - ELTRMX(2,J,2) = ELTRMX(2,J,2)+T(1)*aimag(TC1) - ELTRMX(3,J,2) = ELTRMX(3,J,2)+T(1)* real(TC2) - ELTRMX(4,J,2) = ELTRMX(4,J,2)+T(1)*aimag(TC2) - - enddo - - if ( T(4) .ge. EPSILON_MIE ) then - N = N + 1 - - do J = 1,JX - PI(1,J) = PI(2,J) - PI(2,J) = PI(3,J) - TAU(1,J) = TAU(2,J) - TAU(2,J) = TAU(3,J) - enddo - - FNAP = FNA - FNBP = FNB - - if ( N .gt. NMX2 ) then - if (do_print) write(LUNOPRT, '(a)') "miess:: The upper limit for acap is not enough." - rc = RC_ERROR - return - endif - endif - enddo - - ! Calculate the results. - do J = 1,JX - do K = 1,2 - do I= 1,4 - T(I) = ELTRMX(I,J,K) - enddo - - ELTRMX(2,J,K) = T(1)**2 + T(2)**2 - ELTRMX(1,J,K) = T(3)**2 + T(4)**2 - ELTRMX(3,J,K) = T(1) * T(3) + T(2) * T(4) - ELTRMX(4,J,K) = T(2) * T(3) - T(4) * T(1) - enddo - enddo - - T(1) = 2.0_f * RX**2 - QEXT = QEXT * T(1) - QSCAT = QSCAT * T(1) - CTBRQS = 2.0_f * CTBRQS * T(1) - - ! QBS IS THE BACK SCATTER CROSS SECTION - PIG = ACOS(-1.0_f) - RXP4 = RX*RX/(4.0_f*PIG) - QBS = RXP4*(QBSR**2 + QBSI**2) - - deallocate(ACAP) - deallocate(W) - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/newstate.F90 b/CARMAchem_GridComp/CARMA/source/base/newstate.F90 deleted file mode 100644 index f1762f17..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/newstate.F90 +++ /dev/null @@ -1,245 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine manages the calculations that update state variables -!! of the model with new values at the current simulation time. -!! -!! @author Bardeen -!! @version Jan 2012 -subroutine newstate(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - real(kind=f) :: pc_orig(NZ,NBIN,NELEM) - real(kind=f) :: gc_orig(NZ,NGAS) - real(kind=f) :: t_orig(NZ) - real(kind=f) :: cldfrc_orig(NZ) - real(kind=f) :: scale_cldfrc(NZ) - real(kind=f) :: pc_cloudy(NZ,NBIN,NELEM) - real(kind=f) :: gc_cloudy(NZ,NGAS) - real(kind=f) :: t_cloudy(NZ) - real(kind=f) :: rlheat_cloudy(NZ) - real(kind=f) :: partheat_cloudy(NZ) - real(kind=f) :: zsubsteps_cloudy(NZ) - real(kind=f) :: pc_clear(NZ,NBIN,NELEM) - real(kind=f) :: gc_clear(NZ,NGAS) - real(kind=f) :: t_clear(NZ) - real(kind=f) :: rlheat_clear(NZ) - real(kind=f) :: partheat_clear(NZ) - real(kind=f) :: zsubsteps_clear(NZ) - real(kind=f) :: scale_threshold(NZ) - integer :: igroup - integer :: igas - integer :: ielem - integer :: ibin - integer :: iz - - - ! Calculate changes due to vertical transport - if (do_vtran) then - - call vertical(carma, cstate, rc) - if (rc < RC_OK) return - endif - - - ! There can be two phases to the microphysics: in-cloud and clear sky. Particles - ! that are tagged as "In-cloud" will only be processed in the in-cloud loop, and their - ! concentrations will be scaled by the cloud fraction since it is assumed to be all - ! in-cloud. Other particle types will be process in-cloud and out of cloud; however, - ! their mass is assumed to be a gridbox average. - - ! If doing doing in-cloud processing, then scale the parameters for in-cloud concentrations. - ! - ! NOTE: Don't want to do this before sedimentation, since sedimentation doesn't take into - ! account the varying cloud fractions, and thus a particle scaled at one level and cloud - ! fraction would be scaled inappropriately at another level and cloud fraction. - ! - ! NOTE: All detrainment also happens only in the in-cloud portion. - if (do_incloud) then - - ! First do the in-cloud processing. - - ! Convert "cloud" particles to in-cloud values. - ! - ! NOTE: If a particle is a "cloud" particle, it means that the entire mass of the - ! particle is in the incloud portion of the grid box. Particle that are not "cloud - ! particles" have their mass spread throughout the grid box. - pc_orig(:,:,:) = pc(:,:,:) - gc_orig(:,:) = gc(:,:) - t_orig(:) = t(:) - - ! If the cloud fraction gets too small it causes the microphysics to require a - ! lot of substeps. Enforce a minimum cloud fraction for the purposes of scaling - ! to incloud values. - scale_cldfrc(:) = max(CLDFRC_MIN, cldfrc(:)) - scale_cldfrc(:) = min(1._f - CLDFRC_MIN, scale_cldfrc(:)) - - do ielem = 1, NELEM - igroup = igelem(ielem) - - if (is_grp_cloud(igroup)) then - do ibin = 1, NBIN - pc(:, ibin, ielem) = pc(:, ibin, ielem) / scale_cldfrc(:) - pcd(:, ibin, ielem) = pcd(:, ibin, ielem) / scale_cldfrc(:) - end do - end if - end do - - call newstate_calc(carma, cstate, scale_cldfrc(:), rc) - if (rc < RC_OK) return - - ! Save the new in-cloud values for the gas, particle and temperature fields. - pc_cloudy(:,:,:) = pc(:,:,:) - gc_cloudy(:,:) = gc(:,:) - t_cloudy(:) = t(:) - rlheat_cloudy(:) = rlheat(:) - partheat_cloudy(:) = partheat(:) - - if (do_substep) zsubsteps_cloudy(:) = zsubsteps(:) - - - - ! Now do the clear sky portion, using the original gridbox average concentrations. - ! This is optional. If clear sky is not selected then all of the microphysics is - ! done in-cloud. - pc(:,:,:) = pc_orig(:,:,:) - gc(:,:) = gc_orig(:,:) - t(:) = t_orig(:) - - if (do_clearsky) then - - ! Convert "cloud" particles to clear sky values. - ! - ! NOTE: If a particle is a "cloud" particle, it means that the entire mass of the - ! particle is in the in-cloud portion of the grid box. They have no mass in the - ! clear sky portion. - do ielem = 1, NELEM - igroup = igelem(ielem) - - if (is_grp_cloud(igroup)) then - pc(:, :, ielem) = 0._f - pcd(:, :, ielem) = 0._f - end if - end do - - ! Don't let the supersaturation be scaled by setting the cloud fraction used - ! by the saturation code to 1.0. Any clouds formed in-situ in the clear sky - ! are assumed to fill the grid box. - cldfrc_orig(:) = cldfrc(:) - cldfrc(:) = 1._f - - ! Recalculate supersaturation. - do igas = 1, NGAS - do iz = 1, NZ - call supersat(carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - end do - end do - - call newstate_calc(carma, cstate, (1._f - scale_cldfrc(:)), rc) - if (rc < RC_OK) return - - ! Restore the cloud fraction - cldfrc(:) = cldfrc_orig(:) - - ! Save the new clear sky values for the gas, particle and temperature fields. - pc_clear(:,:,:) = pc(:,:,:) - gc_clear(:,:) = gc(:,:) - t_clear(:) = t(:) - rlheat_clear(:) = rlheat(:) - partheat_clear(:) = partheat(:) - - if (do_substep) zsubsteps_clear(:) = zsubsteps(:) - - ! If not doing a clear sky calculation, then the clear sky portion reamins - ! the same except for any contribution from advection. - else - - ! NOTE: If a particle is a "cloud" particle, it means that the entire mass of the - ! particle is in the in-cloud portion of the grid box. They have no mass in the - ! clear sky portion. - do ielem = 1, NELEM - igroup = igelem(ielem) - - if (is_grp_cloud(igroup)) then - pc_clear(:, :, ielem) = 0._f - else - pc_clear(:, :, ielem) = pc(:, :, ielem) - end if - end do - - do igas = 1, NGAS - gc_clear(:,:) = gc(:,:) - end do - - t_clear(:) = t(:) - rlheat_clear(:) = 0._f - partheat_clear(:) = 0._f - - ! If substepping, then add the advected part that is being doled out over - ! the substeps. - if (do_substep) then - do igas = 1, NGAS - gc_clear(:, igas) = gc_clear(:, igas) + d_gc(:, igas) - end do - t_clear(:) = t_clear(:) + d_t(:) - - zsubsteps_clear(:) = 0._f - end if - end if - - - ! Add up the changes to the particle from the cloudy and clear sky components. - do ielem = 1, NELEM - igroup = igelem(ielem) - - do ibin = 1, NBIN - pc(:, ibin, ielem) = (1._f - scale_cldfrc(:)) * pc_clear(:, ibin, ielem) + scale_cldfrc(:) * pc_cloudy(:, ibin, ielem) - end do - end do - - t(:) = (1._f - scale_cldfrc(:)) * t_clear(:) + scale_cldfrc(:) * t_cloudy(:) - - if (do_grow) then - rlheat(:) = (1._f - scale_cldfrc(:)) * rlheat_clear(:) + scale_cldfrc(:) * rlheat_cloudy(:) - partheat(:) = (1._f - scale_cldfrc(:)) * partheat_clear(:) + scale_cldfrc(:) * partheat_cloudy(:) - end if - - do igas = 1, NGAS - gc(:, igas) = (1._f - scale_cldfrc(:)) * gc_clear(:, igas) + scale_cldfrc(:) * gc_cloudy(:, igas) - - ! Recalculate gridbox average supersaturation. - do iz = 1, NZ - call supersat(carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - end do - end do - - if (do_substep) zsubsteps(:) = zsubsteps_clear(:) + zsubsteps_cloudy(:) - - - - ! No special in-cloud/clear sky processing, everything is gridbox average. - else - scale_threshold(:) = 1._f - call newstate_calc(carma, cstate, scale_threshold, rc) - if (rc < RC_OK) return - end if - - ! Return to caller with new state computed - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/newstate_calc.F90 b/CARMAchem_GridComp/CARMA/source/base/newstate_calc.F90 deleted file mode 100644 index aa9bcbf4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/newstate_calc.F90 +++ /dev/null @@ -1,292 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine manages the calculations that update state variables -!! of the model with new values at the current simulation time. It supports -!! a retry mechanism, so the the number of steps can be increased dynamically -!! if the fast microphysics was not able to generate a valid solution. The -!! validity of the solution is control by the convergence thresholds -!! (dgc_threshold, dt_threshold and ds_threshold) -!! -!! NOTE: For cloud models, this routine may get called multiple times, once for -!! in-cloud calculations and again for clear sky. -!! -!! @author Bardeen -!! @version Jan 2012 -subroutine newstate_calc(carma, cstate, scale_threshold, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - real(kind=f), intent(in) :: scale_threshold(NZ) !! Scaling factor for convergence thresholds - integer, intent(inout) :: rc !! return code, negative indicates failure - - real(kind=f) :: sedlayer(NBIN,NELEM) - real(kind=f) :: pcd_last(NBIN,NELEM) - integer :: kb - integer :: ke - integer :: idk - integer :: iz - integer :: isubstep - integer :: igroup - integer :: igas - integer :: ielem - integer :: ibin - integer :: ntsubsteps - logical :: takeSteps - real(kind=f) :: fraction ! Fraction of dT, dgc and pdc to be added in a substep. - - 1 format(/,'newstate::ERROR - Substep failed, maximum retries execeed. : iz=',i4,',isubstep=',i12, & - ',ntsubsteps=',i12,',nretries=',F9.0) - - - ! Redetermine the maximum particle values. - if ((do_vtran) .or. do_incloud) then - do iz = 1, NZ - call maxconc(carma, cstate, iz, rc) - if (rc < RC_OK) return - end do - end if - - ! Calculate changes in particle concentrations due to microphysical - ! processes, part 1. (potentially slower microphysical calcs) - ! All spatial points are handled by one call to this routine. - if (do_coag) then - call microslow(carma, cstate, rc) - if (rc < RC_OK) return - endif - - ! If there is any microsphysics that happens on a faster time scale, - ! then check to see if the time step needs to be subdivided and then - ! perform the fast microphysical calculations. - if (do_grow) then - - ! Set vertical loop index to increment downwards - ! (for substepping of sedimentation) - if (igridv .eq. I_CART) then - kb = NZ - ke = 1 - idk = -1 - else - kb = 1 - ke = NZ - idk = 1 - endif - - ! Initialize sedimentation source to zero at top of model - dpc_sed(:,:) = 0._f - - ! Save the results from the slow operations, since we might need to retry the - ! fast operations - pcl(:,:,:) = pc(:,:,:) - - if (do_substep) then - do igas = 1,NGAS - gcl(:,igas) = gc(:,igas) - end do - told(:) = t(:) - endif - - - do iz = kb,ke,idk - - ! Compute or specify number of sub-timestep intervals for current spatial point - ! (Could be same for all spatial pts, or could vary as a function of location) - ntsubsteps = minsubsteps - - call nsubsteps(carma, cstate, iz, dtime_orig, ntsubsteps, rc) - if (rc < RC_OK) return - - ! Grab sedimentation source for entire step for this layer - ! and set accumlated source for underlying layer to zero - sedlayer(:,:) = dpc_sed(:,:) - - ! Do sub-timestepping for current spatial grid point, and allow for - ! retrying should this level of substepping not be enough to keep the - ! gas concentration from going negative. - nretries = 0._f - takeSteps = .true. - - do while (takeSteps) - - ! Compute sub-timestep time interval for current spatial grid point - dtime = dtime_orig / ntsubsteps - - ! Don't retry unless requested. - takeSteps = .false. - - ! Reset the amount that has been collected to sedimented down to the - ! layer below. - dpc_sed(:,:) = 0._f - - ! Reset the total nucleation for the step. - pc_nucl(iz,:,:) = 0._f - - ! Remember the amount of detrained particles. - if (do_detrain) then - pcd_last(:,:) = pcd(iz,:,:) - end if - - ! Reset average heating rates. - rlheat(iz) = 0._f - partheat(iz) = 0._f - - do isubstep = 1,ntsubsteps - - ! If substepping, then increment the gas concentration and the temperature by - ! an amount for one substep. - if (do_substep) then - - ! Since we don't really know how the gas and temperature changes arrived during the - ! step, we can try different assumptions for how the gas and temperature are add to - ! the values from the previous substep. - - ! Linear increment for substepping. - fraction = 1._f / ntsubsteps - - do igas = 1,NGAS - gc(iz,igas) = gc(iz,igas) + d_gc(iz,igas) * fraction - enddo - - t(iz) = t(iz) + d_t(iz) * fraction - - - ! Detrainment puts the full gridbox amount into the incloud portion. - if (do_detrain) then - pc(iz,:,:) = pc(iz,:,:) + pcd_last(:,:) * fraction - pcd(iz,:,:) = pcd(iz,:,:) - pcd_last(:,:) * fraction - end if - endif - - - ! Redetermine maximum particle concentrations. - call maxconc(carma, cstate, iz, rc) - if (rc < RC_OK) return - - ! Calculate changes in particle concentrations for current spatial point - ! due to microphysical processes, part 2. (faster microphysical calcs) - call microfast(carma, cstate, iz, scale_threshold(iz), rc) - if (rc < RC_OK) return - - - ! If there was a retry warning message and substepping is enabled, then retry - ! the operation with more substepping. - if (rc == RC_WARNING_RETRY) then - if (do_substep) then - - ! Only retry for so long ... - nretries = nretries + 1 - - if (nretries > maxretries) then - if (do_pfast) then - if (nretries > maxretries+1) then - if (do_print) write(LUNOPRT,1) iz, isubstep, ntsubsteps, -1._f*nretries - rc = RC_ERROR - exit - endif - rc = RC_WARNING_PFAST - else - if (do_print) write(LUNOPRT,1) iz, isubstep, ntsubsteps, nretries - 1._f - rc = RC_ERROR - exit - end if - end if - - ! Try twice the substeps - ! - ! NOTE: We are going to rely upon retries, so don't clutter the log - ! with retry print statements. They slow down the run. - if (rc == RC_WARNING_PFAST) then - ntsubsteps = minsubsteps - else - ntsubsteps = ntsubsteps * 2 - endif - -! if (do_print) write(LUNOPRT,*) "newstate::WARNING - Substep failed, retrying with ", ntsubsteps, " substeps." - - ! Reset the state to the beginning of the step - pc(iz,:,:) = pcl(iz,:,:) - pcd(iz,:,:) = pcd_last(:,:) - t(iz) = told(iz) - do igas = 1,NGAS - gc(iz,igas) = gcl(iz,igas) - - ! Now that we have reset the gas concentration, we need to recalculate the supersaturation. - call supersat(carma, cstate, iz, igas, rc) - if (rc < RC_OK) return - end do - - if (rc == RC_WARNING_RETRY) rc = RC_OK - takeSteps = .true. - exit - - - ! If substepping is not enabled, than the retry warning should be treated as an error. - else - - if (do_print) write(LUNOPRT,*) "newstate::ERROR - Step failed, suggest enabling substepping." - rc = RC_ERROR - exit - end if - end if - end do - end do - - - ! Keep track of substepping and retry statistics for performance tuning. - max_nsubstep = max(max_nsubstep, ntsubsteps) - max_nretry = max(max_nretry, nretries) - - nstep = nstep + 1._f - nsubstep = nsubstep + ntsubsteps - nretry = nretry + nretries - - if (rc == RC_WARNING_PFAST) rc = RC_OK - - if (do_substep) zsubsteps(iz) = ntsubsteps - end do - - ! Restore normal timestep - dtime = dtime_orig - - else - - ! If there is no reason to substep, but substepping was enabled, get the gas and - ! temperature back to their final states. - if (do_substep) then - - do igas = 1,NGAS - gc(:,igas) = gc(:,igas) + d_gc(:,igas) - enddo - - t(:) = t(:) + d_t(:) - end if - - ! Do the detrainment, if it was being done in the growth loop. - if (do_detrain) then - pc(:,:,:) = pc(:,:,:) + pcd(:,:,:) - - ! Remove the ice from the detrained ice, so that total ice will be conserved. - pcd(:,:,:) = 0._f - end if - end if - - ! Calculate average heating rates. - if (do_grow) then - rlheat(:) = rlheat(:) / dtime - partheat(:) = partheat(:) / dtime - end if - - ! Return to caller with new state computed - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/nsubsteps.F90 b/CARMAchem_GridComp/CARMA/source/base/nsubsteps.F90 deleted file mode 100644 index da85209b..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/nsubsteps.F90 +++ /dev/null @@ -1,191 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the number of sub-timesteps -!! for the current model spatial point. -!! -!! @author Eric Jensen -!! @version Apr-2000 -subroutine nsubsteps(carma, cstate, iz, dtime_save, ntsubsteps, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use ieee_arithmetic - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(in) :: dtime_save !! original (not substepped) dtime - integer, intent(inout) :: ntsubsteps !! suggested number of substeps - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ig ! group index - integer :: igas ! gas index - integer :: ibin ! bin index - integer :: iepart - integer :: inuc - integer :: ienucto - integer :: ibin_small(NGROUP) - real(kind=f) :: g0 - real(kind=f) :: g1 - real(kind=f) :: dmdt - real(kind=f) :: dt_adv - real(kind=f) :: ss - real(kind=f) :: ssold - real(kind=f) :: pvap - real(kind=f) :: vf_max - - - ! If substepping is disabled, then use one substep - if (.not. do_substep) then - ntsubsteps = 1 - else - ! Set default values - ntsubsteps = minsubsteps - - ! Find the bin number of the smallest particle bin that - ! contains a significant number of particles. - ! Also check for significant activation of water droplets. - - if( ntsubsteps .lt. maxsubsteps )then - - do ig = 1, NGROUP - - if( pconmax(iz,ig) .gt. FEW_PC) then - - ibin_small(ig) = NBIN - - ! element of particle number concentration - iepart = ienconc(ig) - - if( itype(iepart) .eq. I_INVOLATILE ) then - - ! condensing gas - igas = inucgas(ig) - - if (igas /= 0) then - - ss = max( supsatl(iz,igas), supsatlold(iz,igas) ) - - do inuc = 1,nnuc2elem(iepart) - ienucto = inuc2elem(inuc,iepart) - - if( inucproc(iepart,ienucto) .eq. I_DROPACT ) then - do ibin = 1, NBIN -! if( pc(iz,ibin,iepart) / xmet(iz) / ymet(iz) / zmet(iz) .gt. conmax * pconmax(iz,ig) .and. & - if( pc(iz,ibin,iepart) .gt. conmax * pconmax(iz,ig) * xmet(iz) * ymet(iz) * zmet(iz) .and. & - ss .gt. scrit(iz,ibin,ig) )then - ntsubsteps = maxsubsteps - endif - enddo - endif - enddo - endif - - elseif( itype(iepart) .eq. I_VOLATILE ) then - - do ibin = NBIN-1, 1, -1 - ! Check the presence of NaN or Inf - ! PAC: Why is this done with "print" instead of "write" like - ! the rest of the error messages? - if(ieee_is_nan(pc(iz,ibin,iepart))) print *, 'pc isnan', iz, & - ibin, iepart, pc(iz,ibin,iepart), pconmax(iz,ig) - if(ieee_is_nan(pconmax(iz,ig))) print *, 'pconmax isnan', iz, & - ibin, iepart, pc(iz,ibin,iepart), pconmax(iz,ig) - if(.not. ieee_is_finite(pc(iz,ibin,iepart))) print *, 'pc isinf', & - iz, ibin, iepart, pc(iz,ibin,iepart), pconmax(iz,ig) - if(.not. ieee_is_finite(pconmax(iz,ig))) print *, 'pconmax isinf', & - iz, ibin, iepart, pc(iz,ibin,iepart), pconmax(iz,ig) - if( pc(iz,ibin,iepart)/pconmax(iz,ig) .gt. conmax * xmet(iz) * ymet(iz) * zmet(iz))then - ibin_small(ig) = ibin - endif - enddo - - endif - endif - enddo - endif - - ! Calculate the growth rate of a particle with the mode radius for - ! each volatile group. The maximum time-step to use is then the - ! mass growth rate divided by the mass bin width / 2. - if( ntsubsteps .lt. maxsubsteps )then - - dt_adv = dtime_save - do ig = 1, NGROUP - - ! element of particle number concentration - iepart = ienconc(ig) - - ! condensing gas - igas = igrowgas(iepart) - - if (igas /= 0) then - - if( pconmax(iz,ig) .gt. FEW_PC ) then - - if( itype(iepart) .eq. I_VOLATILE ) then - - if( is_grp_ice(ig) )then - ss = supsati(iz,igas) - pvap = pvapi(iz,igas) - else - ss = supsatl(iz,igas) - pvap = pvapl(iz,igas) - endif - - g0 = gro(iz,ibin_small(ig),ig) - g1 = gro1(iz,ibin_small(ig),ig) - dmdt = abs( pvap * ss * g0 / ( 1._f + g0*g1*pvap ) ) - - if (dmdt /= 0._f) then - dt_adv = min( dt_adv, dm(ibin_small(ig),ig)/dmdt ) - end if - endif - endif - endif - enddo - - ntsubsteps = nint(min(real(maxsubsteps, kind=f), real(dtime_save, kind=f) / dt_adv)) - ntsubsteps = max( minsubsteps, ntsubsteps ) - endif - - ! If the ice supersaturation is large enough for homogeneous freezing - ! of sulfate aerosols, then use maximum number of substeps - if( ntsubsteps .lt. (maxsubsteps) )then - do ig = 1, NGROUP - - ! element of particle number concentration - iepart = ienconc(ig) - - ! condensing gas - igas = inucgas(ig) - - if (igas /= 0) then - - do inuc = 1,nnuc2elem(iepart) - ienucto = inuc2elem(inuc,iepart) - - if (iand(inucproc(iepart,ienucto), I_AERFREEZE) .ne. 0) then - if( (supsati(iz,igas) .gt. 0.4_f) .and. (t(iz) .lt. 233.16_f) ) then - ntsubsteps = maxsubsteps - endif - endif - enddo - endif - enddo - endif - endif - - ! Return to caller with number of sub-timesteps evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/pfastdmdt.F90 b/CARMAchem_GridComp/CARMA/source/base/pfastdmdt.F90 deleted file mode 100644 index b23c3edd..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/pfastdmdt.F90 +++ /dev/null @@ -1,68 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine normalizes dmdt as to not make gas concentration go negative. -!! -!! @author Parker Case -!! @version Mar-2024 -subroutine pfastdmdt(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: rvap - real(kind=f) :: gc_cgs - real(kind=f) :: gc_target - real(kind=f) :: scalefactor - integer :: igroup - integer :: ielem - integer :: igas - integer :: ibin - - do igroup = 1,NGROUP - - ielem = ienconc(igroup) ! element of particle number concentration - - igas = igrowgas(ielem) ! condensing gas - - if ((itype(ielem) == I_VOLATILE) .and. (igas /= 0)) then - - ! Calculate vapor pressures. - call vaporp(carma, cstate, iz, igas, rc) - - ! Define gas constant for this gas - rvap = RGAS / gwtmol(igas) - - ! Current gas concentration - gc_cgs = gc(iz,igas) / (zmet(iz)*xmet(iz)*ymet(iz)) - - ! Gas concentration at equilibrium - gc_target = pvapl(iz,igas) / (rvap * t(iz)) - - ! Determine total mass added to bins in implicit timestep - scalefactor = sum((pc(iz,:,ielem) - pcl(iz,:,ielem))*rmass(:,igroup))/(gc_cgs - gc_target) - - ! Loop through bins and apply correction - do ibin = 1,NBIN - pc(iz,ibin,ielem) = pcl(iz,ibin,ielem) + (pc(iz,ibin,ielem) - pcl(iz,ibin,ielem)) / scalefactor - end do - end if - - end do - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/pheat.F90 b/CARMAchem_GridComp/CARMA/source/base/pheat.F90 deleted file mode 100644 index cb930f14..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/pheat.F90 +++ /dev/null @@ -1,373 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluate particle loss rates due to particle heating. -!! -!! The net energy absorbed by each particle is calculatated as , and -!! this heating rate is included in the caclulation of in growevapl. The -!! particle temperature perturbation realtive to atmospheric temperature -!! and the radiative heating of the atmosphere by particles -!! are also calculated. -!! -!! This algorithm is based upon the model described in the appendix of -!! Toon et al., J. Geophys. Res., 94, 11359-11380, 1989. -!! -!! This routine assumes that the following variable/tables have already been -!! set up: -!! -!! intensity of incoming radiance (solar+ir) [erg/cm2/sr/s/cm] -!! wavelengths used for integration [cm] -!! width of wavelength bands for integration [cm] -!! whether planck emission should be doen for the band -!! extinction [cm2] -!! single scattering albedo -!! -!! @author Chuck Bardeen -!! @version Jan-2010 -subroutine pheat(carma, cstate, iz, igroup, iepart, ibin, igas, dmdt, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - use planck, only : planckIntensity, planckBandIntensity, planckBandIntensityWidger1976, planckBandIntensityConley2011 - - implicit none - - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! vertical index - integer, intent(in) :: igroup !! group index - integer, intent(in) :: iepart !! group's concentration element index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: igas !! gas index - real(kind=f), intent(out) :: dmdt !! particle growth rate (g/s) - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer, parameter :: MAX_ITER = 10 ! Maximum number of iterations - real(kind=f), parameter :: DDTP_LIMIT = 0.01_f ! Convergence criteria for iteration. - - integer :: iter ! iteration - integer :: iwvl ! wavelength band index - integer :: ieother(NELEM) - integer :: nother - integer :: ieoth_rel - integer :: ieoth_abs - integer :: jother - integer :: isol - real(kind=f) :: otherm(NELEM) - real(kind=f) :: argsol - real(kind=f) :: othermtot - real(kind=f) :: othervtot - real(kind=f) :: condm - real(kind=f) :: condv - real(kind=f) :: volfrc - real(kind=f) :: akas - real(kind=f) :: expon - real(kind=f) :: g0 - real(kind=f) :: g1 - real(kind=f) :: g2 - real(kind=f) :: ss - real(kind=f) :: pvap - real(kind=f) :: qrad ! particle net radiation (erg/s) -! real(kind=f) :: qrad0 ! particle net radiation (Tp=Ta) (erg/s) - real(kind=f) :: rlh ! latent heat (erg/g) - real(kind=f) :: tp ! particle temperature (K) - real(kind=f) :: dtp ! change in particle temperature (K) - real(kind=f) :: dtpl ! last change in particle temperature (K) - real(kind=f) :: ddtp ! change in particle temperature in last iteration (K) - real(kind=f) :: plkint ! planck intensity - - ! is combined kelvin (curvature) and solute factors. - ! - ! Ignore solute factor for ice particles. - if( is_grp_ice(igroup) )then - expon = akelvini(iz,igas) / rup_wet(iz,ibin,igroup) - - ! Ice can't be neutralized, so set the volume fraction to 0. - volfrc = 0._f - else - - argsol = 0._f - - ! Consider growth of average particle at radius . - ! - ! Treat solute effect first: is solute factor. - ! - ! Only need to treat solute effect if > 1 - if( nelemg(igroup) .gt. 1 )then - - ! is mass concentration of condensed gas in particle. - ! is number of other elements in group having mass. - ! are mass concentrations of other elements in particle group. - ! is total mass concentrations of other elements in particle. - nother = 0 - othermtot = 0._f - othervtot = 0._f - - ! is relative element number of other element in group. - do ieoth_rel = 2,nelemg(igroup) - - ! is absolute element number of other element. - ieoth_abs = iepart + ieoth_rel - 1 - - if( itype(ieoth_abs) .eq. I_COREMASS )then - nother = nother + 1 - ieother(nother) = ieoth_abs - otherm(nother) = pc(iz,ibin,ieoth_abs) - othermtot = othermtot + otherm(nother) - othervtot = othervtot + otherm(nother) / pc(iz,ibin,iepart) / rhoelem(ibin,ieoth_abs) - endif - enddo - - condm = rmass(ibin,igroup) * pc(iz,ibin,iepart) - othermtot - condv = min(0._f, (rmass(ibin,igroup) / rhoelem(ibin,iepart)) - othervtot) - - if( condm .le. 0._f )then - - ! Zero mass for the condensate -- is a small value << 1 - argsol = 1e6_f - - ! If there is no condensed mass, then the volume fraction of core is 1. - volfrc = 1._f - else - - ! Sum over masses of other elements in group for argument of solute factor. - do jother = 1,nother - isol = isolelem(ieother(jother)) - - ! Some elements aren't soluble, so skip them. - if(isol .gt. 0 ) argsol = argsol + sol_ions(isol)*otherm(jother)/solwtmol(isol) - enddo - - argsol = argsol*gwtmol(igas)/condm - - volfrc = othervtot / (othervtot + condv) - endif - endif ! nelemg(igroup) > 1 - expon = akelvin(iz,igas) / rup_wet(iz,ibin,igroup) - argsol - endif - - expon = max(-POWMAX, expon) - akas = exp( expon ) - - ! Trick for removing haze droplets from droplet bins: - ! allows haze droplets to exist under supersaturated conditions; - ! when below supersaturation, haze droplets will evaporate. -! if( (.not. is_grp_ice(igroup)) .and. (akas .lt. 1._f) .and. & -! (supsatl(iz,igas) .lt. 0._f) ) akas = 1._f - - ! is growth rate in mass space [g/s]. - g0 = gro(iz,ibin+1,igroup) - g1 = gro1(iz,ibin+1,igroup) - g2 = gro2(iz,igroup) - - if( is_grp_ice(igroup) )then - ss = supsati(iz,igas) - pvap = pvapi(iz,igas) - else - ss = supsatl(iz,igas) - pvap = pvapl(iz,igas) - endif - - - ! If particle heating is being considered, then determine qrad and tpart to - ! determine dmdt. - ! - ! NOTE: If no optical properties, then can't do the particle heating calculation. - if ((.not. do_pheat) .or. (.not. do_mie(igroup))) then - - ! Ignore the qrad term. - dmdt = pvap * ( ss + 1._f - akas ) * g0 / ( 1._f + g0 * g1 * pvap ) - - ! Is neutralization set up for the group? - if (neutral_volfrc(igroup) > 0._f) then - - ! When the particle is less than fully neutralized, calculate a new - ! dmdt based upon assuming that the saturation vapor pressure (pvap) - ! is 0. - if (volfrc >= neutral_volfrc(igroup)) then - dmdt = max((pvap * (ss + 1._f)) * g0, dmdt) - else - - ! You can only lose sulfuric acid (condensed) mass until the volume fraction - ! for neutralization is reached. At that point the particle is fully - ! neutralized and the vapor pressure goes to 0. The volume of condensed gas - ! in excess of full neutralization is: - ! - ! condv - othervtot * ((1 - neutral_volfrc) / neutral_volfrc) - ! - ! NOTE: Limit the growth rate so that the neutralized volume fraction is - ! not overshot. Test have shown that this requires reducing the rate by a - ! factor of 2; although, other values probably work too. - dmdt = max(-(condv - othervtot * ((1._f - neutral_volfrc(igroup)) / neutral_volfrc(igroup))) & - * rhoelem(ibin,iepart) / 2._f / dtime, & - dmdt) - end if - end if - else - - ! Latent heat of condensing gas - if( is_grp_ice(igroup) )then - rlh = rlhe(iz,igas) + rlhm(iz,igas) - else - rlh = rlhe(iz,igas) - endif - - ! The particle temperature must be solved for by iterating, with an - ! initial guess that the particle temperature is the ambient temperature. - ! - ! NOTE: We could also try a guest that is based upon an equilibrium - ! between upwelling IR and collisonal heating, which was identified by - ! Jensen [1989] as the dominant terms. - ! - ! radp = 0.d0 - ! - ! do iwvl = 1, Nwave - ! radp = radp + (4.0d0*PI * absk(iwvl,ibin+1,igroup) * - ! $ radint3(ixyz,iwvl) * dwave(iwvl)) - ! end do - ! - ! dtp2 = radp / - ! $ (4.d0*PI*rlow(ibin+1,igroup)*thcondnc(iz)*ft(iz,ibin+1,igroup)) - tp = t(iz) - dtp = 0._f - dtpl = 0._f - - do iter = 1, MAX_ITER - - ! Calculate the net radiative flux on the particle, which requires - ! integrating the incoming and outgoing flux over the spectral - ! interval. - qrad = 0._f - - do iwvl = 1, NWAVE - - ! There may be overlap between bands, so only do the emission - ! for each range of wavelengths once. - if (do_wave_emit(iwvl)) then - - ! Get an integral across the entire band. There are several - ! techniques for doing this that vary in accuracy and - ! performance. Comments below are based on the CAM RRTMG - ! band structure. - - ! Just use the band center. - ! - ! NOTE: This generates about a 20% error, but is the fastest -! plkint = planckIntensity(wave(iwvl), tp) - - ! Brute Force integral - ! - ! The slowest technique, and not as accurate as either Widger - ! and Woodall or Conley, even at 100 iterations. -! plkint = planckBandIntensity(wave(iwvl), dwave(iwvl), tp, 60) - - ! Integral using Widger and Woodall, 1976. - ! - ! NOTE: One of the fastest technique at 2 iterations, but yields errors - ! of about 2%. Can handle wide rage of band sizes. -! plkint = planckBandIntensityWidger1976(wave(iwvl), dwave(iwvl), tp, 2) - - ! Using method developed by Andrew Conley. - ! - ! This is similar in performance to Widger and Woodall, but is more - ! accurate with errors of about 0.3%. It had trouble with SW bands that - ! are very large, but the latest version has improved performance and - ! it does work with the RRTMG band structure. - plkint = planckBandIntensityConley2011(wave(iwvl), dwave(iwvl), tp, 1) - - else - plkint = 0._f - end if - - qrad = qrad + 4.0_f * PI * (1._f - ssa(iwvl,ibin+1,igroup)) * & - qext(iwvl,ibin+1,igroup) * PI * (rlow_wet(iz,ibin+1,igroup) ** 2) & - * arat(ibin+1,igroup) * (radint(iz,iwvl) - plkint) * dwave(iwvl) - end do - - ! Save of the Qrad association with the ambient air temperature. -! if (iter == 0) then -! qrad0 = qrad -! end if - - ! Calculate the change in mass using eq. A3 from Toon et al. [1989]. - dmdt = pvap * ( ss + 1._f - akas * (1._f + qrad * g1 * g2 )) * & - g0 / ( 1._f + g0 * g1 * pvap ) - - ! Calculate a new particle temperature based upon the loss of mass and - ! energy being absorbed. - if ((dmdt * dtime) .le. (- rmass(ibin+1, igroup))) then - dtp = ((rlh * (- rmass(ibin+1, igroup) / dtime)) + qrad) / & - (4._f * PI * rlow_wet(iz,ibin+1,igroup) * thcondnc(iz,ibin+1,igroup) * ft(iz,ibin+1,igroup)) - else - dtp = ((rlh * dmdt) + qrad) / & - (4._f * PI * rlow_wet(iz,ibin+1,igroup) * thcondnc(iz,ibin+1,igroup) * ft(iz,ibin+1,igroup)) - end if - - tp = t(iz) + dtp - - ddtp = dtp - dtpl - dtpl = dtp - - if (abs(ddtp) .le. DDTP_LIMIT) then - exit - end if - - if ((iter .gt. 1) .and. (ddtp .gt. dtpl)) then - exit - end if - end do - - dtpart(iz,ibin,igroup) = dtp - - ! Calculate the contribution of this bin to the heating of the atmosphere. CARMA does - ! not actually apply this heating to change the temperature. - ! - ! From Pruppacher & Klett [2000], eq. 13-19, the heat transfer to - ! one particle is: - ! - ! dq/dt = 4*pi*r*thcondnc*Ft(r)*(T - Tp(r)) - ! - ! so the total heating rate of the air by the particle is: - ! - ! dT/dt = -Sum((4*pi*r*thcondnc*Ft(r)*(T-Tp(r))*pc(r))) / (Cp,air*arho) - ! - ! or - ! - ! dT/dt = Sum((4*pi*r*thcondnc*Ft(r)*dtp*pc(r))) / (Cp,air*arho) - ! - ! where dtp = Tp(r) - T - ! - ! NOTE: Using these terms will cause the model parent model to go out of - ! energy balance, since qrad difference is not being communicated to the - ! other layers. - if (do_pheatatm) then - - ! NOTE: If the particle is going to evaporate entirely during the timestep, - ! then assume that there is no particle heating. - if ((dmdt * dtime) .gt. (- rmass(ibin+1, igroup))) then - - ! If the particles are radiatively active, then the parent model's radiation - ! code is calculated based upon Ta, not Tp. Adjust for this error in Qrad. -! phprod = phprod + (qrad - qrad0) * pc(iz,ibin+1,iepart) / CP / rhoa(iz) - - ! Now add in the heating from thermal conduction. - phprod = phprod + 4._f * PI * rlow_wet(iz,ibin+1,igroup) * & - thcondnc(iz,ibin+1,igroup) * ft(iz,ibin+1,igroup) * dtp * & - pc(iz,ibin+1,iepart) / (CP * rhoa(iz)) - end if - end if - end if - - ! Return to caller with particle loss rates for growth and evaporation - ! evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/planck.F90 b/CARMAchem_GridComp/CARMA/source/base/planck.F90 deleted file mode 100644 index 346a767d..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/planck.F90 +++ /dev/null @@ -1,326 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -module planck - -contains - - !! This routine calculates the planck intensity. - !! - !! This algorithm is based upon eqn 1.2.4 from Liou[2002]. - !! - !! @author Chuck Bardeen - !! @version Jan-2010 - function planckIntensity(wvl, temp) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - real(kind=f), intent(in) :: wvl !! wavelength (cm) - real(kind=f), intent(in) :: temp !! temperature (K) - real(kind=f) :: planckIntensity !! Planck intensity (erg/s/cm2/sr/cm) - - ! Local declarations - - real(kind=f), parameter :: C = 2.9979e10_f ! Speed of light [cm/s] - real(kind=f), parameter :: H = 6.62608e-27_f ! Planck constant [erg s] - - ! Calculate the planck intensity. - planckIntensity = 2._f * H * C**2 / ((wvl**5) * (exp(H * C / (BK * wvl * temp)) - 1._f)) - - ! Return the planck intensity to the caller. - return - end function - - - !! This routine calculates the total planck intensity from the specified - !! wavelength to a wavelength of 0. - !! - !! This algorithm is based upon Widger and Woodall, BAMS, 1976 as - !! indicated at http://www.spectralcalc.com/blackbody/appendixA.html. - !! - !! @author Chuck Bardeen - !! @version Aug-2011 - function planckIntensityWidger1976(wvl, temp, miniter) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - real(kind=f), intent(in) :: wvl !! band center wavelength (cm) - real(kind=f), intent(in) :: temp !! temperature (K) - integer, intent(in) :: miniter !! minimum iterations - real(kind=f) :: planckIntensityWidger1976 !! Planck intensity (erg/s/cm2/sr/cm) - - ! Local Variables - real(kind=f), parameter :: C = 299792458.0_f ! Speed of light [m/s] - real(kind=f), parameter :: H = 6.6260693e-34_f ! Planck constant [J s] - real(kind=f), parameter :: BZ = 1.380658e-23_f ! Boltzman constant - - real(kind=f) :: c1, x, x2, x3, sumJ, dn, sigma - integer :: iter, n - - sigma = 1._f / wvl - - c1 = H * C / BZ - x = c1 * 100._f * sigma / temp - x2 = x * x - x3 = x2 * x - - ! Use fewer iterations, since speed is more important than accuracy for - ! the particle heating code, and even with fewer iterations the results - ! with CAM bands still show good accuracy. -! iter = min(512, int(2._f + 20._f / x)) - iter = min(miniter, int(2._f + 20._f / x)) - - sumJ = 0._f - - do n = 1, iter - dn = 1._f / n - sumJ = sumJ + exp(-n*x) * (x3 + (3.0_f * x2 + 6.0_f * (x + dn) * dn) * dn) * dn - end do - - ! Convert results from W/m2/sr to erg/cm2/s/sr - planckIntensityWidger1976 = 2.0_f * H * (C**2) * ((temp / c1) ** 4) * sumJ * 1e7_f / 1e4_f - - return - end function - - - !! This routine calculates the average planck intensity in the wavelength - !! band defined by wvl and dwvl. - !! - !! This algorithm is based upon Widger and Woodall, BAMS, 1976 as - !! indicated at http://www.spectralcalc.com/blackbody/appendixA.html. - !! - !! @author Chuck Bardeen - !! @version Aug-2011 - function planckBandIntensityWidger1976(wvl, dwvl, temp, miniter) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - real(kind=f), intent(in) :: wvl !! band center wavelength (cm) - real(kind=f), intent(in) :: dwvl !! band width (cm) - real(kind=f), intent(in) :: temp !! temperature (K) - integer, intent(in) :: miniter !! minimum iterations - real(kind=f) :: planckBandIntensityWidger1976 !! Planck intensity (erg/s/cm2/sr/cm) - - ! Calculate the integral from the edges to 0 and subtract. - planckBandIntensityWidger1976 = & - (planckIntensityWidger1976(wvl + (dwvl / 2._f), temp, miniter) & - - planckIntensityWidger1976(wvl - (dwvl / 2._f), temp, miniter)) / dwvl - - return - end function - - - !! This routine calculates the average planck intensity in the wavelength - !! band defined by wvl and dwvl. - !! - !! This algorithm does a brute force integral by dividing the band into - !! small sub-bands. This routine can be slow. - !! - !! @author Chuck Bardeen - !! @version Aug-2011 - function planckBandIntensity(wvl, dwvl, temp, iter) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - real(kind=f), intent(in) :: wvl !! band center wavelength (cm) - real(kind=f), intent(in) :: dwvl !! band width (cm) - real(kind=f), intent(in) :: temp !! temperature (K) - integer, intent(in) :: iter !! number of iterations - real(kind=f) :: planckBandIntensity !! Planck intensity (erg/s/cm2/sr/cm) - - ! Local Variables - real(kind=f) :: wstart ! Starting wavelength (cm) - real(kind=f) :: ddwave ! sub-band width (cm) - integer :: i - - wstart = wvl - (dwvl / 2._f) - ddwave = dwvl / iter - - planckBandIntensity = 0._f - - do i = 1, iter - planckBandIntensity = planckBandIntensity + planckIntensity(wstart + (i - 0.5) * ddwave, temp) * ddwave - end do - - planckBandIntensity = planckBandIntensity / dwvl - - return - end function - - - !! This routine calculates the average planck intensity in the wavelength - !! band defined by wvl and dwvl. - !! - !! error computed on full spectrum compared to planck function. Band-levels may be different - !! 8.9% error with 5 quadrature points in [100 micrometer, 1 millimeter] - !! 1.7% error with 10 quadrature points in [100 micrometer, 1 millimeter] - !! 0.001% error with 100 quadrature points in [100 micrometer, 1 millimeter] - !! - !! NOTE: This code was design to work with the CAM RRTMG band structure, it may not work as - !! well with arbitrary bands. - !! - !! NOTE: For most RRTMG bands, 3 quadrature points are probably sufficient, but testing is - !! left to the reader. - !! - !! @author Andrew Conley, Chuck Bardeen - !! @version Aug-2011 - function planckBandIntensityConley2011(wvl, dwvl, temp, iter) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - real(kind=f), intent(in) :: wvl !! band center wavelength (cm) - real(kind=f), intent(in) :: dwvl !! band width (cm) - real(kind=f), intent(in) :: temp !! temperature (K) - integer, intent(in) :: iter !! number of iterations - real(kind=f) :: planckBandIntensityConley2011 !! Planck intensity (erg/s/cm2/sr/cm) - - real(kind=f) :: half = 0.5_f - real(kind=f) :: third= 1._f / 3._f - real(kind=f) :: sixth= 1._f / 6._f - real(kind=f) :: tfth = 1._f /24._f - - real(kind=f) :: k = 1.3806488e-23_f ! boltzmann J/K - real(kind=f) :: c = 2.99792458e8_f ! light m/s - real(kind=f) :: h = 6.62606957e-34_f ! planck J s - real(kind=f) :: sigma = 5.670373e-8_f ! stef-bolt W/m/m/k/k/k/k - - real(kind=f) :: lambda1 ! wavelength m (lower bound) - real(kind=f) :: lambda2 ! wavelength m (upper bound) - - ! quadrature iteration - integer :: i,inumber - - ! internal temporary variables - real(kind=f) :: fr1, fr2 ! frequency bounds of partition - real(kind=f) :: kt ! k_boltzmann * temperature - real(kind=f) :: l1,l2 ! lower and upper bounds of (wavelength) - real(kind=f) :: dellam ! fraction multiplier for next lambda interval - real(kind=f) :: t1,t3 ! 2nd and 4th order terms - real(kind=f) :: total, total2 ! 2nd and 4th order cumulative partial integral - real(kind=f) :: e,d,em1i,di,ci ! exponential terms appearing in integral - real(kind=f) :: dfr,m,a,o,tt,mi ! terms appearing in integral - real(kind=f) :: argexp ! argument to exponent - real(kind=f) :: coeff ! front coefficient of integral - real(kind=f) :: planck ! planck function - - inumber = iter ! number of partitions - - !initialize - total = 0._f ! partial (cumulative) integral (4th order) -! total2 = 0._f ! partial (cumulative) integral (2nd order) - - kt = k*temp - lambda1 = (wvl - (dwvl / 2._f)) * 1e-2_f - lambda2 = (wvl + (dwvl / 2._f)) * 1e-2_f - ci = 1._f/c - - if (inumber .gt. 1) then - l1 = lambda1 - dellam = exp(log(lambda1/lambda2)/inumber) - l2 = l1/dellam - fr1 = c/l2 - fr2 = c/l1 - else - dellam = 1._f ! meaningless - l1 = lambda1 - l2 = lambda2 - fr1 = c/l2 - fr2 = c/l1 - endif - - ! accumulate integral by stepping (backwards) through partions of frequency - do i = 1,inumber - - ! constants - dfr = half * (fr2-fr1) ! half-range freq interval - m = half * (fr1+fr2) ! mean freq - mi = 1._f/m - a = h/kt ! alpha - - argexp = a*m - if (argexp .lt. 0.5_f) then - e = 1._f + & - argexp + & - (argexp*argexp)*half + & - (argexp*argexp*argexp)*sixth + & - (argexp*argexp*argexp*argexp)*tfth - em1i = 1._f/(e - 1._f ) - di = e*em1i - else if (argexp .lt. 20.0_f) then - e = exp(argexp) - em1i = 1._f/(e - 1._f ) - di = e*em1i - else - e = 1.e+20_f ! exp(20) is large. Use this for frequency >> Temperature - em1i = 1.e-20_f - di = 1._f - endif - - ! frontpiece - coeff = 2._f*h*m*m*m*ci*ci*em1i - - ! integrals - o = fr2-fr1 ! int 1 deps - tt = 2._f*(dfr*dfr*dfr)*third ! int eps^2 deps - - ! term and 4th order correction - t1 = 1._f - t3 = 3._f*mi*mi - 3._f*a*di*mi + a*a*di*di - half*a*a*di - ! t3 could be made more stable by placing (-) terms in denominator of pade approx. - - ! sum it up. Total is 4th order, total2 is 2nd order - total = total + coeff*(o*t1+tt*t3) -! total2 = total2 + coeff*o*t1 - - fr2 = fr1 - fr1 = fr1 * dellam - enddo - - ! Convert to erg/cm2/s/sr/cm - planckBandIntensityConley2011 = total * 1e7 / 1e4 / dwvl - - return - end function -end diff --git a/CARMAchem_GridComp/CARMA/source/base/prestep.F90 b/CARMAchem_GridComp/CARMA/source/base/prestep.F90 deleted file mode 100644 index be9862b5..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/prestep.F90 +++ /dev/null @@ -1,105 +0,0 @@ -#include "carma_globaer.h" - -!! This routine handles all preliminary setup at the beginning -!! of every timestep. Things that would appropriately be done -!! here include: -!! Input or otherwise define interface quantities from other submodels. -!! Save any model state that is needed to compute tendencies. -!! Save any model state that might be needed for comparison at end of step. -!! Update timestep counter and simulation time. -!! -!! @author Bill McKie -!! @version Oct-1995 -subroutine prestep(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - integer :: iz ! z index - integer :: igrp ! group index - integer :: igas ! gas index - integer :: ibin ! bin index - integer :: ielem ! element index - integer :: iep - real(kind=f) :: tmp_gc(NZ, NGAS) - real(kind=f) :: tmp_t(NZ) - - - ! If substepping is enabled, then determine how much the - ! gas concentration and temperature changed during this time step. - if (do_substep) then - if (NGAS > 0) then - d_gc(:,:) = gc(:,:) - gcl(:,:) - - do igas = 1, NGAS - do iz = 1, NZ - - ! NOTE: When d_gc is negative, you can get into problems with overshoot - ! to negative gas concentrations. To prevent that, when gc is negative - ! apply it all in the first step. Only substep gc when gc is increasing. - ! - ! NOTE: Perhaps there should be a limit, so that small changes happen - ! over the course of the timestep, but large changes get applied on the - ! first step. For now, doing it all on the first step should be the most - ! stable. - ! - ! NOTE: The case that is problematic is when the particle is growing - ! (i.e. supersaturated) and d_gc is negative. For better performance, - ! substep the gas unless both of these are true. This might run into - ! trouble if d_t is large and negative. -! if (d_gc(iz, igas) < 0._f) then - if ((d_gc(iz, igas) < 0._f) .and. ((supsatiold(iz, igas) > 0._f) & - .or. (supsati(iz, igas) > 0._f))) then - - ! Start from the new state and don't step the gas. - d_gc(iz, igas) = 0._f - gcl(iz, igas) = gc(iz, igas) - else - - ! Start the step from the old state and step the gas. - gc(iz, igas) = gcl(iz, igas) - end if - end do - end do - end if - - ! Start the temperature from the old state. - d_t(:) = t(:) - told(:) - t(:) = told(:) - endif - - - ! Don't allow particle concentrations to get too small. - do iz = 1, NZ - do ibin = 1, NBIN - do ielem = 1, NELEM - call smallconc(carma, cstate, iz, ibin, ielem, rc) - end do - end do - end do - - ! Set to from previous time step. This is needed by coagulation - ! as well as substepping. - if (do_substep .or. do_coag) then - pcl(:,:,:) = pc(:,:,:) - endif - - ! Find maximum particle concentrations. - do iz = 1, NZ - call maxconc(carma, cstate, iz, rc) - end do - - ! Return to caller with preliminary timestep things completed. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/psolve.F90 b/CARMAchem_GridComp/CARMA/source/base/psolve.F90 deleted file mode 100644 index 8da5003a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/psolve.F90 +++ /dev/null @@ -1,86 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates new particle concentrations. -!! -!! The basic form from which the solution is derived is -!! ( new_value - old_value ) / dtime = source_term - loss_rate*new_value -!! -!! Modified Sep-1997 (McKie) -!! New particle concentrations due to coagulation processes -!! were moved to the csolve routine. Csolve is called to -!! update particle concentrations due to coagulation. -!! This new psolve now updates particle concentrations due -!! to the faster calcs of the non-coag microphysical processes. -!! -!! @author Eric Jensen, Bill McKie -!! @version Oct-1995, Sep-1997 -subroutine psolve(carma, cstate, iz, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: iepart - integer :: igto - integer :: iz_no_sed - real(kind=f) :: ppd ! particle prodocution rate - real(kind=f) :: pc_nonuc ! particles - no nucleation - real(kind=f) :: pls ! particle loss rate - real(kind=f) :: sed_rate - real(kind=f) :: rnuclgtot - real(kind=f) :: dsed - - - ! Define current group & particle number concentration element indices - igroup = igelem(ielem) - iepart = ienconc(igroup) - - if(do_grow) then - - ! Compute total production rate - ppd = rnucpe(ibin,ielem) + rhompe(ibin,ielem) + growpe(ibin,ielem) + evappe(ibin,ielem) - - ! Sum up nucleation loss rates - rnuclgtot = sum(rnuclg(ibin,igroup,:)) - - ! Compute total loss rate - pls = rnuclgtot + growlg(ibin,igroup) + evaplg(ibin,igroup) - - ! Update net particle number concentration during current timestep - ! due to production and loss rates. - pc(iz,ibin,ielem) = (pc(iz,ibin,ielem) + dtime * ppd) / (ONE + pls * dtime) - - ! Figure out how many particles were produced from nucleation. This is just - ! for statistics and is done as a total for the step, not per substep. - pc_nonuc = (pc(iz,ibin,ielem) + dtime * (ppd - rnucpe(ibin,ielem) - rhompe(ibin,ielem))) / (ONE + pls * dtime) -! pc_nucl(iz,ibin,ielem) = pc_nucl(iz,ibin,ielem) + (pc(iz,ibin,ielem) - pc_nonuc) - - ! PRC: Above seems wrong: subtraction from semi-implicit - ! so comment it out and assemble my own pc_nucl (captures for me only homogeneous) - pc_nucl(iz,ibin,ielem) = pc_nucl(iz,ibin,ielem) + rhompe(ibin,ielem) * dtime - - end if - - ! Prevent particle concentrations from dropping below SMALL_PC - call smallconc(carma, cstate, iz, ibin, ielem, rc) - - ! Return to caller with new particle number concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/rhoice_heymsfield2010.F90 b/CARMAchem_GridComp/CARMA/source/base/rhoice_heymsfield2010.F90 deleted file mode 100644 index ee48054f..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/rhoice_heymsfield2010.F90 +++ /dev/null @@ -1,101 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the effective ice densities for each bin, based upon -!! the parameterization of Heymsfield et al. [2010]. -!! -!! @author Chuck Bardeen -!! @ version March 2010 -!! -!! @see CARMAELEMENT_Create -subroutine rhoice_heymsfield2010(carma, rhoice, igroup, regime, rho, aratelem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: rhoice !! ice density(g/cm3) - integer, intent(in) :: igroup !! group index - character(len=4), intent(in) :: regime !! crystal regime [warm | cold | conv] - real(kind=f), intent(out) :: rho(NBIN) !! crystal density per bin (g/cm3) - real(kind=f), intent(out) :: aratelem(NBIN) !! projected area ratio () - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ibin ! bin index - real(kind=f) :: a ! scalar coefficient from Heysfield and Schmitt [2010] - real(kind=f), parameter :: b = 2.1_f ! exponential coefficient from Heysfield and Schmitt [2010] - real(kind=f) :: rbin ! predicated crystal radius (cm) - real(kind=f) :: dmax ! maximum diameter - real(kind=f) :: totalmass ! bin mass - -1 format(/,'rhoice_heymsfield2010::ERROR - unknown ice regime (', a, ').') - - - rc = RC_OK - -! Figure out the 'a' coefficient. - if (regime == "deep") then - a = 1.10e-2_f - else if (regime == "conv") then - a = 6.33e-3_f - else if (regime == "cold") then - a = 5.74e-3_f - else if (regime == "avg") then - a = 5.28e-3_f - else if (regime == "synp") then - a = 4.22e-3_f - else if (regime == "warm") then - a = 3.79e-3_f - else - if (do_print) write(LUNOPRT,1) regime - rc = RC_ERROR - return - end if - - ! Get the starting mass for the first bin and the volume ratio from the CARMA_GROUP. This - ! call is used before initialization has happened, so the bin structure hasn't been - ! determined yet. - - do ibin = 1, NBIN - - ! Determine the total mass of the particle. - ! - ! NOTE: This needs to match the logic in setupbins.F90, so that the ice density - ! and radii will be determined properly. - totalmass = rmassmin(igroup) * (rmrat(igroup)**(ibin-1)) - - ! Determine the radius of the particle from Heymsfield et al. [2010]. - ! - ! m(D) = a * D ^ b (all in cgs units) - rbin = ((totalmass / a) ** (1._f/b)) / 2._f - - ! Determine the density of an equivalent sphere. - rho(ibin) = totalmass / ((4._f / 3._f ) * PI * (rbin ** 3._f)) - - ! Don't let the density be larger than the bulk density of ice. This - ! will happen for r < ~ 50 um in the parameterization, but this is - ! not physical. - rho(ibin) = min(rho(ibin), rhoice) - - ! Determine the area ratio based on the formulation given in Schmitt and Heymsfield - ! [2009]. - dmax = 2._f * rbin - - if (dmax <= 200.e-4_f) then - aratelem(ibin) = exp(-38._f * dmax) - else - aratelem(ibin) = 0.16_f * (dmax ** (-0.27_f)) - end if - - end do - -end subroutine rhoice_heymsfield2010 diff --git a/CARMAchem_GridComp/CARMA/source/base/rhopart.F90 b/CARMAchem_GridComp/CARMA/source/base/rhopart.F90 deleted file mode 100644 index bfec7038..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/rhopart.F90 +++ /dev/null @@ -1,209 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates new average particle densities. -!! -!! The particle mass density can change at each time-step due to -!! changes in the core mass fraction. -!! -!! For particles that are hydrophilic and whose particle size changes based -!! upon the relative humidity, and wet radius and density are also calculated. -!! For particles that do not swell, the wet and dry radius and densities are -!! the same. -!! -!! @author Chuck Bardeen Eric Jensen -!! @ version May-2009; Oct-1995 -!! -!! @see wetr -subroutine rhopart(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - use wetr - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: iz !! z index - integer :: igroup !! group index - integer :: ibin !! bin index - integer :: iepart !! element in group containing the particle concentration - integer :: jcore - integer :: iecore - real(kind=f) :: vcore(NBIN) - real(kind=f) :: mcore(NBIN) - real(kind=f) :: r_ratio - real(kind=f) :: h2o_mass - real(kind=f) :: h2o_vmr - real(kind=f) :: hno3_vmr - real(kind=f) :: h2so4m - - 1 format(/,'rhopart::WARNING - core mass > total mass, truncating : iz=',i4,',igroup=',& - i4,',ibin=',i4,',total mass=',e10.3,',core mass=',e10.3,',using rhop=',f9.4) - - ! Calculate average particle mass density for each group - do igroup = 1,NGROUP - - ! Define particle # concentration element index for current group - iepart = ienconc(igroup) ! element of particle number concentration - - do iz = 1, NZ - - ! If there are no cores, than the density of the particle is just the density - ! of the element. - if (ncore(igroup) < 1) then - rhop(iz,:,igroup) = rhoelem(:,iepart) - - ! Otherwise, the density changes depending on the amount of core and volatile - ! components. - else - - ! Calculate volume of cores and the mass of shell material - ! is the volume of core material and is the - ! mass of shell material. - vcore(:) = 0._f - mcore(:) = 0._f - - do jcore = 1,ncore(igroup) - iecore = icorelem(jcore,igroup) ! core element - - mcore(:) = mcore(:) + pc(iz,:,iecore) - vcore(:) = vcore(:) + pc(iz,:,iecore) / rhoelem(:,iecore) - enddo - - ! Calculate average density - do ibin = 1,NBIN - - ! If there is no core, the the density is that of the volatile element. - if (mcore(ibin) == 0._f) then - rhop(iz,ibin,igroup) = rhoelem(ibin,iepart) - else - - ! Since core mass and particle number (i.e. total mass) are advected separately, - ! numerical diffusion during advection can cause problems where the core mass - ! becomes greater than the total mass. To prevent adevction errors from making the - ! group inconsistent, we will truncate core mass if it is larger than the total - ! mass. - if (mcore(ibin) > (rmass(ibin,igroup) * pc(iz,ibin,iepart))) then - - ! Calculate the density. - rhop(iz,ibin,igroup) = mcore(ibin) / vcore(ibin) - - ! NOTE: This error happens a lot, so this error message is commented out - ! by default. -! if (do_print) write(LUNOPRT,1) iz, igroup, ibin, pc(iz,ibin,iepart)*rmass(ibin,igroup), & -! mcore(ibin), rhop(iz,ibin,igroup) -! rc = RC_WARNING - - ! Repair total mass. - pc(iz,ibin,iepart) = mcore(ibin) / rmass(ibin,igroup) - else - rhop(iz,ibin,igroup) = (rmass(ibin,igroup) * pc(iz,ibin,iepart)) / & - ((pc(iz,ibin,iepart)*rmass(ibin,igroup) - mcore(ibin))/rhoelem(ibin,iepart) + vcore(ibin)) - end if - end if - enddo - endif - - ! If these particles are hygroscopic and grow in response to the relative - ! humidity, then caclulate a wet radius and wet density. Otherwise the wet - ! and dry radius are the same. - - ! Determine the weight percent of sulfate, and store it for later use. - if (irhswell(igroup) == I_WTPCT_H2SO4 .OR. & - (irhswell(igroup) == I_WTPCT_STS .AND. t(iz) > 200._f)) then - h2o_mass = gc(iz, igash2o) / (xmet(iz) * ymet(iz) * zmet(iz)) - else if (irhswell(igroup) == I_WTPCT_STS) then - ! h2o_vmr and hno3_vmr are taken from gas concentrations while h2so4m - ! needs to be the mass of h2so4 in particles and in gas phase - h2o_vmr = gc(iz, igash2o) / gwtmol(igash2o) * WTMOL_AIR - hno3_vmr = gc(iz, igashno3) / gwtmol(igashno3) * WTMOL_AIR - h2so4m = sum(rmass(:, igroup) * pc(iz, :, iepart)) + & - gc(iz, igash2so4) / (xmet(iz) * ymet(iz) * zmet(iz)) - end if - - ! Loop over particle size bins. - do ibin = 1,NBIN - - ! If humidity affects the particle, then determine the equilbirium - ! radius and density based upon the relative humidity. - if (irhswell(igroup) == I_WTPCT_H2SO4 .OR. & - (irhswell(igroup) == I_WTPCT_STS .AND. t(iz) > 200._f)) then - - ! rlow - call getwetr(carma, igroup, relhum(iz), rlow(ibin,igroup), rlow_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_mass=h2o_mass, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz)) - if (rc < 0) return - - ! rup - call getwetr(carma, igroup, relhum(iz), rup(ibin,igroup), rup_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_mass=h2o_mass, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz)) - if (rc < 0) return - - ! r - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_mass=h2o_mass, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz)) - if (rc < 0) return - - ! If STS parameterization is selected, use hno3, h2o, and h2so4 mass - ! to determine equilibrium radius and density - else if (irhswell(igroup) == I_WTPCT_STS) then - - ! rlow - call getwetr(carma, igroup, relhum(iz), rlow(ibin,igroup), rlow_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_vmr=h2o_vmr, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz), press=cstate%f_p(iz), h2so4m = h2so4m, & - hno3_vmr = hno3_vmr) - if (rc < 0) return - - ! rup - call getwetr(carma, igroup, relhum(iz), rup(ibin,igroup), rup_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_vmr=h2o_vmr, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz), press=cstate%f_p(iz), h2so4m = h2so4m, & - hno3_vmr = hno3_vmr) - if (rc < 0) return - - ! r - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_vmr=h2o_vmr, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz), press=cstate%f_p(iz), h2so4m = h2so4m, & - hno3_vmr = hno3_vmr) - if (rc < 0) return - - else - ! rlow - call getwetr(carma, igroup, relhum(iz), rlow(ibin,igroup), rlow_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc) - if (rc < 0) return - - ! rup - call getwetr(carma, igroup, relhum(iz), rup(ibin,igroup), rup_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc) - if (rc < 0) return - - ! r - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc) - if (rc < 0) return - end if - end do - end do - enddo - - ! Return to caller with new particle number densities. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupatm.F90 b/CARMAchem_GridComp/CARMA/source/base/setupatm.F90 deleted file mode 100644 index f841f36a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupatm.F90 +++ /dev/null @@ -1,146 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine setups up parameters related to the atmospheric state. It assumes that the -!! pressure, temperature, and dimensional fields (xc, dx, yc, dy, zc, zl) have already been -!! specified and all state arrays allocated via CARMASTATE_Create(). -!! -!! @author Chuck Bardeen -!! @ version Feb-1995 -!! @see CARMASTATE_Create -subroutine setupatm(carma, cstate, rescale, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - logical, intent(in) :: rescale !! rescale the fall velocity for zmet change, this is instead of realculating - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - !-- - ! For air viscosity calculations - ! Air viscosity is from Sutherland's equation (using Smithsonian - ! Meteorological Tables, in which there is a misprint -- T is deg_K, not - ! deg_C. - real(kind=f), parameter :: rmu_0 = 1.8325e-4_f - real(kind=f), parameter :: rmu_t0 = 296.16_f - real(kind=f), parameter :: rmu_c = 120._f - real(kind=f), parameter :: rmu_const = rmu_0 * (rmu_t0 + rmu_c) - - integer :: ielem, ibin, i, j, ix, iy, iz, ie, ig, ip, igrp, jgrp, igroup - - - ! Calculate the dry air density at each level, using the ideal gas - ! law. This will be used to calculate zmet. - rhoa(:) = p(:) / (R_AIR * t(:)) - - ! Calculate the dimensions and the dimensional metrics. - dz(:) = abs(zl(2:NZP1) - zl(1:NZ)) - - ! Horizontal Metrics - select case(igridh) - ! Cartesian - case (I_CART) - xmet(:) = 1._f - ymet(:) = 1._f - - ! Latitude/Longitude - case (I_LL) - xmet(:) = REARTH * DEG2RAD * cos(DEG2RAD * yc(:)) - ymet(:) = REARTH * DEG2RAD - - case default - if (do_print) write(LUNOPRT,*) "setupatm:: ERROR - The specified horizontal grid type (", igridh, & - ") is not supported." - rc = -1 - end select - - - ! Put the fall velocity back into cgs units, so that we can determine - ! new metrics and then scale it back. This is optional and is done instead - ! of recalculating everything from scratch to improve performance. - if (rescale .and. (igridv /= I_CART)) then - do ibin = 1, NBIN - do igroup = 1, NGROUP - vf(:, ibin, igroup) = vf(:, ibin, igroup) * zmetl(:) - dkz(:, ibin, igroup) = dkz(:, ibin, igroup) * (zmetl(:)**2) - end do - end do - end if - - - ! Vertical Metrics - select case(igridv) - ! Cartesian - case (I_CART) - zmet = 1._f - - ! Sigma - case (I_SIG) - zmet(:) = abs(((pl(1:NZ) - pl(2:NZP1)) / (zl(1:NZ) - zl(2:NZP1))) / & - (GRAV * rhoa(:))) - - ! Hybrid - case (I_HYBRID) - zmet(:) = abs(((pl(1:NZ) - pl(2:NZP1)) / (zl(1:NZ) - zl(2:NZP1))) / & - (GRAV * rhoa(:))) - - case default - if (do_print) write(LUNOPRT,*) "setupatm:: ERROR - The specified vertical grid type (", igridv, & - ") is not supported." - rc = -1 - end select - - ! Interpolate the z metric to the grid box edges. - if (NZ == 1) then - zmetl(:) = zmet(1) - else - - ! Extrpolate the top and bottom. - zmetl(1) = zmet(1) + (zmet(2) - zmet(1)) / (zc(2) - zc(1)) * (zl(1) - zc(1)) - zmetl(NZP1) = zmet(NZ) + (zmet(NZ) - zmet(NZ-1)) / (zc(NZ) - zc(NZ-1)) * (zl(NZP1) - zc(NZ)) - - ! Interpolate the middles. - if (NZ > 2) then - do iz = 2, NZ - zmetl(iz) = zmet(iz-1) + (zmet(iz) - zmet(iz-1)) / (zc(iz) - zc(iz-1)) * (zl(iz) - zc(iz-1)) - end do - end if - end if - - - ! Determine the z metrics at the grid box edges and then use this to put the - ! fall velocity back into /x/y/z units. - if (rescale .and. (igridv /= I_CART)) then - do ibin = 1, NBIN - do igroup = 1, NGROUP - vf(:, ibin, igroup) = vf(:, ibin, igroup) / zmetl(:) - dkz(:, ibin, igroup) = dkz(:, ibin, igroup) / (zmetl(:)**2) - end do - end do - end if - - - ! Scale the density into the units carma wants (i.e. /x/y/z) - rhoa(:) = rhoa(:) * xmet(:) * ymet(:) * zmet(:) - - ! Use the pressure difference across the cell and the fact that the - ! atmosphere is hydrostatic to caclulate an average density in the - ! grid box. - rhoa_wet(:) = abs((pl(2:NZP1) - pl(1:NZ))) / (GRAV) - rhoa_wet(:) = (rhoa_wet(:) * xmet(:) * ymet(:)) / dz(:) - - ! Calculate the thermal properties of the atmosphere. - rmu(:) = rmu_const / ( t(:) + rmu_c ) * (t(:) / rmu_t0 )**1.5_f - thcond(:) = (5.69_f + .017_f*(t(:) - T0)) * 4.186e2_f -end subroutine diff --git a/CARMAchem_GridComp/CARMA/source/base/setupbdif.F90 b/CARMAchem_GridComp/CARMA/source/base/setupbdif.F90 deleted file mode 100644 index 54423d4f..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupbdif.F90 +++ /dev/null @@ -1,114 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle vertical diffusion coefficients, -!! dkz(k,i,j) [cm^2 s^-1]. -!! -!! Method: Uses equation 8.73 from Seinfeld and Pandis [1998] along -!! with the slip correction factor (bpm) calculated in the fall -!! velocity setup. -!! -!! This routine requires that vertical profiles of temperature , -!! air density , viscosity , and slip correction are -!! defined (i.e., initatm.f and setupvf.f must be called before this). -!! -!! NOTE: Eddy diffusion is carried out by the parent model, so the only -!! diffusion that CARMA does is Brownian diffusion. -!! -!! @author Chuck Bardeen -!! @version Aug-2010 -subroutine setupbdif(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup, ibin, iz, k1, k2, nzm1 - - ! Define formats - 2 format(/,'Brownian diffusion coefficient (prior to interpolation)') - 3 format(/,'Particle group ',i3,/,' bin lev p [dyne/cm2] T [K] r [cm] wet r [cm] dkz [cm2/s]',/) - 4 format(i3,4x,i3,5(1pe11.3,4x)) - - - ! Loop over all groups. - do igroup = 1, NGROUP - - ! Loop over particle size bins. - do ibin = 1,NBIN - - ! Loop over all atltitudes. - do iz = 1, NZ - - ! Vertical brownian diffusion coefficient - dkz(iz,ibin,igroup) = (BK*t(iz)*bpm(iz,ibin,igroup)) / (6._f*PI*rmu(iz)*r_wet(iz,ibin,igroup) * rprat(ibin,igroup)) - - enddo - enddo - enddo - - ! Print out diffusivities. -#ifdef DEBUG - if (do_print_init) then - - write(LUNOPRT,2) - - do igroup = 1, NGROUP - - write(LUNOPRT,3) igroup - - do ibin = 1,NBIN - - do iz = NZ, 1, -1 - write(LUNOPRT,4) ibin,iz,p(iz),t(iz),r(ibin,igroup),r_wet(iz,ibin,igroup),dkz(iz,ibin,igroup) - end do - enddo - enddo - - write(LUNOPRT,*) "" - end if -#endif - - ! Interpolate from layer mid-pts to layer boundaries. - ! is the diffusion coefficient at the lower edge of the layer - nzm1 = max(1, NZ-1) - - ! Set upper boundary before averaging - dkz(NZP1,:,:) = dkz(NZ,:,:) - - if (NZ .gt. 1) then - dkz(NZ,:,:) = sqrt(dkz(nzm1,:,:) * dkz(NZ,:,:)) - - if (NZ .gt. 2) then - do iz = NZ-1, 2, -1 - dkz(iz,:,:) = sqrt(dkz(iz-1,:,:) * dkz(iz,:,:)) - enddo - endif - endif - - ! Scale cartesian diffusivities to the appropriate vertical coordinate system. - ! Non--cartesion coordinates are assumed to be positive downward, but - ! vertical velocities in this model are always assumed to be positive upward. - if( igridv .ne. I_CART )then - do igroup=1,NGROUP - do ibin=1,NBIN - dkz(:,ibin,igroup) = dkz(:,ibin,igroup) / (zmetl(:)**2) - enddo - enddo - endif - - ! Return to caller with fall velocities evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupbins.F90 b/CARMAchem_GridComp/CARMA/source/base/setupbins.F90 deleted file mode 100644 index c4f1ab0c..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupbins.F90 +++ /dev/null @@ -1,235 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates the derived mapping arrays and sets up -!! the particle size bins. -!! -!! @author Eric Jensen -!! @ version Oct-1995 -subroutine setupbins(carma, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carma_mod - - implicit none - - type(carma_type), intent(inout) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ielem, ibin, i, j, ix, iy, iz, ie, ig, ip, igrp, jgrp - real(kind=f) :: tmp_rhop(NBIN, NGROUP) - real(kind=f) :: vrfact - real(kind=f) :: cpi - ! Local declarations needed for creation of fractal bin structure - real(kind=f) :: rf, rp - real(kind=f) :: vpor, upor, gamma, happel, perm, brinkman, epsil, omega - - ! Define formats - ! - 1 format(a,': ',12i6) - 2 format(a,': ',i6) - 3 format(a,': ',f12.2) - 4 format(a,': ',12f12.2) - 5 format(/,'Particle grid structure (setupbins):') - 6 format(a,': ',1p12e12.3) - 7 format(a,': ',12l6) - - - ! Determine which elements are particle number concentrations - ! is the element corresponding to particle number - ! concentration in group - ! - igrp = 0 - do ielem = 1, NELEM - if( itype(ielem) .eq. I_INVOLATILE .or. & - itype(ielem) .eq. I_VOLATILE )then - - igrp = igrp + 1 - ienconc(igrp) = ielem - endif - enddo - - if( igrp .gt. NGROUP )then - if (do_print) write(LUNOPRT,'(/,a)') 'CARMA_setupbin:: ERROR - bad itype array' - rc = -1 - return - endif - - ! Determine which group each element belongs to - ! i.e., is the group to which element belongs! - igrp = 0 - do ielem = 1, NELEM - if( itype(ielem) .eq. I_INVOLATILE .or. & - itype(ielem) .eq. I_VOLATILE )then - igrp = igrp + 1 - endif - igelem(ielem) = igrp - enddo - - ! Determine how many cores are in each group . - ! The core elements in a group are given by . - ! - ! Also evaluate whether or not second moment is used for each group. - ielem = 0 - - do igrp = 1, NGROUP - - ncore(igrp) = 0 - if_sec_mom(igrp) = .false. - imomelem(igrp) = 0 - - do j = 1, nelemg(igrp) - - ielem = ielem + 1 - - if( itype(ielem) .eq. I_COREMASS .or. & - itype(ielem) .eq. I_VOLCORE )then - - ncore(igrp) = ncore(igrp) + 1 - icorelem(ncore(igrp),igrp) = ielem - - elseif( itype(ielem) .eq. I_CORE2MOM )then - - if_sec_mom(igrp) = .true. - imomelem(igrp) = ielem - - endif - - enddo - enddo - - ! Particle mass densities (NBIN for each group) -- the user might want - ! to modify this (this code segment does not appear in setupaer subroutine - ! because is not defined until this subroutine). - do ig = 1,NGROUP - ie = ienconc(ig) - do ibin = 1,NBIN - tmp_rhop(ibin, ig) = rhoelem(ibin, ie) - - ! Set initial density of all hydrometeor groups to 1 such that nucleation - ! mapping arrays are calculated correctly. - ! or not -! if( itype(ie) .ne. I_INVOLATILE ) then -! rhop3(ixyz,ibin,ig) = 1. -! endif - enddo - enddo - - ! Set up the particle bins. - ! For each particle group, the mass of a particle in - ! bin j is times that in bin j-1 - ! - ! rmass(NBIN,NGROUP) = bin center mass [g] - ! r(NBIN,NGROUP) = bin mean (volume-weighted) radius [cm] - ! vol(NBIN,NGROUP) = bin center volume [cm^3] - ! dr(NBIN,NGROUP) = bin width in radius space [cm] - ! dv(NBIN,NGROUP) = bin width in volume space [cm^3] - ! dm(NBIN,NGROUP) = bin width in mass space [g] - cpi = 4._f/3._f*PI - - do igrp = 1, NGROUP - - vrfact = ( (3._f/2._f/PI/(rmrat(igrp)+1._f))**(ONE/3._f) )* & - ( rmrat(igrp)**(ONE/3._f) - 1._f ) - - ! If rmassmin wasn't specified, then use rmin to determine the mass - ! of the first bin. - if (rmassmin(igrp) == 0._f) then - rmassmin(igrp) = cpi*tmp_rhop(1,igrp)*rmin(igrp)**3 - else - - ! Just for internal consistency, recalculate rmin based on the rmass - ! that is being used. - rmin(igrp) = (rmassmin(igrp) / cpi / tmp_rhop(1,igrp)) ** (1._f / 3._f) - end if - - do j = 1, NBIN - rmass(j,igrp) = rmassmin(igrp) * rmrat(igrp)**(j-1) - rmassup(j,igrp) = 2._f*rmrat(igrp)/(rmrat(igrp)+1._f)*rmass(j,igrp) - dm(j,igrp) = 2._f*(rmrat(igrp)-1._f)/(rmrat(igrp)+1._f)*rmass(j,igrp) - vol(j,igrp) = rmass(j,igrp) / tmp_rhop(j,igrp) - r(j,igrp) = ( rmass(j,igrp)/tmp_rhop(j,igrp)/cpi )**(ONE/3._f) - rup(j,igrp) = ( rmassup(j,igrp)/tmp_rhop(j,igrp)/cpi )**(ONE/3._f) - dr(j,igrp) = vrfact*(rmass(j,igrp)/tmp_rhop(j,igrp))**(ONE/3._f) - rlow(j,igrp) = rup(j,igrp) - dr(j,igrp) - - if (is_grp_fractal(igrp)) then - ! fractal flag is true - - if (r(j,igrp) .le. rmon(igrp)) then ! if the bin radius is less than the monomer size - - nmon(j,igrp) = 1.0_f - rrat(j,igrp) = 1.0_f - arat(j,igrp) = 1.0_f - rprat(j,igrp) = 1.0_f - df(j,igrp) = 3.0_f ! Reset fractal dimension to 3 (this is a formality) - - else ! if bin radius is greater than the monomer size - - rf = (1.0_f/falpha(igrp))**(1.0_f/df(j,igrp))*r(j,igrp)**(3.0_f/df(j,igrp))*rmon(igrp)**(1.0_f-3.0_f/df(j,igrp)) - nmon(j,igrp) = falpha(igrp)*(rf/rmon(igrp))**df(j,igrp) - - rrat(j,igrp) = rf/r(j,igrp) - - ! Calculate mobility radius for permeable aggregates - ! using Vainshtein (2003) formulation - vpor = 1.0_f - (nmon(j,igrp))**(1.0_f-3.0_f/df(j,igrp)) ! Volume average porosity (eq. 3.2) - upor = 1.0_f-(1.0_f - vpor)*sqrt(df(j,igrp)/3.0_f) ! Uniform poroisty (eq. 3.10) - gamma = (1.0_f - upor)**(1.0_f/3.0_f) - happel = 2.0_f/(9.0_f*(1.0_f-upor))* & ! Happel permeability model - (3.0_f-4.5_f*gamma+4.5_f*gamma**5.0_f-3.0_f*gamma**6.0_f)/ & - (3.0_f+2.0_f*gamma**5.0_f) - perm = happel*rmon(igrp)**2.0_f ! Permeability (eq. 3.3) - brinkman = nmon(j,igrp)**(1.0_f/df(j,igrp))*1.0_f/sqrt(happel) ! Brinkman parameter (eq. 3.9) - epsil = 1.0_f - brinkman**(-1.)*tanh(brinkman) ! - omega = 2.0_f/3.0_f*epsil/(2.0_f/3.0_f+epsil/brinkman**2.0_f) ! drag coefficient (eq. 2.7) - rp = rf * omega - rprat(j,igrp) = rp/r(j,igrp) - - arat(j,igrp) = (rprat(j,igrp) / rrat(j, igrp))**2.0_f - endif - else - ! Not a fractal. - nmon(j,igrp) = 1.0_f - rprat(j,igrp) = 1.0_f - df(j,igrp) = 3.0_f - endif - enddo - enddo - - ! Evaluate differences between valuse of in different bins. - do igrp = 1, NGROUP - do jgrp = 1, NGROUP - do i = 1, NBIN - do j = 1, NBIN - diffmass(i,igrp,j,jgrp) = rmass(i,igrp) - rmass(j,jgrp) - enddo - enddo - enddo - enddo - - ! Report some initialization values - if (do_print_init) then - write(LUNOPRT,5) - write(LUNOPRT,2) 'NGROUP ',NGROUP - write(LUNOPRT,2) 'NELEM ',NELEM - write(LUNOPRT,2) 'NBIN ',NBIN - write(LUNOPRT,6) 'Massmin',(rmassmin(i),i=1,NGROUP) - write(LUNOPRT,4) 'Mrat ',(rmrat(i),i=1,NGROUP) - write(LUNOPRT,1) 'nelemg ',(nelemg(i),i=1,NGROUP) - write(LUNOPRT,1) 'itype ',(itype(i),i=1,NELEM) - write(LUNOPRT,1) 'ienconc',(ienconc(i),i=1,NGROUP) - write(LUNOPRT,1) 'igelem ',(igelem(i),i=1,NELEM) - write(LUNOPRT,1) 'ncore ',(ncore(i),i=1,NGROUP) - write(LUNOPRT,7) 'fractal',(is_grp_fractal(i),i=1,NGROUP) - end if - - ! Return to caller with particle grid initialized - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupckern.F90 b/CARMAchem_GridComp/CARMA/source/base/setupckern.F90 deleted file mode 100644 index 084825c4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupckern.F90 +++ /dev/null @@ -1,523 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates the coagulation kernels, ckernel(k,j1,j2,i1,i2) -!! [cm^3 s^-1] and pkernel. Indices correspond to aritrary array of columns -!! vertical level , aerosol groups and bins of colliding particles. -!! -!! ckernel is calculated as a static array for use each timestep -!! ckern0 is also created for a basis to calculate new ckernels each timestep, if desired. (coagwet.f) -!! -!! This routine requires that vertical profiles of temperature , -!! air density , and viscosity are defined. -!! -!! @version Oct-1995 -!! @author Andy Ackerman -subroutine setupckern(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - ! 2-D collision efficiency for current group pair under - ! consideration (for extrapolation of input data) - real(kind=f) :: e_coll2(NBIN,NBIN) - integer, parameter :: NP_DATA = 21 ! number of collector/collected pairs in input data - integer, parameter :: NR_DATA = 12 ! number of radius bins in input data - real(kind=f), parameter :: e_small = 0.0001_f ! smallest collision efficiency - logical, save :: init_data = .FALSE. ! did data_p and data_r get initialized? - real(kind=f), save :: data_p(NP_DATA) ! radius ratios (collected/collector) - real(kind=f), save :: data_r(NR_DATA) ! collector drop radii (um) - real(kind=f), save :: data_e(NP_DATA, NR_DATA) ! geometric collection efficiencies - - integer :: ip - integer :: ig, jg - - ! The probability that two particles that collide through thermal - ! coagulation will stick to each other. - real(kind=f) :: cstick_calc - - integer :: i1, i2, j1, j2, k - integer :: i, j - integer :: igrp - integer :: ibin - - real(kind=f) :: rhoa_cgs - real(kind=f) :: temp1, temp2 - - real(kind=f) :: r1 - real(kind=f) :: di - real(kind=f) :: gi - real(kind=f) :: rlbi - real(kind=f) :: dti1 - real(kind=f) :: dti2 - real(kind=f) :: dti - - real(kind=f) :: r2 - real(kind=f) :: dj - real(kind=f) :: gj - real(kind=f) :: rlbj - real(kind=f) :: dtj1 - real(kind=f) :: dtj2 - real(kind=f) :: dtj - - real(kind=f) :: rp - real(kind=f) :: dp - real(kind=f) :: gg - real(kind=f) :: delt - real(kind=f) :: term1 - real(kind=f) :: term2 - real(kind=f) :: cbr - - real(kind=f) :: r_larg - real(kind=f) :: r_smal - integer :: i_larg - integer :: i_smal - integer :: ig_larg - integer :: ig_smal - real(kind=f) :: d_larg - - real(kind=f) :: re_larg - real(kind=f) :: pe - real(kind=f) :: pe3 - real(kind=f) :: ccd - - real(kind=f) :: e_coll - real(kind=f) :: vfc_smal - real(kind=f) :: vfc_larg - real(kind=f) :: sk - real(kind=f) :: e1 - real(kind=f) :: e3 - real(kind=f) :: e_langmuir - real(kind=f) :: re60 - - real(kind=f) :: pr - real(kind=f) :: e_fuchs - - integer :: jp, jj, jr - - real(kind=f) :: pblni - real(kind=f) :: rblni - - real(kind=f) :: term3 - real(kind=f) :: term4 - - real(kind=f) :: beta - real(kind=f) :: b_coal - real(kind=f) :: a_coal - real(kind=f) :: x_coal - real(kind=f) :: e_coal - real(kind=f) :: vfc_1 - real(kind=f) :: vfc_2 - real(kind=f) :: cgr - - -! Add constants for calculating effect of Van Der Waal's forces on coagulation -! See Chan and Mozurkewich, J. Atmos. Sci., June 2001 - real(kind=f), parameter :: vwa1 = 0.0757_f - real(kind=f), parameter :: vwa3 = 0.0015_f - real(kind=f), parameter :: vwb0 = 0.0151_f - real(kind=f), parameter :: vwb1 = -0.186_f - real(kind=f), parameter :: vwb3 = -0.0163_f - real(kind=f), parameter :: ham = 6.4e-13_f ! erg, Hamaker constant - real(kind=f) :: hp, hpln, Enot, Einf - logical :: use_vw(NGROUP, NGROUP) - integer :: ielem - - -! Initialization of input data for gravitational collection. -! The data were compiled by Hall (J. Atmos. Sci. 37, 2486-2507, 1980). - - data data_p/0.00_f,0.05_f,0.10_f,0.15_f,0.20_f,0.25_f,0.30_f,0.35_f,0.40_f,0.45_f, & - 0.50_f,0.55_f,0.60_f,0.65_f,0.70_f,0.75_f,0.80_f,0.85_f,0.90_f,0.95_f,1.00_f/ - - data data_r( 1), (data_e(ip, 1),ip=1,NP_DATA) / 10.0, & - 0.0001, 0.0001, 0.0001, 0.0001, 0.0140, 0.0170, 0.0190, 0.0220, & - 0.0270, 0.0300, 0.0330, 0.0350, 0.0370, 0.0380, 0.0380, 0.0370, & - 0.0360, 0.0350, 0.0320, 0.0290, 0.0270 / - data data_r( 2), (data_e(ip, 2),ip=1,NP_DATA) / 20.0, & - 0.0001, 0.0001, 0.0001, 0.0050, 0.0160, 0.0220, 0.0300, 0.0430, & - 0.0520, 0.0640, 0.0720, 0.0790, 0.0820, 0.0800, 0.0760, 0.0670, & - 0.0570, 0.0480, 0.0400, 0.0330, 0.0270 / - data data_r( 3), (data_e(ip, 3),ip=1,NP_DATA) / 30.0, & - 0.0001, 0.0001, 0.0020, 0.0200, 0.0400, 0.0850, 0.1700, 0.2700, & - 0.4000, 0.5000, 0.5500, 0.5800, 0.5900, 0.5800, 0.5400, 0.5100, & - 0.4900, 0.4700, 0.4500, 0.4700, 0.5200 / - data data_r( 4), (data_e(ip, 4),ip=1,NP_DATA) / 40.0, & - 0.0001, 0.0010, 0.0700, 0.2800, 0.5000, 0.6200, 0.6800, 0.7400, & - 0.7800, 0.8000, 0.8000, 0.8000, 0.7800, 0.7700, 0.7600, 0.7700, & - 0.7700, 0.7800, 0.7900, 0.9500, 1.4000 / - data data_r( 5), (data_e(ip, 5),ip=1,NP_DATA) / 50.0, & - 0.0001, 0.0050, 0.4000, 0.6000, 0.7000, 0.7800, 0.8300, 0.8600, & - 0.8800, 0.9000, 0.9000, 0.9000, 0.9000, 0.8900, 0.8800, 0.8800, & - 0.8900, 0.9200, 1.0100, 1.3000, 2.3000 / - data data_r( 6), (data_e(ip, 6),ip=1,NP_DATA) / 60.0, & - 0.0001, 0.0500, 0.4300, 0.6400, 0.7700, 0.8400, 0.8700, 0.8900, & - 0.9000, 0.9100, 0.9100, 0.9100, 0.9100, 0.9100, 0.9200, 0.9300, & - 0.9500, 1.0000, 1.0300, 1.7000, 3.0000 / - data data_r( 7), (data_e(ip, 7),ip=1,NP_DATA) / 70.0, & - 0.0001, 0.2000, 0.5800, 0.7500, 0.8400, 0.8800, 0.9000, 0.9200, & - 0.9400, 0.9500, 0.9500, 0.9500, 0.9500, 0.9500, 0.9500, 0.9700, & - 1.0000, 1.0200, 1.0400, 2.3000, 4.0000 / - data data_r( 8), (data_e(ip, 8),ip=1,NP_DATA) / 100.0, & - 0.0001, 0.5000, 0.7900, 0.9100, 0.9500, 0.9500, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000 / - data data_r( 9), (data_e(ip, 9),ip=1,NP_DATA) / 150.0, & - 0.0001, 0.7700, 0.9300, 0.9700, 0.9700, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000 / - data data_r(10), (data_e(ip,10),ip=1,NP_DATA) / 200.0, & - 0.0001, 0.8700, 0.9600, 0.9800, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000 / - data data_r(11), (data_e(ip,11),ip=1,NP_DATA) / 300.0, & - 0.0001, 0.9700, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000 / - data data_r(12), (data_e(ip,12),ip=1,NP_DATA) / 1000.0, & - 0.0001, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, & - 1.0000, 1.0000, 1.0000, 1.0000, 1.0000 / - - - ! Use constant kernel if = I_COAGOP_CONST - if( icoagop .eq. I_COAGOP_CONST )then - ckernel(:,:,:,:,:) = ck0 - else - - if( icollec .eq. I_COLLEC_DATA )then - - ! Convert from um to cm and take logarithm of ; - ! however, we only want to do this once. - ! - ! If we are using Open/MP, we only want one thread to do this - ! operation once. This is a kludge, and this table should probably - ! get set up a different way. - !$OMP CRITICAL(CARMA_HALL) - if (.not. init_data) then - init_data = .TRUE. - - do i = 1, NR_DATA - data_r(i) = data_r(i)/1.e4_f - do ip = 1, NP_DATA - data_e(ip,i) = log(data_e(ip,i)) - enddo - enddo - endif - !$OMP END CRITICAL(CARMA_HALL) - endif - - ! Loop over the grid - do k = 1, NZ - - ! This is in cartesian coordinates. - rhoa_cgs = rhoa(k) / (xmet(k)*ymet(k)*zmet(k)) - - temp1 = BK*t(k) - temp2 = 6._f*PI*rmu(k) - - do j1 = 1, NGROUP - do j2 = j1, NGROUP - use_vw(j1, j2) = is_grp_sulfate(j1) .and. is_grp_sulfate(j2) - end do - end do - - ! Loop over groups! - do j1 = 1, NGROUP - do j2 = 1, NGROUP - - if( icoag(j1,j2) .ne. 0 )then - - ! First particle - do i1 = 1, NBIN - - r1 = r_wet(k,i1,j1) * rrat(i1,j1) - di = temp1*bpm(k,i1,j1)/(temp2*r1) - gi = sqrt( 8._f*temp1/(PI*rmass(i1,j1)) ) - rlbi = 8._f*di/(PI*gi) - dti1= (2._f*r1 + rlbi)**3 - dti2= (4._f*r1*r1 + rlbi*rlbi)**1.5_f - dti = 1._f/(6._f*r1*rlbi) - dti = dti*(dti1 - dti2) - 2._f*r1 - - ! Second particle - do i2 = 1, NBIN - r2 = r_wet(k,i2,j2) * rrat(i2,j2) - dj = temp1*bpm(k,i2,j2)/(temp2*r2) - gj = sqrt( 8._f*temp1/(PI*rmass(i2,j2)) ) - rlbj = 8._f*dj/(PI*gj) - dtj1= (2._f*r2 + rlbj)**3 - dtj2= (4._f*r2*r2 + rlbj*rlbj)**1.5_f - dtj = 1._f/(6._f*r2*rlbj) - dtj = dtj*(dtj1 - dtj2) - 2._f*r2 - - ! Account for the charging effect of small particles (Van Der Waal's forces). - ! Set cstick to E_infinity/Eo, then multiply cbr kernel by Eo - ! See Chan and Mozurkewich, J. Atmos. Sci., June 2001 - ! Only applicable to groups with sulfate elements - if (use_vw(j1,j2)) then - hp = ham / temp1 * (4._f * r1 * r2 / (r1 + r2)**2) - hpln = log(1._f + hp) - Enot = 1._f + vwa1 * hpln + vwa3 * hpln**3 - Einf = 1._f + sqrt(hp / 3._f) / (1._f + vwb0*sqrt(hp)) + vwb1 * hpln + vwb3 * hpln**3 - cstick_calc = Einf / Enot - else - cstick_calc = cstick - end if - - ! First calculate thermal coagulation kernel - rp = r1 + r2 - dp = di + dj - gg = sqrt(gi*gi + gj*gj)*cstick_calc - delt= sqrt(dti*dti + dtj*dtj) - term1 = rp/(rp + delt) - term2 = 4._f*dp/(gg*rp) - - ! is thermal (brownian) coagulation coefficient - cbr = 4._f*PI*rp*dp/(term1 + term2) - - ! Determine indices of larger and smaller particles (of the pair) - if (r2 .ge. r1) then - r_larg = r2 - r_smal = r1 - i_larg = i2 - i_smal = i1 - ig_larg = j2 - ig_smal = j1 - d_larg = dj - else - r_larg = r1 - r_smal = r2 - i_larg = i1 - i_smal = i2 - ig_larg = j1 - ig_smal = j2 - d_larg = di - endif - - ! Calculate enhancement of coagulation due to convective diffusion - ! as described in Pruppacher and Klett (Eqs. 17-12 and 17-14). - - ! Enhancement applies to larger particle. - re_larg = re(k,i_larg,ig_larg) - - ! is Peclet number. - pe = re_larg*rmu(k) / (rhoa_cgs*d_larg) - pe3 = pe**(1._f/3._f) - - ! is convective diffusion coagulation coefficient - if( re_larg .lt. 1._f )then - ccd = 0.45_f*cbr*pe3 - else - ccd = 0.45_f*cbr*pe3*re_larg**(ONE/6._f) - endif - - ! Next calculate gravitational collection kernel. - - ! First evaluate collection efficiency . - if( icollec .eq. I_COLLEC_CONST )then - ! constant value - e_coll = grav_e_coll0 - else if( icollec .eq. I_COLLEC_FUCHS )then - ! Find maximum of Langmuir's formulation and Fuchs' value. - ! First calculate Langmuir's efficiency . - - ! is stokes number. - ! is the fallspeed in cartesian coordinates.! - vfc_smal = vf(k,i_smal,ig_smal) * zmet(k) - vfc_larg = vf(k,i_larg,ig_larg) * zmet(k) - - sk = vfc_smal * (vfc_larg - vfc_smal) / (r_larg*GRAV) - - if( sk .lt. 0.08333334_f )then - e1 = 0._f - else - e1 = (sk/(sk + 0.25_f))**2 - endif - - if( sk .lt. 1.214_f )then - e3 = 0._f - else - e3 = 1._f/(1._f+.75_f*log(2._f*sk)/(sk-1.214_f))**2 - endif - - if( re_larg .lt. 1._f )then - e_langmuir = e3 - else if( re_larg .gt. 1000._f )then - e_langmuir = e1 - else if( re_larg .le. 1000._f )then - re60 = re_larg/60._f - e_langmuir = (e3 + re60*e1)/(1._f + re60) - endif - - ! Next calculate Fuchs' efficiency (valid for r < 10 um). - pr = r_smal/r_larg - e_fuchs = (pr/(1.414_f*(1. + pr)))**2 - - e_coll = max( e_fuchs, e_langmuir ) - - else if( icollec .eq. I_COLLEC_DATA )then - - ! Interpolate input data (from data statment at beginning of subroutine). - pr = r_smal/r_larg - - ! First treat cases outside the data range - if( pr .lt. data_p(2) )then - - ! Radius ratio is smaller than lowest nonzero ratio in input data -- - ! use constant values (as in Beard and Ochs, 1984) if available, - ! otherwise use very small efficiencty - if( i2 .eq. i_larg )then - if( i2.eq.1 )then - e_coll = e_small - else - e_coll = e_coll2(i1,i2-1) - endif - else - if( i1.eq.1 )then - e_coll = e_small - else - e_coll = e_coll2(i1-1,i2) - endif - endif - - elseif( r_larg .lt. data_r(1) )then - ! Radius of larger particle is smaller than smallest radius in input data -- - ! assign very small efficiency. - e_coll = e_small - else - - ! Both droplets are either within grid (interpolate) or larger - ! droplet is larger than maximum on grid (extrapolate) -- in both cases - ! will interpolate on ratio of droplet radii. - - ! Find such that data_p(jp) <= pr <= data_p(jp+1) and calculate - ! = fractional distance of between points in - jp = NP_DATA - do jj = NP_DATA-1, 2, -1 - if( pr .le. data_p(jj+1) ) jp = jj - enddo - - ! should not need this if-stmt - if( jp .lt. NP_DATA )then - pblni = (pr - data_p(jp)) / (data_p(jp+1) - data_p(jp)) - else - ! nor this else-stmt - if (do_print) write(LUNOPRT, *) 'setupckern::ERROR NP_DATA < jp = ', jp - return - endif - - if( r_larg .gt. data_r(NR_DATA) )then - - ! Extrapolate on R and interpolate on p - ! - ! NOTE: This expression has a bugin it, since jr won't - ! be defined. - e_coll = (1._f-pblni)*data_e(jp ,jr) + & - ( pblni)*data_e(jp+1,jr) - - else - - ! Find such that data_r(jr) <= r_larg <= data_r(jr+1) and calculate - ! = fractional distance of between points in - jr = NR_DATA - do jj = NR_DATA-1, 1, -1 - if( r_larg .le. data_r(jj+1) ) jr = jj - enddo - rblni = (r_larg - data_r(jr)) / (data_r(jr+1) - data_r(jr)) - - ! Bilinear interpolation of logarithm of data. - e_coll = (1._f-pblni)*(1._f-rblni)*data_e(jp ,jr ) + & - ( pblni)*(1._f-rblni)*data_e(jp+1,jr ) + & - (1._f-pblni)*( rblni)*data_e(jp ,jr+1) + & - ( pblni)*( rblni)*data_e(jp+1,jr+1) - - ! (since data_e is logarithm of efficiencies) - term1 = (1._f-rblni)*(1._f-pblni)*data_e(jp,jr) - - if( jp .lt. NP_DATA )then - term2 = pblni*(1.-rblni)*data_e(jp+1,jr) - else - term2 = -100._f - endif - - if( jr .lt. NR_DATA )then - term3 = (1._f-pblni)*rblni*data_e(jp,jr+1) - else - term3 = -100._f - endif - - if( jr .lt. NR_DATA .and. jp .lt. NP_DATA )then - term4 = pblni*rblni*data_e(jp+1,jr+1) - else - term4 = -100._f - endif - - e_coll = exp(term1 + term2 + term3 + term4) - endif - endif - - e_coll2(i1,i2) = e_coll - endif - - ! Now calculate coalescence efficiency from Beard and Ochs - ! (J. Geophys. Res. 89, 7165-7169, 1984). - beta = log(r_smal*1.e4_f) + 0.44_f*log(r_larg*50._f) - b_coal = 0.0946_f*beta - 0.319_f - a_coal = sqrt(b_coal**2 + 0.00441) - x_coal = (a_coal-b_coal)**(ONE/3._f) & - - (a_coal+b_coal)**(ONE/3._f) - x_coal = x_coal + 0.459_f - - ! Limit extrapolated values to no less than 50% and no more than 100% - x_coal = max(x_coal,.5_f) - e_coal = min(x_coal,1._f) - - ! Now use coalescence efficiency and collision efficiency in definition - ! of (geometric) gravitational collection efficiency . - vfc_1 = vf(k,i1,j1) * zmet(k) - vfc_2 = vf(k,i2,j2) * zmet(k) - cgr = e_coal * e_coll * PI * rp**2 * abs( vfc_1 - vfc_2 ) - - ! Long's (1974) kernel that only depends on size of larger droplet - ! if( r_larg .le. 50.e-4_f )then - ! cgr = 1.1e10_f * vol(i_larg,ig_larg)**2 - ! else - ! cgr = 6.33e3_f * vol(i_larg,ig_larg) - ! endif - - ! Now combine all the coagulation and collection kernels into the - ! overall kernel. - ckernel(k,i1,i2,j1,j2) = cbr + ccd + cgr - - ! To avoid generation of large, non-physical hydrometeors by - ! coagulation, cut down ckernel for large radii - ! if( ( r1 .gt. 0.18_f .and. r2 .gt. 10.e-4_f ) .or. & - ! ( r2 .gt. 0.18_f .and. r1 .gt. 10.e-4_f ) ) then - ! ckernel(k,i1,i2,j1,j2) = ckernel(k,i1,i2,j1,j2) / 1.e6_f - ! endif - - enddo ! second particle bin - enddo ! first particle bin - endif ! icoag ne 0 - enddo ! second particle group - enddo ! first particle group - enddo ! vertical level - endif ! not constant - - ! return to caller with coagulation kernels evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupcoag.F90 b/CARMAchem_GridComp/CARMA/source/base/setupcoag.F90 deleted file mode 100644 index 3897d9a3..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupcoag.F90 +++ /dev/null @@ -1,388 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine sets up mapping arrays for coagulation. It only computes varaibles that -!! are independent of the model state. The calculation of factors needed for coagulation -!! that depend on state are calculated in setupckern. -!! -!! @author Eric Jensen -!! @ version Oct-1995 -subroutine setupcoag(carma, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carma_mod - - implicit none - - type(carma_type), intent(inout) :: carma !! the CARMA object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ielem, isolto, icompto, igto, ig, iepart - integer :: icompfrom, ic, iecore - integer :: isolfrom - integer :: igrp, jg, i, j , ipair - real(kind=f) :: rmsum - integer :: ibin - real(kind=f) :: rmkbin - integer :: kb, ncg - real(kind=f) :: rmk - logical :: fill_bot ! used for filling - integer :: irow, icol - logical :: isCoag - integer :: igtest - real(kind=f) :: pkernl, pkernu - - - ! NOTE: Moved this section from from setupckern.f, since it is not dependent on the - ! model's state. - ! - ! Fill , maintaining diagonal symmetry - ! ------------------------------------------- - ! Fill bottom of matrix if non-zero term(s) in upper half; - ! also check for non-zero, non-matching, non-diagonal terms. - fill_bot = .true. - do irow = 2, NGROUP - do icol = 1, irow-1 - if( icoag(irow,icol) .ne. 0 )then - fill_bot = .false. - if( icoag(icol,irow) .ne. 0 .and. & - icoag(icol,irow) .ne. icoag(irow,icol) )then - if (do_print) write(LUNOPRT, *) 'setupcoag::ERROR bad icoag array' - rc = -1 - return - endif - endif - enddo - enddo - - do ig = 2, NGROUP - do jg = 1, ig-1 - if( fill_bot )then - irow = ig - icol = jg - else - irow = jg - icol = ig - endif - icoag(irow,icol) = icoag(icol,irow) - enddo - enddo - - ! Initialize with zeros - do ielem = 1,NELEM - do ig = 1,NGROUP - icoagelem(ielem,ig) = 0 - icoagelem_cm(ielem,ig) = 0 - enddo - enddo - - ! For each element and each group , determine which element in - ! contributes to production in : . - ! If no elements in are transfered into element during coagulation, - ! then set to 0. - do ielem = 1,NELEM - isolto = isolelem(ielem) ! target solute type - icompto = icomp(ielem) ! target element compound - igto = igelem(ielem) ! target group - - do ig = 1, NGROUP ! source group - ! source particle number concentration element - iepart = ienconc(ig) - - ! source element compound - icompfrom = icomp(iepart) - - ! Check to see if the target group is produced by coagulation of any - ! group with the source group. - isCoag = .FALSE. - - do igtest = 1, NGROUP - if (icoag(ig, igtest) .eq. igto .or. icoag(igtest, ig) .eq. igto) then - isCoag = .TRUE. - endif - end do - - ! Only find the source production element if the group igto can - ! be produced by coagulation from group ig. - if (isCoag) then - - ! If only has no cores, then the only way to make particles - ! would be if the one element is the same type as the - ! source. - if( ncore(ig) .eq. 0 ) then - - if( icompfrom .eq. icompto )then - icoagelem(ielem,ig) = iepart - endif - else - - ! Search the elements in the group to see if one has the same - ! type as the source. - - ! First check the particle number concentration element of the group. - ! - ! NOTE: No matter what else happens, you need to adjust the total - ! particle mass. - if( icompfrom .eq. icompto )then - icoagelem(ielem,ig) = iepart - else - - ! Now check the other cores for a match. - do ic = 1,ncore(ig) - iecore = icorelem(ic,ig) ! absolute element number of core - icompfrom = icomp(iecore) ! source element compound - - if( icompfrom .eq. icompto ) then - - ! For core second moment elements, we need additional pairs of source - ! elements c to account for core moment production due to products - ! of source particle core mass. - if( itype(ielem) .eq. I_CORE2MOM )then - icoagelem_cm(ielem,ig) = iecore - icoagelem(ielem,ig) = imomelem(ig) - else - icoagelem(ielem,ig) = iecore - endif - endif - enddo - endif - endif - - ! If is a core mass type and is a pure CN group and the - ! solutes don't match, then set to zero to make sure no - ! coag production occurs. - if( itype(ielem) .eq. I_COREMASS .and. & - itype(ienconc(ig)).eq. I_INVOLATILE & - .and. ncore(ig) .eq. 0 ) then - isolfrom = isolelem(ienconc(ig)) - if( isolfrom .ne. isolto ) then - icoagelem(ielem,ig) = 0 - endif - endif - - ! If there is a source and this is a multi-component group, - ! then we need to make sure that the particle concentration - ! of the group also gets updated, since this keeps track of - ! the total mass. - if (icoagelem(ielem,ig) .ne. 0) then - if (ncore(igto) .ne. 0 .and. ielem .ne. ienconc(igto)) then - icoagelem(ienconc(igto), ig) = iepart - endif - endif - - endif - enddo ! end of (ig = 1, NGROUP) - enddo ! end of (ielem = 1,NELEM) - - - ! Coagulation won't work properly if any of the elements are produced by - ! items that come later in the element list than themselves. Report an - ! error if that is the case. - do ielem = 1, NELEM - do ig = 1, NGROUP - if (icoagelem(ielem, ig) .gt. ielem) then - if (do_print) write(LUNOPRT, '(a,i3,a,i3,a)') & - 'setupcoag::ERROR For coagulation, element (', & - icoagelem(ielem,ig), ') must come before (', ielem, & - ') in the element list.' - rc = -1 - return - endif - enddo - enddo - - - ! Calculate lower bin which coagulated particle goes into - ! and make sure it is less than +1 - ! - ! Colliding particles come from group , bin and group , bin - ! Resulting particle lands in group , between and + 1 - do igrp = 1, NGROUP - do ig = 1, NGROUP - do jg = 1, NGROUP - do i = 1, NBIN - do j = 1, NBIN - - rmsum = rmass(i,ig) + rmass(j,jg) - - do ibin = 1, NBIN-1 - if( rmsum .ge. rmass(ibin,igrp) .and. rmsum .lt. rmass(ibin+1,igrp) ) then - kbin(igrp,ig,jg,i,j) = ibin - endif - enddo - - ibin = NBIN - if( rmsum .ge. rmass(ibin,igrp) ) kbin(igrp,ig,jg,i,j) = NBIN - enddo - enddo - enddo - enddo - enddo - - ! Calculate partial loss fraction - ! - ! This fraction is needed because when a particle in bin collides - ! with a particle in bin resulting in a particle whose mass falls - ! between and +1, only partial loss occurs from bin . - ! - ! Since different particle groups have different radius grids, this - ! fraction is a function of the colliding groups and the resulting group. - do igrp = 1, NGROUP - do ig = 1, NGROUP - do jg = 1, NGROUP - - if( igrp .eq. icoag(ig,jg) ) then - - do i = 1, NBIN - do j = 1,NBIN - volx(igrp,ig,jg,i,j) = 1. - - if(kbin(igrp,ig,jg,i,j).eq.i) then - - ibin = kbin(igrp,ig,jg,i,j) - rmkbin = rmass(ibin,igrp) - volx(igrp,ig,jg,i,j) = 1. - & - (rmrat(igrp)*rmkbin-rmass(i,ig)-rmass(j,jg)) & - /(rmrat(igrp)*rmkbin-rmkbin)* & - rmass(i,ig)/(rmass(i,ig) + rmass(j,jg)) - endif - enddo - enddo - endif - enddo - enddo - enddo - - ! Calculate mapping functions that specify sets of quadruples - ! (group pairs and bin pairs) that contribute to production - ! in each bin. Mass transfer from to occurs due to - ! collisions between particles in and particles in . - ! 2 sets of quadruples must be generated: - ! low: k = ibin and (k != i or ig != igrp) and icoag(ig,jg) = igrp - ! up: k+1 = ibin and icoag(ig,jg) = igrp - ! - ! npair#(igrp,ibin) is the number of pairs in each set (# = l,u) - ! i#, j#, ig#, and jg# are the bin pairs and group pairs in each - ! set (# = low, up) - do igrp = 1, NGROUP - do ibin = 1, NBIN - - npairl(igrp,ibin) = 0 - npairu(igrp,ibin) = 0 - - do ig = 1, NGROUP - do jg = 1, NGROUP - do i = 1, NBIN - do j = 1, NBIN - kb = kbin(igrp,ig,jg,i,j) - ncg = icoag(ig,jg) - - if( kb+1.eq.ibin .and. ncg.eq.igrp ) then - npairu(igrp,ibin) = npairu(igrp,ibin) + 1 - iup(igrp,ibin,npairu(igrp,ibin)) = i - jup(igrp,ibin,npairu(igrp,ibin)) = j - igup(igrp,ibin,npairu(igrp,ibin)) = ig - jgup(igrp,ibin,npairu(igrp,ibin)) = jg - endif - - if( kb.eq.ibin .and. ncg.eq.igrp .and. (i.ne.ibin .or. ig.ne.igrp) ) then - npairl(igrp,ibin) = npairl(igrp,ibin) + 1 - ilow(igrp,ibin,npairl(igrp,ibin)) = i - jlow(igrp,ibin,npairl(igrp,ibin)) = j - iglow(igrp,ibin,npairl(igrp,ibin)) = ig - jglow(igrp,ibin,npairl(igrp,ibin)) = jg - endif - enddo - enddo - enddo - enddo - enddo - enddo - - -! NOTE: Split ckernel out of pkernel, so that it can be made independent of model state. -! It also reduces the size of the tables and should improve the intialization time. - -! Calculate variables needed in routine coagp.f - do igrp = 1, NGROUP - do jg = 1, NGROUP - do ig = 1, NGROUP - - if( igrp .eq. icoag(ig,jg) ) then - - do j = 1, NBIN - do i = 1, NBIN - - ibin = kbin(igrp,ig,jg,i,j) - rmk = rmass(ibin,igrp) - rmsum = rmass(i,ig) + rmass(j,jg) - - pkernl = (rmrat(igrp)*rmk - rmsum) / (rmrat(igrp)*rmk - rmk) - - pkernu = (rmsum - rmk) / (rmrat(igrp)*rmk - rmk) - - if( ibin .eq. NBIN )then - pkernl = rmsum / rmass(ibin,igrp) - pkernu = 0._f - endif - - pkernel(i,j,ig,jg,igrp,1) = pkernu * rmass(i,ig)/rmsum - pkernel(i,j,ig,jg,igrp,2) = pkernl * rmass(i,ig)/rmsum - pkernel(i,j,ig,jg,igrp,3) = pkernu * rmk*rmrat(igrp)/rmsum - pkernel(i,j,ig,jg,igrp,4) = pkernl * rmk/rmsum - pkernel(i,j,ig,jg,igrp,5) = pkernu * ( rmk*rmrat(igrp)/rmsum )**2 - pkernel(i,j,ig,jg,igrp,6) = pkernl * ( rmk/rmsum )**2 - enddo - enddo - endif - enddo - enddo - enddo - - ! Do some extra debugging reports (normally commented) - if (do_print_init) then - write(LUNOPRT,*) ' ' - write(LUNOPRT,*) 'Coagulation group mapping:' - do ig = 1, NGROUP - do jg = 1, NGROUP - write(LUNOPRT,*) 'ig jg icoag = ', ig, jg, icoag(ig,jg) - enddo - enddo - write(LUNOPRT,*) ' ' - write(LUNOPRT,*) 'Coagulation element mapping:' - do ielem = 1, NELEM - do ig = 1, NGROUP - write(LUNOPRT,*) 'ielem ig icoagelem icomp(ielem) = ', & - ielem, ig, icoagelem(ielem,ig), icomp(ielem) - enddo - enddo - write(LUNOPRT,*) ' ' - write(LUNOPRT,*) 'Coagulation bin mapping arrays' - do igrp = 1, NGROUP - do ibin = 1,3 - write(LUNOPRT,*) 'igrp, ibin = ',igrp, ibin - do ipair = 1,npairl(igrp,ibin) - write(LUNOPRT,*) 'low:np,ig,jg,i,j ', & - ipair,iglow(igrp,ibin,ipair), & - jglow(igrp,ibin,ipair), ilow(igrp,ibin,ipair), & - jlow(igrp,ibin,ipair) - enddo - do ipair = 1,npairu(igrp,ibin) - write(LUNOPRT,*) 'up:np,ig,jg,i,j ', & - ipair,igup(igrp,ibin,ipair), & - jgup(igrp,ibin,ipair), iup(igrp,ibin,ipair), & - jup(igrp,ibin,ipair) - enddo - enddo - enddo - endif - - ! Return to caller with coagulation mapping arrays defined - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupgkern.F90 b/CARMAchem_GridComp/CARMA/source/base/setupgkern.F90 deleted file mode 100644 index 5e05e43b..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupgkern.F90 +++ /dev/null @@ -1,324 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine defines radius-dependent but time-independent parameters -!! used to calculate condensational growth of particles. Growth rates -!! are calculated at bin boundaries: the parameters calculated here -!! ( , , , and ) -!! are defined at lower bin boundaries through the growth rate expression -!! (for one particle) used in growevapl.f: -!!> -!! dm = gro*pvap*( S + 1 - Ak*As - gro1*gro2*qrad ) -!! -- ------------------------------------------- -!! dt 1 + gro*gro1*pvap -!! -!! where -!! -!! S = supersaturation -!! Ak = exp(akelvin/r) -!! As = exp(-sol_ions * solute_mass/solwtmol * gwtmol/condensate_mass) -!! pvap = saturation vapor pressure [dyne cm**-2] -!! qrad = radiative energy absorbed -!!< -!! This routine requires that vertical profiles of temperature , -!! and pressure

      are defined. -!! -!! This routine also requires that particle Reynolds' numbers are -!! defined (setupvfall.f must be called before this). -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine setupgkern(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igas !! gas index - integer :: ielem !! element index - integer :: k !! z index - integer :: igroup !! group index - integer :: i - real(kind=f) :: gstick - real(kind=f) :: cor - real(kind=f) :: phish - real(kind=f) :: esh1 - real(kind=f) :: a1 - real(kind=f) :: br - real(kind=f) :: rknudn - real(kind=f) :: rknudnt - real(kind=f) :: rlam - real(kind=f) :: rlamt - real(kind=f) :: rhoa_cgs(NZ, NGAS) - real(kind=f) :: freep(NZ, NGAS) - real(kind=f) :: freept(NZ, NGAS) - real(kind=f) :: rlh - real(kind=f) :: diffus1 - real(kind=f) :: thcond1 - real(kind=f) :: reyn_shape - real(kind=f) :: schn - real(kind=f) :: prnum - real(kind=f) :: x1 - real(kind=f) :: x2 - real(kind=f) :: fv - real(kind=f) :: surf_tens ! surface tension of H2SO4 particle - real(kind=f) :: rho_H2SO4 ! wet density of H2SO4 particle - - - ! Calculate gas properties for all of the gases. Better to do them all once, than to - ! repeat this for multiple groups. - do igas = 1, NGAS - - ! Radius-independent parameters for condensing gas - ! - ! This is in cgs units. - ! - rhoa_cgs(:, igas) = rhoa(:) / (xmet(:)*ymet(:)*zmet(:)) - - if (igas .eq. igash2o) then - - ! Condensing gas is water vapor - ! - ! is surface tension of water-air interface (valid from 0 to 40 C) - ! from Pruppacher and Klett (eq. 5-12). - surfctwa(:) = 76.10_f - 0.155_f*( t(:) - 273.16_f ) - - ! is surface tension of water-ice interface - ! from Pruppacher and Klett (eq. 5-48).! - surfctiw(:) = 28.5_f + 0.25_f*( t(:) - 273.16_f ) - - ! is surface tension of water-ice interface - ! from Hale and Plummer [J. Chem. Phys., 61, 1974]. - surfctia(:) = 141._f - 0.15_f * t(:) - - ! is argument of exponential in kelvin curvature term. - akelvin(:,igas) = 2._f*gwtmol(igas)*surfctwa(:) & - / ( t(:)*RHO_W*RGAS ) - - akelvini(:,igas) = 2._f*gwtmol(igas)*surfctia(:) & - / ( t(:)*RHO_W*RGAS ) - - ! condensing gas is H2SO4 - else if (igas .eq. igash2so4) then - - ! Calculate Kelvin curvature factor for H2SO4 interactively with temperature: - do k = 1, NZ - surf_tens = sulfate_surf_tens(carma, wtpct(k), t(k), rc) - rho_H2SO4 = sulfate_density(carma, wtpct(k), t(k), rc) - akelvin(k, igas) = 2._f * gwtmol(igas) * surf_tens / (t(k) * rho_H2SO4 * RGAS) - - ! Not doing condensation of h2So4 on ice, so just set it to the value - ! for water vapor. - akelvini(k, igas) = akelvini(k, igash2o) - end do - else if (igas .eq. igashno3) then - ! Not growing anything with HNO3 - ! Just grabbing akelvin for h2so4(liq)/water vapor(ice) - do k = 1, NZ - surf_tens = sulfate_surf_tens(carma, wtpct(k), t(k), rc) - rho_H2SO4 = sulfate_density(carma, wtpct(k), t(k), rc) - akelvin(k, igas) = 2._f * gwtmol(igas) * surf_tens / (t(k) * rho_H2SO4 * RGAS) - akelvini(k, igas) = akelvini(k, igash2o) - end do - else - - ! Condensing gas is not yet configured. - if (do_print) write(LUNOPRT,*) 'setupgkern::ERROR - invalid igas' - rc = RC_ERROR - return - endif - - ! Molecular free path of condensing gas - freep(:,igas) = 3._f*diffus(:,igas) & - * sqrt( ( PI*gwtmol(igas) ) / ( 8._f*RGAS*t(:) ) ) - - ! Thermal free path of condensing gas - freept(:,igas) = freep(:,igas)*thcond(:) / & - ( diffus(:,igas) * rhoa_cgs(:, igas) & - * ( CP - RGAS/( 2._f*WTMOL_AIR ) ) ) - end do - - - ! Loop over aerosol groups only (no radius, gas, or spatial dependence). - do igroup = 1, NGROUP - - ! Use gstickl or gsticki, depending on whether group is ice or not - if( is_grp_ice(igroup) ) then - gstick = gsticki - else - gstick = gstickl - endif - - ! Non-spherical corrections (need a reference for these) - if( ishape(igroup) .eq. I_SPHERE )then - - ! Spheres - cor = 1._f - phish = 1._f - else - - if( ishape(igroup) .eq. I_HEXAGON )then - - ! Hexagons - phish = 6._f/PI*tan(PI/6._f)*( eshape(igroup) + 0.5_f ) & - * ( PI / ( 9._f*eshape(igroup)*tan(PI/6._f) ) )**(2._f/3._f) - - else if( ishape(igroup) .eq. I_CYLINDER )then - - ! Spheroids - phish = ( eshape(igroup) + 0.5_f ) & - * ( 2._f / ( 3._f*eshape(igroup) ) )**(2._f/3._f) - endif - - if( eshape(igroup) .lt. 1._f )then - - ! Oblate spheroids - esh1 = 1._f / eshape(igroup) - a1 = sqrt(esh1**2 - 1._f) - cor = a1 / asin( a1 / esh1 ) / esh1**(2._f/3._f) - else - - ! Prolate spheroids - a1 = sqrt( eshape(igroup)**2 - 1._f ) - cor = a1 / log( eshape(igroup) + a1 ) & - / eshape(igroup)**(ONE/3._f) - endif - endif - - ! Evaluate growth terms only for particle elements that grow. - ! particle number concentration element - ielem = ienconc(igroup) - - ! condensing gas is - igas = igrowgas(ielem) - - ! If the group doesn't grow, but is involved in aerosol - ! freezing, then the gas properties still need to be calculated. - if( igas .eq. 0 ) igas = inucgas(igroup) - - if( igas .ne. 0 )then - - do k = 1, NZ - - ! Latent heat of condensing gas - if( is_grp_ice(igroup) )then - rlh = rlhe(k,igas) + rlhm(k,igas) - else - rlh = rlhe(k,igas) - endif - - ! Radius-dependent parameters - do i = 1, NBIN - - br = rlow_wet(k,i,igroup) ! particle bin Boundary Radius - - ! These are Knudsen numbers - rknudn = freep(k,igas) / br - rknudnt = freept(k,igas) / br - - ! These are "lambdas" used in correction for gas kinetic effects. - rlam = ( 1.33_f*rknudn + 0.71_f ) / ( rknudn + 1._f ) & - + ( 4._f*( 1._f - gstick ) ) / ( 3._f*gstick ) - - rlamt = ( 1.33_f*rknudnt + 0.71_f ) / ( rknudnt + 1._f ) & - + ( 4._f*( 1._f - tstick ) ) / ( 3._f*tstick ) - - ! Diffusion coefficient and thermal conductivity modified for - ! free molecular limit and for particle shape. - diffus1 = diffus(k,igas)*cor / ( 1._f + rlam*rknudn*cor/phish ) - thcond1 = thcond(k)*cor / ( 1._f + rlamt*rknudnt*cor/phish ) - - ! Save the modified thermal conductivity off so it can be used in pheat. - thcondnc(k,i,igroup) = thcond1 - - ! Reynolds' number based on particle shape - if( ishape(igroup) .eq. I_SPHERE )then - reyn_shape = re(k,i,igroup) - - else if( eshape(igroup) .lt. 1._f )then - reyn_shape = re(k,i,igroup) * ( 1._f + 2._f*eshape(igroup) ) - - else - reyn_shape = re(k,i,igroup) * PI*( 1._f+2._f*eshape(igroup) ) & - / ( 2._f*( 1._f + eshape(igroup) ) ) - endif - - ! Particle Schmidt number - schn = rmu(k) / ( rhoa_cgs(k,igas) * diffus1 ) - - ! Prandtl number - prnum = rmu(k)*CP/thcond1 - - ! Ventilation factors and from Pruppacher and Klett - x1 = schn **(ONE/3._f) * sqrt( reyn_shape ) - x2 = prnum**(ONE/3._f) * sqrt( reyn_shape ) - - if( is_grp_ice(igroup) )then - - ! Ice crystals - if( x1 .le. 1._f )then - fv = 1._f + 0.14_f*x1**2 - else - fv = 0.86_f + 0.28_f*x1 - endif - - if( x2 .le. 1._f )then - ft(k,i,igroup) = 1._f + 0.14_f*x2**2 - else - ft(k,i,igroup) = 0.86_f + 0.28_f*x2 - endif - else - - ! Liquid water drops - if( x1 .le. 1.4_f )then - fv = 1._f + 0.108_f*x1**2 - else - fv = 0.78_f + 0.308_f*x1 - endif - - if( x2 .le. 1.4_f )then - ft(k,i,igroup) = 1._f + 0.108_f*x2**2 - else - ft(k,i,igroup) = 0.78_f + 0.308_f*x2 - endif - endif - - ! Growth kernel for particle without radiation or heat conduction at - ! radius lower boundary [g cm^3 / erg / s] - gro(k,i,igroup) = 4._f*PI*br & - * diffus1*fv*gwtmol(igas) & - / ( BK*t(k)*AVG ) - - ! Coefficient for conduction term in growth kernel [s/g] - gro1(k,i,igroup) = gwtmol(igas)*rlh**2 & - / ( RGAS*t(k)**2*ft(k,i,igroup)*thcond1 ) & - / ( 4._f*PI*br ) - - ! Coefficient for radiation term in growth kernel [g/erg] - ! (note: no radial dependence). - if( i .eq. 1 )then - gro2(k,igroup) = 1._f / rlh - endif - - enddo ! i=1,NBIN - enddo ! k=1,NZ - endif ! igas ne 0 - enddo ! igroup=1,NGROUP - - ! Return to caller with time-independent particle growth - ! parameters initialized. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupgrow.F90 b/CARMAchem_GridComp/CARMA/source/base/setupgrow.F90 deleted file mode 100644 index bf8a68fa..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupgrow.F90 +++ /dev/null @@ -1,131 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine defines time-independent parameters used to calculate -!! condensational growth/evaporation. -!! -!! The parameters defined for each gas are -!1> -!! gwtmol: molecular weight [g/mol] -!! diffus: diffusivity [cm^2/s] -!! rlhe : latent heat of evaporation [cm^2/s^2] -!! rlhm : latent heat of melting [cm^2/s^2] -!!< -!! Time-independent parameters that depend on particle radius are -!! defined in setupgkern.f. -!! -!! This routine requires that vertical profiles of temperature , -!! and pressure

      are defined. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine setupgrow(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variable - integer :: ielem !! element index - integer :: k !! z index - integer :: i - real(kind=f) :: rhoa_cgs, aden - ! Define formats - 1 format(a,': ',12i6) - 2 format(a,': ',i6) - 3 format(/' id gwtmol gasname',(/,i3,3x,f5.1,3x,a)) - 5 format(/,'Particle growth mapping arrays (setupgrow):') - - - !-----Check that values are valid------------------------------------------ - do ielem = 1, NELEM - if( igrowgas(ielem) .gt. NGAS )then - if (do_print) write(LUNOPRT,*) 'setupgrow::ERROR - component of igrowgas > NGAS' - rc = -1 - return - endif - enddo - - ! Define parameters with weak time-dependence to be used in - ! growth equation. - do k = 1, NZ - - ! Diffusivity of water vapor in air from Pruppacher & Klett (eq. 13-3); - ! units are [cm^2/s]. - if (igash2o /= 0) then - diffus(k, igash2o) = 0.211_f * (1.01325e+6_f / p(k)) * (t(k) / 273.15_f )**1.94_f - - ! Latent heat of evaporation for water; units are [cm^2/s^2] - if (do_cnst_rlh) then - rlhe(k, igash2o) = RLHE_CNST - else - ! from Stull - rlhe(k, igash2o) = (2.5_f - .00239_f * (t(k) - 273.16_f)) * 1.e10_f - end if - - ! Latent heat of ice melting; units are [cm^2/s^2] - if (do_cnst_rlh) then - rlhm(k, igash2o) = RLHM_CNST - else - - ! from Pruppacher & Klett (eq. 4-85b) - ! - ! NOTE: This expression yields negative values for rlmh at mesospheric - ! temperatures. - rlhm(k, igash2o) = (79.7_f + 0.485_f * (t(k) - 273.16_f) - 2.5e-3_f * & - ((t(k) - 273.16_f)**2)) * 4.186e7_f - end if - end if - - ! Properties for H2SO4 - if (igash2so4 /= 0) then - ! Diffusivity - rhoa_cgs = rhoa(k) / (xmet(k) * ymet(k) * zmet(k)) - aden = rhoa_cgs * AVG / WTMOL_AIR - diffus(k,igash2so4) = 1.76575e+17_f * sqrt(t(k)) / aden - - ! HACK: make H2SO4 latent heats same as water - rlhe(k,igash2so4) = rlhe(k, igash2o) - rlhm(k,igash2so4) = rlhe(k, igash2o) - end if - - ! Properties for HNO3 - ! PAC: Making these the same as H2SO4 for now. - if (igashno3 /= 0) then - ! Diffusivity - rhoa_cgs = rhoa(k) / (xmet(k) * ymet(k) * zmet(k)) - aden = rhoa_cgs * AVG / WTMOL_AIR - diffus(k,igashno3) = 1.76575e+17_f * sqrt(t(k)) / aden - - ! HACK: make H2SO4 latent heats same as water - rlhe(k,igashno3) = rlhe(k, igash2o) - rlhm(k,igashno3) = rlhe(k, igash2o) - end if - - enddo - -#ifdef DEBUG - ! Report some initialization values - if (do_print_init) then - write(LUNOPRT,5) - write(LUNOPRT,2) 'NGAS ',NGAS - write(LUNOPRT,1) 'igrowgas',(igrowgas(i),i=1,NELEM) - write(LUNOPRT,3) (i,gwtmol(i),gasname(i),i=1,NGAS) - endif -#endif - - ! Return to caller with particle growth mapping arrays and time-dependent - ! parameters initialized. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupnuc.F90 b/CARMAchem_GridComp/CARMA/source/base/setupnuc.F90 deleted file mode 100644 index 3862ab85..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupnuc.F90 +++ /dev/null @@ -1,97 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates derived mapping arrays and calculates the critical -!! supersaturation used to nucleate dry particles (CN) to droplets. -!! -!! This routine requires that array is defined. -!! (i.e., setupgkern.f must be called before this) -!! -!! NOTE: Most of the code from this routine has been moced to CARMA_InitializeGrowth -!! because it does not rely upon the model's state and thus can be called one during -!! CARMA_Initialize rather than being called every timestep if left in this routine. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine setupnuc(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: igas ! gas index - integer :: isol ! solute index - integer :: ibin ! bin index - integer :: k ! z index - real(kind=f) :: bsol - integer :: i - - ! Define formats - 3 format(a,a) - 6 format(i4,5x,1p2e11.3) - 8 format(/,'Critical supersaturations for ',a,//, ' i r [cm] scrit',/) - - - ! Define critical supersaturation and target bin for each (dry) particle - ! size bin that is subject to nucleation. - ! (only for CN groups subject to nucleation) - do igroup = 1,NGROUP - - igas = inucgas(igroup) - - if( igas .ne. 0 .and. itype( ienconc( igroup ) ) .eq. I_INVOLATILE )then - - isol = isolelem( ienconc( igroup ) ) - - ! If here is no solute are specified, then no scrit value is defined. - if (isol .ne. 0) then - - do ibin = 1,NBIN - - ! This is term "B" in Pruppacher and Klett's eqn. 6-28. - bsol = 3._f*sol_ions(isol)*rmass(ibin,igroup)*gwtmol(igas) & - / ( 4._f*PI*solwtmol(isol)*RHO_W ) - - ! Loop over vertical grid layers because of temperature dependence - ! in solute term. - do k = 1,NZ - scrit(k,ibin,igroup) = sqrt( 4._f * akelvin(k,igas)**3 / ( 27._f * bsol ) ) - enddo - enddo - endif - endif - enddo - -#ifdef DEBUG - if (do_print_init) then - do isol = 1,NSOLUTE - - write(LUNOPRT,3) 'solute name: ',solname(isol) - - do igroup = 1,NGROUP - if( isol .eq. isolelem(ienconc(igroup)) )then - write(LUNOPRT,8) groupname(igroup) - write(LUNOPRT,6) (i,r(i,igroup),scrit(1,i,igroup),i=1,NBIN) - endif - enddo - enddo - endif -#endif - - ! Return to caller with nucleation mapping arrays and critical - ! supersaturations defined. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupvdry.F90 b/CARMAchem_GridComp/CARMA/source/base/setupvdry.F90 deleted file mode 100644 index 2caa8da6..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupvdry.F90 +++ /dev/null @@ -1,106 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the dry deposition velocity, vd [cm s^-1] -!! Method: Zhang et al., 2001 -!! vd = vf(pver) + 1./ (rs + ra) -!! rs is the surface resistance, which is calculated in here -!! ra is the aerodynamic resistance, which is from parent dynamic model, like CAM -!! use carma_do_drydep flag optionally to decide if the CARMA or the parent model does the dry deposition -!! @author Tianyi Fan -!! @version Nov-2010 -subroutine setupvdry(carma, cstate, lndfv, ocnfv, icefv, lndram, ocnram, iceram, lndfrac, ocnfrac, icefrac, rc) - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - real(kind=f), intent(in) :: lndfv !! the surface friction velocity over land [cm/s] - real(kind=f), intent(in) :: ocnfv !! the surface friction velocity over ocean [cm/s] - real(kind=f), intent(in) :: icefv !! the surface friction velocity over ice [cm/s] - real(kind=f), intent(in) :: lndram !! the aerodynamic resistance over land [s/cm] - real(kind=f), intent(in) :: ocnram !! the aerodynamic resistance over ocean [s/cm] - real(kind=f), intent(in) :: iceram !! the aerodynamic resistance over ice [s/cm] - real(kind=f), intent(in) :: lndfrac !! land fraction - real(kind=f), intent(in) :: ocnfrac !! ocn fraction - real(kind=f), intent(in) :: icefrac !! ice fraction - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: ielem, igroup, ibin, icnst, k - real(kind=f) :: vd_lnd, vd_ocn, vd_ice ! the deposition velocity of land,ocean and sea ice - real(kind=f) :: rs ! surface resistance [s/m] - real(kind=f) :: vfall(NBIN, NGROUP) ! fall velocity [m/s] - integer :: cnsttype ! if constituent is prognostic - integer :: maxbin ! last prognostic bin - integer :: ibot, ibotp1 ! index of bottom layer - - - if (do_drydep) then - - if (igridv .eq. I_CART) then - ibot = 1 - ibotp1 = 1 - vfall(:,:) = vf(ibotp1, :, :) ![cm/s] - else - ibot = NZ - ibotp1 = NZP1 - vfall(:,:) = -vf(ibotp1, :, :) * zmetl(ibotp1) ! [z_unit/s] -> [cm/s] - end if - - do ielem = 1, NELEM - igroup = igelem(ielem) - - if (grp_do_drydep(igroup)) then - do ibin = 1, NBIN - vd_lnd = 0._f - vd_ocn = 0._f - vd_ice = 0._f - - ! land - if (lndfrac > 0._f) then - call calcrs(carma, cstate, lndfv, t(ibot), r_wet(ibot, ibin, igroup), & - bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 1, rc) - vd_lnd = vfall(ibin, igroup) + 1._f / (lndram + rs) - end if - - ! ocean - if (ocnfrac > 0._f) then - call calcrs(carma, cstate, ocnfv, t(ibot), r_wet(ibot, ibin, igroup), & - bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 2, rc) - vd_ocn = vfall(ibin, igroup) + 1._f / (ocnram + rs) - end if - - ! sea ice - if (icefrac > 0._f) then - call calcrs(carma, cstate, icefv, t(ibot), r_wet(ibot, ibin, igroup), & - bpm(ibot, ibin, igroup), vfall(ibin,igroup), rs, 3, rc) - vd_ice = vfall(ibin, igroup) + 1._f / (iceram + rs) - end if - - vd(ibin, igroup) = (lndfrac * vd_lnd + ocnfrac * vd_ocn + icefrac * vd_ice) ![cm/s] - end do ! ibin - else - vd(:, igroup) = vfall(:, igroup) ! [cm/s] - end if ! if grp_do_drydep - end do ! ielem - - ! change scale for non-catesian vertical coordinate - ! Scale cartesian fallspeeds to the appropriate vertical coordinate system. - ! Non--cartesion coordinates are assumed to be positive downward, but - ! vertical velocities in this model are always assumed to be positive upward. - if( igridv /= I_CART )then - vd(:,:) = -vd(:,:) / zmetl(NZP1) - end if - end if - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupvf.F90 b/CARMAchem_GridComp/CARMA/source/base/setupvf.F90 deleted file mode 100644 index 28217f13..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupvf.F90 +++ /dev/null @@ -1,186 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates fall velocities for particles. Since there are -!! several different approaches, this routine dispatches the call to the -!! proper subordinate routine based upon the setup routine defined in the -!! particle group. -!! -!! -!! @author Andy Ackerman -!! @version Mar-2010 -subroutine setupvf(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use wetr - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup, i, j, k, k1, k2, ibin, iz, nzm1 - integer :: iepart - real(kind=f) :: r_tmp(NBIN,NGROUP) - real(kind=f) :: h2o_mass - real(kind=f) :: h2o_vmr, hno3_vmr, h2so4m - - ! Define formats - 2 format(/,'Fall velocities and Reynolds number (prior to interpolation)') - 3 format(/,'Particle group ',i3,' using algorithm ',i3,/,' bin lev p [dyne/cm2] T [K] r [cm] wet r [cm] bpm', & - ' vf [cm/s] re'/) - 4 format(i3,4x,i3,7(1pe11.3,4x)) - - ! Loop over all groups. - do igroup = 1, NGROUP - - ! Special handling for vf_const < 0 (if, then abs(vf_const) = dry particle radius [cm]) - ! PAC: do I need to add logic for STS here? - if( ifall == 0 .and. vf_const < 0._f) then - r_tmp = abs(vf_const) - do iz = 1, NZ - do ibin = 1, NBIN - if (irhswell(igroup) == I_WTPCT_H2SO4 .OR. & - (irhswell(igroup) == I_WTPCT_STS .AND. t(iz) > 200.)) then - h2o_mass = gc(iz, igash2o) / (xmet(iz) * ymet(iz) * zmet(iz)) - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_mass=h2o_mass, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz)) - else if (irhswell(igroup) == I_WTPCT_STS) then - iepart = ienconc(igroup) ! element of particle number concentration - h2o_vmr = gc(iz, igash2o) / gwtmol(igash2o) * WTMOL_AIR - hno3_vmr = gc(iz, igashno3) / gwtmol(igashno3) * WTMOL_AIR - h2so4m = sum(rmass(:, igroup) * pc(iz, :, iepart)) + & - gc(iz, igash2so4) / (xmet(iz) * ymet(iz) * zmet(iz)) - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_vmr=h2o_vmr, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz), press=cstate%f_p(iz), h2so4m = h2so4m, & - hno3_vmr = hno3_vmr) - else - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc) - endif - if (rc < 0) return - enddo - enddo - endif - - ! There are different implementations of the fall velocity calculation. Some of - ! these routines may be more appropriate for certain types of partciles. - select case(ifallrtn(igroup)) - - case (I_FALLRTN_STD) - call setupvf_std(carma, cstate, igroup, rc) - - case(I_FALLRTN_STD_SHAPE) - call setupvf_std_shape(carma, cstate, igroup, rc) - - case(I_FALLRTN_HEYMSFIELD2010) - call setupvf_heymsfield2010(carma, cstate, igroup, rc) - - case default - if (do_print) write(LUNOPRT,*) "setupvf:: ERROR - Unknown fall velocity routine (", ifallrtn(igroup), & - ") for group (", igroup, ")." - rc = -1 - return - end select - enddo - - ! Constant value if = 0 - if (ifall .eq. 0) then - if(vf_const > 0) then - vf(:,:,:) = vf_const - else - do igroup = 1, NGROUP - ! Special handling for vf_const < 0 (if, then abs(vf_const) = dry particle radius [cm]) - do iz = 1, NZ - do ibin = 1, NBIN - if (irhswell(igroup) == I_WTPCT_H2SO4 .OR. & - (irhswell(igroup) == I_WTPCT_STS .AND. t(iz) > 200.)) then - h2o_mass = gc(iz, igash2o) / (xmet(iz) * ymet(iz) * zmet(iz)) - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_mass=h2o_mass, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz)) - else if (irhswell(igroup) == I_WTPCT_STS) then - iepart = ienconc(igroup) ! element of particle number concentration - h2o_vmr = gc(iz, igash2o) / gwtmol(igash2o) * WTMOL_AIR - hno3_vmr = gc(iz, igashno3) / gwtmol(igashno3) * WTMOL_AIR - h2so4m = sum(rmass(:, igroup) * pc(iz, :, iepart)) + & - gc(iz, igash2so4) / (xmet(iz) * ymet(iz) * zmet(iz)) - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc, h2o_vmr=h2o_vmr, & - h2o_vp=pvapl(iz, igash2o), temp=t(iz), press=cstate%f_p(iz), h2so4m = h2so4m, & - hno3_vmr = hno3_vmr) - else - call getwetr(carma, igroup, relhum(iz), r(ibin,igroup), r_wet(iz,ibin,igroup), & - rhop(iz,ibin,igroup), rhop_wet(iz,ibin,igroup), rc) - endif - if (rc < 0) return - enddo - enddo - enddo - endif - end if - - ! Print out fall velocities and reynolds' numbers. -#ifdef DEBUG - if (do_print_init) then - - write(LUNOPRT,2) - - do j = 1, NGROUP - - write(LUNOPRT,3) j, ifallrtn(j) - - do i = 1,NBIN - - do k = NZ, 1, -1 - write(LUNOPRT,4) i,k,p(k),t(k),r(i,j),r_wet(k,i,j),bpm(k,i,j),vf(k,i,j),re(k,i,j) - end do - enddo - enddo - - write(LUNOPRT,*) "" - end if -#endif - - ! Interpolate from layer mid-pts to layer boundaries. - ! is the fall velocity at the lower edge of the layer - nzm1 = max(1, NZ-1) - - ! Set upper boundary before averaging - vf(NZP1,:,:) = vf(NZ,:,:) - - if (NZ .gt. 1) then - vf(NZ,:,:) = sqrt(vf(nzm1,:,:) * vf(NZ,:,:)) - - if (NZ .gt. 2) then - do iz = NZ-1, 2, -1 - vf(iz,:,:) = sqrt(vf(iz-1,:,:) * vf(iz,:,:)) - enddo - endif - endif - - ! Scale cartesian fallspeeds to the appropriate vertical coordinate system. - ! Non--cartesion coordinates are assumed to be positive downward, but - ! vertical velocities in this model are always assumed to be positive upward. - if( igridv .ne. I_CART )then - do igroup=1,NGROUP - do ibin=1,NBIN - vf(:,ibin,igroup) = -vf(:,ibin,igroup) / zmetl(:) - enddo - enddo - endif - - ! Return to caller with fall velocities evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupvf_heymsfield2010.F90 b/CARMAchem_GridComp/CARMA/source/base/setupvf_heymsfield2010.F90 deleted file mode 100644 index 0dd1aaaf..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupvf_heymsfield2010.F90 +++ /dev/null @@ -1,90 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle fall velocities, vf(k) [cm s^-1] -!! and reynolds' numbers based on fall velocities, re(j,i,k) [dimensionless]. -!! indices correspond to vertical level , bin index , and aerosol -!! group . -!! -!! Method: Use the routined from Heymsfield and Westbrook [2010], which is -!! designed only for ice particles. Thus this routine uses the dry mass and -!! radius, not the wet mass and radius. The area ration (Ar) is determined -!! based upon the formulation of Schmitt and Heymsfield [JAS, 2009]. -!! -!! @author Chuck Bardeen -!! @version Mar-2010 -subroutine setupvf_heymsfield2010(carma, cstate, j, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: j !! group index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i, k - real(kind=f) :: rhoa_cgs, vg, rmfp, rkn, expon, x - real(kind=f), parameter :: c0 = 0.35_f - real(kind=f), parameter :: delta0 = 8.0_f - - real(kind=f) :: dmax ! maximum diameter - - - ! Loop over all atltitudes. - do k = 1, NZ - - ! This is in cartesian coordinates (good old cgs units) - rhoa_cgs = rhoa(k) / (xmet(k)*ymet(k)*zmet(k)) - - ! is mean thermal velocity of air molecules [cm/s] - vg = sqrt(8._f / PI * R_AIR * t(k)) - - ! is mean free path of air molecules [cm] - rmfp = 2._f * rmu(k) / (rhoa_cgs * vg) - - ! Loop over particle size bins. - do i = 1,NBIN - - ! is knudsen number -! rkn = rmfp / r(i,j) - rkn = rmfp / (r_wet(k,i,j) * rrat(i,j)) - - ! is the slip correction factor, the correction term for - ! non-continuum effects. Also used to calculate coagulation kernels - ! and diffusion coefficients. - expon = -.87_f / rkn - expon = max(-POWMAX, expon) - bpm(k,i,j) = 1._f + (1.246_f*rkn + 0.42_f*rkn*exp(expon)) - - dmax = 2._f * r_wet(k,i,j) * rrat(i,j) - - x = (rhoa_cgs / (rmu(k)**2)) * & - ((8._f * rmass(i,j) * GRAV) / (PI * (arat(i,j)**0.5_f))) - - ! Apply the slip correction factor. This is not included in the formulation - ! from Heymsfield and Westbrook [2010]. - ! - ! NOTE: This is applied according to eq 8.46 and surrounding discussion in - ! Seinfeld and Pandis [1998]. - x = x * bpm(k,i,j) - - re(k,i,j) = ((delta0**2) / 4._f) * (sqrt(1._f + (4._f * sqrt(x) / (delta0**2 * sqrt(c0)))) - 1._f)**2 - - - vf(k,i,j) = rmu(k) * re(k,i,j) / (rhoa_cgs * dmax) - enddo ! - enddo ! - - ! Return to caller with particle fall velocities evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupvf_std.F90 b/CARMAchem_GridComp/CARMA/source/base/setupvf_std.F90 deleted file mode 100644 index 8012df7e..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupvf_std.F90 +++ /dev/null @@ -1,138 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle fall velocities, vf(k) [cm s^-1] -!! and reynolds' numbers based on fall velocities, re(j,i,k) [dimensionless]. -!! indices correspond to vertical level , bin index , and aerosol -!! group . -!! -!! Method: first use Stokes flow (with Fuchs' size corrections, -!! valid only for Stokes flow) to estimate fall velocity, then calculate -!! Reynolds' number (Re) (for spheres, Stokes drag coefficient is 24/Re). -!! Then for Re > 1, correct drag coefficient (Cd) for turbulent boundary -!! layer through standard trick to solving the drag problem: -!! fit y = log( Re ) as a function of x = log( Cd Re^2 ). -!! We use the data for rigid spheres taken from Figure 10-6 of -!! Pruppacher and Klett (1978): -!! -!! Re Cd -!! ----- ------ -!! 1 24 -!! 10 4.3 -!! 100 1.1 -!! 1000 0.45 -!! -!! Note that we ignore the "drag crisis" at Re > 200,000 -!! (as discussed on p. 341 and shown in Fig 10-36 of P&K 1978), where -!! Cd drops dramatically to 0.2 for smooth, rigid spheres, and instead -!! assume Cd = 0.45 for Re > 1,000 -!! -!! Note that we also ignore hydrodynamic deformation of liquid droplets -!! as well as any breakup due to Rayleigh-Taylor instability. -!! -!! This routine requires that vertical profiles of temperature , -!! air density , and viscosity are defined (i.e., initatm.f -!! must be called before this). The vertical profile with ix = iy = 1 -!! is used. -!! -!! We assume spherical particles -- call setupvf_std_shape() to use legacy -!! code from old Toon model for non-spherical effects -- use (better -!! yet, fix) at own risk. -!! -!! Added support for the particle radius being dependent on the relative -!! humidity according to the parameterizations of Gerber [1995] and -!! Fitzgerald [1975]. The fall velocity is then based upon the wet radius -!! rather than the dry radius. For particles that are not subject to -!! swelling, the wet and dry radii are the same. -!! -!! @author Chuck Bardeen, Pete Colarco from Andy Ackerman -!! @version Mar-2010 from Nov-2000 -subroutine setupvf_std(carma, cstate, j, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: j !! group index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i, k - real(kind=f) :: x, y, cdrag - real(kind=f) :: rhoa_cgs, vg, rmfp, rkn, expon - - ! Define formats - 1 format(/,'Non-spherical particles specified for group ',i3, & - ' (ishape=',i3,') but spheres assumed in I_FALLRTN_STD.', & - ' Suggest using non-spherical code in I_FALLRTN_STD_SHAPE.') - - ! Warning message for non-spherical particles! - if( ishape(j) .ne. 1 )then - if (do_print) write(LUNOPRT,1) j, ishape(j) - endif - - ! Loop over all atltitudes. - do k = 1, NZ - - ! This is in cartesian coordinates (good old cgs units) - rhoa_cgs = rhoa(k) / (xmet(k)*ymet(k)*zmet(k)) - - ! is mean thermal velocity of air molecules [cm/s] - vg = sqrt(8._f / PI * R_AIR * t(k)) - - ! is mean free path of air molecules [cm] - rmfp = 2._f * rmu(k) / (rhoa_cgs * vg) - - ! Loop over particle size bins. - do i = 1,NBIN - - ! is knudsen number - rkn = rmfp / (r_wet(k,i,j) * rrat(i,j)) - - ! is the slip correction factor, the correction term for - ! non-continuum effects. Also used to calculate coagulation kernels - ! and diffusion coefficients. - expon = -.87_f / rkn - expon = max(-POWMAX, expon) - bpm(k,i,j) = 1._f + (1.246_f*rkn + 0.42_f*rkn*exp(expon)) - - ! Stokes fall velocity and Reynolds' number - vf(k,i,j) = (ONE * 2._f / 9._f) * rhop_wet(k,i,j) * r_wet(k,i,j)**2 * GRAV * bpm(k,i,j) / rmu(k) / rprat(i,j) - re(k,i,j) = 2. * rhoa_cgs * r_wet(k,i,j) * rprat(i,j) * vf(k,i,j) / rmu(k) - - if (re(k,i,j) .ge. 1._f) then - - ! Correct drag coefficient for turbulence - x = log(re(k,i,j) / bpm(k,i,j)) - y = x*(0.83_f - 0.013_f*x) - - re(k,i,j) = exp(y) * bpm(k,i,j) - - if (re(k,i,j) .le. 1.e3_f) then - - ! drag coefficient from quadratic fit y(x) when Re < 1,000 - vf(k,i,j) = re(k,i,j) * rmu(k) / (2._f * r_wet(k,i,j) * rprat(i,j) * rhoa_cgs) - else - - ! drag coefficient = 0.45 independent of Reynolds number when Re > 1,000 - cdrag = 0.45_f - vf(k,i,j) = bpm(k,i,j) * & - sqrt( 8._f * rhop_wet(k,i,j) * r_wet(k,i,j) * GRAV / & - (3._f * cdrag * rhoa_cgs * rprat(i,j)**2.) ) - endif - endif - enddo ! - enddo ! - - ! Return to caller with particle fall velocities evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/setupvf_std_shape.F90 b/CARMAchem_GridComp/CARMA/source/base/setupvf_std_shape.F90 deleted file mode 100644 index ca2b0be4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/setupvf_std_shape.F90 +++ /dev/null @@ -1,281 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates particle fall velocities, vf(k) [cm s^-1] -!! and reynolds' numbers based on fall velocities, re(j,i,k) [dimensionless]. -!! indices correspond to vertical level , bin index , and aerosol -!! group . -!! -!! Non-spherical particles are treated through shape factors -!! and . -!! -!! General method is to first use Stokes' flow to estimate fall -!!! velocity, then calculate reynolds' number, then use "y function" -!! (defined in Pruppacher and Klett) to reevaluate reynolds' number, -!! from which the fall velocity is finally obtained. -!! -!! This routine requires that vertical profiles of temperature , -!! air density , and viscosity are defined (i.e., initatm.f -!! must be called before this). -!! -!! @author Chuck Bardeen, Pete Colarco from Andy Ackerman -!! @version Mar-2010 from Oct-1995 - - -subroutine setupvf_std_shape(carma, cstate, j, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: j !! group index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i, k, ilast - real(kind=f) :: x, y - real(kind=f) :: rhoa_cgs, vg, rmfp, rkn, expon - real(kind=f) :: f1, f2, f3, ex, exx, exy, xcc, xa, bxx, r_shape, rfix, b0, bb1, bb2, bb3, z - - ! Define formats - 1 format('setupvfall::ERROR - ishape != 1, no fall velocity algorithm') - - - ! First evaluate factors that depend upon particle shape (used in correction - ! factor below). - if (ishape(j) .eq. I_SPHERE) then - - ! Spheres - f1 = 1.0_f - f2 = 1.0_f - - else if (ishape(j) .eq. I_HEXAGON) then - - ! Hexagons: taken from Turco et al (Planet. Space Sci. Rev. 30, 1147-1181, 1982) - ! with diffuse reflection of air molecules assumed - f2 = (PI / 9._f / tan(PI / 6._f))**(ONE/3._f) * eshape(j)**(ONE/6._f) - - else if (ishape(j) .eq. I_CYLINDER)then - - ! Spheroids: also from Turco et al. [1982] - f2 = (2._f / 3._f)**(ONE/3._f) * eshape(j)**(ONE/6._f) - endif - - ! (following statement yields = 1.0 for = I_SPHERE) - f3 = 1.39_f / sqrt((1.14_f + 0.25_f / eshape(j)) * (0.89_f + eshape(j) / 2._f)) - f2 = f2 * f3 - - if (eshape(j) .gt. 1._f) then - - ! For Stokes regime there is no separate data for hexagonal plates or columns, - ! so we use prolate spheroids. This is from Fuchs' book. - exx = eshape(j)**2 - 1._f - exy = sqrt(exx) - xcc = 1.333_f * exx / ((2._f * eshape(j)**2 - 1._f) * log(eshape(j) + exy) / exy-eshape(j)) - xa = 2.666_f * exx / ((2._f * eshape(j)**2 - 3._f) * log(eshape(j) + exy) / exy+eshape(j)) - f1 = eshape(j)**(-ONE/3._f) * (xcc + 2._f*xa) / 3._f - - elseif (eshape(j) .lt. 1._f) then - - ! Use oblate spheroids for disks (eshape < 1.). Also from Fuchs' book. - bxx = 1._f / eshape(j) - exx = bxx**2 - 1._f - exy = sqrt(exx) - xcc = 1.333_f * exx / (bxx * (bxx**2 - 2._f) * atan(exy) / exy + bxx) - xa = 2.666_f * exx / (bxx * (3._f * bxx**2 - 2._f) * atan(exy) / exy - bxx) - f1 = bxx**(ONE/3._f) * (xcc + 2._f * xa) / 3._f - endif - - - ! Loop over column with ixy = 1 - do k = 1,NZ - - ! This is in cartesian coordinates (good old cgs units) - rhoa_cgs = rhoa(k) / (xmet(k)*ymet(k)*zmet(k)) - - ! is mean thermal velocity of air molecules [cm/s] - vg = sqrt(8._f / PI * R_AIR * t(k)) - - ! is mean free path of air molecules [cm] - rmfp = 2._f * rmu(k) / (rhoa_cgs * vg) - - ! Loop over particle size bins. - do i = 1,NBIN - - ! is radius of particle used to calculate . - if (ishape(j) .eq. I_SPHERE) then - r_shape = r_wet(k,i,j) - else if (ishape(j) .eq. I_HEXAGON) then - r_shape = r_wet(k,i,j) * 0.8456_f * eshape(j)**(-ONE/3._f) - else if(ishape(j) .eq. I_CYLINDER) then -! r_shape = r_wet(k,i,j) * eshape(j)**(-ONE/3._f) - - ! Shouldn't this have a factor related to being a cylinder vs a - ! sphere in addition to the aspect ratio factor? - r_shape = r_wet(k,i,j) * 0.8736_f * eshape(j)**(-ONE/3._f) - endif - - ! is knudsen number - rkn = rmfp / r_wet(k,i,j) - - ! is the slip correction factor, the correction term for - ! non-continuum effects. Also used to calculate coagulation kernels - ! and diffusion coefficients. - expon = -.87_f / rkn - expon = max(-POWMAX, expon) - bpm(k,i,j) = 1._f + f1*f2*(1.246_f*rkn + 0.42_f*rkn*exp(expon)) - - ! These are first guesses for fall velocity and Reynolds' number, - ! valid for Reynolds' number < 0.01 - ! - ! This is "regime 1" in Pruppacher and Klett (chap. 10, pg 416). - vf(k,i,j) = (2._f / 9._f) * rhop_wet(k,i,j) *(r_wet(k,i,j)**2) * GRAV * bpm(k,i,j) / (f1 * rmu(k)) - re(k,i,j) = 2._f * rhoa_cgs * r_shape * vf(k,i,j) / rmu(k) - - - ! is used in drag coefficient. - rfix = vol(i,j) * rhop_wet(k,i,j) * GRAV * rhoa_cgs / rmu(k)**2 - - if ((re(k,i,j) .ge. 0.01_f) .and. (re(k,i,j) .le. 300._f)) then - - ! This is "regime 2" in Pruppacher and Klett (chap. 10, pg 417). - ! - ! NOTE: This sphere case is not the same solution used when - ! interpolating other shape factors. This seems potentially inconsistent. - if (ishape(j) .eq. I_SPHERE) then - - x = log(24._f * re(k,i,j) / bpm(k,i,j)) - y = -0.3318657e1_f + x * 0.992696_f - x**2 * 0.153193e-2_f - & - x**3 * 0.987059e-3_f - x**4 * 0.578878e-3_f + & - x**5 * 0.855176E-04_f - x**6 * 0.327815E-05_f - - if (y .lt. -675._f) y = -675._f - if (y .ge. 741._f) y = 741._f - - re(k,i,j) = exp(y) * bpm(k,i,j) - - else if (eshape(j) .le. 1._f) then - - ! P&K pg. 427 - if (ishape(j) .eq. I_HEXAGON) then - x = log10(16._f * rfix / (3._f * sqrt(3._f))) - else if (ishape(j) .eq. I_CYLINDER) then - x = log10(8._f * rfix / PI) - endif - - if (eshape(j) .le. 0.2_f) then - - ! P&K, page 424-427 - b0 = -1.33_f - bb1 = 1.0217_f - bb2 = -0.049018_f - bb3 = 0.0_f - else if (eshape(j) .le. 0.5_f) then - - ! NOTE: This interpolation/extrapolation method is - ! not discussed in P&K; although, the solution for - ! eshape = 0.5 is shown. Does this really work? - ex = (eshape(j) - 0.2_f) / 0.3_f - b0 = -1.33_f + ex * (-1.3247_f + 1.33_f) - bb1 = 1.0217_f + ex * (1.0396_f - 1.0217_f) - bb2 = -0.049018_f + ex * (-0.047556_f + 0.049018_f) - bb3 = ex * (-0.002327_f) - else - - ! Extrapolating to cylinder cases on 436. - ex = (eshape(j) - 0.5_f) / 0.5_f - b0 = -1.3247_f + ex * (-1.310_f + 1.3247_f) - bb1 = 1.0396_f + ex * (0.98968_f - 1.0396_f) - bb2 = -0.047556_f + ex * (-0.042379_f + 0.047556_f) - bb3 = -0.002327_f + ex * ( 0.002327_f) - endif - - y = b0 + x * bb1 + x**2 * bb2 + x**3 * bb3 - re(k,i,j) = 10._f**y * bpm(k,i,j) - - else if (eshape(j) .gt. 1._f) then - ! Why is this so different from the oblate case? - ! This seems wrong. -! x = log10(2._f * rfix / eshape(j)) - if (ishape(j) .eq. I_CYLINDER) then - x = log10(8._f * rfix / PI) - endif - - ! P&K pg 430 - if( eshape(j) .le. 2._f )then - ex = eshape(j) - 1._f - b0 = -1.310_f + ex * (-1.11812_f + 1.310_f) - bb1 = 0.98968_f + ex * (0.97084_f - 0.98968_f) - bb2 = -0.042379_f + ex * (-0.058810_f + 0.042379_f) - bb3 = ex * (0.002159_f) - else if (eshape(j) .le. 10._f) then - ex = (eshape(j) - 2._f) / 8.0_f - b0 = -1.11812_f + ex * (-0.90629_f + 1.11812_f) - bb1 = 0.97084_f + ex * (0.90412_f - 0.97084_f) - bb2 = -0.058810_f + ex * (-0.059312_f + 0.058810_f) - bb3 = 0.002159_f + ex * (0.0029941_f - 0.002159_f) - else - - ! This is interpolating to a solution for an infinite - ! cylinder, so it may not be the greatest estimate. - ex = 10._f / eshape(j) - b0 = -0.79888_f + ex * (-0.90629_f + 0.79888_f) - bb1 = 0.80817_f + ex * (0.90412_f - 0.80817_f) - bb2 = -0.030528_f + ex * (-0.059312_f + 0.030528_f) - bb3 = ex * (0.0029941_f) - endif - - y = b0 + x * bb1 + x**2 * bb2 + x**3 * bb3 - re(k,i,j) = 10._f**y * bpm(k,i,j) - - endif - - ! Adjust for non-sphericicity. - vf(k,i,j) = re(k,i,j) * rmu(k) / (2._f * r_shape * rhoa_cgs) - - endif - - if (re(k,i,j) .gt. 300._f) then - - ! This is "regime 3" in Pruppacher and Klett (chap. 10, pg 418). - -! if ((do_print) .and. (ishape(j) .ne. I_SPHERE)) write(LUNOPRT,1) -! if ((do_print) .and. (ishape(j) .ne. I_SPHERE)) write(LUNOPRT,*) "setupvfall:", j, i, k, re(k,i,j) -! rc = RC_ERROR -! return - - z = ((1.e6_f * rhoa_cgs**2) / (GRAV * rhop_wet(k,i,j) * rmu(k)**4))**(ONE/6._f) - b0 = (24._f * vf(k,i,j) * rmu(k)) / 100._f - x = log(z * b0) - y = -5.00015_f + x * (5.23778_f - x * (2.04914_f - x * (0.475294_f - & - x * (0.0542819_f - x * 0.00238449_f)))) - - if (y .lt. -675._f) y = -675.0_f - if (y .ge. 741._f) y = 741.0_f - - re(k,i,j) = z * exp(y) * bpm(k,i,j) - vf(k,i,j) = re(k,i,j) * rmu(k) / ( 2._f * r_wet(k,i,j) * rhoa_cgs) - - ! Values should not decrease with diameter, but instead should - ! reach a limiting velocity that is independent of size (see - ! Figure 10-25 of Pruppacher and Klett, 1997) - ilast = max(1,i-1) - if ((vf(k,i,j) .lt. vf(k,ilast,j)) .or. (re(k,i,j) .gt. 4000._f)) then - vf(k,i,j) = vf(k,ilast,j) - endif - endif - enddo ! - enddo ! - - ! Return to caller with particle fall velocities evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/smallconc.F90 b/CARMAchem_GridComp/CARMA/source/base/smallconc.F90 deleted file mode 100644 index 2856e383..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/smallconc.F90 +++ /dev/null @@ -1,63 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine ensures limits all particle concentrations in a grid box -!! to SMALL_PC. In bins where this limitation results in the particle -!! concentration changing, the core mass fraction and second moment fraction -!! are set to . -!! -!! @author Andy Ackerman -!! @version Oct-1997 -subroutine smallconc(carma, cstate, iz, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Locals - integer :: ig - integer :: ip - real(kind=f) :: small_val - - - ig = igelem(ielem) - ip = ienconc(ig) - - - ! Element is particle concentration - if (ielem == ip) then - pc(iz,ibin,ielem) = max(pc(iz,ibin,ielem), SMALL_PC) - else - - ! Element is core mass - if ((itype(ielem) .eq. I_COREMASS) .or. (itype(ielem) .eq. I_VOLCORE)) then - small_val = SMALL_PC * rmass(ibin,ig) * FIX_COREF - - ! Element is core second moment - elseif (itype(ielem) .eq. I_CORE2MOM) then - small_val = SMALL_PC * (rmass(ibin,ig) * FIX_COREF)**2 - end if - - ! Reset if either the particle concentration or the element mass are too small. - if ((pc(iz,ibin,ip) <= SMALL_PC) .or. (pc(iz,ibin,ielem) < small_val)) then - pc(iz,ibin,ielem) = small_val - endif - endif - - ! Return to caller with particle concentrations limited to SMALL_PC - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/step.F90 b/CARMAchem_GridComp/CARMA/source/base/step.F90 deleted file mode 100644 index 346d8cf9..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/step.F90 +++ /dev/null @@ -1,37 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine performs all calculations necessary to take one timestep. -!! -!! @author McKie -!! @version Oct-1995 -subroutine step(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - - ! Iterate over each column. Each of these columns should be independent, so - ! the work for each column could be done by a different thread. - - ! Do pre-timestep processing - if (rc >= 0) call prestep(carma, cstate, rc) - - ! Update model state at new time - if (rc >= 0) call newstate(carma, cstate, rc) - - ! Return to caller with one timestep taken - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/sulfate_utils.F90 b/CARMAchem_GridComp/CARMA/source/base/sulfate_utils.F90 deleted file mode 100644 index 2c08319c..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/sulfate_utils.F90 +++ /dev/null @@ -1,655 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -module sulfate_utils - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - ! Declare the public methods. - public wtpct_tabaz - public wtpct_sts - public sulfate_density - public sulfate_surf_tens - - real(kind=f), public:: dnwtp(46), dnc0(46), dnc1(46) - real(kind=f), public:: at_hno3(30), at_h2so4(20), amt_hno3(30), amt_h2so4(30) - - data dnwtp / 0._f, 1._f, 5._f, 10._f, 20._f, 25._f, 30._f, 35._f, 40._f, & - 41._f, 45._f, 50._f, 53._f, 55._f, 56._f, 60._f, 65._f, 66._f, 70._f, & - 72._f, 73._f, 74._f, 75._f, 76._f, 78._f, 79._f, 80._f, 81._f, 82._f, & - 83._f, 84._f, 85._f, 86._f, 87._f, 88._f, 89._f, 90._f, 91._f, 92._f, & - 93._f, 94._f, 95._f, 96._f, 97._f, 98._f, 100._f / - - data dnc0 / 1._f, 1.13185_f, 1.17171_f, 1.22164_f, 1.3219_f, 1.37209_f, & - 1.42185_f, 1.4705_f, 1.51767_f, 1.52731_f, 1.56584_f, 1.61834_f, 1.65191_f, & - 1.6752_f, 1.68708_f, 1.7356_f, 1.7997_f, 1.81271_f, 1.86696_f, 1.89491_f, & - 1.9092_f, 1.92395_f, 1.93904_f, 1.95438_f, 1.98574_f, 2.00151_f, 2.01703_f, & - 2.03234_f, 2.04716_f, 2.06082_f, 2.07363_f, 2.08461_f, 2.09386_f, 2.10143_f,& - 2.10764_f, 2.11283_f, 2.11671_f, 2.11938_f, 2.12125_f, 2.1219_f, 2.12723_f, & - 2.12654_f, 2.12621_f, 2.12561_f, 2.12494_f, 2.12093_f / - - data dnc1 / 0._f, -0.000435022_f, -0.000479481_f, -0.000531558_f, -0.000622448_f,& - -0.000660866_f, -0.000693492_f, -0.000718251_f, -0.000732869_f, -0.000735755_f, & - -0.000744294_f, -0.000761493_f, -0.000774238_f, -0.00078392_f, -0.000788939_f, & - -0.00080946_f, -0.000839848_f, -0.000845825_f, -0.000874337_f, -0.000890074_f, & - -0.00089873_f, -0.000908778_f, -0.000920012_f, -0.000932184_f, -0.000959514_f, & - -0.000974043_f, -0.000988264_f, -0.00100258_f, -0.00101634_f, -0.00102762_f, & - -0.00103757_f, -0.00104337_f, -0.00104563_f, -0.00104458_f, -0.00104144_f, & - -0.00103719_f, -0.00103089_f, -0.00102262_f, -0.00101355_f, -0.00100249_f, & - -0.00100934_f, -0.000998299_f, -0.000990961_f, -0.000985845_f, -0.000984529_f, & - -0.000989315_f / - - data at_hno3 / & - -9.3085785070e-1,1.1200784716e-2,-8.7594232370e-5,2.9290261722e-7,-3.6297845637e-10, & - -9.9276927926e+0,1.3861173987e-1,-7.5302447966e-4,1.9053537417e-6,-1.8847180104e-9, & - 8.9976745608e-1,-1.1682398549e-2,6.1056862242e-5,-1.5087523503e-7,1.4643716979e-10, & - -3.8389447725e-2,4.8922229154e-4,-2.5494288719e-6,6.3306350216e-9,-6.1901374001e-12, & - 7.1911444008e-4,-8.7957856299e-6,4.4035804399e-8,-1.0509519536e-10,9.8591778862e-14, & - -5.2736179784e-6,6.3762209490e-8,-3.1557072358e-10,7.4508569217e-13,-6.9083781268e-16 / - - data at_h2so4 / & - -9.8727713620e+1,1.5892180900e+0,-1.0611069051e-2,3.1437317659e-5,-3.5694366687e-8, & - 2.6972534510e+1,-4.1774114259e-1,2.7534704937e-3,-8.0885350553e-6,9.0919984894e-9, & - -3.1506575361e+0,5.1477027299e-2,-3.4697470359e-4,1.0511865215e-6,-1.2167638793e-9, & - 8.9194643751e-2,-1.4398498884e-3,9.5874823381e-6,-2.8832930837e-8,3.3199717594e-11 / - - data amt_h2so4 / & - 4.9306007769e+0,-2.8124576227e+2,3.6171943540e+4,-7.3921080947e+5,-1.1640936469e+8, & - -1.6902946223e+1,5.7843291724e+3,-1.2462848248e+5,3.1325022591e+7,-2.2068275308e+9, & - -3.9722280419e+1,1.2350607474e+4,-3.4299494505e+5,6.2642389672e+7,-3.9709694493e+9, & - -5.5968384906e+1,1.2922351288e+4,1.3504086346e+6,-1.7890533860e+8,8.8498119334e+9, & - -8.2938840352e+1,2.2079294414e+4,2.9469683691e+5,-3.1424855089e+7,1.0884875646e+9, & - -1.0647596744e+2,2.7525067463e+4,4.2061852240e+5,-5.1877378665e+7,2.2849838182e+9 / - - data amt_hno3 / & - 2.5757237579e-1,3.4615149493e+3,-1.1460419802e+6,1.6003066569e+8,-8.2005020704e+9, & - -2.3081801501e+1,9.7545732474e+3,-1.0751476647e+6,1.2845681641e+8,-5.6387338050e+9, & - -1.1454916074e+2,6.7557746435e+4,-1.5833469853e+7,2.0068038322e+9,-9.5789893230e+10, & - -3.7614906671e+2,2.5721043666e+5,-6.9093891724e+7,8.8886258262e+9,-4.3013954256e+11, & - -1.1566205559e+3,8.5657451707e+5,-2.4386088798e+8,3.1789555772e+10,-1.5566652191e+12,& - -2.9858872606e+3,2.2912842052e+6,-6.6825883931e+8,8.7835101682e+10,-4.3330365673e+12 / -contains - - !! This function calculates the weight % H2SO4 composition of - !! sulfate aerosol, using Tabazadeh et. al. (GRL, 1931, 1997). - !! Rated for T=185-260K, activity=0.01-1.0 - !! - !! Argument list input: - !! temp = temperature (K) - !! h2o_mass = water vapor mass concentration (g/cm3) - !! h2o_vp = water eq. vaper pressure (dynes/cm2) - !! - !! Output: - !! wtpct_tabaz = weight % H2SO4 in H2O/H2SO4 particle (0-100) - !! - !! Include global constants and variables (BK=Boltzman constant, - !! AVG=Avogadro's constant) - !! - !! @author Jason English - !! @ version Apr-2010 - function wtpct_tabaz(carma, temp, h2o_mass, h2o_vp, rc) - - real(kind=f) :: wtpct_tabaz - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: temp !! temperature [K] - real(kind=f), intent(in) :: h2o_mass !! water vapor mass concentration (g/cm3) - real(kind=f), intent(in) :: h2o_vp !! water eq. vaper pressure (dynes/cm2) - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Declare variables for this routine only - real(kind=f) :: atab1,btab1,ctab1,dtab1,atab2,btab2,ctab2,dtab2 - real(kind=f) :: h2o_num, p_h2o, vp_h2o - real(kind=f) :: contl, conth, contt, conwtp - real(kind=f) :: activ - - ! Get number density of water (/cm3) from mass concentration (g/cm3) - h2o_num=h2o_mass*AVG/gwtmol(1) - - ! Get partial pressure of water (dynes/cm2) from concentration (/cm3) - ! Ideal gas law: P=nkT - p_h2o=h2o_num*bk*temp - - ! Convert from dynes/cm2 to mb (hPa) - p_h2o=p_h2o/1000.0_f ! partial pressure - vp_h2o=h2o_vp/1000.0_f ! eq. vp - - ! Activity = water pp in mb / water eq. vp over pure water in mb - activ = p_h2o/vp_h2o - - if (activ.lt.0.05_f) then - activ = max(activ,1.e-32_f) ! restrict minimum activity - atab1 = 12.37208932_f - btab1 = -0.16125516114_f - ctab1 = -30.490657554_f - dtab1 = -2.1133114241_f - atab2 = 13.455394705_f - btab2 = -0.1921312255_f - ctab2 = -34.285174607_f - dtab2 = -1.7620073078_f - elseif (activ.ge.0.05_f.and.activ.le.0.85_f) then - atab1 = 11.820654354_f - btab1 = -0.20786404244_f - ctab1 = -4.807306373_f - dtab1 = -5.1727540348_f - atab2 = 12.891938068_f - btab2 = -0.23233847708_f - ctab2 = -6.4261237757_f - dtab2 = -4.9005471319_f - elseif (activ.gt.0.85_f) then - activ = min(activ,1._f) ! restrict maximum activity - atab1 = -180.06541028_f - btab1 = -0.38601102592_f - ctab1 = -93.317846778_f - dtab1 = 273.88132245_f - atab2 = -176.95814097_f - btab2 = -0.36257048154_f - ctab2 = -90.469744201_f - dtab2 = 267.45509988_f - else - if (do_print) write(LUNOPRT,*) 'invalid activity: activity,pp,vp=',activ, p_h2o - rc = RC_ERROR - return - endif - - contl = atab1*(activ**btab1)+ctab1*activ+dtab1 - conth = atab2*(activ**btab2)+ctab2*activ+dtab2 - - contt = contl + (conth-contl) * ((temp -190._f)/70._f) - conwtp = (contt*98._f) + 1000._f - - wtpct_tabaz = (100._f*contt*98._f)/conwtp - wtpct_tabaz = min(max(wtpct_tabaz,1._f),100._f) ! restrict between 1 and 100 % - - return - end function wtpct_tabaz - - !! This function calculates the weight percent of nitric acid and sulfuric - !! acid in STS liquid PSCs based on sulfate mass and mass concentrations - !! of water vapor and nitric acid vapor. This routine is based on - !! Jacobson et al., 1994 JGR and Tabazadeh et al., 1994 JGR. - !! Adapted from WACCM STS equilibrium code by Tabazadeh. - !! - !! @ author Parker Case - !! @ version Apr-2019 - subroutine wtpct_sts( temper, h2so4m, hno3_avail, h2o_avail, press, & - wts, wtn, rc) - !---------------------------------------------------------------------- - ! - ! temper = Temperature (Kelvin) - ! h2so4m = Total mass of H2SO4 (g cm-3) - ! hno3_avail = HNO3 volume mixing ratio (mol mol-1) - ! h2o_avail = H2O volume mixing ratio (mol mol-1) - ! press = Total atmospheric pressure (mb) - ! wts = Weight percent of sulfuric acid in ternary solution (%) - ! wtn = Weight percent of nitric acid in ternary solution (%) - ! - !---------------------------------------------------------------------- - - implicit none - - !---------------------------------------------------------------------- - ! ... dummy arguments - !---------------------------------------------------------------------- - real(kind=f), intent(in) :: h2so4m - real(kind=f), intent(in) :: hno3_avail - real(kind=f), intent(in) :: h2o_avail - real(kind=f), intent(in) :: press - real(kind=f), intent(in) :: temper - real(kind=f), intent(out) :: wts - real(kind=f), intent(out) :: wtn - integer, intent(inout) :: rc !! return code, negative indicates failure - !---------------------------------------------------------------------- - ! ... local variables - !---------------------------------------------------------------------- - integer, parameter :: itermax = 100 - real(kind=f), parameter :: con_lim = .00005_f - real(kind=f), parameter :: t0 = 298.15_f - real(kind=f), parameter :: ks0 = 2.45e6_f - real(kind=f), parameter :: lower_delx = 1.e-10_f - real(kind=f), parameter :: upper_delx = .98_f - real(kind=f), parameter :: con_crit_chem = 5.e-5_f - - logical :: is_chem - logical :: converged - integer :: iter, l - real(kind=f) :: ch2so4 - real(kind=f) :: molh2so4 - real(kind=f) :: molhno3 - real(kind=f) :: wts0 - real(kind=f) :: reduction_factor - real(kind=f) :: p_h2o - real(kind=f) :: tr - real(kind=f) :: wtn0 - real(kind=f) :: pures - real(kind=f) :: puren - real(kind=f) :: chno3 - real(kind=f) :: chplus - real(kind=f) :: cno3 - real(kind=f) :: wrk - real(kind=f) :: z, num, den - real(kind=f) :: deltax - real(kind=f) :: chplusnew - real(kind=f) :: cno3new - real(kind=f) :: stren - real(kind=f) :: sm - real(kind=f) :: actn - real(kind=f) :: acts - real(kind=f) :: nm - real(kind=f) :: ks - real(kind=f) :: lnks - real(kind=f) :: lnks0 - real(kind=f) :: mixyln - real(kind=f) :: wrk_h2so4 - real(kind=f) :: cphno3new - real(kind=f) :: con_val - real(kind=f) :: ti, t1, t2, fi, f1, f2, ymix, hplus, wtotal, ratio - real(kind=f) :: con_crit - real(kind=f) :: h2o_cond - real(kind=f) :: fratio(0:itermax) - real(kind=f) :: delx(0:itermax) - real(kind=f) :: delz(0:itermax) - real(kind=f) :: a_hno3(5,6) - real(kind=f) :: a_h2so4(5,4) - real(kind=f) :: am_hno3(5,6) - real(kind=f) :: am_h2so4(5,6) - real(kind=f) :: c_hno3(6) - real(kind=f) :: c_h2so4(6) - real(kind=f) :: d_hno3(6) - real(kind=f) :: d_h2so4(4) - logical :: interval_set - logical :: positive - - a_hno3 = reshape(at_hno3, shape(a_hno3)) - a_h2so4 = reshape(at_h2so4, shape(a_h2so4)) - am_hno3 = reshape(amt_hno3, shape(am_hno3)) - am_h2so4 = reshape(amt_h2so4, shape(am_h2so4)) - - converged = .false. - - lnks0 = log( ks0 ) - if( is_chem ) then - con_crit = con_crit_chem - else - con_crit = con_crit_chem - endif - p_h2o = h2o_avail * press * .7501_f ! mbar -> torr - !---------------------------------------------------------------------- - ! Calculating the molality for pure binary systems of H2SO4/H2O - ! and HNO3/H2O at a given temperature and water vapor pressure - ! profile (relative humiditiy). Water activities were used to - ! calculate the molalities as described in Tabazadeh et al. (1994). - !---------------------------------------------------------------------- - ti = max( 180._f,temper ) - tr = 1._f/ti - do l = 1,6 - c_hno3(l) = exp( am_hno3(1,l) + tr*(am_hno3(2,l) + tr*(am_hno3(3,l) + tr*(am_hno3(4,l) + tr*am_hno3(5,l)))) ) - c_h2so4(l) = exp( am_h2so4(1,l) + tr*(am_h2so4(2,l) + tr*(am_h2so4(3,l) + tr*(am_h2so4(4,l) + tr*am_h2so4(5,l)))) ) - ! TODO - end do -!---------------------------------------------------------------------- -! ... H2SO4/H2O pure weight percent and molality -!---------------------------------------------------------------------- - wts0 = max( 0.01_f,c_h2so4(1) + p_h2o*(-1._f*c_h2so4(2) + p_h2o*(c_h2so4(3) + p_h2o*(-1._f*c_h2so4(4) + p_h2o*(c_h2so4(5) - p_h2o*c_h2so4(6)))))) - pures = (wts0 * 1000._f)/(100._f - wts0) - pures = pures / 98._f -!---------------------------------------------------------------------- -! ... HNO3/H2O pure weight percent and molality -!---------------------------------------------------------------------- - puren = max( 0._f,c_hno3(1) + p_h2o*(-1._f*c_hno3(2) + p_h2o*(c_hno3(3) + p_h2o*(-1._f*c_hno3(4) + p_h2o*(c_hno3(5) - p_h2o*c_hno3(6))))) ) -!---------------------------------------------------------------------- -! The solving scheme is described both in Jacobson et al. and Tabazadeh -! et al.. Assumptions: -! (1) H2SO4 is present only in the aqueous-phase -! (2) H2SO4 and HNO3 in solution are fully dissocated into H+ -! SO42- and NO3- -! (3) PHNO3 + NO3- = constant -!---------------------------------------------------------------------- - ch2so4 = (h2so4m) / 98._f - if( pures > 0._f ) then - wrk_h2so4 = (1000._f*ch2so4)/(pures*18._f) - else - wrk_h2so4 = 0._f - endif - chno3 = 1.2029e-5_f * press * tr * hno3_avail - do l = 1,6 - d_hno3(l) = a_hno3(1,l) + ti*(a_hno3(2,l) + ti*(a_hno3(3,l) + ti*(a_hno3(4,l) + ti*a_hno3(5,l)))) - end do - do l = 1,4 - d_h2so4(l) = a_h2so4(1,l) + ti*(a_h2so4(2,l) + ti*(a_h2so4(3,l) + ti*(a_h2so4(4,l) + ti*a_h2so4(5,l)))) - end do -!---------------------------------------------------------------------- -! Note that KS depends only on the temperature -!---------------------------------------------------------------------- - t1 = (ti - t0)/(ti*t0) - t2 = t0/ti - 1._f - log( t0/ti ) - lnks = lnks0 - 8792.3984_f * t1 - 16.8439_f * t2 - ks = exp( lnks ) - - converged = .false. -!---------------------------------------------------------------------- -! Setting up initial guesses for the equations above. Note that -! for the initial choices the mass and the charge must be conserved. -!---------------------------------------------------------------------- - delx(0) = .5_f - z = .5_f - delz(0) = .5_f - fratio(0) = 0._f - reduction_factor = .1_f - interval_set = .false. -Iter_loop : do iter = 1,itermax -!---------------------------------------------------------------------- -! Cwater is the water equation as described in Tabazadeh et -! al. and Jacobson et al. -!---------------------------------------------------------------------- - cno3new = chno3 * delx(iter-1) - cphno3new = chno3 * (1._f - delx(iter-1)) - if( puren > 0._f ) then - t1 = (1000._f*cno3new)/(puren*18._f) - else - t1 = 0._f - endif - h2o_cond = t1 + wrk_h2so4 - if( h2o_cond > 0._f ) then - wrk = 1.e3_f / (18._f * h2o_cond) - molhno3 = cno3new * wrk - molh2so4 = ch2so4 * wrk - else - molhno3 = 0._f - molh2so4 = 0._f - endif - stren = molhno3 + 3._f * molh2so4 -!---------------------------------------------------------------------- -! (1) Calculate the activity of H2SO4 at a given STREN -!---------------------------------------------------------------------- - sm = stren/3._f - acts = d_h2so4(1) + sm*(d_h2so4(2) + sm*(d_h2so4(3) + sm*d_h2so4(4))) -!---------------------------------------------------------------------- -! (2) Calculate the activity for HNO3 at a given STREN -!---------------------------------------------------------------------- - nm = stren - actn = d_hno3(1) + nm*(d_hno3(2) + nm*(d_hno3(3) + nm*(d_hno3(4) + nm*(d_hno3(5) + nm*d_hno3(6))))) -!---------------------------------------------------------------------- -! (3) Calculate the mixed activity coefficient for HNO3 at STREN -! as described by Tabazadeh et al. -!---------------------------------------------------------------------- - f1 = 2._f * (molh2so4 + molhno3) * actn - f2 = 2.25_f * molh2so4 * acts - if (stren > 0._f) then - mixyln = (f1 + f2) / (2._f * stren) - else - mixyln = 0._f - endif - ymix = exp( mixyln ) - hplus = 2._f * molh2so4 + molhno3 - num = ymix**2 * hplus * molhno3 - den = 1000._f * cphno3new * .0820578_f * ti * ks - if (den .eq. 0._f) PRINT *, 'delx, chno3, cphno3new, ti, ks', delx(iter-1), chno3, cphno3new, ti, ks - if( chno3 == 0._f ) then - converged = .true. - exit Iter_loop - endif -!---------------------------------------------------------------------- -! the denominator -! Calculate the ratio F, check convergence -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -! Calculate the ratio F and reset the deltaX (see Jacobson et al.) -!---------------------------------------------------------------------- -! When the numerator is zero, it can drive the denominator -! to 0, which resulted in a NaN for f and also the fraction -! ratio. Assume that in this case, the limit of f would -! really approach 1, not infinity and thus converge the -! solution. - if ((num .eq. 0._f) .and. (den .eq. 0._f)) then - fi = 1._f - else - fi = num / den - endif - fratio(iter) = abs( fi ) - 1._f - con_val = abs( fi - 1._f ) - if( con_val <= con_lim ) then - converged = .true. - exit Iter_loop - endif -!---------------------------------------------------------------------- -! non-convergence; setup next iterate -!---------------------------------------------------------------------- - if( interval_set ) then - z = reduction_factor * z - delz(iter) = z - if( fi > 1._f ) then - deltax = -z - else - deltax = z - endif - delx(iter) = delx(iter-1) + deltax - else - if( iter == 1 ) then - if( fratio(iter) >= 1._f ) then - positive = .false. - else - positive = .true. - endif - endif - if( fratio(iter)*fratio(iter-1) < 0._f ) then - interval_set = .true. - reduction_factor = .5_f - delx(iter) = .5_f*(delx(iter-1) + delx(iter-2)) - z = .5_f*abs( delx(iter-1) - delx(iter-2) ) - else - if( .not. positive ) then - delx(iter) = reduction_factor * delx(iter-1) - else - delx(iter) = reduction_factor + delx(iter-1) - if( delx(iter) > upper_delx ) then - delx(iter) = .5_f - interval_set = .true. - reduction_factor = .5_f - endif - endif - endif - endif - end do Iter_loop - - wtotal = molhno3 * 63._f + molh2so4 * 98._f + 1000._f - wts = (molh2so4 * 9800._f) / wtotal - wtn = (molhno3 *6300._f)/ wtotal - if( cno3new /= 0._f .or. cphno3new /= 0._f ) then - ratio = max( 0._f,min( 1._f,cno3new/(cphno3new + cno3new) ) ) - endif - - end subroutine wtpct_sts - - !! Calculates specific gravity (g/cm3) of sulfate of - !! different compositions as a linear function of temperature, - !! based of measurements of H2SO4/H2O solution densities made - !! at 0 to 100C tabulated in the International Critical Tables - !! (Washburn, ed., NRC, 1928). Measurements have confirmed that - !! this data may be linearly extrapolated to stratospheric - !! temperatures (180-380K) with excellent accuracy - !! (Beyer, Ravishankara, & Lovejoy, JGR, 1996). - !! - !! Argument list input: - !! wtp = aerosol composition in weight % H2SO4 (0-100) - !! temp = temperature in Kelvin - !! - !! Output: - !! sulfate_density (g/cm3) [function name] - !! - !! This function requires setup_sulfate_density to be run - !! first to read in the density coefficients DNC0 and DNC1 - !! and the tabulated weight percents DNWTP. - !! - !! @author Mike Mills - !! @version Mar-2013 - function sulfate_density(carma, wtp, temp, rc) - - !! Include global constants and variables - - real(kind=f) :: sulfate_density - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: wtp !! weight percent - real(kind=f), intent(in) :: temp !! temperature - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i - real(kind=f) :: den1, den2 - real(kind=f) :: frac, temp_loc - - if (wtp .lt. 0.0_f .or. wtp .gt. 100.0_f) then - if (do_print) write(LUNOPRT,*)'sulfate_density: Illegal value for wtp:',wtp - rc = RC_ERROR - return - endif - - ! limit temperature to bounds of extrapolation - temp_loc=min(temp, 380.0_f) - temp_loc=max(temp_loc, 180.0_f) - - i=1 - - do while (wtp .gt. dnwtp(i)) - i=i+1 - end do - - den2=dnc0(i)+dnc1(i)*temp_loc - - if (i.eq.1 .or. wtp.eq.dnwtp(i)) then - sulfate_density=den2 - return - endif - - den1=dnc0(i-1)+dnc1(i-1)*temp_loc - frac=(dnwtp(i)-wtp)/(dnwtp(i)-dnwtp(i-1)) - sulfate_density=den1*frac+den2*(1.0_f-frac) - - return - end function sulfate_density - - !! Calculates the density of ternary HNO3/H2SO4/H2O solutions based on the - !! method described by Carslaw et al., 1995, GRL. Valid for temperatures - !! between 185K and 240K. - !! Note that weight percent in this calculation is assumed to be 0-1 not - !! /100. - !! PAC: check for temperature bounds? - !! - !! Argument list input: - !! wts = weight percent of H2SO4 - !! wtn = wieght percent of HNO3 - !! temp = temperature in Kelvin - !! - !! Output: - !! STS density (g/cm3) - !! - !! @author Parker Case - !! @version Apr-2019 - function sts_density(carma, wts, wtn, temp, rc) - - !! Include global constants and variables - - real(kind=f) :: sts_density - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: wts !! weight percent H2SO4 - real(kind=f), intent(in) :: wtn !! weight percent HNO3 - real(kind=f), intent(in) :: temp !! temperature - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: ms, mn !! molality of sulfuric and nitric acid - real(kind=f) :: rhos, rhon !! density of binary solutions - - ms = -25000._f * wts / (2453 * (wtn + wts - 1)) - mn = -100000._f * wtn / (6303 * (wtn + wts - 1)) - rhos = 1000+(123.64-5.6e-4*temp**2)*ms-(29.54-1.81E-4*temp**2)*ms**1.5 + & - (2.343-1.487E-3*temp-1.324E-5*temp**2)*ms**2 - rhon = 1000+(85.11-5.04e-4*temp**2)*mn-(18.96-1.427e-4*temp**2)*mn**1.5 + & - (1.458-1.198e-3*temp-9.703e-6*temp**2)*mn**2 - sts_density = 1/ ((1/rhos) *ms/ (mn+ms)+ (1/rhon) *mn/(mn+ms) ) * 1.e-3 - - return - end function sts_density - - !! Calculates surface tension (erg/cm2 = dyne/cm) of sulfate of - !! different compositions as a linear function of temperature, - !! as described in Mills (Ph.D. Thesis, 1996), derived from - !! the measurements of Sabinina and Terpugow (1935). - !! - !! Argument list input: - !! WTP = aerosol composition in weight % H2SO4 (0-100) - !! TEMP = temperature in Kelvin - !! - !! Output: - !! sulfate_surf_tens (erg/cm2) [function name] - !! - !! This function requires setup_sulfate_density to be run - !! first to read in the density coefficients DNC0 and DNC1 - !! and the tabulated weight percents DNWTP. - !! - !! @author Mike Mills - !! @version Mar-2013 - function sulfate_surf_tens(carma, wtp, temp, rc) - - real(kind=f) :: sulfate_surf_tens - type(carma_type), intent(in) :: carma !! the carma object - real(kind=f), intent(in) :: wtp !! weight percent - real(kind=f), intent(in) :: temp !! temperature - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i - real(kind=f) :: sig1, sig2 - real(kind=f) :: frac, temp_loc - real(kind=f) :: stwtp(15), stc0(15), stc1(15) - - data stwtp/0._f, 23.8141_f, 38.0279_f, 40.6856_f, 45.335_f, 52.9305_f, 56.2735_f, & - & 59.8557_f, 66.2364_f, 73.103_f, 79.432_f, 85.9195_f, 91.7444_f, 97.6687_f, 100._f/ - - data stc0/117.564_f, 103.303_f, 101.796_f, 100.42_f, 98.4993_f, 91.8866_f, & - & 88.3033_f, 86.5546_f, 84.471_f, 81.2939_f, 79.3556_f, 75.608_f, 70.0777_f, & - & 63.7412_f, 61.4591_f / - - data stc1/-0.153641_f, -0.0982007_f, -0.0872379_f, -0.0818509_f, & - & -0.0746702_f, -0.0522399_f, -0.0407773_f, -0.0357946_f, -0.0317062_f, & - & -0.025825_f, -0.0267212_f, -0.0269204_f, -0.0276187_f, -0.0302094_f, & - & -0.0303081_f / - - ! limit temperature to reasonable bounds of extrapolation - temp_loc=min(temp, 380.0_f) - temp_loc=max(temp_loc, 180.0_f) - - if (wtp .lt. 0.0_f .OR. wtp .gt. 100.0_f) then - if (do_print) write(LUNOPRT,*)'sulfate_surf_tens: Illegal value for wtp:',wtp - if (do_print) write(LUNOPRT,*)'sulfate_surf_tens: temp=',temp - rc = RC_ERROR - return - endif - - i=1 - - do while (wtp.gt.stwtp(i)) - i=i+1 - end do - - sig2=stc0(i)+stc1(i)*temp_loc - - if (i.eq.1 .or. wtp.eq.stwtp(i)) then - sulfate_surf_tens=sig2 - return - end if - - sig1=stc0(i-1)+stc1(i-1)*temp_loc - frac=(stwtp(i)-wtp)/(stwtp(i)-stwtp(i-1)) - sulfate_surf_tens=sig1*frac+sig2*(1.0_f-frac) - - return - end function sulfate_surf_tens - -end module sulfate_utils diff --git a/CARMAchem_GridComp/CARMA/source/base/sulfhetnucrate.F90 b/CARMAchem_GridComp/CARMA/source/base/sulfhetnucrate.F90 deleted file mode 100644 index 6d01bf0a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/sulfhetnucrate.F90 +++ /dev/null @@ -1,98 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates particle production rates due to heterogeneous -!! nucleation : -!! -!! This was moved from sulfnuc to make the code more manageable. -!! -!! @author Mike Mills, Chuck Bardeen -!! @version Jun-2013 -subroutine sulfhetnucrate(carma, cstate, iz, igroup, nucbin, h2o, h2so4, beta1, beta2, ftry, rstar, nucrate, rc) - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! level index - integer, intent(in) :: igroup !! group index - integer, intent(in) :: nucbin !! bin in which nucleation occurs - real(kind=f), intent(in) :: h2o !! H2O concentrations in molec/cm3 - real(kind=f), intent(in) :: h2so4 !! H2SO4 concentrations in molec/cm3 - real(kind=f), intent(in) :: beta1 - real(kind=f), intent(in) :: beta2 - real(kind=f), intent(in) :: ftry - real(kind=f), intent(in) :: rstar !! critical radius (cm) - real(kind=f), intent(out) :: nucrate !! nucleation rate #/x/y/z/s - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: cnucl - real(kind=f) :: chom - real(kind=f) :: expc - real(kind=f) :: chet - real(kind=f) :: xm - real(kind=f) :: xm1 - real(kind=f) :: fxm - real(kind=f) :: fv2 - real(kind=f) :: fu2 - real(kind=f) :: fv3 - real(kind=f) :: fv4 - real(kind=f) :: v1 - real(kind=f) :: fv1 - real(kind=f) :: ftry1 - real(kind=f) :: rarea - real(kind=f) :: gg - real(kind=f) :: FM = cos(50._f * DEG2RAD) ! cos(contact angle) - - ! Heterogeneous nucleation which depends on r - cnucl = 4._f * PI * rstar**(2._f) - chom = h2so4 * h2o * beta1 * cnucl - expc = 2.4e-16_f * exp(4.51872e+11_f / RGAS / t(iz)) - chet = chom * expc * beta2 - - xm = r(nucbin, igroup) / rstar - - if (xm .lt. 1._f) then - fxm = sqrt(1._f - 2._f * FM * xm + xm**(2._f)) - fv2 = (xm - FM) / fxm - fu2 = (1._f - xm * FM) / fxm - fv3 = (2._f + fv2) * xm**3._f * (fv2 - 1._f)**(2._f) - fv4 = 3._f * FM * xm**2._f * (fv2 - 1._f) - else - xm1 = 1._f / xm - fxm = sqrt(1._f - 2._f * FM * xm1 + xm1**2._f) - fu2 = (xm1 - FM) / fxm - fv2 = (1._f - xm1 * FM) / fxm - v1 = (FM**(2._f) - 1._f) / (fv2 + 1._f) / fxm**(2._f) - fv3 = (2._f + fv2) * xm1 * v1**2._f - fv4 = 3._f * FM * v1 - endif - - fv1 = 0.5_f * (1._f + fu2**3._f + fv3 + fv4) - - ftry1 = ftry * fv1 -! ftry1 = ftry * fh - if (ftry1 .lt. -1000._f) then - nucrate = 0._f - else - - rarea = 4._f * PI * r(nucbin, igroup)**2._f ! surface area per nucleus - gg = exp(ftry1) - - ! Calculate heterogeneous nucleation rate [embryos/s] - ! NOTE: for [embryos/gridpoint/s], multipy rnuclg by pc [nuclei/gridpoint] - nucrate = chet * gg * rarea ! embryos/s - end if - - return -end subroutine sulfhetnucrate - diff --git a/CARMAchem_GridComp/CARMA/source/base/sulfnuc.F90 b/CARMAchem_GridComp/CARMA/source/base/sulfnuc.F90 deleted file mode 100644 index 7f271eea..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/sulfnuc.F90 +++ /dev/null @@ -1,131 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates particle production rates due to nucleation : -!! binary homogeneous nucleation of sulfuric acid and water only -!! Numerical method follows Zhao & Turco, JAS, V.26, No.5, 1995. -!! -!! @author Mike Mills, Chuck Bardeen -!! @version Jun-2013 -subroutine sulfnuc(carma,cstate, iz, rc) - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! level index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: ibin ! bin index - integer :: igas ! gas index - integer :: iepart ! concentration element index - integer :: nucbin ! bin in which nucleation takes place - integer :: ignucto ! index of target nucleation group - integer :: ienucto ! index of target nucleation element - integer :: inuc - real(kind=f) :: nucrate ! nucleation rate (#/x/y/z/s) - real(kind=f) :: h2o ! H2O concentrations in molec/cm3 - real(kind=f) :: h2so4 ! H2SO4 concentrations in molec/cm3 - real(kind=f) :: beta1 - real(kind=f) :: beta2 - real(kind=f) :: ftry - real(kind=f) :: rstar ! critical radius (cm) - - ! Cycle through each group, only proceed if BHN - rstar = -1._f - - do igroup = 1 , NGROUP - - igas = inucgas(igroup) ! condensing gas - - if (igas .ne. 0) then - - iepart = ienconc(igroup) ! particle number density element - - if (inucproc(iepart,iepart) .eq. I_HOMNUC) then - - ! This is where all of the pre calculation needs to go, so that it isn't - ! done when the model is not configured for homogeneous nucleation of - ! sulfates. - call sulfnucrate(carma, cstate, iz, igroup, h2so4, h2o, beta1, beta2, ftry, rstar, nucbin, nucrate, rc) - if (rc /= RC_OK) return - - ! Do further calculations only if nucleation occurred - if (nucrate .gt. 0._f) then - - rhompe(nucbin, iepart) = rhompe(nucbin, iepart) + nucrate - - ! Since homogeneous nucleation doesn't go through upgxfer or downgxfer, then - ! then the effects of latent heat need to be accounted for here. - ! rlprod = rlprod + rhompe(nucbin, ielem) * rmass(nucbin,igroup) * rlh_nuc(ielem,ielem) / (CP * rhoa(iz)) - end if - end if - end if - end do - - ! Cycle through each group, only proceed if heterogeneous nucleation - ! - ! NOTE: Only do heterogeneous nucleation if an rstar was determined by homogeneous - ! nucleation. - if (rstar > 0._f) then - do igroup = 1 , NGROUP - - igas = inucgas(igroup) ! condensing gas - - if (igas .ne. 0) then - - iepart = ienconc(igroup) ! particle number density element - - ! Calculate heterogeneous nucleation loss rates. Do not allow nucleation into - ! an evaporating bin. - ! - ! NOTE: Heterogeneous nucleation assumes that homogeneous nucleation was called - ! first to determine the critical cluster size. - ! - ! is index of target nucleation element; - ! is index of target nucleation group. - do inuc = 1, nnuc2elem(iepart) - - ienucto = inuc2elem(inuc,iepart) - - if (ienucto .ne. 0) then - ignucto = igelem(ienucto) - else - ignucto = 0 - endif - - if (inucproc(iepart,ienucto) .eq. I_HETNUCSULF) then - - do ibin = NBIN, 1, -1 - - ! Bypass calculation if few particles are present - if (pconmax(iz,igroup) .gt. FEW_PC) then - - ! This is where all of the pre calculation needs to go, so that it isn't - ! done when the model is not configured for homogeneous nucleation of - ! sulfates. - call sulfhetnucrate(carma, cstate, iz, igroup, ibin, h2so4, h2o, beta1, beta2, ftry, rstar, nucrate, rc) - if (rc /= RC_OK) return - - rnuclg(ibin, igroup, ignucto) = rnuclg(ibin, igroup, ignucto) + nucrate - end if - end do - end if - end do - end if - - end do - end if - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/sulfnucrate.F90 b/CARMAchem_GridComp/CARMA/source/base/sulfnucrate.F90 deleted file mode 100644 index 1efea9ad..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/sulfnucrate.F90 +++ /dev/null @@ -1,318 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates particle production rates due to nucleation : -!! binary homogeneous nucleation of sulfuric acid and water only -!! Numerical method follows Zhao & Turco, JAS, V.26, No.5, 1995. -!! -!! This was moved from sulfnuc to make the code more manageable. -!! -!! @author Mike Mills, Chuck Bardeen -!! @version Jun-2013 -subroutine sulfnucrate(carma,cstate, iz, igroup, h2o, h2so4, beta1, beta2, ftry, rstar, nucbin, nucrate, rc) - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! level index - integer, intent(in) :: igroup !! group index - real(kind=f), intent(out) :: h2o !! H2O concentrations in molec/cm3 - real(kind=f), intent(out) :: h2so4 !! H2SO4 concentrations in molec/cm3 - real(kind=f), intent(out) :: beta1 - real(kind=f), intent(out) :: beta2 - real(kind=f), intent(out) :: ftry - real(kind=f), intent(out) :: rstar !! critical radius (cm) - integer, intent(out) :: nucbin !! bin in which nucleation occurs - real(kind=f), intent(out) :: nucrate !! nucleation rate #/x/y/z/s - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: i, ibin, ie - real(kind=f) :: dens(46) - real(kind=f) :: pa(46) - real(kind=f) :: pb(46) - real(kind=f) :: c1(46) - real(kind=f) :: c2(46) - real(kind=f) :: fct(46) - real(kind=f) :: wtmolr ! molecular weight ration of H2SO4/H2O - real(kind=f) :: h2o_cgs ! H2O densities in g/cm3 - real(kind=f) :: h2so4_cgs ! H2SO4 densities in g/cm3 - real(kind=f) :: h2oln ! H2O ambient vapor pressures [dynes/cm2] - real(kind=f) :: h2so4ln ! H2SO4 ambient vapor pressures [dynes/cm2] - real(kind=f) :: rh ! relative humidity of water wrt liquid water - real(kind=f) :: SA ! total surface area of pre-existing wet particles - real(kind=f) :: SAbin ! bin surface area of pre-existing wet particles - real(kind=f) :: cw - real(kind=f) :: dw - real(kind=f) :: wvp ! water eq.vp over solution - real(kind=f) :: wvpln - real(kind=f) :: t0_kulm - real(kind=f) :: seqln - real(kind=f) :: t_crit_kulm - real(kind=f) :: factor_kulm - real(kind=f) :: dw1, dw2 - real(kind=f) :: dens1 - real(kind=f) :: dens11 - real(kind=f) :: dens12 - real(kind=f) :: xfrac - real(kind=f) :: wstar - real(kind=f) :: dstar - real(kind=f) :: rhln - real(kind=f) :: raln - real(kind=f) :: wfstar - real(kind=f) :: sigma - real(kind=f) :: ystar - real(kind=f) :: r2 - real(kind=f) :: gstar - real(kind=f) :: rb - real(kind=f) :: rpr - real(kind=f) :: rpre - real(kind=f) :: fracmol - real(kind=f) :: zphi - real(kind=f) :: zeld - real(kind=f) :: cfac - real(kind=f) :: ahom - real(kind=f) :: exhom - real(kind=f) :: rmstar - real(kind=f) :: frac_h2so4 - real(kind=f) :: rhomlim - real(kind=f) :: dnpot(46), dnwf(46) - real(kind=f) :: rho_H2SO4_wet - - 5 format(/,'microfast::WARNING - nucleation rate exceeds 5.e1: ie=', i2,', iz=',i4,',lat=', & - f7.2,',lon=',f7.2, ', rhompe=', e10.3) - - rstar = -1._f - - ! Parameterized fit developed by Mike Mills in 1994 to the partial molal - ! Gibbs energies (F2|o-F2) vs. weight percent H2SO4 table in Giauque et al., - ! J. Am. Chem. Soc, 82, 62-70, 1960. The parameterization gives excellent - ! agreement. Ayers (GRL, 7, 433-436, 1980) refers to F2|o-F2 as mu - mu_0 - ! (chemical potential). This parameterization may be replaced by a lookup - ! table, as was done ultimately in the Garcia-Solomon sulfate code. - do i = 1, 46 - dnpot(i) = 4.184_f * (23624.8_f - 1.14208e8_f / ((dnwtp(i) - 105.318_f)**2 + 4798.69_f)) - dnwf(i) = dnwtp(i) / 100._f - end do - - ! Molecular weight ratio of H2SO4 / H2O: - wtmolr = gwtmol(igash2so4) / gwtmol(igash2o) - - ! Compute H2O and H2SO4 densities in g/cm3 - h2o_cgs = gc(iz, igash2o) / (zmet(iz) * xmet(iz) * ymet(iz)) - h2so4_cgs = gc(iz, igash2so4) / (zmet(iz) * xmet(iz) * ymet(iz)) - - ! Compute H2O and H2SO4 concentrations in molec/cm3 - h2o = h2o_cgs * AVG / gwtmol(igash2o) - h2so4 = h2so4_cgs * AVG / gwtmol(igash2so4) - - ! Compute relative humidity of water wrt liquid water - rh = (supsatl(iz, igash2o) + 1._f) * 100._f - - ! Compute ln of H2O and H2SO4 ambient vapor pressures [dynes/cm2] - h2oln = log(h2o_cgs * (RGAS / gwtmol(igash2o)) * t(iz)) - h2so4ln = log(h2so4_cgs * (RGAS / gwtmol(igash2so4)) * t(iz)) - - ! loop through wt pcts and calculate vp/composition for each - do i = 1, 46 - dens(i) = dnc0(i) + dnc1(i) * t(iz) - - ! Calc. water eq.vp over solution using (Lin & Tabazadeh eqn 5, JGR, 2001) - cw = 22.7490_f + 0.0424817_f * dnwtp(i) - 0.0567432_f * dnwtp(i)**0.5_f - 0.000621533_f * dnwtp(i)**2 - dw = -5850.24_f + 21.9744_f * dnwtp(i) - 44.5210_f * dnwtp(i)**0.5_f - 0.384362_f * dnwtp(i)**2 - - ! pH20 | eq[mb] - wvp = exp(cw + dw / t(iz)) - - ! Ln(pH2O | eq [dynes/cm2]) - wvpln = log(wvp * 1013250._f / 1013.25_f) - - ! Save the water eq.vp over solution at each wt pct into this array: - ! - ! Ln(pH2O/pH2O|eq) with both terms in dynes/cm2 - pb(i) = h2oln - wvpln - - ! Calc. sulfuric acid eq.vp over solution using (Ayers et. al., GRL, V.7, No.6, June 1980) - ! - ! T0 set in the low end of the Ayers measurement range (338-445K) - t0_kulm = 340._f - seqln = -10156._f / t0_kulm + 16.259_f - - ! Now calc. Kulmala correction (J. CHEM. PHYS. V.93, No.1, 1 July 1990) - ! - ! Critical temperature = 1.5 * Boiling point - t_crit_kulm = 905._f - factor_kulm = -1._f / t(iz) + 1._f / t0_kulm + 0.38_f / (t_crit_kulm - t0_kulm) * & - (1.0_f + log(t0_kulm / t(iz)) - t0_kulm / t(iz)) - - ! For pure sulfuric acid - seqln = seqln + 10156._f * factor_kulm - - ! Now adjust vp based on weight % composition using parameterization of Giauque 1960 - ! - ! Adjust for WTPCT composition - seqln = seqln - dnpot(i) / (8.3143_f * t(iz)) - - ! Convert atmospheres => dynes/cm2 - seqln = seqln + log(1013250._f) - - ! Save the sulfuric acid eq.vp over solution at each wt pct into this array: - ! - ! Ln(pH2SO4/pH2SO4|eq) with both terms in dynes/cm2 - pa(i) = h2so4ln - seqln - - ! Create 2-component solutions of varying composition c1 and c2 - c1(i) = pa(i) - pb(i) * wtmolr - c2(i) = pa(i) * dnwf(i) + pb(i) * (1._f - dnwf(i)) * wtmolr - end do ! end of loop through wtpcts - - ! Now loop through until we find the c1+c2 combination with minimum Gibbs free energy - dw2 = dnwtp(46) - dnwtp(45) - dens1 = (dens(46) - dens(45)) / dw2 - fct(46) = c1(46) + c2(46) * 100._f * dens1 / dens(46) - dens12 = dens1 - - do i = 45, 2, -1 - dw1 = dw2 - dens11 = dens12 - dw2 = dnwtp(i) - dnwtp(i-1) - dens12 = (dens(i) - dens(i-1)) / dw2 - dens1 = (dens11 * dw2 + dens12 * dw1) / (dw1 + dw2) - - fct(i) = c1(i) + c2(i) * 100._f * dens1 / dens(i) - - ! Find saddle where fct(i)<0 0._f) then - nucbin = 0 - nucrate = 0.0_f - - return - - ! Possibility 2: loop crossed the saddle; interpolate to find exact value: - else if (fct(i) * fct(i+1) < 0._f) then - xfrac = fct(i+1) / (fct(i+1) - fct(i)) - wstar = dnwtp(i+1) * (1.0_f - xfrac) + dnwtp(i) * xfrac ! critical wtpct - dstar = dens(i+1) * (1.0_f - xfrac) + dens(i) * xfrac - rhln = pb(i+1) * (1.0_f - xfrac) + pb(i) * xfrac - raln = pa(i+1) * (1.0_f - xfrac) + pa(i) * xfrac - - ! Possibility 3: loop found the saddle point exactly - else - dstar = dens(i) - - ! critical wtpct - wstar = dnwtp(i) - rhln = pb(i) - raln = pa(i) - end if - - ! Critical weight fraction - wfstar = wstar / 100._f - - if ((wfstar < 0._f) .or. (wfstar > 1._f)) then - write(LUNOPRT,*)'sulfnuc: wstar out of bounds!' - rc = RC_ERROR - return - end if - - ! Critical surface tension [erg/cm2] - sigma = sulfate_surf_tens(carma, wstar, t(iz), rc) - - ! Critical Y (eqn 13 in Zhao & Turco 1993) [erg/cm3] - ystar = dstar * RGAS * t(iz) * (wfstar / gwtmol(igash2so4) & - * raln + (1._f - wfstar) / gwtmol(igash2o) * rhln) - if (ystar < 1.e-20_f) then - nucbin = 0 - nucrate = 0.0_f - - return - end if - - ! Critical cluster radius [cm] - rstar = 2._f * sigma / ystar - rstar = max(rstar, 0.0_f) - r2 = rstar * rstar - - ! Critical Gibbs free energy [erg] - gstar = (4._f * PI / 3._f) * r2 * sigma - - ! kT/(2*Pi*M) = [erg/mol/K]*[K]/[g/mol] = [erg/g] = [cm2/s2] - ! RB[erg/mol] = RGAS[erg/mol/K] * T[K] / (2Pi) - rb = RGAS * t(iz) / 2._f / PI - - ! Beta[cm/s] = sqrt(RB[erg/mol] / WTMOL[g/mol]) - beta1 = sqrt(rb / gwtmol(igash2so4)) ! H2SO4 - beta2 = sqrt(rb / gwtmol(igash2o)) ! H2O - - ! RPR[molecules/s] = 4Pi * R2[cm2] * H2O[molecules/cm3] * Beta[cm/s] - rpr = 4._f * PI * r2 * h2o * beta1 - - ! RPRE[/cm3/s] = RPR[/s] * H2SO4[/cm3]; first part of Zhao & Turco eqn 16 - rpre = rpr * h2so4 - - ! Zeldovitch non-equilibrium correction factor [unitless] - ! Jaecker-Voirol & Mirabel, 1988 (not considered in Zhao & Turco) - fracmol = 1._f /(1._f + wtmolr * (1._f - wfstar) / wfstar) - zphi = atan(fracmol) - zeld = 0.25_f / (sin(zphi))**2 - - ! Empirical correction factor: - cfac = 0.0_f - - ! Gstar exponential term in Zhao & Turco eqn 16 [unitless] - ftry = (-gstar / BK / t(iz)) - ahom = ftry + cfac - if (ahom .lt. -500._f) then - exhom=0.0_f - else - exhom = exp(min(ahom, 28.0_f)) - endif - - ! Calculate mass of critical nucleus - rho_H2SO4_wet = sulfate_density(carma, wtpct(iz),t(iz), rc) - rmstar = (4._f * PI / 3._f) * rho_H2SO4_wet * r2 * rstar - - ! Calculate dry mass of critical nucleus - rmstar = rmstar * wfstar - - ! Calc bin # of crit nucleus - if (rmstar.lt.rmassup(1,igroup)) then - nucbin = 1 - else - nucbin = 2 + int(log(rmstar / rmassup(1,igroup)) / log(rmrat(igroup))) - endif - - ! If none of the bins are large enough for the critical radius, then - ! no nucleation will occur. - if (nucbin > NBIN) then - nucbin = 0 - nucrate = 0.0_f - else - ! Calculate the nucleation rate [#/cm3/s], Zhao & Turco eqn 16. - nucrate = rpre * zeld * exhom - - ! Scale to #/x/y/z/s - nucrate = nucrate * zmet(iz) * xmet(iz) * ymet(iz) - endif - - return -end subroutine sulfnucrate - diff --git a/CARMAchem_GridComp/CARMA/source/base/supersat.F90 b/CARMAchem_GridComp/CARMA/source/base/supersat.F90 deleted file mode 100644 index 94c5b1a4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/supersat.F90 +++ /dev/null @@ -1,107 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine evaluates supersaturations and for all gases. -!! -!! @author Andy Ackerman, Chuck Bardeen -!! @version Dec-1995, Aug-2010 -subroutine supersat(carma, cstate, iz, igas, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: igas !! gas index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: rvap - real(kind=f) :: gc_cgs - real(kind=f) :: alpha - - ! Calculate vapor pressures. - call vaporp(carma, cstate, iz, igas, rc) - - ! Define gas constant for this gas - rvap = RGAS / gwtmol(igas) - - gc_cgs = gc(iz,igas) / (zmet(iz)*xmet(iz)*ymet(iz)) - - supsatl(iz,igas) = (gc_cgs * rvap * t(iz) - pvapl(iz,igas)) / pvapl(iz,igas) - supsati(iz,igas) = (gc_cgs * rvap * t(iz) - pvapi(iz,igas)) / pvapi(iz,igas) - - ! For subgrid scale clouds, the supersaturation needs to be increased be scaled - ! based upon cloud fraction. This approach is similar to Wilson and Ballard (1999), - ! except that only the water vapor (no liquid water) is used to determine the available - ! water. - ! - ! NOTE: This assumes that the cloud is an ice cloud. - if (do_incloud) then - alpha = rhcrit(iz) * (1._f - cldfrc(iz)) + cldfrc(iz) - - supsatl(iz,igas) = (gc_cgs * rvap * t(iz) - alpha * pvapl(iz,igas)) / pvapl(iz,igas) - supsati(iz,igas) = (gc_cgs * rvap * t(iz) - alpha * pvapi(iz,igas)) / pvapi(iz,igas) - - ! Limit supersaturation to liquid saturation. - supsatl(iz,igas) = min(supsatl(iz,igas), 0._f) - supsati(iz,igas) = min(supsati(iz,igas), (pvapl(iz,igas) - alpha * pvapi(iz,igas)) / pvapi(iz,igas)) - end if - - return -end - - -!! This routine evaluates supersaturations and for all gases, but -!! thus version of the routine does not scale the supersaturation based on the cloud -!! fraction. It also assumes that vaporp has already been called. -!! -!! @author Andy Ackerman, Chuck Bardeen -!! @version Dec-1995, Aug-2010 -subroutine supersat_nocldf(carma, cstate, iz, igas, ssi, ssl, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: igas !! gas index - real(kind=f), intent(out) :: ssl - real(kind=f), intent(out) :: ssi - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: rvap - real(kind=f) :: gc_cgs - real(kind=f) :: alpha - - ! Calculate vapor pressures. - call vaporp(carma, cstate, iz, igas, rc) - - ! Define gas constant for this gas - rvap = RGAS / gwtmol(igas) - - gc_cgs = gc(iz,igas) / (zmet(iz)*xmet(iz)*ymet(iz)) - - ssl = (gc_cgs * rvap * t(iz) - pvapl(iz,igas)) / pvapl(iz,igas) - ssi = (gc_cgs * rvap * t(iz) - pvapi(iz,igas)) / pvapi(iz,igas) - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/totalcondensate.F90 b/CARMAchem_GridComp/CARMA/source/base/totalcondensate.F90 deleted file mode 100644 index 5479059e..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/totalcondensate.F90 +++ /dev/null @@ -1,88 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the total amount of condensate associated with each gas. -!! -!! @author Chuck Bardeen -!! @version Nov-2009 -subroutine totalcondensate(carma, cstate, iz, total_ice, total_liquid, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(out) :: total_ice(NGAS) !! total ice at the start of substep - real(kind=f), intent(out) :: total_liquid(NGAS) !! total liquid at the start of substep - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: icore ! core index - integer :: igas ! gas index - integer :: ibin ! bin index - integer :: ielem ! element index - integer :: i - real(kind=f) :: coremass - real(kind=f) :: volatilemass - - - ! Initialize local variables for keeping track of gas changes due - ! to nucleation and growth in each particle group. - total_ice(:) = 0._f - total_liquid(:) = 0._f - - ! Iterate over each particle type and total up that ones that interact - ! with the gases. - ! - ! This code assumes that all changes in condensate are associated with - ! growth in a particular gas. This doesn't handle all possible changes - ! associated with nucleation, if the group do not also participate in - ! growth. - do igroup = 1,NGROUP - - ielem = ienconc(igroup) ! element of particle number concentration - - igas = igrowgas(ielem) ! condensing gas - - if ((itype(ielem) == I_VOLATILE) .and. (igas /= 0)) then - - do ibin = 1, NBIN - - ! If this group has core masses, then determine the involatile component. - coremass = 0._f - - do i = 1, ncore(igroup) - icore = icorelem(i, igroup) - coremass = coremass + pc(iz, ibin, icore) - end do - - volatilemass = (pc(iz, ibin, ielem) * rmass(ibin, igroup)) - coremass - - ! There seem to be times when the coremass becomes larger than the total - ! mass. This shouldn't happen, but check for it here. - ! - ! NOTE: This can be caused by advection in the parent model or sedimentation - ! in this model. - if (volatilemass > 0._f) then - if (is_grp_ice(igroup)) then - total_ice(igas) = total_ice(igas) + volatilemass - else - total_liquid(igas) = total_liquid(igas) + volatilemass - end if - end if - end do - end if - end do - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/tsolve.F90 b/CARMAchem_GridComp/CARMA/source/base/tsolve.F90 deleted file mode 100644 index 0254ca62..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/tsolve.F90 +++ /dev/null @@ -1,115 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates new potential temperature concentration -!! (and updates temperature) due to microphysical and radiative forcings. -!! The equation solved (the first law of thermodynamics in flux form) is -!! -!! d(rhostar theta) rhostar theta d(qv) 1 dF -!! --------------- = - ------------- * ( L ----- + --- -- ) -!! dt Cp T dt rho dz -!! -!! where -!! rhostar = scaled air density -!! theta = potential temperature -!! t = time -!! Cp = specific heat (at constant pressure) of air -!! T = air temperature -!! qv = water vapor mixing ratio -!! L = latent heat -!! F = net radiative flux -!! z = unscaled altitude -!! -!! @author Andy Ackerman -!! @version Oct-1997 -subroutine tsolve(carma, cstate, iz, scale_threshold, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f) :: scale_threshold !! Scaling factor for convergence thresholds - integer, intent(inout) :: rc !! return code, negative indicates failure - - 1 format(/,'tsolve::ERROR - negative temperature for : iz=',i4,',lat=',& - f7.2,',lon=',f7.2,',T=',e10.3,',dT=',e10.3,',t_old=',e10.3,',d_gc=',e10.3,',dT_adv=',e10.3) - 2 format(/,'tsolve::ERROR - temperature change to large for : iz=',i4,',lat=',& - f7.2,',lon=',f7.2,',T=',e10.3,',dT_rlh=',e10.3,',dT_pth=',e10.3,',t_old=',e10.3,',d_gc=',e10.3,',dT_adv=',e10.3) - 3 format(/,'tsolve::ERROR - temperature change to large for : iz=',i4,',lat=',& - f7.2,',lon=',f7.2,',T=',e10.3,',dT_rlh=',e10.3,',dT_pth=',e10.3,',t_old=',e10.3) - 4 format(/,'tsolve::ERROR - negative temperature for : iz=',i4,',lat=',& - f7.2,',lon=',f7.2,',T=',e10.3,',dT=',e10.3,',t_old=',e10.3) - - real(kind=f) :: dt ! delta temperature - real(kind=f) :: threshold ! convergence threshold - - - ! Solve for the new due to latent heat exchange and radiative heating. - ! Latent and radiative heating rates are in units of [deg_K/s]. - ! - ! NOTE: In the embedded model rhoa and p are handled by the parent model and - ! won't change during one time step. - ! - ! NOTE: Radiative heating by the particles is handled by the parent model, so - ! that term does not need to be added here. - dt = dtime * rlprod - rlheat(iz) = rlheat(iz) + rlprod * dtime - - ! With particle heating, you must also include the impact of heat - ! conduction from the particle - ! - ! NOTE: We are ignoring the energy to heat the particle, since we - ! are not tracking the particle temperature. Thus ... - if (do_pheatatm) then - dt = dt + dtime * phprod - partheat(iz) = partheat(iz) + phprod * dtime - end if - - t(iz) = t(iz) + dt - - - ! Don't let the temperature go negative. - if (t(iz) < 0._f) then - if (do_substep) then - if (nretries == maxretries) then - if (do_print) write(LUNOPRT,1) iz, lat, lon, t(iz), dt, told(iz), d_gc(iz, 1), d_t(iz) - end if - else - if (do_print) write(LUNOPRT,4) iz, lat, lon, t(iz), dt, told(iz) - end if - - rc = RC_WARNING_RETRY - end if - - ! Don't let the temperature change by more than the threshold in any given substep, - ! to prevent overshooting that doesn't result in negative gas concentrations, but - ! does result in excessive temperature swings. - threshold = dt_threshold / scale_threshold - - if (threshold /= 0._f) then - if (abs(abs(dt)) > threshold) then - if (do_substep) then - if (nretries == maxretries) then - if (do_print) write(LUNOPRT,2) iz, lat, lon, t(iz), rlprod*dtime, dtime*partheat(iz), told(iz), d_gc(iz, 1), d_t(iz) - end if - else - if (do_print) write(LUNOPRT,3) iz, lat, lon, t(iz), rlprod*dtime, dtime*partheat(iz), told(iz) - end if - - rc = RC_WARNING_RETRY - end if - end if - - ! Return to caller with new temperature. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/upgxfer.F90 b/CARMAchem_GridComp/CARMA/source/base/upgxfer.F90 deleted file mode 100644 index c32c1388..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/upgxfer.F90 +++ /dev/null @@ -1,142 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates particle source terms due to element transfer -!! processes for which the target element number is greater than the source element -!! number. (Otherwise, the source terms are calculated in downgxfer.f.) -!! The calculation is done for one particle size bin at one spatial grid point per -!! call. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine upgxfer(carma, cstate, iz, ibin, ielem, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: ibin !! bin index - integer, intent(in) :: ielem !! element index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: igroup ! group index - integer :: iepart - integer :: jefrom - integer :: iefrom - integer :: igfrom - integer :: ipow_from - integer :: ipow_to - integer :: ipow - integer :: jfrom - integer :: ifrom - integer :: ic - integer :: iecore - real(kind=f) :: xyzmet - real(kind=f) :: rhoa_cgs - real(kind=f) :: elemass - real(kind=f) :: totmass - real(kind=f) :: rmasscore - real(kind=f) :: fracmass - real(kind=f) :: rnucprod - - - ! Define group & particle # concentration indices for current element - igroup = igelem(ielem) ! target particle group - iepart = ienconc(igroup) ! target particle number concentration element - - ! Calculate production terms due to nucleation . - - ! Loop over elements that nucleate to element . - do jefrom = 1,nnucelem(ielem) - - iefrom = inucelem(jefrom,ielem) ! source particle element - - ! Only calculate production rates here if is greater than - ! . Otherwise, production is calculated in downgxfer.f - if( ielem .gt. iefrom ) then - - igfrom = igelem(iefrom) ! source particle group - - ! is the power to which the source particle mass must be taken - ! to match the type of the target element. This ugliness could be - ! handled much more slickly in setupnuc() - if( itype(iefrom) .eq. I_INVOLATILE .or. & - itype(iefrom) .eq. I_VOLATILE )then - ipow_from = 0 - elseif ( itype(iefrom) .eq. I_COREMASS .or. & - itype(iefrom) .eq. I_VOLCORE )then - ipow_from = 1 - else - ipow_from = 2 - endif - - if( itype(ielem) .eq. I_INVOLATILE .or. & - itype(ielem) .eq. I_VOLATILE )then - ipow_to = 0 - elseif ( itype(ielem) .eq. I_COREMASS .or. & - itype(ielem) .eq. I_VOLCORE )then - ipow_to = 1 - else - ipow_to = 2 - endif - - ipow = ipow_to - ipow_from - - ! Loop over bins that nucleate to bin . - do jfrom = 1,nnucbin(igfrom,ibin,igroup) - - ifrom = inucbin(jfrom,igfrom,ibin,igroup) ! bin of source - - ! Bypass calculation if few source particles are present - if( pconmax(iz,igfrom) .gt. FEW_PC )then - - if( rnuclg(ifrom,igfrom,igroup) .gt. 0._f )then - - ! First calculate mass associated with the source element - ! (this is for all source elements except particle number - ! concentration in a multicomponent particle group). - if( ncore(igfrom) .eq. 0 .or. & - itype(iefrom) .gt. I_VOLATILE )then - elemass = rmass(ifrom,igfrom) - else - totmass = pc(iz,ifrom,iefrom) * rmass(ifrom,igfrom) - rmasscore = pc(iz,ifrom,icorelem(1,igfrom)) - - do ic = 2,ncore(igfrom) - iecore = icorelem(ic,igfrom) - rmasscore = rmasscore + pc(iz,ifrom,iecore) - enddo - - fracmass = 1._f - rmasscore/totmass - elemass = fracmass * rmass(ifrom,igfrom) - endif - - rnucprod = rnuclg(ifrom,igfrom,igroup) * & - pc(iz,ifrom,iefrom) * elemass**ipow - - rnucpe(ibin,ielem) = rnucpe(ibin,ielem) + rnucprod - - ! Calculate latent heat associated with nucleation to - ! from -! rlprod = rlprod + rnucprod * rlh_nuc(iefrom,ielem) / & -! (CP * rhoa(iz)) * elemass - endif ! (rnuclg > 0.) - endif ! (pconmax > FEW_PC) - enddo ! (jfrom = 1,nnucbin) - endif ! (ielem > iefrom) - enddo ! (jefrom = 1,nnucelem) - - ! Return to caller with nucleation production terms evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vaporp.F90 b/CARMAchem_GridComp/CARMA/source/base/vaporp.F90 deleted file mode 100644 index a291a70d..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vaporp.F90 +++ /dev/null @@ -1,62 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates the vapor pressure for all gases at one altitude. -!! -!! and are vapor pressures in units of [dyne/cm^2] -!! -!! Uses temperature as input. -!! -!! @author Andy Ackerman -!! @version Dec-1995 -subroutine vaporp(carma, cstate, iz, igas, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - integer, intent(in) :: igas !! gas index - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Each gas should have a vapor pressure routine specified for it. - ! - ! As new gases are supported, this table should be expanded with new entries for - ! the appropriate vapor pressure rotuines. - select case(ivaprtn(igas)) - - case (I_VAPRTN_H2O_BUCK1981) - call vaporp_h2o_buck1981(carma, cstate, iz, rc, pvapl(iz, igas), pvapi(iz, igas)) - - case(I_VAPRTN_H2O_MURPHY2005) - call vaporp_h2o_murphy2005(carma, cstate, iz, rc, pvapl(iz, igas), pvapi(iz, igas)) - - case(I_VAPRTN_H2O_GOFF1946) - call vaporp_h2o_goff1946(carma, cstate, iz, rc, pvapl(iz, igas), pvapi(iz, igas)) - - case(I_VAPRTN_H2SO4_AYERS1980) - call vaporp_h2so4_ayers1980(carma, cstate, iz, rc, pvapl(iz, igas), pvapi(iz, igas)) - - case(I_VAPRTN_NULL) - pvapl(iz, igas) = 1._f - pvapi(iz, igas) = 1._f - - case default - if (do_print) write(LUNOPRT,*) "vaporp:: ERROR - Unknown vapor pressure routine (", ivaprtn(igas), & - ") for gas (", igas, ")." - rc = RC_ERROR - return - end select - - ! Return to caller with vapor pressures evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_buck1981.F90 b/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_buck1981.F90 deleted file mode 100644 index d4f914d2..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_buck1981.F90 +++ /dev/null @@ -1,66 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates the vapor pressure of water vapor over liquid water and ice according -!! to the parameterization of Buck [1981]. -!! -!! NOTE: and are vapor pressures in units of [dyne/cm^2] -!! -subroutine vaporp_h2o_buck1981(carma, cstate, iz, rc, pvap_liq, pvap_ice) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(out) :: pvap_liq !! vapor pressure wrt liquid - real(kind=f), intent(out) :: pvap_ice !! vapor pressure wrt ice - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - - ! Define coefficients in Buck's formulation for saturation vapor pressures - ! Table 2 - ! - ! Ice: valid temperature interval -80 - 0 C - real(kind=f), parameter :: BAI = 6.1115e2_f - real(kind=f), parameter :: BBI = 23.036_f - real(kind=f), parameter :: BCI = 279.82_f - real(kind=f), parameter :: BDI = 333.7_f - - ! Liquid: valid temperature interval -40 - +50 C - real(kind=f), parameter :: BAL = 6.1121e2_f - real(kind=f), parameter :: BBL = 18.729_f - real(kind=f), parameter :: BCL = 257.87_f - real(kind=f), parameter :: BDL = 227.3_f - - real(kind=f) :: tt - - - ! Saturation vapor pressure over liquid water and water ice from - ! Buck [J. Atmos. Sci., 20, 1527, 1981] - tt = t(iz) - 273.16_f - - pvap_liq = BAL * exp( (BBL - tt/BDL)*tt / (tt + BCL) ) - pvap_ice = BAI * exp( (BBI - tt/BDI)*tt / (tt + BCI) ) - - ! Check to see whether temperature is ouside range of validity for the parameterization. - ! - ! NOTE: Don't stop the simulation if the limits are exceeded. - if (pvap_liq .le. 1.e-13_f) then - if (do_print) write(LUNOPRT,*) 'vaporp_buck1981::WARNING - Temperature (', t(iz), ') too small for iz = ', iz - rc = RC_WARNING - endif - - ! Return to caller with vapor pressures evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_goff1946.F90 b/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_goff1946.F90 deleted file mode 100644 index 3dae13ed..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_goff1946.F90 +++ /dev/null @@ -1,65 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates the vapor pressure of water vapor over liquid water and ice according -!! to the parameterization of Goff & Gratch [1946] as used in CAM (wv_saturation.F90). -!! -!! NOTE: and are vapor pressures in units of [dyne/cm^2] -!! -!! @author Chuck Bardeen -!! @version Dec-2010 -subroutine vaporp_h2o_goff1946(carma, cstate, iz, rc, pvap_liq, pvap_ice) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(out) :: pvap_liq !! vapor pressure wrt liquid [dyne/cm2] - real(kind=f), intent(out) :: pvap_ice !! vapor pressure wrt ice [dyne[cm2] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: tt - - - ! Saturation vapor pressure over liquid water and water ice from - ! Goff and Gatch, [1946]. - tt = t(iz) - - pvap_liq = 10.0_f * 10._f**(-7.90298_f * (373.16_f / tt - 1._f) + & - 5.02808_f * log10(373.16_f / tt) - & - 1.3816e-7_f * (10._f**(11.344_f * (1._f - tt / 373.16_f)) - 1._f) + & - 8.1328e-3_f * (10._f**(-3.49149_f * (373.16_f / tt - 1._f)) - 1._f) + & - log10(1013.246_f)) * 100._f - - pvap_ice = 10.0_f * 10._f**(-9.09718_f * (273.16_f / tt - 1._f) - 3.56654_f * & - log10(273.16_f / tt) + 0.876793_f * (1._f - tt / 273.16_f) + & - log10(6.1071_f)) * 100._f - - ! Check to see whether temperature is ouside range of validity for the parameterization. - ! - ! pvapl is defined for -50 C < T < 102 C , Gibbons [1990] - ! pvapi is defined for T > -100 C - ! - ! NOTE: Don't stop the simulation if the limits are exceeded. - if ((t(iz) .le. 173.0_f) .or. (t(iz) .ge. 375.0_f)) then -! if (do_print) then -! write(LUNOPRT,*) 'vaporp_h2o_goff1946::WARNING - Temperature', t(iz), & -! ' out of range at iz = ', iz, "lat=", lat, "lon=", lon -! end if - rc = RC_WARNING - endif - - ! Return to caller with vapor pressures evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_murphy2005.F90 b/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_murphy2005.F90 deleted file mode 100644 index 60f45adb..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2o_murphy2005.F90 +++ /dev/null @@ -1,59 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates the vapor pressure of water vapor over liquid water and ice according -!! to the parameterization of Murphy & Koop [2005]. -!! -!! NOTE: and are vapor pressures in units of [dyne/cm^2] -!! -!! @author Chuck Bardeen -!! @version May-2009 -subroutine vaporp_h2o_murphy2005(carma, cstate, iz, rc, pvap_liq, pvap_ice) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(out) :: pvap_liq !! vapor pressure wrt liquid [dyne/cm2] - real(kind=f), intent(out) :: pvap_ice !! vapor pressure wrt ice [dyne[cm2] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: tt - - - ! Saturation vapor pressure over liquid water and water ice from - ! Murphy and Koop, Quart. J. Roy. Meteo. Soc., 131, 1539-1565, [2005]. - tt = t(iz) - - pvap_liq = 10.0_f * exp(54.842763_f - (6763.22_f / tt) - (4.210_f * log(tt)) + (0.000367_f * tt) + & - (tanh(0.0415_f * (tt - 218.8_f)) * & - (53.878_f - (1331.22_f / tt) - (9.44523_f * log(tt)) + 0.014025_f * tt))) - - pvap_ice = 10.0_f * exp(9.550426_f - (5723.265_f / tt) + (3.53068_f * log(tt)) - (0.00728332_f * tt)) - - ! Check to see whether temperature is ouside range of validity for the parameterization. - ! - ! pvapl is defined for 123 < T < 332 K - ! pvapi is defined for T > 110 K - ! - ! NOTE: Don't stop the simulation if the limits are exceeded. -! if ((t(iz) .le. 123.0_f) .or. (t(iz) .ge. 332.0_f)) then -! if (do_print) write(LUNOPRT,*) 'vaporp_h2o_murphy2005::WARNING - Temperature', t(iz), & -! ' out of range at iz = ', iz, "lat=", lat, "lon=", lon -! rc = RC_WARNING -! endif - - ! Return to caller with vapor pressures evaluated. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2so4_ayers1980.F90 b/CARMAchem_GridComp/CARMA/source/base/vaporp_h2so4_ayers1980.F90 deleted file mode 100644 index 2335892a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vaporp_h2so4_ayers1980.F90 +++ /dev/null @@ -1,91 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! Calculates the vapor pressure for sulfuric acid. -!! -!! and are vapor pressures in units of [dyne/cm^2] -!! -!! Created Dec-1995 (Ackerman) -!! Modified Sep-1997 (McKie) -!! Modified Jul-2001 (Mills) -!! -!! NOTE: To calculate vapor pressure of H2SO4 water vapor pressure (pvapl(iz, igash2o)) -!! should be calculated before this calculation. -!! -!! @author Mike Mills, Tianyi Fan -!! @version Feb-2011 -subroutine vaporp_H2SO4_Ayers1980(carma, cstate, iz, rc, pvap_liq, pvap_ice) -! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! z index - real(kind=f), intent(out) :: pvap_liq !! vapor pressure wrt liquid [dyne/cm2] - real(kind=f), intent(out) :: pvap_ice !! vapor pressure wrt ice [dyne[cm2] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - real(kind=f) :: gc_cgs ! water vapor mass concentration [g/cm3] - real(kind=f) :: fk1, fk4, fk4_1, fk4_2 - real(kind=f) :: factor_kulm ! Kulmala correction terms - real(kind=f) :: en, temp - real(kind=f) :: sulfeq - real(kind=f), parameter :: t0_kulm = 340._f ! T0 set in the low end of the Ayers measurement range (338-445K) - real(kind=f), parameter :: t_crit_kulm = 905._f ! Critical temperature = 1.5 * Boiling point - real(kind=f), parameter :: fk0 = -10156._f / t0_kulm + 16.259_f ! Log(Kulmala correction factor) - real(kind=f), parameter :: fk2 = 1._f / t0_kulm - real(kind=f), parameter :: fk3 = 0.38_f / (t_crit_kulm - t0_kulm) - - - ! Saturation vapor pressure of sulfuric acid - ! - ! Don't allow saturation vapor pressure to underflow at very low temperatures - temp=max(t(iz),140._f) - - ! Convert water vapor concentration to g/cm3: - gc_cgs = gc(iz, igash2o) / (xmet(iz) * ymet(iz) * zmet(iz)) - - ! Compute the sulfate composition based on Hanson parameterization - ! to temperature and water vapor concentration. - wtpct(iz) = wtpct_tabaz(carma, temp, gc_cgs, pvapl(iz, igash2o), rc) - - ! Parameterized fit to Giauque's (1959) enthalpies v. wt %: - en = 4.184_f * (23624.8_f - 1.14208e8_f / ((wtpct(iz) - 105.318_f)**2 + 4798.69_f)) - en = max(en, 0.0_f) - - ! Ayers' (1980) fit to sulfuric acid equilibrium vapor pressure: - ! (Remember this is the log) - ! SULFEQ=-10156/Temp+16.259-En/(8.3143*Temp) - ! - ! Kulmala correction (J. CHEM. PHYS. V.93, No.1, 1 July 1990) - fk1 = -1._f / temp - fk4_1 = log(t0_kulm / temp) - fk4_2 = t0_kulm / temp - fk4 = 1.0_f + fk4_1 - fk4_2 - factor_kulm = fk1 + fk2 + fk3 * fk4 - - ! This is for pure H2SO4 - sulfeq = fk0 + 10156._f * factor_kulm - - ! Adjust for WTPCT composition: - sulfeq = sulfeq - en / (8.3143_f * temp) - - ! REMEMBER TO TAKE THE EXPONENTIAL! - sulfeq = exp(sulfeq) - - ! BUT this is in Atmospheres. Convert ==> dynes/cm2 - pvap_liq = sulfeq * 1.01325e6_f - pvap_ice = sulfeq * 1.01325e6_f - - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/versol.F90 b/CARMAchem_GridComp/CARMA/source/base/versol.F90 deleted file mode 100644 index 4c54b0fa..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/versol.F90 +++ /dev/null @@ -1,143 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine solves the vertical transport equation. -!! is temporary storage for concentrations (particles, -!! gas, potential temperature) being transported. -!! New values of are calculated. -!! -!! @author Eric Jensen -!! @version Dec-1996 -subroutine versol(carma, cstate, cvert, itbnd, ibbnd, ftop, fbot, cvert_tbnd, cvert_bbnd, & - vertadvu, vertadvd, vertdifu, vertdifd, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - real(kind=f), intent(inout) :: cvert(NZ) !! quantity being transported - integer, intent(in) :: itbnd !! top boundary condition - integer, intent(in) :: ibbnd !! bottom boundary condition - real(kind=f), intent(in) :: ftop !! flux at top boundary - real(kind=f), intent(in) :: fbot !! flux at bottom boundary - real(kind=f), intent(in) :: cvert_tbnd !! quantity at top boundary - real(kind=f), intent(in) :: cvert_bbnd !! quantity at bottom boundary - real(kind=f), intent(in) :: vertadvu(NZP1) !! upward vertical transport rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertadvd(NZP1) !! downward vertical transport rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertdifu(NZP1) !! upward vertical diffusion rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertdifd(NZP1) !! downward vertical diffusion rate into level k from level k-1 [cm/s] - integer, intent(inout) :: rc !! return code, negative indicates failure - -! Declare local variables -! - integer :: k - real(kind=f) :: al(NZ) - real(kind=f) :: bl(NZ) - real(kind=f) :: dl(NZ) - real(kind=f) :: el(NZ) - real(kind=f) :: fl(NZ) - real(kind=f) :: ul(NZ) - real(kind=f) :: ctempl(NZ) - real(kind=f) :: ctempu(NZ) - real(kind=f) :: divcor(NZ) - real(kind=f) :: uc - real(kind=f) :: cour - real(kind=f) :: denom - - ! Divergence adjustments are not being generated. - divcor(:) = 0._f - - ! Determine whether transport should be solved explicitly (uc=0) - ! or implicitly (uc=1). - uc = 0._f - do k = 1,NZ - cour = dz(k)/dtime - & - ( vertdifu(k+1) + vertdifd(k) + vertadvu(k+1) + vertadvd(k) ) - - if( cour .lt. 0._f .and. uc .ne. 1._f )then - uc = 1.0_f - - ! NOTE: This can happen a lot and clutters up the log. Should we print it out or not? -! write(LUNOPRT,'(a,i3,7(1x,1pe8.1))') & -! 'in versol: k dz/dt vdifd vdifu vadvd vadvu cour uc = ', & -! k, dz(k)/dtime, vertdifd(k), vertdifu(k+1), & -! vertadvd(k), vertadvu(k+1), cour, uc - endif - enddo - - ! Store concentrations in local variables (shifted up and down - ! a vertical level). - do k = 2,NZ - ctempl(k) = cvert(k-1) - ctempu(k-1) = cvert(k) - enddo - - if( ibbnd .eq. I_FIXED_CONC ) then - ctempl(1) = cvert_bbnd - else - ctempl(1) = 0._f - endif - - if( itbnd .eq. I_FIXED_CONC ) then - ctempu(NZ) = cvert_tbnd - else - ctempu(NZ) = 0._f - endif - - ! Calculate coefficients of the transport equation: - ! al(k)c(k+1) + bl(k)c(k) + ul(k)c(k-1) = dl(k) - - do k = 1,NZ - al(k) = uc * ( vertdifd(k+1) + vertadvd(k+1) ) - bl(k) = -( uc*(vertdifd(k)+vertdifu(k+1)+ & - vertadvd(k)+vertadvu(k+1)) & - + dz(k)/dtime ) - ul(k) = uc * ( vertdifu(k) + vertadvu(k) ) - dl(k) = cvert(k) * & - ( (1._f - uc)*(vertdifd(k)+vertdifu(k+1)+ & - vertadvd(k)+vertadvu(k+1)) & - - dz(k)/dtime ) - & - (1._f - uc) * ( (vertdifu(k)+vertadvu(k))*ctempl(k) + & - (vertdifd(k+1)+vertadvd(k+1))*ctempu(k) ) - & - divcor(k) * dz(k) - enddo - - ! Boundary fluxes: is the downward flux across the - ! upper boundary; is the upward flux across the - ! lower boundary. - if(( igridv .eq. I_SIG ) .or. ( igridv .eq. I_HYBRID )) then - if( itbnd .eq. I_FLUX_SPEC ) dl(1) = dl(1) - ftop - if( ibbnd .eq. I_FLUX_SPEC ) dl(NZ) = dl(NZ) - fbot - else - if( itbnd .eq. I_FLUX_SPEC ) dl(NZ) = dl(NZ) - ftop - if( ibbnd .eq. I_FLUX_SPEC ) dl(1) = dl(1) - fbot - endif - - ! Calculate recursion relations. - el(1) = dl(1)/bl(1) - fl(1) = al(1)/bl(1) - do k = 2,NZ - denom = bl(k) - ul(k) * fl(k-1) - el(k) = ( dl(k) - ul(k)*el(k-1) ) / denom - fl(k) = al(k) / denom - enddo - - ! Calculate new concentrations. - - cvert(NZ) = el(NZ) - do k = NZ-1,1,-1 - cvert(k) = el(k) - fl(k)*cvert(k+1) - enddo - - ! Return to caller with new concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/versub.F90 b/CARMAchem_GridComp/CARMA/source/base/versub.F90 deleted file mode 100644 index 92fd963a..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/versub.F90 +++ /dev/null @@ -1,127 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine solves for sedimentation using an explicit substepping approach. It -!! is faster and handles large cfl and irregular grids better than the normal PPM -!! solver (versol), but it is more diffusive. -!! -!! @author Andy Ackerman, Chuck Bardeen -!! version Aug 2010 -subroutine versub(carma, cstate, pcmax, cvert, itbnd, ibbnd, ftop, fbot, cvert_tbnd, cvert_bbnd, & - vertadvu, vertadvd, vertdifu, vertdifd, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - real(kind=f), intent(in) :: pcmax(NZ) !! maximum particle concentration (#/x/y/z) - real(kind=f), intent(inout) :: cvert(NZ) !! quantity being transported (#/x/y/z) - integer, intent(in) :: itbnd !! top boundary condition - integer, intent(in) :: ibbnd !! bottom boundary condition - real(kind=f), intent(in) :: ftop !! flux at top boundary - real(kind=f), intent(in) :: fbot !! flux at bottom boundary - real(kind=f), intent(in) :: cvert_tbnd !! quantity at top boundary - real(kind=f), intent(in) :: cvert_bbnd !! quantity at bottom boundary - real(kind=f), intent(in) :: vertadvu(NZP1) !! upward vertical transport rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertadvd(NZP1) !! downward vertical transport rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertdifu(NZP1) !! upward vertical diffusion rate into level k from level k-1 [cm/s] - real(kind=f), intent(in) :: vertdifd(NZP1) !! downward vertical diffusion rate into level k from level k-1 [cm/s] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Declare local variables - integer :: iz - integer :: istep - integer :: nstep_sed - real(kind=f) :: fvert(NZ) - real(kind=f) :: up(NZP1) - real(kind=f) :: dn(NZP1) - real(kind=f) :: cfl_max - real(kind=f) :: fvert_1 - real(kind=f) :: fvert_nz - - ! Determine the total upward and downward velocities. - up(:) = vertadvu(:) + vertdifu(:) - dn(:) = vertadvd(:) + vertdifd(:) - - ! Compute the maximum CFL for each bin that has a significant concentration - ! of particles. - cfl_max = 0._f - - do iz = 1, NZ - if (pcmax(iz) > SMALL_PC) then - cfl_max = max(cfl_max, max(abs(up(iz)), abs(up(iz+1)), abs(dn(iz)), abs(dn(iz+1))) * dtime / dz(iz)) - end if - end do - - ! Use the maximum CFL determined above to figure out how much substepping is - ! needed to sediment explicitly without violating the CFL anywhere in the column. - if (cfl_max >= 0._f) then - nstep_sed = int(1._f + cfl_max) - else - nstep_sed = 0 - endif - - ! If velocities are in both directions, then more steps are needed to make sure - ! that no more than half of the concentration can be transported in either direction. - if (maxval(up(:) * dn(:)) > 0._f) then - nstep_sed = nstep_sed * 2 - end if - - ! Determine the top and bottom boundary fluxes, keeping in mind that - ! the velocities and grid coordinates are reversed in sigma or hybrid - ! coordinates - if ((igridv .eq. I_SIG) .or. (igridv .eq. I_HYBRID)) then - if (itbnd .eq. I_FLUX_SPEC) then - fvert_nz = -fbot - else - fvert_nz = cvert_bbnd*dn(NZ+1) - end if - - if (ibbnd .eq. I_FLUX_SPEC) then - fvert_1 = -ftop - else - fvert_1 = cvert_tbnd*up(1) - end if - - else - if (itbnd .eq. I_FLUX_SPEC) then - fvert_nz = ftop - else - fvert_nz = cvert_tbnd*dn(NZ+1) - end if - - if (ibbnd .eq. I_FLUX_SPEC) then - fvert_1 = fbot - else - fvert_1 = cvert_bbnd*up(1) - end if - endif - - ! Sediment the particles using multiple iterations to satisfy the CFL. - do istep = 1, nstep_sed - - ! Determine the net particle flux at each gridbox. The first and last levels - ! need special treatment to handle to bottom and top boundary conditions. - fvert(1) = (-cvert(1)*dn(1) + fvert_1 + cvert(2)*dn(2) - cvert(1)*up(2)) - - do iz = 2, NZ-1 - fvert(iz) = (-cvert(iz)*dn(iz) + cvert(iz-1)*up(iz) + cvert(iz+1)*dn(iz+1) - cvert(iz)*up(iz+1)) - end do - - fvert(NZ) = (-cvert(NZ)*dn(NZ) + cvert(NZ-1)*up(NZ) + fvert_nz - cvert(NZ)*up(NZ+1)) - - ! Now update the actual concentrations. - cvert(:) = cvert(:) + fvert(:) * dtime / nstep_sed / dz(:) - enddo - - return -end subroutine versub diff --git a/CARMAchem_GridComp/CARMA/source/base/vertadv.F90 b/CARMAchem_GridComp/CARMA/source/base/vertadv.F90 deleted file mode 100644 index 1647f988..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vertadv.F90 +++ /dev/null @@ -1,256 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates vertrical advection rates using -!! Piecewise Polynomial Method [Colela and Woodard, J. Comp. Phys., -!! 54, 174-201, 1984] -!! -!! @author Eric Jensen -!! @version Dec-1996 -subroutine vertadv(carma, cstate, vtrans, cvert, itbnd, ibbnd, cvert_tbnd, cvert_bbnd, vertadvu, vertadvd, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - real(kind=f), intent(inout) :: vtrans(NZP1) !! vertical velocity - real(kind=f), intent(in) :: cvert(NZ) !! quantity being transported - integer, intent(in) :: itbnd !! top boundary condition - integer, intent(in) :: ibbnd !! bottom boundary condition - real(kind=f), intent(in) :: cvert_tbnd !! quantity at top boundary - real(kind=f), intent(in) :: cvert_bbnd !! quantity at bottom boundary - real(kind=f), intent(out) :: vertadvu(NZP1) !! upward vertical transport rate into level k from level k-1 [cm/s] - real(kind=f), intent(out) :: vertadvd(NZP1) !! downward vertical transport rate into level k from level k-1 [cm/s] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local declarations - integer :: k - integer :: nzm1 - integer :: nzm2 - integer :: itwo - real(kind=f) :: dela(NZ) - real(kind=f) :: delma(NZ) - real(kind=f) :: aju(NZ) - real(kind=f) :: ar(NZ) - real(kind=f) :: al(NZ) - real(kind=f) :: a6(NZ) - real(kind=f) :: dpc, dpc1, dpcm1 - real(kind=f) :: ratt1, ratt2, ratt3, rat1, rat2, rat3, rat4, den1 - real(kind=f) :: com2, x, xpos - real(kind=f) :: cvert0, cvertnzp1 - - - ! Initialize fluxes to zero - vertadvu(:) = 0._f - vertadvd(:) = 0._f - - ! If doing explicit sedimentation then do a simple sorting of positive and negative - ! velocities into up and down components. - if (do_explised) then - where (vtrans < 0._f) - vertadvd = -vtrans - elsewhere - vertadvu = vtrans - end where - else - - - if( ibbnd .eq. I_FLUX_SPEC ) vtrans(1) = 0._f - if( itbnd .eq. I_FLUX_SPEC ) vtrans(NZP1) = 0._f - - ! Set some constants - nzm1 = max( 1, NZ-1 ) - nzm2 = max( 1, NZ-2 ) - itwo = min( 2, NZ ) - - ! First, use cubic fits to estimate concentration values at layer - ! boundaries - do k = 2,NZ-1 - dpc = cvert(k) / dz(k) - dpc1 = cvert(k+1) / dz(k+1) - dpcm1 = cvert(k-1) / dz(k-1) - ratt1 = dz(k) / ( dz(k-1) + dz(k) + dz(k+1) ) - ratt2 = ( 2._f*dz(k-1) + dz(k) ) / ( dz(k+1) + dz(k) ) - ratt3 = ( 2._f*dz(k+1) + dz(k) ) / ( dz(k-1) + dz(k) ) - dela(k) = ratt1 * ( ratt2*(dpc1-dpc) + ratt3*(dpc-dpcm1) ) - - if( (dpc1-dpc)*(dpc-dpcm1) .gt. 0._f .and. dela(k) .ne. 0._f ) then - delma(k) = min(abs(dela(k)), 2._f*abs(dpc-dpc1), 2._f*abs(dpc-dpcm1)) * abs(dela(k))/dela(k) - else - delma(k) = 0._f - endif - enddo ! k = 2,NZ-2 - - do k = 2,NZ-2 - dpc = cvert(k) / dz(k) - dpc1 = cvert(k+1) / dz(k+1) - dpcm1 = cvert(k-1) / dz(k-1) - rat1 = dz(k) / ( dz(k) + dz(k+1) ) - rat2 = 2._f * dz(k+1) * dz(k) / ( dz(k) + dz(k+1) ) - rat3 = ( dz(k-1) + dz(k) ) / ( 2._f*dz(k) + dz(k+1) ) - rat4 = ( dz(k+2) + dz(k+1) ) / ( 2._f*dz(k+1) + dz(k) ) - den1 = dz(k-1) + dz(k) + dz(k+1) + dz(k+2) - - ! is the estimate for concentration (dn/dz) at layer - ! boundary +1/2. - aju(k) = dpc + rat1*(dpc1-dpc) + 1._f/den1 * ( rat2*(rat3-rat4)*(dpc1-dpc) - & - dz(k)*rat3*delma(k+1) + dz(k+1)*rat4*delma(k) ) - - enddo ! k = 2,NZ-2 - - ! Now construct polynomial functions in each layer - do k = 3,NZ-2 - al(k) = aju(k-1) - ar(k) = aju(k) - enddo - - ! Use linear functions in first two and last two layers - ar(itwo) = aju(itwo) - al(itwo) = cvert(1)/dz(1) + (zl(itwo)-zc(1)) / & - (zc(itwo)-zc(1)) * (cvert(itwo)/dz(itwo)-cvert(1)/dz(1)) - ar(1) = al(itwo) - al(1) = cvert(1)/dz(1) - (zc(1)-zl(1)) / & - (zc(itwo)-zc(1)) * (cvert(itwo)/dz(itwo)-cvert(1)/dz(1)) - - al(nzm1) = aju(nzm2) - ar(nzm1) = cvert(nzm1)/dz(nzm1) + (zl(NZ)-zc(nzm1)) & - / (zc(NZ)-zc(nzm1)) * (cvert(NZ)/dz(NZ)-cvert(nzm1)/dz(nzm1)) - al(NZ) = ar(nzm1) - ar(NZ) = cvert(nzm1)/dz(nzm1) + (zl(NZ+1)-zc(nzm1)) & - / (zc(NZ)-zc(nzm1)) * (cvert(NZ)/dz(NZ)-cvert(nzm1)/dz(nzm1)) - - ! Ensure that boundary values are not negative - al(1) = max( al(1), 0._f ) - ar(NZ) = max( ar(NZ), 0._f ) - - ! Next, ensure that polynomial functions do not deviate beyond the - ! range [,] - do k = 1,NZ - dpc = cvert(k) / dz(k) - if( (ar(k)-dpc)*(dpc-al(k)) .le. 0._f ) then - al(k) = dpc - ar(k) = dpc - endif - - if( (ar(k)-al(k))*( dpc - 0.5_f*(al(k)+ar(k)) ) .gt. 1._f/6._f*(ar(k)-al(k))**2 ) & - al(k) = 3._f*dpc - 2._f*ar(k) - - if( (ar(k)-al(k))*( dpc - 0.5_f*(al(k)+ar(k)) ) .lt. -1._f/6._f*(ar(k)-al(k))**2 ) & - ar(k) = 3._f*dpc - 2._f*al(k) - enddo - - ! Calculate fluxes across each layer boundary - do k = 1,NZ - dpc = cvert(k) / dz(k) - dela(k) = ar(k) - al(k) - a6(k) = 6._f * ( dpc - 0.5_f*(ar(k)+al(k)) ) - enddo - - do k = 1,NZ-1 - com2 = ( dz(k) + dz(k+1) ) / 2._f - x = vtrans(k+1)*dtime/dz(k) - xpos = abs(x) - - ! Upward transport rate - if( vtrans(k+1) .gt. 0._f )then - - if( x .lt. 1._f .and. cvert(k) .ne. 0._f )then - vertadvu(k+1) = ( vtrans(k+1) * com2 ) * ( ( ar(k) - 0.5_f*dela(k)*x + & - (x/2._f - (x**2)/3._f)*a6(k) ) / cvert(k) ) - - ! If Courant # > 1, use upwind advection - else - vertadvu(k+1) = vtrans(k+1) - endif - - ! Downward transport rate - elseif( vtrans(k+1) .lt. 0._f )then - - if( x .gt. -1._f .and. cvert(k+1) .ne. 0._f )then - vertadvd(k+1) = ( -vtrans(k+1) * com2 ) * & - ( ( al(k+1) + 0.5_f*dela(k+1)*xpos + & - ( xpos/2._f - (xpos**2)/3._f)*a6(k+1) ) / cvert(k+1) ) - else - vertadvd(k+1) = -vtrans(k+1) - endif - endif - - enddo ! k = 1,NZ-1 - - ! Lower boundary transport rates: If I_FIXED_CONC boundary - ! condtion is selected, then use concentration assumed just beyond - ! the lowest layer edge to calculate the transport rate across - ! the bottom boundary of the model. - if( ibbnd .eq. I_FIXED_CONC ) then - - com2 = ( dz(1) + dz(itwo) ) / 2._f - x = vtrans(1)*dtime/dz(1) - xpos = abs(x) - cvert0 = cvert_bbnd - if( vtrans(1) .gt. 0._f )then - - if( x .lt. 1._f .and. cvert0 .ne. 0._f )then - vertadvu(1) = vtrans(1)/cvert0*com2 & - * ( ar(1) - 0.5_f*dela(1)*x + & - (x/2._f - (x**2)/3._f)*a6(1) ) - else - vertadvu(1) = vtrans(1) - endif - - elseif( vtrans(1) .lt. 0._f )then - - if( x .gt. -1._f .and. cvert(1) .ne. 0._f )then - vertadvd(1) = -vtrans(1)/ & - cvert(1)*com2 & - * ( al(1) + 0.5_f*dela(1)*xpos + & - (xpos/2._f - (xpos**2)/3._f)*a6(1) ) - else - vertadvd(1) = -vtrans(1) - endif - endif - endif - - ! Upper boundary transport rates - if( itbnd .eq. I_FIXED_CONC ) then - - com2 = ( dz(NZ) + dz(nzm1) ) / 2._f - x = vtrans(NZ+1)*dtime/dz(NZ) - xpos = abs(x) - cvertnzp1 = cvert_tbnd - - if( vtrans(NZ+1) .gt. 0._f )then - - if( x .lt. 1._f .and. cvert(NZ) .ne. 0._f )then - vertadvu(NZ+1) = vtrans(NZ+1)/cvert(NZ)*com2 & - * ( ar(NZ) - 0.5_f*dela(NZ)*x + & - (x/2._f - (x**2)/3._f)*a6(NZ) ) - else - vertadvu(NZ+1) = vtrans(NZ+1) - endif - - elseif( vtrans(NZ+1) .lt. 0._f )then - - if( x .gt. -1._f .and. cvertnzp1 .ne. 0._f )then - vertadvd(NZ+1) = -vtrans(NZ+1)/ & - cvertnzp1*com2 & - * ( al(NZ) + 0.5_f*dela(NZ)*xpos + & - (xpos/2._f - (xpos**2)/3._f)*a6(NZ) ) - else - vertadvd(NZ+1) = -vtrans(NZ+1) - endif - endif - endif - endif - - ! Return to caller with vertical transport rates. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vertdif.F90 b/CARMAchem_GridComp/CARMA/source/base/vertdif.F90 deleted file mode 100644 index 25078ca4..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vertdif.F90 +++ /dev/null @@ -1,125 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine calculates vertrical transport rates. -!! Currently treats diffusion only. -!! Not necessarily generalized for irregular grid. -!! -!! @author Eric Jensen -!! @version Dec-1996 -subroutine vertdif(carma, cstate, igroup, ibin, itbnd, ibbnd, vertdifu, vertdifd, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: igroup !! particle group index - integer, intent(in) :: ibin !! particle bin index - integer, intent(in) :: itbnd !! top boundary condition - integer, intent(in) :: ibbnd !! bottom boundary condition - real(kind=f), intent(out) :: vertdifu(NZP1) !! upward vertical diffusion rate into level k from level k-1 [cm/s] - real(kind=f), intent(out) :: vertdifd(NZP1) !! downward vertical diffusion rate into level k from level k-1 [cm/s] - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: k - integer :: nzm1 - integer :: itwo - real(kind=f) :: dz_avg - real(kind=f) :: rhofact - real(kind=f) :: xex - real(kind=f) :: ttheta - - - ! Set some constants - nzm1 = max( 1, NZ-1 ) - itwo = min( 2, NZ ) - - ! Loop over vertical levels. - do k = 2, NZ - - dz_avg = dz(k) ! layer thickness - - ! Check the vertical coordinate - - if( igridv .eq. I_CART ) then - rhofact = log( rhoa(k)/rhoa(k-1) & - * zmet(k-1)/zmet(k) ) - xex = rhoa(k-1)/rhoa(k) * & - zmet(k)/zmet(k-1) - vertdifu(k) = ( rhofact * dkz(k, ibin, igroup) / dz_avg ) / ( 1._f - xex ) - - vertdifd(k) = vertdifu(k) * xex - - - ! ...else you're in sigma or hybrid coordinates... - elseif(( igridv .eq. I_SIG ) .or. ( igridv .eq. I_HYBRID )) then - vertdifu(k) = dkz(k, ibin, igroup) / dz_avg - vertdifd(k) = dkz(k, ibin, igroup) / dz_avg - - ! ...else write an error (maybe redundant)... - else - if (do_print) write(LUNOPRT,*) 'vertdif::ERROR - Invalid vertical grid type (', igridv, ').' - rc = -1 - return - endif - enddo - - ! Fluxes at boundaries specified by user - if( ibbnd .eq. I_FLUX_SPEC ) then - vertdifu(1) = 0._f - vertdifd(1) = 0._f - endif - - if( itbnd .eq. I_FLUX_SPEC ) then - vertdifu(NZ+1) = 0._f - vertdifd(NZ+1) = 0._f - endif - - ! Diffusion across boundaries using fixed boundary concentration: - if( ibbnd .eq. I_FIXED_CONC ) then - dz_avg = dz(1) ! layer thickness - rhofact = log( rhoa(itwo)/rhoa(1) ) - ttheta = rhofact - if( ttheta .ge. 0._f ) then - ttheta = min(ttheta,POWMAX) - else - ttheta = max(ttheta,-POWMAX) - endif - - xex = exp(-ttheta) - if( abs(ONE - xex) .lt. ALMOST_ZERO ) xex = ALMOST_ONE - - vertdifu(1) = ( rhofact * dkz(1, ibin, igroup) / dz_avg ) / ( 1._f - xex ) - vertdifd(1) = vertdifu(1) * xex - endif - - if( itbnd .eq. I_FIXED_CONC ) then - dz_avg = dz(NZ) ! layer thickness - rhofact = log( rhoa(NZ)/rhoa(nzm1) ) - ttheta = rhofact - if( ttheta .ge. 0._f ) then - ttheta = min(ttheta,POWMAX) - else - ttheta = max(ttheta,-POWMAX) - endif - - xex = exp(-ttheta) - if( abs(ONE - xex) .lt. ALMOST_ZERO ) xex = ALMOST_ONE - - vertdifu(NZ+1) = ( rhofact * dkz(NZ+1, ibin, igroup) / dz_avg ) / ( 1._f - xex ) - vertdifd(NZ+1) = vertdifu(NZ+1) * xex - endif - - ! Return to caller with vertical diffusion rates. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/vertical.F90 b/CARMAchem_GridComp/CARMA/source/base/vertical.F90 deleted file mode 100644 index 2a217388..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/vertical.F90 +++ /dev/null @@ -1,110 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine drives the vertical transport calculations. -!! -!! NOTE: Since this is only for sedimentation and brownian diffusion of a column within -!! a parent model, the advection of air density, gases and potential temperature have -!! been removed. Also, the divergence corrections (divcor) for 1D transport are not -!! applied, since these columns exist within a parent model that is responsible for the -!! advection. -!! -!! @author Eric Jensen -!! version Mar-1995 -subroutine vertical(carma, cstate, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Declare local variables - integer :: ielem - integer :: ibin - integer :: ig - real(kind=f) :: vertadvu(NZP1) - real(kind=f) :: vertadvd(NZP1) - real(kind=f) :: vertdifu(NZP1) - real(kind=f) :: vertdifd(NZP1) - real(kind=f) :: vtrans(NZP1) - real(kind=f) :: old_pc(NZ) - - rc = RC_OK - - do ielem = 1,NELEM ! Loop over particle elements - ig = igelem(ielem) ! particle group - - ! Should this group participate in sedimentation? - if (grp_do_vtran(ig)) then - - ! Are there enough particles in the column to bother? - if (maxval(pconmax(:,ig)) .gt. FEW_PC) then - - do ibin = 1,NBIN ! Loop over particle mass bins - vtrans(:) = -vf(:,ibin,ig) - - ! If dry deposition is enabled for this group, then set - ! the deposition velocity at the surface. - if (grp_do_drydep(ig)) then - if (igridv .eq. I_CART) then - vtrans(1) = -vd(ibin, ig) - else - vtrans(NZP1) = -vd(ibin, ig) - end if - end if - - ! Calculate particle transport rates due to vertical advection - ! and vertical diffusion, and solve for concentrations at end of time step. - call vertadv(carma, cstate, vtrans, pc(:,ibin,ielem), itbnd_pc, ibbnd_pc, & - pc_topbnd(ibin,ielem), pc_botbnd(ibin,ielem), vertadvu, vertadvd, rc) - if (rc < RC_OK) return - - call vertdif(carma, cstate, ig, ibin, itbnd_pc, ibbnd_pc, vertdifu, vertdifd, rc) - if (rc < RC_OK) return - - old_pc(:) = pc(:,ibin,ielem) - - ! There are 2 different solvers, versol with uses a PPM scheme and versub - ! which using an explicit substepping approach. - if (do_explised) then - call versub(carma, cstate, pconmax(:,ig)*xmet(:)*ymet(:)*zmet(:), pc(:,ibin,ielem), itbnd_pc, ibbnd_pc, & - ftoppart(ibin,ielem), fbotpart(ibin,ielem), & - pc_topbnd(ibin,ielem), pc_botbnd(ibin,ielem), & - vertadvu, vertadvd, vertdifu, vertdifd, rc) - if (rc < RC_OK) return - else - call versol(carma, cstate, pc(:,ibin,ielem), itbnd_pc, ibbnd_pc, & - ftoppart(ibin,ielem), fbotpart(ibin,ielem), & - pc_topbnd(ibin,ielem), pc_botbnd(ibin,ielem), & - vertadvu, vertadvd, vertdifu, vertdifd, rc) - if (rc < RC_OK) return - end if - - ! A clunky way to get the mass flux to the surface and to conserve mass - ! is to determine the total before and after. Anything lost went to the - ! surface. - ! - ! NOTE: This only works if you assume nothing is lost out the top. It would be - ! better to figure out how to get this directly from versol. - pc_surf(ibin,ielem) = pc_surf(ibin, ielem) + sum(old_pc(:) * dz(:) / xmet(:) / ymet(:)) - & - sum(pc(:,ibin,ielem) * dz(:) / xmet(:) / ymet(:)) - sedimentationflux(ibin,ielem) = ( sum(old_pc(:) * dz(:) / xmet(:) / ymet(:)) - & - sum(pc(:,ibin,ielem) * dz(:) / xmet(:) / ymet(:)) ) / dtime - enddo ! ibin - endif - endif - enddo ! ielem - - ! Return to caller with new particle concentrations. - return -end diff --git a/CARMAchem_GridComp/CARMA/source/base/wetr.F90 b/CARMAchem_GridComp/CARMA/source/base/wetr.F90 deleted file mode 100644 index 3d2f7ac8..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/wetr.F90 +++ /dev/null @@ -1,311 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -module wetr - -contains - - !! This routine calculates the wet radius for hydrophilic particles that are - !! assumed to grow in size based upon the realtive humidity. - !! - !! Parameterizations based upon Fitzgerald [1975] and Gerber [1985] are support and the - !! particles are assumed to be spherical. - !! - !! @author Chuck Bardeen, Pete Colarco - !! @version May-2009 from Nov-2000 - subroutine getwetr(carma, igroup, rh, rdry, rwet, rhopdry, rhopwet, rc, h2o_mass, h2o_vmr, hno3_vmr, h2o_vp, h2so4m, temp, press) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - use sulfate_utils - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(in) :: igroup !! group index - real(kind=f), intent(in) :: rh !! relative humidity - real(kind=f), intent(in) :: rdry !! dry radius [cm] - real(kind=f), intent(out) :: rwet !! wet radius [cm] - real(kind=f), intent(in) :: rhopdry !! dry radius [cm] - real(kind=f), intent(out) :: rhopwet !! wet radius [cm] - integer, intent(inout) :: rc !! return code, negative indicates failure - real(kind=f), intent(in), optional :: h2o_mass !! water vapor mass concentration (g/cm3) - real(kind=f), intent(in), optional :: h2o_vmr !! water vapor volume mixing ratio - real(kind=f), intent(in), optional :: hno3_vmr !! nitric acid volume mixing ratio - real(kind=f), intent(in), optional :: h2o_vp !! water eq. vaper pressure (dynes/cm2) - real(kind=f), intent(in), optional :: h2so4m !! total aerosol mass of h2so4 (g) - real(kind=f), intent(in), optional :: temp !! temperature [K] - real(kind=f), intent(in), optional :: press !! pressure [dyn cm-2] - - ! Local declarations - real(kind=f) :: humidity - real(kind=f) :: r_ratio - real(kind=f) :: wtpkelv, den1, den2, drho_dwt - real(kind=f) :: sigkelv, sig1, sig2, dsigma_dwt - real(kind=f) :: rkelvinH2O_a, rkelvinH2O_b, rkelvinH2O, h2o_kelv - real(kind=f) :: hno3_kelv - real(kind=f) :: wts, wtn - real(kind=f) :: wtpkelv_n - - ! The following parameters relate to the swelling of seasalt like particles - ! following Fitzgerald, Journal of Applied Meteorology, [1975]. - ! - ! Question - Should epsilon be 1._f? It means alpharat is 1 by definition. - real(kind=f), parameter :: epsilon_ = 1._f ! soluble fraction of deliquescing particle - real(kind=f) :: alphaComp - real(kind=f) :: alpha - real(kind=f) :: alpha1 - real(kind=f) :: alpharat - real(kind=f) :: beta - real(kind=f) :: theta - real(kind=f) :: f1 - real(kind=f) :: f2 - - ! Parameters from Gerber [1985] - real(kind=f) :: c1 - real(kind=f) :: c2 - real(kind=f) :: c3 - real(kind=f) :: c4 - - ! Define formats - 1 format(/,'Non-spherical particles specified for group ',i3, & - ' (ishape=',i3,') but spheres assumed in wetr.f.'/) - - ! If humidty affects the particle, then determine the equilbirium - ! radius and density based upon the relative humidity. - if (irhswell(igroup) == I_NO_SWELLING) then - - ! No swelling, just use the dry values. - rwet = rdry - rhopwet = rhopdry - else - - ! Warning message for non-spherical particles! - if( ishape(igroup) .ne. I_SPHERE )then - if (do_print) write(LUNOPRT,1) igroup, ishape(igroup) - rc = RC_ERROR - return - endif - - ! The Parameterizations don't handly relative humidities of 0, and - ! behave poorly when RH > 0.995, so cap the relative humidity - ! used to these values. - humidity = min(max(rh,tiny(1.0_f)), 0.995_f) - - ! Fitzgerald Parameterization - if (irhswell(igroup) == I_FITZGERALD) then - - ! Calculate the alpha and beta parameters for the wet particle - ! relative to amonium sulfate - beta = exp((0.00077_f * humidity) / (1.009_f - humidity)) - if (humidity .le. 0.97_f) then - theta = 1.058_f - else - theta = 1.058_f - (0.0155_f * (humidity - 0.97_f)) / (1.02_f - humidity**1.4_f) - endif - - alpha1 = 1.2_f * exp((0.066_f * humidity) / (theta - humidity)) - f1 = 10.2_f - 23.7_f * humidity + 14.5_f * humidity**2 - f2 = -6.7_f + 15.5_f * humidity - 9.2_f * humidity**2 - alpharat = 1._f - f1 * (1._f - epsilon_) - f2 * (1._f - epsilon_**2) - - ! Scale the size based on the composition of the particle. - select case(irhswcomp(igroup)) - - case (I_SWF_NH42SO4) - alphaComp = 1.00_f - - case(I_SWF_NH4NO3) - alphaComp = 1.06_f - - case(I_SWF_NANO3) - alphaComp = 1.17_f - - case(I_SWF_NH4CL) - alphaComp = 1.23_f - - case(I_SWF_CACL2) - alphaComp = 1.29_f - - case(I_SWF_NABR) - alphaComp = 1.32_f - - case(I_SWF_NACL) - alphaComp = 1.35_f - - case(I_SWF_MGCL2) - alphaComp = 1.41_f - - case(I_SWF_LICL) - alphaComp = 1.54_f - - case default - if (do_print) write(LUNOPRT,*) "wetr:: ERROR - Unknown composition type (", irhswcomp(igroup), & - ") for Fitzgerald." - rc = RC_ERROR - return - end select - - alpha = alphaComp * (alpha1 * alpharat) - - ! Determine the wet radius. - ! - ! NOTE: Fitgerald's equations assume r in [um], so scale the cgs units - ! appropriately. - rwet = (alpha * (rdry * 1e4_f)**beta) * (1e-4_f) - - ! Determine the wet density from the wet radius. - r_ratio = (rdry / rwet)**3 - rhopwet = r_ratio * rhopdry + (1._f - r_ratio) * RHO_W - end if - - - ! Gerber Paremeterization - if (irhswell(igroup) == I_GERBER) then - - ! Scale the size based on the composition of the particle. - select case(irhswcomp(igroup)) - - case (I_SWG_NH42SO4) - c1 = 0.4809_f - c2 = 3.082_f - c3 = 3.110e-11_f - c4 = -1.428_f - - case(I_SWG_URBAN) - c1 = 0.3926_f - c2 = 3.101_f - c3 = 4.190e-11_f - c4 = -1.404_f - - case(I_SWG_RURAL) - c1 = 0.2789_f - c2 = 3.115_f - c3 = 5.415e-11_f - c4 = -1.399_f - - case(I_SWG_SEA_SALT) - c1 = 0.7674_f - c2 = 3.079_f - c3 = 2.572e-11_f - c4 = -1.424_f - - case default - if (do_print) write(LUNOPRT,*) "wetr:: ERROR - Unknown composition type (", irhswcomp(igroup), & - ") for Gerber." - rc = RC_ERROR - return - end select - - rwet = ((c1 * rdry**c2 / (c3 * rdry**c4 - log10(humidity))) + rdry**3)**(1._f / 3._f) - - ! Determine the wet density from the wet radius. - r_ratio = (rdry / rwet)**3 - rhopwet = r_ratio * rhopdry + (1._f - r_ratio) * RHO_W - end if - end if - - - ! Sulfate Aerosol, using weight percent. - if (irhswell(igroup) == I_WTPCT_H2SO4 .OR. & - (irhswell(igroup) == I_WTPCT_STS .AND. temp > 200._f)) then - - ! Adjust calculation for the Kelvin effect of H2O: - wtpkelv = 80._f ! start with assumption of 80 wt % H2SO4 - den1 = 2.00151_f - 0.000974043_f * temp ! density at 79 wt % - den2 = 2.01703_f - 0.000988264_f * temp ! density at 80 wt % - drho_dwt = den2-den1 ! change in density for change in 1 wt % - - sig1 = 79.3556_f - 0.0267212_f * temp ! surface tension at 79.432 wt % - sig2 = 75.608_f - 0.0269204_f * temp ! surface tension at 85.9195 wt % - dsigma_dwt = (sig2-sig1) / (85.9195_f - 79.432_f) ! change in density for change in 1 wt % - sigkelv = sig1 + dsigma_dwt * (80.0_f - 79.432_f) - - rwet = rdry * (100._f * rhopdry / wtpkelv / den2)**(1._f / 3._f) - - rkelvinH2O_b = 1._f + wtpkelv * drho_dwt / den2 - 3._f * wtpkelv & - * dsigma_dwt / (2._f*sigkelv) - - rkelvinH2O_a = 2._f * gwtmol(igash2so4) * sigkelv / (den1 * RGAS * temp * rwet) - - rkelvinH2O = exp (rkelvinH2O_a*rkelvinH2O_b) - - h2o_kelv = h2o_mass / rkelvinH2O - wtpkelv = wtpct_tabaz(carma, temp, h2o_kelv, h2o_vp, rc) - rhopwet = sulfate_density(carma, wtpkelv, temp, rc) - rwet = rdry * (100._f * rhopdry / wtpkelv / rhopwet)**(1._f / 3._f) - ! STS equilibrium, using weight percent - else if (irhswell(igroup) == I_WTPCT_STS) then - ! Make sure that we aren't going to go ahead and divide by 0... - if (h2so4m == 0.0) then - rwet = rdry - else - !! Adjust calculation for the Kelvin effect of ternary solution - !! This calculation comes from Martin et al., 2000, GRL: - !! Begin: Interpolate along wt % H2SO4 - wtpkelv = 65._f ! start with assumption of 65 wt % H2SO4 - wtpkelv_n = 20._f ! start with assumption of 20 wt % HNO3 - den1 = sts_density(carma, (wtpkelv-1_f)*.01_f, wtpkelv_n*.01_f, temp, rc) ! density at 64 wt % - den2 = sts_density(carma, wtpkelv*.01_f, wtpkelv_n*.01_f, temp, rc) ! density at 65 wt % - drho_dwt = den2-den1 ! change in density for change in 1 wt % - - sig1 = 70.03_f - 0.06_f * (253._f - temp) ! surface tension at 50 wt % H2SO4 - sig2 = 65.88_f - 0.09_f * (253._f - temp) ! surface tension at 65 wt % H2SO4 - dsigma_dwt = (sig2-sig1) / (65._f - 50._f) - sigkelv = sig1 + dsigma_dwt * (wtpkelv - 50._f) - - rwet = rdry * (100._f * rhopdry / wtpkelv / den2)**(1._f / 3._f) - - rkelvinH2O_b = 1._f + wtpkelv * drho_dwt / den2 - 3._f * wtpkelv & - * dsigma_dwt / (2._f*sigkelv) - - rkelvinH2O_a = 2._f * gwtmol(igash2so4) * sigkelv / (den1 * RGAS * temp * rwet) - - rkelvinH2O = exp (rkelvinH2O_a*rkelvinH2O_b) - - h2o_kelv = h2o_vmr / rkelvinH2O - !! End: Interpolate along wt % H2SO4 - - - !! Begin: Interpolate along wt % HNO3 - !! Note: reusing the same variables for the HNO3 calculation - wtpkelv = 65._f ! start with assumption of 65 wt % H2SO4 - wtpkelv_n = 20._f ! start with assumption of 20 wt % HNO3 - den1 = sts_density(carma, wtpkelv*.01_f, (wtpkelv_n-1_f)*.01_f, temp, rc) !density at 19 wt % - den2 = sts_density(carma, wtpkelv*.01_f, wtpkelv_n*.01_f, temp, rc) !density at 20 wt % - drho_dwt = den2-den1 ! change in density for change in 1 wt % - - sig1 = 71.17_f - 0.11_f * (253._f - temp) ! surface tension at 10 wt % HNO3 - sig2 = 65.88_f - 0.09_f * (253._f - temp) ! surface tension at 20 wt % HNO3 - dsigma_dwt = (sig2-sig1) / (20._f - 10._f) - ! PAC: commented out b/c assumption of 20 wt % hno3 is valid at sig2 - !sigkelv = sig1 + dsigma_dwt * (wtpkelv_n - 10._f) - sigkelv = sig2 - - rwet = rdry * (100._f * rhopdry / wtpkelv / den2)**(1._f / 3._f) - - rkelvinH2O_b = 1._f + wtpkelv_n * drho_dwt / den2 - 3._f * wtpkelv_n & - * dsigma_dwt / (2._f*sigkelv) - - rkelvinH2O_a = 2._f * gwtmol(igash2so4) * sigkelv / (den1 * RGAS * temp * rwet) - - rkelvinH2O = exp (rkelvinH2O_a*rkelvinH2O_b) - hno3_kelv = hno3_vmr / rkelvinH2O - !! End: Interpolate along wt % HNO3 - - call wtpct_sts(temp, h2so4m, h2o_kelv, hno3_kelv, press/100., wts, wtn, rc) - rhopwet = sts_density(carma, wts*.01_f, wtn*.01_f, temp, rc) - rwet = rdry * (100._f * rhopdry / wts / rhopwet)**(1._f / 3._f) - end if - end if - - ! Return to caller with wet radius evaluated. - return - end subroutine -end module diff --git a/CARMAchem_GridComp/CARMA/source/base/zeromicro.F90 b/CARMAchem_GridComp/CARMA/source/base/zeromicro.F90 deleted file mode 100644 index 6e03a858..00000000 --- a/CARMAchem_GridComp/CARMA/source/base/zeromicro.F90 +++ /dev/null @@ -1,52 +0,0 @@ -! Include shortname defintions, so that the F77 code does not have to be modified to -! reference the CARMA structure. -#include "carma_globaer.h" - -!! This routine zeroes the fast microphysics sinks and sources, -!! at one spatial point per call. -!! -!! @author Andy Ackerman -!! @version Oct-1997 -subroutine zeromicro(carma, cstate, iz, rc) - - ! types - use carma_precision_mod - use carma_enums_mod - use carma_constants_mod - use carma_types_mod - use carmastate_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - type(carmastate_type), intent(inout) :: cstate !! the carma state object - integer, intent(in) :: iz !! vertical index - integer, intent(inout) :: rc !! return code, negative indicates failure - - - ! Set production terms and loss rates due to nucleation, growth, - ! and evaporation to zero. Also set index of smallest bin nuceleated - ! during time step equal to first time through spatial loop. - - if (do_grow) then - - phprod = 0._f - rlprod = 0._f - dtpart(iz,:,:) = 0._f - - if (NGAS > 0) gasprod(:) = 0._f - - rhompe(:, :) = 0._f - rnucpe(:,:) = 0._f - growpe(:,:) = 0._f - evappe(:,:) = 0._f - rnuclg(:,:,:) = 0._f - growlg(:,:) = 0._f - evaplg(:,:) = 0._f - - end if - - ! Return to caller with fast microphysics sinks and sources zeroed. - return -end diff --git a/CARMAchem_GridComp/CARMA/tests/Makefile b/CARMAchem_GridComp/CARMA/tests/Makefile deleted file mode 100644 index 869934e6..00000000 --- a/CARMAchem_GridComp/CARMA/tests/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# Sub makefile for test files - -# This is intended to be included by another makefile to actually -# build the system. It has all the dependency information for the -# files in the test tree. - -# NOTE: In the future (or in parnet models) this could be replaced -# by automatic dependency generation. - -TEST_OBJ = carma_bcoctest.o carma_bc2gtest.o carma_coagtest.o carma_drydeptest.o carma_falltest.o \ -carma_growtest.o carma_inittest.o carma_mietest.o carma_nuctest.o \ -carma_pheattest.o carma_sigmadrydeptest.o carma_sigmafalltest.o carma_swelltest.o \ -carma_vdiftest.o carma_test.o atmosphere_mod.o carma_scfalltest.o carma_growsubtest.o \ -carma_growintest.o - -TEST_DOC = carma_bcoctest.html carma_bc2gtest.html carma_coagtest.html carma_drydeptest.html \ -carma_falltest.html carma_growtest.html carma_inittest.html carma_mietest.html carma_nuctest.html \ -carma_pheattest.html carma_sigmadrydeptest.html carma_sigmafalltest.html carma_swelltest.html \ -carma_vdiftest.html carma_test.html atmosphere_mod.html carma_scfalltest.html carma_growsubtest.html \ -carma_growintest.html - -atmosphere_mod.o : atmosphere_mod.F90 - $(FORTRAN) $(FFLAGS) -c $< - -carma_testutils.o : carma_testutils.F90 - $(FORTRAN) $(FFLAGS) -c $< - -carma_bcoctest.o : carma_bcoctest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_bc2gtest.o : carma_bc2gtest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_coagtest.o : carma_coagtest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_drydeptest.o : carma_drydeptest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_falltest.o : carma_falltest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_growtest.o : carma_growtest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_growclrtest.o : carma_growclrtest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_growintest.o : carma_growintest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_growsubtest.o : carma_growsubtest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_inittest.o : carma_inittest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_mietest.o : carma_mietest.F90 carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_nuctest.o : carma_nuctest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_nuc2test.o : carma_nuc2test.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_pheattest.o : carma_pheattest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_scfalltest.o : carma_scfalltest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_sigmadrydeptest.o : carma_sigmadrydeptest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_sigmafalltest.o : carma_sigmafalltest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_swelltest.o : carma_swelltest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_sulfatetest.o : carma_sulfatetest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_test.o : carma_test.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - -carma_vdiftest.o : carma_vdiftest.F90 atmosphere_mod.mod carma_mod.mod carma_constants_mod.mod carma_precision_mod.mod - $(FORTRAN) $(FFLAGS) -c $< - diff --git a/CARMAchem_GridComp/CARMA/tests/atmosphere_mod.F90 b/CARMAchem_GridComp/CARMA/tests/atmosphere_mod.F90 deleted file mode 100644 index 60cea0bb..00000000 --- a/CARMAchem_GridComp/CARMA/tests/atmosphere_mod.F90 +++ /dev/null @@ -1,194 +0,0 @@ -!! Public domain code to calculate the US Standard Atmosphere pressure and temperature. -!! This underlying routine, Atmosphere was downloaded from the internet at: -!! -!! http://www.pdas.com/programs/atmos.f90 -!! -!! This module wraps the routine in an interface similar to the one used by the CARMA -!! module, which allows columns, vectors of columns, and arrays of columns via the -!! method GetStandardAtmosphere(). -module atmosphere_mod - ! types - use carma_precision_mod - - implicit none - - private - - ! NOTE: From US Standard Atmosphere 1976, the standard pressure and - ! temperature at sea-level are: - ! P0 = 1.013250e5 (Pa) - ! T0 = 288.15 (K) - real(kind=f), public, parameter :: P0 = 1.013250e5_f !! Standard sea-level pressure - real(kind=f), public, parameter :: T0 = 288.15_f !! Standard sea-level temperature - - interface GetStandardAtmosphere - module procedure GetStandardAtmosphere_1D - module procedure GetStandardAtmosphere_2D - module procedure GetStandardAtmosphere_3D - end interface - - public GetStandardAtmosphere - - contains - - subroutine GetStandardAtmosphere_1D(z, p, t) - real(kind=f), intent(in) :: z(:) !! Geometric Altitude (m) - real(kind=f), optional, intent(out) :: p(:) !! pressure (Pa) - real(kind=f), optional, intent(out) :: t(:) !! temperature (K) - - ! Local variables - real :: sigma - real :: delta - real :: theta - integer :: i - integer :: NZ - - NZ = size(z, 1) - - do i = 1, NZ - - ! Get the scaling of the pressure and temperature at the altitude. - call Atmosphere(real(z(i) / 1000._f), sigma, delta, theta) !! Convert from m -> km - - if (present(p)) p(i) = p0 * delta - if (present(t)) t(i) = T0 * theta - end do - - return - end subroutine - - subroutine GetStandardAtmosphere_2D(z, p, t) - real(kind=f), intent(in) :: z(:, :) !! Geometric Altitude (m) - real(kind=f), optional, intent(out) :: p(:, :) !! pressure (Pa) - real(kind=f), optional, intent(out) :: t(:, :) !! temperature (K) - - ! Local variables - real :: sigma - real :: delta - real :: theta - integer :: i, j - integer :: NY, NZ - - NY = size(z, 1) - NZ = size(z, 2) - - do i = 1, NY - do j = 1, NZ - - ! Get the scaling of the pressure and temperature at the altitude. - call Atmosphere(real(z(i, j) / 1000._f), sigma, delta, theta) !! Convert from m -> km - - if (present(p)) p(i, j) = p0 * delta - if (present(t)) t(i, j) = T0 * theta - end do - end do - - return - end subroutine - - subroutine GetStandardAtmosphere_3D(z, p, t) - real(kind=f), intent(in) :: z(:, :, :) !! Geometric Altitude (m) - real(kind=f), optional, intent(out) :: p(:, :, :) !! pressure (Pa) - real(kind=f), optional, intent(out) :: t(:, :, :) !! temperature (K) - - ! Local variables - real :: sigma - real :: delta - real :: theta - integer :: i, j, k - integer :: NX, NY, NZ - - NX = size(z, 1) - NY = size(z, 2) - NZ = size(z, 3) - - do i = 1, NX - do j = 1, NY - do k = 1, NZ - - ! Get the scaling of the pressure and temperature at the altitude. - call Atmosphere(real(z(i, j, k) / 1000._f), sigma, delta, theta) !! Convert from m -> km - - if (present(p)) p(i, j, k) = p0 * delta - if (present(t)) t(i, j, k) = T0 * theta - end do - end do - end do - - return - end subroutine - - !+ - SUBROUTINE Atmosphere(alt, sigma, delta, theta) - ! ------------------------------------------------------------------------- - ! PURPOSE - Compute the properties of the 1976 standard atmosphere to 86 km. - ! AUTHOR - Ralph Carmichael, Public Domain Aeronautical Software - ! NOTE - If alt > 86, the values returned will not be correct, but they will - ! not be too far removed from the correct values for density. - ! The reference document does not use the terms pressure and temperature - ! above 86 km. - IMPLICIT NONE - !============================================================================ - ! A R G U M E N T S | - !============================================================================ - real,INTENT(IN):: alt ! geometric altitude, km. - real,INTENT(OUT):: sigma ! density/sea-level standard density - real,INTENT(OUT):: delta ! pressure/sea-level standard pressure - real,INTENT(OUT):: theta ! temperature/sea-level standard temperature - !============================================================================ - ! L O C A L C O N S T A N T S | - !============================================================================ - real,PARAMETER:: REARTH = 6369.0 ! radius of the Earth (km) - real,PARAMETER:: GMR = 34.163195 ! hydrostatic constant - INTEGER,PARAMETER:: NTAB=8 ! number of entries in the defining tables - !============================================================================ - ! L O C A L V A R I A B L E S | - !============================================================================ - INTEGER:: i,j,k ! counters - real:: h ! geopotential altitude (km) - real:: tgrad, tbase ! temperature gradient and base temp of this layer - real:: tlocal ! local temperature - real:: deltah ! height above base of this layer - !============================================================================ - ! L O C A L A R R A Y S ( 1 9 7 6 S T D. A T M O S P H E R E ) | - !============================================================================ - real,DIMENSION(NTAB),PARAMETER:: htab= & - (/0.0, 11.0, 20.0, 32.0, 47.0, 51.0, 71.0, 84.852/) - real,DIMENSION(NTAB),PARAMETER:: ttab= & - (/288.15, 216.65, 216.65, 228.65, 270.65, 270.65, 214.65, 186.946/) - real,DIMENSION(NTAB),PARAMETER:: ptab= & - (/1.0, 2.233611E-1, 5.403295E-2, 8.5666784E-3, 1.0945601E-3, & - 6.6063531E-4, 3.9046834E-5, 3.68501E-6/) - real,DIMENSION(NTAB),PARAMETER:: gtab= & - (/-6.5, 0.0, 1.0, 2.8, 0.0, -2.8, -2.0, 0.0/) - !---------------------------------------------------------------------------- - h=alt*REARTH/(alt+REARTH) ! convert geometric to geopotential altitude - - i=1 - j=NTAB ! setting up for binary search - DO - k=(i+j)/2 ! integer division - IF (h < htab(k)) THEN - j=k - ELSE - i=k - END IF - IF (j <= i+1) EXIT - END DO - - tgrad=gtab(i) ! i will be in 1...NTAB-1 - tbase=ttab(i) - deltah=h-htab(i) - tlocal=tbase+tgrad*deltah - theta=tlocal/ttab(1) ! temperature ratio - - IF (tgrad == 0.0) THEN ! pressure ratio - delta=ptab(i)*EXP(-GMR*deltah/tbase) - ELSE - delta=ptab(i)*(tbase/tlocal)**(GMR/tgrad) - END IF - - sigma=delta/theta ! density ratio - RETURN - END Subroutine Atmosphere ! ----------------------------------------------- -end module diff --git a/CARMAchem_GridComp/CARMA/tests/carma_bc2gtest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_bc2gtest.F90 deleted file mode 100644 index 8fe90097..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_bc2gtest.F90 +++ /dev/null @@ -1,369 +0,0 @@ -!! This code is to demonstrate the CARMA coagulation routines -!! in a test case utilizing two groups, one group that has two -!! components (OC, BC/OC). -!! -!! Upon execution, a text file (carma_bc2gtest.txt) is generated. -!! The text file can be read with the IDL procedure read_bc2gtest.pro. -!! -!! @author Peter Colarco (based on Chuck Bardeen's code) -!! @version Feb-2009 - -program carma_bc2gtest - implicit none - - write(*,*) "Coagulation Test (2 Groups)" - - call test_coagulation_bc2g() - - write(*,*) "Done" -end program - - -subroutine test_coagulation_bc2g() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 80 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 3 - integer, parameter :: NBIN = 20 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 72 - - real(kind=f), parameter :: dtime = 600._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_BLACKCARBON = 1 - integer, parameter :: I_ORGANICCARBON = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: rhoa(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i, j - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho, ck0 - real(kind=f) :: r(NBIN) - real(kind=f) :: dr(NBIN) - real(kind=f) :: rmass(NBIN) - - -! write(*,*) "" -! write(*,*) "Coagulation of Particles" - - ! Open the output text file - open(unit=lun,file="carma_bc2gtest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX), rhoa(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - ! Define the groups - ! ----------------- -! write(*,*) " Add Group(s) ..." - rho = 1._f - rmrat = 2._f - rmin = 3.e-7_f - call CARMAGROUP_Create(carma, 1, "organic carbon", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 2, "mixed carbon", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements - ! ------------------- - ! Organic Carbon -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "organic carbon", rho, I_INVOLATILE, I_ORGANICCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "black carbon in mixed", rho, I_INVOLATILE, I_BLACKCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 3, 2, "organic carbon in mixed", rho, I_COREMASS, I_ORGANICCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - -! Setup the coagulation mapping and kernels -! ----------------------------------------- -! From Jacobson: -! ck0 = 8 * kB * T / 3 / dynamic viscosity of air - ck0 = 8._f * bk * 298._f / 3._f / 1.85e-4_f - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - call CARMA_AddCoagulation(carma, 2, 2, 2, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - call CARMA_AddCoagulation(carma, 2, 1, 2, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - -! Setup the CARMA processes to exercise -! write(*,*) " CARMA_Initialize(carma, rc, do_vtran=.FALSE., "// & -! "do_coag=.TRUE.) ..." - call CARMA_Initialize(carma, rc, do_coag=.TRUE.) - if (rc /=0) stop " *** FAILED ***" - -! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "icoagelem : ielem igroup icoagelem(ielem,igroup)" -! do i = 1, NELEM -! do j = 1, NGROUP -! write(*,*) i, j, carma%f_icoagelem(i,j) -! end do -! end do - -! write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a monodisperse aerosol in first bin - ! 10^12 m-3 (= 10^6 cm-3) - ! Note: p is in MKS here, but rmass is in CGS, so scale - mmr(:,:,:,:,:) = 0._f - - !initial organic carbon - call CARMAGroup_Get(carma, 1, rc, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(1,:,:,1,1) = rmass(1)/1000._f* 1.e12_f & - / (p(1,:,:)/287._f/t(1,:,:)) -! mmr(1,:,:,2,1) = rmass(1)/1000._f* 1.e12_f & -! / (p(1,:,:)/287._f/t(1,:,:)) - - ! initial mixed carbon - call CARMAGroup_Get(carma, 2, rc, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(1,:,:,2,1) = rmass(1)/1000._f* 1.e12_f & - / (p(1,:,:)/287._f/t(1,:,:)) - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - - ! Write output for the coagtest (output is scaled to CGS) - write(lun,*) NBIN, NELEM, NGROUP - - do j = 1, NGROUP - call CARMAGroup_Get(carma, j, rc, r=r, dr=dr) - if (rc /=0) stop " *** FAILED ***" - - ! Bin structure - do i = 1, NBIN - write(lun,'(i3,2(1x,e12.5))') & - i, & - r(i), & - dr(i) - end do - end do - - ! Initial particle mass densities. - write(lun,*) 0 - - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)*1e-6_f*1e3_f - end do - end do - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - ! - ! NOTE: This directive allows each column of the model to be processed in a - ! separate thread. This can allow for faster computation on machines that - ! allow multiple threads (e.g. have multiple CPUS). This should probably not - ! be used when the the model is embedded in a another model that is already - ! controlling the distribution of the model across multiple threads. - - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - - enddo - - ! Write output for the coagtest (output in CGS) - write(lun,'(f12.0)') istep*dtime - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)*1e-6_f*1e3_f - end do - end do - - end do ! time loop - - if (rc /=0) stop " *** FAILED ***" - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_bcoctest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_bcoctest.F90 deleted file mode 100644 index 64b6c8d4..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_bcoctest.F90 +++ /dev/null @@ -1,390 +0,0 @@ -!! This code is to demonstrate the CARMA coagulation routines -!! in a test case utilizing three groups, one group that has two -!! components (BC, OC, OC/BC). -!! -!! Upon execution, a text file (carma_bcoctest.txt) is generated. -!! The text file can be read with the IDL procedure read_bcoctest.pro. -!! -!! @author Peter Colarco (based on Chuck Bardeen's code) -!! @version Feb-2009 - -program carma_bcoctest - implicit none - - write(*,*) "Coagulation Test (3 groups)" - - call test_coagulation_bcoc() - - write(*,*) "Done" -end program - - -subroutine test_coagulation_bcoc() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 80 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 4 - integer, parameter :: NBIN = 20 - integer, parameter :: NGROUP = 3 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 72 - - real(kind=f), parameter :: dtime = 600._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_BLACKCARBON = 1 - integer, parameter :: I_ORGANICCARBON = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: rhoa(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i, j - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rhobc, rhooc, ck0 - real(kind=f) :: r(NBIN) - real(kind=f) :: dr(NBIN) - real(kind=f) :: rmass(NBIN) - - -! write(*,*) "" -! write(*,*) "Coagulation of Particles" - - ! Open the output text file - open(unit=lun,file="carma_bcoctest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX), rhoa(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - ! Define the groups - ! ----------------- -! write(*,*) " Add Group(s) ..." - rmrat = 2._f - rmin = 3.e-7_f - - rhobc = 2._f - rhooc = 1._f - - ! Black Carbon - call CARMAGROUP_Create(carma, 1, 'black carbon', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - ! Organic Carbon - call CARMAGROUP_Create(carma, 2, 'organic carbon', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - ! Mixed BC/OC - call CARMAGROUP_Create(carma, 3, 'mixed bc/oc', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements - ! ------------------- -! write(*,*) " Add Element(s) ..." - - ! Black Carbon - call CARMAELEMENT_Create(carma, 1, 1, "black carbon", rhobc, I_INVOLATILE, I_BLACKCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Organic Carbon - call CARMAELEMENT_Create(carma, 2, 2, "organic carbon", rhooc, I_INVOLATILE, I_ORGANICCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Mixed BC/OC - call CARMAELEMENT_Create(carma, 3, 3, "mixed bc/oc", rhooc, I_INVOLATILE, I_ORGANICCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Mass of BC in Mixed Group - call CARMAELEMENT_Create(carma, 4, 3, "mass of bc in mixed", rhobc, I_COREMASS, I_BLACKCARBON, rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Setup the coagulation mapping and kernels - ! ----------------------------------------- -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." - ! From Jacobson: -! ck0 = 8 * kB * T / 3 / dynamic viscosity of air - ck0 = 8._f * bk * 298._f / 3._f / 1.85e-4_f - ! Black Carbon - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Organic Carbon - call CARMA_AddCoagulation(carma, 2, 2, 2, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Organic Carbon & Black Carbon - call CARMA_AddCoagulation(carma, 2, 1, 3, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Black Carbon & Mixed - call CARMA_AddCoagulation(carma, 3, 1, 3, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Organic Carbon & Mixed - call CARMA_AddCoagulation(carma, 3, 2, 3, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Mixed to Mixed - call CARMA_AddCoagulation(carma, 3, 3, 3, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) stop " *** FAILED ***" - - ! Setup the CARMA processes to exercise -! write(*,*) " CARMA_Initialize(carma, rc, do_vtran=.FALSE., "// & -! "do_coag=.TRUE.) ..." - - - call CARMA_Initialize(carma, rc, do_coag=.TRUE.) - if (rc /=0) stop " *** FAILED ***" - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a monodisperse aerosol in first bin - ! 10^12 m-3 (= 10^6 cm-3) - ! Note: p is in MKS here, but rmass is in CGS, so scale - mmr(:,:,:,:,:) = 0._f - - !initial black carbon - call CARMAGROUP_Get(carma, 1, rc, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(1,:,:,1,1) = rmass(1)/1000._f* 1.e12_f & - / (p(1,:,:)/287._f/t(1,:,:)) - - ! initial organic carbon - call CARMAGROUP_Get(carma, 2, rc, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(1,:,:,2,1) = rmass(1)/1000._f* 1.e12_f & - / (p(1,:,:)/287._f/t(1,:,:)) - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - ! Write output for the coagtest (output is scaled to CGS) - write(lun,*) NBIN, NELEM, NGROUP - - do j = 1, NGROUP - call CARMAGROUP_Get(carma, j, rc, r=r, dr=dr) - if (rc /=0) stop " *** FAILED ***" - - ! Bin structure - do i = 1, NBIN - write(lun,'(i3,2(1x,e12.5))') & - i, & - r(i), & - dr(i) - end do - end do - - ! Initial particle mass densities. - write(lun,*) 0 - - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - real(mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)*1e-6_f*1e3_f) - end do - end do - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - - enddo - - ! Write output for the coagtest (output in CGS) - write(lun,'(f12.0)') istep*dtime - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - real(mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)*1e-6_f*1e3_f) - end do - end do - - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_coagtest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_coagtest.F90 deleted file mode 100644 index 75ef53fe..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_coagtest.F90 +++ /dev/null @@ -1,332 +0,0 @@ -!! This code is to demonstrate the CARMA coagulation routines -!! in a test case based on Jacobson, "Modeling coagulation among -!! particles of different composition and size," Atmospheric -!! Environment 28, 1327-13338, 1994. Upon execution, a text file -!! (carma_coagtest.txt) is generated. The text file can -!! be read with the IDL procedure read_coagtest.pro. -!! -!! @author Peter Colarco (based on Chuck Bardeen's code) -!! @version Feb-2009 - -program carma_coagtest - implicit none - - write(*,*) "Coagulation Test" - - call test_coagulation() - - write(*,*) "Done" -end program - - -subroutine test_coagulation() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 80 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 20 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 72 - - real(kind=f), parameter :: dtime = 600._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: rhoa(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: j - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho, ck0 - real(kind=f) :: r(NBIN) - real(kind=f) :: dr(NBIN) - real(kind=f) :: rmass(NBIN) - - -! write(*,*) "" -! write(*,*) "Coagulation of Particles" - - ! Open the output text file - open(unit=lun,file="carma_coagtest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX), rhoa(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - carma_ptr => carma - - ! Define the group -! write(*,*) " Add Group(s) ..." - rho = 2._f - rmrat = 2._f - rmin = 3.e-7_f - - call CARMAGROUP_Create(carma, 1, 'aerosol', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the element -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Setup the coagulation mapping and kernels - ! From Jacobson: -! ck0 = 8 * kB * T / 3 / dynamic viscosity of air - ck0 = 8._f * bk * 298._f / 3._f / 1.85e-4_f - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc, ck0=ck0) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Setup the CARMA processes to exercise -! write(*,*) " CARMA_Initialize(carma, rc, do_vtran=.FALSE., "// & -! "do_coag=.TRUE.) ..." - call CARMA_Initialize(carma, rc, do_coag=.TRUE.) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a monodisperse aerosol in first bin - ! 10^12 m-3 (= 10^6 cm-3) - ! Note: p is in MKS here, but rmass is in CGS, so scale - mmr(:,:,:,:,:) = 0._f - - call CARMAGROUP_Get(carma, 1, rc, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - - mmr(1,:,:,1,1) = rmass(1)/1000._f* 1.e12_f & - / (p(1,:,:)/287._f/t(1,:,:)) - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - ! Write output for the coagtest (output is scaled to CGS) - write(lun,*) NBIN, NELEM, NGROUP - - do j = 1, NGROUP - call CARMAGROUP_Get(carma, j, rc, r=r, dr=dr, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - - ! Bin structure - do i = 1, NBIN - write(lun,'(i3,2(1x,e12.5))') & - i, & - r(i), & - dr(i) - end do - end do - - ! Initial particle mass densities. - write(lun,*) 0 - - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)/rmass(i)*1e-6_f*1e3_f - end do - end do - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - enddo - - ! Write output for the coagtest (output in CGS) - write(lun,'(f12.0)') istep*dtime - rhoa(:,:,:) = p(:,:,:)/287._f/t(:,:,:) - - do j = 1, NELEM - do i = 1, NBIN - write(lun,'(i3,1(1x,e12.5))') & - i, & - mmr(1,NY,NX,j,i)*rhoa(1,NY,NX)/rmass(i)*1e-6_f*1e3_f - end do - end do - - end do ! time loop - - ! Cleanup the carma state object - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_drydeptest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_drydeptest.F90 deleted file mode 100644 index 588a10c5..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_drydeptest.F90 +++ /dev/null @@ -1,291 +0,0 @@ -!! This code is to test the dry deposition routine by comparing -!! sedimentation with and without dry deposition. -!! -!! Upon execution, a text file (carma_drydeptest.txt) is generated. -!! The text file can be read with the IDL procedure read_drydeptest.pro. -!! -!! @author Tianyi Fan -!! @version Apr-2011 - -program carma_drydeptest - implicit none - - write(*,*) "Dry Deposition Test" - - call test_drydep() - - write(*,*) "Done" -end program - -!! Create 2 particle groups, one for particles with dry deposition -!! using arbitary values of ram(aerodynamic resistance) and fv (friction velocity) -!! the other for particles without dry deposition, to see if they make a difference. -subroutine test_drydep() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 150 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 2 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - integer, parameter :: nstep = 100*6 - - ! To keep the file processing simpler, only one bin will get written out - ! to the output file. - integer, parameter :: OUTBIN = 14 - - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: rhmin = .4_f - real(kind=f), parameter :: rhmax = 1.05_f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_PART = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - - real(kind=f), allocatable, target :: mmr(:,:,:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: ielem - integer :: ibin - integer :: igroup - integer, parameter :: lun = 42 - integer, parameter :: lun1 = 41 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - real(kind=f) :: drh - - real(kind=f) :: lndfv = 1.5_f ! land friction velocity - real(kind=f) :: lndram = 60._f ! land aerodynamic resistance - real(kind=f) :: lndfrac = 0.0_f ! land fraction - - real(kind=f) :: ocnfv = 2.0_f ! ocean friction velocity - real(kind=f) :: ocnram = 40._f ! ocean aerodynamic resistance - real(kind=f) :: ocnfrac = 1.0_f ! ocean fraction - - real(kind=f) :: icefv = 2.5_f ! ice friction velocity - real(kind=f) :: iceram = 20._f ! ice aerodynamic resistance - real(kind=f) :: icefrac = 0.0_f ! ice fraction - - real(kind=f) :: vdry(NBIN, NGROUP) - - - ! Open the output text file - open(unit=lun,file="carma_drydeptest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(relhum(NZ)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - rho = 2.65_f - rmrat = 4.32_f - rmin = 1e-6_f - - call CARMAGROUP_Create(carma, 1, "DryDep", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc, & - do_mie = .FALSE., do_wetdep=.FALSE., do_drydep=.TRUE., do_vtran=.TRUE., shortname="DD") - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - call CARMAGROUP_Create(carma, 2, "NoDryDep", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc, & - do_mie = .FALSE., do_wetdep=.FALSE., do_drydep=.FALSE., do_vtran=.TRUE., shortname="NDD") - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "DryDep", rho, I_INVOLATILE, I_PART, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "NoDryDep", rho, I_INVOLATILE, I_PART, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) stop " *** CARMA_AddCoagulation FAILED ***" - - ! Setup the CARMA processes to exercise - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., do_drydep=.TRUE.) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Set up some arbitrary relative humidities, with the maximum at the bottom and - ! minimum at the top. Make the RH at the top 0, just to make sure the code can - ! handle an RH of 0. - drh = (rhmax - rhmin) / (NZ-1) - - do i = 1, NZ - relhum(i) = rhmax - ((i - 1) * drh) - end do - - relhum(NZ) = 0._f - - - ! Put a blob in the model for all elements and bins at 8 km. - mmr(:,:,:) = 0._f - do i = 1, NZ - do ielem = 1, NELEM - do ibin = 1, NBIN - mmr(i,ielem,ibin) = 1e-10_f * exp(-((zc(i) - 8.e3_f) / 3.e3_f)**2) / & - (p(i) / 287._f / t(i)) - end do - end do - end do - - - ! Write output for the falltest - write(lun,*) NZ, NELEM - do i = 1, NZ - write(lun,'(i3,2f10.1)') i, zc(i), zl(i+1)-zl(i) - end do - - write(lun,*) 0 - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') ielem, i, real(mmr(i,ielem,OUTBIN)), real(mmr(i,ielem,OUTBIN)*p(i) / 287._f / t(i)) - end do - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc, relhum=relhum(:)) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc, & - lndfv=lndfv, ocnfv=ocnfv, icefv=icefv, & - lndram=lndram, ocnram=ocnram, iceram=iceram, & - lndfrac=lndfrac, ocnfrac=ocnfrac, icefrac=icefrac) - if (rc /=0) stop " *** CARMASTATE_StepFAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc, vd=vdry(ibin,ielem)) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** CARMASTATE_GetState FAILED ***" - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') ielem, i, real(mmr(i,ielem,OUTBIN)), real(mmr(i,ielem,OUTBIN)*p(i) / 287._f / t(i)) - end do - end do - end do ! time loop - - - ! Close the output file - close(unit=lun) - - ! write the dry deposition velocity - open(unit=lun1,file="carma_vdry.txt",status="unknown") - do igroup = 1, NGROUP - write(lun1,*) igroup, real(vdry(:, igroup)) - end do - close(unit=lun1) - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_falltest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_falltest.F90 deleted file mode 100644 index f3436c90..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_falltest.F90 +++ /dev/null @@ -1,304 +0,0 @@ -!! This code is to demonstrate the CARMA sedimentation routines -!! using a constant fall velocity. -!! -!! Upon execution, a text file (carma_falltest.txt) is generated. -!! The text file can be read with the IDL procedure read_falltest.pro. -!! -!! @author Peter Colarco (based on Chuck Bardeen's code) -!! @version Feb-2009 - -program carma_falltest - implicit none - - write(*,*) "Sedimentation Test" - - call test_sedimentation() - - write(*,*) "Done" -end program - - -subroutine test_sedimentation() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 110 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 8 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 100*6 - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - logical :: do_explised = .false. -! logical :: do_explised = .true. - real(kind=f) :: vf_const = 2.0_f -! real(kind=f) :: vf_const = 0.0_f - - -! write(*,*) "" -! write(*,*) "Sedimentation of Dust Particles" - - ! Open the output text file - open(unit=lun,file="carma_falltest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create(carma, ", NBIN, ", ", NELEM, ", ", NGROUP, & -! ", ", NSOLUTE, ", ", NGAS, ", rc, 6) ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - carma_ptr => carma - - - ! Define the group - rho = 2.65_f - rmrat = 2.0 - rmin = 7.5e-4_f -! write(*,*) " Add Group(s) ..." - call CARMAGROUP_Create(carma, 1, "dust", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - - ! Define the element -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! Setup the CARMA processes to exercise -! do_explised = .true. -! vf_const = 2.0 -! write(*,*) " CARMA_Initialize(carma, rc, do_vtran=.TRUE., "// & -! "vf_const=", vf_const,", do_explised=",do_explised,") ..." - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., vf_const=vf_const, do_explised=do_explised) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a blob in the model first bin at 8 km - mmr(:,:,:,:,:) = 0._f - do i = 1, NZ - mmr(i,:,:,1,1) = 1e-10_f * exp( - ( ( zc(i,:,:) - 8.e3_f)/3.e3_f) ** 2) / & - ( p(i,:,:) / 287._f / t(i,:,:)) - end do - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - ! Write output for the falltest - write(lun,*) NZ - do i = 1, NZ - write(lun,'(i3,2f10.1)') & - i, zc(i,NY,NX), zl(i+1,NY,NX)-zl(i,NY,NX) - end do - - write(lun,*) 0 - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - - - ! Iterate the model over a few time steps. - ! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - enddo - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_growclrtest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_growclrtest.F90 deleted file mode 100644 index 0a4e3206..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_growclrtest.F90 +++ /dev/null @@ -1,386 +0,0 @@ -!! This code is to test condensational growth with substepping using the -!! clear sky microphysics. -!! -!! Upon execution, a text file (carma_growintest.txt) is generated. -!! The text file can be read with the IDL procedure read_growintest.pro. -!! -!! @author Chuck Bardeen -!! @version Jan 2012 - -program carma_growclrtest - implicit none - - write(*,*) "Clear Sky Growth Test with Substepping" - - call test_growclr_sub() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, put an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mass of drops + gas should be conserved. -!! -!! Use substepping, which means that the model should start at ice saturation -!! and then get a perturbation in the first timestep to the specified gas -!! concentration. -subroutine test_growclr_sub() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 2 - integer, parameter :: NBIN = 18 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. - integer :: maxsubsteps = 32 - integer :: maxretries = 20 - -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 60._f -! real(kind=f), parameter :: dtime = 100._f - real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - - real(kind=f), parameter :: zmin = 3000._f - - integer, parameter :: nstep = 5000 / dtime -! integer, parameter :: nstep = 50 - - integer, parameter :: I_H2O = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - real(kind=f), allocatable :: cldfrc(:) - real(kind=f), allocatable :: rhcrit(:) - - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: mmr_gas_old(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - real(kind=f), allocatable :: pvapice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer, parameter :: lun = 42 - integer :: nsubsteps - integer :: lastsub = 0 - - real(kind=f) :: nretries - real(kind=f) :: lastret = 0._f - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - real(kind=f) :: t_orig - - - ! Open the output text file - open(unit=lun,file="carma_growclrtest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ), cldfrc(NZ), rhcrit(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(mmr_gas_old(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(pvapice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, & - LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - rmrat = 2._f -! rmin = 1e-8_f -! rmin = 1e-4_f - rmin = 1e-4_f - call CARMAGROUP_Create(carma, 1, "In-cloud Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc, is_cloud=.true.) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - call CARMAGROUP_Create(carma, 2, "Clear Sky Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc, is_cloud=.false.) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "In-cloud Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "Clear Sky Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, & - I_GCOMP_H2O, rc, ds_threshold=0.2_f) -! call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_GOFF1946, I_GCOMP_H2O, rc) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 1, rc) - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - call CARMA_AddGrowth(carma, 2, 1, rc) - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_substep=.true., do_thermo=.true., & - minsubsteps=1, maxsubsteps=maxsubsteps, maxretries=maxretries, dt_threshold=2._f, & - do_incloud=.true., do_clearsky=.true.) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1) = 90._f * 100._f - zc(1) = 17000._f - t(1) = 190._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - - mmr(:,1,1) = (0.1_f * rmass(1) * (1e-3_f * 1e6_f)) / rho(:) / 2._f - mmr(:,2,1) = (0.1_f * rmass(1) * (1e-3_f * 1e6_f)) / rho(:) / 2._f - - ! Calculate saturation using Murphy and Koop [2005]. - pvapice(:,1) = exp(9.550426_f - (5723.265_f / t(:)) + (3.53068_f * log(t(:))) - (0.00728332_f * t(:))) - mmr_gas_old(:,1) = pvapice(:,1) * 18.0_f / p(:) * 28.9_f - mmr_gas(:,1) = 3.5e-6_f - - t_orig = t(1) - - - write(lun,*) 0 - - write(lun,'(2i6,e12.3)') 0, 0, real(t(1) - t_orig) - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0._f, 0._f - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc, told=t(:)) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - - ! For the first time step, set mmr_old to the original value and - ! then set the current mmr to the new value. This will create a - ! change in gas during the timestep that substepping can use to - ! control the stability of the solution. - if (istep == 1) then - satice(:, igas) = -1._f - satliq(:, igas) = -1._f - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas_old(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - else - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - end if - end do - - ! Execute the step - cldfrc(:) = 0.5_f - rhcrit(:) = 0.8_f - - call CARMASTATE_Step(cstate, rc, cldfrc, rhcrit) - if (rc /=0) stop " *** CARMASTATE_Step FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), & - rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - if (rc /=0) stop " *** CARMASTATE_GetGas FAILED ***" - end do - - ! Get the updated temperature. - call CARMASTATE_Get(cstate, rc, nsubstep=nsubsteps, nretry=nretries) - if (rc /=0) stop " *** CARMASTATE_Get FAILED ***" - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** CARMASTATE_GetState FAILED ***" - - - ! Write output for the test. - write(lun,'(f12.0)') istep*dtime - - write(lun,'(2i6,g16.5)') nsubsteps - lastsub, int(nretries - lastret), t(1) - t_orig - lastsub = nsubsteps - lastret = nretries - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - ! Close the output file - close(unit=lun) - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_growintest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_growintest.F90 deleted file mode 100644 index 65b2ce2b..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_growintest.F90 +++ /dev/null @@ -1,384 +0,0 @@ -!! This code is to test condensational growth with substepping using the -!! incloud microphysics. -!! -!! Upon execution, a text file (carma_growintest.txt) is generated. -!! The text file can be read with the IDL procedure read_growintest.pro. -!! -!! @author Chuck Bardeen -!! @version Jan 2012 - -program carma_growintest - implicit none - - write(*,*) "In-Cloud Growth Test with Substepping" - - call test_growin_sub() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, put an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mass of drops + gas should be conserved. -!! -!! Use substepping, which means that the model should start at ice saturation -!! and then get a perturbation in the first timestep to the specified gas -!! concentration. -subroutine test_growin_sub() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 18 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. - integer :: maxsubsteps = 32 - integer :: maxretries = 10 - -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 60._f -! real(kind=f), parameter :: dtime = 100._f - real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - - real(kind=f), parameter :: zmin = 3000._f - - integer, parameter :: nstep = 5000 / dtime -! integer, parameter :: nstep = 50 - - integer, parameter :: I_H2O = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - real(kind=f), allocatable :: cldfrc(:) - real(kind=f), allocatable :: rhcrit(:) - - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: mmr_gas_old(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - real(kind=f), allocatable :: pvapice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer, parameter :: lun = 42 - integer :: nsubsteps - integer :: lastsub = 0 - - real(kind=f) :: nretries - real(kind=f) :: lastret = 0._f - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - real(kind=f) :: t_orig - - - ! Open the output text file - open(unit=lun,file="carma_growintest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ), cldfrc(NZ), rhcrit(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(mmr_gas_old(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(pvapice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, & - LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - rmrat = 2._f -! rmin = 1e-8_f -! rmin = 1e-4_f - rmin = 1e-4_f - call CARMAGROUP_Create(carma, 1, "Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc, is_cloud=.true.) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, & - I_GCOMP_H2O, rc, ds_threshold=0.2_f) -! call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_GOFF1946, I_GCOMP_H2O, rc) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 1, rc) - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_substep=.true., do_thermo=.true., & - minsubsteps=1, maxsubsteps=maxsubsteps, maxretries=maxretries, dt_threshold=2._f, & - do_incloud=.true.) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Setup up an arbitray mass mixing ratio of water vapor, so there is someting to - ! grow the particles. - mmr_gas(:,:) = 1e-2_f - - ! Start with some initial water drops in the smallest bin, which can then grow - ! to larger sizes in the presence of the water vapor. - mmr(:,:,1) = 1e-6_f - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1) = 90._f * 100._f - zc(1) = 17000._f - t(1) = 190._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - - mmr(:,1,1) = (0.1_f * rmass(1) * (1e-3_f * 1e6_f)) / rho(:) - - ! Calculate saturation using Murphy and Koop [2005]. - pvapice(:,1) = exp(9.550426_f - (5723.265_f / t(:)) + (3.53068_f * log(t(:))) - (0.00728332_f * t(:))) - mmr_gas_old(:,1) = pvapice(:,1) * 18.0_f / p(:) * 28.9_f - mmr_gas(:,1) = 3.5e-6_f - - t_orig = t(1) - - - write(lun,*) 0 - - write(lun,'(2i6,e12.3)') 0, 0, real(t(1) - t_orig) - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0._f, 0._f - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc, told=t(:)) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - - ! For the first time step, set mmr_old to the original value and - ! then set the current mmr to the new value. This will create a - ! change in gas during the timestep that substepping can use to - ! control the stability of the solution. - if (istep == 1) then - satice(:, igas) = -1._f - satliq(:, igas) = -1._f - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas_old(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - else - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - end if - end do - - ! Execute the step - cldfrc(:) = 0.5_f - rhcrit(:) = 0.8_f - - call CARMASTATE_Step(cstate, rc, cldfrc, rhcrit) - if (rc /=0) stop " *** CARMASTATE_Step FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), & - rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - if (rc /=0) stop " *** CARMASTATE_GetGas FAILED ***" - end do - - ! Get the updated temperature. - call CARMASTATE_Get(cstate, rc, nsubstep=nsubsteps, nretry=nretries) - if (rc /=0) stop " *** CARMASTATE_Get FAILED ***" - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** CARMASTATE_GetState FAILED ***" - - - ! Write output for the test. - write(lun,'(f12.0)') istep*dtime - - write(lun,'(2i6,g16.5)') nsubsteps - lastsub, int(nretries - lastret), t(1) - t_orig - lastsub = nsubsteps - lastret = nretries - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - ! Close the output file - close(unit=lun) - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_growsubtest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_growsubtest.F90 deleted file mode 100644 index b8e61f2c..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_growsubtest.F90 +++ /dev/null @@ -1,374 +0,0 @@ -!! This code is to test condensational growth with substepping. -!! -!! Upon execution, a text file (carma_growsubtest.txt) is generated. -!! The text file can be read with the IDL procedure read_growtest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_growsubtest - implicit none - - write(*,*) "Growth Test with Substepping" - - call test_grow_sub() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, put an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mass of drops + gas should be conserved. -!! -!! Use substepping, which means that the model should start at ice saturation -!! and then get a perturbation in the first timestep to the specified gas -!! concentration. -subroutine test_grow_sub() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 18 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. - integer :: maxsubsteps = 32 - integer :: maxretries = 10 - -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 60._f -! real(kind=f), parameter :: dtime = 100._f - real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - - real(kind=f), parameter :: zmin = 3000._f - - integer, parameter :: nstep = 5000 / dtime -! integer, parameter :: nstep = 50 - - integer, parameter :: I_H2O = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: mmr_gas_old(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - real(kind=f), allocatable :: pvapice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer, parameter :: lun = 42 - integer :: nsubsteps - integer :: lastsub = 0 - - real(kind=f) :: nretries - real(kind=f) :: lastret = 0._f - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - real(kind=f) :: t_orig - - -! write(*,*) "" -! write(*,*) "Particle Growth - Simple" - - ! Open the output text file - open(unit=lun,file="carma_growsubtest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(mmr_gas_old(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(pvapice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, & - LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - rmrat = 2._f -! rmin = 1e-8_f -! rmin = 1e-4_f - rmin = 1e-4_f - call CARMAGROUP_Create(carma, 1, "Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, & - I_GCOMP_H2O, rc, ds_threshold=0.2_f) -! call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_GOFF1946, I_GCOMP_H2O, rc) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 1, rc) - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_substep=.true., do_thermo=.true., & - minsubsteps=1, maxsubsteps=maxsubsteps, maxretries=maxretries, dt_threshold=2._f) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Setup up an arbitray mass mixing ratio of water vapor, so there is someting to - ! grow the particles. - mmr_gas(:,:) = 1e-2_f - - ! Start with some initial water drops in the smallest bin, which can then grow - ! to larger sizes in the presence of the water vapor. - mmr(:,:,1) = 1e-6_f - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1) = 90._f * 100._f - zc(1) = 17000._f - t(1) = 190._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - - mmr(:,1,1) = (0.1_f * rmass(1) * (1e-3_f * 1e6_f)) / rho(:) - - ! Calculate saturation using Murphy and Koop [2005]. - pvapice(:,1) = exp(9.550426_f - (5723.265_f / t(:)) + (3.53068_f * log(t(:))) - (0.00728332_f * t(:))) - mmr_gas_old(:,1) = pvapice(:,1) * 18.0_f / p(:) * 28.9_f - mmr_gas(:,1) = 3.5e-6_f - - t_orig = t(1) - - - write(lun,*) 0 - - write(lun,'(2i6,e12.3)') 0, 0, real(t(1) - t_orig) - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0._f, 0._f - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc, told=t(:)) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - - ! For the first time step, set mmr_old to the original value and - ! then set the current mmr to the new value. This will create a - ! change in gas during the timestep that substepping can use to - ! control the stability of the solution. - if (istep == 1) then - satice(:, igas) = -1._f - satliq(:, igas) = -1._f - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas_old(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - else - - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc, & - mmr_old=mmr_gas(:,igas), satice_old=satice(:,igas), satliq_old=satliq(:,igas)) - end if - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), & - rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - end do - - ! Get the updated temperature. - call CARMASTATE_Get(cstate, rc, nsubstep=nsubsteps, nretry=nretries) - call CARMASTATE_GetState(cstate, rc, t=t(:)) - - - ! Write output for the test. - write(lun,'(f12.0)') istep*dtime - - write(lun,'(2i6,g16.5)') nsubsteps - lastsub, int(nretries - lastret), t(1) - t_orig - lastsub = nsubsteps - lastret = nretries - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - end do ! time loop - - if (rc /=0) stop " *** Run FAILED ***" - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - ! Close the output file - close(unit=lun) - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_growtest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_growtest.F90 deleted file mode 100644 index d66b7797..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_growtest.F90 +++ /dev/null @@ -1,324 +0,0 @@ -!! This code is to test condensational growth. -!! -!! Upon execution, a text file (carma_growtest.txt) is generated. -!! The text file can be read with the IDL procedure read_growtest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_growtest - implicit none - - write(*,*) "Growth Test" - - call test_grow_simple() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, put an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mass of drops + gas should be conserved. -subroutine test_grow_simple() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 24 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. -! real(kind=f), parameter :: dtime = .1_f -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f - real(kind=f), parameter :: dtime = 100._f -! real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f - - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 3000._f - - integer, parameter :: nstep = 5000 / dtime - - integer, parameter :: I_H2O = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - real(kind=f), allocatable :: rlheat(:) - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - real(kind=f) :: t_orig - - - ! Open the output text file - open(unit=lun,file="carma_growtest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ), rlheat(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - rmrat = 2._f -! rmin = 1e-8_f -! rmin = 1e-4_f - rmin = 1e-4_f - call CARMAGROUP_Create(carma, 1, "Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, I_GCOMP_H2O, rc) -! call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_GOFF1946, I_GCOMP_H2O, rc) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 1, rc) - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_thermo=.true.) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Setup up an arbitray mass mixing ratio of water vapor, so there is someting to - ! grow the particles. - mmr_gas(:,:) = 1e-2_f - - ! Start with some initial water drops in the smallest bin, which can then grow - ! to larger sizes in the presence of the water vapor. - mmr(:,:,1) = 1e-6_f - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1) = 90._f * 100._f - zc(1) = 17000._f - t(1) = 190._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - mmr_gas(:,:) = 3.5e-6_f - mmr(:,1,1) = (0.1_f * rmass(1) * (1e-3_f * 1e6_f)) / rho(:) - - t_orig = t(1) - - - write(lun,*) 0 - - write(lun,*) 0._f, 0._f - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0., 0. - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Step FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - if (rc /=0) stop " *** CARMASTATE_GetGas FAILED ***" - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:), rlheat=rlheat(:)) - if (rc /=0) stop " *** CARMASTATE_Get FAILED ***" - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - - write(lun,'(2g16.5)') t(1) - t_orig, rlheat(1) - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - end do ! time loop - - - ! Close the output file - close(unit=lun) - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_history.F90 b/CARMAchem_GridComp/CARMA/tests/carma_history.F90 deleted file mode 100644 index 5d0d715c..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_history.F90 +++ /dev/null @@ -1,193 +0,0 @@ -module history - - contains - - subroutine write_history(filename, xc, yc, zc, p, t, pc, gc, rc) - use netcdf - implicit none - - ! This is the name of the data file we will create. - character (len = *), parameter :: FILE_NAME = "pres_temp_4D.nc" - integer :: ncid - - ! We are writing 4D data, a 2 x 6 x 12 lvl-lat-lon grid, with 2 - ! timesteps of data. - integer, parameter :: NDIMS = 4, NRECS = 2 - integer, parameter :: NLVLS = 2, NLATS = 6, NLONS = 12 - integer :: lvl_dimid, lon_dimid, lat_dimid, rec_dimid - - ! The start and count arrays will tell the netCDF library where to - ! write our data. - integer :: start(NDIMS), count(NDIMS) - - ! These program variables hold the latitudes and longitudes. - real :: lats(NLATS), lons(NLONS) - integer :: lon_varid, lat_varid - - ! We will create two netCDF variables, one each for temperature and - ! pressure fields. - character (len = *), parameter :: PRES_NAME="pressure" - character (len = *), parameter :: TEMP_NAME="temperature" - integer :: pres_varid, temp_varid - integer :: dimids(NDIMS) - - ! We recommend that each variable carry a "units" attribute. - - ! Program variables to hold the data we will write out. We will only - ! need enough space to hold one timestep of data; one record. - real :: pres_out(NLONS, NLATS, NLVLS) - real :: temp_out(NLONS, NLATS, NLVLS) - real, parameter :: SAMPLE_PRESSURE = 900.0 - real, parameter :: SAMPLE_TEMP = 9.0 - - ! Use these to construct some latitude and longitude data for this - ! example. - real, parameter :: START_LAT = 25.0, START_LON = -125.0 - - ! Loop indices - integer :: lvl, lat, lon, rec, i - - ! Create pretend data. If this wasn't an example program, we would - ! have some real data to write, for example, model output. - do lat = 1, NLATS - lats(lat) = START_LAT + (lat - 1) * 5.0 - end do - do lon = 1, NLONS - lons(lon) = START_LON + (lon - 1) * 5.0 - end do - i = 0 - do lvl = 1, NLVLS - do lat = 1, NLATS - do lon = 1, NLONS - pres_out(lon, lat, lvl) = SAMPLE_PRESSURE + i - temp_out(lon, lat, lvl) = SAMPLE_TEMP + i - i = i + 1 - end do - end do - end do - - return - end subroutine - - HISTORY_Create(history, filename, carma) - character (len = *), parameter :: LVL_NAME = "level" - character (len = *), parameter :: LAT_NAME = "latitude" - character (len = *), parameter :: LON_NAME = "longitude" - character (len = *), parameter :: REC_NAME = "time" - - character (len = *), parameter :: UNITS = "units" - character (len = *), parameter :: PRES_UNITS = "Pa" - character (len = *), parameter :: TEMP_UNITS = "K" - character (len = *), parameter :: LAT_UNITS = "degrees_north" - character (len = *), parameter :: LON_UNITS = "degrees_east" - - integer :: NGAS - integer :: NELEM - integer :: NBIN - - call CARMA_GetDims(NGROUP, NELEM, NBIN, NSOLUTE, NGAS, NX, NY, NZ) - - ! Create the file. - call check(nf90_create(filename, nf90_clobber, history%ncid)) - - ! Define the dimensions. The record dimension is defined to have - ! unlimited length - it can grow as needed. In this example it is - ! the time dimension. - call check(nf90_def_dim(history%ncid, LVL_NAME, NLVLS, history%lvl_dimid)) - call check(nf90_def_dim(history%ncid, LAT_NAME, NLATS, history%lat_dimid)) - call check(nf90_def_dim(history%ncid, LON_NAME, NLONS, history%lon_dimid)) - call check(nf90_def_dim(history%ncid, REC_NAME, NF90_UNLIMITED, history%rec_dimid)) - - ! Define the coordinate variables. We will only define coordinate - ! variables for lat and lon. Ordinarily we would need to provide - ! an array of dimension IDs for each variable's dimensions, but - ! since coordinate variables only have one dimension, we can - ! simply provide the address of that dimension ID (lat_dimid) and - ! similarly for (lon_dimid). - call check(nf90_def_var(history%ncid, LAT_NAME, NF90_REAL, history%lat_dimid, history%lat_varid)) - call check(nf90_def_var(history%ncid, LON_NAME, NF90_REAL, history%lon_dimid, history%lon_varid)) - - ! Assign units attributes to coordinate variables. - call check(nf90_put_att(history%ncid, lat_varid, UNITS, LAT_UNITS)) - call check(nf90_put_att(history%ncid, lon_varid, UNITS, LON_UNITS)) - - ! The dimids array is used to pass the dimids of the dimensions of - ! the netCDF variables. Both of the netCDF variables we are creating - ! share the same four dimensions. In Fortran, the unlimited - ! dimension must come last on the list of dimids. - dimids = (/ lon_dimid, lat_dimid, lvl_dimid, rec_dimid /) - - ! Define the netCDF variables for the pressure and temperature data. - call check(nf90_def_var(history%ncid, PRES_NAME, NF90_REAL, dimids, history%pres_varid)) - call check(nf90_def_var(history%ncid, TEMP_NAME, NF90_REAL, dimids, history%temp_varid)) - - ! Assign units attributes to the netCDF variables. - call check(nf90_put_att(history%ncid, history%pres_varid, UNITS, PRES_UNITS)) - call check(nf90_put_att(history%ncid, history%temp_varid, UNITS, TEMP_UNITS)) - - ! End define mode. - call check(nf90_enddef(history%ncid)) - - ! Write the coordinate variable data. This will put the latitudes - ! and longitudes of our data grid into the netCDF file. - call check(nf90_put_var(history%ncid, history%lat_varid, lats)) - call check(nf90_put_var(history%ncid, history%lon_varid, lons)) - end - - subroutine History_WriteStep(history, carma) - real(kind=f) :: mmr(history%NX, history%NY, history%NZ) - real(kind=f), pointer :: mmrptr(:,:,:) - - ! These settings tell netcdf to write one timestep of data. (The - ! setting of start(4) inside the loop below tells netCDF which - ! timestep to write.) - count = (/ history%NX, history%NY, history%NZ, 1 /) - countl = (/ history%NX, history%NY, history%NZ+1, 1 /) - start = (/ 1, 1, 1, 1 /) - - ! Write the data. - start(4) = history%time - - ! Write out the atmospheric state. - call check(nf90_put_var(history%ncid, history%p_varid, p, start=start, count=count)) - call check(nf90_put_var(history%ncid, history%t_varid, t, start=start, count=count)) - call check(nf90_put_var(history%ncid, history%z_varid, z, start=start, count=count)) - call check(nf90_put_var(history%ncid, history%pl_varid, pl, start=start, count=countl)) - call check(nf90_put_var(history%ncid, history%zl_varid, zl, start=start, count=countl)) - - ! Write out the bins - mmrptr => mmr - do ielem = 1, history%NELEM - do ibin = 1, history%NBIN - call CARMA_GetBin(carma, ielem, ibin, mmrptr, rc) - call check(nf90_put_var(history%ncid, history%bin_varid(ielem,ibin), mmr, start=start, count=count)) - end do - end do - - ! Write out the gases - do igas = 1, history%NGAS - call CARMA_GetGas(carma, igas, mmrptr, rc) - call check(nf90_put_var(history%ncid, history%gas_varid(igas), mmr, start=start, count=count)) - end do - - ! Write out statistics? - - history%time = history%time+1 - end - - !! Close the history file. This causes netCDF to flush all buffers and make - !! sure your data are really written to disk. - subroutine History_Close(history)) - call check(nf90_close(history%ncid)) - return - end - - subroutine check(status) - integer, intent ( in) :: status - - if(status /= nf90_noerr) then - print *, trim(nf90_strerror(status)) - stop "Stopped" - end if - end -end diff --git a/CARMAchem_GridComp/CARMA/tests/carma_inittest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_inittest.F90 deleted file mode 100644 index 2d9523c6..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_inittest.F90 +++ /dev/null @@ -1,165 +0,0 @@ -!! This code is to test the error handling in the CARMA configuration and -!! initialization interface. -!! -!! @author Chuck Bardeen -!! @version Mar-2009 - -program carma_inittest - implicit none - - write(*,*) "CARMA Initializtion Test" - - call test_initialization() - - write(*,*) "Done" -end program - - -subroutine test_initialization() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carma_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 80 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 3 - integer, parameter :: NBIN = 20 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 72 - - real(kind=f), parameter :: dtime = 600._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_BLACKCARBON = 1 - integer, parameter :: I_ORGANICCARBON = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: rhoa(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i, j - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, ck0 - real(kind=f) :: r(NBIN) - real(kind=f) :: dr(NBIN) - real(kind=f) :: rmass(NBIN) - - -! write(*,*) "" - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - ! Define the groups - ! ----------------- -! write(*,*) " Add Group(s) ..." - rmrat = 2._f - rmin = 3.e-7_f - call CARMAGROUP_Create(carma, 1, 'mixed carbon', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 2, 'organic carbon', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements - ! ------------------- -! write(*,*) " Add Element(s) ..." - - ! Organic Carbon - call CARMAELEMENT_Create(carma, 1, 1, "bc in mixed", 1._f, I_INVOLATILE, I_BLACKCARBON, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - call CARMAELEMENT_Create(carma, 2, 1, "oc in mixed", 1._f, I_COREMASS, I_ORGANICCARBON, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - call CARMAELEMENT_Create(carma, 3, 2, "organic carbon", 1._f, I_INVOLATILE, I_ORGANICCARBON, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - - ! AddCoagulation Tests ... - write(*,*) "" - write(*,*) " Check for group too large in AddCoagulation ... Should Fail" - write(*,*) "" - call CARMA_AddCoagulation(carma, 4, 1, 1, I_COLLEC_DATA, rc) - if (rc /=0) then - rc = 0 - else - stop " *** FAILED ***" - endif - call CARMA_AddCoagulation(carma, 1, 4, 1, I_COLLEC_DATA, rc) - if (rc /=0) then - rc = 0 - else - stop " *** FAILED ***" - endif - call CARMA_AddCoagulation(carma, 1, 1, 4, I_COLLEC_DATA, rc) - if (rc /=0) then - rc = 0 - else - stop " *** FAILED ***" - endif - - ! Initialization Tests - write(*,*) "" - write(*,*) " Check for order of element list ... Should Fail" - write(*,*) "" - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) - call CARMA_AddCoagulation(carma, 2, 2, 2, I_COLLEC_DATA, rc) - call CARMA_AddCoagulation(carma, 2, 1, 1, I_COLLEC_DATA, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMA_Initialize(carma, rc, do_coag=.TRUE.) - if (rc /=0) then - rc = 0 - else - stop " *** FAILED ***" - endif - - - write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_mietest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_mietest.F90 deleted file mode 100644 index cefcc7d4..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_mietest.F90 +++ /dev/null @@ -1,185 +0,0 @@ -!! This code is to demonstrate the CARMA mie routines. -!! -!! Upon execution, a text file (carma_mietest.txt) is generated. -!! The text file can be read with the IDL procedure read_mietest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_mietest - implicit none - - write(*,*) "Mie Test" - - call test_mie() - - write(*,*) "Done" -end program - - -subroutine test_mie() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - - implicit none - - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 44 - - integer, parameter :: I_DUST = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - integer :: rc = 0 - - - integer :: i - integer :: ielem - integer :: iwave - integer :: ibin - integer :: igroup - integer, parameter :: lun = 42 - - real(kind=f) :: rmin, rmrat, rho - - real(kind=f) :: wave(NWAVE) - complex(kind=f) :: refidx(NWAVE) - real(kind=f) :: r_refidx(NWAVE) - real(kind=f) :: i_refidx(NWAVE) - real(kind=f) :: qext(NWAVE, NBIN) - real(kind=f) :: ssa(NWAVE, NBIN) - real(kind=f) :: asym(NWAVE, NBIN) - real(kind=f) :: r(NBIN) - - ! Set the wavelengths - data wave & - / 0.340_f, 0.380_f, 0.412_f, 0.440_f, 0.443_f, 0.490_f, & - 0.500_f, 0.531_f, 0.532_f, 0.551_f, 0.555_f, 0.667_f, & - 0.675_f, 0.870_f, 1.020_f, 1.640_f, 1.111_f, 1.333_f, & - 1.562_f, 1.770_f, 2.051_f, 2.210_f, 2.584_f, 3.284_f, & - 3.809_f, 4.292_f, 4.546_f, 4.878_f, 5.128_f, 5.405_f, & - 5.714_f, 6.061_f, 6.452_f, 6.897_f, 7.407_f, 8.333_f, & - 9.009_f, 10.309_f, 12.500_f, 13.889_f, 16.667_f, 20.000_f, & - 26.316_f, 35.714_f / - - data r_refidx & - / 1.343_f, 1.341_f, 1.339_f, 1.337_f, 1.337_f, 1.335_f, & - 1.335_f, 1.334_f, 1.334_f, 1.333_f, 1.333_f, 1.331_f, & - 1.331_f, 1.329_f, 1.327_f, 1.317_f, 1.327_f, 1.323_f, & - 1.319_f, 1.313_f, 1.305_f, 1.295_f, 1.252_f, 1.455_f, & - 1.362_f, 1.334_f, 1.326_f, 1.320_f, 1.308_f, 1.283_f, & - 1.278_f, 1.313_f, 1.326_f, 1.310_f, 1.293_f, 1.270_f, & - 1.227_f, 1.164_f, 1.173_f, 1.287_f, 1.415_f, 1.508_f, & - 1.541_f, 1.669_f / - - data i_refidx & - / 6.5e-9_f, 4.0e-9_f, 1.86e-9_f, 1.02e-9_f, 1.02e-9_f, 1.0e-9_f, & - 1.0e-9_f, 1.5e-9_f, 1.5e-9_f, 1.96e-9_f, 1.96e-9_f, 3.35e-8_f, & - 3.35e-8_f, 2.93e-7_f, 2.89e-6_f, 8.55e-5_f, 2.05E-06_f, 2.39E-05, & - 1.20E-04_f, 1.18E-04_f, 6.79E-04_f, 3.51E-04_f, 2.39E-03_f, 0.0442_f, & - 0.00339_f, 0.00833_f, 0.0139_f, 0.0125_f, 0.011_f, 0.015_f, & - 0.075_f, 0.086_f, 0.039_f, 0.035_f, 0.035_f, 0.038, & - 0.051_f, 0.161_f, 0.308_f, 0.39_f, 0.42_f, 0.395_f, & - 0.373_f, 0.5_f / - - -! write(*,*) "" -! write(*,*) "Mie Calculations" - - ! Open the output text file - open(unit=lun,file="carma_mietest.txt",status="unknown") - - ! Convert wavelength um -> cm - wave = wave * 1e-4_f - - ! Construct a complex refractive index. - refidx = cmplx(r_refidx, i_refidx) - - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create(carma, ", NBIN, ", ", NELEM, ", ", NGROUP, & -! ", ", NSOLUTE, ", ", NGAS, ", rc, 6) ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6, wave=wave) - if (rc < 0) stop " *** FAILED ***" - carma_ptr => carma - - - ! Define the group - rho = 2.65_f - rmrat = 4.32_f - rmin = 1e-6_f -! write(*,*) " Add Group(s) ..." - call CARMAGROUP_Create(carma, 1, "dust", rmin, rmrat, & - I_SPHERE, 1._f, .FALSE., rc, refidx=refidx, do_mie=.true.) - if (rc < 0) stop " *** FAILED ***" - - - ! Define the element -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc < 0) stop " *** FAILED ***" - - - ! Setup the CARMA processes to exercise -! write(*,*) " Initialize ..." - call CARMA_Initialize(carma, rc) - if (rc < 0) stop " *** FAILED ***" - - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc < 0) stop " *** FAILED ***" - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc < 0) stop " *** FAILED ***" - -! write(*,*) "" - - ! Write output for the falltest - write(lun,*) NGROUP, NWAVE, NBIN - - do iwave = 1, NWAVE - write(lun,'(i3,e10.3)') iwave, wave(iwave) - end do - - do igroup = 1, NGROUP - - call CARMAGROUP_Get(carma, igroup, rc, r=r, qext=qext, ssa=ssa, asym=asym) - - do ibin = 1, NBIN - write(lun,'(i3,e10.3)') ibin, r(ibin) - end do - - do iwave = 1, NWAVE - write(lun,'(i3,2e10.3)') iwave, refidx(iwave) - end do - - do iwave = 1, NWAVE - do ibin = 1, NBIN - write(lun,'(2i3,3(x,e10.3))') iwave, ibin, qext(iwave,ibin), ssa(iwave,ibin), asym(iwave,ibin) - end do - end do - end do - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_nuc2test.F90 b/CARMAchem_GridComp/CARMA/tests/carma_nuc2test.F90 deleted file mode 100644 index 4cb4d5da..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_nuc2test.F90 +++ /dev/null @@ -1,363 +0,0 @@ -!! This code is to test the aerosol freezing routines for ice. -!! -!! Upon execution, a text file (carma_nuctest.txt) is generated. -!! The text file can be read with the IDL procedure read_nuctest.pro. -!! -!! @author Chuck Bardeen -!! @version July-2009 - -program carma_nuctest - implicit none - - write(*,*) "Nucleation & Growth Test" - - call test_nuc_ttl() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, but an initial concentration -!! of sulfate drops at the smallest size, then allow that to nucleate ice -!! and then the ice can grow using a gas. The total mass of ice + gas should -!! be conserved. -subroutine test_nuc_ttl() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmasolute_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 3 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 1 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - integer, parameter :: nstep = 1000 - - - - real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 20._f -! real(kind=f), parameter :: dtime = 100._f -! real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 3000._f - - real(kind=f), parameter :: n = 100._f !! concentration (cm-3) - real(kind=f), parameter :: r0 = 2.5e-6_f !! mean radius (cm) - real(kind=f), parameter :: rsig = 1.5_f !! distribution width - - real(kind=f) :: rhop - real(kind=f) :: rhoa - - integer, parameter :: I_H2SO4 = 1 !! sulfate aerosol composition - integer, parameter :: I_ICE = 2 !! ice - integer, parameter :: I_WATER = 3 !! water - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: dr(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - - real(kind=f) :: RHO_CN = 1.78_f - - - ! Open the output text file - open(unit=lun,file="carma_nuc2test.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(dr(NBIN)) - allocate(rmass(NBIN)) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - - ! Define the groups - call CARMAGROUP_Create(carma, 1, "Sulfate IN", 1.e-7_f, 4._f, I_SPHERE, 1._f, .false., & - rc, do_wetdep=.true., do_drydep=.false., solfac=0.3_f, & - scavcoef=0.1_f, shortname="CRIN", do_mie=.false.) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 2, "Ice Crystal", 5.e-5_f, 4.0_f, I_SPHERE, 3._f, .true., & - rc, do_wetdep=.true., do_drydep=.false., solfac=0.3_f, & - scavcoef=0.1_f, shortname="CRICE", do_mie=.false.) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Sulfate IN", RHO_CN, I_INVOLATILE, I_H2SO4, rc, shortname="CRIN", isolute=1) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "Ice Crystal", RHO_I, I_VOLATILE, I_ICE, rc, shortname="CRICE") - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 3, 2, "Core Mass", RHO_CN, I_COREMASS, I_H2SO4, rc, shortname="CRCORE", isolute=1) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the Solutes - call CARMASOLUTE_Create(carma, 1, "Sulfuric Acid", 2, 98._f, 1.38_f, rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, I_GCOMP_H2O, rc, shortname='Q') - if (rc /=0) stop " *** FAILED ***" - - - ! Setup the CARMA processes to exercise growth and nucleation. - call CARMA_AddGrowth(carma, 2, 1, rc) - if (rc /=0) stop " *** FAILED ***" - -! call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_KOOP_2000, 0._f, rc, igas=1, ievp2elem=1) -! call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_TABAZADEH_2000, 0._f, rc, igas=1, ievp2elem=1) - call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_MOHLER_2010, 0._f, rc, igas=1, ievp2elem=1) -! call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_MURRAY_2010, 0._f, rc, igas=1, ievp2elem=1) - -! call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_KOOP_2000 + I_AF_MURRAY_2010, 0._f, rc, igas=1, ievp2elem=1) - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) " Initialize ..." - call CARMA_Initialize(carma, rc, do_grow=.true.) - if (rc /=0) stop " *** FAILED ***" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, dr=dr, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1) = 90._f * 100._f - zc(1) = 17000._f -! t(1) = 190._f -! t(1) = 205._f - t(1) = 220._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) -! mmr_gas(:,:) = 3.5e-6_f - mmr_gas(:,:) = 4e-5_f - - ! Put in an intial distribution of sulfates. - call CARMAGROUP_Get(carma, 1, rc, r=r, dr=dr, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(:,:,:) = 0._f - do ibin = 1, NBIN - rhop = (100._f * dr(ibin) / (sqrt(2._f*PI) * r(ibin) * log(rsig))) * exp(-((log(r(ibin)) - log(r0))**2) / (2._f*(log(rsig))**2)) * rmass(ibin) - - ! We don't know rhoa for the initial condition, but assume something typical of - ! the conditions at 100 mb and 200K. (mb -> dynes, since R_AIR in cgs) - rhoa = 100._f * 1000._f / (R_AIR) / (200._f) - - mmr(:,1,ibin) = rhop / rhoa - end do - - - write(lun,*) 0 - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0., 0. - end do - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), p(:), & - pl(:), t(:), rc) - if (rc /=0) stop " *** FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - call CARMASTATE_SetGas(cstate, igas, mmr_gas(:,igas), rc) - if (rc /=0) stop " *** FAILED ***" - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - if (rc /=0) stop " *** FAILED ***" - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** FAILED ***" - - ! Cool it down ... - t(1) = t(1) - .05_f - - if (mod(istep, 10) .eq. 0) then - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - - end if - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_nuctest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_nuctest.F90 deleted file mode 100644 index bc16cf34..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_nuctest.F90 +++ /dev/null @@ -1,419 +0,0 @@ -!! This code is to test the aerosol freezing routines for ice. -!! -!! Upon execution, a text file (carma_nuctest.txt) is generated. -!! The text file can be read with the IDL procedure read_nuctest.pro. -!! -!! @author Chuck Bardeen -!! @version July-2009 - -program carma_nuctest - implicit none - - write(*,*) "Nucleation & Growth Test" - - call test_nuc_ttl() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, but an initial concentration -!! of sulfate drops at the smallest size, then allow that to nucleate ice -!! and then the ice can grow using a gas. The total mass of ice + gas should -!! be conserved. -subroutine test_nuc_ttl() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmasolute_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 3 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 1 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - integer, parameter :: nstep = 100 - - - - real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 20._f -! real(kind=f), parameter :: dtime = 100._f -! real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 3000._f - - real(kind=f), parameter :: n = 100._f !! concentration (cm-3) - real(kind=f), parameter :: r0 = 2.5e-6_f !! mean radius (cm) - real(kind=f), parameter :: rsig = 1.5_f !! distribution width - - real(kind=f) :: rhop - real(kind=f) :: rhoa - - integer, parameter :: I_H2SO4 = 1 !! sulfate aerosol composition - integer, parameter :: I_ICE = 2 !! ice - integer, parameter :: I_WATER = 3 !! water - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: relhum(:,:,:) - real(kind=f), allocatable :: rho(:,:,:) - - real(kind=f), allocatable :: mmr(:,:,:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:,:,:) - real(kind=f), allocatable :: satliq(:,:,:,:) - real(kind=f), allocatable :: satice(:,:,:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: dr(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - - real(kind=f) :: RHO_CN = 1.78_f - - -! write(*,*) "" -! write(*,*) "Particle Growth - Simple" - - ! Open the output text file - open(unit=lun,file="carma_nuctest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX), rho(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(mmr_gas(NZ,NY,NX,NGAS)) - allocate(satliq(NZ,NY,NX,NGAS)) - allocate(satice(NZ,NY,NX,NGAS)) - allocate(r(NBIN)) - allocate(dr(NBIN)) - allocate(rmass(NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - - ! Define the groups -! write(*,*) " Add Group(s) ..." - call CARMAGROUP_Create(carma, 1, "Sulfate IN", 1.e-7_f, 4._f, I_SPHERE, 1._f, .false., & - rc, do_wetdep=.true., do_drydep=.false., solfac=0.3_f, & - scavcoef=0.1_f, shortname="CRIN", do_mie=.false.) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 2, "Ice Crystal", 5.e-5_f, 4.0_f, I_SPHERE, 3._f, .true., & - rc, do_wetdep=.true., do_drydep=.false., solfac=0.3_f, & - scavcoef=0.1_f, shortname="CRICE", do_mie=.false.) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "Sulfate IN", RHO_CN, I_INVOLATILE, I_H2SO4, rc, shortname="CRIN", isolute=1) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "Ice Crystal", RHO_I, I_VOLATILE, I_ICE, rc, shortname="CRICE") - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 3, 2, "Core Mass", RHO_CN, I_COREMASS, I_H2SO4, rc, shortname="CRCORE", isolute=1) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the Solutes - call CARMASOLUTE_Create(carma, 1, "Sulfuric Acid", 2, 98._f, 1.38_f, rc) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the gases -! write(*,*) " Add Gase(s) ..." - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, I_GCOMP_H2O, rc, shortname='Q') - if (rc /=0) stop " *** FAILED ***" - - - ! Setup the CARMA processes to exercise growth and nucleation. - call CARMA_AddGrowth(carma, 2, 1, rc) - if (rc /=0) stop " *** FAILED ***" - -! call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_KOOP_2000, 0._f, rc, igas=1, ievp2elem=1) - call CARMA_AddNucleation(carma, 1, 3, I_AERFREEZE + I_AF_KOOP_2000 + I_AF_MURRAY_2010, 0._f, rc, igas=1, ievp2elem=1) - if (rc /=0) stop " *** FAILED ***" - - -! write(*,*) " Initialize ..." - call CARMA_Initialize(carma, rc, do_grow=.true.) - if (rc /=0) stop " *** FAILED ***" - - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - - ! Print the Gas Information -! write(*,*) "" -! call dumpGas(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = -40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, dr=dr, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. - p(1,:,:) = 90._f * 100._f - zc(1,:,:) = 17000._f -! t(1,:,:) = 190._f - t(1,:,:) = 205._f - zl(1,:,:) = zc(1,:,:) - deltaz - zl(2,:,:) = zc(1,:,:) + deltaz - rho(1,:,:) = (p(1,:,:) * 10._f) / (R_AIR * t(1,:,:)) * (1e-3_f * 1e6_f) - pl(1,:,:) = p(1,:,:) - (zl(1,:,:) - zc(1,:,:)) * rho(1,:,:) * (GRAV / 100._f) - pl(2,:,:) = p(1,:,:) - (zl(2,:,:) - zc(1,:,:)) * rho(1,:,:) * (GRAV / 100._f) -! mmr_gas(:,:,:,:) = 3.5e-6_f - mmr_gas(:,:,:,:) = 4e-5_f - - ! Put in an intial distribution of sulfates. - call CARMAGROUP_Get(carma, 1, rc, r=r, dr=dr, rmass=rmass) - if (rc /=0) stop " *** FAILED ***" - mmr(:,:,:,:,:) = 0._f - do ibin = 1, NBIN - rhop = (100._f * dr(ibin) / (sqrt(2._f*PI) * r(ibin) * log(rsig))) * exp(-((log(r(ibin)) - log(r0))**2) / (2._f*(log(rsig))**2)) * rmass(ibin) - - ! We don't know rhoa for the initial condition, but assume something typical of - ! the conditions at 100 mb and 200K. (mb -> dynes, since R_AIR in cgs) - rhoa = 100._f * 1000._f / (R_AIR) / (200._f) - - mmr(:,:,:,1,ibin) = rhop / rhoa - end do - - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - write(lun,*) 0 - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,NY,NX,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,NY,NX,igas)), 0., 0. - end do - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - if (rc /=0) stop " *** FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - if (rc /=0) stop " *** FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - call CARMASTATE_SetGas(cstate, igas, & - mmr_gas(:,iy,ix,igas), rc) - if (rc /=0) stop " *** FAILED ***" - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - if (rc /=0) stop " *** FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,iy,ix,igas), rc, & - satliq=satliq(:,iy,ix,igas), & - satice=satice(:,iy,ix,igas)) - if (rc /=0) stop " *** FAILED ***" - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - if (rc /=0) stop " *** FAILED ***" - - enddo - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,NY,NX,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,NY,NX,igas)), satliq(1,NY,NX,igas), satice(1,NY,NX,igas) - end do - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" - - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_pheattest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_pheattest.F90 deleted file mode 100644 index dee47e3d..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_pheattest.F90 +++ /dev/null @@ -1,359 +0,0 @@ -!! This code is to test the impact of particle heating upon -!! condensational growth. -!! -!! Upon execution, a text file (carma_pheattest.txt) is generated. -!! The text file can be read with the IDL procedure read_pheattest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_pheattest - implicit none - - write(*,*) "Particle Heating Test" - - call test_grow_pheat() - - write(*,*) "Done" -end program - -!! Just have one grid box. In that grid box, put an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mas of drops + gas should be conserved. -subroutine test_grow_pheat() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 28 ! PMC -! integer, parameter :: NBIN = 18 ! TTL - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 1 - integer, parameter :: NWAVE = 4 - integer, parameter :: LUNOPRT = 6 - integer, parameter :: nstep = 50 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f - real(kind=f), parameter :: dtime = 500._f -! real(kind=f), parameter :: dtime = 1000._f -! real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: rhmin = .4_f - real(kind=f), parameter :: rhmax = 1.05_f - real(kind=f), parameter :: zmin = 3000._f - - - integer, parameter :: I_H2O = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: dtpart(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - real(kind=f), allocatable :: wave(:) ! wavelength centers (cm) - real(kind=f), allocatable :: dwave(:) ! wavelength width (cm) - real(kind=f), allocatable :: radint(:,:) ! radiative intensity (W/m2/sr/cm) - complex(kind=f), allocatable :: refidx(:) ! refractive index - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: drh - - -! write(*,*) "" -! write(*,*) "Particle Growth - Simple" - - ! Open the output text file - open(unit=lun,file="carma_pheattest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ), rho(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(dtpart(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - allocate(wave(NWAVE), dwave(NWAVE), refidx(NWAVE), radint(NZ,NWAVE)) - - - ! Define the band centers and widths (in cm) and the refractive indices. - wave(:) = (/ 0.26e-4_f, 0.75e-4_f, 3.0e-4_f, 10e-4_f/) - dwave(:) = (/ 0.48e-4_f, 0.5e-4_f, 4.0e-4_f, 10e-4_f/) - refidx(:) = (/ (1.35090_f, 2e-11_f), (1.30590_f, 5.87000e-08_f), (1.03900, 4.38000e-01_f), (1.19260_f, 5.00800e-02_f) /) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT, wave=wave, dwave=dwave) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - carma_ptr => carma - - - ! Define the groups - - ! PMC - rmin = 2e-8_f - rmrat = 2.6 - - ! TTL -! rmin = 1e-4_f -! rmrat = 2._f - call CARMAGROUP_Create(carma, 1, "Ice Crystal", rmin, rmrat, I_SPHERE, 1._f, .TRUE., rc, refidx=refidx, do_mie=.true.) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Ice Crystal", RHO_I, I_VOLATILE, I_H2O, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, I_GCOMP_H2O, rc) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 1, rc) - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_pheat=.true., do_pheatatm=.true., do_thermo=.true.) -! call CARMA_Initialize(carma, rc, do_grow=.true., do_pheat=.true.) -! call CARMA_Initialize(carma, rc, do_grow=.true.) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, 3.5e-6 g/g, 5 um, 0.1/cm^3. -! p(1) = 90._f * 100._f -! zc(1) = 17000._f -! t(1) = 190._f -! zl(1) = zc(1) - deltaz -! zl(2) = zc(1) + deltaz -! rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) -! pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) -! pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) -! mmr_gas(1,1) = 3.5e-6_f -! mmr(1,1,7) = (100._f * rmass(7) * (1e-3_f * 1e6_f)) / rho(1) -! mmr(1,1,8) = (100._f * rmass(8) * (1e-3_f * 1e6_f)) / rho(1) - - - ! Try Mesopause Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 0.005 hPa, 150 K, 82.5 km, 5e-6 g/g, 0.1 nm, 100/cm^3. - p(1) = 0.005_f * 100._f - zc(1) = 82500._f - t(1) = 140._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - mmr_gas(1,1) = 4e-6_f - mmr(1,1,7) = (100._f * rmass(7) * (1e-3_f * 1e6_f)) / rho(1) - mmr(1,1,8) = (100._f * rmass(8) * (1e-3_f * 1e6_f)) / rho(1) - - ! A crude estimate of band radiative intensity per band (in W/m2/sr/cm). Note the band fluxes - ! need to be scaled by pi to convert to intensity and need to be scaled by - ! the band width. -! radint(1,:) = (/ 171._f, 171._f, 100._f, 300._f/) ! TTL - radint(1,:) = (/ 171._f, 171._f, 60._f, 180._f/) ! Mesopause - - radint(1,:) = radint(1, :) / 2._f / PI / dwave(:) - - - write(lun,*) 0 - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)), real(dtpart(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0., 0. - end do - - write(lun,'(1e12.3)') real(t(1)) - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), p(:), & - pl(:), t(:), rc, radint=radint) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,ielem,ibin), rc) - end do - end do - - ! Send the gas mmrs to CARMA - do igas = 1, NGAS - call CARMASTATE_SetGas(cstate, igas, & - mmr_gas(:,igas), rc) - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,ielem,ibin), rc, dtpart=dtpart(:,ielem,ibin)) - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:)) - - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,2e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)), real(dtpart(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - - write(lun,'(1e12.3)') real(t(1)) - end do ! time loop - - ! Close the output file - close(unit=lun) - - if (rc /=0) stop " *** Stepping FAILED ***" - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_scfalltest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_scfalltest.F90 deleted file mode 100644 index 7af71f7b..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_scfalltest.F90 +++ /dev/null @@ -1,423 +0,0 @@ -!! This code is to demonstrate the CARMA sedimentation routines -!! using a constant fall velocity. Cartesian coordinates are used -!! in the vetical to represent a hybrid grid. -!! -!! Upon execution, a text file (carma_scfalltest.txt) is generated. -!! The text file can be read with the IDL procedure read_sigmafalltest.pro. -!! -!! @author Chuck Bardeen -!! @version Aug-2011 - - -program carma_scfalltest - implicit none - - write(*,*) "Sedimentation Test (Cartesian representation of Hybrid Coordinates)" - - call test_sedimentation_sigma() - - write(*,*) "Done" -end program - - -subroutine test_sedimentation_sigma() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 72 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 8 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 100*6 - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - - real(kind=f), allocatable, target :: mmr(:,:,:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - logical :: do_explised = .false. -! logical :: do_explised = .true. - real(kind=f) :: vf_const = 2.0_f -! real(kind=f) :: vf_const = 0.0_f - - integer :: omp_get_num_threads, omp_get_max_threads, & - omp_get_thread_num - - - real(kind=f) :: a72(73), b72(73), t72(72), ze(73) - real(kind=f) :: hyai66(67), hybi66(67), hyam66(66), hybm66(66) - real(kind=f) :: hyai125(126), hybi125(126), hyam125(125), hybm125(125) - real(kind=f) :: a(NZP1), b(NZP1), dz(NZ), rhoa(NZ) - real(kind=f), parameter :: ps = 98139.8 ! GEOS-5, Omaha, NE, 20090101 - - data a72 / & - 1.0000000, 2.0000002, 3.2700005, 4.7585009, 6.6000011, & - 8.9345014, 11.970302, 15.949503, 21.134903, 27.852606, & - 36.504108, 47.580610, 61.677911, 79.513413, 101.94402, & - 130.05102, 165.07903, 208.49704, 262.02105, 327.64307, & - 407.65710, 504.68010, 621.68012, 761.98417, 929.29420, & - 1127.6902, 1364.3402, 1645.7103, 1979.1604, 2373.0405, & - 2836.7806, 3381.0007, 4017.5409, 4764.3911, 5638.7912, & - 6660.3412, 7851.2316, 9236.5722, 10866.302, 12783.703, & - 15039.303, 17693.003, 20119.201, 21686.501, 22436.301, & - 22389.800, 21877.598, 21214.998, 20325.898, 19309.696, & - 18161.897, 16960.896, 15625.996, 14290.995, 12869.594, & - 11895.862, 10918.171, 9936.5219, 8909.9925, 7883.4220, & - 7062.1982, 6436.2637, 5805.3211, 5169.6110, 4533.9010, & - 3898.2009, 3257.0809, 2609.2006, 1961.3106, 1313.4804, & - 659.37527, 4.8048257, 0.0000000 / - - data b72 / & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 8.1754130e-09, 0.0069600246, 0.028010041, 0.063720063, & - 0.11360208, 0.15622409, 0.20035011, 0.24674112, 0.29440312, & - 0.34338113, 0.39289115, 0.44374018, 0.49459020, 0.54630418, & - 0.58104151, 0.61581843, 0.65063492, 0.68589990, 0.72116594, & - 0.74937819, 0.77063753, 0.79194696, 0.81330397, 0.83466097, & - 0.85601798, 0.87742898, 0.89890800, 0.92038701, 0.94186501, & - 0.96340602, 0.98495195, 1.0000000 / - - ! The WACCM 66 level hybrid coefficients. - data hyai66 /& - 4.5005e-09, 7.4201e-09, 1.22337e-08, 2.017e-08, 3.32545e-08, & - 5.48275e-08, 9.0398e-08, 1.4904e-07, 2.4572e-07, 4.05125e-07, 6.6794e-07, & - 1.101265e-06, 1.81565e-06, 2.9935e-06, 4.963e-06, 8.150651e-06, & - 1.3477e-05, 2.2319e-05, 3.67965e-05, 6.0665e-05, 9.91565e-05, 0.00015739, & - 0.00023885, 0.0003452, 0.000475135, 0.000631805, 0.000829155, 0.00108274, & - 0.00140685, 0.00181885, 0.0023398, 0.00299505, 0.0038147, 0.00483445, & - 0.00609635, 0.00764935, 0.0095501, 0.011864, 0.0146655, 0.018038, & - 0.0220755, 0.0268825, 0.0325735, 0.039273, 0.0471145, 0.0562405, & - 0.0668005, 0.0789485, 0.07731271, 0.07590131, 0.07424086, 0.07228743, & - 0.06998932, 0.06728574, 0.06410509, 0.06036322, 0.05596111, 0.05078225, & - 0.0446896, 0.03752191, 0.02908949, 0.02084739, 0.01334443, 0.00708499, & - 0.00252136, 0, 0 / - - data hybi66 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0.01505309, 0.03276228, 0.05359622, 0.07810627, 0.1069411, 0.1408637, & - 0.180772, 0.227722, 0.2829562, 0.3479364, 0.4243822, 0.5143168, & - 0.6201202, 0.7235355, 0.8176768, 0.8962153, 0.9534761, 0.9851122, 1 / - - data hyam66 /& - 5.9603e-09, 9.8269e-09, 1.620185e-08, 2.671225e-08, 4.4041e-08, & - 7.261275e-08, 1.19719e-07, 1.9738e-07, 3.254225e-07, 5.365325e-07, & - 8.846025e-07, 1.4584575e-06, 2.404575e-06, 3.97825e-06, 6.5568255e-06, & - 1.08138255e-05, 1.7898e-05, 2.955775e-05, 4.873075e-05, 7.991075e-05, & - 0.00012827325, 0.00019812, 0.000292025, 0.0004101675, 0.00055347, & - 0.00073048, 0.0009559475, 0.001244795, 0.00161285, 0.002079325, & - 0.002667425, 0.003404875, 0.004324575, 0.0054654, 0.00687285, & - 0.008599725, 0.01070705, 0.01326475, 0.01635175, 0.02005675, 0.024479, & - 0.029728, 0.03592325, 0.04319375, 0.0516775, 0.0615205, 0.0728745, & - 0.078130605, 0.07660701, 0.075071085, 0.073264145, 0.071138375, & - 0.06863753, 0.065695415, 0.062234155, 0.058162165, 0.05337168, & - 0.047735925, 0.041105755, 0.0333057, 0.02496844, 0.01709591, 0.01021471, & - 0.004803175, 0.00126068, 0 / - - data hybm66 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0.007526545, 0.023907685, 0.04317925, 0.065851245, 0.092523685, & - 0.1239024, 0.16081785, 0.204247, 0.2553391, 0.3154463, 0.3861593, & - 0.4693495, 0.5672185, 0.67182785, 0.77060615, 0.85694605, 0.9248457, & - 0.96929415, 0.9925561 / - - ! The WACCM 125 level hybrid coefficients. - data hyai125 /& - 4.5005e-09, 7.4247466e-09, 1.2236616e-08, 2.0143422e-08, & - 3.3006333e-08, 5.317267e-08, 8.160345e-08, 1.1600713e-07, 1.5343022e-07, & - 1.9154761e-07, 2.2843057e-07, 2.648671e-07, 3.0222616e-07, 3.3995556e-07, & - 3.7754795e-07, 4.1533548e-07, 4.5535556e-07, 4.9759899e-07, & - 5.4204611e-07, 5.8866705e-07, 6.374221e-07, 6.8881999e-07, 7.4381186e-07, & - 8.0260573e-07, 8.6541864e-07, 9.3247687e-07, 1.0040162e-06, 1.080282e-06, & - 1.1619754e-06, 1.2496277e-06, 1.3436572e-06, 1.4445101e-06, & - 1.5526629e-06, 1.6686237e-06, 1.7929346e-06, 1.9263614e-06, & - 2.0696043e-06, 2.2233774e-06, 2.3884455e-06, 2.5656287e-06, & - 2.7558058e-06, 2.9599187e-06, 3.1791492e-06, 3.4146519e-06, & - 3.6676372e-06, 3.9394056e-06, 4.2313546e-06, 4.544986e-06, 4.8819134e-06, & - 5.2440647e-06, 5.6334087e-06, 6.0520116e-06, 6.5020985e-06, & - 6.9860655e-06, 7.5064932e-06, 8.0661613e-06, 8.6701024e-06, & - 9.3223836e-06, 1.002711e-05, 1.0788756e-05, 1.1612197e-05, 1.2502751e-05, & - 1.3466215e-05, 1.4531221e-05, 1.5710984e-05, 1.7020447e-05, & - 1.8476809e-05, 2.0099909e-05, 2.1912687e-05, 2.4079993e-05, 2.673686e-05, & - 3.0029676e-05, 3.416049e-05, 3.9624245e-05, 4.7318986e-05, 5.8509432e-05, & - 7.3993635e-05, 9.5598711e-05, 0.00012447961, 0.00016290808, & - 0.00021346928, 0.00027992192, 0.00036715931, 0.00048162804, 0.000631805, & - 0.000829155, 0.00108274, 0.00140685, 0.00181885, 0.0023398, 0.00299505, & - 0.0038147, 0.00483445, 0.00609635, 0.00764935, 0.0095501, 0.011864, & - 0.0146655, 0.018038, 0.0220755, 0.0268825, 0.0325735, 0.039273, & - 0.0471145, 0.0562405, 0.0668005, 0.0789485, 0.07731271, 0.07590131, & - 0.07424086, 0.07228743, 0.06998932, 0.06728574, 0.06410509, 0.06036322, & - 0.05596111, 0.05078225, 0.0446896, 0.03752191, 0.02908949, 0.02084739, & - 0.01334443, 0.00708499, 0.00252136, 0, 0 / - - data hybi125 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01505309, 0.03276228, 0.05359622, & - 0.07810627, 0.1069411, 0.1408637, 0.180772, 0.227722, 0.2829562, & - 0.3479364, 0.4243822, 0.5143168, 0.6201202, 0.7235355, 0.8176768, & - 0.8962153, 0.9534761, 0.9851122, 1 / - - data hyam125 /& - 5.9626233e-09, 9.8306813e-09, 1.6190019e-08, 2.65748775e-08, & - 4.30895015e-08, 6.738806e-08, 9.880529e-08, 1.34718675e-07, & - 1.72488915e-07, 2.0998909e-07, 2.46648835e-07, 2.8354663e-07, & - 3.2109086e-07, 3.58751755e-07, 3.96441715e-07, 4.3534552e-07, & - 4.76477275e-07, 5.1982255e-07, 5.6535658e-07, 6.13044575e-07, & - 6.63121045e-07, 7.16315925e-07, 7.73208795e-07, 8.34012185e-07, & - 8.98947755e-07, 9.68246535e-07, 1.0421491e-06, 1.1211287e-06, & - 1.20580155e-06, 1.29664245e-06, 1.39408365e-06, 1.4985865e-06, & - 1.6106433e-06, 1.73077915e-06, 1.859648e-06, 1.99798285e-06, & - 2.14649085e-06, 2.30591145e-06, 2.4770371e-06, 2.66071725e-06, & - 2.85786225e-06, 3.06953395e-06, 3.29690055e-06, 3.54114455e-06, & - 3.8035214e-06, 4.0853801e-06, 4.3881703e-06, 4.7134497e-06, & - 5.06298905e-06, 5.4387367e-06, 5.84271015e-06, 6.27705505e-06, & - 6.744082e-06, 7.24627935e-06, 7.78632725e-06, 8.36813185e-06, & - 8.996243e-06, 9.6747468e-06, 1.0407933e-05, 1.12004765e-05, & - 1.2057474e-05, 1.2984483e-05, 1.3998718e-05, 1.51211025e-05, & - 1.63657155e-05, 1.7748628e-05, 1.9288359e-05, 2.1006298e-05, & - 2.299634e-05, 2.54084265e-05, 2.8383268e-05, 3.2095083e-05, & - 3.68923675e-05, 4.34716155e-05, 5.2914209e-05, 6.62515335e-05, & - 8.4796173e-05, 0.0001100391605, 0.000143693845, 0.00018818868, & - 0.0002466956, 0.000323540615, 0.000424393675, 0.00055671652, 0.00073048, & - 0.0009559475, 0.001244795, 0.00161285, 0.002079325, 0.002667425, & - 0.003404875, 0.004324575, 0.0054654, 0.00687285, 0.008599725, 0.01070705, & - 0.01326475, 0.01635175, 0.02005675, 0.024479, 0.029728, 0.03592325, & - 0.04319375, 0.0516775, 0.0615205, 0.0728745, 0.078130605, 0.07660701, & - 0.075071085, 0.073264145, 0.071138375, 0.06863753, 0.065695415, & - 0.062234155, 0.058162165, 0.05337168, 0.047735925, 0.041105755, & - 0.0333057, 0.02496844, 0.01709591, 0.01021471, 0.00480317499999999, & - 0.00126067999999999, 0 / - - data hybm125 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.35614355487735e-18, 0.007526545, & - 0.023907685, 0.04317925, 0.065851245, 0.092523685, 0.1239024, 0.16081785, & - 0.204247, 0.2553391, 0.3154463, 0.3861593, 0.4693495, 0.5672185, & - 0.67182785, 0.77060615, 0.85694605, 0.9248457, 0.96929415, 0.9925561 / - - ! Do the GEOS case. - a = a72 - b = b72 - - ! Do the WACCM 66 case. -! a = hyai66 * 10000_f -! b = hybi66 - - ! Do the WACCM 125 case. -! a = hyai125 * 10000_f -! b = hybi125 - -! do i = 1, NZP1 -! write(*,*) a(i), b(i)*p0, a(i) + b(i)*p0 -! end do - - data t72 / & - 212.161, 210.233, 217.671, 225.546, 232.222, 237.921, 241.836, 243.246, & - 250.032, 265.518, 262.335, 255.389, 253.560, 253.848, 252.496, 247.806, & - 243.108, 237.288, 230.839, 226.233, 221.617, 218.474, 218.014, 218.881, & - 220.297, 222.262, 224.564, 224.059, 221.671, 220.732, 220.200, 218.445, & - 217.424, 215.322, 212.882, 211.080, 210.573, 210.942, 212.593, 214.064, & - 213.704, 209.045, 211.286, 218.995, 227.209, 235.050, 241.144, 246.328, & - 250.606, 254.079, 257.222, 260.012, 262.534, 265.385, 267.348, 267.998, & - 267.964, 267.827, 268.075, 268.397, 268.440, 268.371, 268.302, 268.203, & - 267.943, 266.305, 265.331, 265.628, 266.371, 267.219, 267.981, 268.379 / - data ze / & - 78126.3, 73819.6, 70792.7, 68401.3, 66240.5, 64180.9, 62142.8, 60110.2, 58104.9, 56084.0, 53980.6, & - 51944.7, 50003.9, 48117.8, 46270.4, 44469.8, 42739.0, 41076.6, 39488.8, 37977.8, 36530.2, 35144.5, & - 33810.5, 32511.3, 31238.9, 29990.5, 28750.5, 27517.4, 26306.8, 25128.6, 23974.7, 22842.9, 21739.4, & - 20653.8, 19591.3, 18553.2, 17536.4, 16534.3, 15530.5, 14518.7, 13500.1, 12483.0, 11491.9, 10495.9, & - 9466.47, 8427.35, 7712.39, 7048.43, 6429.18, 5849.30, 5304.75, 4791.16, 4305.46, 3844.44, 3404.89, & - 3122.98, 2850.14, 2586.45, 2331.56, 2084.55, 1892.20, 1750.98, 1612.29, 1476.05, 1342.20, 1210.71, & - 1082.17, 956.177, 832.052, 709.535, 588.531, 469.023, 350.157 / - - - ! Open the output text file - open(unit=lun,file="carma_scfalltest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - carma_ptr => carma - - ! Define the group - rho = 2.65_f -! rmrat = (100._f**3)**(1._f/(NBIN*1._f)) -! rmin = 1.e-5_f * ((1._f+rmrat)/2._f)**(1._f/3._f) - rmrat = 2.0 - rmin = 7.5e-4_f - call CARMAGROUP_Create(carma, 1, 'dust', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - ! Define the element - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., vf_const=vf_const, do_explised=do_explised) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = 40.0_f - lon = -105.0_f - - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - - ! Set from data. - pl(:) = a72(NZP1:1:-1) + b72(NZP1:1:-1)*ps - zl(:) = ze(NZP1:1:-1) - t(:) = t72(NZ:1:-1) - - - ! Calculate based upon the known fields (edges to middle, ...) - p(:) = (pl(1:NZ) + pl(2:NZP1)) / 2._f - zc(:) = (zl(1:NZ) + zl(2:NZP1)) / 2._f - - rhoa(:) = p(:) / 287._f / t(:) - dz(:) = zl(2:NZP1) - zl(1:NZ) - - ! Put a blob in the model first bin at 8 km - mmr(:,:,:) = 0._f - mmr(:,1,1) = 1e-10_f * exp(-((zc(:) - 8.e3_f) / 3.e3_f) ** 2) / rhoa(:) - - ! Write output for the falltest - write(lun,*) NZ - do i = 1, NZ - write(lun,'(i3,2f10.1)') i, zc(i), dz(i) - end do - - write(lun,*) 0 - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') i, real(mmr(i,1,1)), real(mmr(i,1,1)*rhoa(i)) - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_LL, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:)) - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') i, real(mmr(i,1,1)), real(mmr(i,1,1)*rhoa(i)) - end do - - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_sigmadrydeptest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_sigmadrydeptest.F90 deleted file mode 100644 index 8f49266c..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_sigmadrydeptest.F90 +++ /dev/null @@ -1,337 +0,0 @@ -!! This code is to test the dry deposition routine by comparing -!! sedimentation with and without dry deposition. The model is -!! using sigma coordinates. -!! -!! Upon execution, a text file (carma_drydeptest.txt) is generated. -!! The text file can be read with the IDL procedure read_drydeptest.pro. -!! -!! @author Tianyi Fan -!! @version Apr-2011 - - -program carma_sigmadrydeptest - implicit none - - write(*,*) "Sedimentation Test (Sigma Coordinates)" - - call test_sigmadrydep() - - write(*,*) "Done" -end program - - -!! Create 2 particle groups, one for particles with dry deposition -!! using arbitary values of ram(aerodynamic resistance) and fv (friction velocity) -!! the other for particles without dry deposition, to see if they make a difference. -subroutine test_sigmadrydep() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 72 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 2 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 2 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 100*6 - - - ! To keep the file processing simpler, only one bin will get written out - ! to the output file. - integer, parameter :: OUTBIN = 14 - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - - integer, parameter :: I_PART = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - - real(kind=f), allocatable, target :: mmr(:,:,:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: ielem - integer :: ibin - integer :: igroup - integer, parameter :: lun = 42 - integer, parameter :: lun1 = 41 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - - real(kind=f) :: a72(73), b72(73), t72(72), ze(73) - real(kind=f) :: dz(NZ), zm(NZ), rhoa(NZ) - real(kind=f), parameter :: ps = 98139.8 ! GEOS-5, Omaha, NE, 20090101 - - real(kind=f) :: lndfv = 1.5_f ! land friction velocity - real(kind=f) :: lndram = 60._f ! land aerodynamic resistance - real(kind=f) :: lndfrac = 0.0_f ! land fraction - - real(kind=f) :: ocnfv = 2.0_f ! ocean friction velocity - real(kind=f) :: ocnram = 40._f ! ocean aerodynamic resistance - real(kind=f) :: ocnfrac = 1.0_f ! ocean fraction - - real(kind=f) :: icefv = 2.5_f ! ice friction velocity - real(kind=f) :: iceram = 20._f ! ice aerodynamic resistance - real(kind=f) :: icefrac = 0.0_f ! ice fraction - - real(kind=f) :: vdry(NBIN, NGROUP) - - data a72 / & - 1.0000000, 2.0000002, 3.2700005, 4.7585009, 6.6000011, & - 8.9345014, 11.970302, 15.949503, 21.134903, 27.852606, & - 36.504108, 47.580610, 61.677911, 79.513413, 101.94402, & - 130.05102, 165.07903, 208.49704, 262.02105, 327.64307, & - 407.65710, 504.68010, 621.68012, 761.98417, 929.29420, & - 1127.6902, 1364.3402, 1645.7103, 1979.1604, 2373.0405, & - 2836.7806, 3381.0007, 4017.5409, 4764.3911, 5638.7912, & - 6660.3412, 7851.2316, 9236.5722, 10866.302, 12783.703, & - 15039.303, 17693.003, 20119.201, 21686.501, 22436.301, & - 22389.800, 21877.598, 21214.998, 20325.898, 19309.696, & - 18161.897, 16960.896, 15625.996, 14290.995, 12869.594, & - 11895.862, 10918.171, 9936.5219, 8909.9925, 7883.4220, & - 7062.1982, 6436.2637, 5805.3211, 5169.6110, 4533.9010, & - 3898.2009, 3257.0809, 2609.2006, 1961.3106, 1313.4804, & - 659.37527, 4.8048257, 0.0000000 / - - data b72 / & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 8.1754130e-09, 0.0069600246, 0.028010041, 0.063720063, & - 0.11360208, 0.15622409, 0.20035011, 0.24674112, 0.29440312, & - 0.34338113, 0.39289115, 0.44374018, 0.49459020, 0.54630418, & - 0.58104151, 0.61581843, 0.65063492, 0.68589990, 0.72116594, & - 0.74937819, 0.77063753, 0.79194696, 0.81330397, 0.83466097, & - 0.85601798, 0.87742898, 0.89890800, 0.92038701, 0.94186501, & - 0.96340602, 0.98495195, 1.0000000 / - - data t72 / & - 212.161, 210.233, 217.671, 225.546, 232.222, 237.921, 241.836, 243.246, & - 250.032, 265.518, 262.335, 255.389, 253.560, 253.848, 252.496, 247.806, & - 243.108, 237.288, 230.839, 226.233, 221.617, 218.474, 218.014, 218.881, & - 220.297, 222.262, 224.564, 224.059, 221.671, 220.732, 220.200, 218.445, & - 217.424, 215.322, 212.882, 211.080, 210.573, 210.942, 212.593, 214.064, & - 213.704, 209.045, 211.286, 218.995, 227.209, 235.050, 241.144, 246.328, & - 250.606, 254.079, 257.222, 260.012, 262.534, 265.385, 267.348, 267.998, & - 267.964, 267.827, 268.075, 268.397, 268.440, 268.371, 268.302, 268.203, & - 267.943, 266.305, 265.331, 265.628, 266.371, 267.219, 267.981, 268.379 / - - data ze / & - 78126.3, 73819.6, 70792.7, 68401.3, 66240.5, 64180.9, 62142.8, 60110.2, 58104.9, 56084.0, 53980.6, & - 51944.7, 50003.9, 48117.8, 46270.4, 44469.8, 42739.0, 41076.6, 39488.8, 37977.8, 36530.2, 35144.5, & - 33810.5, 32511.3, 31238.9, 29990.5, 28750.5, 27517.4, 26306.8, 25128.6, 23974.7, 22842.9, 21739.4, & - 20653.8, 19591.3, 18553.2, 17536.4, 16534.3, 15530.5, 14518.7, 13500.1, 12483.0, 11491.9, 10495.9, & - 9466.47, 8427.35, 7712.39, 7048.43, 6429.18, 5849.30, 5304.75, 4791.16, 4305.46, 3844.44, 3404.89, & - 3122.98, 2850.14, 2586.45, 2331.56, 2084.55, 1892.20, 1750.98, 1612.29, 1476.05, 1342.20, 1210.71, & - 1082.17, 956.177, 832.052, 709.535, 588.531, 469.023, 350.157 / - - - ! Open the output text file - open(unit=lun,file="carma_sigmadrydeptest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** CARMA_Create FAILED ***, rc=", rc - carma_ptr => carma - - ! Define the group - rho = 2.65_f - rmrat = 4.32_f - rmin = 1e-6_f - - call CARMAGROUP_Create(carma, 1, "DryDep", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc, & - do_mie = .FALSE., do_wetdep=.FALSE., do_drydep=.TRUE., do_vtran=.TRUE., shortname="DD") - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - call CARMAGROUP_Create(carma, 2, "NoDryDep", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc, & - do_mie = .FALSE., do_wetdep=.FALSE., do_drydep=.FALSE., do_vtran=.TRUE., shortname="NDD") - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - ! Define the element - call CARMAELEMENT_Create(carma, 1, 1, "DryDep", rho, I_INVOLATILE, I_PART, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "NoDryDep", rho, I_INVOLATILE, I_PART, rc) - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Setup the CARMA processes to exercise - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., do_drydep=.TRUE.) - if (rc /=0) write(*, *) " *** CARMA_Initialize FAILED ***, rc=", rc - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = 40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Layer edges - pl(:) = a72(:) + b72(:)*ps - zl(:) = a72(:) / 1e5_f + b72(:) - t(:) = t72(:) - - - ! Calculate based upon the known fields (edges to middle, ...) - p(:) = (pl(1:NZ) + pl(2:NZP1)) / 2._f - zc(:) = (zl(1:NZ) + zl(2:NZP1)) / 2._f - - rhoa(:) = p(:) / 287._f / t(:) - dz(:) = zl(2:NZP1) - zl(1:NZ) - zm(:) = (ze(2:NZP1) + ze(1:NZ)) / 2._f - dz(:) = ze(1:NZ) - ze(2:NZP1) - - - ! Put a blob in the model for all elements and bins at 8 km. - mmr(:,:,:) = 0._f - do ielem = 1, NELEM - do ibin = 1, NBIN - mmr(:,ielem,ibin) = 1e-10_f * exp(-((zm(:) - 8.e3_f) / 3.e3_f)**2) / rhoa(:) - end do - end do - - - ! Write output for the test - write(lun,*) NZ, NELEM - do i = 1, NZ - write(lun,'(i3,2f10.1)') i, zm(i), dz(i) - end do - - write(lun,*) 0 - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') ielem, i, real(mmr(i,ielem,OUTBIN)), real(mmr(i,ielem,OUTBIN)*rhoa(i)) - end do - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_HYBRID, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc, & - lndfv=lndfv, ocnfv=ocnfv, icefv=icefv, & - lndram=lndram, ocnram=ocnram, iceram=iceram, & - lndfrac=lndfrac, ocnfrac=ocnfrac, icefrac=icefrac) - if (rc /=0) stop " *** CARMASTATE_Step FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc, vd=vdry(ibin,ielem)) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** CARMASTATE_GetState FAILED ***" - - ! Write output for the test - write(lun,'(f12.0)') istep*dtime - - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') ielem, i, real(mmr(i,ielem,OUTBIN)), real(mmr(i,ielem,OUTBIN)*p(i) / 287._f / t(i)) - end do - end do - end do ! time loop - - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - ! Close the output file - close(unit=lun) - - - ! write the dry deposition velocity - open(unit=lun1,file="carma_sigmavdry.txt",status="unknown") - - write(lun1, *) NGROUP - do igroup = 1, NGROUP - write(lun1,*) igroup, real(vdry(:, igroup)) - end do - - close(unit=lun1) - - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** CARMA_Destroy FAILED ***, rc=", rc -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_sigmafalltest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_sigmafalltest.F90 deleted file mode 100644 index 42c584fb..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_sigmafalltest.F90 +++ /dev/null @@ -1,519 +0,0 @@ -!! This code is to demonstrate the CARMA sedimentation routines -!! using a constant fall velocity. Sigma coordinates are used -!! by the test. -!! -!! Upon execution, a text file (carma_sigmafalltest.txt) is generated. -!! The text file can be read with the IDL procedure read_sigmafalltest.pro. -!! -!! @author Peter Colarco (based on Chuck Bardeen's code) -!! @version Feb-2009 - - -program carma_sigmafalltest - implicit none - - write(*,*) "Sedimentation Test (Sigma Coordinates)" - - call test_sedimentation_sigma() - - write(*,*) "Done" -end program - - -subroutine test_sedimentation_sigma() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 72 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 8 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 100*6 - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - logical :: do_explised = .false. -! logical :: do_explised = .true. - real(kind=f) :: vf_const = 2.0_f -! real(kind=f) :: vf_const = 0.0_f - - integer :: omp_get_num_threads, omp_get_max_threads, & - omp_get_thread_num - - - real(kind=f) :: a72(73), b72(73), t72(72), ze(73) - real(kind=f) :: hyai66(67), hybi66(67), hyam66(66), hybm66(66) - real(kind=f) :: hyai125(126), hybi125(126), hyam125(125), hybm125(125) - real(kind=f) :: a(NZP1), b(NZP1), dz(NZ), zm(NZP1), rhoa(NZ) - real(kind=f), parameter :: ps = 98139.8 ! GEOS-5, Omaha, NE, 20090101 - - data a72 / & - 1.0000000, 2.0000002, 3.2700005, 4.7585009, 6.6000011, & - 8.9345014, 11.970302, 15.949503, 21.134903, 27.852606, & - 36.504108, 47.580610, 61.677911, 79.513413, 101.94402, & - 130.05102, 165.07903, 208.49704, 262.02105, 327.64307, & - 407.65710, 504.68010, 621.68012, 761.98417, 929.29420, & - 1127.6902, 1364.3402, 1645.7103, 1979.1604, 2373.0405, & - 2836.7806, 3381.0007, 4017.5409, 4764.3911, 5638.7912, & - 6660.3412, 7851.2316, 9236.5722, 10866.302, 12783.703, & - 15039.303, 17693.003, 20119.201, 21686.501, 22436.301, & - 22389.800, 21877.598, 21214.998, 20325.898, 19309.696, & - 18161.897, 16960.896, 15625.996, 14290.995, 12869.594, & - 11895.862, 10918.171, 9936.5219, 8909.9925, 7883.4220, & - 7062.1982, 6436.2637, 5805.3211, 5169.6110, 4533.9010, & - 3898.2009, 3257.0809, 2609.2006, 1961.3106, 1313.4804, & - 659.37527, 4.8048257, 0.0000000 / - - data b72 / & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, & - 0.0000000, 8.1754130e-09, 0.0069600246, 0.028010041, 0.063720063, & - 0.11360208, 0.15622409, 0.20035011, 0.24674112, 0.29440312, & - 0.34338113, 0.39289115, 0.44374018, 0.49459020, 0.54630418, & - 0.58104151, 0.61581843, 0.65063492, 0.68589990, 0.72116594, & - 0.74937819, 0.77063753, 0.79194696, 0.81330397, 0.83466097, & - 0.85601798, 0.87742898, 0.89890800, 0.92038701, 0.94186501, & - 0.96340602, 0.98495195, 1.0000000 / - - ! The WACCM 66 level hybrid coefficients. - data hyai66 /& - 4.5005e-09, 7.4201e-09, 1.22337e-08, 2.017e-08, 3.32545e-08, & - 5.48275e-08, 9.0398e-08, 1.4904e-07, 2.4572e-07, 4.05125e-07, 6.6794e-07, & - 1.101265e-06, 1.81565e-06, 2.9935e-06, 4.963e-06, 8.150651e-06, & - 1.3477e-05, 2.2319e-05, 3.67965e-05, 6.0665e-05, 9.91565e-05, 0.00015739, & - 0.00023885, 0.0003452, 0.000475135, 0.000631805, 0.000829155, 0.00108274, & - 0.00140685, 0.00181885, 0.0023398, 0.00299505, 0.0038147, 0.00483445, & - 0.00609635, 0.00764935, 0.0095501, 0.011864, 0.0146655, 0.018038, & - 0.0220755, 0.0268825, 0.0325735, 0.039273, 0.0471145, 0.0562405, & - 0.0668005, 0.0789485, 0.07731271, 0.07590131, 0.07424086, 0.07228743, & - 0.06998932, 0.06728574, 0.06410509, 0.06036322, 0.05596111, 0.05078225, & - 0.0446896, 0.03752191, 0.02908949, 0.02084739, 0.01334443, 0.00708499, & - 0.00252136, 0, 0 / - - data hybi66 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0.01505309, 0.03276228, 0.05359622, 0.07810627, 0.1069411, 0.1408637, & - 0.180772, 0.227722, 0.2829562, 0.3479364, 0.4243822, 0.5143168, & - 0.6201202, 0.7235355, 0.8176768, 0.8962153, 0.9534761, 0.9851122, 1 / - - data hyam66 /& - 5.9603e-09, 9.8269e-09, 1.620185e-08, 2.671225e-08, 4.4041e-08, & - 7.261275e-08, 1.19719e-07, 1.9738e-07, 3.254225e-07, 5.365325e-07, & - 8.846025e-07, 1.4584575e-06, 2.404575e-06, 3.97825e-06, 6.5568255e-06, & - 1.08138255e-05, 1.7898e-05, 2.955775e-05, 4.873075e-05, 7.991075e-05, & - 0.00012827325, 0.00019812, 0.000292025, 0.0004101675, 0.00055347, & - 0.00073048, 0.0009559475, 0.001244795, 0.00161285, 0.002079325, & - 0.002667425, 0.003404875, 0.004324575, 0.0054654, 0.00687285, & - 0.008599725, 0.01070705, 0.01326475, 0.01635175, 0.02005675, 0.024479, & - 0.029728, 0.03592325, 0.04319375, 0.0516775, 0.0615205, 0.0728745, & - 0.078130605, 0.07660701, 0.075071085, 0.073264145, 0.071138375, & - 0.06863753, 0.065695415, 0.062234155, 0.058162165, 0.05337168, & - 0.047735925, 0.041105755, 0.0333057, 0.02496844, 0.01709591, 0.01021471, & - 0.004803175, 0.00126068, 0 / - - data hybm66 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0.007526545, 0.023907685, 0.04317925, 0.065851245, 0.092523685, & - 0.1239024, 0.16081785, 0.204247, 0.2553391, 0.3154463, 0.3861593, & - 0.4693495, 0.5672185, 0.67182785, 0.77060615, 0.85694605, 0.9248457, & - 0.96929415, 0.9925561 / - - ! The WACCM 125 level hybrid coefficients. - data hyai125 /& - 4.5005e-09, 7.4247466e-09, 1.2236616e-08, 2.0143422e-08, & - 3.3006333e-08, 5.317267e-08, 8.160345e-08, 1.1600713e-07, 1.5343022e-07, & - 1.9154761e-07, 2.2843057e-07, 2.648671e-07, 3.0222616e-07, 3.3995556e-07, & - 3.7754795e-07, 4.1533548e-07, 4.5535556e-07, 4.9759899e-07, & - 5.4204611e-07, 5.8866705e-07, 6.374221e-07, 6.8881999e-07, 7.4381186e-07, & - 8.0260573e-07, 8.6541864e-07, 9.3247687e-07, 1.0040162e-06, 1.080282e-06, & - 1.1619754e-06, 1.2496277e-06, 1.3436572e-06, 1.4445101e-06, & - 1.5526629e-06, 1.6686237e-06, 1.7929346e-06, 1.9263614e-06, & - 2.0696043e-06, 2.2233774e-06, 2.3884455e-06, 2.5656287e-06, & - 2.7558058e-06, 2.9599187e-06, 3.1791492e-06, 3.4146519e-06, & - 3.6676372e-06, 3.9394056e-06, 4.2313546e-06, 4.544986e-06, 4.8819134e-06, & - 5.2440647e-06, 5.6334087e-06, 6.0520116e-06, 6.5020985e-06, & - 6.9860655e-06, 7.5064932e-06, 8.0661613e-06, 8.6701024e-06, & - 9.3223836e-06, 1.002711e-05, 1.0788756e-05, 1.1612197e-05, 1.2502751e-05, & - 1.3466215e-05, 1.4531221e-05, 1.5710984e-05, 1.7020447e-05, & - 1.8476809e-05, 2.0099909e-05, 2.1912687e-05, 2.4079993e-05, 2.673686e-05, & - 3.0029676e-05, 3.416049e-05, 3.9624245e-05, 4.7318986e-05, 5.8509432e-05, & - 7.3993635e-05, 9.5598711e-05, 0.00012447961, 0.00016290808, & - 0.00021346928, 0.00027992192, 0.00036715931, 0.00048162804, 0.000631805, & - 0.000829155, 0.00108274, 0.00140685, 0.00181885, 0.0023398, 0.00299505, & - 0.0038147, 0.00483445, 0.00609635, 0.00764935, 0.0095501, 0.011864, & - 0.0146655, 0.018038, 0.0220755, 0.0268825, 0.0325735, 0.039273, & - 0.0471145, 0.0562405, 0.0668005, 0.0789485, 0.07731271, 0.07590131, & - 0.07424086, 0.07228743, 0.06998932, 0.06728574, 0.06410509, 0.06036322, & - 0.05596111, 0.05078225, 0.0446896, 0.03752191, 0.02908949, 0.02084739, & - 0.01334443, 0.00708499, 0.00252136, 0, 0 / - - data hybi125 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01505309, 0.03276228, 0.05359622, & - 0.07810627, 0.1069411, 0.1408637, 0.180772, 0.227722, 0.2829562, & - 0.3479364, 0.4243822, 0.5143168, 0.6201202, 0.7235355, 0.8176768, & - 0.8962153, 0.9534761, 0.9851122, 1 / - - data hyam125 /& - 5.9626233e-09, 9.8306813e-09, 1.6190019e-08, 2.65748775e-08, & - 4.30895015e-08, 6.738806e-08, 9.880529e-08, 1.34718675e-07, & - 1.72488915e-07, 2.0998909e-07, 2.46648835e-07, 2.8354663e-07, & - 3.2109086e-07, 3.58751755e-07, 3.96441715e-07, 4.3534552e-07, & - 4.76477275e-07, 5.1982255e-07, 5.6535658e-07, 6.13044575e-07, & - 6.63121045e-07, 7.16315925e-07, 7.73208795e-07, 8.34012185e-07, & - 8.98947755e-07, 9.68246535e-07, 1.0421491e-06, 1.1211287e-06, & - 1.20580155e-06, 1.29664245e-06, 1.39408365e-06, 1.4985865e-06, & - 1.6106433e-06, 1.73077915e-06, 1.859648e-06, 1.99798285e-06, & - 2.14649085e-06, 2.30591145e-06, 2.4770371e-06, 2.66071725e-06, & - 2.85786225e-06, 3.06953395e-06, 3.29690055e-06, 3.54114455e-06, & - 3.8035214e-06, 4.0853801e-06, 4.3881703e-06, 4.7134497e-06, & - 5.06298905e-06, 5.4387367e-06, 5.84271015e-06, 6.27705505e-06, & - 6.744082e-06, 7.24627935e-06, 7.78632725e-06, 8.36813185e-06, & - 8.996243e-06, 9.6747468e-06, 1.0407933e-05, 1.12004765e-05, & - 1.2057474e-05, 1.2984483e-05, 1.3998718e-05, 1.51211025e-05, & - 1.63657155e-05, 1.7748628e-05, 1.9288359e-05, 2.1006298e-05, & - 2.299634e-05, 2.54084265e-05, 2.8383268e-05, 3.2095083e-05, & - 3.68923675e-05, 4.34716155e-05, 5.2914209e-05, 6.62515335e-05, & - 8.4796173e-05, 0.0001100391605, 0.000143693845, 0.00018818868, & - 0.0002466956, 0.000323540615, 0.000424393675, 0.00055671652, 0.00073048, & - 0.0009559475, 0.001244795, 0.00161285, 0.002079325, 0.002667425, & - 0.003404875, 0.004324575, 0.0054654, 0.00687285, 0.008599725, 0.01070705, & - 0.01326475, 0.01635175, 0.02005675, 0.024479, 0.029728, 0.03592325, & - 0.04319375, 0.0516775, 0.0615205, 0.0728745, 0.078130605, 0.07660701, & - 0.075071085, 0.073264145, 0.071138375, 0.06863753, 0.065695415, & - 0.062234155, 0.058162165, 0.05337168, 0.047735925, 0.041105755, & - 0.0333057, 0.02496844, 0.01709591, 0.01021471, 0.00480317499999999, & - 0.00126067999999999, 0 / - - data hybm125 /& - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.35614355487735e-18, 0.007526545, & - 0.023907685, 0.04317925, 0.065851245, 0.092523685, 0.1239024, 0.16081785, & - 0.204247, 0.2553391, 0.3154463, 0.3861593, 0.4693495, 0.5672185, & - 0.67182785, 0.77060615, 0.85694605, 0.9248457, 0.96929415, 0.9925561 / - - ! Do the GEOS case. - a = a72 - b = b72 - - ! Do the WACCM 66 case. -! a = hyai66 * 10000_f -! b = hybi66 - - ! Do the WACCM 125 case. -! a = hyai125 * 10000_f -! b = hybi125 - -! do i = 1, NZP1 -! write(*,*) a(i), b(i)*p0, a(i) + b(i)*p0 -! end do - - data t72 / & - 212.161, 210.233, 217.671, 225.546, 232.222, 237.921, 241.836, 243.246, & - 250.032, 265.518, 262.335, 255.389, 253.560, 253.848, 252.496, 247.806, & - 243.108, 237.288, 230.839, 226.233, 221.617, 218.474, 218.014, 218.881, & - 220.297, 222.262, 224.564, 224.059, 221.671, 220.732, 220.200, 218.445, & - 217.424, 215.322, 212.882, 211.080, 210.573, 210.942, 212.593, 214.064, & - 213.704, 209.045, 211.286, 218.995, 227.209, 235.050, 241.144, 246.328, & - 250.606, 254.079, 257.222, 260.012, 262.534, 265.385, 267.348, 267.998, & - 267.964, 267.827, 268.075, 268.397, 268.440, 268.371, 268.302, 268.203, & - 267.943, 266.305, 265.331, 265.628, 266.371, 267.219, 267.981, 268.379 / - data ze / & - 78126.3, 73819.6, 70792.7, 68401.3, 66240.5, 64180.9, 62142.8, 60110.2, 58104.9, 56084.0, 53980.6, & - 51944.7, 50003.9, 48117.8, 46270.4, 44469.8, 42739.0, 41076.6, 39488.8, 37977.8, 36530.2, 35144.5, & - 33810.5, 32511.3, 31238.9, 29990.5, 28750.5, 27517.4, 26306.8, 25128.6, 23974.7, 22842.9, 21739.4, & - 20653.8, 19591.3, 18553.2, 17536.4, 16534.3, 15530.5, 14518.7, 13500.1, 12483.0, 11491.9, 10495.9, & - 9466.47, 8427.35, 7712.39, 7048.43, 6429.18, 5849.30, 5304.75, 4791.16, 4305.46, 3844.44, 3404.89, & - 3122.98, 2850.14, 2586.45, 2331.56, 2084.55, 1892.20, 1750.98, 1612.29, 1476.05, 1342.20, 1210.71, & - 1082.17, 956.177, 832.052, 709.535, 588.531, 469.023, 350.157 / - - -! write(*,*) "" -! write(*,*) "Sedimentation of Dust Particles" - - ! Open the output text file - open(unit=lun,file="carma_sigmafalltest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create(carma, ", NBIN, ", ", NELEM, ", ", NGROUP, & -! ", ", NSOLUTE, ", ", NGAS, ", rc, 6) ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - carma_ptr => carma - - ! Define the group -! write(*,*) " Add Group(s) ..." - rho = 2.65_f -! rmrat = (100._f**3)**(1._f/(NBIN*1._f)) -! rmin = 1.e-5_f * ((1._f+rmrat)/2._f)**(1._f/3._f) - rmrat = 2.0 - rmin = 7.5e-4_f - call CARMAGROUP_Create(carma, 1, 'dust', rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - ! Define the element -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! Setup the CARMA processes to exercise -! write(*,*) " CARMA_Initialize(carma, rc, do_vtran=.TRUE., "// & -! "vf_const=", vf_const,", do_explised=",do_explised,") ..." - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., vf_const=vf_const, do_explised=do_explised) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Layer edges - do i = 1, NZP1 -! pl(i,:,:) = a(i)+b(i)*p0 -! zl(i,:,:) = pl(i,:,:)/p0 -! zl(i,:,:) = a(i) + b(i)*p0 - pl(i,:,:) = a72(i)+b72(i)*ps - zl(i,:,:) = pl(i,:,:)/ps - end do - - - ! Vertical center -! t = 270._f - do i = 1, NZ -! p(i,:,:) = exp((log(pl(i,:,:)) + log(pl(i+1,:,:)) ) / 2._f) -! zc(i,:,:) = p(i,:,:) / p0 -! zc(i,:,:) = hyam66(i) * 10000_f + hybm66(i) * p0 -! zc(i,:,:) = hyam125(i) * 10000_f + hybm125(i) * p0 - t(i,:,:) = t72(i) - p(i,:,:) = (pl(i,:,:) + pl(i+1,:,:) ) / 2._f - zc(i,:,:) = p(i,:,:) / p0 - rhoa(i) = p(i,NY,NX)/287._f/t(i,NY,NX) - dz(i) = ze(i)-ze(i+1) - end do - -! zm(NZ) = (p0 - p(NZ,NX,NY)) / (rhoa(NZ)*9.816_f) - zm(NZ) = ze(NZP1)+dz(NZ)/2._f - - do i = NZ-1, 1, -1 - zm(i) = zm(i+1) + (p(i+1,NY,NX) - p(i,NY,NX)) / (rhoa(i)*9.816_f) - end do - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a blob in the model first bin at 8 km - mmr(:,:,:,:,:) = 0._f - do i = 1, NZ - mmr(i,:,:,1,1) = 1e-10_f * exp( - ( ( zm(i) - 8.e3_f)/3.e3_f) ** 2) / & - ( p(i,:,:) / 287._f / t(i,:,:)) - end do - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - ! Write output for the falltest - write(lun,*) NZ - do i = 1, NZ - write(lun,'(i3,2f10.1)') & - i, zm(i), dz(i) - end do - - write(lun,*) 0 - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*rhoa(i)) - end do - - - ! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_HYBRID, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - enddo - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*rhoa(i)) - end do - - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_sulfatetest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_sulfatetest.F90 deleted file mode 100644 index f5541f33..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_sulfatetest.F90 +++ /dev/null @@ -1,392 +0,0 @@ -!! This code is to test the impact of particle swelling from -!! relative humidity on sedimentation. Upon execution, a text -!! file (carma_swelltest.txt) is generated. The text file can -!! be read with the IDL procedure read_swelltest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_sulfatetest - implicit none - - write(*,*) "Sulfate Test" - - call test_sulfate_simple() -end program - -!! Just have one grid box. In that grid box, but an initial concentration -!! of drops at the smallest size, then allow that to grow using a gas. The -!! total mas of drops + gas should be conserved. -subroutine test_sulfate_simple() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NZ = 1 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 38 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 2 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - - - - ! Different sizes for time steps provide different results - ! because of the satbility issues. -! real(kind=f), parameter :: dtime = 1._f -! real(kind=f), parameter :: dtime = 5._f -! real(kind=f), parameter :: dtime = 10._f -! real(kind=f), parameter :: dtime = 50._f -! real(kind=f), parameter :: dtime = 100._f -! real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: dtime = 1800._f -! real(kind=f), parameter :: dtime = 5000._f -! real(kind=f), parameter :: dtime = 10000._f -! real(kind=f), parameter :: dtime = 50000._f - real(kind=f), parameter :: deltax = 100000._f - real(kind=f), parameter :: deltay = 100000._f - real(kind=f), parameter :: deltaz = 1000._f - real(kind=f), parameter :: zmin = 14500._f - - integer, parameter :: nstep = 180000 / int(dtime) - - - integer, parameter :: I_H2SO4 = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:) - real(kind=f), allocatable :: dx(:) - real(kind=f), allocatable :: yc(:) - real(kind=f), allocatable :: dy(:) - real(kind=f), allocatable :: zc(:) - real(kind=f), allocatable :: zl(:) - real(kind=f), allocatable :: p(:) - real(kind=f), allocatable :: pl(:) - real(kind=f), allocatable :: t(:) - real(kind=f), allocatable :: relhum(:) - real(kind=f), allocatable :: rho(:) - - real(kind=f), allocatable :: mmr(:,:,:) - real(kind=f), allocatable :: mmr_gas(:,:) - real(kind=f), allocatable :: new_gas(:,:) - real(kind=f), allocatable :: satliq(:,:) - real(kind=f), allocatable :: satice(:,:) - - real(kind=f), allocatable :: r(:) - real(kind=f), allocatable :: rmass(:) - - real(kind=f) :: lat - real(kind=f) :: lon - - integer :: i - integer :: istep - integer :: igas - integer :: igroup - integer :: ielem - integer :: ibin - integer, parameter :: lun = 42 - integer :: nsubsteps - integer :: lastsub = 0 - - real(kind=f) :: nretries - real(kind=f) :: lastret = 0._f - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat - real(kind=f) :: RHO_SULFATE - real(kind=f) :: drh - real(kind=f) :: t_orig - - ! Open the output text file - open(unit=lun,file="carma_sulfatetest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ), dx(NZ), yc(NZ), dy(NZ), & - zc(NZ), zl(NZP1), p(NZ), pl(NZP1), & - t(NZ),rho(NZ)) - allocate(mmr(NZ,NELEM,NBIN)) - allocate(mmr_gas(NZ,NGAS)) - allocate(new_gas(NZ,NGAS)) - allocate(satliq(NZ,NGAS)) - allocate(satice(NZ,NGAS)) - allocate(r(NBIN)) - allocate(rmass(NBIN)) - - ! Define the particle-grid extent of the CARMA test - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, & - LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** CARMA_Create FAILED ***" - - carma_ptr => carma - - - ! Define the groups - rmrat = 2._f -! rmin = 1e-8_f -! rmin = 1e-4_f - rmin = 2.e-8_f - RHO_SULFATE = 1.923_f ! dry density of sulfate particles (g/cm3) - - call CARMAGROUP_Create(carma, 1, "sulfate", rmin, rmrat, I_SPHERE, 1._f, .false., & - rc, irhswell=I_WTPCT_H2SO4, do_drydep=.true., & - shortname="SULF", is_sulfate=.true.) - if (rc /=0) stop " *** CARMAGROUP_Create FAILED ***" - - ! Define the elements - call CARMAELEMENT_Create(carma, 1, 1, "Sulfate", RHO_SULFATE, I_VOLATILE, I_H2SO4, rc, shortname="SULF") - if (rc /=0) stop " *** CARMAELEMENT_Create FAILED ***" - - ! Define the gases - call CARMAGAS_Create(carma, 1, "Water Vapor", WTMOL_H2O, I_VAPRTN_H2O_MURPHY2005, & - I_GCOMP_H2O, rc, shortname = "Q", dgc_threshold=0.1_f, ds_threshold=0.1_f) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - call CARMAGAS_Create(carma, 2, "Sulphuric Acid", 98.078479_f, I_VAPRTN_H2SO4_AYERS1980, & - I_GCOMP_H2SO4, rc, shortname = "H2SO4", dgc_threshold=0.1_f, ds_threshold=0.1_f) - if (rc /=0) stop " *** CARMAGAS_Create FAILED ***" - - - - ! Setup the CARMA processes to exercise - call CARMA_AddGrowth(carma, 1, 2, rc) ! set H2SO4 to be the condensing gas - if (rc /=0) stop " *** CARMA_AddGrowth FAILED ***" - - call CARMA_AddNucleation(carma, 1, 1, I_HOMNUC, 0._f, rc, igas=2) - if (rc /=0) stop " *** CARMA_AddNucleation FAILED ***" - - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_FUCHS, rc) - if (rc /=0) stop " *** CARMA_AddCoagulation FAILED ***" - - - call CARMA_Initialize(carma, rc, do_grow=.true., do_coag=.true., do_substep=.true., & - do_thermo=.true., maxretries=16, maxsubsteps=32, dt_threshold=1._f) - if (rc /=0) stop " *** CARMA_Initialize FAILED ***" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat = -40.0_f - lon = -105.0_f - - ! Horizonal centers - dx(:) = deltax - xc(:) = dx(:) / 2._f - dy(:) = deltay - yc(:) = dy(:) / 2._f - - ! Vertical center - do i = 1, NZ - zc(i) = zmin + (deltaz * (i - 0.5_f)) - end do - - call GetStandardAtmosphere(zc, p=p, t=t) - - ! Vertical edge - do i = 1, NZP1 - zl(i) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - - ! Write output for the test - write(lun,*) NGROUP, NELEM, NBIN, NGAS - - do igroup = 1, NGROUP - call CARMAGROUP_Get(carma, igroup, rc, r=r, rmass=rmass) - if (rc /=0) stop " *** CARMAGROUP_Get FAILED ***" - - do ibin = 1, NBIN - write(lun,'(2i4,2e10.3)') igroup, ibin, r(ibin) * 1e4_f, rmass(ibin) - end do - end do - - - ! Try WACCM model top conditions -! p(1) = 5.960299999999999e-06_f * 100._f -! zc(1) = 145000._f -! t(1) = 872.3763285535849_f -! zl(1) = zc(1) - deltaz -! zl(2) = zc(1) + deltaz -! rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) -! pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) -! pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - - ! Initial H2O and H2SO4 concentrations -! mmr_gas(:,1) = 8.588236513537504e-09_f ! H2O -! mmr_gas(:,2) = 2.435825934528716e-11_f ! H2SO4 - - - - ! Try TTL Conditions ... - ! - ! p, T, z, mmrgas, rmin, particle concentration - ! 90 hPa, 190 K, 17 km, H2O mmr 3.5e-6 g/g, H2SO4 mmr 100 ppb - p(1) = 90._f * 100._f - zc(1) = 17000._f - t(1) = 190._f - zl(1) = zc(1) - deltaz - zl(2) = zc(1) + deltaz - rho(1) = (p(1) * 10._f) / (R_AIR * t(1)) * (1e-3_f * 1e6_f) - pl(1) = p(1) - (zl(1) - zc(1)) * rho(1) * (GRAV / 100._f) - pl(2) = p(1) - (zl(2) - zc(1)) * rho(1) * (GRAV / 100._f) - - ! Initial H2O and H2SO4 concentrations - mmr_gas(:,1) = 3.e-6_f ! H2O -!! mmr_gas(:,1) = 100.e-6_f ! H2O - mmr_gas(:,2) = 0.01e-12_f ! H2SO4 -!! mmr_gas(:,2) = 30.e-9_f ! H2SO4 -!! mmr_gas(:,2) = 0.1e-9_f * (98._f / 29._f) ! H2SO4 - - satliq(:,:) = -1._f - satice(:,:) = -1._f - - ! Initial sulfate concentration - mmr(:,:,:) = 0._f - - t_orig = t(1) - - - write(lun,*) 0 - - write(lun,'(2i6,g16.5)') 0, 0, 0._f - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e10.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e10.3)') igas, real(mmr_gas(1,igas)), 0., 0. - end do - - - -! Iterate the model over a few time steps. - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat, lon, & - xc(:), dx(:), & - yc(:), dy(:), & - zc(:), zl(:), & - p(:), pl(:), & - t(:), rc, & - told=t(:)) - if (rc /=0) stop " *** CARMASTATE_Create FAILED ***" - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_SetBin FAILED ***" - end do - end do - - ! Send the gas mmrs to CARMA - ! - ! For substepping to do anything, during a step, the old an current - ! gas mmrs or temperatures need to be different. - - ! If you want to add some H2SO4, you can do it here using one or the other - ! of theses lines. - new_gas = mmr_gas(:,:) - -!! if (istep == 1) then -!! new_gas(:,2) = new_gas(:,2) + .05 * new_gas(:,2) ! H2SO4 - add a source of H2SO4, 5% of the initial value -!! end if - -!!! mmr_gas(:,2) = 100.e-9_f ! H2SO4 - reset to the initial condition (i.e. is constant) - - - do igas = 1, NGAS - call CARMASTATE_SetGas(cstate, igas, new_gas(:,igas), rc, & - mmr_old=mmr_gas(:,igas),& - satice_old=satice(:,igas), & - satliq_old=satliq(:,igas)) - if (rc /=0) stop " *** CARMASTATE_SetGas FAILED ***" - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Step FAILED ***" - - - ! Get the retry stats and the updated temperature. - call CARMASTATE_Get(cstate, rc, nsubstep=nsubsteps, nretry=nretries) - if (rc /=0) stop " *** CARMASTATE_Get FAILED ***" - - call CARMASTATE_GetState(cstate, rc, t=t(:)) - if (rc /=0) stop " *** CARMASTATE_GetState FAILED ***" - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, mmr(:,ielem,ibin), rc) - if (rc /=0) stop " *** CARMASTATE_GetBin FAILED ***" - end do - end do - - ! Get the updated gas mmr. - do igas = 1, NGAS - call CARMASTATE_GetGas(cstate, igas, & - mmr_gas(:,igas), rc, & - satliq=satliq(:,igas), & - satice=satice(:,igas)) - if (rc /=0) stop " *** CARMASTATE_GetGas FAILED ***" - end do - - - ! Write output for the sulfatetest - write(lun,'(f12.0)') istep*dtime - - write(lun,'(2i6,g16.5)') nsubsteps - lastsub, int(nretries - lastret), t(1) - t_orig - lastsub = nsubsteps - lastret = nretries - - do ielem = 1, NELEM - do ibin = 1, NBIN - write(lun,'(2i4,e12.3)') ielem, ibin, real(mmr(1,ielem,ibin)) - end do - end do - - do igas = 1, NGAS - write(lun,'(i4,3e12.3)') igas, real(mmr_gas(1,igas)), satliq(1,igas), satice(1,igas) - end do - - end do ! time loop - - ! Close the output file - close(unit=lun) - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** CARMASTATE_Destroy FAILED ***" - - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** CARMA_Destroy FAILED ***" -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_swelltest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_swelltest.F90 deleted file mode 100644 index a5ac7005..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_swelltest.F90 +++ /dev/null @@ -1,348 +0,0 @@ -!! This code is to test the impact of particle swelling from -!! relative humidity on sedimentation using both the Gerber and -!! the FItzgerald parameterizations. -!! -!! Upon execution, a text file (carma_swelltest.txt) is generated. -!! The text file can be read with the IDL procedure read_swelltest.pro. -!! -!! @author Chuck Bardeen -!! @version May-2009 - -program carma_swelltest - implicit none - - write(*,*) "Particle Swelling Test" - - call test_swelling() - - write(*,*) "Done" -end program - -!! Create 3 particle groups, one for each of the particle swelling -!! parameterizations, and see if they fall at different rates. -subroutine test_swelling() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 150 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 3 - integer, parameter :: NBIN = 16 - integer, parameter :: NGROUP = 3 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: LUNOPRT = 6 - integer, parameter :: nstep = 100*6 - - ! To keep the file processing simpler, only one bin will get written out - ! to the output file. - integer, parameter :: OUTBIN = 14 - - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: rhmin = .4_f - real(kind=f), parameter :: rhmax = 1.05_f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_SEA_SALT = 1 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - real(kind=f), allocatable :: relhum(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - real(kind=f) :: drh - - integer :: omp_get_num_threads, omp_get_max_threads, & - omp_get_thread_num - - -! write(*,*) "" -! write(*,*) "Sedimentation of Dust Particles" - - ! Open the output text file - open(unit=lun,file="carma_swelltest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - allocate(relhum(NZ,NY,NX)) - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=LUNOPRT) - if (rc /=0) stop " *** FAILED ***" - carma_ptr => carma - - - ! Define the groups -! write(*,*) " Add Group(s) ..." - rho = 2.65_f - rmrat = 4.32_f - rmin = 1e-6_f - call CARMAGROUP_Create(carma, 1, "None", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 2, "Fitzgerald", rmin, rmrat, I_SPHERE, 1._f, .FALSE., & - rc, irhswell=I_FITZGERALD, irhswcomp=I_SWF_NACL) - if (rc /=0) stop " *** FAILED ***" - - call CARMAGROUP_Create(carma, 3, "Gerber", rmin, rmrat, I_SPHERE, 1._f, .FALSE., & - rc, irhswell=I_GERBER, irhswcomp=I_SWG_SEA_SALT) - if (rc /=0) stop " *** FAILED ***" - - - ! Define the elements -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "None", rho, I_INVOLATILE, I_SEA_SALT, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 2, 2, "Fitz", rho, I_INVOLATILE, I_SEA_SALT, rc) - if (rc /=0) stop " *** FAILED ***" - - call CARMAELEMENT_Create(carma, 3, 3, "Gerb", rho, I_INVOLATILE, I_SEA_SALT, rc) - if (rc /=0) stop " *** FAILED ***" - - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) stop " *** FAILED ***" - - ! Setup the CARMA processes to exercise -! write(*,*) " Initialize ..." - call CARMA_Initialize(carma, rc, do_vtran=.TRUE.) - if (rc /=0) stop " *** FAILED ***" - - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" - - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = -40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Set up some arbitrary relative humidities, with the maximum at the bottom and - ! minimum at the top. Make the RH at the top 0, just to make sure the code can - ! handle an RH of 0. - drh = (rhmax - rhmin) / (NZ-1) - - do i = 1, NZ - relhum(i,:,:) = rhmax - ((i - 1) * drh) - end do - - relhum(NZ,:,:) = 0._f - - - ! Put a blob in the model for all elements and bins at 8 km. - mmr(:,:,:,:,:) = 0._f - do i = 1, NZ - do ielem = 1, NELEM - do ibin = 1, NBIN - mmr(i,:,:,ielem,ibin) = 1e-10_f * exp(-((zc(i,:,:) - 8.e3_f) / 3.e3_f)**2) / & - (p(i,:,:) / 287._f / t(i,:,:)) - end do - end do - end do - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - - - ! Write output for the falltest - write(lun,*) NZ, NELEM - do i = 1, NZ - write(lun,'(i3,2f10.1)') & - i, zc(i,NY,NX), zl(i+1,NY,NX)-zl(i,NY,NX) - end do - - write(lun,*) 0 - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') & - ielem, i, real(mmr(i,NY,NX,ielem,OUTBIN)), real(mmr(i,NY,NX,ielem,OUTBIN)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - end do - - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc, relhum=relhum(:,iy,ix)) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - enddo - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do ielem = 1, NELEM - do i = 1, NZ - write(lun,'(2i4,e10.3,e10.3)') & - ielem, i, real(mmr(i,NY,NX,ielem,OUTBIN)), real(mmr(i,NY,NX,ielem,OUTBIN)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - end do - end do ! time loop - - ! Cleanup the carma state object - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)", "mmr(i,NY,NX,2)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1), mmr(i,NY,NX,1,2) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) stop " *** FAILED ***" - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) stop " *** FAILED ***" -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_test.F90 b/CARMAchem_GridComp/CARMA/tests/carma_test.F90 deleted file mode 100644 index 0c355db3..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_test.F90 +++ /dev/null @@ -1,270 +0,0 @@ -!! This is not a complete unit test, but it does try to at least exercise some of the code -!! paths of the CARMA module interface. More complete and rigorous testing of the CARMA module -!! is performed with the SLOD. -!! -!! @author Chuck Bardeen -!! @version Feb-2009 -! use carma_precision_mod -program carma_test - implicit none - - write(*,*) "Simple CARMA Interface Tester" - - call test_dust_1Dv2() -end program - - -subroutine test_dust_1Dv2() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 15 - integer, parameter :: NY = 15 - integer, parameter :: NZ = 80 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 28 - integer, parameter :: NGAS = 0 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 30 - - real(kind=f), parameter :: dtime = 1800._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 1000._f - real(kind=f), parameter :: zmin = 0._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type), allocatable :: cstate(:) - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - - real(kind=f) :: time - - integer :: omp_get_num_threads, omp_get_max_threads, omp_get_thread_num - - - write(*,*) "" - write(*,*) "Dust Model, 3D" - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), zc(NZ,NY,NX), & - zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), t(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - write(*,*) " CARMA_Create(carma, ", NBIN, ", 1, 1, 0, 0, rc, 6) ..." - call CARMA_Create(carma, NBIN, 1, 1, 0, 0, 0, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***" - carma_ptr => carma - - write(*,*) " Add Group(s) ..." - call CARMAGROUP_Create(carma, 1, "meteoric dust", 2e-8_f, 2.0_f, I_SPHERE, 1._f, .FALSE., rc) - if (rc < 0) stop " *** FAILED ***" - - write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "meteoric dust", 2._f, I_INVOLATILE, I_DUST, rc) - if (rc /=0) stop " *** FAILED ***" - - write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." - call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) " CARMA_Initialize(carma, rc, do_substep=.TRUE., do_vtran=.TRUE., do_coag=.TRUE., vf_const=2._f) ..." - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., do_coag=.TRUE.) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - call dumpGroup(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, which are specified - ! in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom of the model (e.g. z = 0), - ! while for sigma and hybrid coordinates the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - - write(*,'(a6, 3a12)') "level", "zc", "p", "t" - write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" - do i = 1, NZ - write(*,'(i6,3f12.3)') i, zc(i,1,1), p(i,1,1), t(i,1,1) - end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - - write(*,*) "" - write(*,'(a6, 2a12)') "level", "zl", "pl" - write(*,'(a6, 2a12)') "", "(m)", "(Pa)" - do i = 1, NZP1 - write(*,'(i6,2f12.3)') i, zl(i,1,1), pl(i,1,1) - end do - - - ! Put a blob at the top of the model in the first bin. - mmr(:,:,:,:,:) = 0._f - mmr(1,:,:,1,1) = 1e-6_f - mmr(NZ,:,:,1,1) = 1e-6_f - - write(*,*) "" - write(*, '(a6, 4a12)') "level", "mmr(1,1,i,1)", "mmr(1,1,i,2)", "mmr(1,2,i,1)", "mmr(1,2,i,2)" - do i = 1, NZ - write(*, '(i6, 4g12.3)') i, mmr(i,1,1,1,1), mmr(i,1,1,1,2), mmr(i,2,1,1,1), mmr(i,2,1,1,2) - end do - - ! Allocate enough carmastate objects for the maximum number of threads. - allocate(cstate(omp_get_max_threads())) - - - ! Iterate the model over a few time steps. - write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - write(*,'(a,i6,a,f8.2,a)') " step ", istep, ", time=", time / 3600._f, " (hr)" -! write(*,*) "" - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - ! - ! NOTE: This directive allows each column of the model to be processed in a - ! separate thread. This can allow for faster computation on machines that - ! allow multiple threads (e.g. have multiple CPUS). This should probably not - ! be used when the the model is embedded in a another model that is already - ! controlling the distribution of the model across multiple threads. - - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(ixy,ix,iy,ielem,ibin,ithread) - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Use the thread number to determine which member of the cstate pool to use. - ithread = omp_get_thread_num() + 1 - -! write(*,"(i2,': (',i5,',',i5,')')") ithread, iy, ix - - ! Create a CARMASTATE for this column. - ! write(*,*) " CARMASTATE_Create" - call CARMASTATE_Create(cstate(ithread), carma_ptr, time, dtime, NZ, I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), yc(:,iy,ix), dy(:,iy,ix), zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate(ithread), ielem, ibin, mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - ! write(*,*) "" - ! write(*,*) " CARMA_Step" - ! write(*,*) "" - call CARMASTATE_Step(cstate(ithread), rc) - - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - ! write (*, *) " CARMASTATE_GetBin() ..." - call CARMASTATE_GetBin(cstate(ithread), ielem, ibin, mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - ! write(*,*) " CARMASTATE_GetState" - call CARMASTATE_GetState(cstate(ithread), rc, t=t(:,iy,ix)) - enddo - !$OMP END PARALLEL DO - - end do - - ! Cleanup the carma state objects - do i = 1, omp_get_max_threads() - call CARMASTATE_Destroy(cstate(i), rc) - end do - deallocate(cstate) - - - write(*,*) "" - write(*,*) "" - write(*, '(a8, 8a14)') "level", "mmr(1,1,i,1)", "mmr(1,1,i,2)", "mmr(1,1,i,27)", "mmr(1,1,i,28)", "mmr(1,2,i,1)", "mmr(1,2,i,2)", "mmr(1,2,i,27)", "mmr(1,2,i,28)" - do i = 1, NZ - write(*, '(i8, 8g14.3)') i, mmr(i,1,1,1,1), mmr(i,1,1,1,2), mmr(i,1,1,1,27), mmr(i,1,1,1,28), mmr(i,2,1,1,1), mmr(i,2,1,1,2), mmr(i,2,1,1,27), mmr(i,2,1,1,28) - end do - - write(*,*) "" - write(*, '(a8, 2a12)') "level", "t(1,1,:)", "t(1,2,:)" - do i = 1, NZ - write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,2,1) - end do - - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/carma_testutils.F90 b/CARMAchem_GridComp/CARMA/tests/carma_testutils.F90 deleted file mode 100644 index fa6397fe..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_testutils.F90 +++ /dev/null @@ -1,105 +0,0 @@ -!! Some common utilities used in the CARMA test code. -!! -!! @author Chuck Bardeen -!! @version Jun-2010 - - -subroutine dumpElement(carma, rc) - use carma_precision_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - integer :: NELEM - - write(*,*) "" - write(*,*) "Element Information" - - call CARMA_Get(carma, rc, NELEM=NELEM) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - do i = 1, NELEM - call CARMAELEMENT_Print(carma, i, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - end do - - write(*,*) "" - return -end subroutine - - -subroutine dumpGas(carma, rc) - use carma_precision_mod - use carma_enums_mod - use carma_types_mod - use carmagas_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - integer :: NGAS - - call CARMA_Get(carma, rc, NGAS=NGAS) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - write(*,*) "Gas Information" - - do i = 1, NGAS - call CARMAGAS_Print(carma, i, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - end do - - write(*,*) "" -end subroutine - - -subroutine dumpGroup(carma, rc) - use carma_precision_mod - use carma_enums_mod - use carma_types_mod - use carmagroup_mod - use carma_mod - - implicit none - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - integer :: NGROUP - - write(*,*) "" - write(*,*) "Group Information" - - call CARMA_Get(carma, rc, NGROUP=NGROUP) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - do i = 1, NGROUP - call CARMAGROUP_Print(carma, i, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - end do - - write(*,*) "" - return -end subroutine diff --git a/CARMAchem_GridComp/CARMA/tests/carma_vdiftest.F90 b/CARMAchem_GridComp/CARMA/tests/carma_vdiftest.F90 deleted file mode 100644 index dc9109d7..00000000 --- a/CARMAchem_GridComp/CARMA/tests/carma_vdiftest.F90 +++ /dev/null @@ -1,309 +0,0 @@ -!! This code is to demonstrate the CARMA Brownian diffusion routines -!! for an example of diffusing particles. -!! -!! Upon execution, a text file (carma_vdiftest.txt) is generated. -!! The text file can be read with the IDL procedure read_vdiftest.pro. -!! -!! @author Chuck Bardeen -!! @version AUg-2010 - -program carma_vdiftest - implicit none - - write(*,*) "Brownian Diffusion Test" - - call test_diffusion() - - write(*,*) "Done" -end program - - -subroutine test_diffusion() - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - use atmosphere_mod - - implicit none - - integer, parameter :: NX = 1 - integer, parameter :: NY = 1 - integer, parameter :: NZ = 240 - integer, parameter :: NZP1 = NZ+1 - integer, parameter :: NELEM = 1 - integer, parameter :: NBIN = 1 - integer, parameter :: NGROUP = 1 - integer, parameter :: NSOLUTE = 0 - integer, parameter :: NGAS = 0 - integer, parameter :: NWAVE = 0 - integer, parameter :: nstep = 100*6 - - real(kind=f), parameter :: dtime = 1000._f - real(kind=f), parameter :: deltax = 100._f - real(kind=f), parameter :: deltay = 100._f - real(kind=f), parameter :: deltaz = 100._f - real(kind=f), parameter :: zmin = 80000._f - - integer, parameter :: I_DUST = 1 - integer, parameter :: I_ICE = 2 - - type(carma_type), target :: carma - type(carma_type), pointer :: carma_ptr - type(carmastate_type) :: cstate - integer :: rc = 0 - - real(kind=f), allocatable :: xc(:,:,:) - real(kind=f), allocatable :: dx(:,:,:) - real(kind=f), allocatable :: yc(:,:,:) - real(kind=f), allocatable :: dy(:,:,:) - real(kind=f), allocatable :: zc(:,:,:) - real(kind=f), allocatable :: zl(:,:,:) - real(kind=f), allocatable :: p(:,:,:) - real(kind=f), allocatable :: pl(:,:,:) - real(kind=f), allocatable :: t(:,:,:) - - real(kind=f), allocatable, target :: mmr(:,:,:,:,:) - - real(kind=f), allocatable :: lat(:,:) - real(kind=f), allocatable :: lon(:,:) - - integer :: i - integer :: ix - integer :: iy - integer :: ixy - integer :: istep - integer :: ielem - integer :: ibin - integer :: ithread - integer, parameter :: lun = 42 - - real(kind=f) :: time - real(kind=f) :: rmin, rmrat, rho - logical :: do_explised = .false. -! logical :: do_explised = .true. - real(kind=f) :: vf_const = 2.0_f -! real(kind=f) :: vf_const = 0.0_f - - integer :: omp_get_num_threads, omp_get_max_threads, & - omp_get_thread_num - - -! write(*,*) "" -! write(*,*) "Diffusion of Dust Particles" - - ! Open the output text file - open(unit=lun,file="carma_vdiftest.txt",status="unknown") - - ! Allocate the arrays that we need for the model - allocate(xc(NZ,NY,NX), dx(NZ,NY,NX), yc(NZ,NY,NX), dy(NZ,NY,NX), & - zc(NZ,NY,NX), zl(NZP1,NY,NX), p(NZ,NY,NX), pl(NZP1,NY,NX), & - t(NZ,NY,NX)) - allocate(mmr(NZ,NY,NX,NELEM,NBIN)) - allocate(lat(NY,NX), lon(NY,NX)) - - ! Define the particle-grid extent of the CARMA test -! write(*,*) " CARMA_Create(carma, ", NBIN, ", ", NELEM, ", ", NGROUP, & -! ", ", NSOLUTE, ", ", NGAS, ", rc, 6) ..." - call CARMA_Create(carma, NBIN, NELEM, NGROUP, NSOLUTE, NGAS, NWAVE, rc, LUNOPRT=6) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - carma_ptr => carma - - - ! Define the group - rho = 2.65_f - rmrat = 2.0 -! rmin = 7.5e-4_f - rmin = 2e-8_f -! write(*,*) " Add Group(s) ..." - call CARMAGROUP_Create(carma, 1, "dust", rmin, rmrat, I_SPHERE, 1._f, .FALSE., rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - - ! Define the element -! write(*,*) " Add Element(s) ..." - call CARMAELEMENT_Create(carma, 1, 1, "dust", rho, I_INVOLATILE, I_DUST, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - -! write(*,*) " CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) ..." -! call CARMA_AddCoagulation(carma, 1, 1, 1, I_COLLEC_DATA, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! Setup the CARMA processes to exercise -! do_explised = .true. -! write(*,*) " CARMA_Initialize(carma, rc, do_vdiff=.TRUE., do_explised=",do_explised,") ..." -! call CARMA_Initialize(carma, rc, do_vtran=.TRUE., do_vdiff=.FALSE., do_explised=do_explised) - call CARMA_Initialize(carma, rc, do_vtran=.TRUE., vf_const=1e-10_f, do_vdiff=.TRUE., do_explised=do_explised) -! call CARMA_Initialize(carma, rc, do_vtran=.TRUE., do_vdiff=.TRUE., do_explised=do_explised) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Print the Group Information -! write(*,*) "" -! call dumpGroup(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - ! Print the Element Information -! write(*,*) "" -! call dumpElement(carma, rc) -! if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" - - ! For simplicity of setup, do a case with Cartesian coordinates, - ! which are specified in this interface in meters. - ! - ! NOTE: For Cartesian coordinates, the first level is the bottom - ! of the model (e.g. z = 0), while for sigma and hybrid coordinates - ! the first level is the top of the model. - lat(:,:) = 40.0_f - lon(:,:) = -105.0_f - - ! Horizonal centers - do ix = 1, NX - do iy = 1, NY - dx(:,iy,ix) = deltax - xc(:,iy,ix) = ix*dx(:,iy,ix) / 2._f - dy(:,iy,ix) = deltay - yc(:,iy,ix) = iy*dy(:,iy,ix) / 2._f - end do - end do - - ! Vertical center - do i = 1, NZ - zc(i,:,:) = zmin + (deltaz * (i - 0.5_f)) - end do - call GetStandardAtmosphere(zc, p=p, t=t) - -! write(*,'(a6, 3a12)') "level", "zc", "p", "t" -! write(*,'(a6, 3a12)') "", "(m)", "(Pa)", "(K)" -! do i = 1, NZ -! write(*,'(i6,3f12.3)') i, zc(i,NY,NX), p(i,NY,NX), t(i,NY,NX) -! end do - - - ! Vertical edge - do i = 1, NZP1 - zl(i,:,:) = zmin + ((i - 1) * deltaz) - end do - call GetStandardAtmosphere(zl, p=pl) - -! write(*,*) "" -! write(*,'(a6, 2a12)') "level", "zl", "pl" -! write(*,'(a6, 2a12)') "", "(m)", "(Pa)" -! do i = 1, NZP1 -! write(*,'(i6,2f12.3)') i, zl(i,NY,NX), pl(i,NY,NX) -! end do - - - ! Put a blob in the model first bin at 8 km - mmr(:,:,:,:,:) = 0._f - do i = 1, NZ - mmr(i,:,:,1,1) = 1e-10_f * exp( - 5._f*(( zc(i,:,:) - 90.e3_f)/3.e3_f) ** 2) / & - ( p(i,:,:) / 287._f / t(i,:,:)) - end do - -! write(*,*) "" -! write(*, '(a6, 4a12)') "level", "mmr(i,NY,NX,1)" -! do i = 1, NZ -! write(*, '(i6, 4g12.3)') i, mmr(i,NY,NX,1,1) -! end do - - ! Write output for the falltest - write(lun,*) NZ - do i = 1, NZ - write(lun,'(i3,2f10.1)') & - i, zc(i,NY,NX), zl(i+1,NY,NX)-zl(i,NY,NX) - end do - - write(lun,*) 0 - do i = 1, NZ - write(lun,'(i3,e10.3,e10.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - - - ! Iterate the model over a few time steps. -! write(*,*) "" - do istep = 1, nstep - - ! Calculate the model time. - time = (istep - 1) * dtime - - ! NOTE: This means that there should not be any looping over NX or NY done - ! in any other CARMA routines. They should only loop over NZ. - do ixy = 1, NX*NY - ix = ((ixy-1) / NY) + 1 - iy = ixy - (ix-1)*NY - - ! Create a CARMASTATE for this column. - call CARMASTATE_Create(cstate, carma_ptr, time, dtime, NZ, & - I_CART, I_CART, lat(iy,ix), lon(iy,ix), & - xc(:,iy,ix), dx(:,iy,ix), & - yc(:,iy,ix), dy(:,iy,ix), & - zc(:,iy,ix), zl(:,iy,ix), p(:,iy,ix), & - pl(:,iy,ix), t(:,iy,ix), rc) - - ! Send the bin mmrs to CARMA - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_SetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Execute the step - call CARMASTATE_Step(cstate, rc) - ! Get the updated bin mmr. - do ielem = 1, NELEM - do ibin = 1, NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - mmr(:,iy,ix,ielem,ibin), rc) - end do - end do - - ! Get the updated temperature. - call CARMASTATE_GetState(cstate, rc, t=t(:,iy,ix)) - enddo - - ! Write output for the falltest - write(lun,'(f12.0)') istep*dtime - do i = 1, NZ - write(lun,'(i3,e12.3,e12.3)') & - i, real(mmr(i,NY,NX,1,1)), real(mmr(i,NY,NX,1,1)*p(i,NY,NX) / 287._f / t(i,NY,NX)) - end do - - end do ! time loop - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - if (rc /=0) stop " *** FAILED ***" - - ! Close the output file - close(unit=lun) - -! write(*,*) "" -! write(*,*) "" -! write(*, '(a8, 8a14)') "level", "mmr(i,NY,NX,1)" -! do i = 1, NZ -! write(*, '(i8, 8g14.3)') i, mmr(i,NY,NX,1,1) -! end do - -! write(*,*) "" -! write(*, '(a8, 2a12)') "level", "t(:,1,1)", "t(:,NY,NX)" -! do i = 1, NZ -! write(*, '(i8, 2f12.3)') i, t(i,1,1), t(i,NY,NX) -! end do - - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! write(*,*) "" -! write(*,*) " CARMA_Destroy() ..." - call CARMA_Destroy(carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc -end subroutine - diff --git a/CARMAchem_GridComp/CARMA/tests/read_bc2gtest.pro b/CARMAchem_GridComp/CARMA/tests/read_bc2gtest.pro deleted file mode 100644 index f1afdcb4..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_bc2gtest.pro +++ /dev/null @@ -1,166 +0,0 @@ - openr, lun, 'carma_bc2gtest.txt', /get_lun - readf, lun, nbin, nelem, ngroup - -; ibin_ = intarr(nbin) - r = fltarr(nbin,ngroup) ; radius (cm) - dr = fltarr(nbin,ngroup) ; delta radius (cm) - data = fltarr(ngroup+1) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data -; ibin_[ibin] = fix( data[0] ) - r[ibin,igroup] = data[1] - dr[ibin,igroup] = data[2] - endfor - endfor - - data2 = fltarr(2) - pc_ = fltarr(nbin,nelem) ; mass (g/cm^-3) in a bin - - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data2 -; ibin_[ibin] = fix( data2[0] ) - pc_[ibin,ielem] = data2[1] - endfor - endfor - -; ibin = [ibin,ibin_] - if (t1 eq 0.) then begin - pc = pc_ - time = t1 - endif else begin - pc = [pc,pc_] - time = [time,t1] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - pc = reform(pc,nbin,nt,nelem) - - - -; Map units for this test -; 3 elements: 1 - OC, 2 - BC shell, 3 - OC core -; Elements 1 - 2 are PC; element 3 is COREMASS -; For now, all elements have same size and mass dimensions - d = 2.*r*1e4 - dd = 2.*dr*1e4 - - dnlogd = alog(10.) * pc - for ibin = 0, nbin-1 do begin - dnlogd[ibin,*,0] = dnlogd[ibin,*,0]*d[ibin,0]/dd[ibin,0] - dnlogd[ibin,*,1] = dnlogd[ibin,*,1]*d[ibin,0]/dd[ibin,0] - endfor - - ; BCOC - massbc = total(pc[*,*,1],1) - total(pc[*,*,2],1) - massoc = total(pc[*,*,0],1) + total(pc[*,*,2],1) - mass = massbc + massoc - - massmbc = total(pc[*,*,1],1) - total(pc[*,*,2],1) - massmoc = total(pc[*,*,2],1) - massmix = massmbc + massmoc - - - ; Plot - !p.font=0 - !p.multi = [0,1,2] - loadct, 39 - - ; Can't display 0 in log coordinates - dnlogd[where(dnlogd le 0.)] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, d[*,0], dnlogd[*,0,0], $ - /xlog, /ylog, /nodata, xtitle = 'Diameter [um]', ytitle = 'dM/dlogD [g/cm3]', $ - xrange=[.005,.3], yrange=[1.e-21,1.e-11], xstyle=1 - - oplot, d[*,0], dnlogd[*,0,0], color=254, psym=2 - oplot, d[*,1], dnlogd[*,0,1], color=176, psym=4 - - oplot, d[*,1], dnlogd[*,it,0], thick=6, color=254, lin=0 - oplot, d[*,0], dnlogd[*,it,1], thick=3, color=176, lin=0 - oplot, d[*,0], dnlogd[*,it,2], thick=3, color=84, lin=0 - - xyouts, .1, 1.e-12, 'OC (pure group)', color=254 - xyouts, .1, 1.e-13, 'OC (core of mixed group)', color=84 - xyouts, .1, 1.e-14, 'BC (shell of mixed group)', color=176 - - plot, [0.,1.], [mass[it], mass[it]], $ - /nodata, ytitle = 'Total Mass Density [g/cm3]', $ - yrange=[0.,2.5e-13], xstyle=1 - oplot, [0.,1.], [mass[it], mass[it]], thick=3, color=66, lin=0 - oplot, [0.,1.], [massoc[it], massoc[it]], thick=9, color=84, lin=0 - oplot, [0.,1.], [massbc[it], massbc[it]], thick=3, color=176, lin=0 - oplot, [0.,1.], [massmix[it], massmix[it]], thick=3, color=66, lin=2 - oplot, [0.,1.], [massmoc[it], massmoc[it]], thick=3, color=84, lin=2 - oplot, [0.,1.], [massmbc[it], massmbc[it]], thick=6, color=176, lin=2 - - fac = 1./80. - plots, fac*[50,55], 2.0e-13, thick=3, color=66 - plots, fac*[50,55], 1.8e-13, thick=3, color=66, lin=2 - xyouts, fac*57, 1.95e-13, 'Total Mass', color=66 - xyouts, fac*57, 1.75e-13, 'Mixed Group Mass', color=66 - - plots, fac*[50,55], 0.9e-13, thick=3, color=176 - plots, fac*[50,55], 0.7e-13, thick=9, color=84 - plots, fac*[50,55], 0.5e-13, thick=6, color=176, lin=2 - plots, fac*[50,55], 0.3e-13, thick=3, color=84, lin=2 - xyouts, fac*57, 0.85e-13, 'Total BC', color=176 - xyouts, fac*57, 0.65e-13, 'Total OC', color=84 - xyouts, fac*57, 0.45e-13, 'Mixed BC', color=176 - xyouts, fac*57, 0.25e-13, 'Mixed OC', color=84 - - wait, .1 - endfor - - ; At the end, show the mass evolution. - plot, d[*,0], dnlogd[*,0,0], $ - /xlog, /ylog, /nodata, xtitle = 'Diameter [um]', ytitle = 'dM/dlogD [g/cm3]', $ - xrange=[.005,.3], yrange=[1.e-21,1.e-11], xstyle=1 - - oplot, d[*,0], dnlogd[*,0,0], color=254, psym=2 - oplot, d[*,1], dnlogd[*,0,1], color=176, psym=4 - - oplot, d[*,1], dnlogd[*,it-1,0], thick=6, color=254, lin=0 - oplot, d[*,0], dnlogd[*,it-1,1], thick=3, color=176, lin=0 - oplot, d[*,0], dnlogd[*,it-1,2], thick=3, color=84, lin=0 - - xyouts, .1, 1.e-12, 'OC (pure group)', color=254 - xyouts, .1, 1.e-13, 'OC (core of mixed group)', color=84 - xyouts, .1, 1.e-14, 'BC (shell of mixed group)', color=176 - - - plot, mass, xtitle = 'Time Step', ytitle = 'Total Mass Density [g/cm3]' - oplot, mass, thick=3, color=66, lin=0 - oplot, massoc, thick=9, color=84, lin=0 - oplot, massbc, thick=3, color=176, lin=0 - oplot, massmix, thick=3, color=66, lin=2 - oplot, massmoc, thick=3, color=84, lin=2 - oplot, massmbc, thick=6, color=176, lin=2 - - plots, [50,55], 2.0e-13, thick=3, color=66 - plots, [50,55], 1.8e-13, thick=3, color=66, lin=2 - xyouts, 57, 1.95e-13, 'Total Mass', color=66 - xyouts, 57, 1.75e-13, 'Mixed Group Mass', color=66 - - plots, [50,55], 0.9e-13, thick=3, color=176 - plots, [50,55], 0.7e-13, thick=9, color=84 - plots, [50,55], 0.5e-13, thick=6, color=176, lin=2 - plots, [50,55], 0.3e-13, thick=3, color=84, lin=2 - xyouts, 57, 0.85e-13, 'Total BC', color=176 - xyouts, 57, 0.65e-13, 'Total OC', color=84 - xyouts, 57, 0.45e-13, 'Mixed BC', color=176 - xyouts, 57, 0.25e-13, 'Mixed OC', color=84 - - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_bcoctest.pro b/CARMAchem_GridComp/CARMA/tests/read_bcoctest.pro deleted file mode 100644 index f910fbf3..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_bcoctest.pro +++ /dev/null @@ -1,134 +0,0 @@ - openr, lun, 'carma_bcoctest.txt', /get_lun - readf, lun, nbin, nelem, ngroup - -; ibin_ = intarr(nbin) - r = fltarr(nbin,ngroup) ; radius (cm) - dr = fltarr(nbin,ngroup) ; delta radius (cm) - data = fltarr(3) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data -; ibin_[ibin] = fix( data[0] ) - r[ibin,igroup] = data[1] - dr[ibin,igroup] = data[2] - endfor - endfor - - data2 = fltarr(2) - pc_ = fltarr(nbin,nelem) ; mass (g/cm^-3) in a bin - - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data2 -; ibin_[ibin] = fix( data2[0] ) - pc_[ibin,ielem] = data2[1] - endfor - endfor - -; ibin = [ibin,ibin_] - if (t1 eq 0.) then begin - pc = pc_ - time = t1 - endif else begin - pc = [pc,pc_] - time = [time,t1] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - pc = reform(pc,nbin,nt,nelem) - - - -; Map units for this test -; 4 elements: 1 - BC, 2 - OC, 3 - OC shell, 4 - BC core -; Elements 1 - 3 are PC; element 4 is COREMASS -; For now, all elements have same size and mass dimensions - d = 2.*r*1e4 - dd = 2.*dr*1e4 - - dnlogd = alog(10.) * pc - for ibin = 0, nbin-1 do begin - dnlogd[ibin,*,0] = dnlogd[ibin,*,0]*d[ibin,0]/dd[ibin,0] - dnlogd[ibin,*,1] = dnlogd[ibin,*,1]*d[ibin,1]/dd[ibin,1] - dnlogd[ibin,*,2] = dnlogd[ibin,*,2]*d[ibin,2]/dd[ibin,2] - dnlogd[ibin,*,3] = dnlogd[ibin,*,3]*d[ibin,2]/dd[ibin,2] - endfor - - ; BCOC - mass = total(pc[*,*,0],1) + total(pc[*,*,1],1) + total(pc[*,*,2],1) - massbc = total(pc[*,*,0],1) + total(pc[*,*,3],1) - massoc = total(pc[*,*,1],1) + total(pc[*,*,2],1) - total(pc[*,*,3],1) - massmix = total(pc[*,*,2],1) - massmbc = total(pc[*,*,3],1) - massmoc = total(pc[*,*,2],1) - total(pc[*,*,3],1) - - - ; Plot - !p.font=0 - !p.multi = [0,1,2] - loadct, 39 - - ; Can't display 0 in log coordinates - dnlogd[where(dnlogd le 0.)] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, d[*,0], dnlogd[*,0,0], $ - /xlog, /ylog, /nodata, xtitle = 'Diameter [um]', ytitle = 'dM/dlogD [g/cm3]', $ - xrange=[.005,.3], yrange=[1.e-21,1.e-11], xstyle=1 - - oplot, d[*,0], dnlogd[*,0,0], color=254, psym=2 - oplot, d[*,1], dnlogd[*,0,1], color=176, psym=4 - - oplot, d[*,0], dnlogd[*,it,0], thick=6, color=254, lin=0 - oplot, d[*,1], dnlogd[*,it,1], thick=3, color=176, lin=2 - oplot, d[*,2], dnlogd[*,it,2], thick=3, color=84, lin=0 - oplot, d[*,2], dnlogd[*,it,3], thick=3, color=84, lin=2 - - xyouts, .15, 1.e-12, 'BC (pure group)', color=254 - xyouts, .15, 1.e-13, 'OC (pure group)', color=176 - xyouts, .15, 1.e-14, 'OC+BC (mixed group)', color=84 - xyouts, .15, 1.e-15, 'BC (core of mixed group)', color=84 - plots, [.1,.13], 1.5e-12, thick=6, color=254 - plots, [.1,.13], 1.5e-13, thick=3, color=176, lin=2 - plots, [.1,.13], 1.5e-14, thick=3, color=84 - plots, [.1,.13], 1.5e-15, thick=3, color=84, lin=2 - - - ; Show the mass evolution. - plot, mass, xtitle = 'Time Step', ytitle = 'Total Mass Density [g/cm3]' - oplot, mass[0:it], thick=3, color=66, lin=0 - oplot, massoc[0:it], thick=9, color=84, lin=0 - oplot, massbc[0:it], thick=3, color=176, lin=0 - oplot, massmix[0:it], thick=3, color=66, lin=2 - oplot, massmbc[0:it], thick=6, color=176, lin=2 - oplot, massmoc[0:it], thick=3, color=84, lin=2 - - plots, [50,55], 2.0e-13, thick=3, color=66 - plots, [50,55], 1.8e-13, thick=3, color=66, lin=2 - xyouts, 57, 1.95e-13, 'Total Mass', color=66 - xyouts, 57, 1.75e-13, 'Mixed Group Mass', color=66 - - plots, [50,55], 0.9e-13, thick=3, color=176 - plots, [50,55], 0.7e-13, thick=9, color=84 - plots, [50,55], 0.5e-13, thick=6, color=176, lin=2 - plots, [50,55], 0.3e-13, thick=3, color=84, lin=2 - xyouts, 57, 0.85e-13, 'Total BC', color=176 - xyouts, 57, 0.65e-13, 'Total OC', color=84 - xyouts, 57, 0.45e-13, 'Mixed BC', color=176 - xyouts, 57, 0.25e-13, 'Mixed OC', color=84 - - - wait, .05 - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_coagtest.pro b/CARMAchem_GridComp/CARMA/tests/read_coagtest.pro deleted file mode 100644 index 51ce6832..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_coagtest.pro +++ /dev/null @@ -1,85 +0,0 @@ - openr, lun, 'carma_coagtest.txt', /get_lun - readf, lun, nbin, nelem, ngroup - -; ibin_ = intarr(nbin) - r = fltarr(nbin,ngroup) ; radius (cm) - dr = fltarr(nbin,ngroup) ; delta radius (cm) - data = fltarr(3) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data -; ibin_[ibin] = fix( data[0] ) - r[ibin,igroup] = data[1] - dr[ibin,igroup] = data[2] - endfor - endfor - - data2 = fltarr(2) - pc_ = fltarr(nbin,nelem) ; number (#/cm^-3) in a bin - - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data2 -; ibin_[ibin] = fix( data2[0] ) - pc_[ibin,ielem] = data2[1] - endfor - endfor - -; ibin = [ibin,ibin_] - if (t1 eq 0.) then begin - pc = pc_ - time = t1 - endif else begin - pc = [pc,pc_] - time = [time,t1] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - pc = reform(pc,nbin,nt,nelem) - - -; Map units for this test -; 4 elements: 1 - BC, 2 - OC, 3 - OC shell, 4 - BC core -; Elements 1 - 3 are PC; element 4 is COREMASS -; For now, all elements have same size and mass dimensions - d = 2.*r*1e4 - dd = 2.*dr*1e4 - - dnlogd = alog(10.) * pc - - for ibin = 0, nbin-1 do begin - dnlogd[ibin,*,0] = dnlogd[ibin,*,0]*d[ibin,0]/dd[ibin,0] - endfor - - ; Can't display 0 in log coordinates - dnlogd[where(dnlogd le 0.)] = !Values.F_NAN - - - -; The data has been manipulated and converted to match Figure 2 from -; Jacobson et al., Atmospheric Environment 28, 1327-1338, 1994 -; Initial monodisperse distribution is slightly different -- probably because -; I don't know what bin edges were used to calculate dr -; -; - JAS, August 15, 2007 - - plot, [ 0.005, 0.1 ], [ 1., 1.e8 ], /nodata $ - , xtitle = 'Diameter (um)' $ - , /xlog, xstyle = 1 $ - , ytitle = 'dN / d log D (cm-3)' $ - , /ylog, ystyle = 1 $ - , charsize = 1.25 - oplot, d, dnlogd[*,0,0], psym=2, symsize=1.25 - oplot, d, dnlogd[*,nt-1,0], lin=2 - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_drydeptest.pro b/CARMAchem_GridComp/CARMA/tests/read_drydeptest.pro deleted file mode 100644 index b1f71c59..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_drydeptest.pro +++ /dev/null @@ -1,131 +0,0 @@ - openr, lun, 'carma_drydeptest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz, nelem - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz, nelem) - q_ = fltarr(nz, nelem) - - data = fltarr(4) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for ielem = 0, nelem-1 do begin - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz, ielem] = data[2] - q_[iz, ielem] = data[3] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt,nelem) - q = reform(q,nz,nt,nelem) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nelem,nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mass[ielem,it] = total(q[*,it,ielem]*dz[*]) - endfor - endfor - - - for it = 0, nt-1 do begin - plot, q[*,0,0], z[*], yrange=[1.e-2,15], xrange=[1.e-15,2.e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3, $ - /xlog, /ylog - - ; Add a legend - plots, [1.5e-10,2.5e-10], 0.1, thick=3, color=66, lin=0 - plots, [1.5e-10,2.5e-10], 0.2, thick=3, color=66, lin=1 - xyouts, 3.0e-10, 0.1, 'DryDep', color=66 - xyouts, 3.0e-10, 0.2, 'NoDryDep', color=66 - - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], lin=ielem, thick=3, color=66 - endfor - - ; Show the mass evolution. - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, lin=ielem - endfor - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,0:it], thick=6, color=66, lin=ielem - endfor - - wait, 0.01 - endfor - - plot, q[*,0,0], z[*], yrange=[1.e-2,15], xrange=[1.e-15,2.e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3, $ - /xlog,/ylog - oplot, [1.e-15,1.e-9], [8,8], thick=1, lin=1 - xyouts, 2.5e-10, 2.0, 't = 0 sec' - - ; Add a legend - plots, [1.5e-10,2.5e-10], 0.1, thick=3, lin=0 - plots, [1.5e-10,2.5e-10], 0.2, thick=3, lin=1 - xyouts, 3.e-10, 0.1, 'DryDep' - xyouts, 3.e-10, 0.2, 'NoDryDep' - - - it = 200 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=86, thick=3, line=ielem - endfor - ;oplot, [1.e-2,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 2.5e-10, 1.0, 't = 200000 sec', color=86 - - it = 400 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=126, thick=3, line=ielem - endfor - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 2.5e-10, 0.5, 't = 400000 sec', color=126 - - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, color=66, lin=ielem - endfor -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_falltest.pro b/CARMAchem_GridComp/CARMA/tests/read_falltest.pro deleted file mode 100644 index 0f6cb5bb..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_falltest.pro +++ /dev/null @@ -1,108 +0,0 @@ - openr, lun, 'carma_falltest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz - - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz) - q_ = fltarr(nz) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz] = data[1] - q_[iz] = data[2] - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt) - q = reform(q,nz,nt) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nt) - - for it = 0, nt-1 do begin - mass[it] = total(q[*,it]*dz[*]) - endfor - - print - - for it = 0, nt-1 do begin - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, q[*,it], z[*], lin=2, thick=3, color=66 - - ; Show the mass evolution. - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass[0:it], thick=6, color=66, lin=0 - - wait, 0.01 - endfor - - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, [0,2.5e-10], [8,8], thick=1, lin=1 - xyouts, 1.5e-10, 8.2, 't = 0 sec' - - it = 100 - oplot, q[*,it], z[*], color=66, thick=3 - oplot, [0,2.5e-10], [6,6], color=66, thick=1, lin=1 - xyouts, 1.5e-10, 6.2, 't = 100000 sec' - - it = 200 - oplot, q[*,it], z[*], color=86, thick=3 - oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 1.5e-10, 4.2, 't = 200000 sec' - - it = 300 - oplot, q[*,it], z[*], color=106, thick=3 - oplot, [0,2.5e-10], [2,2], color=106, thick=1, lin=1 - xyouts, 1.5e-10, 2.2, 't = 300000 sec' - - it = 400 - oplot, q[*,it], z[*], color=126, thick=3 - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 1.5e-10, 0.2, 't = 400000 sec' - - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass, thick=6, color=66, lin=0 -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_growclrtest.pro b/CARMAchem_GridComp/CARMA/tests/read_growclrtest.pro deleted file mode 100644 index 18580f48..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_growclrtest.pro +++ /dev/null @@ -1,216 +0,0 @@ - openr, lun, 'carma_growclrtest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. -; mmr_ = fltarr(nelem, nbin) - mmr_ = fltarr(nbin, nelem) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - t_ = 0. - nsubstep_ = 0 - nretry_ = 0 - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - readf, lun, nsubstep_, nretry_, t_ - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ibin, ielem] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - nsubstep = nsubstep_ - nretry = nretry_ - t = t_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - nsubstep = [nsubstep,nsubstep_] - nretry = [nretry,nretry_] - t = [t,t_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nbin,nt,nelem) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - nsubstep[0] = !values.f_nan - nretry[0] = !values.f_nan - - - !p.multi = [0,2,3] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for it = 0, nt-1 do begin - for ielem = 0, nelem-1 do begin - mmrelem[it,ielem] = total(mmr[*,it,ielem]) - endfor - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[*], mmr[*,0,0], yrange=[1e-30, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=6, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend - plots, [60,62], 1e-10, thick=3, lin=0, color=66 - plots, [60,62], 1e-5, thick=3, lin=0, color=96 - xyouts, 63, 1e-10, 'Ice', color=66 - xyouts, 63, 1e-5, 'Water Vapor', color=96 - - for ielem = 0, nelem-1 do begin - oplot, r[ielem,*], mmr[*,it,ielem], lin=ielem, thick=6, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r), max(r)], [mmrgas[it, igas], mmrgas[it, igas]], thick=6, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=6, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - ; Add a legend - plots, [.25,.5], 5.5e-6, thick=3, lin=0, color=66 - plots, [1.5,1.75], 5.5e-6, thick=3, lin=0, color=96 - plots, [3.25,3.5], 5.5e-6, thick=3, lin=0, color=26 - xyouts, .75, 5.25e-6, 'Ice', color=66 - xyouts, 2., 5.25e-6, 'Water Vapor', color=96 - xyouts, 3.75, 5.25e-6, 'Total Water', color=26 - - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=6, lin=ielem - endfor - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=6, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=6, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=6, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=6, color=96, lin=igas - endfor - - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=6, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 2], charsize=2.0 - - ; Add a legend - plots, [1,1.25], 1.75, thick=3, lin=0, color=66 - plots, [3.5,3.75], 1.75, thick=3, lin=0, color=196 - xyouts, 1.5, 1.7, 'Sat Ice', color=66 - xyouts, 4, 1.7, 'Sat Liq', color=196 - - oplot, [0, nt], [1., 1.], thick=3 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=6, lin=igas - oplot, satice[*,igas], thick=6, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=6, color=196, lin=igas - oplot, satice[0:it, igas], thick=6, color=66, lin=igas - endfor - - - ; Show the temperature evolution. - plot, t[*], xtitle = 'Time Step', ytitle = 'dT (K)', thick=6, $ - title = 'Delta Temperature', $ - yrange=[0., max(t)], charsize=2.0 - - oplot, t[0:it], thick=6, lin=0, color=66 - - - - ; Show the substepping evolution. - plot, nsubstep[0:*], xtitle = 'Time Step', ytitle = 'Nsubsteps', thick=6, $ - title = 'Number of Substeps', $ - yrange=[0., 1.2*max(nsubstep)], charsize=2.0 - - oplot, nsubstep[0:it], thick=6, lin=0, color=66 - - ; Show the retry evolution. - plot, nretry[0:*], xtitle = 'Time Step', ytitle = 'Nretry', thick=6, $ - title = 'Number of Retries', $ - charsize=2.0 - - oplot, nretry[0:it], thick=6, lin=0, color=66 - - wait, 10. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_growintest.pro b/CARMAchem_GridComp/CARMA/tests/read_growintest.pro deleted file mode 100644 index bead9cb7..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_growintest.pro +++ /dev/null @@ -1,215 +0,0 @@ - openr, lun, 'carma_growintest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - t_ = 0. - nsubstep_ = 0 - nretry_ = 0 - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - readf, lun, nsubstep_, nretry_, t_ - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - nsubstep = nsubstep_ - nretry = nretry_ - t = t_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - nsubstep = [nsubstep,nsubstep_] - nretry = [nretry,nretry_] - t = [t,t_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - nsubstep[0] = !values.f_nan - nretry[0] = !values.f_nan - - - !p.multi = [0,2,3] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[*], mmr[0,0,*], yrange=[1e-30, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=6, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend - plots, [60,62], 1e-10, thick=3, lin=0, color=66 - plots, [60,62], 1e-5, thick=3, lin=0, color=96 - xyouts, 63, 1e-10, 'Ice', color=66 - xyouts, 63, 1e-5, 'Water Vapor', color=96 - - for ielem = 0, nelem-1 do begin - oplot, r[*], mmr[ielem,it,*], lin=ielem, thick=6, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r), max(r)], [mmrgas[it, igas], mmrgas[it, igas]], thick=6, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=6, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - ; Add a legend - plots, [.25,.5], 5.5e-6, thick=3, lin=0, color=66 - plots, [1.5,1.75], 5.5e-6, thick=3, lin=0, color=96 - plots, [3.25,3.5], 5.5e-6, thick=3, lin=0, color=26 - xyouts, .75, 5.25e-6, 'Ice', color=66 - xyouts, 2., 5.25e-6, 'Water Vapor', color=96 - xyouts, 3.75, 5.25e-6, 'Total Water', color=26 - - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=6, lin=ielem - endfor - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=6, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=6, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=6, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=6, color=96, lin=igas - endfor - - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=6, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 2], charsize=2.0 - - ; Add a legend - plots, [1,1.25], 1.75, thick=3, lin=0, color=66 - plots, [3.5,3.75], 1.75, thick=3, lin=0, color=196 - xyouts, 1.5, 1.7, 'Sat Ice', color=66 - xyouts, 4, 1.7, 'Sat Liq', color=196 - - oplot, [0, nt], [1., 1.], thick=3 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=6, lin=igas - oplot, satice[*,igas], thick=6, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=6, color=196, lin=igas - oplot, satice[0:it, igas], thick=6, color=66, lin=igas - endfor - - - ; Show the temperature evolution. - plot, t[*], xtitle = 'Time Step', ytitle = 'dT (K)', thick=6, $ - title = 'Delta Temperature', $ - yrange=[0., max(t)], charsize=2.0 - - oplot, t[0:it], thick=6, lin=0, color=66 - - - - ; Show the substepping evolution. - plot, nsubstep[0:*], xtitle = 'Time Step', ytitle = 'Nsubsteps', thick=6, $ - title = 'Number of Substeps', $ - yrange=[0., 1.2*max(nsubstep)], charsize=2.0 - - oplot, nsubstep[0:it], thick=6, lin=0, color=66 - - ; Show the retry evolution. - plot, nretry[0:*], xtitle = 'Time Step', ytitle = 'Nretry', thick=6, $ - title = 'Number of Retries', $ - charsize=2.0 - - oplot, nretry[0:it], thick=6, lin=0, color=66 - - wait, 10. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_growsubtest.pro b/CARMAchem_GridComp/CARMA/tests/read_growsubtest.pro deleted file mode 100644 index 81ac6ea7..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_growsubtest.pro +++ /dev/null @@ -1,215 +0,0 @@ - openr, lun, 'carma_growsubtest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - t_ = 0. - nsubstep_ = 0 - nretry_ = 0 - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - readf, lun, nsubstep_, nretry_, t_ - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - nsubstep = nsubstep_ - nretry = nretry_ - t = t_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - nsubstep = [nsubstep,nsubstep_] - nretry = [nretry,nretry_] - t = [t,t_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - nsubstep[0] = !values.f_nan - nretry[0] = !values.f_nan - - - !p.multi = [0,2,3] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[*], mmr[0,0,*], yrange=[1e-30, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=6, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend - plots, [60,62], 1e-10, thick=3, lin=0, color=66 - plots, [60,62], 1e-5, thick=3, lin=0, color=96 - xyouts, 63, 1e-10, 'Ice', color=66 - xyouts, 63, 1e-5, 'Water Vapor', color=96 - - for ielem = 0, nelem-1 do begin - oplot, r[*], mmr[ielem,it,*], lin=ielem, thick=6, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r), max(r)], [mmrgas[it, igas], mmrgas[it, igas]], thick=6, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=6, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - ; Add a legend - plots, [.25,.5], 5.5e-6, thick=3, lin=0, color=66 - plots, [1.5,1.75], 5.5e-6, thick=3, lin=0, color=96 - plots, [3.25,3.5], 5.5e-6, thick=3, lin=0, color=26 - xyouts, .75, 5.25e-6, 'Ice', color=66 - xyouts, 2., 5.25e-6, 'Water Vapor', color=96 - xyouts, 3.75, 5.25e-6, 'Total Water', color=26 - - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=6, lin=ielem - endfor - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=6, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=6, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=6, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=6, color=96, lin=igas - endfor - - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=6, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 2], charsize=2.0 - - ; Add a legend - plots, [1,1.25], 1.75, thick=3, lin=0, color=66 - plots, [3.5,3.75], 1.75, thick=3, lin=0, color=196 - xyouts, 1.5, 1.7, 'Sat Ice', color=66 - xyouts, 4, 1.7, 'Sat Liq', color=196 - - oplot, [0, nt], [1., 1.], thick=3 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=6, lin=igas - oplot, satice[*,igas], thick=6, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=6, color=196, lin=igas - oplot, satice[0:it, igas], thick=6, color=66, lin=igas - endfor - - - ; Show the temperature evolution. - plot, t[*], xtitle = 'Time Step', ytitle = 'dT (K)', thick=6, $ - title = 'Delta Temperature', $ - yrange=[0., max(t)], charsize=2.0 - - oplot, t[0:it], thick=6, lin=0, color=66 - - - - ; Show the substepping evolution. - plot, nsubstep[0:*], xtitle = 'Time Step', ytitle = 'Nsubsteps', thick=6, $ - title = 'Number of Substeps', $ - yrange=[0., 1.2*max(nsubstep)], charsize=2.0 - - oplot, nsubstep[0:it], thick=6, lin=0, color=66 - - ; Show the retry evolution. - plot, nretry[0:*], xtitle = 'Time Step', ytitle = 'Nretry', thick=6, $ - title = 'Number of Retries', $ - charsize=2.0 - - oplot, nretry[0:it], thick=6, lin=0, color=66 - - wait, 10. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_growtest.pro b/CARMAchem_GridComp/CARMA/tests/read_growtest.pro deleted file mode 100644 index acab2bba..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_growtest.pro +++ /dev/null @@ -1,197 +0,0 @@ - openr, lun, 'carma_growtest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - t_ = 0. - rlheat_ = 0. - - nt = 0L - while(not(eof(lun))) do begin - readf, lun, t1 - - readf, lun, t_, rlheat_ - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - t = t_ - rlheat = rlheat_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - t = [t,t_] - rlheat = [rlheat,rlheat_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - !p.multi = [0,1,5] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0L, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0L, nt-1 do begin - plot, r[*], mmr[0,0,*], yrange=[1e-30, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=3, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend - plots, [60,62], 1e-10, thick=3, lin=0, color=66 - plots, [60,62], 1e-5, thick=3, lin=0, color=96 - xyouts, 63, 1e-10, 'Ice', color=66 - xyouts, 63, 1e-5, 'Water Vapor', color=96 - - for ielem = 0, nelem-1 do begin - oplot, r[*], mmr[ielem,it,*], lin=ielem, thick=3, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r), max(r)], [mmrgas[it, igas], mmrgas[it, igas]], thick=3, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=3, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - ; Add a legend - plots, [2,2.5], 5.5e-6, thick=3, lin=0, color=66 - plots, [4,4.5], 5.5e-6, thick=3, lin=0, color=96 - plots, [9,9.5], 5.5e-6, thick=3, lin=0, color=26 - xyouts, 2.7, 5.25e-6, 'Ice', color=66 - xyouts, 4.7, 5.25e-6, 'Water Vapor', color=96 - xyouts, 9.7, 5.25e-6, 'Total Water', color=26 - - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=3, lin=ielem - endfor - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=3, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=3, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=3, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=3, color=96, lin=igas - endfor - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=3, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 5], charsize=2.0 - - ; Add a legend - plots, [2,2.5], 4.5, thick=3, lin=0, color=66 - plots, [2,2.5], 3.5, thick=3, lin=0, color=196 - xyouts, 2.7, 4.25, 'Sat Ice', color=66 - xyouts, 2.7, 3.25, 'Sat Liq', color=196 - - oplot, [0, nt], [1., 1.], thick=3 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=3, lin=igas - oplot, satice[*,igas], thick=3, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=3, color=196, lin=igas - oplot, satice[0:it, igas], thick=3, color=66, lin=igas - endfor - - ; Show the temperature evolution. - plot, t[*], xtitle = 'Time Step', ytitle = 'dT (K)', thick=3, $ - title = 'Delta Temperature', $ - yrange=[0., max(t)], charsize=2.0 - - oplot, t[0:it], thick=3, lin=0, color=66 - - ; Show the latent heat. - plot, rlheat[*], xtitle = 'Time Step', ytitle = 'LH (K/s)', thick=3, $ - title = 'Latent Heat', $ - yrange=[min(rlheat), max(rlheat)], charsize=2.0 - - oplot, rlheat[0:it], thick=3, lin=0, color=66 - - wait, 2. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_mietest.pro b/CARMAchem_GridComp/CARMA/tests/read_mietest.pro deleted file mode 100644 index ab92a70f..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_mietest.pro +++ /dev/null @@ -1,97 +0,0 @@ - openr, lun, 'carma_mietest.txt', /get_lun - - - ; Read in the wavelengths. - readf, lun, NGROUP, NWAVE, NBIN - - wave = fltarr(NWAVE) - - data = fltarr(2) - - for iwave = 0, NWAVE-1 do begin - readf, lun, data - - wave[iwave] = data[1] - endfor - - - ; Read in the radius, refractive index and optical properties. - r = fltarr(NBIN,NGROUP) - refidx = fltarr(NWAVE,NGROUP) - - qext = fltarr(NWAVE,NGROUP,NBIN) - ssa = fltarr(NWAVE,NGROUP,NBIN) - asym = fltarr(NWAVE,NGROUP,NBIN) - - for igroup = 0, NGROUP-1 do begin - data = fltarr(2) - - for ibin = 0, NBIN-1 do begin - readf, lun, data - r(ibin, igroup) = data[1] - endfor - - data = fltarr(3) - - for iwave = 0, NWAVE-1 do begin - readf, lun, data - endfor - - data = fltarr(5) - - for iwave = 0, NWAVE-1 do begin - for ibin = 0, NBIN-1 do begin - readf, lun, data - print, iwave, ibin, data - - qext(iwave, igroup, ibin) = data[2] - ssa(iwave, igroup, ibin) = data[3] - asym(iwave, igroup, ibin) = data[4] - endfor - endfor - endfor - - free_lun, lun - - - ; Plot qext, ssa and asym - !p.multi=[0,1,3] - loadct, 39 - - for iwave = 0, NWAVE-1 do begin - plot, r[*,0]*1e4, qext[iwave,0,*], yrange=[1e-5,5], xrange=[0.01,15], $ - title = 'Extinction Efficiency, wavelength = '+string(wave[iwave]*1e4)+' (um)', $ - xtitle='Radius [um]', ytitle = 'Qext', thick=3, /XLOG, /YLOG, charsize=2.0 - - plot, r[*,0]*1e4, ssa[iwave,0,*], yrange=[0,1], xrange=[0.01,15], $ - title = 'Single Scattering Albedo', $ - xtitle='Radius [um]', ytitle = 'w', thick=3, /XLOG, charsize=2.0 - - plot, r[*,0]*1e4, asym[iwave,0,*], yrange=[-1,1], xrange=[0.01,15], $ - title = 'Asymmetry Factor', $ - xtitle='Radius [um]', ytitle = 'g', thick=3, /XLOG, charsize=2.0 - - wait, .1 - endfor - - plot, r[*,0]*1e4, qext[0,0,*], yrange=[1e-5,5], xrange=[0.01,15], $ - title = 'Extinction Efficiency, wavelength = '+string(wave[0]*1e4)+' to '+string(wave[NWAVE-1]*1e4)+' (um)', $ - xtitle='Radius [um]', ytitle = 'Qext', thick=2, /XLOG, /YLOG, charsize=2.0 - for iwave = 0, NWAVE-1 do begin - oplot, r[*,0]*1e4, qext[iwave,0,*], thick=2, color=30+4*iwave - endfor - - plot, r[*,0]*1e4, ssa[0,0,*], yrange=[0,1], xrange=[0.01,15], $ - title = 'Single Scattering Albedo', $ - xtitle='Radius [um]', ytitle = 'w', thick=2, /XLOG, charsize=2.0 - for iwave = 0, NWAVE-1 do begin - oplot, r[*,0]*1e4, ssa[iwave,0,*], thick=2, color=30+4*iwave - endfor - - plot, r[*,0]*1e4, asym[0,0,*], yrange=[-1,1], xrange=[0.01,15], $ - title = 'Asymmetry Factor', $ - xtitle='Radius [um]', ytitle = 'g', thick=2, /XLOG, charsize=2.0 - for iwave = 0, NWAVE-1 do begin - oplot, r[*,0]*1e4, asym[iwave,0,*], thick=2, color=30+4*iwave - endfor -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_nuc2test.pro b/CARMAchem_GridComp/CARMA/tests/read_nuc2test.pro deleted file mode 100644 index 9de13196..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_nuc2test.pro +++ /dev/null @@ -1,203 +0,0 @@ - openr, lun, 'carma_nuc2test.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - - !p.multi = [0,1,4] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[0,*]*1000., mmr[0,0,*], yrange=[1e-20, 1e-10], xrange=[min(r[0,*])*1000., max(r[0,*])*1000.], $ - title = 'Sulfate, time = '+string(time[it])+' seconds', $ - xtitle='Radius [nm]', ytitle = 'MMR [kg/kg]', thick=4, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend -; plots, [1.5e-10,1.75e-10], 4.2, thick=3, color=66, lin=0 -; plots, [1.5e-10,1.75e-10], 2.7, thick=3, color=66, lin=1 -; plots, [1.5e-10,1.75e-10], 1.2, thick=3, color=66, lin=2 -; xyouts, 1.8e-10, 4.2, 'None', color=66 -; xyouts, 1.8e-10, 2.7, 'Fitzgerald', color=66 -; xyouts, 1.8e-10, 1.2, 'Gerber', color=66 - - oplot, r[0,*]*1000., mmr[0,it,*], thick=4, color=66 - - plot, r[1,*], mmr[1,0,*], yrange=[1e-15, 1e-5], xrange=[min(r[1,*]), max(r[1,*])], $ - title = 'H2O and Ice', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=4, $ - /XLOG, /YLOG, charsize=2.0 - - for ielem = 1, nelem-1 do begin - oplot, r[1,*], mmr[ielem,it,*], lin=ielem, thick=4, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r[1,*]), max(r[1,*])], [mmrgas[it, igas], mmrgas[it, igas]], thick=4, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=4, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=4, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=4, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=4, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=4, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=4, color=96, lin=igas - endfor - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=4, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 2], charsize=2.0 - - oplot, [0, nt], [1., 1.], thick=2 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=4, lin=igas - oplot, satice[*,igas], thick=4, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=4, color=196, lin=igas - oplot, satice[0:it, igas], thick=4, color=66, lin=igas - endfor - - wait, 20. / nt - endfor - -; plot, q[*,0,0], z[*], yrange=[0,15], xrange=[0,2.e-10], $ -; title = 'Falling History', $ -; xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 -; oplot, [0,2.5e-10], [8,8], thick=1, lin=1 -; xyouts, 1.5e-10, 9.2, 't = 0 sec' - - ; Add a legend -; plots, [1.5e-10,1.75e-10], 4.2, thick=3, lin=0 -; plots, [1.5e-10,1.75e-10], 2.7, thick=3, lin=1 -; plots, [1.5e-10,1.75e-10], 1.2, thick=3, lin=2 -; xyouts, 1.8e-10, 4.2, 'None' -; xyouts, 1.8e-10, 2.7, 'Fitzgerald' -; xyouts, 1.8e-10, 1.2, 'Gerber' - -; it = 200 -; for ielem = 0, nelem-1 do begin -; oplot, q[*,it,ielem], z[*], color=86, thick=3, line=ielem -; endfor -; oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 -; xyouts, 1.5e-10, 7.7, 't = 200000 sec', color=86 - -; it = 400 -; for ielem = 0, nelem-1 do begin -; oplot, q[*,it,ielem], z[*], color=126, thick=3, line=ielem -; endfor -; oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 -; xyouts, 1.5e-10, 6.2, 't = 400000 sec', color=126 - -; plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ -; title = 'Total mass evolution' -; for ielem = 0, nelem-1 do begin -; oplot, mass[ielem,*], thick=6, color=66, lin=ielem -; endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_nuctest.pro b/CARMAchem_GridComp/CARMA/tests/read_nuctest.pro deleted file mode 100644 index f3f41c8b..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_nuctest.pro +++ /dev/null @@ -1,203 +0,0 @@ - openr, lun, 'carma_nuctest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - - !p.multi = [0,1,4] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[0,*]*1000., mmr[0,0,*], yrange=[1e-20, 1e-10], xrange=[min(r[0,*])*1000., max(r[0,*])*1000.], $ - title = 'Sulfate, time = '+string(time[it])+' seconds', $ - xtitle='Radius [nm]', ytitle = 'MMR [kg/kg]', thick=4, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend -; plots, [1.5e-10,1.75e-10], 4.2, thick=3, color=66, lin=0 -; plots, [1.5e-10,1.75e-10], 2.7, thick=3, color=66, lin=1 -; plots, [1.5e-10,1.75e-10], 1.2, thick=3, color=66, lin=2 -; xyouts, 1.8e-10, 4.2, 'None', color=66 -; xyouts, 1.8e-10, 2.7, 'Fitzgerald', color=66 -; xyouts, 1.8e-10, 1.2, 'Gerber', color=66 - - oplot, r[0,*]*1000., mmr[0,it,*], thick=4, color=66 - - plot, r[1,*], mmr[1,0,*], yrange=[1e-15, 1e-5], xrange=[min(r[1,*]), max(r[1,*])], $ - title = 'H2O and Ice', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=4, $ - /XLOG, /YLOG, charsize=2.0 - - for ielem = 1, nelem-1 do begin - oplot, r[1,*], mmr[ielem,it,*], lin=ielem, thick=4, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r[1,*]), max(r[1,*])], [mmrgas[it, igas], mmrgas[it, igas]], thick=4, color=96, lin=igas - endfor - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=4, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=4, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=4, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=4, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=4, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=4, color=96, lin=igas - endfor - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=4, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 2], charsize=2.0 - - oplot, [0, nt], [1., 1.], thick=2 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=4, lin=igas - oplot, satice[*,igas], thick=4, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=4, color=196, lin=igas - oplot, satice[0:it, igas], thick=4, color=66, lin=igas - endfor - - wait, 20. / nt - endfor - -; plot, q[*,0,0], z[*], yrange=[0,15], xrange=[0,2.e-10], $ -; title = 'Falling History', $ -; xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 -; oplot, [0,2.5e-10], [8,8], thick=1, lin=1 -; xyouts, 1.5e-10, 9.2, 't = 0 sec' - - ; Add a legend -; plots, [1.5e-10,1.75e-10], 4.2, thick=3, lin=0 -; plots, [1.5e-10,1.75e-10], 2.7, thick=3, lin=1 -; plots, [1.5e-10,1.75e-10], 1.2, thick=3, lin=2 -; xyouts, 1.8e-10, 4.2, 'None' -; xyouts, 1.8e-10, 2.7, 'Fitzgerald' -; xyouts, 1.8e-10, 1.2, 'Gerber' - -; it = 200 -; for ielem = 0, nelem-1 do begin -; oplot, q[*,it,ielem], z[*], color=86, thick=3, line=ielem -; endfor -; oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 -; xyouts, 1.5e-10, 7.7, 't = 200000 sec', color=86 - -; it = 400 -; for ielem = 0, nelem-1 do begin -; oplot, q[*,it,ielem], z[*], color=126, thick=3, line=ielem -; endfor -; oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 -; xyouts, 1.5e-10, 6.2, 't = 400000 sec', color=126 - -; plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ -; title = 'Total mass evolution' -; for ielem = 0, nelem-1 do begin -; oplot, mass[ielem,*], thick=6, color=66, lin=ielem -; endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_pheattest.pro b/CARMAchem_GridComp/CARMA/tests/read_pheattest.pro deleted file mode 100644 index 80c0075e..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_pheattest.pro +++ /dev/null @@ -1,201 +0,0 @@ - openr, lun, 'carma_pheattest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - dtpart_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - t_ = fltarr(1) - - data = fltarr(4) - datag = fltarr(4) - datat = fltarr(1) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - dtpart_[ielem, ibin] = data[3] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - dtpart = dtpart_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - dtpart = [dtpart,dtpart_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - readf, lun, datat - t_ = datat - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - t = t_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - t = [t, t_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - dtpart = reform(dtpart,nelem,nt,nbin) - mmrgas = reform(mmrgas,nt,ngas) - satliq = reform(satliq,nt,ngas) - satice = reform(satice,nt,ngas) - - !p.multi = [0,1,4] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + total(mmrgas[it, *]) - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -; mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -; mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -satliq[0,*] = !Values.F_NAN -satice[0,*] = !Values.F_NAN - - for it = 0, nt-1 do begin - plot, r[*], mmr[0,0,*], yrange=[1e-30, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=6, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend - plots, [2,2.5], 1e-10, thick=3, lin=0, color=66 - plots, [2,2.5], 1e-15, thick=3, lin=0, color=96 - xyouts, 2.7, 1e-10, 'Ice', color=66 - xyouts, 2.7, 1e-15, 'Water Vapor', color=96 - - for ielem = 0, nelem-1 do begin - oplot, r[*], mmr[ielem,it,*], lin=ielem, thick=6, color=66 - endfor - - for igas = 0, ngas-1 do begin - oplot, [min(r), max(r)], [mmrgas[it, igas], mmrgas[it, igas]], thick=6, color=96, lin=igas - endfor - - - ; Show particle temperature - maxdtp = max(abs(dtpart)) - plot, r[*], dtpart[0,0,0:NBIN-2], yrange=[-maxdtp, maxdtp], $ - title = 'Particle Temperature', $ - xtitle='Radius [um]', ytitle = 'dTparticle [K]', thick=6, $ - /XLOG, charsize=2.0 - - ; Add a legend - plots, [.0002,.0003], .72 * maxdtp, thick=3, lin=0, color=66 - xyouts, .00035, .7 * maxdtp, 'Ice', color=66 - - for ielem = 0, nelem-1 do begin - oplot, r[*], dtpart[ielem,it,0:NBIN-2], lin=ielem, thick=6, color=66 - endfor - - - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=6, $ - title = 'Total mmr evolution', charsize=2.0, $ - yrange=[min([min(mmrtotal), min(mmrgas), min(mmrelem)]), max([max(mmrtotal), 1.5*max(mmrgas), max(mmrelem)])] - - ; Add a legend - plots, [2,2.5], 5.25e-6, thick=3, lin=0, color=66 - plots, [4,4.5], 5.25e-6, thick=3, lin=0, color=96 - plots, [9,9.5], 5.25e-6, thick=3, lin=0, color=26 - xyouts, 2.7, 5.e-6, 'Ice', color=66 - xyouts, 4.7, 5.e-6, 'Water Vapor', color=96 - xyouts, 9.7, 5.e-6, 'Total Water', color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[*,ielem], thick=6, lin=ielem - endfor - for igas = 0, ngas-1 do begin - oplot, mmrgas[*,igas], thick=6, lin=igas - endfor - - oplot, mmrtotal[0:it], thick=6, color=26 - - for ielem = 0, nelem-1 do begin - oplot, mmrelem[0:it,ielem], thick=6, color=66, lin=ielem - endfor - - for igas = 0, ngas-1 do begin - oplot, mmrgas[0:it, igas], thick=6, color=96, lin=igas - endfor - - ; Show the saturation evolution. - plot, satice[*], xtitle = 'Time Step', ytitle = 's', thick=6, $ - title = 'Gas Saturation Ratio', $ - yrange=[0, 10], charsize=2.0 - - ; Add a legend - plots, [2,2.5], 8, thick=3, lin=0, color=66 - plots, [2,2.5], 6, thick=3, lin=0, color=196 - xyouts, 2.7, 7.75, 'Sat Ice', color=66 - xyouts, 2.7, 5.75, 'Sat Liq', color=196 - - oplot, [0, nt], [1., 1.], thick=3 - - for igas = 0, ngas-1 do begin - oplot, satliq[*,igas], thick=6, lin=igas - oplot, satice[*,igas], thick=6, lin=igas - endfor - - for igas = 0, ngas-1 do begin - oplot, satliq[0:it, igas], thick=6, color=196, lin=igas - oplot, satice[0:it, igas], thick=6, color=66, lin=igas - endfor - - wait, 15. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_scfalltest.pro b/CARMAchem_GridComp/CARMA/tests/read_scfalltest.pro deleted file mode 100644 index d7676496..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_scfalltest.pro +++ /dev/null @@ -1,108 +0,0 @@ - openr, lun, 'carma_scfalltest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz - - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz) - q_ = fltarr(nz) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz] = data[1] - q_[iz] = data[2] - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt) - q = reform(q,nz,nt) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nt) - - for it = 0, nt-1 do begin - mass[it] = total(q[*,it]*dz[*]) - endfor - - print - - for it = 0, nt-1 do begin - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, q[*,it], z[*], lin=2, thick=3, color=66 - - ; Show the mass evolution. - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass[0:it], thick=6, color=66, lin=0 - - wait, 0.01 - endfor - - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, [0,2.5e-10], [8,8], thick=1, lin=1 - xyouts, 1.5e-10, 8.2, 't = 0 sec' - - it = 100 - oplot, q[*,it], z[*], color=66, thick=3 - oplot, [0,2.5e-10], [6,6], color=66, thick=1, lin=1 - xyouts, 1.5e-10, 6.2, 't = 100000 sec' - - it = 200 - oplot, q[*,it], z[*], color=86, thick=3 - oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 1.5e-10, 4.2, 't = 200000 sec' - - it = 300 - oplot, q[*,it], z[*], color=106, thick=3 - oplot, [0,2.5e-10], [2,2], color=106, thick=1, lin=1 - xyouts, 1.5e-10, 2.2, 't = 300000 sec' - - it = 400 - oplot, q[*,it], z[*], color=126, thick=3 - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 1.5e-10, 0.2, 't = 400000 sec' - - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass, thick=6, color=66, lin=0 -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_sigmadrydeptest.pro b/CARMAchem_GridComp/CARMA/tests/read_sigmadrydeptest.pro deleted file mode 100644 index 50481602..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_sigmadrydeptest.pro +++ /dev/null @@ -1,131 +0,0 @@ - openr, lun, 'carma_sigmadrydeptest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz, nelem - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz, nelem) - q_ = fltarr(nz, nelem) - - data = fltarr(4) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for ielem = 0, nelem-1 do begin - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz, ielem] = data[2] - q_[iz, ielem] = data[3] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt,nelem) - q = reform(q,nz,nt,nelem) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nelem,nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mass[ielem,it] = total(q[*,it,ielem]*dz[*]) - endfor - endfor - - - for it = 0, nt-1 do begin - plot, q[*,0,0], z[*], yrange=[1.e-2,15], xrange=[1.e-15,2.e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3, $ - /xlog, /ylog - - ; Add a legend - plots, [1.5e-10,2.5e-10], 0.1, thick=3, color=66, lin=0 - plots, [1.5e-10,2.5e-10], 0.2, thick=3, color=66, lin=1 - xyouts, 3.0e-10, 0.1, 'DryDep', color=66 - xyouts, 3.0e-10, 0.2, 'NoDryDep', color=66 - - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], lin=ielem, thick=3, color=66 - endfor - - ; Show the mass evolution. - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, lin=ielem - endfor - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,0:it], thick=6, color=66, lin=ielem - endfor - - wait, 0.01 - endfor - - plot, q[*,0,0], z[*], yrange=[1.e-2,15], xrange=[1.e-15,2.e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3, $ - /xlog,/ylog - oplot, [1.e-15,1.e-9], [8,8], thick=1, lin=1 - xyouts, 2.5e-10, 2.0, 't = 0 sec' - - ; Add a legend - plots, [1.5e-10,2.5e-10], 0.1, thick=3, lin=0 - plots, [1.5e-10,2.5e-10], 0.2, thick=3, lin=1 - xyouts, 3.e-10, 0.1, 'DryDep' - xyouts, 3.e-10, 0.2, 'NoDryDep' - - - it = 200 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=86, thick=3, line=ielem - endfor - ;oplot, [1.e-2,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 2.5e-10, 1.0, 't = 200000 sec', color=86 - - it = 400 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=126, thick=3, line=ielem - endfor - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 2.5e-10, 0.5, 't = 400000 sec', color=126 - - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, color=66, lin=ielem - endfor -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_sigmafalltest.pro b/CARMAchem_GridComp/CARMA/tests/read_sigmafalltest.pro deleted file mode 100644 index 01d03959..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_sigmafalltest.pro +++ /dev/null @@ -1,108 +0,0 @@ - openr, lun, 'carma_sigmafalltest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz - - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz) - q_ = fltarr(nz) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz] = data[1] - q_[iz] = data[2] - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt) - q = reform(q,nz,nt) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nt) - - for it = 0, nt-1 do begin - mass[it] = total(q[*,it]*dz[*]) - endfor - - print - - for it = 0, nt-1 do begin - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, q[*,it], z[*], lin=2, thick=3, color=66 - - ; Show the mass evolution. - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass[0:it], thick=6, color=66, lin=0 - - wait, 0.01 - endfor - - plot, q[*,0], z[*], yrange=[0,11], xrange=[0,2.5e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, [0,2.5e-10], [8,8], thick=1, lin=1 - xyouts, 1.5e-10, 8.2, 't = 0 sec' - - it = 100 - oplot, q[*,it], z[*], color=66, thick=3 - oplot, [0,2.5e-10], [6,6], color=66, thick=1, lin=1 - xyouts, 1.5e-10, 6.2, 't = 100000 sec' - - it = 200 - oplot, q[*,it], z[*], color=86, thick=3 - oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 1.5e-10, 4.2, 't = 200000 sec' - - it = 300 - oplot, q[*,it], z[*], color=106, thick=3 - oplot, [0,2.5e-10], [2,2], color=106, thick=1, lin=1 - xyouts, 1.5e-10, 2.2, 't = 300000 sec' - - it = 400 - oplot, q[*,it], z[*], color=126, thick=3 - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 1.5e-10, 0.2, 't = 400000 sec' - - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass, thick=6, color=66, lin=0 -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_sulfatetest.pro b/CARMAchem_GridComp/CARMA/tests/read_sulfatetest.pro deleted file mode 100644 index 14a98202..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_sulfatetest.pro +++ /dev/null @@ -1,193 +0,0 @@ - openr, lun, 'carma_sulfatetest.txt', /get_lun - - ; Read in the sizes. - readf, lun, ngroup, nelem, nbin, ngas - - r = fltarr(ngroup, nbin) - rmass = fltarr(ngroup, nbin) - - data = fltarr(4) - - for igroup = 0, ngroup-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - r[igroup, ibin] = data[2] - rmass[igroup, ibin] = data[3] - endfor - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nelem, nbin) - mmrgas_ = fltarr(ngas) - satliq_ = fltarr(ngas) - satice_ = fltarr(ngas) - - data = fltarr(3) - datag = fltarr(4) - - t_ = 0. - nsubstep_ = 0 - nretry_ = 0 - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - readf, lun, nsubstep_, nretry_, t_ - - for ielem = 0, nelem-1 do begin - for ibin = 0, nbin-1 do begin - readf, lun, data - - mmr_[ielem, ibin] = data[2] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - nsubstep = nsubstep_ - nretry = nretry_ - t = t_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - nsubstep = [nsubstep,nsubstep_] - nretry = [nretry,nretry_] - t = [t,t_] - endelse - - for igas = 0, ngas-1 do begin - readf, lun, datag - - mmrgas_[igas] = datag[1] - satliq_[igas] = datag[2] - satice_[igas] = datag[3] - endfor - - if (nt eq 0) then begin - mmrgas = mmrgas_ - satliq = satliq_ - satice = satice_ - endif else begin - mmrgas = [mmrgas,mmrgas_] - satliq = [satliq,satliq_] - satice = [satice,satice_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nelem,nt,nbin) - mmrgas = reform(mmrgas,ngas,nt) - satliq = reform(satliq,ngas, nt) - satice = reform(satice,ngas, nt) - - nsubstep[0] = !values.f_nan - nretry[0] = !values.f_nan - - !p.multi = [0,1,5] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mmrelem = fltarr(nt,nelem) - mmrtotal = fltarr(nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mmrelem[it,ielem] = total(mmr[ielem,it,*]) - mmrtotal[it] = total(mmrelem[it,*]) + mmrgas[1, it] - endfor - endfor - - mmr[where(mmr le 0.)] = !Values.F_NAN -;mmrelem[where(mmrelem le 0.)] = !Values.F_NAN -;mmrtotal[where(mmrtotal le 0.)] = !Values.F_NAN -; satliq[where(satliq le 0.)] = !Values.F_NAN -; satice[where(satice le 0.)] = !Values.F_NAN - satliq[*, 0] = !Values.F_NAN - satice[*, 0] = !Values.F_NAN - - - for it = 0, nt-1 do begin - ; ======plot 1 ============== - plot, r[*], mmr[0,0,*], yrange=[1e-35, 10*max(mmrtotal)], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Radius [um]', ytitle = 'MMR [kg/kg]', thick=6, $ - /XLOG, /YLOG, charsize=2.0 - - ; Add a legend -; plots, [1.5e-10,1.75e-10], 1.0, thick=3, color=66, lin=0 -; plots, [1.5e-10,1.75e-10], 1.0, thick=3, color=66, lin=1 -; plots, [1.5e-10,1.75e-10], 1.2, thick=3, color=66, lin=2 -; xyouts, 1.8e-10, 4.2, 'sulfate mmr', color=66 -; xyouts, 1.8e-10, 2.7, 'gas mmr', color=96 -; xyouts, 1.8e-10, 1.2, 'Gerber', color=66 - - - oplot, r[*], mmr[0,it,*], thick=6, color=66 ; Sulfates, darkblue - - oplot, [min(r), max(r)], [mmrgas[1, it], mmrgas[1, it]], thick=6, color=96 ; H2SO4 gas, light blue - - - ; ======plot 2 ============== - ; Show the mmr evolution. - plot, mmrtotal[*], xtitle = 'Time Step', ytitle = 'mmr [kg/kg]', thick=6, $ - title = 'Total mmr evolution', charsize=2.0, $ - xrange=[0,nt-1], $ - yrange=[0., 1.5*max(mmrtotal[*])] - - ; Add a legend - plots, [nt/25., nt/25.+1.], 1.4*max(mmrtotal[*]), thick=3, lin=0, color=66 - plots, [5.*nt/50.,5.*nt/50.+1.], 1.4*max(mmrtotal[*]), thick=3, lin=0, color=96 - plots, [11.*nt/50.,11.*nt/50.+1.], 1.4*max(mmrtotal[*]), thick=3, lin=0, color=26 - xyouts, nt/25.+1.5, 1.3*max(mmrtotal[*]), 'Sulfate', color=66 - xyouts, 5.*nt/50.+1.5, 1.3*max(mmrtotal[*]), 'Sulfate Gas', color=96 - xyouts, 11.*nt/50.+1.5, 1.3*max(mmrtotal[*]), 'Total H2SO4', color=26 - - oplot, mmrelem[*,0], thick=6 ; Sulfates, trajectory - - - oplot, mmrgas[1,*], thick=6 ; H2SO4 gas, trajectory - - - oplot, mmrtotal[0:it], thick=6, color=26 ; Total H2SO4, purple - - - oplot, mmrelem[0:it,0], thick=6, color=66 ; Sulfates, dark blue - - - oplot, mmrgas[1, 0:it], thick=6, color=96 ; H2SO4 gas, light blue - - ; ======plot 3 ============== - ; Show the saturation evolution. - plot, satliq[*, 2], xtitle = 'Time Step', ytitle = 's', thick=6, $ - title = 'Gas Saturation Ratio', $ - xrange=[0,nt-1], yrange=[0,max(satliq, /NAN)], charsize=2.0 - - oplot, satliq[1, *], thick=6 - oplot, satice[1, *], thick=6 - - oplot, satliq[1, 0:it], thick=6, color=196 ; liquid, yellow - - ; Show the substepping evolution. - plot, nsubstep[0:*], xtitle = 'Time Step', ytitle = 'Nsubsteps', thick=6, $ - title = 'Number of Substeps', $ - yrange=[0., 1.2*max(nsubstep)], charsize=2.0 - - oplot, nsubstep[0:it], thick=6, lin=0, color=66 - - ; Show the retry evolution. - plot, nretry[0:*], xtitle = 'Time Step', ytitle = 'Nretry', thick=6, $ - title = 'Number of Retries', $ - charsize=2.0 - - oplot, nretry[0:it], thick=6, lin=0, color=66 - - wait, 15. / nt - endfor - -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_swelltest.pro b/CARMAchem_GridComp/CARMA/tests/read_swelltest.pro deleted file mode 100644 index 07475d04..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_swelltest.pro +++ /dev/null @@ -1,132 +0,0 @@ - openr, lun, 'carma_swelltest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz, nelem - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz, nelem) - q_ = fltarr(nz, nelem) - - data = fltarr(4) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for ielem = 0, nelem-1 do begin - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz, ielem] = data[2] - q_[iz, ielem] = data[3] - endfor - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt,nelem) - q = reform(q,nz,nt,nelem) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nelem,nt) - - for ielem = 0, nelem-1 do begin - for it = 0, nt-1 do begin - mass[ielem,it] = total(q[*,it,ielem]*dz[*]) - endfor - endfor - - - for it = 0, nt-1 do begin - plot, q[*,0,0], z[*], yrange=[0,15], xrange=[0,2.e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - - ; Add a legend - plots, [1.5e-10,1.75e-10], 4.2, thick=3, color=66, lin=0 - plots, [1.5e-10,1.75e-10], 2.7, thick=3, color=66, lin=1 - plots, [1.5e-10,1.75e-10], 1.2, thick=3, color=66, lin=2 - xyouts, 1.8e-10, 4.2, 'None', color=66 - xyouts, 1.8e-10, 2.7, 'Fitzgerald', color=66 - xyouts, 1.8e-10, 1.2, 'Gerber', color=66 - - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], lin=ielem, thick=3, color=66 - endfor - - ; Show the mass evolution. - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, lin=ielem - endfor - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,0:it], thick=6, color=66, lin=ielem - endfor - - wait, 0.01 - endfor - - plot, q[*,0,0], z[*], yrange=[0,15], xrange=[0,2.e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, [0,2.5e-10], [8,8], thick=1, lin=1 - xyouts, 1.5e-10, 9.2, 't = 0 sec' - - ; Add a legend - plots, [1.5e-10,1.75e-10], 4.2, thick=3, lin=0 - plots, [1.5e-10,1.75e-10], 2.7, thick=3, lin=1 - plots, [1.5e-10,1.75e-10], 1.2, thick=3, lin=2 - xyouts, 1.8e-10, 4.2, 'None' - xyouts, 1.8e-10, 2.7, 'Fitzgerald' - xyouts, 1.8e-10, 1.2, 'Gerber' - - it = 200 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=86, thick=3, line=ielem - endfor - oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 1.5e-10, 7.7, 't = 200000 sec', color=86 - - it = 400 - for ielem = 0, nelem-1 do begin - oplot, q[*,it,ielem], z[*], color=126, thick=3, line=ielem - endfor - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 1.5e-10, 6.2, 't = 400000 sec', color=126 - - plot, mass[0,*], xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - for ielem = 0, nelem-1 do begin - oplot, mass[ielem,*], thick=6, color=66, lin=ielem - endfor -end diff --git a/CARMAchem_GridComp/CARMA/tests/read_vdiftest.pro b/CARMAchem_GridComp/CARMA/tests/read_vdiftest.pro deleted file mode 100644 index c401023d..00000000 --- a/CARMAchem_GridComp/CARMA/tests/read_vdiftest.pro +++ /dev/null @@ -1,108 +0,0 @@ - openr, lun, 'carma_vdiftest.txt', /get_lun - - ; Read in the vertical grid. - readf, lun, nz - - z = fltarr(nz) - dz = fltarr(nz) - - data = fltarr(3) - - for iz = 0, nz-1 do begin - readf, lun, data - - z[iz] = data[1] - dz[iz] = data[2] - endfor - - ; Read in the particles for each time step. - mmr_ = fltarr(nz) - q_ = fltarr(nz) - - nt = 0 - while(not(eof(lun))) do begin - readf, lun, t1 - - for iz = 0, nz-1 do begin - readf, lun, data - - mmr_[iz] = data[1] - q_[iz] = data[2] - endfor - - if (nt eq 0) then begin - time = t1 - mmr = mmr_ - q = q_ - endif else begin - time = [time,t1] - mmr = [mmr,mmr_] - q = [q,q_] - endelse - - nt = nt+1 - endwhile - - free_lun, lun - - mmr = reform(mmr,nz,nt) - q = reform(q,nz,nt) - - z = z/1000. - - !p.multi = [0,1,2] - loadct, 39 - - ;Calculate the column mass, which should be conserved. - mass = fltarr(nt) - - for it = 0, nt-1 do begin - mass[it] = total(q[*,it]*dz[*]) - endfor - - print - - for it = 0, nt-1 do begin - plot, q[*,0], z[*], yrange=[80,104], xrange=[0,2.5e-10], $ - title = 'time = '+string(time[it])+' seconds', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, q[*,it], z[*], lin=2, thick=3, color=66 - - ; Show the mass evolution. - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass[0:it], thick=6, color=66, lin=0 - - wait, 0.01 - endfor - - plot, q[*,0], z[*], yrange=[80,104], xrange=[0,2.5e-10], $ - title = 'Falling History', $ - xtitle='Particle Concentration [g cm-3]', ytitle = 'Altitude [km]', thick=3 - oplot, [0,2.5e-10], [8,8], thick=1, lin=1 - xyouts, 1.5e-10, 8.2, 't = 0 sec' - - it = 100 - oplot, q[*,it], z[*], color=66, thick=3 - oplot, [0,2.5e-10], [6,6], color=66, thick=1, lin=1 - xyouts, 1.5e-10, 6.2, 't = 100000 sec' - - it = 200 - oplot, q[*,it], z[*], color=86, thick=3 - oplot, [0,2.5e-10], [4,4], color=86, thick=1, lin=1 - xyouts, 1.5e-10, 4.2, 't = 200000 sec' - - it = 300 - oplot, q[*,it], z[*], color=106, thick=3 - oplot, [0,2.5e-10], [2,2], color=106, thick=1, lin=1 - xyouts, 1.5e-10, 2.2, 't = 300000 sec' - - it = 400 - oplot, q[*,it], z[*], color=126, thick=3 - oplot, [0,2.5e-10], [0,0], color=126, thick=1, lin=1 - xyouts, 1.5e-10, 0.2, 't = 400000 sec' - - plot, mass, xtitle = 'Time Step', ytitle = 'Column Mass [g cm-2]', thick=6, $ - title = 'Total mass evolution' - oplot, mass, thick=6, color=66, lin=0 -end diff --git a/CARMAchem_GridComp/CARMA/view-bench.csh b/CARMAchem_GridComp/CARMA/view-bench.csh deleted file mode 100755 index 183b8d63..00000000 --- a/CARMAchem_GridComp/CARMA/view-bench.csh +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/tcsh -f -# An entry point for viewing the results of the benchmark runs that -# are part of the CARMA distribution. -# -# Usage -# view-bench.csh [view target] -# -# build target - target label for the make -# - -# Environment Variables -# CARMA_BUILD [carma] -# The subdirectory in which the build was performed. - -if (! $?CARMA_IDL ) then - setenv CARMA_IDL /Applications/itt/idl70/bin/idl -endif - -set runtgt=CARMATEST.exe - -if ($# == 1) then - set runtgt="$1" -endif - -set rundir=run/bench -set testdir=tests -set idlfile="read_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.pro" -set outfile="carma_`echo $runtgt:r | tr '[A-Z]' '[a-z]'`.txt" - -echo $idlfile -echo $outfile - -# Create a directory for the build. -echo "Viewing $testdir/bench/$outfile in the directory $rundir ..." -mkdir -p $rundir - -# Copy the benchmark result to the run directory. -cp $testdir/bench/$outfile $rundir - -if (-f $testdir/$idlfile) then - - # Don't overwrite the file in the run directory if it is newer than - # the one in the test directory. - # - # NOTE: For the test on modification date to work, the copy must - # preserve the modify date and time. - if (-f $rundir/$idlfile) then - if (-M "$rundir/$idlfile" > -M "$testdir/$idlfile") then - setenv IDL_WARNING " WARNING: $idlfile not copied, since $rundir/$idlfile is newer than $testdir/$idlfile" - else - cp -p $testdir/$idlfile $rundir - endif - else - cp -p $testdir/$idlfile $rundir - endif -endif - -# Execute the make file in the build directory. -cd $rundir - -if (-f $idlfile) then - - if (-f $outfile) then - echo "" - echo "Running the IDL analysis routine $idlfile" - - if ($?IDL_WARNING) then - echo "" - echo "$IDL_WARNING" - echo "" - endif - - echo " To run the test, in IDL you need to type the command: .r $idlfile" - echo " To exit IDL, type the command: exit" - - # NOTE: If your invokation of IDL fails, check to see whether idl - # is really on you path or if it is just an alias. Aliases don't work - # properly in scripts, but this is how IDL is setup be default. You - # can add the idl bin directory to your path so that this will work. - echo "" - $CARMA_IDL - endif -endif - - diff --git a/CARMAchem_GridComp/CARMA_GridComp.F90 b/CARMAchem_GridComp/CARMA_GridComp.F90 deleted file mode 100644 index 6bdbe4aa..00000000 --- a/CARMAchem_GridComp/CARMA_GridComp.F90 +++ /dev/null @@ -1,1591 +0,0 @@ -#include "MAPL_Generic.h" -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: CARMA_GridCompMod --- CARMA Grid Component Class -! -! Grid Component class for the Community Aerosol and Radiation -! Model for Atmospheres aerosol/cloud microphysics package. -! -! !INTERFACE: -! - - MODULE CARMA_GridCompMod - -! !USES: - - USE ESMF - USE MAPL - USE Chem_Mod - USE Chem_UtilMod - USE m_inpak90 ! Resource file management - -! Utility Modules - use DryDepositionMod ! Aerosol Dry Deposition - use WetRemovalMod ! Aerosol Wet Removal - use DustEmissionMod, only: KokSizeDistribution - - -! CARMA Specific Methods - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmagas_mod - use carmastate_mod - use carma_mod - - IMPLICIT NONE - INTEGER, PARAMETER :: DBL = KIND(0.00D+00) - -! !TYPES: - - PRIVATE - PUBLIC CARMA_GridComp ! The CARMA object - PUBLIC CARMA_Registry - -! !PUBLIC MEMBER FUNCTIONS: - - PUBLIC CARMA_GridCompInitialize - PUBLIC CARMA_GridCompRun - PUBLIC CARMA_GridCompFinalize - PRIVATE dumpGas - PRIVATE dumpElement - PRIVATE dumpGroup - -! -! !DESCRIPTION: -! -! This module implements the CARMA aerosol & cloud microphysics model -! -! !REVISION HISTORY: -! -! 16Sep2003 da Silva First crack. -! 24Jan2O05 Nielsen Implementation of Code 916 chemistry -! 19Dec2005 d Silva Minor portability mods. -! 30Oct2007 Nielsen GMI Combo set up -! 18May2009 Colarco Follow GMI setup to implement CARMA -! -!EOP -!------------------------------------------------------------------------- - - TYPE CARMA_GridComp - CHARACTER(LEN=255) :: name = "CARMA aerosol/cloud microphysics" - type(CARMA_Registry), pointer :: CARMAreg => null() - type(carma_type), pointer :: carma - type(Chem_Mie), pointer :: CARMAmie ! GOCART style Mie lookup tables - integer :: i1 = 1, i2, im, j1 = 1, j2, jm, km - type(ESMF_grid) :: grid - real, pointer, dimension(:,:) :: LONS, LATS - integer :: nymd_bc = 1 - -! Pointers to species specific emissions - -! Dust - real, pointer, dimension(:,:) :: dust_source => null() - -! Smoke - -! Sulfate - real, pointer :: vLat(:) => null(), & - vLon(:) => null(), & - vSO2(:) => null(), & - vElev(:) => null(), & - vCloud(:) => null() - -! Component derived type declarations -! ----------------------------------- -! TYPE(t_Chemistry ) :: Chemistry - - END TYPE CARMA_GridComp - - TYPE CARMA_Registry - logical :: doing_CARMA = .false. - integer :: nq - character(len=255), pointer :: vname(:) ! variable name (groupname::elemname::XXX) - CHARACTER(LEN=255) :: rcfilen = 'CARMAchem_Registry.rc' - integer :: NBIN, NGROUP, NELEM, NSOLUTE, NGAS, NWAVE - REAL(kind=f), pointer :: RMRAT(:) =>null(), & - RMIN(:) =>null(), & - RHOP(:) =>null(), & - ESHAPE(:) =>null(), & - FSCAV(:) =>null() - INTEGER, pointer :: IGROUP(:) =>null(), & - IRHSWELL(:) =>null(), & - IRHSWCOMP(:) =>null(), & - ISHAPE(:) =>null(), & - ICOMPOSITION(:) =>null(), & - ITYPE(:) =>null() - character(len=255), pointer :: GROUPNAME(:) =>null(), & - ELEMNAME(:) =>null() - -! Gases - character(len=255), pointer :: GASNAME(:) => null() - integer, pointer :: IGCOMP(:) => null(), & - IGVAPREQ(:) => null() - - logical :: do_cnst_rlh = .false. - logical :: do_coag = .false. !! do coagulation? - logical :: do_detrain = .false. - logical :: do_fixedinit = .false. - logical :: do_grow = .false. !! do nucleation, growth and evaporation? - logical :: do_incloud = .false. - logical :: do_explised = .false. - logical :: do_print_init = .false. - logical :: do_substep = .false. !! do substepping - logical :: do_thermo = .false. !! do thermodynamics - logical :: do_vdiff = .false. !! do Brownin diffusion - logical :: do_vtran = .false. !! do sedimentation - real(kind=f) :: vf_const = 0._f !! if specified and non-zero, constant - !! fall velocity for all particles [cm/s] - integer :: minsubsteps = 1 !! minimum number of substeps, default = 1 - integer :: maxsubsteps = 32 !! maximum number of substeps, default = 32 - integer :: maxretries = 16 !! maximum number of substep retries, default = 16 - real(kind=f) :: conmax = 0.1_f !! minimum relative concentration to - !! consider, default = 1e-1 -! Species specific information - integer :: igrp_mixed = -1 !! mixed group - integer :: mixedcorecomp = -1 !! mixed core element (sulfate) - integer :: igrp_sulfate = -1 !! sulfate group - integer :: ielm_sulfate = -1 !! sulfate pc element - integer :: igrp_dust = -1 !! dust group - integer :: ielm_dust = -1 !! dust pc element - integer :: igrp_seasalt = -1 !! seasalt group - integer :: ielm_seasalt = -1 !! seasalt pc element - integer :: igrp_smoke = -1 !! smoke group - integer :: ielm_smoke = -1 !! smoke pc element - integer :: igrp_black_carbon = -1 !! black carbon group - integer :: ielm_black_carbon = -1 !! black carbon pc element - integer :: igrp_ash = -1 !! ash group - integer :: ielm_ash = -1 !! ash pc element - integer :: ielm_mxpc = -1 !! mixed group pc element - integer :: ielm_mxsulfate= -1 !! mixed group sulfate core element - integer :: ielm_mxdust = -1 !! mixed group dust core element - integer :: ielm_mxsmoke = -1 !! mixed group smoke core element - integer :: ielm_mxseasalt= -1 !! mixed group seasalt core element - integer :: ielm_mxbc = -1 !! mixed group black carbon core element - integer :: ielm_mxash = -1 !! mixed group ash core element - integer :: igas_h2o = -1 !! water vapor - integer :: igas_h2so4 = -1 !! sulfuric acid gas - integer :: igas_hno3 = -1 !! nitric acid gas - integer :: ifallrtn = 1 !! default fall velocity routine for particles - -! Dust - real :: dust_emissions_fudgefactor - real, pointer :: dmass_dust(:) => null() !! dust emission size distribution - -! Sea Salt - real :: seasalt_emissions_fudgefactor - -! Smoke - real :: organic_matter_to_organic_carbon_ratio - real :: fraction_terpene_to_organic_carbon - -! Black Carbon - -! Sulfate - character(len=255) :: sulfuric_acid_source - -! GOCART-style Mie Lookup Tables - integer :: nchannels, nmoments - real, pointer :: channels(:) - character(len=255) :: du_optics_file - character(len=255) :: ss_optics_file - character(len=255) :: bc_optics_file - character(len=255) :: sm_optics_file - character(len=255) :: su_optics_file - -! Workspace for any requested point emissions -! Sulfate - logical :: doing_point_emissions_sulfate=.FALSE. ! Providing pointwise emissions - character(len=255) :: point_emissions_srcfilen_sulfate ! filename for pointwise emissions - integer :: nPts_sulfate = -1 - integer, pointer, dimension(:) :: vstart_sulfate => null(), & - vend_sulfate => null() - real, pointer, dimension(:) :: vLat_sulfate => null(), & - vLon_sulfate => null(), & - vBase_sulfate => null(), & - vTop_sulfate => null(), & - vEmis_sulfate => null() -! Ash - logical :: doing_point_emissions_ash=.FALSE. ! Providing pointwise emissions - character(len=255) :: point_emissions_srcfilen_ash ! filename for pointwise emissions - integer :: nPts_ash = -1 - integer, pointer, dimension(:) :: vstart_ash => null(), & - vend_ash => null() - real, pointer, dimension(:) :: vLat_ash => null(), & - vLon_ash => null(), & - vBase_ash => null(), & - vTop_ash => null(), & - vEmis_ash => null() -! Dust - logical :: doing_point_emissions_dust=.FALSE. ! Providing pointwise emissions - character(len=255) :: point_emissions_srcfilen_dust ! filename for pointwise emissions - integer :: nPts_dust = -1 - integer, pointer, dimension(:) :: vstart_dust => null(), & - vend_dust => null() - real, pointer, dimension(:) :: vLat_dust => null(), & - vLon_dust => null(), & - vBase_dust => null(), & - vTop_dust => null(), & - vEmis_dust => null() - - - END TYPE CARMA_Registry - -CONTAINS - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_GridCompInitialize --- Initialize CARMA_GridComp -! -! !INTERFACE: -! - - SUBROUTINE CARMA_GridCompInitialize( gcCARMA, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - INTEGER, PARAMETER :: DBL = KIND(0.00D+00) - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Initializes the CARMA Grid Component. It primarily sets -! the import state. -! -! !REVISION HISTORY: -! -! 18Sep2003 da Silva First crack. -! 30Jun2007 Nielsen GMI Combo set up -! 18May2009 Colarco Adapt to use for CARMA -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_GridCompInitialize' - CHARACTER(LEN=255) :: rcfilen = 'CARMAchem_Registry.rc' - CHARACTER(LEN=255) :: string - - INTEGER :: ios, n - INTEGER, ALLOCATABLE :: ier(:) - INTEGER :: i, i1, i2, ic, im, j, j1, j2, jm, km - INTEGER :: nbins, n1, n2 - INTEGER :: STATUS - - INTEGER :: NBIN, NGROUP, NELEM, NSOLUTE, NWAVE, NGAS - REAL(kind=f), allocatable :: rmrat(:), rmin(:), rhop(:), & - eshape(:), ishape(:), & - radius_(:), rlow_(:), rup_(:), & - rhod_(:), rhog_(:) - real, allocatable :: radius(:), rlow(:), rup(:) - REAL(kind=f) :: gwtmol - REAL :: rhod, rhog - INTEGER, allocatable :: IGROUP(:) - character(len=255) :: groupname, elemname, gasname - type(carmagroup_type) :: cgroup - type(carmaelement_type) :: celement - type(carmastate_type), allocatable :: cstate(:) - logical :: do_coag = .false. !! do coagulation? - logical :: do_grow = .false. !! do nucleation, growth and evaporation? - logical :: do_implised = .false. !! do sedimentation with substepping - logical :: do_substep = .false. !! do substepping - logical :: do_thermo = .false. !! do thermodynamics - logical :: do_vdiff = .false. !! do Brownin diffusion - logical :: do_vtran = .false. !! do sedimentation - logical :: is_sulfate = .false. !! special handling for sulfate aerosol case - real(kind=f) :: vf_const = 0._f !! if specified and non-zero, constant fall velocity for all particles [cm/s] - integer :: minsubsteps = 1 !! minimum number of substeps, default = 1 - integer :: maxsubsteps = 1 !! maximum number of substeps, default = 1 - integer :: maxretries = 5 !! maximum number of substep retries, default = 5 - real(kind=f) :: conmax = 0.1_f !! minimum relative concentration to consider, default = 1e-1 - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - - -! This is for initializing condensed H2O to zero, for now -! ------------------------------------------------------- - REAL, ALLOCATABLE :: h2ocond(:,:,:) - REAL, ALLOCATABLE :: cellArea(:,:) - - reg => gcCARMA%CARMAreg - gcCARMA%name = 'CARMA aerosol/cloud microphysics' - -! Initialize local variables -! -------------------------- - rc = 0 - - CALL init_() - IF ( rc /= 0 ) RETURN - ier(:)=0 - -!! Check on the parameters and if they agree with the Chem_Registry -!! ---------------------------------------------------------------- -!! n_CARMA = NELEM*NBIN + NGAS -! if(nbins .ne. (nbin*nelem + ngas) ) then -! call final_(25) -! return -! endif - -! Establish the CARMA structure -! ----------------------------- - allocate(gcCARMA%carma, stat=ios) - if(ios /= 0) then - call final_(103) - return - endif - if(MAPL_AM_I_ROOT()) then - call CARMA_Create(gcCARMA%carma, reg%NBIN, reg%NELEM, reg%NGROUP, & - reg%NSOLUTE, reg%NGAS, reg%NWAVE, rc, & - LUNOPRT=6) - else - call CARMA_Create(gcCARMA%carma, reg%NBIN, reg%NELEM, reg%NGROUP, & - reg%NSOLUTE, reg%NGAS, reg%NWAVE, rc ) - endif - - if (rc /=0) then - call final_(rc) - return - endif - - r => gcCARMA%carma - - -! Establish the groups -! -------------------- -! NOTE: Hard coded optionals and parameters here - do j = 1, reg%NGROUP - is_sulfate = .false. -! Assumes MIXEDP has sulfate as PC - if( ESMF_UtilStringUpperCase(trim(reg%groupname(j))) == 'SULFATE' .or. & - ESMF_UtilStringUpperCase(trim(reg%groupname(j))) == 'MIXEDP' ) is_sulfate = .true. - if(reg%ishape(j) .eq. 1) then - reg%ifallrtn = I_FALLRTN_STD - else - reg%ifallrtn = I_FALLRTN_STD_SHAPE - endif - call CARMAGROUP_Create(r, j, reg%groupname(j), reg%rmin(j), reg%rmrat(j), & - reg%ishape(j), reg%eshape(j), .FALSE., rc, ifallrtn=reg%ifallrtn, & - irhswell=reg%irhswell(j), irhswcomp=reg%irhswcomp(j), is_sulfate=is_sulfate) - if(rc /=0) then - call final_(rc) - return - endif - end do - -! Establish the elements -! ---------------------- -! NOTE: Hard coded optionals and parameters here - do i = 1, reg%NELEM - call CARMAELEMENT_Create(r, i, reg%igroup(i), & - reg%elemname(i), reg%rhop(i), reg%itype(i), reg%icomposition(i), rc) - if(rc /=0) then - call final_(rc) - return - endif - end do - -! Establish the gases -! ------------------- - do i = 1, reg%NGAS - select case (reg%igcomp(i)) - case (1) - gwtmol = WTMOL_H2O - case (2) - gwtmol = WTMOL_H2SO4 - case (3) - gwtmol = WTMOL_SO2 - case (4) - gwtmol = WTMOL_HNO3 - case default - print *, 'Unknown gas IGCOMP from CARMAchem_Registry.rc for gas ',i - call final_(-100) - return - end select - call CARMAGAS_Create(r, i, reg%gasname(i), & - gwtmol, reg%igvapreq(i), reg%igcomp(i), rc, ds_threshold=-0.2_f) - if(rc /=0) then - call final_(rc) - return - endif - end do - -! Check the group/element/gas names and assign some indices -! --------------------------------------------------------- -! Look for pure groups, mixed group, and sulfuric acid gas - do i = 1, reg%NELEM - j = reg%igroup(i) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(j))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(i))) - if(groupname == 'SULFATE') then - reg%igrp_sulfate = j - if(elemname == 'PC') reg%ielm_sulfate = i - endif - if(groupname == 'DUST') then - reg%igrp_dust = j - if(elemname == 'PC') reg%ielm_dust = i - endif - if(groupname == 'SEASALT') then - reg%igrp_seasalt = j - if(elemname == 'PC') reg%ielm_seasalt = i - endif - if(groupname == 'SMOKE') then - reg%igrp_smoke = j - if(elemname == 'PC') reg%ielm_smoke = i - endif - if(groupname == 'BLACK_CARBON') then - reg%igrp_black_carbon = j - if(elemname == 'PC') reg%ielm_black_carbon = i - endif - if(groupname == 'ASH') then - reg%igrp_ash = j - if(elemname == 'PC') reg%ielm_ash = i - endif -! Mixed group may contain sulfate element - if(groupname == 'MIXEDP') then - reg%igrp_mixed = j - if(elemname == 'PC') reg%ielm_mxpc = i - if(elemname == 'SULFATE') reg%ielm_mxsulfate = i - if(elemname == 'DUST') reg%ielm_mxdust = i - if(elemname == 'SEASALT') reg%ielm_mxseasalt = i - if(elemname == 'SMOKE') reg%ielm_mxsmoke = i - if(elemname == 'ASH') reg%ielm_mxash = i - if(elemname == 'BLACK_CARBON') reg%ielm_mxbc = i - endif - end do - - do i = 1, reg%NGAS - gasname = ESMF_UtilStringUpperCase(trim(reg%gasname(i))) - if(gasname == 'H2SO4') reg%igas_h2so4 = i - if(gasname == 'H2O' ) reg%igas_h2o = i - if(gasname == 'HNO3' ) reg%igas_hno3 = i - end do - -! NEED: -! Hooks to CARMA_Solute - - -! Setup Growth/Nucleation -! ----------------------- -! Check that growth is correctly implemented based on elements/gases - if(reg%do_grow) then - if(reg%igrp_sulfate < 0 .or. reg%ielm_sulfate < 0 .or. & - reg%igas_h2so4 < 0 .or. reg%igas_h2o < 0 ) then - reg%do_grow = .false. - print *, 'Not set up correctly for growth; do_grow set false' - endif - - endif - - if(reg%do_grow) then -! Pure sulfate group - call CARMA_AddGrowth(r, reg%ielm_sulfate, reg%igas_h2so4, rc) - if(rc /=0) then - call final_(rc) - return - endif - -! Add growth to the sulfate element of the mixed group (which is nominally -! the particle concentration element) - if(reg%ielm_mxsulfate > 0) then - call CARMA_AddGrowth(r, reg%ielm_mxsulfate, reg%igas_h2so4, rc) - if(rc /=0) then - call final_(rc) - return - endif - endif - -! Add nucleation - call CARMA_AddNucleation(r, reg%ielm_sulfate, reg%ielm_sulfate, & - I_HOMNUC, 0._f, rc, igas=reg%igas_h2so4) - if(reg%igrp_mixed > 0) then - if(reg%ielm_dust > 0 .and. reg%ielm_mxdust > 0) & - call CARMA_AddNucleation(r, reg%ielm_dust, reg%ielm_mxdust, & - I_HETNUCSULF, 0._f, rc, igas=reg%igas_h2so4, & - ievp2elem=reg%ielm_dust) - if(reg%ielm_smoke > 0 .and. reg%ielm_mxsmoke > 0) & - call CARMA_AddNucleation(r, reg%ielm_smoke, reg%ielm_mxsmoke, & - I_HETNUCSULF, 0._f, rc, igas=reg%igas_h2so4, & - ievp2elem=reg%ielm_smoke) - if(reg%ielm_seasalt > 0 .and. reg%ielm_mxseasalt > 0) & - call CARMA_AddNucleation(r, reg%ielm_seasalt, reg%ielm_mxseasalt, & - I_HETNUCSULF, 0._f, rc, igas=reg%igas_h2so4, & - ievp2elem=reg%ielm_seasalt) - endif - if(rc /=0) then - call final_(rc) - return - endif - endif - - -! Setup Coagulation -! -------------------- -! We set up self coagulation for pure SULFATE and SMOKE groups. -! If there is MIXEDP we allow coagulation of SULFATE with MIXEDP - if(reg%do_coag) then - do i = 1, reg%NELEM - j = reg%igroup(i) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(j))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(i))) - if(groupname == 'MIXEDP' .and. elemname == 'SULFATE') reg%mixedcorecomp = reg%icomposition(i) - -! This block adds the self coagulation of the pure sulfate group and the -! coagulation of the pure sulfate to the mixed group. - if( groupname == 'SULFATE' ) then - call CARMA_AddCoagulation(r, j, j, j, I_COLLEC_FUCHS, rc ) - if(reg%igrp_mixed > 0 .AND. reg%icomposition(i) == reg%mixedcorecomp) then - call CARMA_AddCoagulation(r, j, reg%igrp_mixed, reg%igrp_mixed, I_COLLEC_FUCHS, rc ) - endif - endif - if( groupname == 'SMOKE' ) call CARMA_AddCoagulation(r, j, j, j, I_COLLEC_FUCHS, rc ) - if(rc /=0) then - call final_(rc) - return - endif - end do - endif - - - -! Initialize CARMA -! ---------------- - call CARMA_Initialize(r, rc, & - do_cnst_rlh=reg%do_cnst_rlh, do_coag=reg%do_coag, & - do_detrain=reg%do_detrain, do_fixedinit=reg%do_fixedinit, & - do_grow=reg%do_grow, do_incloud=reg%do_incloud, & - do_explised=reg%do_explised, do_print_init=reg%do_print_init, & - do_substep=reg%do_substep, & - do_thermo=reg%do_thermo, do_vdiff=reg%do_vdiff, & - do_vtran=reg%do_vtran, vf_const=reg%vf_const, conmax=reg%conmax, & - minsubsteps=reg%minsubsteps, maxsubsteps=reg%maxsubsteps, & - maxretries=reg%maxretries, dt_threshold=1._f ) - -! Get the dust emissions size fraction -! ----------------------- -! Look for dust aerosol group / element - do i = 1, reg%NELEM - j = reg%igroup(i) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(j))) - if(groupname == 'DUST' .OR. ESMF_UtilStringUpperCase(trim(reg%elemname(i))) == 'DUST') then - allocate(radius_(reg%NBIN), rlow_(reg%NBIN), rup_(reg%NBIN), __STAT__) - allocate(radius(reg%NBIN), rlow(reg%NBIN), rup(reg%NBIN), __STAT__) - allocate(rhod_(reg%NBIN), rhog_(reg%NBIN), __STAT__) - call CARMAGroup_Get(r, j, rc, r=radius_, rlow=rlow_, rup=rup_) - radius = radius_ / 100. ! go from CARMA cm -> m - rlow = rlow_ / 100. - rup = rup_ / 100. - call CARMAElement_Get(r, i, rc, rho=rhod_) - call CARMAElement_Get(r, r%f_group(j)%f_ienconc, rc, rho=rhog_) - rhod = rhod_(1) * 1000. ! go from CARMA to MKS - rhog = rhog_(1) * 1000. ! go from CARMA to MKS - call KokSizeDistribution(radius, rlow, rup, reg%dmass_dust, rhod=rhod, rhog=rhog) - deallocate(radius, rlow, rup, radius_, rlow_, rup_, rhod_, rhog_, __STAT__) - endif - enddo - - - -! Print information -! ----------------- - IF( MAPL_AM_I_ROOT() ) THEN - call dumpGroup(r, rc) - if(rc /=0) then - call final_(104) - return - endif - call dumpElement(r, rc) - if(rc /=0) then - call final_(105) - return - endif - END IF - -!! Housekeeping -!! ------------ -! deallocate ( r, stat=ios ) -! if ( ios /= 0) then -! call final_(200) -! return -! endif -! ier(:)=0 - - RETURN - -CONTAINS - - SUBROUTINE init_() - INTEGER :: ios, n - n=128 - ios=0 - ALLOCATE ( ier(n), stat=ios ) - IF ( ios /= 0 ) rc = 100 - END SUBROUTINE init_ - - SUBROUTINE final_(ierr) - INTEGER :: ios, ierr - DEALLOCATE ( r, ier, stat=ios ) - CALL I90_release() - rc = ierr - END SUBROUTINE final_ - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !ROUTINE: TFQuery: Find whether a token in T or F. -! -! !INTERFACE: -! - LOGICAL FUNCTION TFQuery(string,fn) - -! !USES: - - IMPLICIT NONE - -! !INPUT PARAMETERS: - - CHARACTER(LEN=*), INTENT(IN) :: string, fn - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: Return the value (T or F) of a particular token (string) -! in the file fn. - -! !REVISION HISTORY: -! -! 15 Aug 2007 Nielsen First version. -!EOP -!------------------------------------------------------------------------- - CHARACTER(LEN=8) :: tOrF - - INTEGER :: rc - rc = 0 - tOrF = ' ' - TFQuery = .FALSE. - - CALL I90_label ( TRIM(string), rc ) - IF(rc .NE. 0) THEN - PRINT *,'Could not find ',TRIM(string),' in ',TRIM(fn) - CALL final_(99) - END IF - - CALL I90_Gtoken( tOrF, rc ) - IF(TRIM(tOrF) == 'T' .OR. TRIM(tOrF) == 't' .OR. & - TRIM(tOrF) == 'TRUE' .OR. TRIM(tOrF) == 'true') TFQuery = .TRUE. - - END FUNCTION TFQuery - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !ROUTINE: setmcor: Find area of tiles. -! -! !INTERFACE: -! - SUBROUTINE setmcor(i1,i2,j1,j2,im,jm,lats,cellArea) - -! !USES: - - IMPLICIT NONE - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: i1,i2,j1,j2,im,jm - REAL, INTENT(IN) :: lats(i1:i2,j1:j2) !radians - -! !OUTPUT PARAMETERS: - - REAL, INTENT(OUT) :: cellArea(i1:i2,j1:j2) !m^2 - -! !DESCRIPTION: Find the horizontal surface area (m^2) of each cell. -! In testing with 8-byte words, the total surface area -! was 4.0000508 PI R^2. - -! !REVISION HISTORY: - -! 15 Aug 2007 Nielsen First version. -!EOP -!------------------------------------------------------------------------- - REAL, PARAMETER :: ae=6.371E+06 - - INTEGER :: i,j - REAL :: scale,dlat,f,arg,err,pi - - err=1.00E-05 - pi=4.00*ATAN(1.00) - dlat=pi/FLOAT(jm-1) - scale = 2.00*pi*ae*ae/FLOAT(im) - - DO j=j1,j2 - DO i=i1,i2 - -! South pole - - IF( lats(i,j) < -0.50*pi+err ) THEN - f=0.25 - arg=0.50*(lats(i,j)+lats(i,j+1)) - -! North pole - - ELSE IF( lats(i,j) > 0.50*pi-err ) THEN - f=0.25 - arg=0.50*(lats(i,j-1)+lats(i,j)) - -! Interior - - ELSE - f=1.00 - arg=lats(i,j) - END IF - - cellArea(i,j)=scale*dlat*f*cos(arg) - - END DO - END DO - - RETURN - END SUBROUTINE setmcor - - END SUBROUTINE CARMA_GridCompInitialize - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !ROUTINE: CARMA_GridCompRun --- The CARMA Driver -! -! !INTERFACE: -! - - SUBROUTINE CARMA_GridCompRun ( gcCARMA, qa, impChem, expChem, nymd, nhms, & - cdt, rc ) - - IMPLICIT none - -! !INPUT/OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - -! !INPUT PARAMETERS: - - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - INTEGER, INTENT(IN) :: nymd, nhms ! time - REAL, INTENT(IN) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - INTEGER, INTENT(OUT) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the CARMA driver -! -! !IMPLEMENTATION NOTES: -! -! No pointer is reservered in the export state for deposition of water. -! -! !REVISION HISTORY: -! -! 18Sep2003 da Silva First crack. -! 24Jan2005 Nielsen Implementation of Code 916 chemistry -! 30Oct2007 Nielsen Implementation of GMI cmbined -! stratosphere/troposphere chemistry -! 12Aug2009 Colarco First crack at CARMA run method -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_GridCompRun' - INTEGER :: STATUS - -! Input fields from GEOS-5 -! ------------------------ - REAL, POINTER, DIMENSION(:,:,:) :: p, ple, rhoa, tmpu, zc, zl, q, zle, & - rh, u, v, su_nuc, & - zsubsteps, sath2so4, su_sareav, & - su_sarea, su_numd, su_reff, & - du_sarea, du_numd, du_reff, & - ash_sarea, ash_numd, ash_reff, & - ss_sarea, ss_numd, ss_reff, & - sm_sarea, sm_numd, sm_reff, & - mx_sarea, mx_numd, mx_reff, & - su_mass, hno3, h2so4 - REAL, POINTER, DIMENSION(:,:) :: gwettop, fraclake, oro, u10m, v10m, & - ustar, pblh, z0h, shflux, precc, precl, & - substeps, retries - real, pointer, dimension(:,:) :: du_sed, su_sed, ss_sed, bc_sed, ash_sed, sm_sed, & - mxdu_sed, mxsu_sed, mxss_sed, mxbc_sed, mxash_sed, mxsm_sed - type(Chem_Array), pointer :: suvf(:), mxvf(:) - - -! Local -! ----- - INTEGER :: i, i1, i2, ic, ier(512), im, ijl, ios - INTEGER :: j, j1, j2, jm - INTEGER :: ielem, ibin, igrp, igas - INTEGER :: k, km, kReverse - INTEGER :: n, n2, nbegin, nend, nCARMABegin, nCARMAEnd - INTEGER :: nymd1, nhms1 - INTEGER :: substep_int, last_sub - real(kind=f) :: retry_real, last_ret - logical :: rootproc - real(kind=f) :: dtime - character(len=ESMF_MAXSTR) :: binstr - - INTEGER, PARAMETER :: ToCARMA = 1 - INTEGER, PARAMETER :: FromCARMA = -1 -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - integer :: igroup - CHARACTER(LEN=255) :: groupname, elemname, gasname - - REAL :: qmax,qmin - real(kind=f) :: lon, lat - real(kind=f), allocatable :: xc(:), dx(:), yc(:), dy(:) - real(kind=f), allocatable :: p_(:), ple_(:), tmpu_(:), zc_(:), zl_(:), & - q_(:), rh_(:), nuc_(:), sarea_(:), numd_(:), & - r_wet_(:), reff_num(:), reff_den(:), vf_(:), & - zsubsteps_(:) - real(kind=f), allocatable :: satice_(:,:), satliq_(:,:), told_(:), gasold_(:,:) - real(kind=f) :: dq_ - - type(carmastate_type) :: cstate - type(carma_type), pointer :: r => null() - type(CARMA_Registry), pointer :: reg => null() - character(len=255) :: string - -! For a reference atmosphere we'll choose some values - real, parameter, dimension(73) :: pleRef = & - (/ 1, 2, 3, 4, 6, 8, 11, 15, 21, 27, 36, 47, 61, 79, 101, 130, & - 165, 208, 262, 327, 407, 504, 621, 761, 929, 1127, 1364, 1645, & - 1979, 2373, 2836, 3381, 4017, 4764, 5638, 6660, 7851, 9236, & - 10866, 12783, 15039, 17693, 20792, 24398, 28606, 33388, 37003, & - 40612, 44214, 47816, 51405, 54997, 58584, 62170, 65769, 68147, & - 70540, 72931, 75313, 77711, 79623, 81046, 82485, 83906, 85344, & - 86765, 88201, 89636, 91071, 92516, 93921, 95376, 100000 /) - real, parameter, dimension(72) :: tmpuRef = & - (/ 219, 221, 223, 228, 230, 230, 232, 238, 245, 253, 259, 263, & - 264, 262, 258, 253, 247, 239, 233, 229, 227, 227, 226, 223, & - 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 212, & - 214, 214, 216, 219, 219, 210, 210, 218, 227, 234, 240, 245, & - 250, 254, 257, 260, 262, 263, 265, 266, 267, 268, 269, 270, & - 270, 270, 270, 270, 271, 271, 271, 270, 267, 265, 266, 266 /) - real, parameter, dimension(72) :: rhRef = 1e-6 * & - (/ 1, 2, 2, 2, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 6, 18, 51, & - 129, 267, 394, 502, 682, 1135, 1603, 2076, 2820, 3792, 5120, & - 6806, 8912, 11597, 15397, 20386, 28168, 29755, 28748, 33875, & - 34058, 28657, 43458, 401856, 947266, 932618, 902344, 657227, & - 371583, 203370, 235108, 317872, 413086, 511719, 691407, 686524, & - 601563, 456055, 475098, 626954, 590821, 483399, 380860, 297852, & - 230958, 183594, 144288, 111084, 96558, 136963, 369629, 770508, & - 793946, 799805 /) - - ier(:) = 0 - -! Short-hand to object - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - -! Grid specs from Chem_Bundle%grid -! -------------------------------- - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - -! Location of species from Chem_Bundle%registry. -! ---------------------------------------------- - nCARMABegin = 1 - nCARMAEnd = gcCARMA%CARMAreg%nq - - rootProc=.FALSE. - IF( MAPL_AM_I_ROOT() ) THEN - rootProc=.TRUE. - END IF - -! Allocate -! -------- - allocate(p(i1:i2,j1:j2,km), __STAT__ ) - allocate(xc(km), dx(km), yc(km), dy(km), & - p_(km), ple_(km+1), tmpu_(km), zc_(km), zl_(km+1), & - q_(km), rh_(km), nuc_(km), sarea_(km), numd_(km), & - r_wet_(km), reff_num(km), reff_den(km), vf_(km+1), & - zsubsteps_(km), __STAT__ ) - allocate(told_(km), gasold_(km,reg%NGAS), satice_(km,reg%NGAS), satliq_(km,reg%NGAS), __STAT__ ) - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, q, 'Q', __RC__) - call MAPL_GetPointer ( impChem, rh, 'RH2', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - call MAPL_GetPointer ( impChem, ustar, 'USTAR', __RC__) - call MAPL_GetPointer ( impChem, fraclake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, gwettop, 'WET1', __RC__) - call MAPL_GetPointer ( impChem, u10m, 'U10M', __RC__) - call MAPL_GetPointer ( impChem, v10m, 'V10M', __RC__) - call MAPL_GetPointer ( impChem, pblh, 'ZPBL', __RC__) - call MAPL_GetPointer ( impChem, z0h, 'Z0H', __RC__) - call MAPL_GetPointer ( impChem, shflux, 'SH', __RC__) - call MAPL_GetPointer ( impChem, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, oro, 'LWI', __RC__) - call MAPL_GetPointer ( impChem, u, 'U', __RC__) - call MAPL_GetPointer ( impChem, v, 'V', __RC__) - call MAPL_GetPointer ( impChem, hno3, 'CARMA_HNO3', notFoundOK=.TRUE., __RC__) - call MAPL_GetPointer ( impChem, h2so4, 'CARMA_H2SO4', notFoundOK=.TRUE., __RC__) - -! Fill the internal state with direct gas species from GMI -! Expectation is species are in VMR and needed in MMR for CARMA -! ----------- - if(reg%sulfuric_acid_source(1:10) == 'full_field' .and. reg%NGAS > 0) then - do igas = 1, reg%NGAS - n = nCARMAbegin + reg%NBIN*reg%NELEM - 1 + igas - gasname = ESMF_UtilStringUpperCase(reg%gasname(igas)) - if(gasname == 'H2SO4') then - if(associated(h2so4)) qa(n)%data3d = h2so4*WTMOL_H2SO4/WTMOL_AIR - endif - if(gasname == 'HNO3' ) then - if(associated(hno3)) qa(n)%data3d = hno3 *WTMOL_HNO3 /WTMOL_AIR - endif - enddo - endif - -! Get Exports -! ----------- -! Mixed Group - call MAPL_GetPointer(expChem, mx_sarea, 'CARMA_MXSAREA', __RC__) - call MAPL_GetPointer(expChem, mx_numd, 'CARMA_MXNUMD', __RC__) - call MAPL_GetPointer(expChem, mx_reff, 'CARMA_MXREFF', __RC__) -! Dust - call MAPL_GetPointer(expChem, du_sed, 'CARMA_DUSD', __RC__) - call MAPL_GetPointer(expChem, du_sarea, 'CARMA_DUSAREA', __RC__) - call MAPL_GetPointer(expChem, du_numd, 'CARMA_DUNUMD', __RC__) - call MAPL_GetPointer(expChem, du_reff, 'CARMA_DUREFF', __RC__) - call MAPL_GetPointer(expChem, mxdu_sed, 'CARMA_MXDUSD', __RC__) -! Ash - call MAPL_GetPointer(expChem, ash_sed, 'CARMA_ASHSD', __RC__) - call MAPL_GetPointer(expChem, ash_sarea, 'CARMA_ASHSAREA', __RC__) - call MAPL_GetPointer(expChem, ash_numd, 'CARMA_ASHNUMD', __RC__) - call MAPL_GetPointer(expChem, ash_reff, 'CARMA_ASHREFF', __RC__) - call MAPL_GetPointer(expChem, mxash_sed, 'CARMA_MXASHSD', __RC__) -! Sulfate - call MAPL_GetPointer(expChem, su_sed, 'CARMA_SUSD', __RC__) - call MAPL_GetPointer(expChem, su_nuc, 'CARMA_SUNUC', __RC__) - call MAPL_GetPointer(expChem, su_sarea, 'CARMA_SUSAREA', __RC__) - call MAPL_GetPointer(expChem, su_mass, 'CARMA_SUMASS', __RC__) - call MAPL_GetPointer(expChem, su_numd, 'CARMA_SUNUMD', __RC__) - call MAPL_GetPointer(expChem, su_reff, 'CARMA_SUREFF', __RC__) - call MAPL_GetPointer(expChem, mxsu_sed, 'CARMA_MXSUSD', __RC__) -! Sea salt - call MAPL_GetPointer(expChem, ss_sed, 'CARMA_SSSD', __RC__) - call MAPL_GetPointer(expChem, ss_sarea, 'CARMA_SSSAREA', __RC__) - call MAPL_GetPointer(expChem, ss_numd, 'CARMA_SSNUMD', __RC__) - call MAPL_GetPointer(expChem, ss_reff, 'CARMA_SSREFF', __RC__) - call MAPL_GetPointer(expChem, mxss_sed, 'CARMA_MXSSSD', __RC__) -! Smoke - call MAPL_GetPointer(expChem, sm_sed, 'CARMA_SMSD', __RC__) - call MAPL_GetPointer(expChem, sm_sarea, 'CARMA_SMSAREA', __RC__) - call MAPL_GetPointer(expChem, sm_numd, 'CARMA_SMNUMD', __RC__) - call MAPL_GetPointer(expChem, sm_reff, 'CARMA_SMREFF', __RC__) - call MAPL_GetPointer(expChem, mxsm_sed, 'CARMA_MXSMSD', __RC__) -! Other - call MAPL_GetPointer(expChem, bc_sed, 'CARMA_BCSD', __RC__) - call MAPL_GetPointer(expChem, mxbc_sed, 'CARMA_MXBCSD', __RC__) - call MAPL_GetPointer(expChem, substeps, 'CARMA_SUBSTEPS', __RC__) - call MAPL_GetPointer(expChem, retries, 'CARMA_RETRIES', __RC__) - call MAPL_GetPointer(expChem, zsubsteps, 'CARMA_ZSUBSTEPS', __RC__) - call MAPL_GetPointer(expChem, sath2so4, 'CARMA_SATH2SO4', __RC__) - call MAPL_GetPointer(expChem, su_sareav, 'CARMA_SUSAREAv', __RC__) - - -! Allocate space for fall velocity diagnostic and see if requested -! ---------------------------------------------------------------- - allocate(suvf(reg%NBIN), mxvf(reg%NBIN), __STAT__) - do ibin = 1, reg%NBIN - write(binstr,'(i3)') ibin - binstr = adjustl(binstr) - if(ibin .lt. 10) binstr = '0'//binstr - if(ibin .lt. 100) binstr = '0'//binstr -! if(MAPL_AM_I_ROOT()) print *, 'CARMA_SUVF'//trim(binstr), 'CARMA_MXVF'//trim(binstr) -! call MAPL_GetPointer(expChem, suvf(ibin)%data3d, 'CARMA_SUVF'//trim(binstr), __RC__) -! call MAPL_GetPointer(expChem, mxvf(ibin)%data3d, 'CARMA_MXVF'//trim(binstr), __RC__) - enddo - -! Get the mid-point pressure -! -------------------------- - DO k=1,km - p(i1:i2,j1:j2,k)=exp((log(ple(i1:i2,j1:j2,k-1))+log(ple(i1:i2,j1:j2,k)) )*0.50) - END DO - -! call pmaxmin('CARMA::U: ', u(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::V: ', v(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::AIRDENS: ', rhoa(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::Q: ', q(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::RH: ', rh(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::P: ', p(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::ZLE: ', zle(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::T: ', tmpu(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -! call pmaxmin('CARMA::ORO: ', oro(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::USTAR: ', ustar(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::FRACLAKE:', fraclake(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::U10M: ', u10m(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::V10M: ', v10m(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::PBLH: ', pblh(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::Z0H: ', z0h(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::SHFLUX: ', shflux(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::PRECL: ', precl(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::PRECC: ', precc(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) -! call pmaxmin('CARMA::GWETTOP: ', gwettop(i1:i2,j1:j2), qmin, qmax, ijl, 1, 1. ) - - IF( ANY(ier(:) /= 0) ) THEN - PRINT *,Iam,': Failed on MAPL_GetPointer for imports in CARMA_GridCompRun.' - rc = 11 - RETURN - END IF - ier(:)=0 - -! For substepping you want to remember the old temperature. -! This is set in the internal_spec but possibly is bootstrapped. -! If bootstrapped set to current temperature. - n = nCARMAbegin + reg%NBIN*reg%NELEM + reg%NGAS - if(qa(n)%data3d(i1,j2,km) <= 0.) qa(n)%data3d = tmpu -! And same for gases -- first, initialize water vapor to current - do igas = 1, reg%NGAS - n = nCARMAbegin + reg%NBIN*reg%NELEM - 1 + igas - if(trim(reg%gasname(igas)) == 'h2o' .or. trim(reg%gasname(igas)) == 'H2O') qa(n)%data3d = q - n2 = nCARMAbegin + reg%NBIN*reg%NELEM + reg%NGAS + igas - if(qa(n2)%data3d(i1,j2,km) < 0.) qa(n2)%data3d = qa(n)%data3d - enddo - -#ifdef DEBUG -if(reg%NGAS > 0) then - n = reg%NBIN*reg%NELEM + 1 - call pmaxmin('CARMA::h2o_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS - call pmaxmin('CARMA::h2so4_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - call pmaxmin('CARMA::su001_0: ', qa(1)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + 1 - call pmaxmin('CARMA::told_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS - call pmaxmin('CARMA::h2o_old_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::h2so4_old_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::satliq2_old_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::satice2_old_0: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -endif -#endif - -! ==================== CARMA Step ================================ -! Establish the CARMA state, do a step, and retain diagnostic - if( associated(DU_sed)) DU_sed(:,:) = 0. - if( associated(SU_sed)) SU_sed(:,:) = 0. - if( associated(SS_sed)) SS_sed(:,:) = 0. - if( associated(BC_sed)) BC_sed(:,:) = 0. - if( associated(SM_sed)) SM_sed(:,:) = 0. - if( associated(ASH_sed)) ASH_sed(:,:) = 0. - if( associated(MXDU_sed)) MXDU_sed(:,:) = 0. - if( associated(MXSU_sed)) MXSU_sed(:,:) = 0. - if( associated(MXSM_sed)) MXSM_sed(:,:) = 0. - if( associated(MXSS_sed)) MXSS_sed(:,:) = 0. - if( associated(MXBC_sed)) MXBC_sed(:,:) = 0. - if( associated(MXASH_sed)) MXASH_sed(:,:) = 0. - if( associated(SU_sarea)) SU_sarea(:,:,:) = 0. - if( associated(SU_numd)) SU_numd(:,:,:) = 0. - if( associated(SU_reff)) SU_reff(:,:,:) = 0. - if( associated(DU_sarea)) DU_sarea(:,:,:) = 0. - if( associated(DU_numd)) DU_numd(:,:,:) = 0. - if( associated(DU_reff)) DU_reff(:,:,:) = 0. - if( associated(SS_sarea)) SS_sarea(:,:,:) = 0. - if( associated(SS_numd)) SS_numd(:,:,:) = 0. - if( associated(SS_reff)) SS_reff(:,:,:) = 0. - if( associated(SM_sarea)) SM_sarea(:,:,:) = 0. - if( associated(SM_numd)) SM_numd(:,:,:) = 0. - if( associated(SM_reff)) SM_reff(:,:,:) = 0. - if( associated(SU_nuc)) SU_nuc(:,:,:) = 0. - if( associated(substeps)) substeps(:,:) = 0. - if( associated(retries)) retries(:,:) = 0. - if( associated(zsubsteps)) zsubsteps(:,:,:) = 0. - if( associated(sath2so4)) sath2so4(:,:,:) = 0. - if( associated(su_sareav)) su_sareav(:,:,:) = 0. - if( associated(su_mass)) su_mass(:,:,:) = 0. - last_sub = 0 - last_ret = 0 - -! Possibly create a CARMA reference state column for 1,1 column in tile - if(reg%do_fixedinit) then -! dx and dy are hack as if for a "b" resolution grid - dx(:) = 2.5 - dy(:) = 2. - xc(:) = 0. - yc(:) = 0. - p_(1:km) = exp((log(pleRef(1:km))+log(pleRef(2:km+1)) )*0.50) - ple_(1:km+1) = pleRef - zc_(:) = p_(:)/pleRef(km+1) - zl_(1:km+1) = pleRef(1:km+1)/pleRef(km+1) - tmpu_(:) = tmpuRef(:) - rh_(:) = rhRef(:) - call CARMASTATE_CreateFromReference(cstate, r, 1._f, dtime, km, & - I_HYBRID, I_CART, lat, lon, & - xc, dx, yc, dy, & - zc_, zl_, p_, ple_, tmpu_, rc, & - relhum=rh_) - endif - - do j = j1, j2 - do i = i1, i2 - - lon = gcCARMA%lons(i,j) - lat = gcCARMA%lats(i,j) -! dx and dy are hack as if for a "b" resolution grid - dx(:) = 2.5 - dy(:) = 2. - xc(:) = lon - yc(:) = lat - p_(:) = p(i,j,:) - ple_(1:km+1) = ple(i,j,0:km) - zc_(:) = p(i,j,:)/ple(i,j,km) - zl_(1:km+1) = ple(i,j,0:km)/ple(i,j,km) - tmpu_(:) = tmpu(i,j,:) - rh_(:) = rh(i,j,:) -! prior time step values for sub-stepping - n = reg%NBIN*reg%NELEM + reg%NGAS + 1 - told_(:) = qa(n)%data3d(i,j,:) - do igas = 1, reg%NGAS - gasold_(:,igas) = qa(n+igas)%data3d(i,j,:) - satliq_(:,igas) = qa(n+reg%NGAS+igas)%data3d(i,j,:) - satice_(:,igas) = qa(n+reg%NGAS+reg%NGAS+igas)%data3d(i,j,:) - enddo - - call CARMASTATE_Create(cstate, r, 1._f, dtime, km, & - I_HYBRID, I_CART, lat, lon, & - xc, dx, yc, dy, & - zc_, zl_, p_, ple_, tmpu_, rc, & - relhum=rh_, told=told_) - - ! Map the model MMR to CARMA - do ielem = 1, reg%NELEM - do ibin = 1, reg%NBIN - n = nCARMAbegin + (ielem-1)*reg%NBIN + ibin - 1 - q_(:) = qa(n)%data3d(i,j,:) - where(q_ < 1.e-32) q_ = 1.e-32 - call CARMASTATE_SetBin(cstate, ielem, ibin, q_, rc) - end do - end do - - ! Map the model gases to CARMA - if(reg%NGAS > 0) then - do igas = 1, reg%NGAS - n = nCARMAbegin + reg%NELEM*reg%NBIN - 1 + igas - q_(:) = qa(n)%data3d(i,j,:) - where(q_ < 1.e-32) q_ = 1.e-32 -!! HACK: Want to put in 10 Tg S of H2SO4 per year total into band 30N - 30S -!! all longitude between 20 - 25 km altitude. So this is 2.e10 kg H2SO4 -!! per year over an area of 2.626e14 m2 over 32.65 hPa depth for levels 30 - 34. -! if( (trim(reg%gasname(igas)) == 'h2so4' .or. trim(reg%gasname(igas)) == 'H2SO4') .and. & -! lat >= -30. .and. lat <= 30.) then -! do k = 30,34 -! q_(k) = q_(k) + 2.e10 / (365.*86400.)*cdt / 2.626e14 / 3265. * 9.8 -! enddo -! endif - - call CARMASTATE_SetGas(cstate, igas, q_(:), rc, & - mmr_old = gasold_(:,igas), satice_old=satice_(:,igas), & - satliq_old=satliq_(:,igas) ) - end do - endif - - ! Execute the step - call CARMASTATE_Step(cstate, ios) - - ! Map CARMA back to model MMR - do ielem = 1, reg%NELEM - do ibin = 1, reg%NBIN - n = nCARMAbegin + (ielem-1)*reg%NBIN + ibin - 1 - call CARMASTATE_GetBin(cstate, ielem, ibin, & - q_, rc) - where(q_ < 1.e-32) q_ = 1.e-32 - qa(n)%data3d(i,j,:) = q_(:) - end do - end do - - ! Map CARMA back to model gas - if(reg%NGAS > 0) then - do igas = 1, reg%NGAS - n = nCARMAbegin + reg%NELEM*reg%NBIN - 1 + igas - call CARMASTATE_GetGas(cstate, igas, q_, rc, & - satice=satice_(:,igas), satliq=satliq_(:,igas)) - where(q_ < 1.e-32) q_ = 1.e-32 - qa(n)%data3d(i,j,:) = q_(:) -! Save current gas mixing ratio and saturations for "old" values of next step - n = reg%NBIN*reg%NELEM + reg%NGAS + 1 - qa(n+igas)%data3d(i,j,:) = q_(:) - qa(n+reg%NGAS+igas)%data3d(i,j,:) = satliq_(:,igas) - qa(n+reg%NGAS+reg%NGAS+igas)%data3d(i,j,:) = satice_(:,igas) -! Save h2so4 supersaturation if it's asked for - if( ESMF_UtilStringUpperCase(trim(reg%gasname(igas))) == 'H2SO4' .and. & - associated(sath2so4) ) sath2so4(i,j,:) = satliq_(:,igas) - end do - -! Hack - for now we assume gas does not change temperature, save told - n = nCARMAbegin + reg%NELEM*reg%NBIN + reg%NGAS - qa(n)%data3d(i,j,:) = tmpu_ - endif - -! Get requested sedimentation flux diagnostics per element - do ielem = 1, reg%NELEM - igroup = gcCARMA%CARMAreg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(gcCARMA%CARMAreg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(gcCARMA%CARMAreg%elemname(ielem))) - do ibin = 1, reg%NBIN - n = nCARMAbegin + (ielem-1)*reg%NBIN + ibin - 1 - call CARMASTATE_GetBin(cstate, ielem, ibin, & - q_, rc, sedimentationflux=dq_) - if(associated(DU_sed) .and. igroup .eq. reg%igrp_dust) DU_sed(i,j) = DU_sed(i,j) + dq_ - if(associated(SS_sed) .and. igroup .eq. reg%igrp_seasalt) SS_sed(i,j) = SS_sed(i,j) + dq_ - if(associated(SM_sed) .and. igroup .eq. reg%igrp_smoke) SM_sed(i,j) = SM_sed(i,j) + dq_ - if(associated(SU_sed) .and. igroup .eq. reg%igrp_sulfate) SU_sed(i,j) = SU_sed(i,j) + dq_ - if(associated(BC_sed) .and. igroup .eq. reg%igrp_black_carbon) BC_sed(i,j) = BC_sed(i,j) + dq_ - if(associated(ASH_sed) .and. igroup .eq. reg%igrp_ash) ASH_sed(i,j) = ASH_sed(i,j) + dq_ -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_sed) .and. ielem .eq. reg%ielm_mxdust) MXDU_sed(i,j) = MXDU_sed(i,j) + dq_ - if(associated(MXSS_sed) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_sed(i,j) = MXSS_sed(i,j) + dq_ - if(associated(MXSM_sed) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_sed(i,j) = MXSM_sed(i,j) + dq_ - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_sed(i,j) = MXSU_sed(i,j) + dq_ - if(associated(MXBC_sed) .and. ielem .eq. reg%ielm_mxbc) MXBC_sed(i,j) = MXBC_sed(i,j) + dq_ - if(associated(MXASH_sed) .and. ielem .eq. reg%ielm_mxash) MXASH_sed(i,j) = MXASH_sed(i,j) + dq_ -! subtract cores - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxdust) MXSU_sed(i,j) = MXSU_sed(i,j) - dq_ - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_sed(i,j) = MXSU_sed(i,j) - dq_ - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_sed(i,j) = MXSU_sed(i,j) - dq_ - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxbc) MXSU_sed(i,j) = MXSU_sed(i,j) - dq_ - if(associated(MXSU_sed) .and. ielem .eq. reg%ielm_mxash) MXSU_sed(i,j) = MXSU_sed(i,j) - dq_ - endif - end do - end do - - ! If the fall velocity diagnostic is asked for, get it (note conversion - ! of sign change to define positive) - do ielem = 1, reg%NELEM - igroup = gcCARMA%CARMAreg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(gcCARMA%CARMAreg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(gcCARMA%CARMAreg%elemname(ielem))) - if(ielem /= r%f_group(igroup)%f_ienconc ) cycle - do ibin = 1, reg%NBIN - if(groupname == 'SULFATE' .and. associated(suvf(ibin)%data3d)) then - call CARMASTATE_GetBin(cstate, ielem, ibin, & - q_, rc, vf=vf_) - suvf(ibin)%data3d(i,j,:) = -1. * vf_ - endif - if( (groupname == 'MIXEDP' .or. groupname == 'DUST') .and. & - associated(mxvf(ibin)%data3d)) then - call CARMASTATE_GetBin(cstate, ielem, ibin, & - q_, rc, vf=vf_) - mxvf(ibin)%data3d(i,j,:) = -1. * vf_ - endif - end do - end do - -! Get the nucleation rate if it is asked for (m-3 s-1) - do ielem = 1, reg%NELEM - igroup = gcCARMA%CARMAreg%igroup(ielem) - groupname = trim(gcCARMA%CARMAreg%groupname(igroup)) - if(groupname /= 'sulfate' .AND. groupname /= 'SULFATE') cycle - if(ielem /= r%f_group(igroup)%f_ienconc ) cycle - if(.not.associated(SU_nuc)) cycle - do ibin = 1, reg%NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, & - q_, rc, nucleationrate=nuc_) - SU_nuc(i,j,:) = SU_nuc(i,j,:) + nuc_ - enddo - enddo - -! Get the group effective wet radius (m), surface area, and number density - do ielem = 1, reg%NELEM - igroup = gcCARMA%CARMAreg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(gcCARMA%CARMAreg%groupname(igroup))) - if(ielem /= r%f_group(igroup)%f_ienconc ) cycle - reff_num = 0. - reff_den = 0. - do ibin = 1, reg%NBIN - call CARMASTATE_GetBin(cstate, ielem, ibin, q_, rc, & - r_wet=r_wet_, numberdensity=numd_, areadensity=sarea_) - if(associated(MX_sarea) .and. igroup .eq. reg%igrp_mixed) MX_sarea(i,j,:) = MX_sarea(i,j,:) + sarea_ - if(associated(MX_numd) .and. igroup .eq. reg%igrp_mixed) MX_numd(i,j,:) = MX_numd(i,j,:) + numd_ - if(associated(SU_sarea) .and. igroup .eq. reg%igrp_sulfate) SU_sarea(i,j,:) = SU_sarea(i,j,:) + sarea_ - if(associated(SU_numd) .and. igroup .eq. reg%igrp_sulfate) SU_numd(i,j,:) = SU_numd(i,j,:) + numd_ - if(associated(SU_mass) .and. igroup .eq. reg%igrp_sulfate) SU_mass(i,j,:) = SU_mass(i,j,:) + q_ - if(associated(DU_sarea) .and. igroup .eq. reg%igrp_dust) DU_sarea(i,j,:) = DU_sarea(i,j,:) + sarea_ - if(associated(DU_numd) .and. igroup .eq. reg%igrp_dust) DU_numd(i,j,:) = DU_numd(i,j,:) + numd_ - if(associated(ASH_sarea) .and. igroup .eq. reg%igrp_ash) ASH_sarea(i,j,:) = ASH_sarea(i,j,:) + sarea_ - if(associated(ASH_numd) .and. igroup .eq. reg%igrp_ash) ASH_numd(i,j,:) = ASH_numd(i,j,:) + numd_ - if(associated(SM_sarea) .and. igroup .eq. reg%igrp_smoke) SM_sarea(i,j,:) = SM_sarea(i,j,:) + sarea_ - if(associated(SM_numd) .and. igroup .eq. reg%igrp_smoke) SM_numd(i,j,:) = SM_numd(i,j,:) + numd_ - if(associated(SS_sarea) .and. igroup .eq. reg%igrp_seasalt) SS_sarea(i,j,:) = SS_sarea(i,j,:) + sarea_ - if(associated(SS_numd) .and. igroup .eq. reg%igrp_seasalt) SS_numd(i,j,:) = SS_numd(i,j,:) + numd_ - reff_num = reff_num + r_wet_**3.*numd_ - reff_den = reff_den + r_wet_**2.*numd_ - enddo - if(associated(MX_reff) .and. igroup .eq. reg%igrp_mixed) where(reff_den > 0) MX_reff(i,j,:) = reff_num / reff_den - if(associated(SM_reff) .and. igroup .eq. reg%igrp_smoke) where(reff_den > 0) SM_reff(i,j,:) = reff_num / reff_den - if(associated(DU_reff) .and. igroup .eq. reg%igrp_dust) where(reff_den > 0) DU_reff(i,j,:) = reff_num / reff_den - if(associated(ASH_reff) .and. igroup .eq. reg%igrp_ash) where(reff_den > 0) ASH_reff(i,j,:) = reff_num / reff_den - if(associated(SU_reff) .and. igroup .eq. reg%igrp_sulfate) where(reff_den > 0) SU_reff(i,j,:) = reff_num / reff_den - if(associated(SS_reff) .and. igroup .eq. reg%igrp_seasalt) where(reff_den > 0) SS_reff(i,j,:) = reff_num / reff_den - enddo - - -! Get the number of substeps, retries from CARMA state - if(reg%do_grow) then - call CARMASTATE_Get(cstate, rc, nsubstep=substep_int, & - nretry=retry_real, zsubsteps=zsubsteps_) - if(associated(substeps)) substeps(i,j) = REAL(substep_int-last_sub, kind=f) - if(associated(retries)) retries(i,j) = retry_real-last_ret - if(associated(zsubsteps)) zsubsteps(i,j,:) = zsubsteps_ - last_sub = substep_int - last_ret = retry_real - endif - -! Hack -- for now don't change temperature -! ! Get the updated temperature. -! call CARMASTATE_GetState(cstate, rc, t=tmpu_) -! tmpu(i,j,:) = tmpu_(:) - - end do - end do - -! Return the updated gas species to GMI from the internal state -! Expectation is species are in MMR and needed in VMR for GMI -! ----------- - if(reg%sulfuric_acid_source(1:10) == 'full_field' .and. reg%NGAS > 0) then - do igas = 1, reg%NGAS - n = nCARMAbegin + reg%NBIN*reg%NELEM - 1 + igas - gasname = ESMF_UtilStringUpperCase(reg%gasname(igas)) - if(gasname == 'H2SO4') then - if(associated(h2so4)) h2so4 = qa(n)%data3d*WTMOL_AIR/WTMOL_H2SO4 - endif - if(gasname == 'HNO3' ) then -! For now don't update HNO3 -! if(associated(hno3)) hno3 = qa(n)%data3d*WTMOL_AIR /WTMOL_HNO3 - endif - enddo - endif - - - - ! Cleanup the carma state objects - call CARMASTATE_Destroy(cstate, rc) - - -#ifdef DEBUG -if(reg%NGAS > 0) then - n = reg%NBIN*reg%NELEM + reg%NGAS - call pmaxmin('CARMA::h2o_1: ', qa(n-1)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - call pmaxmin('CARMA::h2so4_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - call pmaxmin('CARMA::su001_1: ', qa(1)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + 1 - call pmaxmin('CARMA::told_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS - call pmaxmin('CARMA::h2o_old_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::h2so4_old_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::satliq2_old_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) - n = reg%NBIN*reg%NELEM + reg%NGAS + reg%NGAS + reg%NGAS + reg%NGAS + 1 - call pmaxmin('CARMA::satice2_old_1: ', qa(n)%data3d(i1:i2,j1:j2,1:km), qmin, qmax, ijl, km, 1. ) -endif -#endif -! ================= END CARMA Step ================================ - -! Deallocate -! -------- - deallocate(p, xc, dx, yc, dy, gasold_, told_, satice_, satliq_, & - p_, ple_, tmpu_, zc_, zl_, q_, rh_, nuc_, sarea_, numd_, & - r_wet_, reff_num, reff_den, vf_, zsubsteps_, suvf, mxvf, stat=ios) - - -! ------------------------------------------------------------------------ -! Export states -! ------------------------------------------------------------------------ - - - - RETURN - - END SUBROUTINE CARMA_GridCompRun - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_GridCompFinalize -! -! !INTERFACE: -! - - SUBROUTINE CARMA_GridCompFinalize ( gcCARMA, impChem, expChem, & - nymd, nhms, cdt, rc ) - - IMPLICIT none - -! !INPUT/OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(inout) :: gcCARMA ! Grid Component - -! !INPUT PARAMETERS: - - INTEGER, INTENT(in) :: nymd, nhms ! time - REAL, INTENT(in) :: cdt ! chemical timestep (secs) - - -! !OUTPUT PARAMETERS: - - TYPE(ESMF_State), INTENT(inout) :: impChem ! Import State - TYPE(ESMF_State), INTENT(inout) :: expChem ! Import State - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine finalizes this Grid Component. -! -! !REVISION HISTORY: -! -! 18Sep2003 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_GridCompFinalize' - integer :: STATUS - - rc=0 - - deallocate ( gcCARMA%carma ) - - RETURN - - END SUBROUTINE CARMA_GridCompFinalize - - - - subroutine dumpElement(carma, rc) - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - - write(*,*) "" - write(*,*) "Element Information" - - do i = 1, carma%f_NELEM - call CARMAELEMENT_Print(carma, i, rc) - if (rc /=0) write(carma%f_LUNOPRT, *) " *** FAILED ***, rc=", rc - write(carma%f_LUNOPRT,*) "" - end do - - write(carma%f_LUNOPRT,*) "" - return - end subroutine dumpElement - - - - - subroutine dumpGas(carma, rc) - - type(carma_type), pointer, intent(inout) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - type(carmagas_type), pointer :: cgas - character(len=255) :: gasname - real(kind=f) :: gwtmol - - write(*,*) "" - write(*,*) "Gas Information" - - do i = 1, carma%f_NGAS -! call CARMA_GetGas(carma, i, cgas, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - -! call CARMAGAS_Print(cgas, carma, rc) - if (rc /=0) write(*, *) " *** FAILED ***, rc=", rc - - write(*,*) "" - end do - - write(*,*) "" - end subroutine dumpGas - - - - - subroutine dumpGroup(carma, rc) - - type(carma_type), intent(in) :: carma !! the carma object - integer, intent(inout) :: rc !! return code, negative indicates failure - - ! Local Variables - integer :: i - - write(*,*) "" - write(*,*) "Group Information" - - do i = 1, carma%f_NGROUP - call CARMAGROUP_Print(carma, i, rc) - if (rc /=0) write(carma%f_LUNOPRT, *) " *** FAILED ***, rc=", rc - - write(carma%f_LUNOPRT,*) "" - end do - - write(carma%f_LUNOPRT,*) "" - return - end subroutine dumpGroup - - END MODULE CARMA_GridCompMod - diff --git a/CARMAchem_GridComp/CARMA_UtilMod.F90 b/CARMAchem_GridComp/CARMA_UtilMod.F90 deleted file mode 100644 index c9f56f26..00000000 --- a/CARMAchem_GridComp/CARMA_UtilMod.F90 +++ /dev/null @@ -1,2709 +0,0 @@ -#include "MAPL_Generic.h" -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: CARMA_UtilMod --- CARMA Utilities -! -! Container module for dealing with various utility processes -! central to setting up the CARMA problem, but not integral to -! actually running the CARMA subcode. Examples are doing -! emissions, dry deposition, and wet deposition. -! -! !INTERFACE: -! - - MODULE CARMA_UtilMod - -! !USES: - - USE ESMF - USE MAPL - USE Chem_Mod - USE Chem_UtilMod - USE Chem_ConstMod, only: undef - USE m_inpak90 ! Resource file management - USE m_die, only: die - -! Utility Modules - use DustEmissionMod ! Dust Emissions - use SeasaltEmissionMod ! Seasalt Emissions - use DryDepositionMod ! Aerosol Dry Deposition - use WetRemovalMod ! Aerosol Wet Removal - use ConvectionMod ! Offline convective mixing/scavenging - - -! CARMA Specific Methods - use CARMA_GridCompMod - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - - IMPLICIT NONE - INTEGER, PARAMETER :: DBL = KIND(0.00D+00) - REAL, PARAMETER :: radToDeg = 57.2957795 - -! !TYPES: - - PRIVATE - -! !PUBLIC MEMBER FUNCTIONS: - - PUBLIC CARMA_Emissions - PUBLIC CARMA_DryDeposition - PUBLIC CARMA_WetRemoval - PUBLIC CARMA_Convection - PUBLIC CARMA_ComputeDiags - PUBLIC CARMA_GetMieTables - PUBLIC CARMA_DestroyMieTables - -! -! !DESCRIPTION: -! -! This module implements utilities for CARMA -! -! !REVISION HISTORY: -! -! 30Mar2010 Colarco First crack -! -!EOP -!------------------------------------------------------------------------- - -!! Dust 8-bin specific values -! real, parameter :: dMash(8) = & ! GOCART like PSD -! (/ 0.0009, 0.0081, 0.0234, 0.0676, & -! 0.25, 0.25, 0.25, 0.25 /) -! real, parameter :: dMbc(8) = & ! GADS initial PSD for BC -! (/ 0.0077, 0.0533, 0.1848, 0.3213, & -! 0.2803, 0.1227, 0.0269, 0.0030 /) - - -! 22-bin specific values - real, parameter :: dMash(22) = & ! Neimeier et al. 2009 PSD for Pinatubo - (/ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, & - 0.0000, 0.0000, 0.0001, 0.0008, 0.0031, 0.0103, 0.0278, 0.0609, & - 0.1082, 0.1557, 0.1817, 0.1719, 0.1318, 0.0820 /) - real, parameter :: dMbc(22) = & ! Ndola AERONET-mean PSD from Matichuk et al. 2007 - (/ 0.0085, 0.0325, 0.0836, 0.1449, 0.1694, 0.1335, 0.0708, 0.0254, & - 0.0066, 0.0023, 0.0033, 0.0067, 0.0126, 0.0209, 0.0307, 0.0399, & - 0.0460, 0.0470, 0.0424, 0.0339, 0.0240, 0.0151 /) -! Pinatubo pulse initial particle size distribution for direct sulfate -! injection based on Guo et al. 2004 Table 5 (6/15/91 10:53-18:07 effective -! radius = 0.2 - 0.21 microns, so this is dMass mapped to 22 size bin sulfate -! assuming rmed = 0.12 um and sigma = 1.59 -! real, parameter :: dMpin(22) = & -! (/ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & -! 0.00000, 0.00000, 0.00000, 0.00008, 0.00258, 0.03307, 0.17177, 0.36158, & -! 0.30846, 0.10664, 0.01494, 0.00085, 0.00002, 0.00000 /) - -! 24-bin specific values -! Same lognormal parameters as the 22 bin case above. This distribution was -! created assuming the 24 bins, rmrat=3.7515201, rmin=2.6686863e-10 m, and -! rhop=1923 kg m-3 -! real, parameter :: dMpin(24) = & -! (/ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, -! 0.00000, 0.00000, 0.00045, 0.00942, 0.07945, 0.27143, 0.37581, 0.21087, -! 0.04795, 0.00442, 0.00017, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000 /) -! This size distribution is based on effective radius 0.15 (6/15/91 .8 hours -! after eruption. rmed = 0.087 um and sigma = 1.59 - real, parameter :: dMpin(24) = & - (/ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & - 0.00000, 0.00018, 0.00488, 0.05132, 0.21858, 0.37728, 0.26391, 0.07481, & - 0.00860, 0.00040, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000 /) -! This size distribution is putting all of the particles in the smallest bin -! real, parameter :: dMpin(24) = & -! (/ 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & -! 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & -! 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000 /) - - -! Export stuff - - -CONTAINS - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_Emissions -- Handle doing emissions calls for CARMA -! -! !INTERFACE: -! - - SUBROUTINE CARMA_Emissions ( gcCARMA, qa, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Parses the CARMA registry and handles doing emissions to main -! tracer array. -! -! !REVISION HISTORY: -! -! 10Mar2010 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: myname = 'CARMA_Emissions' - CHARACTER(LEN=255) :: groupname, elemname, gasname - - INTEGER :: ielem, ibin, igroup, igas, ienconc - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_UtilMod' - INTEGER :: STATUS - INTEGER :: i1, i2, im, j1, j2, jm, km, ijl, n, ii, ios - INTEGER :: nymd1, nhms1 - INTEGER :: n1, n2 - REAL(kind=f) :: dtime - REAL :: volclon, volclat, dk, dkt, volcems, dlon, dlat - INTEGER :: klow, kup, i, j, k - - - real(kind=f), allocatable :: radius(:), dr(:), rLow(:), rUp(:), rhop(:), & - rhod_(:), rhog_(:) - real, pointer :: w10m(:,:) - real :: radius_m, radius_um, rLow_um, rUp_um, rhod, rhog - real :: qmin, qmax - integer :: ibinfirst, ibinlast - real, allocatable :: fgridefficiency(:,:), fsstemis(:,:), tskin_c(:,:) - - REAL, POINTER, DIMENSION(:,:,:) :: p, ple, rhoa, tmpu, zc, zl, q, zle, rh - REAL, POINTER, DIMENSION(:,:,:) :: pso4, psoa_anthro, psoa_biomass, hno3, h2so4 - REAL, POINTER, DIMENSION(:,:) :: gwettop, frlake, oro, u10m, v10m, & - ustar, pblh, z0h, shflux, precc, precl, & - frocean, frseaice, frland, tskin, area - REAL, POINTER, DIMENSION(:,:) :: emissions, memissions, nemissions, dqa - REAL, POINTER, DIMENSION(:,:) :: biofuel_src, ebcant1_src, ebcant2_src, & - bc_ship_src, biomass_src, biogenic_src - real, pointer, dimension(:,:) :: du_emis, ss_emis, bc_emis, ash_emis, sm_emis - - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - -! Seasalt emission method - integer, parameter :: method = 3 - -! Indices for point emissions - integer, pointer, dimension(:) :: iPoint, jPoint - real, dimension(gcCARMA%km) :: point_column_emissions - real, dimension(gcCARMA%km) :: delp - - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - - n1 = 1 - n2 = gcCARMA%CARMAreg%nq - - allocate(emissions(i1:i2,j1:j2), memissions(i1:i2,j1:j2), & - nemissions(i1:i2,j1:j2), w10m(i1:i2,j1:j2), dqa(i1:i2,j1:j2), stat=STATUS) - VERIFY_(STATUS) - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, area, 'AREA', __RC__) - call MAPL_GetPointer ( impChem, frocean, 'FROCEAN', __RC__) - call MAPL_GetPointer ( impChem, frseaice, 'FRACI', __RC__) - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, q, 'Q', __RC__) - call MAPL_GetPointer ( impChem, rh, 'RH2', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - call MAPL_GetPointer ( impChem, ustar, 'USTAR', __RC__) - call MAPL_GetPointer ( impChem, frlake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, frland, 'FRLAND', __RC__) - call MAPL_GetPointer ( impChem, gwettop, 'WET1', __RC__) - call MAPL_GetPointer ( impChem, u10m, 'U10M', __RC__) - call MAPL_GetPointer ( impChem, v10m, 'V10M', __RC__) - call MAPL_GetPointer ( impChem, pblh, 'ZPBL', __RC__) - call MAPL_GetPointer ( impChem, z0h, 'Z0H', __RC__) - call MAPL_GetPointer ( impChem, shflux, 'SH', __RC__) - call MAPL_GetPointer ( impChem, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, oro, 'LWI', __RC__) -! call MAPL_GetPointer ( impChem, tskin, 'TS', __RC__) - call MAPL_GetPointer ( impChem, pso4, 'CARMA_PSO4TOT', notFoundOK=.TRUE., __RC__) - call MAPL_GetPointer ( impChem, hno3, 'CARMA_HNO3', notFoundOK=.TRUE., __RC__) - - -! Define 10-m wind speed - w10m = sqrt(u10m*u10m + v10m*v10m) - -! Get Exports -! ----------- - call MAPL_GetPointer(expChem, du_emis, 'CARMA_DUEM', __RC__) - call MAPL_GetPointer(expChem, ss_emis, 'CARMA_SSEM', __RC__) - call MAPL_GetPointer(expChem, bc_emis, 'CARMA_BCEM', __RC__) - call MAPL_GetPointer(expChem, sm_emis, 'CARMA_SMEM', __RC__) - call MAPL_GetPointer(expChem, ash_emis, 'CARMA_ASHEM', __RC__) - -! Loop over CARMA elements and assign emissions -! Default behavior is now: if pure groups exist -! then emissions go there, else they go into -! appropriate element of mixed group. - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - ienconc = r%f_group(igroup)%f_ienconc - -! Dust -! ------------------------------------------------------------------------ -! Logic is that primary dust emissions go into any pure dust group that -! exists (groupname == 'DUST') OR ELSE if NO pure dust group go into any -! mixed group (groupname == 'MIXEDP') dust element - if( groupname == 'DUST' .or. & - ( reg%igrp_dust < 1 .AND. groupname == 'MIXEDP' .AND. elemname == 'DUST' ) ) then - -! Compute the vertical dust emission flux (kg m-2 s-1) to be -! apportioned across size and added as a dMass to each bin. -! flux = S * s(r) * f(u,v,...) -! where S is the surface source function (grid-box efficiency) -! which should come from an input file provided in resource -! and s(r) is some function of particle size and f(u,v,...) is -! the functional form of the actual mobilization process. -! In this implementation we compute f(u,v,...) in a separate routine -! and do the rest here. - -! Read dust source function from file - call MAPL_GetPointer( impChem, gcCARMA%dust_source, 'CARMA_DU_SRC', __RC__) - -! Do the emission calculation -! The DEAD emission calculation occurs outside the size bins, returning -! total emissions [kg m-2 s-1] which need to be scaled by particle -! size distribution factors, dust source function, land fraction, and -! other tuning coefficients (i.e., resolution dependent tuning) - emissions = 0. - call DustEmissionDEAD( i1, i2, j1, j2, km, & - gwettop, oro, ustar, u10m, v10m, & - emissions, rc ) - if( associated(DU_emis)) DU_emis(:,:) = 0. - -! Update tracer mixing ratio and emissions diagnostic - do ibin = 1, reg%NBIN - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - dqa = reg%dust_emissions_fudgefactor * frland * & - reg%dmass_dust(ibin) * gcCARMA%dust_source * emissions *& - dtime * grav_mks / (ple(:,:,km)-ple(:,:,km-1)) - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa -! If primary dust emission are going into a mixed group element (test by -! checking no pure dust group but DUST element is not "pc") then need to -! also add mass to "pc" element - if( reg%igrp_dust < 1 .AND. ielem .NE. ienconc) then - n = n1 + (ienconc-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa - endif -! Add to export flux diagnostic - if( associated(DU_emis)) & - DU_emis = DU_emis + dqa / (dtime * grav_mks / (ple(:,:,km)-ple(:,:,km-1))) - end do - - endif ! Dust -! ------------------------------------------------------------------------ - - -! Sea Salt -! ----------------------------------------------------------------------- -! Logic is that primary emissions go into any pure sea salt group that -! exists (groupname == 'SEASALT') OR ELSE if NO pure group go into any -! mixed group (groupname == 'MIXEDP') seasalt element - if( groupname == 'SEASALT' .or. & - ( reg%igrp_seasalt < 1 .AND. groupname == 'MIXEDP' .AND. elemname == 'SEASALT' ) ) then - -! Do the emission calculation - if( associated(SS_emis)) SS_emis(:,:) = 0. - allocate(rLow(reg%NBIN), rUp(reg%NBIN), & - rhod_(reg%NBIN), rhog_(reg%NBIN), __STAT__ ) - -! Grid box efficiency to emission (fraction of sea water) - allocate(fgridefficiency(i1:i2,j1:j2), __STAT__ ) - fgridefficiency = min(max(0.,frocean-frseaice),1.) - -! Sea surface temperature correction - allocate(fsstemis(i1:i2,j1:j2), __STAT__ ) - fsstemis = 0.0 - allocate( tskin_c(i1:i2,j1:j2), __STAT__ ) -! tskin_c = tskin - 273.15 - tskin_c = 285. - 273.15 - - where(tskin_c < -0.1) tskin_c = -0.1 ! temperature range (0, 36) C - where(tskin_c > 36.0) tskin_c = 36.0 ! - - fsstemis = (-1.107211 -0.010681*tskin_c -0.002276*tskin_c**2 + 60.288927*1.0/(40.0 - tskin_c)) - where(fsstemis < 0.0) fsstemis = 0.0 - where(fsstemis > 7.0) fsstemis = 7.0 - - deallocate( tskin_c, __STAT__ ) - - - call CARMAGROUP_Get(gcCARMA%carma, igroup, rc, rlow=rlow, rup=rup) - call CARMAElement_Get(gcCARMA%carma, ielem, rc, rho=rhod_) - call CARMAElement_Get(gcCARMA%carma, ienconc, rc, rho=rhog_) - rhod = rhod_(1) * 1000. ! go from CARMA to MKS - rhog = rhog_(1) * 1000. ! go from CARMA to MKS - -! Update tracer mixing ratio and emissions diagnostic - do ibin = 1, reg%NBIN - memissions = 0. - nemissions = 0. - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 -! Take radius from cm to um - rLow_um = rLow(ibin) * 1.e4 - rUp_um = rUp(ibin) * 1.e4 -! If the radii used are for a "mixed" group with a different density -! than "pure" seasakt we need to determine the radius of the "pure" seasalt -! particle with the same mass as the "mixed" group particle of the specified -! radius, which is simply: - rLow_um = rLow_um*(rhog/rhod)**(1./3.) - rUp_um = rUp_um*(rhog/rhod)**(1./3.) - call SeasaltEmission( rLow_um, rUp_um, method, w10m, & - ustar, memissions, nemissions, rc ) - dqa = reg%seasalt_emissions_fudgefactor * fgridefficiency * fsstemis * & - memissions * dtime * grav_mks / (ple(:,:,km)-ple(:,:,km-1)) - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa -! If primary emissions are going into a mixed group element (test by -! checking no pure seasalt group but SEASALT element is not "pc") then need to -! also add mass to "pc" element - if( reg%igrp_seasalt < 1 .AND. ielem .NE. ienconc) then - n = n1 + (ienconc-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa - endif -! Add to export flux diagnostic - if( associated(SS_emis)) & - SS_emis = SS_emis + reg%seasalt_emissions_fudgefactor * fgridefficiency * fsstemis * memissions - end do - deallocate(rLow,rUp, rhod_, rhog_, fgridefficiency, fsstemis, __STAT__ ) - endif ! Seasalt -! ------------------------------------------------------------------------ - -! Black Carbon -! ------------------------------------------------------------------------ - if(groupname == 'blackcarbon' .OR. groupname == 'BLACKCARBON') then - - if(gcCARMA%nymd_bc .ne. nymd) then - - gcCARMA%nymd_bc = nymd - - endif - - endif ! Black Carbon -! ------------------------------------------------------------------------ - -! Smoke -! ------------------------------------------------------------------------ -! For now just dump emission sources in the lower model layer -! For now also prescribing an initial PSD by bins (dMBC) which is stupid -! and also not correct for mixed groups. - if( groupname == 'SMOKE' .or. & - ( reg%igrp_smoke < 1 .AND. groupname == 'MIXEDP' .AND. elemname == 'SMOKE' ) ) then - -! Do the emission calculation - if( associated(SM_emis)) SM_emis(:,:) = 0. - - call MAPL_GetPointer( impChem, biomass_src, 'CARMA_SM_BIOMASS', __RC__) - call MAPL_GetPointer( impChem, biofuel_src, 'CARMA_SM_BIOFUEL', __RC__) - call MAPL_GetPointer( impChem, ebcant1_src, 'CARMA_SM_ANTEOC1', __RC__) - call MAPL_GetPointer( impChem, ebcant2_src, 'CARMA_SM_ANTEOC2', __RC__) - call MAPL_GetPointer( impChem, bc_ship_src, 'CARMA_SM_SHIP', __RC__) - call MAPL_GetPointer( impChem, biogenic_src, 'CARMA_OC_TERPENE', __RC__) - call MAPL_GetPointer( impChem, psoa_anthro, 'CARMA_PSOA_ANTHRO_VOC', __RC__) - call MAPL_GetPointer( impChem, psoa_biomass, 'CARMA_PSOA_BIOB_VOC', __RC__) - - if(associated(SM_emis)) SM_emis = ( biomass_src + biofuel_src + & - bc_ship_src + ebcant1_src + & - ebcant2_src + & - biogenic_src * reg%fraction_terpene_to_organic_carbon) & - * reg%organic_matter_to_organic_carbon_ratio - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - dqa = dMbc(ibin) * dtime *grav_mks / (ple(:,:,km)-ple(:,:,km-1)) & - * ( biomass_src + biofuel_src + bc_ship_src & - + ebcant1_src + ebcant2_src) * reg%organic_matter_to_organic_carbon_ratio -! biogenic source - dqa = dqa + dMbc(ibin) * dtime *grav_mks / (ple(:,:,km)-ple(:,:,km-1)) * biogenic_src - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa -! If primary emissions are going into a mixed group element (test by -! checking no pure smoke group but SMOKE element is not "pc") then need to -! also add mass to "pc" element - if( reg%igrp_smoke < 1 .AND. ielem .NE. ienconc) then - n = n1 + (ienconc-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) + dqa - endif - enddo - -! PSOA from VOC oxidation - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - do k = 1, km - dqa = dMbc(ibin) * dtime * (psoa_anthro(:,:,k)+psoa_biomass(:,:,k))/rhoa(:,:,k) - qa(n)%data3d(:,:,k) = qa(n)%data3d(:,:,k) + dqa -! If primary emissions are going into a mixed group element (test by -! checking no pure smoke group but SMOKE element is not "pc") then need to -! also add mass to "pc" element - if( reg%igrp_smoke < 1 .AND. ielem .NE. ienconc) then - n = n1 + (ienconc-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(:,:,k) = qa(n)%data3d(:,:,k) + dqa - endif - end do - end do - - - endif ! Smoke -! ------------------------------------------------------------------------ - -! Volcanic Ash -! ------------------------------------------------------------------------ - if( groupname == 'ASH' .or. & - ( reg%igrp_ash < 1 .AND. groupname == 'MIXEDP' .AND. elemname == 'ASH' ) ) then - - if(reg%doing_point_emissions_ash) then - call Chem_UtilPointEmissions( nymd, reg%point_emissions_srcfilen_ash, & - reg%nPts_ash, reg%vLat_ash, reg%vLon_ash, & - reg%vBase_ash, reg%vTop_ash, reg%vEmis_ash, & - reg%vStart_ash, reg%vEnd_ash ) - - -! Distribute -! ---------- - if(reg%nPts_ash > 0) then -! Get indices for point emissions -! ------------------------------- - allocate(iPoint(reg%nPts_ash), jPoint(reg%nPts_ash), stat=ios) - - call MAPL_GetHorzIJIndex(reg%nPts_ash, iPoint, jPoint, & - grid = gcCARMA%grid, & - lon = reg%vLon_ash/radToDeg, & - lat = reg%vLat_ash/radToDeg, & - rc = rc) - if ( rc /= 0 ) call die(myname,'cannot get indices for point emissions') - - do ii = 1, reg%nPts_ash - i = iPoint(ii) - j = jPoint(ii) - if( i<1 .OR. j<1 ) cycle ! point emission not in this sub-domain -! if( reg%regionMask(i,j) == 0 ) cycle ! masked by region mask -! Check that the emissions happen in this time step - if(nhms < reg%vStart_ash(ii) .or. nhms >= reg%vEnd_ash(ii)) cycle - - delp = ple(i,j,1:km)-ple(i,j,0:km-1) - - call distribute_point_emissions(delp, rhoa(i,j,:), & - reg%vBase_ash(ii), reg%vTop_ash(ii), reg%vEmis_ash(ii), & - point_column_emissions, km) -! Update tracer mixing ratio and emissions diagnostic - do ibin = 1, reg%NBIN - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(i,j,:) = qa(n)%data3d(i,j,:) & - + dMash(ibin)*dtime*grav_mks/delp*point_column_emissions/area(i,j) - if( associated(ASH_emis)) & - ASH_emis(i,j) = ASH_emis(i,j) + dMash(ibin)*sum(point_column_emissions)/area(i,j) - enddo - enddo - deallocate(iPoint, jPoint, stat=ios) - endif - endif - endif ! Ash - -! ------------------------------------------------------------------------ - -! Point Emissions -- need some logic to put them appropriately, for now... -! ------------------------------------------------------------------------ - if( groupname == 'DUST' .or. & - ( reg%igrp_dust < 1 .AND. groupname == 'MIXEDP' .AND. elemname == 'DUST' ) ) then - - if(reg%doing_point_emissions_dust) then - call Chem_UtilPointEmissions( nymd, reg%point_emissions_srcfilen_dust, & - reg%nPts_dust, reg%vLat_dust, reg%vLon_dust, & - reg%vBase_dust, reg%vTop_dust, reg%vEmis_dust, & - reg%vStart_dust, reg%vEnd_dust ) - - -! Distribute -! ---------- - if(reg%nPts_dust > 0) then -! Get indices for point emissions -! ------------------------------- - allocate(iPoint(reg%nPts_dust), jPoint(reg%nPts_dust), stat=ios) - - call MAPL_GetHorzIJIndex(reg%nPts_dust, iPoint, jPoint, & - grid = gcCARMA%grid, & - lon = reg%vLon_dust/radToDeg, & - lat = reg%vLat_dust/radToDeg, & - rc = rc) - if ( rc /= 0 ) call die(myname,'cannot get indices for point emissions') - - do ii = 1, reg%nPts_dust - i = iPoint(ii) - j = jPoint(ii) - if( i<1 .OR. j<1 ) cycle ! point emission not in this sub-domain -! if( reg%regionMask(i,j) == 0 ) cycle ! masked by region mask -! Check that the emissions happen in this time step - if(nhms < reg%vStart_dust(ii) .or. nhms >= reg%vEnd_dust(ii)) cycle - - delp = ple(i,j,1:km)-ple(i,j,0:km-1) - - call distribute_point_emissions(delp, rhoa(i,j,:), & - reg%vBase_dust(ii), reg%vTop_dust(ii), reg%vEmis_dust(ii), & - point_column_emissions, km) -! Update tracer mixing ratio and emissions diagnostic - do ibin = 1, reg%NBIN - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 -!NB: using ash PSD here until a proper ash component is integrated - qa(n)%data3d(i,j,:) = qa(n)%data3d(i,j,:) & - + dMash(ibin)*dtime*grav_mks/delp*point_column_emissions/area(i,j) -! If primary emissions are going into a mixed group element (test by -! checking no pure dust group but DUST element is not "pc") then need to -! also add mass to "pc" element - if( reg%igrp_dust < 1 .AND. ielem .NE. ienconc) then - n = n1 + (ienconc-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(i,j,:) = qa(n)%data3d(i,j,:) & - + dMash(ibin)*dtime*grav_mks/delp*point_column_emissions/area(i,j) - endif - end do - enddo - deallocate(iPoint, jPoint, stat=ios) - endif - endif - endif - -! if( groupname == 'SULFATE' .or. & -! ( groupname == 'MIXEDP' .AND. elemname == 'SULFATE' ) ) then - if( groupname == 'SULFATE' ) then - - if(reg%doing_point_emissions_sulfate) then - call Chem_UtilPointEmissions( nymd, reg%point_emissions_srcfilen_sulfate, & - reg%nPts_sulfate, reg%vLat_sulfate, reg%vLon_sulfate, & - reg%vBase_sulfate, reg%vTop_sulfate, reg%vEmis_sulfate, & - reg%vStart_sulfate, reg%vEnd_sulfate ) - - -! Distribute -! ---------- - if(reg%nPts_sulfate > 0) then -! Get indices for point emissions -! ------------------------------- - allocate(iPoint(reg%nPts_sulfate), jPoint(reg%nPts_sulfate), stat=ios) - - call MAPL_GetHorzIJIndex(reg%nPts_sulfate, iPoint, jPoint, & - grid = gcCARMA%grid, & - lon = reg%vLon_sulfate/radToDeg, & - lat = reg%vLat_sulfate/radToDeg, & - rc = rc) - if ( rc /= 0 ) call die(myname,'cannot get indices for point emissions') - - do ii = 1, reg%nPts_sulfate - i = iPoint(ii) - j = jPoint(ii) - if( i<1 .OR. j<1 ) cycle ! point emission not in this sub-domain -! if( reg%regionMask(i,j) == 0 ) cycle ! masked by region mask -! Check that the emissions happen in this time step - if(nhms < reg%vStart_sulfate(ii) .or. nhms >= reg%vEnd_sulfate(ii)) cycle - - delp = ple(i,j,1:km)-ple(i,j,0:km-1) - - call distribute_point_emissions(delp, rhoa(i,j,:), & - reg%vBase_sulfate(ii), & - reg%vTop_sulfate(ii), & - reg%vEmis_sulfate(ii), & - point_column_emissions, km) -! Update tracer mixing ratio and emissions diagnostic - do ibin = 1, reg%NBIN - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - qa(n)%data3d(i,j,:) = qa(n)%data3d(i,j,:) & - + dMpin(ibin)*dtime*grav_mks/delp*point_column_emissions/area(i,j) - end do - enddo - deallocate(iPoint, jPoint, stat=ios) - endif - endif - endif - - - enddo ! NELEM - -! Do the gas source functions -! Direct updates of mixing ratios from chemistry providers -! are done in the CARMA_GridComp Run method -! Not quite yet...yes for GMI, not all other possibilities -! -------------------------------------------------------- - if(reg%NGAS > 0) then - do igas = 1, reg%NGAS - n = n1 + reg%NELEM*reg%NBIN - 1 + igas - gasname = ESMF_UtilStringUpperCase(trim(reg%gasname(igas))) - if(reg%sulfuric_acid_source(1:8) == 'tendency' .and. gasname == 'H2SO4') then - qa(n)%data3d = qa(n)%data3d + pso4 * dtime - endif - if( gasname == 'HNO3') then ! go to MMR - qa(n)%data3d = hno3*WTMOL_HNO3/WTMOL_AIR - endif - end do - endif - - deallocate(emissions, memissions, nemissions, dqa, w10m, stat=STATUS) - VERIFY_(STATUS) - - - RETURN - - end subroutine CARMA_Emissions - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_DryDeposition -- Handle doing dry deposition calls for CARMA -! -! !INTERFACE: -! - - SUBROUTINE CARMA_DryDeposition ( gcCARMA, qa, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Parses the CARMA registry and handles doing emissions to main -! tracer array. -! -! !REVISION HISTORY: -! -! 10Mar2010 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: myname = 'CARMA_DryDeposition' - CHARACTER(LEN=255) :: groupname, elemname - - INTEGER :: ielem, ibin, igroup, ienconc - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_UtilMod' - INTEGER :: STATUS - INTEGER :: i1, i2, im, j1, j2, jm, km, ijl, n - INTEGER :: nymd1, nhms1 - INTEGER :: n1, n2 - REAL(kind=f) :: dtime - real(kind=f), allocatable :: radius_cgs(:) - real(kind=f), allocatable :: rhop_cgs(:) - real :: radius, rhop - - REAL, POINTER, DIMENSION(:,:,:) :: p, ple, rhoa, tmpu, zc, zl, q, zle, rh - REAL, POINTER, DIMENSION(:,:) :: gwettop, fraclake, oro, u10m, v10m, & - ustar, pblh, z0h, shflux, precc, precl - REAL, POINTER, DIMENSION(:,:) :: drydepositionfrequency, dqa - real, pointer, dimension(:,:) :: du_dep, su_dep, ss_dep, bc_dep, ash_dep, sm_dep, & - mxdu_dep, mxsu_dep, mxss_dep, mxbc_dep, mxash_dep, mxsm_dep - - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - - n1 = 1 - n2 = gcCARMA%CARMAreg%nq - - allocate(drydepositionfrequency(i1:i2,j1:j2), dqa(i1:i2,j1:j2), stat=STATUS) - VERIFY_(STATUS) - allocate(radius_cgs(reg%NBIN), rhop_cgs(reg%NBIN),stat=STATUS) - VERIFY_(STATUS) - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, q, 'Q', __RC__) - call MAPL_GetPointer ( impChem, rh, 'RH2', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - call MAPL_GetPointer ( impChem, ustar, 'USTAR', __RC__) - call MAPL_GetPointer ( impChem, fraclake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, gwettop, 'WET1', __RC__) - call MAPL_GetPointer ( impChem, u10m, 'U10M', __RC__) - call MAPL_GetPointer ( impChem, v10m, 'V10M', __RC__) - call MAPL_GetPointer ( impChem, pblh, 'ZPBL', __RC__) - call MAPL_GetPointer ( impChem, z0h, 'Z0H', __RC__) - call MAPL_GetPointer ( impChem, shflux, 'SH', __RC__) - call MAPL_GetPointer ( impChem, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, oro, 'LWI', __RC__) - -! Get Exports -! ----------- - call MAPL_GetPointer(expChem, du_dep, 'CARMA_DUDP', __RC__) - call MAPL_GetPointer(expChem, su_dep, 'CARMA_SUDP', __RC__) - call MAPL_GetPointer(expChem, ss_dep, 'CARMA_SSDP', __RC__) - call MAPL_GetPointer(expChem, bc_dep, 'CARMA_BCDP', __RC__) - call MAPL_GetPointer(expChem, sm_dep, 'CARMA_SMDP', __RC__) - call MAPL_GetPointer(expChem, ash_dep, 'CARMA_ASHDP', __RC__) - call MAPL_GetPointer(expChem, mxdu_dep, 'CARMA_MXDUDP', __RC__) - call MAPL_GetPointer(expChem, mxsu_dep, 'CARMA_MXSUDP', __RC__) - call MAPL_GetPointer(expChem, mxss_dep, 'CARMA_MXSSDP', __RC__) - call MAPL_GetPointer(expChem, mxbc_dep, 'CARMA_MXBCDP', __RC__) - call MAPL_GetPointer(expChem, mxsm_dep, 'CARMA_MXSMDP', __RC__) - call MAPL_GetPointer(expChem, mxash_dep, 'CARMA_MXASHDP', __RC__) - -! Do dry (turbulent) deposition -! Routine calls the GOCART dry deposition routine (sans -! the dust resuspension term at present). Note that this -! scheme is entirely independent of species/size, so we -! apply it equivalently at this point for all species/elements. -! An exception is allowed for dust to use the resuspension term. - - if( associated(DU_dep)) DU_dep(:,:) = 0. - if( associated(SU_dep)) SU_dep(:,:) = 0. - if( associated(SS_dep)) SS_dep(:,:) = 0. - if( associated(BC_dep)) BC_dep(:,:) = 0. - if( associated(SM_dep)) SM_dep(:,:) = 0. - if( associated(ASH_dep)) ASH_dep(:,:) = 0. - if( associated(MXDU_dep)) MXDU_dep(:,:) = 0. - if( associated(MXSU_dep)) MXSU_dep(:,:) = 0. - if( associated(MXSS_dep)) MXSS_dep(:,:) = 0. - if( associated(MXBC_dep)) MXBC_dep(:,:) = 0. - if( associated(MXSM_dep)) MXSM_dep(:,:) = 0. - if( associated(MXASH_dep)) MXASH_dep(:,:) = 0. - do ielem = 1, reg%NELEM - -! Routine returns the dry deposition frequency [s-1]. - drydepositionfrequency = 0. - call DryDepositionGOCART( i1, i2, j1, j2, km, & - tmpu, rhoa, zle, oro, ustar, & - pblh, shflux, z0h, drydepositionfrequency, rc ) - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - ienconc = r%f_group(igroup)%f_ienconc - - do ibin = 1, reg%NBIN - -! If doing dust, recompute the dry deposition frequency per bin -! to allow dust resuspension term. -! NB: This may not make a lot of sense for multi-component dust - if(groupname == 'dust' .OR. groupname == 'DUST') then - call CARMAGROUP_Get(gcCARMA%carma, igroup, rc, r=radius_cgs) - call CARMAELEMENT_Get(gcCARMA%carma, ielem, rc, rho=rhop_cgs) - radius = radius_cgs(ibin) * 1.e-2 - rhop = rhop_cgs(ibin) * 1000. - drydepositionfrequency = 0. - call DryDepositionGOCART( i1, i2, j1, j2, km, & - tmpu, rhoa, zle, oro, ustar, & - pblh, shflux, z0h, drydepositionfrequency, & - rc, radius, rhop, u10m, v10m, fraclake, & - gwettop ) - endif - - dqa = 0. - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - dqa = max(0.0, qa(n)%data3d(:,:,km)*(1.-exp(-drydepositionfrequency*dtime))) - qa(n)%data3d(:,:,km) = qa(n)%data3d(:,:,km) - dqa - dqa = dqa * (ple(:,:,km)-ple(:,:,km-1)) / grav_mks / dtime - - if(associated(DU_dep) .and. igroup .eq. reg%igrp_dust) DU_dep(:,:) = DU_dep(:,:) + dqa - if(associated(SS_dep) .and. igroup .eq. reg%igrp_seasalt) SS_dep(:,:) = SS_dep(:,:) + dqa - if(associated(SM_dep) .and. igroup .eq. reg%igrp_smoke) SM_dep(:,:) = SM_dep(:,:) + dqa - if(associated(SU_dep) .and. igroup .eq. reg%igrp_sulfate) SU_dep(:,:) = SU_dep(:,:) + dqa - if(associated(BC_dep) .and. igroup .eq. reg%igrp_black_carbon) BC_dep(:,:) = BC_dep(:,:) + dqa - if(associated(ASH_dep) .and. igroup .eq. reg%igrp_ash) ASH_dep(:,:) = ASH_dep(:,:) + dqa -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_dep) .and. ielem .eq. reg%ielm_mxdust) MXDU_dep(:,:) = MXDU_dep(:,:) + dqa - if(associated(MXSS_dep) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_dep(:,:) = MXSS_dep(:,:) + dqa - if(associated(MXSM_dep) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_dep(:,:) = MXSM_dep(:,:) + dqa - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_dep(:,:) = MXSU_dep(:,:) + dqa - if(associated(MXBC_dep) .and. ielem .eq. reg%ielm_mxbc) MXBC_dep(:,:) = MXBC_dep(:,:) + dqa - if(associated(MXASH_dep) .and. ielem .eq. reg%ielm_mxash) MXASH_dep(:,:) = MXASH_dep(:,:) + dqa -! subtract cores - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxdust) MXSU_dep(:,:) = MXSU_dep(:,:) - dqa - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_dep(:,:) = MXSU_dep(:,:) - dqa - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_dep(:,:) = MXSU_dep(:,:) - dqa - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxbc) MXSU_dep(:,:) = MXSU_dep(:,:) - dqa - if(associated(MXSU_dep) .and. ielem .eq. reg%ielm_mxash) MXSU_dep(:,:) = MXSU_dep(:,:) - dqa - endif - - enddo ! NBIN - enddo ! NELEM - - deallocate(radius_cgs, rhop_cgs, drydepositionfrequency, dqa, stat=STATUS) - VERIFY_(STATUS) - - - RETURN - - end subroutine CARMA_DryDeposition - - - - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_WetRemoval -- Handle doing wet removal calls for CARMA -! -! !INTERFACE: -! - - SUBROUTINE CARMA_WetRemoval ( gcCARMA, qa, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Parses the CARMA registry and handles doing emissions to main -! tracer array. -! -! !REVISION HISTORY: -! -! 10Mar2010 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: myname = 'CARMA_WetRemoval' - CHARACTER(LEN=255) :: groupname, elemname - - INTEGER :: ielem, ibin, igroup, ienconc - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_UtilMod' - INTEGER :: STATUS - INTEGER :: i1, i2, im, j1, j2, jm, km, ijl, n - INTEGER :: nymd1, nhms1 - INTEGER :: n1, n2 - REAL(kind=f) :: dtime - - REAL, POINTER, DIMENSION(:,:,:) :: p, ple, rhoa, tmpu, zc, zl, q, zle, & - rh, pfllsan, pfilsan - REAL, POINTER, DIMENSION(:,:) :: gwettop, fraclake, oro, u10m, v10m, & - ustar, pblh, z0h, shflux, precc, precl - type(Chem_Array), pointer :: wetremovalflux - real, pointer, dimension(:,:) :: du_wet, su_wet, ss_wet, bc_wet, ash_wet, sm_wet, & - mxdu_wet, mxsu_wet, mxss_wet, mxbc_wet, mxash_wet, mxsm_wet - - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - - real :: qmin, qmax - -! This flag was added to wet removal call to indicate aerosol (true) or gas (false) - logical :: KIN - - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - - n1 = 1 - n2 = reg%nq - - allocate(wetremovalflux, stat=STATUS) - VERIFY_(STATUS) - allocate(wetremovalflux%data2d(i1:i2,j1:j2), stat=STATUS) - VERIFY_(STATUS) - wetremovalflux%data2d = 0. - - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, q, 'Q', __RC__) - call MAPL_GetPointer ( impChem, rh, 'RH2', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - call MAPL_GetPointer ( impChem, ustar, 'USTAR', __RC__) - call MAPL_GetPointer ( impChem, fraclake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, gwettop, 'WET1', __RC__) - call MAPL_GetPointer ( impChem, u10m, 'U10M', __RC__) - call MAPL_GetPointer ( impChem, v10m, 'V10M', __RC__) - call MAPL_GetPointer ( impChem, pblh, 'ZPBL', __RC__) - call MAPL_GetPointer ( impChem, z0h, 'Z0H', __RC__) - call MAPL_GetPointer ( impChem, shflux, 'SH', __RC__) - call MAPL_GetPointer ( impChem, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, oro, 'LWI', __RC__) - call MAPL_GetPointer ( impChem, pfllsan,'PFL_LSAN', __RC__ ) - call MAPL_GetPointer ( impChem, pfilsan,'PFI_LSAN', __RC__ ) - -! Get Exports -! ---------- - call MAPL_GetPointer(expChem, du_wet, 'CARMA_DUWT', __RC__) - call MAPL_GetPointer(expChem, su_wet, 'CARMA_SUWT', __RC__) - call MAPL_GetPointer(expChem, ss_wet, 'CARMA_SSWT', __RC__) - call MAPL_GetPointer(expChem, bc_wet, 'CARMA_BCWT', __RC__) - call MAPL_GetPointer(expChem, sm_wet, 'CARMA_SMWT', __RC__) - call MAPL_GetPointer(expChem, ash_wet, 'CARMA_ASHWT', __RC__) - call MAPL_GetPointer(expChem, mxdu_wet, 'CARMA_MXDUWT', __RC__) - call MAPL_GetPointer(expChem, mxsu_wet, 'CARMA_MXSUWT', __RC__) - call MAPL_GetPointer(expChem, mxss_wet, 'CARMA_MXSSWT', __RC__) - call MAPL_GetPointer(expChem, mxbc_wet, 'CARMA_MXBCWT', __RC__) - call MAPL_GetPointer(expChem, mxsm_wet, 'CARMA_MXSMWT', __RC__) - call MAPL_GetPointer(expChem, mxash_wet, 'CARMA_MXASHWT', __RC__) - -! Routine calls the GOCART wet removal routine (large scale -! precip). Note that this scheme is entirely independent of size, -! but could use species/size varying efficiency factor. -! Returned are the updated tracer mixing ratios (qa) and a flux -! diagnostic (e.g., DU_wet, [integrated kg m-2 s-1 loss from column all bins]). - if( associated(DU_wet)) DU_wet(:,:) = 0. - if( associated(SU_wet)) SU_wet(:,:) = 0. - if( associated(SS_wet)) SS_wet(:,:) = 0. - if( associated(BC_wet)) BC_wet(:,:) = 0. - if( associated(SM_wet)) SM_wet(:,:) = 0. - if( associated(ASH_wet)) ASH_wet(:,:) = 0. - if( associated(MXDU_wet)) MXDU_wet(:,:) = 0. - if( associated(MXSU_wet)) MXSU_wet(:,:) = 0. - if( associated(MXSS_wet)) MXSS_wet(:,:) = 0. - if( associated(MXBC_wet)) MXBC_wet(:,:) = 0. - if( associated(MXSM_wet)) MXSM_wet(:,:) = 0. - if( associated(MXASH_wet)) MXASH_wet(:,:) = 0. - - -! This is a bit clumsy, but for now we define scavenging parameters here - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - groupname = trim(reg%groupname(igroup)) - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - if(groupname == 'ash' .OR. groupname == 'ASH' .or. & - groupname == 'blackcarbon' .OR. groupname == 'BLACKCARBON' .or. & - groupname == 'dust' .OR. groupname == 'DUST' .or. & - groupname =='smoke' .or. groupname == 'SMOKE' ) then - qa(n)%fwet = 0.3 - else - qa(n)%fwet = 1. - endif - end do - end do - - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - ienconc = r%f_group(igroup)%f_ienconc - - n = n1 + (ielem-1)*reg%NBIN - -! For now we presume we are wet removing an aerosol - KIN = .true. ! aerosol - call WetRemovalGOCART (i1, i2, j1, j2, km, n, n+reg%NBIN-1, cdt, & - ESMF_UtilStringLowerCase(trim(groupname)), KIN, & - qa, ple, tmpu, rhoa, pfllsan, pfilsan, & - precc, precl, wetremovalflux, rc ) - if(associated(DU_wet) .and. igroup .eq. reg%igrp_dust) DU_wet(:,:) = wetremovalflux%data2d - if(associated(SS_wet) .and. igroup .eq. reg%igrp_seasalt) SS_wet(:,:) = wetremovalflux%data2d - if(associated(SM_wet) .and. igroup .eq. reg%igrp_smoke) SM_wet(:,:) = wetremovalflux%data2d - if(associated(SU_wet) .and. igroup .eq. reg%igrp_sulfate) SU_wet(:,:) = wetremovalflux%data2d - if(associated(BC_wet) .and. igroup .eq. reg%igrp_black_carbon) BC_wet(:,:) = wetremovalflux%data2d - if(associated(ASH_wet) .and. igroup .eq. reg%igrp_ash) ASH_wet(:,:) = wetremovalflux%data2d -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_wet) .and. ielem .eq. reg%ielm_mxdust) MXDU_wet(:,:) = wetremovalflux%data2d - if(associated(MXSS_wet) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_wet(:,:) = wetremovalflux%data2d - if(associated(MXSM_wet) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_wet(:,:) = wetremovalflux%data2d - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_wet(:,:) = wetremovalflux%data2d - if(associated(MXBC_wet) .and. ielem .eq. reg%ielm_mxbc) MXBC_wet(:,:) = wetremovalflux%data2d - if(associated(MXASH_wet) .and. ielem .eq. reg%ielm_mxash) MXASH_wet(:,:) = wetremovalflux%data2d -! subtract cores - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxdust) MXSU_wet(:,:) = MXSU_wet(:,:) - wetremovalflux%data2d - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_wet(:,:) = MXSU_wet(:,:) - wetremovalflux%data2d - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_wet(:,:) = MXSU_wet(:,:) - wetremovalflux%data2d - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxbc) MXSU_wet(:,:) = MXSU_wet(:,:) - wetremovalflux%data2d - if(associated(MXSU_wet) .and. ielem .eq. reg%ielm_mxash) MXSU_wet(:,:) = MXSU_wet(:,:) - wetremovalflux%data2d - endif - - enddo ! NELEM - - deallocate(wetremovalflux%data2d, stat=STATUS) - VERIFY_(STATUS) - deallocate(wetremovalflux, stat=STATUS) - VERIFY_(STATUS) - - - RETURN - - end subroutine CARMA_WetRemoval - - - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_Convection -- Apply offline convective mixing and -! scavenging code -! -! !INTERFACE: -! - - SUBROUTINE CARMA_Convection ( gcCARMA, qa, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Parses the CARMA registry and handles doing emissions to main -! tracer array. -! -! !REVISION HISTORY: -! -! 10Mar2010 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: myname = 'CARMA_Convection' - CHARACTER(LEN=255) :: groupname, elemname - - INTEGER :: ielem, ibin, igroup, ienconc - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_UtilMod' - INTEGER :: STATUS - INTEGER :: i1, i2, im, j1, j2, jm, km, ijl, n, k - INTEGER :: nymd1, nhms1 - INTEGER :: n1, n2 - REAL(kind=f) :: dtime - real :: qmin, qmax - - REAL, POINTER, DIMENSION(:,:,:) :: cmfmc, qccu, dtrain, ple, zle, rhoa, tmpu - REAL, POINTER, DIMENSION(:,:) :: frocean, frseaice, frlake, area - real, pointer, dimension(:,:) :: du_scav, su_scav, ss_scav, bc_scav, ash_scav, sm_scav, & - mxdu_scav, mxsu_scav, mxss_scav, mxbc_scav, mxash_scav, mxsm_scav -! Locals - real*8, allocatable, dimension(:,:,:) :: cmfmc_, qccu_, dtrain_, & - airmass_, airmol_, vud_, & - delz_, delp_, ple_, tmpu_ - real*8, allocatable :: tc_(:,:,:,:), bcnv_(:,:,:) - real*8, allocatable :: area_(:,:), frlake_(:,:), & - frocean_(:,:), frseaice_(:,:) - integer*4 :: icdt - - - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - -! This flag was added to wet removal call to indicate aerosol (true) or gas (false) - logical :: KIN - - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - - n1 = 1 - n2 = reg%nq - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, frlake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, area, 'AREA', __RC__) - call MAPL_GetPointer ( impChem, frocean, 'FROCEAN', __RC__) - call MAPL_GetPointer ( impChem, frseaice, 'FRACI', __RC__) - call MAPL_GetPointer ( impChem, qccu, 'CNV_QC', __RC__) - call MAPL_GetPointer ( impChem, cmfmc, 'CNV_MFC', __RC__) - call MAPL_GetPointer ( impChem, dtrain, 'CNV_MFD', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - -! Get Exports -! ----------- - call MAPL_GetPointer(expChem, du_scav, 'CARMA_DUSV', __RC__) - call MAPL_GetPointer(expChem, su_scav, 'CARMA_SUSV', __RC__) - call MAPL_GetPointer(expChem, ss_scav, 'CARMA_SSSV', __RC__) - call MAPL_GetPointer(expChem, bc_scav, 'CARMA_BCSV', __RC__) - call MAPL_GetPointer(expChem, sm_scav, 'CARMA_SMSV', __RC__) - call MAPL_GetPointer(expChem, ash_scav, 'CARMA_ASHSV', __RC__) - call MAPL_GetPointer(expChem, mxdu_scav, 'CARMA_MXDUSV', __RC__) - call MAPL_GetPointer(expChem, mxsu_scav, 'CARMA_MXSUSV', __RC__) - call MAPL_GetPointer(expChem, mxss_scav, 'CARMA_MXSSSV', __RC__) - call MAPL_GetPointer(expChem, mxbc_scav, 'CARMA_MXBCSV', __RC__) - call MAPL_GetPointer(expChem, mxsm_scav, 'CARMA_MXSMSV', __RC__) - call MAPL_GetPointer(expChem, mxash_scav, 'CARMA_MXASHSV', __RC__) - -#ifdef DEBUG - call pmaxmin('CARMA::area : ', area , qmin, qmax, ijl, 1, 1. ) - call pmaxmin('CARMA::frlake : ', frlake , qmin, qmax, ijl, 1, 1. ) - call pmaxmin('CARMA::frocean : ', frocean , qmin, qmax, ijl, 1, 1. ) - call pmaxmin('CARMA::frseaice: ', frseaice , qmin, qmax, ijl, 1, 1. ) - call pmaxmin('CARMA::rhoa : ', rhoa , qmin, qmax, ijl, km, 1. ) - call pmaxmin('CARMA::ple : ', ple , qmin, qmax, ijl, km+1, 1. ) - call pmaxmin('CARMA::zle : ', zle , qmin, qmax, ijl, km+1, 1. ) - call pmaxmin('CARMA::cmfmc : ', cmfmc , qmin, qmax, ijl, km+1, 1. ) - call pmaxmin('CARMA::qccu : ', qccu , qmin, qmax, ijl, km, 1. ) - call pmaxmin('CARMA::dtrain : ', dtrain , qmin, qmax, ijl, km, 1. ) -#endif - -! Local allocation and creation - icdt = cdt - allocate(cmfmc_(i1:i2,j1:j2,km+1), qccu_(i1:i2,j1:j2,km), & - dtrain_(i1:i2,j1:j2,km), airmass_(i1:i2,j1:j2,km), & - delz_(i1:i2,j1:j2,km), vud_(i1:i2,j1:j2,km), & - tc_(i1:i2,j1:j2,km,reg%NBIN), delp_(i1:i2,j1:j2,km), & - airmol_(i1:i2,j1:j2,km), tmpu_(i1:i2,j1:j2,km), & - bcnv_(i1:i2,j1:j2,reg%NBIN), ple_(i1:i2,j1:j2,km+1), & - area_(i1:i2,j1:j2), frlake_(i1:i2,j1:j2), & - frocean_(i1:i2,j1:j2), frseaice_(i1:i2,j1:j2), __STAT__ ) - - - area_ = area - frlake_ = frlake - frocean_ = frocean - frseaice_ = frseaice - do k = 1, km+1 - cmfmc_(:,:,k) = cmfmc(:,:,km-k+1) - ple_(:,:,k) = ple(:,:,km-k+1) - end do - do k = 1, km - dtrain_(:,:,k) = dtrain(:,:,km-k+1) - qccu_(:,:,k) = qccu(:,:,km-k+1) - delp_(:,:,k) = ple(:,:,km-k+1)-ple(:,:,km-k) - airmass_(:,:,k) = delp_(:,:,k)/grav_mks*area_ - airmol_(:,:,k) = airmass_(:,:,k)*1000./28.966 - delz_(:,:,k) = delp_(:,:,k)/grav_mks/rhoa(:,:,km-k+1) - tmpu_(:,:,k) = tmpu(:,:,km-k+1) - enddo - -! Routine calls the GOCART wet removal routine (large scale -! precip). Note that this scheme is entirely independent of size, -! but could use species/size varying efficiency factor. -! Returned are the updated tracer mixing ratios (qa) and a flux -! diagnostic (e.g., DU_wet, [integrated kg m-2 s-1 loss from column all bins]). - if( associated(DU_scav)) DU_scav(:,:) = 0. - if( associated(SU_scav)) SU_scav(:,:) = 0. - if( associated(SS_scav)) SS_scav(:,:) = 0. - if( associated(BC_scav)) BC_scav(:,:) = 0. - if( associated(SM_scav)) SM_scav(:,:) = 0. - if( associated(ASH_scav)) ASH_scav(:,:) = 0. - if( associated(MXDU_scav)) MXDU_scav(:,:) = 0. - if( associated(MXSU_scav)) MXSU_scav(:,:) = 0. - if( associated(MXSS_scav)) MXSS_scav(:,:) = 0. - if( associated(MXBC_scav)) MXBC_scav(:,:) = 0. - if( associated(MXSM_scav)) MXSM_scav(:,:) = 0. - if( associated(MXASH_scav)) MXASH_scav(:,:) = 0. - -! For now we do the calculation based on elements - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - ienconc = r%f_group(igroup)%f_ienconc - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - do k = 1, km - tc_(:,:,k,ibin) = qa(n)%data3d(:,:,km-k+1) - enddo - enddo - - call set_vud(i1, i2, j1, j2, km, frlake_, frocean_, frseaice_, cmfmc_, qccu_, & - airmass_, delz_, area_, vud_) - -! For now we presume we are wet removing an aerosol - KIN = .true. ! aerosol - call convection(i1, i2, j1, j2, km, 1, reg%NBIN, icdt, & - ESMF_UtilStringLowerCase(trim(groupname)), KIN, & - tc_, cmfmc_, dtrain_, area_, delz_, delp_, vud_, & - airmass_, airmol_, tmpu_, ple_, & - bcnv_) - -! Return adjusted tracer to mixing ratio and accumulate diagnostic -! Note GOCART returns bcnv_ as negative, recast for my diagnostic -! PRC -- In GeoMIP style simulations finding non-conservative -! return from convection at some North Pole points. So I check -! for bcnv_ > 0 as an indication of this (addition of particles -! to column) and exclude those columns. This is a hack. - - do ibin = 1, reg%NBIN - - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - do k = 1, km - where(bcnv_(:,:,ibin) < 0) qa(n)%data3d(:,:,km-k+1) = tc_(:,:,k,ibin) - enddo - where(bcnv_(:,:,ibin) > 0) bcnv_(:,:,ibin) = 0. - - if(associated(DU_scav) .and. igroup .eq. reg%igrp_dust) DU_scav(:,:) = DU_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(SS_scav) .and. igroup .eq. reg%igrp_seasalt) SS_scav(:,:) = SS_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(SM_scav) .and. igroup .eq. reg%igrp_smoke) SM_scav(:,:) = SM_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(SU_scav) .and. igroup .eq. reg%igrp_sulfate) SU_scav(:,:) = SU_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(BC_scav) .and. igroup .eq. reg%igrp_black_carbon) BC_scav(:,:) = BC_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(ASH_scav) .and. igroup .eq. reg%igrp_ash) ASH_scav(:,:) = ASH_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_scav) .and. ielem .eq. reg%ielm_mxdust) MXDU_scav(:,:) = MXDU_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSS_scav) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_scav(:,:) = MXSS_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSM_scav) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_scav(:,:) = MXSM_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_scav(:,:) = MXSU_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(MXBC_scav) .and. ielem .eq. reg%ielm_mxbc) MXBC_scav(:,:) = MXBC_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt - if(associated(MXASH_scav) .and. ielem .eq. reg%ielm_mxash) MXASH_scav(:,:) = MXASH_scav(:,:) - bcnv_(:,:,ibin)/area_/icdt -! subtract cores - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxdust) MXSU_scav(:,:) = MXSU_scav(:,:) + bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_scav(:,:) = MXSU_scav(:,:) + bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_scav(:,:) = MXSU_scav(:,:) + bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxbc) MXSU_scav(:,:) = MXSU_scav(:,:) + bcnv_(:,:,ibin)/area_/icdt - if(associated(MXSU_scav) .and. ielem .eq. reg%ielm_mxash) MXSU_scav(:,:) = MXSU_scav(:,:) + bcnv_(:,:,ibin)/area_/icdt - endif - - enddo ! NBIN - - enddo ! NELEM - - deallocate(cmfmc_, qccu_, dtrain_, tc_, airmass_, & - delz_, vud_, delp_, airmol_, bcnv_, tmpu_, ple_, & - area_, frlake_, frocean_, frseaice_, __STAT__ ) - - - RETURN - - end subroutine CARMA_Convection - - - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_ComputeDiags -- Compute some diagnostics -! -! !INTERFACE: -! - - SUBROUTINE CARMA_ComputeDiags ( gcCARMA, qa, impChem, expChem, nymd, nhms, cdt, & - rc ) - - IMPLICIT none - -! !INPUT PARAMETERS: - - INTEGER, INTENT(IN) :: nymd, nhms ! Time from AGCM - REAL, INTENT(IN) :: cdt ! Chemistry time step (secs) - -! !OUTPUT PARAMETERS: - - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - TYPE(ESMF_State), INTENT(INOUT) :: impChem ! Import State - TYPE(ESMF_State), INTENT(INOUT) :: expChem ! Export State - TYPE(Chem_Array), pointer :: qa(:) ! tracer array will go here - - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Parses the CARMA registry and handles doing emissions to main -! tracer array. -! -! !REVISION HISTORY: -! -! 12Mar2021 Case Added sulfate stratospheric column diagnostics -! 10Mar2010 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - - CHARACTER(LEN=*), PARAMETER :: myname = 'CARMA_ComputeDiags' - CHARACTER(LEN=255) :: groupname, elemname, qname, gasname - - INTEGER :: ielem, ibin, igroup, ienconc, igas - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_UtilMod' - INTEGER :: STATUS - INTEGER :: i1, i2, im, j1, j2, jm, km, ijl, n, i, j, k, idx - INTEGER :: nymd1, nhms1 - INTEGER :: n1, n2 - logical :: do_angstrom - REAL(kind=f) :: dtime - REAL :: delp - - REAL, POINTER, DIMENSION(:,:,:) :: p, ple, rhoa, tmpu, zc, zl, q, zle, & - rh, u, v - REAL, POINTER, DIMENSION(:,:) :: gwettop, fraclake, oro, u10m, v10m, & - ustar, pblh, z0h, shflux, precc, precl, & - tropp - real, pointer, dimension(:,:,:) :: du_mass, su_mass, ss_mass, bc_mass, ash_mass, sm_mass, & - mxdu_mass, mxsu_mass, mxss_mass, mxbc_mass, mxash_mass, mxsm_mass - real, pointer, dimension(:,:,:) :: du_conc, su_conc, ss_conc, bc_conc, ash_conc, sm_conc, & - mxdu_conc, mxsu_conc, mxss_conc, mxbc_conc, mxash_conc, mxsm_conc - real, pointer, dimension(:,:) :: du_fluxu, su_fluxu, ss_fluxu, bc_fluxu, ash_fluxu, sm_fluxu, & - mxdu_fluxu, mxsu_fluxu, mxss_fluxu, mxbc_fluxu, mxash_fluxu, mxsm_fluxu - real, pointer, dimension(:,:) :: du_fluxv, su_fluxv, ss_fluxv, bc_fluxv, ash_fluxv, sm_fluxv, & - mxdu_fluxv, mxsu_fluxv, mxss_fluxv, mxbc_fluxv, mxash_fluxv, mxsm_fluxv - real, pointer, dimension(:,:) :: du_smass, su_smass, ss_smass, bc_smass, ash_smass, sm_smass, & - mxdu_smass, mxsu_smass, mxss_smass, mxbc_smass, mxash_smass, mxsm_smass - real, pointer, dimension(:,:) :: du_cmass, su_cmass, ss_cmass, bc_cmass, ash_cmass, sm_cmass, & - mxdu_cmass, mxsu_cmass, mxss_cmass, mxbc_cmass, mxash_cmass, mxsm_cmass - real, pointer, dimension(:,:) :: h2so4_cmass - -! Columnar optical quantities: Extinction AOT (??_exttau @ 550 nm), -! Scattering AOT (??_scatau @ 550 nm), -! Angstrom parameter (??_angstr for 470 and 870 nm wavelength pair) - real, pointer, dimension(:,:) :: du_exttau, su_exttau, ss_exttau, bc_exttau, ash_exttau, sm_exttau - real, pointer, dimension(:,:) :: su_stratexttau, su_stratscatau - real, pointer, dimension(:,:) :: du_scatau, su_scatau, ss_scatau, bc_scatau, ash_scatau, sm_scatau - real, pointer, dimension(:,:) :: du_angstr, su_angstr, ss_angstr, bc_angstr, ash_angstr, sm_angstr - real, pointer, dimension(:,:) :: totexttau, totscatau, totangstr -! Vertical optical quantities: Extinction coefficient (??_extcoef @ 550 nm in m-1), -! Scattering coefficient (??_scacoef @ 550 nm in m-1) - real, pointer, dimension(:,:,:) :: du_extcoef, su_extcoef, ss_extcoef, bc_extcoef, ash_extcoef, sm_extcoef - real, pointer, dimension(:,:,:) :: du_scacoef, su_scacoef, ss_scacoef, bc_scacoef, ash_scacoef, sm_scacoef - - type(CARMA_Registry), pointer :: reg => null() - type(carma_type), pointer :: r => null() - type(Chem_Mie), pointer :: mie => null() - -! We are using the CARMA constants here (CGS units) but need -! MKS values to go back to GEOS-5 - REAL, PARAMETER :: grav_mks = grav/100. - -! Optical calculations - real :: ilam550, ilam470, ilam870 - real :: tau, ssa - real, allocatable, dimension(:,:) :: tau470, tau870, tottau470, tottau870, dq - - rc = 0 - i1 = gcCARMA%i1 - i2 = gcCARMA%i2 - im = gcCARMA%im - - j1 = gcCARMA%j1 - j2 = gcCARMA%j2 - jm = gcCARMA%jm - - km = gcCARMA%km - - ijl = (i2-i1+1)*(j2-j1+1) - - dtime = cdt - - r => gcCARMA%carma - reg => gcCARMA%CARMAreg - mie => gcCARMA%CARMAmie - - n1 = 1 - n2 = gcCARMA%CARMAreg%nq - -! Get Imports -! ----------- - call MAPL_GetPointer ( impChem, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer ( impChem, ple, 'PLE', __RC__) - call MAPL_GetPointer ( impChem, zle, 'ZLE', __RC__) - call MAPL_GetPointer ( impChem, tropp, 'TROPP', __RC__) - call MAPL_GetPointer ( impChem, q, 'Q', __RC__) - call MAPL_GetPointer ( impChem, rh, 'RH2', __RC__) - call MAPL_GetPointer ( impChem, tmpu, 'T', __RC__) - call MAPL_GetPointer ( impChem, ustar, 'USTAR', __RC__) - call MAPL_GetPointer ( impChem, fraclake, 'FRLAKE', __RC__) - call MAPL_GetPointer ( impChem, gwettop, 'WET1', __RC__) - call MAPL_GetPointer ( impChem, u10m, 'U10M', __RC__) - call MAPL_GetPointer ( impChem, v10m, 'V10M', __RC__) - call MAPL_GetPointer ( impChem, pblh, 'ZPBL', __RC__) - call MAPL_GetPointer ( impChem, z0h, 'Z0H', __RC__) - call MAPL_GetPointer ( impChem, shflux, 'SH', __RC__) - call MAPL_GetPointer ( impChem, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer ( impChem, oro, 'LWI', __RC__) - call MAPL_GetPointer ( impChem, u, 'U', __RC__) - call MAPL_GetPointer ( impChem, v, 'V', __RC__) - -! Get Exports -! ----------- - call MAPL_GetPointer(expChem, du_mass, 'CARMA_DUMASS', __RC__) - call MAPL_GetPointer(expChem, su_mass, 'CARMA_SUMASS', __RC__) - call MAPL_GetPointer(expChem, ss_mass, 'CARMA_SSMASS', __RC__) - call MAPL_GetPointer(expChem, bc_mass, 'CARMA_BCMASS', __RC__) - call MAPL_GetPointer(expChem, sm_mass, 'CARMA_SMMASS', __RC__) - call MAPL_GetPointer(expChem, ash_mass, 'CARMA_ASHMASS', __RC__) - call MAPL_GetPointer(expChem, mxdu_mass, 'CARMA_MXDUMASS', __RC__) - call MAPL_GetPointer(expChem, mxsu_mass, 'CARMA_MXSUMASS', __RC__) - call MAPL_GetPointer(expChem, mxss_mass, 'CARMA_MXSSMASS', __RC__) - call MAPL_GetPointer(expChem, mxbc_mass, 'CARMA_MXBCMASS', __RC__) - call MAPL_GetPointer(expChem, mxsm_mass, 'CARMA_MXSMMASS', __RC__) - call MAPL_GetPointer(expChem, mxash_mass, 'CARMA_MXASHMASS', __RC__) - call MAPL_GetPointer(expChem, du_conc, 'CARMA_DUCONC', __RC__) - call MAPL_GetPointer(expChem, su_conc, 'CARMA_SUCONC', __RC__) - call MAPL_GetPointer(expChem, ss_conc, 'CARMA_SSCONC', __RC__) - call MAPL_GetPointer(expChem, bc_conc, 'CARMA_BCCONC', __RC__) - call MAPL_GetPointer(expChem, sm_conc, 'CARMA_SMCONC', __RC__) - call MAPL_GetPointer(expChem, ash_conc, 'CARMA_ASHCONC', __RC__) - call MAPL_GetPointer(expChem, mxdu_conc, 'CARMA_MXDUCONC', __RC__) - call MAPL_GetPointer(expChem, mxsu_conc, 'CARMA_MXSUCONC', __RC__) - call MAPL_GetPointer(expChem, mxss_conc, 'CARMA_MXSSCONC', __RC__) - call MAPL_GetPointer(expChem, mxbc_conc, 'CARMA_MXBCCONC', __RC__) - call MAPL_GetPointer(expChem, mxsm_conc, 'CARMA_MXSMCONC', __RC__) - call MAPL_GetPointer(expChem, du_fluxu, 'CARMA_DUFLUXU', __RC__) - call MAPL_GetPointer(expChem, su_fluxu, 'CARMA_SUFLUXU', __RC__) - call MAPL_GetPointer(expChem, ss_fluxu, 'CARMA_SSFLUXU', __RC__) - call MAPL_GetPointer(expChem, bc_fluxu, 'CARMA_BCFLUXU', __RC__) - call MAPL_GetPointer(expChem, sm_fluxu, 'CARMA_SMFLUXU', __RC__) - call MAPL_GetPointer(expChem, ash_fluxu, 'CARMA_ASHFLUXU', __RC__) - call MAPL_GetPointer(expChem, du_fluxv, 'CARMA_DUFLUXV', __RC__) - call MAPL_GetPointer(expChem, su_fluxv, 'CARMA_SUFLUXV', __RC__) - call MAPL_GetPointer(expChem, ss_fluxv, 'CARMA_SSFLUXV', __RC__) - call MAPL_GetPointer(expChem, bc_fluxv, 'CARMA_BCFLUXV', __RC__) - call MAPL_GetPointer(expChem, sm_fluxv, 'CARMA_SMFLUXV', __RC__) - call MAPL_GetPointer(expChem, ash_fluxv, 'CARMA_ASHFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxdu_fluxu, 'CARMA_MXDUFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxsu_fluxu, 'CARMA_MXSUFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxss_fluxu, 'CARMA_MXSSFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxbc_fluxu, 'CARMA_MXBCFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxsm_fluxu, 'CARMA_MXSMFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxash_fluxu, 'CARMA_MXASHFLUXU', __RC__) - call MAPL_GetPointer(expChem, mxdu_fluxv, 'CARMA_MXDUFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxsu_fluxv, 'CARMA_MXSUFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxss_fluxv, 'CARMA_MXSSFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxbc_fluxv, 'CARMA_MXBCFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxsm_fluxv, 'CARMA_MXSMFLUXV', __RC__) - call MAPL_GetPointer(expChem, mxash_fluxv, 'CARMA_MXASHFLUXV', __RC__) - call MAPL_GetPointer(expChem, du_smass, 'CARMA_DUSMASS', __RC__) - call MAPL_GetPointer(expChem, su_smass, 'CARMA_SUSMASS', __RC__) - call MAPL_GetPointer(expChem, ss_smass, 'CARMA_SSSMASS', __RC__) - call MAPL_GetPointer(expChem, bc_smass, 'CARMA_BCSMASS', __RC__) - call MAPL_GetPointer(expChem, sm_smass, 'CARMA_SMSMASS', __RC__) - call MAPL_GetPointer(expChem, ash_smass, 'CARMA_ASHSMASS', __RC__) - call MAPL_GetPointer(expChem, du_cmass, 'CARMA_DUCMASS', __RC__) - call MAPL_GetPointer(expChem, su_cmass, 'CARMA_SUCMASS', __RC__) - call MAPL_GetPointer(expChem, ss_cmass, 'CARMA_SSCMASS', __RC__) - call MAPL_GetPointer(expChem, bc_cmass, 'CARMA_BCCMASS', __RC__) - call MAPL_GetPointer(expChem, sm_cmass, 'CARMA_SMCMASS', __RC__) - call MAPL_GetPointer(expChem, h2so4_cmass, 'CARMA_H2SO4CMASS', __RC__) - call MAPL_GetPointer(expChem, ash_cmass, 'CARMA_ASHCMASS', __RC__) - call MAPL_GetPointer(expChem, mxdu_smass, 'CARMA_MXDUSMASS', __RC__) - call MAPL_GetPointer(expChem, mxsu_smass, 'CARMA_MXSUSMASS', __RC__) - call MAPL_GetPointer(expChem, mxss_smass, 'CARMA_MXSSSMASS', __RC__) - call MAPL_GetPointer(expChem, mxbc_smass, 'CARMA_MXBCSMASS', __RC__) - call MAPL_GetPointer(expChem, mxsm_smass, 'CARMA_MXSMSMASS', __RC__) - call MAPL_GetPointer(expChem, mxash_smass, 'CARMA_MXASHSMASS', __RC__) - call MAPL_GetPointer(expChem, mxdu_cmass, 'CARMA_MXDUCMASS', __RC__) - call MAPL_GetPointer(expChem, mxsu_cmass, 'CARMA_MXSUCMASS', __RC__) - call MAPL_GetPointer(expChem, mxss_cmass, 'CARMA_MXSSCMASS', __RC__) - call MAPL_GetPointer(expChem, mxbc_cmass, 'CARMA_MXBCCMASS', __RC__) - call MAPL_GetPointer(expChem, mxsm_cmass, 'CARMA_MXSMCMASS', __RC__) - call MAPL_GetPointer(expChem, mxash_cmass, 'CARMA_MXASHCMASS', __RC__) - call MAPL_GetPointer(expChem, du_exttau, 'CARMA_DUEXTTAU', __RC__) - call MAPL_GetPointer(expChem, su_exttau, 'CARMA_SUEXTTAU', __RC__) - call MAPL_GetPointer(expChem, ss_exttau, 'CARMA_SSEXTTAU', __RC__) - call MAPL_GetPointer(expChem, bc_exttau, 'CARMA_BCEXTTAU', __RC__) - call MAPL_GetPointer(expChem, sm_exttau, 'CARMA_SMEXTTAU', __RC__) - call MAPL_GetPointer(expChem, ash_exttau, 'CARMA_ASHEXTTAU', __RC__) - call MAPL_GetPointer(expChem, su_stratexttau, 'CARMA_SUSTRATEXTTAU', __RC__) - call MAPL_GetPointer(expChem, du_scatau, 'CARMA_DUSCATAU', __RC__) - call MAPL_GetPointer(expChem, su_scatau, 'CARMA_SUSCATAU', __RC__) - call MAPL_GetPointer(expChem, ss_scatau, 'CARMA_SSSCATAU', __RC__) - call MAPL_GetPointer(expChem, bc_scatau, 'CARMA_BCSCATAU', __RC__) - call MAPL_GetPointer(expChem, sm_scatau, 'CARMA_SMSCATAU', __RC__) - call MAPL_GetPointer(expChem, ash_scatau, 'CARMA_ASHSCATAU', __RC__) - call MAPL_GetPointer(expChem, su_stratscatau, 'CARMA_SUSTRATSCATAU', __RC__) - call MAPL_GetPointer(expChem, du_angstr, 'CARMA_DUANGSTR', __RC__) - call MAPL_GetPointer(expChem, su_angstr, 'CARMA_SUANGSTR', __RC__) - call MAPL_GetPointer(expChem, ss_angstr, 'CARMA_SSANGSTR', __RC__) - call MAPL_GetPointer(expChem, bc_angstr, 'CARMA_BCANGSTR', __RC__) - call MAPL_GetPointer(expChem, sm_angstr, 'CARMA_SMANGSTR', __RC__) - call MAPL_GetPointer(expChem, ash_angstr, 'CARMA_ASHANGSTR', __RC__) - call MAPL_GetPointer(expChem, totexttau, 'CARMA_TOTEXTTAU', __RC__) - call MAPL_GetPointer(expChem, totscatau, 'CARMA_TOTSCATAU', __RC__) - call MAPL_GetPointer(expChem, totangstr, 'CARMA_TOTANGSTR', __RC__) - call MAPL_GetPointer(expChem, du_extcoef, 'CARMA_DUEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, du_scacoef, 'CARMA_DUSCACOEF', __RC__) - call MAPL_GetPointer(expChem, su_extcoef, 'CARMA_SUEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, su_scacoef, 'CARMA_SUSCACOEF', __RC__) - call MAPL_GetPointer(expChem, ss_extcoef, 'CARMA_SSEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, ss_scacoef, 'CARMA_SSSCACOEF', __RC__) - call MAPL_GetPointer(expChem, bc_extcoef, 'CARMA_BCEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, bc_scacoef, 'CARMA_BCSCACOEF', __RC__) - call MAPL_GetPointer(expChem, sm_extcoef, 'CARMA_SMEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, sm_scacoef, 'CARMA_SMSCACOEF', __RC__) - call MAPL_GetPointer(expChem, ash_extcoef, 'CARMA_ASHEXTCOEF', __RC__) - call MAPL_GetPointer(expChem, ash_scacoef, 'CARMA_ASHSCACOEF', __RC__) - -! Routine computes some basic diagnostics - -! Initialize Quantities -! Mass mixing ratio and concentration (size integrated) -! --------------------------------------------------- - if( associated(DU_mass)) DU_mass(:,:,:) = 0. - if( associated(SU_mass)) SU_mass(:,:,:) = 0. - if( associated(SS_mass)) SS_mass(:,:,:) = 0. - if( associated(BC_mass)) BC_mass(:,:,:) = 0. - if( associated(SM_mass)) SM_mass(:,:,:) = 0. - if( associated(ASH_mass)) ASH_mass(:,:,:) = 0. - if( associated(DU_conc)) DU_conc(:,:,:) = 0. - if( associated(SU_conc)) SU_conc(:,:,:) = 0. - if( associated(SS_conc)) SS_conc(:,:,:) = 0. - if( associated(BC_conc)) BC_conc(:,:,:) = 0. - if( associated(SM_conc)) SM_conc(:,:,:) = 0. - if( associated(ASH_conc)) ASH_conc(:,:,:) = 0. - if( associated(MXDU_mass)) MXDU_mass(:,:,:) = 0. - if( associated(MXSU_mass)) MXSU_mass(:,:,:) = 0. - if( associated(MXSS_mass)) MXSS_mass(:,:,:) = 0. - if( associated(MXBC_mass)) MXBC_mass(:,:,:) = 0. - if( associated(MXSM_mass)) MXSM_mass(:,:,:) = 0. - if( associated(MXASH_mass)) MXASH_mass(:,:,:) = 0. - if( associated(MXDU_conc)) MXDU_conc(:,:,:) = 0. - if( associated(MXSU_conc)) MXSU_conc(:,:,:) = 0. - if( associated(MXSS_conc)) MXSS_conc(:,:,:) = 0. - if( associated(MXBC_conc)) MXBC_conc(:,:,:) = 0. - if( associated(MXSM_conc)) MXSM_conc(:,:,:) = 0. - if( associated(MXASH_conc)) MXASH_conc(:,:,:) = 0. - -! Mass Fluxes (size integrated) -! ----------------------------- - if( associated(DU_fluxu)) DU_fluxu(:,:) = 0. - if( associated(SU_fluxu)) SU_fluxu(:,:) = 0. - if( associated(SS_fluxu)) SS_fluxu(:,:) = 0. - if( associated(BC_fluxu)) BC_fluxu(:,:) = 0. - if( associated(SM_fluxu)) SM_fluxu(:,:) = 0. - if( associated(ASH_fluxu)) ASH_fluxu(:,:) = 0. - if( associated(DU_fluxv)) DU_fluxv(:,:) = 0. - if( associated(SU_fluxv)) SU_fluxv(:,:) = 0. - if( associated(SS_fluxv)) SS_fluxv(:,:) = 0. - if( associated(BC_fluxv)) BC_fluxv(:,:) = 0. - if( associated(SM_fluxv)) SM_fluxv(:,:) = 0. - if( associated(ASH_fluxv)) ASH_fluxv(:,:) = 0. - if( associated(MXDU_fluxu)) MXDU_fluxu(:,:) = 0. - if( associated(MXSU_fluxu)) MXSU_fluxu(:,:) = 0. - if( associated(MXSS_fluxu)) MXSS_fluxu(:,:) = 0. - if( associated(MXBC_fluxu)) MXBC_fluxu(:,:) = 0. - if( associated(MXSM_fluxu)) MXSM_fluxu(:,:) = 0. - if( associated(MXASH_fluxu)) MXASH_fluxu(:,:) = 0. - if( associated(MXDU_fluxv)) MXDU_fluxv(:,:) = 0. - if( associated(MXSU_fluxv)) MXSU_fluxv(:,:) = 0. - if( associated(MXSS_fluxv)) MXSS_fluxv(:,:) = 0. - if( associated(MXBC_fluxv)) MXBC_fluxv(:,:) = 0. - if( associated(MXSM_fluxv)) MXSM_fluxv(:,:) = 0. - if( associated(MXASH_fluxv)) MXASH_fluxv(:,:) = 0. - - -! Surface Concentration (size integrated) -! --------------------------------------- - if( associated(DU_smass)) DU_smass(:,:) = 0. - if( associated(SU_smass)) SU_smass(:,:) = 0. - if( associated(SS_smass)) SS_smass(:,:) = 0. - if( associated(BC_smass)) BC_smass(:,:) = 0. - if( associated(SM_smass)) SM_smass(:,:) = 0. - if( associated(ASH_smass)) ASH_smass(:,:) = 0. - if( associated(MXDU_smass)) MXDU_smass(:,:) = 0. - if( associated(MXSU_smass)) MXSU_smass(:,:) = 0. - if( associated(MXSS_smass)) MXSS_smass(:,:) = 0. - if( associated(MXBC_smass)) MXBC_smass(:,:) = 0. - if( associated(MXSM_smass)) MXSM_smass(:,:) = 0. - if( associated(MXASH_smass)) MXASH_smass(:,:) = 0. - -! Column Loading (size integrated) -! -------------------------------- - if( associated(H2SO4_cmass)) H2SO4_cmass(:,:) = 0. - if( associated(DU_cmass)) DU_cmass(:,:) = 0. - if( associated(SU_cmass)) SU_cmass(:,:) = 0. - if( associated(SS_cmass)) SS_cmass(:,:) = 0. - if( associated(BC_cmass)) BC_cmass(:,:) = 0. - if( associated(SM_cmass)) SM_cmass(:,:) = 0. - if( associated(ASH_cmass)) ASH_cmass(:,:) = 0. - if( associated(MXDU_cmass)) MXDU_cmass(:,:) = 0. - if( associated(MXSU_cmass)) MXSU_cmass(:,:) = 0. - if( associated(MXSS_cmass)) MXSS_cmass(:,:) = 0. - if( associated(MXBC_cmass)) MXBC_cmass(:,:) = 0. - if( associated(MXSM_cmass)) MXSM_cmass(:,:) = 0. - if( associated(MXASH_cmass)) MXASH_cmass(:,:) = 0. - - - allocate(dq(i1:i2,j1:j2), stat=STATUS) - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - -! Surface mass concentration -! -------------------------- - k = km - dq = qa(n)%data3d(:,:,k) * rhoa(:,:,k) - if(associated(DU_smass) .and. igroup .eq. reg%igrp_dust) DU_smass = DU_smass + dq - if(associated(SS_smass) .and. igroup .eq. reg%igrp_seasalt) SS_smass = SS_smass + dq - if(associated(SM_smass) .and. igroup .eq. reg%igrp_smoke) SM_smass = SM_smass + dq - if(associated(SU_smass) .and. igroup .eq. reg%igrp_sulfate) SU_smass = SU_smass + dq - if(associated(BC_smass) .and. igroup .eq. reg%igrp_black_carbon) BC_smass = BC_smass + dq - if(associated(ASH_smass) .and. igroup .eq. reg%igrp_ash) ASH_smass = ASH_smass + dq -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_smass) .and. ielem .eq. reg%ielm_mxdust) MXDU_smass = MXDU_smass + dq - if(associated(MXSS_smass) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_smass = MXSS_smass + dq - if(associated(MXSM_smass) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_smass = MXSM_smass + dq - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_smass = MXSU_smass + dq - if(associated(MXBC_smass) .and. ielem .eq. reg%ielm_mxbc) MXBC_smass = MXBC_smass + dq - if(associated(MXASH_smass) .and. ielem .eq. reg%ielm_ash) MXASH_smass = MXASH_smass + dq -! subtract cores - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxdust) MXSU_smass = MXSU_smass - dq - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_smass = MXSU_smass - dq - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_smass = MXSU_smass - dq - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxbc) MXSU_smass = MXSU_smass - dq - if(associated(MXSU_smass) .and. ielem .eq. reg%ielm_mxash) MXSU_smass = MXSU_smass - dq - endif - -! Integrated Mass Mixing Ratio -! ---------------------------- - if(associated(DU_mass) .and. igroup .eq. reg%igrp_dust) DU_mass = DU_mass + qa(n)%data3d - if(associated(SS_mass) .and. igroup .eq. reg%igrp_seasalt) SS_mass = SS_mass + qa(n)%data3d - if(associated(SM_mass) .and. igroup .eq. reg%igrp_smoke) SM_mass = SM_mass + qa(n)%data3d - if(associated(SU_mass) .and. igroup .eq. reg%igrp_sulfate) SU_mass = SU_mass + qa(n)%data3d - if(associated(BC_mass) .and. igroup .eq. reg%igrp_black_carbon) BC_mass = BC_mass + qa(n)%data3d - if(associated(ASH_mass) .and. igroup .eq. reg%igrp_ash) ASH_mass = ASH_mass + qa(n)%data3d -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_mass) .and. ielem .eq. reg%ielm_mxdust) MXDU_mass = MXDU_mass + qa(n)%data3d - if(associated(MXSS_mass) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_mass = MXSS_mass + qa(n)%data3d - if(associated(MXSM_mass) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_mass = MXSM_mass + qa(n)%data3d - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_mass = MXSU_mass + qa(n)%data3d - if(associated(MXBC_mass) .and. ielem .eq. reg%ielm_mxbc) MXBC_mass = MXBC_mass + qa(n)%data3d - if(associated(MXASH_mass) .and. ielem .eq. reg%ielm_ash) MXASH_mass = MXASH_mass + qa(n)%data3d -! subtract cores - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxdust) MXSU_mass = MXSU_mass - qa(n)%data3d - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_mass = MXSU_mass - qa(n)%data3d - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_mass = MXSU_mass - qa(n)%data3d - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxbc) MXSU_mass = MXSU_mass - qa(n)%data3d - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxash) MXSU_mass = MXSU_mass - qa(n)%data3d - endif - -! Integrated Mass Concentration -! ----------------------------- - if(associated(DU_conc) .and. igroup .eq. reg%igrp_dust) DU_conc = DU_conc + qa(n)%data3d*rhoa - if(associated(SS_conc) .and. igroup .eq. reg%igrp_seasalt) SS_conc = SS_conc + qa(n)%data3d*rhoa - if(associated(SM_conc) .and. igroup .eq. reg%igrp_smoke) SM_conc = SM_conc + qa(n)%data3d*rhoa - if(associated(SU_conc) .and. igroup .eq. reg%igrp_sulfate) SU_conc = SU_conc + qa(n)%data3d*rhoa - if(associated(BC_conc) .and. igroup .eq. reg%igrp_black_carbon) BC_conc = BC_conc + qa(n)%data3d*rhoa - if(associated(ASH_conc) .and. igroup .eq. reg%igrp_ash) ASH_conc = ASH_conc + qa(n)%data3d*rhoa -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_conc) .and. ielem .eq. reg%ielm_mxdust) MXDU_conc = MXDU_conc + qa(n)%data3d*rhoa - if(associated(MXSS_conc) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_conc = MXSS_conc + qa(n)%data3d*rhoa - if(associated(MXSM_conc) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_conc = MXSM_conc + qa(n)%data3d*rhoa - if(associated(MXSU_conc) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_conc = MXSU_conc + qa(n)%data3d*rhoa - if(associated(MXBC_conc) .and. ielem .eq. reg%ielm_mxbc) MXBC_conc = MXBC_conc + qa(n)%data3d*rhoa - if(associated(MXASH_conc) .and. ielem .eq. reg%ielm_ash) MXASH_conc = MXASH_conc + qa(n)%data3d*rhoa -! subtract cores - if(associated(MXSU_conc) .and. ielem .eq. reg%ielm_mxdust) MXSU_conc = MXSU_conc - qa(n)%data3d*rhoa - if(associated(MXSU_conc) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_conc = MXSU_conc - qa(n)%data3d*rhoa - if(associated(MXSU_conc) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_conc = MXSU_conc - qa(n)%data3d*rhoa - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxbc) MXSU_mass = MXSU_mass - qa(n)%data3d*rhoa - if(associated(MXSU_mass) .and. ielem .eq. reg%ielm_mxash) MXSU_mass = MXSU_mass - qa(n)%data3d*rhoa - endif - -! Vertically integrated fields -! ---------------------------- - do k = 1, km -! Column Mass Loading -! ------------------- - dq = qa(n)%data3d(:,:,k) * (ple(:,:,k)-ple(:,:,k-1))/grav_mks - if(associated(DU_cmass) .and. igroup .eq. reg%igrp_dust) DU_cmass = DU_cmass + dq - if(associated(SS_cmass) .and. igroup .eq. reg%igrp_seasalt) SS_cmass = SS_cmass + dq - if(associated(SM_cmass) .and. igroup .eq. reg%igrp_smoke) SM_cmass = SM_cmass + dq - if(associated(SU_cmass) .and. igroup .eq. reg%igrp_sulfate) SU_cmass = SU_cmass + dq - if(associated(BC_cmass) .and. igroup .eq. reg%igrp_black_carbon) BC_cmass = BC_cmass + dq - if(associated(ASH_cmass) .and. igroup .eq. reg%igrp_ash) ASH_cmass = ASH_cmass + dq -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_cmass) .and. ielem .eq. reg%ielm_mxdust) MXDU_cmass = MXDU_cmass + dq - if(associated(MXSS_cmass) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_cmass = MXSS_cmass + dq - if(associated(MXSM_cmass) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_cmass = MXSM_cmass + dq - if(associated(MXSU_cmass) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_cmass = MXSU_cmass + dq - if(associated(MXBC_cmass) .and. igroup .eq. reg%igrp_black_carbon) MXBC_cmass = MXBC_cmass + dq - if(associated(MXASH_cmass) .and. igroup .eq. reg%igrp_ash) MXASH_cmass = MXASH_cmass + dq -! subtract cores - if(associated(MXSU_cmass) .and. ielem .eq. reg%ielm_mxdust) MXSU_cmass = MXSU_cmass - dq - if(associated(MXSU_cmass) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_cmass = MXSU_cmass - dq - if(associated(MXSU_cmass) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_cmass = MXSU_cmass - dq - endif - -! Mass Flux (U) -! ------------- - dq = qa(n)%data3d(:,:,k) * (ple(:,:,k)-ple(:,:,k-1))/grav_mks*u(:,:,k) - if(associated(DU_fluxu) .and. igroup .eq. reg%igrp_dust) DU_fluxu = DU_fluxu + dq - if(associated(SS_fluxu) .and. igroup .eq. reg%igrp_seasalt) SS_fluxu = SS_fluxu + dq - if(associated(SM_fluxu) .and. igroup .eq. reg%igrp_smoke) SM_fluxu = SM_fluxu + dq - if(associated(SU_fluxu) .and. igroup .eq. reg%igrp_sulfate) SU_fluxu = SU_fluxu + dq - if(associated(BC_fluxu) .and. igroup .eq. reg%igrp_black_carbon) BC_fluxu = BC_fluxu + dq - if(associated(ASH_fluxu) .and. igroup .eq. reg%igrp_ash) ASH_fluxu = ASH_fluxu + dq -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_fluxu) .and. ielem .eq. reg%ielm_mxdust) MXDU_fluxu = MXDU_fluxu + dq - if(associated(MXSS_fluxu) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_fluxu = MXSS_fluxu + dq - if(associated(MXSM_fluxu) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_fluxu = MXSM_fluxu + dq - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_fluxu = MXSU_fluxu + dq - if(associated(MXBC_fluxu) .and. ielem .eq. reg%ielm_mxbc) MXBC_fluxu = MXBC_fluxu + dq - if(associated(MXASH_fluxu) .and. ielem .eq. reg%ielm_ash) MXASH_fluxu = MXASH_fluxu + dq -! subtract cores - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxdust) MXSU_fluxu = MXSU_fluxu - dq - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_fluxu = MXSU_fluxu - dq - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_fluxu = MXSU_fluxu - dq - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxbc) MXSU_fluxu = MXSU_fluxu - dq - if(associated(MXSU_fluxu) .and. ielem .eq. reg%ielm_mxash) MXSU_fluxu = MXSU_fluxu - dq - endif - -! Mass Flux (V) -! ------------- - dq = qa(n)%data3d(:,:,k) * (ple(:,:,k)-ple(:,:,k-1))/grav_mks*v(:,:,k) - if(associated(DU_fluxv) .and. igroup .eq. reg%igrp_dust) DU_fluxv = DU_fluxv + dq - if(associated(SS_fluxv) .and. igroup .eq. reg%igrp_seasalt) SS_fluxv = SS_fluxv + dq - if(associated(SM_fluxv) .and. igroup .eq. reg%igrp_smoke) SM_fluxv = SM_fluxv + dq - if(associated(SU_fluxv) .and. igroup .eq. reg%igrp_sulfate) SU_fluxv = SU_fluxv + dq - if(associated(BC_fluxv) .and. igroup .eq. reg%igrp_black_carbon) BC_fluxv = BC_fluxv + dq - if(associated(ASH_fluxv) .and. igroup .eq. reg%igrp_ash) ASH_fluxv = ASH_fluxv + dq -! Mixed group -- assume "pc" element is sulfate and subtract cores - if(igroup .eq. reg%igrp_mixed) then - if(associated(MXDU_fluxv) .and. ielem .eq. reg%ielm_mxdust) MXDU_fluxv = MXDU_fluxv + dq - if(associated(MXSS_fluxv) .and. ielem .eq. reg%ielm_mxseasalt) MXSS_fluxv = MXSS_fluxv + dq - if(associated(MXSM_fluxv) .and. ielem .eq. reg%ielm_mxsmoke) MXSM_fluxv = MXSM_fluxv + dq - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxsulfate) MXSU_fluxv = MXSU_fluxv + dq - if(associated(MXBC_fluxv) .and. ielem .eq. reg%ielm_mxbc) MXBC_fluxv = MXBC_fluxv + dq - if(associated(MXASH_fluxv) .and. ielem .eq. reg%ielm_ash) MXASH_fluxv = MXASH_fluxv + dq -! subtract cores - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxdust) MXSU_fluxv = MXSU_fluxv - dq - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxsmoke) MXSU_fluxv = MXSU_fluxv - dq - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxseasalt) MXSU_fluxv = MXSU_fluxv - dq - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxbc) MXSU_fluxv = MXSU_fluxv - dq - if(associated(MXSU_fluxv) .and. ielem .eq. reg%ielm_mxash) MXSU_fluxv = MXSU_fluxv - dq - endif - enddo - - enddo - enddo - deallocate(dq,stat=STATUS) - -! Gas diagnostics -! --------------- - if(reg%NGAS > 0) then - do igas = 1, reg%NGAS - gasname = ESMF_UtilStringUpperCase(trim(reg%gasname(igas))) - n = n1 + reg%NELEM*reg%NBIN - 1 + igas - if( gasname == 'H2SO4') then - if(associated(h2so4_cmass)) then - do k = 1, km - h2so4_cmass = h2so4_cmass & - + qa(n)%data3d(:,:,k) * (ple(:,:,k)-ple(:,:,k-1))/grav_mks - end do - endif - endif - end do - endif - - - -! Optical properties -! ------------------ - -! Get the wavelength indices -! Must provide ilam550 for AOT calculation - ilam550 = 1. - ilam470 = 0. - ilam870 = 0. - if(mie%nch .gt. 1) then - do i = 1, mie%nch - if ( mie%channels(i) .ge. 5.49e-7 .and. & - mie%channels(i) .le. 5.51e-7) ilam550 = i - if ( mie%channels(i) .ge. 4.69e-7 .and. & - mie%channels(i) .le. 4.71e-7) ilam470 = i - if ( mie%channels(i) .ge. 8.69e-7 .and. & - mie%channels(i) .le. 8.71e-7) ilam870 = i - enddo - endif - -! Do an Angstrom parameter calculation? -! ------------------------------------- - do_angstrom = .false. -! If both 470 and 870 channels provided (and not the same) then -! possibly will do Angstrom parameter calculation - if(( ilam470 .ne. 0. .and. & - ilam870 .ne. 0. .and. & - ilam470 .ne. ilam870) .and. & - ( associated(DU_angstr) .or. & - associated(BC_angstr) .or. & - associated(BC_angstr) .or. & - associated(SM_angstr) .or. & - associated(ASH_angstr) .or. & - associated(totangstr) & - ) ) do_angstrom = .true. - if(do_angstrom) then - allocate(tau470(i1:i2,j1:j2), tottau470(i1:i2,j1:j2), & - tau870(i1:i2,j1:j2), tottau870(i1:i2,j1:j2), stat=STATUS) - VERIFY_(STATUS) - tau470(i1:i2,j1:j2) = tiny(1.0) - tau870(i1:i2,j1:j2) = tiny(1.0) - tottau470(i1:i2,j1:j2) = tiny(1.0) - tottau870(i1:i2,j1:j2) = tiny(1.0) - endif - - -! Extinction and Scattering AOD, Angstrom parameter -! ------------------------------------------------- - if( associated(totexttau)) totexttau(:,:) = 0. - if( associated(totscatau)) totscatau(:,:) = 0. - if( associated(totangstr)) totangstr(:,:) = 0. - - if( associated(DU_exttau)) DU_exttau(:,:) = 0. - if( associated(DU_scatau)) DU_scatau(:,:) = 0. - if( associated(DU_angstr)) DU_angstr(:,:) = 0. - - if( associated(SU_exttau)) SU_exttau(:,:) = 0. - if( associated(SU_scatau)) SU_scatau(:,:) = 0. - if( associated(SU_angstr)) SU_angstr(:,:) = 0. - - if( associated(SU_stratexttau)) SU_stratexttau(:,:) = 0. - if( associated(SU_stratscatau)) SU_stratscatau(:,:) = 0. - - if( associated(SS_exttau)) SS_exttau(:,:) = 0. - if( associated(SS_scatau)) SS_scatau(:,:) = 0. - if( associated(SS_angstr)) SS_angstr(:,:) = 0. - - if( associated(BC_exttau)) BC_exttau(:,:) = 0. - if( associated(BC_scatau)) BC_scatau(:,:) = 0. - if( associated(BC_angstr)) BC_angstr(:,:) = 0. - - if( associated(SM_exttau)) SM_exttau(:,:) = 0. - if( associated(SM_scatau)) SM_scatau(:,:) = 0. - if( associated(SM_angstr)) SM_angstr(:,:) = 0. - - if( associated(ASH_exttau)) ASH_exttau(:,:) = 0. - if( associated(ASH_scatau)) ASH_scatau(:,:) = 0. - if( associated(ASH_angstr)) ASH_angstr(:,:) = 0. - - if( associated(DU_extcoef)) DU_extcoef(:,:,:) = 0. - if( associated(DU_scacoef)) DU_scacoef(:,:,:) = 0. - if( associated(SS_extcoef)) SS_extcoef(:,:,:) = 0. - if( associated(SS_scacoef)) SS_scacoef(:,:,:) = 0. - if( associated(SU_extcoef)) SU_extcoef(:,:,:) = 0. - if( associated(SU_scacoef)) SU_scacoef(:,:,:) = 0. - if( associated(BC_extcoef)) BC_extcoef(:,:,:) = 0. - if( associated(BC_scacoef)) BC_scacoef(:,:,:) = 0. - if( associated(SM_extcoef)) SM_extcoef(:,:,:) = 0. - if( associated(SM_scacoef)) SM_scacoef(:,:,:) = 0. - if( associated(ASH_extcoef)) ASH_extcoef(:,:,:) = 0. - if( associated(ASH_scacoef)) ASH_scacoef(:,:,:) = 0. - -! Dust -! ---- - if( associated(DU_exttau) .or. associated(DU_scatau) .or. & - associated(DU_extcoef) .or. associated(DU_scacoef) .or. & - associated(DU_angstr) ) then - - if(do_angstrom)tau470(i1:i2,j1:j2) = tiny(1.0) - if(do_angstrom)tau870(i1:i2,j1:j2) = tiny(1.0) - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - if( groupname == 'DUST' .or. & - ( groupname == 'MIXEDP' .AND. elemname == 'DUST' )) then - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - - qname = trim(reg%vname(n)) - idx = Chem_MieQueryIdx(mie,'CARMA::'//qname,rc) - if(idx .eq. -1) cycle - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - delp = ple(i,j,k)-ple(i,j,k-1) - - call Chem_MieQuery(mie, idx, ilam550, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau, ssa=ssa) - if (associated(DU_exttau)) DU_exttau(i,j) = DU_exttau(i,j) + tau - if (associated(DU_scatau)) DU_scatau(i,j) = DU_scatau(i,j) + ssa*tau - - if( associated(DU_extcoef) ) then - DU_extcoef(i,j,k) = DU_extcoef(i,j,k) + & - tau * (grav_mks * rhoa(i,j,k) / delp) - endif - if( associated(DU_scacoef) ) then - DU_scacoef(i,j,k) = DU_scacoef(i,j,k) + & - ssa * tau * (grav_mks * rhoa(i,j,k) / delp) - endif - - if (associated(DU_angstr) .and. do_angstrom) then - call Chem_MieQuery(mie, idx, ilam470, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau470(i,j) = tau470(i,j) + tau - tottau470(i,j) = tottau470(i,j) + tau - call Chem_MieQuery(mie, idx, ilam870, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau870(i,j) = tau870(i,j) + tau - tottau870(i,j) = tottau870(i,j) + tau - endif - - enddo - enddo - enddo - - end do - endif - end do - endif - - if (associated(DU_angstr) .and. do_angstrom) then - DU_angstr(i1:i2,j1:j2) = & - -log(tau470(i1:i2,j1:j2)/tau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - -! Sulfate -! ------- - if( associated(SU_exttau) .or. associated(SU_scatau) .or. & - associated(SU_extcoef) .or. associated(SU_scacoef) .or. & - associated(SU_angstr) .or. associated(SU_stratexttau) .or. & - associated(SU_stratscatau) ) then - - if(do_angstrom)tau470(i1:i2,j1:j2) = tiny(1.0) - if(do_angstrom)tau870(i1:i2,j1:j2) = tiny(1.0) - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - if( groupname == 'SULFATE' .or. & - ( groupname == 'MIXEDP' .AND. elemname == 'SULFATE' )) then - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - - qname = trim(reg%vname(n)) - idx = Chem_MieQueryIdx(mie,'CARMA::'//qname,rc) - if(idx .eq. -1) cycle - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - delp = ple(i,j,k)-ple(i,j,k-1) - - call Chem_MieQuery(mie, idx, ilam550, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau, ssa=ssa) - if (associated(SU_exttau)) SU_exttau(i,j) = SU_exttau(i,j) + tau - if (associated(SU_scatau)) SU_scatau(i,j) = SU_scatau(i,j) + ssa*tau - - if( associated(SU_extcoef) ) then - SU_extcoef(i,j,k) = SU_extcoef(i,j,k) + & - tau * (grav_mks * rhoa(i,j,k) / delp) - endif - if( associated(SU_scacoef) ) then - SU_scacoef(i,j,k) = SU_scacoef(i,j,k) + & - ssa * tau * (grav_mks * rhoa(i,j,k) / delp) - endif - - if( ple(i,j,k) < tropp(i,j) ) then - if( associated(SU_stratexttau) ) then - SU_stratexttau(i,j) = SU_stratexttau(i,j) + tau - endif - if( associated(SU_stratscatau) ) then - SU_stratscatau(i,j) = SU_stratscatau(i,j) + tau*ssa - endif - endif - - if (associated(SU_angstr) .and. do_angstrom) then - call Chem_MieQuery(mie, idx, ilam470, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau470(i,j) = tau470(i,j) + tau - tottau470(i,j) = tottau470(i,j) + tau - call Chem_MieQuery(mie, idx, ilam870, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau870(i,j) = tau870(i,j) + tau - tottau870(i,j) = tottau870(i,j) + tau - endif - - enddo - enddo - enddo - - end do - endif - end do - endif - - if (associated(SU_angstr) .and. do_angstrom) then - SU_angstr(i1:i2,j1:j2) = & - -log(tau470(i1:i2,j1:j2)/tau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - -! Seasalt -! ------- - if( associated(SS_exttau) .or. associated(SS_scatau) .or. & - associated(SS_extcoef) .or. associated(SS_scacoef) .or. & - associated(SS_angstr) ) then - - if(do_angstrom)tau470(i1:i2,j1:j2) = tiny(1.0) - if(do_angstrom)tau870(i1:i2,j1:j2) = tiny(1.0) - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - if( groupname == 'SEASALT' .or. & - ( groupname == 'MIXEDP' .AND. elemname == 'SEASALT' )) then - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - - qname = trim(reg%vname(n)) - idx = Chem_MieQueryIdx(mie,'CARMA::'//qname,rc) - if(idx .eq. -1) cycle - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - delp = ple(i,j,k)-ple(i,j,k-1) - - call Chem_MieQuery(mie, idx, ilam550, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau, ssa=ssa) - if (associated(SS_exttau)) SS_exttau(i,j) = SS_exttau(i,j) + tau - if (associated(SS_scatau)) SS_scatau(i,j) = SS_scatau(i,j) + ssa*tau - - if( associated(SS_extcoef) ) then - SS_extcoef(i,j,k) = SS_extcoef(i,j,k) + & - tau * (grav_mks * rhoa(i,j,k) / delp) - endif - if( associated(SS_scacoef) ) then - SS_scacoef(i,j,k) = SS_scacoef(i,j,k) + & - ssa * tau * (grav_mks * rhoa(i,j,k) / delp) - endif - - if (associated(SS_angstr) .and. do_angstrom) then - call Chem_MieQuery(mie, idx, ilam470, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau470(i,j) = tau470(i,j) + tau - tottau470(i,j) = tottau470(i,j) + tau - call Chem_MieQuery(mie, idx, ilam870, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau870(i,j) = tau870(i,j) + tau - tottau870(i,j) = tottau870(i,j) + tau - endif - - enddo - enddo - enddo - - end do - endif - end do - endif - - if (associated(SS_angstr) .and. do_angstrom) then - SS_angstr(i1:i2,j1:j2) = & - -log(tau470(i1:i2,j1:j2)/tau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - - -! Black Carbon -! ------------ - if( associated(BC_exttau) .or. associated(BC_scatau) .or. & - associated(BC_extcoef) .or. associated(BC_scacoef) .or. & - associated(BC_angstr) ) then - - if(do_angstrom)tau470(i1:i2,j1:j2) = tiny(1.0) - if(do_angstrom)tau870(i1:i2,j1:j2) = tiny(1.0) - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - if( groupname == 'BLACKCARBON' .or. & - ( groupname == 'MIXEDP' .AND. elemname == 'BLACKCARBON' )) then - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - - qname = trim(reg%vname(n)) - idx = Chem_MieQueryIdx(mie,'CARMA::'//qname,rc) - if(idx .eq. -1) cycle - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - delp = ple(i,j,k)-ple(i,j,k-1) - - call Chem_MieQuery(mie, idx, ilam550, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau, ssa=ssa) - if (associated(BC_exttau)) BC_exttau(i,j) = BC_exttau(i,j) + tau - if (associated(BC_scatau)) BC_scatau(i,j) = BC_scatau(i,j) + ssa*tau - - if( associated(BC_extcoef) ) then - BC_extcoef(i,j,k) = BC_extcoef(i,j,k) + & - tau * (grav_mks * rhoa(i,j,k) / delp) - endif - if( associated(BC_scacoef) ) then - BC_scacoef(i,j,k) = BC_scacoef(i,j,k) + & - ssa * tau * (grav_mks * rhoa(i,j,k) / delp) - endif - - if (associated(BC_angstr) .and. do_angstrom) then - call Chem_MieQuery(mie, idx, ilam470, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau470(i,j) = tau470(i,j) + tau - tottau470(i,j) = tottau470(i,j) + tau - call Chem_MieQuery(mie, idx, ilam870, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau870(i,j) = tau870(i,j) + tau - tottau870(i,j) = tottau870(i,j) + tau - endif - - enddo - enddo - enddo - - end do - endif - end do - endif - - if (associated(BC_angstr) .and. do_angstrom) then - BC_angstr(i1:i2,j1:j2) = & - -log(tau470(i1:i2,j1:j2)/tau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - - -! Smoke -! ----- - if( associated(SM_exttau) .or. associated(SM_scatau) .or. & - associated(SM_extcoef) .or. associated(SM_scacoef) .or. & - associated(SM_angstr) ) then - - if(do_angstrom)tau470(i1:i2,j1:j2) = tiny(1.0) - if(do_angstrom)tau870(i1:i2,j1:j2) = tiny(1.0) - - do ielem = 1, reg%NELEM - - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - if( groupname == 'SMOKE' .or. & - ( groupname == 'MIXEDP' .AND. elemname == 'SMOKE' )) then - - do ibin = 1, reg%NBIN - n = n1 + (ielem-1)*reg%NBIN + ibin - 1 - - qname = trim(reg%vname(n)) - idx = Chem_MieQueryIdx(mie,'CARMA::'//qname,rc) - if(idx .eq. -1) cycle - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - delp = ple(i,j,k)-ple(i,j,k-1) - - call Chem_MieQuery(mie, idx, ilam550, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau, ssa=ssa) - if (associated(SM_exttau)) SM_exttau(i,j) = SM_exttau(i,j) + tau - if (associated(SM_scatau)) SM_scatau(i,j) = SM_scatau(i,j) + ssa*tau - - if( associated(SM_extcoef) ) then - SM_extcoef(i,j,k) = SM_extcoef(i,j,k) + & - tau * (grav_mks * rhoa(i,j,k) / delp) - endif - if( associated(SM_scacoef) ) then - SM_scacoef(i,j,k) = SM_scacoef(i,j,k) + & - ssa * tau * (grav_mks * rhoa(i,j,k) / delp) - endif - - if (associated(SM_angstr) .and. do_angstrom) then - call Chem_MieQuery(mie, idx, ilam470, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau470(i,j) = tau470(i,j) + tau - tottau470(i,j) = tottau470(i,j) + tau - call Chem_MieQuery(mie, idx, ilam870, & - qa(n)%data3d(i,j,k)*delp/grav_mks, & - rh(i,j,k), tau=tau) - tau870(i,j) = tau870(i,j) + tau - tottau870(i,j) = tottau870(i,j) + tau - endif - - enddo - enddo - enddo - - end do - endif - end do - endif - - if (associated(SM_angstr) .and. do_angstrom) then - SM_angstr(i1:i2,j1:j2) = & - -log(tau470(i1:i2,j1:j2)/tau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - -! Totals -! ------ - if ( associated(totexttau)) then - if ( associated(DU_exttau)) totexttau = totexttau + DU_exttau - if ( associated(SU_exttau)) totexttau = totexttau + SU_exttau - if ( associated(SS_exttau)) totexttau = totexttau + SS_exttau - if ( associated(BC_exttau)) totexttau = totexttau + BC_exttau - if ( associated(SM_exttau)) totexttau = totexttau + SM_exttau - endif - if ( associated(totscatau)) then - if ( associated(DU_scatau)) totscatau = totscatau + DU_scatau - if ( associated(SU_scatau)) totscatau = totscatau + SU_scatau - if ( associated(SS_scatau)) totscatau = totscatau + SS_scatau - if ( associated(BC_scatau)) totscatau = totscatau + BC_scatau - if ( associated(SM_scatau)) totscatau = totscatau + SM_scatau - endif - if (associated(totangstr) .and. do_angstrom) then - totangstr(i1:i2,j1:j2) = & - -log(tottau470(i1:i2,j1:j2)/tottau870(i1:i2,j1:j2)) / & - log(470./870.) - endif - - if(do_angstrom) then - deallocate(tau470, tottau470, tau870, tottau870, stat=STATUS) - VERIFY_(STATUS) - endif - - - RETURN - - end subroutine CARMA_ComputeDiags - - - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_GetMieTables -- Get GEOS-5 GOCART-style Mie Look Up Tables -! -! !INTERFACE: -! - - SUBROUTINE CARMA_GetMieTables ( gcCARMA, rc ) - - IMPLICIT none - -! !INPUT/OUTPUT PARAMETERS: - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: From CARMA registry create appropriate GEOS-5 style -! Mie lookup tables -! -! !REVISION HISTORY: -! -! 10Jun2011 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - -! Locals - type(CARMA_Registry), pointer :: reg => null() - type(Chem_Mie), pointer :: mie => null() - integer :: iq, iq0, STATUS, ielem, igroup, ibin, n, n1 - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_GetMieTables' - character(len=255) :: groupname, elemname - - rc = 0 - - reg => gcCARMA%CARMAreg - allocate( gcCARMA%CARMAmie, stat=STATUS) - VERIFY_(STATUS) - mie => gcCARMA%CARMAmie - - mie%nq = reg%nq - allocate(mie%vname( mie%nq) ) - allocate(mie%vindex(mie%nq) ) - allocate(mie%vtable(mie%nq) ) - do iq = 1, mie%nq - mie%vindex(iq) = -1 - mie%vname(iq) = trim(reg%vname(iq)) - enddo - - mie%rcfile = reg%rcfilen - - mie%nch = reg%nchannels - mie%nmom = reg%nmoments - allocate( mie%channels(mie%nch), stat=STATUS) - VERIFY_(STATUS) - mie%channels = reg%channels - - mie%du_optics_file = reg%du_optics_file - mie%ss_optics_file = reg%ss_optics_file - mie%bc_optics_file = reg%bc_optics_file - mie%oc_optics_file = reg%sm_optics_file ! Note I am using OC table hook for smoke - mie%su_optics_file = reg%su_optics_file - -! Allocate and fill Mie tables - allocate( mie%mie_DU, mie%mie_SS, mie%mie_BC, mie%mie_OC, mie%mie_SU, __STAT__) - - mie%mie_DU = Chem_MieTableCreate(mie%du_optics_file, rc) - if ( rc /= 0 ) return - mie%mie_SS = Chem_MieTableCreate(mie%ss_optics_file, rc) - if ( rc /= 0 ) return - mie%mie_BC = Chem_MieTableCreate(mie%bc_optics_file, rc) - if ( rc /= 0 ) return - mie%mie_OC = Chem_MieTableCreate(mie%oc_optics_file, rc) - if ( rc /= 0 ) return - mie%mie_SU = Chem_MieTableCreate(mie%su_optics_file, rc) - if ( rc /= 0 ) return - - call Chem_MieTableRead(mie%mie_DU,mie%nch,mie%channels,rc,nmom=mie%nmom) - if ( rc /= 0 ) return - call Chem_MieTableRead(mie%mie_SS,mie%nch,mie%channels,rc,nmom=mie%nmom) - if ( rc /= 0 ) return - call Chem_MieTableRead(mie%mie_BC,mie%nch,mie%channels,rc,nmom=mie%nmom) - if ( rc /= 0 ) return - call Chem_MieTableRead(mie%mie_OC,mie%nch,mie%channels,rc,nmom=mie%nmom) - if ( rc /= 0 ) return - call Chem_MieTableRead(mie%mie_SU,mie%nch,mie%channels,rc,nmom=mie%nmom) - if ( rc /= 0 ) return - -! Map the mie tables to the particular tracers - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - groupname = ESMF_UtilStringUpperCase(trim(reg%groupname(igroup))) - elemname = ESMF_UtilStringUpperCase(trim(reg%elemname(ielem))) - do ibin = 1, reg%NBIN - iq = (ielem-1)*reg%NBIN + ibin - if( groupname == 'DUST' .OR. groupname == 'ASH' .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'DUST' ) .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'ASH' ) ) then - mie%vindex(iq) = ibin - mie%vtable(iq) = mie%mie_DU - endif - if( groupname == 'SEASALT' .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'SEASALT' ) ) then - mie%vindex(iq) = ibin - mie%vtable(iq) = mie%mie_SS - endif - if( groupname == 'BLACKCARBON' .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'BLACKCARBON' ) ) then - mie%vindex(iq) = ibin - mie%vtable(iq) = mie%mie_BC - endif - if( groupname == 'SMOKE' .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'SMOKE' ) ) then - mie%vindex(iq) = ibin - mie%vtable(iq) = mie%mie_OC - endif - if( groupname == 'SULFATE' .OR. & - ( groupname == 'MIXEDP' .AND. elemname == 'SULFATE' ) ) then - mie%vindex(iq) = ibin - mie%vtable(iq) = mie%mie_SU - endif - end do - end do - - RETURN - - end subroutine CARMA_GetMieTables - - - -!------------------------------------------------------------------------- -!NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1, GEOS/DAS! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CARMA_DestroyMieTables -- Destroy GEOS-5 GOCART-style Mie Look Up Tables -! -! !INTERFACE: -! - - SUBROUTINE CARMA_DestroyMieTables ( gcCARMA, rc ) - - IMPLICIT none - -! !INPUT/OUTPUT PARAMETERS: - TYPE(CARMA_GridComp), INTENT(INOUT) :: gcCARMA ! Grid Component - INTEGER, INTENT(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Clean up Mie tables -! -! !REVISION HISTORY: -! -! 10Jun2011 Colarco First crack. -! -!EOP -!------------------------------------------------------------------------- - -! Locals - type(Chem_Mie), pointer :: mie => null() - integer :: STATUS - CHARACTER(LEN=*), PARAMETER :: IAm = 'CARMA_DestroyMieTables' - - rc = 0 - - mie => gcCARMA%CARMAmie - - call Chem_MieTableDestroy(mie%mie_DU, __RC__) - call Chem_MieTableDestroy(mie%mie_SS, __RC__) - call Chem_MieTableDestroy(mie%mie_BC, __RC__) - call Chem_MieTableDestroy(mie%mie_OC, __RC__) - call Chem_MieTableDestroy(mie%mie_SU, __RC__) - - deallocate(mie%mie_DU, mie%mie_SS, mie%mie_BC, mie%mie_OC, mie%mie_SU, __STAT__) - deallocate(mie%vname, mie%vindex, mie%vtable, mie%channels, __STAT__) - deallocate(mie, __STAT__) - - RETURN - - end subroutine CARMA_DestroyMieTables - - subroutine distribute_point_emissions(delp, rhoa, z_bot, z_top, emissions_point, & - emissions, km) - - implicit none - - integer, intent(in) :: km - - real, dimension(:), intent(in) :: delp - real, dimension(:), intent(in) :: rhoa - real, intent(in) :: emissions_point - real, intent(in) :: z_bot - real, intent(in) :: z_top - real, dimension(:), intent(out):: emissions - -! local - integer :: k - integer :: k_bot, k_top - real :: z_ - real, dimension(km) :: z, dz, w_ - real, parameter :: grav_mks = grav/100. - -! find level height - z = 0.0 - z_= 0.0 - - do k = km, 1, -1 - dz(k) = delp(k)/rhoa(k)/grav_mks - z_ = z_ + dz(k) - z(k) = z_ - end do - -! find the bottom level - do k = km, 1, -1 - if (z(k) >= z_bot) then - k_bot = k - exit - end if - end do - -! find the top level - do k = k_bot, 1, -1 - if (z(k) >= z_top) then - k_top = k - exit - end if - end do - -! find the weights - w_ = 0 - -! if (k_top > k_bot) then -! need to bail - something went wrong here -! end if - - if (k_bot .eq. k_top) then - w_(k_bot) = z_top - z_bot - else - do k = k_bot, k_top, -1 - if ((k < k_bot) .and. (k > k_top)) then - w_(k) = dz(k) - else - if (k == k_bot) then - w_(k) = (z(k) - z_bot) - end if - - if (k == k_top) then - w_(k) = z_top - (z(k)-dz(k)) - end if - end if - end do - end if - -! distribute emissions in the vertical - emissions(:) = (w_ / sum(w_)) * emissions_point - - end subroutine distribute_point_emissions - - - END MODULE CARMA_UtilMod - diff --git a/CARMAchem_GridComp/CARMAchem_GridCompMod.F90 b/CARMAchem_GridComp/CARMAchem_GridCompMod.F90 deleted file mode 100644 index b039dea5..00000000 --- a/CARMAchem_GridComp/CARMAchem_GridCompMod.F90 +++ /dev/null @@ -1,1936 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: CARMAchem_GridCompMod - The Community Aerosol and Radiation Model -! for Atmospheres -! -! !INTERFACE: -! - MODULE CARMAchem_GridCompMod -! -! !USES: -! - USE ESMF - USE MAPL - USE Chem_Mod ! Chemistry Base Class - - USE CARMA_GridCompMod ! ESMF parent component - USE CARMA_UtilMod - USE Chem_UtilMod - USE m_inpak90 ! Resource file management - use m_die, only: die - -! CARMA Specific Methods - use carma_precision_mod - use carma_constants_mod - use carma_enums_mod - use carma_types_mod - use carmaelement_mod - use carmagroup_mod - use carmastate_mod - use carma_mod - - IMPLICIT NONE - PRIVATE - - type(Chem_Mie), dimension(2), save :: carmaMieTable - integer, parameter :: instanceComputational = 1 - integer, parameter :: instanceData = 2 - -! -! !PUBLIC MEMBER FUNCTIONS: - - PUBLIC SetServices -! -! !DESCRIPTION: -! -! {\tt CARMAchem_GridComp} is an ESMF gridded component for the Community -! Aerosol and Radiation Model for Atmospheres aerosol and cloud -! microphysics packages. -! -! Developed for GEOS-5 release Eros-beta7p6 and later. -! -! !REVISION HISTORY: -! -! 31Jul2006 da Silva Created the GMI stub. -! 11Dec2007 Nielsen Real code for Eros-beta7p17. -! 18May2009 Colarco Developed based on GMIchem_GridComp.F90 -! -!EOP -!------------------------------------------------------------------------- - - TYPE CARMAchem_State - PRIVATE - TYPE(Chem_Registry), POINTER :: chemReg => null() - TYPE(CARMA_GridComp), POINTER :: gcCARMA => null() - TYPE(CARMA_Registry), POINTER :: CARMAReg => null() - TYPE(Chem_Array), POINTER :: qa(:) => null() - END TYPE CARMAchem_State - - TYPE CARMAchem_WRAP - TYPE (CARMAchem_State), pointer :: PTR => null() - END TYPE CARMAchem_WRAP - -CONTAINS - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices --- Sets IRF services for CARMA Grid Component -! -! !INTERFACE: - - SUBROUTINE SetServices ( GC, RC ) - -! !ARGUMENTS: - - type(ESMF_GridComp) :: GC ! gridded component - integer, intent(OUT) :: RC ! return code - -! !DESCRIPTION: Sets Initialize, Run and Finalize services. -! -! !REVISION HISTORY: -! -! 31Jul2006 da Silva First crack. -! 18May2009 Colarco Adapted for CARMA -! -!EOP -!------------------------------------------------------------------------- - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm = 'SetServices' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - -! Local derived type aliases -! -------------------------- - type (ESMF_Config) :: CF - type (CARMAchem_State), pointer :: state ! internal, that is - type (CARMAchem_wrap) :: wrap - type(CARMA_Registry), pointer :: r - - integer :: n, i_XX, j_XX, i, j, iq - character(len=ESMF_MAXSTR) :: binstr - -! ------------ - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = TRIM(COMP_NAME) // '::' // TRIM(Iam) - -! Wrap internal state for storing in GC; rename legacyState -! ------------------------------------- - allocate ( state, stat=STATUS ) - VERIFY_(STATUS) - wrap%ptr => state - -! Start by loading the CARMA Registry -! ----------------------------------- - allocate ( state%CARMAReg ) - call registry_ ( state%CARMAReg ) - VERIFY_(STATUS) - call registry_print_ ( state%CARMAReg ) - -! Start by loading the Chem Registry -! ---------------------------------- - allocate ( state%chemReg ) - state%chemReg = Chem_RegistryCreate ( STATUS ) - VERIFY_(STATUS) - - - r => state%CARMAReg ! short hand - -! ------------------------ -! ESMF Functional Services -! ------------------------ - -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - if ( r%doing_CARMA ) then - - if (MAPL_AM_I_ROOT()) print *, trim(Iam)//': ACTIVE' - - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize_, & - RC=STATUS) - VERIFY_(STATUS) - - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run_, & - RC=STATUS) - VERIFY_(STATUS) - - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize_, & - RC=STATUS) - VERIFY_(STATUS) - -! Store internal state in GC -! -------------------------- - call ESMF_UserCompSetInternalState ( GC, 'CARMA_state', wrap, STATUS ) - VERIFY_(STATUS) - - else - - if (MAPL_AM_I_ROOT()) & - print *, trim(Iam)//': NOT ACTIVE, defaulting to Generic No-op stubs' - - endif - -! ------------------ -! GEOS Data Services -! ------------------ -! -! !IMPORT STATE: -#include "CARMA_ImportSpec___.h" - -! !INTERNAL STATE: - -! -! NOTES: -! 1) vtitle as it stands is as the CF definition of long name. -! I may need to create a "standard name" in chemReg and pass -! this to GEOS Generic -! 2) Host model MUST provide convective transport as well -! -! Convention for tracer names is CARMA::groupname::elemname::XXX -! where XXX is the bin number. -! Will need to add space for the NGAS array -! - if ( r%doing_CARMA ) then - -! Add particle tracers - do j = 1, r%NELEM - do i = 1, r%NBIN - write(binstr,'(i3)') i - binstr = adjustl(binstr) - if(i .lt. 10) binstr = '0'//binstr - if(i .lt. 100) binstr = '0'//binstr - - iq = i + (j-1)*r%NBIN - r%vname(iq) = trim(r%groupname(r%igroup(j)))// '::' & - // trim(r%elemname(j))// '::' & - // trim(binstr) - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%groupname(r%igroup(j)))// '::' & - // trim(r%elemname(j))// '::' & - // trim(binstr), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%groupname(r%igroup(j)))// '::' & - // trim(r%elemname(j))// '::' & - // trim(binstr), & - UNITS = 'kg/kg', & ! placeholder - FRIENDLYTO = 'DYNAMICS:TURBULENCE', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - end do - end do - -! Add gas tracers - do j = 1, r%NGAS - - iq = j + r%NBIN*r%NELEM - r%vname(iq) = trim(r%gasname(j)) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%gasname(j)), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%gasname(j)), & - UNITS = 'kg/kg', & ! placeholder - FRIENDLYTO = 'DYNAMICS:TURBULENCE', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - end do - -! Non-advected tracers -! Add the old temperature - iq = r%NBIN*r%NELEM + r%NGAS + 1 - r%vname(iq) = 't_old' - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - UNITS = 'K', & ! placeholder - ADD2EXPORT = .TRUE., & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - -! Add the prior time step gas tracers - if(r%NGAS > 0) then - do j = 1, r%NGAS - - iq = j + r%NBIN*r%NELEM + r%NGAS + 1 - r%vname(iq) = trim(r%gasname(j))//'_old' - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - UNITS = 'kg/kg', & ! placeholder - ADD2EXPORT = .TRUE., & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - end do - -! Add the prior time step saturation wrt liquid - do j = 1, r%NGAS - - iq = j + r%NBIN*r%NELEM + r%NGAS + r%NGAS + 1 - r%vname(iq) = 'satliq_'//trim(r%gasname(j))//'_old' - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - UNITS = '1', & ! placeholder - ADD2EXPORT = .TRUE., & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - end do - -! Add the prior time step saturation wrt ice - do j = 1, r%NGAS - - iq = j + r%NBIN*r%NELEM + r%NGAS + r%NGAS + r%NGAS + 1 - r%vname(iq) = 'satice_'//trim(r%gasname(j))//'_old' - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - LONG_NAME = trim(COMP_NAME)// '::' & - // trim(r%vname(iq)), & - UNITS = '1', & ! placeholder - ADD2EXPORT = .TRUE., & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=STATUS ) - VERIFY_(STATUS) - - end do - endif ! NGAS > 0 - - endif - -! !EXPORT STATE: -! This bundle is needed by radiation - It will contain the -! basically the same as the internal state for aerosols -! and aerosol optics -! -------------------------------------------------------- - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'AERO', & - LONG_NAME = 'aerosol_mass_mixing_ratios', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_StateItem, & - RC=STATUS ) - VERIFY_(STATUS) - -! This state is needed by MOIST - It will contain aerosols -! This bundle is not currently filled in by CARMA, just a -! place holder for symmetry with GOCART -! -------------------------------------------------------- - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'AERO_ACI', & - LONG_NAME = 'aerosol_cloud_interaction', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_StateItem, __RC__) - -! This bundle is needed by surface for snow albedo -! modification by aerosol settling and deposition -! This bundle is not currently filled in by CARMA, just a -! place holder for symmetry with GOCART -! -------------------------------------------------------- - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'AERO_DP', & - LONG_NAME = 'aerosol_deposition', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - DATATYPE = MAPL_BundleItem, & - RC=STATUS ) - VERIFY_(STATUS) - -! -#include "CARMA_ExportSpec___.h" - - -! Set the profiling timers -! ------------------------ - CALL MAPL_TimerAdd(GC, NAME="INITIALIZE", RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_TimerAdd(GC, NAME="RUN", RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_TimerAdd(GC, NAME="FINALIZE", RC=STATUS) - VERIFY_(STATUS) - -! Generic Set Services -! -------------------- - call MAPL_GenericSetServices ( GC, RC=STATUS ) - VERIFY_(STATUS) - -! All done -! -------- - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE SetServices - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize CARMA -! -! !INTERFACE: -! - - SUBROUTINE Initialize_ ( gc, import, export, clock, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: gc ! Grid Component - type(ESMF_State), intent(inout) :: import ! Import State - type(ESMF_State), intent(inout) :: export ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 27Feb2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm = 'Initialize_' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - - type(CARMA_GridComp), pointer :: gcCARMA ! Grid Component - integer :: nymd, nhms ! time of day - real :: cdt ! chemistry timestep (secs) - - type(ESMF_Grid) :: grid - type(ESMF_Config) :: CF, carmaCF - - integer :: i1=1, i2, ig=0, im ! dist grid indices - integer :: j1=1, j2, jg=0, jm ! dist grid indices - integer :: km, nq ! dist grid indices - integer :: n, dims(3), l - - type(Chem_Array), pointer :: qa(:) ! array of pointers - type(MAPL_MetaComp), pointer :: ggState ! GEOS Generic State - type(ESMF_State) :: internal - type(ESMF_Field) :: field - type(ESMF_Field) :: fld - type(ESMF_FieldBundle) :: bundle - type(ESMF_State) :: aero - type(ESMF_FieldBundle) :: aero_state_aerosols - character(len=ESMF_MAXSTR) :: fld_name - integer :: n_aerosols - type(MAPL_VarSpec), pointer :: InternalSpec(:) - integer :: instance - - character(len=ESMF_MAXSTR) :: short_name - type(CARMA_Registry), pointer :: reg => null() - type(Chem_Registry), pointer :: mieReg => null() ! pointer to registry for CARMA aero_provider - integer :: nCARMAbegin, nCARMAend, ibin, ielem, igroup, igas - real :: fscav - - integer :: i, j, k, iq, istart, iend - real, parameter :: rad2deg = 180. / MAPL_PI - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -# include "CARMA_DeclarePointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, CONFIG=CF, __RC__ ) - - Iam = trim(COMP_NAME) // '::Initialize_' - - if (MAPL_AM_I_ROOT()) then - PRINT *, TRIM(Iam)//': Starting...' - PRINT *,' ' - end if - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC ( GC, ggState, __RC__) - - call MAPL_TimerOn(ggState, 'TOTAL') - call MAPL_TimerOn(ggState, 'INITIALIZE') - -! Initialize GEOS Generic -! ------------------------ - call MAPL_GenericInitialize ( gc, import, export, clock, __RC__ ) - -! Get parameters from gc and clock -! -------------------------------- - call extract_ ( gc, clock, gcCARMA, qa, nymd, nhms, cdt, STATUS ) - VERIFY_(STATUS) - -! Get the grid -! ------------ - call ESMF_GridCompGet ( GC, grid=grid, __RC__ ) - - call MAPL_GridGet ( grid, globalCellCountPerDim=DIMS, __RC__ ) - - gcCARMA%im = dims(1) - gcCARMA%jm = dims(2) - - call ESMF_GridGet(GRID, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - computationalCount=DIMS, __RC__ ) - - gcCARMA%grid = grid - reg => gcCARMA%carmaReg - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -# include "CARMA_GetPointer___.h" - -! Associate the Internal State fields with our legacy state -! --------------------------------------------------------- - call MAPL_Get ( ggSTATE, INTERNALSPEC=InternalSpec, & - INTERNAL_ESMF_STATE=internal, & - LONS=gcCARMA%LONS, & - LATS=gcCARMA%LATS, __RC__ ) - -! Convert radians to degrees - gcCARMA%lons = gcCARMA%lons * rad2deg - gcCARMA%lats = gcCARMA%lats * rad2deg - -! Local sizes of three dimensions -!-------------------------------- - gcCARMA%i2 = dims(1) - gcCARMA%j2 = dims(2) - gcCARMA%km = dims(3) - -! Initialize the tracer array -! --------------------------- - _ASSERT( size(InternalSpec) == reg%nq, 'needs informative message' ) - - do L = 1, size(InternalSpec) - - call MAPL_VarSpecGet(InternalSpec(L), SHORT_NAME=short_name, __RC__) - - call MAPL_GetPointer(internal,NAME=short_name,ptr=qa(L)%data3d, __RC__ ) - - end do - -! Bootstrapping option -! -------------------- -! For sub-stepping of gases we need to provide the prior time-step -! temperature, gas mmr, and saturation ratios for liquid and ice. -! If these are not set from the carma_internal_rst we need to -! initialize. - -! Prior time-step temperature - iq = reg%NBIN*reg%NELEM + reg%NGAS + 1 - if(qa(iq)%data3d(gcCARMA%i2,gcCARMA%j2,gcCARMA%km) < 0.) qa(iq)%data3d = -1. - -! Prior time-step gases - istart = reg%NBIN*reg%NELEM + reg%NGAS + 1 + 1 - iend = istart + reg%NGAS - 1 - do iq = istart, iend - if(qa(iq)%data3d(gcCARMA%i2,gcCARMA%j2,gcCARMA%km) < 0.) qa(iq)%data3d = qa(iq-reg%NGAS-1)%data3d - enddo - -! Prior time-step saturation wrt liquid - istart = reg%NBIN*reg%NELEM + reg%NGAS + 1 + reg%NGAS + 1 - iend = istart + reg%NGAS - 1 - do iq = istart, iend - if(qa(iq)%data3d(gcCARMA%i2,gcCARMA%j2,gcCARMA%km) < 0.) qa(iq)%data3d = -1. - enddo - -! Prior time-step saturation wrt ice - istart = reg%NBIN*reg%NELEM + reg%NGAS + 1 + reg%NGAS + reg%NGAS + 1 - iend = istart + reg%NGAS - 1 - do iq = istart, iend - if(qa(iq)%data3d(gcCARMA%i2,gcCARMA%j2,gcCARMA%km) < 0.) qa(iq)%data3d = -1. - enddo - -! Call initialize -! --------------- - call CARMA_GridCompInitialize ( gcCARMA, import, export, nymd, nhms, cdt, & - STATUS ) - VERIFY_(STATUS) - -#ifdef PRINT_STATES - - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': INTERNAL State during Initialize():' - call ESMF_StatePrint ( internal ) - print *, trim(Iam)//': IMPORT State during Initialize():' - call ESMF_StatePrint ( import ) - print *, trim(Iam)//': EXPORT State during Initialize():' - call ESMF_StatePrint ( export ) - end if - -#endif - -! Get the chemistry coupling information from the configuration -! ------------------------------------------------------------- - call ESMF_ConfigGetAttribute(CF, reg%sulfuric_acid_source, & - Label="SULFURIC_ACID_SOURCE:" , DEFAULT='tendency', __RC__) - - -! Fill in the scavenging attribute -! -------------------------------- - nCARMABegin = 1 - nCARMAEnd = reg%nq - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - do ibin = 1, reg%NBIN - n = nCARMAbegin + (ielem-1)*reg%NBIN + ibin - 1 - - call MAPL_VarSpecGet(InternalSpec(n), SHORT_NAME=short_name, __RC__ ) - call ESMF_StateGet(internal, short_name, field, __RC__ ) - fscav = reg%fscav(igroup) - call ESMF_AttributeSet(field,NAME="ScavengingFractionPerKm",VALUE=fscav, __RC__ ) - - end do - end do - -! Get the Mie tables (GEOS-5 like Mie tables) -! ------------------------------------------- - call CARMA_GetMieTables(gcCARMA, rc) - if(rc /= 0) then - if(MAPL_AM_I_ROOT()) print *, 'CARMA: Failed reading Mie tables' - RETURN_(ESMF_FAILURE) - endif - -! Fill the AERO bundle - For now we add all concentration elements -! -------------------- - call ESMF_StateGet(export, 'AERO', aero, __RC__ ) - - ! This attribute indicates if the aerosol optics method is implemented or not. - ! Radiation will not call the aerosol optics method unless this attribute is - ! explicitly set to true. - call ESMF_AttributeSet(aero, name='implements_aerosol_optics_method', value=.true., __RC__) - - aero_state_aerosols = ESMF_FieldBundleCreate(name='AEROSOLS', __RC__) - call MAPL_StateAdd(aero, aero_state_aerosols, __RC__) - - do ielem = 1, reg%NELEM - igroup = reg%igroup(ielem) - if(ielem /= gcCARMA%carma%f_group(igroup)%f_ienconc ) cycle - do ibin = 1, reg%NBIN - n = nCARMAbegin + (ielem-1)*reg%NBIN + ibin - 1 - call ESMF_StateGet ( INTERNAL, & - trim(COMP_NAME) // '::'// & - trim(reg%vname(n)), & - FIELD, __RC__ ) - fld = MAPL_FieldCreate(FIELD, name=reg%vname(n), __RC__) - call MAPL_FieldBundleAdd(aero_state_aerosols, fld, __RC__) - end do - end do - - call ESMF_FieldBundleGet(aero_state_aerosols, fieldCount=n_aerosols, __RC__) - - if (n_aerosols > 0) then - -! This is a placeholder code in case sometime I want CARMA to be "data_driven" -! if (myState%data_driven) then -! instance = instanceData -! else - instance = instanceComputational -! end if - - carmaCF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile(carmaCF,'CARMAchem_Registry.rc', __RC__) - allocate(mieReg, stat=STATUS) - VERIFY_(STATUS) - mieReg = Chem_RegistryCreate(rc,rcfile='CARMAchem_MieRegistry.rc') - if ( rc /= 0 ) call die('CARMA', 'Cannot read CARMAchem_MieRegistry.rc' ) - carmaMieTable(instance) = Chem_MieCreate(carmaCF, chemReg=mieReg, __RC__) - deallocate(mieReg,stat=STATUS) - VERIFY_(STATUS) - call ESMF_ConfigDestroy(carmaCF, __RC__) - - ! Mie Table instance/index - call ESMF_AttributeSet(aero, name='mie_table_instance', value=instance, __RC__) - - ! state of the atmosphere - call ESMF_AttributeSet(aero, name='air_pressure_for_aerosol_optics', value='PLE', __RC__) - call ESMF_AttributeSet(aero, name='relative_humidity_for_aerosol_optics', value='RH', __RC__) - call ESMF_AttributeSet(aero, name='cloud_area_fraction_for_aerosol_optics', value='', __RC__) ! 'cloud_area_fraction_in_atmosphere_layer_for_aerosol_optics' - - ! aerosol optics - call ESMF_AttributeSet(aero, name='band_for_aerosol_optics', value=0, __RC__) - call ESMF_AttributeSet(aero, name='extinction_in_air_due_to_ambient_aerosol', value='EXT', __RC__) - call ESMF_AttributeSet(aero, name='single_scattering_albedo_of_ambient_aerosol', value='SSA', __RC__) - call ESMF_AttributeSet(aero, name='asymmetry_parameter_of_ambient_aerosol', value='ASY', __RC__) - - ! add PLE to aero state - call ESMF_AttributeGet(aero, name='air_pressure_for_aerosol_optics', value=fld_name, __RC__) - if (fld_name /= '') then - fld = MAPL_FieldCreateEmpty(trim(fld_name), gcCARMA%grid, __RC__) - - call MAPL_FieldAllocCommit(fld, dims=MAPL_DimsHorzVert, location=MAPL_VLocationEdge, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, fld, __RC__) - end if - - ! add RH to Aero state - call ESMF_AttributeGet(aero, name='relative_humidity_for_aerosol_optics', value=fld_name, __RC__) - if (fld_name /= '') then - fld = MAPL_FieldCreateEmpty(trim(fld_name), gcCARMA%grid, __RC__) - - call MAPL_FieldAllocCommit(fld, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, fld, __RC__) - end if - - ! add EXT to aero state - call ESMF_AttributeGet(aero, name='extinction_in_air_due_to_ambient_aerosol', value=fld_name, __RC__) - if (fld_name /= '') then - fld = MAPL_FieldCreateEmpty(trim(fld_name), gcCARMA%grid, __RC__) - - call MAPL_FieldAllocCommit(fld, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, fld, __RC__) - end if - - ! add SSA to aero state - call ESMF_AttributeGet(aero, name='single_scattering_albedo_of_ambient_aerosol', value=fld_name, __RC__) - if (fld_name /= '') then - fld = MAPL_FieldCreateEmpty(trim(fld_name), gcCARMA%grid, __RC__) - - call MAPL_FieldAllocCommit(fld, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, fld, __RC__) - end if - - ! add ASY to aero state - call ESMF_AttributeGet(aero, name='asymmetry_parameter_of_ambient_aerosol', value=fld_name, RC=STATUS) - if (fld_name /= '') then - fld = MAPL_FieldCreateEmpty(trim(fld_name), gcCARMA%grid, __RC__) - - call MAPL_FieldAllocCommit(fld, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, fld, __RC__) - end if - - ! attach the aerosol optics method - call ESMF_MethodAdd(aero, label='run_aerosol_optics', userRoutine=run_aerosol_optics, __RC__) - - end if - -#ifdef PRINT_STATES - - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': AERO Bundle during Initialize():' - call ESMF_FieldBundlePrint ( bundle ) - end if - -#endif - -! Stop timers -! ----------- - CALL MAPL_TimerOff(ggState, "INITIALIZE") - CALL MAPL_TimerOff(ggState, "TOTAL") - - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs CARMA -! -! !INTERFACE: -! - - SUBROUTINE Run_ ( gc, import, export, clock, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: gc ! Grid Component - type(ESMF_State), intent(inout) :: import ! Import State - type(ESMF_State), intent(inout) :: export ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 27Feb2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm = 'Run_' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - - type(CARMA_GridComp), pointer :: gcCARMA ! Grid Component - integer :: nymd, nhms ! time - real :: cdt ! chemistry timestep (secs) - type(Chem_Array), pointer :: qa(:) - integer :: i1=1, i2, ig=0, im ! dist grid indices - integer :: j1=1, j2, jg=0, jm ! dist grid indices - integer :: km, nq ! dist grid indices - integer :: k, n, dims(3), l, ijl, iq - real :: qmin, qmax - - type(ESMF_Config) :: CF - type(ESMF_Grid) :: grid - type(ESMF_Time) :: TIME - - type(ESMF_State) :: internal - type(MAPL_VarSpec), pointer :: InternalSpec(:) - type(MAPL_MetaComp), pointer :: ggState ! GEOS Generic State - - - real, pointer, dimension(:,:) :: LATS - real, pointer, dimension(:,:) :: LONS - type (MAPL_SunOrbit) :: ORBIT - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -# include "CARMA_DeclarePointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, __RC__) - Iam = trim(COMP_NAME) // '::Run_' - -! Get my internal MAPL_Generic state -! ----------------------------------- - CALL MAPL_GetObjectFromGC(GC, ggState, __RC__) - -! Start a comprehensive timer -! --------------------------- - CALL MAPL_TimerOn(ggState, "TOTAL") - CALL MAPL_TimerOn(ggState, "RUN") - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -# include "CARMA_GetPointer___.h" - -! Get parameters from gc and clock -! -------------------------------- - call extract_ ( gc, clock, gcCARMA, qa, nymd, nhms, cdt, STATUS ) - VERIFY_(STATUS) - -! Run -! --- - call CARMA_Emissions ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - call CARMA_GridCompRun ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - call CARMA_DryDeposition ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - call CARMA_WetRemoval ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - call CARMA_Convection ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - call CARMA_ComputeDiags ( gcCARMA, qa, import, export, nymd, nhms, & - cdt, STATUS ) - VERIFY_(STATUS) - - CALL MAPL_TimerOff(ggState, "RUN") - CALL MAPL_TimerOff(ggState, "TOTAL") - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE Run_ - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ --- Finalize CARMA -! -! !INTERFACE: -! - - SUBROUTINE Finalize_ ( gc, import, export, clock, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: gc ! Grid Component - type(Chem_Array), pointer :: qa(:) - type(ESMF_State), intent(inout) :: import ! Import State - type(ESMF_State), intent(inout) :: export ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 27Feb2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm = 'Finalize_' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - - type(CARMA_GridComp), pointer :: gcCARMA ! Grid Component - integer :: nymd, nhms ! time - real :: cdt ! chemistry timestep (secs) - - type(CARMAchem_state), pointer :: state - - type(MAPL_MetaComp), pointer :: ggState ! GEOS Generic State - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // 'Finalize_' - -! Get my internal MAPL_Generic state -! ----------------------------------- - CALL MAPL_GetObjectFromGC(GC, ggState, RC=STATUS) - -! Start timers -! ------------ - CALL MAPL_TimerOn(ggState, "TOTAL") - CALL MAPL_TimerOn(ggState, "FINALIZE") - -! Get ESMF parameters from gc and clock -! ------------------------------------- - call extract_ ( gc, clock, gcCARMA, qa, nymd, nhms, cdt, STATUS, & - state = state ) - VERIFY_(STATUS) - -! Call ESMF version -! ----------------- - call CARMA_GridCompFinalize ( gcCARMA, import, export, & - nymd, nhms, cdt, STATUS ) - VERIFY_(STATUS) - -! Destroy Mie Tables -! ------------------ - call CARMA_DestroyMieTables(gcCARMA, rc) - -! Destroy emissions -! ----------------- - if(associated(gcCARMA%vLat)) deallocate( gcCARMA%vLat, __STAT__) - if(associated(gcCARMA%vLon)) deallocate( gcCARMA%vLon, __STAT__) - if(associated(gcCARMA%vSO2)) deallocate( gcCARMA%vSO2, __STAT__) - if(associated(gcCARMA%vElev)) deallocate( gcCARMA%vElev, __STAT__) - if(associated(gcCARMA%vCloud)) deallocate( gcCARMA%vCloud, __STAT__) - -! Destroy Legacy state -! -------------------- - call registry_destroy_ (state%CARMAreg) - deallocate ( state%CARMAreg, state%qa, state%gcCARMA, state%chemReg, __STAT__) - VERIFY_(STATUS) - -! Stop timers -! ----------- - CALL MAPL_TimerOff(ggState, "FINALIZE") - CALL MAPL_TimerOff(ggState, "TOTAL") - -! Finalize MAPL Generic. Atanas says, "Do not deallocate foreign objects." -! ------------------------------------------------------------------------- - call MAPL_GenericFinalize ( gc, import, export, clock, RC=STATUS ) - VERIFY_(STATUS) - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE Finalize_ - -!....................................................................... - subroutine extract_ ( gc, clock, gcCARMA, qa, nymd, nhms, cdt, & - rc, state ) - - type(ESMF_GridComp), intent(INout) :: gc - type(ESMF_Clock), intent(in) :: clock - type(CARMA_GridComp), pointer :: gcCARMA - type(Chem_Array), pointer :: qa(:) - integer, intent(out) :: nymd, nhms - real, intent(out) :: cdt - integer, intent(out) :: rc - type(MAPL_MetaComp), pointer :: ggState - type(CARMAchem_state), pointer, optional :: state - - - type(CARMAchem_state), pointer :: myState - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - - type(ESMF_Alarm) :: ALARM - type(ESMF_TimeInterval) :: RingInterval - - type(ESMF_Time) :: TIME - type(ESMF_Config) :: CF - type(CARMAchem_Wrap) :: wrap - integer :: IYR, IMM, IDD, IHR, IMN, ISC - real(ESMF_KIND_R8) :: dt_r8 - - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, __RC__ ) - Iam = trim(COMP_NAME) // '::' // 'extract_' - - rc = 0 - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC ( GC, ggState, __RC__ ) - - -! Get my internal state -! --------------------- - call ESMF_UserCompGetInternalState(gc, 'CARMA_state', WRAP, STATUS) - VERIFY_(STATUS) - myState => wrap%ptr - if ( present(state) ) then - state => wrap%ptr - end if - - if ( .not. associated(myState%gcCARMA) ) then - allocate ( myState%gcCARMA, stat=STATUS ) - VERIFY_(STATUS) - end if - - if ( .not. associated(myState%CARMAreg) ) then - allocate ( myState%CARMAreg, stat=STATUS ) - VERIFY_(STATUS) - end if - - if ( .not. associated(myState%qa) ) then - allocate ( myState%qa(myState%CARMAreg%nq), stat=STATUS ) - VERIFY_(STATUS) - end if - - gcCARMA => myState%gcCARMA - gcCARMA%CARMAreg => myState%CARMAreg - qa => myState%qa - -! Get the configuration -! --------------------- - call ESMF_GridCompGet ( GC, CONFIG = CF, __RC__ ) - -! Get time step -! ------------- - call MAPL_Get(ggState, RUNALARM=ALARM, __RC__ ) - call ESMF_AlarmGet(ALARM, ringInterval=RingInterval, __RC__) - - call ESMF_TimeIntervalGet(RingInterval, s_r8=dt_r8, __RC__) - cdt = real(dt_r8) - - call ESMF_ClockGet(CLOCK,currTIME=TIME,rc=STATUS) - VERIFY_(STATUS) - -! Need code to extract nymd(20050205), nhms(120000) from clock -! ------------------------------------------ - - call ESMF_ClockGet(CLOCK,currTIME=TIME, __RC__ ) - call ESMF_TimeGet(TIME ,YY=IYR, MM=IMM, DD=IDD, H=IHR, M=IMN, S=ISC, __RC__ ) - call MAPL_PackTime(NYMD,IYR,IMM,IDD) - call MAPL_PackTime(NHMS,IHR,IMN,ISC) - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - -!....................................................................... - subroutine registry_ (r) - - type(CARMA_Registry), pointer :: r - CHARACTER(LEN=255) :: string - integer :: ios, ier(20), i, j, n, rc - -! Load resource file -! ------------------ - CALL I90_loadf ( TRIM(r%rcfilen), ier(1) ) - IF ( ier(1) .NE. 0 ) THEN - CALL final_(10) - RETURN - END IF - ier(1)=0 - -! Particle/Gas/Radiation structure -! -------------------------------- -! NBIN - call i90_label ( 'NBIN:', ier(1) ) - r%NBIN = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! NGROUP - call i90_label ( 'NGROUP:', ier(1) ) - r%NGROUP = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! NELEM - call i90_label ( 'NELEM:', ier(1) ) - r%NELEM = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! NGAS - call i90_label ( 'NGAS:', ier(1) ) - r%NGAS = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! NSOLUTE - call i90_label ( 'NSOLUTE:', ier(1) ) - r%NSOLUTE = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! NWAVE - call i90_label ( 'NWAVE:', ier(1) ) - r%NWAVE = i90_gint ( ier(2) ) - if ( any(ier(1:2) /= 0) ) then - call final_(20) - return - end if - -! Group Characteristics -! --------------------- - allocate ( r%rmrat(r%NGROUP), & - r%rmin(r%NGROUP), & - r%ishape(r%NGROUP), & - r%eshape(r%NGROUP), & - r%fscav(r%NGROUP), & - r%irhswell(r%NGROUP), & - r%irhswcomp(r%NGROUP), & - r%groupname(r%NGROUP), stat=ios ) - if ( ios /= 0) then - call final_(100) - return - endif - - call i90_label ( 'RMRAT:', ier(1) ) - do j = 1, r%NGROUP - r%rmrat(j) = i90_gfloat(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'RMIN:', ier(1) ) - do j = 1, r%NGROUP - r%rmin(j) = i90_gfloat(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'ISHAPE:', ier(1) ) - do j = 1, r%NGROUP - r%ishape(j) = i90_gint(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'ESHAPE:', ier(1) ) - do j = 1, r%NGROUP - r%eshape(j) = i90_gfloat(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'FSCAV:', ier(1) ) - do j = 1, r%NGROUP - r%fscav(j) = i90_gfloat(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'IRHSWELL:', ier(1) ) - do j = 1, r%NGROUP - r%irhswell(j) = i90_gint(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'IRHSWCOMP:', ier(1) ) - do j = 1, r%NGROUP - r%irhswcomp(j) = i90_gint(ier(j+1)) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'GROUPNAME:', ier(1) ) - do j = 1, r%NGROUP - call i90_gtoken(string, ier(j+1)) - r%groupname(j) = trim(string) - end do - if(any(ier(1:r%NGROUP+1) /= 0)) then - call final_(101) - return - endif - - -! Element Characteristics -! ----------------------- - allocate ( r%rhop(r%NELEM), r%igroup(r%NELEM), r%itype(r%NELEM), & - r%elemname(r%NELEM), r%icomposition(r%NELEM), stat=ios ) - if ( ios /= 0) then - call final_(100) - return - endif - - call i90_label ( 'IGROUP:', ier(1) ) - do i = 1, r%NELEM - r%igroup(i) = i90_gint(ier(i+1)) - end do - if(any(ier(1:r%NELEM+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'ICOMPOSITION:', ier(1) ) - do i = 1, r%NELEM - r%icomposition(i) = i90_gint(ier(i+1)) - end do - if(any(ier(1:r%NELEM+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'ITYPE:', ier(1) ) - do i = 1, r%NELEM - r%itype(i) = i90_gint(ier(i+1)) - end do - if(any(ier(1:r%NELEM+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'RHOP:', ier(1) ) - do i = 1, r%NELEM - r%rhop(i) = i90_gfloat(ier(i+1)) - end do - if(any(ier(1:r%NELEM+1) /= 0)) then - call final_(101) - return - endif - - call i90_label ( 'ELEMNAME:', ier(1) ) - do i = 1, r%NELEM - call i90_gtoken(string, ier(i+1)) - r%elemname(i) = trim(string) - end do - if(any(ier(1:r%NELEM+1) /= 0)) then - call final_(101) - return - endif - -! Gas Characteristics -! ------------------- - if(r%NGAS .gt. 0) then - allocate ( r%gasname(r%NGAS), r%igcomp(r%NGAS), & - r%igvapreq(r%NGAS), stat = ios ) - if ( ios /= 0) then - call final_(200) - return - endif - - call i90_label ( 'GASNAME:', ier(1) ) - do i = 1, r%NGAS - call i90_gtoken(string, ier(i+1)) - r%gasname(i) = trim(string) - end do - if(any(ier(1:r%NGAS+1) /= 0)) then - call final_(201) - return - endif - - call i90_label ( 'IGCOMP:', ier(1) ) - do i = 1, r%NGAS - r%igcomp(i) = i90_gint(ier(i+1)) - end do - if(any(ier(1:r%NGAS+1) /= 0)) then - call final_(202) - return - endif - - call i90_label ( 'IGVAPREQ:', ier(1) ) - do i = 1, r%NGAS - r%igvapreq(i) = i90_gint(ier(i+1)) - end do - if(any(ier(1:r%NGAS+1) /= 0)) then - call final_(203) - return - endif - - endif - - - -! Microphysical process flags and timesteps -! ----------------------------------------- -! Note that the labels are not required to be present - call i90_label ( 'DO_COAG:', ios ) - if(ios .eq. 0) r%do_coag = i90_gint( ier(1) ) - call i90_label ( 'DO_GROW:', ios ) - if(ios .eq. 0) r%do_grow = i90_gint( ier(2) ) - call i90_label ( 'DO_SUBSTEP:', ios ) - if(ios .eq. 0) r%do_substep = i90_gint( ier(3) ) - call i90_label ( 'DO_THERMO:', ios ) - if(ios .eq. 0) r%do_thermo = i90_gint( ier(4) ) - call i90_label ( 'DO_VDIFF:', ios ) - if(ios .eq. 0) r%do_vdiff = i90_gint( ier(5) ) - call i90_label ( 'DO_VTRAN:', ios ) - if(ios .eq. 0) r%do_vtran = i90_gint( ier(6) ) - call i90_label ( 'DO_FIXEDINIT:', ios ) - if(ios .eq. 0) r%do_fixedinit = i90_gint( ier(6) ) - call i90_label ( 'VF_CONST:', ios ) - if(ios .eq. 0) r%vf_const = i90_gfloat( ier(7) ) - call i90_label ( 'MINSUBSTEPS:', ios ) - if(ios .eq. 0) r%minsubsteps = i90_gint( ier(8) ) - call i90_label ( 'MAXSUBSTEPS:', ios ) - if(ios .eq. 0) r%maxsubsteps = i90_gint( ier(9) ) - call i90_label ( 'MAXRETRIES:', ios ) - if(ios .eq. 0) r%maxretries = i90_gint( ier(10) ) - call i90_label ( 'CONMAX:', ios ) - if(ios .eq. 0) r%conmax = i90_gfloat( ier(11) ) - if(any(ier(1:11) /= 0)) then - call final_(102) - return - endif - -! Species specific -! ---------------- -! Dust - call i90_label ( 'dust_emissions_fudgefactor:', ier(1) ) - r%dust_emissions_fudgefactor = i90_gfloat ( ier(2)) - if ( any(ier(1:2) /= 0 )) then - call final_(40) - return - end if - allocate(r%dmass_dust(r%NBIN), stat = ios) - -! Sea Salt - call i90_label ( 'seasalt_emissions_fudgefactor:', ier(1) ) - r%seasalt_emissions_fudgefactor = i90_gfloat ( ier(2)) - if ( any(ier(1:2) /= 0 )) then - call final_(40) - return - end if - -! Black Carbon - -! Smoke - call i90_label ( 'organic_matter_to_organic_carbon_ratio:', ier(1) ) - r%organic_matter_to_organic_carbon_ratio = i90_gfloat ( ier(2)) - if ( any(ier(1:2) /= 0 )) then - call final_(40) - return - end if - call i90_label ( 'fraction_terpene_to_organic_carbon:', ier(1) ) - r%fraction_terpene_to_organic_carbon = i90_gfloat ( ier(2)) - if ( any(ier(1:2) /= 0 )) then - call final_(40) - return - end if - -! Get any requested point emissions -! --------------------------------- -! Sulfate - ier(:) = 0 - call i90_label ( 'point_emissions_srcfilen_sulfate:', ier(1) ) - call i90_gtoken ( r%point_emissions_srcfilen_sulfate, ier(2) ) - if ( ier(1) /= 0 ) then - r%doing_point_emissions_sulfate = .FALSE. ! if rc is missing, don't fuss - else if ( any(ier(2:2) /= 0) ) then - call final_(42) ! this means point emissions info is messed up, abort - return - else - if ( (index(r%point_emissions_srcfilen_sulfate,'/dev/null')>0) ) then - r%doing_point_emissions_sulfate = .FALSE. ! disable it if no file specified - else - r%doing_point_emissions_sulfate = .TRUE. ! we are good to go - end if - end if -! Ash - ier(:) = 0 - call i90_label ( 'point_emissions_srcfilen_ash:', ier(1) ) - call i90_gtoken ( r%point_emissions_srcfilen_ash, ier(2) ) - if ( ier(1) /= 0 ) then - r%doing_point_emissions_ash = .FALSE. ! if rc is missing, don't fuss - else if ( any(ier(2:2) /= 0) ) then - call final_(42) ! this means point emissions info is messed up, abort - return - else - if ( (index(r%point_emissions_srcfilen_ash,'/dev/null')>0) ) then - r%doing_point_emissions_ash = .FALSE. ! disable it if no file specified - else - r%doing_point_emissions_ash = .TRUE. ! we are good to go - end if - end if -! Dust - ier(:) = 0 - call i90_label ( 'point_emissions_srcfilen_dust:', ier(1) ) - call i90_gtoken ( r%point_emissions_srcfilen_dust, ier(2) ) - if ( ier(1) /= 0 ) then - r%doing_point_emissions_dust = .FALSE. ! if rc is missing, don't fuss - else if ( any(ier(2:2) /= 0) ) then - call final_(42) ! this means point emissions info is messed up, abort - return - else - if ( (index(r%point_emissions_srcfilen_dust,'/dev/null')>0) ) then - r%doing_point_emissions_dust = .FALSE. ! disable it if no file specified - else - r%doing_point_emissions_dust = .TRUE. ! we are good to go - end if - end if - -! Mie Tables -! ---------- -! Set the number of channels to calculate over -! -------------------------------------------- - call i90_label ( 'n_channels:', ios ) - if ( ios /= 0 ) then - call final_(60) - else - r%nchannels = i90_gint ( ios ) - if ( ios /= 0 ) call final_(61) - end if - -! Set the number of moments -! ------------------------- - call i90_label ( 'n_moments:', ios ) - if ( ios /= 0 ) then - r%nmoments = 0 - else - r%nmoments = i90_gint ( ios ) - if ( ios /= 0 ) call final_(62) - end if - -! Set the channels to calculate over -! ---------------------------------- - allocate( r%channels(r%nchannels), stat = ios ) - call i90_label ( 'r_channels:', ios ) - if ( ios /= 0 ) then - call final_(63) - else - do n = 1, r%nchannels - r%channels(n) = i90_gfloat ( ios ) - if ( ios /= 0 ) call final_(64) - enddo - end if - - call i90_label ( 'filename_optical_properties_DU:', ios ) - if ( ios /= 0 ) then - call final_(65) - else - call i90_gtoken ( r%du_optics_file, ios ) - if ( ios /= 0 ) call final_(66) - end if - - call i90_label ( 'filename_optical_properties_SS:', ios ) - if ( ios /= 0 ) then - call final_(67) - else - call i90_gtoken ( r%ss_optics_file, ios ) - if ( ios /= 0 ) call final_(68) - end if - - call i90_label ( 'filename_optical_properties_BC:', ios ) - if ( ios /= 0 ) then - call final_(67) - else - call i90_gtoken ( r%bc_optics_file, ios ) - if ( ios /= 0 ) call final_(68) - end if - - call i90_label ( 'filename_optical_properties_SM:', ios ) - if ( ios /= 0 ) then - call final_(69) - else - call i90_gtoken ( r%sm_optics_file, ios ) - if ( ios /= 0 ) call final_(70) - end if - - call i90_label ( 'filename_optical_properties_SU:', ios ) - if ( ios /= 0 ) then - call final_(69) - else - call i90_gtoken ( r%su_optics_file, ios ) - if ( ios /= 0 ) call final_(70) - end if - - - r%nq = r%NBIN*r%NELEM + r%NGAS + r%NGAS + r%NGAS + r%NGAS + 1 - - if(r%nq .gt. 0) r%doing_CARMA = .true. - - if(r%doing_CARMA) allocate(r%vname(r%nq), stat=ios) - if(ios /= 0) call final_(100) - - CALL I90_release() - - end subroutine registry_ - - - - - - subroutine registry_destroy_ (r) - - type(CARMA_Registry), pointer :: r - integer :: ios - -! Group Characteristics -! --------------------- - deallocate ( r%rmrat, & - r%rmin, & - r%ishape, & - r%eshape, & - r%fscav, & - r%irhswell, & - r%irhswcomp, & - r%groupname, stat=ios ) - if ( ios /= 0) then - call final_(100) - return - endif - -! Element Characteristics -! ----------------------- - deallocate ( r%rhop, r%igroup, r%itype, & - r%elemname, r%icomposition, stat=ios ) - if ( ios /= 0) then - call final_(100) - return - endif - -! Gas Characteristics -! ------------------- - if(r%NGAS .gt. 0) then - deallocate ( r%gasname, r%igcomp, & - r%igvapreq, stat = ios ) - if ( ios /= 0) then - call final_(200) - return - endif - endif - -! Mie Tables -! ---------- - deallocate( r%channels, stat = ios ) - if ( ios /= 0) then - call final_(300) - return - endif - - if(r%doing_CARMA) deallocate(r%vname, stat=ios) - if(ios /= 0) then - call final_(400) - return - endif - -! Other -! ----- - deallocate( r%dmass_dust, stat=ios) - - end subroutine registry_destroy_ - - - - - -! print the CARMA registry (for checking) - subroutine registry_print_ (r) - - type(CARMA_Registry), pointer :: r - CHARACTER(LEN=255) :: string - integer :: ios, ier(20), i, j, rc - - if(MAPL_AM_I_ROOT()) then - print *, 'CARMAchem_GridCompMod: registry_print_' - print *, 'NBIN: ', r%NBIN - print *, 'NGROUP: ', r%NGROUP - print *, 'NELEM: ', r%NELEM - print *, 'NGAS: ', r%NGAS - print *, 'NSOLUTE: ', r%NSOLUTE - print *, 'NWAVE: ', r%NWAVE - -! Requested point emissions -! ------------------------- - print *, 'Requested point emissions (sulfate) : ', r%doing_point_emissions_sulfate - if(r%doing_point_emissions_sulfate) then - print *, ' Point emissions template (sulfate): ', r%point_emissions_srcfilen_sulfate - endif - print *, 'Requested point emissions (dust) : ', r%doing_point_emissions_dust - if(r%doing_point_emissions_dust) then - print *, ' Point emissions template (dust): ', r%point_emissions_srcfilen_dust - endif - print *, 'Requested point emissions (ash) : ', r%doing_point_emissions_ash - if(r%doing_point_emissions_ash) then - print *, ' Point emissions template (ash): ', r%point_emissions_srcfilen_ash - endif - -! Group Characteristics -! ----------------------- - if(r%NGROUP .gt. 0) then - do j = 1, r%NGROUP - print *, 'GROUP (',j,'): GROUPNAME = ',trim(r%groupname(j)), & - ', RMIN = ',r%rmin(j),', RMRAT = ',r%rmrat(j), & - ', ISHAPE = ',r%ishape(j),', ESHAPE = ',r%eshape(j), & - ', FSCAV = ',r%fscav(j),', IRHSWELL = ', r%irhswell(j), & - ', IRHSWCOMP = ',r%irhswcomp(j) - enddo - endif - -! Element Characteristics -! ----------------------- - if(r%NELEM .gt. 0) then - do j = 1, r%NELEM - print *, 'ELEMENT (',j,'): ELEMNAME = ',trim(r%elemname(j)), & - ', IGROUP = ',r%igroup(j),', RHOP = ',r%rhop(j) - enddo - endif - -! Gas Characteristics -! ------------------- - if(r%NGAS .gt. 0) then - do j = 1, r%NGAS - print *, 'GAS (',j,'): GASNAME = ',trim(r%gasname(j)), & - ', IGCOMP = ',r%igcomp(j),', IGVAPREQ = ',r%igvapreq(j) - enddo - endif - -! Microphysical process flags and timesteps -! ----------------------------------------- - print *, 'DO_COAG: ', r%do_coag - print *, 'DO_GROW: ', r%do_grow - print *, 'DO_SUBSTEP: ', r%do_substep - print *, 'DO_THERMO: ', r%do_thermo - print *, 'DO_VDIFF: ', r%do_vdiff - print *, 'DO_VTRAN: ', r%do_vtran - print *, 'VF_CONST: ', r%vf_const - print *, 'DO_FIXEDINIT: ', r%do_fixedinit - print *, 'MINSUBSTEPS: ', r%minsubsteps - print *, 'MAXSUBSTEPS: ', r%maxsubsteps - print *, 'MAXRETRIES: ', r%maxretries - print *, 'CONMAX: ', r%conmax - - endif - - end subroutine registry_print_ - - - - - - SUBROUTINE final_(ierr) - INTEGER :: ios, ierr, rc - CALL I90_release() - rc = ierr - END SUBROUTINE final_ - - -subroutine run_aerosol_optics(state, rc) - - implicit none - -! Arguments -! --------- - type(ESMF_State) :: state - integer, intent(out) :: rc - - -! Local -! --------- - integer :: n_aerosols - character(len=ESMF_MAXSTR), allocatable :: aerosol_names(:) - type(ESMF_FieldBundle) :: aerosols - - real, dimension(:,:,:), pointer :: ple - real, dimension(:,:,:), pointer :: rh - real, dimension(:,:,:), pointer :: var - real, dimension(:,:,:), pointer :: q - real, dimension(:,:,:,:), pointer :: q_4d - - real, dimension(:,:,:), allocatable :: dp, f_p - - character(len=ESMF_MAXSTR) :: fld_name - type(ESMF_Field) :: fld - - real, dimension(:,:,:,:), allocatable :: ext, ssa, asy ! (lon:,lat:,lev:,band:) - - integer :: n - integer :: i1, j1, i2, j2, km - - integer :: band, offset - - integer :: instance - - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam - - integer, parameter :: n_bands = 1 - - real :: x - integer :: i, j, k - - Iam = 'CARMA::run_aerosol_optics()' - - -! Mie Table instance/index -! ------------------------ - call ESMF_AttributeGet(state, name='mie_table_instance', value=instance, __RC__) - -! Radiation band -! -------------- - band = 0 - call ESMF_AttributeGet(state, name='band_for_aerosol_optics', value=band, __RC__) - offset = band - n_bands - -! Pressure at layer edges -! ------------------------ - call ESMF_AttributeGet(state, name='air_pressure_for_aerosol_optics', value=fld_name, __RC__) - call MAPL_GetPointer(state, ple, trim(fld_name), __RC__) - - i1 = lbound(ple, 1); i2 = ubound(ple, 1) - j1 = lbound(ple, 2); j2 = ubound(ple, 2) - km = ubound(ple, 3) - -! Relative humidity -! ----------------- - call ESMF_AttributeGet(state, name='relative_humidity_for_aerosol_optics', value=fld_name, __RC__) - call MAPL_GetPointer(state, rh, trim(fld_name), __RC__) - - i1 = lbound(rh, 1); i2 = ubound(rh, 1) - j1 = lbound(rh, 2); j2 = ubound(rh, 2) - km = ubound(rh, 3) - - call ESMF_StateGet(state, 'AEROSOLS', aerosols, __RC__) - call ESMF_FieldBundleGet(aerosols, fieldCount=n_aerosols, __RC__) - - allocate(aerosol_names(n_aerosols), __STAT__) - - call ESMF_FieldBundleGet(aerosols, FieldNameList=aerosol_names, __RC__) - - allocate(ext(i1:i2,j1:j2,km,n_bands), & - ssa(i1:i2,j1:j2,km,n_bands), & - asy(i1:i2,j1:j2,km,n_bands), __STAT__) - - allocate(q_4d(i1:i2,j1:j2,km,n_aerosols), __STAT__) - -#if (0) - allocate(dp(i1:i2,j1:j2,km), f_p(i1:i2,j1:j2,km), __STAT__) - - dp = ple(:,:,1:km) - ple(:,:,0:km-1) - f_p = dp / MAPL_GRAV - - do n = 1, n_aerosols - call ESMF_FieldBundleGet(aerosols, trim(aerosol_names(n)), field=fld, __RC__) - call ESMF_FieldGet(fld, farrayPtr=q, __RC__) - - q_4d(:,:,:,n) = f_p * q - end do - - call ESMF_AttributeGet(state, name='mie_table_instance', value=instance, __RC__) - call mie_(carmaMieTable(instance),aerosol_names, n_bands, offset, q_4d, rh, ext, ssa, asy, __RC__) - - deallocate(dp, f_p, __STAT__) -#else - do n = 1, n_aerosols - call ESMF_FieldBundleGet(aerosols, trim(aerosol_names(n)), field=fld, __RC__) - call ESMF_FieldGet(fld, farrayPtr=q, __RC__) - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - x = ((PLE(i,j,k) - PLE(i,j,k-1))*0.01)*(100./MAPL_GRAV) - q_4d(i,j,k,n) = x * q(i,j,k) - end do - end do - end do - end do - - call mie_(carmaMieTable(instance), aerosol_names, n_bands, offset, q_4d, rh, ext, ssa, asy, __RC__) -#endif - - call ESMF_AttributeGet(state, name='extinction_in_air_due_to_ambient_aerosol', value=fld_name, __RC__) - if (fld_name /= '') then - call MAPL_GetPointer(state, var, trim(fld_name), __RC__) - var = ext(:,:,:,1) - end if - - call ESMF_AttributeGet(state, name='single_scattering_albedo_of_ambient_aerosol', value=fld_name, __RC__) - if (fld_name /= '') then - call MAPL_GetPointer(state, var, trim(fld_name), __RC__) - var = ssa(:,:,:,1) - end if - - call ESMF_AttributeGet(state, name='asymmetry_parameter_of_ambient_aerosol', value=fld_name, __RC__) - if (fld_name /= '') then - call MAPL_GetPointer(state, var, trim(fld_name), __RC__) - var = asy(:,:,:,1) - end if - - deallocate(aerosol_names, ext, ssa, asy, q_4d, __STAT__) - - RETURN_(ESMF_SUCCESS) - -contains - - subroutine mie_(mie_table, aerosol, nb, offset, q, rh, ext, ssa, asy, rc) - - implicit none - - type(Chem_Mie), intent(inout):: mie_table ! mie table - character(len=*), intent(in ) :: aerosol(:) ! list of aerosols - integer, intent(in ) :: nb ! number of bands - integer, intent(in ) :: offset ! bands offset - real, intent(in ) :: q(:,:,:,:) ! aerosol mass mixing ratio, kg kg-1 - real, intent(in ) :: rh(:,:,:) ! relative humidity - - real, intent(out) :: ext(:,:,:,:) ! extinction - real, intent(out) :: ssa(:,:,:,:) ! SSA - real, intent(out) :: asy(:,:,:,:) ! asymmetry parameter - - integer, intent(out) :: rc - - ! local - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam='aerosol_optics::mie_' - - integer :: l, idx, na - - real(kind=8) :: ext_(size(ext,1),size(ext,2),size(ext,3),size(ext,4)) - real(kind=8) :: ssa_(size(ext,1),size(ext,2),size(ext,3),size(ext,4)) - real(kind=8) :: asy_(size(ext,1),size(ext,2),size(ext,3),size(ext,4)) - - na = size(aerosol) - - _ASSERT(na == size(q,4), 'needs informative message') - - ext_ = 0.0d0 - ssa_ = 0.0d0 - asy_ = 0.0d0 - - do l = 1, na - idx = Chem_MieQueryIdx(mie_table, 'CARMA::'//trim(aerosol(l)), __RC__) - - call Chem_MieQueryAllBand4D(mie_table, idx, nb, offset, q(:,:,:,l), rh, ext, ssa, asy, __RC__) - - ext_ = ext_ + ext ! total extinction - ssa_ = ssa_ + (ssa*ext) ! total scattering - asy_ = asy_ + asy*(ssa*ext) ! sum of (asy * sca) - end do - - ext = ext_ - ssa = ssa_ - asy = asy_ - - RETURN_(ESMF_SUCCESS) - - end subroutine mie_ - - end subroutine run_aerosol_optics - - - - END MODULE CARMAchem_GridCompMod diff --git a/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.rc b/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.rc deleted file mode 100644 index 227058ad..00000000 --- a/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.rc +++ /dev/null @@ -1,27 +0,0 @@ -PrimaryExports%% - -# DUST -CARMA_DU_SRC NA N Y - none none du_src ExtData/PIESA/sfc/gocart.dust_source.v5a.x1152_y721.nc - -# SMOKE -CARMA_SM_BIOMASS NA N Y %y4-%m2-%d2t12:00:00 none none biomass ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_oc.005.%y4%m2%d2.nc4 -CARMA_SM_BIOFUEL NA Y Y %y4-%m2-%d2t12:00:00 none none biofuel /dev/null -CARMA_SM_ANTEOC1 NA Y Y %y4-%m2-%d2t12:00:00 none none anteoc1 ExtData/AeroCom/sfc/AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc -CARMA_SM_ANTEOC2 NA Y Y %y4-%m2-%d2t12:00:00 none none anteoc2 /dev/null -CARMA_SM_SHIP NA Y Y %y4-%m2-%d2t12:00:00 none none oc_ship ExtData/MERRA2/sfc/edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 -CARMA_OC_TERPENE NA Y Y %y4-%m2-%d2t12:00:00 none none terpene ExtData/PIESA/sfc/geia.terpene_biogenic.x144_y91_t12.1971.nc -CARMA_PSOA_ANTHRO_VOC NA Y Y %y4-%m2-%d2t12:00:00 none none biofuel /dev/null -CARMA_PSOA_BIOB_VOC NA Y Y %y4-%m2-%d2t12:00:00 none none biofuel /dev/null - - - -# SULFATE PRODUCTION -CARMA_PSO4TOT NA Y Y %y4-%m2-%d2t12:00:00 none none pso4tot /dev/null - -# Nitric Acid for STS -CARMA_HNO3 NA Y Y %y4-%m2-%d2t12:00:00 none none hno3 /dev/null - -# Sulfuric Acid Vapor input -CARMA_H2SO4 NA Y Y %y4-%m2-%d2t12:00:00 none none h2so4 /dev/null - -%% diff --git a/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.yaml b/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.yaml deleted file mode 100644 index eb9eed63..00000000 --- a/CARMAchem_GridComp/CARMAchem_GridComp_ExtData.yaml +++ /dev/null @@ -1,87 +0,0 @@ -Collections: - CARMAchem_AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc: - template: ExtData/AeroCom/sfc/AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - CARMAchem_edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4: - template: ExtData/MERRA2/sfc/edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - CARMAchem_geia.terpene_biogenic.x144_y91_t12.1971.nc: - template: ExtData/PIESA/sfc/geia.terpene_biogenic.x144_y91_t12.1971.nc - CARMAchem_gocart.dust_source.v5a.x1152_y721.nc: - template: ExtData/PIESA/sfc/gocart.dust_source.v5a.x1152_y721.nc - CARMAchem_qfed2.emis_oc.005.%y4%m2%d2.nc4: - template: ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_oc.005.%y4%m2%d2.nc4 - -Samplings: - CARMAchem_sample_0: - extrapolation: persist_closest - CARMAchem_sample_1: - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - CARMAchem_sample_2: - extrapolation: clim - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - -Exports: - CARMA_DU_SRC: - collection: CARMAchem_gocart.dust_source.v5a.x1152_y721.nc - regrid: CONSERVE - sample: CARMAchem_sample_0 - variable: du_src - CARMA_OC_TERPENE: - collection: CARMAchem_geia.terpene_biogenic.x144_y91_t12.1971.nc - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: terpene - CARMA_SM_ANTEOC1: - collection: CARMAchem_AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: anteoc1 - CARMA_SM_ANTEOC2: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: anteoc2 - CARMA_SM_BIOFUEL: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: biofuel - CARMA_SM_BIOMASS: - collection: CARMAchem_qfed2.emis_oc.005.%y4%m2%d2.nc4 - regrid: CONSERVE - sample: CARMAchem_sample_1 - variable: biomass - CARMA_SM_SHIP: - collection: CARMAchem_edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: oc_ship - CARMA_PSO4TOT: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: pso4tot - CARMA_H2SO4: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: h2so4 - CARMA_HNO3: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: hno3 - CARMA_PSOA_ANTHRO_VOC: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: biofuel - CARMA_PSOA_BIOB_VOC: - collection: /dev/null - regrid: CONSERVE - sample: CARMAchem_sample_2 - variable: biofuel - diff --git a/CARMAchem_GridComp/CARMAchem_MieRegistry.rc b/CARMAchem_GridComp/CARMAchem_MieRegistry.rc deleted file mode 100755 index fdc26e08..00000000 --- a/CARMAchem_GridComp/CARMAchem_MieRegistry.rc +++ /dev/null @@ -1,513 +0,0 @@ -#------------------------------------------------------------------------ -#BOP -# -# !RESOURCE: AeroChem_Registry --- AeroChem Registry -# -# !HELP: -# -# The Chemistry Registry resource file is used to control basic -# properties of the GOCART and StratChem Grid Components. -# Specifically, it -# -# - selects which constituents to simulate -# - selects the number of bins for each constituent -# - specifies variable names and units for each constituent -# -# NOTES: The water vapor and ozone tracers are not really being used -# in GEOS-5. They are still kept for compatibility with GEOS-4. -# -# XX lists Stratchem's inferred species. See Chem_Registry.rc -# for GMIchem's XX (non-transported) species list. -# -# IMPORTANT: This file should be the same as Chem_Registry.rc, except that -# only aerosols (DU, SS, SU, BC, OC) are turned ON. -# -# !REVISION HISTORY: -# -# 27May2005 da Silva Added variable tables for SU/BC/OC. -# 19dec2005 da Silva Changed volume mixing ratio units to mol/mol -# 10Feb2006 Hayashi Added analysis update frequency -# 27Jul2006 da Silva No more analysis frequencies; added GMI/PChem (GEOS-5) -# -#----------------------------------------------------------------------- -#EOP - - -# Whether to include the constituent in the simulation -# ---------------------------------------------------- -doing_H2O: no # water vapor (must always ON for fvGCM) -doing_O3: no # ozone (must be always ON for fvGCM in DAS mode) -doing_CO: no # carbon monoxide -doing_CO2: no # carbon dioxide -doing_DU: YES # mineral dust -doing_SS: yes # sea salt -doing_SU: yes # sulfates -doing_CFC: no # CFCs -doing_BC: no # black carbon -doing_OC: yes # organic carbon -doing_Rn: no # radon -doing_CH4: no # methane -doing_SC: no # stratospheric chemistry -doing_GMI: no # GMI chemistry (GEOS-5) -doing_XX: no # generic tracer -doing_PC: no # parameterized chemistry (GEOS-5) -doing_OCS: no # ACHEM chemistry (OCS) -doing_NI: no # &YesNo Include nitrate? -doing_TR: no # passive tracers - -# You can select the number of bins (e.g., particle size) -# for each of the constituents. Note nbins>1 may not be -# supported by some constituents -# ---------------------------------------------------- -nbins_H2O: 1 # water vapor -nbins_O3: 1 # ozone -nbins_CO: 10 # carbon monoxide -nbins_CO2: 1 # carbon dioxide -nbins_DU: 22 # mineral dust -nbins_SS: 22 # sea salt -nbins_SU: 22 # sulfates -nbins_CFC: 2 # CFCs -nbins_BC: 2 # black carbon -nbins_OC: 22 # organic carbon -nbins_Rn: 1 # radon -nbins_CH4: 15 # methane -nbins_SC: 34 # stratospheric chemistry -nbins_XX: 18 # generic tracer -nbins_PC: 1 # parameterized chemistry (GEOS-5) -nbins_GMI: 72 # GMI chemistry (GEOS-5) -nbins_OCS: 1 # ACHEM chemistry (OCS) -nbins_NI: 5 # nitrate -nbins_TR: 10 # passive tracers - -# Units for each constituent -# -------------------------- -units_H2O: "kg kg-1" # water vapor -units_O3: "kg kg-1" # ozone -units_CO: "mol mol-1" # carbon monoxide -units_CO2: "mol mol-1" # carbon dioxide -units_DU: "kg kg-1" # mineral dust -units_SS: "kg kg-1" # sea salt -units_SU: "kg kg-1" # sulfates -units_CFC: "mol mol-1" # CFCs -units_BC: "kg kg-1" # black carbon -units_OC: "kg kg-1" # organic carbon -units_Rn: "mol mol-1" # radon -units_CH4: "mol mol-1" # methane -units_SC: "mol mol-1" # stratospheric chemistry -units_XX: "mol mol-1" # generic tracer -units_PC: "kg kg-1" # parameterized chemistry (GEOS-5) -units_GMI: "mol mol-1" # GMI chemistry (GEOS-5) -units_OCS: "kg kg-1" # ACHEM chemistry (OCS) -units_NI: "kg kg-1" # nitrate -units_TR: "mol mol-1" # passive tracers - -# Variable names to override defaults. Optional. Name and Units must -# be 1 token. Long names can be more than one token. -# -------------------------------------------------------------------- - -variable_table_O3:: - -# Name Units Long Name -# ----- ------ -------------------------------- -OX "mol mol-1" Parameterized ozone -:: - -variable_table_CO:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CO "mol mol-1" Global carbon monoxide -COBBAE "mol mol-1" CO Asia and Europe Biomass Burning -COBBNA "mol mol-1" CO North America Biomass Burning -COBBLA "mol mol-1" CO Central and South America Biomass Burning -COBBAF "mol mol-1" CO Africa Biomass Burning -COBBGL "mol mol-1" CO Global Biomass Burning -CONBAS "mol mol-1" CO Asia Non-Biomass Burning -CONBNA "mol mol-1" CO North American Non-Biomass Burning -CONBEU "mol mol-1" CO European Non-Biomass Burning -CONBGL "mol mol-1" CO Global Non-Biomass Burning -:: - -variable_table_CO2:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CO2 "mol mol-1" Carbon Dioxide -:: - -variable_table_CFC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CFC12S "mol mol-1" Stratospheric CFC-12 (CCl2F2) -CFC12T "mol mol-1" Tropospheric CFC-12 (CCl2F2) -:: - -variable_table_DU:: - -# Name Units Long Name -# ----- ------ -------------------------------- -dust::pc::001 kg/kg dust 001 -dust::pc::002 kg/kg dust 002 -dust::pc::003 kg/kg dust 003 -dust::pc::004 kg/kg dust 004 -dust::pc::005 kg/kg dust 005 -dust::pc::006 kg/kg dust 006 -dust::pc::007 kg/kg dust 007 -dust::pc::008 kg/kg dust 008 -dust::pc::009 kg/kg dust 009 -dust::pc::010 kg/kg dust 010 -dust::pc::011 kg/kg dust 011 -dust::pc::012 kg/kg dust 012 -dust::pc::013 kg/kg dust 013 -dust::pc::014 kg/kg dust 014 -dust::pc::015 kg/kg dust 015 -dust::pc::016 kg/kg dust 016 -dust::pc::017 kg/kg dust 017 -dust::pc::018 kg/kg dust 018 -dust::pc::019 kg/kg dust 019 -dust::pc::020 kg/kg dust 020 -dust::pc::021 kg/kg dust 021 -dust::pc::022 kg/kg dust 022 -:: - -variable_table_SS:: - -# Name Units Long Name -# ----- ------ -------------------------------- -seasalt::pc::001 kg/kg seasalt 001 -seasalt::pc::002 kg/kg seasalt 002 -seasalt::pc::003 kg/kg seasalt 003 -seasalt::pc::004 kg/kg seasalt 004 -seasalt::pc::005 kg/kg seasalt 005 -seasalt::pc::006 kg/kg seasalt 006 -seasalt::pc::007 kg/kg seasalt 007 -seasalt::pc::008 kg/kg seasalt 008 -seasalt::pc::009 kg/kg seasalt 009 -seasalt::pc::010 kg/kg seasalt 010 -seasalt::pc::011 kg/kg seasalt 011 -seasalt::pc::012 kg/kg seasalt 012 -seasalt::pc::013 kg/kg seasalt 013 -seasalt::pc::014 kg/kg seasalt 014 -seasalt::pc::015 kg/kg seasalt 015 -seasalt::pc::016 kg/kg seasalt 016 -seasalt::pc::017 kg/kg seasalt 017 -seasalt::pc::018 kg/kg seasalt 018 -seasalt::pc::019 kg/kg seasalt 019 -seasalt::pc::020 kg/kg seasalt 020 -seasalt::pc::021 kg/kg seasalt 021 -seasalt::pc::022 kg/kg seasalt 022 -:: - -variable_table_SU:: - -# Name Units Long Name -# ----- ------ -------------------------------- -sulfate::pc::001 kg/kg sulfate 001 -sulfate::pc::002 kg/kg sulfate 002 -sulfate::pc::003 kg/kg sulfate 003 -sulfate::pc::004 kg/kg sulfate 004 -sulfate::pc::005 kg/kg sulfate 005 -sulfate::pc::006 kg/kg sulfate 006 -sulfate::pc::007 kg/kg sulfate 007 -sulfate::pc::008 kg/kg sulfate 008 -sulfate::pc::009 kg/kg sulfate 009 -sulfate::pc::010 kg/kg sulfate 010 -sulfate::pc::011 kg/kg sulfate 011 -sulfate::pc::012 kg/kg sulfate 012 -sulfate::pc::013 kg/kg sulfate 013 -sulfate::pc::014 kg/kg sulfate 014 -sulfate::pc::015 kg/kg sulfate 015 -sulfate::pc::016 kg/kg sulfate 016 -sulfate::pc::017 kg/kg sulfate 017 -sulfate::pc::018 kg/kg sulfate 018 -sulfate::pc::019 kg/kg sulfate 019 -sulfate::pc::020 kg/kg sulfate 020 -sulfate::pc::021 kg/kg sulfate 021 -sulfate::pc::022 kg/kg sulfate 022 -:: - -variable_table_BC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -BCphobic "kg kg-1" Hydrophobic Black Carbon -BCphilic "kg kg-1" Hydrophilic Black Carbon -:: - -variable_table_OC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -smoke::pc::001 kg/kg smoke 001 -smoke::pc::002 kg/kg smoke 002 -smoke::pc::003 kg/kg smoke 003 -smoke::pc::004 kg/kg smoke 004 -smoke::pc::005 kg/kg smoke 005 -smoke::pc::006 kg/kg smoke 006 -smoke::pc::007 kg/kg smoke 007 -smoke::pc::008 kg/kg smoke 008 -smoke::pc::009 kg/kg smoke 009 -smoke::pc::010 kg/kg smoke 010 -smoke::pc::011 kg/kg smoke 011 -smoke::pc::012 kg/kg smoke 012 -smoke::pc::013 kg/kg smoke 013 -smoke::pc::014 kg/kg smoke 014 -smoke::pc::015 kg/kg smoke 015 -smoke::pc::016 kg/kg smoke 016 -smoke::pc::017 kg/kg smoke 017 -smoke::pc::018 kg/kg smoke 018 -smoke::pc::019 kg/kg smoke 019 -smoke::pc::020 kg/kg smoke 020 -smoke::pc::021 kg/kg smoke 021 -smoke::pc::022 kg/kg smoke 022 -:: - -variable_table_RN:: - -# Name Units Long Name -# ----- ------ -------------------------------- -Rn "mol mol-1" Global radon -:: - -variable_table_CH4:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CH4animls "mol mol-1" Methane from animals -CH4coal "mol mol-1" Methane from coal -CH4leak "mol mol-1" Methane from leakage -CH4gasvnt "mol mol-1" Methane from gas venting -CH4hydz "mol mol-1" Methane from ocean HYDZ -CH4msw "mol mol-1" Methane from municipal sewers -CH4soilab "mol mol-1" Methane absorbed by soil -CH4trmite "mol mol-1" Methane from termites -CH4bogs "mol mol-1" Methane from bogs -CH4burn "mol mol-1" Methane from biomass burning -CH4ricec "mol mol-1" Methane from rice cultivation -CH4swamps "mol mol-1" Methane from swamps -CH4tundra "mol mol-1" Methane from tundra -CH4bf "mol mol-1" Methane from biofuel -CH4tot "mol mol-1" Methane -:: - -variable_table_NI:: - -# Name Units Long Name -# ----- ------ -------------------------------- -NH3 'kg kg-1' Ammonia (NH3, gas phase) -NH4a 'kg kg-1' Ammonium ion (NH4+, aerosol phase) -NO3an1 'kg kg-1' Nitrate size bin 001 -NO3an2 'kg kg-1' Nitrate size bin 002 -NO3an3 'kg kg-1' Nitrate size bin 003 -:: - -variable_table_SC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -OX "mol mol-1" Stratospheric odd oxygen -NOX "mol mol-1" Odd nitrogen -HNO3 "mol mol-1" Nitric acid -N2O5 "mol mol-1" Dinitrogen pentoxide -HO2NO2 "mol mol-1" Peroxynitric acid -CLONO2 "mol mol-1" Chlorine nitrate -CLX "mol mol-1" Odd chlorine -HCL "mol mol-1" Hydrochloric acid -HOCL "mol mol-1" Hypochlorous acid -H2O2 "mol mol-1" Hydrogen peroxide -BRX "mol mol-1" Odd bromine -N2O "mol mol-1" Nitrous oxide -CL2 "mol mol-1" Molecular chlorine -OCLO "mol mol-1" Chlorine dioxide -BRCL "mol mol-1" Bromine chloride -HBR "mol mol-1" Hydrogen bromide -BRONO2 "mol mol-1" Bromine nitrate -CH4 "mol mol-1" Methane -HOBR "mol mol-1" Hypobromous acid -CH3OOH "mol mol-1" Methyl hydroperoxide -CO "mol mol-1" Carbon monoxide -HNO3COND "mol mol-1" Condensed nitric acid -CFC11 "mol mol-1" CFC-11 (CCl3F) -CFC12 "mol mol-1" CFC-12 (CCl2F2) -CFC113 "mol mol-1" CFC-113 (CCl2FCClF2) -HCFC "mol mol-1" HCFC -HCFC22 "mol mol-1" HCFC-22 (CHClF2) -CCL4 "mol mol-1" Carbon tetrachloride -CH3CCL3 "mol mol-1" Methyl chloroform -CH3CL "mol mol-1" Methyl chloride -CH3BR "mol mol-1" Methyl bromide -H1301 "mol mol-1" Halon 1301 (CBrF3) -H12_24 "mol mol-1" Halon 12_24 -AOADAYS days Age-of-air -:: - -variable_table_GMI:: - -# Name Units Long Name -# ----- ------ -------------------------------- -AOADAYS days Age-of-air -CH2O "mol mol-1" Formaldehyde -CH4 "mol mol-1" Methane -CO "mol mol-1" Carbon monoxide -H2 "mol mol-1" Molecular hydrogen -HCOOH "mol mol-1" Formic acid (CH2O2) -HNO2 "mol mol-1" Nitrous acid -HNO3 "mol mol-1" Nitric acid -HNO4 "mol mol-1" Pernitric acid -HO2 "mol mol-1" Perhydroxyl radical -H2O2 "mol mol-1" Hydrogen peroxide -MOH "mol mol-1" Methanol -MP "mol mol-1" Methyl hydroperoxide -N2O "mol mol-1" Nitrous oxide -NO "mol mol-1" Nitric oxide -NO2 "mol mol-1" Nitrogen dioxide -NO3 "mol mol-1" Nitrogen trioxide -N2O5 "mol mol-1" Dinitrogen pentoxide -OX "mol mol-1" Ozone -OH "mol mol-1" Hydroxyl radical -Br "mol mol-1" Ground state atomic bromine (2P3/2) -BrCl "mol mol-1" Bromine chloride -BrO "mol mol-1" Bromine monoxide radical -BrONO2 "mol mol-1" Bromine nitrate -HBr "mol mol-1" Hydrogen bromide -HOBr "mol mol-1" Hydrobromous acid -Cl "mol mol-1" Ground state atomic chlorine (2P3/2) -Cl2 "mol mol-1" Molecular chlorine -ClO "mol mol-1" Chlorine monoxide radical -Cl2O2 "mol mol-1" Chlorine peroxide -ClONO2 "mol mol-1" Chlorine nitrate -HCl "mol mol-1" Hydrochloric acid -HOCl "mol mol-1" Hydrochlorous acid -OClO "mol mol-1" Symmetrical chlorine dioxide -CH3Br "mol mol-1" Methyl bromide -CH3Cl "mol mol-1" Methyl chloride -CH3CCl3 "mol mol-1" Methyl chloroform -CCl4 "mol mol-1" Carbon tetrachloride -CFC11 "mol mol-1" CFC11 (CFCl3) -CFC12 "mol mol-1" CFC12 (CF2Cl2) -CFC113 "mol mol-1" CFC113 (C2Cl3F3) -CFC114 "mol mol-1" CFC114 (C2Cl2F4) -CFC115 "mol mol-1" CFC115 (C2ClF5) -HCFC22 "mol mol-1" HCFC22 (CClF2H) -HCFC141b "mol mol-1" HCFC141b (C2Cl2FH3) -HCFC142b "mol mol-1" HCFC142b (C2ClF2H3) -CF2Br2 "mol mol-1" Halon 1202 -CF2ClBr "mol mol-1" Halon 1211 -CF3Br "mol mol-1" Halon 1301 -H2402 "mol mol-1" Halon 2402 (C2Br2F4) -ACTA "mol mol-1" Acetic acid (C2H4O2) -ALD2 "mol mol-1" Acetaldehyde (C2H4O) -ALK4 "mol mol-1" C4-5 alkanes (C4H10 C5H12) -C2H6 "mol mol-1" Ethane -C3H8 "mol mol-1" Propane -ETP "mol mol-1" Ethylhydroperoxide (C2H6O2) from ETO2 -HAC "mol mol-1" Hydroxyacetone (C3H6O2) -IALD "mol mol-1" Hydroxy carbonyl alkenes (C5H8O2) from isoprene -IAP "mol mol-1" Peroxide (C5H10O5) from IAO2 -ISOP "mol mol-1" Isoprene (C5H8) -MACR "mol mol-1" Methacrolein (C4H6O) -MEK "mol mol-1" Methyl ethyl ketone (C4H8O) -MVK "mol mol-1" Methyl vinyl ketone (C4H6O) -PAN "mol mol-1" Peroxyacetyl nitrate (C2H3NO5) -PMN "mol mol-1" Peroxymethacryloyl nitrate (C4H5O5N) -PPN "mol mol-1" Peroxypropionyl nitrate (C3H5NO5) -PRPE "mol mol-1" Propene (C3H6) -R4N2 "mol mol-1" C4-C5 alkylnitrates (C4H9O3N) -RCHO "mol mol-1" C2 aldehydes (C3H6O) -RCOOH "mol mol-1" C2 organic acids -N2 "m-3" Molecular nitrogen -HNO3COND "mol mol-1" Condensed nitric acid -:: - -variable_table_XX:: - -# Name Units Long Name -# ----- ------ -------------------------------- -O3CHEM "mol mol-1" Ozone from chemistry -O3P "mol mol-1" Atomic oxygen in the ground state -O1D "mol mol-1" Atomic oxygen in the first excited state -N "mol mol-1" Atomic nitrogen -NO "mol mol-1" Nitric oxide -NO2 "mol mol-1" Nitrogen dioxide -NO3 "mol mol-1" Nitrogen trioxide -HATOMIC "mol mol-1" Atomic hydrogen -OH "mol mol-1" Hydroxyl radical -HO2 "mol mol-1" Hydroperoxyl radical -CL "mol mol-1" Atomic chlorine -CLO "mol mol-1" Chlorine monoxide -BRO "mol mol-1" Bromine monoxide -BR "mol mol-1" Atomic bromine -CL2O2 "mol mol-1" Dichlorine peroxide -CH2O "mol mol-1" Formaldehyde -CH3O2 "mol mol-1" Methyl peroxide -RO3OX "none" Ozone-to-odd oxygen ratio -:: - - -variable_table_TR:: - -# Name Units Long Name -# ----- ------ -------------------------------- -st80_25 'mol mol-1' Stratosphere source 25 day tracer -CO_50_na 'mol mol-1' Anthro CO North America 50 day tracer -SF6 'mol mol-1' Sulfur Hexafluoride tracer -aoa days Age of air (uniform source) tracer -e90 'mol mol-1' Constant emission 90 day tracer -Rn222 'mol mol-1' Radon-222 -Pb210 'mol mol-1' Lead-210 -Be7 'mol mol-1' Beryllium radionuclide 7(Be) -Be10 'mol mol-1' Beryllium radionuclide 10(Be) -CH3I 'mol mol-1' Methyl iodide -:: - -#........................................................................ - -# ------------------- -# Not Implemented Yet -# ------------------- - -# Whether to advect the constituent -# --------------------------------- -advect_H2O: yes # water vapor -advect_O3: yes # ozone -advect_CO: yes # carbon monoxide -advect_CO2: yes # carbon dioxide -advect_DU: yes # mineral dust -advect_SS: yes # sea salt -advect_SU: yes # sulfates -advect_CFC: yes # CFCs -advect_BC: yes # black carbon -advect_OC: yes # organic carbon -advect_Rn: yes # radon -advect_CH4: yes # methane -advect_SC: yes # stratospheric chemistry -advect_XX: no # generic tracer -advect_PC: yes # parameterized chemistry (GEOS-5) -advect_GMI: yes # GMI chemistry (GEOS-5) -advect_OCS: yes # ACHEM chemistry (OCS) -advect_NI: yes # Nitrate -advect_TR: yes # passive tracers - -# Whether to diffuse the constituent -# ---------------------------------- -diffuse_H2O: yes # water vapor -diffuse_O3: yes # ozone -diffuse_XX: yes # generic tracer -diffuse_CO: yes # carbon monoxide -diffuse_CO2: yes # carbon dioxide -diffuse_DU: yes # mineral dust -diffuse_SS: yes # sea salt -diffuse_SU: yes # sulfates -diffuse_CFC: yes # CFCs -diffuse_BC: yes # black carbon -diffuse_OC: yes # organic carbon -diffuse_Rn: yes # radon -diffuse_CH4: yes # methane -diffuse_SC: yes # stratospheric chemistry -diffuse_XX: yes # generic tracer -diffuse_PC: yes # parameterized chemistry (GEOS-5) -diffuse_GMI: yes # GMI chemistry (GEOS-5) -diffuse_OCS: yes # ACHEM chemistry (OCS) -diffuse_NI: yes # Nitrate -diffuse_TR: yes # passive tracers diff --git a/CARMAchem_GridComp/CARMAchem_Registry.rc b/CARMAchem_GridComp/CARMAchem_Registry.rc deleted file mode 100644 index ae3828d0..00000000 --- a/CARMAchem_GridComp/CARMAchem_Registry.rc +++ /dev/null @@ -1,483 +0,0 @@ -# -# This the CARMA Grid Component Registry. -# We use a single registry to define the particular instantiation -# of CARMA, as well as to define Import, Internal, and Export -# states -# -# !REVISION HISTORY: -# 16Aug2006 da Silva First Version -# 1Feb2007 Kouatchou Population of specs -# 29Mar2007 Nielsen Name validation, inclusion for GEOS-5 -# 18Nov2009 Colarco First Crack -# 23Nov2009 Colarco Add Control elements to registry -# 16May2019 Case Addition of STS/HNO3 options -# -# ----------------------------------------------------------------- - -# CARMA dimensioning parameters -NBIN: 22 -NGROUP: 1 -NELEM: 1 -NSOLUTE: 0 -NGAS: 0 -NWAVE: 0 - -# PARTICLES -# --------- -# GROUPS: Define the aerosol groups (must be at least NGROUP entries) -# GROUPNAME = name -# RMRAT = ratio of mass of bin i+1 to bin i -# RMIN = central radius [cm] of smallest bin -# ISHAPE = shape type: 1 (Sphere), 2 (Hexagon), 3 (Cylinder) -# ESHAPE = aspect ratio of particle: 1.0 (spherical) -# if CYLINDER, << 1 for disks, >> 1 for needles -# FSCAV = convective scavenging efficiency (fraction km-1) -- deprecated -# IRHSWELL = humidifcation type for fall/optics: 0 (I_NO_SWELLING), 1 (I_FITZGERALD), -# 2 (I_GERBER), 3 (I_WTPCT_H2SO4), -# 4 (I_WTPCT_STS) -# IRHSWCOMP = composition swelling flag -GROUPNAME: dust seasalt smoke -RMRAT: 2.2587828 2.2587828 2.2587828 -RMIN: 5.e-06 5.e-06 5.e-06 -ISHAPE: 1 1 1 -ESHAPE: 1. 1. 1. -FSCAV: 0.4 0.4 0.4 -IRHSWELL: 0 2 0 -IRHSWCOMP: 0 12 0 - -# ELEMENTS: Define the aerosol elements (must be at least NELEM entries) -# IGROUP = group (above) the element maps to -# RHOP = elements density [g cm-3] -# ELEMNAME = name of element -# ITYPE = element type: 1 (I_INVOLATILE), 2 (I_VOLATILE), 3 (I_COREMASS) -# 4 (I_VOLCORE), 5 (I_CORE2MOM) -# ICOMPOSITION = -IGROUP: 1 2 3 -RHOP: 2.65 2.20 1.35 -ELEMNAME: pc pc pc -ITYPE: 1 1 1 -ICOMPOSITION: 1 2 3 - -# GASES -# ----- -# Define the gas properties (must be at least NGAS entries) -# GASNAME = name -# IGCOMP = gas composition: 1 (I_GCOMP_H2O), 2 (I_GCOMP_H2SO4), 3 (I_GCOMP_SO2), -# 4 (I_GCOMP_HNO3) -# IGVAPREQ = vapor pressure equation: -1 (I_VAPRTN_NULL), 1 (I_VAPRTN_H2O_BUCK1981), -# 2 (I_VAPRTN_H2O_MURPHY2005), 3 (I_VAPRTN_H2O_GOFF1946), -# 4 (I_VAPRTN_H2SO4_AYERS1980) -GASNAME: H2O H2SO4 HNO3 -IGCOMP: 1 2 4 -IGVAPREQ: 2 4 -1 - - -# Microphysical process control -# Logical (0 or 1) -DO_COAG: 0 -DO_GROW: 0 -DO_SUBSTEP: 0 -DO_THERMO: 0 -DO_VDIFF: 0 -DO_VTRAN: 1 -DO_FIXEDINIT:1 - -# Substepping and vfall (configured for sulfate case for now) -VF_CONST: 0. -MINSUBSTEPS: 1 -MAXSUBSTEPS: 32 -MAXRETRIES: 16 -CONMAX: 0.1 - -# Species specific parameters (input files, size distribution, other conditions) -# DUST -# Point-wise dust source -point_emissions_srcfilen_dust: /dev/null -dust_emissions_fudgefactor: 2.e-4 - -# SEA SALT -seasalt_emissions_fudgefactor: 1.4 - -# BLACK CARBON - -# SMOKE -organic_matter_to_organic_carbon_ratio: 1.8 -fraction_terpene_to_organic_carbon: 0.1 - -#SULFATE - -# Point-wise sulfate source -point_emissions_srcfilen_sulfate: /dev/null - -# Monochromatic (diagnostic) optical properties - n_channels: 4 - n_moments: 0 - r_channels: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 - filename_optical_properties_DU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_DU.v15.nbin=22.nc - filename_optical_properties_SS: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SS.v3_3.nbin=22.nc - filename_optical_properties_BC: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - filename_optical_properties_SM: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SM.v1.nbin=22.nc - filename_optical_properties_SU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - -# Band optical properties -# Current is a place holder...need CARMA tables for RRTMG, these are just -# GOCART tables made to cause code not to crash (although it will if CARMA is -# AeroProvider) - NUM_BANDS: 30 - DU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SS_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - OC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BRC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - NI_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - -# The following code is the initial registry - COMP_NAME: CARMA - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - ZLE | m | xyz | E | | | | | | Layer interface geopot height - PLE | Pa | xyz | E | | | | | | Layer interface pressure - TROPP | Pa | xy | | | | | | | Tropopause pressure (blended estimate) - Q | kg kg-1 | xyz | C | | | | | | Specific Humidity - RH2 | 1 | xyz | C | | | | | | Relative Humidity after Moist - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - USTAR | m s-1 | xy | | | | | | | Friction Speed - U10M | m s-1 | xy | | | | | | | E/W 10-meter wind speed - V10M | m s-1 | xy | | | | | | | N/S 10-meter wind speed - ZPBL | m | xy | | | | | | | PBL Height - Z0H | m | xy | | | | | | | Roughness Length for Heat - SH | W m-2 | xy | | | | | | | Sensible Heat Flux - NCN_PRCP | kg m-2 s-1 | xy | | | | | | | Non-convective Precipitation - CN_PRCP | kg m-2 s-1 | xy | | | | | | | Surface Conv. rain flux needed by land - LWI | 1 | xy | | | | | | | Land Ocean Ice Mask - FROCEAN | 1 | xy | | | | | | | Ocean fraction - FRLAKE | 1 | xy | | | | | | | Lake fraction - FRLAND | 1 | xy | | | | | | | Land fraction - FRACI | 1 | xy | | | | | | | Ice fraction - WET1 | 1 | xy | | | | | | | Surface Soil Wetness - AREA | m2 | xy | | | | | | | agrid_cell_area - CNV_MFD | kg m-2 s-1 | xyz | C | | | | | | detraining_mass_flux - CNV_MFC | kg m-2 s-1 | xyz | E | | | | | | cumulative_mass_flux - CNV_QC | kg kg-1 | xyz | C | | | | | | grid_mean_convective_condensate - U | m s-1 | xyz | C | | | | | | Eastward (E/W) wind - V | m s-1 | xyz | C | | | | | | Northward (N/S) wind - PFI_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of ice nonconvective precipitation - PFL_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of liquid nonconvective precipitation -# Aerosol source functions - CARMA_DU_SRC | 1 | xy | | | | | | | dust source efficiency - CARMA_SM_BIOMASS | 1 | xy | | | | | | | smoke biomass burning - CARMA_SM_BIOFUEL | 1 | xy | | | | | | | smoke biofuel - CARMA_SM_ANTEOC1 | 1 | xy | | | | | | | smoke anthro (1) - CARMA_SM_ANTEOC2 | 1 | xy | | | | | | | smoke anthro (2) - CARMA_SM_SHIP | 1 | xy | | | | | | | smoke ship - CARMA_OC_TERPENE | kg m-2 s-1 | xy | | | | | | | monoterpene emissions - CARMA_PSOA_ANTHRO_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production anthropogenic VOC - CARMA_PSOA_BIOB_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production biomass burning VOC - CARMA_PSO4TOT | kg m-2 s-1 | xyz | C | | | | | | so4- production from chemistry - CARMA_HNO3 | mol mol-1 | xyz | C | | | | | | nitric acid - CARMA_H2SO4 | mol mol-1 | xyz | C | | | | | | sulfuric acid -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column -# 3) RO = Alkoxy radical, RO2 = Organic peroxy radical - - -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- - - - -# ------------ -# Export State -# ------------ - - -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - CARMA_DUEM | kg m-2 s-1 | xy | | | | | | | Dust emission flux - CARMA_DUDP | kg m-2 s-1 | xy | | | | | | | Dust deposition flux - CARMA_DUSD | kg m-2 s-1 | xy | | | | | | | Dust sedimentation flux - CARMA_DUWT | kg m-2 s-1 | xy | | | | | | | Dust wet-deposition flux - CARMA_DUSV | kg m-2 s-1 | xy | | | | | | | Dust convective scavenging flux - CARMA_DUCMASS | kg m-2 | xy | | | | | | | Dust column burden - CARMA_DUSMASS | kg m-3 | xy | | | | | | | Dust surface mass concentration - CARMA_DUEXTTAU | 1 | xy | | | | | | | Dust 550-nm extinction AOT - CARMA_DUSCATAU | 1 | xy | | | | | | | Dust 550-nm scattering AOT - CARMA_DUANGSTR | 1 | xy | | | | | | | Dust 470-870 nm Angstrom parameter - CARMA_DUFLUXU | kg m-1 s-1 | xy | | | | | | | Dust column u-wind mass flux - CARMA_DUFLUXV | kg m-1 s-1 | xy | | | | | | | Dust column v-wind mass flux - CARMA_DUMASS | kg kg-1 | xyz | C | | | | | | Dust Mass Mixing Ratio - CARMA_DUCONC | kg m-3 | xyz | C | | | | | | Dust Mass Concentration - CARMA_DUSAREA | m-2 m-3 | xyz | C | | | | | | Dust Total Surace Area Density - CARMA_DUNUMD | m-3 | xyz | C | | | | | | Dust Total Number Density - CARMA_DUREFF | m | xyz | C | | | | | | Dust Particle Effective Radius - CARMA_MXDUEM | kg m-2 s-1 | xy | | | | | | | Mixed Dust emission flux - CARMA_MXDUDP | kg m-2 s-1 | xy | | | | | | | Mixed Dust deposition flux - CARMA_MXDUSD | kg m-2 s-1 | xy | | | | | | | Mixed Dust sedimentation flux - CARMA_MXDUWT | kg m-2 s-1 | xy | | | | | | | Mixed Dust wet-deposition flux - CARMA_MXDUSV | kg m-2 s-1 | xy | | | | | | | Mixed Dust convective scavenging flux - CARMA_MXDUCMASS | kg m-2 | xy | | | | | | | Mixed Dust column burden - CARMA_MXDUSMASS | kg m-3 | xy | | | | | | | Mixed Dust surface mass concentration - CARMA_MXDUEXTTAU | 1 | xy | | | | | | | Mixed Dust 550-nm extinction AOT - CARMA_MXDUSCATAU | 1 | xy | | | | | | | Mixed Dust 550-nm scattering AOT - CARMA_MXDUANGSTR | 1 | xy | | | | | | | Mixed Dust 470-870 nm Angstrom parameter - CARMA_MXDUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Dust column u-wind mass flux - CARMA_MXDUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Dust column v-wind mass flux - CARMA_MXDUMASS | kg kg-1 | xyz | C | | | | | | Mixed Dust Mass Mixing Ratio - CARMA_MXDUCONC | kg m-3 | xyz | C | | | | | | Mixed Dust Mass Concentration - CARMA_ASHEM | kg m-2 s-1 | xy | | | | | | | Ash emission flux - CARMA_ASHDP | kg m-2 s-1 | xy | | | | | | | Ash deposition flux - CARMA_ASHSD | kg m-2 s-1 | xy | | | | | | | Ash sedimentation flux - CARMA_ASHWT | kg m-2 s-1 | xy | | | | | | | Ash wet-deposition flux - CARMA_ASHSV | kg m-2 s-1 | xy | | | | | | | Ash convective scavenging flux - CARMA_ASHCMASS | kg m-2 | xy | | | | | | | Ash column burden - CARMA_ASHSMASS | kg m-3 | xy | | | | | | | Ash surface mass concentration - CARMA_ASHEXTTAU | 1 | xy | | | | | | | Ash 550-nm extinction AOT - CARMA_ASHSCATAU | 1 | xy | | | | | | | Ash 550-nm scattering AOT - CARMA_ASHANGSTR | 1 | xy | | | | | | | Ash 470-870 nm Angstrom parameter - CARMA_ASHFLUXU | kg m-1 s-1 | xy | | | | | | | Ash column u-wind mass flux - CARMA_ASHFLUXV | kg m-1 s-1 | xy | | | | | | | Ash column v-wind mass flux - CARMA_ASHMASS | kg kg-1 | xyz | C | | | | | | Ash Mass Mixing Ratio - CARMA_ASHCONC | kg m-3 | xyz | C | | | | | | Ash Mass Concentration - CARMA_ASHSAREA | m-2 m-3 | xyz | C | | | | | | Ash Total Surace Area Density - CARMA_ASHNUMD | m-3 | xyz | C | | | | | | Ash Total Number Density - CARMA_ASHREFF | m | xyz | C | | | | | | Ash Particle Effective Radius - CARMA_MXASHEM | kg m-2 s-1 | xy | | | | | | | Mixed Ash emission flux - CARMA_MXASHDP | kg m-2 s-1 | xy | | | | | | | Mixed Ash deposition flux - CARMA_MXASHSD | kg m-2 s-1 | xy | | | | | | | Mixed Ash sedimentation flux - CARMA_MXASHWT | kg m-2 s-1 | xy | | | | | | | Mixed Ash wet-deposition flux - CARMA_MXASHSV | kg m-2 s-1 | xy | | | | | | | Mixed Ash convective scavenging flux - CARMA_MXASHCMASS | kg m-2 | xy | | | | | | | Mixed Ash column burden - CARMA_MXASHSMASS | kg m-3 | xy | | | | | | | Mixed Ash surface mass concentration - CARMA_MXASHEXTTAU | 1 | xy | | | | | | | Mixed Ash 550-nm extinction AOT - CARMA_MXASHSCATAU | 1 | xy | | | | | | | Mixed Ash 550-nm scattering AOT - CARMA_MXASHANGSTR | 1 | xy | | | | | | | Mixed Ash 470-870 nm Angstrom parameter - CARMA_MXASHFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Ash column u-wind mass flux - CARMA_MXASHFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Ash column v-wind mass flux - CARMA_MXASHMASS | kg kg-1 | xyz | C | | | | | | Mixed Ash Mass Mixing Ratio - CARMA_MXASHCONC | kg m-3 | xyz | C | | | | | | Mixed Ash Mass Concentration - CARMA_SSEM | kg m-2 s-1 | xy | | | | | | | Seasalt emission flux - CARMA_SSDP | kg m-2 s-1 | xy | | | | | | | Seasalt deposition flux - CARMA_SSSD | kg m-2 s-1 | xy | | | | | | | Seasalt sedimentation flux - CARMA_SSWT | kg m-2 s-1 | xy | | | | | | | Seasalt wet-deposition flux - CARMA_SSSV | kg m-2 s-1 | xy | | | | | | | Seasalt convective scavenging flux - CARMA_SSCMASS | kg m-2 | xy | | | | | | | Seasalt column burden - CARMA_SSSMASS | kg m-3 | xy | | | | | | | Seasalt surface mass concentration - CARMA_SSEXTTAU | 1 | xy | | | | | | | Seasalt 550-nm extinction AOT - CARMA_SSSCATAU | 1 | xy | | | | | | | Seasalt 550-nm scattering AOT - CARMA_SSANGSTR | 1 | xy | | | | | | | Seasalt 470-870 nm Angstrom parameter - CARMA_SSFLUXU | kg m-1 s-1 | xy | | | | | | | Seasalt column u-wind mass flux - CARMA_SSFLUXV | kg m-1 s-1 | xy | | | | | | | Seasalt column v-wind mass flux - CARMA_SSMASS | kg kg-1 | xyz | C | | | | | | Seasalt Mass Mixing Ratio - CARMA_SSCONC | kg m-3 | xyz | C | | | | | | Seasalt Mass Concentration - CARMA_SSSAREA | m-2 m-3 | xyz | C | | | | | | Seasalt Total Surace Area Density - CARMA_SSNUMD | m-3 | xyz | C | | | | | | Seasalt Total Number Density - CARMA_SSREFF | m | xyz | C | | | | | | Seasalt Particle Effective Radius - CARMA_MXSSEM | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt emission flux - CARMA_MXSSDP | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt deposition flux - CARMA_MXSSSD | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt sedimentation flux - CARMA_MXSSWT | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt wet-deposition flux - CARMA_MXSSSV | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt convective scavenging flux - CARMA_MXSSCMASS | kg m-2 | xy | | | | | | | Mixed Seasalt column burden - CARMA_MXSSSMASS | kg m-3 | xy | | | | | | | Mixed Seasalt surface mass concentration - CARMA_MXSSEXTTAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm extinction AOT - CARMA_MXSSSCATAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm scattering AOT - CARMA_MXSSANGSTR | 1 | xy | | | | | | | Mixed Seasalt 470-870 nm Angstrom parameter - CARMA_MXSSFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column u-wind mass flux - CARMA_MXSSFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column v-wind mass flux - CARMA_MXSSMASS | kg kg-1 | xyz | C | | | | | | Mixed Seasalt Mass Mixing Ratio - CARMA_MXSSCONC | kg m-3 | xyz | C | | | | | | Mixed Seasalt Mass Concentration - CARMA_SUDP | kg m-2 s-1 | xy | | | | | | | Sulfate deposition flux - CARMA_SUSD | kg m-2 s-1 | xy | | | | | | | Sulfate sedimentation flux - CARMA_SUWT | kg m-2 s-1 | xy | | | | | | | Sulfate wet-deposition flux - CARMA_SUSV | kg m-2 s-1 | xy | | | | | | | Sulfate convective scavenging flux - CARMA_SUCMASS | kg m-2 | xy | | | | | | | Sulfate column burden - CARMA_SUSMASS | kg m-3 | xy | | | | | | | Sulfate surface mass concentration - CARMA_SUEXTTAU | 1 | xy | | | | | | | Sulfate 550-nm extinction AOT - CARMA_SUSCATAU | 1 | xy | | | | | | | Sulfate 550-nm scattering AOT - CARMA_SUSTRATEXTTAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm extinction AOT - CARMA_SUSTRATSCATAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm scattering AOT - CARMA_SUANGSTR | 1 | xy | | | | | | | Sulfate 470-870 nm Angstrom parameter - CARMA_SUFLUXU | kg m-1 s-1 | xy | | | | | | | Sulfate column u-wind mass flux - CARMA_SUFLUXV | kg m-1 s-1 | xy | | | | | | | Sulfate column v-wind mass flux - CARMA_SUMASS | kg kg-1 | xyz | C | | | | | | Sulfate Mass Mixing Ratio - CARMA_SUCONC | kg m-3 | xyz | C | | | | | | Sulfate Mass Concentration - CARMA_SUNUC | m-3 s-1 | xyz | C | | | | | | Sulfate Total Nucleation Rate - CARMA_SUSAREA | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density - CARMA_SUSAREAv | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density (zeroed volcanic) - CARMA_SUNUMD | m-3 | xyz | C | | | | | | Sulfate Total Number Density - CARMA_SUREFF | m | xyz | C | | | | | | Sulfate Particle Effective Radius - CARMA_H2SO4CMASS | kg m-2 | xy | | | | | | | Sulfuric Acid vapor column burden - CARMA_MXSAREA | m-2 m-3 | xyz | C | | | | | | Mixed Group Total Surace Area Density - CARMA_MXNUMD | m-3 | xyz | C | | | | | | Mixed Group Total Number Density - CARMA_MXREFF | m | xyz | C | | | | | | Mixed Group Particle Effective Radius - CARMA_MXSUDP | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate deposition flux - CARMA_MXSUSD | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate sedimentation flux - CARMA_MXSUWT | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate wet-deposition flux - CARMA_MXSUSV | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate convective scavenging flux - CARMA_MXSUCMASS | kg m-2 | xy | | | | | | | Mixed Sulfate column burden - CARMA_MXSUSMASS | kg m-3 | xy | | | | | | | Mixed Sulfate surface mass concentration - CARMA_MXSUEXTTAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm extinction AOT - CARMA_MXSUSCATAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm scattering AOT - CARMA_MXSUANGSTR | 1 | xy | | | | | | | Mixed Sulfate 470-870 nm Angstrom parameter - CARMA_MXSUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column u-wind mass flux - CARMA_MXSUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column v-wind mass flux - CARMA_MXSUMASS | kg kg-1 | xyz | C | | | | | | Mixed Sulfate Mass Mixing Ratio - CARMA_MXSUCONC | kg m-3 | xyz | C | | | | | | Mixed Sulfate Mass Concentration - CARMA_SMEM | kg m-2 s-1 | xy | | | | | | | Smoke emission flux - CARMA_SMDP | kg m-2 s-1 | xy | | | | | | | Smoke deposition flux - CARMA_SMSD | kg m-2 s-1 | xy | | | | | | | Smoke sedimentation flux - CARMA_SMWT | kg m-2 s-1 | xy | | | | | | | Smoke wet-deposition flux - CARMA_SMSV | kg m-2 s-1 | xy | | | | | | | Smoke convective scavenging flux - CARMA_SMCMASS | kg m-2 | xy | | | | | | | Smoke column burden - CARMA_SMSMASS | kg m-3 | xy | | | | | | | Smoke surface mass concentration - CARMA_SMEXTTAU | 1 | xy | | | | | | | Smoke 550-nm extinction AOT - CARMA_SMSCATAU | 1 | xy | | | | | | | Smoke 550-nm scattering AOT - CARMA_SMANGSTR | 1 | xy | | | | | | | Smoke 470-870 nm Angstrom parameter - CARMA_SMFLUXU | kg m-1 s-1 | xy | | | | | | | Smoke column u-wind mass flux - CARMA_SMFLUXV | kg m-1 s-1 | xy | | | | | | | Smoke column v-wind mass flux - CARMA_SMMASS | kg kg-1 | xyz | C | | | | | | Smoke Mass Mixing Ratio - CARMA_SMCONC | kg m-3 | xyz | C | | | | | | Smoke Mass Concentration - CARMA_SMSAREA | m-2 m-3 | xyz | C | | | | | | Smoke Total Surace Area Density - CARMA_SMNUMD | m-3 | xyz | C | | | | | | Smoke Total Number Density - CARMA_SMREFF | m | xyz | C | | | | | | Smoke Particle Effective Radius - CARMA_MXSMEM | kg m-2 s-1 | xy | | | | | | | Mixed Smoke emission flux - CARMA_MXSMDP | kg m-2 s-1 | xy | | | | | | | Mixed Smoke deposition flux - CARMA_MXSMSD | kg m-2 s-1 | xy | | | | | | | Mixed Smoke sedimentation flux - CARMA_MXSMWT | kg m-2 s-1 | xy | | | | | | | Mixed Smoke wet-deposition flux - CARMA_MXSMSV | kg m-2 s-1 | xy | | | | | | | Mixed Smoke convective scavenging flux - CARMA_MXSMCMASS | kg m-2 | xy | | | | | | | Mixed Smoke column burden - CARMA_MXSMSMASS | kg m-3 | xy | | | | | | | Mixed Smoke surface mass concentration - CARMA_MXSMEXTTAU | 1 | xy | | | | | | | Mixed Smoke 550-nm extinction AOT - CARMA_MXSMSCATAU | 1 | xy | | | | | | | Mixed Smoke 550-nm scattering AOT - CARMA_MXSMANGSTR | 1 | xy | | | | | | | Mixed Smoke 470-870 nm Angstrom parameter - CARMA_MXSMFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column u-wind mass flux - CARMA_MXSMFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column v-wind mass flux - CARMA_MXSMMASS | kg kg-1 | xyz | C | | | | | | Mixed Smoke Mass Mixing Ratio - CARMA_MXSMCONC | kg m-3 | xyz | C | | | | | | Mixed Smoke Mass Concentration - CARMA_BCEM | kg m-2 s-1 | xy | | | | | | | Black Carbon emission flux - CARMA_BCDP | kg m-2 s-1 | xy | | | | | | | Black Carbon deposition flux - CARMA_BCSD | kg m-2 s-1 | xy | | | | | | | Black Carbon sedimentation flux - CARMA_BCWT | kg m-2 s-1 | xy | | | | | | | Black Carbon wet-deposition flux - CARMA_BCSV | kg m-2 s-1 | xy | | | | | | | Black Carbon convective scavenging flux - CARMA_BCCMASS | kg m-2 | xy | | | | | | | Black Carbon column burden - CARMA_BCSMASS | kg m-3 | xy | | | | | | | Black Carbon surface mass concentration - CARMA_BCEXTTAU | 1 | xy | | | | | | | Black Carbon 550-nm extinction AOT - CARMA_BCSCATAU | 1 | xy | | | | | | | Black Carbon 550-nm scattering AOT - CARMA_BCANGSTR | 1 | xy | | | | | | | Black Carbon 470-870 nm Angstrom parameter - CARMA_BCFLUXU | kg m-1 s-1 | xy | | | | | | | Black Carbon column u-wind mass flux - CARMA_BCFLUXV | kg m-1 s-1 | xy | | | | | | | Black Carbon column v-wind mass flux - CARMA_BCMASS | kg kg-1 | xyz | C | | | | | | Black Carbon Mass Mixing Ratio - CARMA_BCCONC | kg m-3 | xyz | C | | | | | | Black Carbon Mass Concentration - CARMA_MXBCEM | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon emission flux - CARMA_MXBCDP | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon deposition flux - CARMA_MXBCSD | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon sedimentation flux - CARMA_MXBCWT | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon wet-deposition flux - CARMA_MXBCSV | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon convective scavenging flux - CARMA_MXBCCMASS | kg m-2 | xy | | | | | | | Mixed Black Carbon column burden - CARMA_MXBCSMASS | kg m-3 | xy | | | | | | | Mixed Black Carbon surface mass concentration - CARMA_MXBCEXTTAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm extinction AOT - CARMA_MXBCSCATAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm scattering AOT - CARMA_MXBCANGSTR | 1 | xy | | | | | | | Mixed Black Carbon 470-870 nm Angstrom parameter - CARMA_MXBCFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column u-wind mass flux - CARMA_MXBCFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column v-wind mass flux - CARMA_MXBCMASS | kg kg-1 | xyz | C | | | | | | Mixed Black Carbon Mass Mixing Ratio - CARMA_MXBCCONC | kg m-3 | xyz | C | | | | | | Mixed Black Carbon Mass Concentration - CARMA_TOTEXTTAU | 1 | xy | | | | | | | Total 550-nm extinction AOT - CARMA_TOTSCATAU | 1 | xy | | | | | | | Total 550-nm scattering AOT - CARMA_TOTANGSTR | 1 | xy | | | | | | | Total 470-870 nm Angstrom parameter - CARMA_DUEXTCOEF | m-1 | xyz | C | | | | | | Dust 550 nm extinction coefficient - CARMA_DUSCACOEF | m-1 | xyz | C | | | | | | Dust 550 nm scattering coefficient - CARMA_BCEXTCOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm extinction coefficient - CARMA_BCSCACOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm scattering coefficient - CARMA_SSEXTCOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm extinction coefficient - CARMA_SSSCACOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm scattering coefficient - CARMA_SMEXTCOEF | m-1 | xyz | C | | | | | | Smoke 550 nm extinction coefficient - CARMA_SMSCACOEF | m-1 | xyz | C | | | | | | Smoke 550 nm scattering coefficient - CARMA_SUEXTCOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm extinction coefficient - CARMA_SUSCACOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm scattering coefficient - CARMA_ASHEXTCOEF | m-1 | xyz | C | | | | | | Ash 550 nm extinction coefficient - CARMA_ASHSCACOEF | m-1 | xyz | C | | | | | | Ash 550 nm scattering coefficient - CARMA_SUBSTEPS | 1 | xy | | | | | | | CARMA substeps - CARMA_RETRIES | 1 | xy | | | | | | | CARMA retries - CARMA_ZSUBSTEPS | 1 | xyz | C | | | | | | CARMA substeps per grid box - CARMA_SATH2SO4 | 1 | xyz | C | | | | | | H2SO4 supersaturation - CARMA_SUVF001 | m s-1 | xyz | E | | | | | | SU group vfall bin 001 - CARMA_SUVF002 | m s-1 | xyz | E | | | | | | SU group vfall bin 002 - CARMA_SUVF003 | m s-1 | xyz | E | | | | | | SU group vfall bin 003 - CARMA_SUVF004 | m s-1 | xyz | E | | | | | | SU group vfall bin 004 - CARMA_SUVF005 | m s-1 | xyz | E | | | | | | SU group vfall bin 005 - CARMA_SUVF006 | m s-1 | xyz | E | | | | | | SU group vfall bin 006 - CARMA_SUVF007 | m s-1 | xyz | E | | | | | | SU group vfall bin 007 - CARMA_SUVF008 | m s-1 | xyz | E | | | | | | SU group vfall bin 008 - CARMA_SUVF009 | m s-1 | xyz | E | | | | | | SU group vfall bin 009 - CARMA_SUVF010 | m s-1 | xyz | E | | | | | | SU group vfall bin 010 - CARMA_SUVF011 | m s-1 | xyz | E | | | | | | SU group vfall bin 011 - CARMA_SUVF012 | m s-1 | xyz | E | | | | | | SU group vfall bin 012 - CARMA_SUVF013 | m s-1 | xyz | E | | | | | | SU group vfall bin 013 - CARMA_SUVF014 | m s-1 | xyz | E | | | | | | SU group vfall bin 014 - CARMA_SUVF015 | m s-1 | xyz | E | | | | | | SU group vfall bin 015 - CARMA_SUVF016 | m s-1 | xyz | E | | | | | | SU group vfall bin 016 - CARMA_SUVF017 | m s-1 | xyz | E | | | | | | SU group vfall bin 017 - CARMA_SUVF018 | m s-1 | xyz | E | | | | | | SU group vfall bin 018 - CARMA_SUVF019 | m s-1 | xyz | E | | | | | | SU group vfall bin 019 - CARMA_SUVF020 | m s-1 | xyz | E | | | | | | SU group vfall bin 020 - CARMA_SUVF021 | m s-1 | xyz | E | | | | | | SU group vfall bin 021 - CARMA_SUVF022 | m s-1 | xyz | E | | | | | | SU group vfall bin 022 - CARMA_SUVF023 | m s-1 | xyz | E | | | | | | SU group vfall bin 023 - CARMA_SUVF024 | m s-1 | xyz | E | | | | | | SU group vfall bin 024 - CARMA_MXVF001 | m s-1 | xyz | E | | | | | | MX group vfall bin 001 - CARMA_MXVF002 | m s-1 | xyz | E | | | | | | MX group vfall bin 002 - CARMA_MXVF003 | m s-1 | xyz | E | | | | | | MX group vfall bin 003 - CARMA_MXVF004 | m s-1 | xyz | E | | | | | | MX group vfall bin 004 - CARMA_MXVF005 | m s-1 | xyz | E | | | | | | MX group vfall bin 005 - CARMA_MXVF006 | m s-1 | xyz | E | | | | | | MX group vfall bin 006 - CARMA_MXVF007 | m s-1 | xyz | E | | | | | | MX group vfall bin 007 - CARMA_MXVF008 | m s-1 | xyz | E | | | | | | MX group vfall bin 008 - CARMA_MXVF009 | m s-1 | xyz | E | | | | | | MX group vfall bin 009 - CARMA_MXVF010 | m s-1 | xyz | E | | | | | | MX group vfall bin 010 - CARMA_MXVF011 | m s-1 | xyz | E | | | | | | MX group vfall bin 011 - CARMA_MXVF012 | m s-1 | xyz | E | | | | | | MX group vfall bin 012 - CARMA_MXVF013 | m s-1 | xyz | E | | | | | | MX group vfall bin 013 - CARMA_MXVF014 | m s-1 | xyz | E | | | | | | MX group vfall bin 014 - CARMA_MXVF015 | m s-1 | xyz | E | | | | | | MX group vfall bin 015 - CARMA_MXVF016 | m s-1 | xyz | E | | | | | | MX group vfall bin 016 - CARMA_MXVF017 | m s-1 | xyz | E | | | | | | MX group vfall bin 017 - CARMA_MXVF018 | m s-1 | xyz | E | | | | | | MX group vfall bin 018 - CARMA_MXVF019 | m s-1 | xyz | E | | | | | | MX group vfall bin 019 - CARMA_MXVF020 | m s-1 | xyz | E | | | | | | MX group vfall bin 020 - CARMA_MXVF021 | m s-1 | xyz | E | | | | | | MX group vfall bin 021 - CARMA_MXVF022 | m s-1 | xyz | E | | | | | | MX group vfall bin 022 - CARMA_MXVF023 | m s-1 | xyz | E | | | | | | MX group vfall bin 023 - CARMA_MXVF024 | m s-1 | xyz | E | | | | | | MX group vfall bin 024 -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - - diff --git a/CARMAchem_GridComp/CARMAchem_Registry.rc.MIXED b/CARMAchem_GridComp/CARMAchem_Registry.rc.MIXED deleted file mode 100644 index 6f1154b9..00000000 --- a/CARMAchem_GridComp/CARMAchem_Registry.rc.MIXED +++ /dev/null @@ -1,483 +0,0 @@ -# -# This the CARMA Grid Component Registry. -# We use a single registry to define the particular instantiation -# of CARMA, as well as to define Import, Internal, and Export -# states -# -# !REVISION HISTORY: -# 16Aug2006 da Silva First Version -# 1Feb2007 Kouatchou Population of specs -# 29Mar2007 Nielsen Name validation, inclusion for GEOS-5 -# 18Nov2009 Colarco First Crack -# 23Nov2009 Colarco Add Control elements to registry -# 16May2019 Case Addition of STS/HNO3 options -# -# ----------------------------------------------------------------- - -# CARMA dimensioning parameters -NBIN: 24 -NGROUP: 2 -NELEM: 3 -NSOLUTE: 0 -NGAS: 3 -NWAVE: 0 - -# PARTICLES -# --------- -# GROUPS: Define the aerosol groups (must be at least NGROUP entries) -# GROUPNAME = name -# RMRAT = ratio of mass of bin i+1 to bin i -# RMIN = central radius [cm] of smallest bin -# ISHAPE = shape type: 1 (Sphere), 2 (Hexagon), 3 (Cylinder) -# ESHAPE = aspect ratio of particle: 1.0 (spherical) -# if CYLINDER, << 1 for disks, >> 1 for needles -# FSCAV = convective scavenging efficiency (fraction km-1) -- deprecated -# IRHSWELL = humidifcation type for fall/optics: 0 (I_NO_SWELLING), 1 (I_FITZGERALD), -# 2 (I_GERBER), 3 (I_WTPCT_H2SO4), -# 4 (I_WTPCT_STS) -# IRHSWCOMP = composition swelling flag -GROUPNAME: sulfate mixedp -RMRAT: 3.7515201 2.2587828 -RMIN: 2.6686863e-8 5.e-06 -ISHAPE: 1 1 -ESHAPE: 1. 1. -FSCAV: 0.4 0.4 -IRHSWELL: 3 0 -IRHSWCOMP: 0 0 - -# ELEMENTS: Define the aerosol elements (must be at least NELEM entries) -# IGROUP = group (above) the element maps to -# RHOP = elements density [g cm-3] -# ELEMNAME = name of element -# ITYPE = element type: 1 (I_INVOLATILE), 2 (I_VOLATILE), 3 (I_COREMASS) -# 4 (I_VOLCORE), 5 (I_CORE2MOM) -# ICOMPOSITION = -IGROUP: 1 2 2 2 2 -RHOP: 1.923 1.923 2.65 1.35 2.20 -ELEMNAME: pc sulfate dust smoke seasalt -ITYPE: 2 2 3 3 3 -ICOMPOSITION: 0 0 1 2 3 - -# GASES -# ----- -# Define the gas properties (must be at least NGAS entries) -# GASNAME = name -# IGCOMP = gas composition: 1 (I_GCOMP_H2O), 2 (I_GCOMP_H2SO4), 3 (I_GCOMP_SO2), -# 4 (I_GCOMP_HNO3) -# IGVAPREQ = vapor pressure equation: -1 (I_VAPRTN_NULL), 1 (I_VAPRTN_H2O_BUCK1981), -# 2 (I_VAPRTN_H2O_MURPHY2005), 3 (I_VAPRTN_H2O_GOFF1946), -# 4 (I_VAPRTN_H2SO4_AYERS1980) -GASNAME: H2O H2SO4 HNO3 -IGCOMP: 1 2 4 -IGVAPREQ: 2 4 -1 - - -# Microphysical process control -# Logical (0 or 1) -DO_COAG: 1 -DO_GROW: 1 -DO_SUBSTEP: 1 -DO_THERMO: 1 -DO_VDIFF: 0 -DO_VTRAN: 1 -DO_FIXEDINIT:1 - -# Substepping and vfall (configured for sulfate case for now) -VF_CONST: 0. -MINSUBSTEPS: 1 -MAXSUBSTEPS: 32 -MAXRETRIES: 16 -CONMAX: 0.1 - -# Species specific parameters (input files, size distribution, other conditions) -# DUST -# Point-wise dust source -point_emissions_srcfilen_dust: /dev/null -dust_emissions_fudgefactor: 2.e-4 - -# SEA SALT -seasalt_emissions_fudgefactor: 1.4 - -# BLACK CARBON - -# SMOKE -organic_matter_to_organic_carbon_ratio: 1.8 -fraction_terpene_to_organic_carbon: 0.1 - -#SULFATE - -# Point-wise sulfate source -point_emissions_srcfilen_sulfate: /dev/null - -# Monochromatic (diagnostic) optical properties - n_channels: 4 - n_moments: 0 - r_channels: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 - filename_optical_properties_DU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_DU.v15.nbin=22.nc - filename_optical_properties_SS: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SS.v3_3.nbin=22.nc - filename_optical_properties_BC: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - filename_optical_properties_SM: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SM.v1.nbin=22.nc - filename_optical_properties_SU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - -# Band optical properties -# Current is a place holder...need CARMA tables for RRTMG, these are just -# GOCART tables made to cause code not to crash (although it will if CARMA is -# AeroProvider) - NUM_BANDS: 30 - DU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SS_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - OC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BRC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - NI_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - -# The following code is the initial registry - COMP_NAME: CARMA - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - ZLE | m | xyz | E | | | | | | Layer interface geopot height - PLE | Pa | xyz | E | | | | | | Layer interface pressure - TROPP | Pa | xy | | | | | | | Tropopause pressure (blended estimate) - Q | kg kg-1 | xyz | C | | | | | | Specific Humidity - RH2 | 1 | xyz | C | | | | | | Relative Humidity after Moist - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - USTAR | m s-1 | xy | | | | | | | Friction Speed - U10M | m s-1 | xy | | | | | | | E/W 10-meter wind speed - V10M | m s-1 | xy | | | | | | | N/S 10-meter wind speed - ZPBL | m | xy | | | | | | | PBL Height - Z0H | m | xy | | | | | | | Roughness Length for Heat - SH | W m-2 | xy | | | | | | | Sensible Heat Flux - NCN_PRCP | kg m-2 s-1 | xy | | | | | | | Non-convective Precipitation - CN_PRCP | kg m-2 s-1 | xy | | | | | | | Surface Conv. rain flux needed by land - LWI | 1 | xy | | | | | | | Land Ocean Ice Mask - FROCEAN | 1 | xy | | | | | | | Ocean fraction - FRLAKE | 1 | xy | | | | | | | Lake fraction - FRLAND | 1 | xy | | | | | | | Land fraction - FRACI | 1 | xy | | | | | | | Ice fraction - WET1 | 1 | xy | | | | | | | Surface Soil Wetness - AREA | m2 | xy | | | | | | | agrid_cell_area - CNV_MFD | kg m-2 s-1 | xyz | C | | | | | | detraining_mass_flux - CNV_MFC | kg m-2 s-1 | xyz | E | | | | | | cumulative_mass_flux - CNV_QC | kg kg-1 | xyz | C | | | | | | grid_mean_convective_condensate - U | m s-1 | xyz | C | | | | | | Eastward (E/W) wind - V | m s-1 | xyz | C | | | | | | Northward (N/S) wind - PFI_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of ice nonconvective precipitation - PFL_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of liquid nonconvective precipitation -# Aerosol source functions - CARMA_DU_SRC | 1 | xy | | | | | | | dust source efficiency - CARMA_SM_BIOMASS | 1 | xy | | | | | | | smoke biomass burning - CARMA_SM_BIOFUEL | 1 | xy | | | | | | | smoke biofuel - CARMA_SM_ANTEOC1 | 1 | xy | | | | | | | smoke anthro (1) - CARMA_SM_ANTEOC2 | 1 | xy | | | | | | | smoke anthro (2) - CARMA_SM_SHIP | 1 | xy | | | | | | | smoke ship - CARMA_OC_TERPENE | kg m-2 s-1 | xy | | | | | | | monoterpene emissions - CARMA_PSOA_ANTHRO_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production anthropogenic VOC - CARMA_PSOA_BIOB_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production biomass burning VOC - CARMA_PSO4TOT | kg m-2 s-1 | xyz | C | | | | | | so4- production from chemistry - CARMA_HNO3 | mol mol-1 | xyz | C | | | | | | nitric acid - CARMA_H2SO4 | mol mol-1 | xyz | C | | | | | | sulfuric acid -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column -# 3) RO = Alkoxy radical, RO2 = Organic peroxy radical - - -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- - - - -# ------------ -# Export State -# ------------ - - -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - CARMA_DUEM | kg m-2 s-1 | xy | | | | | | | Dust emission flux - CARMA_DUDP | kg m-2 s-1 | xy | | | | | | | Dust deposition flux - CARMA_DUSD | kg m-2 s-1 | xy | | | | | | | Dust sedimentation flux - CARMA_DUWT | kg m-2 s-1 | xy | | | | | | | Dust wet-deposition flux - CARMA_DUSV | kg m-2 s-1 | xy | | | | | | | Dust convective scavenging flux - CARMA_DUCMASS | kg m-2 | xy | | | | | | | Dust column burden - CARMA_DUSMASS | kg m-3 | xy | | | | | | | Dust surface mass concentration - CARMA_DUEXTTAU | 1 | xy | | | | | | | Dust 550-nm extinction AOT - CARMA_DUSCATAU | 1 | xy | | | | | | | Dust 550-nm scattering AOT - CARMA_DUANGSTR | 1 | xy | | | | | | | Dust 470-870 nm Angstrom parameter - CARMA_DUFLUXU | kg m-1 s-1 | xy | | | | | | | Dust column u-wind mass flux - CARMA_DUFLUXV | kg m-1 s-1 | xy | | | | | | | Dust column v-wind mass flux - CARMA_DUMASS | kg kg-1 | xyz | C | | | | | | Dust Mass Mixing Ratio - CARMA_DUCONC | kg m-3 | xyz | C | | | | | | Dust Mass Concentration - CARMA_DUSAREA | m-2 m-3 | xyz | C | | | | | | Dust Total Surace Area Density - CARMA_DUNUMD | m-3 | xyz | C | | | | | | Dust Total Number Density - CARMA_DUREFF | m | xyz | C | | | | | | Dust Particle Effective Radius - CARMA_MXDUEM | kg m-2 s-1 | xy | | | | | | | Mixed Dust emission flux - CARMA_MXDUDP | kg m-2 s-1 | xy | | | | | | | Mixed Dust deposition flux - CARMA_MXDUSD | kg m-2 s-1 | xy | | | | | | | Mixed Dust sedimentation flux - CARMA_MXDUWT | kg m-2 s-1 | xy | | | | | | | Mixed Dust wet-deposition flux - CARMA_MXDUSV | kg m-2 s-1 | xy | | | | | | | Mixed Dust convective scavenging flux - CARMA_MXDUCMASS | kg m-2 | xy | | | | | | | Mixed Dust column burden - CARMA_MXDUSMASS | kg m-3 | xy | | | | | | | Mixed Dust surface mass concentration - CARMA_MXDUEXTTAU | 1 | xy | | | | | | | Mixed Dust 550-nm extinction AOT - CARMA_MXDUSCATAU | 1 | xy | | | | | | | Mixed Dust 550-nm scattering AOT - CARMA_MXDUANGSTR | 1 | xy | | | | | | | Mixed Dust 470-870 nm Angstrom parameter - CARMA_MXDUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Dust column u-wind mass flux - CARMA_MXDUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Dust column v-wind mass flux - CARMA_MXDUMASS | kg kg-1 | xyz | C | | | | | | Mixed Dust Mass Mixing Ratio - CARMA_MXDUCONC | kg m-3 | xyz | C | | | | | | Mixed Dust Mass Concentration - CARMA_ASHEM | kg m-2 s-1 | xy | | | | | | | Ash emission flux - CARMA_ASHDP | kg m-2 s-1 | xy | | | | | | | Ash deposition flux - CARMA_ASHSD | kg m-2 s-1 | xy | | | | | | | Ash sedimentation flux - CARMA_ASHWT | kg m-2 s-1 | xy | | | | | | | Ash wet-deposition flux - CARMA_ASHSV | kg m-2 s-1 | xy | | | | | | | Ash convective scavenging flux - CARMA_ASHCMASS | kg m-2 | xy | | | | | | | Ash column burden - CARMA_ASHSMASS | kg m-3 | xy | | | | | | | Ash surface mass concentration - CARMA_ASHEXTTAU | 1 | xy | | | | | | | Ash 550-nm extinction AOT - CARMA_ASHSCATAU | 1 | xy | | | | | | | Ash 550-nm scattering AOT - CARMA_ASHANGSTR | 1 | xy | | | | | | | Ash 470-870 nm Angstrom parameter - CARMA_ASHFLUXU | kg m-1 s-1 | xy | | | | | | | Ash column u-wind mass flux - CARMA_ASHFLUXV | kg m-1 s-1 | xy | | | | | | | Ash column v-wind mass flux - CARMA_ASHMASS | kg kg-1 | xyz | C | | | | | | Ash Mass Mixing Ratio - CARMA_ASHCONC | kg m-3 | xyz | C | | | | | | Ash Mass Concentration - CARMA_ASHSAREA | m-2 m-3 | xyz | C | | | | | | Ash Total Surace Area Density - CARMA_ASHNUMD | m-3 | xyz | C | | | | | | Ash Total Number Density - CARMA_ASHREFF | m | xyz | C | | | | | | Ash Particle Effective Radius - CARMA_MXASHEM | kg m-2 s-1 | xy | | | | | | | Mixed Ash emission flux - CARMA_MXASHDP | kg m-2 s-1 | xy | | | | | | | Mixed Ash deposition flux - CARMA_MXASHSD | kg m-2 s-1 | xy | | | | | | | Mixed Ash sedimentation flux - CARMA_MXASHWT | kg m-2 s-1 | xy | | | | | | | Mixed Ash wet-deposition flux - CARMA_MXASHSV | kg m-2 s-1 | xy | | | | | | | Mixed Ash convective scavenging flux - CARMA_MXASHCMASS | kg m-2 | xy | | | | | | | Mixed Ash column burden - CARMA_MXASHSMASS | kg m-3 | xy | | | | | | | Mixed Ash surface mass concentration - CARMA_MXASHEXTTAU | 1 | xy | | | | | | | Mixed Ash 550-nm extinction AOT - CARMA_MXASHSCATAU | 1 | xy | | | | | | | Mixed Ash 550-nm scattering AOT - CARMA_MXASHANGSTR | 1 | xy | | | | | | | Mixed Ash 470-870 nm Angstrom parameter - CARMA_MXASHFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Ash column u-wind mass flux - CARMA_MXASHFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Ash column v-wind mass flux - CARMA_MXASHMASS | kg kg-1 | xyz | C | | | | | | Mixed Ash Mass Mixing Ratio - CARMA_MXASHCONC | kg m-3 | xyz | C | | | | | | Mixed Ash Mass Concentration - CARMA_SSEM | kg m-2 s-1 | xy | | | | | | | Seasalt emission flux - CARMA_SSDP | kg m-2 s-1 | xy | | | | | | | Seasalt deposition flux - CARMA_SSSD | kg m-2 s-1 | xy | | | | | | | Seasalt sedimentation flux - CARMA_SSWT | kg m-2 s-1 | xy | | | | | | | Seasalt wet-deposition flux - CARMA_SSSV | kg m-2 s-1 | xy | | | | | | | Seasalt convective scavenging flux - CARMA_SSCMASS | kg m-2 | xy | | | | | | | Seasalt column burden - CARMA_SSSMASS | kg m-3 | xy | | | | | | | Seasalt surface mass concentration - CARMA_SSEXTTAU | 1 | xy | | | | | | | Seasalt 550-nm extinction AOT - CARMA_SSSCATAU | 1 | xy | | | | | | | Seasalt 550-nm scattering AOT - CARMA_SSANGSTR | 1 | xy | | | | | | | Seasalt 470-870 nm Angstrom parameter - CARMA_SSFLUXU | kg m-1 s-1 | xy | | | | | | | Seasalt column u-wind mass flux - CARMA_SSFLUXV | kg m-1 s-1 | xy | | | | | | | Seasalt column v-wind mass flux - CARMA_SSMASS | kg kg-1 | xyz | C | | | | | | Seasalt Mass Mixing Ratio - CARMA_SSCONC | kg m-3 | xyz | C | | | | | | Seasalt Mass Concentration - CARMA_SSSAREA | m-2 m-3 | xyz | C | | | | | | Seasalt Total Surace Area Density - CARMA_SSNUMD | m-3 | xyz | C | | | | | | Seasalt Total Number Density - CARMA_SSREFF | m | xyz | C | | | | | | Seasalt Particle Effective Radius - CARMA_MXSSEM | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt emission flux - CARMA_MXSSDP | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt deposition flux - CARMA_MXSSSD | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt sedimentation flux - CARMA_MXSSWT | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt wet-deposition flux - CARMA_MXSSSV | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt convective scavenging flux - CARMA_MXSSCMASS | kg m-2 | xy | | | | | | | Mixed Seasalt column burden - CARMA_MXSSSMASS | kg m-3 | xy | | | | | | | Mixed Seasalt surface mass concentration - CARMA_MXSSEXTTAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm extinction AOT - CARMA_MXSSSCATAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm scattering AOT - CARMA_MXSSANGSTR | 1 | xy | | | | | | | Mixed Seasalt 470-870 nm Angstrom parameter - CARMA_MXSSFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column u-wind mass flux - CARMA_MXSSFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column v-wind mass flux - CARMA_MXSSMASS | kg kg-1 | xyz | C | | | | | | Mixed Seasalt Mass Mixing Ratio - CARMA_MXSSCONC | kg m-3 | xyz | C | | | | | | Mixed Seasalt Mass Concentration - CARMA_SUDP | kg m-2 s-1 | xy | | | | | | | Sulfate deposition flux - CARMA_SUSD | kg m-2 s-1 | xy | | | | | | | Sulfate sedimentation flux - CARMA_SUWT | kg m-2 s-1 | xy | | | | | | | Sulfate wet-deposition flux - CARMA_SUSV | kg m-2 s-1 | xy | | | | | | | Sulfate convective scavenging flux - CARMA_SUCMASS | kg m-2 | xy | | | | | | | Sulfate column burden - CARMA_SUSMASS | kg m-3 | xy | | | | | | | Sulfate surface mass concentration - CARMA_SUEXTTAU | 1 | xy | | | | | | | Sulfate 550-nm extinction AOT - CARMA_SUSCATAU | 1 | xy | | | | | | | Sulfate 550-nm scattering AOT - CARMA_SUSTRATEXTTAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm extinction AOT - CARMA_SUSTRATSCATAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm scattering AOT - CARMA_SUANGSTR | 1 | xy | | | | | | | Sulfate 470-870 nm Angstrom parameter - CARMA_SUFLUXU | kg m-1 s-1 | xy | | | | | | | Sulfate column u-wind mass flux - CARMA_SUFLUXV | kg m-1 s-1 | xy | | | | | | | Sulfate column v-wind mass flux - CARMA_SUMASS | kg kg-1 | xyz | C | | | | | | Sulfate Mass Mixing Ratio - CARMA_SUCONC | kg m-3 | xyz | C | | | | | | Sulfate Mass Concentration - CARMA_SUNUC | m-3 s-1 | xyz | C | | | | | | Sulfate Total Nucleation Rate - CARMA_SUSAREA | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density - CARMA_SUSAREAv | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density (zeroed volcanic) - CARMA_SUNUMD | m-3 | xyz | C | | | | | | Sulfate Total Number Density - CARMA_SUREFF | m | xyz | C | | | | | | Sulfate Particle Effective Radius - CARMA_H2SO4CMASS | kg m-2 | xy | | | | | | | Sulfuric Acid vapor column burden - CARMA_MXSAREA | m-2 m-3 | xyz | C | | | | | | Mixed Group Total Surace Area Density - CARMA_MXNUMD | m-3 | xyz | C | | | | | | Mixed Group Total Number Density - CARMA_MXREFF | m | xyz | C | | | | | | Mixed Group Particle Effective Radius - CARMA_MXSUDP | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate deposition flux - CARMA_MXSUSD | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate sedimentation flux - CARMA_MXSUWT | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate wet-deposition flux - CARMA_MXSUSV | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate convective scavenging flux - CARMA_MXSUCMASS | kg m-2 | xy | | | | | | | Mixed Sulfate column burden - CARMA_MXSUSMASS | kg m-3 | xy | | | | | | | Mixed Sulfate surface mass concentration - CARMA_MXSUEXTTAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm extinction AOT - CARMA_MXSUSCATAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm scattering AOT - CARMA_MXSUANGSTR | 1 | xy | | | | | | | Mixed Sulfate 470-870 nm Angstrom parameter - CARMA_MXSUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column u-wind mass flux - CARMA_MXSUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column v-wind mass flux - CARMA_MXSUMASS | kg kg-1 | xyz | C | | | | | | Mixed Sulfate Mass Mixing Ratio - CARMA_MXSUCONC | kg m-3 | xyz | C | | | | | | Mixed Sulfate Mass Concentration - CARMA_SMEM | kg m-2 s-1 | xy | | | | | | | Smoke emission flux - CARMA_SMDP | kg m-2 s-1 | xy | | | | | | | Smoke deposition flux - CARMA_SMSD | kg m-2 s-1 | xy | | | | | | | Smoke sedimentation flux - CARMA_SMWT | kg m-2 s-1 | xy | | | | | | | Smoke wet-deposition flux - CARMA_SMSV | kg m-2 s-1 | xy | | | | | | | Smoke convective scavenging flux - CARMA_SMCMASS | kg m-2 | xy | | | | | | | Smoke column burden - CARMA_SMSMASS | kg m-3 | xy | | | | | | | Smoke surface mass concentration - CARMA_SMEXTTAU | 1 | xy | | | | | | | Smoke 550-nm extinction AOT - CARMA_SMSCATAU | 1 | xy | | | | | | | Smoke 550-nm scattering AOT - CARMA_SMANGSTR | 1 | xy | | | | | | | Smoke 470-870 nm Angstrom parameter - CARMA_SMFLUXU | kg m-1 s-1 | xy | | | | | | | Smoke column u-wind mass flux - CARMA_SMFLUXV | kg m-1 s-1 | xy | | | | | | | Smoke column v-wind mass flux - CARMA_SMMASS | kg kg-1 | xyz | C | | | | | | Smoke Mass Mixing Ratio - CARMA_SMCONC | kg m-3 | xyz | C | | | | | | Smoke Mass Concentration - CARMA_SMSAREA | m-2 m-3 | xyz | C | | | | | | Smoke Total Surace Area Density - CARMA_SMNUMD | m-3 | xyz | C | | | | | | Smoke Total Number Density - CARMA_SMREFF | m | xyz | C | | | | | | Smoke Particle Effective Radius - CARMA_MXSMEM | kg m-2 s-1 | xy | | | | | | | Mixed Smoke emission flux - CARMA_MXSMDP | kg m-2 s-1 | xy | | | | | | | Mixed Smoke deposition flux - CARMA_MXSMSD | kg m-2 s-1 | xy | | | | | | | Mixed Smoke sedimentation flux - CARMA_MXSMWT | kg m-2 s-1 | xy | | | | | | | Mixed Smoke wet-deposition flux - CARMA_MXSMSV | kg m-2 s-1 | xy | | | | | | | Mixed Smoke convective scavenging flux - CARMA_MXSMCMASS | kg m-2 | xy | | | | | | | Mixed Smoke column burden - CARMA_MXSMSMASS | kg m-3 | xy | | | | | | | Mixed Smoke surface mass concentration - CARMA_MXSMEXTTAU | 1 | xy | | | | | | | Mixed Smoke 550-nm extinction AOT - CARMA_MXSMSCATAU | 1 | xy | | | | | | | Mixed Smoke 550-nm scattering AOT - CARMA_MXSMANGSTR | 1 | xy | | | | | | | Mixed Smoke 470-870 nm Angstrom parameter - CARMA_MXSMFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column u-wind mass flux - CARMA_MXSMFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column v-wind mass flux - CARMA_MXSMMASS | kg kg-1 | xyz | C | | | | | | Mixed Smoke Mass Mixing Ratio - CARMA_MXSMCONC | kg m-3 | xyz | C | | | | | | Mixed Smoke Mass Concentration - CARMA_BCEM | kg m-2 s-1 | xy | | | | | | | Black Carbon emission flux - CARMA_BCDP | kg m-2 s-1 | xy | | | | | | | Black Carbon deposition flux - CARMA_BCSD | kg m-2 s-1 | xy | | | | | | | Black Carbon sedimentation flux - CARMA_BCWT | kg m-2 s-1 | xy | | | | | | | Black Carbon wet-deposition flux - CARMA_BCSV | kg m-2 s-1 | xy | | | | | | | Black Carbon convective scavenging flux - CARMA_BCCMASS | kg m-2 | xy | | | | | | | Black Carbon column burden - CARMA_BCSMASS | kg m-3 | xy | | | | | | | Black Carbon surface mass concentration - CARMA_BCEXTTAU | 1 | xy | | | | | | | Black Carbon 550-nm extinction AOT - CARMA_BCSCATAU | 1 | xy | | | | | | | Black Carbon 550-nm scattering AOT - CARMA_BCANGSTR | 1 | xy | | | | | | | Black Carbon 470-870 nm Angstrom parameter - CARMA_BCFLUXU | kg m-1 s-1 | xy | | | | | | | Black Carbon column u-wind mass flux - CARMA_BCFLUXV | kg m-1 s-1 | xy | | | | | | | Black Carbon column v-wind mass flux - CARMA_BCMASS | kg kg-1 | xyz | C | | | | | | Black Carbon Mass Mixing Ratio - CARMA_BCCONC | kg m-3 | xyz | C | | | | | | Black Carbon Mass Concentration - CARMA_MXBCEM | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon emission flux - CARMA_MXBCDP | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon deposition flux - CARMA_MXBCSD | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon sedimentation flux - CARMA_MXBCWT | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon wet-deposition flux - CARMA_MXBCSV | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon convective scavenging flux - CARMA_MXBCCMASS | kg m-2 | xy | | | | | | | Mixed Black Carbon column burden - CARMA_MXBCSMASS | kg m-3 | xy | | | | | | | Mixed Black Carbon surface mass concentration - CARMA_MXBCEXTTAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm extinction AOT - CARMA_MXBCSCATAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm scattering AOT - CARMA_MXBCANGSTR | 1 | xy | | | | | | | Mixed Black Carbon 470-870 nm Angstrom parameter - CARMA_MXBCFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column u-wind mass flux - CARMA_MXBCFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column v-wind mass flux - CARMA_MXBCMASS | kg kg-1 | xyz | C | | | | | | Mixed Black Carbon Mass Mixing Ratio - CARMA_MXBCCONC | kg m-3 | xyz | C | | | | | | Mixed Black Carbon Mass Concentration - CARMA_TOTEXTTAU | 1 | xy | | | | | | | Total 550-nm extinction AOT - CARMA_TOTSCATAU | 1 | xy | | | | | | | Total 550-nm scattering AOT - CARMA_TOTANGSTR | 1 | xy | | | | | | | Total 470-870 nm Angstrom parameter - CARMA_DUEXTCOEF | m-1 | xyz | C | | | | | | Dust 550 nm extinction coefficient - CARMA_DUSCACOEF | m-1 | xyz | C | | | | | | Dust 550 nm scattering coefficient - CARMA_BCEXTCOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm extinction coefficient - CARMA_BCSCACOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm scattering coefficient - CARMA_SSEXTCOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm extinction coefficient - CARMA_SSSCACOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm scattering coefficient - CARMA_SMEXTCOEF | m-1 | xyz | C | | | | | | Smoke 550 nm extinction coefficient - CARMA_SMSCACOEF | m-1 | xyz | C | | | | | | Smoke 550 nm scattering coefficient - CARMA_SUEXTCOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm extinction coefficient - CARMA_SUSCACOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm scattering coefficient - CARMA_ASHEXTCOEF | m-1 | xyz | C | | | | | | Ash 550 nm extinction coefficient - CARMA_ASHSCACOEF | m-1 | xyz | C | | | | | | Ash 550 nm scattering coefficient - CARMA_SUBSTEPS | 1 | xy | | | | | | | CARMA substeps - CARMA_RETRIES | 1 | xy | | | | | | | CARMA retries - CARMA_ZSUBSTEPS | 1 | xyz | C | | | | | | CARMA substeps per grid box - CARMA_SATH2SO4 | 1 | xyz | C | | | | | | H2SO4 supersaturation - CARMA_SUVF001 | m s-1 | xyz | E | | | | | | SU group vfall bin 001 - CARMA_SUVF002 | m s-1 | xyz | E | | | | | | SU group vfall bin 002 - CARMA_SUVF003 | m s-1 | xyz | E | | | | | | SU group vfall bin 003 - CARMA_SUVF004 | m s-1 | xyz | E | | | | | | SU group vfall bin 004 - CARMA_SUVF005 | m s-1 | xyz | E | | | | | | SU group vfall bin 005 - CARMA_SUVF006 | m s-1 | xyz | E | | | | | | SU group vfall bin 006 - CARMA_SUVF007 | m s-1 | xyz | E | | | | | | SU group vfall bin 007 - CARMA_SUVF008 | m s-1 | xyz | E | | | | | | SU group vfall bin 008 - CARMA_SUVF009 | m s-1 | xyz | E | | | | | | SU group vfall bin 009 - CARMA_SUVF010 | m s-1 | xyz | E | | | | | | SU group vfall bin 010 - CARMA_SUVF011 | m s-1 | xyz | E | | | | | | SU group vfall bin 011 - CARMA_SUVF012 | m s-1 | xyz | E | | | | | | SU group vfall bin 012 - CARMA_SUVF013 | m s-1 | xyz | E | | | | | | SU group vfall bin 013 - CARMA_SUVF014 | m s-1 | xyz | E | | | | | | SU group vfall bin 014 - CARMA_SUVF015 | m s-1 | xyz | E | | | | | | SU group vfall bin 015 - CARMA_SUVF016 | m s-1 | xyz | E | | | | | | SU group vfall bin 016 - CARMA_SUVF017 | m s-1 | xyz | E | | | | | | SU group vfall bin 017 - CARMA_SUVF018 | m s-1 | xyz | E | | | | | | SU group vfall bin 018 - CARMA_SUVF019 | m s-1 | xyz | E | | | | | | SU group vfall bin 019 - CARMA_SUVF020 | m s-1 | xyz | E | | | | | | SU group vfall bin 020 - CARMA_SUVF021 | m s-1 | xyz | E | | | | | | SU group vfall bin 021 - CARMA_SUVF022 | m s-1 | xyz | E | | | | | | SU group vfall bin 022 - CARMA_SUVF023 | m s-1 | xyz | E | | | | | | SU group vfall bin 023 - CARMA_SUVF024 | m s-1 | xyz | E | | | | | | SU group vfall bin 024 - CARMA_MXVF001 | m s-1 | xyz | E | | | | | | MX group vfall bin 001 - CARMA_MXVF002 | m s-1 | xyz | E | | | | | | MX group vfall bin 002 - CARMA_MXVF003 | m s-1 | xyz | E | | | | | | MX group vfall bin 003 - CARMA_MXVF004 | m s-1 | xyz | E | | | | | | MX group vfall bin 004 - CARMA_MXVF005 | m s-1 | xyz | E | | | | | | MX group vfall bin 005 - CARMA_MXVF006 | m s-1 | xyz | E | | | | | | MX group vfall bin 006 - CARMA_MXVF007 | m s-1 | xyz | E | | | | | | MX group vfall bin 007 - CARMA_MXVF008 | m s-1 | xyz | E | | | | | | MX group vfall bin 008 - CARMA_MXVF009 | m s-1 | xyz | E | | | | | | MX group vfall bin 009 - CARMA_MXVF010 | m s-1 | xyz | E | | | | | | MX group vfall bin 010 - CARMA_MXVF011 | m s-1 | xyz | E | | | | | | MX group vfall bin 011 - CARMA_MXVF012 | m s-1 | xyz | E | | | | | | MX group vfall bin 012 - CARMA_MXVF013 | m s-1 | xyz | E | | | | | | MX group vfall bin 013 - CARMA_MXVF014 | m s-1 | xyz | E | | | | | | MX group vfall bin 014 - CARMA_MXVF015 | m s-1 | xyz | E | | | | | | MX group vfall bin 015 - CARMA_MXVF016 | m s-1 | xyz | E | | | | | | MX group vfall bin 016 - CARMA_MXVF017 | m s-1 | xyz | E | | | | | | MX group vfall bin 017 - CARMA_MXVF018 | m s-1 | xyz | E | | | | | | MX group vfall bin 018 - CARMA_MXVF019 | m s-1 | xyz | E | | | | | | MX group vfall bin 019 - CARMA_MXVF020 | m s-1 | xyz | E | | | | | | MX group vfall bin 020 - CARMA_MXVF021 | m s-1 | xyz | E | | | | | | MX group vfall bin 021 - CARMA_MXVF022 | m s-1 | xyz | E | | | | | | MX group vfall bin 022 - CARMA_MXVF023 | m s-1 | xyz | E | | | | | | MX group vfall bin 023 - CARMA_MXVF024 | m s-1 | xyz | E | | | | | | MX group vfall bin 024 -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - - diff --git a/CARMAchem_GridComp/CARMAchem_Registry.rc.SU b/CARMAchem_GridComp/CARMAchem_Registry.rc.SU deleted file mode 100644 index 912e541c..00000000 --- a/CARMAchem_GridComp/CARMAchem_Registry.rc.SU +++ /dev/null @@ -1,483 +0,0 @@ -# -# This the CARMA Grid Component Registry. -# We use a single registry to define the particular instantiation -# of CARMA, as well as to define Import, Internal, and Export -# states -# -# !REVISION HISTORY: -# 16Aug2006 da Silva First Version -# 1Feb2007 Kouatchou Population of specs -# 29Mar2007 Nielsen Name validation, inclusion for GEOS-5 -# 18Nov2009 Colarco First Crack -# 23Nov2009 Colarco Add Control elements to registry -# 16May2019 Case Addition of STS/HNO3 options -# -# ----------------------------------------------------------------- - -# CARMA dimensioning parameters -NBIN: 22 -NGROUP: 4 -NELEM: 4 -NSOLUTE: 0 -NGAS: 3 -NWAVE: 0 - -# PARTICLES -# --------- -# GROUPS: Define the aerosol groups (must be at least NGROUP entries) -# GROUPNAME = name -# RMRAT = ratio of mass of bin i+1 to bin i -# RMIN = central radius [cm] of smallest bin -# ISHAPE = shape type: 1 (Sphere), 2 (Hexagon), 3 (Cylinder) -# ESHAPE = aspect ratio of particle: 1.0 (spherical) -# if CYLINDER, << 1 for disks, >> 1 for needles -# FSCAV = convective scavenging efficiency (fraction km-1) -- deprecated -# IRHSWELL = humidifcation type for fall/optics: 0 (I_NO_SWELLING), 1 (I_FITZGERALD), -# 2 (I_GERBER), 3 (I_WTPCT_H2SO4), -# 4 (I_WTPCT_STS) -# IRHSWCOMP = composition swelling flag -GROUPNAME: sulfate dust seasalt smoke -RMRAT: 3.7515201 2.2587828 2.2587828 2.2587828 -RMIN: 2.6686863e-8 5.e-06 5.e-06 5.e-06 -ISHAPE: 1 1 1 1 -ESHAPE: 1. 1. 1. 1. -FSCAV: 0.4 0.4 0.4 0.4 -IRHSWELL: 3 0 2 0 -IRHSWCOMP: 0 0 12 0 - -# ELEMENTS: Define the aerosol elements (must be at least NELEM entries) -# IGROUP = group (above) the element maps to -# RHOP = elements density [g cm-3] -# ELEMNAME = name of element -# ITYPE = element type: 1 (I_INVOLATILE), 2 (I_VOLATILE), 3 (I_COREMASS) -# 4 (I_VOLCORE), 5 (I_CORE2MOM) -# ICOMPOSITION = -IGROUP: 1 2 3 4 -RHOP: 1.923 2.65 2.20 1.35 -ELEMNAME: pc pc pc pc -ITYPE: 2 1 1 1 -ICOMPOSITION: 0 1 2 3 - -# GASES -# ----- -# Define the gas properties (must be at least NGAS entries) -# GASNAME = name -# IGCOMP = gas composition: 1 (I_GCOMP_H2O), 2 (I_GCOMP_H2SO4), 3 (I_GCOMP_SO2), -# 4 (I_GCOMP_HNO3) -# IGVAPREQ = vapor pressure equation: -1 (I_VAPRTN_NULL), 1 (I_VAPRTN_H2O_BUCK1981), -# 2 (I_VAPRTN_H2O_MURPHY2005), 3 (I_VAPRTN_H2O_GOFF1946), -# 4 (I_VAPRTN_H2SO4_AYERS1980) -GASNAME: H2O H2SO4 HNO3 -IGCOMP: 1 2 4 -IGVAPREQ: 2 4 -1 - - -# Microphysical process control -# Logical (0 or 1) -DO_COAG: 1 -DO_GROW: 1 -DO_SUBSTEP: 1 -DO_THERMO: 1 -DO_VDIFF: 0 -DO_VTRAN: 1 -DO_FIXEDINIT:1 - -# Substepping and vfall (configured for sulfate case for now) -VF_CONST: 0. -MINSUBSTEPS: 1 -MAXSUBSTEPS: 32 -MAXRETRIES: 16 -CONMAX: 0.1 - -# Species specific parameters (input files, size distribution, other conditions) -# DUST -# Point-wise dust source -point_emissions_srcfilen_dust: /dev/null -dust_emissions_fudgefactor: 2.e-4 - -# SEA SALT -seasalt_emissions_fudgefactor: 1.4 - -# BLACK CARBON - -# SMOKE -organic_matter_to_organic_carbon_ratio: 1.8 -fraction_terpene_to_organic_carbon: 0.1 - -#SULFATE - -# Point-wise sulfate source -point_emissions_srcfilen_sulfate: /dev/null - -# Monochromatic (diagnostic) optical properties - n_channels: 4 - n_moments: 0 - r_channels: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 - filename_optical_properties_DU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_DU.v15.nbin=22.nc - filename_optical_properties_SS: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SS.v3_3.nbin=22.nc - filename_optical_properties_BC: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - filename_optical_properties_SM: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SM.v1.nbin=22.nc - filename_optical_properties_SU: /discover/nobackup/pcolarco/fvInput/AeroCom/x/carma_optics_SU.v1.nbin=22.nc - -# Band optical properties -# Current is a place holder...need CARMA tables for RRTMG, these are just -# GOCART tables made to cause code not to crash (although it will if CARMA is -# AeroProvider) - NUM_BANDS: 30 - DU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SS_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - SU_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - OC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - BRC_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - NI_OPTICS: ExtData/chemistry/AerosolOptics/v0.0.0/x/opticsBands_DU.v15_3.RRTMG.nc - -# The following code is the initial registry - COMP_NAME: CARMA - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - ZLE | m | xyz | E | | | | | | Layer interface geopot height - PLE | Pa | xyz | E | | | | | | Layer interface pressure - TROPP | Pa | xy | | | | | | | Tropopause pressure (blended estimate) - Q | kg kg-1 | xyz | C | | | | | | Specific Humidity - RH2 | 1 | xyz | C | | | | | | Relative Humidity after Moist - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - USTAR | m s-1 | xy | | | | | | | Friction Speed - U10M | m s-1 | xy | | | | | | | E/W 10-meter wind speed - V10M | m s-1 | xy | | | | | | | N/S 10-meter wind speed - ZPBL | m | xy | | | | | | | PBL Height - Z0H | m | xy | | | | | | | Roughness Length for Heat - SH | W m-2 | xy | | | | | | | Sensible Heat Flux - NCN_PRCP | kg m-2 s-1 | xy | | | | | | | Non-convective Precipitation - CN_PRCP | kg m-2 s-1 | xy | | | | | | | Surface Conv. rain flux needed by land - LWI | 1 | xy | | | | | | | Land Ocean Ice Mask - FROCEAN | 1 | xy | | | | | | | Ocean fraction - FRLAKE | 1 | xy | | | | | | | Lake fraction - FRLAND | 1 | xy | | | | | | | Land fraction - FRACI | 1 | xy | | | | | | | Ice fraction - WET1 | 1 | xy | | | | | | | Surface Soil Wetness - AREA | m2 | xy | | | | | | | agrid_cell_area - CNV_MFD | kg m-2 s-1 | xyz | C | | | | | | detraining_mass_flux - CNV_MFC | kg m-2 s-1 | xyz | E | | | | | | cumulative_mass_flux - CNV_QC | kg kg-1 | xyz | C | | | | | | grid_mean_convective_condensate - U | m s-1 | xyz | C | | | | | | Eastward (E/W) wind - V | m s-1 | xyz | C | | | | | | Northward (N/S) wind - PFI_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of ice nonconvective precipitation - PFL_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of liquid nonconvective precipitation -# Aerosol source functions - CARMA_DU_SRC | 1 | xy | | | | | | | dust source efficiency - CARMA_SM_BIOMASS | 1 | xy | | | | | | | smoke biomass burning - CARMA_SM_BIOFUEL | 1 | xy | | | | | | | smoke biofuel - CARMA_SM_ANTEOC1 | 1 | xy | | | | | | | smoke anthro (1) - CARMA_SM_ANTEOC2 | 1 | xy | | | | | | | smoke anthro (2) - CARMA_SM_SHIP | 1 | xy | | | | | | | smoke ship - CARMA_OC_TERPENE | kg m-2 s-1 | xy | | | | | | | monoterpene emissions - CARMA_PSOA_ANTHRO_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production anthropogenic VOC - CARMA_PSOA_BIOB_VOC | kg m-3 s-1 | xyz | C | | | | | | SOA production biomass burning VOC - CARMA_PSO4TOT | kg m-2 s-1 | xyz | C | | | | | | so4- production from chemistry - CARMA_HNO3 | mol mol-1 | xyz | C | | | | | | nitric acid - CARMA_H2SO4 | mol mol-1 | xyz | C | | | | | | sulfuric acid -# -------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column -# 3) RO = Alkoxy radical, RO2 = Organic peroxy radical - - -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# --------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- - - - -# ------------ -# Export State -# ------------ - - -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - CARMA_DUEM | kg m-2 s-1 | xy | | | | | | | Dust emission flux - CARMA_DUDP | kg m-2 s-1 | xy | | | | | | | Dust deposition flux - CARMA_DUSD | kg m-2 s-1 | xy | | | | | | | Dust sedimentation flux - CARMA_DUWT | kg m-2 s-1 | xy | | | | | | | Dust wet-deposition flux - CARMA_DUSV | kg m-2 s-1 | xy | | | | | | | Dust convective scavenging flux - CARMA_DUCMASS | kg m-2 | xy | | | | | | | Dust column burden - CARMA_DUSMASS | kg m-3 | xy | | | | | | | Dust surface mass concentration - CARMA_DUEXTTAU | 1 | xy | | | | | | | Dust 550-nm extinction AOT - CARMA_DUSCATAU | 1 | xy | | | | | | | Dust 550-nm scattering AOT - CARMA_DUANGSTR | 1 | xy | | | | | | | Dust 470-870 nm Angstrom parameter - CARMA_DUFLUXU | kg m-1 s-1 | xy | | | | | | | Dust column u-wind mass flux - CARMA_DUFLUXV | kg m-1 s-1 | xy | | | | | | | Dust column v-wind mass flux - CARMA_DUMASS | kg kg-1 | xyz | C | | | | | | Dust Mass Mixing Ratio - CARMA_DUCONC | kg m-3 | xyz | C | | | | | | Dust Mass Concentration - CARMA_DUSAREA | m-2 m-3 | xyz | C | | | | | | Dust Total Surace Area Density - CARMA_DUNUMD | m-3 | xyz | C | | | | | | Dust Total Number Density - CARMA_DUREFF | m | xyz | C | | | | | | Dust Particle Effective Radius - CARMA_MXDUEM | kg m-2 s-1 | xy | | | | | | | Mixed Dust emission flux - CARMA_MXDUDP | kg m-2 s-1 | xy | | | | | | | Mixed Dust deposition flux - CARMA_MXDUSD | kg m-2 s-1 | xy | | | | | | | Mixed Dust sedimentation flux - CARMA_MXDUWT | kg m-2 s-1 | xy | | | | | | | Mixed Dust wet-deposition flux - CARMA_MXDUSV | kg m-2 s-1 | xy | | | | | | | Mixed Dust convective scavenging flux - CARMA_MXDUCMASS | kg m-2 | xy | | | | | | | Mixed Dust column burden - CARMA_MXDUSMASS | kg m-3 | xy | | | | | | | Mixed Dust surface mass concentration - CARMA_MXDUEXTTAU | 1 | xy | | | | | | | Mixed Dust 550-nm extinction AOT - CARMA_MXDUSCATAU | 1 | xy | | | | | | | Mixed Dust 550-nm scattering AOT - CARMA_MXDUANGSTR | 1 | xy | | | | | | | Mixed Dust 470-870 nm Angstrom parameter - CARMA_MXDUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Dust column u-wind mass flux - CARMA_MXDUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Dust column v-wind mass flux - CARMA_MXDUMASS | kg kg-1 | xyz | C | | | | | | Mixed Dust Mass Mixing Ratio - CARMA_MXDUCONC | kg m-3 | xyz | C | | | | | | Mixed Dust Mass Concentration - CARMA_ASHEM | kg m-2 s-1 | xy | | | | | | | Ash emission flux - CARMA_ASHDP | kg m-2 s-1 | xy | | | | | | | Ash deposition flux - CARMA_ASHSD | kg m-2 s-1 | xy | | | | | | | Ash sedimentation flux - CARMA_ASHWT | kg m-2 s-1 | xy | | | | | | | Ash wet-deposition flux - CARMA_ASHSV | kg m-2 s-1 | xy | | | | | | | Ash convective scavenging flux - CARMA_ASHCMASS | kg m-2 | xy | | | | | | | Ash column burden - CARMA_ASHSMASS | kg m-3 | xy | | | | | | | Ash surface mass concentration - CARMA_ASHEXTTAU | 1 | xy | | | | | | | Ash 550-nm extinction AOT - CARMA_ASHSCATAU | 1 | xy | | | | | | | Ash 550-nm scattering AOT - CARMA_ASHANGSTR | 1 | xy | | | | | | | Ash 470-870 nm Angstrom parameter - CARMA_ASHFLUXU | kg m-1 s-1 | xy | | | | | | | Ash column u-wind mass flux - CARMA_ASHFLUXV | kg m-1 s-1 | xy | | | | | | | Ash column v-wind mass flux - CARMA_ASHMASS | kg kg-1 | xyz | C | | | | | | Ash Mass Mixing Ratio - CARMA_ASHCONC | kg m-3 | xyz | C | | | | | | Ash Mass Concentration - CARMA_ASHSAREA | m-2 m-3 | xyz | C | | | | | | Ash Total Surace Area Density - CARMA_ASHNUMD | m-3 | xyz | C | | | | | | Ash Total Number Density - CARMA_ASHREFF | m | xyz | C | | | | | | Ash Particle Effective Radius - CARMA_MXASHEM | kg m-2 s-1 | xy | | | | | | | Mixed Ash emission flux - CARMA_MXASHDP | kg m-2 s-1 | xy | | | | | | | Mixed Ash deposition flux - CARMA_MXASHSD | kg m-2 s-1 | xy | | | | | | | Mixed Ash sedimentation flux - CARMA_MXASHWT | kg m-2 s-1 | xy | | | | | | | Mixed Ash wet-deposition flux - CARMA_MXASHSV | kg m-2 s-1 | xy | | | | | | | Mixed Ash convective scavenging flux - CARMA_MXASHCMASS | kg m-2 | xy | | | | | | | Mixed Ash column burden - CARMA_MXASHSMASS | kg m-3 | xy | | | | | | | Mixed Ash surface mass concentration - CARMA_MXASHEXTTAU | 1 | xy | | | | | | | Mixed Ash 550-nm extinction AOT - CARMA_MXASHSCATAU | 1 | xy | | | | | | | Mixed Ash 550-nm scattering AOT - CARMA_MXASHANGSTR | 1 | xy | | | | | | | Mixed Ash 470-870 nm Angstrom parameter - CARMA_MXASHFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Ash column u-wind mass flux - CARMA_MXASHFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Ash column v-wind mass flux - CARMA_MXASHMASS | kg kg-1 | xyz | C | | | | | | Mixed Ash Mass Mixing Ratio - CARMA_MXASHCONC | kg m-3 | xyz | C | | | | | | Mixed Ash Mass Concentration - CARMA_SSEM | kg m-2 s-1 | xy | | | | | | | Seasalt emission flux - CARMA_SSDP | kg m-2 s-1 | xy | | | | | | | Seasalt deposition flux - CARMA_SSSD | kg m-2 s-1 | xy | | | | | | | Seasalt sedimentation flux - CARMA_SSWT | kg m-2 s-1 | xy | | | | | | | Seasalt wet-deposition flux - CARMA_SSSV | kg m-2 s-1 | xy | | | | | | | Seasalt convective scavenging flux - CARMA_SSCMASS | kg m-2 | xy | | | | | | | Seasalt column burden - CARMA_SSSMASS | kg m-3 | xy | | | | | | | Seasalt surface mass concentration - CARMA_SSEXTTAU | 1 | xy | | | | | | | Seasalt 550-nm extinction AOT - CARMA_SSSCATAU | 1 | xy | | | | | | | Seasalt 550-nm scattering AOT - CARMA_SSANGSTR | 1 | xy | | | | | | | Seasalt 470-870 nm Angstrom parameter - CARMA_SSFLUXU | kg m-1 s-1 | xy | | | | | | | Seasalt column u-wind mass flux - CARMA_SSFLUXV | kg m-1 s-1 | xy | | | | | | | Seasalt column v-wind mass flux - CARMA_SSMASS | kg kg-1 | xyz | C | | | | | | Seasalt Mass Mixing Ratio - CARMA_SSCONC | kg m-3 | xyz | C | | | | | | Seasalt Mass Concentration - CARMA_SSSAREA | m-2 m-3 | xyz | C | | | | | | Seasalt Total Surace Area Density - CARMA_SSNUMD | m-3 | xyz | C | | | | | | Seasalt Total Number Density - CARMA_SSREFF | m | xyz | C | | | | | | Seasalt Particle Effective Radius - CARMA_MXSSEM | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt emission flux - CARMA_MXSSDP | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt deposition flux - CARMA_MXSSSD | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt sedimentation flux - CARMA_MXSSWT | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt wet-deposition flux - CARMA_MXSSSV | kg m-2 s-1 | xy | | | | | | | Mixed Seasalt convective scavenging flux - CARMA_MXSSCMASS | kg m-2 | xy | | | | | | | Mixed Seasalt column burden - CARMA_MXSSSMASS | kg m-3 | xy | | | | | | | Mixed Seasalt surface mass concentration - CARMA_MXSSEXTTAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm extinction AOT - CARMA_MXSSSCATAU | 1 | xy | | | | | | | Mixed Seasalt 550-nm scattering AOT - CARMA_MXSSANGSTR | 1 | xy | | | | | | | Mixed Seasalt 470-870 nm Angstrom parameter - CARMA_MXSSFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column u-wind mass flux - CARMA_MXSSFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Seasalt column v-wind mass flux - CARMA_MXSSMASS | kg kg-1 | xyz | C | | | | | | Mixed Seasalt Mass Mixing Ratio - CARMA_MXSSCONC | kg m-3 | xyz | C | | | | | | Mixed Seasalt Mass Concentration - CARMA_SUDP | kg m-2 s-1 | xy | | | | | | | Sulfate deposition flux - CARMA_SUSD | kg m-2 s-1 | xy | | | | | | | Sulfate sedimentation flux - CARMA_SUWT | kg m-2 s-1 | xy | | | | | | | Sulfate wet-deposition flux - CARMA_SUSV | kg m-2 s-1 | xy | | | | | | | Sulfate convective scavenging flux - CARMA_SUCMASS | kg m-2 | xy | | | | | | | Sulfate column burden - CARMA_SUSMASS | kg m-3 | xy | | | | | | | Sulfate surface mass concentration - CARMA_SUEXTTAU | 1 | xy | | | | | | | Sulfate 550-nm extinction AOT - CARMA_SUSCATAU | 1 | xy | | | | | | | Sulfate 550-nm scattering AOT - CARMA_SUSTRATEXTTAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm extinction AOT - CARMA_SUSTRATSCATAU | 1 | xy | | | | | | | Stratospheric Sulfate 550-nm scattering AOT - CARMA_SUANGSTR | 1 | xy | | | | | | | Sulfate 470-870 nm Angstrom parameter - CARMA_SUFLUXU | kg m-1 s-1 | xy | | | | | | | Sulfate column u-wind mass flux - CARMA_SUFLUXV | kg m-1 s-1 | xy | | | | | | | Sulfate column v-wind mass flux - CARMA_SUMASS | kg kg-1 | xyz | C | | | | | | Sulfate Mass Mixing Ratio - CARMA_SUCONC | kg m-3 | xyz | C | | | | | | Sulfate Mass Concentration - CARMA_SUNUC | m-3 s-1 | xyz | C | | | | | | Sulfate Total Nucleation Rate - CARMA_SUSAREA | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density - CARMA_SUSAREAv | m-2 m-3 | xyz | C | | | | | | Sulfate Total Surace Area Density (zeroed volcanic) - CARMA_SUNUMD | m-3 | xyz | C | | | | | | Sulfate Total Number Density - CARMA_SUREFF | m | xyz | C | | | | | | Sulfate Particle Effective Radius - CARMA_H2SO4CMASS | kg m-2 | xy | | | | | | | Sulfuric Acid vapor column burden - CARMA_MXSAREA | m-2 m-3 | xyz | C | | | | | | Mixed Group Total Surace Area Density - CARMA_MXNUMD | m-3 | xyz | C | | | | | | Mixed Group Total Number Density - CARMA_MXREFF | m | xyz | C | | | | | | Mixed Group Particle Effective Radius - CARMA_MXSUDP | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate deposition flux - CARMA_MXSUSD | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate sedimentation flux - CARMA_MXSUWT | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate wet-deposition flux - CARMA_MXSUSV | kg m-2 s-1 | xy | | | | | | | Mixed Sulfate convective scavenging flux - CARMA_MXSUCMASS | kg m-2 | xy | | | | | | | Mixed Sulfate column burden - CARMA_MXSUSMASS | kg m-3 | xy | | | | | | | Mixed Sulfate surface mass concentration - CARMA_MXSUEXTTAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm extinction AOT - CARMA_MXSUSCATAU | 1 | xy | | | | | | | Mixed Sulfate 550-nm scattering AOT - CARMA_MXSUANGSTR | 1 | xy | | | | | | | Mixed Sulfate 470-870 nm Angstrom parameter - CARMA_MXSUFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column u-wind mass flux - CARMA_MXSUFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Sulfate column v-wind mass flux - CARMA_MXSUMASS | kg kg-1 | xyz | C | | | | | | Mixed Sulfate Mass Mixing Ratio - CARMA_MXSUCONC | kg m-3 | xyz | C | | | | | | Mixed Sulfate Mass Concentration - CARMA_SMEM | kg m-2 s-1 | xy | | | | | | | Smoke emission flux - CARMA_SMDP | kg m-2 s-1 | xy | | | | | | | Smoke deposition flux - CARMA_SMSD | kg m-2 s-1 | xy | | | | | | | Smoke sedimentation flux - CARMA_SMWT | kg m-2 s-1 | xy | | | | | | | Smoke wet-deposition flux - CARMA_SMSV | kg m-2 s-1 | xy | | | | | | | Smoke convective scavenging flux - CARMA_SMCMASS | kg m-2 | xy | | | | | | | Smoke column burden - CARMA_SMSMASS | kg m-3 | xy | | | | | | | Smoke surface mass concentration - CARMA_SMEXTTAU | 1 | xy | | | | | | | Smoke 550-nm extinction AOT - CARMA_SMSCATAU | 1 | xy | | | | | | | Smoke 550-nm scattering AOT - CARMA_SMANGSTR | 1 | xy | | | | | | | Smoke 470-870 nm Angstrom parameter - CARMA_SMFLUXU | kg m-1 s-1 | xy | | | | | | | Smoke column u-wind mass flux - CARMA_SMFLUXV | kg m-1 s-1 | xy | | | | | | | Smoke column v-wind mass flux - CARMA_SMMASS | kg kg-1 | xyz | C | | | | | | Smoke Mass Mixing Ratio - CARMA_SMCONC | kg m-3 | xyz | C | | | | | | Smoke Mass Concentration - CARMA_SMSAREA | m-2 m-3 | xyz | C | | | | | | Smoke Total Surace Area Density - CARMA_SMNUMD | m-3 | xyz | C | | | | | | Smoke Total Number Density - CARMA_SMREFF | m | xyz | C | | | | | | Smoke Particle Effective Radius - CARMA_MXSMEM | kg m-2 s-1 | xy | | | | | | | Mixed Smoke emission flux - CARMA_MXSMDP | kg m-2 s-1 | xy | | | | | | | Mixed Smoke deposition flux - CARMA_MXSMSD | kg m-2 s-1 | xy | | | | | | | Mixed Smoke sedimentation flux - CARMA_MXSMWT | kg m-2 s-1 | xy | | | | | | | Mixed Smoke wet-deposition flux - CARMA_MXSMSV | kg m-2 s-1 | xy | | | | | | | Mixed Smoke convective scavenging flux - CARMA_MXSMCMASS | kg m-2 | xy | | | | | | | Mixed Smoke column burden - CARMA_MXSMSMASS | kg m-3 | xy | | | | | | | Mixed Smoke surface mass concentration - CARMA_MXSMEXTTAU | 1 | xy | | | | | | | Mixed Smoke 550-nm extinction AOT - CARMA_MXSMSCATAU | 1 | xy | | | | | | | Mixed Smoke 550-nm scattering AOT - CARMA_MXSMANGSTR | 1 | xy | | | | | | | Mixed Smoke 470-870 nm Angstrom parameter - CARMA_MXSMFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column u-wind mass flux - CARMA_MXSMFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Smoke column v-wind mass flux - CARMA_MXSMMASS | kg kg-1 | xyz | C | | | | | | Mixed Smoke Mass Mixing Ratio - CARMA_MXSMCONC | kg m-3 | xyz | C | | | | | | Mixed Smoke Mass Concentration - CARMA_BCEM | kg m-2 s-1 | xy | | | | | | | Black Carbon emission flux - CARMA_BCDP | kg m-2 s-1 | xy | | | | | | | Black Carbon deposition flux - CARMA_BCSD | kg m-2 s-1 | xy | | | | | | | Black Carbon sedimentation flux - CARMA_BCWT | kg m-2 s-1 | xy | | | | | | | Black Carbon wet-deposition flux - CARMA_BCSV | kg m-2 s-1 | xy | | | | | | | Black Carbon convective scavenging flux - CARMA_BCCMASS | kg m-2 | xy | | | | | | | Black Carbon column burden - CARMA_BCSMASS | kg m-3 | xy | | | | | | | Black Carbon surface mass concentration - CARMA_BCEXTTAU | 1 | xy | | | | | | | Black Carbon 550-nm extinction AOT - CARMA_BCSCATAU | 1 | xy | | | | | | | Black Carbon 550-nm scattering AOT - CARMA_BCANGSTR | 1 | xy | | | | | | | Black Carbon 470-870 nm Angstrom parameter - CARMA_BCFLUXU | kg m-1 s-1 | xy | | | | | | | Black Carbon column u-wind mass flux - CARMA_BCFLUXV | kg m-1 s-1 | xy | | | | | | | Black Carbon column v-wind mass flux - CARMA_BCMASS | kg kg-1 | xyz | C | | | | | | Black Carbon Mass Mixing Ratio - CARMA_BCCONC | kg m-3 | xyz | C | | | | | | Black Carbon Mass Concentration - CARMA_MXBCEM | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon emission flux - CARMA_MXBCDP | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon deposition flux - CARMA_MXBCSD | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon sedimentation flux - CARMA_MXBCWT | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon wet-deposition flux - CARMA_MXBCSV | kg m-2 s-1 | xy | | | | | | | Mixed Black Carbon convective scavenging flux - CARMA_MXBCCMASS | kg m-2 | xy | | | | | | | Mixed Black Carbon column burden - CARMA_MXBCSMASS | kg m-3 | xy | | | | | | | Mixed Black Carbon surface mass concentration - CARMA_MXBCEXTTAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm extinction AOT - CARMA_MXBCSCATAU | 1 | xy | | | | | | | Mixed Black Carbon 550-nm scattering AOT - CARMA_MXBCANGSTR | 1 | xy | | | | | | | Mixed Black Carbon 470-870 nm Angstrom parameter - CARMA_MXBCFLUXU | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column u-wind mass flux - CARMA_MXBCFLUXV | kg m-1 s-1 | xy | | | | | | | Mixed Black Carbon column v-wind mass flux - CARMA_MXBCMASS | kg kg-1 | xyz | C | | | | | | Mixed Black Carbon Mass Mixing Ratio - CARMA_MXBCCONC | kg m-3 | xyz | C | | | | | | Mixed Black Carbon Mass Concentration - CARMA_TOTEXTTAU | 1 | xy | | | | | | | Total 550-nm extinction AOT - CARMA_TOTSCATAU | 1 | xy | | | | | | | Total 550-nm scattering AOT - CARMA_TOTANGSTR | 1 | xy | | | | | | | Total 470-870 nm Angstrom parameter - CARMA_DUEXTCOEF | m-1 | xyz | C | | | | | | Dust 550 nm extinction coefficient - CARMA_DUSCACOEF | m-1 | xyz | C | | | | | | Dust 550 nm scattering coefficient - CARMA_BCEXTCOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm extinction coefficient - CARMA_BCSCACOEF | m-1 | xyz | C | | | | | | Black Carbon 550 nm scattering coefficient - CARMA_SSEXTCOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm extinction coefficient - CARMA_SSSCACOEF | m-1 | xyz | C | | | | | | Seasalt 550 nm scattering coefficient - CARMA_SMEXTCOEF | m-1 | xyz | C | | | | | | Smoke 550 nm extinction coefficient - CARMA_SMSCACOEF | m-1 | xyz | C | | | | | | Smoke 550 nm scattering coefficient - CARMA_SUEXTCOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm extinction coefficient - CARMA_SUSCACOEF | m-1 | xyz | C | | | | | | Sulfate 550 nm scattering coefficient - CARMA_ASHEXTCOEF | m-1 | xyz | C | | | | | | Ash 550 nm extinction coefficient - CARMA_ASHSCACOEF | m-1 | xyz | C | | | | | | Ash 550 nm scattering coefficient - CARMA_SUBSTEPS | 1 | xy | | | | | | | CARMA substeps - CARMA_RETRIES | 1 | xy | | | | | | | CARMA retries - CARMA_ZSUBSTEPS | 1 | xyz | C | | | | | | CARMA substeps per grid box - CARMA_SATH2SO4 | 1 | xyz | C | | | | | | H2SO4 supersaturation - CARMA_SUVF001 | m s-1 | xyz | E | | | | | | SU group vfall bin 001 - CARMA_SUVF002 | m s-1 | xyz | E | | | | | | SU group vfall bin 002 - CARMA_SUVF003 | m s-1 | xyz | E | | | | | | SU group vfall bin 003 - CARMA_SUVF004 | m s-1 | xyz | E | | | | | | SU group vfall bin 004 - CARMA_SUVF005 | m s-1 | xyz | E | | | | | | SU group vfall bin 005 - CARMA_SUVF006 | m s-1 | xyz | E | | | | | | SU group vfall bin 006 - CARMA_SUVF007 | m s-1 | xyz | E | | | | | | SU group vfall bin 007 - CARMA_SUVF008 | m s-1 | xyz | E | | | | | | SU group vfall bin 008 - CARMA_SUVF009 | m s-1 | xyz | E | | | | | | SU group vfall bin 009 - CARMA_SUVF010 | m s-1 | xyz | E | | | | | | SU group vfall bin 010 - CARMA_SUVF011 | m s-1 | xyz | E | | | | | | SU group vfall bin 011 - CARMA_SUVF012 | m s-1 | xyz | E | | | | | | SU group vfall bin 012 - CARMA_SUVF013 | m s-1 | xyz | E | | | | | | SU group vfall bin 013 - CARMA_SUVF014 | m s-1 | xyz | E | | | | | | SU group vfall bin 014 - CARMA_SUVF015 | m s-1 | xyz | E | | | | | | SU group vfall bin 015 - CARMA_SUVF016 | m s-1 | xyz | E | | | | | | SU group vfall bin 016 - CARMA_SUVF017 | m s-1 | xyz | E | | | | | | SU group vfall bin 017 - CARMA_SUVF018 | m s-1 | xyz | E | | | | | | SU group vfall bin 018 - CARMA_SUVF019 | m s-1 | xyz | E | | | | | | SU group vfall bin 019 - CARMA_SUVF020 | m s-1 | xyz | E | | | | | | SU group vfall bin 020 - CARMA_SUVF021 | m s-1 | xyz | E | | | | | | SU group vfall bin 021 - CARMA_SUVF022 | m s-1 | xyz | E | | | | | | SU group vfall bin 022 - CARMA_SUVF023 | m s-1 | xyz | E | | | | | | SU group vfall bin 023 - CARMA_SUVF024 | m s-1 | xyz | E | | | | | | SU group vfall bin 024 - CARMA_MXVF001 | m s-1 | xyz | E | | | | | | MX group vfall bin 001 - CARMA_MXVF002 | m s-1 | xyz | E | | | | | | MX group vfall bin 002 - CARMA_MXVF003 | m s-1 | xyz | E | | | | | | MX group vfall bin 003 - CARMA_MXVF004 | m s-1 | xyz | E | | | | | | MX group vfall bin 004 - CARMA_MXVF005 | m s-1 | xyz | E | | | | | | MX group vfall bin 005 - CARMA_MXVF006 | m s-1 | xyz | E | | | | | | MX group vfall bin 006 - CARMA_MXVF007 | m s-1 | xyz | E | | | | | | MX group vfall bin 007 - CARMA_MXVF008 | m s-1 | xyz | E | | | | | | MX group vfall bin 008 - CARMA_MXVF009 | m s-1 | xyz | E | | | | | | MX group vfall bin 009 - CARMA_MXVF010 | m s-1 | xyz | E | | | | | | MX group vfall bin 010 - CARMA_MXVF011 | m s-1 | xyz | E | | | | | | MX group vfall bin 011 - CARMA_MXVF012 | m s-1 | xyz | E | | | | | | MX group vfall bin 012 - CARMA_MXVF013 | m s-1 | xyz | E | | | | | | MX group vfall bin 013 - CARMA_MXVF014 | m s-1 | xyz | E | | | | | | MX group vfall bin 014 - CARMA_MXVF015 | m s-1 | xyz | E | | | | | | MX group vfall bin 015 - CARMA_MXVF016 | m s-1 | xyz | E | | | | | | MX group vfall bin 016 - CARMA_MXVF017 | m s-1 | xyz | E | | | | | | MX group vfall bin 017 - CARMA_MXVF018 | m s-1 | xyz | E | | | | | | MX group vfall bin 018 - CARMA_MXVF019 | m s-1 | xyz | E | | | | | | MX group vfall bin 019 - CARMA_MXVF020 | m s-1 | xyz | E | | | | | | MX group vfall bin 020 - CARMA_MXVF021 | m s-1 | xyz | E | | | | | | MX group vfall bin 021 - CARMA_MXVF022 | m s-1 | xyz | E | | | | | | MX group vfall bin 022 - CARMA_MXVF023 | m s-1 | xyz | E | | | | | | MX group vfall bin 023 - CARMA_MXVF024 | m s-1 | xyz | E | | | | | | MX group vfall bin 024 -# ------------------|-------------|-----|---|----|---|---|-----|------|-------------------------- - - - diff --git a/CARMAchem_GridComp/CMakeLists.txt b/CARMAchem_GridComp/CMakeLists.txt deleted file mode 100644 index fa4113d3..00000000 --- a/CARMAchem_GridComp/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -esma_set_this () - -set (src_directories - . - CARMA - CARMA/source/base - ) - -set (srcs) -foreach (dir ${src_directories}) - file (GLOB tmpsrcs CONFIGURE_DEPENDS ${dir}/*.[fF] ${dir}/*.[fF]90 ${dir}/*.c) - list (APPEND srcs ${tmpsrcs}) -endforeach() - -set (dependencies Chem_Shared Chem_Base GMAO_mpeu ESMF::ESMF) -esma_add_library (${this} SRCS ${srcs} DEPENDENCIES ${dependencies}) -target_include_directories (${this} PUBLIC $) - -new_esma_generate_automatic_code ( - ${this} CARMAchem_Registry.rc - "CARMA_ExportSpec___.h;CARMA_GetPointer___.h" - CARMA_History___.rc - ${include_GEOSchem_GridComp} ${esma_etc} - -v - ) - -set (resource_files - CARMAchem_GridComp_ExtData.rc - CARMAchem_GridComp_ExtData.yaml - CARMAchem_MieRegistry.rc - CARMAchem_Registry.rc - ) - -install( - FILES ${resource_files} - DESTINATION etc - ) diff --git a/CARMAchem_GridComp/ut_CARMA.F90 b/CARMAchem_GridComp/ut_CARMA.F90 deleted file mode 100644 index 44350eed..00000000 --- a/CARMAchem_GridComp/ut_CARMA.F90 +++ /dev/null @@ -1,664 +0,0 @@ -! ut_CARMA - Simple ESMF/MAPL example demonstrating how to call CARMA -! -! It assumes 2 processors, so typically you will run it as -! -! % mprirun -np 2 ut_CARMA.x -! -! Arlindo da Silva , December 2009 -!---------------------------------------------------------------------------- - -#undef SULFATE -#undef DUST -#undef SEASALT -#define SULFATE - -# include "MAPL_Generic.h" - - Program ut_CARMA - - use ESMF - use MAPL - use CARMAchem_GridCompMod, only: SetServices - implicit NONE - -! Basic ESMF objects being used in this example -! --------------------------------------------- - type(ESMF_Grid) :: grid ! Grid - type(ESMF_VM) :: vm ! ESMF Virtual Machine - type(ESMF_Time) :: Time ! Time objects - type(ESMF_TimeInterval) :: TimeStep ! used to define a clock - -! Grid Component Objects -! ---------------------- - type(ESMF_GridComp) :: GC - type(ESMF_State) :: IMPORT - type(ESMF_State) :: EXPORT - type(ESMF_Clock) :: CLOCK - -! Basic information about the parallel environment -! PET = Persistent Execution Threads -! In the current implementation, a PET is equivalent -! to an MPI process -! ------------------------------------------------ - integer :: myPET ! The local PET number - integer :: nPET ! The total number of PETs you are running on - - integer :: status, rc - integer :: i, j, n, im, jm - - integer :: Nx = 2, Ny=2 ! Layout - integer :: IM_World=72, JM_World=46, LM_WORLD=72 ! Grid dimensions - -! Coordinate variables -! -------------------- - real(kind=8), pointer, dimension(:,:) :: lons, lats - - character(len=ESMF_MAXSTR) :: name - real, pointer, dimension(:,:) :: Array, newArray - - character(len=*), parameter :: Iam = 'ut_CARMA' - -! ----- - - call Main() - -CONTAINS - - subroutine Main() - -! Initialize the ESMF. For performance reasons, it is important -! to turn OFF ESMF's automatic logging feature -! ------------------------------------------------------------- - call ESMF_Initialize (LogKindFlag=ESMF_LOGKIND_NONE, vm=vm, __RC__) - -! Check the number of processors -! ------------------------------ - call ESMF_VMGet(vm, localPET=myPET, PETcount=nPET) - if ( nPET /= 4 ) then - if ( MAPL_am_I_root() ) then - print *, 'Error: expecting 4 PETs but found ', nPET, 'PETs' - print *, 'Try: mpirun -np 4 ut_CARMA.x' - end if - _ASSERT(.FALSE.,'needs informative message') - end if - - if ( MAPL_am_I_root() ) then - print * - print *, 'Starting ' // Iam // ' with ', nPET, ' PETs ...' - print * - end if - -! Create a global 2D Lat-Lon grid on a 2x1 layout -! ------------------------------------------------ - Grid = MAPL_LatLonGridCreate (Name='myGrid', & - Nx = Nx, Ny = Ny, & - IM_World = IM_World, & - JM_World = JM_World, & - LM_World = LM_World, & - __RC__ ) - -! Validate grid -! ------------- - call ESMF_GridValidate(Grid,__RC__) - -! Create a clock starting at 1/1/2001 0Z with a 30 min time step -! -------------------------------------------------------------- - call ESMF_CalendarSetDefault ( ESMF_CALKIND_GREGORIAN ) - call ESMF_TimeSet(Time, yy=2007, mm=7, dd=1, h=0, m=0, s=0) - call ESMF_TimeIntervalSet( TimeStep, h=0, m=30, s=0, __RC__ ) - CLOCK = ESMF_ClockCreate ( name="Clock", timeStep=TimeStep, startTime=Time, __RC__ ) - - -! Create states and the component -! ------------------------------- - IMPORT = ESMF_StateCreate ( name='impCARMA', __RC__ ) - EXPORT = ESMF_StateCreate ( name='expCARMA', __RC__ ) - GC = ESMF_GridCompCreate ( name='CARMA', & - Grid=Grid, & -! GridCompType = ESMF_ATM, & - ConfigFile='MAPL.rc', & - __RC__ ) - - -! Set component services -! ---------------------- - call ESMF_GridCompSetServices ( GC, SetServices, __RC__ ) - -! Initialize component -! -------------------- - call ESMF_GridCompInitialize ( GC, importState=IMPORT, exportState=EXPORT, clock=CLOCK, __RC__ ) - -! Fill in IMPORT state with reasonable values -! ------------------------------------------- - call Fill_Import_State_ (IMPORT,__RC__) - -! Since we are not reading restarts, set the internal state with -! reasonable profiles so that we can exercise the code -! --------------------------------------------------------------- - call Fill_Internal_State_ (GC,__RC__) - -! Look at states -! -------------- - if ( MAPL_AM_I_ROOT() ) then - call ESMF_StatePrint(IMPORT) - call ESMF_StatePrint(EXPORT) - end if - -! Run component -! ------------- - call ESMF_GridCompRun ( GC, importState=IMPORT, exportState=EXPORT, clock=CLOCK, __RC__ ) - -! Finalize component -! ------------------ -!!! call ESMF_GridCompFinalize ( GC, IMPORT, EXPORT, CLOCK, __RC__ ) - -! All done -! -------- - call ESMF_Finalize(__RC__) - - end subroutine Main - -!............................................................................................ - subroutine Fill_Import_State_ (IMPORT,rc) - type(ESMF_State), intent(inout) :: IMPORT - integer, optional, intent(out) :: rc - -! ---- - - integer :: i1, i2, j1, j2, k1, k2 - - real, pointer, dimension(:,:,:) :: q, ple, zle, airdens, fcld, dqdt, t, u, v, o3, rh2 - - real, pointer, dimension(:,:) :: tropp, lwi, zpbl, frlake, fraci, wet1, lai, grn, cn_prcp, ncn_prcp, & - ps, sh, ts, u10m, v10m, ustar, z0h - -! Get Pointers to IMPORT state -! ---------------------------- - call MAPL_GetPointer ( IMPORT, Q, 'Q', __RC__ ) - call MAPL_GetPointer ( IMPORT, PLE, 'PLE', __RC__ ) - call MAPL_GetPointer ( IMPORT, ZLE, 'ZLE', __RC__ ) - call MAPL_GetPointer ( IMPORT, AIRDENS, 'AIRDENS', __RC__ ) -! call MAPL_GetPointer ( IMPORT, FCLD, 'FCLD', __RC__ ) - call MAPL_GetPointer ( IMPORT, DQDT, 'DQDT', __RC__ ) - call MAPL_GetPointer ( IMPORT, T, 'T', __RC__ ) -! call MAPL_GetPointer ( IMPORT, U, 'U', __RC__ ) -! call MAPL_GetPointer ( IMPORT, V, 'V', __RC__ ) -! call MAPL_GetPointer ( IMPORT, O3, 'O3', __RC__ ) - call MAPL_GetPointer ( IMPORT, RH2, 'RH2', __RC__ ) -! call MAPL_GetPointer ( IMPORT, TROPP, 'TROPP', __RC__ ) - call MAPL_GetPointer ( IMPORT, LWI, 'LWI', __RC__ ) - call MAPL_GetPointer ( IMPORT, ZPBL, 'ZPBL', __RC__ ) - call MAPL_GetPointer ( IMPORT, FRLAKE, 'FRLAKE', __RC__ ) -! call MAPL_GetPointer ( IMPORT, FRACI, 'FRACI', __RC__ ) - call MAPL_GetPointer ( IMPORT, WET1, 'WET1', __RC__ ) -! call MAPL_GetPointer ( IMPORT, LAI, 'LAI', __RC__ ) -! call MAPL_GetPointer ( IMPORT, GRN, 'GRN', __RC__ ) - call MAPL_GetPointer ( IMPORT, CN_PRCP, 'CN_PRCP', __RC__ ) - call MAPL_GetPointer ( IMPORT, NCN_PRCP, 'NCN_PRCP', __RC__ ) -! call MAPL_GetPointer ( IMPORT, PS, 'PS', __RC__ ) - call MAPL_GetPointer ( IMPORT, SH, 'SH', __RC__ ) -! call MAPL_GetPointer ( IMPORT, TS, 'TS', __RC__ ) - call MAPL_GetPointer ( IMPORT, U10M, 'U10M', __RC__ ) - call MAPL_GetPointer ( IMPORT, V10M, 'V10M', __RC__ ) - call MAPL_GetPointer ( IMPORT, USTAR, 'USTAR', __RC__ ) - call MAPL_GetPointer ( IMPORT, Z0H, 'Z0H', __RC__ ) - - i1 = lbound(T,1) - j1 = lbound(T,2) - k1 = lbound(T,3) - i2 = ubound(T,1) - j2 = ubound(T,2) - k2 = ubound(T,3) - - _ASSERT( (k2-k1+1) == 72,'needs informative message') - - -! Fill typical values -! ------------------- - do j = j1, j2 - do i = i1, i2 - -! 3D -! -- - Q(i,j,:) = 1.e-6 * & - (/ 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, & - 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, & - 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - 2, 2, 3, 4, 9, 11, 18, 88, 128, 142, 488, 1955, & - 2830, 2898, 2896, 3813, 4874, 7651, 8070, 8004, 7833, 7531, 7404, 7359, & - 7319, 7181, 6985, 6681, 6217, 5614, 5552, 5713, 6077, 8908, 12751, 14355 /) - - PLE(i,j,:) = (/ 1, 2, 3, 4, 6, 8, 11, 15, 21, 27, 36, 47, 61, 79, 101, 130, & - 165, 208, 262, 327, 407, 504, 621, 761, 929, 1127, 1364, 1645, & - 1979, 2373, 2836, 3381, 4017, 4764, 5638, 6660, 7851, 9236, & - 10866, 12783, 15039, 17693, 20792, 24398, 28606, 33388, 37003, & - 40612, 44214, 47816, 51405, 54997, 58584, 62170, 65769, 68147, & - 70540, 72931, 75313, 77711, 79623, 81046, 82485, 83906, 85344, & - 86765, 88201, 89636, 91071, 92516, 93921, 95376 /) - - ZLE(i,j,:) = (/ 78676, 74222, 71032, 68578, 66390, 64345, 62371, 60419, 58455, & - 56469, 54463, 52449, 50446, 48476, 46563, 44718, 42946, 41256, & - 39651, 38123, 36656, 35234, 33847, 32499, 31199, 29940, 28704, & - 27494, 26310, 25151, 24017, 22905, 21815, 20745, 19691, 18656, & - 17629, 16609, 15589, 14559, 13514, 12470, 11475, 10487, 9469, & - 8438, 7731, 7076, 6463, 5889, 5348, 4838, 4355, 3898, 3464, & - 3187, 2918, 2656, 2403, 2155, 1963, 1821, 1682, 1546, 1412, & - 1280, 1149, 1022, 896, 773, 654, 535, 417 /) - - AIRDENS(i,j,:) = (/ 2.27987766266e-05, 4.03523445129e-05, 6.19888305664e-05, 8.63075256348e-05, & - 0.000117659568787, 0.000159025192261, 0.000209808349609, 0.000270366668701, & - 0.000345230102539, 0.000439167022705, 0.00055980682373, 0.000717163085938, & - 0.000923156738281, 0.00120162963867, 0.00156402587891, 0.00202178955078, & - 0.00262451171875, 0.00339889526367, 0.00437164306641, 0.00555419921875, & - 0.00694274902344, 0.00857543945312, 0.0105895996094, 0.0131225585938, & - 0.0160827636719, 0.0195617675781, 0.0237731933594, 0.0287780761719, & - 0.0347290039062, 0.0416870117188, 0.0499267578125, 0.0596313476562, & - 0.0711669921875, 0.084716796875, 0.100830078125, 0.11865234375, 0.138671875, & - 0.1630859375, 0.190185546875, 0.22021484375, 0.25927734375, 0.318359375, & - 0.3720703125, 0.42138671875, 0.47265625, 0.521484375, 0.5615234375, & - 0.6005859375, 0.638671875, 0.677734375, 0.71875, 0.759765625, 0.8017578125, & - 0.8447265625, 0.8798828125, 0.90625, 0.9326171875, 0.958984375, 0.986328125, & - 1.013671875, 1.03515625, 1.052734375, 1.072265625, 1.08984375, 1.10546875, & - 1.123046875, 1.140625, 1.162109375, 1.1953125, 1.21875, 1.234375, 1.25 /) - -! FCLD(i,j,:) = 1e-2 * & -! (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & -! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & -! 0, 0, 0, 0, 0, 0, 16, 21, 26, 28, 0, 0, 0, 0, 0, 0, 0, & -! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 /) - - DQDT(i,j,:) = 1e-12 * & - (/ 9, 11, -3, -3, -2, -18, -10, 2, 0, -3, -6, -5, -3, -1, 1, & - 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, & - 1, 1, 0, 0, -5, -22, -33, 95, 474, 348, 177, 3377, 11045, & - 11788, -5267, -7756, -17491, -19790, -10884, -6082, 8120, 4381, & - -10346, 8033, 69151, 77650, 61351, 46508, 33936, 23022, 15658, & - 11598, 6469, 4861, -846, -7974, -30500, -20663, -14930 /) - - T(i,j,:) = (/ 219, 221, 223, 228, 230, 230, 232, 238, 245, 253, 259, 263, & - 264, 262, 258, 253, 247, 239, 233, 229, 227, 227, 226, 223, & - 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 212, & - 214, 214, 216, 219, 219, 210, 210, 218, 227, 234, 240, 245, & - 250, 254, 257, 260, 262, 263, 265, 266, 267, 268, 269, 270, & - 270, 270, 270, 270, 271, 271, 271, 270, 267, 265, 266, 266 /) - - -! U(i,j,:) = (/ -18, -13, 0, 10, 26, 36, 39, 40, 38, 37, 36, 35, 32, 28, & -! 23, 16, 6, -2, -9, -13, -15, -16, -14, -14, -12, -12, -11, & -! -10, -9, -5, -3, -2, 0, 1, 3, 5, 9, 13, 17, 22, 24, 26, & -! 25, 26, 26, 22, 19, 17, 14, 12, 12, 11, 11, 11, 11, 10, 9, & -! 8, 6, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -6, -6 /) - -! V(i,j,:) = (/ 20, 13, 9, 4, -1, -9, -20, -24, -25, -27, -28, -28, -26, & -! -25, -27, -28, -28, -28, -27, -27, -25, -23, -19, -15, -11, & -! -10, -9, -8, -7, -7, -8, -9, -10, -12, -14, -15, -16, -18, & -! -21, -22, -22, -25, -29, -25, -23, -23, -22, -20, -17, -13, & -! -9, -6, -4, -4, -4, -3, -2, -1, 0, 0, 0, 1, 1, 1, 2, 2, & -! 3, 3, 3, 4, 4, 3 /) - -! O3(i,j,:) = 1.E-9 * & -! (/ 16182, 9700, 7294, 5781, 4164, 3017, 2440, 2287, 2324, 2514, & -! 2838, 3304, 4030, 4924, 5915, 7033, 8434, 9894, 11101, 11414, & -! 10475, 9745, 10058, 9119, 8538, 9238, 9164, 10028, 10132, 10237, & -! 9447, 7972, 7174, 5222, 4008, 3296, 2231, 1320, 768, 628, 685, & -! 676, 202, 122, 96, 88, 86, 83, 83, 84, 84, 83, 82, 81, 79, & -! 79, 77, 76, 77, 80, 84, 87, 89, 90, 89, 88, 83, 76, 69, 65, & -! 64, 64 /) - - RH2(i,j,:) = 1e-6 * & - (/ 1, 2, 2, 2, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 6, 18, 51, & - 129, 267, 394, 502, 682, 1135, 1603, 2076, 2820, 3792, 5120, & - 6806, 8912, 11597, 15397, 20386, 28168, 29755, 28748, 33875, & - 34058, 28657, 43458, 401856, 947266, 932618, 902344, 657227, & - 371583, 203370, 235108, 317872, 413086, 511719, 691407, 686524, & - 601563, 456055, 475098, 626954, 590821, 483399, 380860, 297852, & - 230958, 183594, 144288, 111084, 96558, 136963, 369629, 770508, & - 793946, 799805 /) -! 2D -! -- -! TROPP(i,j) = 20363.5 - LWI(i,j) = 1. - ZPBL(i,j) = 59. - FRLAKE(i,j) = 0. - ! FRACI(i,j) = 0. - WET1(i,j) = 0.0 - ! LAI(i,j) = 0.280273 - ! GRN(i,j) = 0.5 - CN_PRCP(i,j) = 0.0 - NCN_PRCP(i,j) = 3.18323e-10 -! PS(i,j) = 96825.3 - SH(i,j) = -28.548 -! TS(i,j) = 260.014 - U10M(i,j) = -3.5 - V10M(i,j) = 2.8 - USTAR(i,j) = 0.29 - Z0H(i,j) = 0.02005 - - end do - end do - - end subroutine Fill_Import_State_ - -!............................................................................................... - - - subroutine Fill_Internal_State_ (GC,rc) - type(ESMF_GridComp), intent(inout) :: GC - integer, optional, intent(out) :: rc - -! ---- - - type(MAPL_MetaComp), pointer :: MAPL - type(ESMF_State) :: INTERNAL - - real, pointer :: tracer(:,:,:) - integer :: i1, i2, j1, j2, k1, k2 - -! Initialize tracers - real, pointer, dimension(:,:,:) :: du001, du002, du003, du004, du005, du006, du007, du008 - real, pointer, dimension(:,:,:) :: ss001, ss002, ss003, ss004, ss005, ss006, ss007, ss008 - real, pointer, dimension(:,:,:) :: su001, su002, su003, su004, su005, su006, su007, su008, su009, su010, & - su011, su012, su013, su014, su015, su016, su017, su018, su019, su020, & - su021, su022, su023, su024, su025, su026, su027, su028, su029, su030, & - su031, su032, su033, su034, su035, su036, su037, su038, su039, su040, & - su041, su042 - real, pointer, dimension(:,:,:) :: h2o, h2so4, h2o_old, h2so4_old, told - real, pointer, dimension(:,:,:) :: satliq_h2o, satliq_h2so4, satice_h2o, satice_h2so4 - - - -! Get my internal stateb out of GC -! -------------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, __RC__ ) - call MAPL_Get ( MAPL, INTERNAL_ESMF_STATE=INTERNAL, __RC__ ) - -! Get Pointers to IMPORT state -! ---------------------------- -#ifdef DUST - call MAPL_GetPointer ( INTERNAL, du001, 'CARMA::dust::pc::001', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du002, 'CARMA::dust::pc::002', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du003, 'CARMA::dust::pc::003', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du004, 'CARMA::dust::pc::004', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du005, 'CARMA::dust::pc::005', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du006, 'CARMA::dust::pc::006', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du007, 'CARMA::dust::pc::007', __RC__ ) - call MAPL_GetPointer ( INTERNAL, du008, 'CARMA::dust::pc::008', __RC__ ) - _ASSERT( associated(du001),'needs informative message' ) - tracer => du001 -! Local bounds -! ------------ - i1 = lbound(tracer,1) - j1 = lbound(tracer,2) - k1 = lbound(tracer,3) - i2 = ubound(tracer,1) - j2 = ubound(tracer,2) - k2 = ubound(tracer,3) - -! Fill typical values -! ------------------- - do j = j1, j2 - do i = i1, i2 - -! Dust (15Jul2008, 18W, 22N) -! -------------------------- - if (associated(du001)) du001(i,j,:) = 0.09*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(du002)) du002(i,j,:) = 0.081*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(du003)) du003(i,j,:) = 0.234*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(du004)) du004(i,j,:) = 0.676*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(du005)) du005(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 44, & - 568, 2231, 3024, 4148, 6563, 12137, 14465, 19064, 25990, 24448, & - 28202, 22731, 13316, 15222, 47207, 88942, 172528, 225846, 262168, & - 285451, 287779, 282657, 269153, 262168, 259839, 255649, 249595, & - 243076, 232831, 228640, 220025, 212342, 199304, 153436, 68569, & - 26863 /) - if (associated(du006)) du006(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, & - 30, 233, 686, 1638, 3147, 7349, 9707, 13563, 20286, 19151, & - 23196, 19471, 11366, 12471, 37021, 71712, 141329, 189990, 224915, & - 247732, 258443, 256114, 252389, 247732, 246801, 243076, 237255, & - 230503, 221190, 217231, 210247, 205357, 197208, 159257, 76253, & - 29861 /) - if (associated(du007)) du007(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 2, 7, 33, 122, 736, 1361, 2263, 4999, 5574, 8091, 7902, & - 5625, 5407, 12195, 23633, 47323, 69151, 87079, 105938, 120141, & - 131084, 139000, 146451, 148081, 147149, 144588, 141096, 137836, & - 137138, 138535, 142027, 146917, 138535, 86264, 44355 /) - if (associated(du008)) du008(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 15, 25, 27, 116, 247, 456, 754, 852, 803, & - 906, 1279, 2154, 3027, 3708, 5006, 6462, 9241, 12486, 15833, & - 18860, 20635, 21887, 22614, 24302, 25437, 31433, 42085, 55531, & - 67289, 67172, 54890 /) - - end do - end do -#endif - - -#ifdef SEASALT - call MAPL_GetPointer ( INTERNAL, ss001, 'CARMA::seasalt::pc::001', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss002, 'CARMA::seasalt::pc::002', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss003, 'CARMA::seasalt::pc::003', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss004, 'CARMA::seasalt::pc::004', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss005, 'CARMA::seasalt::pc::005', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss006, 'CARMA::seasalt::pc::006', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss007, 'CARMA::seasalt::pc::007', __RC__ ) - call MAPL_GetPointer ( INTERNAL, ss008, 'CARMA::seasalt::pc::008', __RC__ ) - _ASSERT( associated(ss001), 'needs informative message' ) - tracer => ss001 -! Local bounds -! ------------ - i1 = lbound(tracer,1) - j1 = lbound(tracer,2) - k1 = lbound(tracer,3) - i2 = ubound(tracer,1) - j2 = ubound(tracer,2) - k2 = ubound(tracer,3) - -! Fill typical values -! ------------------- - do j = j1, j2 - do i = i1, i2 - -! Seasalt: Duplicate dust -! -------------------------- - if (associated(ss001)) ss001(i,j,:) = 0.09*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(ss002)) ss002(i,j,:) = 0.081*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(ss003)) ss003(i,j,:) = 0.234*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(ss004)) ss004(i,j,:) = 0.676*1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 15, 39, & - 280, 1417, 1874, 1750, 1892, 2700, 4643, 5450, 7116, 9183, & - 8906, 9838, 7757, 4577, 5341, 17317, 32480, 63214, 82073, 94646, & - 102213, 102097, 100700, 93948, 91736, 91387, 90106, 88010, 85566, & - 81840, 80211, 77067, 74390, 69617, 53261, 23545, 9299 /) - if (associated(ss005)) ss005(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 44, & - 568, 2231, 3024, 4148, 6563, 12137, 14465, 19064, 25990, 24448, & - 28202, 22731, 13316, 15222, 47207, 88942, 172528, 225846, 262168, & - 285451, 287779, 282657, 269153, 262168, 259839, 255649, 249595, & - 243076, 232831, 228640, 220025, 212342, 199304, 153436, 68569, & - 26863 /) - if (associated(ss006)) ss006(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, & - 30, 233, 686, 1638, 3147, 7349, 9707, 13563, 20286, 19151, & - 23196, 19471, 11366, 12471, 37021, 71712, 141329, 189990, 224915, & - 247732, 258443, 256114, 252389, 247732, 246801, 243076, 237255, & - 230503, 221190, 217231, 210247, 205357, 197208, 159257, 76253, & - 29861 /) - if (associated(ss007)) ss007(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 2, 7, 33, 122, 736, 1361, 2263, 4999, 5574, 8091, 7902, & - 5625, 5407, 12195, 23633, 47323, 69151, 87079, 105938, 120141, & - 131084, 139000, 146451, 148081, 147149, 144588, 141096, 137836, & - 137138, 138535, 142027, 146917, 138535, 86264, 44355 /) - if (associated(ss008)) ss008(i,j,:) = 1.0e-12 * & - (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, & - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - 1, 1, 1, 1, 1, 15, 25, 27, 116, 247, 456, 754, 852, 803, & - 906, 1279, 2154, 3027, 3708, 5006, 6462, 9241, 12486, 15833, & - 18860, 20635, 21887, 22614, 24302, 25437, 31433, 42085, 55531, & - 67289, 67172, 54890 /) - - end do - end do -#endif -#ifdef SULFATE - call MAPL_GetPointer ( INTERNAL, su001, 'CARMA::sulfate::pc::001', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su002, 'CARMA::sulfate::pc::002', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su003, 'CARMA::sulfate::pc::003', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su004, 'CARMA::sulfate::pc::004', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su005, 'CARMA::sulfate::pc::005', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su006, 'CARMA::sulfate::pc::006', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su007, 'CARMA::sulfate::pc::007', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su008, 'CARMA::sulfate::pc::008', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su009, 'CARMA::sulfate::pc::009', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su010, 'CARMA::sulfate::pc::010', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su011, 'CARMA::sulfate::pc::011', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su012, 'CARMA::sulfate::pc::012', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su013, 'CARMA::sulfate::pc::013', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su014, 'CARMA::sulfate::pc::014', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su015, 'CARMA::sulfate::pc::015', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su016, 'CARMA::sulfate::pc::016', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su017, 'CARMA::sulfate::pc::017', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su018, 'CARMA::sulfate::pc::018', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su019, 'CARMA::sulfate::pc::019', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su020, 'CARMA::sulfate::pc::020', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su021, 'CARMA::sulfate::pc::021', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su022, 'CARMA::sulfate::pc::022', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su023, 'CARMA::sulfate::pc::023', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su024, 'CARMA::sulfate::pc::024', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su025, 'CARMA::sulfate::pc::025', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su026, 'CARMA::sulfate::pc::026', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su027, 'CARMA::sulfate::pc::027', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su028, 'CARMA::sulfate::pc::028', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su029, 'CARMA::sulfate::pc::029', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su030, 'CARMA::sulfate::pc::030', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su031, 'CARMA::sulfate::pc::031', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su032, 'CARMA::sulfate::pc::032', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su033, 'CARMA::sulfate::pc::033', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su034, 'CARMA::sulfate::pc::034', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su035, 'CARMA::sulfate::pc::035', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su036, 'CARMA::sulfate::pc::036', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su037, 'CARMA::sulfate::pc::037', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su038, 'CARMA::sulfate::pc::038', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su039, 'CARMA::sulfate::pc::039', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su040, 'CARMA::sulfate::pc::040', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su041, 'CARMA::sulfate::pc::041', __RC__ ) - call MAPL_GetPointer ( INTERNAL, su042, 'CARMA::sulfate::pc::042', __RC__ ) - call MAPL_GetPointer ( INTERNAL, h2o, 'CARMA::H2O', __RC__ ) - call MAPL_GetPointer ( INTERNAL, h2so4, 'CARMA::H2SO4', __RC__ ) - call MAPL_GetPointer ( INTERNAL, h2o_old, 'CARMA::H2O_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, h2so4_old, 'CARMA::H2SO4_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, satliq_h2o, 'CARMA::satliq_H2O_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, satliq_h2so4, 'CARMA::satliq_H2SO4_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, satice_h2o, 'CARMA::satice_H2O_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, satice_h2so4, 'CARMA::satice_H2SO4_old', __RC__ ) - call MAPL_GetPointer ( INTERNAL, told, 'CARMA::t_old', __RC__ ) - _ASSERT( associated(su001), 'needs informative message' ) - tracer => su001 -! Local bounds -! ------------ - i1 = lbound(tracer,1) - j1 = lbound(tracer,2) - k1 = lbound(tracer,3) - i2 = ubound(tracer,1) - j2 = ubound(tracer,2) - k2 = ubound(tracer,3) - - _ASSERT( (k2-k1+1) == 72,'needs informative message') - -! Fill typical values -! ------------------- - do j = j1, j2 - do i = i1, i2 - -! Sulfate: zero-ed out -! -------------------------- - if (associated(su001)) su001(i,j,:) = 0. - if (associated(su002)) su002(i,j,:) = 0. - if (associated(su003)) su003(i,j,:) = 0. - if (associated(su004)) su004(i,j,:) = 0. - if (associated(su005)) su005(i,j,:) = 0. - if (associated(su006)) su006(i,j,:) = 0. - if (associated(su007)) su007(i,j,:) = 0. - if (associated(su008)) su008(i,j,:) = 0. - if (associated(h2o)) h2o(i,j,:) = 0. - if (associated(h2so4)) h2so4(i,j,:) = 0.01e-12 - if (associated(h2o_old)) h2o_old(i,j,:) = -1. - if (associated(h2so4_old)) h2so4_old(i,j,:) = -1. - if (associated(told)) told(i,j,:) = -1. - if (associated(satliq_h2o)) satliq_h2o(i,j,:) = -1. - if (associated(satliq_h2so4)) satliq_h2so4(i,j,:) = -1. - if (associated(satice_h2o)) satice_h2o(i,j,:) = -1. - if (associated(satice_h2so4)) satice_h2so4(i,j,:) = -1. - - end do - end do -#endif -! --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- - if (MAPL_AM_I_ROOT()) then - print *, '----- Inside Fill_Internal_State -----' - print *, ' state b o u n d s = ', & - lbound(tracer,1), ubound(tracer,1), & - lbound(tracer,2), ubound(tracer,2), & - lbound(tracer,3), ubound(tracer,3) - print *, '----- Inside Fill_Internal_State -----' - end if -! --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- D E B U G --- - - end subroutine Fill_Internal_State_ - -end Program ut_CARMA - diff --git a/CHANGELOG.md b/CHANGELOG.md index 8219a7e2..cda62d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,17 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- in CARMA: Added 'microfast parameterization' -- in CARMA: Added a routine to normalize dmdt (prevent gas overshoot) -- in CARMA: Added a NULL option for vapor pressure equation + - Added SO4REFF connectivity from CARMA to GMI - Added connectivity (OH, H2O2, NO3) from GMI to GOCART ### Removed +- Removed `MAMchem_GridComp`, `MATRIXchem_GridComp`, `CARMAchem_GridComp`, `GAAS_GridComp`, and `GEOSachem_GridComp` as these are now in separate repos + - `MAMchem_GridComp` → [MAM](https://github.com/GEOS-ESM/MAM) + - `MATRIXchem_GridComp` → [MATRIX](https://github.com/GEOS-ESM/MATRIX) + - `CARMAchem_GridComp` → [CARMA](https://github.com/GEOS-ESM/CARMA) + - `GAAS_GridComp` → [GAAS](https://github.com/GEOS-ESM/GAAS) + - `GEOSachem_GridComp` → [ACHEM](https://github.com/GEOS-ESM/ACHEM) + ### Changed -- in CARMA: In a few routines removed initialization of 'rc' -- in CARMA: Changed the test for bootstrapping temperature ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb71c0a..7d412753 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,11 @@ esma_set_this () -esma_add_subdirectories(Shared GOCART TR GMI StratChem) +esma_add_subdirectories(Shared GOCART TR GMI StratChem MAM MATRIX CARMA GAAS ACHEM) set (alldirs GEOSpchem_GridComp - CARMAchem_GridComp GEOSCHEMchem_GridComp - MATRIXchem_GridComp - MAMchem_GridComp - GAAS_GridComp H2O_GridComp - GEOSachem_GridComp DNA_GridComp HEMCO_GridComp ) @@ -25,7 +20,7 @@ set (srcs esma_add_library (${this} SRCS ${srcs} SUBCOMPONENTS ${alldirs} - DEPENDENCIES MAPL Chem_Shared Chem_Base GOCART_GridComp GOCART2G_GridComp TR GMI StratChem ESMF::ESMF) + DEPENDENCIES MAPL Chem_Shared Chem_Base GOCART_GridComp GOCART2G_GridComp TR GMI StratChem MAM MATRIX CARMA GAAS ACHEM ESMF::ESMF) install( FILES GEOS_ChemGridComp.rc ChemEnv_ExtData.rc ChemEnv.rc ChemEnv_ExtData.yaml diff --git a/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.rc b/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.rc deleted file mode 100644 index 19cd50ba..00000000 --- a/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.rc +++ /dev/null @@ -1,9 +0,0 @@ -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - aod_a '1' N N F0 none none AOD /discover/nobackup/projects/gmao/merra2/data/chem/d5124_m2_jan10/Y%y4/M%m2/d5124_m2_jan10.aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 - aod_f '1' N N F0 none none AOD /discover/nobackup/projects/gmao/merra2/data/chem/d5124_m2_jan10/Y%y4/M%m2/d5124_m2_jan10.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 - aod_k '1' N N F0 none none AOD /discover/nobackup/projects/gmao/merra2/data/chem/d5124_m2_jan10/Y%y4/M%m2/d5124_m2_jan10.aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 -%% diff --git a/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.yaml b/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.yaml deleted file mode 100644 index 4afa1c62..00000000 --- a/GAAS_GridComp/AMIP/GAAS_GridComp_ExtData.yaml +++ /dev/null @@ -1,33 +0,0 @@ -Collections: - aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - -Samplings: - GAAS_sample_0: - update_offset: PT450S - exact: True - -Exports: - aod_a: - collection: aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - aod_f: - collection: aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - aod_k: - collection: aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - diff --git a/GAAS_GridComp/CMakeLists.txt b/GAAS_GridComp/CMakeLists.txt deleted file mode 100644 index a4e0e57e..00000000 --- a/GAAS_GridComp/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -esma_set_this () - -set (srcs -# m_ana.F90 - LDE_Mod.F90 - GAAS_GridCompMod.F90 - ) - - -esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL Chem_Base Chem_Shared GMAO_mpeu FVdycoreCubed_GridComp NetCDF::NetCDF_Fortran) - -esma_generate_gocart_code (${this} -F) - -file (GLOB_RECURSE rc_files CONFIGURE_DEPENDS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rc *.yaml) -foreach ( file ${rc_files} ) - get_filename_component( dir ${file} DIRECTORY ) - install( FILES ${file} DESTINATION etc/${dir} ) -endforeach() - -install(PROGRAMS ana_lde.py DESTINATION bin) - -ecbuild_add_executable (TARGET ana_lde.x SOURCES ana_lde.F90 LIBS ${this}) - diff --git a/GAAS_GridComp/GAAS_AerRegistry.rc b/GAAS_GridComp/GAAS_AerRegistry.rc deleted file mode 100644 index e29e8ea8..00000000 --- a/GAAS_GridComp/GAAS_AerRegistry.rc +++ /dev/null @@ -1,325 +0,0 @@ -#------------------------------------------------------------------------ -#BOP -# -# !RESOURCE: AeroChem_Registy --- AeroChem Registry -# -# !HELP: -# -# The Chemistry Registry resource file is used to control basic -# properties of the GOCART and StratChem Grid Components. -# Specifically, it -# -# - selects which constituents to simulate -# - selects the number of bins for each constituent -# - specifies variable names and units for each constituent -# -# NOTE: The water vapor and ozone tracers are not really being used -# in GEOS-5. They are still kept for compatibility with GEOS-4. -# -# IMPORTANT: This file should be the same as Chem_Registry.rc, except that -# only aerosols (DU, SS, SU, BC, OC) are turned ON. -# -# !REVISION HISTORY: -# -# 27May2005 da Silva Added variable tables for SU/BC/OC. -# 19dec2005 da Silva Changed volume mixing ratio units to mol/mol -# 10Feb2006 Hayashi Added analysis update frequency -# 27Jul2006 da Silva No more analysis frequencies; added GMI/PChem (GEOS-5) -# -#----------------------------------------------------------------------- -#EOP - - # &Label Active Constituents - -# -# IMPORTANT: This file should be the same as Chem_Registry.rc, except that -# only aerosols (DU, SS, SU, BC, OC, NI) are turned ON. -# - -# Whether to include the constituent in the simulation -# ---------------------------------------------------- -doing_H2O: no # water vapor (must always ON for fvGCM) -doing_O3: no # ozone (must be always ON for fvGCM in DAS mode) -doing_CO: no # &YesNo Include carbon monoxide? -doing_CO2: no # &YesNo Include carbon dioxide? -doing_CFC: no # CFCs -doing_DU: yes # &YesNo Include mineral dust? -doing_SS: yes # &YesNo Include sea salt? -doing_SU: yes # &YesNo Include sulfates? -doing_BC: yes # &YesNo Include black carbon? -doing_OC: yes # &YesNo Include organic carbon? -doing_NI: yes # &YesNo Include nitrate? -doing_SC: no # &YesNo Include stratospheric chemistry? -doing_AC: no # auto chem -doing_XX: no # generic tracer -doing_PC: no # parameterized chemistry (GEOS-5) -doing_GMI: no # GMI chemistry (GEOS-5) -doing_CARMA: no # CARMA Service Component - -# You can select the number of bins (e.g., particle size) -# for each of the constituents. Note nbins>1 may not be -# supported by some constituents -# ---------------------------------------------------- -nbins_H2O: 1 # water vapor -nbins_O3: 3 # ozone -nbins_CO: 1 # carbon monoxide -nbins_CO2: 1 # carbon dioxide -nbins_CFC: 2 # CFCs -nbins_DU: 5 # mineral dust -nbins_SS: 5 # sea salt -nbins_SU: 4 # sulfates -nbins_BC: 2 # black carbon -nbins_OC: 2 # organic carbon -nbins_NI: 5 # nitrate -nbins_SC: 34 # stratospheric chemistry -nbins_AC: 35 # auto chem -nbins_XX: 18 # generic tracer -nbins_PC: 1 # parameterized chemistry (GEOS-5) -nbins_GMI: 1 # GMI chemistry (GEOS-5) -nbins_CARMA: 1 # CARMA Service Component - -# Units for each constituent -# -------------------------- -units_H2O: kg/kg # water vapor -units_O3: kg/kg # ozone -units_CO: kg/kg # carbon monoxide -units_CO2: kg/kg # carbon dioxide -units_CFC: mol/mol # CFCs -units_DU: kg/kg # mineral dust -units_SS: kg/kg # sea salt -units_SU: kg/kg # sulfates -units_BC: kg/kg # black carbon -units_OC: kg/kg # organic carbon -units_NI: kg/kg # nitrate -units_SC: kg/kg # stratospheric chemistry -units_AC: kg/kg # auto chem -units_XX: kg/kg # generic tracer -units_PC: kg/kg # parameterized chemistry (GEOS-5) -units_GMI: kg/kg # GMI chemistry (GEOS-5) -units_CARMA: kg/kg # CARMA Service Component - -# Variable names to override defaults. Optional. Name and Units must -# be 1 token. Long names can be more than one token. -# -------------------------------------------------------------------- - -variable_table_O3:: - -# Name Units Long Name -# ----- ------ -------------------------------- -O3PARAM mol/mol Parameterized ozone -OXSTRAT mol/mol Stratospheric odd oxygen -OXTROP mol/mol Tropospheric ozone -:: - -variable_table_CO:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CO mol/mol Global carbon monoxide -CONOAMAN mol/mol North American anthropogenic CO -COCEAMAN mol/mol Central American anthropogenic CO -COWHBB mol/mol Western Hemisphere biomass burning CO -COASIAAN mol/mol Asian anthropogenic CO -COASNBB mol/mol Northern Asia biomass burning CO -COASSBB mol/mol Southern Asia biomass burning CO -COFDAN mol/mol Mexico City anthropogenic CO -:: - -variable_table_CO2:: - -# Name Units Long Name -# ----- ------ -------------------------------- -CO2 mol/mol Carbon Dioxide -CO2nam mol/mol North American Carbon Dioxide -CO2sam mol/mol South American Carbon Dioxide -CO2afr mol/mol African -:: - -variable_table_CFC:: -CFC12S mol/mol Stratospheric CFC-12 (CCl2F2) -CFC12T mol/mol Tropospheric CFC-12 (CCl2F2) -:: -variable_table_SU:: - -# Name Units Long Name -# ----- ------ -------------------------------- -DMS kg/kg Dimethylsulphide -SO2 kg/kg Sulphur dioxide -SO4 kg/kg Sulphate aerosol -MSA kg/kg Methanesulphonic acid -:: - -variable_table_BC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -BCphobic kg/kg Hydrophobic Black Carbon -BCphilic kg/kg Hydrophilic Black Carbon -:: - -variable_table_OC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -OCphobic kg/kg Hydrophobic Organic Carbon (Particulate Matter) -OCphilic kg/kg Hydrophilic Organic Carbon (Particulate Matter) -:: - -variable_table_NI:: - -# Name Units Long Name -# ----- ------ -------------------------------- -NH3 kg/kg Ammonia (NH3, gas phase) -NH4a kg/kg Ammonium ion (NH4+, aerosol phase) -NO3an1 kg/kg Nitrate size bin 001 -NO3an2 kg/kg Nitrate size bin 002 -NO3an3 kg/kg Nitrate size bin 003 -:: - - -variable_table_SC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -OXSTRAT mol/mol Stratospheric odd oxygen -NOX mol/mol Odd nitrogen -HNO3 mol/mol Nitric acid -N2O5 mol/mol Dinitrogen pentoxide -HO2NO2 mol/mol Peroxynitric acid -CLONO2 mol/mol Chlorine nitrate -CLX mol/mol Odd chlorine -HCL mol/mol Hydrochloric acid -HOCL mol/mol Hypochlorous acid -H2O2 mol/mol Hydrogen peroxide -BRX mol/mol Odd bromine -N2O mol/mol Nitrous oxide -CL2 mol/mol Molecular chlorine -OCLO mol/mol Chlorine dioxide -BRCL mol/mol Bromine chloride -HBR mol/mol Hydrogen bromide -BRONO2 mol/mol Bromine nitrate -CH4 mol/mol Methane -HOBR mol/mol Hypobromous acid -CH3OOH mol/mol Methyl hydroperoxide -CO mol/mol Carbon monoxide -HNO3COND mol/mol Condensed nitric acid -H2OCOND mol/mol Condensed water vapor in chemistry -F11 mol/mol CFC-11 (CCl3F) -F12 mol/mol CFC-12 (CCl2F2) -F113 mol/mol CFC-113 (CCl2FCClF2) -HCFC mol/mol HCFC -CCL4 mol/mol Carbon tetrachloride -CH3CCL3 mol/mol Methyl chloroform -CH3CL mol/mol Methyl chloride -CH3BR mol/mol Methyl bromide -H1301 mol/mol Halon 1301 (CBrF3) -H12_24 mol/mol Halon 12_24 -Q4AGE mol/mol SSG for computing age-of-air -:: - -variable_table_AC:: - -# Name Units Long Name -# ----- ------ -------------------------------- -OXSTRAT mol/mol Stratospheric odd oxygen -NOX mol/mol Odd nitrogen -HNO3 mol/mol Nitric acid -N2O5 mol/mol Dinitrogen pentoxide -HO2NO2 mol/mol Peroxynitric acid -CLONO2 mol/mol Chlorine nitrate -CLX mol/mol Odd chlorine -HCL mol/mol Hydrochloric acid -HOCL mol/mol Hypochlorous acid -H2O2 mol/mol Hydrogen peroxide -BRX mol/mol Odd bromine -N2O mol/mol Nitrous oxide -CL2 mol/mol Molecular chlorine -OCLO mol/mol Chlorine dioxide -BRCL mol/mol Bromine chloride -HBR mol/mol Hydrogen bromide -BRONO2 mol/mol Bromine nitrate -CH4 mol/mol Methane -HOBR mol/mol Hypobromous acid -CH3OOH mol/mol Methyl hydroperoxide -CO mol/mol Carbon monoxide -HNO3COND mol/mol Condensed nitric acid -H2OCOND mol/mol Condensed water vapor in chemistry -F11 mol/mol CFC-11 (CCl3F) -F12 mol/mol CFC-12 (CCl2F2) -F113 mol/mol CFC-113 (CCl2FCClF2) -HCFC mol/mol HCFC -CCL4 mol/mol Carbon tetrachloride -CH3CCL3 mol/mol Methyl chloroform -CH3CL mol/mol Methyl chloride -CH3BR mol/mol Methyl bromide -H1301 mol/mol Halon 1301 (CBrF3) -H12_24 mol/mol Halon 12_24 -:: - -variable_table_XX:: - -# Name Units Long Name -# ----- ------ -------------------------------- -O3CHEM mol/mol Ozone from chemistry -O3P mol/mol Atomic oxygen in the ground state -O1D mol/mol Atomic oxygen in the first excited state -N mol/mol Atomic nitrogen -NO mol/mol Nitric oxide -NO2 mol/mol Nitrogen dioxide -NO3 mol/mol Nitrogen trioxide -HATOMIC mol/mol Atomic hydrogen -OH mol/mol Hydroxyl radical -HO2 mol/mol Hydroperoxyl radical -CL mol/mol Atomic chlorine -CLO mol/mol Chlorine monoxide -BRO mol/mol Bromine monoxide -BR mol/mol Atomic bromine -CL2O2 mol/mol Dichlorine peroxide -CH2O mol/mol Formaldehyde -CH3O2 mol/mol Methyl peroxide -RO3OX none Ozone-to-odd oxygen ratio -:: - -#........................................................................ - -# ------------------- -# Not Implemented Yet -# ------------------- - -# Whether to advect the constituent -# --------------------------------- -advect_H2O: yes # water vapor -advect_O3: yes # ozone -advect_CO: yes # carbon monoxide -advect_CO2: yes # carbon dioxide -advect_CFC: yes # CFCs -advect_DU: yes # mineral dust -advect_SS: yes # sea salt -advect_SU: yes # sulfates -advect_BC: yes # black carbon -advect_OC: yes # organic carbon -advect_SC: yes # stratospheric chemistry -advect_AC: yes # stratospheric chemistry -advect_XX: no # generic tracer -advect_PC: yes # parameterized chemistry (GEOS-5) -advect_GMI: yes # GMI chemistry (GEOS-5) -advect_CARMA: yes # CARMA Service Component - -# Whether to diffuse the constituent -# ---------------------------------- -diffuse_H2O: yes # water vapor -diffuse_O3: yes # ozone -diffuse_XX: yes # generic tracer -diffuse_CO: yes # carbon monoxide -diffuse_CO2: yes # carbon dioxide -diffuse_CFC: yes # CFCs -diffuse_DU: yes # mineral dust -diffuse_SS: yes # sea salt -diffuse_SU: yes # sulfates -diffuse_BC: yes # black carbon -diffuse_OC: yes # organic carbon -diffuse_SC: yes # stratospheric chemistry -diffuse_XX: yes # generic tracer -diffuse_PC: yes # parameterized chemistry (GEOS-5) -diffuse_GMI: yes # GMI chemistry (GEOS-5) -diffuse_CARMA: yes # CARMA Service Component diff --git a/GAAS_GridComp/GAAS_AodRegistry.rc b/GAAS_GridComp/GAAS_AodRegistry.rc deleted file mode 100644 index e5cc27a0..00000000 --- a/GAAS_GridComp/GAAS_AodRegistry.rc +++ /dev/null @@ -1,154 +0,0 @@ -#------------------------------------------------------------------------ -#BOP -# -# !RESOURCE: AeroChem_Registy --- AeroChem Registry -# -# !HELP: -# -# The Chemistry Registry resource file is used to control basic -# properties of the GOCART and StratChem Grid Components. -# Specifically, it -# -# - selects which constituents to simulate -# - selects the number of bins for each constituent -# - specifies variable names and units for each constituent -# -# NOTE: The water vapor and ozone tracers are not really being used -# in GEOS-5. They are still kept for compatibility with GEOS-4. -# -# IMPORTANT: This file should be the same as Chem_Registry.rc, except that -# only aerosols (DU, SS, SU, BC, OC, NI) are turned ON. -# -# !REVISION HISTORY: -# -# 27May2005 da Silva Added variable tables for SU/BC/OC. -# 19dec2005 da Silva Changed volume mixing ratio units to mol/mol -# 10Feb2006 Hayashi Added analysis update frequency -# 27Jul2006 da Silva No more analysis frequencies; added GMI/PChem (GEOS-5) -# -#----------------------------------------------------------------------- -#EOP - - # &Label Active Constituents - -# -# IMPORTANT: This file should be the same as Chem_Registry.rc, except that -# only aerosols (DU, SS, SU, BC, OC) are turned ON. -# - -# Whether to include the constituent in the simulation -# ---------------------------------------------------- -doing_H2O: no # water vapor (must always ON for fvGCM) -doing_O3: no # ozone (must be always ON for fvGCM in DAS mode) -doing_CO: no # &YesNo Include carbon monoxide? -doing_CO2: no # &YesNo Include carbon dioxide? -doing_CFC: no # CFCs -doing_DU: no # &YesNo Include mineral dust? -doing_SS: no # &YesNo Include sea salt? -doing_SU: no # &YesNo Include sulfates? -doing_BC: no # &YesNo Include black carbon? -doing_OC: no # &YesNo Include organic carbon? -doing_NI: no # &YesNo Include nitrate? -doing_SC: no # &YesNo Include stratospheric chemistry? -doing_AC: no # auto chem -doing_XX: yes # generic tracer -doing_PC: no # parameterized chemistry (GEOS-5) -doing_GMI: no # GMI chemistry (GEOS-5) -doing_CARMA: no # CARMA Service Component - -# You can select the number of bins (e.g., particle size) -# for each of the constituents. Note nbins>1 may not be -# supported by some constituents -# ---------------------------------------------------- -nbins_H2O: 1 # water vapor -nbins_O3: 3 # ozone -nbins_CO: 1 # carbon monoxide -nbins_CO2: 1 # carbon dioxide -nbins_CFC: 2 # CFCs -nbins_DU: 5 # mineral dust -nbins_SS: 5 # sea salt -nbins_SU: 4 # sulfates -nbins_BC: 2 # black carbon -nbins_OC: 2 # organic carbon -nbins_NI: 5 # nitrate -nbins_SC: 34 # stratospheric chemistry -nbins_AC: 35 # auto chem -nbins_XX: 1 # generic tracer -nbins_PC: 1 # parameterized chemistry (GEOS-5) -nbins_GMI: 1 # GMI chemistry (GEOS-5) -nbins_CARMA: 1 # CARMA Service Component - -# Units for each constituent -# -------------------------- -units_H2O: kg/kg # water vapor -units_O3: kg/kg # ozone -units_CO: kg/kg # carbon monoxide -units_CO2: kg/kg # carbon dioxide -units_CFC: mol/mol # CFCs -units_DU: kg/kg # mineral dust -units_SS: kg/kg # sea salt -units_SU: kg/kg # sulfates -units_BC: kg/kg # black carbon -units_OC: kg/kg # organic carbon -units_NI: kg/kg # nitrate -units_SC: kg/kg # stratospheric chemistry -units_AC: kg/kg # auto chem -units_XX: kg/kg # generic tracer -units_PC: kg/kg # parameterized chemistry (GEOS-5) -units_GMI: kg/kg # GMI chemistry (GEOS-5) -units_CARMA: kg/kg # CARMA Service Component - -# Variable names to override defaults. Optional. Name and Units must -# be 1 token. Long names can be more than one token. -# -------------------------------------------------------------------- - -variable_table_XX:: - -# Name Units Long Name -# ----- ------ -------------------------------- -AOD 1 Total Aerosol Optical Depth -:: - -#........................................................................ - -# ------------------- -# Not Implemented Yet -# ------------------- - -# Whether to advect the constituent -# --------------------------------- -advect_H2O: yes # water vapor -advect_O3: yes # ozone -advect_CO: yes # carbon monoxide -advect_CO2: yes # carbon dioxide -advect_CFC: yes # CFCs -advect_DU: yes # mineral dust -advect_SS: yes # sea salt -advect_SU: yes # sulfates -advect_BC: yes # black carbon -advect_OC: yes # organic carbon -advect_SC: yes # stratospheric chemistry -advect_AC: yes # stratospheric chemistry -advect_XX: no # generic tracer -advect_PC: yes # parameterized chemistry (GEOS-5) -advect_GMI: yes # GMI chemistry (GEOS-5) -advect_CARMA: yes # CARMA Service Component - -# Whether to diffuse the constituent -# ---------------------------------- -diffuse_H2O: yes # water vapor -diffuse_O3: yes # ozone -diffuse_XX: yes # generic tracer -diffuse_CO: yes # carbon monoxide -diffuse_CO2: yes # carbon dioxide -diffuse_CFC: yes # CFCs -diffuse_DU: yes # mineral dust -diffuse_SS: yes # sea salt -diffuse_SU: yes # sulfates -diffuse_BC: yes # black carbon -diffuse_OC: yes # organic carbon -diffuse_SC: yes # stratospheric chemistry -diffuse_XX: yes # generic tracer -diffuse_PC: yes # parameterized chemistry (GEOS-5) -diffuse_GMI: yes # GMI chemistry (GEOS-5) -diffuse_CARMA: yes # CARMA Service Component diff --git a/GAAS_GridComp/GAAS_GridComp.rc b/GAAS_GridComp/GAAS_GridComp.rc deleted file mode 100644 index dfde1ffb..00000000 --- a/GAAS_GridComp/GAAS_GridComp.rc +++ /dev/null @@ -1,58 +0,0 @@ -# -# GAAS Grid Component Resource File. -# -# !REVISION HISTORY: -# -# 07dec2010 da Silva First version. -# -#----------------------------------------------------------------------------- - -# ----------------- -# Miscellaneous -# ----------------- - - single_channel: 550. # Single channel to analyze -eps_for_log_transform_aod: 0.01 - verbose: .TRUE. - - CoresPerNode: 8 # Will be reset in SetServices with value from main CF - - - -# ------------------- -# File Name Templates -# ------------------- -aodbias_internal_restart: aodbias_internal_restart.nc -aodbias_internal_checkpoint: aodbias_internal_checkpoint.nc - - -# ------------------- -# MIE PARAMETERS -# ------------------- - -# Common MODIS/MISR channels -### NUM_BANDS: 4 -### BANDS: 470.E-9 550.E-9 660.E-9 870.E-9 - -NUM_BANDS: 1 - BANDS: 550.E-9 - -DU_OPTICS: ExtData/PIESA/x/optics_DU.v15_3.nc -SS_OPTICS: ExtData/PIESA/x/optics_SS.v3_3.nc -SU_OPTICS: ExtData/PIESA/x/optics_SU.v1_3.nc -OC_OPTICS: ExtData/PIESA/x/optics_OC.v1_3.nc -BC_OPTICS: ExtData/PIESA/x/optics_BC.v1_3.nc -BRC_OPTICS: ExtData/PIESA/x/optics_BRC.v1_5.nc -NI_OPTICS: ExtData/PIESA/x/optics_NI.v2_5.nc - -# -------------- -# LDE Parameters -# -------------- - -top_vertical_layer: 36 # k = 36, p ~ 72 hPa - -number_of_ensemble_members: 100 - stencil_radius_in_km: 1000. - aod_weight_delta: 0.5 - -#. diff --git a/GAAS_GridComp/GAAS_GridCompMod.F90 b/GAAS_GridComp/GAAS_GridCompMod.F90 deleted file mode 100644 index 3bc763ae..00000000 --- a/GAAS_GridComp/GAAS_GridCompMod.F90 +++ /dev/null @@ -1,899 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GAAS_GridCompMod - Implements GEOS-5 Aerosol Assimation -! -! !INTERFACE: -! - MODULE GAAS_GridCompMod -! -! !USES: -! - Use ESMF - Use MAPL - Use m_StrTemplate - - Use LDE_Mod - Use Chem_SimpleBundleMod - Use Chem_RegistryMod - Use Chem_MieMod - Use Chem_AodMod - Use MAPL_GridManagerMod - Use MAPL_LatLonGridFactoryMod - Use MAPL_CubedSphereGridFactoryMod, only: CubedSphereGridFactory - use mpi - - IMPLICIT NONE - PRIVATE -! -! !PUBLIC MEMBER FUNCTIONS: - - PUBLIC SetServices -! -! !DESCRIPTION: -! -! {\tt GAAS\_GridComp} is an ESMF gridded component implementing -! the GEOS-5 Aerosol Analysis System (GAAS). -! -! Developed for GEOS-5 release Fortuna 2.3 and later. -! -! !REVISION HISTORY: -! -! 30Nov2010 da Silva Initial version. -! 26Mar2021 E.Sherman Revised to use ESMF/MAPL -! -!EOP -!------------------------------------------------------------------------- - -! Legacy state -! ------------ - TYPE GAAS_State - PRIVATE - - type (ESMF_Config) :: CF ! Private Config - type (ESMF_Grid) :: aodGrid ! AOD Grid (Vertical is "channels") - type (Chem_Mie) :: Mie ! Mie Tables, etc - - type (Chem_Registry) :: aerReg ! Registry with aerosol tracers - type (Chem_Registry) :: aodReg ! Registry with single AOD tracer - - type(LDE) :: E ! LDE object - - type (MAPL_SimpleBundle) :: q_f ! Concentration background - type (MAPL_SimpleBundle) :: q_a ! Concentration analysis - - type (MAPL_SimpleBundle) :: y_f ! On-line AOD background - type (MAPL_SimpleBundle) :: z_f ! Off-line AOD background - type (MAPL_SimpleBundle) :: z_a ! off-line AOD analysis - type (MAPL_SimpleBundle) :: z_k ! Averaging kernel approximation - - type (MAPL_SimpleBundle) :: y_a ! Background adjusted AOD analysis - type (MAPL_SimpleBundle) :: y_d ! AOD Analysis increments - - logical :: verbose=.FALSE. - - real :: eps=0.01 ! parameter for Log(AOD+eps) transform - real :: channel=550. ! Single channel to analyze - - logical :: no_fuss=.FALSE. ! do not fuss if analysis file is missing - - END TYPE GAAS_State - -! Hook for the ESMF -! ----------------- - TYPE GAAS_Wrap - TYPE (GAAS_State), pointer :: PTR => null() - END TYPE GAAS_WRAP - -CONTAINS - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices --- Sets IRF services for the GAAS Grid Component -! -! !INTERFACE: - - SUBROUTINE SetServices ( GC, RC ) - -! !ARGUMENTS: - - type(ESMF_GridComp), intent(INOUT) :: GC ! gridded component - integer, optional :: RC ! return code - -! !DESCRIPTION: Sets Initialize, Run and Finalize services. -! -! !REVISION HISTORY: -! -! 30Nov2010 da Silva Initial version. -! 26Mar20201 E.Sherman Added AERO state to IMPORT -!EOP -!------------------------------------------------------------------------- - -! Local derived type aliases -! -------------------------- - type (GAAS_State), pointer :: self ! internal, that is - type (GAAS_wrap) :: wrap - - character(len=ESMF_MAXSTR) :: comp_name - - __Iam__('SetServices') - -! ------------ - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = TRIM(comp_name) // '::' // TRIM(Iam) - -! Greetings -! --------- - IF(MAPL_AM_I_ROOT()) THEN - PRINT *, TRIM(Iam)//': ACTIVE' - PRINT *,' ' - END IF - -! Wrap internal state for storing in GC; rename legacyState -! ------------------------------------- - allocate ( self, stat=STATUS ) - VERIFY_(STATUS) - wrap%ptr => self - -! Load private Config Attributes -! ------------------------------ - self%CF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile ( self%CF,'GAAS_GridComp.rc',__RC__) - call ESMF_ConfigGetAttribute(self%CF, self%verbose, Label='verbose:', __RC__ ) - call ESMF_ConfigGetAttribute(self%CF, self%eps, Label='eps_for_log_transform_aod:', & - default=0.01, __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%channel, Label='single_channel:', & - default = 550., __RC__ ) - -! ------------------------ -! ESMF Functional Services -! ------------------------ - -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize_, __RC__ ) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run_, __RC__ ) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize_, __RC__ ) - -! Store internal state in GC -! -------------------------- - call ESMF_UserCompSetInternalState ( GC, 'GAAS_state', wrap, STATUS ) - VERIFY_(STATUS) - -! ------------------ -! MAPL Data Services -! ------------------ - -!!BOP -! -! !IMPORT STATE: - -# include "GAAS_ImportSpec___.h" - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'aerosols', & - UNITS = 'kg kg-1', & - SHORT_NAME = 'AERO', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_StateItem, & - RESTART = MAPL_RestartSkip, __RC__) - -! !INTERNAL STATE: (none for now) - -! !EXTERNAL STATE: - -# include "GAAS_ExportSpec___.h" - -! Generic Set Services -! -------------------- - call MAPL_GenericSetServices ( GC, __RC__ ) - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE SetServices - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize GAAS -! -! !INTERFACE: -! - - SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 30Nov2010 da Silva Initial version. -! 12Feb2021 E. Sherman Removed GEOS-4 legacy constructs. Uses ESMF/MAPL constructs. -!EOP -!------------------------------------------------------------------------- - - type(GAAS_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: Grid ! Grid - type(ESMF_Config) :: CF ! Universal Config - type(ESMF_Time) :: Time ! Current time - - type(ESMF_State) :: aero ! Aersol state - type(ESMF_FieldBundle) :: aeroSerialBundle ! serialized aerosol bundle - - integer :: nymd, nhms ! date, time - - integer :: dims(3), IM_World, JM_World, CM_World, Nx, Ny - logical :: isCubed - type(LatLonGridFactory) :: ll_factory - type(CubedSphereGridFactory) :: cs_factory - - character(len=ESMF_MAXSTR) :: comp_name - - __Iam__('Initialize_') - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=COMP_NAME, __RC__ ) - Iam = trim(comp_name) // ':: Initialize' - -! -------- - - if (MAPL_AM_I_ROOT()) then - PRINT *, TRIM(Iam)//': Starting...' - PRINT *,' ' - end if - -! Initialize MAPL Generic -! ----------------------- - call MAPL_GenericInitialize ( gc, IMPORT, EXPORT, clock, __RC__ ) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, CLOCK, self, GRID, CF, time, nymd, nhms, __RC__) - -! Registries -! ---------- - self%aerReg = Chem_RegistryCreate ( rcfile='GAAS_AerRegistry.rc', __RC__ ) ! REMOVE - self%aodReg = Chem_RegistryCreate ( rcfile='GAAS_AodRegistry.rc', __RC__ ) ! REMOVE - -! Mie tables, etc -! --------------- - self%Mie = Chem_MieCreate(self%CF, chemReg=self%aerReg, __RC__) !REMOVE - -! Grid size, etc -! -------------- - call MAPL_GridGet ( GRID, globalCellCountPerDim=DIMS, RC=STATUS) - IM_World = dims(1) - JM_World = dims(2) - CM_World = self%Mie%nch ! Mie tables determine number of channels - call ESMF_ConfigGetAttribute(CF, Nx, Label='NX:', __RC__) - call ESMF_ConfigGetAttribute(CF, Ny, Label='NY:', __RC__) - -! Lat lon or cubed sphere? -! ------------------------ - if ( JM_World == 6*IM_World ) then - isCubed = .True. - else - isCubed = .False. - end if - -! Create AOD grid -! --------------- - if ( isCubed ) then - cs_factory = CubedSphereGridFactory(im_world=im_world,lm=cm_world,nx=nx,ny=ny/6,__RC__) - self%aodGrid = grid_manager%make_grid(cs_factory,__RC__) - - else - ll_factory = LatLonGridFactory(grid_name='aodGrid',nx=nx,ny=ny, & - im_world=im_world,jm_world=jm_world,lm=cm_world, & - pole='PC',dateline='DC',__RC__) - self%aodGrid = grid_manager%make_grid(ll_factory,__RC__) - end if - call ESMF_GridValidate(self%aodGrid,__RC__) - -! Prepare aerosol SimpleBundle -! ----------------------------- -! Execute AERO's serialize_bundle method - call ESMF_StateGet(IMPORT, 'AERO', aero, __RC__) - call ESMF_MethodExecute(aero, label="serialize_bundle", __RC__) - call ESMF_StateGet(aero, 'serialized_aerosolBundle', aeroSerialBundle, __RC__) - -! Create SimpleBundle from aeroBundle -! Associate SimpleBundle with concentration analysis/background - self%q_f = MAPL_SimpleBundleCreate(aeroSerialBundle, name='q_f', __RC__) - self%q_a = MAPL_SimpleBundleCreate(aeroSerialBundle, name='q_a', __RC__) - -! Create AOD Simple Bundles -! ------------------------- - self%y_f = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='y_f') - self%y_f%n2d = 1 - allocate(self%y_f%r2(1), __STAT__) - self%y_f%r2(1)%name='aod_bkg' - - self%y_a = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='y_a') - self%y_a%n2d = 1 - allocate(self%y_a%r2(1), __STAT__) - self%y_a%r2(1)%name='aod_ana' - - self%y_d = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='y_d') - self%y_d%n2d = 1 - allocate(self%y_d%r2(1), __STAT__) - self%y_d%r2(1)%name='aod_inc' - -! Create AOD Simple Bundles from off-line analysis -! ------------------------------------------------ - self%z_f = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='z_f') - self%z_f%n2d = 1 - allocate(self%z_f%r2(1), __STAT__) - self%z_f%r2(1)%name='z_f' - - self%z_a = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='z_a') - self%z_a%n2d = 1 - allocate(self%z_a%r2(1), __STAT__) - self%z_a%r2(1)%name='z_a' - - self%z_k = MAPL_SimpleBundleCreate (self%aodGrid, rc=status, name='z_k') - self%z_k%n2d = 1 - allocate(self%z_k%r2(1), __STAT__) - self%z_k%r2(1)%name='z_k' - -! Create LDE object -! ----------------- - call LDE_Create ( self%E, self%CF, self%aodGrid, __RC__ ) - -#ifdef PRINT_STATES - - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': IMPORT State during Initialize():' - call ESMF_StatePrint ( IMPORT ) - print *, trim(Iam)//': EXPORT State during Initialize():' - call ESMF_StatePrint ( EXPORT ) - end if - -#endif - - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs GAAS -! -! !INTERFACE: -! - - SUBROUTINE Run_ ( gc, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 30Nov2010 da Silva Initial version. -! 26Mar2021 E.Sherman Revised to use ESMF/MAPL - -!EOP -!------------------------------------------------------------------------- - - type(GAAS_state), pointer :: self ! Legacy state - - type (MAPL_MetaComp), pointer :: MAPL - type(ESMF_Grid) :: Grid ! Grid - type(ESMF_Config) :: CF ! Universal Config - type(ESMF_Time) :: Time ! Current time - type(ESMF_Alarm) :: Alarm - type(ESMF_Alarm) :: Predictor_Alarm - type(ESMF_Alarm) :: ReplayShutOff_Alarm - - integer :: nymd, nhms, i550nm, izAOD, iyAOD - logical :: analysis_time, fexists - logical :: PREDICTOR_STEP - logical :: ReplayShutOff - - character(len=ESMF_MAXSTR) :: comp_name - - !(stassi,14feb2012)--character(len=ESMF_MAXSTR) :: TEMPLATE, filename, expid - character(len=256) :: TEMPLATE, filename, expid - - type(ESMF_State) :: aero ! Aersol state - character(len=ESMF_MAXSTR) :: fieldName - real, pointer, dimension(:,:) :: ptr2d - real, pointer, dimension(:,:,:) :: ptr3d - real, dimension(:,:), allocatable, target :: aodInt, aod_a_, aod_k_, aod_f_, & - y_a_, y_d_ - real, pointer, dimension(:,:,:) :: DUsum, SSsum, SUsum, NIsum, CAOCsum, CABCsum, CABRsum - type(ESMF_Field) :: aod_field - logical :: skip_analysis - integer :: hour,minute,second,year,month,day - type(ESMF_Time) :: current_time - type(ESMF_Field) :: aod_a_field - -# include "GAAS_DeclarePointer___.h" - - __Iam__('Run_') - -! Get pointer for IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -# include "GAAS_GetPointer___.h" - -! Set these exports to UNDEF -! -------------------------- - if ( associated(aodana) ) aodana(:,:) = MAPL_UNDEF - if ( associated(aodinc) ) aodinc(:,:) = MAPL_UNDEF - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // '::Run' - - call MAPL_GetObjectFromGC (GC, MAPL, __RC__) - -! Start timers -! ------------ - call MAPL_TimerOn( MAPL, "TOTAL") - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, CLOCK, self, GRID, CF, time, nymd, nhms, __RC__) -! - call ESMF_StateGet(import,"aod_a",aod_a_field,_RC) -! Is it time for analysis? -! ------------------------ - skip_analysis = ESMFL_field_is_undefined(aod_a_field,_RC) - analysis_time = .not.skip_analysis - -! Is it time for analysis? -! ------------------------ - call ESMF_ClockGetAlarm(Clock,'PredictorActive',Predictor_Alarm,__RC__) - PREDICTOR_STEP = ESMF_AlarmIsRinging( Predictor_Alarm,__RC__) - - call ESMF_ClockGetAlarm(Clock,'ReplayShutOff',ReplayShutOff_Alarm,__RC__) - ReplayShutOff = ESMF_AlarmIsRinging( ReplayShutOff_Alarm,__RC__) - -! Stop here if it is NOT analysis time -! ------------------------------------- - if ( PREDICTOR_STEP .or. ReplayShutOff .or. (.not. analysis_time) ) then - RETURN_(ESMF_SUCCESS) - end if - -! OK, let's assimilate the AOD analysis -! ------------------------------------- - if (MAPL_AM_I_ROOT()) then - PRINT *, TRIM(Iam)//': Starting Aerosol Assimilation at ', nymd, nhms - PRINT *,' ' - end if - -! Retrieve AOD from AERO state and fill SimpleBundle -! ------------------------------------------------------ - call ESMF_StateGet(import, 'AERO', aero, __RC__) - -! Set RH for aerosol optics - call ESMF_AttributeGet(aero, name='relative_humidity_for_aerosol_optics', value=fieldName, __RC__) - if (fieldName /= '') then - call MAPL_GetPointer(aero, ptr3d, trim(fieldName), __RC__) - ptr3d = rh2 - end if - - call ESMF_AttributeGet(aero, name='air_pressure_for_aerosol_optics', value=fieldName, __RC__) - if (fieldName /= '') then - call MAPL_GetPointer(aero, ptr3d, trim(fieldName), __RC__) - ptr3d = ple - end if - - ! Set wavelength at 550nm (550 should be a parameter called "monochromatic_wavelength_nm" defined in GAAS) - call ESMF_AttributeSet(aero, name='wavelength_for_aerosol_optics', value=self%channel*1.0e-9, __RC__) - - ! execute the aero provider's optics method - call ESMF_MethodExecute(aero, label="get_monochromatic_aop", __RC__) - - ! Retrieve vertically summed AOD from AERO - allocate(aodInt(ubound(rh2,1), ubound(rh2,2)), __STAT__) - aodInt = 0.0 - call ESMF_AttributeGet(aero, name='monochromatic_extinction_in_air_due_to_ambient_aerosol', value=fieldName, __RC__) - if (fieldName /= '') then - call MAPL_GetPointer(aero, ptr2d, trim(fieldName), __RC__) - aodInt = ptr2d - end if - -! Set AOD value in y_f -! self%y_f%r2(1)%name='aod' - self%y_f%r2(1)%qr4 => aodInt ! vertically summed AOD - self%y_f%r2(1)%q => self%y_f%r2(1)%qr4 - - if ( self%verbose ) then - call MAPL_SimpleBundlePrint(self%y_f) - call MAPL_SimpleBundlePrint(self%q_f) - end if - - -! Read off-line AOD analysis, background and averaging kernel -! ----------------------------------------------------------- - self%z_a%r2(1)%qr4 => aod_a !Move these pointer assignments to Initialize method? -ES - self%z_a%r2(1)%q => self%z_a%r2(1)%qr4 - - self%z_f%r2(1)%qr4 => aod_f - self%z_f%r2(1)%q => self%z_f%r2(1)%qr4 - - self%z_k%r2(1)%qr4 => aod_k - self%z_k%r2(1)%q => self%z_k%r2(1)%qr4 - -! Print summary of input -! ---------------------- - if ( self%verbose ) then - call MAPL_SimpleBundlePrint(self%z_f) - call MAPL_SimpleBundlePrint(self%z_a) - call MAPL_SimpleBundlePrint(self%z_k) - end if - -! Convert AOD to Log(AOD+eps) for A.K. Adjustment -! ----------------------------------------------- - self%z_a%r2(1)%q = Log(self%z_a%r2(1)%q + self%eps) - self%z_f%r2(1)%q = Log(self%z_f%r2(1)%q + self%eps) - self%y_f%r2(1)%q = Log(self%y_f%r2(1)%q + self%eps) - -! Background adjustment using averaging kernel -! This must be done in the Log(AOD+eps) variable -! ----------------------------------------------- - allocate(y_a_(ubound(rh2,1), ubound(rh2,2)), __STAT__) - y_a_ = self%z_a%r2(1)%q & - + (1.-self%z_k%r2(1)%q) & - * ( self%y_f%r2(1)%q - self%z_f%r2(1)%q ) - - self%y_a%r2(1)%qr4 => y_a_ - self%y_a%r2(1)%q => self%y_a%r2(1)%qr4 - -! Convert from Log(AOD+eps) back to AOD -! ------------------------------------- - self%y_a%r2(1)%q = Exp(self%y_a%r2(1)%q) - self%eps - self%y_f%r2(1)%q = Exp(self%y_f%r2(1)%q) - self%eps - - allocate(y_d_(ubound(rh2,1), ubound(rh2,2)), __STAT__) - y_d_ = self%y_a%r2(1)%q - self%y_f%r2(1)%q - self%y_d%r2(1)%qr4 => y_d_ - self%y_d%r2(1)%q => self%y_d%r2(1)%qr4 - - - if ( self%verbose ) then - call MAPL_SimpleBundlePrint(self%y_d) - call MAPL_SimpleBundlePrint(self%y_a) - call MAPL_SimpleBundlePrint(self%y_f) - end if - - -! Get sum of aerosol mixing ratios - call get_aerosolSum (aero, 'dust', DUsum, __RC__) - call get_aerosolSum (aero, 'seasalt', SSsum, __RC__) - call get_aerosolSum (aero, 'sulfate', SUsum, __RC__) - call get_aerosolSum (aero, 'nitrate', NIsum, __RC__) - call get_aerosolSum (aero, 'organicCarbon', CAOCsum, __RC__) - call get_aerosolSum (aero, 'blackCarbon', CABCsum, __RC__) - call get_aerosolSum (aero, 'brownCarbon', CABRsum, __RC__) - -! Handle 3D exports (save bkg for increments) -! ------------------------------------------- - if ( associated(duinc) ) duinc = DUsum - if ( associated(ssinc) ) ssinc = SSsum - if ( associated(niinc) ) niinc = NIsum - if ( associated(bcinc) ) bcinc = CABCsum - if ( associated(ocinc) ) ocinc = CAOCsum - if ( associated(brinc) ) brinc = CABRsum - if ( associated(suinc) ) suinc = SUsum - -! Create concetration analysis from AOD increments -! Here we pass in the y_f and y_d in terms of AOD, -! *not* Log(AOD+eps) -! ------------------------------------------------ - call LDE_Projector1c ( self%E, self%q_a, self%q_f, self%y_f, self%y_d, self%verbose, __RC__ ) - -! Get updated sum of aerosol mixing ratios - call get_aerosolSum (aero, 'dust', DUsum, __RC__) - call get_aerosolSum (aero, 'seasalt', SSsum, __RC__) - call get_aerosolSum (aero, 'sulfate', SUsum, __RC__) - call get_aerosolSum (aero, 'nitrate', NIsum, __RC__) - call get_aerosolSum (aero, 'organicCarbon', CAOCsum, __RC__) - call get_aerosolSum (aero, 'blackCarbon', CABCsum, __RC__) - call get_aerosolSum (aero, 'brownCarbon', CABRsum, __RC__) - -! Handle 2D exports -! ----------------- - if ( associated(aodana) ) aodana(:,:) = self%y_a%r2(1)%q(:,:) - if ( associated(aodinc) ) aodinc(:,:) = self%y_d%r2(1)%q(:,:) - -! Handle 3D exports -! ----------------- - if ( associated(duana) ) duana = DUsum - if ( associated(ssana) ) ssana = SSsum - if ( associated(niana) ) niana = NIsum - if ( associated(bcana) ) bcana = CABCsum - if ( associated(ocana) ) ocana = CAOCsum - if ( associated(brana) ) brana = CABRsum - if ( associated(suana) ) suana = SUsum - -! Compute increments - if ( associated(duinc) ) duinc = DUsum - duinc - if ( associated(ssinc) ) ssinc = SSsum - ssinc - if ( associated(niinc) ) niinc = NIsum - niinc - if ( associated(bcinc) ) bcinc = CABCsum - bcinc - if ( associated(ocinc) ) ocinc = CAOCsum - ocinc - if ( associated(brinc) ) brinc = CABRsum - brinc - if ( associated(suinc) ) suinc = SUsum - suinc - - -#ifdef PRINT_STATES - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': IMPORT State during Run():' - call ESMF_StatePrint ( IMPORT ) - print *, trim(Iam)//': EXPORT State during Run():' - call ESMF_StatePrint ( EXPORT ) - end if -#endif - -! Stop timers -! ------------ - call MAPL_TimerOff( MAPL, "TOTAL") - -if (mapl_am_i_root()) print*,'GAAS finished!' - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - -Contains - - subroutine get_aerosolSum (state, aeroName, aeroSum, rc) - - implicit none - - !ARGUMENTS: - type (ESMF_State), intent(inout) :: state - character (len=*), intent(in) :: aeroName - real, dimension(:,:,:), pointer, intent(out) :: aeroSum - integer, optional, intent(out) :: rc - - !LOCALS: - integer :: status - character (len=ESMF_MAXSTR) :: fld_name - character (len=ESMF_MAXSTR) :: aeroToken - - !Begin... - - select case (aeroName) - case ('dust') - aeroToken = 'DU' - case ('seasalt') - aeroToken = 'SS' - case ('sulfate') - aeroToken = 'SU' - case ('nitrate') - aeroToken = 'NI' - case ('organicCarbon') - aeroToken = 'CA.oc' - case ('blackCarbon') - aeroToken = 'CA.bc' - case ('brownCarbon') - aeroToken = 'CA.br' - end select - - ! Set aerosol to retrieve sum for - call ESMF_AttributeSet(state, name='aerosolName', value=trim(aeroName), __RC__) - - ! execute the aero provider's optics method - call ESMF_MethodExecute(state, label="get_mixRatioSum", __RC__) - - call ESMF_AttributeGet(state, name='sum_of_internalState_aerosol_'//trim(aeroToken), value=fieldName, __RC__) - if (fieldName /= '') then - call MAPL_GetPointer(state, aeroSum, trim(fieldName), __RC__) - end if - - end subroutine get_aerosolSum - - END SUBROUTINE Run_ - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ --- Finalize GAAS -! -! !INTERFACE: -! - - SUBROUTINE Finalize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: gc ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 30Nov2010 da Silva Initial version. -! -!EOP -!------------------------------------------------------------------------- - - type(GAAS_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: Grid ! Grid - type(ESMF_Config) :: CF ! Universal Config - type(ESMF_Time) :: Time ! Current time - - integer :: nymd, nhms ! date, time - - character(len=ESMF_MAXSTR) :: COMP_NAME - -# include "GAAS_DeclarePointer___.h" - - __Iam__('Finalize_') - -! Declare and get pointer for IMPORT/EXPORT/INTERNAL states -! --------------------------------------------------------- -# include "GAAS_GetPointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // '::Finalize' - -! Initialize MAPL Generic -! ----------------------- - call MAPL_GenericFinalize ( GC, IMPORT, EXPORT, CLOCK, __RC__ ) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, CLOCK, self, GRID, CF, time, nymd, nhms, __RC__) - -! Destroy LDE object -! ------------------ - call LDE_Destroy ( self%E, __RC__ ) - -! Destroy all simple bundles -! -------------------------- - - call MAPL_SimpleBundleDestroy(self%y_f, __RC__) - call MAPL_SimpleBundleDestroy(self%y_a, __RC__) - call MAPL_SimpleBundleDestroy(self%y_d, __RC__) - -!ALT call MAPL_SimpleBundleDestroy(self%q_f, __RC__) -!ALT call MAPL_SimpleBundleDestroy(self%q_a, __RC__) - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end SUBROUTINE Finalize_ - -!....................................................................... - - subroutine extract_ ( GC, CLOCK, self, GRID, CF, time, nymd, nhms, rc) - - type(ESMF_GridComp), intent(INout) :: GC ! Grid Comp object - type(ESMF_Clock), intent(in) :: CLOCK ! Clock - - type(GAAS_state), pointer :: self ! Legacy state - type(ESMF_Grid), intent(out) :: GRID ! Grid - type(ESMF_Config), intent(out) :: CF ! Universal Config - type(ESMF_TIME), intent(out) :: Time ! Time - type(ESMF_TimeInterval) :: TimeStep ! used to define a clock - integer, intent(out) :: nymd, nhms ! date, time - integer, intent(out), optional :: rc - -! --- - - character(len=ESMF_MAXSTR) :: comp_name - - __Iam__('extract_') - - type(MAPL_MetaComp), pointer :: MC - type(GAAS_Wrap) :: wrap - integer :: iyr, imm, idd, ihr, imn, isc - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=comp_name, __RC__ ) - Iam = trim(COMP_NAME) // '::extract_' - - rc = 0 - -! Get my internal state -! --------------------- - call ESMF_UserCompGetInternalState(gc, 'GAAS_state', WRAP, STATUS) - VERIFY_(STATUS) - self => wrap%ptr - -! Get the configuration -! --------------------- - call ESMF_GridCompGet ( GC, config=CF, __RC__ ) - -! Extract time as simple integers from clock -! ------------------------------------------ - call ESMF_ClockGet(CLOCK, timeStep=TimeStep, currTIME=TIME,__RC__) - -! NOTE: we shift the time back one time step because the clock ticks -! prior to writing HISTORY, so now we will write at 0Z what is intended -! to be the analysis at 0Z. - TIME = TIME + TimeStep - - call ESMF_TimeGet(TIME ,yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc, __RC__) - call MAPL_PackTime(nymd,iyr,imm,idd) - call MAPL_PackTime(nhms,ihr,imn,isc) - -! Extract the ESMF Grid -! --------------------- - call ESMF_GridCompGet ( GC, grid=GRID, __RC__) - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - - END MODULE GAAS_GridCompMod diff --git a/GAAS_GridComp/GAAS_GridComp_ExtData.rc b/GAAS_GridComp/GAAS_GridComp_ExtData.rc deleted file mode 100644 index 06f20527..00000000 --- a/GAAS_GridComp/GAAS_GridComp_ExtData.rc +++ /dev/null @@ -1,9 +0,0 @@ -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - aod_a '1' N N F0 none none AOD das.aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 - aod_f '1' N N F0 none none AOD das.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 - aod_k '1' N N F0 none none AOD das.aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 1978-01-01T00:00:00P0000-00-00T03:00:00 -%% diff --git a/GAAS_GridComp/GAAS_GridComp_ExtData.yaml b/GAAS_GridComp/GAAS_GridComp_ExtData.yaml deleted file mode 100644 index 4afa1c62..00000000 --- a/GAAS_GridComp/GAAS_GridComp_ExtData.yaml +++ /dev/null @@ -1,33 +0,0 @@ -Collections: - aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4: - template: das.aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 - freq: PT3H - -Samplings: - GAAS_sample_0: - update_offset: PT450S - exact: True - -Exports: - aod_a: - collection: aod_a.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - aod_f: - collection: aod_f.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - aod_k: - collection: aod_k.sfc.%y4%m2%d2_%h2%n2z.nc4 - sample: GAAS_sample_0 - variable: AOD - fail_on_missing_file: false - diff --git a/GAAS_GridComp/GAAS_Mie.rc b/GAAS_GridComp/GAAS_Mie.rc deleted file mode 100644 index ed8d1d36..00000000 --- a/GAAS_GridComp/GAAS_Mie.rc +++ /dev/null @@ -1,45 +0,0 @@ -# -# Mie Tables for AOD analysis. -# -# IMPORTANT: For historical reasons, this resource file is used by -# ana_aod.x to specify the relevant Mie Tables. However, -# the GAAS Grid Component does not use this file but rather its own -# resource file (GAAS_GridComp.rc) because of inconsistencies in the -# MieCreate overloads (different resource names: n_channels vs. NUM_BANDS). -# This is should be fixed. -# -#---------------------------------------------------------------- - -# First block specifies number and channels to compute AOD over -# and the input filenames to use. -# ------------------------------------------------------------ - -# OMI SO2: 305, 310, 324, 380, 440, 500 -# OMI Aerosol: 354 388 [~380] 471 [~470] -# MODIS: 470 550 659 865 1240 1640 2130 -# MISR: 468 [~470] 558 [~550] 672 [~670] 867 [~865] -# PARASOL: 670 [~670] 865 - -# From ODS: -# OMI: 354 388 471 -# MODIS: 470 550 660 870 1200 1600 2100 -# MISR: 468 558 672 867 -# PARASOL: 865 -# COMMON: 470 550 660 870 - -# Common MODIS/MISR channels -n_channels: 4 -r_channels: 470.E-9 550.E-9 660.E-9 870.E-9 - -#n_channels: 1 -#r_channels: 550.E-9 - -filename_optical_properties_DU: ExtData/PIESA/x/optics_DU.v15_3.nc -filename_optical_properties_SS: ExtData/PIESA/x/optics_SS.v3_3.nc -filename_optical_properties_SU: ExtData/PIESA/x/optics_SU.v1_3.nc -filename_optical_properties_OC: ExtData/PIESA/x/optics_OC.v1_3.nc -filename_optical_properties_BC: ExtData/PIESA/x/optics_BC.v1_3.nc -filename_optical_properties_NI: ExtData/PIESA/x/optics_NI.v2_5.nc -filename_optical_properties_BRC: ExtData/PIESA/x/optics_BRC.v1_5.nc - -##r_channels: .305e-6 .310e-6 .324e-6 .354e-6 .388e-6 .440e-6 .471e-6 .500e-6 .55e-6 .659e-6 .670e-6 .865e-6 1.24e-6 1.64e-6 2.13e-6 diff --git a/GAAS_GridComp/GAAS_Registry.rc b/GAAS_GridComp/GAAS_Registry.rc deleted file mode 100644 index 28efd95b..00000000 --- a/GAAS_GridComp/GAAS_Registry.rc +++ /dev/null @@ -1,81 +0,0 @@ -# -# This the GEOS-5 Aerosol Analysis System (GAAS) Grid Component Registry. It defines Import, -# Internal and Export states for this component. -# -# !REVISION HISTORY: -# 30Nov2010 da Silva First Version -# -# ----------------------------------------------------------------- - -COMP_NAME: GAAS - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# ---------|------------|-----|---|----|---|---|-----|------|-----|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst | Name -# ---------|------------|-----|---|----|---|---|-----|------|-----|-------------------------- - DELP | Pa | xyz | C | | | | | | | Pressure Thickness - RH2 | 1 | xyz | C | | | | | | | Relative Humidity - PLE | Pa | xyz | E | | | | | | | Air Pressure - aod_a | 1 | xy | C | | | | | | x | AOD - aod_f | 1 | xy | C | | | | | | x | AOD - aod_k | 1 | xy | C | | | | | | x | AOD -# ---------|------------|-----|---|----|---|---|-----|------|-------------------------- - - -# ------------ -# Export State -# ------------ - - -# ---------|------------|-----|---|----|---|---|-----|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| Name -# ---------|------------|-----|---|----|---|---|-----|--------------------------------- - AODANA | 1 | xy | C | | | | | Aerosol Optical Depth Analysis - AODINC | 1 | xy | C | | | | | Aerosol Optical Depth Analysis Increment -# - DUANA | kg/kg | xyz | C | | | | | Dust Mixing Ratio Analysis - SSANA | kg/kg | xyz | C | | | | | Sea-salt Mixing Ratio Analysis - NIANA | kg/kg | xyz | C | | | | | Nitrate Mixing Ratio Analysis - SUANA | kg/kg | xyz | C | | | | | Sulfate Mixing Ratio Analysis - BCANA | kg/kg | xyz | C | | | | | Black Carbon Mixing Ratio Analysis - OCANA | kg/kg | xyz | C | | | | | Organic Carbon Mixing Ratio Analysis - BRANA | kg/kg | xyz | C | | | | | Brown Carbon Mixing Ratio Analysis -# - DUINC | kg/kg | xyz | C | | | | | Dust Mixing Ratio Analysis Increments - SSINC | kg/kg | xyz | C | | | | | Sea-salt Mixing Ratio Analysis Increments - NIINC | kg/kg | xyz | C | | | | | Nitrate Mixing Ratio Analysis Increments - SUINC | kg/kg | xyz | C | | | | | Sulfate Mixing Ratio Analysis Increments - BCINC | kg/kg | xyz | C | | | | | Black Carbon Mixing Ratio Analysis Increments - OCINC | kg/kg | xyz | C | | | | | Organic Carbon Mixing Ratio Analysis Increments - BRINC | kg/kg | xyz | C | | | | | Brown Carbon Mixing Ratio Analysis Increments -# ---------|------------|-----|---|----|---|---|-----|--------------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column - -#InternalSpec name="GAAS", cols="short_name,units,dims,vlocation,stat,refresh_interval,averaging_interval,num_subtiles,default,norestart,halowidth,friendlyto,long_name"> -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -#/InternalSpec> - - diff --git a/GAAS_GridComp/LDE_Mod.F90 b/GAAS_GridComp/LDE_Mod.F90 deleted file mode 100644 index fd15f504..00000000 --- a/GAAS_GridComp/LDE_Mod.F90 +++ /dev/null @@ -1,1482 +0,0 @@ -! -! Implements Local Displacement Ensembles. It can handle the GEOS-5 lat/lon -! or cubed-sphere grids. -! -! REVISION HISTORY: -! Arlindo da Silva , April 2010 -! Cubed sphere support added July 2012. -! 26March2021 E.Sherman Updated LDE_Projector1c_Cubed_ to work with GOCART2G -!---------------------------------------------------------------------------- - -# include "MAPL_Generic.h" - -module LDE_Mod - - use ESMF - use MAPL - - use Chem_SimpleBundleMod - use m_Random - use m_MergeSorts - - implicit NONE - - private - public LDE - public LDE_Create - public LDE_Destroy - public LDE_Generate - public LDE_Projector1c - - type LDE - - type(ESMF_Config), pointer :: CF - - type(ESMF_Grid), pointer :: Grid - type(ESMF_VM) :: VM - - integer :: IM_World=-1 ! global number of lons - integer :: JM_World=-1 ! global number of lats - integer :: EM_World=-1 ! Max Size of ensemble dimension = Nx*Ny - - real :: channel ! single channel to analyze - - real :: Delta=-1 ! weight parameter - - integer :: ks=1 ! top vertical layer - - integer :: EM=-1 ! Number of esembles to keep - integer :: Nx=-1, Ny=-1 ! Stencil (lon,lat) sizes - real :: R=-1.0 ! stencil Radius - - logical :: isCubed ! Either Cubed Sphere or LatLon - -! Lat/Lon indices -! --------------- - integer, pointer :: Ie(:,:) => null() ! (JM_World,EM_World) - integer, pointer :: Je(:,:) => null() ! (JM_World,EM_World) - -! Cubed Sphere Indices -! -------------------- - integer, pointer :: Indx(:) => null() ! (EM_WORLD) - - end type LDE - - interface LDE_Generate - module procedure LDE_Generate2d - end interface - - interface LDE_Projector - module procedure LDE_Projector1c - end interface - - integer, parameter :: OCEAN = 0, LAND = 1, SEA_ICE = 2 - - include "mpif.h" -CONTAINS - - subroutine LDE_Create ( self, CF, Grid, rc ) -! -! Initialize ensemble parameters, including ensemble size and -! ensemble indices (on root PE only). Notice that it is implicitly -! assumed a GEOS-5 lat/lon grid for now. -! - type(LDE) , intent(inout) :: self - type(ESMF_Config), intent(inout), target :: CF - type(ESMF_Grid), intent(inout), target :: Grid - integer, intent(out) :: rc -! --- - - __Iam__('LDE_Create') - - integer :: dims(3) - - self%Grid => Grid - -! World coordinates -! ----------------- - call MAPL_GridGet ( grid, globalCellCountPerDim=DIMS, __RC__ ) - self%IM_WORLD = dims(1) - self%JM_WORLD = dims(2) - -! Cubed sphere or lat/lon grid? -! ----------------------------- - if ( self%JM_WORLD == self%IM_WORLD * 6 ) then ! Heuristic - self%isCubed = .TRUE. - else - self%isCubed = .FALSE. - end if - -! Stencil properties -! ------------------ - call ESMF_ConfigGetAttribute(CF, self%R, Label='stencil_radius_in_km:', __RC__ ) - self%R = 1000. * self%R ! now in meters - -! Get ensemble size -! ----------------- - if ( self%isCubed ) then - call getEnsSizeCubed_ ( self%IM_World, self%JM_World, self%R, self%Nx, self%Ny, __RC__ ) - self%EM_World = self%Nx * self%Ny - else - call getEnsSizeLatLon_ ( self%IM_World, self%JM_World, self%R, self%Nx, self%Ny, __RC__ ) - self%EM_World = nint(0.75 * self%Nx * self%Ny) ! pi/4 = 0.7853 ~ 0.75 - end if - -! User may elect a smaller number of ensemble members -! --------------------------------------------------- - call ESMF_ConfigGetAttribute(CF, self%EM, default=self%EM_World, & - Label='number_of_ensemble_members:', __RC__ ) - self%EM = min(self%EM,self%EM_World) - -! Get VM for later -! ---------------- - call ESMF_VMGetCurrent(self%VM,__RC__) - -! Set Ensemble indices on root PE -! ------------------------------- - if ( self%isCubed ) then - - allocate(self%Indx(self%EM_World), __STAT__ ) - - if ( MAPL_am_I_root() ) then - call getEnsIndicesCubed_ ( self%EM_World, self%Indx, __RC__ ) - endif - - call MAPL_CommsBcast (self%vm, self%Indx, size(self%Indx), 0, __RC__) - -! Lat/Lon Grid -! ------------ - else - - allocate(self%Ie(self%JM_World,self%EM_World), & - self%Je(self%JM_World,self%EM_World), __STAT__ ) - - if ( MAPL_am_I_root() ) then - call getEnsIndicesLatLon_ ( self%IM_World, self%JM_World, self%EM_World, & - self%R, self%Ie, self%Je, __RC__) - endif - - call MAPL_CommsBcast (self%vm, self%Ie, size(self%Ie), 0, __RC__) - call MAPL_CommsBcast (self%vm, self%Je, size(self%Je), 0, __RC__) - - end if - -! Land/ocean channels for single channel formulation -! -------------------------------------------------- - call ESMF_ConfigGetAttribute(CF, self%channel, Label='single_channel:', __RC__) - -! Weight parameter (Delta<0 means do not weight ensemble members) -! --------------------------------------------------------------- - call ESMF_ConfigGetAttribute(CF, self%delta, Label='aod_weight_delta:', & - default=-1.0, __RC__) - -! Top vertical layer -! ------------------ - call ESMF_ConfigGetAttribute(CF, self%ks, Label='top_vertical_layer:', & - default=1, __RC__) - - if ( MAPL_AM_I_Root() ) then - print * - if ( self%isCubed ) then - print *, 'Initialized LDE on Cubed Sphere with ', self%em, ' ensemble members' - else - print *, 'Initialized LDE on LatLon with ', self%em, ' ensemble members' - end if - end if - - end subroutine LDE_Create - -!......................................................................... - - subroutine LDE_Destroy ( self, rc ) -! -! Initialize ensemble parameters, including ensemble size and -! ensemble indices (on root PE only). Notice that it is implicitly -! assumed a GEOS-5 lat/lon grid for now. -! - type(LDE) , intent(inout) :: self - integer, intent(out) :: rc -! --- - - __Iam__('LDE_Destroy') - - rc = 0 - self%IM_WORLD = -1 - self%JM_WORLD = -1 - self%EM = -1 - self%Nx = -1 - self%Ny = -1 - self%R = -1.0 - - if ( self%isCubed ) then - deallocate(self%Indx, __STAT__ ) - else - deallocate(self%Ie, self%Je, __STAT__ ) - end if - - end subroutine LDE_Destroy - -!......................................................................... - - subroutine LDE_Generate2d ( self, e, a, rc ) -! -! Generates LDE based on a 2D horizontal (lon,lat) array. -! - type(LDE), intent(in) :: self - real, pointer :: a(:,:) ! input distributed horizontal array - real, pointer :: e(:,:,:) ! ensemble of distributed horizontal array - integer, intent(out) :: rc - -! --- - - __Iam__('LDE_Generate2d') - - if ( self%isCubed ) then - call LDE_Generate2d_Cubed_ ( self, e, a, rc ) - else - call LDE_Generate2d_LatLon_ ( self, e, a, rc ) - end if - - end subroutine LDE_Generate2d - -!......................................................................... - - subroutine LDE_Qinc_Global ( self, x_d, x_f, V, rc ) -! -! This is a single PE routine for computing LDEs and computing the -! Q analysis increments. -! All arrays are global. -! - type(LDE), intent(in) :: self -! real(kind=ESMF_KIND_R8), pointer :: x_d(:,:) ! Output: Increments - real(kind=ESMF_KIND_R4), pointer :: x_d(:,:) ! Output: Increments - real, pointer :: x_f(:,:) ! Input: Bkg on a single level - real, pointer :: V(:,:,:) ! Input: Ensemble of V - integer, intent(out) :: rc - -! --- - - __Iam__('LDE_Qinc_Global') - - if ( self%isCubed ) then -!ALT call LDE_Qinc_Global_Cubed_ ( self, x_d, x_f, V, rc ) - else - call LDE_Qinc_Global_LatLon_ ( self, x_d, x_f, V, rc ) - end if - - end subroutine LDE_Qinc_Global - -! ............................................................................. - - subroutine LDE_Projector1c ( self, bQ_a, bQ_f, bY_f, bY_d, verbose, rc ) -! -! Uses Lagrangian Displacement Ensembles to produce aerosol mixing ratio -! analysis given AOD (or log-transformed AOD) background and analysis -! increments, along with the concentrations background. -! -! This is the SINGLE CHANNEL version, with same channel used over land -! and ocean. - - type(LDE), intent(inout) :: self - type(MAPL_SimpleBundle), intent(inout) :: bQ_f ! Aerosol concentration Background - type(MAPL_SimpleBundle), intent(inout) :: bY_f ! AOD background (or log-AOD) - type(MAPL_SimpleBundle), intent(inout) :: bY_d ! AOD increment (or log-AOD) - - type(MAPL_SimpleBundle), intent(inout) :: bQ_a ! Aerosol concentration Analysis; may share - ! storage with bQ_f - - logical, OPTIONAL, intent(in) :: verbose - integer, intent(out) :: rc ! error code - - - if ( self%isCubed ) then - call LDE_Projector1c_Cubed_ ( self, bQ_a, bQ_f, bY_f, bY_d, verbose, rc ) - else - call LDE_Projector1c_Latlon_ ( self, bQ_a, bQ_f, bY_f, bY_d, verbose, rc ) - end if - - end subroutine LDE_Projector1c - -! ............................................................................. - -! --------------------- -! Lat/Lon Grid Routines -! --------------------- - - subroutine getEnsSizeLatLon_ ( im, jm, R, Nx, Ny, rc ) - integer, intent(in) :: im - integer, intent(in) :: jm - real, intent(in) :: R ! stencil radius - integer, intent(out) :: Nx ! stencil size in lon, at the equator - integer, intent(out) :: Ny ! stencil size in lat, away from poles - integer, intent(out) :: rc - - real*8 :: dx, dy - - __Iam__('getEnsSizeLatLon_') - - rc = 0 - dx = 2. * MAPL_Radius * MAPL_PI / im - dy = MAPL_Radius * MAPL_PI / ( jm - 1 ) - Nx = 2 * (nint(R/dx)-1) + 1 - Ny = 2 * (nint(R/dy)-1) + 1 - - if ( Nx<3 .OR. Ny<3 ) then - rc = 1 - return - end if - - if ( Nx*Ny > im*jm ) then - rc = 2 - return - end if - - end subroutine getEnsSizeLatLon_ - - subroutine getEnsIndicesLatLon_ ( im, jm, em, R, Ie, Je, rc ) - integer, intent(in) :: im - integer, intent(in) :: jm - integer, intent(in) :: em ! ensemble size - real, intent(in) :: R ! stencil radius -! --- Ensemble Coordinates ---- - integer, intent(out) :: Ie(jm,em) ! symmetric in longitude - integer, intent(out) :: Je(jm,em) ! symmetric in longitude - integer, intent(out) :: rc -! ---- - - real*8 :: lat, lon, dLat, dLon ! in radians - real*8 :: coslon(im), sinlon(im), coslat(jm), sinlat(jm) - real*8 :: x, y, z, xs, ys, zs, D2_, d2 - integer :: dJ, i, j, is, js, Nx, Ny, ne - integer :: Kx, Mx, j_deficit, n_deficit - - integer :: Ie_(im*jm), Je_(im*jm), indx(im*jm) ! Ensemble index before thinning - real*8 :: rn(im*jm) ! random numbers - - __Iam__('getEnsIndicesLatLon_') - - rc = 0 - -! Check consistency of ensemble size -! ---------------------------------- - call getEnsSizeLatLon_ ( im, jm, R, Nx, Ny, __RC__ ) - if ( em > Nx * Ny ) then - print *, trim(Iam)//': inconsistent em, Nx, Ny', em, Nx, Ny - STATUS = 1 - VERIFY_(STATUS) - end if - -! Trig - Assumes GEOS-5 lat/lon grid -! ---------------------------------- - dLon = 2. * MAPL_PI / im - dLat = MAPL_PI / ( jm - 1 ) - do i = 1, im - lon = -MAPL_pi + i * dLon - coslon(i) = cos(lon) - sinlon(i) = sin(lon) - end do - do j = 1, jm - lat = -MAPL_pi/2. + (j-1)*dLat - coslat(j) = cos(lat) - sinlat(j) = sin(lat) - end do - -! Half threshold distance squared on units of radius -! -------------------------------------------------- - D2_ = (R / MAPL_Radius)**2 - -! Build patch around (is,js) with points that are within L -! -------------------------------------------------------- - Ie = 0 - Je = 0 - dJ = Ny / 2 ! Ny is always odd - - call zufalli(0) ! initialize random number generator with default seed - - is = 1 ! symmetric in longitude - js_: do js = 1, jm - -! Initialize indices for this latitude -! ------------------------------------ - iE_ = 0 - jE_ = 0 - ne = 0 - -! Coordinates of reference point on unit sphere -! --------------------------------------------- - xs = coslat(js) * coslon(is) - ys = coslat(js) * sinlon(is) - zs = sinlat(js) - -! Find those grid points that are close enough -! -------------------------------------------- - jj_: do j = js-dJ, js+dJ - if ( j < 1 .OR. j > jm ) cycle jj_ - ii_: do i = 1, im ! it works at the poles as well - if ( i==is .AND. j==js ) cycle ii_ ! eliminate central point - x = coslat(j) * coslon(i) - y = coslat(j) * sinlon(i) - z = sinlat(j) - d2 = 2. * abs(1.0 - (x*xs + y*ys + z*zs)) ! chordal distance - if ( d2 <= D2_ ) then - ne = ne + 1 - iE_(ne) = i ! record this longitude index - jE_(ne) = j ! record this latitude index - end if - end do ii_ - end do jj_ - -! Consistency check, should never happen -! -------------------------------------- - if ( ne < em ) then ! recall that we skipped middle point (ZERO perturbation) - print *, trim(Iam)//': not enough ensemble members: ', & - js, ne, em, (em-ne) - STATUS = 3 - VERIFY_(STATUS) - end if - -! Final shuffle so that we can select fewer members later, -! say, the first 100 member will be uniformly distributed -! in space. ZERO member will be added to the end -! NOTE: Sampling is biased towards polar latitudes -! ----------------------------------------------------- - call zufall ( ne, rn) - call IndexSet ( ne, indx ) - call IndexSort ( ne, indx, rn, descend=.false.) - Ie(js,1:em) = Ie_ ( (/ (indx(i), i=1,em) /) ) - Je(js,1:em) = Je_ ( (/ (indx(i), i=1,em) /) ) - - end do js_ - - rc = 0 - - end subroutine getEnsIndicesLatLon_ - -!......................................................................... - - subroutine LDE_Generate2d_LatLon_ ( self, e, a, rc ) -! -! Generates LDE based on a 2D horizontal (lon,lat) array. -! - type(LDE), intent(in) :: self - real, pointer :: a(:,:) ! input distributed horizontal array - real, pointer :: e(:,:,:) ! ensemble of distributed horizontal array - integer, intent(out) :: rc - -! --- - - __Iam__('LDE_Generate2d_LatLon') - - type(ESMF_Grid), pointer :: Grid - -! Global version of arrays (root PE only) -! --------------------------------------- - integer :: IM_World, JM_World, EM, i, j, n - real, pointer :: a_world(:,:) => null() - real, pointer :: e_world(:,:) => null() - real, pointer :: ie(:) => null() - real, pointer :: je(:) => null() - - Grid => self%Grid - -! Allocate buffers -! ---------------- - IM_World = self%IM_World - JM_World = self%JM_World - EM = self%EM - allocate(a_world(IM_World,JM_World), & - e_world(IM_World,JM_World), & - ie(JM_World), je(JM_World), & - __STAT__) - -! Gather input array -! ------------------ - call ArrayGather ( a, a_world, Grid, __RC__ ) - -! Generate LDE -! ------------ -Ens: do n = 1, EM - -! Generate this ensemble member on root PE -! ---------------------------------------- - if ( MAPL_AM_I_ROOT() ) then - je = self%je(:,n) -zonal: do i = 1, IM_World - ie = self%ie(:,n) + i - 1 ! shift zonal indices - where ( ie < 1 ) ie = IM_World + ie - where ( ie > IM_World ) ie = ie - IM_World -merid: do j = 1, JM_World - e_world(i,j) = a_world(ie(j),je(j)) - end do merid - end do zonal -!!! e_world = e_world - a_world ! displacement from central point - end if - -! Scatter this member -! ------------------- - call ArrayScatter ( e(:,:,n), e_world, Grid, __RC__ ) - -! Compute displacement from central point -! --------------------------------------- - e(:,:,n) = e(:,:,n) - a(:,:) - - end do Ens - -! Free memory -! ----------- - deallocate(a_world,e_world,ie,je,__STAT__) - - end subroutine LDE_Generate2d_LatLon_ - -! ............................................................................. - - subroutine LDE_Projector1c_LatLon_ ( self, bQ_a, bQ_f, bY_f, bY_d, verbose, rc ) -! -! Uses Lagrangian Displacement Ensembles to produce aerosol mixing ratio -! analysis given AOD (or log-transformed AOD) background and analysis -! increments, along with the concentrations background. -! -! This is the SINGLE CHANNEL version, with same channel used over land -! and ocean. -! -! IMPORTANT: This routine also works for the cubed spehere, albeit not as -! efficiently as LDE_Projector1c_Cubed_(). Once the cubed version is -! made to handle Lat-Lon as well we should drop this rotuine. -! - type(LDE), intent(inout) :: self - type(MAPL_SimpleBundle), intent(inout) :: bQ_f ! Aerosol concentration Background - type(MAPL_SimpleBundle), intent(inout) :: bY_f ! AOD background (or log-AOD) - type(MAPL_SimpleBundle), intent(inout) :: bY_d ! AOD increment (or log-AOD) - - type(MAPL_SimpleBundle), intent(inout) :: bQ_a ! Aerosol concentration Analysis; may share - ! storage with bQ_f - - logical, OPTIONAL, intent(in) :: verbose - integer, intent(out) :: rc ! error code - - integer :: i, j, k, e, s, im, jm, km, em - integer :: ifAOD, idAOD - logical :: verbose_, missing_f, missing_d - -! real(kind=ESMF_KIND_R8), pointer :: vnorm(:,:), x_d(:,:,:) ! accumulators - real(kind=ESMF_KIND_R8), pointer :: vnorm(:,:) ! accumulators - real(kind=ESMF_KIND_R4), pointer :: x_d(:,:,:) ! accumulators - real, pointer :: q_f(:,:), y_f(:,:), y_d(:,:) ! 2D single instances - real, pointer :: X(:,:,:), V(:,:,:), W(:,:,:) ! 2D ensemble variables - - real(kind=ESMF_KIND_R4), pointer :: x_d_World(:,:) - real(kind=ESMF_KIND_R4), pointer :: x_d_World3d(:,:,:) - real, pointer :: q_f_World(:,:) - real, pointer :: q_f_World3d(:,:,:) - real, pointer :: V_World(:,:,:) - real, pointer :: a(:,:), a_World(:,:) - integer, ALLOCATABLE :: krank(:) - integer :: mype, npes, nn, color, comm, lde_comm - integer :: nnodes - - __Iam__('LDE_Projector1c') - - if ( present(verbose) ) then - verbose_ = verbose - else - verbose_ = .FALSE. - end if - - im = size(bQ_f%r3(1)%q,1) - jm = size(bQ_f%r3(1)%q,2) - km = ubound(bQ_f%r3(1)%q,3) - em = self%em - -! Allocate workspace -! ------------------ - allocate ( y_f(im,jm), & - y_d(im,jm), & - vnorm(im,jm), & - X(im,jm,em), & - V(im,jm,em), & - W(im,jm,em), & - __STAT__ ) - - allocate(x_d(im,jm,self%ks:km), __STAT__) - -! Determine convenience indices -! ----------------------------- - ifAOD = MAPL_SimpleBundleGetIndex(bY_f,'AOD',3,__RC__) - idAOD = MAPL_SimpleBundleGetIndex(bY_d,'AOD',3,__RC__) - -! Use single channel -! ------------------ - _ASSERT(size(bY_f%coords%levs) == size(bY_d%coords%levs),'needs informative message') - missing_f = .TRUE. - missing_d = .TRUE. - do k = 1, size(bY_f%coords%levs) - if ( abs(bY_f%coords%levs(k)-self%channel) < 0.01 ) then - y_f = bY_f%r3(ifAOD)%q(:,:,k) - missing_f = .FALSE. - end if - if ( abs(bY_d%coords%levs(k)-self%channel) < 0.01 ) then - y_d = bY_d%r3(idAOD)%q(:,:,k) - missing_d = .FALSE. - end if - end do - if ( missing_f ) then - __raise__(MAPL_RC_ERROR,"could not find matching channel for ") - end if - if ( missing_d ) then - __raise__(MAPL_RC_ERROR,"could not find matching channel for ") - end if - -#ifdef DEBUG - if ( MAPL_AM_I_Root() .and. verbose_ ) print * - call MAPL_MaxMin('y_f',y_f) - call MAPL_MaxMin('y_d',y_d) -#endif - -! Generate ensembles of AOD backgrounds -! ------------------------------------- - call LDE_Generate2d ( self, V, y_f, __RC__ ) - -#ifdef DEBUG - if ( MAPL_AM_I_Root() .and. verbose_ ) print * - call MAPL_MaxMin(' V ',V) -#endif - -! Create ensemble weights -! ----------------------- - if ( self%Delta <= 0.0 ) then - W = 1.0 ! ensemble members are equal-probable - else - do e = 1, em - vnorm = ((V(:,:,e)-y_d(:,:))/self%Delta)**2 - where(vnorm<20.) ! underflow protection - W(:,:,e) = exp(-vnorm) - elsewhere - W(:,:,e) = exp(-20.) - end where - end do - end if - -#ifdef DEBUG - call MAPL_MaxMin(' W ',W) -#endif - -! Normalized AOD ensembles -! -! v{e} = y_f{e} * y_d / -! -! for each ensemble member {e} -! --------------------------------- - vnorm = 0.0 - do e = 1, em - vnorm = vnorm + W(:,:,e) * V(:,:,e)**2 - end do - where ( vnorm==0.0 ) ! division by zero protection - y_d = 0.0 - elsewhere - y_d = y_d / vnorm - end where - do e = 1, em - V(:,:,e) = W(:,:,e) * V(:,:,e) * y_d(:,:) - end do - -#ifdef DEBUG - call MAPL_MaxMin(' V ',V) -#endif - -! Gather V to all processes that will participate in the analysis -! First we make a sub-communicator containing those processes (lde_comm) -! ---------------------------------------------------------------------- - call ESMF_VMGet (self%VM, mpiCommunicator=COMM, localpet=MYPE, petcount=NPES, __RC__) - allocate(krank(self%ks:km)) - nNodes = size(MAPL_NodeRankList) - call MAPL_RoundRobinPEList(krank, nNodes, __RC__) - color = MPI_UNDEFINED - do k = self%ks, km - if( krank(k)==mype ) then - color = 0 - endif - enddo - - CALL MPI_COMM_SPLIT(COMM, color, mype, lde_comm, STATUS) - VERIFY_(STATUS) - -! Allocate V_World on all processes that will participate in the analysis -! ----------------------------------------------------------------------- - if(color /= MPI_UNDEFINED) then - allocate(V_World(self%IM_World,self%JM_World,EM), __STAT__) - endif - -! Gather the distributed V to form the global V_World -! All process participate in this call -! ArrayGather gathers to MAPL_Root by default. To be safe, -! we specify the first rank from MAPL_RoundRobinPEList -! -------------------------------------------------------- - do e = 1, em - call ArrayGather(V(:,:,e),V_World(:,:,e), self%Grid, depe=krank(self%ks), __RC__) - end do - -! Now broadcast from the gather rank to all others in the lde_comm communicator -! ----------------------------------------------------------------------------- - if (color /= MPI_UNDEFINED) & - call MPI_Bcast(V_World, size(V_World), MPI_REAL, krank(self%ks), lde_comm, STATUS) - -! Next compute aerosol concentration analysis for each level, species -! q_a = q_f + -! ------------------------------------------------------------------- - if ( MAPL_AM_I_Root() .and. verbose_ ) then - if ( self%isCubed ) then - print *, 'Calculating LDE increments on Cubed Sphere with ', em, ' ensemble members' - else - print *, 'Calculating LDE increments on LatLon with ', em, ' ensemble members' - end if - end if - - do s = 1, bQ_f%n3d -! if ( .not. isAerosol_(trim(bQ_f%r3(s)%name)) ) cycle - - if ( MAPL_AM_I_Root() .and. verbose_ ) & - print *, ' [ ] Working on <'//trim(bQ_f%r3(s)%name)//'>' - -#ifdef DEBUG - call MAPL_MaxMin(' q_f',bQ_f%r3(s)%q(:,:,self%ks:km)) -#endif - -! Gather distributed levels onto a single processor -! Level to processor assignment occurs inside MAPL_CollectiveGather3D -! Our call to MAPL_RoundRobinPEList is assumed to mimic the assignment -! achieved in MAPL_CollectiveGather3D -! -------------------------------------------------------------------- - call MAPL_CollectiveGather3D(self%Grid, bQ_f%r3(s)%q(:,:,self%ks:km), & - q_f_World3d, __RC__) - -! Allocate work space depending on level assignment -! ------------------------------------------------- - allocate(x_d_World3d(self%IM_World,self%JM_World,size(q_f_World3d,3)), __STAT__) - -! Each process does the analysis on its assigned level -! ---------------------------------------------------- - nn=0 - do k = self%ks, km - if( krank(k)==mype ) then - nn=nn+1 - x_d_World => x_d_World3d(:,:,nn) - q_f_World => q_f_World3d(:,:,nn) - call LDE_Qinc_Global(self, x_d_World, q_f_World, V_World, __RC__) - endif - end do - deallocate(q_f_World3d) - -! Scatter the analysis -! -------------------- - call MAPL_CollectiveScatter3D(self%Grid, x_d_World3d(:,:,:nn), x_d(:,:,self%ks:km), & - __RC__) - deallocate(x_d_World3d) - -! Add analysis increments to q -! ---------------------------- - do k = self%ks, km - bQ_a%r3(s)%q(:,:,k) = bQ_f%r3(s)%q(:,:,k) + x_d(:,:,k) - end do - -! Zero increments above top analysis level -! ---------------------------------------- - do k = 1,self%ks-1 - bQ_a%r3(s)%q(:,:,k) = bQ_f%r3(s)%q(:,:,k) - end do - -#ifdef DEBUG - call MAPL_MaxMin(' q_a',bQ_a%r3(s)%q(:,:,self%ks:km)) -#endif - - bQ_a%r3(s)%q(:,:,self%ks:km) = max(0.0,bQ_a%r3(s)%q(:,:,self%ks:km)) ! fix q<0 - - end do ! variable loop - -! Free memory -! ----------- - deallocate ( y_f, y_d, vnorm, X, V, W, x_d, __STAT__ ) - - if(color /= MPI_UNDEFINED) deallocate ( V_World, __STAT__) - deallocate ( krank , __STAT__) - - rc = 0 - return - - end subroutine LDE_Projector1c_LatLon_ - -!......................................................................... - - subroutine LDE_Qinc_Global_LatLon_ ( self, x_d, x_f, V, rc ) -! -! This is a single PE routine for computing LDEs and computing the -! Q analysis increments. -! All arrays are global. -! - type(LDE), intent(in) :: self -! real(kind=ESMF_KIND_R8), pointer :: x_d(:,:) ! Output: Increments - real(kind=ESMF_KIND_R4), pointer :: x_d(:,:) ! Output: Increments - real, pointer :: x_f(:,:) ! Input: Bkg on a single level - real, pointer :: V(:,:,:) ! Input: Ensemble of V - integer, intent(out) :: rc - -! --- - - __Iam__('LDE_Qinc_Global_LatLon') - - integer :: IM_World, JM_World, EM, i, j, n - real, pointer :: X(:,:) => null() ! LDE based on x_f - real, pointer :: ie(:) => null() - real, pointer :: je(:) => null() - -! Allocate buffers -! ---------------- - IM_World = self%IM_World - JM_World = self%JM_World - EM = self%EM - allocate(X(IM_World,JM_World), & - ie(JM_World), je(JM_World), & - __STAT__) - -! Generate LDE -! ------------ - x_d = 0.0 -Ens: do n = 1, EM - -! Generate this ensemble member on root PE -! ---------------------------------------- - je = self%je(:,n) -zonal: do i = 1, IM_World - ie = self%ie(:,n) + i - 1 ! shift zonal indices - where ( ie < 1 ) ie = IM_World + ie - where ( ie > IM_World ) ie = ie - IM_World -merid: do j = 1, JM_World - X(i,j) = x_f(ie(j),je(j)) - end do merid - end do zonal - - x_d(:,:) = x_d(:,:) + (X(:,:) - x_f(:,:)) * V(:,:,n) - - end do Ens - -! Free memory -! ----------- - deallocate(X,ie,je,__STAT__) - - end subroutine LDE_Qinc_Global_LatLon_ - - -! --------------------- -! Cubed-Sphere Routines -! --------------------- - - subroutine getEnsSizeCubed_ ( im, jm, R, Nx, Ny, rc ) - integer, intent(in) :: im - integer, intent(in) :: jm - real, intent(in) :: R ! stencil radius - - integer, intent(out) :: Nx ! stencil size in X, always odd - integer, intent(out) :: Ny ! same as Nx for cubed-sphere - integer, intent(out) :: rc - -! --- - real*8 :: dArea, dx - - __Iam__('getEnsSizeCubed_') - -! Compute average grid box sizes -! ------------------------------ - dArea = 4. * MAPL_PI * MAPL_RADIUS**2 / ( im * jm ) ! mean area - dx = sqrt(dArea) ! assumes square "mean" grid-boxes - -! Compute stencil size, making sure it is a odd number for symmetry -! ----------------------------------------------------------------- - Nx = 2 * nint(R/dx) + 1 - Ny = Nx - - if ( Nx<3 ) then - rc = 1 - end if - - end subroutine getEnsSizeCubed_ - -!............................................................ - subroutine getEnsIndicesCubed_ ( EM_World, Indx, rc ) - integer, intent(in) :: EM_World ! maximum ensemble size - integer, intent(out) :: Indx(EM_World) ! Randomized indices - integer, intent(out) :: rc -! ---- - - real*8 :: rn(EM_World) ! random numbers - - __Iam__('getEnsIndicesCubed_') - - rc = 0 - call zufalli(0) ! initialize random number generator with default seed - call zufall(EM_World,rn) ! sample - call IndexSet ( EM_World, Indx ) - call IndexSort ( EM_WORLD, Indx, rn, descend=.false.) - - end subroutine getEnsIndicesCubed_ - -!............................................................ - - subroutine LDE_HaloedFace_ ( im, nH, iFace, hA, A, rc ) - - integer, intent(in) :: im ! x/y size for a (square) cube face - integer, intent(in) :: nH ! number of grid-points in halo - integer, intent(in) :: iFace ! which face of the cube to halo - real, intent(in) :: A(im,im,6) ! global array on cobed-sphere - - real, intent(out) :: hA(-nH+1:im+nH,-nH+1:im+nH) ! haloed array on face iFace - integer, intent(out) :: rc -! -! Given a global array on the cubed sphere, returns a haloed array on a single face. -! For face 1 we will have: -! -! x | 3 | x -! ----|---|--- -! 5 | 1 | 2 -! ----|---|--- -! x | 6 | x -! -! where we have indicated the relevant faces. The nearby faces with "x" are the so-called -! dead zones and values in these regions will be set to UNDEF because they are already -! included in other tiles. Recall that axis of adjascent faces may or may not to be rotated -! to align properly. I relied on a paper cut out of the cubed-sphere to have this coded up. -! -! Example for im=5 and nH=3: -! -! | 1 2 3 4 5 | -! (LEFT) -2 -1 0 | 1 2 3 4 5 | 6 7 8 (RIGHT) -! | 1 2 3 4 5 | -! -! ---- - - __Iam__('getHaloedFace_') - - rc = 0 - -! Start with all UNDEFs, dead zones will remain UNDEF -! --------------------------------------------------- - hA = MAPL_UNDEF - -! Fill in the core of the domain -! ------------------------------ - hA(1:im,1:im) = A(1:im,1:im,iFace) - -! Special handle each face -! ------------------------ - if ( iFace == 1 ) then - call fill_ ( im, 6, 0, 'bottom', hA ) - call fill_ ( im, 3, -90, 'top' , hA ) - call fill_ ( im, 5, +90, 'left' , hA ) - call fill_ ( im, 2, 0, 'right' , hA ) - else if ( iFace == 2 ) then - call fill_ ( im, 6, -90, 'bottom', hA ) - call fill_ ( im, 3, 0, 'top' , hA ) - call fill_ ( im, 1, 0, 'left' , hA ) - call fill_ ( im, 4, +90, 'right' , hA ) - else if ( iFace == 3 ) then - call fill_ ( im, 2, 0, 'bottom', hA ) - call fill_ ( im, 5, -90, 'top' , hA ) - call fill_ ( im, 1, +90, 'left' , hA ) - call fill_ ( im, 4, 0, 'right' , hA ) - else if ( iFace == 4 ) then - call fill_ ( im, 2, -90, 'bottom', hA ) - call fill_ ( im, 5, 0, 'top' , hA ) - call fill_ ( im, 3, 0, 'left' , hA ) - call fill_ ( im, 6, +90, 'right' , hA ) - else if ( iFace == 5 ) then - call fill_ ( im, 4, 0, 'bottom', hA ) - call fill_ ( im, 1, -90, 'top' , hA ) - call fill_ ( im, 3, +90, 'left' , hA ) - call fill_ ( im, 6, 0, 'right' , hA ) - else if ( iFace == 6 ) then - call fill_ ( im, 4, -90, 'bottom', hA ) - call fill_ ( im, 1, 0, 'top' , hA ) - call fill_ ( im, 5, 0, 'left' , hA ) - call fill_ ( im, 2, +90, 'right' , hA ) - end if - - contains - - subroutine fill_ ( im, jFace, iRot, location, hA ) - integer, intent(in) :: im - integer, intent(in) :: jFace - integer, intent(in) :: iRot ! whether or not to rotate array - character(len=*), intent(in) :: location - real, intent(out) :: hA(-nH+1:im+nH,-nH+1:im+nH) ! haloed array on face iFace - -! -! Fills top, bottom, left or right halo -! - integer i, j - real :: x(im,im) - -! Rotate adjascent face as necessary -! ---------------------------------- - if ( iRot==0 ) then - x = A(:,:,jFace) - else if ( iRot == +90 ) then ! clockwise - do j = 1, im - do i = 1, im - x(i,j) = A(j,im-i+1,jFace) - end do - end do - else if ( iRot == -90 ) then ! counter-clockwise - do j = 1, im - do i = 1, im - x(i,j) = A(im-j+1,i,jFace) - end do - end do - end if - -! Fill in this halo segment -! ------------------------- - if ( location == 'bottom' ) then - hA(1:im,-nh+1:0) = x(1:im,im-nh+1:im) - else if ( location == 'top' ) then - hA(1:im,im+1:im+nh) = x(1:im,1:nh) - else if ( location == 'left' ) then - hA(-nh+1:0 ,1:im) = x(im-nh+1:im,1:im) - else if ( location == 'right' ) then - hA(im+1:im+nh,1:im) = x(1:nH,1:im) - end if - - end subroutine fill_ - - end subroutine LDE_HaloedFace_ - -!........................................................ - - subroutine LDE_Qinc_Distrib_Cubed_ ( x_d, a, V, indx, im, jm, em, IM_World, EM_World, nh, self, rc ) - integer, intent(in) :: IM_World ! number of x,y gridpoints on face (global) - integer, intent(in) :: EM_World ! maximum ensemble size - - integer, intent(in) :: im, jm ! local dimensions (distributed) - integer, intent(in) :: em ! desired number of ensemble members - integer, intent(in) :: nH ! halo size - - integer, intent(in) :: indx(EM_World) ! Randomized indices - - real, intent(in) :: a(im,jm) ! first guess (distributed) - type(LDE), intent(in) :: self - - - real, intent(out) :: x_d(im,jm) ! Analysis increments (distributed) - integer, intent(out) :: rc - - real :: V(im,jm,em) ! distributed RHS - real :: X(im,jm,em) ! Analysis increments (distributed) - integer :: k - - call LDE_Generate2d_Cubed_Core_ ( X, a, indx, im, jm, em, IM_World, EM_World, nh, self, rc ) - - x_d = 0.0 - do k = 1, em - x_d(:,:) = x_d(:,:) + X(:,:,k) * V(:,:,k) - end do - end subroutine LDE_Qinc_Distrib_Cubed_ - - subroutine LDE_Generate2d_Cubed_Core_ ( X, a, indx, im, jm, em, IM_World, EM_World, nh, self, rc ) - - integer, intent(in) :: IM_World ! number of x,y gridpoints on face (global) - integer, intent(in) :: EM_World ! maximum ensemble size - - integer, intent(in) :: im, jm ! local dimensions (distributed) - integer, intent(in) :: em ! desired number of ensemble members - integer, intent(in) :: nH ! halo size - - integer, intent(in) :: indx(EM_World) ! Randomized indices - - real, intent(in) :: a(im,jm) ! first guess (distributed) - type(LDE), intent(in) :: self - - real, intent(out) :: X(im,jm,em) ! Analysis increments (distributed) - integer, intent(out) :: rc -! -! Returns LDEs given a 2D array. This is a single PE routine; all arrays are global. -! -! ---- - real :: hA(-nH+1:IM_World+nH,-nH+1:IM_World+nH) ! haloed array on a single face - real :: e_(EM_World) ! Maximum possible ensembles for a given point - integer :: iFace, is, js, i, j, k, nH2, j2, d2, ne - integer :: ig, jg - integer :: myFace, i_, j_ - - - - real :: A_World(IM_World,IM_World*6) ! Input 2D array on the cubed sphere - real :: V(im,jm,em) ! distributed RHS - integer :: i1, in, j1, jn - logical :: inside_domain - integer :: status - character(len=ESMF_MAXSTR) :: Iam = 'LDE_Generate2d_Cubed_Core' - - rc = 0 - nH2 = nH**2 - -! gather a to A_World -!-------------------- - call ArrayGather ( a, a_world, self%Grid, __RC__ ) - call MAPL_CommsBcast (self%vm, a_world, size(a_world), 0, __RC__) - - X = 0.0 ! Just in case - -! Consistency check -! ----------------- - if ( EM_World /= (2*nH+1)**2 ) then - print *, 'Very strange: Inconsistent nH, EM_World =', nH, EM_World - rc = 1 - return - end if - -! Loop over faces of the cube -! --------------------------- -! Determine myface -! --------------------- - ! get lower left and upper right corners of my domain - call MAPL_GRID_INTERIOR(self%Grid,I1,IN,J1,JN) - - myFace = (J1-1)/IM_World + 1 - ! Saniny checking: make sure the upper right corner is on the same face - _ASSERT(myFace == (jn -1)/IM_World+1,'needs informative message') - - face: do iFace = myface, myface - -! Haloed array on this face -! ------------------------- - call LDE_HaloedFace_ ( IM_World, nH, iFace, hA, A_World, rc ) - -! For grid point (is,js) on this face... -! -------------------------------------- - js_: do js = 1, IM_World - is_: do is = 1, IM_World - -! convert (is,js,iFace) --> global (ig,jg) - ig = is - jg = (iFace-1)*IM_World + js -! convert (ig, jg) --> local (i_,j_) - i_ = ig - i1 + 1 - j_ = jg - j1 + 1 - -! Check if (is,js,iFace) is in domain - inside_domain = ig >= i1 .and. ig <=in .and. jg>=j1 .and. jg<=jn - if ( .not. inside_domain ) cycle - -! Look around for ensemble members -! -------------------------------- - ne = 0 - e_ = MAPL_UNDEF - jj_: do j = js-nH, js+nH - j2 = (j-js)**2 - ii_: do i = is-nH, is+nH - d2 = j2 + (i-is)**2 ! distance squared from (is,js) - ne = ne + 1 - if ( (i==is .AND. j==js) .OR. (d2>nH2) ) then - e_(ne) = MAPL_UNDEF ! do not include central point or outside "circle" - else - e_(ne) = hA(i,j) - end if - end do ii_ - end do jj_ - - e_ = e_(indx(:)) ! randomize ensembles, including dead zones - -! Select only "em" defined ensembles (exclude dead zones, central point -! and points outsize the circle) -! --------------------------------------------------------------------- - ne = 0 - ens: do k = 1, EM_World - if ( e_(k) /= MAPL_UNDEF ) then ! skip undefined memebers - ne = ne + 1 - if ( ne > em ) exit ens - X(i_,j_,ne) = e_(k) - a(i_,j_) - end if - end do ens - if ( ne < em ) then - print *, 'Very strange: not enough ensemble members found - ne, em =', ne, em - rc = 2 ! not enough members found, should not happen - return - end if - - end do is_ - end do js_ - - end do face - - end subroutine LDE_Generate2d_Cubed_Core_ - -!.............................................................................. - - subroutine LDE_Generate2d_Cubed_ ( self, e, a, rc ) -! -! Generates LDE based on a 2D horizontal (lon,lat) array. -! - type(LDE), intent(in) :: self - real, pointer :: a(:,:) ! input distributed horizontal array - real, pointer :: e(:,:,:) ! ensemble of distributed horizontal array - integer, intent(out) :: rc - -! --- - - __Iam__('LDE_Generate2d_Cubed') - - type(ESMF_Grid), pointer :: Grid - - integer :: IM, JM, EM - integer :: IM_World, JM_World, EM_World, n, nH - -! Aliases -! ---------------- - Grid => self%Grid - nH = self%Nx / 2 ! hallo size - - im = size(a,1) - jm = size(a,2) - em = self%em - - IM_World = self%IM_World - JM_World = self%JM_World - EM_World = self%EM_World - - call LDE_Generate2d_Cubed_Core_ ( e, a, self%indx, im, jm, em, IM_World, EM_World, nh, self, rc ) - - - end subroutine LDE_Generate2d_Cubed_ - -!......................................................................... - - subroutine LDE_Projector1c_Cubed_ ( self, bQ_a, bQ_f, bY_f, bY_d, verbose, rc ) -! -! Uses Lagrangian Displacement Ensembles to produce aerosol mixing ratio -! analysis given AOD (or log-transformed AOD) background and analysis -! increments, along with the concentrations background. -! -! This is the SINGLE CHANNEL version, with same channel used over land -! and ocean. -! -! IMPORTANT: This routine does not yet work for Lat-Lon; this could be accomplished -! by implementing a version of LDE_Qinc_Distrib() that can handle the -! cubed sphere. -! - - type(LDE), intent(inout) :: self - type(MAPL_SimpleBundle), intent(inout) :: bQ_f ! Aerosol concentration Background - type(MAPL_SimpleBundle), intent(inout) :: bY_f ! AOD background (or log-AOD) - type(MAPL_SimpleBundle), intent(inout) :: bY_d ! AOD increment (or log-AOD) - - type(MAPL_SimpleBundle), intent(inout) :: bQ_a ! Aerosol concentration Analysis; may share - ! storage with bQ_f - - logical, OPTIONAL, intent(in) :: verbose - integer, intent(out) :: rc ! error code - -! ---- - - integer :: i, j, k, e, s, im, jm, km, em - integer :: ifAOD, idAOD - logical :: verbose_, missing_f, missing_d - -! real(kind=ESMF_KIND_R8), pointer :: vnorm(:,:), x_d(:,:,:) ! accumulators - real(kind=ESMF_KIND_R8), pointer :: vnorm(:,:) ! accumulators - real(kind=ESMF_KIND_R4), pointer :: x_d(:,:,:) ! accumulators - real, pointer :: q_f(:,:), y_f(:,:), y_d(:,:) ! 2D single instances - real, pointer :: X(:,:,:), V(:,:,:), W(:,:,:) ! 2D ensemble variables - real, pointer :: x_2d(:,:) - - real(kind=ESMF_KIND_R4), pointer :: x_d_World(:,:) - real(kind=ESMF_KIND_R4), pointer :: x_d_World3d(:,:,:) - real, pointer :: q_f_World(:,:) - real, pointer :: V_World(:,:,:) - real, pointer :: a(:,:), a_World(:,:) - integer, ALLOCATABLE :: krank(:) - integer :: mype, npes, nn, color, comm, lde_comm - integer :: im_world, jm_world, em_world - integer :: nH - - __Iam__('LDE_Projector1c') - - if ( present(verbose) ) then - verbose_ = verbose - else - verbose_ = .FALSE. - end if - - im = ubound(bQ_f%r3(1)%q,1) - jm = ubound(bQ_f%r3(1)%q,2) - km = ubound(bQ_f%r3(1)%q,3) - em = self%em - im_world = self%im_world - jm_world = self%jm_world - em_world = self%em_world - - nH = self%Nx/2 - -! Allocate workspace -! ------------------ - allocate ( y_f(im,jm), & - y_d(im,jm), & - vnorm(im,jm), & - X(im,jm,em), & - V(im,jm,em), & - W(im,jm,em), & - __STAT__ ) - - allocate(x_d(im,jm,self%ks:km), __STAT__) - - V = 0.0 ! ALT: Initialize just in case - - -! Use single channel -! ------------------ - _ASSERT(size(bY_f%coords%levs) == size(bY_d%coords%levs),'needs informative message') - y_f = bY_f%r2(1)%q(:,:) - y_d = bY_d%r2(1)%q(:,:) - -#ifdef DEBUG - if ( MAPL_AM_I_Root() .and. verbose_ ) print * - call MAPL_MaxMin('y_f',y_f) - call MAPL_MaxMin('y_d',y_d) -#endif - -! Generate ensembles of AOD backgrounds -! ------------------------------------- - call LDE_Generate2d ( self, V, y_f, __RC__ ) - -#ifdef DEBUG - if ( MAPL_AM_I_Root() .and. verbose_ ) print * - call MAPL_MaxMin(' V ',V) -#endif - -! Create ensemble weights -! ----------------------- - if ( self%Delta <= 0.0 ) then - W = 1.0 ! ensemble members are equal-probable - else - do e = 1, em - vnorm = ((V(:,:,e)-y_d(:,:))/self%Delta)**2 - where(vnorm<20.) ! underflow protection - W(:,:,e) = exp(-vnorm) - elsewhere - W(:,:,e) = exp(-20.) - end where - end do - end if - -#ifdef DEBUG - call MAPL_MaxMin(' W ',W) -#endif - -! Normalized AOD ensembles -! -! v{e} = y_f{e} * y_d / -! -! for each ensemble member {e} -! --------------------------------- - vnorm = 0.0 - do e = 1, em - vnorm = vnorm + W(:,:,e) * V(:,:,e)**2 - end do - where ( vnorm==0.0 ) ! division by zero protection - y_d = 0.0 - elsewhere - y_d = y_d / vnorm - end where - do e = 1, em - V(:,:,e) = W(:,:,e) * V(:,:,e) * y_d(:,:) - end do - -#ifdef DEBUG - call MAPL_MaxMin(' V ',V) -#endif - -! Gather V to all processes that will participate in the analysis -! First we make a sub-communicator containing those processes (lde_comm) -! ---------------------------------------------------------------------- - call ESMF_VMGet (self%VM, mpiCommunicator=COMM, localpet=MYPE, petcount=NPES, __RC__) - -! Next compute aerosol concentration analysis for each level, species -! q_a = q_f + -! ------------------------------------------------------------------- - if ( MAPL_AM_I_Root() .and. verbose_ ) then - if ( self%isCubed ) then - print *, 'Calculating LDE increments on Cubed Sphere with ', em, ' ensemble members' - else - print *, 'Calculating LDE increments on LatLon with ', em, ' ensemble members' - end if - end if - - do s = 1, bQ_f%n3d - - if ( MAPL_AM_I_Root() .and. verbose_ ) & - print *, ' [ ] Working on <'//trim(bQ_f%r3(s)%name)//'>' - -#ifdef DEBUG - call MAPL_MaxMin(' q_f',bQ_f%r3(s)%q(:,:,self%ks:km)) -#endif - -! Each process does the analysis on its assigned level -! ---------------------------------------------------- - do k = self%ks, km - q_f => bQ_f%r3(s)%q(:,:,k) - x_2d => x_d(:,:,k) - call LDE_Qinc_Distrib_Cubed_(x_2d, q_f, V, self%indx, im, jm, em, IM_World, EM_World, nh, self, __RC__ ) - -! Add analysis increments to q - bQ_a%r3(s)%q(:,:,k) = bQ_f%r3(s)%q(:,:,k) + x_d(:,:,k) - - end do - -! Zero increments above top analysis level -! ---------------------------------------- - do k = 1,self%ks-1 - bQ_a%r3(s)%q(:,:,k) = bQ_f%r3(s)%q(:,:,k) - end do - - -#ifdef DEBUG - call MAPL_MaxMin(' q_a',bQ_a%r3(s)%q(:,:,self%ks:km)) -#endif - - bQ_a%r3(s)%q(:,:,self%ks:km) = max(0.0,bQ_a%r3(s)%q(:,:,self%ks:km)) ! fix q<0 - - end do ! variable loop - -! Free memory -! ----------- - deallocate ( y_f, y_d, vnorm, X, V, W, x_d, __STAT__ ) - - rc = 0 - return - - end subroutine LDE_Projector1c_Cubed_ - -!......................................................................... - - logical function isAerosol_ ( name ) - - character(len=*), intent(in) :: name - - __Iam__('isAerosol_') - - if ( ESMF_UtilStringUpperCase(name(1:2))=='DU' .OR. & - ESMF_UtilStringUpperCase(name(1:2))=='SS' .OR. & - ESMF_UtilStringUpperCase(name(1:5))=='NO3AN' .OR. & - ESMF_UtilStringUpperCase(name) =='SO4' .OR. & - ESMF_UtilStringUpperCase(name) =='BCPHOBIC' .OR. & - ESMF_UtilStringUpperCase(name) =='BCPHILIC' .OR. & - ESMF_UtilStringUpperCase(name) =='OCPHOBIC' .OR. & - ESMF_UtilStringUpperCase(name) =='OCPHILIC' ) then - - isAerosol_ = .TRUE. - - else - - isAerosol_ = .FALSE. - - end if - - end function isAerosol_ - - end module LDE_Mod diff --git a/GAAS_GridComp/ana_lde.F90 b/GAAS_GridComp/ana_lde.F90 deleted file mode 100644 index 80b13034..00000000 --- a/GAAS_GridComp/ana_lde.F90 +++ /dev/null @@ -1,251 +0,0 @@ -! Ana_LDE: Produces 3D Aerosol Anaysis Increments using Lagrangian Displacent -! Ensembles and pre-computed AOD analysis increments. -! -! Arlindo da Silva , December 2009 -!---------------------------------------------------------------------------- - -# include "MAPL_Generic.h" - -!............................................................................................ - - Program Ana_LDE - - use ESMF - use MAPL - - use LDE_Mod - use Chem_SimpleBundleMod - - implicit NONE - -! Basic ESMF objects -! ------------------ - type(ESMF_Config) :: CF ! Resource file - type(ESMF_Grid) :: etaGrid ! Eta Grid (lon, lat, eta) - type(ESMF_Grid) :: aodGrid ! AOD Grid (lon, lat, channel) - type(ESMF_Time) :: Time - -! Main data objects -! ----------------- - type(MAPL_SimpleBundle), target :: q_f ! 3D backround aerosol concentration - type(MAPL_SimpleBundle), target :: q_b ! 3D backround aerosol bias - type(MAPL_SimpleBundle), pointer :: q_a ! 3D analyzed aerosol concentration - - type(MAPL_SimpleBundle) :: y_f ! 2D AOD background (log-transform) - type(MAPL_SimpleBundle) :: y_d ! 2D AOD analysis increment (log-transform) - type(MAPL_SimpleBundle) :: y_b ! 2D AOD bias (log-transform) - - type(LDE) :: E ! LDE object - -! Basic information about the parallel environment -! PET = Persistent Execution Threads -! In the current implementation, a PET is equivalent -! to an MPI process -! ------------------------------------------------ - integer :: myPET ! The local PET number - integer :: nPET ! The total number of PETs you are running on - - integer :: status, rc - integer :: i, j, n, im, jm, km - - integer :: Nx, Ny ! Layout - integer :: IM_World, JM_World, LM_WORLD ! Global Grid dimensions - integer :: CM_World ! Number of channels - integer :: nymd, nhms - integer :: yy, mm, dd, h, m, s, iAOD - real :: eps ! eps for log-transform - real :: channel - - logical :: verbose, perform_lde_in_aod_variable, isCubed - - type (CubedSphereGridFactory) :: cs_factory - type (LatlonGridFactory) :: ll_factory - -! Coordinate variables -! -------------------- - character(len=ESMF_MAXSTR) :: name - character(len=ESMF_MAXSTR) :: Iam = "ana_lde" - -! ----- - - call Main() - -CONTAINS - - subroutine Main() - -! For now concentration analysis/background share storage -! ------------------------------------------------------- - q_a => q_f - -! -------------- -! Initialization -! -------------- - - -! Initialize the ESMF. For performance reasons, it is important -! to turn OFF ESMF's automatic logging feature -! ------------------------------------------------------------- - call ESMF_Initialize (LogKindFlag=ESMF_LOGKIND_NONE, __RC__) - call ESMF_CalendarSetDefault ( ESMF_CALKIND_GREGORIAN, __RC__ ) - - if ( MAPL_am_I_root() ) then - print * - print *, ' ----------------' - print *, ' Starting ' // trim(Iam) - print *, ' ----------------' - print * - end if - -! Load resources -! -------------- - CF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile(CF, fileName='lde.rc', __RC__) - call ESMF_ConfigGetAttribute(CF, verbose, Label='verbose:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, eps, Label='eps_for_log_transform_aod:', & - default=-0.01, __RC__) - call ESMF_ConfigGetAttribute(CF, perform_lde_in_aod_variable, & - Label='perform_lde_in_aod_variable:', __RC__) - - -! World grid dimensions and layout -! -------------------------------- - call ESMF_ConfigGetAttribute(CF, IM_World, Label='IM_World:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, JM_World, Label='JM_World:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, LM_World, Label='LM_World:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, CM_World, Label='CM_World:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, Nx, Label='Layout_Nx:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, Ny, Label='Layout_Ny:', __RC__ ) - -! Lat lon or cubed sphere? -! ------------------------ - if ( JM_World == 6*IM_World ) then - isCubed = .True. - else - isCubed = .False. - end if - -! Create global grids: -! ------------------- - if ( isCubed ) then ! Cubed-sphere - - cs_factory = CubedSphereGridFactory(im_world=im_world,lm=lm_world,nx=nx,ny=ny/6,__RC__) - etaGrid = cs_factory%make_grid(__RC__) - cs_factory = CubedSphereGridFactory(im_world=im_world,lm=cm_world,nx=nx,ny=ny/6,__RC__) - aodGrid = cs_factory%make_grid(__RC__) - - else ! Lat Lon Grid - - ll_factory = LatLonGridFactory(grid_name='etaGrid', & - Nx = Nx, Ny = Ny, & - IM_World = IM_World, & - JM_World = JM_World, & - LM = LM_WORLD, pole='PC', dateline='DC', & - __RC__) - etaGrid = ll_factory%make_grid(__RC__) - ll_factory = LatLonGridFactory(grid_name='etaGrid', & - Nx = Nx, Ny = Ny, & - IM_World = IM_World, & - JM_World = JM_World, & - LM = CM_WORLD, pole='PC', dateline='DC', & - __RC__) - aodGrid = ll_factory%make_grid(__RC__) - - end if - -! Validate grid -! ------------- - call ESMF_GridValidate(etaGrid,__RC__) - call ESMF_GridValidate(aodGrid,__RC__) - -! Get date/time from CF -! --------------------- - call ESMF_ConfigGetAttribute(CF, nymd, Label='nymd:', __RC__ ) - call ESMF_ConfigGetAttribute(CF, nhms, Label='nhms:', __RC__ ) - - call ESMF_ConfigGetAttribute(CF, channel, Label='single_channel:', __RC__) - -! Create ESMF Time -! ---------------- - yy = nymd/10000; mm = (nymd-yy*10000) / 100; dd = nymd - (10000*yy + mm*100) - h = nhms/10000; m = (nhms - h*10000) / 100; s = nhms - (10000*h + m*100) - call ESMF_TimeSet(Time, yy=yy, mm=mm, dd=dd, h=h, m=m, s=s) - -! -------------- -! Read Files -! -------------- - - y_f = Chem_SimpleBundleRead (CF, 'aod_bkg_filename', aodGrid, time=Time, __RC__ ) - y_d = Chem_SimpleBundleRead (CF, 'aod_inc_filename', aodGrid, time=Time, __RC__ ) - q_f = Chem_SimpleBundleRead (CF, 'aer_bkg_filename', etaGrid, time=Time, verbose=.TRUE., __RC__ ) -#if 0 - q_b = Chem_SimpleBundleRead (CF, 'aerbias_internal_restart', etaGrid, __RC__ ) - y_b = Chem_SimpleBundleRead (CF, 'aodbias_internal_restart', aodGrid, __RC__ ) -#endif - - y_f%coords%levs(1) = channel - y_d%coords%levs(1) = channel - - if ( verbose ) then - call MAPL_SimpleBundlePrint(y_f) - call MAPL_SimpleBundlePrint(y_d) - call MAPL_SimpleBundlePrint(q_f) - endif - -! Here we assume that the analysis increments coming in are log(AOD+eps) -! while y_a and y_f are always in terms of AOD. When doing the LDE the -! *perform_lde_in_aod_variable* on the rc files specifies whether we -! generate the LDE ensembles based on AOD or Log(AOD+eps), regardless -! of how the analysis was performed. -! -! TO DO: -! Figure out an automatic way to check whether analysis in log-AOD -! ----------------------------------------------------------------------- - if ( perform_lde_in_aod_variable ) then ! use AOD for LDE calculation - iAOD = MAPL_SimpleBundleGetIndex(y_d,'AOD',3,__RC__) - !Note: eta = log(tau+eps) - y_d%r3(iAOD)%q(:,:,:) = Exp( & - Log(y_f%r3(iAOD)%q(:,:,:) + eps) & ! eta_f - + y_d%r3(iAOD)%q(:,:,:) & ! + deta_a - ) - eps & ! tau_a = exp(eta_a) - eps - - y_f%r3(iAOD)%q(:,:,:) ! - tau_e - - else ! use log(AOD+eps) for LDE calculation - iAOD = MAPL_SimpleBundleGetIndex(y_f,'AOD',3,__RC__) - y_f%r3(iAOD)%q(:,:,:) = Log(y_f%r3(iAOD)%q(:,:,:) + eps) - end if - -! ----------- -! Calculation -! ----------- - -! Create concetration analysis from AOD increments -! ------------------------------------------------ - call LDE_Create ( E, CF, aodGrid, __RC__ ) - call LDE_Projector1c ( E, q_f, q_f, y_f, y_d, verbose, __RC__ ) - call LDE_Destroy ( E, __RC__ ) - -! -------------- -! Write Files -! -------------- - - call Chem_SimpleBundleWrite (q_a, CF, 'aer_ana_filename', Time, __RC__ ) -#if 0 - call Chem_SimpleBundleWrite (q_b, CF, 'aerbias_internal_checkpoint', Time, __RC__ ) - call Chem_SimpleBundleWrite (y_b, CF, 'aodbias_internal_checkpoint', Time, __RC__ ) -#endif - - if ( verbose ) then - call MAPL_SimpleBundlePrint(q_a) - endif - - - -! All done -! -------- - call ESMF_Finalize(__RC__) - - end subroutine Main - - end Program Ana_LDE - diff --git a/GAAS_GridComp/ana_lde.py b/GAAS_GridComp/ana_lde.py deleted file mode 100755 index c62369d1..00000000 --- a/GAAS_GridComp/ana_lde.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python - -""" - Python wrapper for ana_lpe.x. - - ana_lde.py aer_f aod_d - -""" - -import os -import sys - -from optparse import OptionParser # Command-line args - -from gfio import GFIO -from MAPL import config - -import warnings -warnings.filterwarnings("ignore") - -#--------------------------------------------------------------------- - -if __name__ == "__main__": - - expid = "a0000" - dir = '.' - -# System Dependent defaults -# ------------------------- - if os.path.exists("/nobackup/1/ARCTAS"): # calculon - dir_f = '/nobackup/1/ARCTAS/' - dir_a = '/home/adasilva/GAAS/%s/chem/' - aer_f = dir_f + 'Y%y4/M%m2/d5_arctas_02.inst3d_aer_v.%y4%m2%d2_%h2%n2z.nc' - aer_a = dir_a + "Y%y4/M%m2/%s.aer_a.eta.%y4%m2%d2_%h2%n2z.nc4" - aod_f = dir_a + "Y%y4/M%m2/%s.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc" - aod_d = dir_a + "Y%y4/M%m2/%s.aod_d.sfc.%y4%m2%d2_%h2%n2z.nc" - elif os.path.exists('/discover/nobackup/projects/gmao/iesa/'): # Discover - dir_f = '/discover/nobackup/projects/gmao/iesa/aerosol/data/ARCTAS/' - dir_a = '/discover/nobackup/projects/gmao/iesa/aerosol/experiments/GAAS/%s/chem/' - aer_f = dir_f + 'Y%y4/M%m2/D%d2/d5_arctas_02.inst3d_aer_v.%y4%m2%d2_%h2%n2z.nc4' - aer_a = dir_a + "Y%y4/M%m2/D%d2/%s.aer_a.eta.%y4%m2%d2_%h2%n2z.nc4" - aod_f = dir_a + "Y%y4/M%m2/%s.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc" - aod_d = dir_a + "Y%y4/M%m2/%s.aod_d.sfc.%y4%m2%d2_%h2%n2z.nc" - else: # Generic default - aer_f = "%s.aer_f.eta.%y4%m2%d2_%h2%n2z.nc" - aer_a = "%s.aer_a.eta.%y4%m2%d2_%h2%n2z.nc" - aod_f = "%s.aod_f.sfc.%y4%m2%d2_%h2%n2z.nc" - aod_d = "%s.aod_d.sfc.%y4%m2%d2_%h2%n2z.nc" - - - rc_file = "lde.rc" - Nx = "2" - Ny = "4" - -# Parse command line options -# -------------------------- - parser = OptionParser(usage="Usage: %prog [options] nymd nhms", - version='1.0.0' ) - - parser.add_option("-A", "--aer_a", dest="aer_a", default=aer_a, - help="output aerosol concentration analysis file template (default=%s)"%aer_a ) - - parser.add_option("-F", "--aer_f", dest="aer_f", default=aer_f, - help="input aerosol concentration background file template (default=%s)"%aer_f ) - - parser.add_option("-D", "--dir", dest="dir", default=dir, - help="directory name to append to file names (default=%s)"%dir ) - - parser.add_option("-d", "--aod_d", dest="aod_d", default=aod_d, - help="output AOD analysis increment file template (default=%s)"%aod_d ) - - parser.add_option("-f", "--aod_f", dest="aod_f", default=aod_f, - help="output AOD background file template (default=%s)"%aod_f ) - - parser.add_option("-r", "--rcfile", dest="rc", default=rc_file, - help="resource file (default=%s)"%rc_file ) - - parser.add_option("-X", "--Nx", dest="Nx", default=Nx, - help="number of PEs to decompose longitude (default=%s)"%Nx ) - - parser.add_option("-Y", "--Ny", dest="Ny", default=Ny, - help="number of PEs to decompose latitude (default=%s)"%Ny ) - - parser.add_option("-x", "--expid", dest="expid", default=expid, - help="experiment Id (default=%s)"%expid ) - - parser.add_option("-v", "--verbose", - action="store_true", dest="verbose") - - options, args = parser.parse_args() - - if len(args) < 2: - parser.error("not enough input arguments") - else: - nymd = args[0] - nhms = args[1] - -# Expand file name templates -# -------------------------- - options.aer_f = config.strTemplate(options.aer_f,expid=options.expid, - nymd=nymd,nhms=nhms) - options.aer_a = config.strTemplate(options.aer_a,expid=options.expid, - nymd=nymd,nhms=nhms) - options.aod_f = config.strTemplate(options.aod_f,expid=options.expid, - nymd=nymd,nhms=nhms) - options.aod_d = config.strTemplate(options.aod_d,expid=options.expid, - nymd=nymd,nhms=nhms) - -# Append directory -# ---------------- - if options.aer_f[0] not in ('/','.'): - options.aer_f = options.dir+'/'+options.aer_f - if options.aer_a[0] not in ('/','.'): - options.aer_a = options.dir+'/'+options.aer_a - if options.aod_f[0] not in ('/','.'): - options.aod_f = options.dir+'/'+options.aod_f - if options.aod_d[0] not in ('/','.'): - options.aod_d = options.dir+'/'+options.aod_d - -# Get file dimensions -# ------------------- - f = GFIO(options.aer_f,'r') - d = GFIO(options.aod_d,'r') - -# Load rc file -# ------------ - cf = config.Config(options.rc) - -# Update rc file with user specified parameters -# --------------------------------------------- - cf('ExpId',options.expid) - cf('Layout_Nx',options.Nx) - cf('Layout_Ny',options.Ny) - cf('IM_World',f.im) - cf('JM_World',f.jm) - cf('LM_World',f.km) - cf('CM_World',d.km) - cf('nymd',nymd) - cf('nhms',nhms) - if options.verbose: - cf('verbose',".TRUE.") - else: - cf('verbose',".FALSE.") - cf('aer_ana_filename',options.aer_a) - cf('aer_bkg_filename',options.aer_f) - cf('aod_bkg_filename',options.aod_f) - cf('aod_inc_filename',options.aod_d) - cf.save(rcfile="lde.rc") # save updated rc file - - nPE = int(options.Nx) * int(options.Ny) - -# Run the Fortran binary -# ---------------------- - rc = os.system("mpirun -np %d ana_lde.x"%nPE) - if rc: - raise RuntimeError, "rc=%d on return from 'ana_lde.x'"%rc diff --git a/GAAS_GridComp/lde.rc b/GAAS_GridComp/lde.rc deleted file mode 100644 index d2ee5782..00000000 --- a/GAAS_GridComp/lde.rc +++ /dev/null @@ -1,85 +0,0 @@ -# -# Resource file defining LDE parameters and file names -# - -# ------------------ -# Dynamic Parameters -# ------------------ - - -ExpId: a0008 - -Layout_Nx: 4 -Layout_Ny: 6 - -CoresPerNode: 12 # System Dependent!!!!! - -# Lat/Lon -# ------- -# IM_World: 576 -# JM_World: 361 - -# Cubed-sphere: C180 -# ------------------ - IM_World: 180 - JM_World: 1080 - -LM_World: 72 -CM_World: 1 - -top_vertical_layer: 36 # k = 36, p ~ 72 hPa - -nymd: 20080630 -nhms: 120000 - -verbose: .TRUE. - -single_channel: 550. # Single channel to analyze - - -# ------------------- -# File Name Templates -# ------------------- - -aer_bkg_filename: /home/adasilva/silo/LDE/dR_Fortuna-2-4-b4.inst3d_aer_v.20080630_1200z.nc4 -aod_bkg_filename: /home/adasilva/silo/LDE/dR_Fortuna-2-4-b4.aod_f.sfc.20080630_1200z.nc4 -aod_inc_filename: /home/adasilva/silo/LDE/dR_Fortuna-2-4-b4.aod_d.sfc.20080630_1200z.nc4 - -aer_ana_filename: ./aer_a.nc4 - -aerbias_internal_restart: aerbias_internal_restart.nc -aerbias_internal_checkpoint: aerbias_internal_checkpoint.nc - -aodbias_internal_restart: aodbias_internal_restart.nc -aodbias_internal_checkpoint: aodbias_internal_checkpoint.nc - -# -# We assume the analysis increment file (aod_d) are in log(AOD+eps), while the -# AOD background file (aod_f) is in plain AOD. -# Regardless of whether the AOD analysis was performed in log-transform space or not, -# this resource constrols whether AOD or log(AOD+eps) is used to generate the ensembles. -# -# Because of Log(AOD+eps) is non-linear as a function of q, it may be better to perform -# this operation using plain AOD. -# -perform_lde_in_aod_variable: .TRUE. - -eps_for_log_transform_aod: 0.01 - -# -------------- -# LDE Parameters -# -------------- - -#number_of_ensemble_members: 300 -number_of_ensemble_members: 100 -#stencil_radius_in_km: 1500. -stencil_radius_in_km: 1000. -aod_weight_delta: 0.5 - -lde_debug_filename: aod_lde.nc # for debugging only - - - - - - diff --git a/GEOS_ChemGridComp.F90 b/GEOS_ChemGridComp.F90 index 79c84d3d..f3c80fae 100644 --- a/GEOS_ChemGridComp.F90 +++ b/GEOS_ChemGridComp.F90 @@ -25,10 +25,10 @@ module GEOS_ChemGridCompMod use GMIchem_GridCompMod, only : GMI_SetServices => SetServices use CARMAchem_GridCompMod, only : CARMA_SetServices => SetServices use GEOSCHEMchem_GridCompMod, only : GCChem_SetServices => SetServices - use MATRIXchem_GridCompMod, only : MATRIX_SetServices => SetServices - use MAMchem_GridCompMod, only : MAM_SetServices => SetServices + use MATRIX_GridCompMod, only : MATRIX_SetServices => SetServices + use MAM_GridCompMod, only : MAM_SetServices => SetServices use GEOS_PChemGridCompMod, only : PChem_SetServices => SetServices - use GEOS_AChemGridCompMod, only : AChem_SetServices => SetServices + use ACHEM_GridCompMod, only : AChem_SetServices => SetServices use GAAS_GridCompMod, only : GAAS_SetServices => SetServices use H2O_GridCompMod, only : H2O_SetServices => SetServices use TR_GridCompMod, only : TR_SetServices => SetServices diff --git a/GEOSachem_GridComp/AMIP.20C/GEOS_AChemGridComp.rc b/GEOSachem_GridComp/AMIP.20C/GEOS_AChemGridComp.rc deleted file mode 100644 index 29256ab5..00000000 --- a/GEOSachem_GridComp/AMIP.20C/GEOS_AChemGridComp.rc +++ /dev/null @@ -1,44 +0,0 @@ -# -# Resource file for the GEOS aerosol chemistry grid component. -# -# 15 Aug 2012 A. Darmenov -#-------------------------------------------------------------------- - -verbose: .True. - - -# MAM chemistry -# ------------------------------------- -gas_chemistry: .false. -aqueous_chemistry: .false. - - -# OCS chemistry and boundary conditions -# ------------------------------------- -ocs_chemistry: .false. -ocs_surface_vmr: 490.0e-12 # 'mol/mol' - - -# VOC chemistry and parameters -# ------------------------------------- -voc_chemistry: .true. -voc_BiomassBurnFactor: 0.013 # 'g/g CO' -voc_AnthroFactor: 0.069 # 'g/g CO' -voc_MW: 0.150 # 'kg/mol' -soa_MW: 0.161 # 'kg/mol' - - -# Maximum allowed time step for integrating aqueous phase chemistry kinematics -# ---------------------------------------------------------------------------- -aqueous_chemistry_solver_max_dt: 60 - - -# Heights of aviation LTO, CDS and CRS layers, 'm' -# ------------------------------------------------ -aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3 - - -# Volcanic emissions -# ------------------ -volcanoes: ExtData/chemistry/CARN/v202106/sfc/so2_volcanic_emissions_Carns.%y4%m2%d2.rc - diff --git a/GEOSachem_GridComp/AMIP.20C/GEOSachem_ExtData.rc b/GEOSachem_GridComp/AMIP.20C/GEOSachem_ExtData.rc deleted file mode 100644 index 64a04519..00000000 --- a/GEOSachem_GridComp/AMIP.20C/GEOSachem_ExtData.rc +++ /dev/null @@ -1,60 +0,0 @@ -# -# Sample resource file exemplifying the specification of an interface to -# boundary conditions, emissions and other external files. This resource -# file is meant to be read by the MAPL_ExtData Grid Component. -# - -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - -# SO2 emissions -SO2_EMIS_FIRES 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00 none none biomass ExtData/chemistry/HFED/v1.0/Y%y4/hfed.emis_so2.x576_y361_t14.%y4.nc4 - - -SO2_EMIS_NONENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl1 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 -SO2_EMIS_ENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl2 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - - -SO2_EMIS_SHIPPING 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_ship ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_LTO 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CDS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CRS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - -# Surface seawater concentration of DMS -DMS_CONC_OCEAN 'mol m-3' Y Y %y4-%m2-%d2t12:00:00 0.0 1.0e-6 conc ExtData/chemistry/Lana/v2011/DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - -# NH3 emissions -NH3_EMIS 'kg m-2 s-1' N Y 0 none none emi_nh3 ExtData/chemistry/MERRA2/v0.0.0/sfc/edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 -NH3_EMIS_FIRE 'kg m-2 s-1' N Y %y4-%m2-%d2T12:00:00 none none biomass ExtData/chemistry/HFED/v1.0/Y%y4/hfed.emis_nh3.x576_y361_t14.%y4.nc4 -NH3_EMIS_OCEAN 'kg m-2 s-1' Y Y %y4-%m2-%d2T12:00:00 none none emiss_ocn ExtData/chemistry/GEIA/v0.0.0/sfc/GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - -# Volume mixing ratio of prescribed oxidant field -OH 'mol mol-1' N N 0 none none oh ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -NO3 'mol mol-1' N N 0 none none no3 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -#HO2 'mol mol-1' N N 0 none none ho2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -H2O2 'mol mol-1' N N 0 none none h2o2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - - -# SOA(gas) emissions -SOAG_EMIS 'm-2 s-1' Y N 0 none none soag ExtData/chemistry/CAM/v0.0.0/sfc/SOAG.emiss.x144_y91_t12.1990.nc4 - -# CO emissions for VOC -CO_BIOMASS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none biomass ExtData/chemistry/HFED/v1.0/Y%y4/hfed.emis_co.x576_y361_t14.%y4.nc4 -CO_BF_VOC 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00Z none none emcobf /dev/null -CO_FS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none co ExtData/chemistry/CEDS/v2021-04-21-revised/sfc/CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - -# Photolysis rates -#jH2O2 's-1' Y N 0 none none jH2O2 ExtData/chemistry/GMI/v0.0.0/L72/Y2008/gmi_jh2o2.x144_y91_z72.2008%m2.nc4 -%% - -DerivedExports%% -# ---------|---------|--------------------------------------------| -# Export | Primary |_________________ Mask _____________________| -# Name | Name | Name | Expression | -# ---------|---------|------------|-------------------------------| -# ---------|---------|------------|-------------------------------| -%% - diff --git a/GEOSachem_GridComp/AMIP/GEOS_AChemGridComp.rc b/GEOSachem_GridComp/AMIP/GEOS_AChemGridComp.rc deleted file mode 100644 index 29256ab5..00000000 --- a/GEOSachem_GridComp/AMIP/GEOS_AChemGridComp.rc +++ /dev/null @@ -1,44 +0,0 @@ -# -# Resource file for the GEOS aerosol chemistry grid component. -# -# 15 Aug 2012 A. Darmenov -#-------------------------------------------------------------------- - -verbose: .True. - - -# MAM chemistry -# ------------------------------------- -gas_chemistry: .false. -aqueous_chemistry: .false. - - -# OCS chemistry and boundary conditions -# ------------------------------------- -ocs_chemistry: .false. -ocs_surface_vmr: 490.0e-12 # 'mol/mol' - - -# VOC chemistry and parameters -# ------------------------------------- -voc_chemistry: .true. -voc_BiomassBurnFactor: 0.013 # 'g/g CO' -voc_AnthroFactor: 0.069 # 'g/g CO' -voc_MW: 0.150 # 'kg/mol' -soa_MW: 0.161 # 'kg/mol' - - -# Maximum allowed time step for integrating aqueous phase chemistry kinematics -# ---------------------------------------------------------------------------- -aqueous_chemistry_solver_max_dt: 60 - - -# Heights of aviation LTO, CDS and CRS layers, 'm' -# ------------------------------------------------ -aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3 - - -# Volcanic emissions -# ------------------ -volcanoes: ExtData/chemistry/CARN/v202106/sfc/so2_volcanic_emissions_Carns.%y4%m2%d2.rc - diff --git a/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.rc b/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.rc deleted file mode 100644 index 3fa2e7d3..00000000 --- a/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.rc +++ /dev/null @@ -1,60 +0,0 @@ -# -# Sample resource file exemplifying the specification of an interface to -# boundary conditions, emissions and other external files. This resource -# file is meant to be read by the MAPL_ExtData Grid Component. -# - -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - -# SO2 emissions -SO2_EMIS_FIRES 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00 none none biomass ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_so2.061.%y4%m2%d2.nc4 - - -SO2_EMIS_NONENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl1 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 -SO2_EMIS_ENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl2 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - - -SO2_EMIS_SHIPPING 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_ship ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_LTO 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CDS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CRS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - -# Surface seawater concentration of DMS -DMS_CONC_OCEAN 'mol m-3' Y Y %y4-%m2-%d2t12:00:00 0.0 1.0e-6 conc ExtData/chemistry/Lana/v2011/DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - -# NH3 emissions -NH3_EMIS 'kg m-2 s-1' N Y 0 none none emi_nh3 ExtData/chemistry/MERRA2/v0.0.0/sfc/edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 -NH3_EMIS_FIRE 'kg m-2 s-1' N Y %y4-%m2-%d2T12:00:00 none none biomass ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_nh3.061.%y4%m2%d2.nc4 -NH3_EMIS_OCEAN 'kg m-2 s-1' Y Y %y4-%m2-%d2T12:00:00 none none emiss_ocn ExtData/chemistry/GEIA/v0.0.0/sfc/GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - -# Volume mixing ratio of prescribed oxidant field -OH 'mol mol-1' N N 0 none none oh ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -NO3 'mol mol-1' N N 0 none none no3 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -#HO2 'mol mol-1' N N 0 none none ho2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -H2O2 'mol mol-1' N N 0 none none h2o2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - - -# SOA(gas) emissions -SOAG_EMIS 'm-2 s-1' Y N 0 none none soag ExtData/chemistry/CAM/v0.0.0/sfc/SOAG.emiss.x144_y91_t12.1990.nc4 - -# CO emissions for VOC -CO_BIOMASS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none biomass ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_co.061.%y4%m2%d2.nc4 -CO_BF_VOC 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00Z none none emcobf /dev/null -CO_FS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none co ExtData/chemistry/CEDS/v2021-04-21-revised/sfc/CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - -# Photolysis rates -#jH2O2 's-1' Y N 0 none none jH2O2 ExtData/chemistry/GMI/v0.0.0/L72/Y2008/gmi_jh2o2.x144_y91_z72.2008%m2.nc4 -%% - -DerivedExports%% -# ---------|---------|--------------------------------------------| -# Export | Primary |_________________ Mask _____________________| -# Name | Name | Name | Expression | -# ---------|---------|------------|-------------------------------| -# ---------|---------|------------|-------------------------------| -%% - diff --git a/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.yaml b/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.yaml deleted file mode 100644 index e088964b..00000000 --- a/GEOSachem_GridComp/AMIP/GEOSachem_ExtData.yaml +++ /dev/null @@ -1,140 +0,0 @@ -Collections: - GEOSachem_CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4: - template: ExtData/chemistry/CEDS/v2021-04-21-revised/sfc/CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - GEOSachem_DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4: - template: ExtData/chemistry/Lana/v2011/DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - GEOSachem_GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4: - template: ExtData/chemistry/GEIA/v0.0.0/sfc/GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4: - template: ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - GEOSachem_SOAG.emiss.x144_y91_t12.1990.nc4: - template: ExtData/chemistry/CAM/v0.0.0/sfc/SOAG.emiss.x144_y91_t12.1990.nc4 - GEOSachem_edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4: - template: ExtData/chemistry/MERRA2/v0.0.0/sfc/edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 - GEOSachem_htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - GEOSachem_htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 - GEOSachem_qfed2.emis_co.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_co.061.%y4%m2%d2.nc4 - valid_range: "2000-02-29T12:00/2025-01-01" - GEOSachem_hfed.emis_co.x576_y361.%y4%m2.nc4: - template: ExtData/chemistry/HFED/v1.0/Y%y4/M%m2/hfed.emis_co.x576_y361.%y4%m2.nc4 - valid_range: "1960-01-16T12:00/2000-12-16T12:00" - GEOSachem_qfed2.emis_nh3.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_nh3.061.%y4%m2%d2.nc4 - valid_range: "2000-02-29T12:00/2025-01-01" - GEOSachem_hfed.emis_nh3.x576_y361.%y4%m2.nc4: - template: ExtData/chemistry/HFED/v1.0/Y%y4/M%m2/hfed.emis_nh3.x576_y361.%y4%m2.nc4 - valid_range: "1960-01-16T12:00/2000-12-16T12:00" - GEOSachem_qfed2.emis_so2.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.6r1/sfc/0.1/Y%y4/M%m2/qfed2.emis_so2.061.%y4%m2%d2.nc4 - valid_range: "2000-02-29T12:00/2025-01-01" - GEOSachem_hfed.emis_so2.x576_y361.%y4%m2.nc4: - template: ExtData/chemistry/HFED/v1.0/Y%y4/M%m2/hfed.emis_so2.x576_y361.%y4%m2.nc4 - valid_range: "1960-01-16T12:00/2000-12-16T12:00" - - - -Samplings: - GEOSachem_sample_0: - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - GEOSachem_sample_1: - extrapolation: clim - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - GEOSachem_sample_2: - extrapolation: clim - -Exports: - CO_BF_VOC: - collection: /dev/null - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: emcobf - CO_BIOMASS_VOC: - - {starting: "1960-01-16T12:00", collection: GEOSachem_hfed.emis_co.x576_y361.%y4%m2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - - {starting: "2000-03-01T00:00", collection: GEOSachem_qfed2.emis_co.061.%y4%m2%d2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - CO_FS_VOC: - collection: GEOSachem_CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_0 - variable: co - DMS_CONC_OCEAN: - collection: GEOSachem_DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - linear_transformation: - - 0.0 - - 1.0e-06 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: conc - H2O2: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: h2o2 - NH3_EMIS: - collection: GEOSachem_edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 - regrid: CONSERVE - variable: emi_nh3 - NH3_EMIS_FIRE: - - {starting: "1960-01-16T12:00", collection: GEOSachem_hfed.emis_nh3.x576_y361.%y4%m2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - - {starting: "2000-03-01T00:00", collection: GEOSachem_qfed2.emis_nh3.061.%y4%m2%d2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - NH3_EMIS_OCEAN: - collection: GEOSachem_GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: emiss_ocn - NO3: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: no3 - OH: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: oh - SO2_EMIS_AIRCRAFT_CDS: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_AIRCRAFT_CRS: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_AIRCRAFT_LTO: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_ENERGY: - collection: GEOSachem_htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: sanl2 - SO2_EMIS_FIRES: - - {starting: "1960-01-16T12:00", collection: GEOSachem_hfed.emis_so2.x576_y361.%y4%m2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - - {starting: "2000-03-01T00:00", collection: GEOSachem_qfed2.emis_so2.061.%y4%m2%d2.nc4, regrid: CONSERVE, sample: GEOSachem_sample_0, variable: biomass} - SO2_EMIS_NONENERGY: - collection: GEOSachem_htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: sanl1 - SO2_EMIS_SHIPPING: - collection: GEOSachem_htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_ship - SOAG_EMIS: - collection: GEOSachem_SOAG.emiss.x144_y91_t12.1990.nc4 - sample: GEOSachem_sample_2 - variable: soag - diff --git a/GEOSachem_GridComp/CMakeLists.txt b/GEOSachem_GridComp/CMakeLists.txt deleted file mode 100644 index 9fccc9cb..00000000 --- a/GEOSachem_GridComp/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -esma_set_this () - -set (kpp_gas_dir kpp/gas) -set (srcs - ${kpp_gas_dir}/kpp_achem_gas_Precision.f90 - ${kpp_gas_dir}/kpp_achem_gas_Parameters.f90 - ${kpp_gas_dir}/kpp_achem_gas_Global.f90 - ${kpp_gas_dir}/kpp_achem_gas_Function.f90 - ${kpp_gas_dir}/kpp_achem_gas_JacobianSP.f90 - ${kpp_gas_dir}/kpp_achem_gas_Jacobian.f90 - ${kpp_gas_dir}/kpp_achem_gas_HessianSP.f90 - ${kpp_gas_dir}/kpp_achem_gas_Hessian.f90 - ${kpp_gas_dir}/kpp_achem_gas_StoichiomSP.f90 - ${kpp_gas_dir}/kpp_achem_gas_Stoichiom.f90 - ${kpp_gas_dir}/kpp_achem_gas_Rates.f90 - ${kpp_gas_dir}/kpp_achem_gas_Monitor.f90 - ${kpp_gas_dir}/kpp_achem_gas_Util.f90 - ${kpp_gas_dir}/kpp_achem_gas_LinearAlgebra.f90 - ${kpp_gas_dir}/kpp_achem_gas_Integrator.f90 - GACL_ConstantsMod.F90 - GACL_EmissionsMod.F90 - GACL_ReactionRatesMod.F90 - GACL_DryDepositionMod.F90 - GEOS_AChemGridCompMod.F90 - ) - -esma_add_library ( - ${this} - SRCS ${srcs} - DEPENDENCIES Chem_Shared MAPL GMAO_mpeu ESMF::ESMF NetCDF::NetCDF_Fortran - ) -target_compile_definitions (${this} PRIVATE MAPL_MODE GEOS5) -set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${PP}) - -new_esma_generate_automatic_code ( - ${this} GEOSachem_Registry.rc - "GEOS_AChem_ExportSpec___.h;GEOS_AChem_GetPointer___.h" - GEOS_AChem_History___.rc - ${include_GEOSachem_GridComp} ${esma_etc} - "-f" - ) - -file (GLOB_RECURSE rc_files CONFIGURE_DEPENDS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rc *.yaml) -foreach ( file ${rc_files} ) - get_filename_component( dir ${file} DIRECTORY ) - install( FILES ${file} DESTINATION etc/${dir} ) -endforeach() - diff --git a/GEOSachem_GridComp/GACL_ConstantsMod.F90 b/GEOSachem_GridComp/GACL_ConstantsMod.F90 deleted file mode 100644 index 285e819e..00000000 --- a/GEOSachem_GridComp/GACL_ConstantsMod.F90 +++ /dev/null @@ -1,81 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GACL_ConstantsMod -! -! !INTERFACE: -! - module GACL_ConstantsMod -! -! !USES: -! -#ifdef MAPL_MODE - use MAPL_ConstantsMod, only : MAPL_PI, MAPL_GRAV, MAPL_AVOGAD, MAPL_RUNIV, & - MAPL_AIRMW, MAPL_H2OMW, MAPL_O3MW, & - MAPL_TICE -#endif - - implicit none - private - -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !PUBLIC PARAMETERS: -#ifdef MAPL_MODE - real, parameter, public :: pi = MAPL_PI ! pi - real, parameter, public :: N_avog = 1e-3 * MAPL_AVOGAD ! Avogadro's constant, '1 mol-1' - real, parameter, public :: R_univ = 1e-3 * MAPL_RUNIV ! Universal/ideal gas constant, 'J K-1 mol-1' - real, parameter, public :: g_earth = MAPL_GRAV ! standard gravity, 'm s-2' - real, parameter, public :: T_ice = MAPL_TICE ! melting point of ice, 'K' - real, parameter, public :: mw_air = 1e-3 * MAPL_AIRMW ! molar mass of dry air, 'kg mol-1' - real, parameter, public :: mw_H2O = 1e-3 * MAPL_H2OMW ! molar mass of water, 'kg mol-1' - real, parameter, public :: mw_O3 = 1e-3 * MAPL_O3MW ! molar mass of ozone, 'kg mol-1' -#else - real, parameter, public :: pi = 3.141592653589793 ! pi - real, parameter, public :: N_avog = 6.022e23 ! Avogadro's constant, '1 mol-1' - real, parameter, public :: R_univ = 8.31447 ! Universal/ideal gas constant, 'J K-1 mol-1' - real, parameter, public :: g_earth = 9.80665 ! standard gravity, 'm s-2' - real, parameter, public :: T_ice = 273.16 ! Melting point of ice, 'K' - real, parameter, public :: mw_air = 28.965e-3 ! molar mass of dry air, 'kg mol-1' - real, parameter, public :: mw_H2O = 18.015e-3 ! molar mass of water, 'kg mol-1' - real, parameter, public :: mw_O3 = 47.9982e-3 ! molar mass of ozone, 'kg mol-1' -#endif - - real, parameter, public :: mw_S = 32.065e-3 ! atomic mass of sulfur, 'kg mol-1' - real, parameter, public :: mw_SO2 = 64.066e-3 ! molar mass of sulfur dioxide, 'kg mol-1' - real, parameter, public :: mw_SO4 = 96.07e-3 ! molar mass of sulfate, 'kg mol-1' - real, parameter, public :: mw_H2SO4 = 98.079e-3 ! molar mass of sulfuric acid, 'kg mol-1' - real, parameter, public :: mw_DMS = 62.13e-3 ! molar mass of dimethyl sulfide, 'kg mol-1' - real, parameter, public :: mw_MSA = 96.11e-3 ! molar mass of methanesulfonic acid, 'kg mol-1' - real, parameter, public :: mw_OH = 17.01e-3 ! molar mass of hydroxyl radical, 'kg mol-1' - real, parameter, public :: mw_HO2 = 33.01e-3 ! molar mass of hydroperoxyl radical, 'kg mol-1' - real, parameter, public :: mw_H2O2 = 34.0147e-3 ! molar mass of hydrogen peroxide, 'kg mol-1' - real, parameter, public :: mw_N = 14.007e-3 ! atomic mass of nitrogen, 'kg mol-1' - real, parameter, public :: mw_NO3 = 62.0049e-3 ! molar mass of nitrate ion, 'kg mol-1' - real, parameter, public :: mw_NH3 = 17.031e-3 ! molar mass of ammonia, 'kg mol-1' - real, parameter, public :: mw_NH4 = 18.0385e-3 ! molar mass of ammonium, 'kg mol-1' - real, parameter, public :: mw_OCS = 60.075e-3 ! molar mass of carbonyl sulfide, 'kg mol-1' - real, parameter, public :: mw_SOAg = 12.0e-3 ! molar mass of SOA(gas), 'kg mol-1' - -! -! !PRIVATE PARAMETERS: - -! -! !DESCRIPTION: -! -! {\tt GACL\_ConstantsMod} defines physics and chemistry constants. -! -! -! !REVISION HISTORY: -! -! 06June2014 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - end module GACL_ConstantsMod - diff --git a/GEOSachem_GridComp/GACL_DryDepositionMod.F90 b/GEOSachem_GridComp/GACL_DryDepositionMod.F90 deleted file mode 100644 index 5cebe39b..00000000 --- a/GEOSachem_GridComp/GACL_DryDepositionMod.F90 +++ /dev/null @@ -1,285 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GACL_DryDepositionMod - Dry deposition of gases and particles -! -! !INTERFACE: -! - module GACL_DryDepositionMod -! -! !USES: -! - use MAPL - - use GACL_ConstantsMod - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public DepositionVelocity - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - -! -! !DESCRIPTION: -! -! {\tt GACL\_DryDepositionMod} provides a collection of methods for -! modeling dry deposition of gases and aerosol particles. -! -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - interface DepositionVelocity - module procedure DepositionVelocityAerosol - module procedure DepositionVelocityGas - end interface DepositionVelocity - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: schmidt_number --- calculates the Schmidt's number -! -! !INTERFACE: - - pure function schmidt_number(viscosity, D) result (Sc) -! !USES: - - implicit None - - real :: Sc ! Schmidt number, '' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: viscosity ! kinematic viscosity, 'm2 s-1' - real, intent(in) :: D ! Brownian diffusivity coefficient, '' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the Schmidt's number (see Eq. -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('schmidt_number') - - Sc = viscosity / D - - end function schmidt_number - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: stokes_number --- calculates the Sokes number -! -! !INTERFACE: - - pure function stokes_number(settling_velocity, friction_velocity, viscosity) result (St) -! !USES: - - use GACL_ConstantsMod, only : g => g_earth - - implicit None - - real :: St ! Stokes number, '' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: settling_velocity ! settling/sedimentation velocity, 'm s-1' - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - real, intent(in) :: viscosity ! kinematic viscosity, 'm2 s-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the Stokes number (see Eq. 8.105, Seinfeld and Pandis) -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('stokes_number') - - St = settling_velocity * friction_velocity**2 / (g * viscosity) - - end function stokes_number - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: stokes_number --- calculates the quasi-laminar resistance for -! particles -! -! !INTERFACE: - - pure function quasi_laminar_resistance(friction_velocity, Sc, St) result (r_b) -! !USES: - - implicit None - - real :: r_b ! Quasi-laminar resistance, 'm-1 s' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - real, intent(in) :: Sc ! Schmidt number, '' - real, intent(in) :: St ! Stokes number, '' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the quasi-laminar resistance (see Eq. XX, Seinfeld and Pandis) -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('quasi_laminar_resistance') - - r_b = 1 / (friction_velocity * (Sc**(-0.5) + 10.0**(-3/St))) - - end function quasi_laminar_resistance - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: DepositionVelosityAerosol --- -! -! !INTERFACE: - - pure function DepositionVelocityAerosol(v_t, r_a, r_b) result (v_d) -! !USES: - - implicit None - - real :: v_d - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: v_t ! settling velocity, 'm s-1' - - real, intent(in) :: r_a ! aerodynamic resistance, 'm-1 s' - real, intent(in) :: r_b ! quasi-laminar resistance, 'm-1 s' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the deposition velocity of particles following -! Venkatram and Pleim, 1999. -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('DepositionVelocityAerosol') - - v_d = v_t / (1 - exp(-(r_a + r_b) * v_t)) - - end function DepositionVelocityAerosol - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: GACL_DepositionVelosityAerosol --- -! -! !INTERFACE: - - pure function DepositionVelocityGas(r_a, r_b) result (v_d) -! !USES: - - implicit None - - real :: v_d - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: r_a ! aerodynamic resistance, 'm-1 s' - real, intent(in) :: r_b ! quasi-laminar resistance, 'm-1 s' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the deposition velocity of particles following -! Venkatram and Pleim, 1999. -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('GACL_DepositionVelocityGas') - - v_d = 1 / (r_a + r_b) - - end function DepositionVelocityGas - - - - end module GACL_DryDepositionMod - diff --git a/GEOSachem_GridComp/GACL_EmissionsMod.F90 b/GEOSachem_GridComp/GACL_EmissionsMod.F90 deleted file mode 100644 index b31ed231..00000000 --- a/GEOSachem_GridComp/GACL_EmissionsMod.F90 +++ /dev/null @@ -1,908 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GACL_EmissionsMod - Primary emissions of aerosol precursor gases -! -! !INTERFACE: -! - module GACL_EmissionsMod -! -! !USES: -! - - use ESMF, only : ESMF_Grid, ESMF_Config, & - ESMF_ConfigCreate, & - ESMF_ConfigDestroy, & - ESMF_ConfigLoadFile, & - ESMF_ConfigGetDim, & - ESMF_ConfigFindLabel, & - ESMF_ConfigNextLine, & - ESMF_ConfigGetAttribute - - use MAPL - - use m_StrTemplate, only : StrTemplate - - use GACL_ConstantsMod, only : g_earth, T_ice, N_avog, & - mw_air, mw_S, mw_SO2, mw_NH3, mw_DMS, mw_H2O - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public NH3_Emissions - public SO2_Emissions - public DMS_Emissions - public SOAG_Emissions - public VOC_Emissions -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - -! -! !DESCRIPTION: -! -! {\tt GACL\_EmissionsMod} - emissions of sulfate and ammonia. -! -! !REVISION HISTORY: -! -! 29Sep2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NH3_emissions --- Ammonia (NH3) emissions from natural and -! anthropogenic sources. Emissions are injected in the -! surface model layer. -! -! !INTERFACE: - - subroutine NH3_Emissions(delp, & - emiss_lumped, & - emiss_bb, & - q, & - cdt, & - rc) -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp ! pressure level thickness, Pa - - real, dimension(:,:), intent(in) :: emiss_lumped ! emissions of NH3 (not including biomass burning) - real, dimension(:,:), intent(in) :: emiss_bb ! emissions of NH3 from biomass burning - - real, intent(in) :: cdt ! time step - - -! !OUTPUT PARAMETERS: - - real, dimension(:,:,:), intent(inout) :: q ! NH3 mixing ratio, mol mol-1 - - integer, intent(out) :: rc ! return code - -! !DESCRIPTION: Emissions of NH3. Emissions are injected in the first surface layer. -! -! -! !REVISION HISTORY: -! -! 29Sep2012 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('NH3_emissions') - - ! local - real :: f - integer :: k1, km - - rc = 0 - - k1 = lbound(q, 3) - km = ubound(q, 3) - - f = (mw_air / mw_NH3) * g_earth * cdt - q(:,:,km) = q(:,:,km) + f * (emiss_lumped(:,:) + emiss_bb(:,:)) / delp(:,:,km) - - end subroutine NH3_Emissions - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SO2_emissions --- Sulfur dioxide (SO2) emissions from natural and -! anthropogenic sources. For now anthropogenic (except aviation sector) -! and fire emissions are injected in the surface model layer. -! -! !INTERFACE: - - subroutine SO2_Emissions(delp, & - zle, & - rho_air, & - emiss_bb, & - emiss_nonenergy, & - emiss_energy, & - emiss_ship, & - emiss_aircraft_lto, & - emiss_aircraft_cds, & - emiss_aircraft_crs, & - aviation_layers, & - n_volcanos, & - volc_elev, & - volc_cloud, & - volc_SO2, & - volc_start, volc_end, & - volc_i, volc_j, & - emiss_volcanic_expl, & - emiss_volcanic_nexp, & - emiss_tot, & - q, & - cell_area, & - cdt, & - nymd, & - nhms, & - rc) - -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp ! pressure level thickness, Pa - real, dimension(:,:,:), intent(in) :: rho_air ! air density, kg m-3 - real, dimension(:,:,0:),intent(in) :: zle ! edge heights, m - - real, dimension(:,:), intent(in) :: emiss_bb ! emissions of SO2 from biomass burning - real, dimension(:,:), intent(in) :: emiss_nonenergy ! emissions of SO2 from non-energy sectors - real, dimension(:,:), intent(in) :: emiss_energy ! emissions of SO2 from energy sectors - real, dimension(:,:), intent(in) :: emiss_ship ! emissions of SO2 from ships - - real, dimension(:,:), intent(in) :: emiss_aircraft_lto ! emissions of SO2 from aircraft - LTO layer - real, dimension(:,:), intent(in) :: emiss_aircraft_cds ! emissions of SO2 from aircraft - CDS layer - real, dimension(:,:), intent(in) :: emiss_aircraft_crs ! emissions of SO2 from aircraft - CRS layer - real, dimension(4), intent(in) :: aviation_layers ! extend of the LTO, CDS amd CRS layers - - integer :: n_volcanos - real, pointer, dimension(:) :: volc_elev, volc_SO2, volc_cloud - integer, pointer, dimension(:) :: volc_start, volc_end - integer, pointer, dimension(:) :: volc_i, volc_j - - integer, intent(in) :: nymd ! current date - integer, intent(in) :: nhms ! current time - - real, dimension(:,:), intent(in) :: cell_area ! - - - real, intent(in) :: cdt ! time step - -! !OUTPUT PARAMETERS: - real, dimension(:,:), intent(inout) :: emiss_volcanic_expl ! emissions from explosive volcanoes - real, dimension(:,:), intent(inout) :: emiss_volcanic_nexp ! emissions from non-explosive volcanoes - - real, dimension(:,:), intent(inout) :: emiss_tot ! diagnostics: total emissions of SO2, 'kg m-2 s-1' - real, dimension(:,:,:), intent(inout) :: q ! SO2 mixing ratio, mol mol-1 - - integer, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 29Sep2012 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('SO2_Emissions') - - ! local - real :: f - - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k, k1, km - - integer :: it - - real :: z_lto_bot, z_lto_top - real :: z_cds_bot, z_cds_top - real :: z_crs_bot, z_crs_top - - real, allocatable, dimension(:,:,:) :: emiss_aviation_layer - real, allocatable, dimension(:,:,:) :: emiss_aviation - - real :: so2volcano - - real, allocatable, dimension(:,:) :: z0 - - real :: hup, hlow, dz_volc - real :: dz, z1 - real :: deltaSO2v - - rc = 0 - - i1 = lbound(q, 1); i2 = ubound(q, 1) - j1 = lbound(q, 2); j2 = ubound(q, 2) - k1 = lbound(q, 3); km = ubound(q, 3) - - f = (mw_air / mw_SO2) * g_earth * cdt - - ! for now inject emissions in the first model layer - q(:,:,km) = q(:,:,km) + f * (emiss_bb(:,:) + & - emiss_nonenergy(:,:) + & - emiss_energy(:,:) + & - emiss_ship(:,:)) / delp(:,:,km) - - ! aircraft emissions: LTO, CDS and CRS layers - z_lto_bot = max(1e-3, aviation_layers(1)) - z_lto_top = max(2e-3, aviation_layers(2)) - - z_cds_bot = max(2e-3, aviation_layers(2)) - z_cds_top = max(3e-3, aviation_layers(3)) - - z_crs_bot = max(3e-3, aviation_layers(3)) - z_crs_top = max(4e-3, aviation_layers(4)) - - allocate(emiss_aviation_layer(i1:i2,j1:j2,km), __STAT__) - allocate(emiss_aviation(i1:i2,j1:j2,km), __STAT__) - - emiss_aviation_layer = 0.0 - emiss_aviation = 0.0 - - call distribute_aviation_emissions(delp, rho_air, z_lto_bot, z_lto_top, emiss_aircraft_lto, emiss_aviation_layer, i1, i2, j1, j2, km) - emiss_aviation = emiss_aviation + emiss_aviation_layer - - call distribute_aviation_emissions(delp, rho_air, z_cds_bot, z_cds_top, emiss_aircraft_cds, emiss_aviation_layer, i1, i2, j1, j2, km) - emiss_aviation = emiss_aviation + emiss_aviation_layer - - call distribute_aviation_emissions(delp, rho_air, z_crs_bot, z_crs_top, emiss_aircraft_crs, emiss_aviation_layer, i1, i2, j1, j2, km) - emiss_aviation = emiss_aviation + emiss_aviation_layer - - deallocate(emiss_aviation_layer, __STAT__) - - q(:,:,:) = q(:,:,:) + f * emiss_aviation(:,:,:) / delp(:,:,:) - - ! volcanic emissions - ! Point source volcanos (loop over each volcano) - allocate(z0(i1:i2,j1:j2), __STAT__) - z0 = zle(:,:,km) - - emiss_volcanic_expl = 0.0 - emiss_volcanic_nexp = 0.0 - - if (n_volcanos > 0) then - - VOLCANOES: do it = 1, n_volcanos - - i = volc_i(it) - j = volc_j(it) - - ! skip this volcano? - if ((i < 1) .or. (j < 1)) cycle ! volcano not in sub-domain - - ! check time against time range of eruption - if (nhms < volc_start(it) .or. nhms >= volc_end(it)) cycle - - so2volcano = 0.0 - - ! emissions per volcano - if (cell_area(i,j) > 1.0) then ! omit volcanos in very small grid boxes - so2volcano = volc_so2(it) / cell_area(i,j) ! to 'kg(SO2) s-1 m-2' - so2volcano = max(so2volcano, tiny(so2volcano)) - endif - - ! distribute in the vertical - hup = volc_cloud(it) - hlow = volc_elev(it) - - if (hup .ne. hlow) then - hlow = hup - (hup - hlow)/3.0 - endif - - ! diagnostic - sum of volcanos - if (hup .eq. hlow) then - emiss_volcanic_nexp(i,j) = emiss_volcanic_nexp(i,j) + so2volcano - else - emiss_volcanic_expl(i,j) = emiss_volcanic_expl(i,j) + so2volcano - end if - - dz_volc = hup - hlow - - VERTICAL_LEVELS: do k = km, 1, -1 - z1 = zle(i,j,k-1) - dz = z1 - z0(i,j) - deltaSO2v = 0.0 - - ! volcano is above this level - if(z1 .lt. hlow) then - z0(i,j) = z1 - cycle - end if - - ! volcano is below this level - if (z0(i,j) .gt. hup) then - z0(i,j) = z1 - cycle - end if - - ! volcano is in this level - if ((k .eq. km .and. z0(i,j) .gt. hup) .or. & ! below surface - (z0(i,j) .le. hlow .and. z1 .ge. hup)) then ! in level - deltaSO2v = so2volcano - - ! volcano only partly in level ! cell: - else if (z0(i,j) .lt. hlow .and. z1 .lt. hup) then ! has bottom of cloud - deltaSO2v = (z1 - hlow)/dz_volc * so2volcano - - else if (z0(i,j) .gt. hlow .and. z1 .gt. hup) then ! has top of cloud - deltaSO2v = (hup - z0(i,j))/dz_volc * so2volcano - - else ! is filled with cloud - deltaSO2v = dz/dz_volc * so2volcano - end if - - z0(i,j) = z1 - - q(i,j,k) = q(i,j,k) + (mw_air / mw_SO2)*deltaSO2v*cdt*g_earth/delp(i,j,k) - end do VERTICAL_LEVELS - end do VOLCANOES - - endif - - ! diagnostics - total SO2 emissions - emiss_tot = (emiss_bb + & - emiss_nonenergy + & - emiss_energy + & - emiss_ship + & - emiss_volcanic_expl + & - emiss_volcanic_nexp + & - sum(emiss_aviation, dim=3)) - - - deallocate(emiss_aviation, __STAT__) - deallocate(z0, __STAT__) - -contains - - subroutine distribute_aviation_emissions(delp, rhoa, z_bot, z_top, emissions_layer, emissions, i1, i2, j1, j2, km) - - implicit none - - integer, intent(in) :: i1, i2, j1, j2, km - - real, dimension(:,:,:), intent(in) :: delp - real, dimension(:,:,:), intent(in) :: rhoa - real, dimension(:,:), intent(in) :: emissions_layer - real, intent(in) :: z_bot - real, intent(in) :: z_top - real, dimension(:,:,:), intent(out):: emissions - -! local - integer :: i, j, k - integer :: k_bot, k_top - real :: z_ - real, dimension(km) :: z, dz, w_ - - do j = j1, j2 - do i = i1, i2 - ! find level height - z = 0.0 - z_= 0.0 - - do k = km, 1, -1 - dz(k) = delp(i,j,k)/rhoa(i,j,k)/g_earth - z_ = z_ + dz(k) - z(k) = z_ - end do - - ! find the bottom level - do k = km, 1, -1 - if (z(k) >= z_bot) then - k_bot = k - exit - end if - end do - - ! find the top level - do k = k_bot, 1, -1 - if (z(k) >= z_top) then - k_top = k - exit - end if - end do - - ! find the weights - w_ = 0 - -! if (k_top > k_bot) then -! need to bail - something went wrong here -! end if - - if (k_bot .eq. k_top) then - w_(k_bot) = z_top - z_bot - else - do k = k_bot, k_top, -1 - if ((k < k_bot) .and. (k > k_top)) then - w_(k) = dz(k) - else - if (k == k_bot) then - w_(k) = (z(k) - z_bot) - end if - - if (k == k_top) then - w_(k) = z_top - (z(k)-dz(k)) - end if - end if - end do - end if - - ! distribute emissions in the vertical - emissions(i,j,:) = (w_ / sum(w_)) * emissions_layer(i,j) - end do - end do - - return - - end subroutine distribute_aviation_emissions - - end subroutine SO2_Emissions - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: DMS_emissions --- DMS emissions from ocean. Emissions are -! injected in the surface model layer. -! -! !INTERFACE: - - subroutine DMS_emissions(delp, & - t_skin, & - u10n, & - v10n, & - fr_ocean, & - DMS_ocean, & - q, & - flux, & - cdt, & - rc) -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp ! pressure level thickness, Pa - - real, dimension(:,:), intent(in) :: t_skin ! skin teneperature, K - - real, dimension(:,:), intent(in) :: u10n ! equivalient neutral wind speed at 10m - real, dimension(:,:), intent(in) :: v10n ! equivalient neutral wind speed at 10m - - real, dimension(:,:), intent(in) :: fr_ocean ! fraction of ocean - - real, dimension(:,:), intent(in) :: DMS_ocean ! sea surface concentrations of DMS - - real, intent(in) :: cdt ! time step - -! !OUTPUT PARAMETERS: - - real, dimension(:,:,:), intent(inout) :: q ! DMS mixing ratio, mol mol-1 - real, dimension(:,:), intent(inout) :: flux ! DMS flux, mol m-2 s-1 - - integer, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 14Aug2012 A. Darmenov Fisrst crack -! -!EOP -!------------------------------------------------------------------------- - - - __Iam__('DMS_Emissions') - - ! local - real :: f - - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k1, km - - rc = 0 - - i1 = lbound(q, 1); i2 = ubound(q, 1) - j1 = lbound(q, 2); j2 = ubound(q, 2) - k1 = lbound(q, 3); km = ubound(q, 3) - - f = mw_air * cdt * g_earth - flux = 0.0 - forall (i = i1:i2, j = j1:j2, (fr_ocean(i,j) > 0.0) .and. (t_skin(i,j) > T_ice)) - flux(i,j) = DMS_flux(DMS_ocean(i,j), & - q(i,j,km), & - u10n(i,j), & - v10n(i,j), & - t_skin(i,j)) - - q(i,j,km) = q(i,j,km) + f * flux(i,j) / delp(i,j,km) - end forall - - end subroutine DMS_Emissions - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: DMS_flux --- Computes sea-to-air DMS flux. -! -! !INTERFACE: - - pure real function DMS_flux(DMS_ocean, DMS_atmosphere, u10n, v10n, SST) - -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: DMS_ocean ! ocean DMS concentration, mol m-3 - real, intent(in) :: DMS_atmosphere ! DMS concentration, mol mol-1 - - real, intent(in) :: u10n, v10n ! equivalient neutral wind speed at 10m, m s-1 - - real, intent(in) :: SST ! sea surface temperature (SST), K - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: Computes sea-to-air DMS flux. -! -! -! !REVISION HISTORY: -! -! 14Aug2012 A. Darmenov First crack -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('DMS_flux') - - ! parameters - real, parameter :: f_a = 659 * sqrt(mw_DMS / mw_H2O) - - ! local - real :: k_Sc600 ! gas transfer coefficient for a Schmidt number of 600 - real :: k_w ! water side DMS gas transfer velocity, cm h-1 - real :: k_a ! airside DMS gas transfer velosity, cm h-1 - - real :: k ! total gas transfer velocity, cm h-1 - - real :: gamma_a ! airside gradient fraction - real :: alpha ! Ostwald solubility coefficient, alpha = H * (R * T * water_density), kH is Henry's law coefficient - real :: Sc_DMS ! Schmidt number for DMS - - real :: SST_C ! SST, C - real :: w10n ! equivalient neutral wind speed at 10m, m s-1 - - - ! equivalent neutral wind speed at 10 meters - w10n = sqrt(u10n*u10n + v10n*v10n) - - ! water side DMS gas transfer velocity is based on the 10 m wind‐speed‐based - ! parameterization of Nightingale et al. [2000] - k_Sc600 = 0.222*w10n**2 + 0.333*w10n - SST_c = min(max(0.0, SST - 273.15), 35.0) - Sc_DMS = 2764.0 + SST_c*(-147.12 + SST_c*(3.726 + SST_c*(-0.038))) - - k_w = k_Sc600 * sqrt(Sc_DMS / 600.0) - - ! Ostwald solubility coefficient for DMS - alpha = exp(3525.0/SST - 9.464) - - ! airside transfer velocity - k_a = f_a * w10n ! k_a = (659 * w10n) * sqrt(mw_DMS / mw_H2O) - - ! atmospheric gradient fraction - gamma_a = 1.0/(1.0 + k_a / (alpha * k_w)) - - ! total gas transfer velocity - k = k_w * (1.0 - gamma_a) ! cm h-1 - k = (1e-2/3600) * k ! converted to m s-1 - - ! DMS emission flux, mol m-2 s-1 -#if(1) - DMS_flux = k * (DMS_ocean - alpha * DMS_atmosphere) -#else - DMS_flux = k * DMS_ocean -#endif - - DMS_flux = max(0.0, DMS_flux) - - end function DMS_flux - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SOAG_emissions --- SOA(gas) emissions from natural and -! anthropogenic sources. Emissions are injected in the -! surface model layer. -! -! !INTERFACE: - - subroutine SOAG_Emissions(delp, & - emiss_lumped, & - q, & - cdt, & - rc) -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp ! pressure level thickness, Pa - - real, dimension(:,:), intent(in) :: emiss_lumped ! lumped emissions of SOA(gas), 'molecules m-2 s-1' - - real, intent(in) :: cdt ! time step - - -! !OUTPUT PARAMETERS: - - real, dimension(:,:,:), intent(inout) :: q ! SOA(gas) mixing ratio, mol mol-1 - - integer, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 29Sep2012 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('SOAG_emissions') - - ! local - real :: f - integer :: k1, km - - rc = 0 - - k1 = lbound(q, 3) - km = ubound(q, 3) - - f = (mw_air / N_avog) * g_earth * cdt - q(:,:,km) = q(:,:,km) + f * emiss_lumped(:,:) / delp(:,:,km) - - end subroutine SOAG_Emissions - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: VOC_emissions --- -! VOC emissions from biomass burning and anthropogenic sources, -! based on corresponding CO emissions. Emissions are injected in -! the model surface layer. -! -! !INTERFACE: - - subroutine VOC_Emissions(delp, & - voc_BiomassBurnFactor, & - voc_AnthroFactor, & - co_biomass_voc, & - co_bf_voc, & - co_fs_voc, & - voc_MW, & - q, qb, & - cdt, & - rc) -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp ! pressure level thickness, Pa - - real, dimension(:,:), intent(in) :: co_biomass_voc ! CO biomass burning emissions, kg m-2 s-1 - real, dimension(:,:), intent(in) :: co_bf_voc ! CO biofuel emissions, kg m-2 s-1 - real, dimension(:,:), intent(in) :: co_fs_voc ! CO fossil fuel emissions, kg m-2 s-1 - - real, intent(in) :: voc_BiomassBurnFactor ! 'g/g CO' - real, intent(in) :: voc_AnthroFactor ! 'g/g CO' - real, intent(in) :: voc_MW - - real, intent(in) :: cdt ! time step - - -! !OUTPUT PARAMETERS: - real, dimension(:,:,:), intent(inout) :: q ! VOC mixing ratio, mol mol-1 (anthro) - real, dimension(:,:,:), intent(inout) :: qb ! VOC mixing ratio, mol mol-1 (biob) - integer, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 07Oct2016 M.S. Johnson/P.R. Colarco -! -!------------------------------------------------------------------------- - __Iam__('VOC_emissions') - - ! local variables - real :: f - real, allocatable, dimension(:,:) :: dvoc - integer :: i1, i2, j1, j2, k1, km - - rc = 0 - - i1 = lbound(q, 1); i2 = ubound(q, 1) - j1 = lbound(q, 2); j2 = ubound(q, 2) - k1 = lbound(q, 3); km = ubound(q, 3) - - ! The scaling here results in a change in the volume mixing ratio of VOC - f = (mw_air / voc_MW) * g_earth * cdt - allocate(dvoc(i1:i2,j1:j2), __STAT__) - ! Anthropogenic + Biofuel - dvoc = f * (co_bf_voc + co_fs_voc) * voc_AnthroFactor / delp(:,:,km) - q(:,:,km) = q(:,:,km) + dvoc - ! Biomass burning - dvoc = f * co_biomass_voc * voc_BiomassBurnFactor / delp(:,:,km) - qb(:,:,km) = qb(:,:,km) + dvoc - deallocate(dvoc, __STAT__) - - end subroutine VOC_Emissions -! -!EOP -!------------------------------------------------------------------------- - - -!------------------------------------------------------------------------- -! NASA/GSFC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: distribute_aviation_emissions - Distributes 2D aviation emissions -! in the vertical column - -! -! !INTERFACE: -! - subroutine distribute_aviation_emissions(delp, rhoa, z_bot, z_top, emissions_layer, emissions, i1, i2, j1, j2, km) - - implicit none - - integer, intent(in) :: i1, i2, j1, j2, km - - real, dimension(:,:,:), intent(in) :: delp - real, dimension(:,:,:), intent(in) :: rhoa - real, dimension(:,:), intent(in) :: emissions_layer - real, intent(in) :: z_bot - real, intent(in) :: z_top - real, dimension(:,:,:), intent(out):: emissions - -! local - integer :: i, j, k - integer :: k_bot, k_top - real :: z_ - real, dimension(km) :: z, dz, w_ - - do j = j1, j2 - do i = i1, i2 - ! find level height - z = 0.0 - z_= 0.0 - - do k = km, 1, -1 - dz(k) = delp(i,j,k)/rhoa(i,j,k)/g_earth - z_ = z_ + dz(k) - z(k) = z_ - end do - - ! find the bottom level - do k = km, 1, -1 - if (z(k) >= z_bot) then - k_bot = k - exit - end if - end do - - ! find the top level - do k = k_bot, 1, -1 - if (z(k) >= z_top) then - k_top = k - exit - end if - end do - - ! find the weights - w_ = 0 - -! if (k_top > k_bot) then -! need to bail - something went wrong here -! end if - - if (k_bot .eq. k_top) then - w_(k_bot) = z_top - z_bot - else - do k = k_bot, k_top, -1 - if ((k < k_bot) .and. (k > k_top)) then - w_(k) = dz(k) - else - if (k == k_bot) then - w_(k) = (z(k) - z_bot) - end if - - if (k == k_top) then - w_(k) = z_top - (z(k)-dz(k)) - end if - end if - end do - end if - - ! distribute emissions in the vertical - emissions(i,j,:) = (w_ / sum(w_)) * emissions_layer(i,j) - end do - end do - - end subroutine distribute_aviation_emissions - - end module GACL_EmissionsMod diff --git a/GEOSachem_GridComp/GACL_ReactionRatesMod.F90 b/GEOSachem_GridComp/GACL_ReactionRatesMod.F90 deleted file mode 100644 index a28ea107..00000000 --- a/GEOSachem_GridComp/GACL_ReactionRatesMod.F90 +++ /dev/null @@ -1,287 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GACL_ReactionRatesMod - Reaction rate coefficients. -! -! !INTERFACE: -! - module GACL_ReactionRatesMod -! -! !USES: -! - use GACL_ConstantsMod, only : pi - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public henry - -! -! !PUBLIC PARAMETERS: - - ! molar enthalpy of dissolution over R_univ - real, public, parameter :: E_R_DMS = -3500.0 ! K - real, public, parameter :: E_R_MSA = -0.0 ! K - real, public, parameter :: E_R_SO2 = -3120.0 ! K - real, public, parameter :: E_R_H2SO4 = -0.0 ! K - real, public, parameter :: E_R_NH3 = -4085.0 ! K - real, public, parameter :: E_R_OH = -4300.0 ! K - real, public, parameter :: E_R_H2O2 = -6338.0 ! K - real, public, parameter :: E_R_O3 = -2560.0 ! K - - ! Henry's Low coefficients at T0 = 298.15K - real, public, parameter :: H_DMS_298 = 5.4e-1 ! M atm-1 - real, public, parameter :: H_MSA_298 = 1.0e20 ! M atm-1 <-- big as in infinity - real, public, parameter :: H_SO2_298 = 1.2 ! M atm-1 - real, public, parameter :: H_H2SO4_298 = 1.0e11 ! M atm-1 - real, public, parameter :: H_NH3_298 = 58.0 ! M atm-1 - real, public, parameter :: H_OH_298 = 30.0 ! M atm-1 - real, public, parameter :: H_H2O2_298 = 1.0e5 ! M atm-1 - real, public, parameter :: H_O3_298 = 1.2e-2 ! M atm-1 - - -! -! !PRIVATE PARAMETERS: - -! -! !DESCRIPTION: -! -! {\tt GACL\_ReactionRatesMod} - Reaction rate coefficients. -! -! !REVISION HISTORY: -! -! 22Oct2012 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Henry - computes Henry;s low coefficents -! -! !INTERFACE: - - pure real function henry(H0, T0, E_R, T) - -! !USES: - - implicit None - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - real, intent(in) :: H0 ! Henry's constant at T=T0, M atm-1 - real, intent(in) :: T0 ! temperature, K - - real, intent(in) :: E_R ! molar enthalpy of dissolution over R_univ, K - - real, intent(in) :: T ! temperature, K - - - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 29Sep2012 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - henry = H0 * exp(-E_R*(1.0/T - 1.0/T0)) - - end function henry - - -#if(0) -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: dynamic_viscosity_air --- -! -! !INTERFACE: - - pure function dynamic_viscosity_air(T) result (viscosity) -! !USES: - - implicit None - - real :: viscosity ! dynamic viscosity air, 'kg m-1 s-1' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: T ! temperature, 'K' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the dynamic viscosity of air, following -! Sutherland's equation (List, 1984) -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('dynamic_viscosity_air') - - viscosity = 1.8325e-5 * (416.16 / (T + 120)) * (T/296.16)**1.5 - - end function dynamic_viscosity_air - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: kinematic_viscosity_air --- -! -! !INTERFACE: - - pure function kinematic_viscosity_air(T, density_air) result (viscosity) -! !USES: - - implicit None - - real :: viscosity ! kinematic viscosity air, 'm2 s-1' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: T ! temperature, 'K' - real, intent(in) :: density_air ! density of air, 'kg m-3' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the kinematic viscosity of air. -! -! !REVISION HISTORY: -! -! 12Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('kinematic_viscosity_air') - - viscosity = dynamic_viscosity_air(T) / density_air - - end function kinematic_viscosity_air - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: free_mean_path_gas --- -! -! !INTERFACE: - - pure function free_mean_path_gas(p, T, v, mw) result (path) -! !USES: - - implicit None - - real :: path ! free mean path of gas, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: p ! pressure, 'Pa' - real, intent(in) :: T ! temperature, 'K' - real, intent(in) :: v ! viscosity, 'kg m-1 s-1' - real, intent(in) :: mw ! molecular weight, 'kg Kmole-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the free mean path of a pure gas, following -! Seinfeld and Pandis, equation 8.6 -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('free_mean_path_gas') - - path = 2 * v / (p * (8/pi * mw/(R_univ*T))**0.5) - - end function free_mean_path_gas - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: free_mean_path_gas --- -! -! !INTERFACE: - - pure function free_mean_path_air(p, T) result (path) -! !USES: - - implicit None - - real :: path ! free mean path of air, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: p ! pressure, 'Pa' - real, intent(in) :: T ! temperature, 'K' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the free mean path of air molecules -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! __Iam__('free_mean_path_air') - - real :: v_air ! viscosity, 'kg m-1 s-1' - - v_air = dynamic_viscosity_air(T) - path = free_mean_path_gas(p, T, v_air, MW_air) - - end function free_mean_path_air -#endif - - end module GACL_ReactionRatesMod diff --git a/GEOSachem_GridComp/GEOS_AChemGridComp.rc b/GEOSachem_GridComp/GEOS_AChemGridComp.rc deleted file mode 100644 index 7df82156..00000000 --- a/GEOSachem_GridComp/GEOS_AChemGridComp.rc +++ /dev/null @@ -1,43 +0,0 @@ -# -# Resource file for the GEOS aerosol chemistry grid component. -# -# 15 Aug 2012 A. Darmenov -#-------------------------------------------------------------------- - -verbose: .True. - - -# MAM chemistry -# ------------------------------------- -gas_chemistry: .false. -aqueous_chemistry: .false. - - -# OCS chemistry and boundary conditions -# ------------------------------------- -ocs_chemistry: .false. -ocs_surface_vmr: 490.0e-12 # 'mol/mol' - - -# VOC chemistry and parameters -# ------------------------------------- -voc_chemistry: .true. -voc_BiomassBurnFactor: 0.013 # 'g/g CO' -voc_AnthroFactor: 0.069 # 'g/g CO' -voc_MW: 0.150 # 'kg/mol' -soa_MW: 0.161 # 'kg/mol' - - -# Maximum allowed time step for integrating aqueous phase chemistry kinematics -# ---------------------------------------------------------------------------- -aqueous_chemistry_solver_max_dt: 60 - - -# Heights of aviation LTO, CDS and CRS layers, 'm' -# ------------------------------------------------ -aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3 - - -# Volcanic emissions -# ------------------ -volcanoes: ExtData/chemistry/CARN/v202106/sfc/so2_volcanic_emissions_CARN_v202106.degassing_only.rc diff --git a/GEOSachem_GridComp/GEOS_AChemGridCompMod.F90 b/GEOSachem_GridComp/GEOS_AChemGridCompMod.F90 deleted file mode 100644 index ff268d89..00000000 --- a/GEOSachem_GridComp/GEOS_AChemGridCompMod.F90 +++ /dev/null @@ -1,3871 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: GEOS_AChemGridCompMod - -! -! !INTERFACE: -! - module GEOS_AChemGridCompMod -! -! !USES: -! - use ESMF - use MAPL - - use m_StrTemplate, only: StrTemplate - - use DryDepositionMod, only: DryDepositionGOCART - - use GACL_ConstantsMod, only: pi, g_earth, N_avog, R_univ, & - mw_air, mw_S, mw_SO2, mw_SO4, mw_H2SO4, & - mw_DMS, mw_MSA, mw_OH, mw_NO3, mw_N, mw_NH3, mw_NH4, mw_SOAg - - use GACL_DryDepositionMod, only: DepositionVelocity - - use GACL_EmissionsMod, only: NH3_Emissions, & - SO2_Emissions, & - DMS_Emissions, & - SOAG_Emissions, & - VOC_Emissions - - - use GACL_ReactionRatesMod, only: henry, & - H_SO2_298, E_R_SO2, & - H_NH3_298, E_R_NH3, & - H_H2O2_298, E_R_H2O2, & - H_O3_298, E_R_O3 - - - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices -! -! !DESCRIPTION: -! -! {\tt GEOS\_AChem} is an ESMF gridded component implementing gas and aqueous phase -! chemistry in GEOS-5. -! -! Developed for GEOS-5 release Fortuna 2.0 and later. -! -! !REVISION HISTORY: -! -! 08Aug2012 A. Darmenov Cloned from MAM -! -!EOP -!------------------------------------------------------------------------- - -! Legacy state -! ------------ - type AChem_State - private - type(ESMF_Config) :: CF ! Private Config - - type(ESMF_Grid) :: grid ! Grid - - logical :: verbose ! turn on/off more verbose messages - - logical :: mam_chem ! aerosol chemistry for MAM and alike - logical :: gas_phase_chem ! enable/disable gas phase chemistry - logical :: aqu_phase_chem ! enable/disable aqueous phase chemistry - - logical :: ocs_chem ! enable/disable OCS chemistry mechanism - real :: ocs_surface_vmr = 0.0 ! OCS surface volume mixing ratio - - logical :: voc_chem ! voc chemistry ! turn on/off VOCs - real :: voc_BiomassBurnFactor = 0.0 ! conversion factor CO->VOC (BB) - real :: voc_AnthroFactor = 0.0 ! conversion factor CO->VOC (anthro) - real :: voc_MW = 0.0 ! molecular weight of VOC - real :: soa_MW = 0.0 ! molecular weight of SOA - - real :: aqu_solver_max_dt ! maximum time step used for integration in the aqueous-phase mechanism - - logical :: apply_diurnal_cycle ! flag that indicates if offline oxidant have to be temporally downscaled - - real, dimension(4) :: aviation_layers ! heights of the LTO, CDS and CRS layers - - integer :: nymd_volcanic_emiss ! nYMD of last volcanic emission update - character(len=1024) :: volcanic_emiss_file ! resource file with volcanic emissions data - integer :: n_volcanoes = 0 ! point wise location, amount, elevation, plume height, cell indexes - real, pointer, dimension(:) :: volc_lat => null(), & - volc_lon => null(), & - volc_SO2 => null(), & - volc_elev => null(), & - volc_cloud => null() - integer, pointer, dimension(:) :: volc_start => null(), & - volc_end => null(), & - volc_i => null(), & - volc_j => null() - - real, pointer, dimension(:,:,:) :: h2o2 ! buffer for H2O2 that is being replenished every 3 hours - ! if it is from climatology - end type AChem_State - -! Hook for the ESMF -! ----------------- - type AChem_Wrap - type (AChem_State), pointer :: PTR => null() - end type AChem_Wrap - -contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices --- Sets IRF services for the AChem Grid Component -! -! !INTERFACE: - - subroutine SetServices(GC, RC) - -! !ARGUMENTS: - - type(ESMF_GridComp), intent(INOUT) :: GC ! gridded component - integer, optional :: RC ! return code - -! !DESCRIPTION: Sets Initialize, Run and Finalize services. -! -! !REVISION HISTORY: -! -! 1Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('SetServices') - -! Local derived type aliases -! -------------------------- - type (AChem_State), pointer :: self ! internal state - type (AChem_Wrap) :: wrap - - character(len=ESMF_MAXSTR) :: comp_name - -! Local variables -! -------------------------- - integer :: n - -! ------------ - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = TRIM(comp_name) // '::' // trim(Iam) - -! Wrap internal state for storing in GC; rename legacyState -! ------------------------------------- - allocate(self, __STAT__) - wrap%ptr => self - -! Load private Config Attributes -! ------------------------------ - self%CF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile(self%CF, 'GEOS_AChemGridComp.rc', __RC__) - - call ESMF_ConfigGetAttribute(self%CF, self%verbose, label='verbose:', default=.false., __RC__) - - ! gas phase options - call ESMF_ConfigGetAttribute(self%CF, self%gas_phase_chem, label='gas_chemistry:', default=.true., __RC__) - - ! aqueous phase options - call ESMF_ConfigGetAttribute(self%CF, self%aqu_phase_chem, label='aqueous_chemistry:', default=.true., __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%aqu_solver_max_dt, label='aqueous_chemistry_solver_max_dt:', default=60.0, __RC__) -#if (0) - ! combo(gas- and aqueous-phase) options - call ESMF_ConfigGetAttribute(self%CF, self%combo_chem, label='combo_chemistry:', default=.true., __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%combo_solver_max_dt, label='combo_chemistry_max_dt:', default=10.0, __RC__) -#endif - ! other options - call ESMF_ConfigGetAttribute(self%CF, self%apply_diurnal_cycle, label='apply_diurnal_cycle:', default=.true., __RC__) - - ! volcanic emissions - call ESMF_ConfigGetAttribute(self%CF, self%volcanic_emiss_file, Label='volcanoes:', default='/dev/null', __RC__) - - ! heights of aviation layers - self%aviation_layers = 0.0 - call ESMF_ConfigFindLabel(self%CF, Label='aviation_vertical_layers:', __RC__) - AVIATION_LAYERS: do n = 1, 4 - call ESMF_ConfigGetAttribute(self%CF, self%aviation_layers(n), __RC__) - end do AVIATION_LAYERS - - ! OCS chemistry - call ESMF_ConfigGetAttribute(self%CF, self%ocs_chem, Label='ocs_chemistry:', default=.false., __RC__) - - if (self%ocs_chem) then - call ESMF_ConfigGetAttribute(self%CF, self%ocs_surface_vmr, Label='ocs_surface_vmr:', __RC__) - else - self%ocs_surface_vmr = 0.0 - end if - - ! VOC chemistry - call ESMF_ConfigGetAttribute(self%CF, self%voc_chem, Label='voc_chemistry:', default=.false., __RC__) - - if (self%voc_chem) then - call ESMF_ConfigGetAttribute(self%CF, self%voc_BiomassBurnFactor, Label='voc_BiomassBurnFactor:', __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%voc_AnthroFactor, Label='voc_AnthroFactor:', __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%voc_MW, Label='voc_MW:', __RC__) - call ESMF_ConfigGetAttribute(self%CF, self%soa_MW, Label='soa_MW:', __RC__) - end if - - ! Minimalistic atmospheric mechanism for MAM and alike - if (self%gas_phase_chem .or. self%aqu_phase_chem) then - self%mam_chem = .true. - else - self%mam_chem = .false. - end if - - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': Configuration' - print *, trim(Iam)//': gas chemistry = ', self%gas_phase_chem - print *, trim(Iam)//': aqueous chemistry = ', self%aqu_phase_chem - print *, trim(Iam)//': VOC chemistry = ', self%voc_chem - print *, trim(Iam)//': OCS chemistry = ', self%ocs_chem - print *, '' - end if - - -! ------------------------ -! ESMF Functional Services -! ------------------------ - -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, Initialize_, __RC__) - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_RUN, Run_, __RC__) - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_FINALIZE, Finalize_, __RC__) - -! Store internal state in GC -! -------------------------- - call ESMF_UserCompSetInternalState(GC, 'AChem_State', wrap, STATUS) - VERIFY_(STATUS) - -! ------------------ -! MAPL Data Services -! ------------------ - -!BOS -! -! !IMPORT STATE: - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'AIRDENS', & - LONG_NAME = 'Air density', & - UNITS = 'kg m-3', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'DELP', & - LONG_NAME = 'Pressure Thickness', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PLE', & - LONG_NAME = 'Edge pressure', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, & - __RC__) - - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'T', & - LONG_NAME = 'Air Temperature (from Dynamics)', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - - - OPTIONAL_CHEM_IMPORT: if (self%mam_chem) then - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'Cell area', & - UNITS = 'm2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'ZLE', & - LONG_NAME = 'Edge heights', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'QLTOT', & - LONG_NAME = 'Mass fraction of cloud liquid water', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FCLD', & - LONG_NAME = 'Cloud fraction for radiation', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'U10N', & - LONG_NAME = 'Equivalent neutral 10 meter eastward wind', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'V10N', & - LONG_NAME = 'Equivalent neutral 10 meter northward wind', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FROCEAN', & - LONG_NAME = 'Fraction of ocean', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'LWI', & - LONG_NAME = 'Land-water-ice flags', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'USTAR', & - LONG_NAME = 'Surface (friction) velocity scale', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SH', & - LONG_NAME = 'Sensible heat flux', & - UNITS = 'W/m2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'Z0H', & - LONG_NAME = 'Surface roughness for heat', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'ZPBL', & - LONG_NAME = 'Height of PBL', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TS', & - LONG_NAME = 'Surface skin temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'H2O2', & - LONG_NAME = 'Hydrogen peroxide (H2O2)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'OH', & - LONG_NAME = 'Hydroxyl radical (OH)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'NO3', & - LONG_NAME = 'Nitrogen trixide (NO3)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'O3', & - LONG_NAME = 'Ozone (mass mixing ratio)', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'DMS_CONC_OCEAN', & - LONG_NAME = 'Surface seawater concentration of DMS', & - UNITS = 'nmol L-1-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_FIRES', & - LONG_NAME = 'SO2 emissions from biomass burning', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_NONENERGY', & - LONG_NAME = 'SO2 emissions from non-energy sectors', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_ENERGY', & - LONG_NAME = 'SO2 emissions from energy sector', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_SHIPPING', & - LONG_NAME = 'SO2 emissions from shipping sector', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_AIRCRAFT_LTO', & - LONG_NAME = 'SO2 emissions from aviation (LTO layer)', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_AIRCRAFT_CDS', & - LONG_NAME = 'SO2 emissions from aviation (CDS layer)', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SO2_EMIS_AIRCRAFT_CRS', & - LONG_NAME = 'SO2 emissions from aviation (CRS layer)', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'NH3_EMIS', & - LONG_NAME = 'NH3 emissions - all sectors excluding biomass burning', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'NH3_EMIS_FIRE', & - LONG_NAME = 'NH3 emissions - biomass burning', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SOAG_EMIS', & - LONG_NAME = 'SOA(gas) surface emissions', & - UNITS = 'm-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - end if OPTIONAL_CHEM_IMPORT - - - - OPTIONAL_VOC_IMPORTS: if (self%voc_chem) then - - if (.not. self%mam_chem) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'OH', & - LONG_NAME = 'Hydroxyl radical (OH)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - __RC__) - end if - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'CO_BIOMASS_VOC', & - LONG_NAME = 'CO Biomass Burning Emissions', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'CO_BF_VOC', & - LONG_NAME = 'CO Biofuel Emissions', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'CO_FS_VOC', & - LONG_NAME = 'CO Fossil Fuel Emissions', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RESTART = MAPL_RestartSkip, & - __RC__) - - end if OPTIONAL_VOC_IMPORTS - - - OPTIONAL_OCS_IMPORTS: if (self%ocs_chem) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TROPP', & - LONG_NAME = 'Tropopause pressure based on blended estimate', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'OHSTRAT', & - LONG_NAME = 'Hydroxyl radical', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'O3P', & - LONG_NAME = 'O triplet P', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'OCS_JRATE', & - LONG_NAME = 'OCS photolysis rates', & - UNITS = 's-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - __RC__) - - end if OPTIONAL_OCS_IMPORTS - - -! !INTERNAL STATE: - - OPTIONAL_CHEM_INTERNAL: if (self%mam_chem) then - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'DMS', & - LONG_NAME = 'Dimethyl sulfide (DMS)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'MSA', & - LONG_NAME = 'Methanesulfonic acid (MSA)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'SO2', & - LONG_NAME = 'Sulfur dioxide (SO2)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'H2SO4', & - LONG_NAME = 'Sulfuric acid (H2SO4 gas)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'NH3', & - LONG_NAME = 'Ammonia (NH3)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'SOAG', & - LONG_NAME = 'Secondary Organic Aerosols (SOA gas)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', & - ADD2EXPORT = .true., & - __RC__) - end if OPTIONAL_CHEM_INTERNAL - - - OPTIONAL_OCS_INTERNAL: if (self%ocs_chem) then - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'OCS', & - LONG_NAME = 'Carbonyl Sulfide (OCS gas)', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST:MAM', & - ADD2EXPORT = .true., & - __RC__) - - end if OPTIONAL_OCS_INTERNAL - - - OPTIONAL_VOC_INTERNAL: if (self%voc_chem) then - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'VOC', & - LONG_NAME = 'Volatile Organic Compound (VOC) --anthropogenic sources', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', & - ADD2EXPORT = .true., & - __RC__) - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = trim(comp_name)//'::'//'VOCbiob', & - LONG_NAME = 'Volatile Organic Compound (VOC) -- biomass burning sources',& - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', & - ADD2EXPORT = .true., & - __RC__) - - end if OPTIONAL_VOC_INTERNAL - -! !EXTERNAL STATE: - OPTIONAL_CHEM_EXPORT: if (self%mam_chem) then -#include "GEOS_AChem_ExportSpec___.h" - end if OPTIONAL_CHEM_EXPORT - - - OPTIONAL_VOC_EXPORT: if (self%voc_chem) then - - if (.not. self%mam_chem) then - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'OH', & - LONG_NAME = 'OH with imposed diurnal cycle', & - UNITS = 'mol mol-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - end if - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSOA_ANTHRO_VOC', & - LONG_NAME = 'Production of SOA from Anthropogenic + Biofuel Burning VOC', & - UNITS = 'kg m-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSOA_ANTHRO_VOC_MMRday', & - LONG_NAME = 'Production of SOA from Anthropogenic + Biofuel Burning VOC', & - UNITS = 'kg m-3 d-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSOA_BIOB_VOC', & - LONG_NAME = 'Production of SOA from Biomass Burning VOC', & - UNITS = 'kg m-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSOA_BIOB_VOC_MMRday', & - LONG_NAME = 'Production of SOA from Biomass Burning VOC', & - UNITS = 'kg m-3 d-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - end if OPTIONAL_VOC_EXPORT - - - OPTIONAL_OCS_EXPORT: if (self%ocs_chem) then - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSO2_OCS', & - LONG_NAME = 'Production of SO2 from OCS', & - UNITS = 'kg kg-1 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSO2_OCS_OH', & - LONG_NAME = 'Production of SO2 from OCS+OH', & - UNITS = 'kg kg-1 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSO2_OCS_O3p', & - LONG_NAME = 'Production of SO2 from OCS+O3p', & - UNITS = 'kg kg-1 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pSO2_OCS_jOCS', & - LONG_NAME = 'Production of SO2 from OCS photolysis', & - UNITS = 'kg kg-1 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'lOCS', & - LONG_NAME = 'Loss rate of OCS (molec cm-3 s-1)', & - UNITS = 'cm-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'lOCS_OH', & - LONG_NAME = 'Loss rate of OCS from OCS+OH(molec cm-3 s-1)', & - UNITS = 'cm-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'lOCS_O3p', & - LONG_NAME = 'Loss rate of OCS from OCS+O3p(molec cm-3 s-1)', & - UNITS = 'cm-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'lOCS_jOCS', & - LONG_NAME = 'Loss rate of OCS from photolysis (molec cm-3 s-1)', & - UNITS = 'cm-3 s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'pScl_OCS', & - LONG_NAME = 'Production of SO2 from OCS (column integrated)', & - UNITS = 'kg m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - end if OPTIONAL_OCS_EXPORT - -!EOS - -! Set the Profiling timers -! ------------------------ - call MAPL_TimerAdd(GC, name = 'TOTAL', __RC__) - call MAPL_TimerAdd(GC, name = 'RUN', __RC__) - call MAPL_TimerAdd(GC, name = '-EMISSIONS', __RC__) - call MAPL_TimerAdd(GC, name = '-CHEMISTRY', __RC__) - call MAPL_TimerAdd(GC, name = '--CHEMISTRY_GAS', __RC__) - call MAPL_TimerAdd(GC, name = '--CHEMISTRY_AQUEOUS', __RC__) - call MAPL_TimerAdd(GC, name = '--CHEMISTRY_VOC', __RC__) - call MAPL_TimerAdd(GC, name = '--CHEMISTRY_OCS', __RC__) - call MAPL_TimerAdd(GC, name = 'INITIALIZE', __RC__) - - -! Generic Set Services -! -------------------- - call MAPL_GenericSetServices(GC, __RC__) - -! All done -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine SetServices - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize AChem -! -! !INTERFACE: -! - - subroutine Initialize_(GC, IMPORT, EXPORT, CLOCK, rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 01Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Initialize_') - - type(AChem_State), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - integer :: i1, i2, im ! 3D Dimensions - integer :: j1, j2, jm ! - integer :: km ! - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name ! component's name - - real, pointer, dimension(:,:,:) :: q_H2O2 ! H2O2 - logical, parameter :: using_GMI_H2O2 = .false. ! coupling with GMI is not implemented - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -#if(0) -#include "GEOS_AChem_DeclarePointer___.h" -#endif - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - -! -------- - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': Starting...' - print *, '' - end if - - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - - call MAPL_TimerOn(mgState, 'TOTAL', __RC__) - call MAPL_TimerOn(mgState, 'INITIALIZE', __RC__) - - -! Initialize MAPL Generic -! ----------------------- - call MAPL_GenericInitialize(GC, IMPORT, EXPORT, clock, __RC__) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -#if(0) -#include "GEOS_AChem_GetPointer___.h" -#endif - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, CLOCK, self, GRID, CF, i1, i2, im, j1, j2, jm, km, nymd, nhms, cdt, __RC__) - - -! Set the grid -! ------------------------------------------------- - self%grid = GRID - -! Initialize volcanic emissions timestamp -! --------------------------------------- - self%nymd_volcanic_emiss = -1 - - nullify(self%volc_lat) - nullify(self%volc_lon) - nullify(self%volc_SO2) - nullify(self%volc_elev) - nullify(self%volc_cloud) - nullify(self%volc_start) - nullify(self%volc_end) - nullify(self%volc_i) - nullify(self%volc_j) - - INIT_H2O2: if (self%aqu_phase_chem) then - ! Initialize the internal copy of H2O2 - ! ------------------------------------ - allocate(self%h2o2(i1:i2,j1:j2,km), __STAT__) - - if (using_GMI_H2O2) then - self%h2o2 = 0.0 ! initial value is not important if H2O2 is from GMI - else - call MAPL_GetPointer(import, q_H2O2, 'H2O2', __RC__) - self%h2o2 = q_H2O2 - end if - else - nullify(self%h2o2) - end if INIT_H2O2 - -! All done -! -------- - call MAPL_TimerOff(mgState, 'INITIALIZE', __RC__) - call MAPL_TimerOff(mgState, 'TOTAL', __RC__) - - RETURN_(ESMF_SUCCESS) - - end subroutine Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs AChem -! -! !INTERFACE: -! - - subroutine Run_(GC, IMPORT, EXPORT, CLOCK, rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 27Feb2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Run_') - - type(AChem_State), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state - type(ESMF_Alarm) :: run_alarm - logical :: run_alarm_ringing - - integer :: i1, i2, im ! 3D Dimensions - integer :: j1, j2, jm ! - integer :: km ! - - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name - - integer :: k, k1 - -! Input fields -! ------------ - real, pointer, dimension(:,:) :: cell_area => null() - - real, pointer, dimension(:,:,:) :: density_air => null() - real, pointer, dimension(:,:,:) :: temperature => null() - real, pointer, dimension(:,:,:) :: lwc => null() - real, pointer, dimension(:,:,:) :: fcld => null() - real, pointer, dimension(:,:,:) :: ple => null() - real, pointer, dimension(:,:,:) :: delp => null() - real, pointer, dimension(:,:,:) :: zle => null() - real, pointer, dimension(:,:) :: tropp => null() - - real, pointer, dimension(:,:) :: u10n => null() - real, pointer, dimension(:,:) :: v10n => null() - - real, pointer, dimension(:,:) :: tskin => null() - - real, pointer, dimension(:,:) :: fr_ocean => null() - - real, pointer, dimension(:,:) :: oro => null() - real, pointer, dimension(:,:) :: ustar => null() - real, pointer, dimension(:,:) :: shflux => null() - real, pointer, dimension(:,:) :: pblh => null() - real, pointer, dimension(:,:) :: z0h => null() - - real, pointer, dimension(:,:,:) :: q_OH => null() - real, pointer, dimension(:,:,:) :: q_NO3 => null() - real, pointer, dimension(:,:,:) :: q_H2O2 => null() - real, pointer, dimension(:,:,:) :: q_O3 => null() - - real, pointer, dimension(:,:,:) :: q_OH_STRATCHEM => null() - real, pointer, dimension(:,:,:) :: q_O3P_STRATCHEM => null() - real, pointer, dimension(:,:,:) :: j_ocs => null() - - real, pointer, dimension(:,:) :: DMS_ocean => null() - - real, pointer, dimension(:,:) :: SO2_emiss_bb => null() - real, pointer, dimension(:,:) :: SO2_emiss_nonenergy => null() - real, pointer, dimension(:,:) :: SO2_emiss_energy => null() - real, pointer, dimension(:,:) :: SO2_emiss_shipping => null() - real, pointer, dimension(:,:) :: SO2_emiss_aviation_lto => null() - real, pointer, dimension(:,:) :: SO2_emiss_aviation_cds => null() - real, pointer, dimension(:,:) :: SO2_emiss_aviation_crs => null() - - real, pointer, dimension(:,:) :: NH3_emiss => null() - real, pointer, dimension(:,:) :: NH3_emiss_bb => null() - - real, pointer, dimension(:,:) :: SOAG_emiss => null() - - real,pointer,dimension(:,:) :: co_biomass_voc => null() - real,pointer,dimension(:,:) :: co_bf_voc => null() - real,pointer,dimension(:,:) :: co_fs_voc => null() - -! Export fields -! ------------- - type(ESMF_State) :: internal - - real, pointer, dimension(:,:,:) :: ptr3d => null() - real, pointer, dimension(:,:) :: ptr2d => null() - - real, pointer, dimension(:,:,:) :: q_DMS => null() - real, pointer, dimension(:,:,:) :: q_MSA => null() - real, pointer, dimension(:,:,:) :: q_SO2 => null() - real, pointer, dimension(:,:,:) :: q_H2SO4 => null() - real, pointer, dimension(:,:,:) :: q_NH3 => null() - real, pointer, dimension(:,:,:) :: q_SOAG => null() - real, pointer, dimension(:,:,:) :: q_OCS => null() - real, pointer, dimension(:,:,:) :: q_VOCanth => null() - real, pointer, dimension(:,:,:) :: q_VOCbiob => null() - - real, allocatable, dimension(:,:,:) :: q_OAanth - real, allocatable, dimension(:,:,:) :: q_OAanthmmrd - real, allocatable, dimension(:,:,:) :: q_OAbiob - real, allocatable, dimension(:,:,:) :: q_OAbiobmmrd - - real, allocatable, dimension(:,:,:) :: pSO2_OCS ! production of S from OCS in the stratosphere - real, allocatable, dimension(:,:,:) :: pSO2_OCS_OH ! production of S from OCS+OH - real, allocatable, dimension(:,:,:) :: pSO2_OCS_O3p ! production of S from OCS+O3p - real, allocatable, dimension(:,:,:) :: pSO2_OCS_jOCS ! production of S from OCS photolysis - real, allocatable, dimension(:,:,:) :: lOCS ! loss OCS, 'molecules cm-3 s-1' - real, allocatable, dimension(:,:,:) :: lOCS_OH ! loss rate of OCS from OCS+OH, 'molec cm-3 s-1' - real, allocatable, dimension(:,:,:) :: lOCS_O3p ! loss rate of OCS from OCS+O3p, 'molec cm-3 s-1' - real, allocatable, dimension(:,:,:) :: lOCS_jOCS ! loss rate of OCS from photolysis, 'molec cm-3 s-1' - - real, pointer, dimension(:,:) :: dry_dep_DMS => null() ! dry deposition fluxes - real, pointer, dimension(:,:) :: dry_dep_MSA => null() - real, pointer, dimension(:,:) :: dry_dep_SO2 => null() - real, pointer, dimension(:,:) :: dry_dep_H2SO4 => null() - real, pointer, dimension(:,:) :: dry_dep_NH3 => null() - real, pointer, dimension(:,:) :: dry_dep_SOAG => null() - - real, pointer, dimension(:,:,:) :: ddt_DMS_gas => null() ! tendencies due to gas phase chemistry - real, pointer, dimension(:,:,:) :: ddt_MSA_gas => null() - real, pointer, dimension(:,:,:) :: ddt_SO2_gas => null() - real, pointer, dimension(:,:,:) :: ddt_H2SO4_gas => null() - real, pointer, dimension(:,:,:) :: ddt_NH3_gas => null() - real, pointer, dimension(:,:,:) :: ddt_SOAG_gas => null() - - real, pointer, dimension(:,:,:) :: ddt_DMS_aq => null() ! tendencies due to aqueous phase chemistry - real, pointer, dimension(:,:,:) :: ddt_MSA_aq => null() - real, pointer, dimension(:,:,:) :: ddt_SO2_aq => null() - real, pointer, dimension(:,:,:) :: ddt_H2SO4_aq => null() - real, pointer, dimension(:,:,:) :: ddt_NH3_aq => null() - real, pointer, dimension(:,:,:) :: ddt_SOAG_aq => null() - - real, pointer, dimension(:,:,:) :: DMS_g_ => null() ! tendencies due to gas phase chemistry - real, pointer, dimension(:,:,:) :: MSA_g_ => null() - real, pointer, dimension(:,:,:) :: SO2_g_ => null() - real, pointer, dimension(:,:,:) :: H2SO4_g_ => null() - real, pointer, dimension(:,:,:) :: NH3_g_ => null() - real, pointer, dimension(:,:,:) :: SOAG_g_ => null() - - real, pointer, dimension(:,:,:) :: DMS_a_ => null() ! tendencies due to aqueous phase chemistry - real, pointer, dimension(:,:,:) :: MSA_a_ => null() - real, pointer, dimension(:,:,:) :: SO2_a_ => null() - real, pointer, dimension(:,:,:) :: H2SO4_a_ => null() - real, pointer, dimension(:,:,:) :: NH3_a_ => null() - real, pointer, dimension(:,:,:) :: SOAG_a_ => null() - - - -! Dry deposition frequency -! ------------------------ - real, allocatable, dimension(:,:) :: dry_dep_frequency - real, allocatable, dimension(:,:) :: dq - - -! DMS flux -! --------- - real, allocatable, dimension(:,:) :: flux_DMS - -! Sulfur diagnostics -! ------------------ - real, allocatable, dimension(:,:) :: SO2_emiss_total - -! VOC local arrays -! ---------------- - real, allocatable, dimension(:,:,:) :: dVOC - real, allocatable, dimension(:,:,:) :: dOAanth, dOAbiob - real, allocatable, dimension(:,:,:) :: rk_OA_OH - real, allocatable, dimension(:,:,:) :: fanth - - - -! Work buffers of oxidant fields -! ------------------------------ - real, allocatable, dimension(:,:,:) :: q_OH_ - real, allocatable, dimension(:,:,:) :: q_NO3_ - - -! local -! ----- - real, parameter :: ORO_OCEAN = 0.0 - real, parameter :: ORO_LAND = 1.0 - real, parameter :: ORO_SEA_ICE = 2.0 - - integer :: doy ! day of year - real :: f_hour, x_hour ! UTC hour - - logical, parameter :: using_GMI_H2O2 = .false. ! coupling with GMI is not implemented - logical, parameter :: using_GMI_OH = .false. - logical, parameter :: using_GMI_NO3 = .false. - - integer :: n, n_steps - - real, allocatable, dimension(:,:) :: SO2_emiss_volc_expl, SO2_emiss_volc_nonexpl - - real, allocatable, dimension(:,:) :: day_time, night_time ! day time and night time durations, s - real, allocatable, dimension(:,:) :: f_day_time, f_night_time ! day time and night time factors - - real, allocatable, dimension(:,:) :: sza - real, allocatable, dimension(:,:) :: cos_sza - real, allocatable, dimension(:,:) :: sum_cos_sza - - real, allocatable, dimension(:,:) :: cmd_S ! column mass density (i.e., column integrated mass loading) of S from gas species - real, allocatable, dimension(:,:) :: cmd_DMS - real, allocatable, dimension(:,:) :: cmd_MSA - real, allocatable, dimension(:,:) :: cmd_SO2 - real, allocatable, dimension(:,:) :: cmd_H2SO4 - - - real, allocatable, dimension(:,:) :: cmd_NH3 - real, allocatable, dimension(:,:) :: cmd_N - - real, allocatable, dimension(:,:) :: cmd_SOAG - - real, allocatable, dimension(:,:,:) :: pSO4_aq ! production rates from aquesous chemistry - real, allocatable, dimension(:,:,:) :: pNH4_aq - real, allocatable, dimension(:,:,:) :: pSO4_aq_SO2 - real, allocatable, dimension(:,:,:) :: pSO4_aq_H2SO4 - real, allocatable, dimension(:,:,:) :: pNH4_aq_NH3 - - real, allocatable, dimension(:,:) :: cpl_NH3 - real, allocatable, dimension(:,:) :: cpl_DMS - real, allocatable, dimension(:,:) :: cpl_MSA - real, allocatable, dimension(:,:) :: cpl_SO2 - real, allocatable, dimension(:,:) :: cpl_H2SO4 - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -#if(0) -#include "GEOS_AChem_DeclarePointer___.h" -#endif - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -#if(0) - #include "GEOS_AChem_GetPointer___.h" -#else - -#endif - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - - call MAPL_TimerOn(mgState, 'TOTAL', __RC__) - call MAPL_TimerOn(mgState, 'RUN', __RC__) - -! Get parameters from generic state -! ---------------------------------- - call MAPL_Get(mgState, LONS=lons, LATS=lats, RunAlarm=run_alarm, __RC__) - - -! If it is time, update AChem state -! --------------------------------- - run_alarm_ringing = ESMF_AlarmIsRinging(run_alarm, __RC__) - - if (run_alarm_ringing) then - call ESMF_AlarmRingerOff(run_alarm, __RC__) - else - RETURN_(ESMF_SUCCESS) - endif - - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, CLOCK, self, GRID, CF, i1, i2, im, j1, j2, jm, km, nymd, nhms, cdt, __RC__) - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, density_air, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, temperature, 'T', __RC__) - - - if (self%mam_chem) then - call MAPL_GetPointer(import, cell_area, 'AREA', __RC__) - call MAPL_GetPointer(import, zle, 'ZLE', __RC__) - call MAPL_GetPointer(import, lwc, 'QLTOT', __RC__) - call MAPL_GetPointer(import, fcld, 'FCLD', __RC__) - - call MAPL_GetPointer(import, u10n, 'U10N', __RC__) - call MAPL_GetPointer(import, v10n, 'V10N', __RC__) - - call MAPL_GetPointer(import, tskin, 'TS', __RC__) - - call MAPL_GetPointer(import, fr_ocean, 'FROCEAN', __RC__) - - call MAPL_GetPointer(import, oro, 'LWI', __RC__) - call MAPL_GetPointer(import, shflux, 'SH', __RC__) - call MAPL_GetPointer(import, ustar, 'USTAR', __RC__) - call MAPL_GetPointer(import, z0h, 'Z0H', __RC__) - call MAPL_GetPointer(import, pblh, 'ZPBL', __RC__) - - call MAPL_GetPointer(import, q_OH, 'OH', __RC__) - call MAPL_GetPointer(import, q_NO3, 'NO3', __RC__) - call MAPL_GetPointer(import, q_H2O2, 'H2O2', __RC__) - call MAPL_GetPointer(import, q_O3, 'O3', __RC__) - - call MAPL_GetPointer(import, DMS_ocean, 'DMS_CONC_OCEAN', __RC__) - - call MAPL_GetPointer(import, SO2_emiss_bb, 'SO2_EMIS_FIRES', __RC__) - call MAPL_GetPointer(import, SO2_emiss_nonenergy, 'SO2_EMIS_NONENERGY', __RC__) - call MAPL_GetPointer(import, SO2_emiss_energy, 'SO2_EMIS_ENERGY', __RC__) - call MAPL_GetPointer(import, SO2_emiss_shipping, 'SO2_EMIS_SHIPPING', __RC__) - call MAPL_GetPointer(import, SO2_emiss_aviation_lto, 'SO2_EMIS_AIRCRAFT_LTO', __RC__) - call MAPL_GetPointer(import, SO2_emiss_aviation_cds, 'SO2_EMIS_AIRCRAFT_CDS', __RC__) - call MAPL_GetPointer(import, SO2_emiss_aviation_crs, 'SO2_EMIS_AIRCRAFT_CRS', __RC__) - - call MAPL_GetPointer(import, NH3_emiss, 'NH3_EMIS', __RC__) - call MAPL_GetPointer(import, NH3_emiss_bb, 'NH3_EMIS_FIRE', __RC__) - - call MAPL_GetPointer(import, SOAG_emiss, 'SOAG_EMIS', __RC__) - end if - - if (self%ocs_chem) then - call MAPL_GetPointer(import, tropp, 'TROPP', __RC__) - call MAPL_GetPointer(import, q_O3p_STRATCHEM, 'O3P', __RC__) - call MAPL_GetPointer(import, q_OH_STRATCHEM, 'OHSTRAT', __RC__) - call MAPL_GetPointer(import, j_ocs, 'OCS_JRATE', __RC__) - end if - - if (self%voc_chem) then - if (.not. associated(q_OH)) then - call MAPL_GetPointer(import, q_OH, 'OH', __RC__) - end if - - call MAPL_GetPointer(import, co_biomass_voc, 'CO_BIOMASS_VOC', __RC__) - call MAPL_GetPointer(import, co_bf_voc, 'CO_BF_VOC', __RC__) - call MAPL_GetPointer(import, co_fs_voc, 'CO_FS_VOC', __RC__) - end if - -! Get Exports -! ------------- - if (self%mam_chem) then - call MAPL_GetPointer(export, dry_dep_DMS, 'DRY_DEP_DMS', __RC__) - call MAPL_GetPointer(export, dry_dep_MSA, 'DRY_DEP_MSA', __RC__) - call MAPL_GetPointer(export, dry_dep_SO2, 'DRY_DEP_SO2', __RC__) - call MAPL_GetPointer(export, dry_dep_H2SO4, 'DRY_DEP_H2SO4', __RC__) - call MAPL_GetPointer(export, dry_dep_NH3, 'DRY_DEP_NH3', __RC__) - call MAPL_GetPointer(export, dry_dep_SOAG, 'DRY_DEP_SOAG', __RC__) - - call MAPL_GetPointer(export, ddt_DMS_gas, 'DDT_DMS_gas', __RC__) - call MAPL_GetPointer(export, ddt_MSA_gas, 'DDT_MSA_gas', __RC__) - call MAPL_GetPointer(export, ddt_SO2_gas, 'DDT_SO2_gas', __RC__) - call MAPL_GetPointer(export, ddt_H2SO4_gas, 'DDT_H2SO4_gas', __RC__) - call MAPL_GetPointer(export, ddt_NH3_gas, 'DDT_NH3_gas', __RC__) - call MAPL_GetPointer(export, ddt_SOAG_gas, 'DDT_SOAG_gas', __RC__) - - call MAPL_GetPointer(export, ddt_DMS_aq, 'DDT_DMS_aq', __RC__) - call MAPL_GetPointer(export, ddt_MSA_aq, 'DDT_MSA_aq', __RC__) - call MAPL_GetPointer(export, ddt_SO2_aq, 'DDT_SO2_aq', __RC__) - call MAPL_GetPointer(export, ddt_H2SO4_aq, 'DDT_H2SO4_aq', __RC__) - call MAPL_GetPointer(export, ddt_NH3_aq, 'DDT_NH3_aq', __RC__) - call MAPL_GetPointer(export, ddt_SOAG_aq, 'DDT_SOAG_aq', __RC__) - - call MAPL_GetPointer(export, DMS_g_, '_DMS_gas', __RC__) - call MAPL_GetPointer(export, MSA_g_, '_MSA_gas', __RC__) - call MAPL_GetPointer(export, SO2_g_, '_SO2_gas', __RC__) - call MAPL_GetPointer(export, H2SO4_g_, '_H2SO4_gas', __RC__) - call MAPL_GetPointer(export, NH3_g_, '_NH3_gas', __RC__) - call MAPL_GetPointer(export, SOAG_g_, '_SOAG_gas', __RC__) - - call MAPL_GetPointer(export, DMS_a_, '_DMS_aq', __RC__) - call MAPL_GetPointer(export, MSA_a_, '_MSA_aq', __RC__) - call MAPL_GetPointer(export, SO2_a_, '_SO2_aq', __RC__) - call MAPL_GetPointer(export, H2SO4_a_, '_H2SO4_aq', __RC__) - call MAPL_GetPointer(export, NH3_a_, '_NH3_aq', __RC__) - call MAPL_GetPointer(export, SOAG_a_, '_SOAG_aq', __RC__) - end if - -! Get Internals -! ------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - call MAPL_Get(mgState, INTERNAL_ESMF_STATE=internal, __RC__) - - if (self%mam_chem) then - call MAPL_GetPointer(internal, q_DMS, trim(comp_name)//'::'//'DMS', __RC__) - call MAPL_GetPointer(internal, q_MSA, trim(comp_name)//'::'//'MSA', __RC__) - call MAPL_GetPointer(internal, q_SO2, trim(comp_name)//'::'//'SO2', __RC__) - call MAPL_GetPointer(internal, q_H2SO4, trim(comp_name)//'::'//'H2SO4', __RC__) - call MAPL_GetPointer(internal, q_NH3, trim(comp_name)//'::'//'NH3', __RC__) - call MAPL_GetPointer(internal, q_SOAG, trim(comp_name)//'::'//'SOAG', __RC__) - end if - - if (self%ocs_chem) then - call MAPL_GetPointer(internal, q_OCS, trim(comp_name)//'::'//'OCS', __RC__) - end if - - if (self%voc_chem) then - call MAPL_GetPointer(internal, q_VOCanth, trim(comp_name)//'::'//'VOC', __RC__) - call MAPL_GetPointer(internal, q_VOCbiob, trim(comp_name)//'::'//'VOCbiob', __RC__) - end if - - - call MAPL_TimerOn(mgState, '-EMISSIONS', __RC__) - - UPDATE_VOLCANIC_EMISSIONS: if (self%mam_chem) then -! Update volcanic emissions if necessary (daily) -! ---------------------------------------------- - if(self%nymd_volcanic_emiss .ne. nymd) then - self%nymd_volcanic_emiss = nymd - - call GetVolcDailyTables(self%nymd_volcanic_emiss, & - trim(self%volcanic_emiss_file), & - self%n_volcanoes, & - self%volc_lat, & - self%volc_lon, & - self%volc_elev, & - self%volc_cloud, & - self%volc_SO2, & - self%volc_start, & - self%volc_end, & - __RC__) - - if (self%n_volcanoes > 0) then - if (associated(self%volc_i)) deallocate(self%volc_i, __STAT__) - allocate(self%volc_i(self%n_volcanoes), __STAT__) - - if (associated(self%volc_j)) deallocate(self%volc_j, __STAT__) - allocate(self%volc_j(self%n_volcanoes), __STAT__) - - ! get indices for volcanic emissions - call MAPL_GetHorzIJIndex(self%n_volcanoes, & - self%volc_i, self%volc_j, & - grid = self%grid, & - lon = self%volc_lon * (MAPL_PI/180.0), & - lat = self%volc_lat * (MAPL_PI/180.0), & - __RC__) - end if - end if - end if UPDATE_VOLCANIC_EMISSIONS - - -! Impose diurnal cycle to the offline OH and NO3 monthly mean fields -! ------------------------------------------------------------------ - if (self%gas_phase_chem .or. self%voc_chem) then - allocate(q_OH_(i1:i2,j1:j2,km), __STAT__) - q_OH_ = q_OH - end if - - if (self%gas_phase_chem) then - allocate(q_NO3_(i1:i2,j1:j2,km), __STAT__) - q_NO3_ = q_NO3 - end if - - if (self%apply_diurnal_cycle .and. (self%mam_chem .or. self%voc_chem)) then - ! find cos(SZA) - doy = day_of_year(nymd) - f_hour = ( real(nhms / 10000) * 3600 + & - real(mod(nhms, 10000) / 100) * 60 + & - real(mod(nhms, 100)) ) / 3600 - - - ! want to find the sum of the cos(sza) for use in scaling OH diurnal variation - allocate(sza(i1:i2,j1:j2), __STAT__) - allocate(cos_sza(i1:i2,j1:j2), __STAT__) - allocate(sum_cos_sza(i1:i2,j1:j2), __STAT__) - allocate(day_time(i1:i2,j1:j2), __STAT__) - allocate(night_time(i1:i2,j1:j2), __STAT__) - allocate(f_day_time(i1:i2,j1:j2), __STAT__) - allocate(f_night_time(i1:i2,j1:j2), __STAT__) - - - x_hour = f_hour - n_steps = 86400.0 / cdt - sum_cos_sza(:,:) = 0.0 - day_time(:,:) = 0.0 - do n = 1, n_steps - call solar_zenith_angle(doy, x_hour, (180.0/pi)*lons, (180.0/pi)*lats, sza, cos_sza) - - sum_cos_sza = sum_cos_sza + cos_sza - - x_hour = x_hour + cdt/3600.0 - if (x_hour > 24) x_hour = x_hour - 24 - - ! find the daylight portion of the day - where (cos_sza > 0.0) - day_time = day_time + cdt - end where - end do - - night_time = 86400.0 - day_time - - call solar_zenith_angle(doy, f_hour, (180.0/pi)*lons, (180.0/pi)*lats, sza, cos_sza) - - where(sum_cos_sza > 0) - f_day_time = (86400.0/cdt)*cos_sza / sum_cos_sza - elsewhere - f_day_time = 0.0 - end where - - - ! scale OH - do k = 1, km - q_OH_(:,:,k) = q_OH_(:,:,k) * f_day_time(:,:) - end do - - where(q_OH_ < 0.0) q_OH_ = 0.0 - - - ! set NO3 to 0 in sun lighten grid cells - average is - ! distributed only over the night time portion - where (cos_sza > 0 .or. night_time < tiny(0.0)) - f_night_time = 0.0 - elsewhere - f_night_time = 86400.0 / night_time - end where - - if (self%gas_phase_chem) then - do k = 1, km - q_NO3_(:,:,k) = q_NO3_(:,:,k) * f_night_time(:,:) - end do - - where(q_NO3_ < 0.0) q_NO3_ = 0.0 - end if - - deallocate(sza, __STAT__) - deallocate(cos_sza, __STAT__) - deallocate(sum_cos_sza, __STAT__) - deallocate(day_time, __STAT__) - deallocate(night_time, __STAT__) - deallocate(f_day_time, __STAT__) - deallocate(f_night_time, __STAT__) - end if ! diurnal cycle of oxidants - - if (self%mam_chem .or. self%voc_chem) then - call MAPL_GetPointer(export, ptr3d, 'OH', __RC__) - if (associated(ptr3d)) then - ptr3d = q_OH_ - end if - end if - - if (self%mam_chem) then - call MAPL_GetPointer(export, ptr3d, 'NO3', __RC__) - if (associated(ptr3d)) then - ptr3d = q_NO3_ - end if - end if - - -! If the H2O2 is from climatology, replenish it every 3 hours -! ----------------------------------------------------------- - if (.not. using_GMI_H2O2 .and. self%aqu_phase_chem) then - if (mod(nhms/10000, 3) == 0 .and. (nhms/10000*100 == nhms/100)) then - self%h2o2 = q_H2O2 - end if - end if - - - UPDATE_CHEM_EMISSIONS: if (self%mam_chem) then -! -! Ammonia emissions -! ----------------- - call NH3_emissions(delp, & - NH3_emiss, & - NH3_emiss_bb, & - q_NH3, & - cdt, & - rc) - - -! Sulfur emissions -! ---------------- - allocate(flux_DMS(i1:i2,j1:j2), __STAT__) - - call DMS_emissions(delp, & - tskin, & - u10n, & - v10n, & - fr_ocean, & - DMS_ocean, & - q_DMS, & - flux_DMS, & - cdt, & - rc) - - call MAPL_GetPointer(export, ptr2d, 'EMIS_DMS', __RC__) - if (associated(ptr2d)) then - ! convert from 'mol-DMS m-2 s-1' to 'kg-DMS m-2 s-1' - ptr2d = mw_DMS * flux_DMS - end if - - call MAPL_GetPointer(export, ptr2d, 'EMIS_S_DMS', __RC__) - if (associated(ptr2d)) then - ! convert from 'mol-DMS m-2 s-1' to 'kg-S m-2 s-1' - ptr2d = mw_S * flux_DMS - end if - - deallocate(flux_DMS) - - - allocate(SO2_emiss_total(i1:i2,j1:j2), __STAT__) - allocate(SO2_emiss_volc_expl(i1:i2,j1:j2), __STAT__) - allocate(SO2_emiss_volc_nonexpl(i1:i2,j1:j2), __STAT__) - - SO2_emiss_total = 0.0 - SO2_emiss_volc_expl = 0.0 - SO2_emiss_volc_nonexpl = 0.0 - - ! 3D aircraft emissions - ! TODO: move vertical distribution of 2D-layered emissions here - ! calc_aviation_emissions(...) - - ! 3D volcanic emissions - ! TODO: move calculation of area mean 3D volcanic emissions here - ! calc_volcanic_emissions(...) - - call SO2_emissions(delp, & - zle, & - density_air, & - SO2_emiss_bb, & - SO2_emiss_nonenergy, & - SO2_emiss_energy, & - SO2_emiss_shipping, & - SO2_emiss_aviation_lto, & - SO2_emiss_aviation_cds, & - SO2_emiss_aviation_crs, & - self%aviation_layers, & - self%n_volcanoes, & - self%volc_elev, & - self%volc_cloud, & - self%volc_SO2, & - self%volc_start, self%volc_end, & - self%volc_i, self%volc_j, & - SO2_emiss_volc_expl, & - SO2_emiss_volc_nonexpl, & - SO2_emiss_total, & - q_SO2, & - cell_area, & - cdt, & - nymd, & - nhms, & - rc) - - - call MAPL_GetPointer(export, ptr2d, 'EMIS_SO2', __RC__) - if (associated(ptr2d)) then - ptr2d = SO2_emiss_total - end if - - call MAPL_GetPointer(export, ptr2d, 'EMIS_S_SO2', __RC__) - if (associated(ptr2d)) then - ptr2d = (mw_S/mw_SO2) * SO2_emiss_total - end if - - call MAPL_GetPointer(export, ptr2d, 'EMIS_SO2_EXV', __RC__) - if (associated(ptr2d)) then - ptr2d = SO2_emiss_volc_expl - end if - - call MAPL_GetPointer(export, ptr2d, 'EMIS_SO2_NXV', __RC__) - if (associated(ptr2d)) then - ptr2d = SO2_emiss_volc_nonexpl - end if - - call MAPL_GetPointer(export, ptr2d, 'EMIS_SO2_VOLC', __RC__) - if (associated(ptr2d)) then - ptr2d = SO2_emiss_volc_expl + SO2_emiss_volc_nonexpl - end if - - - deallocate(SO2_emiss_total, __STAT__) - deallocate(SO2_emiss_volc_expl, __STAT__) - deallocate(SO2_emiss_volc_nonexpl, __STAT__) - - -! -! SOAG emissions -! -------------- - call SOAG_emissions(delp, & - SOAG_emiss, & - q_SOAG, & - cdt, & - rc) - - end if UPDATE_CHEM_EMISSIONS - - - UPDATE_VOC_EMISSIONS: if (self%voc_chem) then - - call VOC_Emissions(delp, & - self%voc_BiomassBurnFactor, & - self%voc_AnthroFactor, & - co_biomass_voc, & - co_bf_voc, & - co_fs_voc, & - self%voc_MW, & - q_VOCanth, q_VOCbiob, & - cdt, & - rc) - - end if UPDATE_VOC_EMISSIONS - - - call MAPL_TimerOff(mgState, '-EMISSIONS', __RC__) - - -! Dry deposition -! -------------- - UPDATE_CHEM_DRY_DEP: if (self%mam_chem) then - - allocate(dry_dep_frequency(i1:i2,j1:j2), __STAT__) - allocate(dq(i1:i2,j1:j2), __STAT__) - - call DryDepositionGOCART(i1, i2, j1, j2, km, & - temperature, density_air, zle, oro, ustar, & - pblh, shflux, z0h, dry_dep_frequency, rc) - - ! DMS - no dry dep - if (associated(dry_dep_DMS)) & - dry_dep_DMS = 0.0 - - ! MSA - dq = -q_MSA(i1:i2,j1:j2,km) * (1.0 - exp(-dry_dep_frequency * cdt)) - - q_MSA(i1:i2,j1:j2,km) = q_MSA(i1:i2,j1:j2,km) + dq - - if (associated(dry_dep_MSA)) & - dry_dep_MSA = -dq / mw_air / cdt - - ! SO2 - where (abs(oro - ORO_OCEAN) < 0.5) ! oro has descrete values 0, 1 or 2 - dq = -q_SO2(i1:i2,j1:j2,km) * (1.0 - exp(-(10.0 * dry_dep_frequency) * cdt)) - elsewhere - dq = -q_SO2(i1:i2,j1:j2,km) * (1.0 - exp(-( 3.0 * dry_dep_frequency) * cdt)) - end where - - q_SO2(i1:i2,j1:j2,km) = q_SO2(i1:i2,j1:j2,km) + dq - - if (associated(dry_dep_SO2)) & - dry_dep_SO2 = -dq / mw_air / cdt - - ! H2SO4 - where (abs(oro - ORO_OCEAN) < 0.5) ! oro has descrete values 0, 1 or 2 - dq = -q_H2SO4(i1:i2,j1:j2,km) * (1.0 - exp(-(10.0 * dry_dep_frequency) * cdt)) - elsewhere - dq = -q_H2SO4(i1:i2,j1:j2,km) * (1.0 - exp(-( 3.0 * dry_dep_frequency) * cdt)) - end where - - q_H2SO4(i1:i2,j1:j2,km) = q_H2SO4(i1:i2,j1:j2,km) + dq - - if (associated(dry_dep_H2SO4)) & - dry_dep_H2SO4 = -dq / mw_air / cdt - - ! NH3 - dq = -q_NH3(i1:i2,j1:j2,km) * (1.0 - exp(-dry_dep_frequency * cdt)) - - q_NH3(i1:i2,j1:j2,km) = q_NH3(i1:i2,j1:j2,km) + dq - - if (associated(dry_dep_NH3)) & - dry_dep_NH3 = -dq / mw_air / cdt - - ! lumped precursor VOC (SOA gas) - dq = -q_SOAG(i1:i2,j1:j2,km) * (1.0 - exp(-dry_dep_frequency * cdt)) - - q_SOAG(i1:i2,j1:j2,km) = q_SOAG(i1:i2,j1:j2,km) + dq - - if (associated(dry_dep_SOAG)) & - dry_dep_SOAG = -dq / mw_air / cdt - - deallocate(dry_dep_frequency, __STAT__) - deallocate(dq, __STAT__) - - end if UPDATE_CHEM_DRY_DEP - - -! Ensure positive values only -! --------------------------- - if (self%mam_chem) then - where (q_NH3 < tiny(0.0)) q_NH3 = tiny(0.0) - where (q_DMS < tiny(0.0)) q_DMS = tiny(0.0) - where (q_MSA < tiny(0.0)) q_MSA = tiny(0.0) - where (q_SO2 < tiny(0.0)) q_SO2 = tiny(0.0) - where (q_H2SO4 < tiny(0.0)) q_H2SO4 = tiny(0.0) - where (q_NO3_ < tiny(0.0)) q_NO3_ = tiny(0.0) - end if - - if (self%mam_chem .or. self%voc_chem) then - where (q_OH_ < tiny(0.0)) q_OH_ = tiny(0.0) - end if - - - call MAPL_TimerOn(mgState, '-CHEMISTRY', __RC__) - -! Gas-phase chemistry -! ------------------- - call MAPL_TimerOn(mgState, '--CHEMISTRY_GAS', __RC__) - - UPDATE_CHEM_GAS_PHASE: if (self%mam_chem) then - - if (associated(DMS_g_)) DMS_g_ = q_DMS - if (associated(MSA_g_)) MSA_g_ = q_MSA - if (associated(SO2_g_)) SO2_g_ = q_SO2 - if (associated(H2SO4_g_)) H2SO4_g_ = q_H2SO4 - if (associated(NH3_g_)) NH3_g_ = q_NH3 - if (associated(SOAG_g_)) SOAG_g_ = q_SOAG - - allocate(cpl_NH3(i1:i2,j1:j2), __STAT__) - allocate(cpl_DMS(i1:i2,j1:j2), __STAT__) - allocate(cpl_MSA(i1:i2,j1:j2), __STAT__) - allocate(cpl_SO2(i1:i2,j1:j2), __STAT__) - allocate(cpl_H2SO4(i1:i2,j1:j2), __STAT__) - - cpl_NH3 = 0.0 - cpl_DMS = 0.0 - cpl_MSA = 0.0 - cpl_SO2 = 0.0 - cpl_H2SO4 = 0.0 - - if (self%gas_phase_chem) then - ! tendencies due to gas phase chemistry - if (associated(ddt_DMS_gas)) ddt_DMS_gas = q_DMS - if (associated(ddt_MSA_gas)) ddt_MSA_gas = q_MSA - if (associated(ddt_SO2_gas)) ddt_SO2_gas = q_SO2 - if (associated(ddt_H2SO4_gas)) ddt_H2SO4_gas = q_H2SO4 - if (associated(ddt_NH3_gas)) ddt_NH3_gas = q_NH3 - if (associated(ddt_SOAG_gas)) ddt_SOAG_gas = q_SOAG - - call gas_chemistry(ple, & - temperature, & - density_air, & - q_NH3, & - q_DMS, & - q_MSA, & - q_SO2, & - q_H2SO4, & - q_OH_, & - q_NO3_, & - cpl_NH3, & - cpl_DMS, & - cpl_MSA, & - cpl_SO2, & - cpl_H2SO4, & - cdt, & - rc) - - ! tendencies due to gas phase chemistry - if (associated(ddt_DMS_gas)) ddt_DMS_gas = (q_DMS - ddt_DMS_gas) / cdt - if (associated(ddt_MSA_gas)) ddt_MSA_gas = (q_MSA - ddt_MSA_gas) / cdt - if (associated(ddt_SO2_gas)) ddt_SO2_gas = (q_SO2 - ddt_SO2_gas) / cdt - if (associated(ddt_H2SO4_gas)) ddt_H2SO4_gas = (q_H2SO4 - ddt_H2SO4_gas) / cdt - if (associated(ddt_NH3_gas)) ddt_NH3_gas = (q_NH3 - ddt_NH3_gas) / cdt - if (associated(ddt_SOAG_gas)) ddt_SOAG_gas = (q_SOAG - ddt_SOAG_gas) / cdt - else - ! set to zero the tendencies due to gas phase chemistry - if (associated(ddt_DMS_gas)) ddt_DMS_gas = 0.0 - if (associated(ddt_MSA_gas)) ddt_MSA_gas = 0.0 - if (associated(ddt_SO2_gas)) ddt_SO2_gas = 0.0 - if (associated(ddt_H2SO4_gas)) ddt_H2SO4_gas = 0.0 - if (associated(ddt_NH3_gas)) ddt_NH3_gas = 0.0 - if (associated(ddt_SOAG_gas)) ddt_SOAG_gas = 0.0 - end if - - ! column integrated P+L tendencies due to gas phase chemistry - call MAPL_GetPointer(export, ptr2d, 'CPL_DMS_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_DMS * mw_DMS ! 'kg-DMS m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_MSA_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_MSA * mw_MSA ! 'kg-MSA m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_SO2_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_SO2 * mw_SO2 ! 'kg-SO2 m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_H2SO4_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_H2SO4 * mw_H2SO4 ! 'kg-H2SO4 m-2 s-1' - end if - - ! column integrated P+L tendencies due to gas phase chemistry - call MAPL_GetPointer(export, ptr2d, 'CPL_S_DMS_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_DMS * mw_S ! 'kg-S m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_S_MSA_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_MSA * mw_S ! 'kg-S m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_S_SO2_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_SO2 * mw_S ! 'kg-S m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_S_H2SO4_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_H2SO4 * mw_S ! 'kg-S m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_S_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = (cpl_DMS + cpl_MSA + cpl_SO2 + cpl_H2SO4) * mw_S ! 'kg-S m-2 s-1' - end if - - - call MAPL_GetPointer(export, ptr2d, 'CPL_NH3_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_NH3 * mw_NH3 ! 'kg-NH3 m-2 s-1' - end if - - ! column integrated P+L tendencies due to gas phase chemistry - call MAPL_GetPointer(export, ptr2d, 'CPL_N_NH3_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = cpl_NH3 * mw_N ! 'kg-N m-2 s-1' - end if - - call MAPL_GetPointer(export, ptr2d, 'CPL_N_gas', __RC__) - if (associated(ptr2d)) then - ptr2d = (cpl_NH3) * mw_N ! 'kg-N m-2 s-1' - end if - - deallocate(cpl_NH3, __STAT__) - deallocate(cpl_DMS, __STAT__) - deallocate(cpl_MSA, __STAT__) - deallocate(cpl_SO2, __STAT__) - deallocate(cpl_H2SO4, __STAT__) - - end if UPDATE_CHEM_GAS_PHASE - - call MAPL_TimerOff(mgState, '--CHEMISTRY_GAS', __RC__) - - -! Aqueous-phase chemistry -! ----------------------- - call MAPL_TimerOn(mgState, '--CHEMISTRY_AQUEOUS', __RC__) - - UPDATE_CHEM_AQU_PHASE: if (self%mam_chem) then - - allocate(pSO4_aq(i1:i2,j1:j2,km), __STAT__) - allocate(pNH4_aq(i1:i2,j1:j2,km), __STAT__) - allocate(pSO4_aq_SO2(i1:i2,j1:j2,km), __STAT__) - allocate(pSO4_aq_H2SO4(i1:i2,j1:j2,km), __STAT__) - allocate(pNH4_aq_NH3(i1:i2,j1:j2,km), __STAT__) - - pSO4_aq = 0.0 - pNH4_aq = 0.0 - pSO4_aq_SO2 = 0.0 - pSO4_aq_H2SO4 = 0.0 - pNH4_aq_NH3 = 0.0 - - if (associated(DMS_a_)) DMS_a_ = q_DMS - if (associated(MSA_a_)) MSA_a_ = q_MSA - if (associated(SO2_a_)) SO2_a_ = q_SO2 - if (associated(H2SO4_a_)) H2SO4_a_ = q_H2SO4 - if (associated(NH3_a_)) NH3_a_ = q_NH3 - if (associated(SOAG_a_)) SOAG_a_ = q_SOAG - - if (self%aqu_phase_chem) then - ! tendencies due to aqueous chemistry - if (associated(ddt_DMS_aq)) ddt_DMS_aq = q_DMS - if (associated(ddt_MSA_aq)) ddt_MSA_aq = q_MSA - if (associated(ddt_SO2_aq)) ddt_SO2_aq = q_SO2 - if (associated(ddt_H2SO4_aq)) ddt_H2SO4_aq = q_H2SO4 - if (associated(ddt_NH3_aq)) ddt_NH3_aq = q_NH3 - if (associated(ddt_SOAG_aq)) ddt_SOAG_aq = q_SOAG - - call aqu_chemistry_fast(ple, & - temperature, & - density_air, & - lwc, & - 0.5e-7, & - fcld, & - q_NH3, & - q_SO2, & - q_H2SO4, & - self%h2o2, & - pSO4_aq, & - pNH4_aq, & - pSO4_aq_SO2, & - pSO4_aq_H2SO4, & - pNH4_aq_NH3, & - cdt, & - rc) - - ! tendencies due to aqueous chemistry - if (associated(ddt_DMS_aq)) ddt_DMS_aq = (q_DMS - ddt_DMS_aq) / cdt - if (associated(ddt_MSA_aq)) ddt_MSA_aq = (q_MSA - ddt_MSA_aq) / cdt - if (associated(ddt_SO2_aq)) ddt_SO2_aq = (q_SO2 - ddt_SO2_aq) / cdt - if (associated(ddt_H2SO4_aq)) ddt_H2SO4_aq = (q_H2SO4 - ddt_H2SO4_aq) / cdt - if (associated(ddt_NH3_aq)) ddt_NH3_aq = (q_NH3 - ddt_NH3_aq) / cdt - if (associated(ddt_SOAG_aq)) ddt_SOAG_aq = (q_SOAG - ddt_SOAG_aq) / cdt - else - ! set to zero the tendencies due to aqueous chemistry - if (associated(ddt_DMS_aq)) ddt_DMS_aq = 0.0 - if (associated(ddt_MSA_aq)) ddt_MSA_aq = 0.0 - if (associated(ddt_SO2_aq)) ddt_SO2_aq = 0.0 - if (associated(ddt_H2SO4_aq)) ddt_H2SO4_aq = 0.0 - if (associated(ddt_NH3_aq)) ddt_NH3_aq = 0.0 - if (associated(ddt_SOAG_aq)) ddt_SOAG_aq = 0.0 - end if - - - ! total production in aqueous phase - call MAPL_GetPointer(export, ptr3d, 'pSO4_aq', __RC__) - if (associated(ptr3d)) ptr3d = pSO4_aq - - call MAPL_GetPointer(export, ptr3d, 'pNH4_aq', __RC__) - if (associated(ptr3d)) ptr3d = pNH4_aq - - ! contributions of production pathways in aqueous phase - call MAPL_GetPointer(export, ptr3d, 'pSO4_aq_SO2', __RC__) - if (associated(ptr3d)) ptr3d = pSO4_aq_SO2 - - call MAPL_GetPointer(export, ptr3d, 'pSO4_aq_H2SO4', __RC__) - if (associated(ptr3d)) ptr3d = pSO4_aq_H2SO4 - - call MAPL_GetPointer(export, ptr3d, 'pNH4_aq_NH3', __RC__) - if (associated(ptr3d)) ptr3d = pNH4_aq_NH3 - - deallocate(pSO4_aq, __STAT__) - deallocate(pNH4_aq, __STAT__) - deallocate(pSO4_aq_SO2, __STAT__) - deallocate(pSO4_aq_H2SO4, __STAT__) - deallocate(pNH4_aq_NH3, __STAT__) - - -!! call aqu_chemistry(ple, & -!! temperature, & -!! density_air, & -!! lwc, & -!! fcld, & -!! q_NH3, & -!! q_SO2, & -!! q_SO4_aq, & -!! q_NH4_aq, & -!! q_H2O2, & -!! q_O3, & -!! cdt, & -!! self%aqu_solver_max_dt, & -!! 0.5e-7, & -!! rc) - - end if UPDATE_CHEM_AQU_PHASE - - call MAPL_TimerOff(mgState, '--CHEMISTRY_AQUEOUS', __RC__) - - - call MAPL_TimerOn(mgState, '--CHEMISTRY_VOC', __RC__) - - ! If doing VOC chemistry by OH to create OA - ! ----------------------------------------- - ! Note that we do not update the OH concentration - ! Could (should?) integrate this with gas_chemistry below - ! Right now the VOC calculation is optional, specified in - ! in GEOS_AchemGridComp.rc, but the export is coupled to - ! GOCART if both GOCART and ACHEM are running, so fill - ! in with zero in case it is requested. - - OPTIONAL_VOC_CHEMISTRY: if (self%voc_chem) then - - allocate(q_OAanth(i1:i2,j1:j2,1:km), & - q_OAbiob(i1:i2,j1:j2,1:km), & - q_OAanthmmrd(i1:i2,j1:j2,1:km), & - q_OAbiobmmrd(i1:i2,j1:j2,1:km), __STAT__) - - allocate(dVOC(i1:i2,j1:j2,1:km), & - dOAanth(i1:i2,j1:j2,1:km), & - dOAbiob(i1:i2,j1:j2,1:km), & - fanth(i1:i2,j1:j2,1:km), & - rk_OA_OH(i1:i2,j1:j2,1:km),__STAT__) - - q_OAanth = 0.0 - q_OAanthmmrd = 0.0 - q_OAbiob = 0.0 - q_OAbiobmmrd = 0.0 - - where (q_VOCanth < tiny(0.0)) q_VOCanth = tiny(0.0) - where (q_VOCbiob < tiny(0.0)) q_VOCbiob = tiny(0.0) - - ! rate coefficient from Kim et al 2015 - rk_OA_OH = 1.25d-11*N_avog*q_OH_*density_air/mw_air*(1.0e-6)*cdt - dVOC = (q_VOCanth + q_VOCbiob)*(1.0-exp(-rk_OA_OH)) ! Loss of VOC (mol/mol air) - dOAanth = 0.0 - dOAbiob = 0.0 - - where (dVOC > 1.e-32) - fanth = q_VOCanth / (q_VOCanth + q_VOCbiob) ! Anthropogenic fraction of total VOC - dOAanth = dVOC *fanth ! Production of OA (mol/mol air) - q_VOCanth = q_VOCanth - dVOC * fanth ! Update VOC (mol/mol air) - dOAbiob = dVOC * (1.0 -fanth) ! Production of OA (mol/mol air) - q_VOCbiob = q_VOCbiob- dVOC * (1.0 -fanth) ! Update VOC (mol/mol air) - endwhere - - where (q_VOCanth wrap%ptr - -! Get the configuration -! --------------------- - call ESMF_GridCompGet(GC, config=CF, __RC__) - -! Get time step -! ------------- - call MAPL_Get(mgState, RunAlarm=run_alarm, __RC__) - call ESMF_AlarmGet(run_alarm, ringInterval=ring_interval, __RC__) - - call ESMF_TimeIntervalGet(ring_interval, s_r8=time_step, __RC__) - cdt = real(time_step) - -! Extract time as simple integers from clock -! ------------------------------------------ - call ESMF_ClockGet(CLOCK, currTime=time, __RC__) - call ESMF_TimeGet(TIME, yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc, __RC__) - - call MAPL_PackTime(nymd, iyr, imm, idd) - call MAPL_PackTime(nhms, ihr, imn, isc) - -! Extract the ESMF Grid -! --------------------- - call ESMF_GridCompGet(GC, grid=GRID, __RC__) - -! Local dimensions -! ---------------- - call MAPL_GridGet ( grid, globalCellCountPerDim=DIMS, __RC__) - - im = dims(1) - jm = dims(2) - lm = dims(3) - - call ESMF_GridGet(GRID, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - computationalCount=dims, __RC__) - i1 = 1 - j1 = 1 - i2 = dims(1) - j2 = dims(2) - km = dims(3) - - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - - -!------------------------------------------------------------------------- -! NASA/GSFC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: GetVolcDailyTables - Get pointwise SO2 and altitude of volcanoes -! from a daily file database - -! -! !INTERFACE: -! - - subroutine GetVolcDailyTables(nymd, volc_emiss_file, & - nVolcPts, & - vLat, vLon, & - vElev, & - vCloud, & - vSO2, & - vStart, vEnd, & - rc) - -! !USES: - - implicit none - - -! Data for volcanic emissions comes from the daily inventory of all -! volcanos (as represented by the text tables). We return all the -! volcanic emissions (as points, per volcano). - - integer, intent(in) :: nymd - character(len=*), intent(in) :: volc_emiss_file - integer, intent(out) :: nVolcPts - real, pointer, dimension(:) :: vLat, vLon, vElev, vCloud, vSO2 - integer, pointer, dimension(:) :: vStart, vEnd - - integer, intent(out) :: rc - - ! local - integer :: i, j - integer :: nLines, nCols - integer :: nymd_volc, nhms_volc - character(len=1024) :: fname - type(ESMF_Config) :: cf - real, pointer, dimension(:) :: vData - - __Iam__('GetVolcDailyTables') - - STATUS = ESMF_SUCCESS - -! If previous instance of volcano point data tables exist, deallocate it -! to get the correct number of elements - if (associated(vLat)) deallocate(vLat, __STAT__) - if (associated(vLon)) deallocate(vLon, __STAT__) - if (associated(vSO2)) deallocate(vSO2, __STAT__) - if (associated(vElev)) deallocate(vElev, __STAT__) - if (associated(vCloud)) deallocate(vCloud, __STAT__) - if (associated(vStart)) deallocate(vStart, __STAT__) - if (associated(vEnd)) deallocate(vEnd, __STAT__) - - nVolcPts = 0 - -! Daily files (e.g., from AEROCOM) -! -------------------------------- -! Note: Volcanic emissions in these files are in mass of sulfur -! Returned volcanic emissions (vSO2) are in mass of sulfur dioxide - - nymd_volc = nymd - nhms_volc = 120000 - - call StrTemplate(fname, trim(volc_emiss_file), xid='unknown', nymd=nymd_volc, nhms=nhms_volc) - - cf = ESMF_ConfigCreate() - call ESMF_ConfigLoadFile(cf, fileName=trim(fname), __RC__) - call ESMF_ConfigGetDim(cf, nLines, nCols, LABEL='volcano::', __RC__) - - nVolcPts = nLines - - PARSE_DATA: if (nVolcPts > 0) then - call ESMF_ConfigFindLabel(cf, 'volcano::', __RC__) - - allocate(vData(nCols), __STAT__) - - allocate(vLat(nLines), __STAT__) - allocate(vLon(nLines), __STAT__) - allocate(vSO2(nLines), __STAT__) - allocate(vElev(nLines), __STAT__) - allocate(vStart(nLines), __STAT__) - allocate(vEnd(nLines), __STAT__) - allocate(vCloud(nLines), __STAT__) - - vStart = -1 - vEnd = -1 - - do i = 1, nLines - call ESMF_ConfigNextLine(cf, __RC__) - - do j = 1, nCols - call ESMF_ConfigGetAttribute(cf, vData(j), default=-1.0, __RC__) - end do - - vLat(i) = vData(1) - vLon(i) = vData(2) - vSO2(i) = vData(3) * mw_SO2 / mw_S - vElev(i) = vData(4) - vCloud(i) = vData(5) - - if(nCols >= 6) vStart(i) = vData(6) - if(nCols >= 7) vEnd(i) = vData(7) - end do - - where(vStart < 0) vStart = 000000 - where(vEnd < 0) vEnd = 240000 - end if PARSE_DATA - - call ESMF_ConfigDestroy(cf, __RC__) - - deallocate(vData, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine GetVolcDailyTables - - - subroutine gas_chemistry(delp, & - temperature, & - density_air, & - q_NH3, & - q_DMS, & - q_MSA, & - q_SO2, & - q_H2SO4, & - q_OH, & - q_NO3, & - cpl_NH3, & - cpl_DMS, & - cpl_MSA, & - cpl_SO2, & - cpl_H2SO4, & - dt, & - rc) - -! !USES: - - use kpp_achem_gas_Precision, only: kpp_r8 => dp - - use kpp_achem_gas_Global, only: kpp_uf_conc => CFACTOR, & - kpp_conc => C, & - kpp_reaction_rate => RCONST, & - kpp_sun => SUN, & - kpp_temperature => TEMP, & - kpp_conc_air => c_air, & - kpp_conc_O2 => c_O2, & - kpp_time => TIME, & - kpp_time_start => TSTART, & - kpp_time_end => TEND, & - kpp_dt => DT, & - kpp_step_min => STEPMIN, & - kpp_step_max => STEPMAX, & - kpp_rtol => RTOL, & - kpp_atol => ATOL - - use kpp_achem_gas_Parameters, only: kpp_iNH3 => ind_NH3, & - kpp_iDMS => ind_DMS, & - kpp_iSO2 => ind_SO2, & - kpp_iH2SO4 => ind_H2SO4, & - kpp_iMSA => ind_MSA, & - kpp_iNO3 => ind_NO3, & - kpp_iOH => ind_OH - - use kpp_achem_gas_Integrator, only: kpp_integrate => INTEGRATE - - use kpp_achem_gas_Rates, only: kpp_update_sun => Update_SUN, & - kpp_update_reaction_rates => Update_RCONST - - implicit none - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: delp - real, dimension(:,:,:), intent(in) :: temperature - real, dimension(:,:,:), intent(in) :: density_air - - real, dimension(:,:,:), intent(in) :: q_OH - real, dimension(:,:,:), intent(in) :: q_NO3 - - real, intent(in) :: dt - - integer, intent(out) :: rc - -! !OUTPUT PARAMETERS: - - real, dimension(:,:,:), intent(inout) :: q_NH3 - real, dimension(:,:,:), intent(inout) :: q_DMS - real, dimension(:,:,:), intent(inout) :: q_MSA - real, dimension(:,:,:), intent(inout) :: q_SO2 - real, dimension(:,:,:), intent(inout) :: q_H2SO4 - - real, dimension(:,:), intent(inout) :: cpl_NH3 - real, dimension(:,:), intent(inout) :: cpl_DMS - real, dimension(:,:), intent(inout) :: cpl_MSA - real, dimension(:,:), intent(inout) :: cpl_SO2 - real, dimension(:,:), intent(inout) :: cpl_H2SO4 - - - -! !DESCRIPTION: Wrap the KPP generated code. -! -! !REVISION HISTORY: -! -! 13Aug2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('gas_chemistry') - - ! parameters - - integer, parameter :: r8 = kpp_r8 - - real(kind=r8), parameter :: zero_concentration = 1d-6 ! very small concentration, # cm-3 - - real(kind=r8), parameter :: rel_tolerance = 1.0d-2 - real(kind=r8), parameter :: abs_tolerance = 1.0d-2 - - integer, parameter :: ICNTRL_U(20) = (/1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/) - real(kind=r8), parameter :: RCNTRL_U(20) = (/0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & - 0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & - 0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0, & - 0.0d0, 0.0d0, 0.0d0, 0.0d0, 0.0d0/) - - ! local - integer :: ierr - real(kind=r8) :: RSTATE(20) - real(kind=r8) :: conc_air_inv - real(kind=r8) :: time - - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k, k1, km - integer :: ijl, ijkl - integer :: n - - real :: ff - - -#ifdef DEBUG - real, dimension(:,:,:), allocatable :: conc_air -#endif - - rc = 0 - - i1 = lbound(density_air, dim=1); i2 = ubound(density_air, dim=1) - j1 = lbound(density_air, dim=2); j2 = ubound(density_air, dim=2) - k1 = lbound(density_air, dim=3); km = ubound(density_air, dim=3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * (km - k1 + 1) - -#ifdef DEBUG - ! air molecules concentrations, #molecules/cm-3 - allocate(conc_air(i1:i2,j1:j2,k1:km), __STAT__) - conc_air = 1.0e-6 * (N_avog/mw_air) * density_air - - - call write_parallel('[ DEBUG ] ' // trim(Iam) // ': inputs to gas phase chemistry') - - call write_parallel('[ DEBUG ] ' // 'volume mixing ratios:') - call MAPL_MaxMin('OH : ', q_OH(:,:,km)) - call MAPL_MaxMin('NO3 : ', q_NO3(:,:,km)) - call MAPL_MaxMin('DMS : ', q_DMS(:,:,km)) - call MAPL_MaxMin('MSA : ', q_MSA(:,:,km)) - call MAPL_MaxMin('SO2 : ', q_SO2(:,:,km)) - call MAPL_MaxMin('H2SO4 : ', q_H2SO4(:,:,km)) - call MAPL_MaxMin('NH3 : ', q_NH3(:,:,km)) - - call write_parallel('[ DEBUG ] ' // 'concentrations:') - call MAPL_MaxMin('air : ', conc_air(:,:,km)) - call MAPL_MaxMin('OH : ', q_OH(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('NO3 : ', q_NO3(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('DMS : ', q_DMS(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('MSA : ', q_MSA(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('SO2 : ', q_SO2(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('H2SO4 : ', q_H2SO4(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('NH3 : ', q_NH3(:,:,km) * conc_air(:,:,km)) -#endif - - - cpl_NH3 = sum(q_NH3 * delp, dim=3) - cpl_DMS = sum(q_DMS * delp, dim=3) - cpl_MSA = sum(q_MSA * delp, dim=3) - cpl_SO2 = sum(q_SO2 * delp, dim=3) - cpl_H2SO4 = sum(q_H2SO4* delp, dim=3) - - do k = k1, km - do j = j1, j2 - do i = i1, i2 - ! set the onversion factor for concentration units - kpp_uf_conc = 1.0_r8 - - ! set sunlight intensity for KPP - kpp_sun = 1.0_r8 - - ! initialize the KPP integration parameteres - kpp_step_min = 0.0 ! seconds - kpp_step_max = 0.0 - - ! set the KPP realtive (RTOL) and absolute (ATOL) tolerances - kpp_rtol(:) = rel_tolerance - kpp_atol(:) = abs_tolerance - - ! set KPP times - kpp_dt = dt - kpp_time_start = 0.0_r8 - kpp_time_end = kpp_time_start + dt - - ! set temperature for KPP - kpp_temperature = temperature(i,j,k) - - ! set concentrations for KPP, #molecules/cm-3 - kpp_conc_air = 1.0e-6 * (N_avog/mw_air) * density_air(i,j,k) - kpp_conc_O2 = 0.20946 * kpp_conc_air - - kpp_conc(kpp_iNO3) = kpp_conc_air * q_NO3(i,j,k) - kpp_conc(kpp_iOH) = kpp_conc_air * q_OH(i,j,k) - - kpp_conc(kpp_iDMS) = kpp_conc_air * q_DMS(i,j,k) - kpp_conc(kpp_iSO2) = kpp_conc_air * q_SO2(i,j,k) - kpp_conc(kpp_iH2SO4) = kpp_conc_air * q_H2SO4(i,j,k) - kpp_conc(kpp_iMSA) = kpp_conc_air * q_MSA(i,j,k) - kpp_conc(kpp_iNH3) = kpp_conc_air * q_NH3(i,j,k) - - time = kpp_time_start - KPP_TIME_INTEGRATE: do while (time < kpp_time_end) - - kpp_time = time - - ! chemistry solver - call kpp_update_reaction_rates() - - ! set sunlight intensity for KPP - kpp_sun = 1.0_r8 - - kpp_conc(kpp_iNO3) = kpp_conc_air * q_NO3(i,j,k) - kpp_conc(kpp_iOH) = kpp_conc_air * q_OH(i,j,k) - - - call kpp_integrate(TIN = time, & - TOUT = time+kpp_dt, & - RSTATUS_U = RSTATE, & - ICNTRL_U = ICNTRL_U, & - RCNTRL_U = RCNTRL_U, & - IERR_U = ierr) - - if (ierr < 0) then - STATUS = -1 - else - STATUS = ESMF_SUCCESS - end if - - VERIFY_(STATUS) - - time = RSTATE(1) - end do KPP_TIME_INTEGRATE - - - - ! update the model concentrations - if (kpp_conc_air > zero_concentration) then - conc_air_inv = 1.0_r8 / kpp_conc_air - else - conc_air_inv = 0.0_r8 - end if - - q_DMS(i,j,k) = kpp_conc(kpp_iDMS) * conc_air_inv - q_SO2(i,j,k) = kpp_conc(kpp_iSO2) * conc_air_inv - q_H2SO4(i,j,k) = kpp_conc(kpp_iH2SO4) * conc_air_inv - q_MSA(i,j,k) = kpp_conc(kpp_iMSA) * conc_air_inv - q_NH3(i,j,k) = kpp_conc(kpp_iNH3) * conc_air_inv - end do - end do - end do - - ff = 1.0 / (mw_air * g_earth * dt) - - cpl_NH3 = (sum(q_NH3 * delp, dim=3) - cpl_NH3 ) * ff - cpl_DMS = (sum(q_DMS * delp, dim=3) - cpl_DMS ) * ff - cpl_MSA = (sum(q_MSA * delp, dim=3) - cpl_MSA ) * ff - cpl_SO2 = (sum(q_SO2 * delp, dim=3) - cpl_SO2 ) * ff - cpl_H2SO4 = (sum(q_H2SO4 * delp, dim=3) - cpl_H2SO4) * ff - - -#ifdef DEBUG - call write_parallel('[ DEBUG ] ' // trim(Iam) // ': fields after gas phase chemistry') - - call write_parallel('[ DEBUG ] ' // 'volume mixing ratios:') - call MAPL_MaxMin('OH : ', q_OH(:,:,km)) - call MAPL_MaxMin('NO3 : ', q_NO3(:,:,km)) - call MAPL_MaxMin('DMS : ', q_DMS(:,:,km)) - call MAPL_MaxMin('MSA : ', q_MSA(:,:,km)) - call MAPL_MaxMin('SO2 : ', q_SO2(:,:,km)) - call MAPL_MaxMin('H2SO4 : ', q_H2SO4(:,:,km)) - call MAPL_MaxMin('NH3 : ', q_NH3(:,:,km)) - - call write_parallel('[ DEBUG ] ' // 'concentrations:') - call MAPL_MaxMin('air : ', conc_air(:,:,km)) - call MAPL_MaxMin('OH : ', q_OH(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('NO3 : ', q_NO3(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('DMS : ', q_DMS(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('MSA : ', q_MSA(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('SO2 : ', q_SO2(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('H2SO4 : ', q_H2SO4(:,:,km) * conc_air(:,:,km)) - call MAPL_MaxMin('NH3 : ', q_NH3(:,:,km) * conc_air(:,:,km)) - - deallocate(conc_air, __STAT__) -#endif - - where (q_DMS < 0.0) q_DMS = tiny(0.0) - where (q_MSA < 0.0) q_MSA = tiny(0.0) - where (q_SO2 < 0.0) q_SO2 = tiny(0.0) - where (q_H2SO4 < 0.0) q_H2SO4 = tiny(0.0) - where (q_NH3 < 0.0) q_NH3 = tiny(0.0) - - RETURN_(ESMF_SUCCESS) - - end subroutine gas_chemistry - - - subroutine aqu_chemistry_fast(ple, & - temperature, & - density_air, & - lwc, & - lwc_min, & - fcld, & - q_NH3, & - q_SO2, & - q_H2SO4, & - q_H2O2, & - pSO4_aq, & - pNH4_aq, & - pSO4_aq_SO2, & - pSO4_aq_H2SO4, & - pNH4_aq_NH3, & - dt, & - rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: ple - real, dimension(:,:,:), intent(in) :: temperature - real, dimension(:,:,:), intent(in) :: density_air - real, dimension(:,:,:), intent(in) :: lwc - real, intent(in) :: lwc_min - real, dimension(:,:,:), intent(in) :: fcld - - real, intent(in) :: dt - - integer, intent(out) :: rc - -! !OUTPUT PARAMETERS: - real, dimension(:,:,:), intent(inout) :: q_H2O2 - - real, dimension(:,:,:), intent(inout) :: q_NH3 - real, dimension(:,:,:), intent(inout) :: q_SO2 - real, dimension(:,:,:), intent(inout) :: q_H2SO4 - - real, dimension(:,:,:), intent(out) :: pSO4_aq - real, dimension(:,:,:), intent(out) :: pNH4_aq - - real, dimension(:,:,:), intent(out) :: pSO4_aq_SO2 - real, dimension(:,:,:), intent(out) :: pSO4_aq_H2SO4 - real, dimension(:,:,:), intent(out) :: pNH4_aq_NH3 - - - -! !DESCRIPTION: Super fast implementation of aqueous chemistry. -! -! !REVISION HISTORY: -! -! 09Nov2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('aqu_chemistry_fast') - - ! parameters - real, parameter :: T_freeze = 258.0 ! freezing point of supercooled cloud water, K - - - ! local - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k, k1, km - integer :: ijl, ijkl - - real :: SO2, H2SO4, H2O2, NH3 - real :: l_SO2, l_H2SO4, l_H2O2, l_NH3 - real :: f - - - rc = ESMF_SUCCESS - - i1 = lbound(q_SO2, dim=1); i2 = ubound(q_SO2, dim=1) - j1 = lbound(q_SO2, dim=2); j2 = ubound(q_SO2, dim=2) - k1 = lbound(q_SO2, dim=3); km = ubound(q_SO2, dim=3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * (km - k1 + 1) - - ! total production in aqueous phase - pSO4_aq = 0.0 - pNH4_aq = 0.0 - - ! contributions of production pathways in aqueous phase - pSO4_aq_SO2 = 0.0 - pSO4_aq_H2SO4 = 0.0 - pNH4_aq_NH3 = 0.0 - - do k = k1, km - do j = j1, j2 - do i = i1, i2 - - SO2 = q_SO2(i,j,k) - H2SO4 = q_H2SO4(i,j,k) - H2O2 = q_H2O2(i,j,k) - NH3 = q_NH3(i,j,k) - - if ((lwc(i,j,k) > lwc_min) .and. (temperature(i,j,k) > T_freeze)) then - - f = fcld(i,j,k) - - if (SO2 > H2O2) then - f = f * (H2O2 / SO2) - H2O2 = H2O2 * (1 - fcld(i,j,k)) - else - H2O2 = H2O2 * (1 - fcld(i,j,k)*(SO2/H2O2)) - endif - - ! aqueous loss - l_SO2 = f * SO2 - l_H2SO4 = fcld(i,j,k) * H2SO4 - l_NH3 = fcld(i,j,k) * NH3 ! all NH3 dissociates to NH4 i.e., [NH4] = [NH3] for pH < 5 - - ! update TMR - SO2 = SO2 * (1 - f) - H2SO4 = H2SO4 * (1 - fcld(i,j,k)) - NH3 = NH3 * (1 - fcld(i,j,k)) - else - l_SO2 = 0.0 - l_H2SO4 = 0.0 - l_NH3 = 0.0 - endif - - ! H2O2 mixing ratio should be updated at this point - ! and then reset it periodically - SO2 = max(SO2, tiny(SO2)) - H2SO4 = max(H2SO4, tiny(H2SO4)) - H2O2 = max(H2O2, tiny(H2O2)) - NH3 = max(NH3, tiny(NH3)) - - q_SO2(i,j,k) = SO2 - q_H2SO4(i,j,k) = H2SO4 - q_H2O2(i,j,k) = H2O2 - q_NH3(i,j,k) = NH3 - - ! units are 'kg-SO4/kg-air/s' - pSO4_aq_SO2(i,j,k) = (mw_SO4/mw_air) * l_SO2 / dt - pSO4_aq_H2SO4(i,j,k) = (mw_SO4/mw_air) * l_H2SO4 / dt - - pSO4_aq(i,j,k) = pSO4_aq(i,j,k) + pSO4_aq_SO2(i,j,k) - pSO4_aq(i,j,k) = pSO4_aq(i,j,k) + pSO4_aq_H2SO4(i,j,k) - - ! units are 'kg-NH4/kg-air/s' - pNH4_aq_NH3(i,j,k) = (mw_NH4/mw_air) * l_NH3 / dt - pNH4_aq(i,j,k) = pNH4_aq(i,j,k) + pNH4_aq_NH3(i,j,k) - end do - end do - end do - - RETURN_(ESMF_SUCCESS) - - end subroutine aqu_chemistry_fast - - - subroutine aqu_chemistry(ple, & - temperature, & - density_air, & - lwc, & - fcld, & - q_NH3, & - q_SO2, & - q_SVI_aq, & - q_NH4_aq, & - q_H2O2, & - q_O3, & - dt, & - solver_max_dt, & - lwc_min, & - rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: ple - real, dimension(:,:,:), intent(in) :: temperature - real, dimension(:,:,:), intent(in) :: density_air - real, dimension(:,:,:), intent(in) :: lwc - real, dimension(:,:,:), intent(in) :: fcld - - real, dimension(:,:,:), intent(in) :: q_H2O2 - real, dimension(:,:,:), intent(in) :: q_O3 ! has to be converted to VMR - - real, intent(in) :: dt - real, intent(in) :: solver_max_dt - real, intent(in) :: lwc_min - - integer, intent(out) :: rc - -! !OUTPUT PARAMETERS: - - real, dimension(:,:,:), intent(inout) :: q_NH3 - real, dimension(:,:,:), intent(inout) :: q_SO2 - - real, dimension(:,:,:), intent(inout) :: q_SVI_aq - real, dimension(:,:,:), intent(inout) :: q_NH4_aq - - - -! !DESCRIPTION: Fast implementation of aqueous chemistry. -! -! !REVISION HISTORY: -! -! 09Nov2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('aqu_chemistry') - - ! parameters - real, parameter :: atm = 1.01325e5 ! one atmosphere (pressure), Pa - - real, parameter :: zero_concentration = 1.0e-6 ! very small concentration (one molecule per cm3), # cm-3 - - real, parameter :: Hp_0 = 10**-5.6 - real, parameter :: Hp_cloud = 10**-4.5 - real, parameter :: f_Hp = 0.1 - - - ! local - real :: conc_air_inv - - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k, k1, km - integer :: ijl, ijkl - - integer :: n, n_steps ! number of time splitting sub-steps - real :: dt_step ! length of a time sub-step - - real :: T ! temperature - real :: Hp ! hydrogen ion [H^+] concentration - real :: c_air, c_air_inv ! concentration of air and its reciprocal - real :: g_NH3, g_SO2, g_H2O2, g_O3 ! gas phase concentrations - real :: a_NH3, a_NH4p, a_SO2, & ! aqueous phase concentrations - a_OHm, a_H2O2, a_O3, & ! ... - a_HSO3m, a_SO3mm, a_HSO4m, a_SVI ! ... - real :: p_NH3, p_SO2, p_H2O2, p_O3 ! partial pressure - real :: H_NH3, H_SO2, H_H2O2, H_O3 ! Henry's law constant - - real :: f_pp ! partial pressure factor - - real :: Kw, Ka1, Ks1, Ks2, Kso4 ! equilibrium constants for dissociation reactions - - real :: k_SIV_O3, k_SIV_H2O2 ! S(IV)-O3 and S(IV)-H2O2 aqueous phase oxidation rates - real :: delta_a_SIV ! loss/production of S(IV)/S(VI) - - rc = 0 - - i1 = lbound(density_air, dim=1); i2 = ubound(density_air, dim=1) - j1 = lbound(density_air, dim=2); j2 = ubound(density_air, dim=2) - k1 = lbound(density_air, dim=3); km = ubound(density_air, dim=3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * (km - k1 + 1) - - n_steps = max(1, nint(dt / solver_max_dt)) - dt_step = dt / n_steps - - do k = k1, km - do j = j1, j2 - do i = i1, i2 - if (lwc(i,j,k) > lwc_min) then - - T = temperature(i,j,k) - - ! air molecules concentrations, #molecules/cm-3 - c_air = 1.0e-6 * (N_avog/mw_air) * density_air(i,j,k) - - if (c_air > zero_concentration) then - c_air_inv = 1.0 / c_air - else - c_air_inv = 0.0 - end if - - ! compute Henry's constants - H_NH3 = henry(H_NH3_298, 298.0, E_R_NH3, T) - H_SO2 = henry(H_SO2_298, 298.0, E_R_SO2, T) - H_H2O2 = henry(H_H2O2_298, 298.0, E_R_H2O2, T) - H_O3 = henry(H_O3_298, 298.0, E_R_O3, T) - - ! gas-phase concentrations and partial pressures - f_pp = (R_univ / mw_air) * (density_air(i,j,k) * T) / atm - - g_O3 = c_air * q_O3(i,j,k) * (MAPL_AIRMW / MAPL_O3MW) - p_O3 = f_pp * q_O3(i,j,k) * (MAPL_AIRMW / MAPL_O3MW) - - g_H2O2 = c_air * q_H2O2(i,j,k) - p_H2O2 = f_pp * q_H2O2(i,j,k) - - g_SO2 = c_air * q_SO2(i,j,k) - p_SO2 = f_pp * q_SO2(i,j,k) - - g_NH3 = c_air * q_NH3(i,j,k) - p_NH3 = f_pp * q_NH3(i,j,k) - - a_SVI = 1e3 * q_SVI_aq(i,j,k) / (mw_air * lwc(i,j,k)) ! convert from mol/mol-air to mol L-1 - - ! dissociation rates - Kw = K_w(T) - Ka1 = K_a1(T) - Ks1 = K_s1(T) - Ks2 = K_s2(T) - Kso4 = K_1696(T) - - - ! time sub-splitting - do n = 1, n_steps - ! compute [H+] -#if (0) - Hp = Hp_0 + f_Hp * (2*c_SO4mm + c_HSO3m - c_NH4m) ! ~~ (c_SO4mm + c_HSO3m) ~~ (c_SO4mm + SO2_aq) -#else - Hp = Hp_cloud ! fixed pH -#endif - ! compute equilibrium aqueous phase concentrations, mol L-1 - a_OHm = Kw / Hp - - a_NH4p = H_NH3 * p_NH3 * (Ka1 / Kw) * Hp - - a_HSO3m = H_SO2 * p_SO2 * Ks1 / Hp - a_SO3mm = H_SO2 * p_SO2 * Ks1 * Ks2 / Hp**2 - - a_HSO4m = Hp * a_SVI / (Hp + Kso4) - - ! chemical reaction rates - k_SIV_H2O2 = 0.0 - k_SIV_O3 = 0.0 - k_SIV_H2O2 = 0.0 - - ! integrate - delta_a_SIV = 0.0 * dt_step - - delta_a_SIV = 0.0 * dt_step - - - ! update model state - !q_SO2(i,j,k) = c_SO2 * conc_air_inv - end do - - ! update model state - q_NH4_aq(i,j,k) = q_NH4_aq(i,j,k) + (lwc(i,j,k) * mw_air * a_NH4p) - end if - - end do - end do - end do - - - where (q_SO2 < 0.0) q_SO2 = tiny(0.0) - where (q_NH3 < 0.0) q_NH3 = tiny(0.0) - - RETURN_(ESMF_SUCCESS) - - contains - - elemental real function K_w(T) - implicit none - real, intent(in) :: T - - real, parameter :: K_298 = 1.0e-14 ! M atm-1 - real, parameter :: dH_R = 6710.0 ! K - - K_w = K_298 * exp(-dH_R * (1/T - 1/298.0)) - end function K_w - - elemental real function K_s1(T) - implicit none - real, intent(in) :: T - - real, parameter :: K_298 = 1.3e-2 ! M atm-1 - real, parameter :: dH_R = -1960.0 ! K - - K_s1 = K_298 * exp(-dH_R * (1/T - 1/298.0)) - end function K_s1 - - elemental real function K_s2(T) - implicit none - real, intent(in) :: T - - real, parameter :: K_298 = 6.6e-8 ! M atm-1 - real, parameter :: dH_R = -1500.0 ! K - - K_s2 = K_298 * exp(-dH_R * (1/T - 1/298.0)) - end function K_s2 - - elemental real function K_1696(T) - implicit none - real, intent(in) :: T - - real, parameter :: K_298 = 1.02e-2 ! M atm-1 - real, parameter :: dH_R = -2720.0 ! K - - K_1696 = K_298 * exp(-dH_R * (1/T - 1/298.0)) - end function K_1696 - - elemental real function K_a1(T) - implicit none - real, intent(in) :: T - - real, parameter :: K_298 = 1.7e-5 ! M atm-1 - real, parameter :: dH_R = 450.0 ! K - - K_a1 = K_298 * exp(-dH_R * (1/T - 1/298.0)) - end function K_a1 - - - end subroutine aqu_chemistry - - - subroutine ocs_chemistry(ple, & - temperature, & - density_air, & - ocs_surface_vmr, & - tropp, & - q_OCS, & - q_OH, & - q_O3p, & - j_ocs, & - pSO2_OCS, & - pSO2_OCS_OH, & - pSO2_OCS_O3p, & - pSO2_OCS_jOCS, & - lOCS, & - lOCS_OH, & - lOCS_O3p, & - lOCS_jOCS, & - dt, & - rc) - -! !USES: - - use kpp_achem_gas_Precision, only: kpp_r8 => dp - - implicit none - -! !INPUT PARAMETERS: - - real, dimension(:,:,:), intent(in) :: ple - real, dimension(:,:,:), intent(in) :: temperature - real, dimension(:,:,:), intent(in) :: density_air - real , intent(in) :: ocs_surface_vmr - - real, intent(in) :: dt - - integer, intent(out) :: rc - - real, dimension(:,:) , intent(in) :: tropp - - real, dimension(:,:,:), intent(in) :: q_OH - real, dimension(:,:,:), intent(in) :: q_O3p - real, dimension(:,:,:), intent(in) :: j_ocs - -! !OUTPUT PARAMETERS: - real, dimension(:,:,:), intent(inout) :: q_OCS - - real, dimension(:,:,:), intent(inout) :: pSO2_OCS ! production of S from OCS in the stratosphere - real, dimension(:,:,:), intent(inout) :: pSO2_OCS_OH ! production of S from OCS+OH - real, dimension(:,:,:), intent(inout) :: pSO2_OCS_O3p ! production of S from OCS+O3p - real, dimension(:,:,:), intent(inout) :: pSO2_OCS_jOCS ! production of S from OCS photolysis - real, dimension(:,:,:), intent(inout) :: lOCS ! loss ocs, 'molecules cm-3 s-1' - real, dimension(:,:,:), intent(inout) :: lOCS_OH ! loss rate of OCS from OCS+OH, 'molec cm-3 s-1' - real, dimension(:,:,:), intent(inout) :: lOCS_O3p ! loss rate of OCS from OCS+O3p, 'molec cm-3 s-1' - real, dimension(:,:,:), intent(inout) :: lOCS_jOCS ! loss rate of OCS from photolysis, 'molec cm-3 s-1' - - -! !DESCRIPTION: Calculate the OCS chemistry -! -! !REVISION HISTORY: -! -! 16 April 2014 V. Aquila First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('ocs_chemistry') - - ! parameters - - integer, parameter :: r8 = kpp_r8 - real :: conc_air, c_air_inv ! air concentration [molecules/cm3] - real :: conc_OCS ! OCS concentration [molecules/cm3] - real :: conc_OH ! OH concentration [molecules/cm3] - real :: conc_O3p ! O3p concentration [molecules/cm3] - real :: ltot_ocs ! OCS loss [molecules/cm3] - - real, parameter :: mw_SO2 = 64.066 ! molar mass of sulfur dioxide, g mol-1 - real, parameter :: mw_OH = 17.01 ! molar mass of hydroxide ion, g mol -1 - real, parameter :: mw_air = 28.97 ! molar mass of dry air, g mol-1 - - real, parameter :: N_A = 6.02214129e23 ! mol-1 - - real(kind=r8), parameter :: zero_concentration = 1e-6 ! very small concentration, # cm-3 - - real :: k_oh, k_o3p, kk ! reaction rates - - !reactions parameters from Sander, S. P. et al. (2010), Chemical Kinetics and Photochemical - !Data for Use in Atmospheric Studies (No. 17) NASA JPL. - !Rate constant ak = A*exp[-ER/Temperature] - real, parameter :: A_oh = 1.1e-13 ! Arrhenius A-factor OCS+OH - real, parameter :: ER_oh = 1200 ! Temperature dependence OCS+OH - real, parameter :: A_o3p = 2.1e-11 ! Arrhenius A-factor OCS+O3p - real, parameter :: ER_o3p = 2200 ! Temperature dependence OCS+O3p - - real, allocatable, dimension(:, :,:) :: prod_SO2 ! production of SO2 from OCS - real, allocatable, dimension(:, :,:) :: prod_SO2_OH ! production of SO2 from OCS+OH - real, allocatable, dimension(:, :,:) :: prod_SO2_O3p ! production of SO2 from OCS+O3p - real, allocatable, dimension(:, :,:) :: prod_SO2_jOCS ! production of SO2 from OCS photolysis - real, allocatable, dimension(:, :,:) :: loss_ocs ! loss OCS. molecules cm-3 - real, allocatable, dimension(:, :,:) :: loss_ocs_OH ! loss OCS. molecules cm-3 - real, allocatable, dimension(:, :,:) :: loss_ocs_JOCS ! loss OCS. molecules cm-3 - real, allocatable, dimension(:, :,:) :: loss_ocs_O3p ! loss OCS. molecules cm-3 - - integer :: i, i1, i2 - integer :: j, j1, j2 - integer :: k, k1, km - - i1 = lbound(density_air, dim=1); i2 = ubound(density_air, dim=1) - j1 = lbound(density_air, dim=2); j2 = ubound(density_air, dim=2) - k1 = lbound(density_air, dim=3); km = ubound(density_air, dim=3) - - allocate(prod_SO2(i1:i2,j1:j2,k1:km), __STAT__) - allocate(prod_SO2_OH(i1:i2,j1:j2,k1:km), __STAT__) - allocate(prod_SO2_O3p(i1:i2,j1:j2,k1:km), __STAT__) - allocate(prod_SO2_jOCS(i1:i2,j1:j2,k1:km), __STAT__) - - allocate(loss_ocs(i1:i2,j1:j2,k1:km), __STAT__) - allocate(loss_ocs_OH(i1:i2,j1:j2,k1:km), __STAT__) - allocate(loss_ocs_O3p(i1:i2,j1:j2,k1:km), __STAT__) - allocate(loss_ocs_jOCS(i1:i2,j1:j2,k1:km), __STAT__) - - prod_SO2 = 0.0 - prod_SO2_OH = 0.0 - prod_SO2_O3p = 0.0 - prod_SO2_jOCS = 0.0 - - loss_ocs = 0.0 - loss_ocs_OH = 0.0 - loss_ocs_O3p = 0.0 - loss_ocs_jOCS = 0.0 - - q_OCS(i1:i2,j1:j2,km) = ocs_surface_vmr - - do k = k1, km - do j = j1, j2 - do i = i1, i2 - STRATOSPHERE: if (ple(i,j,k) <= tropp(i,j)) then - !transform from mol/mol to molecules/cm3 - conc_air = dble(1e-3 * (N_A/mw_air) * density_air(i,j,k)) - - conc_OCS = conc_air * dble(q_OCS(i,j,k)) - conc_OH = conc_air * dble(q_OH(i,j,k)) - conc_O3p = conc_air * dble(q_O3p(i,j,k)) - - k_oh = A_oh * exp(- ER_oh / temperature(i,j,k)) - k_o3p = A_o3p * exp(- ER_o3p / temperature(i,j,k)) - kk = (k_oh * conc_OH + k_o3p * conc_O3p + j_ocs(i,j,k)) - - ltot_ocs = conc_OCS * (1 - exp(-kk * dt)) - - if (conc_air > zero_concentration) then - c_air_inv = 1.0 / conc_air - else - c_air_inv = 0.0 - end if - - q_OCS(i,j,k) = q_OCS(i,j,k) - ltot_ocs * c_air_inv - q_OCS(i,j,k) = max(q_OCS(i,j,k), tiny(0.0)) - - prod_SO2(i,j,k) = ltot_ocs * c_air_inv * mw_SO2/mw_air / dt - - prod_SO2_OH(i,j,k) = (k_oh * conc_OH) / kk * ltot_ocs * c_air_inv * mw_SO2/mw_air / dt - prod_SO2_O3p(i,j,k) = (k_o3p * conc_O3p) / kk * ltot_ocs * c_air_inv * mw_SO2/mw_air / dt - prod_SO2_jOCS(i,j,k) = (j_OCS(i,j,k)) / kk * ltot_ocs * c_air_inv * mw_SO2/mw_air / dt - - loss_ocs(i,j,k) = ltot_ocs / dt - - loss_ocs_OH(i,j,k) = (k_oh * conc_OH) / kk * ltot_ocs / dt - loss_ocs_O3p(i,j,k) = (k_o3p * conc_O3p) / kk * ltot_ocs / dt - loss_ocs_jOCS(i,j,k) = (j_OCS(i,j,k)) / kk * ltot_ocs / dt - endif STRATOSPHERE - enddo - enddo - enddo - - pSO2_OCS = prod_SO2 - pSO2_OCS_OH = prod_SO2_OH - pSO2_OCS_O3p = prod_SO2_O3p - pSO2_OCS_jOCS = prod_SO2_jOCS - - lOCS = loss_ocs - lOCS_OH = loss_ocs_OH - lOCS_O3p = loss_ocs_O3p - lOCS_jOCS = loss_ocs_jOCS - - - deallocate(prod_SO2, __STAT__) - deallocate(prod_SO2_OH, __STAT__) - deallocate(prod_SO2_O3p, __STAT__) - deallocate(prod_SO2_jOCS, __STAT__) - - deallocate(loss_ocs, __STAT__) - deallocate(loss_ocs_OH, __STAT__) - deallocate(loss_ocs_O3p, __STAT__) - deallocate(loss_ocs_jOCS, __STAT__) - - end subroutine ocs_chemistry - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: solar_zenith_angle --- Given day of the year, UTC time and -! geographical location computes solar zenith angle. -! -! !INTERFACE: -! - - subroutine solar_zenith_angle(doy, utc_hour, lon, lat, sza, cos_sza) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - integer, intent(in) :: doy ! day since the begining of the year - real, intent(in) :: utc_hour ! hour - - real, dimension(:,:), intent(in) :: lon ! longitudes, degrees - real, dimension(:,:), intent(in) :: lat ! latitudes, degrees - - real, dimension(:,:), intent(inout) :: sza ! solar zenith angle, degrees - real, dimension(:,:), intent(inout) :: cos_sza ! cos(solar zenith angle) - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Computes solar zenith angle -! -! !REVISION HISTORY: -! -! 28Sep2012 A. Darmenov Addopted existing code from SulfateChemDriverMod. -! -!EOP -!------------------------------------------------------------------------- - - ! parameters - real, parameter :: pi = 3.1415926 - real, parameter :: f_rad2deg = 180.0/pi - real, parameter :: f_deg2rad = pi/180.0 - - real, parameter :: a0 = 0.006918 - real, parameter :: a1 = 0.399912 - real, parameter :: a2 = 0.006758 - real, parameter :: a3 = 0.002697 - real, parameter :: b1 = 0.070257 - real, parameter :: b2 = 0.000907 - real, parameter :: b3 = 0.000148 - - ! local - real :: r - real :: solar_declination, sin_sd, cos_sd - real :: local_time - real :: hour_angle, cos_ha - real :: lat_ - integer :: i, i1, i2 - integer :: j, j1, j2 - - - r = (2 * pi * (doy - 1))/365 - - ! solar declination in radians - solar_declination = a0 - a1*cos( r) + b1*sin( r) & - - a2*cos(2*r) + b2*sin(2*r) & - - a3*cos(3*r) + b3*sin(3*r) - - sin_sd = sin(solar_declination) - cos_sd = cos(solar_declination) - - i1 = lbound(lon, dim=1); i2 = ubound(lon, dim=1) - j1 = lbound(lon, dim=2); j2 = ubound(lon, dim=2) - - do j = j1, j2 - do i = i1, i2 - local_time = utc_hour + lon(i,j)/15 - - if(local_time < 0) local_time = local_time + 24 - if(local_time > 24) local_time = local_time - 24 - - hour_angle = (abs(local_time - 12) * 15) * f_deg2rad - - cos_ha = cos(hour_angle) - - lat_ = lat(i,j) * f_deg2rad - cos_sza(i,j) = sin(lat_)*sin_sd + cos(lat_)*cos_sd*cos_ha - end do - end do - - sza = acos(cos_sza) * f_rad2deg - where (cos_sza < 0) cos_sza = 0.0 - - end subroutine solar_zenith_angle - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: day_of_year -- given nymd compute the day number of the yea -! -! !INTERFACE: -! - - pure function day_of_year(nymd) result (doy) - -! !USES: - - implicit none - - integer :: doy - -! !INPUT PARAMETERS: - - integer, intent(in) :: nymd - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: Computes day of year -! -! !REVISION HISTORY: -! -! 11Nov2012 A. Darmenov Addopted existing code from SulfateChemDriverMod. -! -!EOP -!------------------------------------------------------------------------- - ! parameters - integer, parameter :: days(12) = (/31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/) - - ! local - integer :: yyyy - integer :: mm - integer :: dd - integer :: month - logical :: leap - - yyyy = nymd / 10000 - mm = mod(nymd, 10000) / 100 - dd = mod(nymd, 100) - - ! is it a leap year? - leap = .false. - - if (mod(yyyy, 4) == 0) then - leap = .true. - if (mod(yyyy, 100) == 0) then - leap = .false. - if (mod(yyyy, 400) == 0) then - leap = .true. - endif - endif - endif - - ! calculate day of year - doy = 0 - - if (mm == 1) then - doy = dd - else - do month = 1, mm - 1 - if ( (month == 2) .and. leap ) then - doy = doy + 29 - else - doy = doy + days(month) - endif - enddo - - doy = doy + dd - endif - - end function day_of_year - - - end module GEOS_AChemGridCompMod diff --git a/GEOSachem_GridComp/GEOSachem_ExtData.rc b/GEOSachem_GridComp/GEOSachem_ExtData.rc deleted file mode 100755 index ffc64d27..00000000 --- a/GEOSachem_GridComp/GEOSachem_ExtData.rc +++ /dev/null @@ -1,60 +0,0 @@ -# -# Sample resource file exemplifying the specification of an interface to -# boundary conditions, emissions and other external files. This resource -# file is meant to be read by the MAPL_ExtData Grid Component. -# - -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - -# SO2 emissions -SO2_EMIS_FIRES 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00 none none biomass ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_so2.006.%y4%m2%d2.nc4 - - -SO2_EMIS_NONENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl1 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 -SO2_EMIS_ENERGY 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none sanl2 ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - - -SO2_EMIS_SHIPPING 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_ship ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_LTO 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CDS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 -SO2_EMIS_AIRCRAFT_CRS 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00 none none so2_aviation ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - -# Surface seawater concentration of DMS -DMS_CONC_OCEAN 'mol m-3' Y Y %y4-%m2-%d2t12:00:00 0.0 1.0e-6 conc ExtData/chemistry/Lana/v2011/DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - -# NH3 emissions -NH3_EMIS 'kg m-2 s-1' N Y 0 none none emi_nh3 ExtData/chemistry/MERRA2/v0.0.0/sfc/edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 -NH3_EMIS_FIRE 'kg m-2 s-1' N Y %y4-%m2-%d2T12:00:00 none none biomass ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_nh3.006.%y4%m2%d2.nc4 -NH3_EMIS_OCEAN 'kg m-2 s-1' Y Y %y4-%m2-%d2T12:00:00 none none emiss_ocn ExtData/chemistry/GEIA/v0.0.0/sfc/GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - -# Volume mixing ratio of prescribed oxidant field -OH 'mol mol-1' N N 0 none none oh ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -NO3 'mol mol-1' N N 0 none none no3 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -#HO2 'mol mol-1' N N 0 none none ho2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 -H2O2 'mol mol-1' N N 0 none none h2o2 ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - - -# SOA(gas) emissions -SOAG_EMIS 'm-2 s-1' Y N 0 none none soag ExtData/chemistry/CAM/v0.0.0/sfc/SOAG.emiss.x144_y91_t12.1990.nc4 - -# CO emissions for VOC -CO_BIOMASS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none biomass ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_co.006.%y4%m2%d2.nc4 -CO_BF_VOC 'kg m-2 s-1' Y Y %y4-%m2-%d2t12:00:00Z none none emcobf /dev/null -CO_FS_VOC 'kg m-2 s-1' N Y %y4-%m2-%d2t12:00:00Z none none co ExtData/chemistry/CEDS/v2021-04-21-revised/sfc/CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - -# Photolysis rates -#jH2O2 's-1' Y N 0 none none jH2O2 ExtData/chemistry/GMI/v0.0.0/L72/Y2008/gmi_jh2o2.x144_y91_z72.2008%m2.nc4 -%% - -DerivedExports%% -# ---------|---------|--------------------------------------------| -# Export | Primary |_________________ Mask _____________________| -# Name | Name | Name | Expression | -# ---------|---------|------------|-------------------------------| -# ---------|---------|------------|-------------------------------| -%% - diff --git a/GEOSachem_GridComp/GEOSachem_ExtData.yaml b/GEOSachem_GridComp/GEOSachem_ExtData.yaml deleted file mode 100644 index 6712a14e..00000000 --- a/GEOSachem_GridComp/GEOSachem_ExtData.yaml +++ /dev/null @@ -1,138 +0,0 @@ -Collections: - GEOSachem_CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4: - template: ExtData/chemistry/CEDS/v2021-04-21-revised/sfc/CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - GEOSachem_DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4: - template: ExtData/chemistry/Lana/v2011/DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - GEOSachem_GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4: - template: ExtData/chemistry/GEIA/v0.0.0/sfc/GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4: - template: ExtData/chemistry/MERRA2GMI/v0.0.0/L72/MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - GEOSachem_SOAG.emiss.x144_y91_t12.1990.nc4: - template: ExtData/chemistry/CAM/v0.0.0/sfc/SOAG.emiss.x144_y91_t12.1990.nc4 - GEOSachem_edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4: - template: ExtData/chemistry/MERRA2/v0.0.0/sfc/edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 - GEOSachem_htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 - GEOSachem_htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - GEOSachem_htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4: - template: ExtData/chemistry/HTAP/v2.2/sfc/htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 - GEOSachem_qfed2.emis_co.006.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_co.006.%y4%m2%d2.nc4 - valid_range: "2014-12-01T12:00/2021-11-01T12:00" - GEOSachem_qfed2.emis_nh3.006.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_nh3.006.%y4%m2%d2.nc4 - valid_range: "2014-12-01T12:00/2021-11-01T12:00" - GEOSachem_qfed2.emis_so2.006.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_so2.006.%y4%m2%d2.nc4 - valid_range: "2014-12-01T12:00/2021-11-01T12:00" - GEOSachem_qfed2.emis_co.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_co.061.%y4%m2%d2.nc4 - valid_range: "2021-11-01T12:00/2025-01-01" - GEOSachem_qfed2.emis_nh3.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_nh3.061.%y4%m2%d2.nc4 - valid_range: "2021-11-01T12:00/2025-01-01" - GEOSachem_qfed2.emis_so2.061.%y4%m2%d2.nc4: - template: ExtData/chemistry/QFED/v2.5r1-nrt/sfc/0.1/Y%y4/M%m2/qfed2.emis_so2.061.%y4%m2%d2.nc4 - valid_range: "2021-11-01T12:00/2025-01-01" - -Samplings: - GEOSachem_sample_0: - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - GEOSachem_sample_1: - extrapolation: clim - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - GEOSachem_sample_2: - extrapolation: clim - -Exports: - CO_BF_VOC: - collection: /dev/null - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: emcobf - CO_BIOMASS_VOC: - - {starting: "2014-12-01T12:00",collection: GEOSachem_qfed2.emis_co.006.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - - {starting: "2021-11-01T12:00",collection: GEOSachem_qfed2.emis_co.061.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - CO_FS_VOC: - collection: GEOSachem_CO-em-anthro_CMIP_CEDS_gn.x2304_y1441_t12.%y4.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_0 - variable: co - DMS_CONC_OCEAN: - collection: GEOSachem_DMSclim_sfcconcentration.x360_y181_t12.Lana2011.nc4 - linear_transformation: - - 0.0 - - 1.0e-06 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: conc - H2O2: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: h2o2 - NH3_EMIS: - collection: GEOSachem_edgar-v42.emis_nh3.anthropogenic.x1152_y721.19700703T12z_20200703T00z.nc4 - regrid: CONSERVE - variable: emi_nh3 - NH3_EMIS_FIRE: - - {starting: "2014-12-01T12:00",collection: GEOSachem_qfed2.emis_nh3.006.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - - {starting: "2021-11-01T12:00",collection: GEOSachem_qfed2.emis_nh3.061.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - NH3_EMIS_OCEAN: - collection: GEOSachem_GEIA.emis_NH3.ocean.x576_y361.t12.20080715_12z.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: emiss_ocn - NO3: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: no3 - OH: - collection: GEOSachem_MERRA2_GMI.tavg24_3d_dac_Nv.x576_y361_t12.%y4.nc4 - variable: oh - SO2_EMIS_AIRCRAFT_CDS: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_cds.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_AIRCRAFT_CRS: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_crs.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_AIRCRAFT_LTO: - collection: GEOSachem_htap-v2.2.emis_so2.aviation_lto.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_aviation - SO2_EMIS_ENERGY: - collection: GEOSachem_htapv2.2.emisso2.elevated.x3600y1800t12.2017.integrate.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: sanl2 - SO3_EMIS_FIRE: - - {starting: "2014-12-01T12:00",collection: GEOSachem_qfed2.emis_so3.006.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - - {starting: "2021-11-01T12:00",collection: GEOSachem_qfed2.emis_so3.061.%y4%m2%d2.nc4,regrid: CONSERVE,sample: GEOSachem_sample_0,variable: biomass} - SO2_EMIS_NONENERGY: - collection: GEOSachem_htapv2.2.emisso2.surface.x3600y1800t12.2017.integrate.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: sanl1 - SO2_EMIS_SHIPPING: - collection: GEOSachem_htap-v2.2.emis_so2.ships.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: GEOSachem_sample_1 - variable: so2_ship - SOAG_EMIS: - collection: GEOSachem_SOAG.emiss.x144_y91_t12.1990.nc4 - sample: GEOSachem_sample_2 - variable: soag - diff --git a/GEOSachem_GridComp/GEOSachem_Registry.rc b/GEOSachem_GridComp/GEOSachem_Registry.rc deleted file mode 100644 index b6a20cda..00000000 --- a/GEOSachem_GridComp/GEOSachem_Registry.rc +++ /dev/null @@ -1,219 +0,0 @@ -# -# This the GEOS-5 SulfateChem Grid Component Registry. It defines Import, -# Internal and Export states for this component. -# -# !REVISION HISTORY: -# 30Jul2010 Darmenov, A. First Version -# -# ----------------------------------------------------------------- - -COMP_NAME: GEOS_AChem - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- -# Short | | | V |Item|Intervl| Sub | Def | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Name -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - AREA | m2 | xy | | | | | | | Cell area - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - DELP | Pa | xyz | C | | | | | | Pressure Thickness - PLE | Pa | xyz | E | | | | | | Edge pressure - ZLE | m | xyz | E | | | | | | Edge heights - RH2 | 1 | xyz | C | | | | | | Relative humidity after moist - Q | kg kg-1 | xyz | C | | | | | | Specific humidity - QLTOT | kg kg-1 | xyz | C | | | | | | Mass fraction of cloud liquid water - QCTOT | kg kg-1 | xyz | C | | | | | | Mass fraction of total cloud water - FCLD | 1 | xyz | C | | | | | | Cloud fraction for radiation - QL | kg kg-1 | xyz | C | | | | | | Cloud liquid for radiation - TROPP | Pa | xy | | | | | | | Tropopause pressure based on blended estimate - TS | K | xy | | | | | | | Surface skin temperature - U10N | m s-1 | xy | | | | | | | Equivalent neutral 10 meter eastward wind - V10N | m s-1 | xy | | | | | | | Equivalent neutral 10 meter northward wind - FROCEAN | 1 | xy | | | | | | | Fraction of ocean - FRLAND | 1 | xy | | | | | | | Fraction of land - FRLAKE | 1 | xy | | | | | | | Fraction of lake - FRLANDICE | 1 | xy | | | | | | | Fraction of land ice - LWI | 1 | xy | | | | | | | Land-water-ice flags - USTAR | m s-1 | xy | | | | | | | Surface (friction) velocity scale - SH | W/m2 | xy | | | | | | | Sensible heat flux - Z0H | m | xy | | | | | | | Surface roughness for heat - ZPBL | m | xy | | | | | | | Height of PBL -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - OH | mol mol-1 | xyz | C | | | | | | Hydroxyl radical (OH) - NO3 | mol mol-1 | xyz | C | | | | | | Nitrogen trixide (NO3) - H2O2 | mol mol-1 | xyz | C | | | | | | Hydrogen peroxide (H2O2) - O3 | kg kg-1 | xyz | C | | | | | | Ozone (mass mixing ratio) -# ---------------------|------------|-----|---|----|---|---|-----|------|-------------------------- -# OHSTRAT | mol mol-1 | xyz | C | | | | | | Hydroxyl radical -# O3P | mol mol-1 | xyz | C | | | | | | O triplet P -# OCS_JRATE | s-1 | xyz | C | | | | | | OCS photolysis rates -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - DMS_CONC_OCEAN | nmol L-1-1 | xy | | | | | | | Surface seawater concentration of DMS -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - SO2_EMIS_FIRES | kg m-2 s-1 | xy | | | | | | | SO2 emissions from biomass burning - SO2_EMIS_NONENERGY | kg m-2 s-1 | xy | | | | | | | SO2 emissions from non-energy sectors - SO2_EMIS_ENERGY | kg m-2 s-1 | xy | | | | | | | SO2 emissions from energy sector - SO2_EMIS_SHIPPING | kg m-2 s-1 | xy | | | | | | | SO2 emissions from shipping sector - SO2_EMIS_AIRCRAFT_LTO | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (LTO layer) - SO2_EMIS_AIRCRAFT_CDS | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (CDS layer) - SO2_EMIS_AIRCRAFT_CRS | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (CRS layer) -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - NH3_EMIS | kg m-2 s-1 | xy | | | | | | | NH3 emissions - all sectors excluding biomass burning - NH3_EMIS_FIRE | kg m-2 s-1 | xy | | | | | | | NH3 emissions - biomass burning -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - SOAG_EMIS | m-2 s-1 | xy | | | | | | | SOA(gas) surface emissions -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- -# CO_BIOMASS | kg m-2 s-1 | xy | | | | | | | CO Biomass Burning Emissions -# CO_BF | kg m-2 s-1 | xy | | | | | | | CO Biofuel Emissions -# CO_FS | kg m-2 s-1 | xy | | | | | | | CO Fossil Fuel Emissions -# ----------------------|------------|-----|---|----|---|---|-----|------|-------------------------- - - -# ------------ -# Export State -# ------------ - - -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ -# Short | | | V |Item|Intervl| Sub | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| Name -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - OH | mol mol-1 | xyz | C | | | | | OH with imposed diurnal cycle - NO3 | mol mol-1 | xyz | C | | | | | NO3 with imposed diurnal cycle -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - EMIS_S_DMS | kg m-2 s-1 | xy | | | | | | DMS emissions in kg-S m-2 s-1 - EMIS_S_SO2 | kg m-2 s-1 | xy | | | | | | SO2 emissions in kg-S m-2 s-1 - EMIS_DMS | kg m-2 s-1 | xy | | | | | | DMS emissions - EMIS_SO2 | kg m-2 s-1 | xy | | | | | | SO2 emissions from biomass burning and anthropogenic sources - EMIS_SO2_EXV | kg m-2 s-1 | xy | | | | | | SO2 emissions from explosive volcanoes - EMIS_SO2_NXV | kg m-2 s-1 | xy | | | | | | SO2 emissions from non-explosive volcanoes - EMIS_SO2_VOLC | kg m-2 s-1 | xy | | | | | | SO2 emissions from explosive and non-explosive volcanoes -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - SFC_CONC_DMS | m-3 | xy | | | | | | Near-surface concentration of DMS in molecules-DMS m-3 - SFC_CONC_MSA | m-3 | xy | | | | | | Near-surface concentration of MSA in molecules-MSA m-3 - SFC_CONC_SO2 | m-3 | xy | | | | | | Near-surface concentration of SO2 in molecules-SO2 m-3 - SFC_CONC_H2SO4 | m-3 | xy | | | | | | Near-surface concentration of H2SO4 in molecules-H2SO4 m-3 - SFC_CONC_NH3 | m-3 | xy | | | | | | Near-surface concentration of NH3 in molecules-NH3 m-3 - SFC_CONC_SOAG | m-3 | xy | | | | | | Near-surface concentration of SOA(gas) in molecules-SOA m-3 -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - CONC_DMS | m-3 | xyz | C | | | | | Concentration of DMS in molecules-DMS m-3 - CONC_MSA | m-3 | xyz | C | | | | | Concentration of MSA in molecules-MSA m-3 - CONC_SO2 | m-3 | xyz | C | | | | | Concentration of SO2 in molecules-SO2 m-3 - CONC_H2SO4 | m-3 | xyz | C | | | | | Concentration of H2SO4 in molecules-H2SO4 m-3 - CONC_NH3 | m-3 | xyz | C | | | | | Concentration of NH3 in molecules-NH3 m-3 - CONC_SOAG | m-3 | xyz | C | | | | | Concentration of SOA(gas) in molecules-SOA m-3 -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - CMD_S_DMS | kg m-2 | xy | | | | | | Column mass density of DMS in kg-S m-2 - CMD_S_MSA | kg m-2 | xy | | | | | | Column mass density of MSA in kg-S m-2 - CMD_S_SO2 | kg m-2 | xy | | | | | | Column mass density of SO2 in kg-S m-2 - CMD_S_H2SO4 | kg m-2 | xy | | | | | | Column mass density of H2SO4 in kg-S m-2 - CMD_S_GAS | kg m-2 | xy | | | | | | Column mass density of sulfur in gas phase in kg-S m-2 -# - CMD_N_NH3 | kg m-2 | xy | | | | | | Column mass density of NH3 in kg-N m-2 - CMD_N_GAS | kg m-2 | xy | | | | | | Column mass density of nitrogen in kg-N m-2 -# - CMD_DMS | kg m-2 | xy | | | | | | Column mass density of DMS - CMD_MSA | kg m-2 | xy | | | | | | Column mass density of MSA - CMD_SO2 | kg m-2 | xy | | | | | | Column mass density of SO2 - CMD_H2SO4 | kg m-2 | xy | | | | | | Column mass density of H2SO4 - CMD_NH3 | kg m-2 | xy | | | | | | Column mass density of NH3 - CMD_SOAG | kg m-2 | xy | | | | | | Column mass density of SOA(gas) -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - DRY_DEP_SO2 | kg m-2 s-1 | xy | | | | | | Dry deposition flux of sulfur dioxide (SO2) - DRY_DEP_H2SO4 | kg m-2 s-1 | xy | | | | | | Dry deposition flux of sulfuric acid, (H2SO4 gas) - DRY_DEP_DMS | kg m-2 s-1 | xy | | | | | | Dry deposition flux of DMS - DRY_DEP_MSA | kg m-2 s-1 | xy | | | | | | Dry deposition flux of MSA - DRY_DEP_NH3 | kg m-2 s-1 | xy | | | | | | Dry deposition flux of NH3 - DRY_DEP_SOAG | kg m-2 s-1 | xy | | | | | | Dry deposition flux of SOA(gas) -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - DDT_DMS_gas | mol mol-1 s-1 | xyz | C | | | | | Dimethyl sulfide (DMS) tendency due to gas phase chemistry - DDT_MSA_gas | mol mol-1 s-1 | xyz | C | | | | | Methanesulfonic acid (MSA) tendency due to gas phase chemistry - DDT_SO2_gas | mol mol-1 s-1 | xyz | C | | | | | Sulfur dioxide (SO2) tendency due to gas phase chemistry - DDT_H2SO4_gas | mol mol-1 s-1 | xyz | C | | | | | Sulfuric acid (H2SO4 gas) tendency due to gas phase chemistry - DDT_NH3_gas | mol mol-1 s-1 | xyz | C | | | | | Ammonia (NH3) tendency due to gas phase chemistry - DDT_SOAG_gas | mol mol-1 s-1 | xyz | C | | | | | Secondary Organic Aerosols (SOA gas) tendency due to gas phase chemistry - _DMS_gas | mol mol-1 s-1 | xyz | C | | | | | Dimethyl sulfide (DMS) before gas phase chemistry - _MSA_gas | mol mol-1 s-1 | xyz | C | | | | | Methanesulfonic acid (MSA) befoe gas phase chemistry - _SO2_gas | mol mol-1 s-1 | xyz | C | | | | | Sulfur dioxide (SO2) before gas phase chemistry - _H2SO4_gas | mol mol-1 s-1 | xyz | C | | | | | Sulfuric acid (H2SO4 gas) before gas phase chemistry - _NH3_gas | mol mol-1 s-1 | xyz | C | | | | | Ammonia (NH3) before gas phase chemistry - _SOAG_gas | mol mol-1 s-1 | xyz | C | | | | | Secondary Organic Aerosols (SOA gas) before gas phase chemistry -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - CPL_DMS_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of dimethyl sulfide (DMS) due to gas phase chemistry - CPL_MSA_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of methanesulfonic acid (MSA) due to gas phase chemistry - CPL_SO2_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of sulfur dioxide (SO2) due to gas phase chemistry - CPL_H2SO4_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of sulfuric acid (H2SO4 gas) due to gas phase chemistry - CPL_NH3_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of ammonia (NH3) due to gas phase chemistry - CPL_SOAG_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of Secondary Organic Aerosols (SOA gas) due to gas phase chemistry -# - CPL_S_DMS_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of dimethyl sulfide (DMS) due to gas phase chemistry - CPL_S_MSA_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of methanesulfonic acid (MSA) due to gas phase chemistry - CPL_S_SO2_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of sulfur dioxide (SO2) due to gas phase chemistry - CPL_S_H2SO4_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of sulfuric acid (H2SO4 gas) due to gas phase chemistry - CPL_S_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of total sulfur due to gas phase chemistry - CPL_N_NH3_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of ammonia (NH3) due to gas phase chemistry - CPL_N_gas | kg m-2 s-1 | xy | | | | | | Column integrated tendency of total nitrogen due to gas phase chemistry -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ - DDT_DMS_aq | mol mol-1 s-1 | xyz | C | | | | | Dimethyl sulfide (DMS gas) tendency due to aqueous phase chemistry - DDT_MSA_aq | mol mol-1 s-1 | xyz | C | | | | | Methanesulfonic acid (MSA gas) tendency due to aqueous phase chemistry - DDT_SO2_aq | mol mol-1 s-1 | xyz | C | | | | | Sulfur dioxide (SO2 gas) tendency due to aqueous phase chemistry - DDT_H2SO4_aq | mol mol-1 s-1 | xyz | C | | | | | Sulfuric acid (H2SO4 gas) tendency due to aqueous phase chemistry - DDT_NH3_aq | mol mol-1 s-1 | xyz | C | | | | | Ammonia (NH3 gas) tendency due to aqueous phase chemistry - DDT_SOAG_aq | mol mol-1 s-1 | xyz | C | | | | | Secondary Organic Aerosols (SOA gas) tendency due to aqueous phase chemistry - _DMS_aq | mol mol-1 s-1 | xyz | C | | | | | Dimethyl sulfide (DMS gas) before aqueous phase chemistry - _MSA_aq | mol mol-1 s-1 | xyz | C | | | | | Methanesulfonic acid (MSA gas) before aqueous phase chemistry - _SO2_aq | mol mol-1 s-1 | xyz | C | | | | | Sulfur dioxide (SO2 gas) before aqueous phase chemistry - _H2SO4_aq | mol mol-1 s-1 | xyz | C | | | | | Sulfuric acid (H2SO4 gas) before aqueous phase chemistry - _NH3_aq | mol mol-1 s-1 | xyz | C | | | | | Ammonia (NH3 gas) tendency before aqueous phase chemistry - _SOAG_aq | mol mol-1 s-1 | xyz | C | | | | | Secondary Organic Aerosols (SOA gas) before aqueous phase chemistry -# -------------------------------------------------------------------------------------------------- - pSO4_aq | kg kg-1 s-1 | xyz | C | | | | | production rate of sulfate in aqueous phase - pNH4_aq | kg kg-1 s-1 | xyz | C | | | | | production rate of ammonium in aqueous phase - pSO4_aq_SO2 | kg kg-1 s-1 | xyz | C | | | | | production rate of sulfate from sulfur dioxide (SO2) in aqueous phase - pSO4_aq_H2SO4 | kg kg-1 s-1 | xyz | C | | | | | production rate of sulfate from irreversible uptake of sulfuric acid vapor (H2SO4) in aqueous phase - pNH4_aq_NH3 | kg kg-1 s-1 | xyz | C | | | | | production rate of ammonium from dissociation of ammonia (NH3) in aqueous phase -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ -# VOC exports are defined in the code -# pSOA_ANTHRO_VOC | kg m-3 s-1 | xyz | C | | | | | Production of SOA from Anthropogenic + Biofuel Burning VOC -# pSOA_ANTHRO_VOC_MMRday| kg m-3 d-1 | xyz | C | | | | | Production of SOA from Anthropogenic + Biofuel Burning VOC -# pSOA_BIOB_VOC | kg m-3 s-1 | xyz | C | | | | | Production of SOA from Biomass Burning VOC -# pSOA_BIOB_VOC_MMRday | kg m-3 d-1 | xyz | C | | | | | Production of SOA from Biomass Burning VOC -# ----------------------|---------------|-----|---|----|---|---|-----|------------------------------ -# OCS exports are defined in the code -# pSO2_OCS | kg kg-1 s-1 | xyz | C | | | | | Production of SO2 from OCS -# pSO2_OCS_OH | kg kg-1 s-1 | xyz | C | | | | | Production of SO2 from OCS+OH -# pSO2_OCS_O3p | kg kg-1 s-1 | xyz | C | | | | | Production of SO2 from OCS+O3p -# pSO2_OCS_jOCS | kg kg-1 s-1 | xyz | C | | | | | Production of SO2 from OCS photolysis -# lOCS | cm-3 s-1 | xyz | C | | | | | Loss rate of OCS (molec cm-3 s-1) -# lOCS_OH | cm-3 s-1 | xyz | C | | | | | Loss rate of OCS from OCS+OH(molec cm-3 s-1) -# lOCS_O3p | cm-3 s-1 | xyz | C | | | | | Loss rate of OCS from OCS+O3p(molec cm-3 s-1) -# lOCS_jOCS | cm-3 s-1 | xyz | C | | | | | Loss rate of OCS from photolysis (molec cm-3 s-1) -# pScl_OCS | kg m-2 | xy | | | | | | Production of SO2 from OCS (column integrated) - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection, or "S" for self (add to EXPORT state); leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column - - -# ----------------------|------------|-----|---|----|---|---|-----|------|----|----|---------|------ -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# ----------------------|------------|-----|---|----|---|---|-----|------|----|----|---------|------ -# ----------------------|------------|-----|---|----|---|---|-----|------|----|----|---------|------ - - diff --git a/GEOSachem_GridComp/kpp/gas/Makefile_kpp_achem_gas b/GEOSachem_GridComp/kpp/gas/Makefile_kpp_achem_gas deleted file mode 100644 index efcbdaa1..00000000 --- a/GEOSachem_GridComp/kpp/gas/Makefile_kpp_achem_gas +++ /dev/null @@ -1,178 +0,0 @@ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# User: Set here the F90 compiler and options -# Pedefined compilers: INTEL, PGF, HPUX, LAHEY -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -#COMPILER = G95 -#COMPILER = LAHEY -COMPILER = INTEL -#COMPILER = PGF -#COMPILER = HPUX -#COMPILER = GFORTRAN - -FC_G95 = g95 -FOPT_G95 = -cpp -O -pg -fbounds-check -fimplicit-none -Wall -ftrace=full - -FC_LAHEY = lf95 -# More aggressive for production runs: -#FOPT_LAHEY = -Cpp --pca -O -# More checking for debugging: -FOPT_LAHEY = -Cpp --chk a,e,s,u --pca --ap -O0 -g --trap --trace --chkglobal - -FC_INTEL = ifort -# More aggressive for production runs: -#FOPT_INTEL = -cpp -O -fp-model precise -pc80 -prec_div -# More checking for debugging: -FOPT_INTEL = -cpp -O0 -fp-model strict -implicitnone -ftrapuv \ - -debug all -check all -warn all - -FC_PGF = pgf90 -# More aggressive for production runs: -FOPT_PGF = -Mpreprocess -O -fast -pc 80 -Kieee -# More checking for debugging: -#FOPT_PGF = -Mpreprocess -O0 -Mbounds -Mchkfpstk -Mchkptr -Mchkstk \ -# -Ktrap=fp -pc 80 -Kieee - -FC_HPUX = f90 -FOPT_HPUX = -O -u +Oall +check=on - -FC_GFORTRAN = gfortran -FOPT_GFORTRAN = -cpp -O - -# define FULL_ALGEBRA for non-sparse integration -FC = $(FC_$(COMPILER)) -FOPT = $(FOPT_$(COMPILER)) # -DFULL_ALGEBRA - -LIBS = -#LIBS = -llapack -lblas - -# Command to create Matlab mex gateway routines -# Note: use $(FC) as the mex Fortran compiler -MEX = mex - -GENSRC = kpp_achem_gas_Precision.f90 \ - kpp_achem_gas_Parameters.f90 \ - kpp_achem_gas_Global.f90 - -GENOBJ = kpp_achem_gas_Precision.o \ - kpp_achem_gas_Parameters.o \ - kpp_achem_gas_Global.o - -FUNSRC = kpp_achem_gas_Function.f90 -FUNOBJ = kpp_achem_gas_Function.o - -JACSRC = kpp_achem_gas_JacobianSP.f90 kpp_achem_gas_Jacobian.f90 -JACOBJ = kpp_achem_gas_JacobianSP.o kpp_achem_gas_Jacobian.o - -HESSRC = kpp_achem_gas_HessianSP.f90 kpp_achem_gas_Hessian.f90 -HESOBJ = kpp_achem_gas_HessianSP.o kpp_achem_gas_Hessian.o - -STMSRC = kpp_achem_gas_StoichiomSP.f90 kpp_achem_gas_Stoichiom.f90 -STMOBJ = kpp_achem_gas_StoichiomSP.o kpp_achem_gas_Stoichiom.o - -UTLSRC = kpp_achem_gas_Rates.f90 kpp_achem_gas_Util.f90 kpp_achem_gas_Monitor.f90 -UTLOBJ = kpp_achem_gas_Rates.o kpp_achem_gas_Util.o kpp_achem_gas_Monitor.o - -LASRC = kpp_achem_gas_LinearAlgebra.f90 -LAOBJ = kpp_achem_gas_LinearAlgebra.o - -STOCHSRC = kpp_achem_gas_Stochastic.f90 -STOCHOBJ = kpp_achem_gas_Stochastic.o - -MAINSRC = kpp_achem_gas_Main.f90 kpp_achem_gas_Initialize.f90 kpp_achem_gas_Integrator.f90 kpp_achem_gas_Model.f90 -MAINOBJ = kpp_achem_gas_Main.o kpp_achem_gas_Initialize.o kpp_achem_gas_Integrator.o kpp_achem_gas_Model.o - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# User: modify the line below to include only the -# objects needed by your application -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -ALLOBJ = $(GENOBJ) $(FUNOBJ) $(JACOBJ) $(HESOBJ) $(STMOBJ) \ - $(UTLOBJ) $(LAOBJ) - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# User: modify the line below to include only the -# executables needed by your application -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -all: exe - -exe: $(ALLOBJ) $(MAINOBJ) - $(FC) $(FOPT) $(ALLOBJ) $(MAINOBJ) $(LIBS) -o kpp_achem_gas.exe - -stochastic:$(ALLOBJ) $(STOCHOBJ) $(MAINOBJ) - $(FC) $(FOPT) $(ALLOBJ) $(STOCHOBJ) $(MAINOBJ) $(LIBS) \ - -o kpp_achem_gas_stochastic.exe - -mex: $(ALLOBJ) - $(MEX) FC#$(FC) -fortran -O kpp_achem_gas_mex_Fun.f90 $(ALLOBJ) - $(MEX) FC#$(FC) -fortran -O kpp_achem_gas_mex_Jac_SP.f90 $(ALLOBJ) - $(MEX) FC#$(FC) -fortran -O kpp_achem_gas_mex_Hessian.f90 $(ALLOBJ) - -clean: - rm -f kpp_achem_gas*.o kpp_achem_gas*.mod \ - kpp_achem_gas*.dat kpp_achem_gas.exe kpp_achem_gas*.mexglx \ - kpp_achem_gas.map - -distclean: - rm -f kpp_achem_gas*.o kpp_achem_gas*.mod \ - kpp_achem_gas*.dat kpp_achem_gas.exe kpp_achem_gas.map \ - kpp_achem_gas*.f90 kpp_achem_gas_*.mexglx - -kpp_achem_gas_Precision.o: kpp_achem_gas_Precision.f90 - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Parameters.o: kpp_achem_gas_Parameters.f90 \ - kpp_achem_gas_Precision.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Monitor.o: kpp_achem_gas_Monitor.f90 \ - kpp_achem_gas_Precision.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Global.o: kpp_achem_gas_Global.f90 \ - kpp_achem_gas_Parameters.o kpp_achem_gas_Precision.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Initialize.o: kpp_achem_gas_Initialize.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Function.o: kpp_achem_gas_Function.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Stochastic.o: kpp_achem_gas_Stochastic.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_JacobianSP.o: kpp_achem_gas_JacobianSP.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Jacobian.o: kpp_achem_gas_Jacobian.f90 $(GENOBJ) kpp_achem_gas_JacobianSP.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_LinearAlgebra.o: kpp_achem_gas_LinearAlgebra.f90 $(GENOBJ) kpp_achem_gas_JacobianSP.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Rates.o: kpp_achem_gas_Rates.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_HessianSP.o: kpp_achem_gas_HessianSP.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Hessian.o: kpp_achem_gas_Hessian.f90 $(GENOBJ) kpp_achem_gas_HessianSP.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_StoichiomSP.o: kpp_achem_gas_StoichiomSP.f90 $(GENOBJ) - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Stoichiom.o: kpp_achem_gas_Stoichiom.f90 $(GENOBJ) kpp_achem_gas_StoichiomSP.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Util.o: kpp_achem_gas_Util.f90 $(GENOBJ) kpp_achem_gas_Monitor.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Main.o: kpp_achem_gas_Main.f90 $(ALLOBJ) kpp_achem_gas_Initialize.o kpp_achem_gas_Model.o kpp_achem_gas_Integrator.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Model.o: kpp_achem_gas_Model.f90 $(ALLOBJ) kpp_achem_gas_Integrator.o - $(FC) $(FOPT) -c $< - -kpp_achem_gas_Integrator.o: kpp_achem_gas_Integrator.f90 $(ALLOBJ) - $(FC) $(FOPT) -c $< diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.def b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.def deleted file mode 100644 index 9f43a9f0..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.def +++ /dev/null @@ -1,30 +0,0 @@ -#INCLUDE kpp_achem_gas.spc -#INCLUDE kpp_achem_gas.eqn - -#CHECK S; N; - -#LOOKATALL -#MONITOR NO3; OH; DMS; MSA; SO2; H2SO4; NH3; - -#INITVALUES - DMS = 1.0e6; - NH3 = 2.0e7; - - NO3 = 3.0e6; - OH = 5.0e6; - - MSA = 0.0; - SO2 = 1.0e7; - - H2SO4 = 0.0; - -#INLINE F90_INIT - temp = 270.0 - - c_O2 = 0.5e19 - c_air = 2.0e19 - - dt = 1800.0 ! seconds - tstart = 0.0 - tend = tstart + 1800 -#ENDINLINE diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.eqn b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.eqn deleted file mode 100644 index 7084f137..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.eqn +++ /dev/null @@ -1,64 +0,0 @@ -#EQUATIONS { gas phase reactions used in the sulfur scheme} - DMS + OH = SO2 : 1.2d-11 * exp(-260.0d0 / temp); - DMS + OH = 0.75 SO2 + 0.25 MSA : k_DMS_OH(c_O2, temp); - DMS + NO3 = SO2 : 1.9d-13 * exp( 520.0d0 / temp); - SO2 + OH = H2SO4 : k_SO2_OH(c_air, temp); - NH3 + OH = H2O : 1.7d-12 * exp(-710.0d0 / temp); - -#INLINE F90_GLOBAL -real(dp) :: c_O2 -real(dp) :: c_air -#ENDINLINE - - - -#INLINE F90_RATES -real(dp) function k_DMS_OH(c_O2, T) - ! - ! reaction rate for OH addition pathway: - ! DMS + OH = 0.75SO2 + 0.25MSA - ! - - implicit none - - ! inputs - real(dp), intent(in) :: c_O2 - real(dp), intent(in) :: T - - ! local - - ! rate - !k_DMS_OH = c_O2 * 1.7d-42 * exp(7810_dp/T) / & - ! (1_dp + c_O2 * 5.5d-31 * exp(7460_dp/T)) - - k_DMS_OH = c_O2 * 1.7d-11 * exp(7810_dp/T) / & - (1.0d31 + c_O2 * 5.5d0 * exp(7460_dp/T)) - -end function k_DMS_OH - - -real(dp) function k_SO2_OH(c_air, T) - ! - ! reaction rate for: - ! SO2 + OH = H2SO4 - ! - - implicit none - - ! inputs - real(dp), intent(in) :: c_air - real(dp), intent(in) :: T - - ! local - real(dp) :: k_0, k_inf - - ! rate - k_0 = 3.0d-31 * (300_dp/T)**3.3 - k_inf = 1.5d-12 - - k_SO2_OH = ((k_0 * c_air) / (1.0_dp + k_0 * c_air / k_inf)) * & - 0.6_dp**(1.0_dp / (1.0_dp + (log10(k_0 * c_air / k_inf))**2)) - -end function k_SO2_OH -#ENDINLINE - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.kpp b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.kpp deleted file mode 100644 index 6b686d41..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.kpp +++ /dev/null @@ -1,17 +0,0 @@ -#MODEL kpp_achem_gas - -#LANGUAGE Fortran90 -#DOUBLE on - -#DRIVER general -#INTFILE kpp_lsode -#JACOBIAN SPARSE_LU_ROW -#FUNCTION AGGREGATE - -#REORDER on -#DUMMYINDEX on -#HESSIAN on -#STOICMAT on -#EQNTAGS off -#MEX on - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.spc b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.spc deleted file mode 100644 index 4e1d62e9..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas.spc +++ /dev/null @@ -1,16 +0,0 @@ -#INCLUDE atoms - -#DEFVAR - DMS = S + ignore; {CH3-S-CH3} - MSA = S + ignore; {CH3SO3H} - SO2 = S + ignore; - SO4 = S + ignore; - H2SO4 = S + ignore; - - NH3 = N + ignore; - -#DEFFIX - NO3 = ignore; - OH = ignore; - H2O = ignore; - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Function.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Function.f90 deleted file mode 100644 index ab127763..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Function.f90 +++ /dev/null @@ -1,81 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! The ODE Function of Chemical Model File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Function.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Function - - USE kpp_achem_gas_Parameters - IMPLICIT NONE - -! A - Rate for each equation - REAL(kind=dp) :: A(NREACT) - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Fun - time derivatives of variables - Agregate form -! Arguments : -! V - Concentrations of variable species (local) -! F - Concentrations of fixed species (local) -! RCT - Rate constants (local) -! Vdot - Time derivative of variable species concentrations -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Fun ( V, F, RCT, Vdot ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! F - Concentrations of fixed species (local) - REAL(kind=dp) :: F(NFIX) -! RCT - Rate constants (local) - REAL(kind=dp) :: RCT(NREACT) -! Vdot - Time derivative of variable species concentrations - REAL(kind=dp) :: Vdot(NVAR) - - -! Computation of equation rates - A(1) = RCT(1)*V(1)*F(2) - A(2) = RCT(2)*V(1)*F(2) - A(3) = RCT(3)*V(1)*F(1) - A(4) = RCT(4)*V(2)*F(2) - A(5) = RCT(5)*V(3)*F(2) - -! Aggregate function - Vdot(1) = -A(1)-A(2)-A(3) - Vdot(2) = A(1)+0.75*A(2)+A(3)-A(4) - Vdot(3) = -A(5) - Vdot(4) = 0.25*A(2) - Vdot(5) = A(4) - -END SUBROUTINE Fun - -! End of Fun function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Function - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Global.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Global.f90 deleted file mode 100644 index e2a9e0ad..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Global.f90 +++ /dev/null @@ -1,81 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Global Data Module File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Global.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Global - - USE kpp_achem_gas_Parameters, ONLY: dp, NSPEC, NVAR, NFIX, NREACT - PUBLIC - SAVE - - -! Declaration of global variables - -! C - Concentration of all species - REAL(kind=dp) :: C(NSPEC) -! VAR - Concentrations of variable species (global) - REAL(kind=dp) :: VAR(NVAR) -! FIX - Concentrations of fixed species (global) - REAL(kind=dp) :: FIX(NFIX) -! VAR, FIX are chunks of array C - EQUIVALENCE( C(1),VAR(1) ) - EQUIVALENCE( C(6),FIX(1) ) -! RCONST - Rate constants (global) - REAL(kind=dp) :: RCONST(NREACT) -! TIME - Current integration time - REAL(kind=dp) :: TIME -! SUN - Sunlight intensity between [0,1] - REAL(kind=dp) :: SUN -! TEMP - Temperature - REAL(kind=dp) :: TEMP -! RTOLS - (scalar) Relative tolerance - REAL(kind=dp) :: RTOLS -! TSTART - Integration start time - REAL(kind=dp) :: TSTART -! TEND - Integration end time - REAL(kind=dp) :: TEND -! DT - Integration step - REAL(kind=dp) :: DT -! ATOL - Absolute tolerance - REAL(kind=dp) :: ATOL(NVAR) -! RTOL - Relative tolerance - REAL(kind=dp) :: RTOL(NVAR) -! STEPMIN - Lower bound for integration step - REAL(kind=dp) :: STEPMIN -! STEPMAX - Upper bound for integration step - REAL(kind=dp) :: STEPMAX -! CFACTOR - Conversion factor for concentration units - REAL(kind=dp) :: CFACTOR -! DDMTYPE - DDM sensitivity w.r.t.: 0=init.val., 1=params - INTEGER :: DDMTYPE - -! INLINED global variable declarations - -real(dp) :: c_O2 -real(dp) :: c_air - -! INLINED global variable declarations - - -END MODULE kpp_achem_gas_Global - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Hessian.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Hessian.f90 deleted file mode 100644 index 2e84afb0..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Hessian.f90 +++ /dev/null @@ -1,153 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Hessian File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Hessian.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Hessian - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_HessianSP - - IMPLICIT NONE - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Hessian - function for Hessian (Jac derivative w.r.t. variables) -! Arguments : -! V - Concentrations of variable species (local) -! F - Concentrations of fixed species (local) -! RCT - Rate constants (local) -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Hessian ( V, F, RCT, HESS ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! F - Concentrations of fixed species (local) - REAL(kind=dp) :: F(NFIX) -! RCT - Rate constants (local) - REAL(kind=dp) :: RCT(NREACT) -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) - REAL(kind=dp) :: HESS(NHESS) - -! -------------------------------------------------------- -! Note: HESS is represented in coordinate sparse format: -! HESS(m) = d^2 f_i / dv_j dv_k = d Jac_{i,j} / dv_k -! where i = IHESS_I(m), j = IHESS_J(m), k = IHESS_K(m). -! -------------------------------------------------------- -! Note: d^2 f_i / dv_j dv_k = d^2 f_i / dv_k dv_j, -! therefore only the terms d^2 f_i / dv_j dv_k -! with j <= k are computed and stored in HESS. -! -------------------------------------------------------- - -! Local variables -! D2A - Second derivatives of equation rates - REAL(kind=dp) :: D2A(1) - -! Computation of the second derivatives of equation rates - -! Computation of the Jacobian derivative - -END SUBROUTINE Hessian - -! End of Hessian function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! HessTR_Vec - Hessian transposed times user vectors -! Arguments : -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) -! U1 - User vector -! U2 - User vector -! HTU - Transposed Hessian times user vectors: (Hess x U2)^T * U1 = [d (Jac^T*U1)/d Var] * U2 -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE HessTR_Vec ( HESS, U1, U2, HTU ) - -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) - REAL(kind=dp) :: HESS(NHESS) -! U1 - User vector - REAL(kind=dp) :: U1(NVAR) -! U2 - User vector - REAL(kind=dp) :: U2(NVAR) -! HTU - Transposed Hessian times user vectors: (Hess x U2)^T * U1 = [d (Jac^T*U1)/d Var] * U2 - REAL(kind=dp) :: HTU(NVAR) - -! Compute the vector HTU =(Hess x U2)^T * U1 = d (Jac^T*U1)/d Var * U2 - HTU(1) = 0 - HTU(2) = 0 - HTU(3) = 0 - HTU(4) = 0 - HTU(5) = 0 - -END SUBROUTINE HessTR_Vec - -! End of HessTR_Vec function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Hess_Vec - Hessian times user vectors -! Arguments : -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) -! U1 - User vector -! U2 - User vector -! HU - Hessian times user vectors: (Hess x U2) * U1 = [d (Jac*U1)/d Var] * U2 -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Hess_Vec ( HESS, U1, U2, HU ) - -! HESS - Hessian of Var (i.e. the 3-tensor d Jac / d Var) - REAL(kind=dp) :: HESS(NHESS) -! U1 - User vector - REAL(kind=dp) :: U1(NVAR) -! U2 - User vector - REAL(kind=dp) :: U2(NVAR) -! HU - Hessian times user vectors: (Hess x U2) * U1 = [d (Jac*U1)/d Var] * U2 - REAL(kind=dp) :: HU(NVAR) - -! Compute the vector HU =(Hess x U2) * U1 = d (Jac*U1)/d Var * U2 - HU(1) = 0 - HU(2) = 0 - HU(3) = 0 - HU(4) = 0 - HU(5) = 0 - -END SUBROUTINE Hess_Vec - -! End of Hess_Vec function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Hessian - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_HessianSP.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_HessianSP.f90 deleted file mode 100644 index 5143fb5e..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_HessianSP.f90 +++ /dev/null @@ -1,39 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Sparse Hessian Data Structures File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_HessianSP.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_HessianSP - - PUBLIC - SAVE - - -! Hessian Sparse Data -! - - INTEGER, DIMENSION(1) :: IHESS_I - INTEGER, DIMENSION(1) :: IHESS_J - INTEGER, DIMENSION(1) :: IHESS_K - -END MODULE kpp_achem_gas_HessianSP - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Initialize.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Initialize.f90 deleted file mode 100644 index 2548290d..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Initialize.f90 +++ /dev/null @@ -1,92 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Initialization File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Initialize.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Initialize - - USE kpp_achem_gas_Parameters, ONLY: dp, NVAR, NFIX - IMPLICIT NONE - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Initialize - function to initialize concentrations -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Initialize ( ) - - - USE kpp_achem_gas_Global - - INTEGER :: i - REAL(kind=dp) :: x - - CFACTOR = 1.000000e+00_dp - - x = (0.)*CFACTOR - DO i = 1, NVAR - VAR(i) = x - END DO - - x = (0.)*CFACTOR - DO i = 1, NFIX - FIX(i) = x - END DO - - VAR(1) = (1.0e6)*CFACTOR - VAR(2) = (1.0e7)*CFACTOR - VAR(3) = (2.0e7)*CFACTOR - VAR(4) = (0.0)*CFACTOR - VAR(5) = (0.0)*CFACTOR - FIX(1) = (3.0e6)*CFACTOR - FIX(2) = (5.0e6)*CFACTOR -! constant rate coefficients -! END constant rate coefficients - -! INLINED initializations - - temp = 270.0 - - c_O2 = 0.5e19 - c_air = 2.0e19 - - dt = 1800.0 ! seconds - tstart = 0.0 - tend = tstart + 1800 - -! End INLINED initializations - - -END SUBROUTINE Initialize - -! End of Initialize function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Initialize - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Integrator.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Integrator.f90 deleted file mode 100644 index 220fc33e..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Integrator.f90 +++ /dev/null @@ -1,3468 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Numerical Integrator (Time-Stepping) File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Integrator.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! INTEGRATE - Integrator routine -! Arguments : -! TIN - Start Time for Integration -! TOUT - End Time for Integration -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! -! LSODE - Stiff method based on backward differentiation formulas (BDF) ! -! By default the code employs the KPP sparse linear algebra routines ! -! Compile with -DFULL_ALGEBRA to use full linear algebra (LAPACK) ! -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! -! A. Sandu - version of July 2005 - -MODULE kpp_achem_gas_Integrator - - USE kpp_achem_gas_Precision - USE kpp_achem_gas_Global, ONLY: FIX, RCONST, TIME, ATOL, RTOL - USE kpp_achem_gas_Parameters, ONLY: NVAR, NSPEC, NFIX, LU_NONZERO - USE kpp_achem_gas_JacobianSP, ONLY: LU_DIAG - USE kpp_achem_gas_LinearAlgebra, ONLY: KppDecomp, KppSolve, & - Set2zero, WLAMCH - - IMPLICIT NONE - PUBLIC - SAVE - - !~~~> Statistics on the work performed by the LSODE method - INTEGER :: Nfun,Njac,Nstp,Nacc,Nrej,Ndec,Nsol,Nsng - INTEGER, PARAMETER :: ifun=1, ijac=2, istp=3, iacc=4, & - irej=5, idec=6, isol=7, isng=8, itexit=1, ihexit=2 - ! SDIRK method coefficients - REAL(kind=dp) :: rkAlpha(5,4), rkBeta(5,4), rkD(4,5), & - rkGamma, rkA(5,5), rkB(5), rkC(5) - - ! mz_rs_20050717: TODO: use strings of IERR_NAMES for error messages - ! description of the error numbers IERR - CHARACTER(LEN=50), PARAMETER, DIMENSION(-8:1) :: IERR_NAMES = (/ & - 'Matrix is repeatedly singular ', & ! -8 - 'Step size too small ', & ! -7 - 'No of steps exceeds maximum bound ', & ! -6 - 'Improper tolerance values ', & ! -5 - 'FacMin/FacMax/FacRej must be positive ', & ! -4 - 'Hmin/Hmax/Hstart must be positive ', & ! -3 - 'Improper value for maximal no of Newton iterations', & ! -2 - 'Improper value for maximal no of steps ', & ! -1 - ' ', & ! 0 (not used) - 'Success ' /) ! 1 - -CONTAINS - -SUBROUTINE INTEGRATE( TIN, TOUT, & - ICNTRL_U, RCNTRL_U, ISTATUS_U, RSTATUS_U, IERR_U ) - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - IMPLICIT NONE - - REAL(kind=dp), INTENT(IN) :: TIN ! Start Time - REAL(kind=dp), INTENT(IN) :: TOUT ! End Time - ! Optional input parameters and statistics - INTEGER, INTENT(IN), OPTIONAL :: ICNTRL_U(20) - REAL(kind=dp), INTENT(IN), OPTIONAL :: RCNTRL_U(20) - INTEGER, INTENT(OUT), OPTIONAL :: ISTATUS_U(20) - REAL(kind=dp), INTENT(OUT), OPTIONAL :: RSTATUS_U(20) - INTEGER, INTENT(OUT), OPTIONAL :: IERR_U - - REAL(kind=dp) :: RCNTRL(20), RSTATUS(20) - INTEGER :: ICNTRL(20), ISTATUS(20), IERR -!!$ INTEGER, SAVE :: Ntotal = 0 - - ICNTRL(:) = 0 - RCNTRL(:) = 0.0_dp - ISTATUS(:) = 0 - RSTATUS(:) = 0.0_dp - - ICNTRL(5) = 2 ! maximal order - - ! If optional parameters are given, and if they are >0, - ! then they overwrite default settings. - IF (PRESENT(ICNTRL_U)) THEN - WHERE(ICNTRL_U(:) > 0) ICNTRL(:) = ICNTRL_U(:) - END IF - IF (PRESENT(RCNTRL_U)) THEN - WHERE(RCNTRL_U(:) > 0) RCNTRL(:) = RCNTRL_U(:) - END IF - - CALL KppLsode( TIN,TOUT,VAR,RTOL,ATOL, & - RCNTRL,ICNTRL,RSTATUS,ISTATUS,IERR ) - -! INTEGER ITASK, ISTATE, NG, NEQ, IOUT, JROOT, ISTATS, & -! IERROR, I -! DOUBLE PRECISION ATOL, RTOL, RSTATS, T, TOUT, Y -! DIMENSION JROOT(2) -! TYPE(VODE_OPTS) :: OPTIONS -! IERROR = 0 -! ITASK = 1 -! ISTATE = 1 -! NG = 2 -! OPTIONS = SET_OPTS(DENSE_J=.TRUE.,RELERR=RTOL, & -! ABSERR_VECTOR=ATOL,NEVENTS=NG) -! CALL DVODE_F90(FEX,NEQ,Y,TIN,TOUT,ITASK,ISTATE,OPTIONS,G_FCN=GEX) -! CALL GET_STATS(RSTATS, ISTATS, NG, JROOT) - - - STEPMIN = RSTATUS(ihexit) ! Save last step - - ! if optional parameters are given for output they to return information - IF (PRESENT(ISTATUS_U)) ISTATUS_U(:) = ISTATUS(1:20) - IF (PRESENT(RSTATUS_U)) RSTATUS_U(:) = RSTATUS(1:20) - IF (PRESENT(IERR_U)) THEN - IF (IERR==2) THEN ! DLSODE returns "2" after successful completion - IERR_U = 1 ! IERR_U will return "1" for successful completion - ELSE - IERR_U = IERR - ENDIF - ENDIF - - END SUBROUTINE INTEGRATE - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE KppLsode( TIN,TOUT,Y,RelTol,AbsTol, & - RCNTRL,ICNTRL,RSTATUS,ISTATUS,IERR ) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -!~~~> INPUT PARAMETERS: -! -! Note: For input parameters equal to zero the default values of the -! corresponding variables are used. -! -! Note: For input parameters equal to zero the default values of the -! corresponding variables are used. -!~~~> -! ICNTRL(1) = not used -! -! ICNTRL(2) = 0: AbsTol, RelTol are NVAR-dimensional vectors -! = 1: AbsTol, RelTol are scalars -! -! ICNTRL(3) = not used -! -! ICNTRL(4) -> maximum number of integration steps -! For ICNTRL(4)=0 the default value of 100000 is used -! -! ICNTRL(5) -> maximum order of the integration formula allowed -! -!~~~> Real parameters -! -! RCNTRL(1) -> Hmin, lower bound for the integration step size -! It is strongly recommended to keep Hmin = ZERO -! RCNTRL(2) -> Hmax, upper bound for the integration step size -! RCNTRL(3) -> Hstart, starting value for the integration step size -! -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -!~~~> OUTPUT PARAMETERS: -! -! Note: each call to Rosenbrock adds the current no. of fcn calls -! to previous value of ISTATUS(1), and similar for the other params. -! Set ISTATUS(1:10) = 0 before call to avoid this accumulation. -! -! ISTATUS(1) = No. of function calls -! ISTATUS(2) = No. of jacobian calls -! ISTATUS(3) = No. of steps -! -! RSTATUS(1) -> Texit, the time corresponding to the -! computed Y upon return -! RSTATUS(2) -> Hexit, last predicted step before exit -! For multiple restarts, use Hexit as Hstart in the following run -! -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - IMPLICIT NONE - REAL(kind=dp) :: Y(NVAR), AbsTol(NVAR), RelTol(NVAR), TIN, TOUT - REAL(kind=dp) :: RCNTRL(20), RSTATUS(20) - INTEGER :: ICNTRL(20), ISTATUS(20) - INTEGER, PARAMETER :: LRW = 25 + 9*NVAR+2*NVAR*NVAR, & - LIW = 32 + NVAR - REAL(kind=dp) :: RWORK(LRW), RPAR(1) - INTEGER :: IWORK(LIW), IPAR(1), ITOL, ITASK, & - IERR, IOPT, MF - - !~~~> NORMAL COMPUTATION - ITASK = 1 - IERR = 1 - IOPT = 1 ! 0=no/1=use optional input - - RWORK(1:30) = 0.0d0 - IWORK(1:30) = 0 - - IF (ICNTRL(2)==0) THEN - ITOL = 4 ! Abs/RelTol are both vectors - ELSE - ITOL = 1 ! Abs/RelTol are both scalars - END IF - IWORK(6) = ICNTRL(4) ! max number of internal steps - IWORK(5) = ICNTRL(5) ! maximal order - - MF = 21 !~~~> stiff case, analytic full Jacobian - - RWORK(5) = RCNTRL(3) ! Hstart - RWORK(6) = RCNTRL(2) ! Hmax - RWORK(7) = RCNTRL(1) ! Hmin - - CALL DLSODE ( FUN_CHEM, NVAR, Y, TIN, TOUT, ITOL, RelTol, AbsTol, ITASK,& - IERR, IOPT, RWORK, LRW, IWORK, LIW, JAC_CHEM, MF) - - ISTATUS(1) = IWORK(12) ! Number of function evaluations - ISTATUS(2) = IWORK(13) ! Number of Jacobian evaluations - ISTATUS(3) = IWORK(11) ! Number of steps - - RSTATUS(1) = TOUT ! mz_rs_20050717 - RSTATUS(2) = RWORK(11) ! mz_rs_20050717 - - END SUBROUTINE KppLsode -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!DECK DLSODE - SUBROUTINE DLSODE (F, NEQ, Y, T, TOUT, ITOL, RelTol, AbsTol, ITASK, & - ISTATE, IOPT, RWORK, LRW, IWORK, LIW, JAC, MF) - EXTERNAL F, JAC - INTEGER NEQ, ITOL, ITASK, ISTATE, IOPT, LRW, LIW, IWORK(LIW), MF - REAL(kind=dp) Y(*), T, TOUT, RelTol(*), AbsTol(*), RWORK(LRW) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!***BEGIN PROLOGUE DLSODE -!***PURPOSE Livermore Solver for Ordinary Differential Equations. -! DLSODE solves the initial-value problem for stiff or -! nonstiff systems of first-order ODE's, -! dy/dt = f(t,y), or, in component form, -! dy(i)/dt = f(i) = f(i,t,y(1),y(2),...,y(N)), i=1,...,N. -!***CATEGORY I1A -!***TYPE REAL(kind=dp) (SLSODE-S, DLSODE-D) -!***KEYWORDS ORDINARY DIFFERENTIAL EQUATIONS, INITIAL VALUE PROBLEM, -! STIFF, NONSTIFF -!***AUTHOR Hindmarsh, Alan C., (LLNL) -! Center for Applied Scientific Computing, L-561 -! Lawrence Livermore National Laboratory -! Livermore, CA 94551. -!***DESCRIPTION -! -! NOTE: The "Usage" and "Arguments" sections treat only a subset of -! available options, in condensed fashion. The options -! covered and the information supplied will support most -! standard uses of DLSODE. -! -! For more sophisticated uses, full details on all options are -! given in the concluding section, headed "Long Description." -! A synopsis of the DLSODE Long Description is provided at the -! beginning of that section; general topics covered are: -! - Elements of the call sequence; optional input and output -! - Optional supplemental routines in the DLSODE package -! - internal COMMON block -! -! *Usage: -! Communication between the user and the DLSODE package, for normal -! situations, is summarized here. This summary describes a subset -! of the available options. See "Long Description" for complete -! details, including optional communication, nonstandard options, -! and instructions for special situations. -! -! A sample program is given in the "Examples" section. -! -! Refer to the argument descriptions for the definitions of the -! quantities that appear in the following sample declarations. -! -! For MF = 10, -! PARAMETER (LRW = 20 + 16*NEQ, LIW = 20) -! For MF = 21 or 22, -! PARAMETER (LRW = 22 + 9*NEQ + NEQ**2, LIW = 20 + NEQ) -! For MF = 24 or 25, -! PARAMETER (LRW = 22 + 10*NEQ + (2*ML+MU)*NEQ, -! * LIW = 20 + NEQ) -! -! EXTERNAL F, JAC -! INTEGER NEQ, ITOL, ITASK, ISTATE, IOPT, LRW, IWORK(LIW), -! * LIW, MF -! REAL(kind=dp) Y(NEQ), T, TOUT, RelTol, AbsTol(ntol), RWORK(LRW) -! -! CALL DLSODE (F, NEQ, Y, T, TOUT, ITOL, RelTol, AbsTol, ITASK, -! * ISTATE, IOPT, RWORK, LRW, IWORK, LIW, JAC, MF) -! -! *Arguments: -! F :EXT Name of subroutine for right-hand-side vector f. -! This name must be declared EXTERNAL in calling -! program. The form of F must be: -! -! SUBROUTINE F (NEQ, T, Y, YDOT) -! INTEGER NEQ -! REAL(kind=dp) T, Y(*), YDOT(*) -! -! The inputs are NEQ, T, Y. F is to set -! -! YDOT(i) = f(i,T,Y(1),Y(2),...,Y(NEQ)), -! i = 1, ..., NEQ . -! -! NEQ :IN Number of first-order ODE's. -! -! Y :INOUT Array of values of the y(t) vector, of length NEQ. -! Input: For the first call, Y should contain the -! values of y(t) at t = T. (Y is an input -! variable only if ISTATE = 1.) -! Output: On return, Y will contain the values at the -! new t-value. -! -! T :INOUT Value of the independent variable. On return it -! will be the current value of t (normally TOUT). -! -! TOUT :IN Next point where output is desired (.NE. T). -! -! ITOL :IN 1 or 2 according as AbsTol (below) is a scalar or -! an array. -! -! RelTol :IN Relative tolerance parameter (scalar). -! -! AbsTol :IN Absolute tolerance parameter (scalar or array). -! If ITOL = 1, AbsTol need not be dimensioned. -! If ITOL = 2, AbsTol must be dimensioned at least NEQ. -! -! The estimated local error in Y(i) will be controlled -! so as to be roughly less (in magnitude) than -! -! EWT(i) = RelTol*ABS(Y(i)) + AbsTol if ITOL = 1, or -! EWT(i) = RelTol*ABS(Y(i)) + AbsTol(i) if ITOL = 2. -! -! Thus the local error test passes if, in each -! component, either the absolute error is less than -! AbsTol (or AbsTol(i)), or the relative error is less -! than RelTol. -! -! Use RelTol = 0.0 for pure absolute error control, and -! use AbsTol = 0.0 (or AbsTol(i) = 0.0) for pure relative -! error control. Caution: Actual (global) errors may -! exceed these local tolerances, so choose them -! conservatively. -! -! ITASK :IN Flag indicating the task DLSODE is to perform. -! Use ITASK = 1 for normal computation of output -! values of y at t = TOUT. -! -! ISTATE:INOUT Index used for input and output to specify the state -! of the calculation. -! Input: -! 1 This is the first call for a problem. -! 2 This is a subsequent call. -! Output: -! 1 Nothing was done, because TOUT was equal to T. -! 2 DLSODE was successful (otherwise, negative). -! Note that ISTATE need not be modified after a -! successful return. -! -1 Excess work done on this call (perhaps wrong -! MF). -! -2 Excess accuracy requested (tolerances too -! small). -! -3 Illegal input detected (see printed message). -! -4 Repeated error test failures (check all -! inputs). -! -5 Repeated convergence failures (perhaps bad -! Jacobian supplied or wrong choice of MF or -! tolerances). -! -6 Error weight became zero during problem -! (solution component i vanished, and AbsTol or -! AbsTol(i) = 0.). -! -! IOPT :IN Flag indicating whether optional inputs are used: -! 0 No. -! 1 Yes. (See "Optional inputs" under "Long -! Description," Part 1.) -! -! RWORK :WORK Real work array of length at least: -! 20 + 16*NEQ for MF = 10, -! 22 + 9*NEQ + NEQ**2 for MF = 21 or 22, -! 22 + 10*NEQ + (2*ML + MU)*NEQ for MF = 24 or 25. -! -! LRW :IN Declared length of RWORK (in user's DIMENSION -! statement). -! -! IWORK :WORK Integer work array of length at least: -! 20 for MF = 10, -! 20 + NEQ for MF = 21, 22, 24, or 25. -! -! If MF = 24 or 25, input in IWORK(1),IWORK(2) the -! lower and upper Jacobian half-bandwidths ML,MU. -! -! On return, IWORK contains information that may be -! of interest to the user: -! -! Name Location Meaning -! ----- --------- ----------------------------------------- -! NST IWORK(11) Number of steps taken for the problem so -! far. -! NFE IWORK(12) Number of f evaluations for the problem -! so far. -! NJE IWORK(13) Number of Jacobian evaluations (and of -! matrix LU decompositions) for the problem -! so far. -! NQU IWORK(14) Method order last used (successfully). -! LENRW IWORK(17) Length of RWORK actually required. This -! is defined on normal returns and on an -! illegal input return for insufficient -! storage. -! LENIW IWORK(18) Length of IWORK actually required. This -! is defined on normal returns and on an -! illegal input return for insufficient -! storage. -! -! LIW :IN Declared length of IWORK (in user's DIMENSION -! statement). -! -! JAC :EXT Name of subroutine for Jacobian matrix (MF = -! 21 or 24). If used, this name must be declared -! EXTERNAL in calling program. If not used, pass a -! dummy name. The form of JAC must be: -! -! SUBROUTINE JAC (NEQ, T, Y, ML, MU, PD, NROWPD) -! INTEGER NEQ, ML, MU, NROWPD -! REAL(kind=dp) T, Y(*), PD(NROWPD,*) -! -! See item c, under "Description" below for more -! information about JAC. -! -! MF :IN Method flag. Standard values are: -! 10 Nonstiff (Adams) method, no Jacobian used. -! 21 Stiff (BDF) method, user-supplied full Jacobian. -! 22 Stiff method, internally generated full -! Jacobian. -! 24 Stiff method, user-supplied banded Jacobian. -! 25 Stiff method, internally generated banded -! Jacobian. -! -! *Description: -! DLSODE solves the initial value problem for stiff or nonstiff -! systems of first-order ODE's, -! -! dy/dt = f(t,y) , -! -! or, in component form, -! -! dy(i)/dt = f(i) = f(i,t,y(1),y(2),...,y(NEQ)) -! (i = 1, ..., NEQ) . -! -! DLSODE is a package based on the GEAR and GEARB packages, and on -! the October 23, 1978, version of the tentative ODEPACK user -! interface standard, with minor modifications. -! -! The steps in solving such a problem are as follows. -! -! a. First write a subroutine of the form -! -! SUBROUTINE F (NEQ, T, Y, YDOT) -! INTEGER NEQ -! REAL(kind=dp) T, Y(*), YDOT(*) -! -! which supplies the vector function f by loading YDOT(i) with -! f(i). -! -! b. Next determine (or guess) whether or not the problem is stiff. -! Stiffness occurs when the Jacobian matrix df/dy has an -! eigenvalue whose real part is negative and large in magnitude -! compared to the reciprocal of the t span of interest. If the -! problem is nonstiff, use method flag MF = 10. If it is stiff, -! there are four standard choices for MF, and DLSODE requires the -! Jacobian matrix in some form. This matrix is regarded either -! as full (MF = 21 or 22), or banded (MF = 24 or 25). In the -! banded case, DLSODE requires two half-bandwidth parameters ML -! and MU. These are, respectively, the widths of the lower and -! upper parts of the band, excluding the main diagonal. Thus the -! band consists of the locations (i,j) with -! -! i - ML <= j <= i + MU , -! -! and the full bandwidth is ML + MU + 1 . -! -! c. If the problem is stiff, you are encouraged to supply the -! Jacobian directly (MF = 21 or 24), but if this is not feasible, -! DLSODE will compute it internally by difference quotients (MF = -! 22 or 25). If you are supplying the Jacobian, write a -! subroutine of the form -! -! SUBROUTINE JAC (NEQ, T, Y, ML, MU, PD, NROWPD) -! INTEGER NEQ, ML, MU, NRWOPD -! REAL(kind=dp) T, Y(*), PD(NROWPD,*) -! -! which provides df/dy by loading PD as follows: -! - For a full Jacobian (MF = 21), load PD(i,j) with df(i)/dy(j), -! the partial derivative of f(i) with respect to y(j). (Ignore -! the ML and MU arguments in this case.) -! - For a banded Jacobian (MF = 24), load PD(i-j+MU+1,j) with -! df(i)/dy(j); i.e., load the diagonal lines of df/dy into the -! rows of PD from the top down. -! - In either case, only nonzero elements need be loaded. -! -! d. Write a main program that calls subroutine DLSODE once for each -! point at which answers are desired. This should also provide -! for possible use of logical unit 6 for output of error messages -! by DLSODE. -! -! Before the first call to DLSODE, set ISTATE = 1, set Y and T to -! the initial values, and set TOUT to the first output point. To -! continue the integration after a successful return, simply -! reset TOUT and call DLSODE again. No other parameters need be -! reset. -! -! *Examples: -! The following is a simple example problem, with the coding needed -! for its solution by DLSODE. The problem is from chemical kinetics, -! and consists of the following three rate equations: -! -! dy1/dt = -.04*y1 + 1.E4*y2*y3 -! dy2/dt = .04*y1 - 1.E4*y2*y3 - 3.E7*y2**2 -! dy3/dt = 3.E7*y2**2 -! -! on the interval from t = 0.0 to t = 4.E10, with initial conditions -! y1 = 1.0, y2 = y3 = 0. The problem is stiff. -! -! The following coding solves this problem with DLSODE, using -! MF = 21 and printing results at t = .4, 4., ..., 4.E10. It uses -! ITOL = 2 and AbsTol much smaller for y2 than for y1 or y3 because y2 -! has much smaller values. At the end of the run, statistical -! quantities of interest are printed. -! -! EXTERNAL FEX, JEX -! INTEGER IOPT, IOUT, ISTATE, ITASK, ITOL, IWORK(23), LIW, LRW, -! * MF, NEQ -! REAL(kind=dp) AbsTol(3), RelTol, RWORK(58), T, TOUT, Y(3) -! NEQ = 3 -! Y(1) = 1.D0 -! Y(2) = 0.D0 -! Y(3) = 0.D0 -! T = 0.D0 -! TOUT = .4D0 -! ITOL = 2 -! RelTol = 1.D-4 -! AbsTol(1) = 1.D-6 -! AbsTol(2) = 1.D-10 -! AbsTol(3) = 1.D-6 -! ITASK = 1 -! ISTATE = 1 -! IOPT = 0 -! LRW = 58 -! LIW = 23 -! MF = 21 -! DO 40 IOUT = 1,12 -! CALL DLSODE (FEX, NEQ, Y, T, TOUT, ITOL, RelTol, AbsTol, ITASK, -! * ISTATE, IOPT, RWORK, LRW, IWORK, LIW, JEX, MF) -! WRITE(6,20) T, Y(1), Y(2), Y(3) -! 20 FORMAT(' At t =',D12.4,' y =',3D14.6) -! IF (ISTATE .LT. 0) GO TO 80 -! 40 TOUT = TOUT*10.D0 -! WRITE(6,60) IWORK(11), IWORK(12), IWORK(13) -! 60 FORMAT(/' No. steps =',i4,', No. f-s =',i4,', No. J-s =',i4) -! STOP -! 80 WRITE(6,90) ISTATE -! 90 FORMAT(///' Error halt.. ISTATE =',I3) -! STOP -! END -! -! SUBROUTINE FEX (NEQ, T, Y, YDOT) -! INTEGER NEQ -! REAL(kind=dp) T, Y(3), YDOT(3) -! YDOT(1) = -.04D0*Y(1) + 1.D4*Y(2)*Y(3) -! YDOT(3) = 3.D7*Y(2)*Y(2) -! YDOT(2) = -YDOT(1) - YDOT(3) -! RETURN -! END -! -! SUBROUTINE JEX (NEQ, T, Y, ML, MU, PD, NRPD) -! INTEGER NEQ, ML, MU, NRPD -! REAL(kind=dp) T, Y(3), PD(NRPD,3) -! PD(1,1) = -.04D0 -! PD(1,2) = 1.D4*Y(3) -! PD(1,3) = 1.D4*Y(2) -! PD(2,1) = .04D0 -! PD(2,3) = -PD(1,3) -! PD(3,2) = 6.D7*Y(2) -! PD(2,2) = -PD(1,2) - PD(3,2) -! RETURN -! END -! -! The output from this program (on a Cray-1 in single precision) -! is as follows. -! -! At t = 4.0000e-01 y = 9.851726e-01 3.386406e-05 1.479357e-02 -! At t = 4.0000e+00 y = 9.055142e-01 2.240418e-05 9.446344e-02 -! At t = 4.0000e+01 y = 7.158050e-01 9.184616e-06 2.841858e-01 -! At t = 4.0000e+02 y = 4.504846e-01 3.222434e-06 5.495122e-01 -! At t = 4.0000e+03 y = 1.831701e-01 8.940379e-07 8.168290e-01 -! At t = 4.0000e+04 y = 3.897016e-02 1.621193e-07 9.610297e-01 -! At t = 4.0000e+05 y = 4.935213e-03 1.983756e-08 9.950648e-01 -! At t = 4.0000e+06 y = 5.159269e-04 2.064759e-09 9.994841e-01 -! At t = 4.0000e+07 y = 5.306413e-05 2.122677e-10 9.999469e-01 -! At t = 4.0000e+08 y = 5.494530e-06 2.197825e-11 9.999945e-01 -! At t = 4.0000e+09 y = 5.129458e-07 2.051784e-12 9.999995e-01 -! At t = 4.0000e+10 y = -7.170603e-08 -2.868241e-13 1.000000e+00 -! -! No. steps = 330, No. f-s = 405, No. J-s = 69 -! -! *Accuracy: -! The accuracy of the solution depends on the choice of tolerances -! RelTol and AbsTol. Actual (global) errors may exceed these local -! tolerances, so choose them conservatively. -! -! *Cautions: -! The work arrays should not be altered between calls to DLSODE for -! the same problem, except possibly for the conditional and optional -! inputs. -! -! *Portability: -! Since NEQ is dimensioned inside DLSODE, some compilers may object -! to a call to DLSODE with NEQ a scalar variable. In this event, -! use DIMENSION NEQ. Similar remarks apply to RelTol and AbsTol. -! -! Note to Cray users: -! For maximum efficiency, use the CFT77 compiler. Appropriate -! compiler optimization directives have been inserted for CFT77. -! -! *Reference: -! Alan C. Hindmarsh, "ODEPACK, A Systematized Collection of ODE -! Solvers," in Scientific Computing, R. S. Stepleman, et al., Eds. -! (North-Holland, Amsterdam, 1983), pp. 55-64. -! -! *Long Description: -! The following complete description of the user interface to -! DLSODE consists of four parts: -! -! 1. The call sequence to subroutine DLSODE, which is a driver -! routine for the solver. This includes descriptions of both -! the call sequence arguments and user-supplied routines. -! Following these descriptions is a description of optional -! inputs available through the call sequence, and then a -! description of optional outputs in the work arrays. -! -! 2. Descriptions of other routines in the DLSODE package that may -! be (optionally) called by the user. These provide the ability -! to alter error message handling, save and restore the internal -! COMMON, and obtain specified derivatives of the solution y(t). -! -! 3. Descriptions of COMMON block to be declared in overlay or -! similar environments, or to be saved when doing an interrupt -! of the problem and continued solution later. -! -! 4. Description of two routines in the DLSODE package, either of -! which the user may replace with his own version, if desired. -! These relate to the measurement of errors. -! -! -! Part 1. Call Sequence -! ---------------------- -! -! Arguments -! --------- -! The call sequence parameters used for input only are -! -! F, NEQ, TOUT, ITOL, RelTol, AbsTol, ITASK, IOPT, LRW, LIW, JAC, MF, -! -! and those used for both input and output are -! -! Y, T, ISTATE. -! -! The work arrays RWORK and IWORK are also used for conditional and -! optional inputs and optional outputs. (The term output here -! refers to the return from subroutine DLSODE to the user's calling -! program.) -! -! The legality of input parameters will be thoroughly checked on the -! initial call for the problem, but not checked thereafter unless a -! change in input parameters is flagged by ISTATE = 3 on input. -! -! The descriptions of the call arguments are as follows. -! -! F The name of the user-supplied subroutine defining the ODE -! system. The system must be put in the first-order form -! dy/dt = f(t,y), where f is a vector-valued function of -! the scalar t and the vector y. Subroutine F is to compute -! the function f. It is to have the form -! -! SUBROUTINE F (NEQ, T, Y, YDOT) -! REAL(kind=dp) T, Y(*), YDOT(*) -! -! where NEQ, T, and Y are input, and the array YDOT = -! f(T,Y) is output. Y and YDOT are arrays of length NEQ. -! Subroutine F should not alter Y(1),...,Y(NEQ). F must be -! declared EXTERNAL in the calling program. -! -! Subroutine F may access user-defined quantities in -! NEQ(2),... and/or in Y(NEQ+1),..., if NEQ is an array -! (dimensioned in F) and/or Y has length exceeding NEQ. -! See the descriptions of NEQ and Y below. -! -! If quantities computed in the F routine are needed -! externally to DLSODE, an extra call to F should be made -! for this purpose, for consistent and accurate results. -! If only the derivative dy/dt is needed, use DINTDY -! instead. -! -! NEQ The size of the ODE system (number of first-order -! ordinary differential equations). Used only for input. -! NEQ may be decreased, but not increased, during the -! problem. If NEQ is decreased (with ISTATE = 3 on input), -! the remaining components of Y should be left undisturbed, -! if these are to be accessed in F and/or JAC. -! -! Normally, NEQ is a scalar, and it is generally referred -! to as a scalar in this user interface description. -! However, NEQ may be an array, with NEQ set to the -! system size. (The DLSODE package accesses only NEQ.) -! In either case, this parameter is passed as the NEQ -! argument in all calls to F and JAC. Hence, if it is an -! array, locations NEQ(2),... may be used to store other -! integer data and pass it to F and/or JAC. Subroutines -! F and/or JAC must include NEQ in a DIMENSION statement -! in that case. -! -! Y A real array for the vector of dependent variables, of -! length NEQ or more. Used for both input and output on -! the first call (ISTATE = 1), and only for output on -! other calls. On the first call, Y must contain the -! vector of initial values. On output, Y contains the -! computed solution vector, evaluated at T. If desired, -! the Y array may be used for other purposes between -! calls to the solver. -! -! This array is passed as the Y argument in all calls to F -! and JAC. Hence its length may exceed NEQ, and locations -! Y(NEQ+1),... may be used to store other real data and -! pass it to F and/or JAC. (The DLSODE package accesses -! only Y(1),...,Y(NEQ).) -! -! T The independent variable. On input, T is used only on -! the first call, as the initial point of the integration. -! On output, after each call, T is the value at which a -! computed solution Y is evaluated (usually the same as -! TOUT). On an error return, T is the farthest point -! reached. -! -! TOUT The next value of T at which a computed solution is -! desired. Used only for input. -! -! When starting the problem (ISTATE = 1), TOUT may be equal -! to T for one call, then should not equal T for the next -! call. For the initial T, an input value of TOUT .NE. T -! is used in order to determine the direction of the -! integration (i.e., the algebraic sign of the step sizes) -! and the rough scale of the problem. Integration in -! either direction (forward or backward in T) is permitted. -! -! If ITASK = 2 or 5 (one-step modes), TOUT is ignored -! after the first call (i.e., the first call with -! TOUT .NE. T). Otherwise, TOUT is required on every call. -! -! If ITASK = 1, 3, or 4, the values of TOUT need not be -! monotone, but a value of TOUT which backs up is limited -! to the current internal T interval, whose endpoints are -! TCUR - HU and TCUR. (See "Optional Outputs" below for -! TCUR and HU.) -! -! -! ITOL An indicator for the type of error control. See -! description below under AbsTol. Used only for input. -! -! RelTol A relative error tolerance parameter, either a scalar or -! an array of length NEQ. See description below under -! AbsTol. Input only. -! -! AbsTol An absolute error tolerance parameter, either a scalar or -! an array of length NEQ. Input only. -! -! The input parameters ITOL, RelTol, and AbsTol determine the -! error control performed by the solver. The solver will -! control the vector e = (e(i)) of estimated local errors -! in Y, according to an inequality of the form -! -! rms-norm of ( e(i)/EWT(i) ) <= 1, -! -! where -! -! EWT(i) = RelTol(i)*ABS(Y(i)) + AbsTol(i), -! -! and the rms-norm (root-mean-square norm) here is -! -! rms-norm(v) = SQRT(sum v(i)**2 / NEQ). -! -! Here EWT = (EWT(i)) is a vector of weights which must -! always be positive, and the values of RelTol and AbsTol -! should all be nonnegative. The following table gives the -! types (scalar/array) of RelTol and AbsTol, and the -! corresponding form of EWT(i). -! -! ITOL RelTol AbsTol EWT(i) -! ---- ------ ------ ----------------------------- -! 1 scalar scalar RelTol*ABS(Y(i)) + AbsTol -! 2 scalar array RelTol*ABS(Y(i)) + AbsTol(i) -! 3 array scalar RelTol(i)*ABS(Y(i)) + AbsTol -! 4 array array RelTol(i)*ABS(Y(i)) + AbsTol(i) -! -! When either of these parameters is a scalar, it need not -! be dimensioned in the user's calling program. -! -! If none of the above choices (with ITOL, RelTol, and AbsTol -! fixed throughout the problem) is suitable, more general -! error controls can be obtained by substituting -! user-supplied routines for the setting of EWT and/or for -! the norm calculation. See Part 4 below. -! -! If global errors are to be estimated by making a repeated -! run on the same problem with smaller tolerances, then all -! components of RelTol and AbsTol (i.e., of EWT) should be -! scaled down uniformly. -! -! ITASK An index specifying the task to be performed. Input -! only. ITASK has the following values and meanings: -! 1 Normal computation of output values of y(t) at -! t = TOUT (by overshooting and interpolating). -! 2 Take one step only and return. -! 3 Stop at the first internal mesh point at or beyond -! t = TOUT and return. -! 4 Normal computation of output values of y(t) at -! t = TOUT but without overshooting t = TCRIT. TCRIT -! must be input as RWORK(1). TCRIT may be equal to or -! beyond TOUT, but not behind it in the direction of -! integration. This option is useful if the problem -! has a singularity at or beyond t = TCRIT. -! 5 Take one step, without passing TCRIT, and return. -! TCRIT must be input as RWORK(1). -! -! Note: If ITASK = 4 or 5 and the solver reaches TCRIT -! (within roundoff), it will return T = TCRIT (exactly) to -! indicate this (unless ITASK = 4 and TOUT comes before -! TCRIT, in which case answers at T = TOUT are returned -! first). -! -! ISTATE An index used for input and output to specify the state -! of the calculation. -! -! On input, the values of ISTATE are as follows: -! 1 This is the first call for the problem -! (initializations will be done). See "Note" below. -! 2 This is not the first call, and the calculation is to -! continue normally, with no change in any input -! parameters except possibly TOUT and ITASK. (If ITOL, -! RelTol, and/or AbsTol are changed between calls with -! ISTATE = 2, the new values will be used but not -! tested for legality.) -! 3 This is not the first call, and the calculation is to -! continue normally, but with a change in input -! parameters other than TOUT and ITASK. Changes are -! allowed in NEQ, ITOL, RelTol, AbsTol, IOPT, LRW, LIW, MF, -! ML, MU, and any of the optional inputs except H0. -! (See IWORK description for ML and MU.) -! -! Note: A preliminary call with TOUT = T is not counted as -! a first call here, as no initialization or checking of -! input is done. (Such a call is sometimes useful for the -! purpose of outputting the initial conditions.) Thus the -! first call for which TOUT .NE. T requires ISTATE = 1 on -! input. -! -! On output, ISTATE has the following values and meanings: -! 1 Nothing was done, as TOUT was equal to T with -! ISTATE = 1 on input. -! 2 The integration was performed successfully. -! -1 An excessive amount of work (more than MXSTEP steps) -! was done on this call, before completing the -! requested task, but the integration was otherwise -! successful as far as T. (MXSTEP is an optional input -! and is normally 500.) To continue, the user may -! simply reset ISTATE to a value >1 and call again (the -! excess work step counter will be reset to 0). In -! addition, the user may increase MXSTEP to avoid this -! error return; see "Optional Inputs" below. -! -2 Too much accuracy was requested for the precision of -! the machine being used. This was detected before -! completing the requested task, but the integration -! was successful as far as T. To continue, the -! tolerance parameters must be reset, and ISTATE must -! be set to 3. The optional output TOLSF may be used -! for this purpose. (Note: If this condition is -! detected before taking any steps, then an illegal -! input return (ISTATE = -3) occurs instead.) -! -3 Illegal input was detected, before taking any -! integration steps. See written message for details. -! (Note: If the solver detects an infinite loop of -! calls to the solver with illegal input, it will cause -! the run to stop.) -! -4 There were repeated error-test failures on one -! attempted step, before completing the requested task, -! but the integration was successful as far as T. The -! problem may have a singularity, or the input may be -! inappropriate. -! -5 There were repeated convergence-test failures on one -! attempted step, before completing the requested task, -! but the integration was successful as far as T. This -! may be caused by an inaccurate Jacobian matrix, if -! one is being used. -! -6 EWT(i) became zero for some i during the integration. -! Pure relative error control (AbsTol(i)=0.0) was -! requested on a variable which has now vanished. The -! integration was successful as far as T. -! -! Note: Since the normal output value of ISTATE is 2, it -! does not need to be reset for normal continuation. Also, -! since a negative input value of ISTATE will be regarded -! as illegal, a negative output value requires the user to -! change it, and possibly other inputs, before calling the -! solver again. -! -! IOPT An integer flag to specify whether any optional inputs -! are being used on this call. Input only. The optional -! inputs are listed under a separate heading below. -! 0 No optional inputs are being used. Default values -! will be used in all cases. -! 1 One or more optional inputs are being used. -! -! RWORK A real working array (double precision). The length of -! RWORK must be at least -! -! 20 + NYH*(MAXORD + 1) + 3*NEQ + LWM -! -! where -! NYH = the initial value of NEQ, -! MAXORD = 12 (if METH = 1) or 5 (if METH = 2) (unless a -! smaller value is given as an optional input), -! LWM = 0 if MITER = 0, -! LWM = NEQ**2 + 2 if MITER = 1 or 2, -! LWM = NEQ + 2 if MITER = 3, and -! LWM = (2*ML + MU + 1)*NEQ + 2 -! if MITER = 4 or 5. -! (See the MF description below for METH and MITER.) -! -! Thus if MAXORD has its default value and NEQ is constant, -! this length is: -! 20 + 16*NEQ for MF = 10, -! 22 + 16*NEQ + NEQ**2 for MF = 11 or 12, -! 22 + 17*NEQ for MF = 13, -! 22 + 17*NEQ + (2*ML + MU)*NEQ for MF = 14 or 15, -! 20 + 9*NEQ for MF = 20, -! 22 + 9*NEQ + NEQ**2 for MF = 21 or 22, -! 22 + 10*NEQ for MF = 23, -! 22 + 10*NEQ + (2*ML + MU)*NEQ for MF = 24 or 25. -! -! The first 20 words of RWORK are reserved for conditional -! and optional inputs and optional outputs. -! -! The following word in RWORK is a conditional input: -! RWORK(1) = TCRIT, the critical value of t which the -! solver is not to overshoot. Required if ITASK -! is 4 or 5, and ignored otherwise. See ITASK. -! -! LRW The length of the array RWORK, as declared by the user. -! (This will be checked by the solver.) -! -! IWORK An integer work array. Its length must be at least -! 20 if MITER = 0 or 3 (MF = 10, 13, 20, 23), or -! 20 + NEQ otherwise (MF = 11, 12, 14, 15, 21, 22, 24, 25). -! (See the MF description below for MITER.) The first few -! words of IWORK are used for conditional and optional -! inputs and optional outputs. -! -! The following two words in IWORK are conditional inputs: -! IWORK(1) = ML These are the lower and upper half- -! IWORK(2) = MU bandwidths, respectively, of the banded -! Jacobian, excluding the main diagonal. -! The band is defined by the matrix locations -! (i,j) with i - ML <= j <= i + MU. ML and MU -! must satisfy 0 <= ML,MU <= NEQ - 1. These are -! required if MITER is 4 or 5, and ignored -! otherwise. ML and MU may in fact be the band -! parameters for a matrix to which df/dy is only -! approximately equal. -! -! LIW The length of the array IWORK, as declared by the user. -! (This will be checked by the solver.) -! -! Note: The work arrays must not be altered between calls to DLSODE -! for the same problem, except possibly for the conditional and -! optional inputs, and except for the last 3*NEQ words of RWORK. -! The latter space is used for internal scratch space, and so is -! available for use by the user outside DLSODE between calls, if -! desired (but not for use by F or JAC). -! -! JAC The name of the user-supplied routine (MITER = 1 or 4) to -! compute the Jacobian matrix, df/dy, as a function of the -! scalar t and the vector y. (See the MF description below -! for MITER.) It is to have the form -! -! SUBROUTINE JAC (NEQ, T, Y, ML, MU, PD, NROWPD) -! REAL(kind=dp) T, Y(*), PD(NROWPD,*) -! -! where NEQ, T, Y, ML, MU, and NROWPD are input and the -! array PD is to be loaded with partial derivatives -! (elements of the Jacobian matrix) on output. PD must be -! given a first dimension of NROWPD. T and Y have the same -! meaning as in subroutine F. -! -! In the full matrix case (MITER = 1), ML and MU are -! ignored, and the Jacobian is to be loaded into PD in -! columnwise manner, with df(i)/dy(j) loaded into PD(i,j). -! -! In the band matrix case (MITER = 4), the elements within -! the band are to be loaded into PD in columnwise manner, -! with diagonal lines of df/dy loaded into the rows of PD. -! Thus df(i)/dy(j) is to be loaded into PD(i-j+MU+1,j). ML -! and MU are the half-bandwidth parameters (see IWORK). -! The locations in PD in the two triangular areas which -! correspond to nonexistent matrix elements can be ignored -! or loaded arbitrarily, as they are overwritten by DLSODE. -! -! JAC need not provide df/dy exactly. A crude approximation -! (possibly with a smaller bandwidth) will do. -! -! In either case, PD is preset to zero by the solver, so -! that only the nonzero elements need be loaded by JAC. -! Each call to JAC is preceded by a call to F with the same -! arguments NEQ, T, and Y. Thus to gain some efficiency, -! intermediate quantities shared by both calculations may -! be saved in a user COMMON block by F and not recomputed -! by JAC, if desired. Also, JAC may alter the Y array, if -! desired. JAC must be declared EXTERNAL in the calling -! program. -! -! Subroutine JAC may access user-defined quantities in -! NEQ(2),... and/or in Y(NEQ+1),... if NEQ is an array -! (dimensioned in JAC) and/or Y has length exceeding -! NEQ. See the descriptions of NEQ and Y above. -! -! MF The method flag. Used only for input. The legal values -! of MF are 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, -! and 25. MF has decimal digits METH and MITER: -! MF = 10*METH + MITER . -! -! METH indicates the basic linear multistep method: -! 1 Implicit Adams method. -! 2 Method based on backward differentiation formulas -! (BDF's). -! -! MITER indicates the corrector iteration method: -! 0 Functional iteration (no Jacobian matrix is -! involved). -! 1 Chord iteration with a user-supplied full (NEQ by -! NEQ) Jacobian. -! 2 Chord iteration with an internally generated -! (difference quotient) full Jacobian (using NEQ -! extra calls to F per df/dy value). -! 3 Chord iteration with an internally generated -! diagonal Jacobian approximation (using one extra call -! to F per df/dy evaluation). -! 4 Chord iteration with a user-supplied banded Jacobian. -! 5 Chord iteration with an internally generated banded -! Jacobian (using ML + MU + 1 extra calls to F per -! df/dy evaluation). -! -! If MITER = 1 or 4, the user must supply a subroutine JAC -! (the name is arbitrary) as described above under JAC. -! For other values of MITER, a dummy argument can be used. -! -! Optional Inputs -! --------------- -! The following is a list of the optional inputs provided for in the -! call sequence. (See also Part 2.) For each such input variable, -! this table lists its name as used in this documentation, its -! location in the call sequence, its meaning, and the default value. -! The use of any of these inputs requires IOPT = 1, and in that case -! all of these inputs are examined. A value of zero for any of -! these optional inputs will cause the default value to be used. -! Thus to use a subset of the optional inputs, simply preload -! locations 5 to 10 in RWORK and IWORK to 0.0 and 0 respectively, -! and then set those of interest to nonzero values. -! -! Name Location Meaning and default value -! ------ --------- ----------------------------------------------- -! H0 RWORK(5) Step size to be attempted on the first step. -! The default value is determined by the solver. -! HMAX RWORK(6) Maximum absolute step size allowed. The -! default value is infinite. -! HMIN RWORK(7) Minimum absolute step size allowed. The -! default value is 0. (This lower bound is not -! enforced on the final step before reaching -! TCRIT when ITASK = 4 or 5.) -! MAXORD IWORK(5) Maximum order to be allowed. The default value -! is 12 if METH = 1, and 5 if METH = 2. (See the -! MF description above for METH.) If MAXORD -! exceeds the default value, it will be reduced -! to the default value. If MAXORD is changed -! during the problem, it may cause the current -! order to be reduced. -! MXSTEP IWORK(6) Maximum number of (internally defined) steps -! allowed during one call to the solver. The -! default value is 500. -! MXHNIL IWORK(7) Maximum number of messages printed (per -! problem) warning that T + H = T on a step -! (H = step size). This must be positive to -! result in a nondefault value. The default -! value is 10. -! -! Optional Outputs -! ---------------- -! As optional additional output from DLSODE, the variables listed -! below are quantities related to the performance of DLSODE which -! are available to the user. These are communicated by way of the -! work arrays, but also have internal mnemonic names as shown. -! Except where stated otherwise, all of these outputs are defined on -! any successful return from DLSODE, and on any return with ISTATE = -! -1, -2, -4, -5, or -6. On an illegal input return (ISTATE = -3), -! they will be unchanged from their existing values (if any), except -! possibly for TOLSF, LENRW, and LENIW. On any error return, -! outputs relevant to the error will be defined, as noted below. -! -! Name Location Meaning -! ----- --------- ------------------------------------------------ -! HU RWORK(11) Step size in t last used (successfully). -! HCUR RWORK(12) Step size to be attempted on the next step. -! TCUR RWORK(13) Current value of the independent variable which -! the solver has actually reached, i.e., the -! current internal mesh point in t. On output, -! TCUR will always be at least as far as the -! argument T, but may be farther (if interpolation -! was done). -! TOLSF RWORK(14) Tolerance scale factor, greater than 1.0, -! computed when a request for too much accuracy -! was detected (ISTATE = -3 if detected at the -! start of the problem, ISTATE = -2 otherwise). -! If ITOL is left unaltered but RelTol and AbsTol are -! uniformly scaled up by a factor of TOLSF for the -! next call, then the solver is deemed likely to -! succeed. (The user may also ignore TOLSF and -! alter the tolerance parameters in any other way -! appropriate.) -! NST IWORK(11) Number of steps taken for the problem so far. -! NFE IWORK(12) Number of F evaluations for the problem so far. -! NJE IWORK(13) Number of Jacobian evaluations (and of matrix LU -! decompositions) for the problem so far. -! NQU IWORK(14) Method order last used (successfully). -! NQCUR IWORK(15) Order to be attempted on the next step. -! IMXER IWORK(16) Index of the component of largest magnitude in -! the weighted local error vector ( e(i)/EWT(i) ), -! on an error return with ISTATE = -4 or -5. -! LENRW IWORK(17) Length of RWORK actually required. This is -! defined on normal returns and on an illegal -! input return for insufficient storage. -! LENIW IWORK(18) Length of IWORK actually required. This is -! defined on normal returns and on an illegal -! input return for insufficient storage. -! -! The following two arrays are segments of the RWORK array which may -! also be of interest to the user as optional outputs. For each -! array, the table below gives its internal name, its base address -! in RWORK, and its description. -! -! Name Base address Description -! ---- ------------ ---------------------------------------------- -! YH 21 The Nordsieck history array, of size NYH by -! (NQCUR + 1), where NYH is the initial value of -! NEQ. For j = 0,1,...,NQCUR, column j + 1 of -! YH contains HCUR**j/factorial(j) times the jth -! derivative of the interpolating polynomial -! currently representing the solution, evaluated -! at t = TCUR. -! ACOR LENRW-NEQ+1 Array of size NEQ used for the accumulated -! corrections on each step, scaled on output to -! represent the estimated local error in Y on -! the last step. This is the vector e in the -! description of the error control. It is -! defined only on successful return from DLSODE. -! -! -! Part 2. Other Callable Routines -! -------------------------------- -! -! The following are optional calls which the user may make to gain -! additional capabilities in conjunction with DLSODE. -! -! Form of call Function -! ------------------------ ---------------------------------------- -! CALL XSETUN(LUN) Set the logical unit number, LUN, for -! output of messages from DLSODE, if the -! default is not desired. The default -! value of LUN is 6. This call may be made -! at any time and will take effect -! immediately. -! CALL XSETF(MFLAG) Set a flag to control the printing of -! messages by DLSODE. MFLAG = 0 means do -! not print. (Danger: this risks losing -! valuable information.) MFLAG = 1 means -! print (the default). This call may be -! made at any time and will take effect -! immediately. -! CALL DSRCOM(RSAV,ISAV,JOB) Saves and restores the contents of the -! internal COMMON blocks used by DLSODE -! (see Part 3 below). RSAV must be a -! real array of length 218 or more, and -! ISAV must be an integer array of length -! 37 or more. JOB = 1 means save COMMON -! into RSAV/ISAV. JOB = 2 means restore -! COMMON from same. DSRCOM is useful if -! one is interrupting a run and restarting -! later, or alternating between two or -! more problems solved with DLSODE. -! CALL DINTDY(,,,,,) Provide derivatives of y, of various -! (see below) orders, at a specified point t, if -! desired. It may be called only after a -! successful return from DLSODE. Detailed -! instructions follow. -! -! Detailed instructions for using DINTDY -! -------------------------------------- -! The form of the CALL is: -! -! CALL DINTDY (T, K, RWORK(21), NYH, DKY, IFLAG) -! -! The input parameters are: -! -! T Value of independent variable where answers are -! desired (normally the same as the T last returned by -! DLSODE). For valid results, T must lie between -! TCUR - HU and TCUR. (See "Optional Outputs" above -! for TCUR and HU.) -! K Integer order of the derivative desired. K must -! satisfy 0 <= K <= NQCUR, where NQCUR is the current -! order (see "Optional Outputs"). The capability -! corresponding to K = 0, i.e., computing y(t), is -! already provided by DLSODE directly. Since -! NQCUR >= 1, the first derivative dy/dt is always -! available with DINTDY. -! RWORK(21) The base address of the history array YH. -! NYH Column length of YH, equal to the initial value of NEQ. -! -! The output parameters are: -! -! DKY Real array of length NEQ containing the computed value -! of the Kth derivative of y(t). -! IFLAG Integer flag, returned as 0 if K and T were legal, -! -1 if K was illegal, and -2 if T was illegal. -! On an error return, a message is also written. -! -! -! Part 3. Common Blocks -! ---------------------- -! -! If DLSODE is to be used in an overlay situation, the user must -! declare, in the primary overlay, the variables in: -! (1) the call sequence to DLSODE, -! (2) the internal COMMON block /DLS001/, of length 255 -! (218 double precision words followed by 37 integer words). -! -! If DLSODE is used on a system in which the contents of internal -! COMMON blocks are not preserved between calls, the user should -! declare the above COMMON block in his main program to insure that -! its contents are preserved. -! -! If the solution of a given problem by DLSODE is to be interrupted -! and then later continued, as when restarting an interrupted run or -! alternating between two or more problems, the user should save, -! following the return from the last DLSODE call prior to the -! interruption, the contents of the call sequence variables and the -! internal COMMON block, and later restore these values before the -! next DLSODE call for that problem. In addition, if XSETUN and/or -! XSETF was called for non-default handling of error messages, then -! these calls must be repeated. To save and restore the COMMON -! block, use subroutine DSRCOM (see Part 2 above). -! -! -! Part 4. Optionally Replaceable Solver Routines -! ----------------------------------------------- -! -! Below are descriptions of two routines in the DLSODE package which -! relate to the measurement of errors. Either routine can be -! replaced by a user-supplied version, if desired. However, since -! such a replacement may have a major impact on performance, it -! should be done only when absolutely necessary, and only with great -! caution. (Note: The means by which the package version of a -! routine is superseded by the user's version may be system- -! dependent.) -! -! DEWSET -! ------ -! The following subroutine is called just before each internal -! integration step, and sets the array of error weights, EWT, as -! described under ITOL/RelTol/AbsTol above: -! -! SUBROUTINE DEWSET (NEQ, ITOL, RelTol, AbsTol, YCUR, EWT) -! -! where NEQ, ITOL, RelTol, and AbsTol are as in the DLSODE call -! sequence, YCUR contains the current dependent variable vector, -! and EWT is the array of weights set by DEWSET. -! -! If the user supplies this subroutine, it must return in EWT(i) -! (i = 1,...,NEQ) a positive quantity suitable for comparing errors -! in Y(i) to. The EWT array returned by DEWSET is passed to the -! DVNORM routine (see below), and also used by DLSODE in the -! computation of the optional output IMXER, the diagonal Jacobian -! approximation, and the increments for difference quotient -! Jacobians. -! -! In the user-supplied version of DEWSET, it may be desirable to use -! the current values of derivatives of y. Derivatives up to order NQ -! are available from the history array YH, described above under -! optional outputs. In DEWSET, YH is identical to the YCUR array, -! extended to NQ + 1 columns with a column length of NYH and scale -! factors of H**j/factorial(j). On the first call for the problem, -! given by NST = 0, NQ is 1 and H is temporarily set to 1.0. -! NYH is the initial value of NEQ. The quantities NQ, H, and NST -! can be obtained by including in SEWSET the statements: -! REAL(kind=dp) RLS -! COMMON /DLS001/ RLS(218),ILS(37) -! NQ = ILS(33) -! NST = ILS(34) -! H = RLS(212) -! Thus, for example, the current value of dy/dt can be obtained as -! YCUR(NYH+i)/H (i=1,...,NEQ) (and the division by H is unnecessary -! when NST = 0). -! -! DVNORM -! ------ -! DVNORM is a real function routine which computes the weighted -! root-mean-square norm of a vector v: -! -! d = DVNORM (n, v, w) -! -! where: -! n = the length of the vector, -! v = real array of length n containing the vector, -! w = real array of length n containing weights, -! d = SQRT( (1/n) * sum(v(i)*w(i))**2 ). -! -! DVNORM is called with n = NEQ and with w(i) = 1.0/EWT(i), where -! EWT is as set by subroutine DEWSET. -! -! If the user supplies this function, it should return a nonnegative -! value of DVNORM suitable for use in the error control in DLSODE. -! None of the arguments should be altered by DVNORM. For example, a -! user-supplied DVNORM routine might: -! - Substitute a max-norm of (v(i)*w(i)) for the rms-norm, or -! - Ignore some components of v in the norm, with the effect of -! suppressing the error control on those components of Y. -! --------------------------------------------------------------------- -!***ROUTINES CALLED DEWSET, DINTDY, DUMACH, DSTODE, DVNORM, XERRWD -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYYYMMDD) -! 19791129 DATE WRITTEN -! 19791213 Minor changes to declarations; DELP init. in STODE. -! 19800118 Treat NEQ as array; integer declarations added throughout; -! minor changes to prologue. -! 19800306 Corrected TESCO(1,NQP1) setting in CFODE. -! 19800519 Corrected access of YH on forced order reduction; -! numerous corrections to prologues and other comments. -! 19800617 In main driver, added loading of SQRT(UROUND) in RWORK; -! minor corrections to main prologue. -! 19800923 Added zero initialization of HU and NQU. -! 19801218 Revised XERRWD routine; minor corrections to main prologue. -! 19810401 Minor changes to comments and an error message. -! 19810814 Numerous revisions: replaced EWT by 1/EWT; used flags -! JCUR, ICF, IERPJ, IERSL between STODE and subordinates; -! added tuning parameters CCMAX, MAXCOR, MSBP, MXNCF; -! reorganized returns from STODE; reorganized type decls.; -! fixed message length in XERRWD; changed default LUNIT to 6; -! changed Common lengths; changed comments throughout. -! 19870330 Major update by ACH: corrected comments throughout; -! removed TRET from Common; rewrote EWSET with 4 loops; -! fixed t test in INTDY; added Cray directives in STODE; -! in STODE, fixed DELP init. and logic around PJAC call; -! combined routines to save/restore Common; -! passed LEVEL = 0 in error message calls (except run abort). -! 19890426 Modified prologue to SLATEC/LDOC format. (FNF) -! 19890501 Many improvements to prologue. (FNF) -! 19890503 A few final corrections to prologue. (FNF) -! 19890504 Minor cosmetic changes. (FNF) -! 19890510 Corrected description of Y in Arguments section. (FNF) -! 19890517 Minor corrections to prologue. (FNF) -! 19920514 Updated with prologue edited 891025 by G. Shaw for manual. -! 19920515 Converted source lines to upper case. (FNF) -! 19920603 Revised XERRWD calls using mixed upper-lower case. (ACH) -! 19920616 Revised prologue comment regarding CFT. (ACH) -! 19921116 Revised prologue comments regarding Common. (ACH). -! 19930326 Added comment about non-reentrancy. (FNF) -! 19930723 Changed D1MACH to DUMACH. (FNF) -! 19930801 Removed ILLIN and NTREP from Common (affects driver logic); -! minor changes to prologue and internal comments; -! changed Hollerith strings to quoted strings; -! changed internal comments to mixed case; -! replaced XERRWD with new version using character type; -! changed dummy dimensions from 1 to *. (ACH) -! 19930809 Changed to generic intrinsic names; changed names of -! subprograms and Common blocks to DLSODE etc. (ACH) -! 19930929 Eliminated use of REAL intrinsic; other minor changes. (ACH) -! 20010412 Removed all 'own' variables from Common block /DLS001/ -! (affects declarations in 6 routines). (ACH) -! 20010509 Minor corrections to prologue. (ACH) -! 20031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -! 20031112 Added SAVE statements for data-loaded constants. -! -!***END PROLOGUE DLSODE -! -!*Internal Notes: -! -! Other Routines in the DLSODE Package. -! -! In addition to Subroutine DLSODE, the DLSODE package includes the -! following subroutines and function routines: -! DINTDY computes an interpolated value of the y vector at t = TOUT. -! DSTODE is the core integrator, which does one step of the -! integration and the associated error control. -! DCFODE sets all method coefficients and test constants. -! DPREPJ computes and preprocesses the Jacobian matrix J = df/dy -! and the Newton iteration matrix P = I - h*l0*J. -! DSOLSY manages solution of linear system in chord iteration. -! DEWSET sets the error weight vector EWT before each step. -! DVNORM computes the weighted R.M.S. norm of a vector. -! DSRCOM is a user-callable routine to save and restore -! the contents of the internal Common block. -! DGEFA and DGESL are routines from LINPACK for solving full -! systems of linear algebraic equations. -! DGBFA and DGBSL are routines from LINPACK for solving banded -! linear systems. -! DUMACH computes the unit roundoff in a machine-independent manner. -! XERRWD, XSETUN, XSETF, IXSAV, IUMACH handle the printing of all -! error messages and warnings. XERRWD is machine-dependent. -! Note: DVNORM, DUMACH, IXSAV, and IUMACH are function routines. -! All the others are subroutines. -! -!**End -! -! Declare externals. -! Note: they are now internal - !EXTERNAL DPREPJ, DSOLSY - !REAL(kind=dp) DUMACH, DVNORM -! -! Declare all other variables. - INTEGER INIT, MXSTEP, MXHNIL, NHNIL, NSLAST, NYH, IOWNS, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - INTEGER I, I1, I2, IFLAG, IMXER, KGO, LF0, & - LENIW, LENRW, LENWM, ML, MORD(2), MU, MXHNL0, MXSTP0 - REAL(kind=dp) ROWNS, & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND - REAL(kind=dp) AbsTolI, AYI, BIG, EWTI, H0, HMAX, HMX, RH, RelTolI, & - TCRIT, TDIST, TNEXT, TOL, TOLSF, TP, SIZE, SUM, W0 - - LOGICAL IHIT - CHARACTER*80 MSG - SAVE MORD, MXSTP0, MXHNL0 -!----------------------------------------------------------------------- -! The following internal Common block contains -! (a) variables which are local to any subroutine but whose values must -! be preserved between calls to the routine ("own" variables), and -! (b) variables which are communicated between subroutines. -! The block DLS001 is declared in subroutines DLSODE, DINTDY, DSTODE, -! DPREPJ, and DSOLSY. -! Groups of variables are replaced by dummy arrays in the Common -! declarations in routines where those variables are not used. -!----------------------------------------------------------------------- - COMMON /DLS001/ ROWNS(209), & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND, & - INIT, MXSTEP, MXHNIL, NHNIL, NSLAST, NYH, IOWNS(6), & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU -! - DATA MORD(1),MORD(2)/12,5/, MXSTP0/5000/, MXHNL0/10/ -!----------------------------------------------------------------------- -! Block A. -! This code block is executed on every call. -! It tests ISTATE and ITASK for legality and branches appropriately. -! If ISTATE .GT. 1 but the flag INIT shows that initialization has -! not yet been done, an error return occurs. -! If ISTATE = 1 and TOUT = T, return immediately. -!----------------------------------------------------------------------- -! -!***FIRST EXECUTABLE STATEMENT DLSODE - IF (ISTATE .LT. 1 .OR. ISTATE .GT. 3) GO TO 601 - IF (ITASK .LT. 1 .OR. ITASK .GT. 5) GO TO 602 - IF (ISTATE .EQ. 1) GO TO 10 - IF (INIT .EQ. 0) GO TO 603 - IF (ISTATE .EQ. 2) GO TO 200 - GO TO 20 - 10 INIT = 0 - IF (TOUT .EQ. T) RETURN -!----------------------------------------------------------------------- -! Block B. -! The next code block is executed for the initial call (ISTATE = 1), -! or for a continuation call with parameter changes (ISTATE = 3). -! It contains checking of all inputs and various initializations. -! -! First check legality of the non-optional inputs NEQ, ITOL, IOPT, -! MF, ML, and MU. -!----------------------------------------------------------------------- - 20 IF (NEQ .LE. 0) GO TO 604 - IF (ISTATE .EQ. 1) GO TO 25 - IF (NEQ .GT. N) GO TO 605 - 25 N = NEQ - IF (ITOL .LT. 1 .OR. ITOL .GT. 4) GO TO 606 - IF (IOPT .LT. 0 .OR. IOPT .GT. 1) GO TO 607 - METH = MF/10 - MITER = MF - 10*METH - IF (METH .LT. 1 .OR. METH .GT. 2) GO TO 608 - IF (MITER .LT. 0 .OR. MITER .GT. 5) GO TO 608 - IF (MITER .LE. 3) GO TO 30 - ML = IWORK(1) - MU = IWORK(2) - IF (ML .LT. 0 .OR. ML .GE. N) GO TO 609 - IF (MU .LT. 0 .OR. MU .GE. N) GO TO 610 - 30 CONTINUE -! Next process and check the optional inputs. -------------------------- - IF (IOPT .EQ. 1) GO TO 40 - MAXORD = MORD(METH) - MXSTEP = MXSTP0 - MXHNIL = MXHNL0 - IF (ISTATE .EQ. 1) H0 = 0.0D0 - HMXI = 0.0D0 - HMIN = 0.0D0 - GO TO 60 - 40 MAXORD = IWORK(5) - IF (MAXORD .LT. 0) GO TO 611 - IF (MAXORD .EQ. 0) MAXORD = 100 - MAXORD = MIN(MAXORD,MORD(METH)) - MXSTEP = IWORK(6) - IF (MXSTEP .LT. 0) GO TO 612 - IF (MXSTEP .EQ. 0) MXSTEP = MXSTP0 - MXHNIL = IWORK(7) - IF (MXHNIL .LT. 0) GO TO 613 - IF (MXHNIL .EQ. 0) MXHNIL = MXHNL0 - IF (ISTATE .NE. 1) GO TO 50 - H0 = RWORK(5) - IF ((TOUT - T)*H0 .LT. 0.0D0) GO TO 614 - 50 HMAX = RWORK(6) - IF (HMAX .LT. 0.0D0) GO TO 615 - HMXI = 0.0D0 - IF (HMAX .GT. 0.0D0) HMXI = 1.0D0/HMAX - HMIN = RWORK(7) - IF (HMIN .LT. 0.0D0) GO TO 616 -!----------------------------------------------------------------------- -! Set work array pointers and check lengths LRW and LIW. -! Pointers to segments of RWORK and IWORK are named by prefixing L to -! the name of the segment. E.g., the segment YH starts at RWORK(LYH). -! Segments of RWORK (in order) are denoted YH, WM, EWT, SAVF, ACOR. -!----------------------------------------------------------------------- - 60 LYH = 21 - IF (ISTATE .EQ. 1) NYH = N - LWM = LYH + (MAXORD + 1)*NYH - IF (MITER .EQ. 0) LENWM = 0 - IF (MITER .EQ. 1 .OR. MITER .EQ. 2) LENWM = N*N + 2 - IF (MITER .EQ. 3) LENWM = N + 2 - IF (MITER .GE. 4) LENWM = (2*ML + MU + 1)*N + 2 - LEWT = LWM + LENWM - LSAVF = LEWT + N - LACOR = LSAVF + N - LENRW = LACOR + N - 1 - IWORK(17) = LENRW - LIWM = 1 - LENIW = 20 + N - IF (MITER .EQ. 0 .OR. MITER .EQ. 3) LENIW = 20 - IWORK(18) = LENIW - IF (LENRW .GT. LRW) GO TO 617 - IF (LENIW .GT. LIW) GO TO 618 -! Check RelTol and AbsTol for legality. ------------------------------------ - RelTolI = RelTol(1) - AbsTolI = AbsTol(1) - DO 70 I = 1,N - IF (ITOL .GE. 3) RelTolI = RelTol(I) - IF (ITOL .EQ. 2 .OR. ITOL .EQ. 4) AbsTolI = AbsTol(I) - IF (RelTolI .LT. 0.0D0) GO TO 619 - IF (AbsTolI .LT. 0.0D0) GO TO 620 - 70 CONTINUE - IF (ISTATE .EQ. 1) GO TO 100 -! If ISTATE = 3, set flag to signal parameter changes to DSTODE. ------- - JSTART = -1 - IF (NQ .LE. MAXORD) GO TO 90 -! MAXORD was reduced below NQ. Copy YH(*,MAXORD+2) into SAVF. --------- - DO 80 I = 1,N - 80 RWORK(I+LSAVF-1) = RWORK(I+LWM-1) -! Reload WM(1) = RWORK(LWM), since LWM may have changed. --------------- - 90 IF (MITER .GT. 0) RWORK(LWM) = SQRT(UROUND) - IF (N .EQ. NYH) GO TO 200 -! NEQ was reduced. Zero part of YH to avoid undefined references. ----- - I1 = LYH + L*NYH - I2 = LYH + (MAXORD + 1)*NYH - 1 - IF (I1 .GT. I2) GO TO 200 - DO 95 I = I1,I2 - 95 RWORK(I) = 0.0D0 - GO TO 200 -!----------------------------------------------------------------------- -! Block C. -! The next block is for the initial call only (ISTATE = 1). -! It contains all remaining initializations, the initial call to F, -! and the calculation of the initial step size. -! The error weights in EWT are inverted after being loaded. -!----------------------------------------------------------------------- - 100 UROUND = DUMACH() - TN = T - IF (ITASK .NE. 4 .AND. ITASK .NE. 5) GO TO 110 - TCRIT = RWORK(1) - IF ((TCRIT - TOUT)*(TOUT - T) .LT. 0.0D0) GO TO 625 - IF (H0 .NE. 0.0D0 .AND. (T + H0 - TCRIT)*H0 .GT. 0.0D0) & - H0 = TCRIT - T - 110 JSTART = 0 - IF (MITER .GT. 0) RWORK(LWM) = SQRT(UROUND) - NHNIL = 0 - NST = 0 - NJE = 0 - NSLAST = 0 - HU = 0.0D0 - NQU = 0 - CCMAX = 0.3D0 - MAXCOR = 3 - MSBP = 20 - MXNCF = 10 -! Initial call to F. (LF0 points to YH(*,2).) ------------------------- - LF0 = LYH + NYH - CALL F (NEQ, T, Y, RWORK(LF0)) - NFE = 1 -! Load the initial value vector in YH. --------------------------------- - DO 115 I = 1,N - 115 RWORK(I+LYH-1) = Y(I) -! Load and invert the EWT array. (H is temporarily set to 1.0.) ------- - NQ = 1 - H = 1.0D0 - CALL DEWSET (N, ITOL, RelTol, AbsTol, RWORK(LYH), RWORK(LEWT)) - DO 120 I = 1,N - IF (RWORK(I+LEWT-1) .LE. 0.0D0) GO TO 621 - 120 RWORK(I+LEWT-1) = 1.0D0/RWORK(I+LEWT-1) -!----------------------------------------------------------------------- -! The coding below computes the step size, H0, to be attempted on the -! first step, unless the user has supplied a value for this. -! First check that TOUT - T differs significantly from zero. -! A scalar tolerance quantity TOL is computed, as MAX(RelTol(I)) -! if this is positive, or MAX(AbsTol(I)/ABS(Y(I))) otherwise, adjusted -! so as to be between 100*UROUND and 1.0E-3. -! Then the computed value H0 is given by.. -! NEQ -! H0**2 = TOL / ( w0**-2 + (1/NEQ) * SUM ( f(i)/ywt(i) )**2 ) -! 1 -! where w0 = MAX ( ABS(T), ABS(TOUT) ), -! f(i) = i-th component of initial value of f, -! ywt(i) = EWT(i)/TOL (a weight for y(i)). -! The sign of H0 is inferred from the initial values of TOUT and T. -!----------------------------------------------------------------------- - IF (H0 .NE. 0.0D0) GO TO 180 - TDIST = ABS(TOUT - T) - W0 = MAX(ABS(T),ABS(TOUT)) - IF (TDIST .LT. 2.0D0*UROUND*W0) GO TO 622 - TOL = RelTol(1) - IF (ITOL .LE. 2) GO TO 140 - DO 130 I = 1,N - 130 TOL = MAX(TOL,RelTol(I)) - 140 IF (TOL .GT. 0.0D0) GO TO 160 - AbsTolI = AbsTol(1) - DO 150 I = 1,N - IF (ITOL .EQ. 2 .OR. ITOL .EQ. 4) AbsTolI = AbsTol(I) - AYI = ABS(Y(I)) - IF (AYI .NE. 0.0D0) TOL = MAX(TOL,AbsTolI/AYI) - 150 CONTINUE - 160 TOL = MAX(TOL,100.0D0*UROUND) - TOL = MIN(TOL,0.001D0) - SUM = DVNORM (N, RWORK(LF0), RWORK(LEWT)) - SUM = 1.0D0/(TOL*W0*W0) + TOL*SUM**2 - H0 = 1.0D0/SQRT(SUM) - H0 = MIN(H0,TDIST) - H0 = SIGN(H0,TOUT-T) -! Adjust H0 if necessary to meet HMAX bound. --------------------------- - 180 RH = ABS(H0)*HMXI - IF (RH .GT. 1.0D0) H0 = H0/RH -! Load H with H0 and scale YH(*,2) by H0. ------------------------------ - H = H0 - DO 190 I = 1,N - 190 RWORK(I+LF0-1) = H0*RWORK(I+LF0-1) - GO TO 270 -!----------------------------------------------------------------------- -! Block D. -! The next code block is for continuation calls only (ISTATE = 2 or 3) -! and is to check stop conditions before taking a step. -!----------------------------------------------------------------------- - 200 NSLAST = NST - GO TO (210, 250, 220, 230, 240), ITASK - 210 IF ((TN - TOUT)*H .LT. 0.0D0) GO TO 250 - CALL DINTDY (TOUT, 0, RWORK(LYH), NYH, Y, IFLAG) - IF (IFLAG .NE. 0) GO TO 627 - T = TOUT - GO TO 420 - 220 TP = TN - HU*(1.0D0 + 100.0D0*UROUND) - IF ((TP - TOUT)*H .GT. 0.0D0) GO TO 623 - IF ((TN - TOUT)*H .LT. 0.0D0) GO TO 250 - GO TO 400 - 230 TCRIT = RWORK(1) - IF ((TN - TCRIT)*H .GT. 0.0D0) GO TO 624 - IF ((TCRIT - TOUT)*H .LT. 0.0D0) GO TO 625 - IF ((TN - TOUT)*H .LT. 0.0D0) GO TO 245 - CALL DINTDY (TOUT, 0, RWORK(LYH), NYH, Y, IFLAG) - IF (IFLAG .NE. 0) GO TO 627 - T = TOUT - GO TO 420 - 240 TCRIT = RWORK(1) - IF ((TN - TCRIT)*H .GT. 0.0D0) GO TO 624 - 245 HMX = ABS(TN) + ABS(H) - IHIT = ABS(TN - TCRIT) .LE. 100.0D0*UROUND*HMX - IF (IHIT) GO TO 400 - TNEXT = TN + H*(1.0D0 + 4.0D0*UROUND) - IF ((TNEXT - TCRIT)*H .LE. 0.0D0) GO TO 250 - H = (TCRIT - TN)*(1.0D0 - 4.0D0*UROUND) - IF (ISTATE .EQ. 2) JSTART = -2 -!----------------------------------------------------------------------- -! Block E. -! The next block is normally executed for all calls and contains -! the call to the one-step core integrator DSTODE. -! -! This is a looping point for the integration steps. -! -! First check for too many steps being taken, update EWT (if not at -! start of problem), check for too much accuracy being requested, and -! check for H below the roundoff level in T. -!----------------------------------------------------------------------- - 250 CONTINUE - IF ((NST-NSLAST) .GE. MXSTEP) GO TO 500 - CALL DEWSET (N, ITOL, RelTol, AbsTol, RWORK(LYH), RWORK(LEWT)) - DO 260 I = 1,N - IF (RWORK(I+LEWT-1) .LE. 0.0D0) GO TO 510 - 260 RWORK(I+LEWT-1) = 1.0D0/RWORK(I+LEWT-1) - 270 TOLSF = UROUND*DVNORM (N, RWORK(LYH), RWORK(LEWT)) - IF (TOLSF .LE. 1.0D0) GO TO 280 - TOLSF = TOLSF*2.0D0 - IF (NST .EQ. 0) GO TO 626 - GO TO 520 - 280 IF ((TN + H) .NE. TN) GO TO 290 - NHNIL = NHNIL + 1 - IF (NHNIL .GT. MXHNIL) GO TO 290 - MSG = 'DLSODE- Warning..internal T (=R1) and H (=R2) are' - CALL XERRWD (MSG, 50, 101, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG=' such that in the machine, T + H = T on the next step ' - CALL XERRWD (MSG, 60, 101, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' (H = step size). Solver will continue anyway' - CALL XERRWD (MSG, 50, 101, 0, 0, 0, 0, 2, TN, H) - IF (NHNIL .LT. MXHNIL) GO TO 290 - MSG = 'DLSODE- Above warning has been issued I1 times. ' - CALL XERRWD (MSG, 50, 102, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' It will not be issued again for this problem' - CALL XERRWD (MSG, 50, 102, 0, 1, MXHNIL, 0, 0, 0.0D0, 0.0D0) - 290 CONTINUE -!----------------------------------------------------------------------- -! CALL DSTODE(NEQ,Y,YH,NYH,YH,EWT,SAVF,ACOR,WM,IWM,F,JAC,DPREPJ,DSOLSY) -!----------------------------------------------------------------------- - CALL DSTODE (NEQ, Y, RWORK(LYH), NYH, RWORK(LYH), RWORK(LEWT), & - RWORK(LSAVF), RWORK(LACOR), RWORK(LWM), IWORK(LIWM), & - F, JAC) - !F, JAC, DPREPJ, DSOLSY) - KGO = 1 - KFLAG - GO TO (300, 530, 540), KGO -!----------------------------------------------------------------------- -! Block F. -! The following block handles the case of a successful return from the -! core integrator (KFLAG = 0). Test for stop conditions. -!----------------------------------------------------------------------- - 300 INIT = 1 - GO TO (310, 400, 330, 340, 350), ITASK -! ITASK = 1. If TOUT has been reached, interpolate. ------------------- - 310 IF ((TN - TOUT)*H .LT. 0.0D0) GO TO 250 - CALL DINTDY (TOUT, 0, RWORK(LYH), NYH, Y, IFLAG) - T = TOUT - GO TO 420 -! ITASK = 3. Jump to exit if TOUT was reached. ------------------------ - 330 IF ((TN - TOUT)*H .GE. 0.0D0) GO TO 400 - GO TO 250 -! ITASK = 4. See if TOUT or TCRIT was reached. Adjust H if necessary. - 340 IF ((TN - TOUT)*H .LT. 0.0D0) GO TO 345 - CALL DINTDY (TOUT, 0, RWORK(LYH), NYH, Y, IFLAG) - T = TOUT - GO TO 420 - 345 HMX = ABS(TN) + ABS(H) - IHIT = ABS(TN - TCRIT) .LE. 100.0D0*UROUND*HMX - IF (IHIT) GO TO 400 - TNEXT = TN + H*(1.0D0 + 4.0D0*UROUND) - IF ((TNEXT - TCRIT)*H .LE. 0.0D0) GO TO 250 - H = (TCRIT - TN)*(1.0D0 - 4.0D0*UROUND) - JSTART = -2 - GO TO 250 -! ITASK = 5. See if TCRIT was reached and jump to exit. --------------- - 350 HMX = ABS(TN) + ABS(H) - IHIT = ABS(TN - TCRIT) .LE. 100.0D0*UROUND*HMX -!----------------------------------------------------------------------- -! Block G. -! The following block handles all successful returns from DLSODE. -! If ITASK .NE. 1, Y is loaded from YH and T is set accordingly. -! ISTATE is set to 2, and the optional outputs are loaded into the -! work arrays before returning. -!----------------------------------------------------------------------- - 400 DO 410 I = 1,N - 410 Y(I) = RWORK(I+LYH-1) - T = TN - IF (ITASK .NE. 4 .AND. ITASK .NE. 5) GO TO 420 - IF (IHIT) T = TCRIT - 420 ISTATE = 2 - RWORK(11) = HU - RWORK(12) = H - RWORK(13) = TN - IWORK(11) = NST - IWORK(12) = NFE - IWORK(13) = NJE - IWORK(14) = NQU - IWORK(15) = NQ - RETURN -!----------------------------------------------------------------------- -! Block H. -! The following block handles all unsuccessful returns other than -! those for illegal input. First the error message routine is called. -! If there was an error test or convergence test failure, IMXER is set. -! Then Y is loaded from YH and T is set to TN. The optional outputs -! are loaded into the work arrays before returning. -!----------------------------------------------------------------------- -! The maximum number of steps was taken before reaching TOUT. ---------- - 500 MSG = 'DLSODE- At current T (=R1), MXSTEP (=I1) steps ' - CALL XERRWD (MSG, 50, 201, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' taken on this call before reaching TOUT ' - CALL XERRWD (MSG, 50, 201, 0, 1, MXSTEP, 0, 1, TN, 0.0D0) - ISTATE = -1 - GO TO 580 -! EWT(I) .LE. 0.0 for some I (not at start of problem). ---------------- - 510 EWTI = RWORK(LEWT+I-1) - MSG = 'DLSODE- At T (=R1), EWT(I1) has become R2 .LE. 0.' - CALL XERRWD (MSG, 50, 202, 0, 1, I, 0, 2, TN, EWTI) - ISTATE = -6 - GO TO 580 -! Too much accuracy requested for machine precision. ------------------- - 520 MSG = 'DLSODE- At T (=R1), too much accuracy requested ' - CALL XERRWD (MSG, 50, 203, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' for precision of machine.. see TOLSF (=R2) ' - CALL XERRWD (MSG, 50, 203, 0, 0, 0, 0, 2, TN, TOLSF) - RWORK(14) = TOLSF - ISTATE = -2 - GO TO 580 -! KFLAG = -1. Error test failed repeatedly or with ABS(H) = HMIN. ----- - 530 MSG = 'DLSODE- At T(=R1) and step size H(=R2), the error' - CALL XERRWD (MSG, 50, 204, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' test failed repeatedly or with ABS(H) = HMIN' - CALL XERRWD (MSG, 50, 204, 0, 0, 0, 0, 2, TN, H) - ISTATE = -4 - GO TO 560 -! KFLAG = -2. Convergence failed repeatedly or with ABS(H) = HMIN. ---- - 540 MSG = 'DLSODE- At T (=R1) and step size H (=R2), the ' - CALL XERRWD (MSG, 50, 205, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' corrector convergence failed repeatedly ' - CALL XERRWD (MSG, 50, 205, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG = ' or with ABS(H) = HMIN ' - CALL XERRWD (MSG, 30, 205, 0, 0, 0, 0, 2, TN, H) - ISTATE = -5 -! Compute IMXER if relevant. ------------------------------------------- - 560 BIG = 0.0D0 - IMXER = 1 - DO 570 I = 1,N - SIZE = ABS(RWORK(I+LACOR-1)*RWORK(I+LEWT-1)) - IF (BIG .GE. SIZE) GO TO 570 - BIG = SIZE - IMXER = I - 570 CONTINUE - IWORK(16) = IMXER -! Set Y vector, T, and optional outputs. ------------------------------- - 580 DO 590 I = 1,N - 590 Y(I) = RWORK(I+LYH-1) - T = TN - RWORK(11) = HU - RWORK(12) = H - RWORK(13) = TN - IWORK(11) = NST - IWORK(12) = NFE - IWORK(13) = NJE - IWORK(14) = NQU - IWORK(15) = NQ - RETURN -!----------------------------------------------------------------------- -! Block I. -! The following block handles all error returns due to illegal input -! (ISTATE = -3), as detected before calling the core integrator. -! First the error message routine is called. If the illegal input -! is a negative ISTATE, the run is aborted (apparent infinite loop). -!----------------------------------------------------------------------- - 601 MSG = 'DLSODE- ISTATE (=I1) illegal ' - CALL XERRWD (MSG, 30, 1, 0, 1, ISTATE, 0, 0, 0.0D0, 0.0D0) - IF (ISTATE .LT. 0) GO TO 800 - GO TO 700 - 602 MSG = 'DLSODE- ITASK (=I1) illegal ' - CALL XERRWD (MSG, 30, 2, 0, 1, ITASK, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 603 MSG = 'DLSODE- ISTATE .GT. 1 but DLSODE not initialized ' - CALL XERRWD (MSG, 50, 3, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 604 MSG = 'DLSODE- NEQ (=I1) .LT. 1 ' - CALL XERRWD (MSG, 30, 4, 0, 1, NEQ, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 605 MSG = 'DLSODE- ISTATE = 3 and NEQ increased (I1 to I2) ' - CALL XERRWD (MSG, 50, 5, 0, 2, N, NEQ, 0, 0.0D0, 0.0D0) - GO TO 700 - 606 MSG = 'DLSODE- ITOL (=I1) illegal ' - CALL XERRWD (MSG, 30, 6, 0, 1, ITOL, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 607 MSG = 'DLSODE- IOPT (=I1) illegal ' - CALL XERRWD (MSG, 30, 7, 0, 1, IOPT, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 608 MSG = 'DLSODE- MF (=I1) illegal ' - CALL XERRWD (MSG, 30, 8, 0, 1, MF, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 609 MSG = 'DLSODE- ML (=I1) illegal.. .LT.0 or .GE.NEQ (=I2)' - CALL XERRWD (MSG, 50, 9, 0, 2, ML, NEQ, 0, 0.0D0, 0.0D0) - GO TO 700 - 610 MSG = 'DLSODE- MU (=I1) illegal.. .LT.0 or .GE.NEQ (=I2)' - CALL XERRWD (MSG, 50, 10, 0, 2, MU, NEQ, 0, 0.0D0, 0.0D0) - GO TO 700 - 611 MSG = 'DLSODE- MAXORD (=I1) .LT. 0 ' - CALL XERRWD (MSG, 30, 11, 0, 1, MAXORD, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 612 MSG = 'DLSODE- MXSTEP (=I1) .LT. 0 ' - CALL XERRWD (MSG, 30, 12, 0, 1, MXSTEP, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 613 MSG = 'DLSODE- MXHNIL (=I1) .LT. 0 ' - CALL XERRWD (MSG, 30, 13, 0, 1, MXHNIL, 0, 0, 0.0D0, 0.0D0) - GO TO 700 - 614 MSG = 'DLSODE- TOUT (=R1) behind T (=R2) ' - CALL XERRWD (MSG, 40, 14, 0, 0, 0, 0, 2, TOUT, T) - MSG = ' Integration direction is given by H0 (=R1) ' - CALL XERRWD (MSG, 50, 14, 0, 0, 0, 0, 1, H0, 0.0D0) - GO TO 700 - 615 MSG = 'DLSODE- HMAX (=R1) .LT. 0.0 ' - CALL XERRWD (MSG, 30, 15, 0, 0, 0, 0, 1, HMAX, 0.0D0) - GO TO 700 - 616 MSG = 'DLSODE- HMIN (=R1) .LT. 0.0 ' - CALL XERRWD (MSG, 30, 16, 0, 0, 0, 0, 1, HMIN, 0.0D0) - GO TO 700 - 617 CONTINUE - MSG='DLSODE- RWORK length needed, LENRW (=I1), exceeds LRW (=I2)' - CALL XERRWD (MSG, 60, 17, 0, 2, LENRW, LRW, 0, 0.0D0, 0.0D0) - GO TO 700 - 618 CONTINUE - MSG='DLSODE- IWORK length needed, LENIW (=I1), exceeds LIW (=I2)' - CALL XERRWD (MSG, 60, 18, 0, 2, LENIW, LIW, 0, 0.0D0, 0.0D0) - GO TO 700 - 619 MSG = 'DLSODE- RelTol(I1) is R1 .LT. 0.0 ' - CALL XERRWD (MSG, 40, 19, 0, 1, I, 0, 1, RelTolI, 0.0D0) - GO TO 700 - 620 MSG = 'DLSODE- AbsTol(I1) is R1 .LT. 0.0 ' - CALL XERRWD (MSG, 40, 20, 0, 1, I, 0, 1, AbsTolI, 0.0D0) - GO TO 700 - 621 EWTI = RWORK(LEWT+I-1) - MSG = 'DLSODE- EWT(I1) is R1 .LE. 0.0 ' - CALL XERRWD (MSG, 40, 21, 0, 1, I, 0, 1, EWTI, 0.0D0) - GO TO 700 - 622 CONTINUE - MSG='DLSODE- TOUT (=R1) too close to T(=R2) to start integration' - CALL XERRWD (MSG, 60, 22, 0, 0, 0, 0, 2, TOUT, T) - GO TO 700 - 623 CONTINUE - MSG='DLSODE- ITASK = I1 and TOUT (=R1) behind TCUR - HU (= R2) ' - CALL XERRWD (MSG, 60, 23, 0, 1, ITASK, 0, 2, TOUT, TP) - GO TO 700 - 624 CONTINUE - MSG='DLSODE- ITASK = 4 OR 5 and TCRIT (=R1) behind TCUR (=R2) ' - CALL XERRWD (MSG, 60, 24, 0, 0, 0, 0, 2, TCRIT, TN) - GO TO 700 - 625 CONTINUE - MSG='DLSODE- ITASK = 4 or 5 and TCRIT (=R1) behind TOUT (=R2) ' - CALL XERRWD (MSG, 60, 25, 0, 0, 0, 0, 2, TCRIT, TOUT) - GO TO 700 - 626 MSG = 'DLSODE- At start of problem, too much accuracy ' - CALL XERRWD (MSG, 50, 26, 0, 0, 0, 0, 0, 0.0D0, 0.0D0) - MSG=' requested for precision of machine.. See TOLSF (=R1) ' - CALL XERRWD (MSG, 60, 26, 0, 0, 0, 0, 1, TOLSF, 0.0D0) - RWORK(14) = TOLSF - GO TO 700 - 627 MSG = 'DLSODE- Trouble in DINTDY. ITASK = I1, TOUT = R1' - CALL XERRWD (MSG, 50, 27, 0, 1, ITASK, 0, 1, TOUT, 0.0D0) -! - 700 ISTATE = -3 - RETURN -! - 800 MSG = 'DLSODE- Run aborted.. apparent infinite loop ' - CALL XERRWD (MSG, 50, 303, 2, 0, 0, 0, 0, 0.0D0, 0.0D0) - RETURN -!----------------------- END OF SUBROUTINE DLSODE ---------------------- - !END SUBROUTINE DLSODE - CONTAINS - - -!DECK DUMACH - REAL(kind=dp) FUNCTION DUMACH () -!***BEGIN PROLOGUE DUMACH -!***PURPOSE Compute the unit roundoff of the machine. -!***CATEGORY R1 -!***TYPE REAL(kind=dp) (RUMACH-S, DUMACH-D) -!***KEYWORDS MACHINE CONSTANTS -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! *Usage: -! REAL(kind=dp) A, DUMACH -! A = DUMACH() -! -! *Function Return Values: -! A : the unit roundoff of the machine. -! -! *Description: -! The unit roundoff is defined as the smallest positive machine -! number u such that 1.0 + u .ne. 1.0. This is computed by DUMACH -! in a machine-independent manner. -! -!***REFERENCES (NONE) -!***ROUTINES CALLED DUMSUM -!***REVISION HISTORY (YYYYMMDD) -! 19930216 DATE WRITTEN -! 19930818 Added SLATEC-format prologue. (FNF) -! 20030707 Added DUMSUM to force normal storage of COMP. (ACH) -!***END PROLOGUE DUMACH -! - REAL(kind=dp) U, COMP -!***FIRST EXECUTABLE STATEMENT DUMACH - U = 1.0D0 - 10 U = U*0.5D0 - CALL DUMSUM(1.0D0, U, COMP) - IF (COMP .NE. 1.0D0) GO TO 10 - DUMACH = U*2.0D0 - RETURN -!----------------------- End of Function DUMACH ------------------------ - END FUNCTION DUMACH - - SUBROUTINE DUMSUM(A,B,C) -! Routine to force normal storing of A + B, for DUMACH. - REAL(kind=dp) A, B, C - C = A + B - RETURN - END SUBROUTINE DUMSUM -!DECK DCFODE - SUBROUTINE DCFODE (METH, ELCO, TESCO) -!***BEGIN PROLOGUE DCFODE -!***SUBSIDIARY -!***PURPOSE Set ODE integrator coefficients. -!***TYPE REAL(kind=dp) (SCFODE-S, DCFODE-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! DCFODE is called by the integrator routine to set coefficients -! needed there. The coefficients for the current method, as -! given by the value of METH, are set for all orders and saved. -! The maximum order assumed here is 12 if METH = 1 and 5 if METH = 2. -! (A smaller value of the maximum order is also allowed.) -! DCFODE is called once at the beginning of the problem, -! and is not called again unless and until METH is changed. -! -! The ELCO array contains the basic method coefficients. -! The coefficients el(i), 1 .le. i .le. nq+1, for the method of -! order nq are stored in ELCO(i,nq). They are given by a genetrating -! polynomial, i.e., -! l(x) = el(1) + el(2)*x + ... + el(nq+1)*x**nq. -! For the implicit Adams methods, l(x) is given by -! dl/dx = (x+1)*(x+2)*...*(x+nq-1)/factorial(nq-1), l(-1) = 0. -! For the BDF methods, l(x) is given by -! l(x) = (x+1)*(x+2)* ... *(x+nq)/K, -! where K = factorial(nq)*(1 + 1/2 + ... + 1/nq). -! -! The TESCO array contains test constants used for the -! local error test and the selection of step size and/or order. -! At order nq, TESCO(k,nq) is used for the selection of step -! size at order nq - 1 if k = 1, at order nq if k = 2, and at order -! nq + 1 if k = 3. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED (NONE) -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -!***END PROLOGUE DCFODE -!**End - INTEGER METH - INTEGER I, IB, NQ, NQM1, NQP1 - REAL(kind=dp) ELCO(13,12), TESCO(3,12), PC(12) - REAL(kind=dp) AGAMQ, FNQ, FNQM1, PINT, RAGQ, RQFAC, RQ1FAC, TSIGN, XPIN -! -!***FIRST EXECUTABLE STATEMENT DCFODE - GO TO (100, 200), METH -! - 100 ELCO(1,1) = 1.0D0 - ELCO(2,1) = 1.0D0 - TESCO(1,1) = 0.0D0 - TESCO(2,1) = 2.0D0 - TESCO(1,2) = 1.0D0 - TESCO(3,12) = 0.0D0 - PC(1) = 1.0D0 - RQFAC = 1.0D0 - DO 140 NQ = 2,12 -!----------------------------------------------------------------------- -! The PC array will contain the coefficients of the polynomial -! p(x) = (x+1)*(x+2)*...*(x+nq-1). -! Initially, p(x) = 1. -!----------------------------------------------------------------------- - RQ1FAC = RQFAC - RQFAC = RQFAC/NQ - NQM1 = NQ - 1 - FNQM1 = NQM1 - NQP1 = NQ + 1 -! Form coefficients of p(x)*(x+nq-1). ---------------------------------- - PC(NQ) = 0.0D0 - DO 110 IB = 1,NQM1 - I = NQP1 - IB - 110 PC(I) = PC(I-1) + FNQM1*PC(I) - PC(1) = FNQM1*PC(1) -! Compute integral, -1 to 0, of p(x) and x*p(x). ----------------------- - PINT = PC(1) - XPIN = PC(1)/2.0D0 - TSIGN = 1.0D0 - DO 120 I = 2,NQ - TSIGN = -TSIGN - PINT = PINT + TSIGN*PC(I)/I - 120 XPIN = XPIN + TSIGN*PC(I)/(I+1) -! Store coefficients in ELCO and TESCO. -------------------------------- - ELCO(1,NQ) = PINT*RQ1FAC - ELCO(2,NQ) = 1.0D0 - DO 130 I = 2,NQ - 130 ELCO(I+1,NQ) = RQ1FAC*PC(I)/I - AGAMQ = RQFAC*XPIN - RAGQ = 1.0D0/AGAMQ - TESCO(2,NQ) = RAGQ - IF (NQ .LT. 12) TESCO(1,NQP1) = RAGQ*RQFAC/NQP1 - TESCO(3,NQM1) = RAGQ - 140 CONTINUE - RETURN -! - 200 PC(1) = 1.0D0 - RQ1FAC = 1.0D0 - DO 230 NQ = 1,5 -!----------------------------------------------------------------------- -! The PC array will contain the coefficients of the polynomial -! p(x) = (x+1)*(x+2)*...*(x+nq). -! Initially, p(x) = 1. -!----------------------------------------------------------------------- - FNQ = NQ - NQP1 = NQ + 1 -! Form coefficients of p(x)*(x+nq). ------------------------------------ - PC(NQP1) = 0.0D0 - DO 210 IB = 1,NQ - I = NQ + 2 - IB - 210 PC(I) = PC(I-1) + FNQ*PC(I) - PC(1) = FNQ*PC(1) -! Store coefficients in ELCO and TESCO. -------------------------------- - DO 220 I = 1,NQP1 - 220 ELCO(I,NQ) = PC(I)/PC(2) - ELCO(2,NQ) = 1.0D0 - TESCO(1,NQ) = RQ1FAC - TESCO(2,NQ) = NQP1/ELCO(1,NQ) - TESCO(3,NQ) = (NQ+2)/ELCO(1,NQ) - RQ1FAC = RQ1FAC/FNQ - 230 CONTINUE - RETURN -!----------------------- END OF SUBROUTINE DCFODE ---------------------- - END SUBROUTINE DCFODE -!DECK DINTDY - SUBROUTINE DINTDY (T, K, YH, NYH, DKY, IFLAG) -!***BEGIN PROLOGUE DINTDY -!***SUBSIDIARY -!***PURPOSE Interpolate solution derivatives. -!***TYPE REAL(kind=dp) (SINTDY-S, DINTDY-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! DINTDY computes interpolated values of the K-th derivative of the -! dependent variable vector y, and stores it in DKY. This routine -! is called within the package with K = 0 and T = TOUT, but may -! also be called by the user for any K up to the current order. -! (See detailed instructions in the usage documentation.) -! -! The computed values in DKY are gotten by interpolation using the -! Nordsieck history array YH. This array corresponds uniquely to a -! vector-valued polynomial of degree NQCUR or less, and DKY is set -! to the K-th derivative of this polynomial at T. -! The formula for DKY is: -! q -! DKY(i) = sum c(j,K) * (T - tn)**(j-K) * h**(-j) * YH(i,j+1) -! j=K -! where c(j,K) = j*(j-1)*...*(j-K+1), q = NQCUR, tn = TCUR, h = HCUR. -! The quantities nq = NQCUR, l = nq+1, N = NEQ, tn, and h are -! communicated by COMMON. The above sum is done in reverse order. -! IFLAG is returned negative if either K or T is out of bounds. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED XERRWD -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -! 010418 Reduced size of Common block /DLS001/. (ACH) -! 031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -! 050427 Corrected roundoff decrement in TP. (ACH) -!***END PROLOGUE DINTDY -!**End - INTEGER K, NYH, IFLAG - REAL(kind=dp) T, YH(NYH,*), DKY(*) - INTEGER IOWND, IOWNS, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - REAL(kind=dp) ROWNS, & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND - COMMON /DLS001/ ROWNS(209), & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND, & - IOWND(6), IOWNS(6), & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - INTEGER I, IC, J, JB, JB2, JJ, JJ1, JP1 - REAL(kind=dp) C, R, S, TP - CHARACTER*80 MSG -! -!***FIRST EXECUTABLE STATEMENT DINTDY - IFLAG = 0 - IF (K .LT. 0 .OR. K .GT. NQ) GO TO 80 - TP = TN - HU - 100.0D0*UROUND*SIGN(ABS(TN) + ABS(HU), HU) - IF ((T-TP)*(T-TN) .GT. 0.0D0) GO TO 90 -! - S = (T - TN)/H - IC = 1 - IF (K .EQ. 0) GO TO 15 - JJ1 = L - K - DO 10 JJ = JJ1,NQ - 10 IC = IC*JJ - 15 C = IC - DO 20 I = 1,N - 20 DKY(I) = C*YH(I,L) - IF (K .EQ. NQ) GO TO 55 - JB2 = NQ - K - DO 50 JB = 1,JB2 - J = NQ - JB - JP1 = J + 1 - IC = 1 - IF (K .EQ. 0) GO TO 35 - JJ1 = JP1 - K - DO 30 JJ = JJ1,J - 30 IC = IC*JJ - 35 C = IC - DO 40 I = 1,N - 40 DKY(I) = C*YH(I,JP1) + S*DKY(I) - 50 CONTINUE - IF (K .EQ. 0) RETURN - 55 R = H**(-K) - DO 60 I = 1,N - 60 DKY(I) = R*DKY(I) - RETURN -! - 80 MSG = 'DINTDY- K (=I1) illegal ' - CALL XERRWD (MSG, 30, 51, 0, 1, K, 0, 0, 0.0D0, 0.0D0) - IFLAG = -1 - RETURN - 90 MSG = 'DINTDY- T (=R1) illegal ' - CALL XERRWD (MSG, 30, 52, 0, 0, 0, 0, 1, T, 0.0D0) - MSG=' T not in interval TCUR - HU (= R1) to TCUR (=R2) ' - CALL XERRWD (MSG, 60, 52, 0, 0, 0, 0, 2, TP, TN) - IFLAG = -2 - RETURN -!----------------------- END OF SUBROUTINE DINTDY ---------------------- - END SUBROUTINE DINTDY -!DECK DPREPJ - SUBROUTINE DPREPJ (NEQ, Y, YH, NYH, EWT, FTEM, SAVF, WM, IWM, F, JAC) -!***BEGIN PROLOGUE DPREPJ -!***SUBSIDIARY -!***PURPOSE Compute and process Newton iteration matrix. -!***TYPE REAL(kind=dp) (SPREPJ-S, DPREPJ-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! DPREPJ is called by DSTODE to compute and process the matrix -! P = I - h*el(1)*J , where J is an approximation to the Jacobian. -! Here J is computed by the user-supplied routine JAC if -! MITER = 1 or 4, or by finite differencing if MITER = 2, 3, or 5. -! If MITER = 3, a diagonal approximation to J is used. -! J is stored in WM and replaced by P. If MITER .ne. 3, P is then -! subjected to LU decomposition in preparation for later solution -! of linear systems with P as coefficient matrix. This is done -! by DGEFA if MITER = 1 or 2, and by DGBFA if MITER = 4 or 5. -! -! In addition to variables described in DSTODE and DLSODE prologues, -! communication with DPREPJ uses the following: -! Y = array containing predicted values on entry. -! FTEM = work array of length N (ACOR in DSTODE). -! SAVF = array containing f evaluated at predicted y. -! WM = real work space for matrices. On output it contains the -! inverse diagonal matrix if MITER = 3 and the LU decomposition -! of P if MITER is 1, 2 , 4, or 5. -! Storage of matrix elements starts at WM(3). -! WM also contains the following matrix-related data: -! WM(1) = SQRT(UROUND), used in numerical Jacobian increments. -! WM(2) = H*EL0, saved for later use if MITER = 3. -! IWM = integer work space containing pivot information, starting at -! IWM(21), if MITER is 1, 2, 4, or 5. IWM also contains band -! parameters ML = IWM(1) and MU = IWM(2) if MITER is 4 or 5. -! EL0 = EL(1) (input). -! IERPJ = output error flag, = 0 if no trouble, .gt. 0 if -! P matrix found to be singular. -! JCUR = output flag = 1 to indicate that the Jacobian matrix -! (or approximation) is now current. -! This routine also uses the COMMON variables EL0, H, TN, UROUND, -! MITER, N, NFE, and NJE. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED DGBFA, DGEFA, DVNORM -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890504 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -! 010418 Reduced size of Common block /DLS001/. (ACH) -! 031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -!***END PROLOGUE DPREPJ -!**End - EXTERNAL F, JAC - INTEGER NEQ, NYH, IWM(*) - REAL(kind=dp) Y(*), YH(NYH,*), EWT(*), FTEM(*), SAVF(*), WM(*) - INTEGER IOWND, IOWNS, IER, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - REAL(kind=dp) ROWNS, & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND - COMMON /DLS001/ ROWNS(209), & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND, & - IOWND(6), IOWNS(6), & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - INTEGER I, I1, I2, ISING, II, J, J1, JJ, LENP, & - MBA, MBAND, MEB1, MEBAND, ML, ML3, MU, NP1 - REAL(kind=dp) CON, DI, FAC, HL0, R, R0, SRUR, YI, YJ, YJJ - !REAL(kind=dp) DVNORM -! -!***FIRST EXECUTABLE STATEMENT DPREPJ - NJE = NJE + 1 - IERPJ = 0 - JCUR = 1 - HL0 = H*EL0 - CON = -HL0 - -#ifdef FULL_ALGEBRA - LENP = N*N - DO i = 1,LENP - WM(i+2) = 0.0D0 - END DO - CALL JAC_CHEM (NEQ, TN, Y, WM(3)) - DO I = 1,LENP - WM(I+2) = WM(I+2)*CON - END DO - ! Add identity matrix - J = 3 - NP1 = N + 1 - DO I = 1,N - WM(J) = WM(J) + 1.0D0 - J = J + NP1 - END DO - ! Do LU decomposition on P - CALL DGETRF(N,N,WM(3),N,IWM(21),ISING) -#else - CALL JAC_CHEM (NEQ, TN, Y, WM(3)) - DO i = 1,LU_NONZERO - WM(i+2) = WM(i+2)*CON - END DO - ! Add identity matrix - DO i = 1,N - j = 2+LU_DIAG(i) - WM(j) = WM(j) + 1.0D0 - END DO - ! Do LU decomposition on P - CALL KppDecomp(WM(3),IER) -#endif - IF (IER .NE. 0) IERPJ = 1 - RETURN - !----------------------- END OF SUBROUTINE DPREPJ ---------------------- - END SUBROUTINE DPREPJ -!DECK DSOLSY - SUBROUTINE DSOLSY (WM, IWM, X, TEM) -!***BEGIN PROLOGUE DSOLSY -!***SUBSIDIARY -!***PURPOSE ODEPACK linear system solver. -!***TYPE REAL(kind=dp) (SSOLSY-S, DSOLSY-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! This routine manages the solution of the linear system arising from -! a chord iteration. It is called if MITER .ne. 0. -! If MITER is 1 or 2, it calls DGESL to accomplish this. -! If MITER = 3 it updates the coefficient h*EL0 in the diagonal -! matrix, and then computes the solution. -! If MITER is 4 or 5, it calls DGBSL. -! Communication with DSOLSY uses the following variables: -! WM = real work space containing the inverse diagonal matrix if -! MITER = 3 and the LU decomposition of the matrix otherwise. -! Storage of matrix elements starts at WM(3). -! WM also contains the following matrix-related data: -! WM(1) = SQRT(UROUND) (not used here), -! WM(2) = HL0, the previous value of h*EL0, used if MITER = 3. -! IWM = integer work space containing pivot information, starting at -! IWM(21), if MITER is 1, 2, 4, or 5. IWM also contains band -! parameters ML = IWM(1) and MU = IWM(2) if MITER is 4 or 5. -! X = the right-hand side vector on input, and the solution vector -! on output, of length N. -! TEM = vector of work space of length N, not used in this version. -! IERSL = output flag (in COMMON). IERSL = 0 if no trouble occurred. -! IERSL = 1 if a singular matrix arose with MITER = 3. -! This routine also uses the COMMON variables EL0, H, MITER, and N. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED DGBSL, DGESL -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -! 010418 Reduced size of Common block /DLS001/. (ACH) -! 031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -!***END PROLOGUE DSOLSY -!**End - INTEGER IWM(*) - REAL(kind=dp) WM(*), X(*), TEM(*) - INTEGER IOWND, IOWNS, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - REAL(kind=dp) ROWNS, & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND - COMMON /DLS001/ ROWNS(209), & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND, & - IOWND(6), IOWNS(6), & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - INTEGER I, MEBAND, ML, MU - REAL(kind=dp) DI, HL0, PHL0, R -#ifdef FULL_ALGEBRA - INTEGER ISING -#endif -! -!***FIRST EXECUTABLE STATEMENT DSOLSY - IERSL = 0 -#ifdef FULL_ALGEBRA - CALL DGETRS ('N',N,1,WM(3),N,IWM(21),X,N,ISING) -#else - CALL KppSolve(WM(3),X) -#endif - RETURN -!----------------------- END OF SUBROUTINE DSOLSY ---------------------- - END SUBROUTINE DSOLSY -!DECK DSRCOM - SUBROUTINE DSRCOM (RSAV, ISAV, JOB) -!***BEGIN PROLOGUE DSRCOM -!***SUBSIDIARY -!***PURPOSE Save/restore ODEPACK COMMON blocks. -!***TYPE REAL(kind=dp) (SSRCOM-S, DSRCOM-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! This routine saves or restores (depending on JOB) the contents of -! the COMMON block DLS001, which is used internally -! by one or more ODEPACK solvers. -! -! RSAV = real array of length 218 or more. -! ISAV = integer array of length 37 or more. -! JOB = flag indicating to save or restore the COMMON blocks: -! JOB = 1 if COMMON is to be saved (written to RSAV/ISAV) -! JOB = 2 if COMMON is to be restored (read from RSAV/ISAV) -! A call with JOB = 2 presumes a prior call with JOB = 1. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED (NONE) -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 921116 Deleted treatment of block /EH0001/. (ACH) -! 930801 Reduced Common block length by 2. (ACH) -! 930809 Renamed to allow single/double precision versions. (ACH) -! 010418 Reduced Common block length by 209+12. (ACH) -! 031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -! 031112 Added SAVE statement for data-loaded constants. -!***END PROLOGUE DSRCOM -!**End - INTEGER ISAV(*), JOB - INTEGER ILS - INTEGER I, LENILS, LENRLS - REAL(kind=dp) RSAV(*), RLS - SAVE LENRLS, LENILS - COMMON /DLS001/ RLS(218), ILS(37) - DATA LENRLS/218/, LENILS/37/ -! -!***FIRST EXECUTABLE STATEMENT DSRCOM - IF (JOB .EQ. 2) GO TO 100 -! - DO 10 I = 1,LENRLS - 10 RSAV(I) = RLS(I) - DO 20 I = 1,LENILS - 20 ISAV(I) = ILS(I) - RETURN -! - 100 CONTINUE - DO 110 I = 1,LENRLS - 110 RLS(I) = RSAV(I) - DO 120 I = 1,LENILS - 120 ILS(I) = ISAV(I) - RETURN -!----------------------- END OF SUBROUTINE DSRCOM ---------------------- - END SUBROUTINE DSRCOM -!DECK DSTODE - SUBROUTINE DSTODE (NEQ, Y, YH, NYH, YH1, EWT, SAVF, ACOR, & - WM, IWM, F, JAC) - !WM, IWM, F, JAC, PJAC, SLVS) -!***BEGIN PROLOGUE DSTODE -!***SUBSIDIARY -!***PURPOSE Performs one step of an ODEPACK integration. -!***TYPE REAL(kind=dp) (SSTODE-S, DSTODE-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! DSTODE performs one step of the integration of an initial value -! problem for a system of ordinary differential equations. -! Note: DSTODE is independent of the value of the iteration method -! indicator MITER, when this is .ne. 0, and hence is independent -! of the type of chord method used, or the Jacobian structure. -! Communication with DSTODE is done with the following variables: -! -! NEQ = integer array containing problem size in NEQ, and -! passed as the NEQ argument in all calls to F and JAC. -! Y = an array of length .ge. N used as the Y argument in -! all calls to F and JAC. -! YH = an NYH by LMAX array containing the dependent variables -! and their approximate scaled derivatives, where -! LMAX = MAXORD + 1. YH(i,j+1) contains the approximate -! j-th derivative of y(i), scaled by h**j/factorial(j) -! (j = 0,1,...,NQ). on entry for the first step, the first -! two columns of YH must be set from the initial values. -! NYH = a constant integer .ge. N, the first dimension of YH. -! YH1 = a one-dimensional array occupying the same space as YH. -! EWT = an array of length N containing multiplicative weights -! for local error measurements. Local errors in Y(i) are -! compared to 1.0/EWT(i) in various error tests. -! SAVF = an array of working storage, of length N. -! Also used for input of YH(*,MAXORD+2) when JSTART = -1 -! and MAXORD .lt. the current order NQ. -! ACOR = a work array of length N, used for the accumulated -! corrections. On a successful return, ACOR(i) contains -! the estimated one-step local error in Y(i). -! WM,IWM = real and integer work arrays associated with matrix -! operations in chord iteration (MITER .ne. 0). -! PJAC = name of routine to evaluate and preprocess Jacobian matrix -! and P = I - h*el0*JAC, if a chord method is being used. -! SLVS = name of routine to solve linear system in chord iteration. -! CCMAX = maximum relative change in h*el0 before PJAC is called. -! H = the step size to be attempted on the next step. -! H is altered by the error control algorithm during the -! problem. H can be either positive or negative, but its -! sign must remain constant throughout the problem. -! HMIN = the minimum absolute value of the step size h to be used. -! HMXI = inverse of the maximum absolute value of h to be used. -! HMXI = 0.0 is allowed and corresponds to an infinite hmax. -! HMIN and HMXI may be changed at any time, but will not -! take effect until the next change of h is considered. -! TN = the independent variable. TN is updated on each step taken. -! JSTART = an integer used for input only, with the following -! values and meanings: -! 0 perform the first step. -! .gt.0 take a new step continuing from the last. -! -1 take the next step with a new value of H, MAXORD, -! N, METH, MITER, and/or matrix parameters. -! -2 take the next step with a new value of H, -! but with other inputs unchanged. -! On return, JSTART is set to 1 to facilitate continuation. -! KFLAG = a completion code with the following meanings: -! 0 the step was succesful. -! -1 the requested error could not be achieved. -! -2 corrector convergence could not be achieved. -! -3 fatal error in PJAC or SLVS. -! A return with KFLAG = -1 or -2 means either -! abs(H) = HMIN or 10 consecutive failures occurred. -! On a return with KFLAG negative, the values of TN and -! the YH array are as of the beginning of the last -! step, and H is the last step size attempted. -! MAXORD = the maximum order of integration method to be allowed. -! MAXCOR = the maximum number of corrector iterations allowed. -! MSBP = maximum number of steps between PJAC calls (MITER .gt. 0). -! MXNCF = maximum number of convergence failures allowed. -! METH/MITER = the method flags. See description in driver. -! N = the number of first-order differential equations. -! The values of CCMAX, H, HMIN, HMXI, TN, JSTART, KFLAG, MAXORD, -! MAXCOR, MSBP, MXNCF, METH, MITER, and N are communicated via COMMON. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED DCFODE, DVNORM -!***COMMON BLOCKS DLS001 -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -! 010418 Reduced size of Common block /DLS001/. (ACH) -! 031105 Restored 'own' variables to Common block /DLS001/, to -! enable interrupt/restart feature. (ACH) -!***END PROLOGUE DSTODE -!**End - EXTERNAL F, JAC !, PJAC, SLVS - INTEGER NEQ, NYH, IWM(*) - REAL(kind=dp) Y(*), YH(NYH,*), YH1(*), EWT(*), SAVF(*), & - ACOR(*), WM(*) - INTEGER IOWND, IALTH, IPUP, LMAX, MEO, NQNYH, NSLP, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU - INTEGER I, I1, IREDO, IRET, J, JB, M, NCF, NEWQ - REAL(kind=dp) CONIT, CRATE, EL, ELCO, HOLD, RMAX, TESCO, & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND - REAL(kind=dp) DCON, DDN, DEL, DELP, DSM, DUP, EXDN, EXSM, & - EXUP,R, RH, RHDN, RHSM, RHUP, TOLD - !REAL(kind=dp) DVNORM - COMMON /DLS001/ CONIT, CRATE, EL(13), ELCO(13,12), & - HOLD, RMAX, TESCO(3,12), & - CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND, & - IOWND(6), IALTH, IPUP, LMAX, MEO, NQNYH, NSLP, & - ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, & - LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER, & - MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU -! -!***FIRST EXECUTABLE STATEMENT DSTODE - KFLAG = 0 - TOLD = TN - NCF = 0 - IERPJ = 0 - IERSL = 0 - JCUR = 0 - ICF = 0 - DELP = 0.0D0 - IF (JSTART .GT. 0) GO TO 200 - IF (JSTART .EQ. -1) GO TO 100 - IF (JSTART .EQ. -2) GO TO 160 -!----------------------------------------------------------------------- -! On the first call, the order is set to 1, and other variables are -! initialized. RMAX is the maximum ratio by which H can be increased -! in a single step. It is initially 1.E4 to compensate for the small -! initial H, but then is normally equal to 10. If a failure -! occurs (in corrector convergence or error test), RMAX is set to 2 -! for the next increase. -!----------------------------------------------------------------------- - LMAX = MAXORD + 1 - NQ = 1 - L = 2 - IALTH = 2 - RMAX = 10000.0D0 - RC = 0.0D0 - EL0 = 1.0D0 - CRATE = 0.7D0 - HOLD = H - MEO = METH - NSLP = 0 - IPUP = MITER - IRET = 3 - GO TO 140 -!----------------------------------------------------------------------- -! The following block handles preliminaries needed when JSTART = -1. -! IPUP is set to MITER to force a matrix update. -! If an order increase is about to be considered (IALTH = 1), -! IALTH is reset to 2 to postpone consideration one more step. -! If the caller has changed METH, DCFODE is called to reset -! the coefficients of the method. -! If the caller has changed MAXORD to a value less than the current -! order NQ, NQ is reduced to MAXORD, and a new H chosen accordingly. -! If H is to be changed, YH must be rescaled. -! If H or METH is being changed, IALTH is reset to L = NQ + 1 -! to prevent further changes in H for that many steps. -!----------------------------------------------------------------------- - 100 IPUP = MITER - LMAX = MAXORD + 1 - IF (IALTH .EQ. 1) IALTH = 2 - IF (METH .EQ. MEO) GO TO 110 - CALL DCFODE (METH, ELCO, TESCO) - MEO = METH - IF (NQ .GT. MAXORD) GO TO 120 - IALTH = L - IRET = 1 - GO TO 150 - 110 IF (NQ .LE. MAXORD) GO TO 160 - 120 NQ = MAXORD - L = LMAX - DO 125 I = 1,L - 125 EL(I) = ELCO(I,NQ) - NQNYH = NQ*NYH - RC = RC*EL(1)/EL0 - EL0 = EL(1) - CONIT = 0.5D0/(NQ+2) - DDN = DVNORM (N, SAVF, EWT)/TESCO(1,L) - EXDN = 1.0D0/L - RHDN = 1.0D0/(1.3D0*DDN**EXDN + 0.0000013D0) - RH = MIN(RHDN,1.0D0) - IREDO = 3 - IF (H .EQ. HOLD) GO TO 170 - RH = MIN(RH,ABS(H/HOLD)) - H = HOLD - GO TO 175 -!----------------------------------------------------------------------- -! DCFODE is called to get all the integration coefficients for the -! current METH. Then the EL vector and related constants are reset -! whenever the order NQ is changed, or at the start of the problem. -!----------------------------------------------------------------------- - 140 CALL DCFODE (METH, ELCO, TESCO) - 150 DO 155 I = 1,L - 155 EL(I) = ELCO(I,NQ) - NQNYH = NQ*NYH - RC = RC*EL(1)/EL0 - EL0 = EL(1) - CONIT = 0.5D0/(NQ+2) - GO TO (160, 170, 200), IRET -!----------------------------------------------------------------------- -! If H is being changed, the H ratio RH is checked against -! RMAX, HMIN, and HMXI, and the YH array rescaled. IALTH is set to -! L = NQ + 1 to prevent a change of H for that many steps, unless -! forced by a convergence or error test failure. -!----------------------------------------------------------------------- - 160 IF (H .EQ. HOLD) GO TO 200 - RH = H/HOLD - H = HOLD - IREDO = 3 - GO TO 175 - 170 RH = MAX(RH,HMIN/ABS(H)) - 175 RH = MIN(RH,RMAX) - RH = RH/MAX(1.0D0,ABS(H)*HMXI*RH) - R = 1.0D0 - DO 180 J = 2,L - R = R*RH - DO 180 I = 1,N - 180 YH(I,J) = YH(I,J)*R - H = H*RH - RC = RC*RH - IALTH = L - IF (IREDO .EQ. 0) GO TO 690 -!----------------------------------------------------------------------- -! This section computes the predicted values by effectively -! multiplying the YH array by the Pascal Triangle matrix. -! RC is the ratio of new to old values of the coefficient H*EL(1). -! When RC differs from 1 by more than CCMAX, IPUP is set to MITER -! to force PJAC to be called, if a Jacobian is involved. -! In any case, PJAC is called at least every MSBP steps. -!----------------------------------------------------------------------- - 200 IF (ABS(RC-1.0D0) .GT. CCMAX) IPUP = MITER - IF (NST .GE. NSLP+MSBP) IPUP = MITER - TN = TN + H - I1 = NQNYH + 1 - DO 215 JB = 1,NQ - I1 = I1 - NYH -!dir$ ivdep - DO 210 I = I1,NQNYH - 210 YH1(I) = YH1(I) + YH1(I+NYH) - 215 CONTINUE -!----------------------------------------------------------------------- -! Up to MAXCOR corrector iterations are taken. A convergence test is -! made on the R.M.S. norm of each correction, weighted by the error -! weight vector EWT. The sum of the corrections is accumulated in the -! vector ACOR(i). The YH array is not altered in the corrector loop. -!----------------------------------------------------------------------- - 220 M = 0 - DO 230 I = 1,N - 230 Y(I) = YH(I,1) - CALL F (NEQ, TN, Y, SAVF) - NFE = NFE + 1 - IF (IPUP .LE. 0) GO TO 250 -!----------------------------------------------------------------------- -! If indicated, the matrix P = I - h*el(1)*J is reevaluated and -! preprocessed before starting the corrector iteration. IPUP is set -! to 0 as an indicator that this has been done. -!----------------------------------------------------------------------- - !CALL PJAC (NEQ, Y, YH, NYH, EWT, ACOR, SAVF, WM, IWM, F, JAC) - CALL DPREPJ(NEQ, Y, YH, NYH, EWT, ACOR, SAVF, WM, IWM, F, JAC) - IPUP = 0 - RC = 1.0D0 - NSLP = NST - CRATE = 0.7D0 - IF (IERPJ .NE. 0) GO TO 430 - 250 DO 260 I = 1,N - 260 ACOR(I) = 0.0D0 - 270 IF (MITER .NE. 0) GO TO 350 -!----------------------------------------------------------------------- -! In the case of functional iteration, update Y directly from -! the result of the last function evaluation. -!----------------------------------------------------------------------- - DO 290 I = 1,N - SAVF(I) = H*SAVF(I) - YH(I,2) - 290 Y(I) = SAVF(I) - ACOR(I) - DEL = DVNORM (N, Y, EWT) - DO 300 I = 1,N - Y(I) = YH(I,1) + EL(1)*SAVF(I) - 300 ACOR(I) = SAVF(I) - GO TO 400 -!----------------------------------------------------------------------- -! In the case of the chord method, compute the corrector error, -! and solve the linear system with that as right-hand side and -! P as coefficient matrix. -!----------------------------------------------------------------------- - 350 DO 360 I = 1,N - 360 Y(I) = H*SAVF(I) - (YH(I,2) + ACOR(I)) - !CALL SLVS (WM, IWM, Y, SAVF) - CALL DSOLSY(WM, IWM, Y, SAVF) - IF (IERSL .LT. 0) GO TO 430 - IF (IERSL .GT. 0) GO TO 410 - DEL = DVNORM (N, Y, EWT) - DO 380 I = 1,N - ACOR(I) = ACOR(I) + Y(I) - 380 Y(I) = YH(I,1) + EL(1)*ACOR(I) -!----------------------------------------------------------------------- -! Test for convergence. If M.gt.0, an estimate of the convergence -! rate constant is stored in CRATE, and this is used in the test. -!----------------------------------------------------------------------- - 400 IF (M .NE. 0) CRATE = MAX(0.2D0*CRATE,DEL/DELP) - DCON = DEL*MIN(1.0D0,1.5D0*CRATE)/(TESCO(2,NQ)*CONIT) - IF (DCON .LE. 1.0D0) GO TO 450 - M = M + 1 - IF (M .EQ. MAXCOR) GO TO 410 - IF (M .GE. 2 .AND. DEL .GT. 2.0D0*DELP) GO TO 410 - DELP = DEL - CALL F (NEQ, TN, Y, SAVF) - NFE = NFE + 1 - GO TO 270 -!----------------------------------------------------------------------- -! The corrector iteration failed to converge. -! If MITER .ne. 0 and the Jacobian is out of date, PJAC is called for -! the next try. Otherwise the YH array is retracted to its values -! before prediction, and H is reduced, if possible. If H cannot be -! reduced or MXNCF failures have occurred, exit with KFLAG = -2. -!----------------------------------------------------------------------- - 410 IF (MITER .EQ. 0 .OR. JCUR .EQ. 1) GO TO 430 - ICF = 1 - IPUP = MITER - GO TO 220 - 430 ICF = 2 - NCF = NCF + 1 - RMAX = 2.0D0 - TN = TOLD - I1 = NQNYH + 1 - DO 445 JB = 1,NQ - I1 = I1 - NYH -!dir$ ivdep - DO 440 I = I1,NQNYH - 440 YH1(I) = YH1(I) - YH1(I+NYH) - 445 CONTINUE - IF (IERPJ .LT. 0 .OR. IERSL .LT. 0) GO TO 680 - IF (ABS(H) .LE. HMIN*1.00001D0) GO TO 670 - IF (NCF .EQ. MXNCF) GO TO 670 - RH = 0.25D0 - IPUP = MITER - IREDO = 1 - GO TO 170 -!----------------------------------------------------------------------- -! The corrector has converged. JCUR is set to 0 -! to signal that the Jacobian involved may need updating later. -! The local error test is made and control passes to statement 500 -! if it fails. -!----------------------------------------------------------------------- - 450 JCUR = 0 - IF (M .EQ. 0) DSM = DEL/TESCO(2,NQ) - IF (M .GT. 0) DSM = DVNORM (N, ACOR, EWT)/TESCO(2,NQ) - IF (DSM .GT. 1.0D0) GO TO 500 -!----------------------------------------------------------------------- -! After a successful step, update the YH array. -! Consider changing H if IALTH = 1. Otherwise decrease IALTH by 1. -! If IALTH is then 1 and NQ .lt. MAXORD, then ACOR is saved for -! use in a possible order increase on the next step. -! If a change in H is considered, an increase or decrease in order -! by one is considered also. A change in H is made only if it is by a -! factor of at least 1.1. If not, IALTH is set to 3 to prevent -! testing for that many steps. -!----------------------------------------------------------------------- - KFLAG = 0 - IREDO = 0 - NST = NST + 1 - HU = H - NQU = NQ - DO 470 J = 1,L - DO 470 I = 1,N - 470 YH(I,J) = YH(I,J) + EL(J)*ACOR(I) - IALTH = IALTH - 1 - IF (IALTH .EQ. 0) GO TO 520 - IF (IALTH .GT. 1) GO TO 700 - IF (L .EQ. LMAX) GO TO 700 - DO 490 I = 1,N - 490 YH(I,LMAX) = ACOR(I) - GO TO 700 -!----------------------------------------------------------------------- -! The error test failed. KFLAG keeps track of multiple failures. -! Restore TN and the YH array to their previous values, and prepare -! to try the step again. Compute the optimum step size for this or -! one lower order. After 2 or more failures, H is forced to decrease -! by a factor of 0.2 or less. -!----------------------------------------------------------------------- - 500 KFLAG = KFLAG - 1 - TN = TOLD - I1 = NQNYH + 1 - DO 515 JB = 1,NQ - I1 = I1 - NYH -!dir$ ivdep - DO 510 I = I1,NQNYH - 510 YH1(I) = YH1(I) - YH1(I+NYH) - 515 CONTINUE - RMAX = 2.0D0 - IF (ABS(H) .LE. HMIN*1.00001D0) GO TO 660 - IF (KFLAG .LE. -3) GO TO 640 - IREDO = 2 - RHUP = 0.0D0 - GO TO 540 -!----------------------------------------------------------------------- -! Regardless of the success or failure of the step, factors -! RHDN, RHSM, and RHUP are computed, by which H could be multiplied -! at order NQ - 1, order NQ, or order NQ + 1, respectively. -! In the case of failure, RHUP = 0.0 to avoid an order increase. -! The largest of these is determined and the new order chosen -! accordingly. If the order is to be increased, we compute one -! additional scaled derivative. -!----------------------------------------------------------------------- - 520 RHUP = 0.0D0 - IF (L .EQ. LMAX) GO TO 540 - DO 530 I = 1,N - 530 SAVF(I) = ACOR(I) - YH(I,LMAX) - DUP = DVNORM (N, SAVF, EWT)/TESCO(3,NQ) - EXUP = 1.0D0/(L+1) - RHUP = 1.0D0/(1.4D0*DUP**EXUP + 0.0000014D0) - 540 EXSM = 1.0D0/L - RHSM = 1.0D0/(1.2D0*DSM**EXSM + 0.0000012D0) - RHDN = 0.0D0 - IF (NQ .EQ. 1) GO TO 560 - DDN = DVNORM (N, YH(1,L), EWT)/TESCO(1,NQ) - EXDN = 1.0D0/NQ - RHDN = 1.0D0/(1.3D0*DDN**EXDN + 0.0000013D0) - 560 IF (RHSM .GE. RHUP) GO TO 570 - IF (RHUP .GT. RHDN) GO TO 590 - GO TO 580 - 570 IF (RHSM .LT. RHDN) GO TO 580 - NEWQ = NQ - RH = RHSM - GO TO 620 - 580 NEWQ = NQ - 1 - RH = RHDN - IF (KFLAG .LT. 0 .AND. RH .GT. 1.0D0) RH = 1.0D0 - GO TO 620 - 590 NEWQ = L - RH = RHUP - IF (RH .LT. 1.1D0) GO TO 610 - R = EL(L)/L - DO 600 I = 1,N - 600 YH(I,NEWQ+1) = ACOR(I)*R - GO TO 630 - 610 IALTH = 3 - GO TO 700 - 620 IF ((KFLAG .EQ. 0) .AND. (RH .LT. 1.1D0)) GO TO 610 - IF (KFLAG .LE. -2) RH = MIN(RH,0.2D0) -!----------------------------------------------------------------------- -! If there is a change of order, reset NQ, l, and the coefficients. -! In any case H is reset according to RH and the YH array is rescaled. -! Then exit from 690 if the step was OK, or redo the step otherwise. -!----------------------------------------------------------------------- - IF (NEWQ .EQ. NQ) GO TO 170 - 630 NQ = NEWQ - L = NQ + 1 - IRET = 2 - GO TO 150 -!----------------------------------------------------------------------- -! Control reaches this section if 3 or more failures have occured. -! If 10 failures have occurred, exit with KFLAG = -1. -! It is assumed that the derivatives that have accumulated in the -! YH array have errors of the wrong order. Hence the first -! derivative is recomputed, and the order is set to 1. Then -! H is reduced by a factor of 10, and the step is retried, -! until it succeeds or H reaches HMIN. -!----------------------------------------------------------------------- - 640 IF (KFLAG .EQ. -10) GO TO 660 - RH = 0.1D0 - RH = MAX(HMIN/ABS(H),RH) - H = H*RH - DO 645 I = 1,N - 645 Y(I) = YH(I,1) - CALL F (NEQ, TN, Y, SAVF) - NFE = NFE + 1 - DO 650 I = 1,N - 650 YH(I,2) = H*SAVF(I) - IPUP = MITER - IALTH = 5 - IF (NQ .EQ. 1) GO TO 200 - NQ = 1 - L = 2 - IRET = 3 - GO TO 150 -!----------------------------------------------------------------------- -! All returns are made through this section. H is saved in HOLD -! to allow the caller to change H on the next step. -!----------------------------------------------------------------------- - 660 KFLAG = -1 - GO TO 720 - 670 KFLAG = -2 - GO TO 720 - 680 KFLAG = -3 - GO TO 720 - 690 RMAX = 10.0D0 - 700 R = 1.0D0/TESCO(2,NQU) - DO 710 I = 1,N - 710 ACOR(I) = ACOR(I)*R - 720 HOLD = H - JSTART = 1 - RETURN -!----------------------- END OF SUBROUTINE DSTODE ---------------------- - END SUBROUTINE DSTODE -!DECK DEWSET - SUBROUTINE DEWSET (N, ITOL, RelTol, AbsTol, YCUR, EWT) -!***BEGIN PROLOGUE DEWSET -!***SUBSIDIARY -!***PURPOSE Set error weight vector. -!***TYPE REAL(kind=dp) (SEWSET-S, DEWSET-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! This subroutine sets the error weight vector EWT according to -! EWT(i) = RelTol(i)*ABS(YCUR(i)) + AbsTol(i), i = 1,...,N, -! with the subscript on RelTol and/or AbsTol possibly replaced by 1 above, -! depending on the value of ITOL. -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED (NONE) -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -!***END PROLOGUE DEWSET -!**End - INTEGER N, ITOL - INTEGER I - REAL(kind=dp) RelTol(*), AbsTol(*), YCUR(N), EWT(N) -! -!***FIRST EXECUTABLE STATEMENT DEWSET - GO TO (10, 20, 30, 40), ITOL - 10 CONTINUE - DO 15 I = 1,N - 15 EWT(I) = RelTol(1)*ABS(YCUR(I)) + AbsTol(1) - RETURN - 20 CONTINUE - DO 25 I = 1,N - 25 EWT(I) = RelTol(1)*ABS(YCUR(I)) + AbsTol(I) - RETURN - 30 CONTINUE - DO 35 I = 1,N - 35 EWT(I) = RelTol(I)*ABS(YCUR(I)) + AbsTol(1) - RETURN - 40 CONTINUE - DO 45 I = 1,N - 45 EWT(I) = RelTol(I)*ABS(YCUR(I)) + AbsTol(I) - RETURN -!----------------------- END OF SUBROUTINE DEWSET ---------------------- - END SUBROUTINE DEWSET -!DECK DVNORM - REAL(kind=dp) FUNCTION DVNORM (N, V, W) -!***BEGIN PROLOGUE DVNORM -!***SUBSIDIARY -!***PURPOSE Weighted root-mean-square vector norm. -!***TYPE REAL(kind=dp) (SVNORM-S, DVNORM-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! This function routine computes the weighted root-mean-square norm -! of the vector of length N contained in the array V, with weights -! contained in the array W of length N: -! DVNORM = SQRT( (1/N) * SUM( V(i)*W(i) )**2 ) -! -!***SEE ALSO DLSODE -!***ROUTINES CALLED (NONE) -!***REVISION HISTORY (YYMMDD) -! 791129 DATE WRITTEN -! 890501 Modified prologue to SLATEC/LDOC format. (FNF) -! 890503 Minor cosmetic changes. (FNF) -! 930809 Renamed to allow single/double precision versions. (ACH) -!***END PROLOGUE DVNORM -!**End - INTEGER N, I - REAL(kind=dp) V(N), W(N), SUM -! -!***FIRST EXECUTABLE STATEMENT DVNORM - SUM = 0.0D0 - DO 10 I = 1,N - 10 SUM = SUM + (V(I)*W(I))**2 - DVNORM = SQRT(SUM/N) - RETURN -!----------------------- END OF FUNCTION DVNORM ------------------------ - END FUNCTION DVNORM -!DECK XERRWD - SUBROUTINE XERRWD (MSG, NMES, NERR, LEVEL, NI, I1, I2, NR, R1, R2) -!***BEGIN PROLOGUE XERRWD -!***SUBSIDIARY -!***PURPOSE Write error message with values. -!***CATEGORY R3C -!***TYPE REAL(kind=dp) (XERRWV-S, XERRWD-D) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! Subroutines XERRWD, XSETF, XSETUN, and the function routine IXSAV, -! as given here, constitute a simplified version of the SLATEC error -! handling package. -! -! All arguments are input arguments. -! -! MSG = The message (character array). -! NMES = The length of MSG (number of characters). -! NERR = The error number (not used). -! LEVEL = The error level.. -! 0 or 1 means recoverable (control returns to caller). -! 2 means fatal (run is aborted--see note below). -! NI = Number of integers (0, 1, or 2) to be printed with message. -! I1,I2 = Integers to be printed, depending on NI. -! NR = Number of reals (0, 1, or 2) to be printed with message. -! R1,R2 = Reals to be printed, depending on NR. -! -! Note.. this routine is machine-dependent and specialized for use -! in limited context, in the following ways.. -! 1. The argument MSG is assumed to be of type CHARACTER, and -! the message is printed with a format of (1X,A). -! 2. The message is assumed to take only one line. -! Multi-line messages are generated by repeated calls. -! 3. If LEVEL = 2, control passes to the statement STOP -! to abort the run. This statement may be machine-dependent. -! 4. R1 and R2 are assumed to be in double precision and are printed -! in D21.13 format. -! -!***ROUTINES CALLED IXSAV -!***REVISION HISTORY (YYMMDD) -! 920831 DATE WRITTEN -! 921118 Replaced MFLGSV/LUNSAV by IXSAV. (ACH) -! 930329 Modified prologue to SLATEC format. (FNF) -! 930407 Changed MSG from CHARACTER*1 array to variable. (FNF) -! 930922 Minor cosmetic change. (FNF) -!***END PROLOGUE XERRWD -! -!*Internal Notes: -! -! For a different default logical unit number, IXSAV (or a subsidiary -! routine that it calls) will need to be modified. -! For a different run-abort command, change the statement following -! statement 100 at the end. -!----------------------------------------------------------------------- -! Subroutines called by XERRWD.. None -! Function routine called by XERRWD.. IXSAV -!----------------------------------------------------------------------- -!**End -! -! Declare arguments. -! - REAL(kind=dp) R1, R2 - INTEGER NMES, NERR, LEVEL, NI, I1, I2, NR - CHARACTER*(*) MSG -! -! Declare local variables. -! - INTEGER LUNIT, MESFLG !, IXSAV -! -! Get logical unit number and message print flag. -! -!***FIRST EXECUTABLE STATEMENT XERRWD - LUNIT = IXSAV (1, 0, .FALSE.) - MESFLG = IXSAV (2, 0, .FALSE.) - IF (MESFLG .EQ. 0) GO TO 100 -! -! Write the message. -! - WRITE (LUNIT,10) MSG - 10 FORMAT(1X,A) - IF (NI .EQ. 1) WRITE (LUNIT, 20) I1 - 20 FORMAT(6X,'In above message, I1 =',I10) - IF (NI .EQ. 2) WRITE (LUNIT, 30) I1,I2 - 30 FORMAT(6X,'In above message, I1 =',I10,3X,'I2 =',I10) - IF (NR .EQ. 1) WRITE (LUNIT, 40) R1 - 40 FORMAT(6X,'In above message, R1 =',D21.13) - IF (NR .EQ. 2) WRITE (LUNIT, 50) R1,R2 - 50 FORMAT(6X,'In above, R1 =',D21.13,3X,'R2 =',D21.13) -! -! Abort the run if LEVEL = 2. -! - 100 IF (LEVEL .NE. 2) RETURN - STOP -!----------------------- End of Subroutine XERRWD ---------------------- - END SUBROUTINE XERRWD -!DECK XSETF - SUBROUTINE XSETF (MFLAG) -!***BEGIN PROLOGUE XSETF -!***PURPOSE Reset the error print control flag. -!***CATEGORY R3A -!***TYPE ALL (XSETF-A) -!***KEYWORDS ERROR CONTROL -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! XSETF sets the error print control flag to MFLAG: -! MFLAG=1 means print all messages (the default). -! MFLAG=0 means no printing. -! -!***SEE ALSO XERRWD, XERRWV -!***REFERENCES (NONE) -!***ROUTINES CALLED IXSAV -!***REVISION HISTORY (YYMMDD) -! 921118 DATE WRITTEN -! 930329 Added SLATEC format prologue. (FNF) -! 930407 Corrected SEE ALSO section. (FNF) -! 930922 Made user-callable, and other cosmetic changes. (FNF) -!***END PROLOGUE XSETF -! -! Subroutines called by XSETF.. None -! Function routine called by XSETF.. IXSAV -!----------------------------------------------------------------------- -!**End - INTEGER MFLAG, JUNK !, IXSAV -! -!***FIRST EXECUTABLE STATEMENT XSETF - IF (MFLAG .EQ. 0 .OR. MFLAG .EQ. 1) JUNK = IXSAV (2,MFLAG,.TRUE.) - RETURN -!----------------------- End of Subroutine XSETF ----------------------- - END SUBROUTINE XSETF -!DECK XSETUN - SUBROUTINE XSETUN (LUN) -!***BEGIN PROLOGUE XSETUN -!***PURPOSE Reset the logical unit number for error messages. -!***CATEGORY R3B -!***TYPE ALL (XSETUN-A) -!***KEYWORDS ERROR CONTROL -!***DESCRIPTION -! -! XSETUN sets the logical unit number for error messages to LUN. -! -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***SEE ALSO XERRWD, XERRWV -!***REFERENCES (NONE) -!***ROUTINES CALLED IXSAV -!***REVISION HISTORY (YYMMDD) -! 921118 DATE WRITTEN -! 930329 Added SLATEC format prologue. (FNF) -! 930407 Corrected SEE ALSO section. (FNF) -! 930922 Made user-callable, and other cosmetic changes. (FNF) -!***END PROLOGUE XSETUN -! -! Subroutines called by XSETUN.. None -! Function routine called by XSETUN.. IXSAV -!----------------------------------------------------------------------- -!**End - INTEGER LUN, JUNK !, IXSAV -! -!***FIRST EXECUTABLE STATEMENT XSETUN - IF (LUN .GT. 0) JUNK = IXSAV (1,LUN,.TRUE.) - RETURN -!----------------------- End of Subroutine XSETUN ---------------------- - END SUBROUTINE XSETUN -!DECK IXSAV - INTEGER FUNCTION IXSAV (IPAR, IVALUE, ISET) -!***BEGIN PROLOGUE IXSAV -!***SUBSIDIARY -!***PURPOSE Save and recall error message control parameters. -!***CATEGORY R3C -!***TYPE ALL (IXSAV-A) -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! -! IXSAV saves and recalls one of two error message parameters: -! LUNIT, the logical unit number to which messages are printed, and -! MESFLG, the message print flag. -! This is a modification of the SLATEC library routine J4SAVE. -! -! Saved local variables.. -! LUNIT = Logical unit number for messages. The default is obtained -! by a call to IUMACH (may be machine-dependent). -! MESFLG = Print control flag.. -! 1 means print all messages (the default). -! 0 means no printing. -! -! On input.. -! IPAR = Parameter indicator (1 for LUNIT, 2 for MESFLG). -! IVALUE = The value to be set for the parameter, if ISET = .TRUE. -! ISET = Logical flag to indicate whether to read or write. -! If ISET = .TRUE., the parameter will be given -! the value IVALUE. If ISET = .FALSE., the parameter -! will be unchanged, and IVALUE is a dummy argument. -! -! On return.. -! IXSAV = The (old) value of the parameter. -! -!***SEE ALSO XERRWD, XERRWV -!***ROUTINES CALLED IUMACH -!***REVISION HISTORY (YYMMDD) -! 921118 DATE WRITTEN -! 930329 Modified prologue to SLATEC format. (FNF) -! 930915 Added IUMACH call to get default output unit. (ACH) -! 930922 Minor cosmetic changes. (FNF) -! 010425 Type declaration for IUMACH added. (ACH) -!***END PROLOGUE IXSAV -! -! Subroutines called by IXSAV.. None -! Function routine called by IXSAV.. IUMACH -!----------------------------------------------------------------------- -!**End - LOGICAL ISET - INTEGER IPAR, IVALUE -!----------------------------------------------------------------------- - INTEGER LUNIT, MESFLG!, IUMACH -!----------------------------------------------------------------------- -! The following Fortran-77 declaration is to cause the values of the -! listed (local) variables to be saved between calls to this routine. -!----------------------------------------------------------------------- - SAVE LUNIT, MESFLG - DATA LUNIT/-1/, MESFLG/1/ -! -!***FIRST EXECUTABLE STATEMENT IXSAV - IF (IPAR .EQ. 1) THEN - IF (LUNIT .EQ. -1) LUNIT = IUMACH() - IXSAV = LUNIT - IF (ISET) LUNIT = IVALUE - ENDIF -! - IF (IPAR .EQ. 2) THEN - IXSAV = MESFLG - IF (ISET) MESFLG = IVALUE - ENDIF -! - RETURN -!----------------------- End of Function IXSAV ------------------------- - END FUNCTION IXSAV -!DECK IUMACH - INTEGER FUNCTION IUMACH() -!***BEGIN PROLOGUE IUMACH -!***PURPOSE Provide standard output unit number. -!***CATEGORY R1 -!***TYPE INTEGER (IUMACH-I) -!***KEYWORDS MACHINE CONSTANTS -!***AUTHOR Hindmarsh, Alan C., (LLNL) -!***DESCRIPTION -! *Usage: -! INTEGER LOUT, IUMACH -! LOUT = IUMACH() -! -! *Function Return Values: -! LOUT : the standard logical unit for Fortran output. -! -!***REFERENCES (NONE) -!***ROUTINES CALLED (NONE) -!***REVISION HISTORY (YYMMDD) -! 930915 DATE WRITTEN -! 930922 Made user-callable, and other cosmetic changes. (FNF) -!***END PROLOGUE IUMACH -! -!*Internal Notes: -! The built-in value of 6 is standard on a wide range of Fortran -! systems. This may be machine-dependent. -!**End -!***FIRST EXECUTABLE STATEMENT IUMACH - IUMACH = 6 -! - RETURN -!----------------------- End of Function IUMACH ------------------------ - END FUNCTION IUMACH - -!---- END OF SUBROUTINE DLSODE AND ITS INTERNAL PROCEDURES - END SUBROUTINE DLSODE -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE FUN_CHEM(N, T, V, FCT) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - USE kpp_achem_gas_Function, ONLY: Fun - USE kpp_achem_gas_Rates - - IMPLICIT NONE - - INTEGER :: N - REAL(kind=dp) :: V(NVAR), FCT(NVAR), T - -! TOLD = TIME -! TIME = T -! CALL Update_SUN() -! CALL Update_RCONST() -! CALL Update_PHOTO() -! TIME = TOLD - - CALL Fun(V, FIX, RCONST, FCT) - - !Nfun=Nfun+1 - - END SUBROUTINE FUN_CHEM - - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE JAC_CHEM (N, T, V, JF) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - USE kpp_achem_gas_JacobianSP - USE kpp_achem_gas_Jacobian, ONLY: Jac_SP - USE kpp_achem_gas_Rates - - IMPLICIT NONE - - REAL(kind=dp) :: V(NVAR), T - INTEGER :: N -#ifdef FULL_ALGEBRA - INTEGER :: I, J - REAL(kind=dp) :: JV(LU_NONZERO), JF(NVAR,NVAR) -#else - REAL(kind=dp) :: JF(LU_NONZERO) -#endif - -! TOLD = TIME -! TIME = T -! CALL Update_SUN() -! CALL Update_RCONST() -! CALL Update_PHOTO() -! TIME = TOLD - -#ifdef FULL_ALGEBRA - CALL Jac_SP(V, FIX, RCONST, JV) - DO j=1,NVAR - DO i=1,NVAR - JF(i,j) = 0.0d0 - END DO - END DO - DO i=1,LU_NONZERO - JF(LU_IROW(i),LU_ICOL(i)) = JV(i) - END DO -#else - CALL Jac_SP(V, FIX, RCONST, JF) -#endif - !Njac=Njac+1 - - END SUBROUTINE JAC_CHEM - - -END MODULE kpp_achem_gas_Integrator -! End of INTEGRATE function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Jacobian.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Jacobian.f90 deleted file mode 100644 index 17e39bc4..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Jacobian.f90 +++ /dev/null @@ -1,161 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! The ODE Jacobian of Chemical Model File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Jacobian.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Jacobian - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - IMPLICIT NONE - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Jac_SP - the Jacobian of Variables in sparse matrix representation -! Arguments : -! V - Concentrations of variable species (local) -! F - Concentrations of fixed species (local) -! RCT - Rate constants (local) -! JVS - sparse Jacobian of variables -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Jac_SP ( V, F, RCT, JVS ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! F - Concentrations of fixed species (local) - REAL(kind=dp) :: F(NFIX) -! RCT - Rate constants (local) - REAL(kind=dp) :: RCT(NREACT) -! JVS - sparse Jacobian of variables - REAL(kind=dp) :: JVS(LU_NONZERO) - - -! Local variables -! B - Temporary array - REAL(kind=dp) :: B(10) - -! B(1) = dA(1)/dV(1) - B(1) = RCT(1)*F(2) -! B(3) = dA(2)/dV(1) - B(3) = RCT(2)*F(2) -! B(5) = dA(3)/dV(1) - B(5) = RCT(3)*F(1) -! B(7) = dA(4)/dV(2) - B(7) = RCT(4)*F(2) -! B(9) = dA(5)/dV(3) - B(9) = RCT(5)*F(2) - -! Construct the Jacobian terms from B's -! JVS(1) = Jac_FULL(1,1) - JVS(1) = -B(1)-B(3)-B(5) -! JVS(2) = Jac_FULL(2,1) - JVS(2) = B(1)+0.75*B(3)+B(5) -! JVS(3) = Jac_FULL(2,2) - JVS(3) = -B(7) -! JVS(4) = Jac_FULL(3,3) - JVS(4) = -B(9) -! JVS(5) = Jac_FULL(4,1) - JVS(5) = 0.25*B(3) -! JVS(6) = Jac_FULL(4,4) - JVS(6) = 0 -! JVS(7) = Jac_FULL(5,2) - JVS(7) = B(7) -! JVS(8) = Jac_FULL(5,5) - JVS(8) = 0 - -END SUBROUTINE Jac_SP - -! End of Jac_SP function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Jac_SP_Vec - function for sparse multiplication: sparse Jacobian times vector -! Arguments : -! JVS - sparse Jacobian of variables -! UV - User vector for variables -! JUV - Jacobian times user vector -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Jac_SP_Vec ( JVS, UV, JUV ) - -! JVS - sparse Jacobian of variables - REAL(kind=dp) :: JVS(LU_NONZERO) -! UV - User vector for variables - REAL(kind=dp) :: UV(NVAR) -! JUV - Jacobian times user vector - REAL(kind=dp) :: JUV(NVAR) - - JUV(1) = JVS(1)*UV(1) - JUV(2) = JVS(2)*UV(1)+JVS(3)*UV(2) - JUV(3) = JVS(4)*UV(3) - JUV(4) = JVS(5)*UV(1)+JVS(6)*UV(4) - JUV(5) = JVS(7)*UV(2)+JVS(8)*UV(5) - -END SUBROUTINE Jac_SP_Vec - -! End of Jac_SP_Vec function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! JacTR_SP_Vec - sparse multiplication: sparse Jacobian transposed times vector -! Arguments : -! JVS - sparse Jacobian of variables -! UV - User vector for variables -! JTUV - Jacobian transposed times user vector -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE JacTR_SP_Vec ( JVS, UV, JTUV ) - -! JVS - sparse Jacobian of variables - REAL(kind=dp) :: JVS(LU_NONZERO) -! UV - User vector for variables - REAL(kind=dp) :: UV(NVAR) -! JTUV - Jacobian transposed times user vector - REAL(kind=dp) :: JTUV(NVAR) - - JTUV(1) = JVS(1)*UV(1)+JVS(2)*UV(2)+JVS(5)*UV(4) - JTUV(2) = JVS(3)*UV(2)+JVS(7)*UV(5) - JTUV(3) = JVS(4)*UV(3) - JTUV(4) = JVS(6)*UV(4) - JTUV(5) = JVS(8)*UV(5) - -END SUBROUTINE JacTR_SP_Vec - -! End of JacTR_SP_Vec function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Jacobian - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_JacobianSP.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_JacobianSP.f90 deleted file mode 100644 index e2fc812a..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_JacobianSP.f90 +++ /dev/null @@ -1,48 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Sparse Jacobian Data Structures File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_JacobianSP.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_JacobianSP - - PUBLIC - SAVE - - -! Sparse Jacobian Data - - - INTEGER, PARAMETER, DIMENSION(8) :: LU_IROW = (/ & - 1, 2, 2, 3, 4, 4, 5, 5 /) - - INTEGER, PARAMETER, DIMENSION(8) :: LU_ICOL = (/ & - 1, 1, 2, 3, 1, 4, 2, 5 /) - - INTEGER, PARAMETER, DIMENSION(6) :: LU_CROW = (/ & - 1, 2, 4, 5, 7, 9 /) - - INTEGER, PARAMETER, DIMENSION(6) :: LU_DIAG = (/ & - 1, 3, 4, 6, 8, 9 /) - - -END MODULE kpp_achem_gas_JacobianSP - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_LinearAlgebra.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_LinearAlgebra.f90 deleted file mode 100644 index bea06443..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_LinearAlgebra.f90 +++ /dev/null @@ -1,1160 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Linear Algebra Data and Routines File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_LinearAlgebra.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_LinearAlgebra - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - IMPLICIT NONE - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! SPARSE_UTIL - SPARSE utility functions -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppDecomp( JVS, IER ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Sparse LU factorization -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: IER - REAL(kind=dp) :: JVS(LU_NONZERO), W(NVAR), a - INTEGER :: k, kk, j, jj - - a = 0. ! mz_rs_20050606 - IER = 0 - DO k=1,NVAR - ! mz_rs_20050606: don't check if real value == 0 - ! IF ( JVS( LU_DIAG(k) ) .EQ. 0. ) THEN - IF ( ABS(JVS(LU_DIAG(k))) < TINY(a) ) THEN - IER = k - RETURN - END IF - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - W( LU_ICOL(kk) ) = JVS(kk) - END DO - DO kk = LU_CROW(k), LU_DIAG(k)-1 - j = LU_ICOL(kk) - a = -W(j) / JVS( LU_DIAG(j) ) - W(j) = -a - DO jj = LU_DIAG(j)+1, LU_CROW(j+1)-1 - W( LU_ICOL(jj) ) = W( LU_ICOL(jj) ) + a*JVS(jj) - END DO - END DO - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - JVS(kk) = W( LU_ICOL(kk) ) - END DO - END DO - -END SUBROUTINE KppDecomp - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppDecompCmplx( JVS, IER ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Sparse LU factorization, complex -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: IER - DOUBLE COMPLEX :: JVS(LU_NONZERO), W(NVAR), a - REAL(kind=dp) :: b = 0.0 - INTEGER :: k, kk, j, jj - - IER = 0 - DO k=1,NVAR - IF ( ABS(JVS(LU_DIAG(k))) < TINY(b) ) THEN - IER = k - RETURN - END IF - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - W( LU_ICOL(kk) ) = JVS(kk) - END DO - DO kk = LU_CROW(k), LU_DIAG(k)-1 - j = LU_ICOL(kk) - a = -W(j) / JVS( LU_DIAG(j) ) - W(j) = -a - DO jj = LU_DIAG(j)+1, LU_CROW(j+1)-1 - W( LU_ICOL(jj) ) = W( LU_ICOL(jj) ) + a*JVS(jj) - END DO - END DO - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - JVS(kk) = W( LU_ICOL(kk) ) - END DO - END DO - -END SUBROUTINE KppDecompCmplx - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppDecompCmplxR( JVSR, JVSI, IER ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Sparse LU factorization, complex -! (Real and Imaginary parts are used instead of complex data type) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: IER - REAL(kind=dp) :: JVSR(LU_NONZERO), JVSI(LU_NONZERO) - REAL(kind=dp) :: WR(NVAR), WI(NVAR), ar, ai, den - INTEGER :: k, kk, j, jj - - IER = 0 - ar = 0.0 - DO k=1,NVAR - IF ( ( ABS(JVSR(LU_DIAG(k))) < TINY(ar) ) .AND. & - ( ABS(JVSI(LU_DIAG(k))) < TINY(ar) ) ) THEN - IER = k - RETURN - END IF - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - WR( LU_ICOL(kk) ) = JVSR(kk) - WI( LU_ICOL(kk) ) = JVSI(kk) - END DO - DO kk = LU_CROW(k), LU_DIAG(k)-1 - j = LU_ICOL(kk) - den = JVSR(LU_DIAG(j))**2 + JVSI(LU_DIAG(j))**2 - ar = -(WR(j)*JVSR(LU_DIAG(j)) + WI(j)*JVSI(LU_DIAG(j)))/den - ai = -(WI(j)*JVSR(LU_DIAG(j)) - WR(j)*JVSI(LU_DIAG(j)))/den - WR(j) = -ar - WI(j) = -ai - DO jj = LU_DIAG(j)+1, LU_CROW(j+1)-1 - WR( LU_ICOL(jj) ) = WR( LU_ICOL(jj) ) + ar*JVSR(jj) - ai*JVSI(jj) - WI( LU_ICOL(jj) ) = WI( LU_ICOL(jj) ) + ar*JVSI(jj) + ai*JVSR(jj) - END DO - END DO - DO kk = LU_CROW(k), LU_CROW(k+1)-1 - JVSR(kk) = WR( LU_ICOL(kk) ) - JVSI(kk) = WI( LU_ICOL(kk) ) - END DO - END DO - -END SUBROUTINE KppDecompCmplxR - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveIndirect( JVS, X ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Sparse solve subroutine using indirect addressing -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - REAL(kind=dp) :: JVS(LU_NONZERO), X(NVAR), sum - - DO i=1,NVAR - DO j = LU_CROW(i), LU_DIAG(i)-1 - X(i) = X(i) - JVS(j)*X(LU_ICOL(j)); - END DO - END DO - - DO i=NVAR,1,-1 - sum = X(i); - DO j = LU_DIAG(i)+1, LU_CROW(i+1)-1 - sum = sum - JVS(j)*X(LU_ICOL(j)); - END DO - X(i) = sum/JVS(LU_DIAG(i)); - END DO - -END SUBROUTINE KppSolveIndirect - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveTRIndirect( JVS, X ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Complex sparse solve transpose subroutine using indirect addressing -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - REAL(kind=dp) :: JVS(LU_NONZERO), X(NVAR) - - DO i=1,NVAR - X(i) = X(i)/JVS(LU_DIAG(i)) - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_DIAG(i)+1,LU_CROW(i+1)-1 - X(LU_ICOL(j)) = X(LU_ICOL(j))-JVS(j)*X(i) - END DO - END DO - - DO i=NVAR, 1, -1 - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_CROW(i),LU_DIAG(i)-1 - X(LU_ICOL(j)) = X(LU_ICOL(j))-JVS(j)*X(i) - END DO - END DO - -END SUBROUTINE KppSolveTRIndirect - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveCmplx( JVS, X ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Complex sparse solve subroutine using indirect addressing -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - DOUBLE COMPLEX :: JVS(LU_NONZERO), X(NVAR), sum - - DO i=1,NVAR - DO j = LU_CROW(i), LU_DIAG(i)-1 - X(i) = X(i) - JVS(j)*X(LU_ICOL(j)); - END DO - END DO - - DO i=NVAR,1,-1 - sum = X(i); - DO j = LU_DIAG(i)+1, LU_CROW(i+1)-1 - sum = sum - JVS(j)*X(LU_ICOL(j)); - END DO - X(i) = sum/JVS(LU_DIAG(i)); - END DO - -END SUBROUTINE KppSolveCmplx - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveCmplxR( JVSR, JVSI, XR, XI ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Complex sparse solve subroutine using indirect addressing -! (Real and Imaginary parts are used instead of complex data type) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - REAL(kind=dp) :: JVSR(LU_NONZERO), JVSI(LU_NONZERO), XR(NVAR), XI(NVAR), sumr, sumi, den - - DO i=1,NVAR - DO j = LU_CROW(i), LU_DIAG(i)-1 - XR(i) = XR(i) - (JVSR(j)*XR(LU_ICOL(j)) - JVSI(j)*XI(LU_ICOL(j))) - XI(i) = XI(i) - (JVSR(j)*XI(LU_ICOL(j)) + JVSI(j)*XR(LU_ICOL(j))) - END DO - END DO - - DO i=NVAR,1,-1 - sumr = XR(i); sumi = XI(i) - DO j = LU_DIAG(i)+1, LU_CROW(i+1)-1 - sumr = sumr - (JVSR(j)*XR(LU_ICOL(j)) - JVSI(j)*XI(LU_ICOL(j))) - sumi = sumi - (JVSR(j)*XI(LU_ICOL(j)) + JVSI(j)*XR(LU_ICOL(j))) - END DO - den = JVSR(LU_DIAG(i))**2 + JVSI(LU_DIAG(i))**2 - XR(i) = (sumr*JVSR(LU_DIAG(i)) + sumi*JVSI(LU_DIAG(i)))/den - XI(i) = (sumi*JVSR(LU_DIAG(i)) - sumr*JVSI(LU_DIAG(i)))/den - END DO - -END SUBROUTINE KppSolveCmplxR - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveTRCmplx( JVS, X ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Complex sparse solve transpose subroutine using indirect addressing -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - DOUBLE COMPLEX :: JVS(LU_NONZERO), X(NVAR) - - DO i=1,NVAR - X(i) = X(i)/JVS(LU_DIAG(i)) - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_DIAG(i)+1,LU_CROW(i+1)-1 - X(LU_ICOL(j)) = X(LU_ICOL(j))-JVS(j)*X(i) - END DO - END DO - - DO i=NVAR, 1, -1 - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_CROW(i),LU_DIAG(i)-1 - X(LU_ICOL(j)) = X(LU_ICOL(j))-JVS(j)*X(i) - END DO - END DO - -END SUBROUTINE KppSolveTRCmplx - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -SUBROUTINE KppSolveTRCmplxR( JVSR, JVSI, XR, XI ) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Complex sparse solve transpose subroutine using indirect addressing -! (Real and Imaginary parts are used instead of complex data type) -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_JacobianSP - - INTEGER :: i, j - REAL(kind=dp) :: JVSR(LU_NONZERO), JVSI(LU_NONZERO), XR(NVAR), XI(NVAR), den - - DO i=1,NVAR - den = JVSR(LU_DIAG(i))**2 + JVSI(LU_DIAG(i))**2 - XR(i) = (XR(i)*JVSR(LU_DIAG(i)) + XI(i)*JVSI(LU_DIAG(i)))/den - XI(i) = (XI(i)*JVSR(LU_DIAG(i)) - XR(i)*JVSI(LU_DIAG(i)))/den - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_DIAG(i)+1,LU_CROW(i+1)-1 - XR(LU_ICOL(j)) = XR(LU_ICOL(j))-(JVSR(j)*XR(i) - JVSI(j)*XI(i)) - XI(LU_ICOL(j)) = XI(LU_ICOL(j))-(JVSI(j)*XR(i) + JVSR(j)*XI(i)) - END DO - END DO - - DO i=NVAR, 1, -1 - ! subtract all nonzero elements in row i of JVS from X - DO j=LU_CROW(i),LU_DIAG(i)-1 - XR(LU_ICOL(j)) = XR(LU_ICOL(j))-(JVSR(j)*XR(i) - JVSI(j)*XI(i)) - XI(LU_ICOL(j)) = XI(LU_ICOL(j))-(JVSI(j)*XR(i) + JVSR(j)*XI(i)) - END DO - END DO - -END SUBROUTINE KppSolveTRCmplxR - - -! -! Next few commented subroutines perform sparse big linear algebra -! -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!SUBROUTINE KppDecompBig( JVS, IP, IER ) -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! Sparse LU factorization -!! for the Runge Kutta (3n)x(3n) linear system -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! USE kpp_achem_gas_Parameters -! USE kpp_achem_gas_JacobianSP -! -! INTEGER :: IP3(3), IER, IP(3,NVAR) -! REAL(kind=dp) :: JVS(3,3,LU_NONZERO), W(3,3,NVAR), a(3,3), E(3,3) -! INTEGER :: k, kk, j, jj -! -! a = 0.0d0 -! IER = 0 -! DO k=1,NVAR -! DO kk = LU_CROW(k), LU_CROW(k+1)-1 -! W( 1:3,1:3,LU_ICOL(kk) ) = JVS(1:3,1:3,kk) -! END DO -! DO kk = LU_CROW(k), LU_DIAG(k)-1 -! j = LU_ICOL(kk) -! E(1:3,1:3) = JVS( 1:3,1:3,LU_DIAG(j) ) -! ! CALL DGETRF(3,3,E,3,IP3,IER) -! CALL FAC3(E,IP3,IER) -! IF ( IER /= 0 ) RETURN -! ! a = W(j) / JVS( LU_DIAG(j) ) -! a(1:3,1:3) = W( 1:3,1:3,j ) -! ! CALL DGETRS ('N',3,3,E,3,IP3,a,3,IER) -! CALL SOL3('N',E,IP3,a(1,1)) -! CALL SOL3('N',E,IP3,a(1,2)) -! CALL SOL3('N',E,IP3,a(1,3)) -! W(1:3,1:3,j) = a(1:3,1:3) -! DO jj = LU_DIAG(j)+1, LU_CROW(j+1)-1 -! W( 1:3,1:3,LU_ICOL(jj) ) = W( 1:3,1:3,LU_ICOL(jj) ) & -! - MATMUL( a(1:3,1:3) , JVS(1:3,1:3,jj) ) -! END DO -! END DO -! DO kk = LU_CROW(k), LU_CROW(k+1)-1 -! JVS(1:3,1:3,kk) = W( 1:3,1:3,LU_ICOL(kk) ) -! END DO -! END DO -! -! DO k=1,NVAR -! ! CALL WGEFA(JVS(1,1,LU_DIAG(k)),3,3,IP(1,k),IER) -! ! CALL DGETRF(3,3,JVS(1,1,LU_DIAG(k)),3,IP(1,k),IER) -! CALL FAC3(JVS(1,1,LU_DIAG(k)),IP(1,k),IER) -! IF ( IER /= 0 ) RETURN -! END DO -! -!END SUBROUTINE KppDecompBig -! -! -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!SUBROUTINE KppSolveBig( JVS, IP, X ) -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! Sparse solve subroutine using indirect addressing -!! for the Runge Kutta (3n)x(3n) linear system -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! USE kpp_achem_gas_Parameters -! USE kpp_achem_gas_JacobianSP -! -! INTEGER :: i, j, k, m, IP3(3), IP(3,NVAR), IER -! REAL(kind=dp) :: JVS(3,3,LU_NONZERO), X(3,NVAR), sum(3) -! -! DO i=1,NVAR -! DO j = LU_CROW(i), LU_DIAG(i)-1 -! !X(1:3,i) = X(1:3,i) - MATMUL(JVS(1:3,1:3,j),X(1:3,LU_ICOL(j))); -! DO k=1,3 -! DO m=1,3 -! X(k,i) = X(k,i) - JVS(k,m,j)*X(m,LU_ICOL(j)) -! END DO -! END DO -! END DO -! END DO -! -! DO i=NVAR,1,-1 -! sum(1:3) = X(1:3,i); -! DO j = LU_DIAG(i)+1, LU_CROW(i+1)-1 -! !sum(1:3) = sum(1:3) - MATMUL(JVS(1:3,1:3,j),X(1:3,LU_ICOL(j))); -! DO k=1,3 -! DO m=1,3 -! sum(k) = sum(k) - JVS(k,m,j)*X(m,LU_ICOL(j)) -! END DO -! END DO -! END DO -! ! X(i) = sum/JVS(LU_DIAG(i)); -! ! CALL DGETRS ('N',3,1,JVS(1:3,1:3,LU_DIAG(i)),3,IP(1,i),sum,3,0) -! ! CALL WGESL('N',JVS(1,1,LU_DIAG(i)),3,3,IP(1,i),sum) -! CALL SOL3('N',JVS(1,1,LU_DIAG(i)),IP(1,i),sum) -! X(1:3,i) = sum(1:3) -! END DO -! -!END SUBROUTINE KppSolveBig -! -! -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!SUBROUTINE KppSolveBigTR( JVS, IP, X ) -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! Big sparse transpose solve using indirect addressing -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! USE kpp_achem_gas_Parameters -! USE kpp_achem_gas_JacobianSP -! -! INTEGER :: i, j, k, m, IP(3,NVAR) -! REAL(kind=dp) :: JVS(3,3,LU_NONZERO), X(3,NVAR) -! -! DO i=1,NVAR -! ! X(i) = X(i)/JVS(LU_DIAG(i)) -! CALL SOL3('T',JVS(1,1,LU_DIAG(i)),IP(1,i),X(1,i)) -! DO j=LU_DIAG(i)+1,LU_CROW(i+1)-1 -! !X(1:3,LU_ICOL(j)) = X(1:3,LU_ICOL(j)) & -! ! - MATMUL( TRANSPOSE(JVS(1:3,1:3,j)), X(1:3,i) ) -! DO k=1,3 -! DO m=1,3 -! X(k,LU_ICOL(j)) = X(k,LU_ICOL(j)) - JVS(m,k,j)*X(m,i) -! END DO -! END DO -! END DO -! END DO -! -! DO i=NVAR, 1, -1 -! DO j=LU_CROW(i),LU_DIAG(i)-1 -! !X(1:3,LU_ICOL(j)) = X(1:3,LU_ICOL(j)) & -! ! - MATMUL( TRANSPOSE(JVS(1:3,1:3,j)), X(1:3,i) ) -! DO k=1,3 -! DO m=1,3 -! X(k,LU_ICOL(j)) = X(k,LU_ICOL(j)) - JVS(m,k,j)*X(m,i) -! END DO -! END DO -! END DO -! END DO -! -!END SUBROUTINE KppSolveBigTR -! -! -! -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!SUBROUTINE FAC3(A,IPVT,INFO) -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! FAC3 FACTORS THE MATRIX A (3,3) BY -!! GAUSS ELIMINATION WITH PARTIAL PIVOTING -!! LINPACK - LIKE -!! -!! Remove comments to perform pivoting -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! -! REAL(kind=dp) :: A(3,3) -! INTEGER :: IPVT(3),INFO -!! INTEGER :: L -!! REAL(kind=dp) :: t, dmax, da, TMP(3) -! REAL(kind=dp), PARAMETER :: ZERO = 0.0, ONE = 1.0 -! -! info = 0 -!! t = TINY(da) -!! -!! da = ABS(A(1,1)); L = 1 -!! IF ( ABS(A(2,1))>da ) THEN -!! da = ABS(A(2,1)); L = 2 -!! IF ( ABS(A(3,1))>da ) THEN -!! L = 3 -!! END IF -!! END IF -!! IPVT(1) = L -!! IF (L /=1 ) THEN -!! TMP(1:3) = A(L,1:3) -!! A(L,1:3) = A(1,1:3) -!! A(1,1:3) = TMP(1:3) -!! END IF -!! IF (ABS(A(1,1)) < t) THEN -!! info = 1 -!! return -!! END IF -!! -! A(2,1) = A(2,1)/A(1,1) -! A(2,2) = A(2,2) - A(2,1)*A(1,2) -! A(2,3) = A(2,3) - A(2,1)*A(1,3) -! A(3,1) = A(3,1)/A(1,1) -! A(3,2) = A(3,2) - A(3,1)*A(1,2) -! A(3,3) = A(3,3) - A(3,1)*A(1,3) -! -!! IPVT(2) = 2 -!! IF (ABS(A(3,2))>ABS(A(2,2))) THEN -!! IPVT(2) = 3 -!! TMP(2:3) = A(3,2:3) -!! A(3,2:3) = A(2,2:3) -!! A(2,2:3) = TMP(2:3) -!! END IF -!! IF (ABS(A(2,2)) < t) THEN -!! info = 1 -!! return -!! END IF -!! -! A(3,2) = A(3,2)/A(2,2) -! A(3,3) = A(3,3) - A(3,2)*A(2,3) -! IPVT(3) = 3 -! -!END SUBROUTINE FAC3 -! -! -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!SUBROUTINE SOL3(Trans,A,IPVT,b) -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!! SOL3 solves the system 3x3 -!! A * x = b or trans(a) * x = b -!! using the factors computed by WGEFA. -!! -!! Trans = 'N' to solve A*x = b , -!! = 'T' to solve transpose(A)*x = b -!! LINPACK - LIKE -!! -!! Remove comments to use pivoting -!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! CHARACTER :: Trans -! REAL(kind=dp) :: a(3,3),b(3) -! INTEGER :: IPVT(3) -!! INTEGER :: L -!! REAL(kind=dp) :: TMP -! -! SELECT CASE (Trans) -! -! CASE ('n','N') ! Solve A * x = b -! -!! Solve L*y = b -!! L = IPVT(1) -!! IF (L /= 1) THEN -!! TMP = B(1); B(1) = B(L); B(L) = TMP -!! END IF -! b(2) = b(2)-A(2,1)*b(1) -! b(3) = b(3)-A(3,1)*b(1) -! -!! L = IPVT(2) -!! IF (L /= 2) THEN -!! TMP = B(2); B(2) = B(L); B(L) = TMP -!! END IF -! b(3) = b(3)-A(3,2)*b(2) -! -!! Solve U*x = y -! b(3) = b(3)/A(3,3) -! b(2) = (b(2)-A(2,3)*b(3))/A(2,2) -! b(1) = (b(1)-A(1,3)*b(3)-A(1,2)*b(2))/A(1,1) -! -! -! CASE ('t','T') ! Solve transpose(A) * x = b -! -!! Solve transpose(U)*y = b -! b(1) = b(1)/A(1,1) -! b(2) = (b(2)-A(1,2)*b(1))/A(2,2) -! b(3) = (b(3)-A(1,3)*b(1)-A(2,3)*b(2))/A(3,3) -! -!! Solve transpose(L)*x = y -! b(2) = b(2)-A(3,2)*b(3) -!! L = ipvt(2) -!! IF (L /= 2) THEN -!! TMP = B(2); B(2) = B(L); B(L) = TMP -!! END IF -! b(1) = b(1)-A(3,1)*b(3)-A(2,1)*b(2) -!! L = ipvt(1) -!! IF (L /= 1) THEN -!! TMP = B(1); B(1) = B(L); B(L) = TMP -!! END IF -! -! END SELECT -! -!END SUBROUTINE SOL3 - -! End of SPARSE_UTIL function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! KppSolve - sparse back substitution -! Arguments : -! JVS - sparse Jacobian of variables -! X - Vector for variables -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE KppSolve ( JVS, X ) - -! JVS - sparse Jacobian of variables - REAL(kind=dp) :: JVS(LU_NONZERO) -! X - Vector for variables - REAL(kind=dp) :: X(NVAR) - - X(2) = X(2)-JVS(2)*X(1) - X(4) = X(4)-JVS(5)*X(1) - X(5) = X(5)-JVS(7)*X(2) - X(5) = X(5)/JVS(8) - X(4) = X(4)/JVS(6) - X(3) = X(3)/JVS(4) - X(2) = X(2)/JVS(3) - X(1) = X(1)/JVS(1) - -END SUBROUTINE KppSolve - -! End of KppSolve function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! KppSolveTR - sparse, transposed back substitution -! Arguments : -! JVS - sparse Jacobian of variables -! X - Vector for variables -! XX - Vector for output variables -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE KppSolveTR ( JVS, X, XX ) - -! JVS - sparse Jacobian of variables - REAL(kind=dp) :: JVS(LU_NONZERO) -! X - Vector for variables - REAL(kind=dp) :: X(NVAR) -! XX - Vector for output variables - REAL(kind=dp) :: XX(NVAR) - - XX(1) = X(1)/JVS(1) - XX(2) = X(2)/JVS(3) - XX(3) = X(3)/JVS(4) - XX(4) = X(4)/JVS(6) - XX(5) = X(5)/JVS(8) - XX(5) = XX(5) - XX(4) = XX(4) - XX(3) = XX(3) - XX(2) = XX(2)-JVS(7)*XX(5) - XX(1) = XX(1)-JVS(2)*XX(2)-JVS(5)*XX(4) - -END SUBROUTINE KppSolveTR - -! End of KppSolveTR function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! BLAS_UTIL - BLAS-LIKE utility functions -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -!-------------------------------------------------------------- -! -! BLAS/LAPACK-like subroutines used by the integration algorithms -! It is recommended to replace them by calls to the optimized -! BLAS/LAPACK library for your machine -! -! (C) Adrian Sandu, Aug. 2004 -! Virginia Polytechnic Institute and State University -!-------------------------------------------------------------- - - -!-------------------------------------------------------------- - SUBROUTINE WCOPY(N,X,incX,Y,incY) -!-------------------------------------------------------------- -! copies a vector, x, to a vector, y: y <- x -! only for incX=incY=1 -! after BLAS -! replace this by the function from the optimized BLAS implementation: -! CALL SCOPY(N,X,1,Y,1) or CALL DCOPY(N,X,1,Y,1) -!-------------------------------------------------------------- -! USE kpp_achem_gas_Precision - - INTEGER :: i,incX,incY,M,MP1,N - REAL(kind=dp) :: X(N),Y(N) - - IF (N.LE.0) RETURN - - M = MOD(N,8) - IF( M .NE. 0 ) THEN - DO i = 1,M - Y(i) = X(i) - END DO - IF( N .LT. 8 ) RETURN - END IF - MP1 = M+1 - DO i = MP1,N,8 - Y(i) = X(i) - Y(i + 1) = X(i + 1) - Y(i + 2) = X(i + 2) - Y(i + 3) = X(i + 3) - Y(i + 4) = X(i + 4) - Y(i + 5) = X(i + 5) - Y(i + 6) = X(i + 6) - Y(i + 7) = X(i + 7) - END DO - - END SUBROUTINE WCOPY - - -!-------------------------------------------------------------- - SUBROUTINE WAXPY(N,Alpha,X,incX,Y,incY) -!-------------------------------------------------------------- -! constant times a vector plus a vector: y <- y + Alpha*x -! only for incX=incY=1 -! after BLAS -! replace this by the function from the optimized BLAS implementation: -! CALL SAXPY(N,Alpha,X,1,Y,1) or CALL DAXPY(N,Alpha,X,1,Y,1) -!-------------------------------------------------------------- - - INTEGER :: i,incX,incY,M,MP1,N - REAL(kind=dp) :: X(N),Y(N),Alpha - REAL(kind=dp), PARAMETER :: ZERO = 0.0_dp - - IF (Alpha .EQ. ZERO) RETURN - IF (N .LE. 0) RETURN - - M = MOD(N,4) - IF( M .NE. 0 ) THEN - DO i = 1,M - Y(i) = Y(i) + Alpha*X(i) - END DO - IF( N .LT. 4 ) RETURN - END IF - MP1 = M + 1 - DO i = MP1,N,4 - Y(i) = Y(i) + Alpha*X(i) - Y(i + 1) = Y(i + 1) + Alpha*X(i + 1) - Y(i + 2) = Y(i + 2) + Alpha*X(i + 2) - Y(i + 3) = Y(i + 3) + Alpha*X(i + 3) - END DO - - END SUBROUTINE WAXPY - - - -!-------------------------------------------------------------- - SUBROUTINE WSCAL(N,Alpha,X,incX) -!-------------------------------------------------------------- -! constant times a vector: x(1:N) <- Alpha*x(1:N) -! only for incX=incY=1 -! after BLAS -! replace this by the function from the optimized BLAS implementation: -! CALL SSCAL(N,Alpha,X,1) or CALL DSCAL(N,Alpha,X,1) -!-------------------------------------------------------------- - - INTEGER :: i,incX,M,MP1,N - REAL(kind=dp) :: X(N),Alpha - REAL(kind=dp), PARAMETER :: ZERO=0.0_dp, ONE=1.0_dp - - IF (Alpha .EQ. ONE) RETURN - IF (N .LE. 0) RETURN - - M = MOD(N,5) - IF( M .NE. 0 ) THEN - IF (Alpha .EQ. (-ONE)) THEN - DO i = 1,M - X(i) = -X(i) - END DO - ELSEIF (Alpha .EQ. ZERO) THEN - DO i = 1,M - X(i) = ZERO - END DO - ELSE - DO i = 1,M - X(i) = Alpha*X(i) - END DO - END IF - IF( N .LT. 5 ) RETURN - END IF - MP1 = M + 1 - IF (Alpha .EQ. (-ONE)) THEN - DO i = MP1,N,5 - X(i) = -X(i) - X(i + 1) = -X(i + 1) - X(i + 2) = -X(i + 2) - X(i + 3) = -X(i + 3) - X(i + 4) = -X(i + 4) - END DO - ELSEIF (Alpha .EQ. ZERO) THEN - DO i = MP1,N,5 - X(i) = ZERO - X(i + 1) = ZERO - X(i + 2) = ZERO - X(i + 3) = ZERO - X(i + 4) = ZERO - END DO - ELSE - DO i = MP1,N,5 - X(i) = Alpha*X(i) - X(i + 1) = Alpha*X(i + 1) - X(i + 2) = Alpha*X(i + 2) - X(i + 3) = Alpha*X(i + 3) - X(i + 4) = Alpha*X(i + 4) - END DO - END IF - - END SUBROUTINE WSCAL - -!-------------------------------------------------------------- - REAL(kind=dp) FUNCTION WLAMCH( C ) -!-------------------------------------------------------------- -! returns epsilon machine -! after LAPACK -! replace this by the function from the optimized LAPACK implementation: -! CALL SLAMCH('E') or CALL DLAMCH('E') -!-------------------------------------------------------------- -! USE kpp_achem_gas_Precision - - CHARACTER :: C - INTEGER :: i - REAL(kind=dp), SAVE :: Eps - REAL(kind=dp) :: Suma - REAL(kind=dp), PARAMETER :: ONE=1.0_dp, HALF=0.5_dp - LOGICAL, SAVE :: First=.TRUE. - - IF (First) THEN - First = .FALSE. - Eps = HALF**(16) - DO i = 17, 80 - Eps = Eps*HALF - CALL WLAMCH_ADD(ONE,Eps,Suma) - IF (Suma.LE.ONE) GOTO 10 - END DO - PRINT*,'ERROR IN WLAMCH. EPS < ',Eps - RETURN -10 Eps = Eps*2 - i = i-1 - END IF - - WLAMCH = Eps - - END FUNCTION WLAMCH - - SUBROUTINE WLAMCH_ADD( A, B, Suma ) -! USE kpp_achem_gas_Precision - - REAL(kind=dp) A, B, Suma - Suma = A + B - - END SUBROUTINE WLAMCH_ADD -!-------------------------------------------------------------- - - -!-------------------------------------------------------------- - SUBROUTINE SET2ZERO(N,Y) -!-------------------------------------------------------------- -! copies zeros into the vector y: y <- 0 -! after BLAS -!-------------------------------------------------------------- - - INTEGER :: i,M,MP1,N - REAL(kind=dp) :: Y(N) - REAL(kind=dp), PARAMETER :: ZERO = 0.0d0 - - IF (N.LE.0) RETURN - - M = MOD(N,8) - IF( M .NE. 0 ) THEN - DO i = 1,M - Y(i) = ZERO - END DO - IF( N .LT. 8 ) RETURN - END IF - MP1 = M+1 - DO i = MP1,N,8 - Y(i) = ZERO - Y(i + 1) = ZERO - Y(i + 2) = ZERO - Y(i + 3) = ZERO - Y(i + 4) = ZERO - Y(i + 5) = ZERO - Y(i + 6) = ZERO - Y(i + 7) = ZERO - END DO - - END SUBROUTINE SET2ZERO - - -!-------------------------------------------------------------- - REAL(kind=dp) FUNCTION WDOT (N, DX, incX, DY, incY) -!-------------------------------------------------------------- -! dot produce: wdot = x(1:N)*y(1:N) -! only for incX=incY=1 -! after BLAS -! replace this by the function from the optimized BLAS implementation: -! CALL SDOT(N,X,1,Y,1) or CALL DDOT(N,X,1,Y,1) -!-------------------------------------------------------------- -! USE messy_mecca_kpp_Precision -!-------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: N, incX, incY - REAL(kind=dp) :: DX(N), DY(N) - - INTEGER :: i, IX, IY, M, MP1, NS - - WDOT = 0.0D0 - IF (N .LE. 0) RETURN - IF (incX .EQ. incY) IF (incX-1) 5,20,60 -! -! Code for unequal or nonpositive increments. -! - 5 IX = 1 - IY = 1 - IF (incX .LT. 0) IX = (-N+1)*incX + 1 - IF (incY .LT. 0) IY = (-N+1)*incY + 1 - DO i = 1,N - WDOT = WDOT + DX(IX)*DY(IY) - IX = IX + incX - IY = IY + incY - END DO - RETURN -! -! Code for both increments equal to 1. -! -! Clean-up loop so remaining vector length is a multiple of 5. -! - 20 M = MOD(N,5) - IF (M .EQ. 0) GO TO 40 - DO i = 1,M - WDOT = WDOT + DX(i)*DY(i) - END DO - IF (N .LT. 5) RETURN - 40 MP1 = M + 1 - DO i = MP1,N,5 - WDOT = WDOT + DX(i)*DY(i) + DX(i+1)*DY(i+1) + DX(i+2)*DY(i+2) + & - DX(i+3)*DY(i+3) + DX(i+4)*DY(i+4) - END DO - RETURN -! -! Code for equal, positive, non-unit increments. -! - 60 NS = N*incX - DO i = 1,NS,incX - WDOT = WDOT + DX(i)*DY(i) - END DO - - END FUNCTION WDOT - - -!-------------------------------------------------------------- - SUBROUTINE WADD(N,X,Y,Z) -!-------------------------------------------------------------- -! adds two vectors: z <- x + y -! BLAS - like -!-------------------------------------------------------------- -! USE kpp_achem_gas_Precision - - INTEGER :: i, M, MP1, N - REAL(kind=dp) :: X(N),Y(N),Z(N) - - IF (N.LE.0) RETURN - - M = MOD(N,5) - IF( M /= 0 ) THEN - DO i = 1,M - Z(i) = X(i) + Y(i) - END DO - IF( N < 5 ) RETURN - END IF - MP1 = M+1 - DO i = MP1,N,5 - Z(i) = X(i) + Y(i) - Z(i + 1) = X(i + 1) + Y(i + 1) - Z(i + 2) = X(i + 2) + Y(i + 2) - Z(i + 3) = X(i + 3) + Y(i + 3) - Z(i + 4) = X(i + 4) + Y(i + 4) - END DO - - END SUBROUTINE WADD - - - -!-------------------------------------------------------------- - SUBROUTINE WGEFA(N,A,Ipvt,info) -!-------------------------------------------------------------- -! WGEFA FACTORS THE MATRIX A (N,N) BY -! GAUSS ELIMINATION WITH PARTIAL PIVOTING -! LINPACK - LIKE -!-------------------------------------------------------------- -! - INTEGER :: N,Ipvt(N),info - REAL(kind=dp) :: A(N,N) - REAL(kind=dp) :: t, dmax, da - INTEGER :: j,k,l - REAL(kind=dp), PARAMETER :: ZERO = 0.0, ONE = 1.0 - - info = 0 - -size: IF (n > 1) THEN - -col: DO k = 1, n-1 - -! find l = pivot index -! l = idamax(n-k+1,A(k,k),1) + k - 1 - l = k; dmax = abs(A(k,k)) - DO j = k+1,n - da = ABS(A(j,k)) - IF (da > dmax) THEN - l = j; dmax = da - END IF - END DO - Ipvt(k) = l - -! zero pivot implies this column already triangularized - IF (ABS(A(l,k)) < TINY(ZERO)) THEN - info = k - return - ELSE - IF (l /= k) THEN - t = A(l,k); A(l,k) = A(k,k); A(k,k) = t - END IF - t = -ONE/A(k,k) - CALL WSCAL(n-k,t,A(k+1,k),1) - DO j = k+1, n - t = A(l,j) - IF (l /= k) THEN - A(l,j) = A(k,j); A(k,j) = t - END IF - CALL WAXPY(n-k,t,A(k+1,k),1,A(k+1,j),1) - END DO - END IF - - END DO col - - END IF size - - Ipvt(N) = N - IF (ABS(A(N,N)) == ZERO) info = N - - END SUBROUTINE WGEFA - - -!-------------------------------------------------------------- - SUBROUTINE WGESL(Trans,N,A,Ipvt,b) -!-------------------------------------------------------------- -! WGESL solves the system -! a * x = b or trans(a) * x = b -! using the factors computed by WGEFA. -! -! Trans = 'N' to solve A*x = b , -! = 'T' to solve transpose(A)*x = b -! LINPACK - LIKE -!-------------------------------------------------------------- - - INTEGER :: N,Ipvt(N) - CHARACTER :: trans - REAL(kind=dp) :: A(N,N),b(N) - REAL(kind=dp) :: t - INTEGER :: k,kb,l - - - SELECT CASE (Trans) - - CASE ('n','N') ! Solve A * x = b - -! first solve L*y = b - IF (n >= 2) THEN - DO k = 1, n-1 - l = Ipvt(k) - t = b(l) - IF (l /= k) THEN - b(l) = b(k) - b(k) = t - END IF - CALL WAXPY(n-k,t,a(k+1,k),1,b(k+1),1) - END DO - END IF -! now solve U*x = y - DO kb = 1, n - k = n + 1 - kb - b(k) = b(k)/a(k,k) - t = -b(k) - CALL WAXPY(k-1,t,a(1,k),1,b(1),1) - END DO - - CASE ('t','T') ! Solve transpose(A) * x = b - -! first solve trans(U)*y = b - DO k = 1, n - t = WDOT(k-1,a(1,k),1,b(1),1) - b(k) = (b(k) - t)/a(k,k) - END DO -! now solve trans(L)*x = y - IF (n >= 2) THEN - DO kb = 1, n-1 - k = n - kb - b(k) = b(k) + WDOT(n-k,a(k+1,k),1,b(k+1),1) - l = Ipvt(k) - IF (l /= k) THEN - t = b(l); b(l) = b(k); b(k) = t - END IF - END DO - END IF - - END SELECT - - END SUBROUTINE WGESL -! End of BLAS_UTIL function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_LinearAlgebra - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Main.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Main.f90 deleted file mode 100644 index b014fb04..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Main.f90 +++ /dev/null @@ -1,89 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Main Program File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Main.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! MAIN - Main program - driver routine -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -PROGRAM kpp_achem_gas_Driver - - USE kpp_achem_gas_Model - USE kpp_achem_gas_Initialize, ONLY: Initialize - - REAL(kind=dp) :: T, DVAL(NSPEC) - REAL(kind=dp) :: RSTATE(20) - INTEGER :: i - -!~~~> Initialization - - STEPMIN = 0.0d0 - STEPMAX = 0.0d0 - - DO i=1,NVAR - RTOL(i) = 1.0d-4 - ATOL(i) = 1.0d-3 - END DO - - CALL Initialize() - CALL InitSaveData() - -!~~~> Time loop - T = TSTART -kron: DO WHILE (T < TEND) - - TIME = T - CALL GetMass( C, DVAL ) - WRITE(6,991) (T-TSTART)/(TEND-TSTART)*100, T, & - ( TRIM(SPC_NAMES(MONITOR(i))), & - C(MONITOR(i))/CFACTOR, i=1,NMONITOR ) - CALL SaveData() - CALL Update_SUN() - CALL Update_RCONST() - - CALL INTEGRATE( TIN = T, TOUT = T+DT, RSTATUS_U = RSTATE, & - ICNTRL_U = (/ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /) ) - T = RSTATE(1) - - END DO kron -!~~~> End Time loop - - CALL GetMass( C, DVAL ) - WRITE(6,991) (T-TSTART)/(TEND-TSTART)*100, T, & - ( TRIM(SPC_NAMES(MONITOR(i))), & - C(MONITOR(i))/CFACTOR, i=1,NMONITOR ) - TIME = T - CALL SaveData() - CALL CloseSaveData() - -991 FORMAT(F6.1,'%. T=',E9.3,2X,200(A,'=',E11.4,'; ')) - -END PROGRAM kpp_achem_gas_Driver - -! End of MAIN function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Model.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Model.f90 deleted file mode 100644 index 1f90bcfc..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Model.f90 +++ /dev/null @@ -1,22 +0,0 @@ -MODULE kpp_achem_gas_Model - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Completely defines the model kpp_achem_gas -! by using all the associated modules -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Precision - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - USE kpp_achem_gas_Function - USE kpp_achem_gas_Integrator - USE kpp_achem_gas_Rates - USE kpp_achem_gas_Jacobian - USE kpp_achem_gas_Hessian - USE kpp_achem_gas_Stoichiom - USE kpp_achem_gas_LinearAlgebra - USE kpp_achem_gas_Monitor - USE kpp_achem_gas_Util - -END MODULE kpp_achem_gas_Model - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Monitor.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Monitor.f90 deleted file mode 100644 index 45f68b8a..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Monitor.f90 +++ /dev/null @@ -1,52 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Utility Data Module File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Monitor.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Monitor - - - CHARACTER(LEN=15), PARAMETER, DIMENSION(8) :: SPC_NAMES = (/ & - 'DMS ','SO2 ','NH3 ', & - 'MSA ','H2SO4 ','NO3 ', & - 'OH ','H2O ' /) - - INTEGER, PARAMETER, DIMENSION(8) :: LOOKAT = (/ & - 1, 2, 3, 4, 5, 6, 7, 8 /) - - INTEGER, PARAMETER, DIMENSION(7) :: MONITOR = (/ & - 1, 2, 3, 4, 5, 6, 7 /) - - CHARACTER(LEN=15), DIMENSION(1) :: SMASS - CHARACTER(LEN=100), PARAMETER, DIMENSION(5) :: EQN_NAMES = (/ & - ' DMS + OH --> SO2 ', & - ' DMS + OH --> 0.75 SO2 + 0.25 MSA ', & - 'DMS + NO3 --> SO2 ', & - ' SO2 + OH --> H2SO4 ', & - ' NH3 + OH --> H2O ' /) - -! INLINED global variables - -! End INLINED global variables - - -END MODULE kpp_achem_gas_Monitor diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Parameters.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Parameters.f90 deleted file mode 100644 index 2c82cc41..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Parameters.f90 +++ /dev/null @@ -1,97 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Parameter Module File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Parameters.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Parameters - - USE kpp_achem_gas_Precision - PUBLIC - SAVE - - -! NSPEC - Number of chemical species - INTEGER, PARAMETER :: NSPEC = 8 -! NVAR - Number of Variable species - INTEGER, PARAMETER :: NVAR = 5 -! NVARACT - Number of Active species - INTEGER, PARAMETER :: NVARACT = 3 -! NFIX - Number of Fixed species - INTEGER, PARAMETER :: NFIX = 3 -! NREACT - Number of reactions - INTEGER, PARAMETER :: NREACT = 5 -! NVARST - Starting of variables in conc. vect. - INTEGER, PARAMETER :: NVARST = 1 -! NFIXST - Starting of fixed in conc. vect. - INTEGER, PARAMETER :: NFIXST = 6 -! NONZERO - Number of nonzero entries in Jacobian - INTEGER, PARAMETER :: NONZERO = 8 -! LU_NONZERO - Number of nonzero entries in LU factoriz. of Jacobian - INTEGER, PARAMETER :: LU_NONZERO = 8 -! CNVAR - (NVAR+1) Number of elements in compressed row format - INTEGER, PARAMETER :: CNVAR = 6 -! CNEQN - (NREACT+1) Number stoicm elements in compressed col format - INTEGER, PARAMETER :: CNEQN = 6 -! NHESS - Length of Sparse Hessian - INTEGER, PARAMETER :: NHESS = 1 -! NLOOKAT - Number of species to look at - INTEGER, PARAMETER :: NLOOKAT = 8 -! NMONITOR - Number of species to monitor - INTEGER, PARAMETER :: NMONITOR = 7 -! NMASS - Number of atoms to check mass balance - INTEGER, PARAMETER :: NMASS = 1 - -! Index declaration for variable species in C and VAR -! VAR(ind_spc) = C(ind_spc) - - INTEGER, PARAMETER :: ind_DMS = 1 - INTEGER, PARAMETER :: ind_SO2 = 2 - INTEGER, PARAMETER :: ind_NH3 = 3 - INTEGER, PARAMETER :: ind_MSA = 4 - INTEGER, PARAMETER :: ind_H2SO4 = 5 - -! Index declaration for fixed species in C -! C(ind_spc) - - INTEGER, PARAMETER :: ind_NO3 = 6 - INTEGER, PARAMETER :: ind_OH = 7 - INTEGER, PARAMETER :: ind_H2O = 8 - -! Index declaration for dummy species - - INTEGER, PARAMETER :: ind_SO4 = 0 - -! Index declaration for fixed species in FIX -! FIX(indf_spc) = C(ind_spc) = C(NVAR+indf_spc) - - INTEGER, PARAMETER :: indf_NO3 = 1 - INTEGER, PARAMETER :: indf_OH = 2 - INTEGER, PARAMETER :: indf_H2O = 3 - -! NJVRP - Length of sparse Jacobian JVRP - INTEGER, PARAMETER :: NJVRP = 5 - -! NSTOICM - Length of Sparse Stoichiometric Matrix - INTEGER, PARAMETER :: NSTOICM = 10 - -END MODULE kpp_achem_gas_Parameters - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Precision.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Precision.f90 deleted file mode 100644 index da5e4da7..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Precision.f90 +++ /dev/null @@ -1,17 +0,0 @@ - -MODULE kpp_achem_gas_Precision - -! -! Definition of different levels of accuracy -! for REAL variables using KIND parameterization -! -! KPP SP - Single precision kind - INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(6,30) -! KPP DP - Double precision kind - INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(14,300) -! KPP QP - Quadruple precision kind - INTEGER, PARAMETER :: qp = SELECTED_REAL_KIND(18,400) - -END MODULE kpp_achem_gas_Precision - - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Rates.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Rates.f90 deleted file mode 100644 index f93f5781..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Rates.f90 +++ /dev/null @@ -1,274 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! The Reaction Rates File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Rates.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Rates - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - IMPLICIT NONE - -CONTAINS - - - -! Begin Rate Law Functions from KPP_HOME/util/UserRateLaws - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! User-defined Rate Law functions -! Note: the default argument type for rate laws, as read from the equations file, is single precision -! but all the internal calculations are performed in double precision -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -!~~~> Arrhenius - REAL(kind=dp) FUNCTION ARR( A0,B0,C0 ) - REAL A0,B0,C0 - ARR = DBLE(A0) * EXP(-DBLE(B0)/TEMP) * (TEMP/300.0_dp)**DBLE(C0) - END FUNCTION ARR - -!~~~> Simplified Arrhenius, with two arguments -!~~~> Note: The argument B0 has a changed sign when compared to ARR - REAL(kind=dp) FUNCTION ARR2( A0,B0 ) - REAL A0,B0 - ARR2 = DBLE(A0) * EXP( DBLE(B0)/TEMP ) - END FUNCTION ARR2 - - REAL(kind=dp) FUNCTION EP2(A0,C0,A2,C2,A3,C3) - REAL A0,C0,A2,C2,A3,C3 - REAL(kind=dp) K0,K2,K3 - K0 = DBLE(A0) * EXP(-DBLE(C0)/TEMP) - K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) - K3 = DBLE(A3) * EXP(-DBLE(C3)/TEMP) - K3 = K3*CFACTOR*1.0E6_dp - EP2 = K0 + K3/(1.0_dp+K3/K2 ) - END FUNCTION EP2 - - REAL(kind=dp) FUNCTION EP3(A1,C1,A2,C2) - REAL A1, C1, A2, C2 - REAL(kind=dp) K1, K2 - K1 = DBLE(A1) * EXP(-DBLE(C1)/TEMP) - K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) - EP3 = K1 + K2*(1.0E6_dp*CFACTOR) - END FUNCTION EP3 - - REAL(kind=dp) FUNCTION FALL ( A0,B0,C0,A1,B1,C1,CF) - REAL A0,B0,C0,A1,B1,C1,CF - REAL(kind=dp) K0, K1 - K0 = DBLE(A0) * EXP(-DBLE(B0)/TEMP)* (TEMP/300.0_dp)**DBLE(C0) - K1 = DBLE(A1) * EXP(-DBLE(B1)/TEMP)* (TEMP/300.0_dp)**DBLE(C1) - K0 = K0*CFACTOR*1.0E6_dp - K1 = K0/K1 - FALL = (K0/(1.0_dp+K1))* & - DBLE(CF)**(1.0_dp/(1.0_dp+(LOG10(K1))**2)) - END FUNCTION FALL - - !--------------------------------------------------------------------------- - - ELEMENTAL REAL(kind=dp) FUNCTION k_3rd(temp,cair,k0_300K,n,kinf_300K,m,fc) - - INTRINSIC LOG10 - - REAL(kind=dp), INTENT(IN) :: temp ! temperature [K] - REAL(kind=dp), INTENT(IN) :: cair ! air concentration [molecules/cm3] - REAL, INTENT(IN) :: k0_300K ! low pressure limit at 300 K - REAL, INTENT(IN) :: n ! exponent for low pressure limit - REAL, INTENT(IN) :: kinf_300K ! high pressure limit at 300 K - REAL, INTENT(IN) :: m ! exponent for high pressure limit - REAL, INTENT(IN) :: fc ! broadening factor (usually fc=0.6) - REAL(kind=dp) :: zt_help, k0_T, kinf_T, k_ratio - - zt_help = 300._dp/temp - k0_T = k0_300K * zt_help**(n) * cair ! k_0 at current T - kinf_T = kinf_300K * zt_help**(m) ! k_inf at current T - k_ratio = k0_T/kinf_T - k_3rd = k0_T/(1._dp+k_ratio)*fc**(1._dp/(1._dp+LOG10(k_ratio)**2)) - - END FUNCTION k_3rd - - !--------------------------------------------------------------------------- - - ELEMENTAL REAL(kind=dp) FUNCTION k_arr (k_298,tdep,temp) - ! Arrhenius function - - REAL, INTENT(IN) :: k_298 ! k at T = 298.15K - REAL, INTENT(IN) :: tdep ! temperature dependence - REAL(kind=dp), INTENT(IN) :: temp ! temperature - - INTRINSIC EXP - - k_arr = k_298 * EXP(tdep*(1._dp/temp-3.3540E-3_dp)) ! 1/298.15=3.3540e-3 - - END FUNCTION k_arr - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! End of User-defined Rate Law functions -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -! End Rate Law Functions from KPP_HOME/util/UserRateLaws - - -! Begin INLINED Rate Law Functions - - -real(dp) function k_DMS_OH(c_O2, T) - ! - ! reaction rate for OH addition pathway: - ! DMS + OH = 0.75SO2 + 0.25MSA - ! - - implicit none - - ! inputs - real(dp), intent(in) :: c_O2 - real(dp), intent(in) :: T - - ! local - - ! rate - !k_DMS_OH = c_O2 * 1.7d-42 * exp(7810_dp/T) / & - ! (1_dp + c_O2 * 5.5d-31 * exp(7460_dp/T)) - - k_DMS_OH = c_O2 * 1.7d-11 * exp(7810_dp/T) / & - (1.0d31 + c_O2 * 5.5d0 * exp(7460_dp/T)) - -end function k_DMS_OH - - -real(dp) function k_SO2_OH(c_air, T) - ! - ! reaction rate for: - ! SO2 + OH = H2SO4 - ! - - implicit none - - ! inputs - real(dp), intent(in) :: c_air - real(dp), intent(in) :: T - - ! local - real(dp) :: k_0, k_inf - - ! rate - k_0 = 3.0d-31 * (300_dp/T)**3.3 - k_inf = 1.5d-12 - - k_SO2_OH = ((k_0 * c_air) / (1.0_dp + k_0 * c_air / k_inf)) * & - 0.6_dp**(1.0_dp / (1.0_dp + (log10(k_0 * c_air / k_inf))**2)) - -end function k_SO2_OH - -! End INLINED Rate Law Functions - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Update_SUN - update SUN light using TIME -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - SUBROUTINE Update_SUN() - !USE kpp_achem_gas_Parameters - !USE kpp_achem_gas_Global - - IMPLICIT NONE - - REAL(kind=dp) :: SunRise, SunSet - REAL(kind=dp) :: Thour, Tlocal, Ttmp - ! PI - Value of pi - REAL(kind=dp), PARAMETER :: PI = 3.14159265358979d0 - - SunRise = 4.5_dp - SunSet = 19.5_dp - Thour = TIME/3600.0_dp - Tlocal = Thour - (INT(Thour)/24)*24 - - IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN - Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) - IF (Ttmp.GT.0) THEN - Ttmp = Ttmp*Ttmp - ELSE - Ttmp = -Ttmp*Ttmp - END IF - SUN = ( 1.0_dp + COS(PI*Ttmp) )/2.0_dp - ELSE - SUN = 0.0_dp - END IF - - END SUBROUTINE Update_SUN - -! End of Update_SUN function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Update_RCONST - function to update rate constants -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Update_RCONST ( ) - - - - -! Begin INLINED RCONST - - -! End INLINED RCONST - - RCONST(1) = (1.2d-11*exp(-260.0d0/temp)) - RCONST(2) = (k_DMS_OH(c_O2,temp)) - RCONST(3) = (1.9d-13*exp(520.0d0/temp)) - RCONST(4) = (k_SO2_OH(c_air,temp)) - RCONST(5) = (1.7d-12*exp(-710.0d0/temp)) - -END SUBROUTINE Update_RCONST - -! End of Update_RCONST function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Update_PHOTO - function to update photolytical rate constants -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Update_PHOTO ( ) - - - USE kpp_achem_gas_Global - - -END SUBROUTINE Update_PHOTO - -! End of Update_PHOTO function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Rates - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Stoichiom.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Stoichiom.f90 deleted file mode 100644 index 530e11fb..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Stoichiom.f90 +++ /dev/null @@ -1,228 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! The Stoichiometric Chemical Model File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Stoichiom.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Stoichiom - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_StoichiomSP - - IMPLICIT NONE - -CONTAINS - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! ReactantProd - Reactant Products in each equation -! Arguments : -! V - Concentrations of variable species (local) -! F - Concentrations of fixed species (local) -! ARP - Reactant product in each equation -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE ReactantProd ( V, F, ARP ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! F - Concentrations of fixed species (local) - REAL(kind=dp) :: F(NFIX) -! ARP - Reactant product in each equation - REAL(kind=dp) :: ARP(NREACT) - - -! Reactant Products in each equation are useful in the -! stoichiometric formulation of mass action law - ARP(1) = V(1)*F(2) - ARP(2) = V(1)*F(2) - ARP(3) = V(1)*F(1) - ARP(4) = V(2)*F(2) - ARP(5) = V(3)*F(2) - -END SUBROUTINE ReactantProd - -! End of ReactantProd function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! JacReactantProd - Jacobian of Reactant Products vector -! Arguments : -! V - Concentrations of variable species (local) -! F - Concentrations of fixed species (local) -! JVRP - d ARP(1:NREACT)/d VAR (1:NVAR) -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE JacReactantProd ( V, F, JVRP ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! F - Concentrations of fixed species (local) - REAL(kind=dp) :: F(NFIX) -! JVRP - d ARP(1:NREACT)/d VAR (1:NVAR) - REAL(kind=dp) :: JVRP(NJVRP) - - -! Reactant Products in each equation are useful in the -! stoichiometric formulation of mass action law -! Below we compute the Jacobian of the Reactant Products vector -! w.r.t. variable species: d ARP(1:NREACT) / d Var(1:NVAR) - -! JVRP(1) = dARP(1)/dV(1) - JVRP(1) = F(2) -! JVRP(2) = dARP(2)/dV(1) - JVRP(2) = F(2) -! JVRP(3) = dARP(3)/dV(1) - JVRP(3) = F(1) -! JVRP(4) = dARP(4)/dV(2) - JVRP(4) = F(2) -! JVRP(5) = dARP(5)/dV(3) - JVRP(5) = F(2) - -END SUBROUTINE JacReactantProd - -! End of JacReactantProd function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -! Begin Derivative w.r.t. Rate Coefficients - -! ------------------------------------------------------------------------------ -! Subroutine for the derivative of Fun with respect to rate coefficients -! ----------------------------------------------------------------------------- - - SUBROUTINE dFun_dRcoeff( V, F, NCOEFF, JCOEFF, DFDR ) - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_StoichiomSP - IMPLICIT NONE - -! V - Concentrations of variable/radical/fixed species - REAL(kind=dp) V(NVAR), F(NFIX) -! NCOEFF - the number of rate coefficients with respect to which we differentiate - INTEGER NCOEFF -! JCOEFF - a vector of integers containing the indices of reactions (rate -! coefficients) with respect to which we differentiate - INTEGER JCOEFF(NCOEFF) -! DFDR - a matrix containg derivative values; specifically, -! column j contains d Fun(1:NVAR) / d RCT( JCOEFF(j) ) -! for each 1 <= j <= NCOEFF -! This matrix is stored in a column-wise linearized format - REAL(kind=dp) DFDR(NVAR*NCOEFF) - -! Local vector with reactant products - REAL(kind=dp) A_RPROD(NREACT) - REAL(kind=dp) aj - INTEGER i,j,k - -! Compute the reactant products of all reactions - CALL ReactantProd ( V, F, A_RPROD ) - -! Compute the derivatives by multiplying column JCOEFF(j) of the stoichiometric matrix with A_RPROD - DO j=1,NCOEFF -! Initialize the j-th column of derivative matrix to zero - DO i=1,NVAR - DFDR(i+NVAR*(j-1)) = 0.0_dp - END DO -! Column JCOEFF(j) in the stoichiometric matrix times the -! reactant product of the JCOEFF(j)-th reaction -! give the j-th column of the derivative matrix - aj = A_RPROD(JCOEFF(j)) - DO k=CCOL_STOICM(JCOEFF(j)),CCOL_STOICM(JCOEFF(j)+1)-1 - DFDR(IROW_STOICM(k)+NVAR*(j-1)) = STOICM(k)*aj - END DO - END DO - - END SUBROUTINE dFun_dRcoeff - -! End Derivative w.r.t. Rate Coefficients - - -! Begin Jacobian Derivative w.r.t. Rate Coefficients - -! ------------------------------------------------------------------------------ -! Subroutine for the derivative of Jac with respect to rate coefficients -! Times a user vector -! ----------------------------------------------------------------------------- - - SUBROUTINE dJac_dRcoeff( V, F, U, NCOEFF, JCOEFF, DJDR ) - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_StoichiomSP - IMPLICIT NONE - -! V - Concentrations of variable/fixed species - REAL(kind=dp) V(NVAR), F(NFIX) -! U - User-supplied Vector - REAL(kind=dp) U(NVAR) -! NCOEFF - the number of rate coefficients with respect to which we differentiate - INTEGER NCOEFF -! JCOEFF - a vector of integers containing the indices of reactions (rate -! coefficients) with respect to which we differentiate - INTEGER JCOEFF(NCOEFF) -! DFDR - a matrix containg derivative values; specifically, -! column j contains d Jac(1:NVAR) / d RCT( JCOEFF(j) ) * U -! for each 1 <= j <= NCOEFF -! This matrix is stored in a column-wise linearized format - REAL(kind=dp) DJDR(NVAR*NCOEFF) - -! Local vector for Jacobian of reactant products - REAL(kind=dp) JV_RPROD(NJVRP) - REAL(kind=dp) aj - INTEGER i,j,k - -! Compute the Jacobian of all reactant products - CALL JacReactantProd( V, F, JV_RPROD ) - -! Compute the derivatives by multiplying column JCOEFF(j) of the stoichiometric matrix with A_PROD - DO j=1,NCOEFF -! Initialize the j-th column of derivative matrix to zero - DO i=1,NVAR - DJDR(i+NVAR*(j-1)) = 0.0_dp - END DO -! Column JCOEFF(j) in the stoichiometric matrix times the -! ( Gradient of reactant product of the JCOEFF(j)-th reaction X user vector ) -! give the j-th column of the derivative matrix -! -! Row JCOEFF(j) of JV_RPROD times the user vector - aj = 0.0_dp - DO k=CROW_JVRP(JCOEFF(j)),CROW_JVRP(JCOEFF(j)+1)-1 - aj = aj + JV_RPROD(k)*U(ICOL_JVRP(k)) - END DO -! Column JCOEFF(j) of Stoichiom. matrix times aj - DO k=CCOL_STOICM(JCOEFF(j)),CCOL_STOICM(JCOEFF(j)+1)-1 - DJDR(IROW_STOICM(k)+NVAR*(j-1)) = STOICM(k)*aj - END DO - END DO - - END SUBROUTINE dJac_dRcoeff - -! End Jacobian Derivative w.r.t. Rate Coefficients - - -END MODULE kpp_achem_gas_Stoichiom - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_StoichiomSP.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_StoichiomSP.f90 deleted file mode 100644 index 19be04ef..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_StoichiomSP.f90 +++ /dev/null @@ -1,63 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Sparse Stoichiometric Data Structures File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_StoichiomSP.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_StoichiomSP - - USE kpp_achem_gas_Precision - PUBLIC - SAVE - - -! Row-compressed sparse data for the Jacobian of reaction products JVRP - - INTEGER, PARAMETER, DIMENSION(6) :: CROW_JVRP = (/ & - 1, 2, 3, 4, 5, 6 /) - - INTEGER, PARAMETER, DIMENSION(5) :: ICOL_JVRP = (/ & - 1, 1, 1, 2, 3 /) - - INTEGER, PARAMETER, DIMENSION(5) :: IROW_JVRP = (/ & - 1, 2, 3, 4, 5 /) - - - -! Stoichiometric Matrix in Compressed Column Sparse Format - - - INTEGER, PARAMETER, DIMENSION(6) :: CCOL_STOICM = (/ & - 1, 3, 6, 8, 10, 11 /) - - INTEGER, PARAMETER, DIMENSION(10) :: IROW_STOICM = (/ & - 1, 2, 1, 2, 4, 1, 2, 2, 5, 3 /) - - INTEGER, PARAMETER, DIMENSION(10) :: ICOL_STOICM = (/ & - 1, 1, 2, 2, 2, 3, 3, 4, 4, 5 /) - - REAL(kind=dp), PARAMETER, DIMENSION(10) :: STOICM = (/ & - -1.000000e+00_dp, 1.000000e+00_dp, -1.000000e+00_dp, 7.500000e-01_dp, 2.500000e-01_dp, & - -1.000000e+00_dp, 1.000000e+00_dp, -1.000000e+00_dp, 1.000000e+00_dp, -1.000000e+00_dp /) - - -END MODULE kpp_achem_gas_StoichiomSP - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Util.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Util.f90 deleted file mode 100644 index 850e23e5..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_Util.f90 +++ /dev/null @@ -1,231 +0,0 @@ -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Auxiliary Routines File -! -! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor -! (http://www.cs.vt.edu/~asandu/Software/KPP) -! KPP is distributed under GPL, the general public licence -! (http://www.gnu.org/copyleft/gpl.html) -! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa -! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech -! With important contributions from: -! M. Damian, Villanova University, USA -! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany -! -! File : kpp_achem_gas_Util.f90 -! Time : Thu Jun 11 11:33:46 2015 -! Working directory : /gpfsm/dnb32/adarmeno/models/geos-5/heracles-UNSTABLE-DEV_MICROPHYSICS/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphV -! Equation file : kpp_achem_gas.kpp -! Output root filename : kpp_achem_gas -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -MODULE kpp_achem_gas_Util - - USE kpp_achem_gas_Parameters - IMPLICIT NONE - -CONTAINS - - - -! User INLINED Utility Functions - -! End INLINED Utility Functions - -! Utility Functions from KPP_HOME/util/util -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! UTIL - Utility functions -! Arguments : -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -! **************************************************************** -! -! InitSaveData - Opens the data file for writing -! Parameters : -! -! **************************************************************** - - SUBROUTINE InitSaveData () - - USE kpp_achem_gas_Parameters - - open(10, file='kpp_achem_gas.dat') - - END SUBROUTINE InitSaveData - -! End of InitSaveData function -! **************************************************************** - -! **************************************************************** -! -! SaveData - Write LOOKAT species in the data file -! Parameters : -! -! **************************************************************** - - SUBROUTINE SaveData () - - USE kpp_achem_gas_Global - USE kpp_achem_gas_Monitor - - INTEGER i - - WRITE(10,999) (TIME-TSTART)/3600.D0, & - (C(LOOKAT(i))/CFACTOR, i=1,NLOOKAT) -999 FORMAT(E24.16,100(1X,E24.16)) - - END SUBROUTINE SaveData - -! End of SaveData function -! **************************************************************** - -! **************************************************************** -! -! CloseSaveData - Close the data file -! Parameters : -! -! **************************************************************** - - SUBROUTINE CloseSaveData () - - USE kpp_achem_gas_Parameters - - CLOSE(10) - - END SUBROUTINE CloseSaveData - -! End of CloseSaveData function -! **************************************************************** - -! **************************************************************** -! -! GenerateMatlab - Generates MATLAB file to load the data file -! Parameters : -! It will have a character string to prefix each -! species name with. -! -! **************************************************************** - - SUBROUTINE GenerateMatlab ( PREFIX ) - - USE kpp_achem_gas_Parameters - USE kpp_achem_gas_Global - USE kpp_achem_gas_Monitor - - - CHARACTER(LEN=8) PREFIX - INTEGER i - - open(20, file='kpp_achem_gas.m') - write(20,*) 'load kpp_achem_gas.dat;' - write(20,990) PREFIX -990 FORMAT(A1,'c = kpp_achem_gas;') - write(20,*) 'clear kpp_achem_gas;' - write(20,991) PREFIX, PREFIX -991 FORMAT(A1,'t=',A1,'c(:,1);') - write(20,992) PREFIX -992 FORMAT(A1,'c(:,1)=[];') - - do i=1,NLOOKAT - write(20,993) PREFIX, SPC_NAMES(LOOKAT(i)), PREFIX, i -993 FORMAT(A1,A6,' = ',A1,'c(:,',I2,');') - end do - - CLOSE(20) - - END SUBROUTINE GenerateMatlab - -! End of GenerateMatlab function -! **************************************************************** - - -! End Utility Functions from KPP_HOME/util/util -! End of UTIL function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Shuffle_user2kpp - function to copy concentrations from USER to KPP -! Arguments : -! V_USER - Concentration of variable species in USER's order -! V - Concentrations of variable species (local) -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Shuffle_user2kpp ( V_USER, V ) - -! V_USER - Concentration of variable species in USER's order - REAL(kind=dp) :: V_USER(NVAR) -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) - - V(1) = V_USER(1) - V(4) = V_USER(2) - V(2) = V_USER(3) - V(5) = V_USER(5) - -END SUBROUTINE Shuffle_user2kpp - -! End of Shuffle_user2kpp function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! Shuffle_kpp2user - function to restore concentrations from KPP to USER -! Arguments : -! V - Concentrations of variable species (local) -! V_USER - Concentration of variable species in USER's order -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE Shuffle_kpp2user ( V, V_USER ) - -! V - Concentrations of variable species (local) - REAL(kind=dp) :: V(NVAR) -! V_USER - Concentration of variable species in USER's order - REAL(kind=dp) :: V_USER(NVAR) - - V_USER(1) = V(1) - V_USER(2) = V(4) - V_USER(3) = V(2) - V_USER(5) = V(5) - -END SUBROUTINE Shuffle_kpp2user - -! End of Shuffle_kpp2user function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! -! GetMass - compute total mass of selected atoms -! Arguments : -! CL - Concentration of all species (local) -! Mass - value of mass balance -! -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SUBROUTINE GetMass ( CL, Mass ) - -! CL - Concentration of all species (local) - REAL(kind=dp) :: CL(NSPEC) -! Mass - value of mass balance - REAL(kind=dp) :: Mass(1) - - -END SUBROUTINE GetMass - -! End of GetMass function -! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -END MODULE kpp_achem_gas_Util - diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Fun.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Fun.f90 deleted file mode 100644 index 05fdf9ae..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Fun.f90 +++ /dev/null @@ -1,45 +0,0 @@ - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE mexFunction( nlhs, plhs, nrhs, prhs ) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Matlab Gateway for the Derivative Function Fun -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Model - - INTEGER nlhs, nrhs - INTEGER plhs(*), prhs(*) - INTEGER mxGetPr, mxCreateFull, mxGetM, mxgetN - INTEGER VPtr, FPtr, RPtr, VdotPtr - REAL(kind=dp) V(5), F(3), RCT(5) - REAL(kind=dp) Vdot(5) - -! Check for the right number of input arguments - IF ( nrhs .ne. 3 ) THEN - CALL mexErrMsgTxt('Fun requires 3 input vectors: & - &V(5), F(3), RCT(5)') - END IF -! Check for the right number of output arguments - IF ( nlhs .ne. 1 ) THEN - CALL mexErrMsgTxt('Fun requires 1 output vector: & - &Vdot(5)') - END IF - - plhs(1) = mxCreateDoubleMatrix(5,1,0) - - VPtr = mxGetPr(prhs(1)) - CALL mxCopyPtrToReal8(VPtr,V,5) - - FPtr = mxGetPr(prhs(2)) - CALL mxCopyPtrToReal8(FPtr,F,3) - - RPtr = mxGetPr(prhs(3)) - CALL mxCopyPtrToReal8(RPtr,RCT,5) - - VdotPtr = mxGetPr(plhs(1)) - - CALL Fun( V, F, RCT, Vdot ) - - CALL mxCopyReal8ToPtr(Vdot, VdotPtr, 5) - - END SUBROUTINE mexFunction diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Hessian.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Hessian.f90 deleted file mode 100644 index 733df64f..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Hessian.f90 +++ /dev/null @@ -1,45 +0,0 @@ - -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE mexFunction( nlhs, plhs, nrhs, prhs ) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Matlab Gateway for the Function Hessian -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Model - - INTEGER nlhs, nrhs - INTEGER plhs(*), prhs(*) - INTEGER mxGetPr, mxCreateFull, mxGetM, mxgetN - INTEGER VPtr, FPtr, RPtr, HESSPtr - REAL(kind=dp) V(5), F(3), RCT(5) - REAL(kind=dp) HESS(0) - -! Check for the right number of input arguments - IF ( nrhs .ne. 3 ) THEN - CALL mexErrMsgTxt('Hessian requires 3 input vectors: & - &V(5), F(3), RCT(5)') - END IF -! Check for the right number of output arguments - IF ( nlhs .ne. 1 ) THEN - CALL mexErrMsgTxt('Hessian requires 1 output vector: & - &HESS(0)') - END IF - - plhs(1) = mxCreateDoubleMatrix(0,1,0) - - VPtr = mxGetPr(prhs(1)); - CALL mxCopyPtrToReal8(VPtr,V,5) - - FPtr = mxGetPr(prhs(2)); - CALL mxCopyPtrToReal8(FPtr,F,3) - - RPtr = mxGetPr(prhs(3)); - CALL mxCopyPtrToReal8(RPtr,RCT,5) - - HESSPtr = mxGetPr(plhs(1)) - - CALL Hessian( V, F, RCT, HESS ) - - CALL mxCopyReal8ToPtr(HESS, HESSPtr, 0) - - END SUBROUTINE mexFunction diff --git a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Jac_SP.f90 b/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Jac_SP.f90 deleted file mode 100644 index 5419a022..00000000 --- a/GEOSachem_GridComp/kpp/gas/kpp_achem_gas_mex_Jac_SP.f90 +++ /dev/null @@ -1,44 +0,0 @@ -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SUBROUTINE mexFunction( nlhs, plhs, nrhs, prhs ) -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -! Matlab Gateway for the Sparse Jacobian Function Jac_SP -!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - USE kpp_achem_gas_Model - - INTEGER nlhs, nrhs - INTEGER plhs(*), prhs(*) - INTEGER mxGetPr, mxCreateFull, mxGetM, mxgetN - INTEGER VPtr, FPtr, RPtr, JVSPtr - REAL(kind=dp) V(5), F(3), RCT(5) - REAL(kind=dp) JVS(8) - -! Check for the right number of input arguments - IF ( nrhs .ne. 3 ) THEN - CALL mexErrMsgTxt('Jac_SP requires 3 input vectors: & - &V(5), F(3), RCT(5)') - END IF -! Check for the right number of output arguments - IF ( nlhs .ne. 1 ) THEN - CALL mexErrMsgTxt('Jac_SP requires 1 output vector: & - &JVS(8)') - END IF - - plhs(1) = mxCreateDoubleMatrix(8,1,0) - - VPtr = mxGetPr(prhs(1)) - CALL mxCopyPtrToReal8(VPtr,V,5) - - FPtr = mxGetPr(prhs(2)) - CALL mxCopyPtrToReal8(FPtr,F,3) - - RPtr = mxGetPr(prhs(3)) - CALL mxCopyPtrToReal8(RPtr,RCT,5) - - JVSPtr = mxGetPr(plhs(1)) - - CALL Jac_SP( V, F, RCT, JVS ) - - CALL mxCopyReal8ToPtr(JVS, JVSPtr, 8) - - END SUBROUTINE mexFunction diff --git a/MAMchem_GridComp/CMakeLists.txt b/MAMchem_GridComp/CMakeLists.txt deleted file mode 100644 index ae245d58..00000000 --- a/MAMchem_GridComp/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -esma_set_this () - -set (microphysics_dir microphysics) -set (srcs - ${microphysics_dir}/infnan.F90 - ${microphysics_dir}/cam_logfile.F90 - ${microphysics_dir}/abortutils.F90 - ${microphysics_dir}/chem_mods.F90 - ${microphysics_dir}/constituents.F90 - ${microphysics_dir}/modal_aero_data.F90 - ${microphysics_dir}/modal_aero_newnuc.F90 - ${microphysics_dir}/module_data_mosaic_kind.F90 - ${microphysics_dir}/module_data_mosaic_aero.F90 - ${microphysics_dir}/module_data_mosaic_asect.F90 - ${microphysics_dir}/module_data_mosaic_asecthp.F90 - ${microphysics_dir}/module_data_mosaic_constants.F90 - ${microphysics_dir}/module_mosaic_ext.F90 - ${microphysics_dir}/module_mosaic_support.F90 - ${microphysics_dir}/module_mosaic_astem.F90 - ${microphysics_dir}/module_data_mosaic_main.F90 - ${microphysics_dir}/module_data_mosaic_gas.F90 - ${microphysics_dir}/module_mosaic_lsode.F90 - ${microphysics_dir}/module_mosaic_box_aerchem.F90 - ${microphysics_dir}/modal_aero_coag.F90 - ${microphysics_dir}/modal_aero_calcsize.F90 - ${microphysics_dir}/modal_aero_amicphys.F90 - ${microphysics_dir}/module_mosaic_init_aerpar.F90 - ${microphysics_dir}/module_mosaic_init.F90 - ${microphysics_dir}/module_mosaic_cam_init.F90 - ${microphysics_dir}/modal_aero_initialize_data.F90 - ${microphysics_dir}/modal_aero_wateruptake.F90 - MAML_SizeMod.F90 - MAML_SettlingMod.F90 - MAML_DryDepositionMod.F90 - MAML_DryRemovalMod.F90 - MAML_WetRemovalMod.F90 - MAML_OpticsTableMod.F90 - MAML_OpticsMod.F90 - MAM3_DataMod.F90 - MAM7_DataMod.F90 - MAM_ComponentsDataMod.F90 - MAM_ConstituentsDataMod.F90 - MAM_BaseMod.F90 - MAM_SizeMod.F90 - MAM_DryRemovalMod.F90 - MAM_WetRemovalMod.F90 - MAM_SeasaltMod.F90 - MAM_DustMod.F90 - MAM_BlackCarbonMod.F90 - MAM_OrganicCarbonMod.F90 - MAM_SulfateMod.F90 - MAMchem_GridCompMod.F90 - # wetdep.F90 - ) - - -set (dependencies MAPL Chem_Shared GMAO_mpeu ESMF::ESMF NetCDF::NetCDF_Fortran) -esma_add_library (${this} SRCS ${srcs} DEPENDENCIES ${dependencies} SUBDIRS optics) -target_compile_definitions (${this} PRIVATE GEOS5 MODAL_AERO MODAL_AERO_7MODE GEOS5_PORT) - -esma_generate_gocart_code (${this} -F) - -file (GLOB resource_files CONFIGURE_DEPENDS "*.rc" "*.yaml") - -set (mamscripts mam_optics_calculator.py mam_optics_calculator.csh) - -ecbuild_add_executable(TARGET mam_optics_calculator.xx SOURCES mam_optics_calculator.F90 LIBS ${this}) - -install( - FILES ${resource_files} - DESTINATION etc - ) - -install( - PROGRAMS ${mamscripts} - DESTINATION bin) - diff --git a/MAMchem_GridComp/ChangeLog b/MAMchem_GridComp/ChangeLog deleted file mode 100644 index b18e45dc..00000000 --- a/MAMchem_GridComp/ChangeLog +++ /dev/null @@ -1,42 +0,0 @@ -2015-11-19 Anton Darmenov - * tag asd-Heracles-UNSTABLE-MAM+ACI-a3: changed the interface - of modal_aero_amicphys_intr() to return the column-integrated - tendencies due to gas-aerosol-exchange/condensation, rename, - nucleation and coagulation - - * added automatically generated exports of the column-integrated - tendencies due to microphysics process; need a better way of mapping - the diagnostics from the modal_aero_amicphys_intr() to the exported - fields - - * added MAM7_ExtData.rc and GEOSachem_ExtData.rc - - * added the code and scripts that generate the mie-optics LUTs - in the 'optics' subdirectory - - * upstream edits from Heracles-UNSTABLE - - -2015-11-12 Anton Darmenov - * tag asd-Heracles-UNSTABLE-MAM+ACI-a2: do not use code from the - ./CAM directory; - - * the old implementations of the coagulation, - nucleation and gas-aerosol-exchange parameterizations - in MAML_CoagulationMod.F90 and MAM_CoagulationMod.F90, - MAML_NucleationMod.F90 and MAM_NucleationMod.F90, - MAML_GasAerosolExchangeMod.F90 and MAM_GasAerosolExchangeMod.F90 are not - needed anymore because these processes are now done in - the modal_aero_amicphys_intr() subroutine - - * synced with upstream edits from Heracles-UNSTABLE (radiation, moist, etc) - - -2015-10-30 Anton Darmenov - - * tag asd-Heracles-UNSTABLE-MAM+ACI-a1: adapted improvements updates to - MAM and MOSAIC from PNNL and cherrypicked files from CESM to GEOS-5; export - AERO_ACI state with a method to calculate volume-averaged aerosol - activation properties; the tag passes the regression test. - - diff --git a/MAMchem_GridComp/MAM3_DataMod.F90 b/MAMchem_GridComp/MAM3_DataMod.F90 deleted file mode 100644 index 96bc44e1..00000000 --- a/MAMchem_GridComp/MAM3_DataMod.F90 +++ /dev/null @@ -1,125 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM3_DataMod - basic MAM3 parameters and types -! -! !INTERFACE: -! - MODULE MAM3_DataMod -! -! !USES: -! - - IMPLICIT NONE - PRIVATE -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !DESCRIPTION: -! -! {\tt MAM3\_DataMod} provides a collection of parameters and types -! used in the MAM3 code. -! -! -! !REVISION HISTORY: -! -! 14Sep2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - -! Number of modes -! ------------------ - integer, public, parameter :: MAM3_MODES = 3 - - -! Mode IDs -! ------------------ - integer, public, parameter :: MAM3_AITKEN_MODE_ID = 1 - integer, public, parameter :: MAM3_ACCUMULATION_MODE_ID = 2 - integer, public, parameter :: MAM3_COARSE_MODE_ID = 3 - - integer, public, parameter :: MAM3_AIT_ID = MAM3_AITKEN_MODE_ID - integer, public, parameter :: MAM3_ACC_ID = MAM3_ACCUMULATION_MODE_ID - integer, public, parameter :: MAM3_COR_ID = MAM3_COARSE_MODE_ID - - -! Mode Names -! ------------------ - character(len=*), public, parameter :: MAM3_AITKEN_MODE_NAME = 'AIT' - character(len=*), public, parameter :: MAM3_ACCUMULATION_MODE_NAME = 'ACC' - character(len=*), public, parameter :: MAM3_COARSE_MODE_NAME = 'COR' - - character(len=*), public, parameter :: MAM3_AIT_NAME = MAM3_AITKEN_MODE_NAME - character(len=*), public, parameter :: MAM3_ACC_NAME = MAM3_ACCUMULATION_MODE_NAME - character(len=*), public, parameter :: MAM3_COR_NAME = MAM3_COARSE_MODE_NAME - - -! Geometric standard deviation -! ------------------------------ - real, public, parameter :: MAM3_AITKEN_MODE_SIGMA = 1.6 - real, public, parameter :: MAM3_ACCUMULATION_MODE_SIGMA = 1.8 - real, public, parameter :: MAM3_COARSE_MODE_SIGMA = 2.0 - - real, public, parameter :: MAM3_AIT_SIGMA = MAM3_AITKEN_MODE_SIGMA - real, public, parameter :: MAM3_ACC_SIGMA = MAM3_ACCUMULATION_MODE_SIGMA - real, public, parameter :: MAM3_COR_SIGMA = MAM3_COARSE_MODE_SIGMA - - -! Sea-salt emission cut-off size ranges in [m] -! ---------------------------------------------- - real, public, parameter :: MAM3_AIT_SS_D_CUTOFF(2) = (/ 0.02, 0.08 /) * 1.0e-6 - real, public, parameter :: MAM3_ACC_SS_D_CUTOFF(2) = (/ 0.08, 1.00 /) * 1.0e-6 - real, public, parameter :: MAM3_COR_SS_D_CUTOFF(2) = (/ 1.00, 10.0 /) * 1.0e-6 - -! Dust emission cut-off size ranges in units [m] -! ---------------------------------------------- - real, public, parameter :: MAM3_ACC_DU_D_CUTOFF(2) = (/ 0.10, 1.00 /) * 1.0e-6 - real, public, parameter :: MAM3_COR_DU_D_CUTOFF(2) = (/ 1.00, 10.0 /) * 1.0e-6 - - - -! ...conveniently packed, use the MAM3_MODE_ID array to inquire data -! ------------------------------------------------------------------- - integer, public, parameter, dimension(MAM3_MODES) :: & - MAM3_MODE_ID = (/ MAM3_AIT_ID, MAM3_ACC_ID, MAM3_COR_ID /) - - character(len=*), public, parameter, dimension(MAM3_MODES) :: & - MAM3_MODE_NAME = (/ MAM3_AIT_NAME, MAM3_ACC_NAME, MAM3_COR_NAME /) - - real, public, parameter, dimension(MAM3_MODES) :: & - MAM3_MODE_SIGMA = (/ MAM3_AIT_SIGMA, MAM3_ACC_SIGMA, MAM3_COR_SIGMA /) - - - - integer, public, parameter, dimension(3) :: & - MAM3_SS_EMISSION_MODE_ID = (/ MAM3_AIT_ID, & - MAM3_ACC_ID, & - MAM3_COR_ID /) - - real, public, parameter, dimension(3) :: & - MAM3_SS_EMISSION_D_CUTOFF_LOW = (/ MAM3_AIT_SS_D_CUTOFF(1), & - MAM3_ACC_SS_D_CUTOFF(1), & - MAM3_COR_SS_D_CUTOFF(1) /) - - real, public, parameter, dimension(3) :: & - MAM3_SS_EMISSION_D_CUTOFF_UP = (/ MAM3_AIT_SS_D_CUTOFF(2), & - MAM3_ACC_SS_D_CUTOFF(2), & - MAM3_COR_SS_D_CUTOFF(2) /) - - integer, public, parameter, dimension(2) :: & - MAM3_DU_EMISSION_MODE_ID = (/ MAM3_ACC_ID, & - MAM3_COR_ID /) - - real, public, parameter, dimension(2) :: & - MAM3_DU_EMISSION_D_CUTOFF_LOW = (/ MAM3_ACC_DU_D_CUTOFF(1), & - MAM3_COR_DU_D_CUTOFF(1) /) - - real, public, parameter, dimension(2) :: & - MAM3_DU_EMISSION_D_CUTOFF_UP = (/ MAM3_ACC_DU_D_CUTOFF(2), & - MAM3_COR_DU_D_CUTOFF(2) /) - - END MODULE MAM3_DataMod diff --git a/MAMchem_GridComp/MAM7_DataMod.F90 b/MAMchem_GridComp/MAM7_DataMod.F90 deleted file mode 100644 index b938a016..00000000 --- a/MAMchem_GridComp/MAM7_DataMod.F90 +++ /dev/null @@ -1,212 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 710.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM7_DataMod - basic MAM7 parameters and types -! -! !INTERFACE: -! - MODULE MAM7_DataMod -! -! !USES: -! - - - IMPLICIT NONE - PRIVATE -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !DESCRIPTION: -! -! {\tt MAM7\_DataMod} provides a collection of parameters and -! types used in the MAM code. -! -! -! !REVISION HISTORY: -! -! 14Sep2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - -! Number of aerosol components -! ---------------------------- - integer, public, parameter :: MAM7_AEROSOL_COMPONENTS = 7 - - -! Number of modes -! --------------- - integer, public, parameter :: MAM7_MODES = 7 - - -! Mode IDs -! ------------------ - integer, public, parameter :: MAM7_AITKEN_MODE_ID = 1 - integer, public, parameter :: MAM7_ACCUMULATION_MODE_ID = 2 - integer, public, parameter :: MAM7_PRIMARY_CARBON_MODE_ID = 3 - integer, public, parameter :: MAM7_FINE_SEASALT_MODE_ID = 4 - integer, public, parameter :: MAM7_FINE_DUST_MODE_ID = 5 - integer, public, parameter :: MAM7_COARSE_SEASALT_MODE_ID = 6 - integer, public, parameter :: MAM7_COARSE_DUST_MODE_ID = 7 - -! Mode Names -! ------------------ - character(len=*), public, parameter :: MAM7_AITKEN_MODE_NAME = 'AIT' - character(len=*), public, parameter :: MAM7_ACCUMULATION_MODE_NAME = 'ACC' - character(len=*), public, parameter :: MAM7_PRIMARY_CARBON_MODE_NAME = 'PCM' - character(len=*), public, parameter :: MAM7_FINE_SEASALT_MODE_NAME = 'FSS' - character(len=*), public, parameter :: MAM7_FINE_DUST_MODE_NAME = 'FDU' - character(len=*), public, parameter :: MAM7_COARSE_SEASALT_MODE_NAME = 'CSS' - character(len=*), public, parameter :: MAM7_COARSE_DUST_MODE_NAME = 'CDU' - -! Number of species -! ----------------- - integer, public, parameter :: MAM7_AITKEN_MODE_SPECIES = 4 - integer, public, parameter :: MAM7_ACCUMULATION_MODE_SPECIES = 6 - integer, public, parameter :: MAM7_PRIMARY_CARBON_MODE_SPECIES = 2 - integer, public, parameter :: MAM7_FINE_SEASALT_MODE_SPECIES = 3 - integer, public, parameter :: MAM7_FINE_DUST_MODE_SPECIES = 3 - integer, public, parameter :: MAM7_COARSE_SEASALT_MODE_SPECIES = 3 - integer, public, parameter :: MAM7_COARSE_DUST_MODE_SPECIES = 3 - -! Geometric standard deviation -! ------------------------------ - real, public, parameter :: MAM7_AITKEN_MODE_SIGMA = 1.6 - real, public, parameter :: MAM7_ACCUMULATION_MODE_SIGMA = 1.8 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_SIGMA = 1.6 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_SIGMA = 2.0 - real, public, parameter :: MAM7_FINE_DUST_MODE_SIGMA = 1.8 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_SIGMA = 2.0 - real, public, parameter :: MAM7_COARSE_DUST_MODE_SIGMA = 1.8 - -! Default Size - Median geometric diameter of number size distribution), 'm' -! ------------ - real, public, parameter :: MAM7_AITKEN_MODE_SIZE = 0.0260e-6 - real, public, parameter :: MAM7_ACCUMULATION_MODE_SIZE = 0.1100e-6 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_SIZE = 0.0500e-6 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_SIZE = 0.2000e-6 - real, public, parameter :: MAM7_FINE_DUST_MODE_SIZE = 0.1000e-6 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_SIZE = 2.0000e-6 - real, public, parameter :: MAM7_COARSE_DUST_MODE_SIZE = 1.0000e-6 - -! Minimum Size - lower limit of the number size distribution), 'm' -! ------------ - real, public, parameter :: MAM7_AITKEN_MODE_SIZE_MIN = 0.0087e-6 - real, public, parameter :: MAM7_ACCUMULATION_MODE_SIZE_MIN = 0.0535e-6 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_SIZE_MIN = 0.0100e-6 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_SIZE_MIN = 0.0500e-6 - real, public, parameter :: MAM7_FINE_DUST_MODE_SIZE_MIN = 0.0500e-6 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_SIZE_MIN = 1.0000e-6 - real, public, parameter :: MAM7_COARSE_DUST_MODE_SIZE_MIN = 0.5000e-6 - -! Maximum Size - upper limit of the number size distribution), 'm' -! ------------ - real, public, parameter :: MAM7_AITKEN_MODE_SIZE_MAX = 0.0520e-6 - real, public, parameter :: MAM7_ACCUMULATION_MODE_SIZE_MAX = 0.4400e-6 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_SIZE_MAX = 0.1000e-6 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_SIZE_MAX = 1.0000e-6 - real, public, parameter :: MAM7_FINE_DUST_MODE_SIZE_MAX = 0.5000e-6 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_SIZE_MAX = 4.0000e-6 - real, public, parameter :: MAM7_COARSE_DUST_MODE_SIZE_MAX = 2.0000e-6 - -! Crystallization RH points -! ------------------------ - real, public, parameter :: MAM7_AITKEN_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_ACCUMULATION_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_FINE_DUST_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_RH_CRYSTALLIZATION = 0.350 - real, public, parameter :: MAM7_COARSE_DUST_MODE_RH_CRYSTALLIZATION = 0.350 - -! Deliquescence RH points -! ------------------------ - real, public, parameter :: MAM7_AITKEN_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_ACCUMULATION_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_PRIMARY_CARBON_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_FINE_SEASALT_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_FINE_DUST_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_COARSE_SEASALT_MODE_RH_DELIQUESCENCE = 0.800 - real, public, parameter :: MAM7_COARSE_DUST_MODE_RH_DELIQUESCENCE = 0.800 - -! Sea-salt emission cut-off size ranges in [m] -! ---------------------------------------------- - real, public, parameter :: MAM7_AIT_SS_D_CUTOFF(2) = (/ 0.02, 0.08 /) * 1.0e-6 - real, public, parameter :: MAM7_ACC_SS_D_CUTOFF(2) = (/ 0.08, 0.30 /) * 1.0e-6 - real, public, parameter :: MAM7_FSS_SS_D_CUTOFF(2) = (/ 0.30, 1.00 /) * 1.0e-6 - real, public, parameter :: MAM7_CSS_SS_D_CUTOFF(2) = (/ 1.00, 10.0 /) * 1.0e-6 - - -! Dust emission cut-off size ranges in units [m] -! ---------------------------------------------- - real, public, parameter :: MAM7_FDU_DU_D_CUTOFF(2) = (/ 0.10, 2.00 /) * 1.0e-6 - real, public, parameter :: MAM7_CDU_DU_D_CUTOFF(2) = (/ 2.00, 10.0 /) * 1.0e-6 - - - -! ...conveniently packed, use the MAM7_MODE_ID array to inquire data -! ------------------------------------------------------------------- - - integer, public, parameter, dimension(MAM7_MODES) :: & - MAM7_MODE_ID = (/ MAM7_AITKEN_MODE_ID, & - MAM7_ACCUMULATION_MODE_ID, & - MAM7_PRIMARY_CARBON_MODE_ID, & - MAM7_FINE_SEASALT_MODE_ID, & - MAM7_FINE_DUST_MODE_ID, & - MAM7_COARSE_SEASALT_MODE_ID, & - MAM7_COARSE_DUST_MODE_ID /) - - character(len=*), public, parameter, dimension(MAM7_MODES) :: & - MAM7_MODE_NAME = (/ MAM7_AITKEN_MODE_NAME, & - MAM7_ACCUMULATION_MODE_NAME, & - MAM7_PRIMARY_CARBON_MODE_NAME, & - MAM7_FINE_SEASALT_MODE_NAME, & - MAM7_FINE_DUST_MODE_NAME, & - MAM7_COARSE_SEASALT_MODE_NAME, & - MAM7_COARSE_DUST_MODE_NAME /) - - real, public, parameter, dimension(MAM7_MODES) :: & - MAM7_MODE_SIGMA = (/ MAM7_AITKEN_MODE_SIGMA, & - MAM7_ACCUMULATION_MODE_SIGMA, & - MAM7_PRIMARY_CARBON_MODE_SIGMA, & - MAM7_FINE_SEASALT_MODE_SIGMA, & - MAM7_FINE_DUST_MODE_SIGMA, & - MAM7_COARSE_SEASALT_MODE_SIGMA, & - MAM7_COARSE_DUST_MODE_SIGMA /) - - - integer, public, parameter, dimension(4) :: & - MAM7_SS_EMISSION_MODE_ID = (/ MAM7_AITKEN_MODE_ID, & - MAM7_ACCUMULATION_MODE_ID, & - MAM7_FINE_SEASALT_MODE_ID, & - MAM7_COARSE_SEASALT_MODE_ID /) - - real, public, parameter, dimension(4) :: & - MAM7_SS_EMISSION_D_CUTOFF_LOW = (/ MAM7_AIT_SS_D_CUTOFF(1), & - MAM7_ACC_SS_D_CUTOFF(1), & - MAM7_FSS_SS_D_CUTOFF(1), & - MAM7_CSS_SS_D_CUTOFF(1) /) - - real, public, parameter, dimension(4) :: & - MAM7_SS_EMISSION_D_CUTOFF_UP = (/ MAM7_AIT_SS_D_CUTOFF(2), & - MAM7_ACC_SS_D_CUTOFF(2), & - MAM7_FSS_SS_D_CUTOFF(2), & - MAM7_CSS_SS_D_CUTOFF(2) /) - - integer, public, parameter, dimension(2) :: & - MAM7_DU_EMISSION_MODE_ID = (/ MAM7_FINE_DUST_MODE_ID, & - MAM7_COARSE_DUST_MODE_ID /) - - real, public, parameter, dimension(2) :: & - MAM7_DU_EMISSION_D_CUTOFF_LOW = (/ MAM7_FDU_DU_D_CUTOFF(1), & - MAM7_CDU_DU_D_CUTOFF(1) /) - - real, public, parameter, dimension(2) :: & - MAM7_DU_EMISSION_D_CUTOFF_UP = (/ MAM7_FDU_DU_D_CUTOFF(2), & - MAM7_CDU_DU_D_CUTOFF(2) /) - - - END MODULE MAM7_DataMod diff --git a/MAMchem_GridComp/MAM7_ExtData.rc b/MAMchem_GridComp/MAM7_ExtData.rc deleted file mode 100755 index 82cdb92f..00000000 --- a/MAMchem_GridComp/MAM7_ExtData.rc +++ /dev/null @@ -1,45 +0,0 @@ -# -# Sample resource file exemplifying the specification of an interface to -# boundary conditions, emissions and other external files. This resource -# file is meant to be read by the MAPL_ExtData Grid Component. -# - -PrimaryExports%% -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# -------------|-------|-------|--------|----------------------|--------|--------|-------------|----------| - -# BC emissions -BC_EMIS_FIRE 'kg m-2 s-1' N Y %y4-%m2-%d2T12:00:00Z 0.0 1.0 biomass ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_bc.005.%y4%m2%d2.nc4 -BC_EMIS_BIOFUEL 'kg m-2 s-1' N Y 0 0.0 1.0 antebc1 ExtData/PIESA/sfc/AeroCom.noship_BC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc -BC_EMIS_FOSSILFUEL 'kg m-2 s-1' N Y 0 0.0 1.0 antebc2 /dev/null -BC_EMIS_SHIP 'kg m-2 s-1' N Y 0 0.0 1.0 bc_ship ExtData/MERRA2/sfc/edgar-v41.emis_bc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 -BC_AIRCRAFT_LTO 'kg m-2 s-1' Y Y 0 0.0 1.0 bc_aviation /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_lto.x3600_y1800_t12.2010.nc4 -BC_AIRCRAFT_CDS 'kg m-2 s-1' Y Y 0 0.0 1.0 bc_aviation /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_cds.x3600_y1800_t12.2010.nc4 -BC_AIRCRAFT_CRS 'kg m-2 s-1' Y Y 0 0.0 1.0 bc_aviation /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_crs.x3600_y1800_t12.2010.nc4 - -# OC emissions -OC_EMIS_FIRE 'kg m-2 s-1' N Y %y4-%m2-%d2T12:00:00Z 0.0 1.0 biomass ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_oc.005.%y4%m2%d2.nc4 -OC_EMIS_BIOFUEL 'kg m-2 s-1' N Y 0 0.0 1.0 anteoc1 ExtData/PIESA/sfc/AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc -OC_EMIS_FOSSILFUEL 'kg m-2 s-1' N Y 0 0.0 1.0 anteoc2 /dev/null -OC_EMIS_SHIP 'kg m-2 s-1' N Y 0 0.0 1.0 oc_ship ExtData/MERRA2/sfc/edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 -OC_AIRCRAFT_LTO 'kg m-2 s-1' Y Y 0 0.0 1.0 oc_aviation ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_lto.x3600_y1800_t12.2010.nc4 -OC_AIRCRAFT_CDS 'kg m-2 s-1' Y Y 0 0.0 1.0 oc_aviation ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_cds.x3600_y1800_t12.2010.nc4 -OC_AIRCRAFT_CRS 'kg m-2 s-1' Y Y 0 0.0 1.0 oc_aviation ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_crs.x3600_y1800_t12.2010.nc4 - -# SO4 emissions -SO4_EMIS_SHIP 'kg m-2 s-1' N Y 0 0.0 1.0 so4_ship ExtData/MERRA2/sfc/edgar-v41.emis_so4.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - -# Dust source function -GINOUX_DU '1' Y N - 0.0 1.0 du_src ExtData/PIESA/sfc/gocart.dust_source.v5a.x1152_y721.nc -%% - -DerivedExports%% -# ---------|---------|--------------------------------------------| -# Export | Primary |_________________ Mask _____________________| -# Name | Name | Name | Expression | -# ---------|---------|------------|-------------------------------| -# ---------|---------|------------|-------------------------------| -%% - diff --git a/MAMchem_GridComp/MAM7_ExtData.yaml b/MAMchem_GridComp/MAM7_ExtData.yaml deleted file mode 100644 index d4ce5c51..00000000 --- a/MAMchem_GridComp/MAM7_ExtData.yaml +++ /dev/null @@ -1,112 +0,0 @@ -Collections: - MAM7_AeroCom.noship_BC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc: - template: ExtData/PIESA/sfc/AeroCom.noship_BC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - MAM7_AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc: - template: ExtData/PIESA/sfc/AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - MAM7_edgar-v41.emis_bc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4: - template: ExtData/MERRA2/sfc/edgar-v41.emis_bc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - MAM7_edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4: - template: ExtData/MERRA2/sfc/edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - MAM7_edgar-v41.emis_so4.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4: - template: ExtData/MERRA2/sfc/edgar-v41.emis_so4.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - MAM7_gocart.dust_source.v5a.x1152_y721.nc: - template: ExtData/PIESA/sfc/gocart.dust_source.v5a.x1152_y721.nc - MAM7_htap-v2.2.emis_bc.aviation_cds.x3600_y1800_t12.2010.nc4: - template: /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_cds.x3600_y1800_t12.2010.nc4 - MAM7_htap-v2.2.emis_bc.aviation_crs.x3600_y1800_t12.2010.nc4: - template: /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_crs.x3600_y1800_t12.2010.nc4 - MAM7_htap-v2.2.emis_bc.aviation_lto.x3600_y1800_t12.2010.nc4: - template: /home/adarmeno/fvInput/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_bc.aviation_lto.x3600_y1800_t12.2010.nc4 - MAM7_htap-v2.2.emis_oc.aviation_cds.x3600_y1800_t12.2010.nc4: - template: ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_cds.x3600_y1800_t12.2010.nc4 - MAM7_htap-v2.2.emis_oc.aviation_crs.x3600_y1800_t12.2010.nc4: - template: ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_crs.x3600_y1800_t12.2010.nc4 - MAM7_htap-v2.2.emis_oc.aviation_lto.x3600_y1800_t12.2010.nc4: - template: ExtData/PIESA/sfc/HTAP/v2.2/htap-v2.2.emis_oc.aviation_lto.x3600_y1800_t12.2010.nc4 - MAM7_qfed2.emis_bc.005.%y4%m2%d2.nc4: - template: ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_bc.005.%y4%m2%d2.nc4 - MAM7_qfed2.emis_oc.005.%y4%m2%d2.nc4: - template: ExtData/PIESA/sfc/QFED/v2.4r6/Y%y4/M%m2/qfed2.emis_oc.005.%y4%m2%d2.nc4 - -Samplings: - MAM7_sample_0: - update_frequency: PT24H - update_offset: PT12H - update_reference_time: '0' - MAM7_sample_1: - extrapolation: clim - -Exports: - BC_AIRCRAFT_CDS: - collection: MAM7_htap-v2.2.emis_bc.aviation_cds.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: bc_aviation - BC_AIRCRAFT_CRS: - collection: MAM7_htap-v2.2.emis_bc.aviation_crs.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: bc_aviation - BC_AIRCRAFT_LTO: - collection: MAM7_htap-v2.2.emis_bc.aviation_lto.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: bc_aviation - BC_EMIS_BIOFUEL: - collection: MAM7_AeroCom.noship_BC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - regrid: CONSERVE - variable: antebc1 - BC_EMIS_FIRE: - collection: MAM7_qfed2.emis_bc.005.%y4%m2%d2.nc4 - regrid: CONSERVE - sample: MAM7_sample_0 - variable: biomass - BC_EMIS_FOSSILFUEL: - collection: /dev/null - regrid: CONSERVE - variable: antebc2 - BC_EMIS_SHIP: - collection: MAM7_edgar-v41.emis_bc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - regrid: CONSERVE - variable: bc_ship - GINOUX_DU: - collection: MAM7_gocart.dust_source.v5a.x1152_y721.nc - sample: MAM7_sample_1 - variable: du_src - OC_AIRCRAFT_CDS: - collection: MAM7_htap-v2.2.emis_oc.aviation_cds.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: oc_aviation - OC_AIRCRAFT_CRS: - collection: MAM7_htap-v2.2.emis_oc.aviation_crs.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: oc_aviation - OC_AIRCRAFT_LTO: - collection: MAM7_htap-v2.2.emis_oc.aviation_lto.x3600_y1800_t12.2010.nc4 - regrid: CONSERVE - sample: MAM7_sample_1 - variable: oc_aviation - OC_EMIS_BIOFUEL: - collection: MAM7_AeroCom.noship_OC_src.sfc.x360_y181_t44.19780703_12z_20210703_12z.nc - regrid: CONSERVE - variable: anteoc1 - OC_EMIS_FIRE: - collection: MAM7_qfed2.emis_oc.005.%y4%m2%d2.nc4 - regrid: CONSERVE - sample: MAM7_sample_0 - variable: biomass - OC_EMIS_FOSSILFUEL: - collection: /dev/null - regrid: CONSERVE - variable: anteoc2 - OC_EMIS_SHIP: - collection: MAM7_edgar-v41.emis_oc.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - regrid: CONSERVE - variable: oc_ship - SO4_EMIS_SHIP: - collection: MAM7_edgar-v41.emis_so4.navigation.x360_y181_t47.19750703T12z_20210703T00z.nc4 - regrid: CONSERVE - variable: so4_ship - diff --git a/MAMchem_GridComp/MAML_CoagulationMod.F90 b/MAMchem_GridComp/MAML_CoagulationMod.F90 deleted file mode 100644 index 9d0a580e..00000000 --- a/MAMchem_GridComp/MAML_CoagulationMod.F90 +++ /dev/null @@ -1,703 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_CoagulationMod - Coagulation of aerosol particles. -! -! !INTERFACE: -! - module MAML_CoagulationMod -! -! !USES: -! - use MAPL - use MAPL_ConstantsMod, only : MAPL_PI, MAPL_RHOWTR, r8 => MAPL_R8, r4 => MAPL_R4 - - use modal_aero_coag, only : getcoags_wrapper_f - - use MAM_ComponentsDataMod, only : MAM_SOA_COMPONENT_HYGROSCOPICITY, & - MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_Coagulation - - -! !PRIVATE PARAMETERS - real, private, parameter :: pi = MAPL_PI - - real, private, parameter :: R_univ = MAPL_RUNIV ! Universal gas constant, 'J K-1 Kmole-1' - real, private, parameter :: density_water = MAPL_RHOWTR ! density of water, 'kg m-3' - - - ! the fSOA_EquivSO4 factor converts an SOA volume to a volume of SO4(+NH4) - ! having same hygroscopicity as the SOA - real, private, parameter :: fSOA_EquivSO4 = (MAM_SOA_COMPONENT_HYGROSCOPICITY / & - MAM_SULFATE_COMPONENT_HYGROSCOPICITY) - - ! number of SO4(+NH4) monolayers needed to 'age' a carbon particle - real, private, parameter :: NUMBER_SO4_MONOLAYERS_PCAGE = 3.0 - - -! -! !DESCRIPTION: -! -! {\tt MAML\_CoagulationMod} provides a collection of methods to calculate -! intra- and intermodal coagulation rates. -! -! -! !REVISION HISTORY: -! -! 03Jan2012 A. Darmenov Initial version -- based on CESM-1.0.3 CAM/MAM -! modal_aero_coag module -! -! -!EOP -!------------------------------------------------------------------------- - - - interface MAML_Coagulation - module procedure MAML_CoagulationBimodal - module procedure MAML_Coagulation_AIT_PCM_ACC - end interface MAML_Coagulation - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_Coagulation_Bimodal --- -! -! !INTERFACE: - - subroutine MAML_CoagulationBimodal(pressure, & - temperature, & - density_air, & - q_number, & - q_mass, & - Dg_wet, & - density_wet, & - sigma, & - n_species, & - intermodal_transfer, & - dt) - - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: q_number ! number mixing ratios of the aerosol modes - real, dimension(:,:), intent(inout) :: q_mass ! mass mixing ratios of the components in the three modes - -! !INPUT PARAMETERS: - real, intent(in) :: pressure ! pressure at mid level - real, intent(in) :: temperature ! temperature at mid level - real, intent(in) :: density_air ! air density - - real, intent(in) :: dt ! time step - - real, dimension(:), intent(in) :: Dg_wet ! wet geometric mean diameter of number size distribution - - real, dimension(:), intent(in) :: density_wet ! wet density - real, dimension(:), intent(in) :: sigma ! geometric standard deviation - - integer, dimension(:), intent(in) :: n_species ! number of species - - integer, dimension(:), intent(in) :: intermodal_transfer ! maps the indexes of the source mode species to the - ! indexes of the receiving mode species - - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Bimodal (e.g., Aitken and accumulation modes) coagulation. -! -! !REVISION HISTORY: -! -! 03Jan2011 A. Darmenov First crack -- based on modal_aero_coag_sub(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_CoagulationBimodal') - - ! local parameters - integer, parameter :: n_coag_modes = 2 ! number of modes considered in the coagulation process - ! bimodal coagulation, e.g., 1(AIT) + 1(ACC) = 2 - - integer, parameter :: mode_i = 1 ! source (e.g., Aitken) mode index - integer, parameter :: mode_j = 2 ! receiving (e.g., accumulation) mode index - - - ! local variables - real(r8) :: P, T ! pressure and temperarute - - real(r8) :: D_wet_i, density_wet_i ! wet size and density of the source mode - real(r8) :: sigma_i, ln_sigma_i ! geometric standard deviation and its log - - real(r8) :: D_wet_j, density_wet_j ! wet size and density of the receiving mode - real(r8) :: sigma_j, ln_sigma_j ! geometric standard deviation and its log - - real(r8) :: beta_ii0, beta_ii2 ! intramodal coagulation rates - 'i' mode - real(r8) :: beta_jj0, beta_jj2 ! intramodal coagulation rates - 'j' mode - real(r8) :: beta_ij0, beta_ij2i, beta_ij2j, beta_ij3 ! intermodal coagulation rates - - real(r8), dimension(n_coag_modes) :: number_conc ! initial number concentrations of 'i' and 'j' modes - real(r8), dimension(n_coag_modes) :: number_conc_new ! final number concentrations of 'i' and 'j' modes - real(r8), dimension(n_coag_modes) :: number_conc_avg ! average number concentrations - - real(r8) :: N_i, N_j ! temporary variables - initial number concentration - real(r8) :: tmp_A, tmp_B, tmp_C, tmp_F, tmp_G, tmp_H ! temporary variables - various terms - - real(r8) :: frac_transfer_vol, frac_transfer_vol_max ! fraction of volume that can be transfered between the modes - real(r8) :: vol_loss_i, mass_transfer - - integer :: m, iq, iq_mode_i, iq_mode_j - - - - do m = 1, n_coag_modes - number_conc(m) = q_number(m)*density_air - number_conc(m) = max(0.0, number_conc(m)) - end do - - - ! Calculate the coagulation rates -- use double precision - ! where it is required - ! -------------------------------------------------------- - P = dble(pressure) - T = dble(temperature) - - D_wet_i = dble(Dg_wet(mode_i)) - D_wet_j = dble(Dg_wet(mode_j)) - - density_wet_i = dble(density_wet(mode_i)) - density_wet_j = dble(density_wet(mode_j)) - - sigma_i = dble(sigma(mode_i)) - sigma_j = dble(sigma(mode_j)) - - ln_sigma_i = log(sigma_i) - ln_sigma_j = log(sigma_j) - - ! coagulation rates using CMAQ 'fast' method, based on Whitby's - ! approximation approach - call getcoags_wrapper_f(T, P, D_wet_i, & - D_wet_j, & - sigma_i, & - sigma_j, & - ln_sigma_i, & - ln_sigma_j, & - density_wet_i, & - density_wet_j, & - beta_ij0, & - beta_ij2i, & - beta_ij2j, & - beta_ij3, & - beta_ii0, & - beta_ii2, & - beta_jj0, & - beta_jj2 ) - - - ! Compute number mixing ratio changes due to - ! coagulation between 'i' - source/from mode and - ! 'j' - receiving/to mode: - ! - ! intramodal intermodal - ! ------------------- ------------------ - ! | dN_i/dt = -beta_ii0 * N_i*N_i - beta_ij0 * N_i*N_j - ! | dN_j/dt = -beta_jj0 * N_j*N_j - ! - ! | dS_i/dt = -beta_ii2 * S_i*N_i - beta_ij2i * S_i*N_j - ! | dS_j/dt = -beta_jj2 * S_j*N_j + beta_ij2j * S_i*N_j - ! - ! | dV_i/dt = -beta_ij3 * V_i*N_j - ! | dV_j/dt = -dV_i/dt - ! - ! - ! The first system of equations is solved for N_j first, and - ! then for N_i, assuming that the coag. coefficients are - ! constants during the integration step, and by substituting N_j - ! with its mean value = 1/2 * (N_j(t) + N_j(t+dt)), i.e. - ! - ! dN_j/dt = -beta_jj0 * N_j*N_j - ! dN_i/dt = -beta_ii0 * N_i*N_i - (beta_ij0 * )*N_j - ! - ! -------------------------------------------------------- - - ! update number mixing ratio of the receiving (j) mode - N_j = number_conc(mode_j) ! N_j(t) - number_conc_new(mode_j) = N_j / (1.0 + beta_jj0*N_j*dt) ! N_j(t + dt) - number_conc_avg(mode_j) = 0.5 * (number_conc_new(mode_j) + N_j) ! [N_j(t) + N_j(t + dt)]/2 - - q_number(mode_j) = number_conc_new(mode_j) / density_air ! update the input number concentration - - ! update number mixing ratio of the source (i) mode - N_i = number_conc(mode_i) ! N_i(t) - - tmp_A = beta_ij0 * number_conc_avg(mode_j) * dt ! recurring terms - tmp_B = beta_ii0 * dt ! ... - tmp_C = tmp_A + (tmp_B * N_i) ! ... - - if (abs(tmp_C) < 1e-2) then - number_conc_new(mode_i) = N_i * exp(-tmp_C) ! N_i(t + dt) - else if (abs(tmp_A) < 1e-3) then - number_conc_new(mode_i) = exp(-tmp_A) * N_i/(1.0 + tmp_B*N_i)! N_i(t + dt) - else - tmp_F = (tmp_B * N_i)/tmp_C ! recurring terms - tmp_G = exp(-tmp_A) ! ... - tmp_H = tmp_G*(1.0 - tmp_F)/(1.0 - tmp_G*tmp_F) ! ... - - number_conc_new(mode_i) = N_i * max(0.0, min(1.0, tmp_H)) ! N_i(t + dt) - end if - - number_conc_avg(mode_i) = 0.5*(number_conc_new(mode_i) + N_i) ! [N_i(t) + N_i(t + dt)]/2 - - q_number(mode_i) = number_conc_new(mode_i) / density_air - - - ! Compute mass mixing ratios changes due to coagulation between - ! source and receiving modes - ! ------------------------------------------------------------ - - ! maximum fraction of transfered volume = 1 - eps - frac_transfer_vol_max = 1.0 - 1.0e1*epsilon(1.0_r8) - - ! first order loss rate for mode 'i' volume - vol_loss_i = beta_ij3 * number_conc_avg(mode_j) - - ! fraction of 'i' volume transferred to 'j' over time dt - frac_transfer_vol = 1.0 - exp(-vol_loss_i*dt) - - frac_transfer_vol = min(frac_transfer_vol_max, frac_transfer_vol) - frac_transfer_vol = max(0.0, frac_transfer_vol) - - do iq = 1, n_species(mode_i) - iq_mode_i = iq - iq_mode_j = intermodal_transfer(iq) - - if (iq_mode_j > 0) then - ! species mass transfered from 'i' to 'j' mode - mass_transfer = q_mass(iq_mode_i, mode_i)*frac_transfer_vol - - q_mass(iq_mode_i, mode_i) = q_mass(iq_mode_i, mode_i) - mass_transfer - q_mass(iq_mode_j, mode_j) = q_mass(iq_mode_j, mode_j) + mass_transfer - end if - end do - - end subroutine MAML_CoagulationBimodal - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_Coagulation_AIT_PCM_ACC --- -! -! !INTERFACE: - - subroutine MAML_Coagulation_AIT_PCM_ACC(pressure, & - temperature, & - density_air, & - q_number, & - q_mass, & - Dg_dry, & - Dg_wet, & - density_wet, & - sigma, & - n_species, & - intermodal_transfer, & - mass2vol_aitken_age, & - mass2vol_pcarbon, & - dt) - - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: q_number ! number mixing ratios of the and ACC modes - real, dimension(:,:), intent(inout) :: q_mass ! mass mixing ratios of the components in the three modes - -! !INPUT PARAMETERS: - real, intent(in) :: pressure ! pressure at mid level - real, intent(in) :: temperature ! temperature at mid level - real, intent(in) :: density_air ! air density - - real, intent(in) :: dt ! time step - - real, dimension(:), intent(in) :: Dg_dry ! dry geometric mean diameter of number size distribution - real, dimension(:), intent(in) :: Dg_wet ! wet geometric mean diameter of number size distribution - - real, dimension(:), intent(in) :: density_wet ! wet density - real, dimension(:), intent(in) :: sigma ! geometric standard deviation - - integer, dimension(:), intent(in) :: n_species ! number of species - - integer, dimension(:,:), intent(in) :: intermodal_transfer ! maps the indexes of the source mode species to the - ! indexes of the receiving mode species - - real, dimension(:), intent(in) :: mass2vol_aitken_age ! conversion factor for the aitken to PCM aging, equal - ! to - real, dimension(:), intent(in) :: mass2vol_pcarbon ! - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Coagulation of Aitken, primary carbon and accumulation -! modes. -! -! !REVISION HISTORY: -! -! 13Jan2011 A. Darmenov First crack -- based on modal_aero_coag_sub(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_Coagulation_AIT_PCM_ACC') - - ! local parameters - integer, parameter :: n_coag_modes = 3 ! number of modes considered in the coagulation process - ! 1(AIT) + 1(PCM) + 1(ACC) = 3 - - integer, parameter :: n_coag_pairs = 3 ! number of mode pairs that coagulate - ! 1) AIT -> ACC - ! 2) PCM -> ACC - ! 3) AIT -> PCM + 'ageing' -> ACC - - integer, parameter :: mode_ait = 1 ! Aitken mode index - integer, parameter :: mode_pcm = 2 ! primary carbon mode index - integer, parameter :: mode_acc = 3 ! accumulation mode index - - integer, parameter :: ait_acc = 1 ! AIT -> ACC coagulation pair index - integer, parameter :: pcm_acc = 2 ! PCM -> ACC coagulation pair inde - integer, parameter :: ait_pcm = 3 ! AIT -> PCM + 'ageing' -> ACC coagulation pair index - - integer, parameter :: coag_mode_source(n_coag_pairs) = (/mode_ait, mode_pcm, mode_ait/) - integer, parameter :: coag_mode_receiv(n_coag_pairs) = (/mode_acc, mode_acc, mode_pcm/) - - - ! local variables - real(r8) :: P, T, air_conc ! air molar density - - real(r8) :: D_wet_i, density_wet_i ! wet size and density of the source mode - real(r8) :: sigma_i, ln_sigma_i ! geometric standard deviation and its log - - real(r8) :: D_wet_j, density_wet_j ! wet size and density of the receiving mode - real(r8) :: sigma_j, ln_sigma_j ! geometric standard deviation and its log - - real(r8), dimension(n_coag_pairs) :: beta_ii0 ! intramodal coagulation rates - real(r8), dimension(n_coag_pairs) :: beta_ii2 ! ... - real(r8), dimension(n_coag_pairs) :: beta_jj0 ! ... - real(r8), dimension(n_coag_pairs) :: beta_jj2 ! ... - real(r8), dimension(n_coag_pairs) :: beta_ij0 ! intermodal coagulation rates - real(r8), dimension(n_coag_pairs) :: beta_ij2i ! ... - real(r8), dimension(n_coag_pairs) :: beta_ij2j ! ... - real(r8), dimension(n_coag_pairs) :: beta_ij3 ! ... - - real(r8), dimension(n_coag_modes) :: number_conc ! initial number concentrations of the modes - real(r8), dimension(n_coag_modes) :: number_conc_new ! final number concentrations of the modes - real(r8), dimension(n_coag_modes) :: number_conc_avg ! mean (during the time step) number concentrations - - real(r8) :: N_0 ! temporary variables - initial number concentration - real(r8) :: tmp_A, tmp_B, tmp_C, tmp_F, tmp_G, tmp_H ! temporary variables - various terms - - real(r8) :: frac_transfer_vol, frac_transfer_vol_max ! fraction of volume that can be transfered between the modes - real(r8) :: frac_transfer_vol_pcage ! fraction of volume transfered between the modes due to primary carbone aging - real(r8) :: vol_shell, vol_core ! volumes of shell and core - real(r8) :: vol_loss, mass_transfer, number_transfer ! volume, mass and number transfered between the modes - - real(r8) :: dR_so4_monolayers_pcage ! change in size(radius) due to number of SO4 monolayers - - real :: f_vol2sfc_pcarbon ! volume to surface factor - - integer :: m, n - integer :: iq, iq_mode_i, iq_mode_j - integer :: mode_i, mode_j - integer :: coag_pair - - - ! air molar density (kmol m-3) - P = dble(pressure) - T = dble(temperature) - - do m = 1, n_coag_modes - number_conc(m) = q_number(m)*density_air - number_conc(m) = max(0.0, number_conc(m)) - end do - - - ! Calculate the coagulation rates -- use double precision - ! where it is required - ! -------------------------------------------------------- - beta_ij0 = 0.0 - beta_ij2i = 0.0 - beta_ij2j = 0.0 - beta_ij3 = 0.0 - beta_ii0 = 0.0 - beta_ii2 = 0.0 - beta_jj0 = 0.0 - beta_jj2 = 0.0 - - do n = 1, n_coag_pairs - mode_i = coag_mode_source(n) - mode_j = coag_mode_receiv(n) - - D_wet_i = dble(Dg_wet(mode_i)) - D_wet_j = dble(Dg_wet(mode_j)) - - density_wet_i = dble(density_wet(mode_i)) - density_wet_j = dble(density_wet(mode_j)) - - sigma_i = dble(sigma(mode_i)) - sigma_j = dble(sigma(mode_j)) - - ln_sigma_i = log(sigma_i) - ln_sigma_j = log(sigma_j) - - ! coagulation rates using CMAQ 'fast' method, based on Whitby's - ! approximation approach - call getcoags_wrapper_f(T, P, D_wet_i, & - D_wet_j, & - sigma_i, & - sigma_j, & - ln_sigma_i, & - ln_sigma_j, & - density_wet_i, & - density_wet_j, & - beta_ij0(n), & - beta_ij2i(n), & - beta_ij2j(n), & - beta_ij3(n), & - beta_ii0(n), & - beta_ii2(n), & - beta_jj0(n), & - beta_jj2(n) ) - end do - - - ! Compute number mixing ratio changes due to - ! coagulation between ait, primary carbon and - ! accumulation mode - ! - ! intramodal intermodal - ! ------------------- ------------------ - ! | dN_ait/dt = -beta_ii0 * N_ait*N_ait - beta_ij0 * N_acc*N_ait - beta_ij0 * N_pcm*N_ait - ! | dN_pcm/dt = -beta_ii0 * N_pcm*N_pcm - beta_ij0 * N_acc*N_pcm - ! | dN_acc/dt = -beta_jj0 * N_acc*N_acc - ! - ! | dV_i/dt = -beta_ij3 * V_i*N_j - ! | dV_j/dt = -dV_i/dt - ! - ! - ! The first system of equations is solved for N_acc first, and - ! then for N_pcm, and finally for N_ait assuming that the coag. - ! coefficients are constants during the integration step, and - ! by substituting N_ait and N_pcm with their mean values - ! = 1/2 * (N_acc|pcm(t) + N_acc|pcm(t+dt)), i.e. - ! - ! dN_acc/dt = -beta_jj0 * N_acc*N_acc - ! dN_pcm/dt = -beta_ii0 * N_pcm*N_pcm - (beta_ij0 * )*N_pcm - ! dN_ait/dt = -beta_jj0 * N_ait*N_ait - (beta_ij0 * + beta_ij0 * )*N_ait - ! - ! - ! TODO: General coagulation solver. Assuming that the coagulating modes - ! are ordered by size (from smaller to larger), calculate the coagulation - ! rates for every pair and find the intermodal terms - ! _i = sum {j>i} (beta_ij0 * ) - ! - ! Then solve the equations - ! dN_j/dt = -beta_jj0 * N_j*N_j, larges mode - ! = ... - ! ... - ! dN_i/dt = -beta_jj0 * N_i*N_i - _i * N_i, i = j -1 - ! ... - ! dN_i/dt = -beta_jj0 * N_i*N_i - _i * N_i, i = 1 - ! ... - ! -------------------------------------------------------- - - - ! update number mixing ratio of the accumulation mode - N_0 = number_conc(mode_acc) ! N_acc(t) - number_conc_new(mode_acc) = N_0 / (1.0 + beta_jj0(ait_acc)*N_0*dt) ! N_acc(t + dt) - number_conc_avg(mode_acc) = 0.5 * (number_conc_new(mode_acc) + N_0) ! [N_acc(t) + N_acc(t + dt)]/2 - - q_number(mode_acc) = number_conc_new(mode_acc) / air_conc ! update the input number concentration - - - ! update number mixing ratio of the primary carbon mode - N_0 = number_conc(mode_pcm) ! N_pcm(t) - - tmp_A = beta_ij0(pcm_acc) * number_conc_avg(mode_acc) * dt ! recurring terms - tmp_B = beta_ii0(pcm_acc) * dt ! ... - tmp_C = tmp_A + (tmp_B * N_0) ! ... - - if (abs(tmp_C) < 1e-2) then - number_conc_new(mode_pcm) = N_0 * exp(-tmp_C) ! N_pcm(t + dt) - else if (abs(tmp_A) < 1e-3) then - number_conc_new(mode_pcm) = exp(-tmp_A) * N_0/(1.0 + tmp_B*N_0) ! N_pcm(t + dt) - else - tmp_F = (tmp_B * N_0)/tmp_C ! recurring terms - tmp_G = exp(-tmp_A) ! ... - tmp_H = tmp_G*(1.0 - tmp_F)/(1.0 - tmp_G*tmp_F) ! ... - - number_conc_new(mode_pcm) = N_0 * max(0.0, min(1.0, tmp_H)) ! N_pcm(t + dt) - end if - - number_conc_avg(mode_pcm) = 0.5*(number_conc_new(mode_pcm) + N_0) ! [N_pcm(t) + N_pcm(t + dt)]/2 - - q_number(mode_pcm) = number_conc_new(mode_pcm) / density_air - - - ! update number mixing ratio of the aitken mode - ! - ! coagulation pair: aitken -> primary carbon - ! - N_0 = number_conc(mode_ait) ! N_ait(t) - - tmp_A = ( beta_ij0(ait_acc) * number_conc_avg(mode_acc) + & - beta_ij0(ait_pcm) * number_conc_avg(mode_pcm) ) * dt ! recurring terms - tmp_B = beta_ii0(ait_acc) * dt ! ... - tmp_C = tmp_A + (tmp_B * N_0) ! ... - - if (abs(tmp_C) < 1e-2) then - number_conc_new(mode_ait) = N_0 * exp(-tmp_C) ! N_ait(t + dt) - else if (abs(tmp_A) < 1e-3) then - number_conc_new(mode_ait) = exp(-tmp_A) * N_0/(1.0 + tmp_B*N_0) ! N_ait(t + dt) - else - tmp_F = (tmp_B * N_0)/tmp_C ! recurring terms - tmp_G = exp(-tmp_A) ! ... - tmp_H = tmp_G*(1.0 - tmp_F)/(1.0 - tmp_G*tmp_F) ! ... - - number_conc_new(mode_ait) = N_0 * max(0.0, min(1.0, tmp_H)) ! N_ait(t + dt) - end if - - number_conc_avg(mode_ait) = 0.5*(number_conc_new(mode_ait) + N_0) ! [N_ait(t) + N_ait(t + dt)]/2 - - q_number(mode_ait) = number_conc_new(mode_ait) / air_conc - - - - ! Compute mass mixing ratios changes due to coagulation between - ! source and receiving modes - ! ------------------------------------------------------------ - - ! maximum fraction of transfered volume = 1 - eps - frac_transfer_vol_max = 1.0 - 1.0e1*epsilon(1.0_r8) - - ! first order loss rate from aitken to accumulation and primary carbon modes - vol_loss = (beta_ij3(ait_acc) * number_conc_avg(mode_acc) + & - beta_ij3(ait_pcm) * number_conc_avg(mode_pcm)) - - ! fraction of 'i' volume transferred to 'j' mode - frac_transfer_vol = 1.0 - exp(-vol_loss*dt) - - frac_transfer_vol = min(frac_transfer_vol_max, frac_transfer_vol) - frac_transfer_vol = max(0.0, frac_transfer_vol) - - vol_shell = 0.0 - tmp_A = beta_ij3(ait_pcm)*number_conc_avg(mode_pcm)/max(vol_loss, 1.0e-37_r8) - - coag_pair = ait_acc - mode_i = coag_mode_source(coag_pair) - mode_j = coag_mode_receiv(coag_pair) - - do iq = 1, n_species(mode_i) - iq_mode_i = iq - iq_mode_j = intermodal_transfer(iq, coag_pair) - - if (iq_mode_j > 0) then - ! species mass transfered from 'i' to 'j' mode - mass_transfer = q_mass(iq_mode_i, mode_i)*frac_transfer_vol - - q_mass(iq_mode_i, mode_i) = q_mass(iq_mode_i, mode_i) - mass_transfer - q_mass(iq_mode_j, mode_j) = q_mass(iq_mode_j, mode_j) + mass_transfer - - ! volume of shell material: SO4 and NH4 transfered from aitken to PCM - vol_shell = vol_shell + (mass_transfer * tmp_A * mass2vol_aitken_age(iq)) - end if - end do - - - ! calculate aging transfer fraction for primary carbon to accumulation: - ! duplicates the code in CAM/MAM modal_aero_gasaerexch module - - ! use 1 mol (bi-)sulfate = 65 cm^3 --> 1 molecule = (4.76e-10 m)^3 - dR_so4_monolayers_pcage = NUMBER_SO4_MONOLAYERS_PCAGE * 4.76e-10 - - ! volume to surface factor - f_vol2sfc_pcarbon = exp(2.5 * (log(sigma(mode_pcm)))**2) - - vol_core = 0.0 - do iq = 1, n_species(mode_pcm) - vol_core = vol_core + q_mass(iq, mode_pcm) * mass2vol_pcarbon(iq) - end do - - tmp_A = vol_shell * Dg_dry(mode_pcm) * f_vol2sfc_pcarbon - tmp_B = 6.0 * dR_so4_monolayers_pcage * vol_core - tmp_B = max(tmp_B, 0.0) - - if (tmp_A >= tmp_B) then - frac_transfer_vol_pcage = frac_transfer_vol_max - else - frac_transfer_vol_pcage = min(tmp_A/tmp_B, frac_transfer_vol_max) - end if - - - ! calculate mass changes from primary carbon to accumulation by - ! direct coagulation and aging - vol_loss = beta_ij3(pcm_acc)*number_conc_avg(mode_acc) - - frac_transfer_vol = 1.0 - exp(-vol_loss*dt) - frac_transfer_vol = frac_transfer_vol + frac_transfer_vol_pcage - - frac_transfer_vol = min(frac_transfer_vol_max, frac_transfer_vol) - frac_transfer_vol = max(0.0, frac_transfer_vol) - - coag_pair = pcm_acc - mode_i = coag_mode_source(coag_pair) - mode_j = coag_mode_receiv(coag_pair) - - do iq = 1, n_species(mode_i) ! mass mixing ratios - iq_mode_i = iq - iq_mode_j = intermodal_transfer(iq, coag_pair) - - if (iq_mode_j > 0) then - ! species mass transfered from 'i' to 'j' mode - mass_transfer = q_mass(iq_mode_i, mode_i)*frac_transfer_vol - - q_mass(iq_mode_i, mode_i) = q_mass(iq_mode_i, mode_i) - mass_transfer - q_mass(iq_mode_j, mode_j) = q_mass(iq_mode_j, mode_j) + mass_transfer - end if - end do - - number_transfer = q_number(mode_i) * frac_transfer_vol_pcage ! number mixing ratios - q_number(mode_i) = q_number(mode_i) - number_transfer - q_number(mode_j) = q_number(mode_j) + number_transfer - - return - end subroutine MAML_Coagulation_AIT_PCM_ACC - - - end module MAML_CoagulationMod diff --git a/MAMchem_GridComp/MAML_DryDepositionMod.F90 b/MAMchem_GridComp/MAML_DryDepositionMod.F90 deleted file mode 100644 index c7b90ab9..00000000 --- a/MAMchem_GridComp/MAML_DryDepositionMod.F90 +++ /dev/null @@ -1,372 +0,0 @@ -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_DryDepositionMod - Dry deposition of gases and particles -! -! !INTERFACE: -! - module MAML_DryDepositionMod -! -! !USES: -! - use MAPL - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_DepositionVelocity - - public schmidt_number - public stokes_number - public quasi_laminar_resistance - public aerodynamic_resistance - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - real, private, parameter :: g_E = MAPL_GRAV ! standard gravity, 'm s-2' - real, private, parameter :: von_karman = MAPL_KARMAN ! von Karman's constant, '1' - real, private, parameter :: c_p = MAPL_CP ! specific heat capacity of dry air, 'J kg-1 K01' - -! -! !DESCRIPTION: -! -! {\tt MAML\_DryDepositionMod} provides a collection of methods for -! modeling dry deposition of gases and aerosol particles. -! -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - interface MAML_DepositionVelocity - module procedure MAML_DepositionVelocityAerosol -! module procedure MAML_DepositionVelocityGas - end interface MAML_DepositionVelocity - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: schmidt_number --- calculates the Schmidt's number -! -! !INTERFACE: - - function schmidt_number(viscosity, D) result (Sc) -! !USES: - - implicit None - - real :: Sc ! Schmidt number, '' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: viscosity ! kinematic viscosity, 'm2 s-1' - real, intent(in) :: D ! Brownian diffusivity coefficient, '' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the Schmidt's number (see Eq. -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('schmidt_number') - - Sc = viscosity / D - - end function schmidt_number - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: stokes_number --- calculates the Sokes number -! -! !INTERFACE: - - function stokes_number(settling_velocity, friction_velocity, viscosity) result (St) -! !USES: - - implicit None - - real :: St ! Stokes number, '' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: settling_velocity ! settling/sedimentation velocity, 'm s-1' - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - real, intent(in) :: viscosity ! kinematic viscosity, 'm2 s-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the Stokes number (see Eq. 8.105, Seinfeld and Pandis) -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('stokes_number') - - St = settling_velocity * friction_velocity**2 / (g_E * viscosity) - - end function stokes_number - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: quasi_laminar_resistance --- calculates the quasi-laminar -! resistance for particles -! -! !INTERFACE: - - function quasi_laminar_resistance(friction_velocity, Sc, St) result (r_b) -! !USES: - - implicit None - - real :: r_b ! Quasi-laminar resistance, 'm-1 s' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - real, intent(in) :: Sc ! Schmidt number, '' - real, intent(in) :: St ! Stokes number, '' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the quasi-laminar resistance (see Eq. XX, Seinfeld and Pandis) -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('quasi_laminar_resistance') - - r_b = 1 / (friction_velocity * (Sc**(-0.5) + 10.0**(-3/St))) - - end function quasi_laminar_resistance - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: aerodynamic_resistance --- calculates the aerodynamic resistance -! -! !INTERFACE: - - function aerodynamic_resistance(temperature, density_air, flux_sh, & - friction_velocity, dz, z0h) result (r_a) -! !USES: - - implicit None - - real :: r_a ! Aerodynamic resistance, 'm-1 s' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: temperature ! temperature, 'K' - real, intent(in) :: density_air ! density of air, 'kg m-3' - real, intent(in) :: flux_sh ! sensible heat flux at the surface, 'W m-2' - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - real, intent(in) :: dz ! depth of the surface layer, 'm' - real, intent(in) :: z0h ! roughness height for sensible heat, 'm' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the aerodynamic resistance (see Eq. XX, Seinfeld and Pandis) -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('aerodynamic_resistance') - - ! local - real, parameter :: k = von_karman - - real :: z_ref - real :: f - real :: psi_h - real :: log_f - real :: z0h_ - real :: eps - real :: L - - - z_ref = 0.5 * dz - - L = monin_obukhov_length(temperature, density_air, flux_sh, friction_velocity) - - f = z_ref / L - - if(f > 1.0) then - f = 1.0 - end if - - if ( (f > 0.0) .and. (f <= 1.0)) then - psi_h = -5.0*f - else if (f < 0.0) then - eps = min(1.0, -f) - log_f = log(eps) - psi_h = exp(0.598 + 0.39*log_f - 0.09*(log_f**2)) - endif - - z0h_ = max(z0h, 1e2 * tiny(1.0)) - - r_a = (log(z_ref / z0h_) - psi_h) / (k * friction_velocity) - - end function aerodynamic_resistance - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: monin_obukhov_length --- calculates the Monin-Obukhov length -! -! !INTERFACE: - - function monin_obukhov_length(temperature, density_air, flux_sh, friction_velocity) result (L) -! !USES: - - implicit None - - real :: L ! Monin-Obukhov length, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: temperature ! temperature, 'K' - real, intent(in) :: density_air ! density of air, 'kg m-3' - real, intent(in) :: flux_sh ! sensible heat flux at the surface, 'W m-2' - real, intent(in) :: friction_velocity ! friction velocity, 'm s-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: calculates the calculates the Monin-Obukhov length -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('monin_obukhov_length') - - ! local - real, parameter :: k = von_karman - real, parameter :: g = g_E - - if (abs(flux_sh) > 1e3*epsilon(0.0)) then - L = - density_air * c_p * temperature * friction_velocity**3 / (k * g * flux_sh) - else - L = 1/(1e3*epsilon(0.0)) - end if - - end function monin_obukhov_length - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DepositionVelosityAerosol --- -! -! !INTERFACE: - - function MAML_DepositionVelocityAerosol(v_t, r_a, r_b) result (v_d) -! !USES: - - implicit None - - real :: v_d - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: v_t ! settling velocity, 'm s-1' - - real, intent(in) :: r_a ! aerodynamic resistance, 'm-1 s' - real, intent(in) :: r_b ! quasi-laminar resistance, 'm-1 s' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the deposition velocity of particles following -! Venkatram and Pleim, 1999. -! -! !REVISION HISTORY: -! -! 15Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_DepositionVelocityAerosol') - - v_d = v_t / (1 - exp(-(r_a + r_b) * v_t)) - - end function MAML_DepositionVelocityAerosol - - end module MAML_DryDepositionMod - diff --git a/MAMchem_GridComp/MAML_DryRemovalMod.F90 b/MAMchem_GridComp/MAML_DryRemovalMod.F90 deleted file mode 100644 index cf4ef43c..00000000 --- a/MAMchem_GridComp/MAML_DryRemovalMod.F90 +++ /dev/null @@ -1,362 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_DryRemovalMod - Gravitational sedimentation/settling and dry -! deposition of aerosol particles and gases -! -! !INTERFACE: -! - module MAML_DryRemovalMod -! -! !USES: -! - use MAPL - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_DryRemoval - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - real, private, parameter :: g_E = MAPL_GRAV ! standard gravity, 'm s-2' - -! -! !DESCRIPTION: -! -! {\tt MAML\_SettlingMod} provides a collection of methods for -! modeling graviational sedimentation/settling of aerosol particles -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - interface MAML_DryRemoval - module procedure MAML_DryRemovalAerosol - module procedure MAML_DryRemovalGas - end interface MAML_DryRemoval - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DryRemovalTendencySolverAerosol --- -! -! !INTERFACE: - - subroutine MAML_DryRemovalTendencySolverAerosol(dqdt, q, delp, dz, v_t, v_d) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - -! !INPUT PARAMETERS: - - real, dimension(:), intent(in) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, dimension(:), intent(in) :: delp ! pressure thickness of levels, 'Pa' - real, dimension(:), intent(in) :: dz ! thickness of levels, 'm' - real, dimension(:), intent(in) :: v_t ! settling velocity, 'm s-1' - real, intent(in) :: v_d ! deposition velocity, 'm s-1' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates mixing ratio tendency (dq/dt) due to -! gravitational sedimentation/settling and dry deposition. -! -! !REVISION HISTORY: -! -! 19Nov2011 A. Darmenov First crack. -! 20Dec2011 A. Darmenov Gravitational sedimentation and dry deposition -! are done in parallel -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_DryRemovalTendencySolverAerosol') - - real, allocatable, dimension(:) :: v - integer :: k1, k2, km - integer :: rc - - k1 = lbound(q, 1) - km = ubound(q, 1) - - allocate(v(k1:km), __STAT__) - - v(k1:km-1) = v_t(k1:km-1) - v(km) = v_d - - k2 = k1 + 1 - dqdt = 0.0 - - ! zero flux in from top of the atmosphere (k=k1) - dqdt(k1) = 0.0 - q(k1) * v(k1) / dz(k1) - - ! levels k2:km --- flux in from the level above and flux out into the level below - dqdt(k2:km) = (q(k1:km-1) * (v(k1:km-1) / dz(k1:km-1))) * (delp(k1:km-1)/delp(k2:km)) - & - (q(k2:km ) * (v(k2:km ) / dz(k2:km ))) - - deallocate(v, __STAT__) - - end subroutine MAML_DryRemovalTendencySolverAerosol - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DryRemovalTendencySolverGas --- -! -! !INTERFACE: - - subroutine MAML_DryRemovalTendencySolverGas(dqdt, q, dz, v_d, dt) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, intent(inout) :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - -! !INPUT PARAMETERS: - - real, intent(in) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, intent(in) :: dz ! thickness of the surface level, 'm' - real, intent(in) :: v_d ! deposition velocity, 'm s-1' - real, intent(in) :: dt ! time step, 's' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates mixing ratio tendency (dq/dt) due to dry deposition. -! Follows Kerkweg et al., 2006 approach to avoid depletion (q < 0) -! of the species by introducing effective deposition velocity. -! -! !REVISION HISTORY: -! -! 20Dec2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_DryRemovalTendencySolverGas') - - - real :: v_eff ! effective deposition velocity: derived by - ! integrating the equation: - ! - ! dq/dt = - q * (v_d / dz) - - - v_eff = dz/dt * (1 - exp(-v_d * dt/dz)) - - dqdt = - q * v_eff / dz - - end subroutine MAML_DryRemovalTendencySolverGas - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DryRemovalAerosol --- -! -! !INTERFACE: - - subroutine MAML_DryRemovalAerosol(q, delp, dz, v_t, v_d, dt, flux) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, optional, intent(inout) :: flux ! deposition flux 'kg m-2 s-1' or '# m-2 s-1' - -! !INPUT PARAMETERS: - real, dimension(:), intent(in) :: delp ! pressure thickness of levels, 'Pa' - real, dimension(:), intent(in) :: dz ! thickness of levels, 'm' - real, dimension(:), intent(in) :: v_t ! settling velocity, 'm s-1' - real, intent(in) :: v_d ! deposition velocity, 'm s-1' - real, intent(in) :: dt ! model time step, 's' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the changes in the mixing ratio due to -! gravitational sedimentation/settling. -! -! !REVISION HISTORY: -! -! 6Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_DryRemovalAerosol') - - real, pointer, dimension(:) :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - - real :: q_column_initial ! initial value of column integrated mixing ratio - real :: q_column_final ! final value of column integrated mixing ratio - - real :: dt_step, dt_cfl ! integration time step - integer :: n_steps ! number of time steps - - integer :: k1, km ! indexes - integer :: n ! loop counter - - integer :: rc ! return code - - - k1 = lbound(q, 1) - km = ubound(q, 1) - - allocate(dqdt(k1:km), __STAT__) - - ! If there is no time splitting, the flux is simply the settling flux out from the - ! surface layer, because of the mass conservation. Instead of integrating in time, - ! we calculate the flux as the difference in the column integrated mass before and - ! after the settling. - - q_column_initial = 0.0 - q_column_final = 0.0 - - if (present(flux)) then - q_column_initial = sum(q * delp/g_E) - end if - - ! test if the time step is sufficiently small to maintain numerical stability - dt_cfl = min(dt, minval(dz / v_t)) - dt_cfl = min(dt_cfl, dz(km) / v_d) - - if (dt_cfl < dt) then - n_steps = ceiling(dt / dt_cfl) - else - n_steps = 1 - end if - - ! time integration - dt_step = dt / n_steps - - do n = 1, n_steps - dqdt = 0.0 - - ! NOTE: In case of polydisperse aerosols, it would be more correct - ! to update the settling velocities in the innner time loop. - call MAML_DryRemovalTendencySolverAerosol(dqdt, q, delp, dz, v_t, v_d) - - q = q + (dqdt * dt_step) - end do - - ! calculate the flux due to deposition - if (present(flux)) then - q_column_final = sum(q * delp/g_E) - - flux = -(q_column_final - q_column_initial) / dt - end if - - deallocate(dqdt, __STAT__) - - end subroutine MAML_DryRemovalAerosol - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DryRemovalGas --- -! -! !INTERFACE: - - subroutine MAML_DryRemovalGas(q, delp, dz, v_d, dt, flux) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, intent(inout) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, optional, intent(inout) :: flux ! deposition flux 'kg m-2 s-1' or '# m-2 s-1' - -! !INPUT PARAMETERS: - real, intent(in) :: delp ! pressure thickness of levels, 'Pa' - real, intent(in) :: dz ! thickness of levels, 'm' - real, intent(in) :: v_d ! deposotion velocity, 'm s-1' - real, intent(in) :: dt ! model time step, 's' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the changes in the mixing ratio due to -! gravitational sedimentation/settling. -! -! !REVISION HISTORY: -! -! 6Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_DryRemovalGas') - - real :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - - real :: q_initial ! initial value of the mixing ratio - - - ! save the initial mixing ratio - q_initial = q - - call MAML_DryRemovalTendencySolverGas(dqdt, q, dz, v_d, dt) - - q = q + (dqdt * dt) - - ! calculate the flux due to deposition - if (present(flux)) then - flux = -(q - q_initial) * (delp/g_E) / dt - end if - - end subroutine MAML_DryRemovalGas - - end module MAML_DryRemovalMod - diff --git a/MAMchem_GridComp/MAML_GasAerosolExchangeMod.F90 b/MAMchem_GridComp/MAML_GasAerosolExchangeMod.F90 deleted file mode 100644 index 16f484ff..00000000 --- a/MAMchem_GridComp/MAML_GasAerosolExchangeMod.F90 +++ /dev/null @@ -1,823 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_GasAerosolExchangeMod - Gas condensation. -! -! !INTERFACE: -! - module MAML_GasAerosolExchangeMod -! -! !USES: -! - use shr_kind_mod, only : r8 => shr_kind_r8 - - use MAPL - - use MAM_ComponentsDataMod - use modal_aero_gasaerexch, only : modal_aero_soaexch - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_GasAerosolExchange - - -! !PRIVATE PARAMETERS - real, private, parameter :: pi = MAPL_PI - real, private, parameter :: mw_air = MAPL_AIRMW ! molecular weight of dry air, kg/Kmole - - -! -! !DESCRIPTION: -! -! {\tt MAML\_GasAerosolExchangeMod} provides methods to compute -! gas-aerosol exchange. -! -! -! !REVISION HISTORY: -! -! 25Jun2012 A. Darmenov Initial version -- based on CESM-1.0.3 CAM/MAM -! modal_aero_gasaerexch module -! -! -!EOP -!------------------------------------------------------------------------- - - - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_GasAerosolExchange --- condensation of H2SO4, NH3 and MSA. -! -! -! !INTERFACE: - - subroutine MAML_GasAerosolExchange(pressure, & - temperature, & - density_air, & - rh, & - f_cld, & - z, & - pblz, & - q_number, & - q_nh4, & - q_so4, & - q_h2so4, & - q_nh3, & - do_nh3, & - do_nh4g, & ! << added - do_msag, & ! << added - do_soag, & ! << added - Dg, & - Dg_min, & - Dg_max, & - density_so4, & - mw_so4a, & - mw_nh4a, & - dq_h2so4_gasprod, & - dq_h2so4_aeruptk, & - dt) - - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, intent(inout) :: q_number ! number mixing ratios of the Aitken mode - real, intent(inout) :: q_nh4 ! mass mixing ratio of ammonium (NH4) in the Aitken mode - real, intent(inout) :: q_so4 ! mass mixing ratio of sulfate (SO4) in the Aitken mode - - real, intent(inout) :: q_h2so4 ! mass mixing ratio of sulfuric acid (H2SO4) - real, intent(inout) :: q_nh3 ! mass mixing ratio of ammonia (NH3) - - real, intent(inout) :: g_so4 ! gas H2SO4 - real, intent(inout) :: g_nh4 ! gas NH3 - real, intent(inout) :: g_msa ! gas MSA - real, intent(inout) :: g_soa ! gas SOA(SOAG) - - - -! !INPUT PARAMETERS: - real, intent(in) :: pressure ! pressure at mid level, Pa - real, intent(in) :: temperature ! temperature at mid level, K - real, intent(in) :: density_air ! air density, kg m-3 - real, intent(in) :: rh ! relative humidity - real, intent(in) :: f_cld ! cloud fraction - real, intent(in) :: z ! mid-layer height above surface, m - real, intent(in) :: pblz ! PBL height, m - - real, intent(in) :: Dg ! mean diameter of Aitken mode number size distribution - real, intent(in) :: Dg_min ! low limit of the mean diameter - real, intent(in) :: Dg_max ! upper limit of the mean diameter - - real, intent(in) :: density_so4 ! SO4 bulk density - real, intent(in) :: mw_so4a ! molecular weight of SO4 aerosol - real, intent(in) :: mw_nh4a ! molecular weight of NH4 aerosol - - - real, intent(in) :: dq_h2so4_gasprod ! H2SO4 gas-phase production change over dt (mol/mol) - real, intent(in) :: dq_h2so4_aeruptk ! H2SO4 gas-phase loss to aerosol over dt (mol/mol) - - real, intent(in) :: dt ! time step - - logical, intent(in) :: do_nh3 ! NH3 flag - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Condensation of H2SO4, NH3, and MSA. Both treated as completely -! non-volatile (gas --> aerosol, but no aerosol --> gas): -! - gas H2SO4 goes to aerosol SO4 -! - gas MSA (if present) goes to aerosol SO4 -! aerosol MSA is not distinguished from aerosol SO4 -! - gas NH3 (if present) goes to aerosol NH4 -! if gas NH3 is not present, then...? - -! -! !REVISION HISTORY: -! -! 25Jun2012 A. Darmenov First crack -- based on modal_aero_gasaerexch_sub(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_GasAerosolExchange') - - - ! local variables - real(r8) :: P, T ! pressure and temperature at midlevels - real(r8) :: zm ! mid-level height - real(r8) :: pblh ! PBL height - - real(r8) :: d_dry_min, d_dry_max ! dry-diameter limits - real(r8) :: mass_1p, mass_1p_min, mass_1p_max ! single particle mass and mass limits - - real(r8) :: f ! lognormal size distribution factor - - real(r8) :: mw_so4a_host ! molecular weght of sulfate aerosol - - real :: cld ! cloud fraction in the interval [0, 1] - real :: rh_grid ! RH (grid average) - real(r8) :: rh_non_cld ! RH in the non cloudy area of the grid - - real(r8) :: dqdt ! tendency - - - real(r8) :: deltat ! time step - - real(r8) :: dplom_mode(1), dphim_mode(1) ! dry-diameter limits - - real(r8) :: q_h2so4_cur ! H2SO4 molar mixing ratio - real(r8) :: q_h2so4_avg ! estimated H2SO4, mol/mol-air - real(r8) :: q_nh3_cur ! NH3, mol/mol-air - - ! note: aerosol changes are > 0; gas changes are < 0 - real(r8) :: dq_numa ! change to aerosol number mixing ratio, #/mol-air - real(r8) :: dq_so4a ! change to aerosol SO4 mixing ratio, mol/mol-air - real(r8) :: dq_nh4a ! change to aerosol NH4 mixing ratio, mol/mol-air - real(r8) :: dq_h2so4 ! change to gas H2SO4 mixing ratio, mol/mol-air - real(r8) :: dq_nh3 ! change to gas NH3 mixing ratio, mol/mol-air - - real(r8) :: dens_nh4so4a ! dry-density of the new NH4-SO4 aerosol mass, kg m-3 - - real(r8) :: dndt_ait, dmdt_ait ! number and mass nucleation rates - - real(r8) :: dso4dt_ait ! - real(r8) :: dnh4dt_ait ! - real(r8) :: dqdt_numait, dqdt_nh4ait, dqdt_so4ait ! - real(r8) :: dqdt_h2so4, dqdt_nh3 ! - - real(r8) :: tmp_a, tmp_b, tmp_c, tmp_q2, tmp_q3, & ! temporary vars - tmp_uptake_rate, tmp_frso4 - - real(r8) :: dndt_aitsv1, dndt_aitsv2, dndt_aitsv3, & ! temporary values of the nucleation rates - dmdt_aitsv1, dmdt_aitsv2, dmdt_aitsv3 - - integer :: l_diag_veh02 ! diagnostics flag, -1 / +1 corresponds to disable / enable - - integer :: itmp ! size bin of newly formed particles - - - ! local parameters - real(r8), parameter :: q_h2so4_cutoff = 4.0e-16_r8 ! minimal H2SO4 vapor molar mixing ratio for nucleation = 4.0e-16 mol/mol-air, - ! which corresponds to approximatlelly 1.0e4 molecules/cm3 - - integer, parameter :: nuc_method_flag = 11 ! 1 = merikanto et al (2007) ternary - ! 2 = vehkamaki et al (2002) binary - ! 11 = merikanto ternary + first-order boundary layer - ! 12 = merikanto ternary + second-order boundary layer - - - - ! mass to volume factors - f_m2v_so4 = mw_so4_a / density_so4_a - f_m2v_nh4 = mw_nh4_a / density_nh4_a - f_m2v_soa = mw_soa_a / density_soa_a - - f_m2v_pcarbon(:) = 0.0 - n = modeptr_pcarbon - do l = 1, nspec_amode(n) - l2 = lspectype_amode(l,n) - ! fac_m2v converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) - ! [m3-AP/kmol-AP] = [kg-AP/kmol-AP] / [kg-AP/m3-AP] - fac_m2v_pcarbon(l) = mw_amode(l2) / density_amode(l2) - end do - - ! volume to surface - f_v2s_pcarbon = exp(2.5*(alnsg_amode(n)**2)) - xferfrac_max = 1.0 - 10.0*epsilon(1.0) ! 1 - eps - - - ! compute gas-to-aerosol mass transfer rates - call gas_aer_uptkrates(q, t, pmid, dgncur_awet, uptkrate) - - - ! use this for tendency calculations to avoid generating very small negative values - dt_ = dt * (1.0 + epsilon(1.0)) - -#if(0) - jsrf = jsrflx_gaexch - - ! f_gain_so4(n) = fraction of total H2SO4 uptake going to mode n - ! f_gain_nh4(n) = fraction of total NH3 uptake going to mode n - sum_uptk_rate_so4 = 0.0 - sum_uprt_nh4 = 0.0 - sum_uprt_soa = 0.0 - - do n = 1, ntot_amode - uptkratebb(n) = uptkrate(n,i,k) - - if (ido_so4a(n) > 0) then - fgain_so4(n) = uptkratebb(n) - sum_uprt_so4 = sum_uprt_so4 + fgain_so4(n) - - if (ido_so4a(n) == 1) then - qold_so4(n) = q(i,k,lptr_so4_a_amode(n)-loffset) - else - qold_so4(n) = 0.0 - end if - else - fgain_so4(n) = 0.0 - qold_so4(n) = 0.0 - end if - - if (ido_nh4a(n) > 0) then - ! 2.08 factor is for gas diffusivity (nh3/h2so4) - ! differences in fuch-sutugin and accom coef ignored - - fgain_nh4(n) = uptkratebb(n)*2.08 - sum_uprt_nh4 = sum_uprt_nh4 + fgain_nh4(n) - - if (ido_nh4a(n) == 1) then - qold_nh4(n) = q(i,k,lptr_nh4_a_amode(n)-loffset) - else - qold_nh4(n) = 0.0 - end if - else - fgain_nh4(n) = 0.0 - qold_nh4(n) = 0.0 - end if - - if (ido_soaa(n) > 0) then - ! 0.81 factor is for gas diffusivity (soa/h2so4) - ! (differences in fuch-sutugin and accom coef ignored) - - fgain_soa(n) = uptkratebb(n)*0.81 - sum_uprt_soa = sum_uprt_soa + fgain_soa(n) - - if (ido_soaa(n) == 1) then - qold_soa(n) = q(i,k,lptr_soa_a_amode(n)-loffset) - l = lptr_pom_a_amode(n)-loffset - - if (l > 0) then - qold_poa(n) = q(i,k,l) - else - qold_poa(n) = 0.0 - end if - else - qold_soa(n) = 0.0 - qold_poa(n) = 0.0 - end if - else - fgain_soa(n) = 0.0 - qold_soa(n) = 0.0 - qold_poa(n) = 0.0 - end if - - uptkrate_soa(n) = fgain_soa(n) - end do - - - - if (sum_uprt_so4 > 0.0) then - do n = 1, ntot_amode - fgain_so4(n) = fgain_so4(n) / sum_uprt_so4 - end do - end if - - ! at this point (sum_uprt_so4 <= 0.0) only when all the fgain_so4 are zero - if (sum_uprt_nh4 > 0.0) then - do n = 1, ntot_amode - fgain_nh4(n) = fgain_nh4(n) / sum_uprt_nh4 - end do - end if - - if (sum_uprt_soa > 0.0) then - do n = 1, ntot_amode - fgain_soa(n) = fgain_soa(n) / sum_uprt_soa - end do - end if - - ! uptake amount (fraction of gas uptaken) over deltat - avg_uprt_so4 = (1.0 - exp(-deltatxx*sum_uprt_so4))/deltatxx - avg_uprt_nh4 = (1.0 - exp(-deltatxx*sum_uprt_nh4))/deltatxx - avg_uprt_soa = (1.0 - exp(-deltatxx*sum_uprt_soa))/deltatxx - - ! sum_dqdt_so4 = so4_a tendency from h2so4 gas uptake (mol/mol/s) - ! sum_dqdt_msa = msa_a tendency from msa gas uptake (mol/mol/s) - ! sum_dqdt_nh4 = nh4_a tendency from nh3 gas uptake (mol/mol/s) - ! sum_dqdt_soa = soa_a tendency from soa gas uptake (mol/mol/s) - sum_dqdt_so4 = q(i,k,l_so4g) * avg_uprt_so4 - - if (do_msag) then - sum_dqdt_msa = q(i,k,l_msag) * avg_uprt_so4 - else - sum_dqdt_msa = 0.0 - end if - - if (do_nh4g) then - sum_dqdt_nh4 = q(i,k,l_nh4g) * avg_uprt_nh4 - else - sum_dqdt_nh4 = 0.0 - end if - - if (do_soag) then - sum_dqdt_soa = q(i,k,l_soag) * avg_uprt_soa - else - sum_dqdt_soa = 0.0 - end if - - - ! compute TMR tendencies for so4, nh4, msa interstial aerosol - ! due to simple gas uptake - pdel_fac = pdel(i,k)/gravit - sum_dqdt_nh4_b = 0.0 - - do n = 1, ntot_amode - dqdt_so4(n) = fgain_so4(n)*(sum_dqdt_so4 + sum_dqdt_msa) - - if (do_nh4g) then - dqdt_nh4(n) = fgain_nh4(n)*sum_dqdt_nh4 - qnew_nh4 = qold_nh4(n) + dqdt_nh4(n)*deltat - qnew_so4 = qold_so4(n) + dqdt_so4(n)*deltat - qmax_nh4 = 2.0*qnew_so4 - - if (qnew_nh4 > qmax_nh4) then - dqdt_nh4(n) = (qmax_nh4 - qold_nh4(n))/deltatxx - end if - - sum_dqdt_nh4_b = sum_dqdt_nh4_b + dqdt_nh4(n) - end if - end do - - if (( do_soag ) .and. (method_soa > 1)) then - ! compute TMR tendencies for soag and soa interstial aerosol - ! using soa parameterization - - niter_max = 1000 - dqdt_soa(:) = 0.0 - - call modal_aero_soaexch( deltat, t(i,k), pmid(i,k), & - niter, niter_max, ntot_soamode, & - q(i,k,l_soag), qold_soa, qold_poa, uptkrate_soa, & - tmp1, dqdt_soa ) - - sum_dqdt_soa = -tmp1 - else if ( do_soag ) then - ! compute TMR tendencies for soa interstial aerosol - ! due to simple gas uptake - - do n = 1, ntot_amode - dqdt_soa(n) = fgain_soa(n)*sum_dqdt_soa - end do - else - dqdt_soa(:) = 0.0 - end if - - do n = 1, ntot_amode - if (ido_so4a(n) == 1) then - l = lptr_so4_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_so4(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_so4(n)*pdel_fac - end if - - if (do_nh4g) then - if (ido_nh4a(n) == 1) then - l = lptr_nh4_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_nh4(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_nh4(n)*pdel_fac - end if - end if - - if (do_soag) then - if (ido_soaa(n) == 1) then - l = lptr_soa_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_soa(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_soa(n)*pdel_fac - end if - end if - end do - - ! compute TMR tendencies for h2so4, nh3, and msa gas - ! due to simple gas uptake - l = l_so4g - dqdt(i,k,l) = -sum_dqdt_so4 - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - - if (do_msag) then - l = l_msag - dqdt(i,k,l) = -sum_dqdt_msa - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - - if (do_nh4g) then - l = l_nh4g - dqdt(i,k,l) = -sum_dqdt_nh4_b - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - - if (do_soag) then - l = l_soag - dqdt(i,k,l) = -sum_dqdt_soa - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - - ! compute TMR tendencies associated with primary carbon aging - if (modefrm_pcage > 0) then - n = modeptr_pcarbon - vol_shell = deltat * (dqdt_so4(n)*fac_m2v_so4 + dqdt_nh4(n)*fac_m2v_nh4 + & - dqdt_soa(n)*fac_m2v_soa*soa_equivso4_factor ) - - vol_core = 0.0 - do l = 1, nspec_amode(n) - vol_core = vol_core + q(i,k,lmassptr_amode(l,n)-loffset)*fac_m2v_pcarbon(l) - end do - - ! ratio1 = vol_shell/vol_core = - ! actual hygroscopic-shell-volume/carbon-core-volume after gas uptake - ! ratio2 = 6.0_r8*dr_so4_monolayers_pcage/(dgncur_a*fac_volsfc_pcarbon) - ! = (shell-volume corresponding to n_so4_monolayers_pcage)/core-volume - ! The 6.0/(dgncur_a*fac_volsfc_pcarbon) = (mode-surface-area/mode-volume) - ! Note that vol_shell includes both so4+nh4 AND soa as "equivalent so4", - ! The soa_equivso4_factor accounts for the lower hygroscopicity of soa. - ! - ! Define xferfrac_pcage = min( 1.0, ratio1/ratio2) - ! But ratio1/ratio2 == tmp1/tmp2, and coding below avoids possible overflow - ! - - tmp1 = vol_shell*dgncur_a(i,k,n)*fac_volsfc_pcarbon - tmp2 = max( 6.0_r8*dr_so4_monolayers_pcage*vol_core, 0.0_r8 ) - - if (tmp1 >= tmp2) then - xferfrac_pcage = xferfrac_max - else - xferfrac_pcage = min( tmp1/tmp2, xferfrac_max ) - end if - - if (xferfrac_pcage > 0.0_r8) then - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq)-loffset - lstoo = lspectoo_pcage(iq)-loffset - xferrate = (xferfrac_pcage/deltat)*q(i,k,lsfrm) - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferrate - qsrflx(i,lsfrm,jsrf) = qsrflx(i,lsfrm,jsrf) - xferrate*pdel_fac - - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferrate - qsrflx(i,lstoo,jsrf) = qsrflx(i,lstoo,jsrf) + xferrate*pdel_fac - end if - end do - - if (ido_so4a(modetoo_pcage) > 0) then - l = lptr_so4_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_so4(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_so4(modefrm_pcage)*pdel_fac - end if - - if (ido_nh4a(modetoo_pcage) > 0) then - l = lptr_nh4_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_nh4(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_nh4(modefrm_pcage)*pdel_fac - end if - - if (ido_soaa(modetoo_pcage) > 0) then - l = lptr_soa_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_soa(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_soa(modefrm_pcage)*pdel_fac - end if - - end if - - end if - - -! set "temporary testing arrays" - qold(:,:,:) = q(:,:,:) - qqcwold(:,:,:) = qqcw(:,:,:) - dqdtsv1(:,:,:) = dqdt(:,:,:) - dqqcwdtsv1(:,:,:) = dqqcwdt(:,:,:) - - -! -! do renaming calcs -! - dotendrn(:) = .false. - dotendqqcwrn(:) = .false. - dorename_atik(1:ncol,:) = .true. - is_dorename_atik = .true. - if (ncol >= -13579) then - call modal_aero_rename_sub( & - 'modal_aero_gasaerexch_sub', & - lchnk, ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - pdel, & - dotendrn, q, & - dqdt, dqdt_other, & - dotendqqcwrn, qqcw, & - dqqcwdt, dqqcwdt_other, & - is_dorename_atik, dorename_atik, & - jsrflx_rename, nsrflx, & - qsrflx, qqcwsrflx ) - end if - - -! -! apply the dqdt to update q (and same for qqcw) -! - do l = 1, pcnstxx - if ( dotend(l) .or. dotendrn(l) ) then - do k = 1, pver - do i = 1, ncol - q(i,k,l) = q(i,k,l) + dqdt(i,k,l)*deltat - end do - end do - end if - if ( dotendqqcw(l) .or. dotendqqcwrn(l) ) then - do k = 1, pver - do i = 1, ncol - qqcw(i,k,l) = qqcw(i,k,l) + dqqcwdt(i,k,l)*deltat - end do - end do - end if - end do - - -! do history file column-tendency fields - do l = 1, pcnstxx - lb = l + loffset - - do jsrf = 1, 2 - - do jac = 1, 2 - - if (jac == 1) then - if (jsrf == jsrflx_gaexch) then - if ( .not. dotend(l) ) cycle - - fieldname = trim(cnst_name(lb)) // '_sfgaex1' - else if (jsrf == jsrflx_rename) then - if ( .not. dotendrn(l) ) cycle - - fieldname = trim(cnst_name(lb)) // '_sfgaex2' - else - cycle - end if - - do i = 1, ncol - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf)*(adv_mass(l)/mwdry) - end do - - call outfld( fieldname, qsrflx(:,l,jsrf), pcols, lchnk ) - else - if (jsrf == jsrflx_gaexch) then - cycle - else if (jsrf == jsrflx_rename) then - if ( .not. dotendqqcwrn(l) ) cycle - fieldname = trim(cnst_name_cw(lb)) // '_sfgaex2' - else - cycle - end if - - do i = 1, ncol - qqcwsrflx(i,l,jsrf) = qqcwsrflx(i,l,jsrf)*(adv_mass(l)/mwdry) - end do - - call outfld( fieldname, qqcwsrflx(:,l,jsrf), pcols, lchnk ) - end if - - if (ldiag4 > 0) then - if (icol_diag > 0) then - i = icol_diag - - if (jac == 1) then - tmp1 = qsrflx(i,l,jsrf) - else - tmp1 = qqcwsrflx(i,l,jsrf) - end if - - write(*,'(a,4i5,2x,a,1p,2e12.4)') & - 'gasaerexch nstep,lat,lon,l,fieldname,qsrflx,adv_mass', & - nstep, latndx(i), lonndx(i), l, fieldname, tmp1, adv_mass(l) - end if - end if - - end do ! jac = ... - end do ! jsrf = ... - end do ! l = ... - -#endif - return - - end subroutine MAML_GasAerosolExchange - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_GasAerosolUptake --- Compute uptake rate due to gas -! condensation. -! -! -! !INTERFACE: - - subroutine MAML_GasAerosolUptake(pressure, & - temperature, & - density_air, & - q_number, & - Dg_wet, & - sigma, & - uptake) - - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: q_number ! number mixing ratios of the aerosol modes - - - real, dimension(:), intent(inout) :: uptake ! gas-to-aerosol mass transfer rate - - -! !INPUT PARAMETERS: - real, intent(in) :: pressure ! pressure at mid level, Pa - real, intent(in) :: temperature ! temperature at mid level, K - real, intent(in) :: density_air ! air density, kg m-3 - - real, dimension(:), intent(in) :: Dg_wet ! wet geometric mean diameter of number size distribution - real, dimension(:), intent(in) :: sigma ! geometric standard deviation - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Computes the H2SO4 uptake rate (gas to aerosol phase) for aerosol -! population with lognormal size distribution N=N(ln(Dp)) -! / -! uptake rate = | dx * dN/dx * gas_conden_rate(Dp(x)), where -! / -! -! Dp = particle diameter, cm -! x = ln(Dp) -! dN/dx = log-normal particle number density distribution -! -! gas_conden_rate(Dp) = 2 * pi * gas_diffusivity * Dp * F(Kn,ac) -! F(Kn,ac) = Fuchs-Sutugin correction factor -! Kn = Knudsen number -! ac = accommodation coefficient = -! = 'number of molecules entering liquid phase' / -! 'number of molecular collisions with the surface' -! -! The uptake rate is computed numerically using Gauss-Hermite -! quadrature of order 2. -! - -! -! !REVISION HISTORY: -! -! 25Jun2012 A. Darmenov First crack -- based on gas_aer_uptkrates(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_GasAerosolUptake') - - - ! local parameters - real, parameter :: beta = 2.0 - real, parameter :: sqrt_2 = sqrt(2.0) - real, parameter :: sqrt_pi = sqrt(pi) - - integer, parameter :: n_ghq = 2 ! Gauss-Hermite quadrature order, abscissae and weights - real, dimension(n_ghq), parameter :: x_ghq = (-0.70710678, 0.70710678) - real, dimension(n_ghq), parameter :: w_ghq = ( 0.88622693, 0.88622693) - -! integer, parameter :: n_ghq = 3 -! real, dimension(n_ghq), parameter :: x_ghq = (-1.22474487, 0.000000000, 1.22474487) -! real, dimension(n_ghq), parameter :: w_ghq = ( 0.29540897, 1.181635901, 0.29540897) -! -! integer, parameter :: n_ghq = 4 -! real, dimension(n_ghq), parameter :: x_ghq = (-1.65068012,-0.524647623, 0.524647623, 1.65068012) -! real, dimension(n_ghq), parameter :: w_ghq = ( 0.08131283, 0.804914090, 0.804914090, 0.08131283) -! -! integer, parameter :: n_ghq = 5 -! real, dimension(n_ghq), parameter :: x_ghq = (-2.02018287,-0.958572465, 0.000000000, 0.958572465, 2.02018287) -! real, dimension(n_ghq), parameter :: w_ghq = ( 0.01995324, 0.393619323, 0.945308720, 0.393619323, 0.01995324) - - - ! local variables - real :: air_con ! dry air molar concentration, kmol-air/m3 - real :: num_a_con ! aerosol number molar concentration, kmol m-3 - - real :: diffusivity_h2so4 ! diffusivity of H2SO4(gas), m2/s - real :: speed_h2so4 ! mean molecular speed of H2SO4(gas), m/s - - real :: mean_free_path ! mean free path, m - - real, dimension(n_ghq) :: ln_dp, dp ! temporary vars - real, dimension(n_ghq) :: Kn ! Knudsen number - real, dimension(n_ghq) :: fuchs_sutugin ! Fuchs-Sutugin term - - real :: sum_ghq ! Gauss-Hermite quadrature - - real :: C, ln_Dg, ln_sigma ! temporary vars - - integer :: n, n_modes - - - n_modes = size(q_number) - - - ! dry air concentration - air_con = density_air / mw_air - - ! following expressions for H2SO4(gas) are from MOSAIC - diffusivity_h2so4 = 0.557e-4 * (temperature**1.75) / pressure - speed_h2so4 = 1.470e1 * sqrt(temperature ) - - - ! Fuchs-Sutugin definition of mean free path - mean_free_path = 3.0 * diffusivity_h2so4 / speed_h2so4 - - do n = 1, n_modes - ! concentration of aerosol particles - num_a_con = q_number(n) * air_con - - ln_Dg = log(Dg_wet(n)) - ln_sigma = log(sigma(n)) - - ! compute function values at gauss-hermite quadrature points - ln_dp = ln_Dg + beta*ln_sigma**2 + sqrt_2*ln_sigma*x_ghq - dp = exp(ln_Dp) - - ! knudsen number - Kn = 2 * mean_free_path/dp - - ! apply accommodation coefficient (ac) = 0.65, after Adams & Seinfeld (JGR, 2002) - ! fuchs_sutugin(Kn,ac) = (0.75*ac*(1 + Kn)) / (Kn*(1 + Kn + 0.283*ac) + 0.75*ac) - fuchs_sutugin = (0.4875 * (1 + Kn)) / (Kn*(1.184 + Kn) + 0.4875) - - ! gauss-hermite quadrature - sum_ghq = sum(w_ghq * dp * fuchs_sutugin/(dp**beta)) - - C = 2*sqrt_pi * num_a_con * exp(beta*ln_Dg + 0.5*(beta*ln_sigma)**2) - uptake(n) = C * diffusivity_h2so4 * sum_ghq - end do - - return - - end subroutine MAML_GasAerosolUptake - - - end module MAML_GasAerosolExchangeMod diff --git a/MAMchem_GridComp/MAML_NucleationMod.F90 b/MAMchem_GridComp/MAML_NucleationMod.F90 deleted file mode 100644 index 8794f233..00000000 --- a/MAMchem_GridComp/MAML_NucleationMod.F90 +++ /dev/null @@ -1,421 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_NucleationMod - Nucleation of aerosol particles. -! -! !INTERFACE: -! - module MAML_NucleationMod -! -! !USES: -! - - use MAPL - use MAPL_ConstantsMod, only : MAPL_PI, r8 => MAPL_R8 - - use MAM_ComponentsDataMod - use modal_aero_newnuc, only : mer07_veh02_nuc_mosaic_1box - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_Nucleation - - -! !PRIVATE PARAMETERS - real, private, parameter :: pi = MAPL_PI - - - -! -! !DESCRIPTION: -! -! {\tt MAML\_NucleationMod} provides a collection of methods to calculate -! binary and ternary nucleation rates. -! -! -! !REVISION HISTORY: -! -! 26Jan2012 A. Darmenov Initial version -- based on CESM-1.0.3 CAM/MAM -! modal_aero_newnuc module -! -! -!EOP -!------------------------------------------------------------------------- - - - interface MAML_Nucleation - module procedure MAML_NucleationHomogeneous - end interface MAML_Nucleation - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_NucleationHomogeneous --- -! -! !INTERFACE: - - subroutine MAML_NucleationHomogeneous(pressure, & - temperature, & - density_air, & - rh, & - f_cld, & - z, & - pblz, & - q_number, & - q_nh4, & - q_so4, & - q_h2so4, & - q_nh3, & - do_nh3, & - Dg, & - Dg_min, & - Dg_max, & - density_so4, & - mw_so4a, & - mw_nh4a, & - dq_h2so4_gasprod, & - dq_h2so4_aeruptk, & - dt) - - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, intent(inout) :: q_number ! number mixing ratios of the Aitken mode - real, intent(inout) :: q_nh4 ! mass mixing ratio of ammonium (NH4) in the Aitken mode - real, intent(inout) :: q_so4 ! mass mixing ratio of sulfate (SO4) in the Aitken mode - - real, intent(inout) :: q_h2so4 ! mass mixing ratio of sulfuric acid (H2SO4) - real, intent(inout) :: q_nh3 ! mass mixing ratio of ammonia (NH3) - - -! !INPUT PARAMETERS: - real, intent(in) :: pressure ! pressure at mid level, Pa - real, intent(in) :: temperature ! temperature at mid level, K - real, intent(in) :: density_air ! air density, kg m-3 - real, intent(in) :: rh ! relative humidity - real, intent(in) :: f_cld ! cloud fraction - real, intent(in) :: z ! mid-layer height above surface, m - real, intent(in) :: pblz ! PBL height, m - - real, intent(in) :: Dg ! mean diameter of Aitken mode number size distribution - real, intent(in) :: Dg_min ! low limit of the mean diameter - real, intent(in) :: Dg_max ! upper limit of the mean diameter - - real, intent(in) :: density_so4 ! SO4 bulk density - real, intent(in) :: mw_so4a ! molecular weight of SO4 aerosol - real, intent(in) :: mw_nh4a ! molecular weight of NH4 aerosol - - - real, intent(in) :: dq_h2so4_gasprod ! H2SO4 gas-phase production change over dt (mol/mol) - real, intent(in) :: dq_h2so4_aeruptk ! H2SO4 gas-phase loss to aerosol over dt (mol/mol) - - real, intent(in) :: dt ! time step - - logical, intent(in) :: do_nh3 ! NH3 flag - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Homogeneous nucleation. -! -! !REVISION HISTORY: -! -! 03Jan2011 A. Darmenov First crack -- based on modal_aero_coag_sub(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_NucleationHomogeneous') - - - ! local variables - real(r8) :: P, T ! pressure and temperature at midlevels - real(r8) :: zm ! mid-level height - real(r8) :: pblh ! PBL height - - real(r8) :: d_dry_min, d_dry_max ! dry-diameter limits - real(r8) :: mass_1p, mass_1p_min, mass_1p_max ! single particle mass and mass limits - - real(r8) :: f ! lognormal size distribution factor - - real(r8) :: mw_so4a_host ! molecular weght of sulfate aerosol - - real :: cld ! cloud fraction in the interval [0, 1] - real :: rh_grid ! RH (grid average) - real(r8) :: rh_non_cld ! RH in the non cloudy area of the grid - - real(r8) :: dqdt ! tendency - - - real(r8) :: deltat ! time step - - real(r8) :: dplom_mode(1), dphim_mode(1) ! dry-diameter limits - - real(r8) :: q_h2so4_cur ! H2SO4 molar mixing ratio - real(r8) :: q_h2so4_avg ! estimated H2SO4, mol/mol-air - real(r8) :: q_nh3_cur ! NH3, mol/mol-air - - ! note: aerosol changes are > 0; gas changes are < 0 - real(r8) :: dq_numa ! change to aerosol number mixing ratio, #/mol-air - real(r8) :: dq_so4a ! change to aerosol SO4 mixing ratio, mol/mol-air - real(r8) :: dq_nh4a ! change to aerosol NH4 mixing ratio, mol/mol-air - real(r8) :: dq_h2so4 ! change to gas H2SO4 mixing ratio, mol/mol-air - real(r8) :: dq_nh3 ! change to gas NH3 mixing ratio, mol/mol-air - - real(r8) :: dens_nh4so4a ! dry-density of the new NH4-SO4 aerosol mass, kg m-3 - - real(r8) :: dndt_ait, dmdt_ait ! number and mass nucleation rates - - real(r8) :: dso4dt_ait ! - real(r8) :: dnh4dt_ait ! - real(r8) :: dqdt_numait, dqdt_nh4ait, dqdt_so4ait ! - real(r8) :: dqdt_h2so4, dqdt_nh3 ! - - real(r8) :: tmp_a, tmp_b, tmp_c, tmp_q2, tmp_q3, & ! temporary vars - tmp_uptake_rate, tmp_frso4 - - real(r8) :: dndt_aitsv1, dndt_aitsv2, dndt_aitsv3, & ! temporary values of the nucleation rates - dmdt_aitsv1, dmdt_aitsv2, dmdt_aitsv3 - - integer :: l_diag_veh02 ! diagnostics flag, -1 / +1 corresponds to disable / enable - - integer :: itmp ! size bin of newly formed particles - - - ! local parameters - real(r8), parameter :: q_h2so4_cutoff = 4.0e-16_r8 ! minimal H2SO4 vapor molar mixing ratio for nucleation = 4.0e-16 mol/mol-air, - ! which corresponds to approximatlelly 1.0e4 molecules/cm3 - - integer, parameter :: nuc_method_flag = 11 ! 1 = merikanto et al (2007) ternary - ! 2 = vehkamaki et al (2002) binary - ! 11 = merikanto ternary + first-order boundary layer - ! 12 = merikanto ternary + second-order boundary layer - - - dqdt = 0.0 - - ! dry-diameter limits for 'grown' new particles - d_dry_min = exp(0.67*log(Dg_min) + 0.33*log(Dg)) - d_dry_max = Dg_max - - - - ! mass_1p_[min|max] = mass (kg) of so4 & nh4 in a single particle of diameter min|max - ! (assuming same dry density for so4 & nh4) - ! mass1p_aitlo - dp = dplom_mode(1) - ! mass1p_aithi - dp = dphim_mode(1) - f = (pi/6.0) * density_so4 - mass_1p_min = f * (d_dry_min**3) - mass_1p_max = f * (d_dry_max**3) - - ! mw_so4a_host is molecular weght of sulfate aerosol in host code: - ! if NH3/NH4 are simulated mw_so4a_host is equal to 96, - ! - something else when NH3/NH4 are not simulated - mw_so4a_host = mw_so4a - - - - ! if completely cloudy all H2SO4 vapor should be cloud-borne - if (f_cld >= 0.99) & - return - - ! current H2SO4 mixing ratio (after aerosol uptake) - q_h2so4_cur = q_h2so4 - - ! skip if H2SO4 vapor mixing ratio is less than q_h2so4_cutoff - if (q_h2so4_cur <= q_h2so4_cutoff) & - return - - - tmp_a = max(0.0, dq_h2so4_gasprod) - tmp_q3 = q_h2so4_cur - - ! tmp_q2 = qh2so4 before aerosol uptake, note that both - ! tmp_q3 and tmp_q2 are greater or equal to 0 - tmp_q2 = tmp_q3 + max(0.0, -dq_h2so4_aeruptk) - - - ! tmp_b = log(tmp_q2 / tmp_q3) BUT with some checks added - ! tmp_uptake_rate = tmp_b/dt - if (tmp_q2 <= tmp_q3) then - tmp_b = 0.0 - else - tmp_c = tmp_q2 * exp(-20.0) - - if (tmp_q3 <= tmp_c) then - tmp_q3 = tmp_c - tmp_b = 20.0_r8 - else - tmp_b = log(tmp_q2/tmp_q3) - end if - end if - - ! d[ln(qh2so4)]/dt (1/s) from uptake (condensation) to aerosol - tmp_uptake_rate = tmp_b/dt - - ! q_h2so4_avg = estimated average q_h2so4 when production and loss are done simultaneously - if (tmp_b <= 0.1_r8) then - q_h2so4_avg = tmp_q3*(1.0_r8 + 0.5_r8*tmp_b) - 0.5_r8*tmp_a - else - tmp_c = tmp_a/tmp_b - q_h2so4_avg = ((tmp_q3 - tmp_c)*((exp(tmp_b) - 1.0_r8) / tmp_b)) + tmp_c - end if - - if (q_h2so4_avg <= q_h2so4_cutoff) & - return - - if (do_nh3) then - q_nh3_cur = max(0.0_r8, q_nh3) - else - q_nh3_cur = 0.0_r8 - end if - - - ! grid average RH - rh_grid = max(0.0, min(1.0, rh)) - - ! non-cloudy area RH - cld = max(0.0_r8, f_cld) - rh_non_cld = (rh_grid - cld) / (1.0 - cld) - rh_non_cld = max(0.0_r8, min(1.0_r8, rh_non_cld)) - - ! limit RH to between 0.1% and 99% - rh_non_cld = max(0.01, min(0.99, rh_non_cld)) - - - ! call ... routine to get nucleation rates - l_diag_veh02 = -1 ! diagnostics flag - - - ! double precission - T = temperature - P = pressure - zm = z - deltat = dt - - dplom_mode(1) = d_dry_min - dphim_mode(1) = d_dry_max - - call mer07_veh02_nuc_mosaic_1box(nuc_method_flag, & ! nucleation method - deltat, & ! time step, s - T, & ! temperature, K - rh_non_cld, & ! relative humidity, as fraction - P, & ! air pressure, Pa - zm, & ! - pblh, & ! - q_h2so4_cur, & ! gas h2so4 mixing ratios (mol/mol-air) -- current value (after gas chem and condensation) - q_h2so4_avg, & ! -- // -- -- estimated average value (for simultaneous source/sink calcs) - q_nh3_cur, & ! gas nh3 mixing ratios (mol/mol-air) -- current value - tmp_uptake_rate, & - mw_so4a_host, & - 1, & ! ?? nsize // number of aerosol size bins - 1, & ! ?? - dplom_mode, & ! dry diameter at lower bnd of bin (m) - dphim_mode, & ! dry diameter at upper bnd of bin (m) - itmp, & ! size bin into which new particles go - dq_numa, & ! change to aerosol number mixing ratio (#/mol-air) - dq_so4a, & ! change to aerosol so4 mixing ratio (mol/mol-air) -- aerosol changes are > 0 - dq_nh4a, & ! change to aerosol nh4 mixing ratio (mol/mol-air) - dq_h2so4, & ! change to gas h2so4 mixing ratio (mol/mol-air) -- gas changes are < 0 - dq_nh3, & ! change to gas nh3 mixing ratio (mol/mol-air) - dens_nh4so4a, & ! dry-density of the new nh4-so4 aerosol mass (kg/m3) - l_diag_veh02) ! diagnostics - - - ! convert dq_numa units from #/mol-air to #/kmol-air - dq_numa = dq_numa * 1.0e3_r8 - - ! number nucleation rate, #/kmol-air/s - dndt_ait = dq_numa/deltat - - ! fraction of mass nuc going to SO4 - tmp_a = dq_so4a * mw_so4a - tmp_b = tmp_a + dq_nh4a*mw_nh4a - tmp_frso4 = max(tmp_a, 1.0e-35_r8)/max(tmp_b, 1.0e-35_r8) - - ! mass nuc rate (kg/kmol-air/s or g/mol...) - dmdt_ait = max(0.0_r8, (tmp_b/deltat) ) - - dndt_aitsv1 = dndt_ait - dmdt_aitsv1 = dmdt_ait - dndt_aitsv2 = 0.0 - dmdt_aitsv2 = 0.0 - dndt_aitsv3 = 0.0 - dmdt_aitsv3 = 0.0 - - if (dndt_ait < 1.0e2) then - ! ignore newnuc if number rate < 100 #/kmol-air/s ~= 0.3 #/mg-air/d - dndt_ait = 0.0 - dmdt_ait = 0.0 - else - dndt_aitsv2 = dndt_ait - dmdt_aitsv2 = dmdt_ait - - - ! mirage2 code checked for complete H2SO4 depletion here, - ! but this is now done in mer07_veh02_nuc_mosaic_1box - mass_1p = dmdt_ait/dndt_ait - dndt_aitsv3 = dndt_ait - dmdt_aitsv3 = dmdt_ait - - ! apply particle size constraints - if (mass_1p < mass_1p_min) then - ! reduce dndt to increase new particle size - dndt_ait = dmdt_ait/mass_1p_min - else if (mass_1p > mass_1p_max) then - ! reduce dmdt to decrease new particle size - dmdt_ait = dndt_ait*mass_1p_max - end if - end if - - - ! set tendencies - - ! dso4dt_ait and dnh4dt_ait are in units kmol/kmol-air/s - dso4dt_ait = dmdt_ait*tmp_frso4/mw_so4a - dnh4dt_ait = dmdt_ait*(1.0_r8 - tmp_frso4)/mw_nh4a - - dqdt_h2so4 = -dso4dt_ait*(1.0 - cld) - q_h2so4 = q_h2so4 + dqdt_h2so4*deltat - - dqdt_so4ait = dso4dt_ait*(1.0 - cld) - q_so4 = q_so4 + dqdt_so4ait*deltat - - dqdt_numait = dndt_ait*(1.0 - cld) - q_number = q_number + dqdt_numait*deltat - - if (do_nh3 .and. (dnh4dt_ait > 0.0_r8)) then - dqdt_nh3 = -dnh4dt_ait*(1.0 - cld) - q_nh3 = q_nh3 + dqdt_nh3*deltat - - dqdt_nh4ait = dnh4dt_ait*(1.0 - cld) - q_nh4 = q_nh4 + dqdt_nh4ait*deltat - end if - - - return - - end subroutine MAML_NucleationHomogeneous - - - end module MAML_NucleationMod diff --git a/MAMchem_GridComp/MAML_OpticsMod.F90 b/MAMchem_GridComp/MAML_OpticsMod.F90 deleted file mode 100644 index a7bbe27d..00000000 --- a/MAMchem_GridComp/MAML_OpticsMod.F90 +++ /dev/null @@ -1,676 +0,0 @@ -#include "MAPL_Exceptions.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_OpticsMod--- aerosol optics. -! -! !INTERFACE: -! - - module MAML_OpticsMod - -! !USES: - - use ESMF - use MAPL - - use MAM_BaseMod - use MAM_ConstituentsDataMod - use MAM_ComponentsDataMod - - use MAML_OpticsTableMod, only: MAML_OpticsTable - - implicit none - - -! !PUBLIC TYPES: - - private - -! -! !PUBLIC MEMBER FUNCTIONS: -! - public MAML_OpticsInterpolate ! Computes aerosol optical properties - -! -! !GLOBAL PARAMETERS -! - - integer, parameter :: f = MAPL_R8 - -! -! !DESCRIPTION: -! -! This module computes aerosol optical properties. -! -! !REVISION HISTORY: -! -! 09May2013 Darmenov - Initial code. -! -!EOP -!------------------------------------------------------------------------- - -contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_OpticsCalculator --- Compute aerosol ext, sca, asy... -! -! !INTERFACE: -! - - subroutine MAML_OpticsInterpolate(mie_table, band, q, density, dgn_wet, delp, ext, sca, asy, nc, i1, i2, j1, j2, k1, k2, rc) - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - integer, intent(in) :: nc ! number of aerosol components - - integer, intent(in) :: i1, i2 ! upper and lower bounds of spatial dims - integer, intent(in) :: j1, j2 ! ... - integer, intent(in) :: k1, k2 ! ... - - type(MAML_OpticsTable), intent(in) :: mie_table - integer, intent(in) :: band ! band index - real, dimension(nc,i1:i2,j1:j2,k1:k2), intent(in) :: q ! mass mixing ratios of aerosol components (including absorbed water), 'kg kg-1' - real, dimension(nc), intent(in) :: density ! density of aerosol components, 'kg m-3' - real, dimension(i1:i2,j1:j2,k1:k2), intent(in) :: dgn_wet ! wet size of number size distribution - - real, dimension(i1:i2,j1:j2,k1:k2), intent(in) :: delp ! - -! !OUTPUT PARAMETERS: - real, dimension(i1:i2,j1:j2,k1:k2), intent(out) :: ext, sca, asy ! extinction, scattering and asymmetry parameter - integer, optional, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: -! Interpolates Mie lookup table and returns extinction, scattering and asymmetry parameter. -! NOTE: It is important that the q and density arrays follow the same order of components -! as the mie_table. -! -! !REVISION HISTORY: -! -! 09May2013 Darmenov API. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__("MAML_OpticsInterpolate") - - real(kind=f) :: Dgs_min, Dgs_max - real(kind=f) :: logDgs_min, logDgs_max, logDgs - real(kind=f) :: sigma, log_sigma - real(kind=f) :: n_re_min, n_re_max - real(kind=f) :: n_im_min, n_im_max - real(kind=f) :: q_max - - real(kind=f) :: vol, vol_ - real(kind=f) :: n_re_mix, n_im_mix, n_re_mix_, n_im_mix_ - - real(kind=f) :: x ! chebyshev polynomial parameter - real(kind=f) :: tt, uu ! bilinear interpolation and weights - real(kind=f) :: w00, w01, w10, w11 ! ... - - real(kind=f), allocatable, dimension(:) :: T - real(kind=f), allocatable, dimension(:) :: c_ext - real(kind=f), allocatable, dimension(:) :: c_sca - real(kind=f), allocatable, dimension(:) :: c_asy - - real(kind=f), allocatable, dimension(:) :: n_re - real(kind=f), allocatable, dimension(:) :: n_im - - real(kind=f), allocatable, dimension(:) :: component_n_re - real(kind=f), allocatable, dimension(:) :: component_n_im - real(kind=f), allocatable, dimension(:) :: q_ - - real(kind=f), allocatable, dimension(:,:,:) :: mie_c_ext - real(kind=f), allocatable, dimension(:,:,:) :: mie_c_sca - real(kind=f), allocatable, dimension(:,:,:) :: mie_c_asy - - integer :: n_ac ! number of aerosol components - - integer :: i_re, i_im ! indexes - - integer :: i, j, k, n ! loop counters - - integer :: size_im, size_re, size_n - - real(kind=f) :: factor ! multiplication factor - real(kind=f), parameter :: density_water = 1000.0_f ! kg m-3 - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - - ! basic dim-size check - _ASSERT(mie_table%n_aerosol_components == nc,'needs informative message') - - - ! short hand and likely to improve data storage - n_ac = mie_table%n_aerosol_components - Dgs_min = mie_table%Dgs_min - Dgs_max = mie_table%Dgs_max - sigma = mie_table%sigma - - allocate(component_n_re(n_ac), __STAT__) - allocate(component_n_im(n_ac), __STAT__) - allocate(q_(n_ac), __STAT__) - - allocate(n_re(mie_table%n_refractive_index_re), __STAT__) - allocate(n_im(mie_table%n_refractive_index_im), __STAT__) - - component_n_re = mie_table%component_refractive_index_re(band,:) - component_n_im = mie_table%component_refractive_index_im(band,:) - - n_re = mie_table%refractive_index_re(band, :) - n_im = mie_table%refractive_index_im(band, :) - - n_re_min = n_re(1) ! values are monotonically increasing - n_re_max = n_re(mie_table%n_refractive_index_re) - - n_im_min = n_im(1) ! values are monotonically increasing - n_im_max = n_im(mie_table%n_refractive_index_im) - - allocate( T(mie_table%n_cheb), __STAT__) - allocate(c_ext(mie_table%n_cheb), __STAT__) - allocate(c_sca(mie_table%n_cheb), __STAT__) - allocate(c_asy(mie_table%n_cheb), __STAT__) - - size_im = size(mie_table%c_ext,dim=2) - size_re = size(mie_table%c_ext,dim=3) - size_n = size(mie_table%c_ext,dim=4) - - allocate(mie_c_ext(size_n,size_im,size_re), __STAT__) - allocate(mie_c_sca(size_n,size_im,size_re), __STAT__) - allocate(mie_c_asy(size_n,size_im,size_re), __STAT__) - - do k = 1, size_re - do j = 1, size_im - do i = 1, size_n - mie_c_ext(i,j,k) = mie_table%c_ext(band,j,k,i) - mie_c_sca(i,j,k) = mie_table%c_sca(band,j,k,i) - mie_c_asy(i,j,k) = mie_table%c_asy(band,j,k,i) - end do - end do - end do - - logDgs_min = log(Dgs_min) - logDgs_max = log(Dgs_max) - log_sigma = log(sigma) - - ext = 0.0 - sca = 0.0 - asy = 0.0 - - do k = k1, k2 - do j = j1, j2 - do i = i1, i2 - - if (any(q(:,i,j,k) > 0.0)) then - ! normalize mass mixing ratios to avoid numerical issues - q_max = maxval(q(:,i,j,k)) - q_ = q(:,i,j,k) / q_max - vol = sum(q_/density) - - ! compute effective refractive index using volume mixing rule - n_re_mix = sum(component_n_re * q_/density) / vol - n_im_mix = sum(component_n_im * q_/density) / vol - - vol = q_max * vol - else - q_max = 0.0_f - vol = 0.0_f - n_re_mix = component_n_re(1) - n_im_mix = component_n_im(1) - end if - - - if (n_re_mix < n_re_min) then - n_re_mix = n_re_min + tiny(0.0) - end if - - if (n_re_mix > n_re_max) then - n_re_mix = n_re_max - tiny(0.0) - end if - - if (n_im_mix < n_im_min) then - n_im_mix = n_im_min + tiny(0.0) - end if - - if (n_im_mix > n_im_max) then - n_im_mix = n_im_max - tiny(0.0) - end if - - i_re = locate(n_re_mix, n_re, mie_table%n_refractive_index_re) - i_im = locate(n_im_mix, n_im, mie_table%n_refractive_index_im) - - if (i_re < 1 ) i_re = 1 - if (i_re > mie_table%n_refractive_index_re -1) i_re = mie_table%n_refractive_index_re -1 - if (i_im < 1 ) i_im = 1 - if (i_im > mie_table%n_refractive_index_im -1) i_im = mie_table%n_refractive_index_im -1 - - -! bilinear interpolation: notes -! t = (x - x1) / (x2 - x1) -! u = (y - y1) / (y2 - y1) -! -! w00 = (1.0_f - t) * (1.0_f - u), f00 = f1 -! w10 = ( t) * (1.0_f - u), f10 = f2 -! w01 = (1.0_f - t) * ( u), f01 = f4 -! w11 = ( t) * ( u), f11 = f3 -! -! bilinear_interpolation = (1.0_f - t) * (1.0_f - u) * f1 + & -! ( t) * (1.0_f - u) * f2 + & -! ( t) * ( u) * f3 + & -! (1.0_f - t) * ( u) * f4 -! -! bilinear_interpolation = w00*f00 + w10*f10 + w01*f01 + w11*f11 -! -! -! mapping: -! x -> re -! y -> im - - tt = ( n_re_mix - n_re(i_re)) / & - (n_re(i_re+1) - n_re(i_re)) - - uu = ( n_im_mix - n_im(i_im)) / & - (n_im(i_im+1) - n_im(i_im)) - - - _ASSERT(tt >= 0 .and. tt <= 1.0,'needs informative message') - _ASSERT(uu >= 0 .and. uu <= 1.0,'needs informative message') - - w00 = (1.0_f - tt) * (1.0_f - uu) ! weight for f(i_re+0, i_im+0) - w10 = ( tt) * (1.0_f - uu) ! weight for f(i_re+1, i_im+0) - w01 = (1.0_f - tt) * ( uu) ! weight for f(i_re+0, i_im+1) - w11 = ( tt) * ( uu) ! weight for f(i_re+1, i_im+1) - - T = 0.0_f - c_ext = 0.0_f - c_sca = 0.0_f - c_asy = 0.0_f - - do n = 1, mie_table%n_cheb - c_ext(n) = w00 * mie_c_ext(n, i_im , i_re ) + & - w10 * mie_c_ext(n, i_im , i_re+1) + & - w01 * mie_c_ext(n, i_im+1, i_re ) + & - w11 * mie_c_ext(n, i_im+1, i_re+1) - - c_sca(n) = w00 * mie_c_sca(n, i_im , i_re ) + & - w10 * mie_c_sca(n, i_im , i_re+1) + & - w01 * mie_c_sca(n, i_im+1, i_re ) + & - w11 * mie_c_sca(n, i_im+1, i_re+1) - - c_asy(n) = w00 * mie_c_asy(n, i_im , i_re ) + & - w10 * mie_c_asy(n, i_im , i_re+1) + & - w01 * mie_c_asy(n, i_im+1, i_re ) + & - w11 * mie_c_asy(n, i_im+1, i_re+1) - end do - - logDgs = log(dgn_wet(i,j,k)) + 2.0_f*log_sigma*log_sigma - x = (2.0_f*logDgs - logDgs_max - logDgs_min) / (logDgs_max - logDgs_min) - - if (x > 1.0_f) then - x = 1.0_f - tiny(0.0_f) - end if - - if (x < -1.0_f) then - x = -1.0_f + tiny(0.0_f) - end if - - - ! compute Chebyshev polynomials - T = cheb_poly(mie_table%n_cheb, x) - - ! extinction and scattering are unitless, i.e., AOT(i,j) = sum(ext(i,j,1:km) - factor = vol * density_water * delp(i,j,k) / MAPL_GRAV - - ext(i,j,k) = sum(c_ext * T) * factor - sca(i,j,k) = sum(c_sca * T) * factor - asy(i,j,k) = sum(c_asy * T) - - if (ext(i,j,k) < 0.0_f) then - ext(i,j,k) = tiny(0.0_f) - end if - - if (sca(i,j,k) > ext(i,j,k)) then - sca(i,j,k) = ext(i,j,k) - end if - - end do - end do - end do - - deallocate(component_n_re, component_n_im, __STAT__) - deallocate(n_re, n_im, q_, __STAT__) - deallocate(T, c_ext, c_sca, c_asy, __STAT__) - deallocate(mie_c_ext, mie_c_sca, mie_c_asy,__STAT__) - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAML_OpticsInterpolate - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_RefractiveIndex --- Computes refractive index of internaly mixed components. -! -! !INTERFACE: -! - - subroutine MAML_RefractiveIndex(q_mass, & - density, & - n_re, & - n_im, & - n_re_mix, & - n_im_mix, & - rc) - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - real, dimension(:), intent(in) :: q_mass ! mass mixing ratios of components, including absorbed water - real, dimension(:), intent(in) :: density ! densities of components - real, dimension(:), intent(in) :: n_re ! real part of refractive index - real, dimension(:), intent(in) :: n_im ! imaginary part of refractive index - - -! !OUTPUT PARAMETERS: - real, intent(out) :: n_re_mix ! real part of effective refractive index - real, intent(out) :: n_im_mix ! imaginary part of effective refractive index - integer, optional, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Computes refractive index of internally mixed components using -! volume mixing rule. -! -! -! !REVISION HISTORY: -! -! 08May2014 Darmenov API. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__("MAML_RefractiveIndex") - - ! local variables - real :: vol ! volume - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - - vol = sum(q_mass / density) - - n_re_mix = sum(n_re_mix * q_mass / density) / vol - n_im_mix = sum(n_im_mix * q_mass / density) / vol - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAML_RefractiveIndex - - - - -function locate(v, x, nx) - - ! - ! Returns the index of the largest element from the array x - ! that is smaller than v. - ! - ! Assumes that the array x is sorted in increasing order, - ! and that min(x) <= v <= max(x) - ! - - implicit none - - integer :: locate - - real(kind=f), intent(in) :: v - real(kind=f), dimension(nx), intent(in) :: x - integer, intent(in) :: nx - - ! local - integer i - - do i = 1, nx - if (x(i) > v) exit - end do - - locate = (i - 1) - - return -end function locate - - -function linear_interpolation(x1, x2, f1, f2, x) - - ! - ! Linear interpolation. - ! - - implicit none - - real(kind=f) :: linear_interpolation - - real(kind=f), intent(in) :: x1 - real(kind=f), intent(in) :: x2 - real(kind=f), intent(in) :: f1 - real(kind=f), intent(in) :: f2 - real(kind=f), intent(in) :: x - - linear_interpolation = f1 + ((x - x1) / (x2 - x1)) * (f2 - f1) -end function linear_interpolation - - -function bilinear_interpolation(x1, x2, y1, y2, f1, f2, f3, f4, x, y) - - ! - ! Bilinear interpolation. - ! - - implicit none - - real(kind=f) :: bilinear_interpolation - - real(kind=f), intent(in) :: x1 - real(kind=f), intent(in) :: x2 - real(kind=f), intent(in) :: y1 - real(kind=f), intent(in) :: y2 - real(kind=f), intent(in) :: f1 - real(kind=f), intent(in) :: f2 - real(kind=f), intent(in) :: f3 - real(kind=f), intent(in) :: f4 - real(kind=f), intent(in) :: x - real(kind=f), intent(in) :: y - - ! local - real(kind=f) :: t, u - - t = (x - x1) / (x2 - x1) - u = (y - y1) / (y2 - y1) - - bilinear_interpolation = (1.0_f - t) * (1.0_f - u) * f1 + & - ( t) * (1.0_f - u) * f2 + & - (1.0_f - t) * ( u) * f4 + & - ( t) * ( u) * f3 - -end function bilinear_interpolation - - -pure function cheb_poly(n, x) result(T) - - ! - ! Returns the value of the first n (where, n > 2) Chebyshev - ! polynomials. Note that the code is optimized for - ! n > 2, but no safety check are done to ensure this - ! that this condition is met! - ! - ! Uses requrrence equation: - ! T_n(x) = 2xT_(n-1)(x) - T_(n-2)(x) - ! T_(n=1)(x) = 1.0 - ! T_(n=2)(x) = x - ! - - implicit none - - real(kind=f), dimension(n) :: T - integer, intent(in) :: n - real(kind=f), intent(in) :: x - - ! local - integer :: k - real(kind=f) :: x2 - - x2 = 2.0_f * x - - T(1) = 1.0_f - T(2) = x - - do k = 3, n - T(k) = x2 * T(k-1) - T(k-2) - end do - - return -end function cheb_poly - - -subroutine lookup(lut_refractive_index_re, & - lut_refractive_index_im, & - lut_c_ext, & - lut_c_sca, & - lut_c_g, & - refractive_index_re, & - refractive_index_im, & - x, & - ext, & - sca, & - g, & - n_lut_re, & - n_lut_im, & - n_lut_cheb, & - n_lev, & - n_clm) - - ! - ! Returns - ! - - implicit none - - integer, intent(in) :: n_lut_re - integer, intent(in) :: n_lut_im - integer, intent(in) :: n_lut_cheb - - integer, intent(in) :: n_lev - integer, intent(in) :: n_clm - - real(kind=f), dimension(n_lut_re), intent(in) :: lut_refractive_index_re - real(kind=f), dimension(n_lut_im), intent(in) :: lut_refractive_index_im - - real(kind=f), dimension(n_lut_cheb, n_lut_re, n_lut_im), intent(in) :: lut_c_ext - real(kind=f), dimension(n_lut_cheb, n_lut_re, n_lut_im), intent(in) :: lut_c_sca - real(kind=f), dimension(n_lut_cheb, n_lut_re, n_lut_im), intent(in) :: lut_c_g - - real(kind=f), dimension(n_clm, n_lev), intent(in) :: refractive_index_re - real(kind=f), dimension(n_clm, n_lev), intent(in) :: refractive_index_im - real(kind=f), dimension(n_clm, n_lev), intent(in) :: x - - real(kind=f), dimension(n_clm, n_lev), intent(out) :: ext - real(kind=f), dimension(n_clm, n_lev), intent(out) :: sca - real(kind=f), dimension(n_clm, n_lev), intent(out) :: g - - - ! local - integer :: c, k, l - integer :: i_re - integer :: i_im - real(kind=f), dimension(n_lut_cheb) :: T - real(kind=f), dimension(n_lut_cheb) :: c_ext - real(kind=f), dimension(n_lut_cheb) :: c_sca - real(kind=f), dimension(n_lut_cheb) :: c_g - - -loop_levels: do l = 1, n_lev -loop_columns: do c = 1, n_clm - - ! initialize - T = 0.0_f - c_ext = 0.0_f - c_sca = 0.0_f - c_g = 0.0_f - - ! locate the indexes in refractive index plane - i_re = locate(refractive_index_re(c,l), lut_refractive_index_re, n_lut_re) - i_im = locate(refractive_index_im(c,l), lut_refractive_index_im, n_lut_im) - - ! interpolate in the refractive index plane - do k = 1, n_lut_cheb - c_ext(k) = bilinear_interpolation(lut_refractive_index_re(i_re), & - lut_refractive_index_re(i_re+1), & - lut_refractive_index_im(i_im), & - lut_refractive_index_im(i_im+1), & - lut_c_ext(k,i_re ,i_im ), & - lut_c_ext(k,i_re+1,i_im ), & - lut_c_ext(k,i_re+1,i_im+1), & - lut_c_ext(k,i_re ,i_im+1), & - refractive_index_re(c,l), & - refractive_index_im(c,l)) - - c_sca(k) = bilinear_interpolation(lut_refractive_index_re(i_re), & - lut_refractive_index_re(i_re+1), & - lut_refractive_index_im(i_im), & - lut_refractive_index_im(i_im+1), & - lut_c_sca(k,i_re ,i_im ), & - lut_c_sca(k,i_re+1,i_im ), & - lut_c_sca(k,i_re+1,i_im+1), & - lut_c_sca(k,i_re ,i_im+1), & - refractive_index_re(c,l), & - refractive_index_im(c,l)) - - c_g(k) = bilinear_interpolation(lut_refractive_index_re(i_re), & - lut_refractive_index_re(i_re+1), & - lut_refractive_index_im(i_im), & - lut_refractive_index_im(i_im+1), & - lut_c_g(k,i_re ,i_im ), & - lut_c_g(k,i_re+1,i_im ), & - lut_c_g(k,i_re+1,i_im+1), & - lut_c_g(k,i_re ,i_im+1), & - refractive_index_re(c,l), & - refractive_index_im(c,l)) - end do - - - ! compute Chebyshev polynomials - T = cheb_poly(n_lut_cheb, x(c,l)) - - ext(c,l) = sum(c_ext * T) - sca(c,l) = sum(c_sca * T) - g(c,l) = sum(c_g * T) - -end do loop_columns -end do loop_levels - -end subroutine lookup - -end module MAML_OpticsMod diff --git a/MAMchem_GridComp/MAML_OpticsTableMod.F90 b/MAMchem_GridComp/MAML_OpticsTableMod.F90 deleted file mode 100644 index 40177c30..00000000 --- a/MAMchem_GridComp/MAML_OpticsTableMod.F90 +++ /dev/null @@ -1,589 +0,0 @@ -#include "MAPL_Exceptions.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_OpticsTableMod --- Reader for aerosol optical properties -! lookup tables. -! -! !INTERFACE: -! - - module MAML_OpticsTableMod - -! !USES: - - use ESMF - use MAPL - use m_die, only: die, warn - - use netcdf - - implicit none - -! !PUBLIC TYPES: - - private - - public MAML_OpticsTable ! Holds Optics Lookup Tables - -! -! !PUBLIC MEMBER FUNCTIONS: -! - public MAML_OpticsTableCreate ! Constructor - create a new optics table - public MAML_OpticsTableDestroy ! Destructor - release resources associated with an optics table - public MAML_OpticsTableRead ! Read optics table from a file - -! -! !DESCRIPTION: -! -! This module reads optics/mie aerosol tables. -! -! !REVISION HISTORY: -! -! 01Apr2013 Darmenov - Initial code based on Chem_MieTableMod. -! -!EOP -!------------------------------------------------------------------------- - -! Optics/Mie LUT table -! Will be reduced from input files to the desired channels -! -------- - type MAML_OpticsTable - character(len=1024):: file ! lookup table file - - ! mode properties - logical :: monochromatic ! flag that indicates monochromatic or band-averaged quantities - - real :: Dgs_min ! diameter of surface distribution - lower bound - real :: Dgs_max ! diameter of surface distribution - upper bound - real :: sigma ! geometric standard deviation of lognormal size distribution - real :: rh_deliq ! RH deliquescence point - real :: rh_cryst ! RH crystallization point - integer :: n_aerosol_components ! number of aerosol components - character(len=80), pointer & - :: component(:) => null() ! aerosol components - real, pointer :: component_refractive_index_re(:,:) ! real part of aerosol component refractive index - real, pointer :: component_refractive_index_im(:,:) ! imaginary part of aerosol component refractive index - - ! mie - integer :: n_cheb ! number of terms used in truncated Chebyshev series expansion - integer :: n_bands ! number of monochromatic (narrow-band) or heterochromatic (wideband) bands - integer :: n_refractive_index_re ! number of refractive indexes - real part - integer :: n_refractive_index_im ! number of refractive indexes - imaginary part - - real, pointer :: wavelength(:,:) => null() ! band range, lower- and upper-bound wavelengths - real, pointer :: refractive_index_re(:,:) => null() ! real part of refractive index - real, pointer :: refractive_index_im(:,:) => null() ! imaginary part of refractive index - real, pointer :: c_ext(:,:,:,:) => null() ! chebyshev polynomial coefficients of specific extinction - real, pointer :: c_sca(:,:,:,:) => null() ! chebyshev polynomial coefficients of specific scattering - real, pointer :: c_asy(:,:,:,:) => null() ! chebyshev polynomial coefficients of asymmetry parameter - -! TODO... -! integer :: n_mom ! number of moments of phase function -! integer :: n_pol ! number of elements of scattering phase matrix -! real, pointer :: pback(:,:,:,:) => null() ! backscatter phase function -! real, pointer :: pmom(:,:,:,:,:) => null() ! moments of phase function - end type MAML_OpticsTable - - -contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_OpticsTableCreate --- Construct Chemistry Registry -! -! !INTERFACE: -! - - function MAML_OpticsTableCreate(file, rc) result (this) - - implicit none - - type(MAML_OpticsTable) :: this - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - character(len=*), intent(in) :: file - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: -! -! -! !REVISION HISTORY: -! -! 01Apr2013 Darmenov API. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__("Chem_MieTableCreate") - - type(MAML_OpticsTable) :: lut - - lut%file = trim(file) - - lut%monochromatic = .false. - - lut%Dgs_min = -1.0 - lut%Dgs_max = -1.0 - lut%sigma = -1.0 - lut%rh_deliq = -1.0 - lut%rh_cryst = -1.0 - - lut%n_aerosol_components = -1 - - lut%n_cheb = -1 - lut%n_bands = -1 - - lut%n_refractive_index_re = -1 - lut%n_refractive_index_im = -1 - -! lut%n_mom = -1 -! lut%n_pol = -1 - - this = lut - - RETURN_(ESMF_SUCCESS) - - end function MAML_OpticsTableCreate - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_OpticsTableDestroy --- Release resources associated with the table -! -! !INTERFACE: -! - subroutine MAML_OpticsTableDestroy(this, rc) - -! !USES: - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - - type(MAML_OpticsTable), intent(inout) :: this - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: Destructor for MAML_OpticsTable object. -! -! !REVISION HISTORY: -! -! 01Apr2013 Darmenov API. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__("MAML_OpticsTableDestroy") - - -! Set these to invalid values -! --------------------------- - this%file = '' - - this%monochromatic = .false. - this%Dgs_min = -1.0 - this%Dgs_max = -1.0 - this%sigma = -1.0 - this%rh_deliq = -1.0 - this%rh_cryst = -1.0 - this%n_aerosol_components = -1 - this%n_cheb = -1 - this%n_bands = -1 - this%n_refractive_index_re = -1 - this%n_refractive_index_im = -1 - -! this%n_mom = -1 -! this%n_pol = -1 - -! Deallocate whatever has been allocated -! -------------------------------------- - if (associated(this%component)) & - deallocate(this%component, __STAT__) - - if (associated(this%component_refractive_index_re)) & - deallocate(this%component_refractive_index_re, __STAT__) - - if (associated(this%component_refractive_index_im)) & - deallocate(this%component_refractive_index_im, __STAT__) - - if (associated(this%refractive_index_re)) & - deallocate(this%refractive_index_re, __STAT__) - - if (associated(this%refractive_index_im)) & - deallocate(this%refractive_index_im, __STAT__) - - if (associated(this%wavelength)) & - deallocate(this%wavelength, __STAT__) - - if (associated(this%c_ext)) & - deallocate(this%c_ext, __STAT__) - - if (associated(this%c_sca)) & - deallocate(this%c_sca, __STAT__) - - if (associated(this%c_asy)) & - deallocate(this%c_asy, __STAT__) - - -! if (associated(this%bbck)) deallocate(this%bbck, __STAT__) -! if (associated(this%pmom)) deallocate(this%pmom, __STAT__) - -! All done -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAML_OpticsTableDestroy - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_OpticsTableRead --- Read and fill in the Optics/Mie table -! -! !INTERFACE: -! - subroutine MAML_OpticsTableRead(this, rc) - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - type(MAML_OpticsTable), intent(inout) :: this - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! return code - - -! !DESCRIPTION: Fills in the Optics/Mie table -! -! !REVISION HISTORY: -! -! 01Mar2013 Darmenov API. -! -!EOP -!------------------------------------------------------------------------- - - integer :: id_nc, id_dim, id_var ! IDs for NetCDF objects - - integer :: id_dim_band, len_dim_band ! length of the wavelength dimension - integer :: id_dim_range, len_dim_range ! length of the range dimension - integer :: id_dim_component, len_dim_component ! length of the aerosol components dimension - integer :: id_dim_chars, len_dim_chars ! length of the characters dimension - integer :: id_dim_n_re, len_dim_n_re ! length of the real part of refractive index dimension - integer :: id_dim_n_im, len_dim_n_im ! length of the imaginary part of refractive index dimension - integer :: id_dim_k, len_dim_k ! length of the truncated Chebyshev series dimension - - integer, dimension(nf90_max_var_dims) :: var_dim_ids - integer, dimension(nf90_max_var_dims) :: var_dim_len - integer :: dim_len - integer :: n_dims - - character(len=80) :: buff_str - - __Iam__("MAML_OpticsTableRead") - -! Open the lookup table file -! -------------------------- - rc = nf90_open(trim(this%file), NF90_NOWRITE, id_nc); VERIFY_(rc) - -! Read ID and size of dimensions -! ------------------------------- - call get_dim_info_(id_nc, 'band', id_dim_band, len_dim_band, __RC__) - call get_dim_info_(id_nc, 'range', id_dim_range, len_dim_range, __RC__) - call get_dim_info_(id_nc, 'nchars', id_dim_chars, len_dim_chars, __RC__) - call get_dim_info_(id_nc, 'component', id_dim_component, len_dim_component, __RC__) - call get_dim_info_(id_nc, 'n_re', id_dim_n_re, len_dim_n_re, __RC__) - call get_dim_info_(id_nc, 'n_im', id_dim_n_im, len_dim_n_im, __RC__) - call get_dim_info_(id_nc, 'k', id_dim_k, len_dim_k, __RC__) - - _ASSERT(len_dim_range == 2,'needs informative message') - - this%n_bands = len_dim_band - this%n_aerosol_components = len_dim_component - this%n_cheb = len_dim_k - this%n_refractive_index_re = len_dim_n_re - this%n_refractive_index_im = len_dim_n_im - -! Read lookup table attributes -! ---------------------------- - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'aerosol_method', buff_str); VERIFY_(rc) - _ASSERT(buff_str == 'modal','needs informative message') - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'optics', buff_str); VERIFY_(rc) - _ASSERT(buff_str == 'monochromatic' .or. buff_str == 'band averaged','needs informative message') - if (buff_str == 'monochromatic') then - this%monochromatic = .true. - else - this%monochromatic = .false. - end if - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'Dgs_min', this%Dgs_min) - VERIFY_(rc) - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'Dgs_max', this%Dgs_max) - VERIFY_(rc) - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'mode_width', this%sigma) - VERIFY_(rc) - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'mode_deliq', this%rh_deliq) - VERIFY_(rc) - - rc = nf90_get_att(id_nc, NF90_GLOBAL, 'mode_cryst', this%rh_cryst) - VERIFY_(rc) - - -! Read data - aerosol components -! ----------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'component', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_chars .and. var_dim_ids(2) == id_dim_component,'needs informative message') - - allocate(this%component(len_dim_component), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%component); VERIFY_(rc) - - -! Read data - real part of aerosol component refractive index -! ----------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'component_n_re', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_band .and. var_dim_ids(2) == id_dim_component,'needs informative message') - - allocate(this%component_refractive_index_re(len_dim_band, len_dim_component), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%component_refractive_index_re); VERIFY_(rc) - - -! Read data - imaginary part of aerosol component refractive index -! ----------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'component_n_im', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_band .and. var_dim_ids(2) == id_dim_component,'needs informative message') - - allocate(this%component_refractive_index_im(len_dim_band, len_dim_component), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%component_refractive_index_im); VERIFY_(rc) - -! Read data - band range -! ---------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'wavelength', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_band .and. var_dim_ids(2) == id_dim_range,'needs informative message') - - allocate(this%wavelength(len_dim_band, len_dim_range), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%wavelength); VERIFY_(rc) - - if (this%monochromatic) then - _ASSERT(maxval(abs(this%wavelength(:,1) - this%wavelength(:,2))) < 1e2*tiny(0.0),'needs informative message') - end if - -! Read data - real part of refractive index -! ----------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'n_re', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_band .and. var_dim_ids(2) == id_dim_n_re,'needs informative message') - - allocate(this%refractive_index_re(len_dim_band, len_dim_n_re), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%refractive_index_re); VERIFY_(rc) - -! Read data - imaginary part of refractive index -! ---------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'n_im', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 2,'needs informative message') - _ASSERT(var_dim_ids(1) == id_dim_band .and. var_dim_ids(2) == id_dim_n_im,'needs informative message') - - allocate(this%refractive_index_im(len_dim_band, len_dim_n_im), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%refractive_index_im); VERIFY_(rc) - -! Read data - chebyshev polynomial coefficients of specific extinction -! -------------------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'c_ext', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 4,'needs informative message') - _ASSERT(all(var_dim_ids(:4) .eq. (/id_dim_band, id_dim_n_im, id_dim_n_re, id_dim_k/)),'needs informative message') - - allocate(this%c_ext(len_dim_band, len_dim_n_im, len_dim_n_re, len_dim_k), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%c_ext); VERIFY_(rc) - -! Read data - chebyshev polynomial coefficients of specific scattering -! -------------------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'c_sca', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 4,'needs informative message') - _ASSERT(all(var_dim_ids(:4) .eq. (/id_dim_band, id_dim_n_im, id_dim_n_re, id_dim_k/)),'needs informative message') - - allocate(this%c_sca(len_dim_band, len_dim_n_im, len_dim_n_re, len_dim_k), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%c_sca); VERIFY_(rc) - -! Read data - chebyshev polynomial coefficients of asymmetry parameter -! -------------------------------------------------------------------- - var_dim_ids = 0 - var_dim_len = 0 - - rc = nf90_inq_varid(id_nc, 'c_asy', id_var); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, ndims=n_dims); VERIFY_(rc) - rc = nf90_inquire_variable(id_nc, id_var, dimids=var_dim_ids(:n_dims)); VERIFY_(rc) - - _ASSERT(n_dims == 4,'needs informative message') - _ASSERT(all(var_dim_ids(:4) .eq. (/id_dim_band, id_dim_n_im, id_dim_n_re, id_dim_k/)),'needs informative message') - - allocate(this%c_asy(len_dim_band, len_dim_n_im, len_dim_n_re, len_dim_k), __STAT__) - rc = nf90_get_var(id_nc, id_var, this%c_asy); VERIFY_(rc) - - -! Get the backscatter phase function values -! TODO... - - -! Close the table file -! ------------------------------------- - rc = nf90_close(id_nc); VERIFY_(rc) - - - RETURN_(ESMF_SUCCESS) - - contains - - subroutine get_dim_info_(id_nc, dim_name, dim_id, dim_len, rc) - implicit none - - integer, intent(in) :: id_nc - character(len=*), intent(in) :: dim_name - integer, intent(out) :: dim_id - integer, intent(out) :: dim_len - integer, intent(out) :: rc - - rc = nf90_inq_dimid(id_nc, trim(dim_name), dim_id); VERIFY_(rc) - rc = nf90_inquire_dimension(id_nc, dim_id, len=dim_len); VERIFY_(rc) - - RETURN_(ESMF_SUCCESS) - end subroutine get_dim_info_ - - end subroutine MAML_OpticsTableRead - - - subroutine polint(x, y, n, xWant, yWant, yErr, myname) - - implicit none - - integer :: n - real(kind=8) :: x(n), y(n) - real :: xWant, yWant, yErr - character(len=*) :: myname - - ! given array x(n) of independent variables and array y(n) of dependent - ! variables, compute the linear interpolated result yWant at xWant and return - ! with a dummy error estimate yErr. Hacked up from Numerical Recipes Chapter 3 - - integer :: i, j - real :: dx, slope - character(len=255) :: msg - - ! on out of bounds, set i to lower or upper limit - i = 0 - if(xWant < x(1)) then - write(msg,*) "in polint, wanted: ", xWant, ", got lower bound: ", x(1) - call warn(myname, msg) - i = 1 - endif - - if(xWant > x(n)) then - write(msg,*) "in polint, wanted: ", xWant, ", got upper bound: ", x(n) - call warn(myname, msg) - i = n - endif - - ! if i is still zero find i less than xWant - if(i == 0) then - do j = 1, n - if(xWant >= x(j)) i = j - enddo - endif - - ! slope - if(i == n) then - slope = 0.0 - else - slope = (y(i+1)-y(i)) / (x(i+1)-x(i)) - endif - - dx = xWant - x(i) - yWant = y(i) + slope*dx - - yErr = 0.0 - - return - end subroutine polint - - end module MAML_OpticsTableMod - diff --git a/MAMchem_GridComp/MAML_SettlingMod.F90 b/MAMchem_GridComp/MAML_SettlingMod.F90 deleted file mode 100644 index de04e7b6..00000000 --- a/MAMchem_GridComp/MAML_SettlingMod.F90 +++ /dev/null @@ -1,790 +0,0 @@ -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_SettlingMod - Gravitational sedimentation/settling of aerosol -! particles -! -! !INTERFACE: -! - module MAML_SettlingMod -! -! !USES: -! - use MAPL - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_SettlingVelocity - public MAML_Settling - - public dynamic_viscosity_air - public kinematic_viscosity_air - public free_mean_path_air - public knudsen_number - public slip_flow_correction - public particle_diffusion_coefficient - public stokes_settling_velocity - - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - real, private, parameter :: pi = MAPL_PI - - real, private, parameter :: R_univ = MAPL_RUNIV ! Universal gas constant, 'J K-1 Kmole-1' - real, private, parameter :: N_avog = MAPL_AVOGAD ! Avogadro constant, 'Kmole-1' - real, private, parameter :: k_B = R_univ/N_avog ! Boltzmann's constant, 'J K-1' - real, private, parameter :: MW_air = MAPL_AIRMW ! molecular weight of air, 'kg Kmole-1' - real, private, parameter :: g_E = MAPL_GRAV ! standard gravity, 'm s-2' - -! -! !DESCRIPTION: -! -! {\tt MAML\_SettlingMod} provides a collection of methods for -! modeling graviational sedimentation/settling of aerosol particles -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - interface MAML_SettlingVelocity - module procedure MAML_SettlingVelocityMonodisperseAerosol - module procedure MAML_SettlingVelocityPolydisperseAerosol - end interface MAML_SettlingVelocity - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: dynamic_viscosity_air --- -! -! !INTERFACE: - - function dynamic_viscosity_air(T) result (viscosity) -! !USES: - - implicit None - - real :: viscosity ! dynamic viscosity air, 'kg m-1 s-1' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: T ! temperature, 'K' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the dynamic viscosity of air, following -! Sutherland's equation (List, 1984) -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - viscosity = 1.8325e-5 * (416.16 / (T + 120)) * (T/296.16)**1.5 - - end function dynamic_viscosity_air - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: kinematic_viscosity_air --- -! -! !INTERFACE: - - function kinematic_viscosity_air(T, density_air) result (viscosity) -! !USES: - - implicit None - - real :: viscosity ! kinematic viscosity air, 'm2 s-1' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: T ! temperature, 'K' - real, intent(in) :: density_air ! density of air, 'kg m-3' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the kinematic viscosity of air. -! -! !REVISION HISTORY: -! -! 12Dec2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - viscosity = dynamic_viscosity_air(T) / density_air - - end function kinematic_viscosity_air - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: free_mean_path_gas --- -! -! !INTERFACE: - - function free_mean_path_gas(p, T, v, mw) result (path) -! !USES: - - implicit None - - real :: path ! free mean path of gas, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: p ! pressure, 'Pa' - real, intent(in) :: T ! temperature, 'K' - real, intent(in) :: v ! viscosity, 'kg m-1 s-1' - real, intent(in) :: mw ! molecular weight, 'kg Kmole-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the free mean path of a pure gas, following -! Seinfeld and Pandis, equation 8.6 -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - path = 2 * v / (p * (8/pi * mw/(R_univ*T))**0.5) - - end function free_mean_path_gas - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: free_mean_path_gas --- -! -! !INTERFACE: - - function free_mean_path_air(p, T) result (path) -! !USES: - - implicit None - - real :: path ! free mean path of air, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: p ! pressure, 'Pa' - real, intent(in) :: T ! temperature, 'K' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the free mean path of air molecules -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - real :: v_air ! viscosity, 'kg m-1 s-1' - - v_air = dynamic_viscosity_air(T) - path = free_mean_path_gas(p, T, v_air, MW_air) - - end function free_mean_path_air - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: knudsen_number --- -! -! !INTERFACE: - - function knudsen_number(free_mean_path, diameter) result (Kn) -! !USES: - - implicit None - - real :: Kn ! free mean path of air, 'm' - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: free_mean_path ! free mean path, 'm' - real, intent(in) :: diameter ! diameter, 'm' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the Knudsen number -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - Kn = 2 * free_mean_path / diameter - - end function knudsen_number - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: slip_flow_correction --- -! -! !INTERFACE: - - function slip_flow_correction(Kn) result (Cc) -! !USES: - - implicit None - - real :: Cc ! Cunningham slip-flow correction - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: Kn ! Knudsen number - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the Cunningham slip-flow correction -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - ! following Seinfeld and Pandis, equation 8.34 / Allen and Raabe (1982) - real, parameter :: A = 1.257 - real, parameter :: B = 0.4 - real, parameter :: C = 1.1 - - Cc = 1 + Kn*(A + B*exp(-C/Kn)) - - end function slip_flow_correction - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: slip_flow_correction_ --- -! -! !INTERFACE: - - function slip_flow_correction_(Kn, linearized) result (Cc) -! !USES: - - implicit None - - real :: Cc ! Cunningham slip-flow correction - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: Kn ! Knudsen number - logical, optional, intent(in) :: linearized ! linearized formulation (default = false) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the Cunningham slip-flow correction -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - logical :: linearized_form - - ! following Seinfeld and Pandis, equation 8.34 / Allen and Raabe (1982) - real, parameter :: A = 1.257 - real, parameter :: B = 0.4 - real, parameter :: C = 1.1 - - ! linearized form following Binkowski and Shankar (equation A27, 1995) - real, parameter :: A_lf = 1.246 - - - if (present(linearized)) then - linearized_form = linearized - else - linearized_form = .false. - end if - - if (linearized_form) then - Cc = 1 + Kn*A_lf - else - Cc = 1 + Kn*(A + B*exp(-C/Kn)) - end if - - end function slip_flow_correction_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: particle_diffusion_coefficient --- -! -! !INTERFACE: - - function particle_diffusion_coefficient(temperature, & - viscosity_air, & - Cc, & - diameter) result (Dp) -! !USES: - - implicit None - - real :: Dp - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: temperature ! temperature, 'K' - real, intent(in) :: viscosity_air ! dynamic viscosity of air, 'kg m-1 s-1' - - real, intent(in) :: diameter ! particle diameter, 'm' - - real, intent(in) :: Cc ! slip-flow correction factor - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the Brownian particle diffusivity. -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - Dp = (k_B * temperature / (3 * pi * viscosity_air * diameter)) * Cc - - end function particle_diffusion_coefficient - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: particle_diffusion_coefficient --- -! -! !INTERFACE: - - function stokes_settling_velocity(viscosity_air, & - diameter, & - density) result (v_s) -! !USES: - - implicit None - - real :: v_s - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: viscosity_air ! dynamic viscosity of air, 'kg m-1 s-1' - - real, intent(in) :: diameter ! particle diameter, 'm' - real, intent(in) :: density ! particle density, 'm' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the Stokes velocity. -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - v_s = (g_E / 18) * (density * diameter**2 / viscosity_air) - - end function stokes_settling_velocity - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_SettlingVelosityMonodisperseAerosol --- -! -! !INTERFACE: - - function MAML_SettlingVelocityMonodisperseAerosol(pressure, & - temperature, & - diameter, & - density) result (v_t) -! !USES: - - implicit None - - real :: v_t - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: pressure ! pressure, 'Pa' - real, intent(in) :: temperature ! temperature, 'K' - - real, intent(in) :: diameter ! particle diameter, 'm' - real, intent(in) :: density ! particle density, 'kg m-3' - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the terminal settling velocity of -! monodisperse spherical particles. -! (Reference: Seinfeld and Pandis, equation 8.42) -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - real :: viscosity ! viscosity of air, 'kg m-1 s-1' - real :: free_mean_path ! free mean path - real :: Kn ! Knudsen number - real :: Cc ! slip-flow correction - real :: v_s ! Stokes velocity - - - viscosity = dynamic_viscosity_air(temperature) - free_mean_path = free_mean_path_air(pressure, temperature) - - Kn = knudsen_number(free_mean_path, diameter) - - Cc = slip_flow_correction(Kn) - v_s = stokes_settling_velocity(viscosity, diameter, density) - - v_t = v_s * Cc - - end function MAML_SettlingVelocityMonodisperseAerosol - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_SettlingVelocityPolydisperseAerosol --- -! -! !INTERFACE: - - function MAML_SettlingVelocityPolydisperseAerosol(pressure, & - temperature, & - diameter, & - density, & - sigma, & - k) result (v_t) -! !USES: - - implicit None - - real :: v_t - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: pressure ! pressure, 'Pa' - real, intent(in) :: temperature ! temperature, 'K' - - real, intent(in) :: diameter ! geometric mean diameter, 'm' - real, intent(in) :: density ! particle density, 'kg m-3' - - real, intent(in) :: sigma ! geometric standard deviation - integer, intent(in) :: k ! k-th moment of the number size distribution - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the terminal settling velocity of -! polydisperse spherical particles. Note that the expression -! for monodisperse distribution settling velocity is recovered -! if the geometric standard deviatin is set to 1. -! References: Binkowski and Shankar, 1995; Tulet et al., 2005 -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - real :: viscosity ! dynamic viscosity of air, 'kg m-1 s-1' - real :: free_mean_path ! free mean path - real :: Kn ! Knudsen number - real :: Cc ! Cunningham-slip-flow correction term - real :: v_s ! Stokes terminal velocity - - real :: ln2_sigma ! log^2(sigma) - - ! linearized form of slip-flow correction following Binkowski and Shankar - ! (equation A27, 1995) - real, parameter :: A = 1.246 - - ln2_sigma = (log(sigma))**2 - - viscosity = dynamic_viscosity_air(temperature) - free_mean_path = free_mean_path_air(pressure, temperature) - - Kn = knudsen_number(free_mean_path, diameter) - - Cc = exp((2*k + 2) * ln2_sigma) + A * Kn * exp((k + 0.5) * ln2_sigma) - v_s = stokes_settling_velocity(viscosity, diameter, density) - - v_t = v_s * Cc - - end function MAML_SettlingVelocityPolydisperseAerosol - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_SettlingTendencySolver --- -! -! !INTERFACE: - - subroutine MAML_SettlingTendencySolver(dqdt, q, delp, dz, v_t) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), optional, intent(out) :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - -! !INPUT PARAMETERS: - - real, dimension(:), intent(in) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, dimension(:), intent(in) :: delp ! pressure thickness of levels, 'Pa' - real, dimension(:), intent(in) :: dz ! thickness of levels, 'm' - real, dimension(:), intent(in) :: v_t ! settling velocity, 'm s-1' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates mixing ratio tendency (dq/dt) due to -! gravitational sedimentation/settling. -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - integer :: k1, k2, km - - k1 = lbound(q, 1) - km = ubound(q, 1) - - k2 = k1 + 1 - dqdt = 0.0 - - ! zero flux in from top of the atmosphere (k=k1) - dqdt(k1) = 0.0 - q(k1) * v_t(k1) / dz(k1) - - ! levels k2:km --- flux in from the level above and flux out into the level below - dqdt(k2:km) = (q(k1:km-1) * (v_t(k1:km-1) / dz(k1:km-1))) * (delp(k1:km-1)/delp(k2:km)) - & - (q(k2:km ) * (v_t(k2:km ) / dz(k2:km ))) - - end subroutine MAML_SettlingTendencySolver - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_Settling --- -! -! !INTERFACE: - - subroutine MAML_Settling(q, delp, dz, v_t, dt, flux) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, dimension(:), intent(inout) :: q ! mixing ratio, 'kg kg-1' or '# kg-1' - real, optional, intent(inout) :: flux ! surface flux 'kg m-2 s-1' or '# m-2 s-1' - -! !INPUT PARAMETERS: - real, dimension(:), intent(in) :: delp ! pressure thickness of levels, 'Pa' - real, dimension(:), intent(in) :: dz ! thickness of levels, 'm' - real, dimension(:), intent(in) :: v_t ! settling velocity, 'm s-1' - real, intent(in) :: dt ! model time step, 's' - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the changes in the mixing ratio due to -! gravitational sedimentation/settling. -! -! !REVISION HISTORY: -! -! 6Nov2011 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_Settling') - - real, pointer, dimension(:) :: dqdt ! dq/dt - mixing ratio tendency due to - ! gravitational sedimentation - - real :: q_column_initial ! initial value of column integrated mixing ratio - real :: q_column_final ! final value of column integrated mixing ratio - - real :: dt_step, dt_cfl ! integration time step - integer :: n_steps ! number of time steps - - integer :: k1, km ! indexes - integer :: n ! loop counter - - integer :: rc ! return code - - - k1 = lbound(q, 1) - km = ubound(q, 1) - - allocate(dqdt(k1:km), __STAT__) - - ! If there is no time splitting, the flux is simply the settling flux out from the - ! surface layer, because of the mass conservation. Instead of integrating in time, - ! we calculate the flux as the difference in the column integrated mass before and - ! after the settling. - - q_column_initial = 0.0 - q_column_final = 0.0 - - if (present(flux)) then - q_column_initial = sum(q * delp/g_E) - end if - - ! test if the time step is sufficiently small to maintain numerical stability - dt_cfl = min(dt, minval(dz / v_t)) - - if (dt_cfl < dt) then - n_steps = ceiling(dt / dt_cfl) - else - n_steps = 1 - end if - - ! time integration - dt_step = dt / n_steps - - do n = 1, n_steps - dqdt = 0.0 - - ! NOTE: In case of polydisperse aerosols, it would be more correct - ! to update the settling velocities in the innner time loop. - call MAML_SettlingTendencySolver(dqdt, q, delp, dz, v_t) - - q = q + (dqdt * dt_step) - end do - - ! calculate the flux due to settling - if (present(flux)) then - q_column_final = sum(q * delp/g_E) - - flux = -(q_column_final - q_column_initial) / dt - end if - - deallocate(dqdt, __STAT__) - - end subroutine MAML_Settling - - - end module MAML_SettlingMod - diff --git a/MAMchem_GridComp/MAML_SizeMod.F90 b/MAMchem_GridComp/MAML_SizeMod.F90 deleted file mode 100644 index 04f305ed..00000000 --- a/MAMchem_GridComp/MAML_SizeMod.F90 +++ /dev/null @@ -1,366 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_SizeMod - methods for calculation of dry and wet sizes. -! -! !INTERFACE: -! - module MAML_SizeMod -! -! !USES: -! - - use MAPL - use MAPL_ConstantsMod, only : MAPL_PI, MAPL_RHOWTR, r8 => MAPL_R8 - - use modal_aero_wateruptake, only : modal_aero_kohler - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_DrySize - public MAML_WetSize - - -! !PRIVATE PARAMETERS - real, private, parameter :: pi = MAPL_PI - real, private, parameter :: density_water = MAPL_RHOWTR ! density of water, 'kg m-3' - - -! -! !DESCRIPTION: -! -! {\tt MAML\_SizeMod} provides a collection of methods to calculate -! dry and wet size of aerosol particles. -! -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_DrySize --- -! -! !INTERFACE: - - function MAML_DrySize(q_number, & - q_mass, & - density, & - sigma, & - Dg_default, & - Dg_min, & - Dg_max, & - vol2num_default, & - vol2num_min, & - vol2num_max) result (Dg_num) -! !USES: - - implicit NONE - - real :: Dg_num - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - - real, intent(in) :: q_number ! number mixing ratio - real, dimension(:), intent(in) :: q_mass ! mass mixing ratio of all components - real, dimension(:), intent(in) :: density ! bulk density of all components - real, intent(in) :: sigma ! geometric standard deviation - - real, intent(in) :: Dg_default ! default geometric mean number of number size distribution - real, intent(in) :: Dg_min ! minimum geometric mean number of number size distribution - real, intent(in) :: Dg_max ! maximum geometric mean number of number size distribution - - real, intent(in) :: vol2num_default ! default volume to number ratio - real, intent(in) :: vol2num_min ! minimum volume to number ratio - real, intent(in) :: vol2num_max ! maximum volume to number ratio - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the geometric mean diameter of number size distribution. -! -! !REVISION HISTORY: -! -! 17Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAML_DrySize') - - ! local variables - real :: vol ! volume - real :: num ! number mixing ratio - real :: vol2num ! mass mixing ratio - real :: Dg ! geometric mean diameter - - real :: f ! factor - - ! set the default values - Dg = Dg_default - vol2num = vol2num_default - - ! compute volume mixing ratio - vol = sum(q_mass/density) - - if (vol > 0) then - num = max(0.0, q_number) - - if (num <= vol*vol2num_max) then - Dg = Dg_max - vol2num = vol2num_max - else if (num >= vol*vol2num_min) then - Dg = Dg_min - vol2num = vol2num_min - else - ! lognormal size distribution factor - f = (pi / 6) * exp(4.5 * log(sigma)**2) - - Dg = (vol / (f * num))**(1/3.) - vol2num = num / vol - end if - end if - - Dg_num = Dg - - end function MAML_DrySize - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_WetSize --- -! -! !INTERFACE: - - subroutine MAML_WetSize(q_mass, & - Dg_dry, & - density, & - hygroscopicity, & - sigma, & - rh_deliquescence, & - rh_crystallization, & - rh, & - f_cld, & - Dg_wet, & - density_wet, & - q_aerosol_water) -! !USES: - - implicit NONE - - -! !INPUT/OUTPUT PARAMETERS: - real, intent(inout) :: Dg_wet ! aerosol wet size, 'm' - real, intent(inout) :: density_wet ! aerosol wet density, 'kg m-3' - real, intent(inout) :: q_aerosol_water ! mass mixing ratio of absorbed - ! by aerosol water, 'kg kg-1' - -! !INPUT PARAMETERS: - - real, dimension(:), intent(in) :: q_mass ! mass mixing ratio of all components - real, dimension(:), intent(in) :: density ! bulk density of all components - real, dimension(:), intent(in) :: hygroscopicity ! hygroscopicity of all components - real, intent(in) :: sigma ! geometric standard deviation - - real, intent(in) :: Dg_dry ! Dry size -- geometric mean diameter of number size distribution - - real, intent(in) :: rh_deliquescence ! deliquescence RH point - real, intent(in) :: rh_crystallization ! crystallization RH point - - real, intent(in) :: rh ! relative humidity - real, intent(in) :: f_cld ! cloud fraction - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates wet size and density of aerosol particles. -! -! !REVISION HISTORY: -! -! 12Dec2011 A. Darmenov First crack -- based on modal_aero_wateruptake_sub(), -! from CESM-1.0.3 -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_WetSize') - - - real, allocatable, dimension(:) :: q_vol_dry ! dry volume mixing ratios - - real :: vol_dry ! total dry volume (mixing ratio) - real :: mass_dry ! total dry mass (mixing ratio) - real :: number_dry ! total number of particles - real :: density_dry ! dry density - - real :: f ! lognormal size distribution factor - real :: vol2num ! volume to number ratio - real :: Dg ! geometric mean diameter - - real :: f_hysteresis ! hysteresis factor - - real :: particle_number_dry ! one particle, that is equal to 1 - real :: particle_hygroscopicity ! - volume average hygroscopicity - real :: particle_vol_dry ! - dry volume - real :: particle_mass_dry ! - dry mass - real :: particle_radius_dry ! - dry radius - real :: particle_vol_wet ! - wet volume - real :: particle_radius_wet ! - wet radius - real :: particle_vol_water ! - volume of aerosol water - - - real :: rh_clr - - real(r8) :: rh_(1) - real(r8) :: particle_radius_dry_(1) - real(r8) :: particle_hygroscopicity_(1) - real(r8) :: particle_radius_wet_(1) - - integer :: n_species - integer :: rc ! return code - - real, parameter :: VMR_DRY_MIN = 1e-30 ! minimum volume mixing ratio - real, parameter :: MMR_DRY_MIN = 1e-31 ! minimum mass mixing ratio - - real, parameter :: pi_43 = (4/3.0) * pi - - real, parameter :: third = (1/3.0) - - - - ! clear portion RH - rh_clr = rh - rh_clr = max(rh_clr, 0.00) - rh_clr = min(rh_clr, 0.98) - - if (f_cld < 1.0) then - rh_clr = (rh_clr - 1.0*f_cld) / (1 - f_cld) - end if - - rh_clr = max(rh_clr, 0.00) - - - n_species = size(q_mass) - allocate(q_vol_dry(n_species), __STAT__) - - ! volume average hygroscopicity - q_vol_dry = max(0.0, q_mass/density) - vol_dry = sum(q_vol_dry) ! the total dry volume - - if (vol_dry > VMR_DRY_MIN) then - particle_hygroscopicity = sum(hygroscopicity * q_vol_dry) / vol_dry - else - particle_hygroscopicity = sum(hygroscopicity) / size(hygroscopicity) - end if - - deallocate(q_vol_dry, __STAT__) - - ! (volume) average density - mass_dry = sum(max(0.0, q_mass)) - - if (mass_dry > 1e-31) then - density_dry = mass_dry / vol_dry - else - density_dry = sum(density) / size(density) - end if - - - ! dry volume to number factor - f = (pi / 6) * exp(4.5 * (log(sigma))**2) - vol2num = 1 / (f * Dg_dry**3) - - number_dry = vol2num * vol_dry ! why not pass the number mixing ratio as an input argument? - ! besides, there might be inconsistencies introduced by - ! using max()/min() range tests - - - ! mean (single particle) dry volume and mass - particle_number_dry = 1.0 - particle_vol_dry = particle_number_dry / vol2num - particle_mass_dry = density_dry * particle_vol_dry - particle_radius_dry = (particle_vol_dry / pi_43)**third - - ! compute the wet radius - rh_(1) = rh_clr - particle_radius_dry_(1) = particle_radius_dry - particle_hygroscopicity_(1) = particle_hygroscopicity - - call modal_aero_kohler(particle_radius_dry_, & - particle_hygroscopicity_, & - rh_, & - particle_radius_wet_, 1, 1) - - particle_radius_wet = particle_radius_wet_(1) - - particle_radius_wet = max(particle_radius_wet, particle_radius_dry) - - ! swell the particle by applying the ratio of wet to dry size - Dg_wet = Dg_dry * (particle_radius_wet / particle_radius_dry) - - ! aerosol water volume and mass - particle_vol_wet = pi_43 * particle_radius_wet**3 - particle_vol_wet = max(particle_vol_wet, particle_vol_dry) - - particle_vol_water = particle_vol_wet - particle_vol_dry - particle_vol_water = max(0.0, particle_vol_water) - - - ! Simple treatment of deliquesence/crystallization hysteresis -- - ! for rhcrystal < rh < rhdeliques, aerosol water is a fraction of the - ! "upper curve" value, and the fraction is a linear function of RH - - if (rh_clr < rh_crystallization) then - particle_radius_wet = particle_radius_dry - particle_vol_wet = particle_vol_dry - particle_vol_water = 0.0 - else if (rh_clr < rh_deliquescence) then - f_hysteresis = 1.0 / max(1.0e-5, (rh_deliquescence - rh_crystallization)) - - particle_vol_water = f_hysteresis * (rh_clr - rh_crystallization) * particle_vol_water - particle_vol_water = max(0.0, particle_vol_water) - - particle_vol_wet = particle_vol_dry + particle_vol_water - particle_radius_wet = (particle_vol_wet / pi_43)**third - end if - - - ! water absorbed by the aerosols - q_aerosol_water = density_water * number_dry * particle_vol_water - - - ! aerosol wet density (kg/m3) - if (particle_vol_wet > VMR_DRY_MIN) then - density_wet = (particle_mass_dry + (density_water * particle_vol_water))/particle_vol_wet - else - density_wet = density_dry - end if - - end subroutine MAML_WetSize - - - end module MAML_SizeMod diff --git a/MAMchem_GridComp/MAML_WetRemovalMod.F90 b/MAMchem_GridComp/MAML_WetRemovalMod.F90 deleted file mode 100644 index 352ed3e6..00000000 --- a/MAMchem_GridComp/MAML_WetRemovalMod.F90 +++ /dev/null @@ -1,558 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAML_WetRemovalMod - Gravitational sedimentation/settling and dry -! deposition of aerosol particles and gases -! -! !INTERFACE: -! - module MAML_WetRemovalMod -! -! !USES: -! - use MAPL - - use WetRemovalMod, only: WetRemovalGOCART - - - implicit None - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAML_WetRemoval - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - real, private, parameter :: g_E = MAPL_GRAV ! standard gravity, 'm s-2' - -! -! !DESCRIPTION: -! -! {\tt MAML\_SettlingMod} provides a collection of methods for -! modeling graviational sedimentation/settling of aerosol particles -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAML_WetRemovalAerosol --- -! -! !INTERFACE: - - subroutine MAML_WetRemoval(qa, f_wet, aero_type, kin, ple, tmpu, rhoa, & - pfllsan, pfilsan, precc, precl, cdt, flux, rc) - -! !USES: - - implicit None - - -! !INPUT/OUTPUT PARAMETERS: - real, pointer, dimension(:,:,:), intent(inout) :: qa ! mixing ratio, 'kg kg-1' or '# kg-1' - real, pointer, dimension(:,:), intent(inout) :: flux ! wet removal flux, 'kg m-2 s-1' or '# m-2 s-1' - -! !INPUT PARAMETERS: - real, intent(in) :: f_wet ! large scale wet removal efficiency - character(len=*) :: aero_type ! aerosol type - logical, intent(in) :: kin ! true for aerosol - - real, pointer, dimension(:,:,:), intent(in) :: ple ! pressure at model layer edges, 'Pa' - real, pointer, dimension(:,:,:), intent(in) :: tmpu ! temperature - real, pointer, dimension(:,:,:), intent(in) :: rhoa - real, pointer, dimension(:,:,:), intent(in) :: pfllsan, pfilsan - real, pointer, dimension(:,:), intent(in) :: precc - real, pointer, dimension(:,:), intent(in) :: precl - real, intent(in) :: cdt ! time step, 's' - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! return code - - -! !DESCRIPTION: Based on WetRemovalGOCART() subroutine. -! -! !REVISION HISTORY: -! -! 10Dec2012 A. Darmenov -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAML_WetRemoval') - - - integer :: i1, i2, j1, j2, k1, km ! indexes - integer :: i, j, k, kk, n ! loop counters - - integer :: LH - - real :: F, B, BT ! temporary variables on cloud, freq. - real :: qmx, qd, A ! temporary variables on moisture - - real :: pls, pcv, pac ! ls, cv, tot precip [mm day-1] - real, dimension(:), allocatable :: qls, qcv ! ls, cv portion dqcond [kg m-3 s-1] - - real, dimension(:,:,:), allocatable :: pdog ! air mass factor dp/g [kg m-2] - real, dimension(:,:,:), allocatable :: delz ! box height dp/g/rhoa [m] - - real :: WASHFRAC, WASHFRAC_F_14 - real, allocatable :: fd(:,:) ! flux across layers [kg m-2] - real, allocatable :: dpfli(:,:,:) ! vertical gradient of LS ice+rain precip flux - real, allocatable :: DC(:) ! scavenge change in mass mixing ratio - real, allocatable :: c_h2o(:,:,:), cldliq(:,:,:), cldice(:,:,:) - - - real :: effRemoval - - integer, parameter :: nbins = 1 ! work with a single bin tracer - - real, parameter :: grav = g_E - - ! Rain parameters from Liu et al. - real, parameter :: B0_ls = 1.0e-4 - real, parameter :: F0_ls = 1.0 - real, parameter :: XL_ls = 5.0e-4 - real, parameter :: B0_cv = 1.5e-3 - real, parameter :: F0_cv = 0.3 - real, parameter :: XL_cv = 2.0e-3 - real, parameter :: k_wash = 1.d0 ! first order washout rate, constant, [cm^-1] - -! Duration of rain: ls = model timestep, cv = 1800 s (<= cdt) - real :: Td_ls - real, parameter :: Td_cv = 1800.0 - real(kind=8), parameter :: R = 8.2057d-2 ! universal gas constant [L*atm/moles/K] - real(kind=8), parameter :: INV_T0 = 1d0 / 298d0 - real(kind=8), parameter :: conv_NH3 = 5.69209978831d-1 ! 0.6*SQRT(0.9) for ice to gas ratio - real(kind=8) :: k_rain, Kstar298, H298_R, I2G, L2G, C_TOT, F_L, F_I - real(kind=8) :: PP, LP - - logical :: snow_scavenging - - i1 = lbound(qa, 1); i2 = ubound(qa, 1) - j1 = lbound(qa, 2); j2 = ubound(qa, 2) - k1 = lbound(qa, 3); km = ubound(qa, 3) - - effRemoval = f_wet - - rc = 0 - -! Initialize local variables -! -------------------------- - -! c_h2o, cldliq, and cldice are respectively intended to be the -! water mixing ratio (liquid or vapor?, in or out of cloud?) -! cloud liquid water mixing ratio -! cloud ice water mixing ratio - - allocate( c_h2o(i1:i2,j1:j2,km), __STAT__) - allocate(cldliq(i1:i2,j1:j2,km), __STAT__) - allocate(cldice(i1:i2,j1:j2,km), __STAT__) - - - c_h2o = (10d0**(-2663.5d0/tmpu(:,:,:) + 12.537d0 ) ) / & - (ple(:,:,0:km-1)+ple(:,:,1:km)) /2d0 - cldliq = 0.d0 - where(tmpu > 248.) cldliq = 1.d-6 * ( ( tmpu - 248.d0) / 20.d0 ) - where(tmpu >= 268.) cldliq = 1.d-6 - cldice = 1.d-6 - cldliq - - Td_ls = cdt - - if (associated(flux)) flux = 0.0 - -! Allocate the dynamic arrays - allocate(fd(km,nbins), __STAT__) - allocate(dc(nbins), __STAT__) - - allocate(qls(km), __STAT__) - allocate(qcv(km), __STAT__) - - allocate(dpfli(i1:i2,j1:j2,km), __STAT__) - allocate(pdog(i1:i2,j1:j2,km), __STAT__) - allocate(delz(i1:i2,j1:j2,km), __STAT__) - - -! Accumulate the 3-dimensional arrays of rhoa and pdog - pdog = (ple(:,:,1:km)-ple(:,:,0:km-1)) / grav - delz = pdog / rhoa - - dpfli = pfllsan(:,:,1:km)-pfllsan(:,:,0:km-1)+pfilsan(:,:,1:km)-pfilsan(:,:,0:km-1) - - if (.not. KIN) then ! Gases - if (aero_type == 'NH3') then ! Only for NH3 at present - ! values adopted in Umich/IMPACT and GMI, effective Henry's law coefficient at pH=5 - Kstar298 = 1.05d6 - H298_R = -4.2d3 - else - if (MAPL_AM_I_ROOT()) print *, 'stop in WetRemoval, need Kstar298 and H298_R' - stop - endif - endif - -! Snow scavenging flag - snow_scavenging = .true. - - if (aero_type == 'BC' .and. n == 2) then - snow_scavenging = .false. - end if - - if ( (aero_type == 'OC' ) .or. & - (aero_type == 'sea_salt') .or. & - (aero_type == 'sulfur' ) .or. & - (aero_type == 'seasalt' ) .or. & - (aero_type == 'sulfate' ) .or. & - (aero_type == 'NH3' ) .or. & - (aero_type == 'NH4a' ) .or. & - (aero_type == 'nitrate' ) .or. & - (aero_type == 'dust' ) ) then - snow_scavenging = .false. - end if - -! Loop over spatial indices - do j = j1, j2 - do i = i1, i2 - -! Check for total precipitation amount -! Assume no precip in column if precl+precc = 0 - pac = precl(i,j) + precc(i,j) - if(pac .le. 0.) goto 100 - pls = precl(i,j) - pcv = precc(i,j) - -! Initialize the precipitation fields - qls(:) = 0. - qcv(:) = 0. - fd(:,:) = 0. - -! Find the highest model layer experiencing rainout. Assumes no -! scavenging if T < 258 K - LH = 0 - do k = 1, km - if(dpfli(i,j,k) .gt. 0. ) then - LH = k - goto 15 - endif - end do - 15 continue - if(LH .lt. 1) goto 100 - - do k = LH, km - qls(k) = dpfli(i,j,k)/pdog(i,j,k)*rhoa(i,j,k) - end do - -! Loop over vertical to do the scavenging! - do k = LH, km - -!----------------------------------------------------------------------------- -! (1) LARGE-SCALE RAINOUT: -! Tracer loss by rainout = TC0 * F * exp(-B*dt) -! where B = precipitation frequency, -! F = fraction of grid box covered by precipitating clouds. -! We assume that tracer scavenged by rain is falling down to the -! next level, where a fraction could be re-evaporated to gas phase -! if Qls is less then 0 in that level. -!----------------------------------------------------------------------------- - if (qls(k) .gt. 0.) then - F = F0_ls / (1. + F0_ls*B0_ls*XL_ls/(qls(k)*cdt/Td_ls)) - k_rain = B0_ls/F0_ls +1./(F0_ls*XL_ls/qls(k)) - if ( kin ) then ! Aerosols - B = k_rain - else ! Gases - ! ice to gas ratio - if ( c_h2o(i,j,k) > 0.d0) then - I2G = (cldice(i,j,k) / c_h2o(i,j,k)) * conv_NH3 - else - I2G = 0.d0 - endif - L2G = cldliq(i,j,k) * R * tmpu(i,j,k) * & - Kstar298 * EXP( -H298_R * ( ( 1d0 / tmpu(i,j,k) ) - INV_T0 ) ) - ! fraction of NH3 in liquid & ice phases - C_TOT = 1d0 + L2G + I2G - F_L = L2G / C_TOT - F_I = I2G / C_TOT - ! compute kg, the retention factor for liquid NH3 is 0 at T < 248K and - ! 0.05 at 248K < T < 268K - if (tmpu(i,j,k) >=268d0) then - B = k_rain * ( F_L+F_I ) - elseif ( (248d0 < tmpu(i,j,k)) .and. (tmpu(i,j,k) < 268d0) ) then - B = k_rain * ( (0.05*F_L)+F_I ) - else - B = k_rain * F_I - endif - endif ! kin - BT = B * Td_ls - if (BT.gt.10.) BT = 10. !< Avoid overflow > -! Adjust du level: - do n = 1, nbins -! implementing QQ Wang's change for snow scavening by Huisheng Bian (4/24/2015) -! supress scavenging at cold T except BC1 (hydrophobic), dust, and hno3 - if (tmpu(i,j,k) < 258d0 .and. .not.snow_scavenging) then - F = 0.d0 - endif - - effRemoval = f_wet - DC(n) = qa(i,j,k) * F * effRemoval *(1.-exp(-BT)) - if (DC(n).lt.0.) DC(n) = 0. - qa(i,j,k) = qa(i,j,k)-DC(n) - if (qa(i,j,k) .lt. 1.0E-32) qa(i,j,k) = 1.0E-32 - end do -! Flux down: unit is kg m-2 -! Formulated in terms of production in the layer. In the revaporation step -! we consider possibly adding flux from above... - do n = 1, nbins - Fd(k,n) = DC(n)*pdog(i,j,k) - end do - - end if ! if Qls > 0 >>> - -!----------------------------------------------------------------------------- -! * (2) LARGE-SCALE WASHOUT: -! * Occurs when rain at this level is less than above. -!----------------------------------------------------------------------------- - if(k .gt. LH .and. qls(k) .ge. 0.) then - if(qls(k) .lt. qls(k-1)) then -! Find a maximum F overhead until the level where Qls<0. - Qmx = 0. - do kk = k-1,LH,-1 - if (Qls(kk).gt.0.) then - Qmx = max(Qmx,Qls(kk)) - else - goto 333 - end if - end do - - 333 continue - F = F0_ls / (1. + F0_ls*B0_ls*XL_ls/(Qmx*cdt/Td_ls)) - if (F.lt.0.01) F = 0.01 -!----------------------------------------------------------------------------- -! The following is to convert Q(k) from kgH2O/m3/sec to mm/sec in order -! to use the Harvard formula. Convert back to mixing ratio by multiplying -! by rhoa. Multiply by pdog gives kg/m2/s of precip. Divide by density -! of water (=1000 kg/m3) gives m/s of precip and multiply by 1000 gives -! units of mm/s (omit the multiply and divide by 1000). -!----------------------------------------------------------------------------- - -! Aerosols - Qd = Qmx /rhoa(i,j,k)*pdog(i,j,k) - if (Qd.ge.50.) then - B = 0. - else - B = Qd * 0.1 - end if - BT = B * cdt - if (BT.gt.10.) BT = 10. - -! Gases - if ( .not. KIN ) then - IF ( tmpu(i,j,k) >= 268d0 ) THEN - !------------------------ - ! T >= 268K: Do washout - !------------------------ - ! Rainwater content in the grid box (Eq. 17, Jacob et al, 2000) - PP = (PFLLSAN(i,j,k)/1000d0 + PFILSAN(i,j,k)/917d0 )*100d0 ! from kg H2O/m2/s to cm3 H2O/cm2/s - LP = ( PP * cdt ) / ( F * delz(i,j,k)*100.d0 ) ! DZ*100.d0 in cm - ! Compute liquid to gas ratio for H2O2, using the appropriate - ! parameters for Henry's law -- also use rainwater content Lp - ! (Eqs. 7, 8, and Table 1, Jacob et al, 2000) - !CALL COMPUTE_L2G( Kstar298, H298_R, tmpu(i,j,k), LP, L2G ) - L2G = Kstar298 * EXP( -H298_R*((1d0/tmpu(i,j,k))-INV_T0) ) & - * LP * R * tmpu(i,j,k) - ! Washout fraction from Henry's law (Eq. 16, Jacob et al, 2000) - WASHFRAC = L2G / ( 1d0 + L2G ) - ! Washout fraction / F from Eq. 14, Jacob et al, 2000 - ! Note: WASHFRAC_F_14 should match what's used for HNO3 (hma, 13aug2011) - WASHFRAC_F_14 = 1d0 - EXP( -K_WASH * ( PP / F ) * cdt ) - ! Do not let the Henry's law washout fraction exceed - IF ( WASHFRAC > WASHFRAC_F_14 ) THEN - WASHFRAC = WASHFRAC_F_14 - ENDIF - ELSE - !------------------------ - ! T < 268K: No washout - !------------------------ - WASHFRAC = 0d0 - ENDIF - endif - -! Adjust du level: - do n = 1, nbins - if ( KIN ) then - DC(n) = qa(i,j,k) * F * (1.-exp(-BT)) - else - DC(n) = qa(i,j,k) * F * WASHFRAC - endif - if (DC(n).lt.0.) DC(n) = 0. - qa(i,j,k) = qa(i,j,k)-DC(n) - if (qa(i,j,k) .lt. 1.0E-32) & - qa(i,j,k) = 1.0E-32 - if( associated(flux) ) then - flux(i,j) = flux(i,j)+DC(n)*pdog(i,j,k)/cdt - endif - end do - - end if - end if ! if ls washout >>> - -!----------------------------------------------------------------------------- -! (3) CONVECTIVE RAINOUT: -! Tracer loss by rainout = dd0 * F * exp(-B*dt) -! where B = precipitation frequency, -! F = fraction of grid box covered by precipitating clouds. -!----------------------------------------------------------------------------- - - if (qcv(k) .gt. 0.) then - F = F0_cv / (1. + F0_cv*B0_cv*XL_cv/(Qcv(k)*cdt/Td_cv)) - B = B0_cv - BT = B * Td_cv - if (BT.gt.10.) BT = 10. !< Avoid overflow > - -! Adjust du level: - do n = 1, nbins - effRemoval = f_wet - DC(n) = qa(i,j,k) * F * effRemoval * (1.-exp(-BT)) - if (DC(n).lt.0.) DC(n) = 0. - qa(i,j,k) = qa(i,j,k)-DC(n) - if (qa(i,j,k) .lt. 1.0E-32) qa(i,j,k) = 1.0E-32 - end do - -!------ Flux down: unit is kg. Including both ls and cv. - do n = 1, nbins - Fd(k,n) = Fd(k,n) + DC(n)*pdog(i,j,k) - end do - - end if ! if Qcv > 0 >>> - -!----------------------------------------------------------------------------- -! (4) CONVECTIVE WASHOUT: -! Occurs when rain at this level is less than above. -!----------------------------------------------------------------------------- - - if (k.gt.LH .and. Qcv(k).ge.0.) then - if (Qcv(k).lt.Qcv(k-1)) then -!----- Find a maximum F overhead until the level where Qls<0. - Qmx = 0. - do kk = k-1, LH, -1 - if (Qcv(kk).gt.0.) then - Qmx = max(Qmx,Qcv(kk)) - else - goto 444 - end if - end do - - 444 continue - F = F0_cv / (1. + F0_cv*B0_cv*XL_cv/(Qmx*cdt/Td_cv)) - if (F.lt.0.01) F = 0.01 -!----------------------------------------------------------------------------- -! The following is to convert Q(k) from kgH2O/m3/sec to mm/sec in order -! to use the Harvard formula. Convert back to mixing ratio by multiplying -! by rhoa. Multiply by pdog gives kg/m2/s of precip. Divide by density -! of water (=1000 kg/m3) gives m/s of precip and multiply by 1000 gives -! units of mm/s (omit the multiply and divide by 1000). -!----------------------------------------------------------------------------- - - Qd = Qmx / rhoa(i,j,k)*pdog(i,j,k) - if (Qd.ge.50.) then - B = 0. - else - B = Qd * 0.1 - end if - BT = B * cdt - if (BT.gt.10.) BT = 10. - -! Adjust du level: - do n = 1, nbins - DC(n) = qa(i,j,k) * F * (1.-exp(-BT)) - if (DC(n).lt.0.) DC(n) = 0. - qa(i,j,k) = qa(i,j,k)-DC(n) - if (qa(i,j,k) .lt. 1.0E-32) & - qa(i,j,k) = 1.0E-32 - if( associated(flux) ) then - flux(i,j) = flux(i,j)+DC(n)*pdog(i,j,k)/cdt - endif - end do - - end if - end if ! if cv washout >>> - -!----------------------------------------------------------------------------- -! (5) RE-EVAPORATION. Assume that SO2 is re-evaporated as SO4 since it -! has been oxidized by H2O2 at the level above. -!----------------------------------------------------------------------------- -! Add in the flux from above, which will be subtracted if reevaporation occurs - if(k .gt. LH) then - do n = 1, nbins - Fd(k,n) = Fd(k,n) + Fd(k-1,n) - end do - -! Is there evaporation in the currect layer? - if (dpfli(i,j,k) .lt. 0.) then -! Fraction evaporated = H2O(k)evap / H2O(next condensation level). - if (dpfli(i,j,k-1) .gt. 0.) then - - A = abs( dpfli(i,j,k) / dpfli(i,j,k-1) ) - if (A .gt. 1.) A = 1. - -! Adjust tracer in the level - do n = 1, nbins - DC(n) = Fd(k-1,n) / pdog(i,j,k) * A - qa(i,j,k) = qa(i,j,k) + DC(n) - qa(i,j,k) = max(qa(i,j,k),1.e-32) -! Adjust the flux out of the bottom of the layer - Fd(k,n) = Fd(k,n) - DC(n)*pdog(i,j,k) - end do - - endif - endif ! if -moistq < 0 - endif - end do ! k - - do n = 1, nbins - if( associated(flux) ) then - flux = flux + Fd(km,n)/cdt - endif - end do - - 100 continue - end do ! i - end do ! j - - deallocate(fd, __STAT__) - deallocate(dpfli, __STAT__) - deallocate(DC, __STAT__) - deallocate(c_h2o, __STAT__) - deallocate(cldliq, __STAT__) - deallocate(cldice, __STAT__) - deallocate(qls, __STAT__) - deallocate(qcv, __STAT__) - deallocate(pdog, __STAT__) - deallocate(delz, __STAT__) - - end subroutine MAML_WetRemoval - - - end module MAML_WetRemovalMod - diff --git a/MAMchem_GridComp/MAM_BaseMod.F90 b/MAMchem_GridComp/MAM_BaseMod.F90 deleted file mode 100644 index 1b24bab3..00000000 --- a/MAMchem_GridComp/MAM_BaseMod.F90 +++ /dev/null @@ -1,2268 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_BaseMod - basic MAM constants and types -! -! !INTERFACE: -! - module MAM_BaseMod -! -! !USES: -! - - use MAPL - - use MAM_ComponentsDataMod - use MAM_ConstituentsDataMod - - use MAM3_DataMod -! use MAM4_DataMod - use MAM7_DataMod - - implicit NONE - private -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !DESCRIPTION: -! -! {\tt MAM\_Base} provides a collection of basic constants and -! types used in the MAM code. -! -! -! !REVISION HISTORY: -! -! 14Sep2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - -! MAM public types -! ------------------ - public MAM_Range - public MAM_AerosolSpecies - public MAM_AerosolMode - - public MAM_Scheme - - -! MAM public methods -! ------------------------ - public MAM_RangeSet - public MAM_RangeGet - - public MAM_AerosolComponentSet - public MAM_AerosolComponentGet - - public MAM_AerosolSpeciesGet - - public MAM_AerosolModeSet - public MAM_AerosolModeGet - - public MAM_SchemeGetModeIndex - - public MAM_SchemeInit - - public MAM_SchemeValidate - - -! Status codes -! ------------ - integer, public, parameter :: MAM_SUCCESS = 0 - integer, public, parameter :: MAM_GENERAL_ERROR = 9000 + 1 - integer, public, parameter :: MAM_NOT_IMPLEMENTED_ERROR = 9000 + 2 - integer, public, parameter :: MAM_UNKNOWN_SCHEME_ERROR = 9000 + 3 - integer, public, parameter :: MAM_UNKNOWN_AEROSOL_MODE_ERROR = 9000 + 4 - integer, public, parameter :: MAM_UNKNOWN_AEROSOL_COMPONENT_ERROR = 9000 + 5 - integer, public, parameter :: MAM_UNKNOWN_AEROSOL_CONSTITUENT_ERROR = 9000 + 6 - - -! MAM defs -! ------------------ - integer, public, parameter :: MAM3_SCHEME = 1000 + 3 - integer, public, parameter :: MAM4_SCHEME = 1000 + 4 - integer, public, parameter :: MAM7_SCHEME = 1000 + 7 - - integer, public, parameter :: MAM_INTERSTITIAL_AEROSOL = 5000 + 1 - integer, public, parameter :: MAM_CLOUDBORNE_AEROSOL = 5000 + 2 - - integer, public, parameter :: MAM_NUMBER_AEROSOL = 6000 + 1 - integer, public, parameter :: MAM_MASS_AEROSOL = 6000 + 2 - - - - integer, public, parameter :: MAM_MAX_NUMBER_MODES = max(MAM3_MODES, MAM7_MODES) - - integer, public, parameter :: MAM_MAXSTR = 256 ! maximum string length - - - - - -! A range/interval -! ---------------- - type MAM_Range - real :: low = 0.0 ! lower bound of the range - real :: up = 0.0 ! upper bound of the range - end type - - -! Aerosol Component -! ----------------- - type MAM_AerosolComponent - character(len=MAM_MAXSTR) :: name ! name of the aerosol component - character(len=MAM_MAXSTR) :: long_name ! long name - - real :: density ! bulk density - real :: hygroscopicity ! hygroscopicity of the aerosol component - real :: solubility ! fractional solubility - end type - - -! Aerosol Species -! --------------- - type MAM_AerosolSpecies - character(len=MAM_MAXSTR) :: name ! name of the aerosol specie - character(len=MAM_MAXSTR) :: long_name ! long name - - type(MAM_AerosolComponent), pointer :: component => null() ! aerosol component - - type(MAM_Range), pointer :: emission_size_range => null() ! cutoff size range for emissions - end type - - - -! Aerosol Mode -! ------------ - type MAM_AerosolMode - character(len=MAM_MAXSTR) :: name ! name of the aerosol mode - character(len=MAM_MAXSTR) :: long_name ! long name - - real :: sigma ! geometric standard deviation - - real :: size ! default geometric mean diameter of number size distribution - type(MAM_Range) :: size_range ! size range limits - - real :: rh_deliquescence ! deliquescence RH point - real :: rh_crystallization ! crystallization RH point - - real :: f_conv_scav ! convective scavenging parameter - real :: f_wet ! wet removal efficiency - - integer :: n_species ! number of species - type(MAM_AerosolSpecies), pointer :: species(:) => null() ! species - end type - - -! Gas Species -! ----------- - type MAM_GasSpecies - character(len=MAM_MAXSTR) :: name ! name of the gas specie - character(len=MAM_MAXSTR) :: long_name ! long name - character(len=MAM_MAXSTR) :: units ! units - - real :: mw ! molecular weight - end type - - -! MAM Tracer -! ---------- - type MAM_Tracer - integer :: id ! tracer ID - character(len=MAM_MAXSTR) :: name ! name of the tracer - character(len=MAM_MAXSTR) :: long_name ! long name - - character(len=MAM_MAXSTR) :: units ! units - integer :: type ! interstital aerosol, cloud-borne aerosol or gas - - type(MAM_AerosolSpecies), pointer :: aerosol_species => null() - type(MAM_GasSpecies), pointer :: gas_species => null() - -! real, pointer, dimension(:,:,:) :: q => null() - end type - - -! Modal Aerosol Model Scheme/Configuration -! ---------------------------------------- - type MAM_Scheme - integer :: id ! scheme ID - character(len=MAM_MAXSTR) :: name ! name of the scheme - character(len=MAM_MAXSTR) :: long_name ! long name of the scheme - - - ! Aerosol microphysics - ! -------------------- - integer :: n_aerosol_components ! number of aerosol components - type(MAM_AerosolComponent), pointer :: aerosol_component(:) => null() - - integer :: n_modes ! number of (aerosol) modes - type(MAM_AerosolMode), pointer :: mode(:) => null() - end type - - - interface MAM_SchemeGetAerosolComponentIndex - module procedure MAM_SchemeGetAerosolComponentIndexFromName - end interface MAM_SchemeGetAerosolComponentIndex - - - interface MAM_SchemeGetModeIndex - module procedure MAM_SchemeGetModeIndexFromName - end interface MAM_SchemeGetModeIndex - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_RangeSet --- Sets range bounds -! -! !INTERFACE: - - subroutine MAM_RangeSet(self, lower_bound, upper_bound, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Range), intent(inout) :: self - -! !INPUT PARAMETERS: - real, optional, intent(in) :: lower_bound - real, optional, intent(in) :: upper_bound - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - - -! !DESCRIPTION: Sets upper and lower bounds of a range. -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_RangeGet') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(lower_bound)) & - self%low = lower_bound - - if (present(upper_bound)) & - self%up = upper_bound - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_RangeSet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_RangeGet --- Gets bounds of a range -! -! !INTERFACE: - - subroutine MAM_RangeGet(self, lower_bound, upper_bound, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - real, optional, intent(inout) :: lower_bound - real, optional, intent(inout) :: upper_bound - -! !INPUT PARAMETERS: - type(MAM_Range), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Gets the upper and lower bounds of a size range/bin. -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_RangeGet') - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(lower_bound)) lower_bound = self%low - - if (present(upper_bound)) upper_bound = self%up - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_RangeGet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_RangeGet --- Gets bounds of a range -! -! !INTERFACE: - - subroutine MAM_RangePrint(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - type(MAM_Range), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - - -! !DESCRIPTION: Gets the upper and lower bounds of a size range/bin. -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_RangePrint') - - - real :: lower_bound - real :: upper_bound - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - call MAM_RangeGet(self, lower_bound = lower_bound, & - upper_bound = upper_bound, __RC__) - - write (*, *) lower_bound, upper_bound - - if (present(rc)) rc = STATUS - - end subroutine MAM_RangePrint - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolComponentSet --- -! -! !INTERFACE: - - subroutine MAM_AerosolComponentSet(self, name, & - long_name, & - density, & - hygroscopicity, & - solubility, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_AerosolComponent), intent(inout) :: self - -! !INPUT PARAMETERS: - character(len=*), optional, intent(in) :: name - character(len=*), optional, intent(in) :: long_name - - real, optional, intent(in) :: density - real, optional, intent(in) :: hygroscopicity - real, optional, intent(in) :: solubility - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol component properties -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolComponentSet') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name)) & - self%name = trim(name) - - if (present(long_name)) & - self%long_name = trim(long_name) - - if (present(density)) & - self%density = density - - if (present(hygroscopicity)) & - self%hygroscopicity = hygroscopicity - - if (present(solubility)) & - self%solubility = solubility - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_AerosolComponentSet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolComponentGet --- -! -! !INTERFACE: - - subroutine MAM_AerosolComponentGet(self, name, & - long_name, & - density, & - hygroscopicity, & - solubility, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - character(len=*), optional, intent(inout) :: name - character(len=*), optional, intent(inout) :: long_name - - real, optional, intent(inout) :: density - real, optional, intent(inout) :: hygroscopicity - real, optional, intent(inout) :: solubility - -! !INPUT PARAMETERS: - type(MAM_AerosolComponent), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Get aerosol component properties -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolComponentGet') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name))& - name = trim(self%name) - - if (present(long_name)) & - long_name = trim(self%long_name) - - if (present(density)) & - density = self%density - - if (present(hygroscopicity)) & - hygroscopicity = self%hygroscopicity - - if (present(solubility)) & - solubility = self%solubility - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_AerosolComponentGet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolComponentPrint --- -! -! !INTERFACE: - - subroutine MAM_AerosolComponentPrint(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - type(MAM_AerosolComponent), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Get aerosol component properties -! -! !REVISION HISTORY: -! -! 15Sep2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolComponentPrint') - - character(len=MAM_MAXSTR) :: name - character(len=MAM_MAXSTR) :: long_name - - real :: density - real :: hygroscopicity - real :: solubility - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - call MAM_AerosolComponentGet(self, name = name, & - long_name = long_name, & - density = density, & - hygroscopicity = hygroscopicity, & - solubility = solubility, __RC__) - - write (*, *) 'Aerosol Component: ' - write (*, *) ' name = ', trim(name) - write (*, *) ' long_name = ', trim(long_name) - write (*, *) ' density = ', density - write (*, *) ' hygroscopicity = ', hygroscopicity - write (*, *) ' solubility = ', solubility - write (*, *) - - if (present(rc)) rc = STATUS - - end subroutine MAM_AerosolComponentPrint - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolSpeciesSet --- -! -! !INTERFACE: - - subroutine MAM_AerosolSpeciesSet(self, name, & - long_name, & - component, & - emission_size_range, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_AerosolSpecies), intent(inout) :: self - -! !INPUT PARAMETERS: - character(len=*), optional, intent(in) :: name - character(len=*), optional, intent(in) :: long_name - - type(MAM_Range), optional, intent(in) :: emission_size_range - - type(MAM_AerosolComponent), pointer, optional, intent(in) :: component - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolSpeciesSet') - - - type(MAM_Range), pointer :: buff - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name))& - self%name = trim(name) - - if (present(long_name)) & - self%long_name = trim(long_name) - - if (present(component)) & - self%component => component - - if (present(emission_size_range)) then - - if (.not. associated(self%emission_size_range)) then - allocate(buff, __STAT__) - end if - - buff = emission_size_range - self%emission_size_range => buff - - self%emission_size_range = emission_size_range - end if - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_AerosolSpeciesSet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolSpeciesGet --- -! -! !INTERFACE: - - subroutine MAM_AerosolSpeciesGet(self, name, & - long_name, & - component, & - emission_size_range, & - density, & - hygroscopicity, & - solubility, & - component_name, & - component_long_name, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - character(len=*), optional, intent(inout) :: name - character(len=*), optional, intent(inout) :: long_name - - type(MAM_Range), optional, intent(inout) :: emission_size_range - - type(MAM_AerosolComponent), pointer, optional, intent(inout) :: component - - real, optional, intent(inout) :: density - real, optional, intent(inout) :: hygroscopicity - real, optional, intent(inout) :: solubility - character(len=*), optional, intent(inout) :: component_name - character(len=*), optional, intent(inout) :: component_long_name - -! !INPUT PARAMETERS: - type(MAM_AerosolSpecies), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolSpeciesGet') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name))& - name = trim(self%name) - - if (present(long_name)) & - long_name = trim(self%long_name) - - if (present(component)) & - component => self%component - - if (present(emission_size_range)) then - if (associated(self%emission_size_range)) then - emission_size_range = self%emission_size_range - else - call MAM_RangeSet(emission_size_range, -MAPL_UNDEF, -MAPL_UNDEF, __RC__) - end if - end if - - if(present(density)) then - if (associated(self%component)) then - call MAM_AerosolComponentGet(self%component, density=density, __RC__) - else - density = MAPL_UNDEF - end if - end if - - if (present(hygroscopicity)) then - if (associated(self%component)) then - call MAM_AerosolComponentGet(self%component, hygroscopicity=hygroscopicity, __RC__) - else - hygroscopicity = MAPL_UNDEF - end if - end if - - if (present(solubility)) then - if (associated(self%component)) then - call MAM_AerosolComponentGet(self%component, solubility=solubility, __RC__) - else - solubility = MAPL_UNDEF - end if - end if - - if (present(component_name)) then - if (associated(self%component)) then - call MAM_AerosolComponentGet(self%component, name=component_name, __RC__) - else - component_name = '' - end if - end if - - if (present(component_long_name)) then - if (associated(self%component)) then - call MAM_AerosolComponentGet(self%component, long_name=component_long_name, __RC__) - else - component_long_name = '' - end if - end if - - if (present(rc)) rc = STATUS - - end subroutine MAM_AerosolSpeciesGet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolSpeciesPrint --- -! -! !INTERFACE: - - subroutine MAM_AerosolSpeciesPrint(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - type(MAM_AerosolSpecies), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolSpeciesPrint') - - character(len=MAM_MAXSTR) :: name - character(len=MAM_MAXSTR) :: long_name - - type(MAM_Range) :: emission_size_range - - character(len=MAM_MAXSTR) :: component_name - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - call MAM_AerosolSpeciesGet(self, name = name, & - long_name = long_name, & - emission_size_range = emission_size_range, & - component_name = component_name, __RC__) - - write (*, *) 'Aerosol Species: ' - write (*, *) ' name = ', trim(name) - write (*, *) ' long_name = ', trim(long_name) - write (*, *) ' emission_range = ', emission_size_range%low, emission_size_range%up - write (*, *) ' component = ', component_name - write (*, *) - - if (present(rc)) rc = STATUS - - end subroutine MAM_AerosolSpeciesPrint - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolModeSet --- -! -! !INTERFACE: - - subroutine MAM_AerosolModeSet(self, name, & - long_name, & - sigma, & - size_default, & - size_min, & - size_max, & - rh_deliquescence, & - rh_crystallization, & - f_conv_scavenging, & - f_wet, & - n_species, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_AerosolMode), intent(inout) :: self - -! !INPUT PARAMETERS: - character(len=*), optional, intent(in) :: name - character(len=*), optional, intent(in) :: long_name - - real, optional, intent(in) :: sigma - - real, optional, intent(in) :: size_default - real, optional, intent(in) :: size_min - real, optional, intent(in) :: size_max - - real, optional, intent(in) :: rh_deliquescence - real, optional, intent(in) :: rh_crystallization - - real, optional, intent(in) :: f_conv_scavenging - real, optional, intent(in) :: f_wet - - integer, optional, intent(in) :: n_species - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolModeSet') - - - type(MAM_AerosolSpecies), pointer, dimension(:) :: buff - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name))& - self%name = trim(name) - - if (present(long_name)) & - self%long_name = trim(long_name) - - if (present(sigma)) & - self%sigma = sigma - - if (present(size_default)) & - self%size = size_default - - if (present(size_min)) & - self%size_range%low = size_min - - if (present(size_max)) & - self%size_range%up = size_max - - if (present(rh_deliquescence)) & - self%rh_deliquescence = rh_deliquescence - - if (present(rh_crystallization)) & - self%rh_crystallization = rh_crystallization - - if (present(f_conv_scavenging)) & - self%f_conv_scav = f_conv_scavenging - - if (present(f_wet)) & - self%f_wet = f_wet - - if (present(n_species)) then - if (n_species > 0) then - allocate(buff(n_species), __STAT__) - - self%n_species = n_species - self%species => buff - else - __raise__(MAM_GENERAL_ERROR, 'Number of aerosol species must be positive.') - end if - end if - - if (present(rc)) then - rc = MAM_SUCCESS - end if - - end subroutine MAM_AerosolModeSet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolModeGet --- -! -! !INTERFACE: - - subroutine MAM_AerosolModeGet(self, name, & - long_name, & - sigma, & - size_default, & - size_min, & - size_max, & - rh_deliquescence, & - rh_crystallization, & - f_conv_scavenging, & - f_wet, & - n_species, & - species, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - character(len=*), optional, intent(inout) :: name - character(len=*), optional, intent(inout) :: long_name - - real, optional, intent(inout) :: sigma - - real, optional, intent(inout) :: size_default - real, optional, intent(inout) :: size_min - real, optional, intent(inout) :: size_max - - real, optional, intent(inout) :: rh_deliquescence - real, optional, intent(inout) :: rh_crystallization - - real, optional, intent(inout) :: f_conv_scavenging - real, optional, intent(inout) :: f_wet - - integer, optional, intent(inout) :: n_species - type(MAM_AerosolSpecies), optional, pointer :: species(:) - - -! !INPUT PARAMETERS: - type(MAM_AerosolMode), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolModeGet') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name))& - name = trim(self%name) - - if (present(long_name)) & - long_name = trim(self%long_name) - - if (present(sigma)) & - sigma = self%sigma - - if (present(size_default)) & - size_default = self%size - - if (present(size_min)) & - size_min = self%size_range%low - - if (present(size_max)) & - size_max = self%size_range%up - - if (present(rh_deliquescence)) & - rh_deliquescence = self%rh_deliquescence - - if (present(rh_crystallization)) & - rh_crystallization = self%rh_crystallization - - if (present(f_conv_scavenging)) & - f_conv_scavenging = self%f_conv_scav - - if (present(f_wet)) & - f_wet = self%f_wet - - if (present(n_species)) & - n_species = self%n_species - - if (present(species)) & - species => self%species - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_AerosolModeGet - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_AerosolModePrint --- -! -! !INTERFACE: - - subroutine MAM_AerosolModePrint(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - type(MAM_AerosolMode), intent(in) :: self - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc - -! !DESCRIPTION: Sets aerosol species properties -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_AerosolModeGet') - - character(len=MAM_MAXSTR) :: name - character(len=MAM_MAXSTR) :: long_name - - real :: sigma - - real :: size_default - real :: size_min - real :: size_max - - real :: rh_deliquescence - real :: rh_crystallization - - integer :: n, n_species - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - call MAM_AerosolModeGet(self, name = name, & - long_name = long_name, & - sigma = sigma, & - size_default = size_default, & - size_min = size_min, & - size_max = size_max, & - rh_deliquescence = rh_deliquescence, & - rh_crystallization = rh_crystallization, & - n_species = n_species, __RC__) - - - write (*, *) 'Aerosol Mode: ' - write (*, *) ' name = ', trim(name) - write (*, *) ' long_name = ', trim(long_name) - write (*, *) ' sigma = ', sigma - write (*, *) ' default size = ', size_default - write (*, *) ' min/max size = ', size_min, size_max - write (*, *) ' RH deliquesc. = ', rh_deliquescence - write (*, *) ' RH crystalliz. = ', rh_crystallization - write (*, *) ' species = ', n_species - write (*, *) - - do n = 1, n_species - call MAM_AerosolSpeciesPrint(self%species(n), __RC__) - end do - - write (*, *) - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_AerosolModePrint - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemeValidate --- -! -! !INTERFACE: - - subroutine MAM_SchemeValidate(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: self ! MAM scheme/configuration - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! !REVISION HISTORY: -! -! 03Dec2013 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_SchemeValidate') - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - select case(self%id) - - case (MAM3_SCHEME) - STATUS = MAM_NOT_IMPLEMENTED_ERROR - __raise__(MAM_NOT_IMPLEMENTED_ERROR, 'MAM3 scheme is not implemented yet.') - - case (MAM7_SCHEME) - STATUS = MAM_SUCCESS - - case default - STATUS = MAM_UNKNOWN_SCHEME_ERROR - __raise__(MAM_UNKNOWN_SCHEME_ERROR, 'Unsupported MAM configuration.') - - end select - - if (present(rc)) rc = STATUS - - end subroutine MAM_SchemeValidate - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemeInit --- -! -! !INTERFACE: - - subroutine MAM_SchemeInit(self, scheme_id, verbose, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: self ! MAM scheme/configuration - logical, optional, intent(in) :: verbose ! verbosity flag - -! !INPUT PARAMETERS: - integer, intent(in) :: scheme_id ! MAM model scheme -- MAM3/MAM7 - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc ! return code - -! !DESCRIPTION: -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_SchemeInit') - - logical :: verbose_ - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(verbose)) then - verbose_ = verbose - else - verbose_ = .False. - end if - - - select case(scheme_id) - case (MAM3_SCHEME) - call MAM3_Init(self, verbose_, __RC__) - - case (MAM7_SCHEME) - call MAM7_Init(self, verbose_, __RC__) - - case default - __raise__ (MAM_UNKNOWN_SCHEME_ERROR, 'Unsupported MAM model.') - end select - - if (verbose_ .and. MAPL_AM_I_ROOT()) then - call MAM_SchemePrint(self, __RC__) - end if - - if (present(rc)) rc = STATUS - - end subroutine MAM_SchemeInit - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM7_Init --- -! -! !INTERFACE: - - subroutine MAM7_Init(self, verbose, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: self ! MAM scheme/configuration - logical, optional, intent(in) :: verbose ! verbosity flag - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Set up MAM7 machinery -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM7_Init') - - - type(MAM_AerosolComponent), pointer :: aerosol_component - type(MAM_AerosolSpecies), pointer :: aerosol_species - type(MAM_AerosolMode), pointer :: mode - - type(MAM_Range) :: emission_range - - logical :: verbose_ - integer :: m, s, c - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(verbose)) then - verbose_ = verbose - else - verbose_ = .false. - end if - - ! set the model scheme ID and name - self%id = MAM7_SCHEME - self%name = 'MAM7' - self%long_name = 'GEOS5/MAM7 Aerosol Model' - - ! initialize the aerosol components - call MAM7_AerosolComponentsInit(self, verbose_, __RC__) - - - ! initialize the aerosol modes - call MAM7_AerosolModesInit(self, verbose_, __RC__) - - - ! populate AITKEN - ! --------------- - m = MAM_SchemeGetModeIndex(self, MAM7_AITKEN_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add SOA - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - SOA' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SOA_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SOA_CONSTITUENT_NAME, & - long_name = 'SOA aerosol species', & - component = aerosol_component, __RC__) - - ! add SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - seasalt' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SEASALT_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_AIT_SS_D_CUTOFF(1), & - upper_bound = MAM7_AIT_SS_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SEASALT_CONSTITUENT_NAME, & - long_name = 'seasalt aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_AITKEN_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Aitken mode.") - end if - - - ! populate ACCUMULATION - ! --------------------- - m = MAM_SchemeGetModeIndex(self, MAM7_ACCUMULATION_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add SOA - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - SOA' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SOA_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SOA_CONSTITUENT_NAME, & - long_name = 'SOA aerosol species', & - component = aerosol_component, __RC__) - - ! add POM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - POM' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_POM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_POM_CONSTITUENT_NAME, & - long_name = 'POM aerosol species', & - component = aerosol_component, __RC__) - - ! add BLACK CARBON - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - black carbon' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_BLACK_CARBON_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_BLACK_CARBON_CONSTITUENT_NAME, & - long_name = 'black carbon aerosol species', & - component = aerosol_component, __RC__) - - ! add SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - seasalt' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SEASALT_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_ACC_SS_D_CUTOFF(1), & - upper_bound = MAM7_ACC_SS_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SEASALT_CONSTITUENT_NAME, & - long_name = 'seasalt aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_ACCUMULATION_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Accumulation mode.") - end if - - - ! populate PRIMARY CARBON MODE - ! ---------------------------- - m = MAM_SchemeGetModeIndex(self, MAM7_PRIMARY_CARBON_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add POM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - POM' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_POM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_POM_CONSTITUENT_NAME, & - long_name = 'POM aerosol species', & - component = aerosol_component, __RC__) - - ! add BLACK CARBON - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - black carbon' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_BLACK_CARBON_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_BLACK_CARBON_CONSTITUENT_NAME, & - long_name = 'black carbon aerosol species', & - component = aerosol_component, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_PRIMARY_CARBON_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Primary organic mode.") - end if - - - ! populate FINE SEASALT - ! --------------------- - m = MAM_SchemeGetModeIndex(self, MAM7_FINE_SEASALT_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - seasalt' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SEASALT_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_FSS_SS_D_CUTOFF(1), & - upper_bound = MAM7_FSS_SS_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SEASALT_CONSTITUENT_NAME, & - long_name = 'seasalt aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_FINE_SEASALT_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Fine seasalt mode.") - end if - - - ! populate FINE DUST - ! ------------------ - m = MAM_SchemeGetModeIndex(self, MAM7_FINE_DUST_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add DUST - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - dust' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_DUST_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_FDU_DU_D_CUTOFF(1), & - upper_bound = MAM7_FDU_DU_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_DUST_CONSTITUENT_NAME, & - long_name = 'dust aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_FINE_DUST_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Fine dust mode.") - end if - - - ! populate COARSE SEASALT - ! --------------------- - m = MAM_SchemeGetModeIndex(self, MAM7_COARSE_SEASALT_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - seasalt' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SEASALT_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_CSS_SS_D_CUTOFF(1), & - upper_bound = MAM7_CSS_SS_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SEASALT_CONSTITUENT_NAME, & - long_name = 'seasalt aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_COARSE_SEASALT_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Coarse seasalt mode.") - end if - - - ! populate COARSE DUST - ! ------------------ - m = MAM_SchemeGetModeIndex(self, MAM7_COARSE_DUST_MODE_NAME, __RC__) - mode => self%mode(m) - - s = 0 - - ! add SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - sulfate' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_SULFATE_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_SULFATE_CONSTITUENT_NAME, & - long_name = 'sulfate aerosol species', & - component = aerosol_component, __RC__) - - ! add AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - ammonium' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_AMMONIUM_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_AMMONIUM_CONSTITUENT_NAME, & - long_name = 'ammonium aerosol species', & - component = aerosol_component, __RC__) - - ! add DUST - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding species - dust' - s = s + 1 - c = MAM_SchemeGetAerosolComponentIndex(self, MAM_DUST_COMPONENT_NAME, __RC__) - aerosol_component => self%aerosol_component(c) - call MAM_RangeSet(emission_range, lower_bound = MAM7_CDU_DU_D_CUTOFF(1), & - upper_bound = MAM7_CDU_DU_D_CUTOFF(2), __RC__) - call MAM_AerosolSpeciesSet(mode%species(s), name = MAM_DUST_CONSTITUENT_NAME, & - long_name = 'dust aerosol species', & - component = aerosol_component, & - emission_size_range = emission_range, __RC__) - - ! check if the right number of species were added - if ( s /= MAM7_COARSE_DUST_MODE_SPECIES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol species in Coarse dust mode.") - end if - - - if (present(rc)) rc = STATUS - - end subroutine MAM7_Init - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM7_AerosolComponentsInit --- -! -! !INTERFACE: - - subroutine MAM7_AerosolComponentsInit(self, verbose, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: self ! MAM scheme/configuration - logical, optional, intent(in) :: verbose ! verbosity flag - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Set up MAM7 machinery -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM7_AerosolComponentsInit') - - - type(MAM_AerosolComponent), pointer :: aero_component - - logical :: verbose_ - integer :: n - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(verbose)) then - verbose_ = verbose - else - verbose_ = .false. - end if - - ! allocate memory for the aerosol components - allocate(self%aerosol_component(MAM7_AEROSOL_COMPONENTS), __STAT__) - - - ! initialize the counter - n = 0 - - ! SULFATE - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - sulfate' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = trim(MAM_SULFATE_COMPONENT_NAME), & - long_name = trim(MAM_SULFATE_COMPONENT_NAME)//' aerosol', & - density = MAM_SULFATE_COMPONENT_DENSITY, & - hygroscopicity = MAM_SULFATE_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_SULFATE_COMPONENT_SOLUBILITY, __RC__) - - ! AMMONIUM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - ammonium' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = trim(MAM_AMMONIUM_COMPONENT_NAME), & - long_name = trim(MAM_AMMONIUM_COMPONENT_NAME)//' aerosol', & - density = MAM_AMMONIUM_COMPONENT_DENSITY, & - hygroscopicity = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_AMMONIUM_COMPONENT_SOLUBILITY, __RC__) - - ! BLACK CARBON - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - black carbon' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = MAM_BLACK_CARBON_COMPONENT_NAME, & - long_name = trim(MAM_BLACK_CARBON_COMPONENT_NAME)//' aerosol', & - density = MAM_BLACK_CARBON_COMPONENT_DENSITY, & - hygroscopicity = MAM_BLACK_CARBON_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_BLACK_CARBON_COMPONENT_SOLUBILITY, __RC__) - - ! SOA - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - SOA' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = MAM_SOA_COMPONENT_NAME, & - long_name = trim(MAM_SOA_COMPONENT_NAME)//' aerosol', & - density = MAM_SOA_COMPONENT_DENSITY, & - hygroscopicity = MAM_SOA_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_SOA_COMPONENT_SOLUBILITY, __RC__) - - ! POM - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - POM' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = MAM_POM_COMPONENT_NAME, & - long_name = trim(MAM_POM_COMPONENT_NAME)//' aerosol', & - density = MAM_POM_COMPONENT_DENSITY, & - hygroscopicity = MAM_POM_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_POM_COMPONENT_SOLUBILITY, __RC__) - - ! DUST - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - dust' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = MAM_DUST_COMPONENT_NAME, & - long_name = trim(MAM_DUST_COMPONENT_NAME)//' aerosol', & - density = MAM_DUST_COMPONENT_DENSITY, & - hygroscopicity = MAM_DUST_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_DUST_COMPONENT_SOLUBILITY, __RC__) - - ! SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding component - seasalt' - n = n + 1 - aero_component => self%aerosol_component(n) - call MAM_AerosolComponentSet(aero_component, & - name = MAM_SEASALT_COMPONENT_NAME, & - long_name = trim(MAM_SEASALT_COMPONENT_NAME)//' aerosol', & - density = MAM_SEASALT_COMPONENT_DENSITY, & - hygroscopicity = MAM_SEASALT_COMPONENT_HYGROSCOPICITY, & - solubility = MAM_SEASALT_COMPONENT_SOLUBILITY, __RC__) - - ! check if the number of components is right - self%n_aerosol_components = n - if ( self%n_aerosol_components /= MAM7_AEROSOL_COMPONENTS ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol components.") - end if - - if (present(rc)) then - rc = MAM_SUCCESS - end if - - end subroutine MAM7_AerosolComponentsInit - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM7_AerosolModesInit --- -! -! !INTERFACE: - - subroutine MAM7_AerosolModesInit(self, verbose, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: self ! MAM scheme/configuration - logical, optional, intent(in) :: verbose ! verbosity flag - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Set up MAM7 machinery -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM7_AerosolModesInit') - - - type(MAM_AerosolMode), pointer :: mode - - logical :: verbose_ - integer :: n - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(verbose)) then - verbose_ = verbose - else - verbose_ = .false. - end if - - ! allocate memory for the aerosol modes - allocate(self%mode(MAM7_MODES), __STAT__) - - - n = 0 - - ! AITKEN - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - aitken' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_AITKEN_MODE_NAME, & - long_name = 'aitken mode', & - sigma = MAM7_AITKEN_MODE_SIGMA, & - size_default = MAM7_AITKEN_MODE_SIZE, & - size_min = MAM7_AITKEN_MODE_SIZE_MIN, & - size_max = MAM7_AITKEN_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_AITKEN_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_AITKEN_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_AITKEN_MODE_SPECIES, __RC__) - - ! ACCUMULATION - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - accumulation' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_ACCUMULATION_MODE_NAME, & - long_name = 'accumulation mode', & - sigma = MAM7_ACCUMULATION_MODE_SIGMA, & - size_default = MAM7_ACCUMULATION_MODE_SIZE, & - size_min = MAM7_ACCUMULATION_MODE_SIZE_MIN, & - size_max = MAM7_ACCUMULATION_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_ACCUMULATION_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_ACCUMULATION_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_ACCUMULATION_MODE_SPECIES, __RC__) - - ! PRIMARY CARBON - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - primary carbon' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_PRIMARY_CARBON_MODE_NAME, & - long_name = 'primary carbon mode', & - sigma = MAM7_PRIMARY_CARBON_MODE_SIGMA, & - size_default = MAM7_PRIMARY_CARBON_MODE_SIZE, & - size_min = MAM7_PRIMARY_CARBON_MODE_SIZE_MIN, & - size_max = MAM7_PRIMARY_CARBON_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_PRIMARY_CARBON_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_PRIMARY_CARBON_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_PRIMARY_CARBON_MODE_SPECIES, __RC__) - - ! FINE SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - fine seasalt' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_FINE_SEASALT_MODE_NAME, & - long_name = 'fine seasalt mode', & - sigma = MAM7_FINE_SEASALT_MODE_SIGMA, & - size_default = MAM7_FINE_SEASALT_MODE_SIZE, & - size_min = MAM7_FINE_SEASALT_MODE_SIZE_MIN, & - size_max = MAM7_FINE_SEASALT_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_FINE_SEASALT_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_FINE_SEASALT_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_FINE_SEASALT_MODE_SPECIES, __RC__) - - ! FINE DUST - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - fine dust' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_FINE_DUST_MODE_NAME, & - long_name = 'fine dust mode', & - sigma = MAM7_FINE_DUST_MODE_SIGMA, & - size_default = MAM7_FINE_DUST_MODE_SIZE, & - size_min = MAM7_FINE_DUST_MODE_SIZE_MIN, & - size_max = MAM7_FINE_DUST_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_FINE_DUST_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_FINE_DUST_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_FINE_DUST_MODE_SPECIES, __RC__) - - ! COARSE SEASALT - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - coarse seasalt' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_COARSE_SEASALT_MODE_NAME, & - long_name = 'coarse seasalt mode', & - sigma = MAM7_COARSE_SEASALT_MODE_SIGMA, & - size_default = MAM7_COARSE_SEASALT_MODE_SIZE, & - size_min = MAM7_COARSE_SEASALT_MODE_SIZE_MIN, & - size_max = MAM7_COARSE_SEASALT_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_COARSE_SEASALT_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_COARSE_SEASALT_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_COARSE_SEASALT_MODE_SPECIES, __RC__) - - ! COARSE DUST - if (verbose_ .and. MAPL_AM_I_ROOT()) write (*,*) 'adding mode - coarse dust' - n = n + 1 - mode => self%mode(n) - call MAM_AerosolModeSet(mode, name = MAM7_COARSE_DUST_MODE_NAME, & - long_name = 'coarse dust mode', & - sigma = MAM7_COARSE_DUST_MODE_SIGMA, & - size_default = MAM7_COARSE_DUST_MODE_SIZE, & - size_min = MAM7_COARSE_DUST_MODE_SIZE_MIN, & - size_max = MAM7_COARSE_DUST_MODE_SIZE_MAX, & - rh_deliquescence = MAM7_COARSE_DUST_MODE_RH_DELIQUESCENCE, & - rh_crystallization = MAM7_COARSE_DUST_MODE_RH_CRYSTALLIZATION, & - n_species = MAM7_COARSE_DUST_MODE_SPECIES, __RC__) - - ! check if the number of modes is right - self%n_modes = n - if ( self%n_modes /= MAM7_MODES ) then - __raise__ (MAM_GENERAL_ERROR, "Incorrect number of aerosol modes.") - end if - - if (present(rc)) then - rc = STATUS - end if - - end subroutine MAM7_AerosolModesInit - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM3_Init --- -! -! !INTERFACE: - - subroutine MAM3_Init(scheme, verbose, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAM_Scheme), intent(inout) :: scheme ! MAM scheme/configuration - -! !INPUT PARAMETERS: - logical, optional, intent(in) :: verbose ! verbosity flag - -! !OUTPUT PARAMETERS: - integer, optional, intent(inout) :: rc ! return code - -! !DESCRIPTION: Set up MAM3 machinery -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM3_Init') - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - __raise__ (MAM_NOT_IMPLEMENTED_ERROR, 'MAM3 initialization is not implemented yet.') - - end subroutine MAM3_Init - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemeGetAerosolComponentIndexFromName --- -! -! !INTERFACE: - - function MAM_SchemeGetAerosolComponentIndexFromName(self, name, rc) result(ix) - -! !USES: - - implicit NONE - - integer :: ix - -! !INPUT/OUTPUT PARAMETERS: - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - character(len=*), intent(in) :: name ! name of the component - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: Returns the index of aerosol component -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM_SchemeGetAerosolComponentIndexFromName') - - integer :: i - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - ix = 0 - - do i = 1, self%n_aerosol_components - if (self%aerosol_component(i)%name == trim(name)) then - ix = i - exit - end if - end do - - if (ix == 0) then - STATUS = MAM_UNKNOWN_AEROSOL_COMPONENT_ERROR - VERIFY_(STATUS) - else - STATUS = MAM_SUCCESS - VERIFY_(STATUS) - end if - - if (present(rc)) then - rc = STATUS - end if - - end function MAM_SchemeGetAerosolComponentIndexFromName - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemeGetmodeIndexFromName --- -! -! !INTERFACE: - - function MAM_SchemeGetModeIndexFromName(self, name, rc) result(ix) - -! !USES: - - implicit NONE - - integer :: ix - -! !INPUT/OUTPUT PARAMETERS: - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - character(len=*), intent(in) :: name ! name of the component - -! !OUTPUT PARAMETERS: - -! !DESCRIPTION: Returns the index of aerosol mode -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM_SchemeGetModeIndexFromName') - - integer :: i - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - ix = 0 - - do i = 1, self%n_modes - if (self%mode(i)%name == trim(name)) then - ix = i - exit - end if - end do - - if (ix == 0) then - STATUS = MAM_GENERAL_ERROR - VERIFY_(STATUS) - else - STATUS = MAM_SUCCESS - VERIFY_(STATUS) - end if - - if (present(rc)) then - rc = STATUS - end if - - end function MAM_SchemeGetModeIndexFromName - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemePrint --- -! -! !INTERFACE: - - subroutine MAM_SchemePrint(self, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc ! return code - -! !DESCRIPTION: Returns the index of aerosol mode -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM_SchemeGetModeIndexFromName') - - integer :: c - integer :: m - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - do c = 1, self%n_aerosol_components - call MAM_AerosolComponentPrint(self%aerosol_component(c), __RC__) - end do - - do m = 1, self%n_modes - call MAM_AerosolModePrint(self%mode(m), __RC__) - end do - - if (present(rc)) rc = STATUS - - end subroutine MAM_SchemePrint - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SchemeGet --- -! -! !INTERFACE: - - subroutine MAM_SchemeGet(self, name, & - long_name, & - n_aerosol_components, & - aerosol_components, & - n_modes, & - modes, & - rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - character(len=*), optional, intent(inout) :: name - character(len=*), optional, intent(inout) :: long_name - - integer, optional, intent(inout) :: n_aerosol_components - integer, optional, intent(inout) :: n_modes - - type(MAM_AerosolComponent), optional, & - pointer, dimension(:), intent(inout) :: aerosol_components - type(MAM_AerosolMode), optional, & - pointer, dimension(:), intent(inout) :: modes - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - -! !OUTPUT PARAMETERS: - integer, optional, intent(out) :: rc ! return code - - -! !DESCRIPTION: Quires a MAM_Scheme instance. -! -! !REVISION HISTORY: -! -! 5Dec2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - __Iam__('MAM_SchemeGet') - - - if (present(rc)) rc = MAM_NOT_IMPLEMENTED_ERROR - - if (present(name)) then - name = trim(self%name) - end if - - if (present(long_name)) then - long_name = trim(self%long_name) - end if - - if (present(n_aerosol_components)) then - n_aerosol_components = self%n_aerosol_components - end if - - if (present(n_modes)) then - n_modes = self%n_modes - end if - - if (present(aerosol_components)) then - aerosol_components => self%aerosol_component - end if - - if (present(modes)) then - modes => self%mode - end if - - if (present(rc)) rc = MAM_SUCCESS - - end subroutine MAM_SchemeGet - - - end module MAM_BaseMod - - diff --git a/MAMchem_GridComp/MAM_BlackCarbonMod.F90 b/MAMchem_GridComp/MAM_BlackCarbonMod.F90 deleted file mode 100644 index 3394420e..00000000 --- a/MAMchem_GridComp/MAM_BlackCarbonMod.F90 +++ /dev/null @@ -1,545 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Data Assimilation Office, Code 610.1, GEOS/DAS ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_BlackCarbonMod --- MAM BC processes and diagnostics -! -! !INTERFACE: -! - - module MAM_BlackCarbonMod - -! !USES: - - USE ESMF - USE MAPL - - use Chem_ConstMod, only: grav, undef - use Chem_UtilMod, only: Chem_BiomassDiurnal - - use MAM_BaseMod - use MAM3_DataMod - use MAM7_DataMod - - implicit none - -! !PUBLIC TYPES: -! - PRIVATE - real, private, parameter :: pi = MAPL_PI - -! -! !PUBLIIC MEMBER FUNCTIONS: -! - - PUBLIC MAM_BC_Emission - PUBLIC MAM_BC_Diagnostics - -! -! !DESCRIPTION: -! -! This module implements MAM Black Carbon processes (emission, etc) and -! diagnostic fields -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - -CONTAINS - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_BC_Emission --- The Emission Driver -! -! !INTERFACE: -! - - subroutine MAM_BC_Emission (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the Black Carbon Emissions Driver. That -! is, adds tendencies due to emission. -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_BC_Emission' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i - integer :: ijl, ijkl - real :: qmin, qmax - real :: rUp, rLow - real, pointer, dimension(:,:) :: emission_total - real, pointer, dimension(:,:) :: emission_mass, emission_num - real, pointer, dimension(:,:) :: dqa_mass, dqa_num - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - character(len=ESMF_MAXSTR) :: emiss_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:) :: gwettop - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Input fields from ExtData -! ------------------------- - real, pointer, dimension(:,:) :: emiss_bb - real, pointer, dimension(:,:) :: emiss_bf - real, pointer, dimension(:,:) :: emiss_ff - real, pointer, dimension(:,:) :: emiss_sh - -! Exports -! ----------------------- - real, pointer, dimension(:,:) :: emission - -! -! Parameters of primary aerosol emissions -! --------------------------------------- - type PAE - integer :: mode_id ! mode ID - - real :: weight ! weight by mass - real :: sigma ! geometric standard deviation - real :: diameter ! geometric mean diameter of number size distribution - - real, pointer, dimension(:,:) :: emission => null() - real, pointer, dimension(:,:,:) :: injection => null() - end type - - - type(PAE), parameter :: pae_bb = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_bf = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_ff = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_sh = PAE(1, 1.0, 1.8, 0.080, null(), null()) - - real :: D_emiss_bb, f_bb - real :: D_emiss_bf, f_bf - real :: D_emiss_ff, f_ff - real :: D_emiss_sh, f_sh - -! Initialize local variables -! -------------------------- - rc = 0 - - D_emiss_bb = pae_bb%weight * pae_bb%diameter * exp(1.5 * log(pae_bb%sigma)**2) - D_emiss_bf = pae_bf%weight * pae_bf%diameter * exp(1.5 * log(pae_bf%sigma)**2) - D_emiss_ff = pae_ff%weight * pae_ff%diameter * exp(1.5 * log(pae_ff%sigma)**2) - D_emiss_sh = pae_sh%weight * pae_sh%diameter * exp(1.5 * log(pae_sh%sigma)**2) - - f_bb = 1 / (pi/6 * D_emiss_bb**3) - f_bf = 1 / (pi/6 * D_emiss_bf**3) - f_ff = 1 / (pi/6 * D_emiss_ff**3) - f_sh = 1 / (pi/6 * D_emiss_sh**3) - - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - mode_name = MAM7_PRIMARY_CARBON_MODE_NAME - else - mode_name = MAM3_ACCUMULATION_MODE_NAME - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, gwettop, 'WET1', __RC__) - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - call MAPL_GetPointer(import, emiss_bb, 'BC_EMIS_FIRE', __RC__) - call MAPL_GetPointer(import, emiss_bf, 'BC_EMIS_BIOFUEL', __RC__) - call MAPL_GetPointer(import, emiss_ff, 'BC_EMIS_FOSSILFUEL', __RC__) - call MAPL_GetPointer(import, emiss_sh, 'BC_EMIS_SHIP', __RC__) - - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(before)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') - - call pmaxmin('BC: gwettop ', gwettop, qmin, qmax, ijl, k1, 1.) - - call pmaxmin('BC: rhoa ', rhoa, qmin, qmax, ijl, km, 1.) - call pmaxmin('BC: ple ', ple, qmin, qmax, ijl, km, 1.) - call pmaxmin('BC: delp ', delp, qmin, qmax, ijl, km, 1.) -#endif - -! Black Carbon Emissions -! ---------------------- - allocate(emission_total(i1:i2,j1:j2), __STAT__) - allocate(emission_mass(i1:i2,j1:j2), __STAT__) - allocate(emission_num(i1:i2,j1:j2), __STAT__) - allocate(dqa_mass(i1:i2,j1:j2), __STAT__) - allocate(dqa_num(i1:i2,j1:j2), __STAT__) - - emission_total = 0.0 - - mmr_name = 'BC_A_' // trim(mode_name) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name) ! name of the number mixing ratio - emiss_name = 'BCEM' // trim(mode_name) ! name of the emission export - - emission_num = 0.0 - emission_mass = 0.0 - - - ! set undefined to 0 - where ((emiss_bb - undef) > abs(emiss_bb)*epsilon(emiss_bb)) emiss_bb = 0.0 - where ((emiss_bf - undef) > abs(emiss_bf)*epsilon(emiss_bf)) emiss_bf = 0.0 - where ((emiss_ff - undef) > abs(emiss_ff)*epsilon(emiss_ff)) emiss_ff = 0.0 - where ((emiss_sh - undef) > abs(emiss_sh)*epsilon(emiss_sh)) emiss_sh = 0.0 - - - emission_mass = ( emiss_bb + & - emiss_bf + & - emiss_ff + & - emiss_sh ) - - emission_num = ( f_bb * emiss_bb + & - f_bf * emiss_bf + & - f_ff * emiss_ff + & - f_sh * emiss_sh ) - - - -#ifdef DEBUG - call pmaxmin('BC: emission_total ', emission_total, qmin, qmax, ijl, 1, 1.) - - call write_parallel('BC: mode ' // trim(mode_name)) - call pmaxmin('BC: emission_mass ', emission_mass, qmin, qmax, ijl, 1, 1.) - call pmaxmin('BC: emission_number', emission_num, qmin, qmax, ijl, 1, 1.) -#endif - - dqa_mass = emission_mass * cdt * grav / delp(:,:,km) - dqa_num = emission_num * cdt * grav / delp(:,:,km) - - ! update the mass and number mixing ratios due to emission - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_mass - - i = MAPL_SimpleBundleGetIndex(qa, nmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_num - - call MAPL_GetPointer(export, emission, emiss_name, __RC__) - if (associated(emission)) then - emission = emission_mass - endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(after)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -! Clean up -! -------- - deallocate(emission_total, __STAT__) - deallocate(emission_mass, __STAT__) - deallocate(emission_num, __STAT__) - deallocate(dqa_mass, __STAT__) - deallocate(dqa_num, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_BC_Emission - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_BC_Diagnostics --- The Diagnostics Driver -! -! !INTERFACE: -! - - subroutine MAM_BC_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine calculates a number of diagnostic fields. -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_BC_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i, k - integer :: ijl, ijkl - real :: qmin, qmax - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: u, v - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: sfcmass ! surface mass concentration, kg m-3 - real, pointer, dimension(:,:) :: sfcmass25 ! surface PM2.5 mass concentration, kg m-3 - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - real, pointer, dimension(:,:) :: colmass25 ! column integrated PM2.5 mass density, kg m-2 - - real, pointer, dimension(:,:) :: fluxu ! Column mass flux in x direction - real, pointer, dimension(:,:) :: fluxv ! Column mass flux in y direction - - real, pointer, dimension(:,:,:) :: conc ! mass concentration, kg m-3 - real, pointer, dimension(:,:,:) :: mass ! mass mixing ratio, kg kg-1 - real, pointer, dimension(:,:,:) :: mass25 ! PM2.5 mass mixing ratio, kg kg-1 - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') -#if (0) - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_BC_EMISSION_MODE_ID) - mode(1:nmodes) = MAM7_BC_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_BC_EMISSION_MODE_ID) - mode(1:nmodes) = MAM3_BC_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, u, 'U', __RC__) - call MAPL_GetPointer(import, v, 'V', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, sfcmass, 'BCSMASS', __RC__) - call MAPL_GetPointer(export, sfcmass25, 'BCSMASS25', __RC__) - call MAPL_GetPointer(export, colmass, 'BCCMASS', __RC__) - call MAPL_GetPointer(export, colmass25, 'BCCMASS25', __RC__) - - call MAPL_GetPointer(export, fluxu, 'BCFLUXU', __RC__) - call MAPL_GetPointer(export, fluxv, 'BCFLUXV', __RC__) - - call MAPL_GetPointer(export, conc, 'BCCONC', __RC__) - call MAPL_GetPointer(export, mass, 'BCMASS', __RC__) - call MAPL_GetPointer(export, mass25, 'BCMASS25', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - -! Initialize diagnostic fields -! ---------------------------- - if (associated(sfcmass)) sfcmass = 0.0 - if (associated(sfcmass25)) sfcmass25 = 0.0 - if (associated(colmass)) colmass = 0.0 - if (associated(colmass25)) colmass25 = 0.0 - - if (associated(fluxu)) fluxu = 0.0 - if (associated(fluxv)) fluxv = 0.0 - - if (associated(conc)) conc = 0.0 - if (associated(mass)) mass = 0.0 - if (associated(mass25)) mass25 = 0.0 - - -! Calculate diagnostic fields -! --------------------------- - do n = 1, nmodes - mmr_name = 'BC_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - - - if (associated(sfcmass)) then - sfcmass(:,:) = sfcmass(:,:) + qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(sfcmass25)) then ! placeholder for now - sfcmass25(:,:) = sfcmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(colmass25)) then ! placeholder for now - do k = 1, km - colmass25(:,:) = colmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxu)) then - do k = 1, km - fluxu(:,:) = fluxu(:,:) + u(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxv)) then - do k = 1, km - fluxv(:,:) = fluxv(:,:) + v(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(conc)) then - conc = conc + qa%r3(i)%q * rhoa - end if - - if (associated(mass)) then - mass = mass + qa%r3(i)%q - end if - - if (associated(mass25)) then ! placeholder for now - mass25 = mass25 + 0.0 * qa%r3(i)%q - end if - - end do -#endif - -! Clean up -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_BC_Diagnostics - - - end module MAM_BlackCarbonMod diff --git a/MAMchem_GridComp/MAM_CoagulationMod.F90 b/MAMchem_GridComp/MAM_CoagulationMod.F90 deleted file mode 100644 index af5bb17e..00000000 --- a/MAMchem_GridComp/MAM_CoagulationMod.F90 +++ /dev/null @@ -1,801 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_CoagulationMod - Coagulation of interstitial aerosols -! -! !INTERFACE: -! - module MAM_CoagulationMod -! -! !USES: -! - - use ESMF - - use MAPL - - use MAML_CoagulationMod - - use MAM3_DataMod - use MAM7_DataMod - - use MAM_BaseMod - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_CoagulationBimodal -#if (1) - public MAM_Coagulation -#endif - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - -! -! !DESCRIPTION: -! -! {\tt MAML\_CoagulationMod} provides methods for computing the changes -! of number and mass mixing ratios of MAM interstitial aerosols. -! -! -! !REVISION HISTORY: -! -! 9Jan2012 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_CoagulationBimodal --- models the coagualtion of interstitial aerosols -! -! -! !INTERFACE: - - subroutine MAM_CoagulationBimodal(self, import, export, qa, Da, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: Da ! dry(geometric mean) and wet diameter - ! of number size distribution - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Coagulation of interstitial aerosols: -! - MAM7 scheme models coagulation by treating intramodal -! coagulation of Aitken, accumulation and primary carbon (PCM) -! modes as well as intramodal coagulation from Aitken to -! accumulation, primary carbon to accumulation and aged Aitken -! via primary carbon to accumulation mode. -! - MAM3 scheme models intra- and intermodal coagulation of -! the Aitken and accumulation modes. -! -! !REVISION HISTORY: -! -! 09Jan2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_CoagulationBimodal') - - - ! Mode parameters - ! --------------- - real :: sigma - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - ! indexes - integer :: m, s, n - integer :: i, im, j, jm, k, km - - integer :: n_coag_modes ! number of coagulation modes - integer :: coag_species_number_max ! max number of species - - real :: temperature ! local temperature - real :: pressure ! local mid-level pressure - real :: density_air ! local air density - - real :: f_hg ! hygroscopic growth factor - - ! buffers - integer, allocatable, dimension( :) :: coag_mode_index ! indexes of the modes included in the coagulation - integer, allocatable, dimension( :) :: coag_mode_species_number ! numbner of species in each mode - - integer, allocatable, dimension( :) :: coag_intermodal_transfer ! intermodal coagulation mapping - - integer, allocatable, dimension( :) :: iq_dgn_dry, iq_dgn_wet ! dry and wet size bundle indexes - - integer, allocatable, dimension( :) :: iq_nmr ! number mixing ratio bundle indexes - integer, allocatable, dimension(:,:) :: iq_mmr ! mass mixing ratio bundle indexes - - - real, allocatable, dimension( :) :: qa_number ! number mixing ratios - real, allocatable, dimension(:,:) :: qa_mass ! mass mixing ratios - real, allocatable, dimension(:,:) :: density_species ! species bulk densities - - real, allocatable, dimension( :) :: diameter_dry, diameter_wet ! dry and wet aerosol sizes - real, allocatable, dimension( :) :: density_dry, density_wet ! dry and wet aerosol densities - real, allocatable, dimension( :) :: coag_mode_sigma ! geometric standard deviations - - - - ! other derived variables - real, allocatable, dimension(:) :: dz - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: T - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux - - - real, parameter :: density_water = 1000.0 ! kg m-3 - - - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - - - ! Local dimensions - ! ---------------- - im = size(rhoa, 1) - jm = size(rhoa, 2) - km = size(rhoa, 3) - - - ! Find the coagulating modes - ! -------------------------- - n_coag_modes = 2 - allocate(coag_mode_index(n_coag_modes), __STAT__) - allocate(coag_mode_species_number(n_coag_modes), __STAT__) - - coag_mode_index = 0 - coag_mode_species_number = 0 - - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - n_species = n_species ) - - if (trim(mode_name) == trim(MAM7_AITKEN_MODE_NAME)) then - coag_mode_index(1) = m - coag_mode_species_number(1) = n_species - else if (trim(mode_name) == trim(MAM7_ACCUMULATION_MODE_NAME)) then - coag_mode_index(2) = m - coag_mode_species_number(2) = n_species - end if - end do - - _ASSERT(any(coag_mode_index /= 0),'needs informative message') - _ASSERT(any(coag_mode_species_number /= 0),'needs informative message') - - - ! Allocate memory for bufferes - ! ---------------------------- - - coag_species_number_max = maxval(coag_mode_species_number) ! max number of species from the coagulating modes - - allocate(coag_intermodal_transfer(coag_mode_species_number(1)), __STAT__) ! indexes used for the intermodal transfer - - allocate(coag_mode_sigma(n_coag_modes), __STAT__) ! geometric standard deviations of the coagulating modes - - allocate(iq_nmr(n_coag_modes), __STAT__) ! number mixing ratio indexes of the coagulating modes - allocate(iq_dgn_dry(n_coag_modes), __STAT__) ! dry size indexes of the coagulating modes - allocate(iq_dgn_wet(n_coag_modes), __STAT__) ! wet size indexes of the coagulating modes - - allocate(iq_mmr(coag_species_number_max, n_coag_modes), __STAT__) ! mass mixing ratio indexes of the coagulating modes - allocate(density_species(coag_species_number_max, n_coag_modes), __STAT__) ! species bulk densities of the coagulating modes - - allocate(qa_number(n_coag_modes), __STAT__) ! number mixing ratios of the coagulating modes - allocate(qa_mass(coag_species_number_max, n_coag_modes), __STAT__) ! mass mixing ratios of the coagulating modes - - allocate(diameter_dry(n_coag_modes), __STAT__) ! dry aerosol size - allocate(diameter_wet(n_coag_modes), __STAT__) ! wet aerosol size - - allocate(density_dry(n_coag_modes), __STAT__) ! dry aerosol density - allocate(density_wet(n_coag_modes), __STAT__) ! wet aerosol density - - - coag_intermodal_transfer(:) = (/1, 2, 3, 6/) - - coag_mode_sigma = 0.0 - density_species = 0.0 - - iq_nmr = 0 - iq_mmr = 0 - - iq_dgn_dry = 0 - iq_dgn_wet = 0 - - - do n = 1, n_coag_modes - - m = coag_mode_index(n) - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - sigma = sigma, & - n_species = n_species) - - ! geometric standard deviation - coag_mode_sigma(n) = sigma - - ! aerosol dry and wet sizes - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry(n) = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - field_name = 'DGN_WET_' // trim(mode_name) - iq_dgn_wet(n) = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - iq_nmr(n) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - iq_mmr(s, n) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - density_species(s, n) = self%mode(m)%species(s)%component%density - end do - end do - - - ! coagulation and column integrated number flux due to it - allocate(dz(km), __STAT__) - - do j = 1, jm - do i = 1, im - - do k = 1, km - - ! mid level pressure, temperature and air density - pressure = 0.5 * (ple(i,j,k-1) + ple(i,j,k)) - temperature = T(i,j,k) - density_air = rhoa(i,j,k) - - ! dry and wet densities - do n = 1, n_coag_modes - ! number of species in this mode - n_species = coag_mode_species_number(n) - - ! aerosol size - diameter_dry(n) = Da%r3(iq_dgn_dry(n))%q(i,j,k) - diameter_wet(n) = Da%r3(iq_dgn_wet(n))%q(i,j,k) - - ! aerosol species mass mixing ratios - qa_number(n) = 0.0 - qa_number(n) = qa%r3(iq_nmr(n))%q(i,j,k) - - qa_mass(:,n) = 0.0 - do s = 1, n_species - qa_mass(s,n) = qa%r3(iq_mmr(s,n))%q(i,j,k) - end do - - ! dry density - if (any(qa_mass(:,n) > 1.0e-15)) then - density_dry(n) = sum(qa_mass(1:n_species,n)) / sum(qa_mass(1:n_species,n)/density_species(1:n_species,n)) - else - density_dry(n) = sum(density_species(1:n_species,n))/n_species - end if - - ! wet density - f_hg = max(diameter_wet(n) / diameter_dry(n), 1.0) ! hygroscopic growth factor - density_wet(n) = f_hg**(-3) * density_dry(n) + (1 - f_hg**(-3)) * density_water - end do - - ! coagulation - call MAML_Coagulation(pressure, & - temperature, & - density_air, & - qa_number, & - qa_mass, & - diameter_wet, & - density_wet, & - coag_mode_sigma, & - coag_mode_species_number, & - coag_intermodal_transfer, & - cdt) - - ! update the number and mass mixing ratios - do n = 1, n_coag_modes - ! number of species in this mode - n_species = coag_mode_species_number(n) - - qa%r3(iq_nmr(n))%q(i,j,k) = qa_number(n) - - do s = 1, n_species - qa%r3(iq_mmr(s,n))%q(i,j,k) = qa_mass(s,n) - end do - end do - - end do ! k - - dz(:) = delp(i,j,:) / (MAPL_GRAV * rhoa(i,j,:)) - - end do ! i - end do ! j - - ! Free dynamically allocated memory - ! --------------------------------- - deallocate(dz, __STAT__) - - deallocate(density_dry, __STAT__) - deallocate(density_wet, __STAT__) - - deallocate(diameter_dry, __STAT__) - deallocate(diameter_wet, __STAT__) - - deallocate(qa_number, __STAT__) - deallocate(qa_mass, __STAT__) - - deallocate(iq_mmr, __STAT__) - deallocate(density_species, __STAT__) - - deallocate(iq_nmr, __STAT__) - deallocate(iq_dgn_dry, __STAT__) - deallocate(iq_dgn_wet, __STAT__) - - deallocate(coag_mode_sigma, __STAT__) - deallocate(coag_intermodal_transfer, __STAT__) - - end subroutine MAM_CoagulationBimodal - - - -#if (1) -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_Coagulation --- models the coagualtion of interstitial aerosols -! -! -! !INTERFACE: - - subroutine MAM_Coagulation(self, import, export, qa, Da, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: Da ! dry(geometric mean) and wet diameter - ! of number size distribution - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Coagulation of interstitial aerosols: -! - MAM7 scheme models coagulation by treating intramodal -! coagulation of Aitken, accumulation and primary carbon (PCM) -! modes as well as intramodal coagulation from Aitken to -! accumulation, primary carbon to accumulation and aged Aitken -! via primary carbon to accumulation mode. -! - MAM3 scheme models intra- and intermodal coagulation of -! the Aitken and accumulation modes. -! -! !REVISION HISTORY: -! -! 09Jan2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_Coagulation') - - - ! Mode parameters - ! --------------- - real :: sigma - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - ! indexes - integer :: m, s, n - integer :: i, im, j, jm, k, km - - integer :: n_coag_pairs ! number of pairs of modes - integer :: n_coag_modes ! number of coagulation modes - integer :: coag_species_number_max ! max number of species - - real :: temperature ! local temperature - real :: pressure ! local mid-level pressure - real :: density_air ! local air density - - real :: f_hg ! hygroscopic growth factor - - ! buffers - integer, allocatable, dimension( :) :: coag_mode_index ! indexes of the modes included in the coagulation - integer, allocatable, dimension( :) :: coag_mode_species_number ! number of species in each mode - - integer, allocatable, dimension(:,:) :: coag_intermodal_transfer ! intermodal coagulation mapping - - integer, allocatable, dimension( :) :: iq_dgn_dry, iq_dgn_wet ! dry and wet size bundle indexes - - integer, allocatable, dimension( :) :: iq_nmr ! number mixing ratio bundle indexes - integer, allocatable, dimension(:,:) :: iq_mmr ! mass mixing ratio bundle indexes - - - real, allocatable, dimension( :) :: qa_number ! number mixing ratios - real, allocatable, dimension(:,:) :: qa_mass ! mass mixing ratios - real, allocatable, dimension(:,:) :: density_species ! species bulk densities - - real, allocatable, dimension( :) :: diameter_dry, diameter_wet ! dry and wet aerosol sizes - real, allocatable, dimension( :) :: density_dry, density_wet ! dry and wet aerosol densities - real, allocatable, dimension( :) :: coag_mode_sigma ! geometric standard deviations - - real, allocatable, dimension( :) :: mass2vol_aitken_age ! mass to volume factor - real, allocatable, dimension( :) :: mass2vol_pcarbon ! mass to volume factor - - - ! other derived variables - real, allocatable, dimension(:) :: dz - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: T - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux - - - real, parameter :: density_water = 1000.0 ! kg m-3 - - ! MAM7 - integer, parameter :: mam7_mode_ait = 1 ! Aitken mode index - integer, parameter :: mam7_mode_pcm = 2 ! primary carbon mode index - integer, parameter :: mam7_mode_acc = 3 ! accumulation mode index - - integer, parameter :: mam7_ait_acc = 1 ! AIT -> ACC coagulation pair index - integer, parameter :: mam7_pcm_acc = 2 ! PCM -> ACC coagulation pair inde - integer, parameter :: mam7_ait_pcm = 3 ! AIT -> PCM + 'ageing' -> ACC coagulation pair index - - ! MAM3 - integer, parameter :: mam3_mode_ait = 1 ! Aitken mode index - integer, parameter :: mam3_mode_acc = 2 ! accumulation mode index - - integer, parameter :: mam3_ait_acc = 1 ! AIT -> ACC coagulation pair index - - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - - - ! Local dimensions - ! ---------------- - im = size(rhoa, 1) - jm = size(rhoa, 2) - km = size(rhoa, 3) - - - ! Find the coagulating modes - ! -------------------------- - if (self%id == MAM7_SCHEME) then - n_coag_modes = 3 ! AIT, PCM, ACC - n_coag_pairs = 3 ! AIT->ACC, PCM->ACC, AIT->PCM - else if (self%id == MAM3_SCHEME) then - n_coag_modes = 2 ! AIT, ACC - n_coag_pairs = 1 ! AIT->ACC - else - __raise__ (MAM_UNKNOWN_SCHEME_ERROR, "Unsupported MAM model.") - end if - - - allocate(coag_mode_index(n_coag_modes), __STAT__) - allocate(coag_mode_species_number(n_coag_modes), __STAT__) - - coag_mode_index = 0 - coag_mode_species_number = 0 - - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - n_species = n_species ) - - if (self%id == MAM7_SCHEME) then - if (trim(mode_name) == trim(MAM7_AITKEN_MODE_NAME)) then - coag_mode_index(mam7_mode_ait) = m - coag_mode_species_number(mam7_mode_ait) = n_species - else if (trim(mode_name) == trim(MAM7_PRIMARY_CARBON_MODE_NAME)) then - coag_mode_index(mam7_mode_pcm) = m - coag_mode_species_number(mam7_mode_pcm) = n_species - else if (trim(mode_name) == trim(MAM7_ACCUMULATION_MODE_NAME)) then - coag_mode_index(mam7_mode_acc) = m - coag_mode_species_number(mam7_mode_acc) = n_species - end if - else if (self%id == MAM3_SCHEME) then - if (trim(mode_name) == trim(MAM3_AITKEN_MODE_NAME)) then - coag_mode_index(mam3_mode_ait) = m - coag_mode_species_number(mam3_mode_ait) = n_species - else if (trim(mode_name) == trim(MAM3_ACCUMULATION_MODE_NAME)) then - coag_mode_index(mam3_mode_acc) = m - coag_mode_species_number(mam3_mode_acc) = n_species - end if - end if - end do - - _ASSERT(any(coag_mode_index /= 0),'needs informative message') - _ASSERT(any(coag_mode_species_number /= 0),'needs informative message') - - - ! Allocate memory for bufferes - ! ---------------------------- - - coag_species_number_max = maxval(coag_mode_species_number) ! max number of species from the coagulating modes - - allocate(coag_intermodal_transfer(coag_species_number_max,coag_mode_species_number(1)), __STAT__) ! indexes used for the intermodal transfer - - allocate(coag_mode_sigma(n_coag_modes), __STAT__) ! geometric standard deviations of the coagulating modes - - allocate(iq_nmr(n_coag_modes), __STAT__) ! number mixing ratio indexes of the coagulating modes - allocate(iq_dgn_dry(n_coag_modes), __STAT__) ! dry size indexes of the coagulating modes - allocate(iq_dgn_wet(n_coag_modes), __STAT__) ! wet size indexes of the coagulating modes - - allocate(iq_mmr(coag_species_number_max, n_coag_modes), __STAT__) ! mass mixing ratio indexes of the coagulating modes - allocate(density_species(coag_species_number_max, n_coag_modes), __STAT__) ! species bulk densities of the coagulating modes - - allocate(qa_number(n_coag_modes), __STAT__) ! number mixing ratios of the coagulating modes - allocate(qa_mass(coag_species_number_max, n_coag_modes), __STAT__) ! mass mixing ratios of the coagulating modes - - allocate(diameter_dry(n_coag_modes), __STAT__) ! dry aerosol size - allocate(diameter_wet(n_coag_modes), __STAT__) ! wet aerosol size - - allocate(density_dry(n_coag_modes), __STAT__) ! dry aerosol density - allocate(density_wet(n_coag_modes), __STAT__) ! wet aerosol density - - allocate(mass2vol_aitken_age(coag_species_number_max), __STAT__) ! mass to volume factor, needed only for MAM7 coagulation - allocate(mass2vol_pcarbon(coag_species_number_max), __STAT__) ! mass to volume factor, needed only for MAM7 coagulation - - - coag_intermodal_transfer(:,:) = 0 - - if (self%id == MAM7_SCHEME) then - n_species = coag_mode_species_number(mam7_mode_ait) - coag_intermodal_transfer(mam7_ait_acc, 1:n_species) = (/1, 2, 3, 6/) - - n_species = coag_mode_species_number(mam7_mode_pcm) - coag_intermodal_transfer(mam7_pcm_acc, 1:n_species) = (/4, 5/) - - n_species = coag_mode_species_number(mam7_mode_ait) - coag_intermodal_transfer(mam7_ait_pcm, 1:n_species) = (/0, 0, 0, 0/) - - else if (self%id == MAM3_SCHEME) then - n_species = coag_mode_species_number(mam3_mode_ait) - coag_intermodal_transfer(mam3_ait_acc, 1:n_species) = (/1, 2, 6/) - end if - - - coag_mode_sigma = 0.0 - density_species = 0.0 - - iq_nmr = 0 - iq_mmr = 0 - - iq_dgn_dry = 0 - iq_dgn_wet = 0 - - - do n = 1, n_coag_modes - - m = coag_mode_index(n) - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - sigma = sigma, & - n_species = n_species) - - ! geometric standard deviation - coag_mode_sigma(n) = sigma - - ! aerosol dry and wet sizes - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry(n) = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - field_name = 'DGN_WET_' // trim(mode_name) - iq_dgn_wet(n) = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - iq_nmr(n) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - iq_mmr(s, n) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - density_species(s, n) = self%mode(m)%species(s)%component%density - end do - end do - - - ! coagulation calculation and column integrated number flux due to it - allocate(dz(km), __STAT__) - - do j = 1, jm - do i = 1, im - - do k = 1, km - - ! mid level pressure, temperature and air density - pressure = (ple(i,j,k-1) + ple(i,j,k)) * 0.5 - temperature = T(i,j,k) - density_air = rhoa(i,j,k) - - ! dry and wet densities - do n = 1, n_coag_modes - ! number of species in this mode - n_species = coag_mode_species_number(n) - - ! aerosol size - diameter_dry(n) = Da%r3(iq_dgn_dry(n))%q(i,j,k) - diameter_wet(n) = Da%r3(iq_dgn_wet(n))%q(i,j,k) - - ! aerosol species mass mixing ratios - qa_number(n) = 0.0 - qa_number(n) = qa%r3(iq_nmr(n))%q(i,j,k) - - qa_mass(:,n) = 0.0 - do s = 1, n_species - qa_mass(s,n) = qa%r3(iq_mmr(s,n))%q(i,j,k) - end do - - ! dry density - if (any(qa_mass(:,n) > 1.0e-15)) then - density_dry(n) = sum(qa_mass(1:n_species,n)) / & - (sum(qa_mass(1:n_species,n) / density_species(1:n_species,n))) - else - density_dry(n) = sum(density_species(1:n_species,n)) / n_species - end if - - ! wet density - f_hg = max(diameter_wet(n) / diameter_dry(n), 1.0) ! hygroscopic growth factor - density_wet(n) = f_hg**(-3) * density_dry(n) + (1 - f_hg**(-3)) * density_water - end do - - ! coagulation - call MAML_Coagulation(pressure, & - temperature, & - density_air, & - qa_number, & - qa_mass, & - diameter_dry, & - diameter_wet, & - density_wet, & - coag_mode_sigma, & - coag_mode_species_number, & - coag_intermodal_transfer, & - mass2vol_aitken_age, & - mass2vol_pcarbon, & - cdt) - - ! update the number and mass mixing ratios - do n = 1, n_coag_modes - ! number of species in this mode - n_species = coag_mode_species_number(n) - - qa%r3(iq_nmr(n))%q(i,j,k) = qa_number(n) - - do s = 1, n_species - qa%r3(iq_mmr(s,n))%q(i,j,k) = qa_mass(s,n) - end do - end do - - end do ! k - - dz(:) = delp(i,j,:) / (MAPL_GRAV * rhoa(i,j,:)) - - end do ! i - end do ! j - - - ! Free dynamically allocated memory - ! --------------------------------- - deallocate(dz, __STAT__) - - deallocate(mass2vol_aitken_age, __STAT__) - deallocate(mass2vol_pcarbon, __STAT__) - - deallocate(density_dry, __STAT__) - deallocate(density_wet, __STAT__) - - deallocate(diameter_dry, __STAT__) - deallocate(diameter_wet, __STAT__) - - deallocate(qa_number, __STAT__) - deallocate(qa_mass, __STAT__) - - deallocate(iq_mmr, __STAT__) - deallocate(density_species, __STAT__) - - deallocate(iq_nmr, __STAT__) - deallocate(iq_dgn_dry, __STAT__) - deallocate(iq_dgn_wet, __STAT__) - - deallocate(coag_intermodal_transfer, __STAT__) - - deallocate(coag_mode_sigma, __STAT__) - - deallocate(coag_mode_index, __STAT__) - deallocate(coag_mode_species_number, __STAT__) - - end subroutine MAM_Coagulation - -#endif - -end module MAM_CoagulationMod diff --git a/MAMchem_GridComp/MAM_ComponentsDataMod.F90 b/MAMchem_GridComp/MAM_ComponentsDataMod.F90 deleted file mode 100644 index 58172b67..00000000 --- a/MAMchem_GridComp/MAM_ComponentsDataMod.F90 +++ /dev/null @@ -1,108 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_ComponentsDataMod - MAM chem/aerosol components properties -! -! !INTERFACE: -! - module MAM_ComponentsDataMod -! -! !USES: -! - - implicit NONE - private -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !DESCRIPTION: -! -! {\tt MAM\_ComponentsData} describes properties (density, hygroscopicity, etc.) -! of chem/aerosol components in MAM. -! -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - ! Component Names - ! --------------- - character(len=*), public, parameter :: MAM_WATER_COMPONENT_NAME = 'water' - character(len=*), public, parameter :: MAM_SULFATE_COMPONENT_NAME = 'sulfate' - character(len=*), public, parameter :: MAM_AMMONIUM_COMPONENT_NAME = 'ammonium' - character(len=*), public, parameter :: MAM_NITRATE_COMPONENT_NAME = 'nitrate' - character(len=*), public, parameter :: MAM_BLACK_CARBON_COMPONENT_NAME = 'black carbon' - character(len=*), public, parameter :: MAM_DUST_COMPONENT_NAME = 'dust' - character(len=*), public, parameter :: MAM_SEASALT_COMPONENT_NAME = 'seasalt' - character(len=*), public, parameter :: MAM_SOA_COMPONENT_NAME = 'secondary organic' - character(len=*), public, parameter :: MAM_POM_COMPONENT_NAME = 'primary organic' - - character(len=*), public, parameter :: MAM_H2O2_COMPONENT_NAME = 'hydrogen peroxide' - character(len=*), public, parameter :: MAM_H2SO4_COMPONENT_NAME = 'sulfuric acid' - character(len=*), public, parameter :: MAM_SO2_COMPONENT_NAME = 'sulfur dioxide' - character(len=*), public, parameter :: MAM_DMS_COMPONENT_NAME = 'dimethyl sulfide' - character(len=*), public, parameter :: MAM_NH3_COMPONENT_NAME = 'ammonia' - character(len=*), public, parameter :: MAM_SOA_GAS_COMPONENT_NAME = 'SOA gas' - - - ! Component Bulk Density, 'kg m-3' - ! -------------------------------- - real, public, parameter :: MAM_WATER_COMPONENT_DENSITY = 1000.0 - real, public, parameter :: MAM_SULFATE_COMPONENT_DENSITY = 1770.0 - real, public, parameter :: MAM_AMMONIUM_COMPONENT_DENSITY = 1770.0 - real, public, parameter :: MAM_BLACK_CARBON_COMPONENT_DENSITY = 1700.0 - real, public, parameter :: MAM_DUST_COMPONENT_DENSITY = 2600.0 - real, public, parameter :: MAM_SEASALT_COMPONENT_DENSITY = 1900.0 - real, public, parameter :: MAM_SOA_COMPONENT_DENSITY = 1000.0 - real, public, parameter :: MAM_POM_COMPONENT_DENSITY = 1000.0 - - - ! Component Molecular Weight, 'kg Kmol-1' - ! --------------------------------------- - real, public, parameter :: MAM_WATER_COMPONENT_MOLECULAR_WEIGHT = 18.0 - real, public, parameter :: MAM_SULFATE_COMPONENT_MOLECULAR_WEIGHT = 96.0 - real, public, parameter :: MAM_AMMONIUM_COMPONENT_MOLECULAR_WEIGHT = 18.0 - real, public, parameter :: MAM_NITRATE_COMPONENT_MOLECULAR_WEIGHT = 62.0 - real, public, parameter :: MAM_BLACK_CARBON_COMPONENT_MOLECULAR_WEIGHT = 12.0 - real, public, parameter :: MAM_DUST_COMPONENT_MOLECULAR_WEIGHT = 135.0 - real, public, parameter :: MAM_SEASALT_COMPONENT_MOLECULAR_WEIGHT = 58.5 - real, public, parameter :: MAM_SOA_COMPONENT_MOLECULAR_WEIGHT = 12.0 - real, public, parameter :: MAM_POM_COMPONENT_MOLECULAR_WEIGHT = 12.0 - - real, public, parameter :: MAM_H2O2_COMPONENT_MOLECULAR_WEIGHT = 34.0147 - real, public, parameter :: MAM_H2SO4_COMPONENT_MOLECULAR_WEIGHT = 98.07848 - real, public, parameter :: MAM_SO2_COMPONENT_MOLECULAR_WEIGHT = 64.064 - real, public, parameter :: MAM_DMS_COMPONENT_MOLECULAR_WEIGHT = 62.1324 - real, public, parameter :: MAM_NH3_COMPONENT_MOLECULAR_WEIGHT = 17.03052 - real, public, parameter :: MAM_SOA_GAS_COMPONENT_MOLECULAR_WEIGHT = 12.011 - - - - ! Component Hygroscopicity - ! ------------------------ - real, public, parameter :: MAM_SULFATE_COMPONENT_HYGROSCOPICITY = 0.507 - real, public, parameter :: MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY = 0.507 - real, public, parameter :: MAM_BLACK_CARBON_COMPONENT_HYGROSCOPICITY = 1e-10 - real, public, parameter :: MAM_DUST_COMPONENT_HYGROSCOPICITY = 0.068 - real, public, parameter :: MAM_SEASALT_COMPONENT_HYGROSCOPICITY = 1.16 - real, public, parameter :: MAM_SOA_COMPONENT_HYGROSCOPICITY = 0.14 - real, public, parameter :: MAM_POM_COMPONENT_HYGROSCOPICITY = 0.10 - - - ! Component Solubility - ! -------------------- - real, public, parameter :: MAM_SULFATE_COMPONENT_SOLUBILITY = 1.00 - real, public, parameter :: MAM_AMMONIUM_COMPONENT_SOLUBILITY = 1.00 - real, public, parameter :: MAM_BLACK_CARBON_COMPONENT_SOLUBILITY = 0.00 - real, public, parameter :: MAM_DUST_COMPONENT_SOLUBILITY = 0.20 - real, public, parameter :: MAM_SEASALT_COMPONENT_SOLUBILITY = 1.00 - real, public, parameter :: MAM_SOA_COMPONENT_SOLUBILITY = 0.05 - real, public, parameter :: MAM_POM_COMPONENT_SOLUBILITY = 0.05 - - end module MAM_ComponentsDataMod diff --git a/MAMchem_GridComp/MAM_ConstituentsDataMod.F90 b/MAMchem_GridComp/MAM_ConstituentsDataMod.F90 deleted file mode 100644 index f8eca4ac..00000000 --- a/MAMchem_GridComp/MAM_ConstituentsDataMod.F90 +++ /dev/null @@ -1,63 +0,0 @@ -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_ConstituentsDataMod - MAM chem/aerosol constituents -! -! !INTERFACE: -! - module MAM_ConstituentsDataMod -! -! !USES: -! - - implicit NONE - private -! -! !PUBLIC MEMBER FUNCTIONS: - -! -! !DESCRIPTION: -! -! {\tt MAM\_ConstituentsData} describes the chem/aerosol constituents in MAM. -! -! -! !REVISION HISTORY: -! -! 21Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - ! Number of Particles Name - ! ------------------------ - character(len=*), public, parameter :: MAM_NUMBER_PARTICLES_NAME = 'NUM' - - ! Absorbed Water Name - ! ------------------- - character(len=*), public, parameter :: MAM_ABSORBED_WATER_NAME = 'WTR' - - ! Constituent names - ! ----------------- - character(len=*), public, parameter :: MAM_SULFATE_CONSTITUENT_NAME = 'SU' - character(len=*), public, parameter :: MAM_AMMONIUM_CONSTITUENT_NAME = 'AMM' - character(len=*), public, parameter :: MAM_BLACK_CARBON_CONSTITUENT_NAME = 'BC' - character(len=*), public, parameter :: MAM_DUST_CONSTITUENT_NAME = 'DU' - character(len=*), public, parameter :: MAM_SEASALT_CONSTITUENT_NAME = 'SS' - character(len=*), public, parameter :: MAM_SOA_CONSTITUENT_NAME = 'SOA' - character(len=*), public, parameter :: MAM_POM_CONSTITUENT_NAME = 'POM' - - character(len=*), public, parameter :: MAM_H2SO4_CONSTITUENT_NAME = 'H2SO4' - character(len=*), public, parameter :: MAM_SO2_CONSTITUENT_NAME = 'SO2' - character(len=*), public, parameter :: MAM_NH3_CONSTITUENT_NAME = 'NH3' - character(len=*), public, parameter :: MAM_SOA_GAS_CONSTITUENT_NAME = 'SOA_GAS' - - - character(len=*), public, parameter :: MAM_SU_CONSTITUENT_NAME = MAM_SULFATE_CONSTITUENT_NAME - character(len=*), public, parameter :: MAM_AMM_CONSTITUENT_NAME = MAM_AMMONIUM_CONSTITUENT_NAME - character(len=*), public, parameter :: MAM_BC_CONSTITUENT_NAME = MAM_BLACK_CARBON_CONSTITUENT_NAME - character(len=*), public, parameter :: MAM_DU_CONSTITUENT_NAME = MAM_DUST_CONSTITUENT_NAME - character(len=*), public, parameter :: MAM_SS_CONSTITUENT_NAME = MAM_SEASALT_CONSTITUENT_NAME - - end module MAM_ConstituentsDataMod diff --git a/MAMchem_GridComp/MAM_DryRemovalMod.F90 b/MAMchem_GridComp/MAM_DryRemovalMod.F90 deleted file mode 100644 index 06b58933..00000000 --- a/MAMchem_GridComp/MAM_DryRemovalMod.F90 +++ /dev/null @@ -1,331 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_DryRemovalMod - Gravitational sedimentation and deposition -! of aerosol particles -! -! !INTERFACE: -! - module MAM_DryRemovalMod -! -! !USES: -! - use ESMF - use MAPL - - - use MAML_SettlingMod - use MAML_DryDepositionMod - use MAML_DryRemovalMod - - use MAM_BaseMod - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_DryRemoval - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - real, private, parameter :: pi = MAPL_PI - real, private, parameter :: density_water = MAPL_RHOWTR ! density of water, 'kg m-3' - - -! -! !DESCRIPTION: -! -! {\tt MAML\_DryRemovalMod} provides a collection of methods for -! modeling graviational sedimentation/settling and dry deposition -! of aerosol particles -! -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_DryRemoval --- -! -! !INTERFACE: - - subroutine MAM_DryRemoval(self, import, export, qa, Da, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: Da ! dry(geometric mean) and wet diameter - ! of number size distribution - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Gravitational sedimentation and dry deposition of aerosol particles. -! -! !REVISION HISTORY: -! -! 01Dec2011 A. Darmenov First crack. -! 21Dec2011 A. Darmenov Dry removal of aerosols. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_DryRemoval') - - ! Mode parameters - ! --------------- - real :: sigma - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - integer :: m, s - integer :: iq_dgn_dry, iq_dgn_wet - integer :: iq_nmr, iq_mmr - integer, pointer, dimension(:) :: iq_mmr_species - real, pointer, dimension(:) :: density_species, qa_species - - integer :: i, im, j, jm, k, km - - real :: flux_drydep - real :: density_air, temperature, pressure - real :: diameter_dry, density_dry - real :: diameter_wet, density_wet - - real :: f_hg - - real, pointer, dimension(:) :: vt_nmr, vt_mmr - real, pointer, dimension(:) :: dz - - real :: vd_nmr, vd_mmr - real :: r_a, r_b - real :: flux_sh - real :: friction_velocity - real :: viscosity_dyn, viscosity_kin - real :: free_mean_path, Kn, Cc, Dp, Sc, St - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: T - - real, pointer, dimension(:,:) :: SH - real, pointer, dimension(:,:) :: z0h - real, pointer, dimension(:,:) :: ustar - - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux - - - integer, parameter :: MOMENT_0 = 0 - integer, parameter :: MOMENT_3 = 3 - - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - call MAPL_GetPointer(import, SH, 'SH', __RC__) - call MAPL_GetPointer(import, z0h, 'Z0H', __RC__) - call MAPL_GetPointer(import, ustar, 'USTAR', __RC__) - - - ! Local dimensions - ! ---------------- - im = size(rhoa, 1) - jm = size(rhoa, 2) - km = size(rhoa, 3) - - - allocate(dz(km), __STAT__) - allocate(vt_nmr(km), __STAT__) - allocate(vt_mmr(km), __STAT__) - - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - sigma = sigma, & - n_species = n_species) - - ! aerosol dry and wet sizes - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - field_name = 'DGN_WET_' // trim(mode_name) - iq_dgn_wet = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - iq_nmr = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - ! buffers - allocate(iq_mmr_species(n_species), __STAT__) ! index of the species in the bundle - allocate(density_species(n_species), __STAT__) ! density of the species - allocate(qa_species(n_species), __STAT__) ! the mass mixing ratio of the species - - iq_mmr_species = -1 - qa_species = 0.0 - density_species = 0.0 - - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - iq_mmr_species(s) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - density_species(s) = self%mode(m)%species(s)%component%density - end do - - do j = 1, jm - do i = 1, im - - ! calculate the sedimentation velocities in the column - do k = 1, km - ! mid level pressure - pressure = (ple(i,j,k-1) + ple(i,j,k)) * 0.5 - temperature = T(i,j,k) - density_air = rhoa(i,j,k) - - ! aerosol size - diameter_dry = Da%r3(iq_dgn_dry)%q(i,j,k) - diameter_wet = Da%r3(iq_dgn_wet)%q(i,j,k) - - ! aerosol species mass mixing ratios - do s = 1, n_species - qa_species(s) = qa%r3(iq_mmr_species(s))%q(i,j,k) - end do - - ! dry density - if (any(qa_species > 1.0e-15)) then - density_dry = sum(qa_species) / sum(qa_species / density_species) - else - density_dry = sum(density_species)/n_species - end if - - ! wet density - f_hg = max(diameter_wet / diameter_dry, 1.0) ! hygroscopic growth factor - density_wet = f_hg**(-3) * density_dry + (1 - f_hg**(-3)) * density_water - - - ! calculate the settling velocity using the wet size and density - vt_nmr(k) = MAML_SettlingVelocity(pressure, temperature, & - diameter_wet, density_wet, sigma, MOMENT_0) - - vt_mmr(k) = MAML_SettlingVelocity(pressure, temperature, & - diameter_wet, density_wet, sigma, MOMENT_3) - end do ! k - - dz(:) = delp(i,j,:) / (MAPL_GRAV * rhoa(i,j,:)) - - ! compute deposition velocity - temperature = T(i,j,km) - density_air = rhoa(i,j,km) - flux_sh = SH(i,j) - friction_velocity = ustar(i,j) - diameter_wet = Da%r3(iq_dgn_wet)%q(i,j,km) - - viscosity_dyn = dynamic_viscosity_air(temperature) - viscosity_kin = kinematic_viscosity_air(temperature, density_air) - - free_mean_path = free_mean_path_air(pressure, temperature) - Kn = knudsen_number(free_mean_path, diameter_wet) - Cc = slip_flow_correction(Kn) - - Dp = particle_diffusion_coefficient(temperature, viscosity_dyn, Cc, diameter_wet) - Sc = schmidt_number(viscosity_kin, Dp) - St = stokes_number(vt_nmr(km), friction_velocity, viscosity_kin) - - r_b = quasi_laminar_resistance(friction_velocity, Sc, St) - r_a = aerodynamic_resistance(temperature, density_air, flux_sh, friction_velocity, dz(km), z0h(i,j)) - - vd_nmr = MAML_DepositionVelocity(vt_nmr(km), r_a, r_b) - vd_mmr = MAML_DepositionVelocity(vt_mmr(km), r_a, r_b) - - ! update the number mixing ratio in the column - call MAML_DryRemoval(qa%r3(iq_nmr)%q(i,j,:), delp(i,j,:), & - dz(:), & - vt_nmr(:), & - vd_nmr, & - cdt) - - ! update the mass mixing ratios in the column and save the mass flux - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - iq_mmr = iq_mmr_species(s) - - ! pointer to the sedimentation flux - field_name = 'DP_' // trim(species_name) // '_' // trim(mode_name) - - call MAPL_GetPointer(export, flux, field_name, __RC__) - - call MAML_DryRemoval(qa%r3(iq_mmr)%q(i,j,:), delp(i,j,:), & - dz(:), & - vt_mmr(:), & - vd_mmr, & - cdt, & - flux=flux_drydep) - - if (associated(flux)) then - flux(i,j) = flux_drydep - end if - end do - - end do ! i - end do ! j - - deallocate(iq_mmr_species, __STAT__) - deallocate(density_species, __STAT__) - deallocate(qa_species, __STAT__) - end do ! m - - - deallocate(vt_mmr, __STAT__) - deallocate(vt_nmr, __STAT__) - deallocate(dz, __STAT__) - - end subroutine MAM_DryRemoval - - -end module MAM_DryRemovalMod diff --git a/MAMchem_GridComp/MAM_DustMod.F90 b/MAMchem_GridComp/MAM_DustMod.F90 deleted file mode 100644 index eda96427..00000000 --- a/MAMchem_GridComp/MAM_DustMod.F90 +++ /dev/null @@ -1,525 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Data Assimilation Office, Code 610.1, GEOS/DAS ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_DustMod --- MAM dust processes and diagnostics -! -! !INTERFACE: -! - - module MAM_DustMod - -! !USES: - - USE ESMF - USE MAPL - - use Chem_ConstMod, only: grav - - use DustEmissionMod, only: MAM_DustEmissionGOCART, MAM_DustEmission - - use MAM_BaseMod - use MAM3_DataMod - use MAM7_DataMod - - implicit none - -! !PUBLIC TYPES: -! - PRIVATE - -! -! !PUBLIIC MEMBER FUNCTIONS: -! - - PUBLIC MAM_DU_Emission - PUBLIC MAM_DU_Diagnostics - -! -! !DESCRIPTION: -! -! This module implements MAM dust processes (emission, etc) and -! diagnostic fields -! -! !REVISION HISTORY: -! -! 07 Sep 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - -CONTAINS - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_DU_Emission --- The Emission Driver -! -! !INTERFACE: -! - - subroutine MAM_DU_Emission (self, import, export, qa, f_emiss, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - real, intent(in) :: f_emiss ! tuning parameter for the dust emissions - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the Dust Emissions Driver. That -! is, adds tendencies due to emission. -! -! !REVISION HISTORY: -! -! 07 Sep 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_DU_Emission' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i - integer :: ijl, ijkl - real :: qmin, qmax - real :: rUp, rLow - real, pointer, dimension(:,:) :: emission_total - real, pointer, dimension(:,:) :: emission_mass, emission_num - real, pointer, dimension(:,:) :: dqa_mass, dqa_num - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - real, dimension(MAM_MAX_NUMBER_MODES) :: d_cutoff_low - real, dimension(MAM_MAX_NUMBER_MODES) :: d_cutoff_up - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - character(len=ESMF_MAXSTR) :: emiss_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:) :: fsrc, oro, u10m, v10m - real, pointer, dimension(:,:) :: fraclake, gwettop - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Exports -! ----------------------- - real, pointer, dimension(:,:) :: emission - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_DU_EMISSION_MODE_ID) - - mode(1:nmodes) = MAM7_DU_EMISSION_MODE_ID - d_cutoff_low(1:nmodes) = MAM7_DU_EMISSION_D_CUTOFF_LOW - d_cutoff_up(1:nmodes) = MAM7_DU_EMISSION_D_CUTOFF_UP - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_DU_EMISSION_MODE_ID) - - mode(1:nmodes) = MAM3_DU_EMISSION_MODE_ID - d_cutoff_low(1:nmodes) = MAM3_DU_EMISSION_D_CUTOFF_LOW - d_cutoff_up(1:nmodes) = MAM3_DU_EMISSION_D_CUTOFF_UP - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, fsrc, 'GINOUX_DU', __RC__) - call MAPL_GetPointer(import, oro, 'LWI', __RC__) - call MAPL_GetPointer(import, u10m, 'U10M', __RC__) - call MAPL_GetPointer(import, v10m, 'V10M', __RC__) - call MAPL_GetPointer(import, fraclake, 'FRLAKE', __RC__) - call MAPL_GetPointer(import, gwettop, 'WET1', __RC__) - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(before)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') - call write_parallel(f_emiss, format='(("emiss factor = ", (F5.3)))') - - call pmaxmin('DU: fsrc ', fsrc, qmin, qmax, ijl, k1, 1.) - call pmaxmin('DU: oro ', oro, qmin, qmax, ijl, k1, 1.) - call pmaxmin('DU: u10m ', u10m, qmin, qmax, ijl, k1, 1.) - call pmaxmin('DU: v10m ', v10m, qmin, qmax, ijl, k1, 1.) - call pmaxmin('DU: fraclake ', fraclake, qmin, qmax, ijl, k1, 1.) - call pmaxmin('DU: gwettop ', gwettop, qmin, qmax, ijl, k1, 1.) - - call pmaxmin('DU: rhoa ', rhoa, qmin, qmax, ijl, km, 1.) - call pmaxmin('DU: ple ', ple, qmin, qmax, ijl, km, 1.) - call pmaxmin('DU: delp ', delp, qmin, qmax, ijl, km, 1.) -#endif - -! Dust Emissions -! -------------- - allocate(emission_total(i1:i2,j1:j2), __STAT__) - allocate(emission_mass(i1:i2,j1:j2), __STAT__) - allocate(emission_num(i1:i2,j1:j2), __STAT__) - allocate(dqa_mass(i1:i2,j1:j2), __STAT__) - allocate(dqa_num(i1:i2,j1:j2), __STAT__) - - - emission_total = 0.0 - call MAM_DustEmissionGOCART(i1, i2, j1, j2, km, & - fraclake, gwettop, oro, u10m, v10m, & - emission_total, rc) - - ! apply the dust emission tuning coefficient [kg s2 m-5] and Ginoux dust source function - emission_total = (f_emiss * 1e-9) * fsrc * emission_total - - do n = 1, nmodes - mmr_name = 'DU_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - emiss_name = 'DUEM' // trim(mode_name(n)) ! name of the emission export - - rLow = d_cutoff_low(n) / 2 ! [m] - rUp = d_cutoff_up(n) / 2 ! [m] - - emission_num = 0.0 - emission_mass = 0.0 - - call MAM_DustEmission(i1, i2, j1, j2, km, & - rLow, rUp, & - emission_total, & - emission_mass, emission_num, rc) - - emission_mass = emission_mass - emission_num = emission_num - -#ifdef DEBUG - call pmaxmin('DU: emission_total ', emission_total, qmin, qmax, ijl, 1, 1.) - - call write_parallel('DU: mode ' // trim(mode_name(n))) - call pmaxmin('DU: emission_mass ', emission_mass, qmin, qmax, ijl, 1, 1.) - call pmaxmin('DU: emission_number', emission_num, qmin, qmax, ijl, 1, 1.) -#endif - - dqa_mass = emission_mass * cdt * grav / delp(:,:,km) - dqa_num = emission_num * cdt * grav / delp(:,:,km) - - ! update the mass and number mixing ratios due to emission - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_mass - - i = MAPL_SimpleBundleGetIndex(qa, nmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_num - - call MAPL_GetPointer(export, emission, emiss_name, __RC__) - if (associated(emission)) then - emission = emission_mass - endif - end do - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(after)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -! Clean up -! -------- - deallocate(emission_total, __STAT__) - deallocate(emission_mass, __STAT__) - deallocate(emission_num, __STAT__) - deallocate(dqa_mass, __STAT__) - deallocate(dqa_num, __STAT__) - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_DU_Emission - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_DU_Diagnostics --- The Diagnostics Driver -! -! !INTERFACE: -! - - subroutine MAM_DU_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine calculates a number of diagnostic fields. -! -! !REVISION HISTORY: -! -! 13 Oct 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_DU_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i, k - integer :: ijl, ijkl - real :: qmin, qmax - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: u, v - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: sfcmass ! surface mass concentration, kg m-3 - real, pointer, dimension(:,:) :: sfcmass25 ! surface PM2.5 mass concentration, kg m-3 - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - real, pointer, dimension(:,:) :: colmass25 ! column integrated PM2.5 mass density, kg m-2 - - real, pointer, dimension(:,:) :: fluxu ! Column mass flux in x direction - real, pointer, dimension(:,:) :: fluxv ! Column mass flux in y direction - - real, pointer, dimension(:,:,:) :: conc ! mass concentration, kg m-3 - real, pointer, dimension(:,:,:) :: mass ! mass mixing ratio, kg kg-1 - real, pointer, dimension(:,:,:) :: mass25 ! PM2.5 mass mixing ratio, kg kg-1 - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_DU_EMISSION_MODE_ID) - mode(1:nmodes) = MAM7_DU_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_DU_EMISSION_MODE_ID) - mode(1:nmodes) = MAM3_DU_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, u, 'U', __RC__) - call MAPL_GetPointer(import, v, 'V', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, sfcmass, 'DUSMASS', __RC__) - call MAPL_GetPointer(export, sfcmass25, 'DUSMASS25', __RC__) - call MAPL_GetPointer(export, colmass, 'DUCMASS', __RC__) - call MAPL_GetPointer(export, colmass25, 'DUCMASS25', __RC__) - - call MAPL_GetPointer(export, fluxu, 'DUFLUXU', __RC__) - call MAPL_GetPointer(export, fluxv, 'DUFLUXV', __RC__) - - call MAPL_GetPointer(export, conc, 'DUCONC', __RC__) - call MAPL_GetPointer(export, mass, 'DUMASS', __RC__) - call MAPL_GetPointer(export, mass25, 'DUMASS25', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - -! Initialize diagnostic fields -! ---------------------------- - if (associated(sfcmass)) sfcmass = 0.0 - if (associated(sfcmass25)) sfcmass25 = 0.0 - if (associated(colmass)) colmass = 0.0 - if (associated(colmass25)) colmass25 = 0.0 - - if (associated(fluxu)) fluxu = 0.0 - if (associated(fluxv)) fluxv = 0.0 - - if (associated(conc)) conc = 0.0 - if (associated(mass)) mass = 0.0 - if (associated(mass25)) mass25 = 0.0 - - -! Calculate diagnostic fields -! --------------------------- - do n = 1, nmodes - mmr_name = 'DU_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - - - if (associated(sfcmass)) then - sfcmass(:,:) = sfcmass(:,:) + qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(sfcmass25)) then ! placeholder for now - sfcmass25(:,:) = sfcmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(colmass25)) then ! placeholder for now - do k = 1, km - colmass25(:,:) = colmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxu)) then - do k = 1, km - fluxu(:,:) = fluxu(:,:) + u(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxv)) then - do k = 1, km - fluxv(:,:) = fluxv(:,:) + v(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(conc)) then - conc = conc + qa%r3(i)%q * rhoa - end if - - if (associated(mass)) then - mass = mass + qa%r3(i)%q - end if - - if (associated(mass25)) then ! placeholder for now - mass25 = mass25 + 0.0 * qa%r3(i)%q - end if - - end do - - -! Clean up -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_DU_Diagnostics - - - end module MAM_DustMod diff --git a/MAMchem_GridComp/MAM_GasAerosolExchangeMod.F90 b/MAMchem_GridComp/MAM_GasAerosolExchangeMod.F90 deleted file mode 100644 index d370dd14..00000000 --- a/MAMchem_GridComp/MAM_GasAerosolExchangeMod.F90 +++ /dev/null @@ -1,656 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_gasAerosolExchange - Gas condensation on aerosol particles -! -! -! !INTERFACE: -! - module MAM_GasAerosolExchangeMod -! -! !USES: -! - - use ESMF - - use MAPL - -! use MAML_GasAerosolExchangeMod - - use MAM_ConstituentsDataMod - use MAM_ComponentsDataMod - - use MAM3_DataMod - use MAM7_DataMod - - use MAM_BaseMod - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_GasAerosolExchange - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - -! -! !DESCRIPTION: -! -! {\tt MAM\_GasAerosolEchangeMod} provides methods for computing the ... -! rates and changes of number and mass mixing ratios. -! -! -! !REVISION HISTORY: -! -! 29Jun2012 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_GasAerosolExchange --- models ... -! -! -! !INTERFACE: - - subroutine MAM_GasAerosolExchange(self, qa, qc, qg, Da, import, export, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio of interstitial aerosols - type(MAPL_SimpleBundle), intent(inout) :: qc ! number/mass mixing ratio of cloud-borne aerosols - type(MAPL_SimpleBundle), intent(inout) :: qg ! mixing ratio of gas species - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: Da ! dry(geometric mean) and wet diameter - ! of number size distribution - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Nucleation: -! - MAM7 and MAM3 schemes model gas aerosol exchange ... -! -! !REVISION HISTORY: -! -! 29Jun2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_GasAerosolExchange') -#ifdef WORK_IN_PROGRESS - - ! Mode parameters - ! --------------- - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - ! indexes - integer :: i, im, j, jm, k, km - integer :: s, m - - real :: temperature ! local temperature - real :: pressure ! local mid-level pressure - real :: density_air ! local air density - real :: rel_humidity ! local RH - real :: z ! local mid-level height - real :: f_cld ! local cloud fraction - - real :: qg_h2so4 ! H2SO4 volume mixing ratio - real :: qg_nh3 ! NH3 volume mixing ratio - real :: qg_soag ! SOA(gas) volume mixing ratio - - integer :: n_modes ! number of aerosol modes - integer :: n_species ! number of species in a mode - integer :: n_max_species ! largest number of species - - integer :: iq_h2so4 ! index of the H2SO4 volume mixing ratio - integer :: iq_nh3 ! index of the NH3 volume mixing ratio - integer :: iq_soag ! index of the SOA(gas) volume mixing ratio - - -!! integer, dimension(:,:), allocatable :: id_species ! IDs of species in aerosol modes -!! integer, dimension(:), allocatable :: id_mode ! IDs of modes -!! -!! real, dimension(:), allocatable :: qa_number ! interstitial aerosols - number mixing ratio -!! real, dimension(:,:), allocatable :: qa_mass ! - mass mixing ratio -!! -!! real, dimension(:), allocatable :: qc_number ! cloud-borne aerosols - number mixing ratio -!! real, dimension(:,:), allocatable :: qc_mass ! mass mixing ratio -!! -!! real, dimension(:), allocatable :: D_dry ! dry size (geometric mean diameter of number size distribution) -!! real, dimension(:), allocatable :: D_wet ! wet size - - -#if (0) - real :: dq_h2so4_gasprod ! H2SO4 - real :: dq_h2so4_aeruptk ! H2SO4 - - integer :: ait_index ! index of the Aitken mode - integer :: acc_index ! index of the accumulation mode - - integer :: iq_dgn_dry = 0 ! index of the Aitken mode dry diameter - integer :: iq_number = 0 ! index of the Aitken mode number mixing ratio - integer :: iq_amm = 0 ! index of the Aitken mode ammonium aerosol mass mixing ratio - integer :: iq_su = 0 ! index of the Aitken mode sulfate aerosol mass mixing ratio - integer :: iq_h2so4 = 0 ! index of the H2SO4 volume mixing ratio - integer :: iq_nh3 = 0 ! index of the NH3 volume mixing ratio - - logical :: do_nh3 ! - - ! other derived variables - real, allocatable, dimension(:) :: dz -#endif - - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: zle - real, pointer, dimension(:,:,:) :: T - real, pointer, dimension(:,:,:) :: rh - real, pointer, dimension(:,:,:) :: fcld - real, pointer, dimension(:,:) :: zpbl - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux - - ! Parameters - ! ---------- -#if (0) - real, parameter :: mw_su = MAM_SULFATE_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: mw_amm = MAM_AMMONIUM_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: mw_soa = MAM_SOA_COMPONENT_MOLECULAR_WEIGHT - - real, parameter :: mw_h2so4 = MAM_H2SO4_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: mw_nh3 = MAM_NH3_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: mw_soag = MAM_SOA_GAS_COMPONENT_MOLECULAR_WEIGHT -#endif - - - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, zle, 'ZLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - call MAPL_GetPointer(import, rh, 'RH2', __RC__) - call MAPL_GetPointer(import, fcld, 'FCLD', __RC__) - call MAPL_GetPointer(import, zpbl, 'ZPBL', __RC__) - - ! Local dimensions - ! ---------------- - im = size(rhoa, 1) - jm = size(rhoa, 2) - km = size(rhoa, 3) - - -#ifdef CAM - ! - ! init ------------------------------- - ! - ! - - ! define "from mode" and "to mode" for primary carbon aging - ! - ! skip (turn off) aging if either is absent, - ! or if accum mode so4 is absent - ! - modefrm_pcage = -999888777 - modetoo_pcage = -999888777 - - if ((modeptr_pcarbon <= 0) .or. (modeptr_accum <= 0)) goto 15000 - - l = lptr_so4_a_amode(modeptr_accum) - if ((l < 1) .or. (l > pcnst)) goto 15000 - - modefrm_pcage = modeptr_pcarbon - modetoo_pcage = modeptr_accum - - ! - ! define species involved in each primary carbon aging pairing - ! (include aerosol water) - ! - ! - mfrm = modefrm_pcage - mtoo = modetoo_pcage - - nspec = 0 - aa_iqfrm: do iqfrm = -1, nspec_amode(mfrm) - - if (iqfrm == -1) then - lsfrm = numptr_amode(mfrm) - lstoo = numptr_amode(mtoo) - else if (iqfrm == 0) then - ! bypass transfer of aerosol water due to primary-carbon aging - cycle aa_iqfrm - ! lsfrm = lwaterptr_amode(mfrm) - ! lstoo = lwaterptr_amode(mtoo) - else - lsfrm = lmassptr_amode(iqfrm,mfrm) - lstoo = 0 - end if - - if ((lsfrm < 1) .or. (lsfrm > pcnst)) cycle aa_iqfrm - - if (lsfrm>0 .and. iqfrm>0 ) then - ! find "too" species having same lspectype_amode as the "frm" species - do iqtoo = 1, nspec_amode(mtoo) - if ( lspectype_amode(iqtoo,mtoo) .eq. lspectype_amode(iqfrm,mfrm) ) then - lstoo = lmassptr_amode(iqtoo,mtoo) - exit - end if - end do - end if - - if ((lstoo < 1) .or. (lstoo > pcnst)) lstoo = 0 - nspec = nspec + 1 - lspecfrm_pcage(nspec) = lsfrm - lspectoo_pcage(nspec) = lstoo - end do aa_iqfrm - - nspecfrm_pcage = nspec - - -15000 continue - - ! set gas species indices - call cnst_get_ind( 'H2SO4', l_so4g, .false. ) - call cnst_get_ind( 'NH3', l_nh4g, .false. ) - call cnst_get_ind( 'MSA', l_msag, .false. ) - call cnst_get_ind( 'SOAG', l_soag, .false. ) - - if ((l_so4g <= 0) .or. (l_so4g > pcnst)) then - write( *, '(/a/a,2i7)' ) & - '*** modal_aero_gasaerexch_init -- cannot find H2SO4 species', & - ' l_so4g=', l_so4g - call endrun( 'modal_aero_gasaerexch_init error' ) - end if - - do_nh4g = .false. - do_msag = .false. - do_soag = .false. - - if ((l_nh4g > 0) .and. (l_nh4g <= pcnst)) do_nh4g = .true. - if ((l_msag > 0) .and. (l_msag <= pcnst)) do_msag = .true. - if ((l_soag > 0) .and. (l_soag <= pcnst)) do_soag = .true. - - - ! set tendency flags - dotend(:) = .false. - dotend(l_so4g) = .true. - - if ( do_nh4g ) dotend(l_nh4g) = .true. - if ( do_msag ) dotend(l_msag) = .true. - if ( do_soag ) dotend(l_soag) = .true. - - do n = 1, ntot_amode - l = lptr_so4_a_amode(n) - if ((l > 0) .and. (l <= pcnst)) then - dotend(l) = .true. - - if ( do_nh4g ) then - l = lptr_nh4_a_amode(n) - - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - end if - end if - - l = lptr_soa_a_amode(n) - if ((l > 0) .and. (l <= pcnst)) then - dotend(l) = .true. - end if - end do - - if (modefrm_pcage > 0) then - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq) - lstoo = lspectoo_pcage(iq) - - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - - end if - end do - end if - - - ! define history fields for aitken-->accum renaming - dotend(:) = .false. - dotendqqcw(:) = .false. - - do ipair = 1, npair_renamexf - do iq = 1, nspecfrm_renamexf(ipair) - - lsfrm = lspecfrma_renamexf(iq,ipair) - lstoo = lspectooa_renamexf(iq,ipair) - - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - - lsfrm = lspecfrmc_renamexf(iq,ipair) - lstoo = lspectooc_renamexf(iq,ipair) - - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotendqqcw(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotendqqcw(lstoo) = .true. - end if - end if - - end do ! iq = ... - end do ! ipair = ... - - - ! calculate soa_equivso4_factor - ! if do_soag == .false., then set it to zero as a safety measure - soa_equivso4_factor = 0.0 - - if ( do_soag ) then - tmp1 = -1.0 ; tmp2 = -1.0 - - do l = 1, ntot_aspectype - if (specname_amode(l) == 's-organic') tmp1 = spechygro(l) - if (specname_amode(l) == 'sulfate' ) tmp2 = spechygro(l) - end do - - if ((tmp1 > 0.0_r8) .and. (tmp2 > 0.0_r8)) then - soa_equivso4_factor = tmp1/tmp2 - else - write(*,'(a/a,1p,2e10.2)') '*** subr modal_aero_gasaerexch_init', & - ' cannot find hygros - tmp1/2 =', tmp1, tmp2 - call endrun() - end if - end if - - - ! - ! run ------------------------------------------ - ! - - call cnst_get_ind( 'H2SO4', l_so4g, .false. ) - call cnst_get_ind( 'NH3', l_nh4g, .false. ) - call cnst_get_ind( 'MSA', l_msag, .false. ) - call cnst_get_ind( 'SOAG', l_soag, .false. ) - - l_so4g = l_so4g - loffset - l_nh4g = l_nh4g - loffset - l_msag = l_msag - loffset - l_soag = l_soag - loffset - - if ((l_so4g <= 0) .or. (l_so4g > pcnstxx)) then - write( *, '(/a/a,2i7)' ) '*** modal_aero_gasaerexch_sub -- cannot find H2SO4 species', & - ' l_so4g, loffset =', l_so4g, loffset - call endrun( 'modal_aero_gasaerexch_sub error' ) - end if - - do_nh4g = .false. - do_msag = .false. - - if ((l_nh4g > 0) .and. (l_nh4g <= pcnstxx)) do_nh4g = .true. - if ((l_msag > 0) .and. (l_msag <= pcnstxx)) do_msag = .true. - - do_soag = .false. - - if ((method_soa == 1) .or. (method_soa == 2)) then - if ((l_soag > 0) .and. (l_soag <= pcnstxx)) do_soag = .true. - else if (method_soa /= 0) then - write(*,'(/a,1x,i10)') '*** modal_aero_gasaerexch_sub - bad method_soa =', method_soa - call endrun( 'modal_aero_gasaerexch_sub error' ) - end if - - ! set tendency flags - dotend(:) = .false. - dotendqqcw(:) = .false. - ido_so4a(:) = 0 - ido_nh4a(:) = 0 - ido_soaa(:) = 0 - - dotend(l_so4g) = .true. - if ( do_nh4g ) dotend(l_nh4g) = .true. - if ( do_msag ) dotend(l_msag) = .true. - if ( do_soag ) dotend(l_soag) = .true. - - ntot_soamode = 0 - do n = 1, ntot_amode - - l = lptr_so4_a_amode(n)-loffset - - if ((l > 0) .and. (l <= pcnstxx)) then - - dotend(l) = .true. - ido_so4a(n) = 1 - - if ( do_nh4g ) then - l = lptr_nh4_a_amode(n)-loffset - if ((l > 0) .and. (l <= pcnstxx)) then - dotend(l) = .true. - ido_nh4a(n) = 1 - end if - end if - end if - - if ( do_soag ) then - - l = lptr_soa_a_amode(n)-loffset - - if ((l > 0) .and. (l <= pcnstxx)) then - dotend(l) = .true. - ido_soaa(n) = 1 - ntot_soamode = n - end if - end if - end do - - if ( do_soag ) ntot_soamode = max( ntot_soamode, modefrm_pcage ) - - if (modefrm_pcage > 0) then - ido_so4a(modefrm_pcage) = 2 - - if (ido_nh4a(modetoo_pcage) == 1) ido_nh4a(modefrm_pcage) = 2 - if (ido_soaa(modetoo_pcage) == 1) ido_soaa(modefrm_pcage) = 2 - - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq)-loffset - lstoo = lspectoo_pcage(iq)-loffset - - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - - dotend(lsfrm) = .true. - - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - end do - end if -#endif - - ! Find the number of modes - ! ------------------------ - n_modes = self%n_modes - - - ! Find the largest number of aerosol species in a single mode - ! ----------------------------------------------------------- - n_max_species = 0 - do m = 1, n_modes - call MAM_AerosolModeGet(self%mode(m), n_species=n_species) - n_max_species = max(n_max_species, n_species) - end do - - - ! Allocate memory for the buffers -!! allocate(qa_number(n_modes), __STAT__) ! number mixing ratio of interstitial aerosols -!! allocate(qc_number(n_modes), __STAT__) ! number mixing ratio of cloud-borne aerosols -!! -!! allocate(D_dry(n_modes), __STAT__) ! dry size - geometric mean diameter of number size distribution -!! allocate(D_wet(n_modes), __STAT__) ! wet size -!! -!! allocate(qa_mass(n_max_species,n_modes), __STAT__) ! -!! allocate(qc_mass(n_max_species,n_modes), __STAT__) ! -!! -!! allocate(id_species(n_max_species,n_modes), __STAT__) ! -!! allocate(id_mode(n_modes), __STAT__) - -#if (0) - ! Find aitken and accumulation modes - ! ---------------------------------- - - mode_name_ait = '' - mode_name_acc = '' - - if (self%id == MAM7_MODEL) then - mode_name_ait = trim(MAM7_AITKEN_MODE_NAME) - mode_name_acc = trim(MAM7_ACCUMULATION_MODE_NAME) - else if (self%id == MAM3_MODEL) then - mode_name_ait = trim(MAM3_AITKEN_MODE_NAME) - mode_name_acc = trim(MAM3_ACCUMULATION_MODE_NAME) - else - return - end if -#endif - - - - ! Find the indexes of the gas species - ! ----------------------------------- - field_name = trim(MAM_H2SO4_CONSTITUENT_NAME) - iq_h2so4 = MAPL_SimpleBundleGetIndex(qg, field_name, 3, __RC__) - - field_name = trim(MAM_NH3_CONSTITUENT_NAME) - iq_nh3 = MAPL_SimpleBundleGetIndex(qg, field_name, 3, __RC__) - - field_name = trim(MAM_NH3_CONSTITUENT_NAME) - iq_soag = MAPL_SimpleBundleGetIndex(qg, field_name, 3, __RC__) - - - ! Gas-aerosol exchange - ! -------------------- - do j = 1, jm - do i = 1, im - - do k = 1, km - - ! mid level pressure, temperature and air density - pressure = 0.5 * (ple(i,j,k-1) + ple(i,j,k)) - z = 0.5 * (zle(i,j,k-1) + zle(i,j,k)) - - temperature = T(i,j,k) - density_air = rhoa(i,j,k) - rel_humidity = rh(i,j,k) - - ! aerosol dry size - diameter_dry = Da%r3(iq_dgn_dry)%q(i,j,k) - - ! aerosol species mass mixing ratios - q_number = qa%r3(iq_number)%q(i,j,k) - q_amm = qa%r3(iq_amm)%q(i,j,k) - q_su = qa%r3(iq_su)%q(i,j,k) - - q_h2so4 = qg%r3(iq_h2so4)%q(i,j,k) - q_nh3 = qg%r3(iq_nh3)%q(i,j,k) - - dq_h2so4_gasprod = 0.0 - dq_h2so4_aeruptk = 0.0 - - do_nh3 = .true. - -#if(0) - ! gas-aerosol exchange - MAML_GasAerosolExchange(pressure, & - temperature, & - density_air, & - rel_humidity, & - f_cld, & - z, & - pbl_height, & - q_number, & - q_nh4, & - q_so4, & - q_h2so4, & - q_nh3, & - do_nh3, & - do_nh4g, & - do_msag, & - do_soag, & - Dg, & - Dg_min, & - Dg_max, & - density_so4, & - mw_so4a, & - mw_nh4a, & - dq_h2so4_gasprod, & - dq_h2so4_aeruptk, & - cdt) - - ! update the number and mass mixing ratios - qa%r3(iq_number)%q(i,j,k) = q_number - - qa%r3(iq_amm)%q(i,j,k) = q_amm - qa%r3(iq_su)%q(i,j,k) = q_su - - qg%r3(iq_h2so4)%q(i,j,k) = q_h2so4 - qg%r3(iq_nh3)%q(i,j,k) = q_nh3 - - end do ! k -#endif - - end do ! i - end do ! j -#endif - end subroutine MAM_GasAerosolExchange - - -end module MAM_GasAerosolExchangeMod - diff --git a/MAMchem_GridComp/MAM_NucleationMod.F90 b/MAMchem_GridComp/MAM_NucleationMod.F90 deleted file mode 100644 index da2abc2c..00000000 --- a/MAMchem_GridComp/MAM_NucleationMod.F90 +++ /dev/null @@ -1,379 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_NucleationMod - Nucleation (formation and growth) of new -! aerosol particles -! -! !INTERFACE: -! - module MAM_NucleationMod -! -! !USES: -! - - use ESMF - - use MAPL - - use MAML_NucleationMod - - use MAM_ConstituentsDataMod - use MAM_ComponentsDataMod - - use MAM3_DataMod - use MAM7_DataMod - - use MAM_BaseMod - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_Nucleation - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - -! -! !DESCRIPTION: -! -! {\tt MAM\_NucleationMod} provides methods for computing the nucleation -! rates and changes of number and mass mixing ratios. -! -! -! !REVISION HISTORY: -! -! 27Jan2012 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_Nucleation --- models the nucleation of Aitken mode -! -! -! !INTERFACE: - - subroutine MAM_Nucleation(self, import, export, qa, qg, Da, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio - type(MAPL_SimpleBundle), intent(inout) :: qg ! gas mixing ratio - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: Da ! dry(geometric mean) and wet diameter - ! of number size distribution - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Nucleation: -! - MAM7 scheme models nucleation by treating ... -! - MAM3 scheme ... -! -! !REVISION HISTORY: -! -! 09Jan2012 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_Nucleation') - - - ! Mode parameters - ! --------------- - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - ! indexes - integer :: i, im, j, jm, k, km - - real :: temperature ! local temperature - real :: pressure ! local mid-level pressure - real :: density_air ! local air density - real :: rel_humidity ! local RH - real :: z ! local mid-level height - real :: f_cld ! local cloud fraction - real :: pbl_height ! PBL height - - real :: diameter_dry ! local Aitken mode dry size - real :: diameter_dry_min, diameter_dry_max ! Aitken mode dry size limits - - real :: q_number ! local number mixing ratio - real :: q_amm ! local ammonium mass mixing ratio - real :: q_su ! local sulfate mass mixing ratio - real :: q_h2so4 ! local H2SO4 volume mixing ratio - real :: q_nh3 ! local NH3 volume mixing ratio - - real :: dq_h2so4_gasprod ! H2SO4 - real :: dq_h2so4_aeruptk ! H2SO4 - - integer :: ait_index = 0 ! index of the Aitken mode - integer :: iq_dgn_dry = 0 ! index of the Aitken mode dry diameter - integer :: iq_number = 0 ! index of the Aitken mode number mixing ratio - integer :: iq_amm = 0 ! index of the Aitken mode ammonium aerosol mass mixing ratio - integer :: iq_su = 0 ! index of the Aitken mode sulfate aerosol mass mixing ratio - integer :: iq_h2so4 = 0 ! index of the H2SO4 volume mixing ratio - integer :: iq_nh3 = 0 ! index of the NH3 volume mixing ratio - - logical :: do_nh3 - - - ! other derived variables - real, allocatable, dimension(:) :: dz - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: zle - real, pointer, dimension(:,:,:) :: T - real, pointer, dimension(:,:,:) :: rh - real, pointer, dimension(:,:,:) :: fcld - real, pointer, dimension(:,:) :: zpbl - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux - - ! Parameters - ! ---------- - real, parameter :: mw_su = MAM_SULFATE_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: mw_amm = MAM_AMMONIUM_COMPONENT_MOLECULAR_WEIGHT - real, parameter :: density_su = MAM_SULFATE_COMPONENT_DENSITY - - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, zle, 'ZLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - call MAPL_GetPointer(import, rh, 'RH2', __RC__) - call MAPL_GetPointer(import, fcld, 'FCLD', __RC__) - call MAPL_GetPointer(import, zpbl, 'ZPBL', __RC__) - - ! Local dimensions - ! ---------------- - im = size(rhoa, 1) - jm = size(rhoa, 2) - km = size(rhoa, 3) - - -#ifdef CAM - ! - ! init ------------------------------- - ! - - mait = modeptr_aitken - - if (mait > 0) then - lnumait = numptr_amode(mait) - lso4ait = lptr_so4_a_amode(mait) - lnh4ait = lptr_nh4_a_amode(mait) - end if - - if ((l_h2so4 <= 0) .or. (l_h2so4 > pcnst)) then - write(*,'(/a/)') '*** modal_aero_newnuc bypass -- l_h2so4 <= 0' - return - else if ((lso4ait <= 0) .or. (lso4ait > pcnst)) then - write(*,'(/a/)') '*** modal_aero_newnuc bypass -- lso4ait <= 0' - return - else if ((lnumait <= 0) .or. (lnumait > pcnst)) then - write(*,'(/a/)') '*** modal_aero_newnuc bypass -- lnumait <= 0' - return - else if ((mait <= 0) .or. (mait > ntot_amode)) then - write(*,'(/a/)') '*** modal_aero_newnuc bypass -- modeptr_aitken <= 0' - return - end if - - ! - ! run ------------------------------------------ - ! - - ! skip if no aitken mode OR if no h2so4 species - if ((l_h2so4 <= 0) .or. (lso4ait <= 0) .or. (lnumait <= 0)) then - return - end if - - lnh4ait = lptr_nh4_a_amode(mait) - loffset - if ((l_nh3 > 0) .and. (l_nh3 <= pcnst) .and. & - (lnh4ait > 0) .and. (lnh4ait <= pcnst)) then - do_nh3 = .true. - dotend(lnh4ait) = .true. - dotend(l_nh3) = .true. - else - do_nh3 = .false. - end if -#endif - - ! Find the nucleation mode - ! ------------------------ - - mode_name = '' - - if (self%id == MAM7_SCHEME) then - mode_name = trim(MAM7_AITKEN_MODE_NAME) - else if (self%id == MAM3_SCHEME) then - mode_name = trim(MAM3_AITKEN_MODE_NAME) - else - return - end if - - - ait_index = 0 - ait_index = MAM_SchemeGetModeIndex(self, trim(mode_name), __RC__) - - call MAM_AerosolModeGet(self%mode(ait_index), size_min = diameter_dry_min, & - size_max = diameter_dry_max, & - n_species = n_species) - - - ! find the indexes of the aerosol species - ! --------------------------------------- - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - field_name = trim(MAM_NUMBER_PARTICLES_NAME) // '_A_' // trim(mode_name) - iq_number = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - field_name = trim(MAM_AMMONIUM_CONSTITUENT_NAME) // '_A_' // trim(mode_name) - iq_amm = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - field_name = trim(MAM_SULFATE_CONSTITUENT_NAME) // '_A_' // trim(mode_name) - iq_su = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - - ! find the indexes of the gas species - ! ----------------------------------- - field_name = trim(MAM_H2SO4_CONSTITUENT_NAME) - iq_h2so4 = MAPL_SimpleBundleGetIndex(qg, field_name, 3, __RC__) - - field_name = trim(MAM_NH3_CONSTITUENT_NAME) - iq_nh3 = MAPL_SimpleBundleGetIndex(qg, field_name, 3, __RC__) - - - - ! nucleation calculation and column integrated number flux due to it - allocate(dz(km), __STAT__) - - do j = 1, jm - do i = 1, im - - do k = 1, km - - ! mid level pressure, temperature and air density - pressure = 0.5 * (ple(i,j,k-1) + ple(i,j,k)) - z = 0.5 * (zle(i,j,k-1) + zle(i,j,k)) - - temperature = T(i,j,k) - density_air = rhoa(i,j,k) - rel_humidity = rh(i,j,k) - pbl_height = zpbl(i,j) - - ! aerosol dry size - diameter_dry = Da%r3(iq_dgn_dry)%q(i,j,k) - - ! aerosol species mass mixing ratios - q_number = qa%r3(iq_number)%q(i,j,k) - q_amm = qa%r3(iq_amm)%q(i,j,k) - q_su = qa%r3(iq_su)%q(i,j,k) - - q_h2so4 = qg%r3(iq_h2so4)%q(i,j,k) - q_nh3 = qg%r3(iq_nh3)%q(i,j,k) - - dq_h2so4_gasprod = 0.0 - dq_h2so4_aeruptk = 0.0 - - do_nh3 = .true. - - ! nucleation - call MAML_Nucleation(pressure, & - temperature, & - density_air, & - rel_humidity, & - f_cld, & - z, & - pbl_height, & - q_number, & - q_amm, & - q_su, & - q_h2so4, & - q_nh3, & - do_nh3, & - diameter_dry, & - diameter_dry_min, & - diameter_dry_max, & - density_su, & - mw_su, & - mw_amm, & - dq_h2so4_gasprod, & - dq_h2so4_aeruptk, & - cdt) - - - ! update the number and mass mixing ratios - qa%r3(iq_number)%q(i,j,k) = q_number - - qa%r3(iq_amm)%q(i,j,k) = q_amm - qa%r3(iq_su)%q(i,j,k) = q_su - - qg%r3(iq_h2so4)%q(i,j,k) = q_h2so4 - qg%r3(iq_nh3)%q(i,j,k) = q_nh3 - - end do ! k - - dz(:) = delp(i,j,:) / (MAPL_GRAV * rhoa(i,j,:)) - - end do ! i - end do ! j - - deallocate(dz, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_Nucleation - - -end module MAM_NucleationMod diff --git a/MAMchem_GridComp/MAM_OrganicCarbonMod.F90 b/MAMchem_GridComp/MAM_OrganicCarbonMod.F90 deleted file mode 100644 index b5571de3..00000000 --- a/MAMchem_GridComp/MAM_OrganicCarbonMod.F90 +++ /dev/null @@ -1,547 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Data Assimilation Office, Code 610.1, GEOS/DAS ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_OrganicCarbonMod --- MAM OC processes and diagnostics -! -! !INTERFACE: -! - - module MAM_OrganicCarbonMod - -! !USES: - - USE ESMF - USE MAPL - - use Chem_ConstMod, only: grav, undef - use Chem_UtilMod, only: Chem_BiomassDiurnal - - use MAM_BaseMod - use MAM3_DataMod - use MAM7_DataMod - - implicit none - -! !PUBLIC TYPES: -! - PRIVATE - real, private, parameter :: pi = MAPL_PI - -! -! !PUBLIIC MEMBER FUNCTIONS: -! - - PUBLIC MAM_OC_Emission - PUBLIC MAM_OC_Diagnostics - -! -! !DESCRIPTION: -! -! This module implements MAM Organic Carbon processes (emission, etc) and -! diagnostic fields -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - -CONTAINS - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_OC_Emission --- The Emission Driver -! -! !INTERFACE: -! - - subroutine MAM_OC_Emission (self, import, export, qa, pom_oc_ratio, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - real, intent(in) :: pom_oc_ratio ! ratio of POM emissions to primary OC emissions - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the Organic Carbon Emissions Driver. That -! is, adds tendencies due to emission. -! -! !REVISION HISTORY: -! -! 11 Dec 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_OC_Emission' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i - integer :: ijl, ijkl - real :: qmin, qmax - real :: rUp, rLow - real, pointer, dimension(:,:) :: emission_total - real, pointer, dimension(:,:) :: emission_mass, emission_num - real, pointer, dimension(:,:) :: dqa_mass, dqa_num - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - character(len=ESMF_MAXSTR) :: emiss_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:) :: gwettop - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Input fields from ExtData -! ------------------------- - real, pointer, dimension(:,:) :: emiss_bb - real, pointer, dimension(:,:) :: emiss_bf - real, pointer, dimension(:,:) :: emiss_ff - real, pointer, dimension(:,:) :: emiss_sh - -! Exports -! ----------------------- - real, pointer, dimension(:,:) :: emission - -! -! Parameters of primary aerosol emissions -! --------------------------------------- - type PAE - integer :: mode_id ! mode ID - - real :: weight ! weight by mass - real :: sigma ! geometric standard deviation - real :: diameter ! geometric mean diameter of number size distribution - - real, pointer, dimension(:,:) :: emission => null() - real, pointer, dimension(:,:,:) :: injection => null() - end type - - - type(PAE), parameter :: pae_bb = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_bf = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_ff = PAE(1, 1.0, 1.8, 0.080, null(), null()) - type(PAE), parameter :: pae_sh = PAE(1, 1.0, 1.8, 0.080, null(), null()) - - real :: D_emiss_bb, f_bb - real :: D_emiss_bf, f_bf - real :: D_emiss_ff, f_ff - real :: D_emiss_sh, f_sh - -! Initialize local variables -! -------------------------- - rc = 0 - - D_emiss_bb = pae_bb%weight * pae_bb%diameter * exp(1.5 * log(pae_bb%sigma)**2) - D_emiss_bf = pae_bf%weight * pae_bf%diameter * exp(1.5 * log(pae_bf%sigma)**2) - D_emiss_ff = pae_ff%weight * pae_ff%diameter * exp(1.5 * log(pae_ff%sigma)**2) - D_emiss_sh = pae_sh%weight * pae_sh%diameter * exp(1.5 * log(pae_sh%sigma)**2) - - f_bb = 1 / (pi/6 * D_emiss_bb**3) - f_bf = 1 / (pi/6 * D_emiss_bf**3) - f_ff = 1 / (pi/6 * D_emiss_ff**3) - f_sh = 1 / (pi/6 * D_emiss_sh**3) - - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - mode_name = MAM7_PRIMARY_CARBON_MODE_NAME - else - mode_name = MAM3_ACCUMULATION_MODE_NAME - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, gwettop, 'WET1', __RC__) - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - call MAPL_GetPointer(import, emiss_bb, 'OC_EMIS_FIRE', __RC__) - call MAPL_GetPointer(import, emiss_bf, 'OC_EMIS_BIOFUEL', __RC__) - call MAPL_GetPointer(import, emiss_ff, 'OC_EMIS_FOSSILFUEL', __RC__) - call MAPL_GetPointer(import, emiss_sh, 'OC_EMIS_SHIP', __RC__) - - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(before)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') - call write_parallel(f_emiss, format='(("emiss factor = ", (F5.3)))') - - call pmaxmin('OC: gwettop ', gwettop, qmin, qmax, ijl, k1, 1.) - - call pmaxmin('OC: rhoa ', rhoa, qmin, qmax, ijl, km, 1.) - call pmaxmin('OC: ple ', ple, qmin, qmax, ijl, km, 1.) - call pmaxmin('OC: delp ', delp, qmin, qmax, ijl, km, 1.) -#endif - -! Organic Carbon Emissions -! ---------------------- - allocate(emission_total(i1:i2,j1:j2), __STAT__) - allocate(emission_mass(i1:i2,j1:j2), __STAT__) - allocate(emission_num(i1:i2,j1:j2), __STAT__) - allocate(dqa_mass(i1:i2,j1:j2), __STAT__) - allocate(dqa_num(i1:i2,j1:j2), __STAT__) - - emission_total = 0.0 - - mmr_name = 'POM_A_' // trim(mode_name) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name) ! name of the number mixing ratio - emiss_name = 'POMEM' // trim(mode_name) ! name of the emission export - - emission_num = 0.0 - emission_mass = 0.0 - - - ! set undefined to 0 - where ((emiss_bb - undef) > abs(emiss_bb)*epsilon(emiss_bb)) emiss_bb = 0.0 - where ((emiss_bf - undef) > abs(emiss_bf)*epsilon(emiss_bf)) emiss_bf = 0.0 - where ((emiss_ff - undef) > abs(emiss_ff)*epsilon(emiss_ff)) emiss_ff = 0.0 - where ((emiss_sh - undef) > abs(emiss_sh)*epsilon(emiss_sh)) emiss_sh = 0.0 - - - emission_mass = ( emiss_bb + & - emiss_bf + & - emiss_ff + & - emiss_sh ) * pom_oc_ratio - - emission_num = ( f_bb * emiss_bb + & - f_bf * emiss_bf + & - f_ff * emiss_ff + & - f_sh * emiss_sh ) * pom_oc_ratio - - - -#ifdef DEBUG - call pmaxmin('OC: emission_total ', emission_total, qmin, qmax, ijl, 1, 1.) - - call write_parallel('OC: mode ' // trim(mode_name)) - call pmaxmin('OC: emission_mass ', emission_mass, qmin, qmax, ijl, 1, 1.) - call pmaxmin('OC: emission_number', emission_num, qmin, qmax, ijl, 1, 1.) -#endif - - dqa_mass = emission_mass * cdt * grav / delp(:,:,km) - dqa_num = emission_num * cdt * grav / delp(:,:,km) - - ! update the mass and number mixing ratios due to emission - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_mass - - i = MAPL_SimpleBundleGetIndex(qa, nmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_num - - call MAPL_GetPointer(export, emission, emiss_name, __RC__) - if (associated(emission)) then - emission = emission_mass - endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(after)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -! Clean up -! -------- - deallocate(emission_total, __STAT__) - deallocate(emission_mass, __STAT__) - deallocate(emission_num, __STAT__) - deallocate(dqa_mass, __STAT__) - deallocate(dqa_num, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_OC_Emission - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_OC_Diagnostics --- The Diagnostics Driver -! -! !INTERFACE: -! - - subroutine MAM_OC_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine calculates a number of diagnostic fields. -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_BC_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i, k - integer :: ijl, ijkl - real :: qmin, qmax - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: u, v - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: sfcmass ! surface mass concentration, kg m-3 - real, pointer, dimension(:,:) :: sfcmass25 ! surface PM2.5 mass concentration, kg m-3 - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - real, pointer, dimension(:,:) :: colmass25 ! column integrated PM2.5 mass density, kg m-2 - - real, pointer, dimension(:,:) :: fluxu ! Column mass flux in x direction - real, pointer, dimension(:,:) :: fluxv ! Column mass flux in y direction - - real, pointer, dimension(:,:,:) :: conc ! mass concentration, kg m-3 - real, pointer, dimension(:,:,:) :: mass ! mass mixing ratio, kg kg-1 - real, pointer, dimension(:,:,:) :: mass25 ! PM2.5 mass mixing ratio, kg kg-1 - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') -#if (0) - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_DU_EMISSION_MODE_ID) - mode(1:nmodes) = MAM7_DU_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_DU_EMISSION_MODE_ID) - mode(1:nmodes) = MAM3_DU_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, u, 'U', __RC__) - call MAPL_GetPointer(import, v, 'V', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, sfcmass, 'DUSMASS', __RC__) - call MAPL_GetPointer(export, sfcmass25, 'DUSMASS25', __RC__) - call MAPL_GetPointer(export, colmass, 'DUCMASS', __RC__) - call MAPL_GetPointer(export, colmass25, 'DUCMASS25', __RC__) - - call MAPL_GetPointer(export, fluxu, 'DUFLUXU', __RC__) - call MAPL_GetPointer(export, fluxv, 'DUFLUXV', __RC__) - - call MAPL_GetPointer(export, conc, 'DUCONC', __RC__) - call MAPL_GetPointer(export, mass, 'DUMASS', __RC__) - call MAPL_GetPointer(export, mass25, 'DUMASS25', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - -! Initialize diagnostic fields -! ---------------------------- - if (associated(sfcmass)) sfcmass = 0.0 - if (associated(sfcmass25)) sfcmass25 = 0.0 - if (associated(colmass)) colmass = 0.0 - if (associated(colmass25)) colmass25 = 0.0 - - if (associated(fluxu)) fluxu = 0.0 - if (associated(fluxv)) fluxv = 0.0 - - if (associated(conc)) conc = 0.0 - if (associated(mass)) mass = 0.0 - if (associated(mass25)) mass25 = 0.0 - - -! Calculate diagnostic fields -! --------------------------- - do n = 1, nmodes - mmr_name = 'DU_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - - - if (associated(sfcmass)) then - sfcmass(:,:) = sfcmass(:,:) + qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(sfcmass25)) then ! placeholder for now - sfcmass25(:,:) = sfcmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(colmass25)) then ! placeholder for now - do k = 1, km - colmass25(:,:) = colmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxu)) then - do k = 1, km - fluxu(:,:) = fluxu(:,:) + u(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxv)) then - do k = 1, km - fluxv(:,:) = fluxv(:,:) + v(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(conc)) then - conc = conc + qa%r3(i)%q * rhoa - end if - - if (associated(mass)) then - mass = mass + qa%r3(i)%q - end if - - if (associated(mass25)) then ! placeholder for now - mass25 = mass25 + 0.0 * qa%r3(i)%q - end if - - end do -#endif - -! Clean up -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_OC_Diagnostics - - - end module MAM_OrganicCarbonMod diff --git a/MAMchem_GridComp/MAM_SeasaltMod.F90 b/MAMchem_GridComp/MAM_SeasaltMod.F90 deleted file mode 100644 index 5880a986..00000000 --- a/MAMchem_GridComp/MAM_SeasaltMod.F90 +++ /dev/null @@ -1,525 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Data Assimilation Office, Code 610.1, GEOS/DAS ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_SeasaltMod --- MAM Sea-salt processes and diagnostics -! -! !INTERFACE: -! - - module MAM_SeasaltMod - -! !USES: - - use ESMF - - use MAPL - - use Chem_ConstMod, only: grav - - use SeasaltEmissionMod, only: SeasaltEmission - - use MAM_BaseMod - use MAM3_DataMod - use MAM7_DataMod - - implicit none - - private - -! !PUBLIC TYPES: -! - - -! -! !PUBLIIC MEMBER FUNCTIONS: -! - - public MAM_SS_Emission - public MAM_SS_Diagnostics - -! -! !DESCRIPTION: -! -! This module implements MAM Sea-salt (emission, etc) and -! diagnostic fields -! -! !REVISION HISTORY: -! -! 07 Sep 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SS_Emission --- The Emission Driver -! -! !INTERFACE: -! - - subroutine MAM_SS_Emission (self, import, export, qa, f_emiss, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - real, intent(in) :: f_emiss ! tuning parameter for the seasalt emissions - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the Seasalt Emissions Driver. That -! is, adds tendencies due to emission. -! -! !REVISION HISTORY: -! -! 07 Sep 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_SS_Emission' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i - integer :: ijl, ijkl - real :: qmin, qmax - real :: rUp, rLow - real, pointer, dimension(:,:) :: emission_mass, emission_num - real, allocatable, dimension(:,:) :: f_grid_efficiency, f_sst_emis, tskin_c, w10m - real, allocatable, dimension(:,:) :: dqa_mass, dqa_num - - integer, parameter :: method = 3 ! seasalt emission scheme (hardwired) - integer, parameter :: sstemisFlag = 2 ! SST correction parameterization (hardwired) - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with seasalt emission - real, dimension(MAM_MAX_NUMBER_MODES) :: d_cutoff_low - real, dimension(MAM_MAX_NUMBER_MODES) :: d_cutoff_up - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - character(len=ESMF_MAXSTR) :: emiss_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:) :: u10m, v10m, ustar, tskin, frocean, frseaice - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Exports -! ----------------------- - real, pointer, dimension(:,:) :: emission - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_SS_EMISSION_MODE_ID) - - mode(1:nmodes) = MAM7_SS_EMISSION_MODE_ID - d_cutoff_low(1:nmodes) = MAM7_SS_EMISSION_D_CUTOFF_LOW - d_cutoff_up(1:nmodes) = MAM7_SS_EMISSION_D_CUTOFF_UP - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_SS_EMISSION_MODE_ID) - - mode(1:nmodes) = MAM3_SS_EMISSION_MODE_ID - d_cutoff_low(1:nmodes) = MAM3_SS_EMISSION_D_CUTOFF_LOW - d_cutoff_up(1:nmodes) = MAM3_SS_EMISSION_D_CUTOFF_UP - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, frocean, 'FROCEAN', __RC__) - call MAPL_GetPointer(import, frseaice, 'FRACI', __RC__) - - call MAPL_GetPointer(import, u10m, 'U10M', __RC__) - call MAPL_GetPointer(import, v10m, 'V10M', __RC__) - call MAPL_GetPointer(import, ustar, 'USTAR', __RC__) - call MAPL_GetPointer(import, tskin, 'TS', __RC__) - - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') - call write_parallel(f_emiss, format='(("emiss factor = ", (F5.3)))') -#endif - -! Seasalt Emissions -! ----------------- - allocate(emission_mass(i1:i2,j1:j2), __STAT__) - allocate(emission_num(i1:i2,j1:j2), __STAT__) - allocate(dqa_mass(i1:i2,j1:j2), __STAT__) - allocate(dqa_num(i1:i2,j1:j2), __STAT__) - allocate(f_grid_efficiency(i1:i2,j1:j2), __STAT__) - allocate(w10m(i1:i2,j1:j2), __STAT__) - allocate(f_sst_emis(i1:i2,j1:j2), __STAT__ ) - -! Define 10-m wind speed - w10m = sqrt(u10m*u10m + v10m*v10m) - -! Define grid emission efficiency - f_grid_efficiency = min(max(0.0, frocean - frseaice), 1.0) - -! Apply SST correction to emissions - f_sst_emis = 1.0 - - if (sstemisFlag == 1) then ! SST correction folowing Jaegle et al. 2011 - f_sst_emis = 0.0 - - allocate(tskin_c(i1:i2,j1:j2), __STAT__) - tskin_c = tskin - 273.15 - f_sst_emis = (0.3 + 0.1*tskin_c - 0.0076*tskin_c**2 + 0.00021*tskin_c**3) - - where(f_sst_emis < 0.0) f_sst_emis = 0.0 - deallocate(tskin_c, __STAT__) - else if (sstemisFlag == 2) then ! GEOS5 SST correction - f_sst_emis = 0.0 - - allocate(tskin_c(i1:i2,j1:j2), __STAT__) - tskin_c = tskin - 273.15 - - where(tskin_c < -0.1) tskin_c = -0.1 ! temperature range (0, 36) C - where(tskin_c > 36.0) tskin_c = 36.0 ! - - f_sst_emis = (-1.107211 -0.010681*tskin_c -0.002276*tskin_c**2 + 60.288927*1.0/(40.0 - tskin_c)) - where(f_sst_emis < 0.0) f_sst_emis = 0.0 - where(f_sst_emis > 7.0) f_sst_emis = 7.0 - - deallocate(tskin_c, __STAT__) - endif - - - - - do n = 1, nmodes - mmr_name = 'SS_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - emiss_name = 'SSEM' // trim(mode_name(n)) ! name of the emission export - - rLow = 1.0e6 * d_cutoff_low(n) / 2 ! convert from [m] to [um] - rUp = 1.0e6 * d_cutoff_up(n) / 2 ! convert from [m] to [um] - - emission_num = 0.0 - emission_mass = 0.0 - - call SeasaltEmission(rLow, rUp, method, w10m, ustar, & - emission_mass, emission_num, rc) - - emission_mass = f_emiss * f_grid_efficiency * f_sst_emis * emission_mass - emission_num = f_emiss * f_grid_efficiency * f_sst_emis * emission_num - -#ifdef DEBUG - call write_parallel('SS: mode ' // trim(mode_name(n))) - - call pmaxmin('SS: emission_mass ', emission_mass, qmin, qmax, ijl, 1, 1.) - call pmaxmin('SS: emission_number', emission_num, qmin, qmax, ijl, 1, 1.) -#endif - - dqa_mass = emission_mass * cdt * grav / delp(:,:,km) - dqa_num = emission_num * cdt * grav / delp(:,:,km) - - ! update the mass and number mixing ratios due to emission - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_mass - - i = MAPL_SimpleBundleGetIndex(qa, nmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_num - - call MAPL_GetPointer(export, emission, emiss_name, __RC__) - if (associated(emission)) then - emission = emission_mass - endif - end do - - -! Clean up -! -------- - deallocate(emission_mass, __STAT__) - deallocate(emission_num, __STAT__) - deallocate(dqa_mass, __STAT__) - deallocate(dqa_num, __STAT__) - deallocate(f_grid_efficiency, __STAT__) - deallocate(f_sst_emis, __STAT__) - deallocate(w10m, __STAT__) - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_SS_Emission - - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SS_Diagnostics --- The Diagnostics Driver -! -! !INTERFACE: -! - - subroutine MAM_SS_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine calculates a number of diagnostic fields. -! -! !REVISION HISTORY: -! -! 13 Oct 2011 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_SS_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i, k - integer :: ijl, ijkl - real :: qmin, qmax - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: u, v - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: sfcmass ! surface mass concentration, kg m-3 - real, pointer, dimension(:,:) :: sfcmass25 ! surface PM2.5 mass concentration, kg m-3 - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - real, pointer, dimension(:,:) :: colmass25 ! column integrated PM2.5 mass density, kg m-2 - - real, pointer, dimension(:,:) :: fluxu ! Column mass flux in x direction - real, pointer, dimension(:,:) :: fluxv ! Column mass flux in y direction - - real, pointer, dimension(:,:,:) :: conc ! mass concentration, kg m-3 - real, pointer, dimension(:,:,:) :: mass ! mass mixing ratio, kg kg-1 - real, pointer, dimension(:,:,:) :: mass25 ! PM2.5 mass mixing ratio, kg kg-1 - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_SS_EMISSION_MODE_ID) - mode(1:nmodes) = MAM7_SS_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_SS_EMISSION_MODE_ID) - mode(1:nmodes) = MAM3_SS_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, u, 'U', __RC__) - call MAPL_GetPointer(import, v, 'V', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, sfcmass, 'SSSMASS', __RC__) - call MAPL_GetPointer(export, sfcmass25, 'SSSMASS25', __RC__) - call MAPL_GetPointer(export, colmass, 'SSCMASS', __RC__) - call MAPL_GetPointer(export, colmass25, 'SSCMASS25', __RC__) - - call MAPL_GetPointer(export, fluxu, 'SSFLUXU', __RC__) - call MAPL_GetPointer(export, fluxv, 'SSFLUXV', __RC__) - - call MAPL_GetPointer(export, conc, 'SSCONC', __RC__) - call MAPL_GetPointer(export, mass, 'SSMASS', __RC__) - call MAPL_GetPointer(export, mass25, 'SSMASS25', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - -! Initialize diagnostic fields -! ---------------------------- - if (associated(sfcmass)) sfcmass = 0.0 - if (associated(sfcmass25)) sfcmass25 = 0.0 - if (associated(colmass)) colmass = 0.0 - if (associated(colmass25)) colmass25 = 0.0 - - if (associated(fluxu)) fluxu = 0.0 - if (associated(fluxv)) fluxv = 0.0 - - if (associated(conc)) conc = 0.0 - if (associated(mass)) mass = 0.0 - if (associated(mass25)) mass25 = 0.0 - - -! Calculate diagnostic fields -! --------------------------- - do n = 1, nmodes - mmr_name = 'SS_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - - - if (associated(sfcmass)) then - sfcmass(:,:) = sfcmass(:,:) + qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(sfcmass25)) then ! placeholder for now - sfcmass25(:,:) = sfcmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(colmass25)) then ! placeholder for now - do k = 1, km - colmass25(:,:) = colmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxu)) then - do k = 1, km - fluxu(:,:) = fluxu(:,:) + u(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxv)) then - do k = 1, km - fluxv(:,:) = fluxv(:,:) + v(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(conc)) then - conc = conc + qa%r3(i)%q * rhoa - end if - - if (associated(mass)) then - mass = mass + qa%r3(i)%q - end if - - if (associated(mass25)) then ! placeholder for now - mass25 = mass25 + 0.0 * qa%r3(i)%q - end if - - end do - - -! Clean up -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_SS_Diagnostics - - - - end module MAM_SeasaltMod diff --git a/MAMchem_GridComp/MAM_SizeMod.F90 b/MAMchem_GridComp/MAM_SizeMod.F90 deleted file mode 100644 index 37eae794..00000000 --- a/MAMchem_GridComp/MAM_SizeMod.F90 +++ /dev/null @@ -1,361 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_SizeMod - Dry and wet size of interstitial aerosols -! -! !INTERFACE: -! - module MAM_SizeMod -! -! !USES: -! - - use ESMF - - use MAPL - - use MAML_SizeMod - use MAM_BaseMod - - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_DrySize - public MAM_WetSize - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - - real, private, parameter :: pi = MAPL_PI - - -! -! !DESCRIPTION: -! -! {\tt MAML\_SizeMod} provides a collection of methods for calculating -! dry and wet size of aerosol particles. -! -! -! !REVISION HISTORY: -! -! 8Dec2011 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_DrySize --- calculates the dry size of interstitial aerosols -! -! !INTERFACE: - - subroutine MAM_DrySize(self, import, export, qa, Da, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_State), intent(inout) :: import ! import state - type(ESMF_State), intent(inout) :: export ! export state - - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - - type(MAPL_SimpleBundle), intent(in) :: qa ! number/mass mixing ratios - type(MAPL_SimpleBundle), intent(in) :: Da ! dry sizes - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the number/volume mean geometric diameter. -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_DrySize') - - - real :: D ! number mean geometric diameter - - real :: sigma - real :: Dg_default, Dg_min, Dg_max - real :: vol2num_default, vol2num_min, vol2num_max - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - integer :: iq_dgn_dry - integer :: iq_nmr - integer, pointer :: iq_mmr(:) - - integer :: m, s - real, pointer :: q_mass(:) - real, pointer :: density(:) - real :: q_number - - real :: f - integer :: i, j, k, im, jm, km - - - do m = 1, self%n_modes - - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - sigma = sigma, & - size_default = Dg_default, & - size_min = Dg_min, & - size_max = Dg_max, & - n_species = n_species) - - ! will need these for the calculations - f = (pi / 6) * exp(4.5 * log(sigma)**2) ! volume to number factor - vol2num_default = 1 / (f * Dg_default**3) - vol2num_min = 1 / (f * Dg_min**3) - vol2num_max = 1 / (f * Dg_max**3) - - - ! size of dry interstitial aerosols - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - iq_nmr = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - allocate(q_mass(n_species), __STAT__) ! buffer for the species mass mixing ratios - allocate(density(n_species), __STAT__) ! buffer for the species densities - allocate(iq_mmr(n_species), __STAT__) ! buffer for the species mass mixing ratios bundle indexes - - density = 0.0 - do s = 1, n_species - call MAM_AerosolSpeciesGet(self%mode(m)%species(s), name = species_name, & - density = density(s)) - - field_name = trim(species_name) //'_A_' // trim(mode_name) - iq_mmr(s) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - end do - - im = ubound(qa%r3(iq_nmr)%q, 1) - jm = ubound(qa%r3(iq_nmr)%q, 2) - km = ubound(qa%r3(iq_nmr)%q, 3) - - do k = 1, km - do j = 1, jm - do i = 1, im - - q_number = qa%r3(iq_nmr)%q(i,j,k) - - q_mass = 0.0 - do s = 1, n_species - q_mass(s) = qa%r3(iq_mmr(s))%q(i,j,k) ! OPTIMIZATION_NEEDED: this will probably trash the cache - end do - - D = MAML_DrySize(q_number, & - q_mass, & - density, & - sigma, & - Dg_default, & - Dg_min, & - Dg_max, & - vol2num_default, & - vol2num_min, & - vol2num_max) - - Da%r3(iq_dgn_dry)%q(i,j,k) = D - end do ! i - end do ! j - end do ! k - - deallocate(q_mass, density, iq_mmr, __STAT__) - end do - - end subroutine MAM_DrySize - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_WetSize --- calculates the wet size and density of -! interstitial aerosols -! -! !INTERFACE: - - subroutine MAM_WetSize(self, import, export, qa, Da, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_State), intent(inout) :: import ! import state - type(ESMF_State), intent(inout) :: export ! export state - - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - - type(MAPL_SimpleBundle), intent(in) :: qa ! number/mass mixing ratios - type(MAPL_SimpleBundle), intent(in) :: Da ! dry and wet sizes of interstital aerosols - - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Calculates the number/volume mean geometric diameter. -! -! !REVISION HISTORY: -! -! 18Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_WetSize') - - - real :: D ! number mean geometric diameter - - real :: sigma - real :: rh_deliquescence - real :: rh_crystallization - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - integer :: iq_mmr_wtr - integer :: iq_dgn_dry - integer :: iq_dgn_wet - integer, allocatable, dimension(:) :: iq_mmr - - integer :: m, s - real, allocatable, dimension(:) :: q_mass - real, allocatable, dimension(:) :: density - real, allocatable, dimension(:) :: hygroscopicity - - real :: diameter_dry - real :: diameter_wet - real :: density_wet - real :: q_aerosol_water - - real, pointer, dimension(:,:,:) :: rh - real, pointer, dimension(:,:,:) :: fcld - - integer :: i, j, k, im, jm, km - - - call MAPL_GetPointer(import, rh, 'RH2', __RC__) - call MAPL_GetPointer(import, fcld, 'FCLD', __RC__) - - do m = 1, self%n_modes - - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - sigma = sigma, & - rh_deliquescence = rh_deliquescence, & - rh_crystallization = rh_crystallization, & - n_species = n_species) - - ! dry size - field_name = 'DGN_DRY_' // trim(mode_name) - iq_dgn_dry = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! wet size - field_name = 'DGN_WET_' // trim(mode_name) - iq_dgn_wet = MAPL_SimpleBundleGetIndex(Da, field_name, 3, __RC__) - - ! absorbed water - field_name = 'WTR_A_' // trim(mode_name) - iq_mmr_wtr = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - - allocate(density(n_species), __STAT__) ! buffer for the species densities - allocate(hygroscopicity(n_species), __STAT__) ! buffer for the species hygroscopicity - - allocate(q_mass(n_species), __STAT__) ! buffer for the species mass mixing ratios - allocate(iq_mmr(n_species), __STAT__) ! buffer for the species mass mixing ratios bundle indexes - - do s = 1, n_species - call MAM_AerosolSpeciesGet(self%mode(m)%species(s), name = species_name, & - density = density(s), & - hygroscopicity = hygroscopicity(s)) - - field_name = trim(species_name) //'_A_' // trim(mode_name) - iq_mmr(s) = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - end do - - im = size(qa%r3(iq_mmr(1))%q, 1) - jm = size(qa%r3(iq_mmr(1))%q, 2) - km = size(qa%r3(iq_mmr(1))%q, 3) - - do k = 1, km - do j = 1, jm - do i = 1, im - - q_mass = 0.0 - do s = 1, n_species - q_mass(s) = qa%r3(iq_mmr(s))%q(i,j,k) - end do - - diameter_dry = Da%r3(iq_dgn_dry)%q(i,j,k) - - call MAML_WetSize(q_mass, & - diameter_dry, & - density, & - hygroscopicity, & - sigma, & - rh_deliquescence, & - rh_crystallization, & - rh(i,j,k), & - fcld(i,j,k), & - diameter_wet, & - density_wet, & - q_aerosol_water) - - Da%r3(iq_dgn_wet)%q(i,j,k) = diameter_wet - - qa%r3(iq_mmr_wtr)%q(i,j,k) = q_aerosol_water - - end do ! i - end do ! j - end do ! k - - deallocate(q_mass, density, hygroscopicity, iq_mmr, __STAT__) - end do - - end subroutine MAM_WetSize - - -end module MAM_SizeMod diff --git a/MAMchem_GridComp/MAM_SulfateMod.F90 b/MAMchem_GridComp/MAM_SulfateMod.F90 deleted file mode 100644 index ada06ce6..00000000 --- a/MAMchem_GridComp/MAM_SulfateMod.F90 +++ /dev/null @@ -1,519 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Data Assimilation Office, Code 610.1, GEOS/DAS ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_SulfateMod --- MAM Sulfate (SO4) processes and diagnostics -! -! !INTERFACE: -! - - module MAM_SulfateMod - -! !USES: - - USE ESMF - USE MAPL - - use Chem_ConstMod, only: grav, undef - use Chem_UtilMod, only: Chem_BiomassDiurnal - - use MAM_BaseMod - use MAM3_DataMod - use MAM7_DataMod - - implicit none - -! !PUBLIC TYPES: -! - PRIVATE - real, private, parameter :: pi = MAPL_PI - -! -! !PUBLIIC MEMBER FUNCTIONS: -! - - PUBLIC MAM_SO4_Emission - PUBLIC MAM_SO4_Diagnostics - -! -! !DESCRIPTION: -! -! This module implements MAM Sulfate (SO4) processes (emission, etc) and -! diagnostic fields -! -! !REVISION HISTORY: -! -! 01 Aug 2016 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - -CONTAINS - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SO4_Emission --- The Emission Driver -! -! !INTERFACE: -! - - subroutine MAM_SO4_Emission (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine implements the Sulfate (SO4) Emissions Driver. That -! is, adds tendencies due to emission. -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_SO4_Emission' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i - integer :: ijl, ijkl - real :: qmin, qmax - real :: rUp, rLow - real, pointer, dimension(:,:) :: emission_total - real, pointer, dimension(:,:) :: emission_mass, emission_num - real, pointer, dimension(:,:) :: dqa_mass, dqa_num - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - character(len=ESMF_MAXSTR) :: emiss_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:) :: gwettop - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Input fields from ExtData -! ------------------------- - real, pointer, dimension(:,:) :: emiss_sh - -! Exports -! ----------------------- - real, pointer, dimension(:,:) :: emission - -! -! Parameters of primary aerosol emissions -! --------------------------------------- - type PAE - integer :: mode_id ! mode ID - - real :: weight ! weight by mass - real :: sigma ! geometric standard deviation - real :: diameter ! geometric mean diameter of number size distribution - - real, pointer, dimension(:,:) :: emission => null() - real, pointer, dimension(:,:,:) :: injection => null() - end type - - - ! note that the SO4 from ship emissions is emitted with D_mass_emiss = 0.261 micrometers - type(PAE), parameter :: pae_sh = PAE(1, 1.0, 0.0, 0.261, null(), null()) - - real :: D_emiss_sh, f_sh - -! Initialize local variables -! -------------------------- - rc = 0 - - D_emiss_sh = pae_sh%diameter - - f_sh = 1 / (pi/6 * D_emiss_sh**3) - - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - if (self%id == MAM7_SCHEME) then - mode_name = MAM7_ACCUMULATION_MODE_NAME - else - mode_name = MAM3_ACCUMULATION_MODE_NAME - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, gwettop, 'WET1', __RC__) - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - call MAPL_GetPointer(import, emiss_sh, 'SO4_EMIS_SHIP', __RC__) - - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(before)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') - - call pmaxmin('SO4: gwettop ', gwettop, qmin, qmax, ijl, k1, 1.) - - call pmaxmin('SO4: rhoa ', rhoa, qmin, qmax, ijl, km, 1.) - call pmaxmin('SO4: ple ', ple, qmin, qmax, ijl, km, 1.) - call pmaxmin('SO4: delp ', delp, qmin, qmax, ijl, km, 1.) -#endif - -! Sulfate (SO4) Emissions -! ----------------------- - allocate(emission_total(i1:i2,j1:j2), __STAT__) - allocate(emission_mass(i1:i2,j1:j2), __STAT__) - allocate(emission_num(i1:i2,j1:j2), __STAT__) - allocate(dqa_mass(i1:i2,j1:j2), __STAT__) - allocate(dqa_num(i1:i2,j1:j2), __STAT__) - - emission_total = 0.0 - - mmr_name = 'SU_A_' // trim(mode_name) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name) ! name of the number mixing ratio - emiss_name = 'SUEM' // trim(mode_name) ! name of the emission export - - emission_num = 0.0 - emission_mass = 0.0 - - - ! set undefined to 0 - where ((emiss_sh - undef) > abs(emiss_sh)*epsilon(emiss_sh)) emiss_sh = 0.0 - - - emission_mass = emiss_sh - - emission_num = f_sh * emiss_sh - - - -#ifdef DEBUG - call pmaxmin('SO4: emission_total ', emission_total, qmin, qmax, ijl, 1, 1.) - - call write_parallel('SO4: mode ' // trim(mode_name)) - call pmaxmin('SO4: emission_mass ', emission_mass, qmin, qmax, ijl, 1, 1.) - call pmaxmin('SO4: emission_number', emission_num, qmin, qmax, ijl, 1, 1.) -#endif - - dqa_mass = emission_mass * cdt * grav / delp(:,:,km) - dqa_num = emission_num * cdt * grav / delp(:,:,km) - - ! update the mass and number mixing ratios due to emission - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_mass - - i = MAPL_SimpleBundleGetIndex(qa, nmr_name, 3, __RC__) - qa%r3(i)%q(:,:,km) = qa%r3(i)%q(:,:,km) + dqa_num - - call MAPL_GetPointer(export, emission, emiss_name, __RC__) - if (associated(emission)) then - emission = emission_mass - endif - - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG(after)::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (X2I3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (X2I3)))') - - do i = 1, qa%n3d - call pmaxmin('CAM:qa:'//trim(qa%r3(i)%name)//' : ', & - qa%r3(i)%q(i1:i2,j1:j2,k1:km), qmin, qmax, ijl, km, 1.) - end do -#endif - - -! Clean up -! -------- - deallocate(emission_total, __STAT__) - deallocate(emission_mass, __STAT__) - deallocate(emission_num, __STAT__) - deallocate(dqa_mass, __STAT__) - deallocate(dqa_num, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_SO4_Emission - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_SO4_Diagnostics --- The Diagnostics Driver -! -! !INTERFACE: -! - - subroutine MAM_SO4_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine calculates a number of diagnostic fields. -! -! !REVISION HISTORY: -! -! 11 Jul 2012 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_SO4_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, n, i, k - integer :: ijl, ijkl - real :: qmin, qmax - -! Mode parameters -! ------------------------ - integer :: nmodes ! number of modes with dust emission - - integer, dimension(MAM_MAX_NUMBER_MODES) :: mode - character(len=ESMF_MAXSTR) :: mode_name(MAM_MAX_NUMBER_MODES) - character(len=ESMF_MAXSTR) :: mmr_name, nmr_name - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: u, v - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: sfcmass ! surface mass concentration, kg m-3 - real, pointer, dimension(:,:) :: sfcmass25 ! surface PM2.5 mass concentration, kg m-3 - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - real, pointer, dimension(:,:) :: colmass25 ! column integrated PM2.5 mass density, kg m-2 - - real, pointer, dimension(:,:) :: fluxu ! Column mass flux in x direction - real, pointer, dimension(:,:) :: fluxv ! Column mass flux in y direction - - real, pointer, dimension(:,:,:) :: conc ! mass concentration, kg m-3 - real, pointer, dimension(:,:,:) :: mass ! mass mixing ratio, kg kg-1 - real, pointer, dimension(:,:,:) :: mass25 ! PM2.5 mass mixing ratio, kg kg-1 - - -! Initialize local variables -! -------------------------- - rc = 0 - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') -#if (0) - if (self%id == MAM7_SCHEME) then - nmodes = size(MAM7_SO4_EMISSION_MODE_ID) - mode(1:nmodes) = MAM7_SO4_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM7_MODE_NAME(mode(1:nmodes)) - else - nmodes = size(MAM3_SO4_EMISSION_MODE_ID) - mode(1:nmodes) = MAM3_SO4_EMISSION_MODE_ID - - mode_name(1:nmodes) = MAM3_MODE_NAME(mode(1:nmodes)) - end if - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, u, 'U', __RC__) - call MAPL_GetPointer(import, v, 'V', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, sfcmass, 'SUSMASS', __RC__) - call MAPL_GetPointer(export, sfcmass25, 'SUSMASS25', __RC__) - call MAPL_GetPointer(export, colmass, 'SUCMASS', __RC__) - call MAPL_GetPointer(export, colmass25, 'SUCMASS25', __RC__) - - call MAPL_GetPointer(export, fluxu, 'SUFLUXU', __RC__) - call MAPL_GetPointer(export, fluxv, 'SUFLUXV', __RC__) - - call MAPL_GetPointer(export, conc, 'SUCONC', __RC__) - call MAPL_GetPointer(export, mass, 'SUMASS', __RC__) - call MAPL_GetPointer(export, mass25, 'SUMASS25', __RC__) - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - -! Initialize diagnostic fields -! ---------------------------- - if (associated(sfcmass)) sfcmass = 0.0 - if (associated(sfcmass25)) sfcmass25 = 0.0 - if (associated(colmass)) colmass = 0.0 - if (associated(colmass25)) colmass25 = 0.0 - - if (associated(fluxu)) fluxu = 0.0 - if (associated(fluxv)) fluxv = 0.0 - - if (associated(conc)) conc = 0.0 - if (associated(mass)) mass = 0.0 - if (associated(mass25)) mass25 = 0.0 - - -! Calculate diagnostic fields -! --------------------------- - do n = 1, nmodes - mmr_name = 'SU_A_' // trim(mode_name(n)) ! name of the mass mixing ratio - nmr_name = 'NUM_A_' // trim(mode_name(n)) ! name of the number mixing ratio - - i = MAPL_SimpleBundleGetIndex(qa, mmr_name, 3, __RC__) - - - if (associated(sfcmass)) then - sfcmass(:,:) = sfcmass(:,:) + qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(sfcmass25)) then ! placeholder for now - sfcmass25(:,:) = sfcmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(colmass25)) then ! placeholder for now - do k = 1, km - colmass25(:,:) = colmass25(:,:) + 0.0 * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxu)) then - do k = 1, km - fluxu(:,:) = fluxu(:,:) + u(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(fluxv)) then - do k = 1, km - fluxv(:,:) = fluxv(:,:) + v(:,:,k) * qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - - if (associated(conc)) then - conc = conc + qa%r3(i)%q * rhoa - end if - - if (associated(mass)) then - mass = mass + qa%r3(i)%q - end if - - if (associated(mass25)) then ! placeholder for now - mass25 = mass25 + 0.0 * qa%r3(i)%q - end if - - end do -#endif - -! Clean up -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_SO4_Diagnostics - - - end module MAM_SulfateMod diff --git a/MAMchem_GridComp/MAM_WetRemovalMod.F90 b/MAMchem_GridComp/MAM_WetRemovalMod.F90 deleted file mode 100644 index dfb4d1ef..00000000 --- a/MAMchem_GridComp/MAM_WetRemovalMod.F90 +++ /dev/null @@ -1,181 +0,0 @@ -#include "MAPL_Exceptions.h" -#include "MAPL_Generic.h" - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAM_WetRemovalMod - Scavenging in convective updrafts and first-order -! rainout and washout by precipitation -! -! !INTERFACE: -! - module MAM_WetRemovalMod -! -! !USES: -! - use ESMF - - use MAPL - - use MAML_WetRemovalMod - use MAM_BaseMod - - implicit NONE - private - -! -! !PUBLIC MEMBER FUNCTIONS: - - public MAM_WetRemoval - -! -! !PUBLIC PARAMETERS: - -! -! !PRIVATE PARAMETERS: - real, private, parameter :: pi = MAPL_PI - real, private, parameter :: density_water = MAPL_RHOWTR ! density of water, 'kg m-3' - - -! -! !DESCRIPTION: -! -! {\tt MAML\_WetRemovalMod} provides a collection of methods for -! modeling wet removal of aerosol particles. -! -! -! !REVISION HISTORY: -! -! 29Nov2012 A. Darmenov Initial version -! -!EOP -!------------------------------------------------------------------------- - - - contains - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_WetRemoval --- -! -! !INTERFACE: - - subroutine MAM_WetRemoval(self, import, export, qa, cdt, rc) -! !USES: - - implicit NONE - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! number/mass mixing ratio - type(ESMF_State), intent(inout) :: export ! export state - integer, optional, intent(inout) :: rc ! return code - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import state - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - - -! !DESCRIPTION: Wet removal of aerosol particles. -! -! !REVISION HISTORY: -! -! 29Nov2011 A. Darmenov First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('MAM_WetRemoval') - - ! Mode parameters - ! --------------- - real :: f_wet - character(len=MAM_MAXSTR) :: aero_type - logical :: kin - character(len=MAM_MAXSTR) :: mode_name - - integer :: n_species - character(len=MAM_MAXSTR) :: species_name - - character(len=MAM_MAXSTR) :: field_name - - integer :: m, s - integer :: i_qa - - - ! Input fields from fvGCM - ! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: T - - real, pointer, dimension(:,:,:) :: pfllsan - real, pointer, dimension(:,:,:) :: pfilsan - real, pointer, dimension(:,:,:) :: qccu - real, pointer, dimension(:,:,:) :: cmfmc - real, pointer, dimension(:,:,:) :: dtrain - - real, pointer, dimension(:,:) :: precc - real, pointer, dimension(:,:) :: precl - - ! Exports - ! ----------------------- - real, pointer, dimension(:,:) :: flux => null() - - - ! Get Imports - ! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - call MAPL_GetPointer(import, precc, 'CN_PRCP', __RC__) - call MAPL_GetPointer(import, precl, 'NCN_PRCP', __RC__) - call MAPL_GetPointer(import, pfllsan, 'PFL_LSAN', __RC__) - call MAPL_GetPointer(import, pfilsan, 'PFI_LSAN', __RC__) - call MAPL_GetPointer(import, cmfmc, 'CNV_MFC', __RC__) - call MAPL_GetPointer(import, dtrain, 'CNV_MFD', __RC__) - - ! large-scale wet removal - aero_type = 'sulfate' - kin = .true. - - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name = mode_name, & - n_species = n_species, & - f_wet = f_wet) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - i_qa = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - call MAML_WetRemoval(qa%r3(i_qa)%q, f_wet, aero_type, kin, ple, T, rhoa, & - pfllsan, pfilsan, precc, precl, cdt, flux, __RC__) - - - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - i_qa = MAPL_SimpleBundleGetIndex(qa, field_name, 3, __RC__) - - call MAML_WetRemoval(qa%r3(i_qa)%q, f_wet, aero_type, kin, ple, T, rhoa, & - pfllsan, pfilsan, precc, precl, cdt, flux, __RC__) - end do - end do - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_WetRemoval - - -end module MAM_WetRemovalMod diff --git a/MAMchem_GridComp/MAMchem_GridComp.rc b/MAMchem_GridComp/MAMchem_GridComp.rc deleted file mode 100644 index e957c6c8..00000000 --- a/MAMchem_GridComp/MAMchem_GridComp.rc +++ /dev/null @@ -1,102 +0,0 @@ -# ----------------------------------------------- -# Resource file for the MAMchem Gridded Component -# ----------------------------------------------- - -verbose: .FALSE. - -# MAM scheme - MAM7(default) -# -------------------------- -scheme: MAM7 - - -# Aerosol processes -#------------------ -dry_removal: yes -wet_removal: yes -coagulation: yes -nucleation: yes - - -# Prognostics emissions parameters (resolution: a, b, c, d, e, f) -# --------------------------------------------------------------- -seasalt_femis: 0.875 1.1 0.875 0.875 0.875 0.612 -dust_femis: 0.2 0.46 0.08 0.08 0.08 0.067 - - -# Ratio of POM emissions to primary OC emissions -# ---------------------------------------------- -pom_oc_ratio: 1.4 - - -# Heights of aviation LTO, CDS and CRS layers, 'm' -# ------------------------------------------------- -aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3 - - -# Convective scavenging parameters -# -------------------------------- -f_conv_scav_ait: 0.5 # aitken mode -f_conv_scav_acc: 0.4 # accumulation mode -f_conv_scav_pcm: 0.1 # primary carbon mode -f_conv_scav_fss: 0.4 # fine seasalt mode -f_conv_scav_css: 0.5 # coarse seasalt mode -f_conv_scav_fdu: 0.3 # fine dust mode -f_conv_scav_cdu: 0.2 # coarse dust mode - - -# Large scale wet removal efficiency -# ---------------------------------- -f_wet_ait: 1.0 # aitken mode -f_wet_acc: 1.0 # accumulation mode -f_wet_pcm: 1.0 # primary carbon mode -f_wet_fss: 1.0 # fine seasalt mode -f_wet_css: 1.0 # coarse seasalt mode -f_wet_fdu: 0.5 # fine dust mode -f_wet_cdu: 0.5 # coarse dust mode - - -# Monochromatic Mie lookup tables -# ------------------------------- -narrowband_optics_ait: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_AIT.v0.3-rc1.nc4 -narrowband_optics_acc: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_ACC.v0.3-rc1.nc4 -narrowband_optics_pcm: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_PCM.v0.3-rc1.nc4 -narrowband_optics_fss: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_FSS.v0.3-rc1.nc4 -narrowband_optics_css: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_CSS.v0.3-rc1.nc4 -narrowband_optics_fdu: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_FDU.v0.3-rc1.nc4 -narrowband_optics_cdu: /home/adarmeno/tmp/MAM7-OpticsTables/_optics_MAM7_CDU.v0.3-rc1.nc4 - - -# Broadband Mie lookup tables -# --------------------------- -broadband_optics_ait: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_AIT.v0.3-rc1.nc4 -broadband_optics_acc: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_ACC.v0.3-rc1.nc4 -broadband_optics_pcm: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_PCM.v0.3-rc1.nc4 -broadband_optics_fss: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_FSS.v0.3-rc1.nc4 -broadband_optics_css: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_CSS.v0.3-rc1.nc4 -broadband_optics_fdu: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_FDU.v0.3-rc1.nc4 -broadband_optics_cdu: /home/adarmeno/tmp/MAM7-OpticsTables/_opticsBands_MAM7_CDU.v0.3-rc1.nc4 - - -PRIMARY_AEROSOL_EMISSIONS: - EMISSIONS_FIRE - EMISSIONS_BIOFUEL - EMISSIONS_FOSSILFUEL - EMISSIONS_SHIP -:: - -EMISSIONS_FIRE: -# mode species weight(by mass) sigma Dgn(um) -# ------------------------------------------------- - PCM BC 1.0 1.8 0.080 - PCM POM 1.0 1.8 0.080 - AIT SU 0.025 1.8 0.080 -:: - -EMISSIONS_BIOFUEL: -# mode species weight(by mass) sigma Dgn(um) -# ------------------------------------------------- - PCM BC 1.0 1.8 0.080 - PCM POM 1.0 1.8 0.080 - AIT SU 0.025 1.8 0.080 -:: - diff --git a/MAMchem_GridComp/MAMchem_GridCompMod.F90 b/MAMchem_GridComp/MAMchem_GridCompMod.F90 deleted file mode 100644 index 853dce9e..00000000 --- a/MAMchem_GridComp/MAMchem_GridCompMod.F90 +++ /dev/null @@ -1,5107 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MAMchem_GridCompMod - Implements MAM Chemistry -! -! !INTERFACE: -! - module MAMchem_GridCompMod -! -! !USES: -! - use ESMF - use MAPL - - use Chem_UtilMod, only: Chem_UtilResVal - - USE modal_aero_amicphys, only: modal_aero_amicphys_intr - - use modal_aero_data, only: numptr_amode, lmassptr_amode - USE modal_aero_calcsize, only: modal_aero_calcsize_sub - - use MAM3_DataMod - use MAM7_DataMod - - use MAM_BaseMod - use MAM_ComponentsDataMod - - use MAM_SizeMod, only: MAM_DrySize, MAM_WetSize - - use MAM_SeasaltMod, only: MAM_SS_Emission, MAM_SS_Diagnostics - use MAM_DustMod, only: MAM_DU_Emission, MAM_DU_Diagnostics - use MAM_BlackCarbonMod, only: MAM_BC_Emission - use MAM_OrganicCarbonMod, only: MAM_OC_Emission - use MAM_SulfateMod, only: MAM_SO4_Emission - - use MAM_DryRemovalMod, only: MAM_DryRemoval - use MAM_WetRemovalMod, only: MAM_WetRemoval - - use MAML_OpticsTableMod, only: MAML_OpticsTable, & - MAML_OpticsTableCreate, & - MAML_OpticsTableDestroy, & - MAML_OpticsTableRead - use MAML_OpticsMod, only: MAML_OpticsInterpolate - - - implicit none - private - - - type(MAML_OpticsTable), save :: MAM7_MieTable(7) - - integer, parameter :: instanceComputational = 1 - integer, parameter :: instanceData = 2 - - -! -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices -! -! !DESCRIPTION: -! -! {\tt MAMchem\_GridComp} is an ESMF gridded component implementing -! the MAM aerosol microphysical processes. -! -! Developed for GEOS-5 release Fortuna 2.0 and later. -! -! !REVISION HISTORY: -! -! 06Dec2009 da Silva Created the MATRIX skeleton. -! 15Aug2011 A. Darmenov Initial version of MAM -! -!EOP -!------------------------------------------------------------------------- - -! Legacy state -! ------------ - type MAM_State - private - - logical :: data_driven = .false. - - type(ESMF_Config) :: CF ! Private Config - - type(ESMF_Grid) :: grid ! Grid - - integer :: im_world ! Horizontal dimensions - lon - integer :: jm_world ! Horizontal dimensions - lat - - type(MAPL_SimpleBundle) :: qa ! Interstitial aerosol species and absorbed water - type(MAPL_SimpleBundle) :: qc ! Cloud-borne aerosol species - type(MAPL_SimpleBundle) :: qg ! Gas species - - type(MAPL_SimpleBundle) :: Da ! Dry and 'wet' geometric mean diameter of interstitial aerosol number size distribution - - real :: dt ! Model time step - - integer :: scheme_id ! MAM7 or MAM3 - type(MAM_Scheme) :: scheme ! MAM scheme/configuration - - real :: femisSS ! Seasalt emission tuning parameter - real :: femisDU ! Dust emission tuning parameter - - real :: pom_oc_ratio ! ratio of POM emissions to primary OC emissions - - logical :: dry_removal ! turn on/off dry removal processes - logical :: wet_removal ! turn on/off wet removal processes - logical :: nucleation ! turn on/off nucleation process - logical :: condensation ! turn on/off condensation process - logical :: coagulation ! turn on/off coagulation process - logical :: rename ! turn on/off rename manager - - logical :: microphysics ! turn on/off aerosol microphysics - logical :: mode_merging ! turn on/off explicit mode merging - - real :: f_conv_scav_ait - real :: f_conv_scav_acc - real :: f_conv_scav_pcm - real :: f_conv_scav_fss - real :: f_conv_scav_css - real :: f_conv_scav_fdu - real :: f_conv_scav_cdu - - real :: f_wet_ait - real :: f_wet_acc - real :: f_wet_pcm - real :: f_wet_fss - real :: f_wet_css - real :: f_wet_fdu - real :: f_wet_cdu - - type(MAML_OpticsTable) :: mie_ait - type(MAML_OpticsTable) :: mie_acc - type(MAML_OpticsTable) :: mie_pcm - type(MAML_OpticsTable) :: mie_fss - type(MAML_OpticsTable) :: mie_css - type(MAML_OpticsTable) :: mie_fdu - type(MAML_OpticsTable) :: mie_cdu - - logical :: verbose ! verbosity flag - end type MAM_State - -! Hook for the ESMF -! ----------------- - type MAM_Wrap - type (MAM_State), pointer :: PTR => null() - end type MAM_Wrap - - -contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices --- Sets IRF services for the MAMchem Grid Component -! -! !INTERFACE: - - subroutine SetServices ( GC, RC ) - -! !ARGUMENTS: - - type(ESMF_GridComp), intent(INOUT) :: GC ! gridded component - integer, optional :: RC ! return code - -! !DESCRIPTION: Sets Initialize, Run and Finalize services. -! -! !REVISION HISTORY: -! -! 1Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('SetServices') - -! Local derived type aliases -! -------------------------- - type (MAM_State), pointer :: self ! internal private state - type (MAM_wrap) :: wrap - - character(len=ESMF_MAXSTR) :: comp_name - -! Local variables -! -------------------------- - character(len=ESMF_MAXSTR) :: scheme ! name of MAM scheme/configuration - - character(len=MAM_MAXSTR) :: field_name ! field name - character(len=MAM_MAXSTR) :: field_long_name ! field name - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - character(len=MAM_MAXSTR) :: mode_long_name ! aerosol mode name - character(len=MAM_MAXSTR) :: species_name ! aerosol species name - character(len=MAM_MAXSTR) :: attachment_state ! attachment state of aerosols - integer :: n_species ! number of aerosol species - integer :: m, s ! mode and species indexes - -! local -! ----- - type(ESMF_Config) :: CF ! Universal Config - character(len=1024) :: mie_optics_file ! MAM Mie optics table file - - character(len=ESMF_MAXSTR), parameter:: microphysics_process(4) = (/'GAEX', 'RNAM', 'NUCL', 'COND'/) - character(len=ESMF_MAXSTR) :: process ! abbreviation of the process - integer :: i ! counter - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - -! Wrap internal state for storing in GC; rename legacyState -! ------------------------------------- - allocate ( self, stat=STATUS ) - VERIFY_(STATUS) - wrap%ptr => self - - -! Is the component data driven -! ---------------------------- - self%data_driven = isDataDrivenGC_(GC, __RC__) - - -! Load private Config Attributes -! ------------------------------ - self%CF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile ( self%CF, 'MAMchem_GridComp.rc', __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%verbose, label='verbose:', default=.false., __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, scheme, label='scheme:', default='MAM7' , __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%dry_removal, label='dry_removal:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%wet_removal, label='wet_removal:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%nucleation, label='nucleation:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%condensation, label='condensation:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%coagulation, label='coagulation:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%rename, label='rename:', default=.true., __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%microphysics, label='microphysics:', default=.true., __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%mode_merging, label='mode_merging:', default=.true., __RC__ ) - - -! call ESMF_ConfigGetAttribute ( self%CF, self%femisSS, label='seasalt_femis:', default=1.0, __RC__ ) -! call ESMF_ConfigGetAttribute ( self%CF, self%femisDU, label='dust_femis:', default=1.0, __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%pom_oc_ratio, label='pom_oc_ratio:', default=1.4, __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_ait, label='f_conv_scav_ait:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_acc, label='f_conv_scav_acc:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_pcm, label='f_conv_scav_pcm:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_fss, label='f_conv_scav_fss:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_css, label='f_conv_scav_css:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_fdu, label='f_conv_scav_fdu:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_conv_scav_cdu, label='f_conv_scav_cdu:', default=0.0, __RC__ ) - - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_ait, label='f_wet_ait:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_acc, label='f_wet_acc:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_pcm, label='f_wet_pcm:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_fss, label='f_wet_fss:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_css, label='f_wet_css:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_fdu, label='f_wet_fdu:', default=0.0, __RC__ ) - call ESMF_ConfigGetAttribute ( self%CF, self%f_wet_cdu, label='f_wet_cdu:', default=0.0, __RC__ ) - - -! Set the MAM model scheme -! ------------------------- - scheme = ESMF_UtilStringUpperCase(scheme, __RC__) - - select case (scheme) - case ('MAM7') - self%scheme_id = MAM7_SCHEME - - case default - __raise__ (MAM_UNKNOWN_SCHEME_ERROR, "Unsupported MAM scheme: " // trim(scheme)) - end select - - - -! Set the profiling timers -! ------------------------ - call MAPL_TimerAdd(GC, name='TOTAL', __RC__) - call MAPL_TimerAdd(GC, name='INITIALIZE', __RC__) - call MAPL_TimerAdd(GC, name='RUN', __RC__) - call MAPL_TimerAdd(GC, name='-EMISSIONS', __RC__) - call MAPL_TimerAdd(GC, name='-MICROPHYSICS', __RC__) - call MAPL_TimerAdd(GC, name='--MICROPHYSICS_POSITIVE', __RC__) - call MAPL_TimerAdd(GC, name='-AQUEOUS_CHEM', __RC__) - call MAPL_TimerAdd(GC, name='-SIZE', __RC__) - call MAPL_TimerAdd(GC, name='--SIZE_DRY', __RC__) - call MAPL_TimerAdd(GC, name='--SIZE_WET', __RC__) - call MAPL_TimerAdd(GC, name='-MODE_MERGING', __RC__) - call MAPL_TimerAdd(GC, name='-REMOVAL', __RC__) - call MAPL_TimerAdd(GC, name='--REMOVAL_DRY', __RC__) - call MAPL_TimerAdd(GC, name='---REMOVAL_DRY_SETTLING', __RC__) - call MAPL_TimerAdd(GC, name='---REMOVAL_DRY_DEPOSITION', __RC__) - call MAPL_TimerAdd(GC, name='---REMOVAL_DRY_SOLVER', __RC__) - call MAPL_TimerAdd(GC, name='--REMOVAL_WET', __RC__) - call MAPL_TimerAdd(GC, name='-HYGROSCOPIC_GROWTH', __RC__) - call MAPL_TimerAdd(GC, name='-DIAGNOSTICS', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_SEASALT', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_DUST', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_CIM', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_SFC', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_AOT', __RC__) - - -! ------------------------ -! ESMF Functional Services -! ------------------------ - -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize_, __RC__ ) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run_, __RC__ ) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize_, __RC__ ) - -! Store internal state in GC -! -------------------------- - call ESMF_UserCompSetInternalState ( GC, 'MAM_state', wrap, STATUS ) - VERIFY_(STATUS) - -! ------------------ -! MAPL Data Services -! ------------------ - -!BOS -! -! !IMPORT STATE: - -#include "MAMchem_ImportSpec___.h" - -! !INTERNAL STATE: - - -! !EXTERNAL STATE: - -#include "MAMchem_ExportSpec___.h" - -!EOS - -! Set MAM infrastructure -! ----------------------------- - call MAM_SchemeInit(self%scheme, self%scheme_id, __RC__) - - -! Add interstitial aerosols to the internal state -! ----------------------------------------------- - attachment_state = 'interstitial' - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, long_name=mode_long_name, n_species=n_species) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - field_long_name = 'number of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = '#/kg', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartOptional, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', __RC__) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = trim(species_name) // '_A_' // trim(mode_name) - field_long_name = 'mass mixing ratio of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartOptional, & - FRIENDLYTO = 'DYNAMICS:TURBULENCE:MOIST', __RC__) - end do - - ! absorbed water - field_name = 'WTR_A_' // trim(mode_name) - field_long_name = 'mass mixing ratio of absorbed water by ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - ADD2EXPORT = .true., & - RESTART = MAPL_RestartSkip, __RC__) - - ! dry size - field_name = 'DGN_DRY_' // trim(mode_name) - field_long_name = 'dry diameter of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - ADD2EXPORT = .true., & - RESTART = MAPL_RestartSkip, __RC__) - - ! wet size - field_name = 'DGN_WET_' // trim(mode_name) - field_long_name = 'wet diameter of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - ADD2EXPORT = .true., & - RESTART = MAPL_RestartSkip, __RC__) - end do - - -! Add cloud-borne aerosols to the internal state -! ---------------------------------------------- - attachment_state = 'cloud-borne' - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, long_name=mode_long_name, n_species=n_species) - - ! number mixing ratio - field_name = 'NUM_C_' // trim(mode_name) - field_long_name = 'number of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = '#/kg', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartOptional, & - FRIENDLYTO = 'MOIST', __RC__) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = trim(species_name) // '_C_' // trim(mode_name) - field_long_name = 'mass mixing ratio of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartOptional, & - FRIENDLYTO = 'MOIST', __RC__) - end do - end do - -#if (0) -! Add dry and wet aerosol sizes to the internal state -! --------------------------------------------------- - attachment_state = 'interstitial' - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, long_name=mode_long_name, n_species=n_species) - - field_name = 'DGN_DRY_' // trim(mode_name) - field_long_name = 'dry geometric mean diameter of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - FRIENDLYTO = trim(COMP_NAME), __RC__) - - - field_name = 'DGN_WET_' // trim(mode_name) - field_long_name = 'wet size of ' // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - call MAPL_AddInternalSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RESTART = MAPL_RestartSkip, & - FRIENDLYTO = trim(COMP_NAME), __RC__) - end do -#endif - -! This state is needed by radiation - It will contain -! aerosol number and mass mixing ratios, and aerosol optics -! --------------------------------------------------------------- - call MAPL_AddExportSpec(GC, SHORT_NAME = 'AERO', & - LONG_NAME = 'aerosol_mixing_ratios', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_StateItem, __RC__) - - -! This state is needed by MOIST - It will contain -! aerosol number concentrations and aerosol activation properties -! --------------------------------------------------------------- - call MAPL_AddExportSpec(GC, SHORT_NAME = 'AERO_ACI', & - LONG_NAME = 'aerosol_cloud_interaction', & - UNITS = 'kg kg-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_StateItem, __RC__) - - -! -! Diagnostics: Column-integrated tendencies due to -! gas-aerosol-exchange/condensation, rename, nucleation and -! coagulation -! --------------------------------------------------------------- - MICROPHYSICS_PROCESSES: do i = 1, size(microphysics_process) - - process = trim(microphysics_process(i)) - - attachment_state = 'interstitial' - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, long_name=mode_long_name, n_species=n_species) - - ! number mixing ratio - field_name = 'DDT_NUM_A_' // trim(mode_name) // '_' // trim(process) - field_long_name = 'column-integrated_tendency_due_to_' // trim(process) - - call MAPL_AddExportSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = '# m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = 'DDT_' // trim(species_name) // '_A_' // trim(mode_name) // '_' // trim(process) - field_long_name = 'column-integrated_tendency_due_to_' // trim(process) - - call MAPL_AddExportSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - end do - end do - - - CLOUD_BOURNE_RENAME_DIAGNOSTICS: if (process == 'RNAM') then - - attachment_state = 'cloud-borne' - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, long_name=mode_long_name, n_species=n_species) - - ! number mixing ratio - field_name = 'DDT_NUM_C_' // trim(mode_name) // '_' // trim(process) - field_long_name = 'column-integrated_tendency_due_to_' // trim(process) - - call MAPL_AddExportSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = '# m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = 'DDT_' // trim(species_name) // '_C_' // trim(mode_name) // '_' // trim(process) - field_long_name = 'column-integrated_tendency_due_to_' // trim(process) - - call MAPL_AddExportSpec(GC, SHORT_NAME = trim(field_name), & - LONG_NAME = trim(field_long_name), & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - __RC__) - end do - end do - end if CLOUD_BOURNE_RENAME_DIAGNOSTICS - - end do MICROPHYSICS_PROCESSES - - - -! Create Mie tables for coupling with radiation -! --------------------------------------------- - call ESMF_GridCompGet(GC, config=CF, __RC__) ! read paths to Mie tables from global config - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_AIT_OPTICS:', __RC__) - MAM7_MieTable(1) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(1), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_ACC_OPTICS:', __RC__) - MAM7_MieTable(2) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(2), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_PCM_OPTICS:', __RC__) - MAM7_MieTable(3) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(3), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_FSS_OPTICS:', __RC__) - MAM7_MieTable(4) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(4), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_CSS_OPTICS:', __RC__) - MAM7_MieTable(5) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(5), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_FDU_OPTICS:', __RC__) - MAM7_MieTable(6) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(6), __RC__) - - call ESMF_ConfigGetAttribute(CF, mie_optics_file, label='MAM7_CDU_OPTICS:', __RC__) - MAM7_MieTable(7) = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(MAM7_MieTable(7), __RC__) - - -! This bundle is not filled in by MAM, just a place holder for now -! ---------------------------------------------------------------- - call MAPL_AddExportSpec(GC, SHORT_NAME = 'AERO_DP', & - LONG_NAME = 'aerosol_deposition', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - DATATYPE = MAPL_BundleItem, __RC__) - -! Generic Set Services -! -------------------- - call MAPL_GenericSetServices ( GC, __RC__ ) - -! All done -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine SetServices - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize MAMchem -! -! !INTERFACE: -! - - subroutine Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 01Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Initialize_') - - type(MAM_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - type(ESMF_State) :: aero ! - type(ESMF_FieldBundle) :: aero_state_aerosols! - logical :: implements_aerosol_optics - type(ESMF_Field) :: field ! field - character(len=MAM_MAXSTR) :: field_name ! field name - - type(ESMF_State) :: aero_aci ! - logical :: implements_aap_method - character(len=ESMF_MAXSTR), allocatable, dimension(:) :: aero_aci_modes - - integer :: im_World, jm_World ! Global 2D Dimensions - integer :: im, jm, lm ! 3D Dimensions - - integer, parameter :: n_hres = 6 ! number of horizontal resolutions (a, b, c, d, e) - real, dimension(n_hres) :: f_hres ! buffer for the resolution dependent factors - integer :: n - - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=1024) :: var_names ! comma separated names - - character(len=ESMF_MAXSTR) :: comp_name ! component's name - - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - character(len=MAM_MAXSTR) :: species_name ! aerosol species name - integer :: n_species ! number of aerosol species - integer :: m, s ! mode and species indexes - - real :: hygroscopicity ! hygroscopicity of the aerosol species - real :: solubility ! solubility of the aerosol specie - - real :: f_scav ! globally uniform convective scavenging coefficient, km-1 - - character(len=1024) :: mie_optics_file - - real, parameter :: f_scav_none = 0.0 - real, parameter :: f_wet_none = 0.0 - - character(len=2), parameter :: name_delimiter = ', ' - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- - type(MAPL_MetaComp), pointer :: mgState - type(ESMF_State) :: INTERNAL - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=COMP_NAME, __RC__ ) - Iam = trim(comp_name) // '::' // trim(Iam) - -! -------- - if (MAPL_AM_I_ROOT()) then - write (*,*) trim(Iam)//': Starting...' - write (*,*) - end if - - call MAPL_GetObjectFromGC ( GC, mgState, __RC__) - - call MAPL_TimerOn(mgState, 'TOTAL', __RC__) - call MAPL_TimerOn(mgState, 'INITIALIZE', __RC__) - -! Initialize MAPL Generic -! ----------------------- - call MAPL_GenericInitialize ( GC, IMPORT, EXPORT, clock, __RC__ ) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- - call MAPL_Get (mgState, INTERNAL_ESMF_STATE=INTERNAL, __RC__) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, CLOCK, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, & - nymd, nhms, cdt, __RC__ ) - -! Aerosol Processes -! ----------------- - if (self%verbose .and. MAPL_AM_I_ROOT()) then - write (*,*) 'Aerosol processes:' - call PrintProcessFlag('Dry removal ', self%dry_removal) - call PrintProcessFlag('Wet removal ', self%wet_removal) - - if (.not. self%microphysics) then - call PrintProcessFlag('Microphysics', self%microphysics) - else - call PrintProcessFlag('Condensation', self%condensation) - call PrintProcessFlag('Nucleation ', self%nucleation) - call PrintProcessFlag('Coagulation ', self%coagulation) - call PrintProcessFlag('Rename ', self%rename) - end if - - call PrintProcessFlag('Mode merging', self%mode_merging) - - write (*,*) - end if - - -! Set the grid and dimensions -! --------------------------- - self%grid = GRID - - self%im_world = im_World - self%jm_world = jm_World - - -! Set the time step -! ----------------- - self%dt = cdt - - -! Set resolution dependent parameters -! ----------------------------------- - call ESMF_ConfigFindLabel(self%CF, 'seasalt_femis:', __RC__) - do n = 1, size(f_hres) - call ESMF_ConfigGetAttribute(self%CF, f_hres(n), __RC__) - end do - self%femisSS = Chem_UtilResVal(self%im_world, self%jm_world, f_hres(:), STATUS) - VERIFY_(STATUS) - - - call ESMF_ConfigFindLabel(self%CF, 'dust_femis:', __RC__) - do n = 1, size(f_hres) - call ESMF_ConfigGetAttribute(self%CF, f_hres(n), __RC__) - end do - self%femisDU = Chem_UtilResVal(self%im_world, self%jm_world, f_hres(:), STATUS) - VERIFY_(STATUS) - - -! Box model aerosol microphysics -! ------------------------------ - call microphysics_initialize(imozart=1, verbose=.false., __RC__) - - -! Bundle the interstitial and cloud-borne tracers -! ------------------------------------------------- - var_names = '' - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - ! number mixing ratio - field_name = 'NUM_A_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - - ! absorbed water - field_name = 'WTR_A_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = trim(species_name) // '_A_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - end do - end do - var_names = trim(var_names(1:len_trim(var_names)-1)) - - self%qa = MAPL_SimpleBundleCreate(INTERNAL, name='MAM_INTERSTITIAL_AEROSOLS', & - only_vars=var_names, __RC__) - call MAPL_SimpleBundlePrint(self%qa) - - - var_names = '' - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - ! number mixing ratio - field_name = 'NUM_C_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - - ! mass mixing ratios - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - - field_name = trim(species_name) // '_C_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - end do - end do - var_names = trim(var_names(1:len_trim(var_names)-1)) - - self%qc = MAPL_SimpleBundleCreate(INTERNAL, name='MAM_CLOUDBORNE_AEROSOLS', & - only_vars=var_names, __RC__) - call MAPL_SimpleBundlePrint(self%qc) - - -! Bundle the dry and wet modal geometric diameters -! ------------------------------------------------- - var_names = '' - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - field_name = 'DGN_DRY_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - - field_name = 'DGN_WET_' // trim(mode_name) - var_names = trim(var_names) // trim(field_name) // trim(name_delimiter) - end do - var_names = trim(var_names(1:len_trim(var_names)-1)) - - self%Da = MAPL_SimpleBundleCreate(INTERNAL, name='MAM_INTERSTITIAL_AEROSOLS_DIAMETERS', & - only_vars=var_names, __RC__) - call MAPL_SimpleBundlePrint(self%Da) - -! Bundle the gas tracers -! ------------------------------------------------- - var_names = 'H2SO4, SO2, NH3, SOA_GAS' - - self%qg = MAPL_SimpleBundleCreate(IMPORT, name='MAM_GAS_SPECIES', & - only_vars=var_names, __RC__) - call MAPL_SimpleBundlePrint(self%qg) - - -! Fill the AERO State with the aerosol mixing ratios -! --------------------------------------------------- - call ESMF_StateGet(EXPORT, 'AERO', aero, __RC__) - - ! This attribute indicates if the aerosol optics method is implemented or not. - ! Radiation will not call the aerosol optics method unless this attribute is - ! explicitly set to true. - - implements_aerosol_optics = .true. - - call ESMF_AttributeSet(aero, name = 'implements_aerosol_optics_method', & - value = implements_aerosol_optics, __RC__) - - COUPLING_TO_RADIATION: if (implements_aerosol_optics) then - - aero_state_aerosols = ESMF_FieldBundleCreate(name="AEROSOLS", __RC__) - call MAPL_StateAdd(aero, aero_state_aerosols, __RC__) - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - ! interstitial aerosol tracers - field_name = 'NUM_A_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - - field_name = 'WTR_A_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - - field_name = 'DGN_WET_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - end do - end do - - - ! TODO - ! MAM_MieTable = MAM_MieCreate(CF, __RC__) - - ! state of the atmosphere - call ESMF_AttributeSet(aero, name='air_pressure_for_aerosol_optics', value='PLE', __RC__) - call ESMF_AttributeSet(aero, name='relative_humidity_for_aerosol_optics', value='RH', __RC__) - call ESMF_AttributeSet(aero, name='cloud_area_fraction_for_aerosol_optics', value='', __RC__) ! 'cloud_area_fraction_in_atmosphere_layer_for_aerosol_optics' - - ! aerosol optics - call ESMF_AttributeSet(aero, name='band_for_aerosol_optics', value=0, __RC__) - call ESMF_AttributeSet(aero, name='extinction_in_air_due_to_ambient_aerosol', value='EXT', __RC__) - call ESMF_AttributeSet(aero, name='single_scattering_albedo_of_ambient_aerosol', value='SSA', __RC__) - call ESMF_AttributeSet(aero, name='asymmetry_parameter_of_ambient_aerosol', value='ASY', __RC__) - - ! add PLE to Aero state - call ESMF_AttributeGet(aero, name='air_pressure_for_aerosol_optics', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationEdge, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, field, __RC__) - end if - - ! add RH to Aero state - call ESMF_AttributeGet(aero, name='relative_humidity_for_aerosol_optics', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, field, __RC__) - end if - - ! add EXT to Aero state - call ESMF_AttributeGet(aero, name='extinction_in_air_due_to_ambient_aerosol', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, field, __RC__) - end if - - ! add SSA to aero state - call ESMF_AttributeGet(aero, name='single_scattering_albedo_of_ambient_aerosol', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, field, __RC__) - end if - - ! add ASY to aero state - call ESMF_AttributeGet(aero, name='asymmetry_parameter_of_ambient_aerosol', value=field_name, RC=STATUS) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero, field, __RC__) - end if - - ! attach the aerosol optics method - call ESMF_MethodAdd(aero, label='aerosol_optics', userRoutine=aerosol_optics, __RC__) - - end if COUPLING_TO_RADIATION - - -! Fill the AERO State with the aerosol mixing ratios -! --------------------------------------------------- - call ESMF_StateGet(EXPORT, 'AERO_ACI', aero_aci, __RC__) - - ! This attribute indicates if the aerosol optics method is implemented or not. - ! Radiation will not call the aerosol optics method unless this attribute is - ! explicitly set to true. - - implements_aap_method = .true. - - call ESMF_AttributeSet(aero_aci, name = 'implements_aerosol_activation_properties_method', & - value = implements_aap_method, __RC__) - - COUPLING_TO_CLOUD_MICROPHYSICS: if (implements_aap_method) then - - _ASSERT(self%scheme%n_modes > 0,'needs informative message') - - allocate(aero_aci_modes(self%scheme%n_modes), __STAT__) - - aero_state_aerosols = ESMF_FieldBundleCreate(name="AEROSOLS", __RC__) - call MAPL_StateAdd(aero_aci, aero_state_aerosols, __RC__) - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - ! add the mode name to the list of aerosol modes - aero_aci_modes(m) = trim(mode_name) - - ! interstitial aerosol tracers - field_name = 'NUM_A_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_FieldBundleAdd(aero_state_aerosols, (/field/), __RC__) - end do - end do - - ! Following the aerosol-cloud-interaction state protocol, next steps are: - ! - attach a list with the aerosol modes - ! - attach required met fields - ! - attach method that computes the aerosol activation properties - - call ESMF_AttributeSet(aero_aci, name='number_of_aerosol_modes', value=self%scheme%n_modes, __RC__) - call ESMF_AttributeSet(aero_aci, name='aerosol_modes', itemcount=self%scheme%n_modes, valuelist=aero_aci_modes, __RC__) - - deallocate(aero_aci_modes, __STAT__) - - - ! met fields and land fraction - call ESMF_AttributeSet(aero_aci, name='air_pressure', value='', __RC__) - call ESMF_AttributeSet(aero_aci, name='air_temperature', value='', __RC__) - call ESMF_AttributeSet(aero_aci, name='fraction_of_land_type', value='', __RC__) - - ! aerosol activation properties - call ESMF_AttributeSet(aero_aci, name='width_of_aerosol_mode', value='SIGMA', __RC__) - call ESMF_AttributeSet(aero_aci, name='aerosol_number_concentration', value='NUM', __RC__) - call ESMF_AttributeSet(aero_aci, name='aerosol_dry_size', value='DGN', __RC__) - call ESMF_AttributeSet(aero_aci, name='aerosol_density', value='density', __RC__) - call ESMF_AttributeSet(aero_aci, name='aerosol_hygroscopicity', value='KAPPA', __RC__) - call ESMF_AttributeSet(aero_aci, name='fraction_of_dust_aerosol', value='FDUST', __RC__) - call ESMF_AttributeSet(aero_aci, name='fraction_of_soot_aerosol', value='FSOOT', __RC__) - call ESMF_AttributeSet(aero_aci, name='fraction_of_organic_aerosol', value='FORGANIC', __RC__) - - - ! add PLE to ACI state - call ESMF_AttributeGet(aero_aci, name='air_pressure', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationEdge, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - ! add T to ACI state - call ESMF_AttributeGet(aero_aci, name='air_temperature', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - ! add FRLAND to ACI state - call ESMF_AttributeGet(aero_aci, name='fraction_of_land_type', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzOnly, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - ! add aerosol activation properties to ACI state - call ESMF_AttributeGet(aero_aci, name='width_of_aerosol_mode', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='aerosol_number_concentration', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='aerosol_dry_size', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='aerosol_density', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='aerosol_hygroscopicity', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='fraction_of_dust_aerosol', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='fraction_of_soot_aerosol', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - call ESMF_AttributeGet(aero_aci, name='fraction_of_organic_aerosol', value=field_name, __RC__) - if (field_name /= '') then - field = MAPL_FieldCreateEmpty(trim(field_name), self%grid, __RC__) - - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_StateAdd(aero_aci, field, __RC__) - end if - - ! attach the aerosol optics method - call ESMF_MethodAdd(aero_aci, label='aerosol_activation_properties', userRoutine=aerosol_activation_properties, __RC__) - - end if COUPLING_TO_CLOUD_MICROPHYSICS - - - -! Fill the scavenging coefficients -! -------------------------------- - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species) - - select case (trim(mode_name)) - case (trim(MAM7_AITKEN_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_ait, & - f_wet = self%f_wet_ait) - - case (trim(MAM7_ACCUMULATION_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_acc, & - f_wet = self%f_wet_acc) - - case (trim(MAM7_PRIMARY_CARBON_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_pcm, & - f_wet = self%f_wet_pcm) - - case (trim(MAM7_FINE_SEASALT_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_fss, & - f_wet = self%f_wet_fss) - - case (trim(MAM7_FINE_DUST_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_fdu, & - f_wet = self%f_wet_fdu) - - case (trim(MAM7_COARSE_SEASALT_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_css, & - f_wet = self%f_wet_css) - - case (trim(MAM7_COARSE_DUST_MODE_NAME)) - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = self%f_conv_scav_cdu, & - f_wet = self%f_wet_cdu) - - case default - call MAM_AerosolModeSet(self%scheme%mode(m), f_conv_scavenging = f_scav_none, f_wet = f_wet_none) - end select - end do - - do m = 1, self%scheme%n_modes - call MAM_AerosolModeGet(self%scheme%mode(m), name=mode_name, n_species=n_species, f_conv_scavenging=f_scav) - - if (self%verbose .and. MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': Convective Scavenging Parameter of '//trim(mode_name)//' : ', f_scav - end if - - ! interstitial aerosol tracers - field_name = 'NUM_A_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - - call ESMF_AttributeSet(field, NAME='ScavengingFractionPerKm', VALUE=f_scav, __RC__) - - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - - call ESMF_AttributeSet(field, NAME='ScavengingFractionPerKm', VALUE=f_scav, __RC__) - end do - - ! cloud-borne aerosol tracers - field_name = 'NUM_C_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_AttributeSet(field, NAME='ScavengingFractionPerKm', VALUE=f_scav_none, __RC__) - - do s = 1, n_species - species_name = self%scheme%mode(m)%species(s)%name - field_name = trim(species_name) // '_C_' // trim(mode_name) - call ESMF_StateGet(INTERNAL, trim(field_name), field, __RC__) - call ESMF_AttributeSet(field, NAME='ScavengingFractionPerKm', VALUE=f_scav_none, __RC__) - end do - end do - -#ifdef PRINT_STATES - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': AERO State during Initialize():' - call ESMF_StatePrint(aero, nestedFlag=.true., __RC__) - end if -#endif - -! Create narrow-band Mie tables -! ----------------------------- - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_ait:', default='', __RC__ ) - self%mie_ait = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_ait, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_acc:', default='', __RC__ ) - self%mie_acc = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_acc, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_pcm:', default='', __RC__ ) - self%mie_pcm = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_pcm, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_fss:', default='', __RC__ ) - self%mie_fss = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_fss, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_css:', default='', __RC__ ) - self%mie_css = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_css, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_fdu:', default='', __RC__ ) - self%mie_fdu = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_fdu, __RC__) - - call ESMF_ConfigGetAttribute ( self%CF, mie_optics_file, Label='narrowband_optics_cdu:', default='', __RC__ ) - self%mie_cdu = MAML_OpticsTableCreate(trim(mie_optics_file), __RC__) - call MAML_OpticsTableRead(self%mie_cdu, __RC__) - - -! All done -! -------- - call MAPL_TimerOff(mgState, 'INITIALIZE', __RC__) - call MAPL_TimerOff(mgState, 'TOTAL', __RC__) - - RETURN_(ESMF_SUCCESS) - - contains - - subroutine PrintProcessFlag(name, state) - implicit none - character(len=*), intent(in) :: name - logical, intent(in) :: state - - character(len=*), parameter :: fmt_flag = "(4X, A12, X, '-', X, A3)" - - if (state) then - write (*, fmt_flag) trim(name), 'ON' - else - write (*, fmt_flag) trim(name), 'OFF' - end if - end subroutine PrintProcessFlag - - - subroutine microphysics_initialize(imozart, verbose, rc) - use MAPL_ConstantsMod, only: r8 => MAPL_R8 - - use constituents, only: pcnst, cnst_name, cnst_longname - use chem_mods, only: gas_pcnst, adv_mass - - use modal_aero_data, only: ntot_amode, ntot_aspectype, nspec_amode, numptr_amode, lmassptr_amode, numptrcw_amode, lmassptrcw_amode - use modal_aero_initialize_data, only: modal_aero_register, modal_aero_initialize - - use MAM_ComponentsDataMod - - implicit none - - integer, intent(in) :: imozart - logical, intent(in) :: verbose - integer, intent(out) :: rc - - ! local - real(r8) :: sigma(ntot_amode) - real(r8) :: dgn(ntot_amode) - real(r8) :: dgn_low(ntot_amode) - real(r8) :: dgn_hi(ntot_amode) - real(r8) :: rh_crystal(ntot_amode) - real(r8) :: rh_deliques(ntot_amode) - real(r8) :: spec_dens(ntot_aspectype) - real(r8) :: spec_hygro(ntot_aspectype) - -#ifdef DEBUG - integer :: m, l -#endif - - __Iam__('MAM::microphysics_initialize') - - - ! this is probably done somewhere in CAM/chem or CAM/phys - cnst_name(:) = '__NONE__' - cnst_longname(:) = '__NONE__' - adv_mass(:) = 0.0_r8 - -#if ( defined MODAL_AERO_7MODE ) - ! - ! based on files in pp_trop_mam7 from CESM-1.2.1 - ! - cnst_name(1:pcnst) = (/'H2O2 ','H2SO4 ','SO2 ','DMS ','NH3 ', & - 'SOAG ','so4_a1 ','nh4_a1 ','pom_a1 ','soa_a1 ', & - 'bc_a1 ','ncl_a1 ','num_a1 ','so4_a2 ','nh4_a2 ', & - 'soa_a2 ','ncl_a2 ','num_a2 ','pom_a3 ','bc_a3 ', & - 'num_a3 ','ncl_a4 ','so4_a4 ','nh4_a4 ','num_a4 ', & - 'dst_a5 ','so4_a5 ','nh4_a5 ','num_a5 ','ncl_a6 ', & - 'so4_a6 ','nh4_a6 ','num_a6 ','dst_a7 ','so4_a7 ', & - 'nh4_a7 ','num_a7 ' /) - - adv_mass(1:gas_pcnst) = (/ 34.013600_r8, 98.078400_r8, 64.064800_r8, 62.132400_r8, 17.028940_r8, & - 12.011000_r8, 96.063600_r8, 18.036340_r8, 12.011000_r8, 12.011000_r8, & - 12.011000_r8, 58.442468_r8, 1.007400_r8, 96.063600_r8, 18.036340_r8, & - 12.011000_r8, 58.442468_r8, 1.007400_r8, 12.011000_r8, 12.011000_r8, & - 1.007400_r8, 58.442468_r8, 96.063600_r8, 18.036340_r8, 1.007400_r8, & - 135.064039_r8, 96.063600_r8, 18.036340_r8, 1.007400_r8, 58.442468_r8, & - 96.063600_r8, 18.036340_r8, 1.007400_r8, 135.064039_r8, 96.063600_r8, & - 18.036340_r8, 1.007400_r8 /) - - - sigma(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_SIGMA, & - MAM7_AITKEN_MODE_SIGMA, & - MAM7_PRIMARY_CARBON_MODE_SIGMA, & - MAM7_FINE_SEASALT_MODE_SIGMA, & - MAM7_FINE_DUST_MODE_SIGMA, & - MAM7_COARSE_SEASALT_MODE_SIGMA, & - MAM7_COARSE_DUST_MODE_SIGMA /) - - dgn(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_SIZE,& - MAM7_AITKEN_MODE_SIZE, & - MAM7_PRIMARY_CARBON_MODE_SIZE, & - MAM7_FINE_SEASALT_MODE_SIZE, & - MAM7_FINE_DUST_MODE_SIZE, & - MAM7_COARSE_SEASALT_MODE_SIZE, & - MAM7_COARSE_DUST_MODE_SIZE /) - - - dgn_low(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_SIZE_MIN, & - MAM7_AITKEN_MODE_SIZE_MIN, & - MAM7_PRIMARY_CARBON_MODE_SIZE_MIN, & - MAM7_FINE_SEASALT_MODE_SIZE_MIN, & - MAM7_FINE_DUST_MODE_SIZE_MIN, & - MAM7_COARSE_SEASALT_MODE_SIZE_MIN, & - MAM7_COARSE_DUST_MODE_SIZE_MIN /) - - dgn_hi(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_SIZE_MAX, & - MAM7_AITKEN_MODE_SIZE_MAX, & - MAM7_PRIMARY_CARBON_MODE_SIZE_MAX, & - MAM7_FINE_SEASALT_MODE_SIZE_MAX, & - MAM7_FINE_DUST_MODE_SIZE_MAX, & - MAM7_COARSE_SEASALT_MODE_SIZE_MAX, & - MAM7_COARSE_DUST_MODE_SIZE_MAX /) - - - rh_crystal(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_RH_CRYSTALLIZATION, & - MAM7_AITKEN_MODE_RH_CRYSTALLIZATION, & - MAM7_PRIMARY_CARBON_MODE_RH_CRYSTALLIZATION, & - MAM7_FINE_SEASALT_MODE_RH_CRYSTALLIZATION, & - MAM7_FINE_DUST_MODE_RH_CRYSTALLIZATION, & - MAM7_COARSE_SEASALT_MODE_RH_CRYSTALLIZATION, & - MAM7_COARSE_DUST_MODE_RH_CRYSTALLIZATION /) - - rh_deliques(:ntot_amode) = (/ MAM7_ACCUMULATION_MODE_RH_DELIQUESCENCE, & - MAM7_AITKEN_MODE_RH_DELIQUESCENCE, & - MAM7_PRIMARY_CARBON_MODE_RH_DELIQUESCENCE, & - MAM7_FINE_SEASALT_MODE_RH_DELIQUESCENCE, & - MAM7_FINE_DUST_MODE_RH_DELIQUESCENCE, & - MAM7_COARSE_SEASALT_MODE_RH_DELIQUESCENCE, & - MAM7_COARSE_DUST_MODE_RH_DELIQUESCENCE /) - -#endif - - ! following the indexes in specname_amode(:ntot_aspectype) - ! specname_amode(ntot_aspectype) = (/ 'sulfate ', 'ammonium ', 'nitrate ', 'p-organic ', 's-organic ', 'black-c ', 'seasalt ', 'dust '/) - spec_dens(:ntot_aspectype) = (/ MAM_SULFATE_COMPONENT_DENSITY, & - MAM_AMMONIUM_COMPONENT_DENSITY, & - MAM_SULFATE_COMPONENT_DENSITY, & ! assigned value for nitrate: verify what is used in CAM - MAM_POM_COMPONENT_DENSITY, & - MAM_SOA_COMPONENT_DENSITY, & - MAM_BLACK_CARBON_COMPONENT_DENSITY, & - MAM_SEASALT_COMPONENT_DENSITY, & - MAM_DUST_COMPONENT_DENSITY /) - - spec_hygro(:ntot_aspectype) = (/ MAM_SULFATE_COMPONENT_HYGROSCOPICITY, & - MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY, & - MAM_SULFATE_COMPONENT_HYGROSCOPICITY, & ! assigned value for nitrate: verify what is used in CAM - MAM_POM_COMPONENT_HYGROSCOPICITY, & - MAM_SOA_COMPONENT_HYGROSCOPICITY, & - MAM_BLACK_CARBON_COMPONENT_HYGROSCOPICITY, & - MAM_SEASALT_COMPONENT_HYGROSCOPICITY, & - MAM_DUST_COMPONENT_HYGROSCOPICITY /) - - - call modal_aero_register(verbose) - - call modal_aero_initialize(imozart, sigma, dgn, dgn_low, dgn_hi, rh_crystal, rh_deliques, spec_dens, spec_hygro, verbose) - -#ifdef DEBUG - if (MAPL_AM_I_ROOT()) then - - print *, 'Interstitial aerosols:' - - do m = 1, ntot_amode - print *, 'mode: numptr_amode(m) = ', m, numptr_amode(m) - end do - print * - - do m = 1, ntot_amode - do l = 1, nspec_amode(m) - print *, 'mode, species: lmassptr_amode(l,m) = ', l, m, lmassptr_amode(l,m) - end do - print * - end do - - print * - - print *, 'Cloud-borne aerosols:' - - do m = 1, ntot_amode - print *, 'mode: numptrcw_amode(m) = ', m, numptrcw_amode(m) - end do - print * - - do m = 1, ntot_amode - do l = 1, nspec_amode(m) - print *, 'mode, species: lmassptrcw_amode(l,m) = ', l, m, lmassptrcw_amode(l,m) - end do - print * - end do - - end if -#endif - - - RETURN_(ESMF_SUCCESS) - - end subroutine microphysics_initialize - - end subroutine Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs MAMchem -! -! !INTERFACE: -! - - subroutine Run_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - use MAPL_ConstantsMod, only: r8 => MAPL_R8 - use cam_logfile, only: iulog - use chem_mods, only: gas_pcnst, adv_mass - - use modal_aero_data, only: ntot_amode - use modal_aero_amicphys, only: pcols, pver, pcnstxx, & - nqtendaa, iqtend_cond, iqtend_rnam, iqtend_nnuc, iqtend_coag, & - nqqcwtendaa, iqqcwtend_rnam, & - modal_aero_amicphys_intr - - use MAM7_DataMod, only: MAM7_AITKEN_MODE_SIZE, & - MAM7_ACCUMULATION_MODE_SIZE, & - MAM7_PRIMARY_CARBON_MODE_SIZE, & - MAM7_FINE_SEASALT_MODE_SIZE, & - MAM7_FINE_DUST_MODE_SIZE, & - MAM7_COARSE_SEASALT_MODE_SIZE, & - MAM7_COARSE_DUST_MODE_SIZE - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 27Feb2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Run_') - - type(MAM_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state - type(ESMF_Alarm) :: run_alarm - logical :: run_alarm_ringing - - integer :: im_World, jm_World ! Global 2D Dimensions - integer :: im, jm, lm ! 3D Dimensions - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name - - - ! inputs to the aerosol microphysics core - integer :: i, j - integer :: iq - - real, pointer, dimension(:,:) :: zpbl - real, pointer, dimension(:,:,:) :: fcld - real, pointer, dimension(:,:,:) :: Q - real, pointer, dimension(:,:,:) :: T - real, pointer, dimension(:,:,:) :: RH - real, pointer, dimension(:,:,:) :: delp - real, pointer, dimension(:,:,:) :: ple - real, pointer, dimension(:,:,:) :: zle - -! real, pointer, dimension(:,:,:) :: h2o2 -! real, pointer, dimension(:,:,:) :: dms -! real, pointer, dimension(:,:,:) :: msa - real, pointer, dimension(:,:,:) :: so2 - real, pointer, dimension(:,:,:) :: h2so4 - real, pointer, dimension(:,:,:) :: nh3 - real, pointer, dimension(:,:,:) :: soa_g - - real, pointer, dimension(:,:,:) :: ddt_dms_gas - real, pointer, dimension(:,:,:) :: ddt_msa_gas - real, pointer, dimension(:,:,:) :: ddt_so2_gas - real, pointer, dimension(:,:,:) :: ddt_h2so4_gas - real, pointer, dimension(:,:,:) :: ddt_nh3_gas - real, pointer, dimension(:,:,:) :: ddt_soa_g_gas - - real, pointer, dimension(:,:,:) :: ddt_dms_aq - real, pointer, dimension(:,:,:) :: ddt_msa_aq - real, pointer, dimension(:,:,:) :: ddt_so2_aq - real, pointer, dimension(:,:,:) :: ddt_h2so4_aq - real, pointer, dimension(:,:,:) :: ddt_nh3_aq - real, pointer, dimension(:,:,:) :: ddt_soa_g_aq - - real, pointer, dimension(:,:,:) :: dms_g_ - real, pointer, dimension(:,:,:) :: msa_g_ - real, pointer, dimension(:,:,:) :: so2_g_ - real, pointer, dimension(:,:,:) :: h2so4_g_ - real, pointer, dimension(:,:,:) :: nh3_g_ - real, pointer, dimension(:,:,:) :: soa_g_g_ - - real, pointer, dimension(:,:,:) :: dms_a_ - real, pointer, dimension(:,:,:) :: msa_a_ - real, pointer, dimension(:,:,:) :: so2_a_ - real, pointer, dimension(:,:,:) :: h2so4_a_ - real, pointer, dimension(:,:,:) :: nh3_a_ - real, pointer, dimension(:,:,:) :: soa_g_a_ - - real, pointer, dimension(:,:,:) :: ait_a_num - real, pointer, dimension(:,:,:) :: ait_a_so4 - real, pointer, dimension(:,:,:) :: ait_a_nh4 - real, pointer, dimension(:,:,:) :: ait_a_soa - real, pointer, dimension(:,:,:) :: ait_a_ncl - - real, pointer, dimension(:,:,:) :: ait_c_num - real, pointer, dimension(:,:,:) :: ait_c_so4 - real, pointer, dimension(:,:,:) :: ait_c_nh4 - real, pointer, dimension(:,:,:) :: ait_c_soa - real, pointer, dimension(:,:,:) :: ait_c_ncl - - - real, pointer, dimension(:,:,:) :: acc_a_num - real, pointer, dimension(:,:,:) :: acc_a_so4 - real, pointer, dimension(:,:,:) :: acc_a_nh4 - real, pointer, dimension(:,:,:) :: acc_a_soa - real, pointer, dimension(:,:,:) :: acc_a_pom - real, pointer, dimension(:,:,:) :: acc_a_bc - real, pointer, dimension(:,:,:) :: acc_a_ncl - - real, pointer, dimension(:,:,:) :: acc_c_num - real, pointer, dimension(:,:,:) :: acc_c_so4 - real, pointer, dimension(:,:,:) :: acc_c_nh4 - real, pointer, dimension(:,:,:) :: acc_c_soa - real, pointer, dimension(:,:,:) :: acc_c_pom - real, pointer, dimension(:,:,:) :: acc_c_bc - real, pointer, dimension(:,:,:) :: acc_c_ncl - - - real, pointer, dimension(:,:,:) :: pcm_a_num - real, pointer, dimension(:,:,:) :: pcm_a_pom - real, pointer, dimension(:,:,:) :: pcm_a_bc - - real, pointer, dimension(:,:,:) :: pcm_c_num - real, pointer, dimension(:,:,:) :: pcm_c_pom - real, pointer, dimension(:,:,:) :: pcm_c_bc - - - real, pointer, dimension(:,:,:) :: fdu_a_num - real, pointer, dimension(:,:,:) :: fdu_a_dst - real, pointer, dimension(:,:,:) :: fdu_a_so4 - real, pointer, dimension(:,:,:) :: fdu_a_nh4 - - real, pointer, dimension(:,:,:) :: fdu_c_num - real, pointer, dimension(:,:,:) :: fdu_c_dst - real, pointer, dimension(:,:,:) :: fdu_c_so4 - real, pointer, dimension(:,:,:) :: fdu_c_nh4 - - - real, pointer, dimension(:,:,:) :: cdu_a_num - real, pointer, dimension(:,:,:) :: cdu_a_dst - real, pointer, dimension(:,:,:) :: cdu_a_so4 - real, pointer, dimension(:,:,:) :: cdu_a_nh4 - - real, pointer, dimension(:,:,:) :: cdu_c_num - real, pointer, dimension(:,:,:) :: cdu_c_dst - real, pointer, dimension(:,:,:) :: cdu_c_so4 - real, pointer, dimension(:,:,:) :: cdu_c_nh4 - - - real, pointer, dimension(:,:,:) :: fss_a_num - real, pointer, dimension(:,:,:) :: fss_a_ncl - real, pointer, dimension(:,:,:) :: fss_a_so4 - real, pointer, dimension(:,:,:) :: fss_a_nh4 - - real, pointer, dimension(:,:,:) :: fss_c_num - real, pointer, dimension(:,:,:) :: fss_c_ncl - real, pointer, dimension(:,:,:) :: fss_c_so4 - real, pointer, dimension(:,:,:) :: fss_c_nh4 - - - real, pointer, dimension(:,:,:) :: css_a_num - real, pointer, dimension(:,:,:) :: css_a_ncl - real, pointer, dimension(:,:,:) :: css_a_so4 - real, pointer, dimension(:,:,:) :: css_a_nh4 - - real, pointer, dimension(:,:,:) :: css_c_num - real, pointer, dimension(:,:,:) :: css_c_ncl - real, pointer, dimension(:,:,:) :: css_c_so4 - real, pointer, dimension(:,:,:) :: css_c_nh4 - - - real, pointer, dimension(:,:,:) :: ait_a_wtr - real, pointer, dimension(:,:,:) :: ait_dgn_dry - real, pointer, dimension(:,:,:) :: ait_dgn_wet - - real, pointer, dimension(:,:,:) :: acc_a_wtr - real, pointer, dimension(:,:,:) :: acc_dgn_dry - real, pointer, dimension(:,:,:) :: acc_dgn_wet - - real, pointer, dimension(:,:,:) :: pcm_a_wtr - real, pointer, dimension(:,:,:) :: pcm_dgn_dry - real, pointer, dimension(:,:,:) :: pcm_dgn_wet - - real, pointer, dimension(:,:,:) :: fdu_a_wtr - real, pointer, dimension(:,:,:) :: fdu_dgn_dry - real, pointer, dimension(:,:,:) :: fdu_dgn_wet - - real, pointer, dimension(:,:,:) :: cdu_a_wtr - real, pointer, dimension(:,:,:) :: cdu_dgn_dry - real, pointer, dimension(:,:,:) :: cdu_dgn_wet - - real, pointer, dimension(:,:,:) :: fss_a_wtr - real, pointer, dimension(:,:,:) :: fss_dgn_dry - real, pointer, dimension(:,:,:) :: fss_dgn_wet - - real, pointer, dimension(:,:,:) :: css_a_wtr - real, pointer, dimension(:,:,:) :: css_dgn_dry - real, pointer, dimension(:,:,:) :: css_dgn_wet - - ! pre-aqueous chemistry SO4 and NH4 - real, allocatable, dimension(:,:,:) :: ait_a_so4_ - real, allocatable, dimension(:,:,:) :: ait_a_nh4_ - - real, allocatable, dimension(:,:,:) :: acc_a_so4_ - real, allocatable, dimension(:,:,:) :: acc_a_nh4_ - - real, allocatable, dimension(:,:,:) :: fdu_a_so4_ - real, allocatable, dimension(:,:,:) :: fdu_a_nh4_ - - real, allocatable, dimension(:,:,:) :: cdu_a_so4_ - real, allocatable, dimension(:,:,:) :: cdu_a_nh4_ - - real, allocatable, dimension(:,:,:) :: fss_a_so4_ - real, allocatable, dimension(:,:,:) :: fss_a_nh4_ - - real, allocatable, dimension(:,:,:) :: css_a_so4_ - real, allocatable, dimension(:,:,:) :: css_a_nh4_ - - real, allocatable, dimension(:,:,:) :: css_c_so4_ - real, allocatable, dimension(:,:,:) :: css_c_nh4_ - - real, allocatable, dimension(:,:,:) :: q_coltend_cond_ - real, allocatable, dimension(:,:,:) :: q_coltend_rename_ - real, allocatable, dimension(:,:,:) :: q_coltend_coag_ - real, allocatable, dimension(:,:,:) :: q_coltend_nucl_ - real, allocatable, dimension(:,:,:) :: qqcw_coltend_rename_ - - real, pointer, dimension(:,:) :: q_coltend - - ! wrap the aerosol microphisics core - integer, parameter :: ncol = 1 ! number of atmospheric columns - - integer :: amc_do_gasaerexch - integer :: amc_do_rename - integer :: amc_do_newnuc - integer :: amc_do_coag - - integer :: amc_lchnk ! chunk identifier - integer :: amc_nstep ! model time-step number - integer :: amc_loffset ! offset applied to modal aero "ptrs" - integer :: amc_latndx(1), amc_lonndx(1) - - real(r8) :: amc_deltat ! time step (s) - - real(r8) :: amc_dqdt(ncol,pver,pcnstxx) ! tendency of q - logical :: amc_dotend(pcnstxx) ! flag - - real(r8) :: amc_q(ncol,pver,pcnstxx) ! current tracer mixing ratios (TMRs) - ! these values are updated (so out /= in) - ! *** MUST BE #/kmol-air for number - ! *** MUST BE mol/mol-air for mass - ! *** NOTE ncol dimension - - real(r8) :: amc_qqcw(ncol,pver,pcnstxx) ! like q but for cloud-borner tracers - ! these values are updated - - real(r8) :: amc_q_pregaschem(ncol,pver,pcnstxx) ! q TMRs before gas-phase chemistry - real(r8) :: amc_q_precldchem(ncol,pver,pcnstxx) ! q TMRs before cloud chemistry - real(r8) :: amc_qqcw_precldchem(ncol,pver,pcnstxx) ! qqcw TMRs before cloud chemistry - - real(r8) :: amc_t(pcols,pver) ! temperature at model levels (K) - real(r8) :: amc_pmid(pcols,pver) ! pressure at model level centers (Pa) - real(r8) :: amc_pdel(pcols,pver) ! pressure thickness of levels (Pa) - real(r8) :: amc_zm(pcols,pver) ! altitude (above ground) at level centers (m) - real(r8) :: amc_pblh(pcols) ! planetary boundary layer depth (m) - real(r8) :: amc_qv(pcols,pver) ! specific humidity (kg/kg) - real(r8) :: amc_rh(pcols,pver) ! relative humidity (0, 1) - real(r8) :: amc_cld(ncol,pver) ! cloud fraction (-) *** NOTE ncol dimension - real(r8) :: amc_dgn_a_dry(pcols,pver,ntot_amode) - real(r8) :: amc_dgn_a_wet(pcols,pver,ntot_amode) ! dry & wet geo. mean dia. (m) of number distrib. - real(r8) :: amc_wetdens_host(pcols,pver,ntot_amode) ! interstitial aerosol wet density (kg/m3) - real(r8) :: amc_q_coltendaa(pcols,pcnstxx,nqtendaa) ! column-integrated tendencies for condensation, renaming, coagulation, and nucleation - real(r8) :: amc_qqcw_coltendaa(pcols,pcnstxx,nqqcwtendaa) ! --dito-- but for cloud-borne aerosols - real(r8) :: amc_qaerwat(pcols,pver,ntot_amode) ! optional, aerosol water mixing ratio (kg/kg) - - real(r8) :: tmp_min, tmp_max - - integer :: i_H2O2, i_H2SO4, i_SO2, i_DMS, i_NH3, i_SOAG - - integer :: i_so4_a1, i_nh4_a1, i_pom_a1, i_soa_a1, i_bc_a1, i_ncl_a1, i_num_a1 - integer :: i_so4_a2, i_nh4_a2, i_soa_a2, i_ncl_a2, i_num_a2 - integer :: i_pom_a3, i_bc_a3 , i_num_a3 - integer :: i_ncl_a4, i_so4_a4, i_nh4_a4, i_num_a4 - integer :: i_dst_a5, i_so4_a5, i_nh4_a5, i_num_a5 - integer :: i_ncl_a6, i_so4_a6, i_nh4_a6, i_num_a6 - integer :: i_dst_a7, i_so4_a7, i_nh4_a7, i_num_a7 - - real, parameter :: mw_air = 28.97 ! molar mass of dry air, g mol-1 - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- - type(ESMF_State) :: INTERNAL - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // '::' // trim(Iam) - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - - call MAPL_TimerOn(mgState, 'TOTAL', __RC__) - call MAPL_TimerOn(mgState, 'RUN', __RC__) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- - call MAPL_Get (mgState, INTERNAL_ESMF_STATE=INTERNAL, __RC__) - - - -! Get parameters from generic state -! ---------------------------------- - call MAPL_Get(mgState, LONS=lons, & - LATS=lats, & - RunAlarm=run_alarm, __RC__) - - -! If it is time, update MAM state -! ------------------------------- - run_alarm_ringing = ESMF_AlarmIsRinging(run_alarm, __RC__) - - if (run_alarm_ringing) then - call ESMF_AlarmRingerOff(run_alarm, __RC__) - else - RETURN_(ESMF_SUCCESS) - endif - - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, CLOCK, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, & - nymd, nhms, cdt, __RC__) - - -! Force non-negative mixing ratios -! -------------------------------- - do iq = 1, self%qa%n3d - where(self%qa%r3(iq)%q < 0) self%qa%r3(iq)%q = tiny(0.0) - end do - - do iq = 1, self%qc%n3d - where(self%qc%r3(iq)%q < 0) self%qc%r3(iq)%q = tiny(0.0) - end do - - do iq = 1, self%qg%n3d - where(self%qg%r3(iq)%q < 0) self%qg%r3(iq)%q = tiny(0.0) - end do - - -! Partition aqueous phase production of SO4 and NH4 -! ------------------------------------------------- - call MAPL_GetPointer(internal, ait_a_so4, 'SU_A_AIT' , __RC__) - call MAPL_GetPointer(internal, ait_a_nh4, 'AMM_A_AIT', __RC__) - call MAPL_GetPointer(internal, acc_a_so4, 'SU_A_ACC' , __RC__) - call MAPL_GetPointer(internal, acc_a_nh4, 'AMM_A_ACC', __RC__) - call MAPL_GetPointer(internal, fdu_a_so4, 'SU_A_FDU' , __RC__) - call MAPL_GetPointer(internal, fdu_a_nh4, 'AMM_A_FDU', __RC__) - call MAPL_GetPointer(internal, cdu_a_so4, 'SU_A_CDU' , __RC__) - call MAPL_GetPointer(internal, cdu_a_nh4, 'AMM_A_CDU', __RC__) - call MAPL_GetPointer(internal, fss_a_so4, 'SU_A_FSS' , __RC__) - call MAPL_GetPointer(internal, fss_a_nh4, 'AMM_A_FSS', __RC__) - call MAPL_GetPointer(internal, css_a_so4, 'SU_A_CSS' , __RC__) - call MAPL_GetPointer(internal, css_a_nh4, 'AMM_A_CSS', __RC__) - - ! save pre-aqueous phase SO4 and NH4 - allocate(ait_a_so4_(im,jm,lm), __STAT__) - allocate(ait_a_nh4_(im,jm,lm), __STAT__) - allocate(acc_a_so4_(im,jm,lm), __STAT__) - allocate(acc_a_nh4_(im,jm,lm), __STAT__) - allocate(fdu_a_so4_(im,jm,lm), __STAT__) - allocate(fdu_a_nh4_(im,jm,lm), __STAT__) - allocate(cdu_a_so4_(im,jm,lm), __STAT__) - allocate(cdu_a_nh4_(im,jm,lm), __STAT__) - allocate(fss_a_so4_(im,jm,lm), __STAT__) - allocate(fss_a_nh4_(im,jm,lm), __STAT__) - allocate(css_a_so4_(im,jm,lm), __STAT__) - allocate(css_a_nh4_(im,jm,lm), __STAT__) - - ait_a_so4_ = ait_a_so4 - ait_a_nh4_ = ait_a_nh4 - acc_a_so4_ = acc_a_so4 - acc_a_nh4_ = acc_a_nh4 - fdu_a_so4_ = fdu_a_so4 - fdu_a_nh4_ = fdu_a_nh4 - cdu_a_so4_ = cdu_a_so4 - cdu_a_nh4_ = cdu_a_nh4 - fss_a_so4_ = fss_a_so4 - fss_a_nh4_ = fss_a_nh4 - css_a_so4_ = css_a_so4 - css_a_nh4_ = css_a_nh4 - - call MAPL_TimerOn(mgState, '-AQUEOUS_CHEM', __RC__) - call AqueousChemistry(self%scheme, import, export, self%qa, cdt, rc) - call MAPL_TimerOff(mgState, '-AQUEOUS_CHEM', __RC__) - - - ! colmn-integrated diagnostics: tendencies due to condensation, - ! rename, coagulation and nucleation - allocate(q_coltend_cond_(im,jm,pcnstxx), __STAT__) - allocate(q_coltend_rename_(im,jm,pcnstxx), __STAT__) - allocate(q_coltend_coag_(im,jm,pcnstxx), __STAT__) - allocate(q_coltend_nucl_(im,jm,pcnstxx), __STAT__) - allocate(qqcw_coltend_rename_(im,jm,pcnstxx), __STAT__) - - q_coltend_cond_ = 0.0 - q_coltend_rename_ = 0.0 - q_coltend_coag_ = 0.0 - q_coltend_nucl_ = 0.0 - qqcw_coltend_rename_ = 0.0 - - - call MAPL_TimerOn(mgState, '-MICROPHYSICS', __RC__) - -! Calculate size of the particles --- CAM interface -! ------------------------------------------------------ -! call CAM_CalculateSize(self%scheme, self%qa, self%qc, self%Dg_dry, self%Dg_wet, delp, self%dt, rc) - - - -! Aerosol microphysics core -! ------------------------- - - i_H2O2 = constituent_index_('H2O2' , __RC__) - i_H2SO4 = constituent_index_('H2SO4' , __RC__) - i_SO2 = constituent_index_('SO2' , __RC__) - i_DMS = constituent_index_('DMS' , __RC__) - i_NH3 = constituent_index_('NH3' , __RC__) - i_SOAG = constituent_index_('SOAG' , __RC__) - i_so4_a1 = constituent_index_('so4_a1', __RC__) - i_nh4_a1 = constituent_index_('nh4_a1', __RC__) - i_pom_a1 = constituent_index_('pom_a1', __RC__) - i_soa_a1 = constituent_index_('soa_a1', __RC__) - i_bc_a1 = constituent_index_('bc_a1' , __RC__) - i_ncl_a1 = constituent_index_('ncl_a1', __RC__) - i_num_a1 = constituent_index_('num_a1', __RC__) - i_so4_a2 = constituent_index_('so4_a2', __RC__) - i_nh4_a2 = constituent_index_('nh4_a2', __RC__) - i_soa_a2 = constituent_index_('soa_a2', __RC__) - i_ncl_a2 = constituent_index_('ncl_a2', __RC__) - i_num_a2 = constituent_index_('num_a2', __RC__) - i_pom_a3 = constituent_index_('pom_a3', __RC__) - i_bc_a3 = constituent_index_('bc_a3' , __RC__) - i_num_a3 = constituent_index_('num_a3', __RC__) - i_ncl_a4 = constituent_index_('ncl_a4', __RC__) - i_so4_a4 = constituent_index_('so4_a4', __RC__) - i_nh4_a4 = constituent_index_('nh4_a4', __RC__) - i_num_a4 = constituent_index_('num_a4', __RC__) - i_dst_a5 = constituent_index_('dst_a5', __RC__) - i_so4_a5 = constituent_index_('so4_a5', __RC__) - i_nh4_a5 = constituent_index_('nh4_a5', __RC__) - i_num_a5 = constituent_index_('num_a5', __RC__) - i_ncl_a6 = constituent_index_('ncl_a6', __RC__) - i_so4_a6 = constituent_index_('so4_a6', __RC__) - i_nh4_a6 = constituent_index_('nh4_a6', __RC__) - i_num_a6 = constituent_index_('num_a6', __RC__) - i_dst_a7 = constituent_index_('dst_a7', __RC__) - i_so4_a7 = constituent_index_('so4_a7', __RC__) - i_nh4_a7 = constituent_index_('nh4_a7', __RC__) - i_num_a7 = constituent_index_('num_a7', __RC__) - - - ! set initial values - amc_do_gasaerexch = 0 - amc_do_rename = 0 - amc_do_newnuc = 0 - amc_do_coag = 0 - - amc_nstep = 99 ! model time-step number - amc_lchnk = 0 ! chunk identifier - amc_latndx = 1 - amc_lonndx = 1 ! lat and lon indices - amc_loffset = 0 - - - if (self%condensation) amc_do_gasaerexch = 1 - if (self%rename) amc_do_rename = 1 - if (self%nucleation) amc_do_newnuc = 1 - if (self%coagulation) amc_do_coag = 1 - - - amc_deltat = self%dt ! time step (s) - - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - call MAPL_GetPointer(import, fcld, 'FCLD', __RC__) - call MAPL_GetPointer(import, Q, 'Q', __RC__) - call MAPL_GetPointer(import, RH, 'RH2', __RC__) - call MAPL_GetPointer(import, T, 'T', __RC__) - call MAPL_GetPointer(import, zle, 'ZLE', __RC__) - call MAPL_GetPointer(import, zpbl, 'ZPBL', __RC__) - -! call MAPL_GetPointer(import, h2o2, 'H2O2', __RC__) - call MAPL_GetPointer(import, h2so4, 'H2SO4', __RC__) - call MAPL_GetPointer(import, so2, 'SO2', __RC__) -! call MAPL_GetPointer(import, dms, 'DMS', __RC__) - call MAPL_GetPointer(import, nh3, 'NH3', __RC__) - call MAPL_GetPointer(import, soa_g, 'SOA_GAS', __RC__) - - call MAPL_GetPointer(import, ddt_dms_gas, 'DDT_DMS_gas', __RC__) - call MAPL_GetPointer(import, ddt_msa_gas, 'DDT_MSA_gas', __RC__) - call MAPL_GetPointer(import, ddt_so2_gas, 'DDT_SO2_gas', __RC__) - call MAPL_GetPointer(import, ddt_h2so4_gas, 'DDT_H2SO4_gas', __RC__) - call MAPL_GetPointer(import, ddt_nh3_gas, 'DDT_NH3_gas', __RC__) - call MAPL_GetPointer(import, ddt_soa_g_gas, 'DDT_SOA_GAS_gas', __RC__) - - call MAPL_GetPointer(import, ddt_dms_aq, 'DDT_DMS_aq', __RC__) - call MAPL_GetPointer(import, ddt_msa_aq, 'DDT_MSA_aq', __RC__) - call MAPL_GetPointer(import, ddt_so2_aq, 'DDT_SO2_aq', __RC__) - call MAPL_GetPointer(import, ddt_h2so4_aq, 'DDT_H2SO4_aq', __RC__) - call MAPL_GetPointer(import, ddt_nh3_aq, 'DDT_NH3_aq', __RC__) - call MAPL_GetPointer(import, ddt_soa_g_aq, 'DDT_SOA_GAS_aq', __RC__) - - - call MAPL_GetPointer(import, msa_g_, '_MSA_gas', __RC__) - call MAPL_GetPointer(import, dms_g_, '_DMS_gas', __RC__) - call MAPL_GetPointer(import, so2_g_, '_SO2_gas', __RC__) - call MAPL_GetPointer(import, h2so4_g_, '_H2SO4_gas', __RC__) - call MAPL_GetPointer(import, nh3_g_, '_NH3_gas', __RC__) - call MAPL_GetPointer(import, soa_g_g_, '_SOA_GAS_gas', __RC__) - - call MAPL_GetPointer(import, so2_a_, '_SO2_aq', __RC__) - call MAPL_GetPointer(import, h2so4_a_, '_H2SO4_aq', __RC__) - call MAPL_GetPointer(import, nh3_a_, '_NH3_aq', __RC__) - call MAPL_GetPointer(import, soa_g_a_, '_SOA_GAS_aq', __RC__) - - - ! aitken - call MAPL_GetPointer(internal, ait_a_num, 'NUM_A_AIT', __RC__) - call MAPL_GetPointer(internal, ait_a_so4, 'SU_A_AIT' , __RC__) - call MAPL_GetPointer(internal, ait_a_nh4, 'AMM_A_AIT', __RC__) - call MAPL_GetPointer(internal, ait_a_soa, 'SOA_A_AIT', __RC__) - call MAPL_GetPointer(internal, ait_a_ncl, 'SS_A_AIT' , __RC__) - - call MAPL_GetPointer(internal, ait_c_num, 'NUM_C_AIT', __RC__) - call MAPL_GetPointer(internal, ait_c_so4, 'SU_C_AIT' , __RC__) - call MAPL_GetPointer(internal, ait_c_nh4, 'AMM_C_AIT', __RC__) - call MAPL_GetPointer(internal, ait_c_soa, 'SOA_C_AIT', __RC__) - call MAPL_GetPointer(internal, ait_c_ncl, 'SS_C_AIT' , __RC__) - - ! accumulation - call MAPL_GetPointer(internal, acc_a_num, 'NUM_A_ACC', __RC__) - call MAPL_GetPointer(internal, acc_a_so4, 'SU_A_ACC' , __RC__) - call MAPL_GetPointer(internal, acc_a_nh4, 'AMM_A_ACC', __RC__) - call MAPL_GetPointer(internal, acc_a_soa, 'SOA_A_ACC', __RC__) - call MAPL_GetPointer(internal, acc_a_pom, 'POM_A_ACC', __RC__) - call MAPL_GetPointer(internal, acc_a_bc, 'BC_A_ACC' , __RC__) - call MAPL_GetPointer(internal, acc_a_ncl, 'SS_A_ACC' , __RC__) - - call MAPL_GetPointer(internal, acc_c_num, 'NUM_C_ACC', __RC__) - call MAPL_GetPointer(internal, acc_c_so4, 'SU_C_ACC' , __RC__) - call MAPL_GetPointer(internal, acc_c_nh4, 'AMM_C_ACC', __RC__) - call MAPL_GetPointer(internal, acc_c_soa, 'SOA_C_ACC', __RC__) - call MAPL_GetPointer(internal, acc_c_pom, 'POM_C_ACC', __RC__) - call MAPL_GetPointer(internal, acc_c_bc, 'BC_C_ACC' , __RC__) - call MAPL_GetPointer(internal, acc_c_ncl, 'SS_C_ACC' , __RC__) - - ! primary carbon mode - call MAPL_GetPointer(internal, pcm_a_num, 'NUM_A_PCM', __RC__) - call MAPL_GetPointer(internal, pcm_a_pom, 'POM_A_PCM', __RC__) - call MAPL_GetPointer(internal, pcm_a_bc, 'BC_A_PCM', __RC__) - - call MAPL_GetPointer(internal, pcm_c_num, 'NUM_C_PCM', __RC__) - call MAPL_GetPointer(internal, pcm_c_pom, 'POM_C_PCM', __RC__) - call MAPL_GetPointer(internal, pcm_c_bc, 'BC_C_PCM', __RC__) - - ! fine dust - call MAPL_GetPointer(internal, fdu_a_num, 'NUM_A_FDU', __RC__) - call MAPL_GetPointer(internal, fdu_a_dst, 'DU_A_FDU' , __RC__) - call MAPL_GetPointer(internal, fdu_a_so4, 'SU_A_FDU' , __RC__) - call MAPL_GetPointer(internal, fdu_a_nh4, 'AMM_A_FDU', __RC__) - - call MAPL_GetPointer(internal, fdu_c_num, 'NUM_C_FDU', __RC__) - call MAPL_GetPointer(internal, fdu_c_dst, 'DU_C_FDU' , __RC__) - call MAPL_GetPointer(internal, fdu_c_so4, 'SU_C_FDU' , __RC__) - call MAPL_GetPointer(internal, fdu_c_nh4, 'AMM_C_FDU', __RC__) - - ! caorse dust - call MAPL_GetPointer(internal, cdu_a_num, 'NUM_A_CDU', __RC__) - call MAPL_GetPointer(internal, cdu_a_dst, 'DU_A_CDU' , __RC__) - call MAPL_GetPointer(internal, cdu_a_so4, 'SU_A_CDU' , __RC__) - call MAPL_GetPointer(internal, cdu_a_nh4, 'AMM_A_CDU', __RC__) - - call MAPL_GetPointer(internal, cdu_c_num, 'NUM_C_CDU', __RC__) - call MAPL_GetPointer(internal, cdu_c_dst, 'DU_C_CDU' , __RC__) - call MAPL_GetPointer(internal, cdu_c_so4, 'SU_C_CDU' , __RC__) - call MAPL_GetPointer(internal, cdu_c_nh4, 'AMM_C_CDU', __RC__) - - ! fine seasalt - call MAPL_GetPointer(internal, fss_a_num, 'NUM_A_FSS', __RC__) - call MAPL_GetPointer(internal, fss_a_ncl, 'SS_A_FSS' , __RC__) - call MAPL_GetPointer(internal, fss_a_so4, 'SU_A_FSS' , __RC__) - call MAPL_GetPointer(internal, fss_a_nh4, 'AMM_A_FSS', __RC__) - - call MAPL_GetPointer(internal, fss_c_num, 'NUM_C_FSS', __RC__) - call MAPL_GetPointer(internal, fss_c_ncl, 'SS_C_FSS' , __RC__) - call MAPL_GetPointer(internal, fss_c_so4, 'SU_C_FSS' , __RC__) - call MAPL_GetPointer(internal, fss_c_nh4, 'AMM_C_FSS', __RC__) - - ! caorse seasalt - call MAPL_GetPointer(internal, css_a_num, 'NUM_A_CSS', __RC__) - call MAPL_GetPointer(internal, css_a_ncl, 'SS_A_CSS' , __RC__) - call MAPL_GetPointer(internal, css_a_so4, 'SU_A_CSS' , __RC__) - call MAPL_GetPointer(internal, css_a_nh4, 'AMM_A_CSS', __RC__) - - call MAPL_GetPointer(internal, css_c_num, 'NUM_C_CSS', __RC__) - call MAPL_GetPointer(internal, css_c_ncl, 'SS_C_CSS' , __RC__) - call MAPL_GetPointer(internal, css_c_so4, 'SU_C_CSS' , __RC__) - call MAPL_GetPointer(internal, css_c_nh4, 'AMM_C_CSS', __RC__) - - ! size - call MAPL_GetPointer(internal, ait_dgn_dry, 'DGN_DRY_AIT', __RC__) - call MAPL_GetPointer(internal, ait_dgn_wet, 'DGN_WET_AIT', __RC__) - call MAPL_GetPointer(internal, acc_dgn_dry, 'DGN_DRY_ACC', __RC__) - call MAPL_GetPointer(internal, acc_dgn_wet, 'DGN_WET_ACC', __RC__) - call MAPL_GetPointer(internal, pcm_dgn_dry, 'DGN_DRY_PCM', __RC__) - call MAPL_GetPointer(internal, pcm_dgn_wet, 'DGN_WET_PCM', __RC__) - call MAPL_GetPointer(internal, fss_dgn_dry, 'DGN_DRY_FSS', __RC__) - call MAPL_GetPointer(internal, fss_dgn_wet, 'DGN_WET_FSS', __RC__) - call MAPL_GetPointer(internal, fdu_dgn_dry, 'DGN_DRY_FDU', __RC__) - call MAPL_GetPointer(internal, fdu_dgn_wet, 'DGN_WET_FDU', __RC__) - call MAPL_GetPointer(internal, css_dgn_dry, 'DGN_DRY_CSS', __RC__) - call MAPL_GetPointer(internal, css_dgn_wet, 'DGN_WET_CSS', __RC__) - call MAPL_GetPointer(internal, cdu_dgn_dry, 'DGN_DRY_CDU', __RC__) - call MAPL_GetPointer(internal, cdu_dgn_wet, 'DGN_WET_CDU', __RC__) - - ! aerosol water - call MAPL_GetPointer(internal, ait_a_wtr, 'WTR_A_AIT', __RC__) - call MAPL_GetPointer(internal, acc_a_wtr, 'WTR_A_ACC', __RC__) - call MAPL_GetPointer(internal, pcm_a_wtr, 'WTR_A_PCM', __RC__) - call MAPL_GetPointer(internal, fdu_a_wtr, 'WTR_A_FDU', __RC__) - call MAPL_GetPointer(internal, cdu_a_wtr, 'WTR_A_CDU', __RC__) - call MAPL_GetPointer(internal, fss_a_wtr, 'WTR_A_FSS', __RC__) - call MAPL_GetPointer(internal, css_a_wtr, 'WTR_A_CSS', __RC__) - - - call MAPL_TimerOn(mgState, '--MICROPHYSICS_POSITIVE', __RC__) - - where (ait_dgn_dry < tiny(0.0)) - ait_dgn_dry = MAM7_AITKEN_MODE_SIZE - end where - - where (acc_dgn_dry < tiny(0.0)) - acc_dgn_dry = MAM7_ACCUMULATION_MODE_SIZE - end where - - where (pcm_dgn_dry < tiny(0.0)) - pcm_dgn_dry = MAM7_PRIMARY_CARBON_MODE_SIZE - end where - - where (fss_dgn_dry < tiny(0.0)) - fss_dgn_dry = MAM7_FINE_SEASALT_MODE_SIZE - end where - - where (fdu_dgn_dry < tiny(0.0)) - fdu_dgn_dry = MAM7_FINE_SEASALT_MODE_SIZE - end where - - where (css_dgn_dry < tiny(0.0)) - css_dgn_dry = MAM7_COARSE_SEASALT_MODE_SIZE - end where - - where (cdu_dgn_dry < tiny(0.0)) - cdu_dgn_dry = MAM7_COARSE_DUST_MODE_SIZE - end where - - - where (ait_dgn_wet < tiny(0.0)) - ait_dgn_wet = MAM7_AITKEN_MODE_SIZE - end where - - where (acc_dgn_wet < tiny(0.0)) - acc_dgn_wet = MAM7_ACCUMULATION_MODE_SIZE - end where - - where (pcm_dgn_wet < tiny(0.0)) - pcm_dgn_wet = MAM7_PRIMARY_CARBON_MODE_SIZE - end where - - where (fss_dgn_wet < tiny(0.0)) - fss_dgn_wet = MAM7_FINE_SEASALT_MODE_SIZE - end where - - where (fdu_dgn_wet < tiny(0.0)) - fdu_dgn_wet = MAM7_FINE_SEASALT_MODE_SIZE - end where - - where (css_dgn_wet < tiny(0.0)) - css_dgn_wet = MAM7_COARSE_SEASALT_MODE_SIZE - end where - - where (cdu_dgn_wet < tiny(0.0)) - cdu_dgn_wet = MAM7_COARSE_DUST_MODE_SIZE - end where - - call MAPL_TimerOff(mgState, '--MICROPHYSICS_POSITIVE', __RC__) - -#if (1) - call MAPL_TimerOn(mgState, '-SIZE', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_DRY', __RC__) - call MAM_DrySize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_DRY', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_WET', __RC__) - call MAM_WetSize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_WET', __RC__) - - call MAPL_TimerOff(mgState, '-SIZE', __RC__) -#endif - - - AEROSOL_MICROPHYSICS: if (self%microphysics) then - - do j = 1, jm - do i = 1, im - - amc_t(ncol, :) = T(i, j, :) ! temperature at model levels (K) - amc_pmid(ncol, :) = 0.5*(ple(i,j,0:lm-1)+ple(i,j,1:lm)) ! pressure at layer center (Pa) - amc_pdel(ncol, :) = delp(i,j,:) ! pressure thickness of layer (Pa) - amc_zm(ncol, :) = zle(i,j,1:lm) ! altitude (above ground) at layer center (m) - amc_pblh(ncol) = zpbl(i,j) ! planetary boundary layer depth (m) - - amc_qv(ncol, :) = Q(i,j,:) ! specific humidity (kg/kg) - amc_cld(ncol, :) = fcld(i,j,:) ! cloud fraction - amc_rh(ncol, :) = RH(i,j,:) ! relative humidity - - ! current tracer mixing ratios (TMRs) - - amc_qqcw(:ncol,:pver,:pcnstxx) = tiny(0.0) - amc_qqcw_precldchem(:ncol,:pver,:pcnstxx) = tiny(0.0) ! qqcw TMRs before cloud chemistry - - - ! units mixing ratios should be 'mol/mol-air' and '#/kmol-air' - amc_q(ncol,:,i_h2o2) = tiny(0.0) ! h2o2 - amc_q(ncol,:,i_h2so4) = h2so4(i,j,:) - amc_q(ncol,:,i_so2) = so2(i,j,:) - amc_q(ncol,:,i_dms) = tiny(0.0) ! dms - amc_q(ncol,:,i_nh3) = nh3(i,j,:) - amc_q(ncol,:,i_soag) = soa_g(i,j,:) - ! accumulation mode - amc_q(ncol,:,i_so4_a1) = acc_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a1)) - amc_q(ncol,:,i_nh4_a1) = acc_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a1)) - amc_q(ncol,:,i_pom_a1) = acc_a_pom(i,j,:) * (mw_air / adv_mass(i_pom_a1)) - amc_q(ncol,:,i_soa_a1) = acc_a_soa(i,j,:) * (mw_air / adv_mass(i_soa_a1)) - amc_q(ncol,:,i_bc_a1) = acc_a_bc(i,j,:) * (mw_air / adv_mass(i_bc_a1)) - amc_q(ncol,:,i_ncl_a1) = acc_a_ncl(i,j,:) * (mw_air / adv_mass(i_ncl_a1)) - amc_q(ncol,:,i_num_a1) = acc_a_num(i,j,:) * mw_air - ! aitken mode - amc_q(ncol,:,i_so4_a2) = ait_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a2)) - amc_q(ncol,:,i_nh4_a2) = ait_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a2)) - amc_q(ncol,:,i_soa_a2) = ait_a_soa(i,j,:) * (mw_air / adv_mass(i_soa_a2)) - amc_q(ncol,:,i_ncl_a2) = ait_a_ncl(i,j,:) * (mw_air / adv_mass(i_ncl_a2)) - amc_q(ncol,:,i_num_a2) = ait_a_num(i,j,:) * mw_air - ! primary carbon mode - amc_q(ncol,:,i_pom_a3) = pcm_a_pom(i,j,:) * (mw_air / adv_mass(i_pom_a3)) - amc_q(ncol,:,i_bc_a3) = pcm_a_bc(i,j,:) * (mw_air / adv_mass(i_bc_a3)) - amc_q(ncol,:,i_num_a3) = pcm_a_num(i,j,:) * mw_air - ! fine seasalt mode - amc_q(ncol,:,i_ncl_a4) = fss_a_ncl(i,j,:) * (mw_air / adv_mass(i_ncl_a4)) - amc_q(ncol,:,i_so4_a4) = fss_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a4)) - amc_q(ncol,:,i_nh4_a4) = fss_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a4)) - amc_q(ncol,:,i_num_a4) = fss_a_num(i,j,:) * mw_air - ! fine dust mode - amc_q(ncol,:,i_dst_a5) = fdu_a_dst(i,j,:) * (mw_air / adv_mass(i_dst_a5)) - amc_q(ncol,:,i_so4_a5) = fdu_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a5)) - amc_q(ncol,:,i_nh4_a5) = fdu_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a5)) - amc_q(ncol,:,i_num_a5) = fdu_a_num(i,j,:) * mw_air - ! coarse seasalt mode - amc_q(ncol,:,i_ncl_a6) = css_a_ncl(i,j,:) * (mw_air / adv_mass(i_ncl_a6)) - amc_q(ncol,:,i_so4_a6) = css_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a6)) - amc_q(ncol,:,i_nh4_a6) = css_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a6)) - amc_q(ncol,:,i_num_a6) = css_a_num(i,j,:) * mw_air - ! coarse dust mode - amc_q(ncol,:,i_dst_a7) = cdu_a_dst(i,j,:) * (mw_air / adv_mass(i_dst_a7)) - amc_q(ncol,:,i_so4_a7) = cdu_a_so4(i,j,:) * (mw_air / adv_mass(i_so4_a7)) - amc_q(ncol,:,i_nh4_a7) = cdu_a_nh4(i,j,:) * (mw_air / adv_mass(i_nh4_a7)) - amc_q(ncol,:,i_num_a7) = cdu_a_num(i,j,:) * mw_air - - - amc_q_pregaschem(:ncol,:pver,:pcnstxx) = amc_q ! q TMRs before gas-phase chemistry -#if (0) - ! compute pregaschem using tendencies - amc_q_pregaschem(ncol,:,i_h2so4) = h2so4(i,j,:) - (ddt_h2so4_gas(i,j,:) + ddt_h2so4_aq(i,j,:))*self%dt - amc_q_pregaschem(ncol,:,i_so2) = so2(i,j,:) - (ddt_so2_gas(i,j,:) + ddt_so2_aq(i,j,:) )*self%dt - amc_q_pregaschem(ncol,:,i_nh3) = nh3(i,j,:) - (ddt_nh3_gas(i,j,:) + ddt_nh3_aq(i,j,:) )*self%dt -#else - ! ...or use the pregas exports - amc_q_pregaschem(ncol,:,i_h2so4) = h2so4_g_(i,j,:) - amc_q_pregaschem(ncol,:,i_so2) = so2_g_(i,j,:) - amc_q_pregaschem(ncol,:,i_nh3) = nh3_g_(i,j,:) -#endif - - - amc_q_precldchem(:ncol,:pver,:pcnstxx) = amc_q ! q TMRs before cloud chemistry -#if (0) - ! compute preaqchem using tendencies - amc_q_precldchem(ncol,:,i_h2so4) = h2so4(i,j,:) - (ddt_h2so4_aq(i,j,:))*self%dt - amc_q_precldchem(ncol,:,i_so2) = so2(i,j,:) - (ddt_so2_aq(i,j,:) )*self%dt - amc_q_precldchem(ncol,:,i_nh3) = nh3(i,j,:) - (ddt_nh3_aq(i,j,:) )*self%dt -#else - ! ...or use the preaq exports - amc_q_precldchem(ncol,:,i_h2so4) = h2so4_a_(i,j,:) - amc_q_precldchem(ncol,:,i_so2) = so2_a_(i,j,:) - amc_q_precldchem(ncol,:,i_nh3) = nh3_a_(i,j,:) -#endif - amc_q_precldchem(ncol,:,i_so4_a1) = acc_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a1)) - amc_q_precldchem(ncol,:,i_nh4_a1) = acc_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a1)) - amc_q_precldchem(ncol,:,i_so4_a2) = ait_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a2)) - amc_q_precldchem(ncol,:,i_nh4_a2) = ait_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a2)) - amc_q_precldchem(ncol,:,i_so4_a4) = fss_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a4)) - amc_q_precldchem(ncol,:,i_nh4_a4) = fss_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a4)) - amc_q_precldchem(ncol,:,i_so4_a5) = fdu_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a5)) - amc_q_precldchem(ncol,:,i_nh4_a5) = fdu_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a5)) - amc_q_precldchem(ncol,:,i_so4_a6) = css_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a6)) - amc_q_precldchem(ncol,:,i_nh4_a6) = css_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a6)) - amc_q_precldchem(ncol,:,i_so4_a7) = cdu_a_so4_(i,j,:) * (mw_air / adv_mass(i_so4_a7)) - amc_q_precldchem(ncol,:,i_nh4_a7) = cdu_a_nh4_(i,j,:) * (mw_air / adv_mass(i_nh4_a7)) - - - amc_dgn_a_dry(pcols,:,1) = acc_dgn_dry(i,j,:) ! dry geo. mean dia. (m) of number PSD - amc_dgn_a_dry(pcols,:,2) = ait_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,3) = pcm_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,4) = fss_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,5) = fdu_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,6) = css_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,7) = cdu_dgn_dry(i,j,:) - - amc_dgn_a_wet(pcols,:,1) = acc_dgn_wet(i,j,:) ! wet geo. mean dia. (m) of number PSD - amc_dgn_a_wet(pcols,:,2) = ait_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,3) = pcm_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,4) = fss_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,5) = fdu_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,6) = css_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,7) = cdu_dgn_wet(i,j,:) - - - amc_wetdens_host(:pcols,:pver,:ntot_amode) = 1.0e3 ! interstitial aerosol wet density (kg/m3) - amc_qaerwat(:pcols,:pver,:ntot_amode) = 0.0 ! optional, aerosol water mixing ratio (kg/kg) - amc_qaerwat(pcols,:,1) = acc_a_wtr(i,j,:) ! aerosol water - amc_qaerwat(pcols,:,2) = ait_a_wtr(i,j,:) - amc_qaerwat(pcols,:,3) = pcm_a_wtr(i,j,:) - amc_qaerwat(pcols,:,4) = fss_a_wtr(i,j,:) - amc_qaerwat(pcols,:,5) = fdu_a_wtr(i,j,:) - amc_qaerwat(pcols,:,6) = css_a_wtr(i,j,:) - amc_qaerwat(pcols,:,7) = cdu_a_wtr(i,j,:) - - amc_q_coltendaa = 0.0d0 ! column integrated tendencies diagnostics - amc_qqcw_coltendaa = 0.0d0 ! --dito-- but for qqcw - - - ! the modal_aero_amicphys_intr() subroutine does in the order listed below: - ! - ! - in clear grid cells - ! 1. condensation / gas-aerosol-exchange of H2SO4, NH3, H2O - ! 2. renaming after "continuous growth" - ! 3. nucleation (new particle formation) - ! 4. coagulation - ! 5. primary carbon aging - ! - ! - in cloudy grid cells - ! 1. condensation / gas-aerosol-exchange - ! 2. renaming after "continuous growth" - ! 3. primary carbon aging - - call modal_aero_amicphys_intr(amc_do_gasaerexch, & - amc_do_rename, & - amc_do_newnuc, & - amc_do_coag, & - amc_lchnk, & - ncol, & - amc_nstep, & - amc_loffset, & - amc_deltat, & - amc_latndx, & - amc_lonndx, & - amc_t, & - amc_pmid, & - amc_pdel, & - amc_zm, & - amc_pblh, & - amc_qv, & - amc_cld, & - amc_rh, & - amc_q, & - amc_qqcw, & - amc_q_pregaschem, & - amc_q_precldchem, & - amc_qqcw_precldchem, & - amc_dgn_a_dry, & - amc_dgn_a_wet, & - amc_wetdens_host, & - amc_q_coltendaa, & - amc_qqcw_coltendaa)! & amc_qaerwat -- optional) - - - ! current tracer mixing ratios (TMRs) -! h2o2 = amc_q(ncol,:,i_h2o2) - h2so4(i,j,:) = amc_q(ncol,:,i_h2so4) - so2(i,j,:) = amc_q(ncol,:,i_so2) -! dms = amc_q(ncol,:,i_dms) - nh3(i,j,:) = amc_q(ncol,:,i_nh3) - soa_g(i,j,:) = amc_q(ncol,:,i_soag) - ! accumulation mode - acc_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a1) * (adv_mass(i_so4_a1) / mw_air) - acc_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a1) * (adv_mass(i_nh4_a1) / mw_air) - acc_a_pom(i,j,:) = amc_q(ncol,:,i_pom_a1) * (adv_mass(i_pom_a1) / mw_air) - acc_a_soa(i,j,:) = amc_q(ncol,:,i_soa_a1) * (adv_mass(i_soa_a1) / mw_air) - acc_a_bc(i,j,:) = amc_q(ncol,:,i_bc_a1) * (adv_mass(i_bc_a1) / mw_air) - acc_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a1) * (adv_mass(i_ncl_a1) / mw_air) - acc_a_num(i,j,:) = amc_q(ncol,:,i_num_a1) / mw_air - ! aitken mode - ait_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a2) * (adv_mass(i_so4_a2) / mw_air) - ait_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a2) * (adv_mass(i_nh4_a2) / mw_air) - ait_a_soa(i,j,:) = amc_q(ncol,:,i_soa_a2) * (adv_mass(i_soa_a2) / mw_air) - ait_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a2) * (adv_mass(i_ncl_a2) / mw_air) - ait_a_num(i,j,:) = amc_q(ncol,:,i_num_a2) / mw_air - ! primary carbon mode - pcm_a_pom(i,j,:) = amc_q(ncol,:,i_pom_a3) * (adv_mass(i_pom_a3) / mw_air) - pcm_a_bc(i,j,:) = amc_q(ncol,:,i_bc_a3) * (adv_mass(i_bc_a3) / mw_air) - pcm_a_num(i,j,:) = amc_q(ncol,:,i_num_a3) / mw_air - ! fine seasalt mode - fss_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a4) * (adv_mass(i_ncl_a4) / mw_air) - fss_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a4) * (adv_mass(i_so4_a4) / mw_air) - fss_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a4) * (adv_mass(i_nh4_a4) / mw_air) - fss_a_num(i,j,:) = amc_q(ncol,:,i_num_a4) / mw_air - ! fine dust mode - fdu_a_dst(i,j,:) = amc_q(ncol,:,i_dst_a5) * (adv_mass(i_dst_a5) / mw_air) - fdu_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a5) * (adv_mass(i_so4_a5) / mw_air) - fdu_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a5) * (adv_mass(i_nh4_a5) / mw_air) - fdu_a_num(i,j,:) = amc_q(ncol,:,i_num_a5) / mw_air - ! coarse seasalt mode - css_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a6) * (adv_mass(i_ncl_a6) / mw_air) - css_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a6) * (adv_mass(i_so4_a6) / mw_air) - css_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a6) * (adv_mass(i_nh4_a6) / mw_air) - css_a_num(i,j,:) = amc_q(ncol,:,i_num_a6) / mw_air - ! coarse dust mode - cdu_a_dst(i,j,:) = amc_q(ncol,:,i_dst_a7) * (adv_mass(i_dst_a7) / mw_air) - cdu_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a7) * (adv_mass(i_so4_a7) / mw_air) - cdu_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a7) * (adv_mass(i_nh4_a7) / mw_air) - cdu_a_num(i,j,:) = amc_q(ncol,:,i_num_a7) / mw_air - - ! save the colmn-integrated diagnostics - q_coltend_cond_(i,j,:) = amc_q_coltendaa(ncol,:,iqtend_cond) - q_coltend_rename_(i,j,:) = amc_q_coltendaa(ncol,:,iqtend_rnam) - q_coltend_nucl_(i,j,:) = amc_q_coltendaa(ncol,:,iqtend_nnuc) - q_coltend_coag_(i,j,:) = amc_q_coltendaa(ncol,:,iqtend_coag) - qqcw_coltend_rename_(i,j,:) = amc_q_coltendaa(ncol,:,iqqcwtend_rnam) - end do - end do - - end if AEROSOL_MICROPHYSICS - - call MAPL_TimerOff(mgState, '-MICROPHYSICS', __RC__) - - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_ACC_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a1) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_AIT_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a2) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_PCM_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a3) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_FSS_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a4) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_FDU_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a5) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_CSS_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a6) - - nullify(q_coltend); call MAPL_GetPointer(export, q_coltend, 'DDT_NUM_A_CDU_COND', __RC__) - if (associated(q_coltend)) q_coltend = q_coltend_cond_(:,:,i_num_a7) - - - ! free the memory used to hold the pre-aqueous SO4 and NH4 - deallocate(ait_a_so4_, __STAT__) - deallocate(ait_a_nh4_, __STAT__) - deallocate(acc_a_so4_, __STAT__) - deallocate(acc_a_nh4_, __STAT__) - deallocate(fdu_a_so4_, __STAT__) - deallocate(fdu_a_nh4_, __STAT__) - deallocate(cdu_a_so4_, __STAT__) - deallocate(cdu_a_nh4_, __STAT__) - deallocate(fss_a_so4_, __STAT__) - deallocate(fss_a_nh4_, __STAT__) - deallocate(css_a_so4_, __STAT__) - deallocate(css_a_nh4_, __STAT__) - - ! free the memory used to hold the column-integrated tendency diagnostics - deallocate(q_coltend_cond_, __STAT__) - deallocate(q_coltend_rename_, __STAT__) - deallocate(q_coltend_coag_, __STAT__) - deallocate(q_coltend_nucl_, __STAT__) - deallocate(qqcw_coltend_rename_, __STAT__) - - -! Emissions: note that emissions are done after the aerosol microphysics -! in order to obtain and apply the pre-gas and pre-aqueous phase mixing ratios -! required by the later -! --------------------- - - call MAPL_TimerOn(mgState, '-EMISSIONS', __RC__) - -! Seasalt emissions -! ----------------- - call MAM_SS_Emission(self%scheme, import, export, self%qa, self%femisSS, self%dt, __RC__) - -! Dust emissions -! ----------------- - call MAM_DU_Emission(self%scheme, import, export, self%qa, self%femisDU, self%dt, __RC__) - -! Black Carbon emissions -! ---------------------- - call MAM_BC_Emission(self%scheme, import, export, self%qa, self%dt, __RC__) - -! Organic Carbon emissions -! ---------------------- - call MAM_OC_Emission(self%scheme, import, export, self%qa, self%pom_oc_ratio, self%dt, __RC__) - -! Sulfate (SO4) emissions -! ----------------------- - call MAM_SO4_Emission(self%scheme, import, export, self%qa, self%dt, __RC__) - - call MAPL_TimerOff(mgState, '-EMISSIONS', __RC__) - - - call MAPL_TimerOn(mgState, '-MODE_MERGING', __RC__) - - AEROSOL_MODE_MERGING: if (self%mode_merging) then - - do j = 1, jm - do i = 1, im - - ! current tracer mixing ratios (TMRs) - amc_q(ncol,:,i_h2o2) = tiny(0.0) - amc_q(ncol,:,i_h2so4) = h2so4(i,j,:) - amc_q(ncol,:,i_so2) = so2(i,j,:) - amc_q(ncol,:,i_dms) = tiny(0.0) ! dms - amc_q(ncol,:,i_nh3) = nh3(i,j,:) - amc_q(ncol,:,i_soag) = soa_g(i,j,:) - ! accumulation mode - amc_q(ncol,:,i_so4_a1) = acc_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a1) = acc_a_nh4(i,j,:) - amc_q(ncol,:,i_pom_a1) = acc_a_pom(i,j,:) - amc_q(ncol,:,i_soa_a1) = acc_a_soa(i,j,:) - amc_q(ncol,:,i_bc_a1) = acc_a_bc(i,j,:) - amc_q(ncol,:,i_ncl_a1) = acc_a_ncl(i,j,:) - amc_q(ncol,:,i_num_a1) = acc_a_num(i,j,:) - ! aitken mode - amc_q(ncol,:,i_so4_a2) = ait_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a2) = ait_a_nh4(i,j,:) - amc_q(ncol,:,i_soa_a2) = ait_a_soa(i,j,:) - amc_q(ncol,:,i_ncl_a2) = ait_a_ncl(i,j,:) - amc_q(ncol,:,i_num_a2) = ait_a_num(i,j,:) - ! primary carbon mode - amc_q(ncol,:,i_pom_a3) = pcm_a_pom(i,j,:) - amc_q(ncol,:,i_bc_a3) = pcm_a_bc(i,j,:) - amc_q(ncol,:,i_num_a3) = pcm_a_num(i,j,:) - ! fine seasalt mode - amc_q(ncol,:,i_ncl_a4) = fss_a_ncl(i,j,:) - amc_q(ncol,:,i_so4_a4) = fss_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a4) = fss_a_nh4(i,j,:) - amc_q(ncol,:,i_num_a4) = fss_a_num(i,j,:) - ! fine dust mode - amc_q(ncol,:,i_dst_a5) = fdu_a_dst(i,j,:) - amc_q(ncol,:,i_so4_a5) = fdu_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a5) = fdu_a_nh4(i,j,:) - amc_q(ncol,:,i_num_a5) = fdu_a_num(i,j,:) - ! coarse seasalt mode - amc_q(ncol,:,i_ncl_a6) = css_a_ncl(i,j,:) - amc_q(ncol,:,i_so4_a6) = css_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a6) = css_a_nh4(i,j,:) - amc_q(ncol,:,i_num_a6) = css_a_num(i,j,:) - ! coarse dust mode - amc_q(ncol,:,i_dst_a7) = cdu_a_dst(i,j,:) - amc_q(ncol,:,i_so4_a7) = cdu_a_so4(i,j,:) - amc_q(ncol,:,i_nh4_a7) = cdu_a_nh4(i,j,:) - amc_q(ncol,:,i_num_a7) = cdu_a_num(i,j,:) - - - amc_qqcw(:ncol,:pver,:pcnstxx) = tiny(0.0) - - - amc_dgn_a_dry(pcols,:,1) = acc_dgn_dry(i,j,:) ! dry geo. mean dia. (m) of number PSD - amc_dgn_a_dry(pcols,:,2) = ait_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,3) = pcm_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,4) = fss_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,5) = fdu_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,6) = css_dgn_dry(i,j,:) - amc_dgn_a_dry(pcols,:,7) = cdu_dgn_dry(i,j,:) - - amc_dgn_a_wet(pcols,:,1) = acc_dgn_wet(i,j,:) ! wet geo. mean dia. (m) of number PSD - amc_dgn_a_wet(pcols,:,2) = ait_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,3) = pcm_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,4) = fss_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,5) = fdu_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,6) = css_dgn_wet(i,j,:) - amc_dgn_a_wet(pcols,:,7) = cdu_dgn_wet(i,j,:) - - amc_dotend = .false. - amc_dqdt = 0.0d0 - call modal_aero_calcsize_sub(1, & - 1, 1, 72, 72, & - amc_pdel, & - amc_q, & - amc_qqcw, & - amc_dqdt, & - amc_dgn_a_dry, & - amc_deltat, & - amc_dotend, & - self%verbose) - - ! apply the tendencies due to the mode manager mechanism - amc_q(ncol,:,7:pcnstxx) = amc_q(ncol,:,7:pcnstxx) + amc_dqdt(ncol,:,7:pcnstxx)*amc_deltat - - - ! current tracer mixing ratios (TMRs) -! h2o2 = amc_q(ncol,:,i_h2o2) - h2so4(i,j,:) = amc_q(ncol,:,i_h2so4) - so2(i,j,:) = amc_q(ncol,:,i_so2) -! dms = amc_q(ncol,:,i_dms) - nh3(i,j,:) = amc_q(ncol,:,i_nh3) - soa_g(i,j,:) = amc_q(ncol,:,i_soag) - - ! accumulation mode - acc_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a1) - acc_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a1) - acc_a_pom(i,j,:) = amc_q(ncol,:,i_pom_a1) - acc_a_soa(i,j,:) = amc_q(ncol,:,i_soa_a1) - acc_a_bc(i,j,:) = amc_q(ncol,:,i_bc_a1) - acc_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a1) - acc_a_num(i,j,:) = amc_q(ncol,:,i_num_a1) - ! aitken mode - ait_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a2) - ait_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a2) - ait_a_soa(i,j,:) = amc_q(ncol,:,i_soa_a2) - ait_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a2) - ait_a_num(i,j,:) = amc_q(ncol,:,i_num_a2) - ! primary carbon mode - pcm_a_pom(i,j,:) = amc_q(ncol,:,i_pom_a3) - pcm_a_bc(i,j,:) = amc_q(ncol,:,i_bc_a3) - pcm_a_num(i,j,:) = amc_q(ncol,:,i_num_a3) - ! fine seasalt mode - fss_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a4) - fss_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a4) - fss_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a4) - fss_a_num(i,j,:) = amc_q(ncol,:,i_num_a4) - ! fine dust mode - fdu_a_dst(i,j,:) = amc_q(ncol,:,i_dst_a5) - fdu_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a5) - fdu_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a5) - fdu_a_num(i,j,:) = amc_q(ncol,:,i_num_a5) - ! coarse seasalt mode - css_a_ncl(i,j,:) = amc_q(ncol,:,i_ncl_a6) - css_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a6) - css_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a6) - css_a_num(i,j,:) = amc_q(ncol,:,i_num_a6) - ! coarse dust mode - cdu_a_dst(i,j,:) = amc_q(ncol,:,i_dst_a7) - cdu_a_so4(i,j,:) = amc_q(ncol,:,i_so4_a7) - cdu_a_nh4(i,j,:) = amc_q(ncol,:,i_nh4_a7) - cdu_a_num(i,j,:) = amc_q(ncol,:,i_num_a7) - - -#if (0) - acc_a_wtr(i,j,:) = amc_qaerwat(pcols,:,1) ! aerosol water - ait_a_wtr(i,j,:) = amc_qaerwat(pcols,:,2) - pcm_a_wtr(i,j,:) = amc_qaerwat(pcols,:,3) - fss_a_wtr(i,j,:) = amc_qaerwat(pcols,:,4) - fdu_a_wtr(i,j,:) = amc_qaerwat(pcols,:,5) - css_a_wtr(i,j,:) = amc_qaerwat(pcols,:,6) - cdu_a_wtr(i,j,:) = amc_qaerwat(pcols,:,7) -#endif - -#if (0) - acc_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,1) ! dry geo. mean dia. (m) of number PSD - ait_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,2) - pcm_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,3) - fss_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,4) - fdu_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,5) - css_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,6) - cdu_dgn_dry(i,j,:) = amc_dgn_a_dry(pcols,:,7) - - acc_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,1) - ait_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,2) - pcm_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,3) - fss_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,4) - fdu_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,5) - css_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,6) - cdu_dgn_wet(i,j,:) = amc_dgn_a_wet(pcols,:,7) -#endif - end do - end do - - end if AEROSOL_MODE_MERGING - - call MAPL_TimerOff(mgState, '-MODE_MERGING', __RC__) - - -! -! Dry removal - gravitational settling and dry deposition -! ------------------------------------------------------- - - if (self%dry_removal) then -#if (1) - call MAPL_TimerOn(mgState, '-SIZE', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_DRY', __RC__) - call MAM_DrySize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_DRY', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_WET', __RC__) - call MAM_WetSize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_WET', __RC__) - - call MAPL_TimerOff(mgState, '-SIZE', __RC__) -#endif - call MAPL_TimerOn(mgState, '-REMOVAL', __RC__) - call MAPL_TimerOn(mgState, '--REMOVAL_DRY', __RC__) - call MAM_DryRemoval(self%scheme, import, export, self%qa, self%Da, self%dt, __RC__) - call MAPL_TimerOff(mgState, '--REMOVAL_DRY', __RC__) - call MAPL_TimerOff(mgState, '-REMOVAL', __RC__) - end if - - -! -! Wet removal - large scale wet scavenging -! ---------------------------------------- - call MAPL_TimerOn(mgState, '-REMOVAL', __RC__) - call MAPL_TimerOn(mgState, '--REMOVAL_WET', __RC__) - - if (self%wet_removal) then - call MAM_WetRemoval(self%scheme, import, export, self%qa, self%dt, __RC__) - end if - - call MAPL_TimerOff(mgState, '--REMOVAL_WET', __RC__) - call MAPL_TimerOff(mgState, '-REMOVAL', __RC__) - -! -! Update the aerosol size and absorbed water -! ------------------------------------------ - call MAPL_TimerOn(mgState, '-HYGROSCOPIC_GROWTH', __RC__) -#if (1) - call MAPL_TimerOn(mgState, '-SIZE', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_DRY', __RC__) - call MAM_DrySize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_DRY', __RC__) - - call MAPL_TimerOn(mgState, '--SIZE_WET', __RC__) - call MAM_WetSize(self%scheme, import, export, self%qa, self%Da, __RC__) - call MAPL_TimerOff(mgState, '--SIZE_WET', __RC__) - - call MAPL_TimerOff(mgState, '-SIZE', __RC__) -#endif - call MAPL_TimerOff(mgState, '-HYGROSCOPIC_GROWTH', __RC__) - - -! Diagnostics -! ----------------- -! NOTE : The order of which the processes are done will have -! some impact on the dignostic fields -! ----------------------------------------------------------- - call MAPL_TimerOn(mgState, '-DIAGNOSTICS', __RC__) - - call MAPL_TimerOn(mgState, '--DIAGNOSTICS_SEASALT', __RC__) - call MAM_SS_Diagnostics(self%scheme, import, export, self%qa, self%dt, __RC__) - call MAPL_TimerOff(mgState, '--DIAGNOSTICS_SEASALT', __RC__) - - call MAPL_TimerOn(mgState, '--DIAGNOSTICS_DUST', __RC__) - call MAM_DU_Diagnostics(self%scheme, import, export, self%qa, self%dt, __RC__) - call MAPL_TimerOff(mgState, '--DIAGNOSTICS_DUST', __RC__) - - call MAPL_TimerOn(mgState, '--DIAGNOSTICS_CIM', __RC__) - call CIM_Diagnostics(self%scheme, import, export, self%qa, self%dt, __RC__) - call MAPL_TimerOff(mgState, '--DIAGNOSTICS_CIM', __RC__) - - call MAPL_TimerOn(mgState, '--DIAGNOSTICS_SFC', __RC__) - call SFC_Diagnostics(self%scheme, import, export, self%qa, self%Da, self%dt, __RC__) - call MAPL_TimerOff(mgState, '--DIAGNOSTICS_SFC', __RC__) - - - call MAPL_TimerOn(mgState, '--DIAGNOSTICS_AOT', __RC__) - call AOT_Diagnostics(self%scheme, import, export, self%qa, self%Da, self%mie_ait, & - self%mie_acc, & - self%mie_pcm, & - self%mie_fss, & - self%mie_css, & - self%mie_fdu, & - self%mie_cdu, & - self%dt, __RC__) - call MAPL_TimerOff(mgState, '--DIAGNOSTICS_AOT', __RC__) - - call MAPL_TimerOff(mgState, '-DIAGNOSTICS', __RC__) - - call MAPL_TimerOff(mgState, 'RUN', __RC__) - - call MAPL_TimerOff(mgState, 'TOTAL', __RC__) - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine Run_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ --- Finalize MAMchem -! -! !INTERFACE: -! - - subroutine Finalize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: gc ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 01Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Finalize_') - - type(MAM_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - integer :: im_World, jm_World ! Global 2D dimensions - integer :: im, jm, lm ! 3D Dimensions - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: COMP_NAME - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // '::' // trim(Iam) - -! Finalize MAPL Generic -! --------------------- - call MAPL_GenericFinalize ( GC, IMPORT, EXPORT, CLOCK, __RC__ ) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, CLOCK, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, & - nymd, nhms, cdt, __RC__ ) - - -! Delete the tracers bundles -! ------------------------------------ - call MAPL_SimpleBundleDestroy(self%qa) - call MAPL_SimpleBundleDestroy(self%qc) - call MAPL_SimpleBundleDestroy(self%qg) - - call MAPL_SimpleBundleDestroy(self%Da) - -! Delete the broad-band optical tables -! ------------------------------------ - call MAML_OpticsTableDestroy(MAM7_MieTable(1), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(2), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(3), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(4), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(5), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(6), __RC__) - call MAML_OpticsTableDestroy(MAM7_MieTable(7), __RC__) - -! Delete the narrow-band optical tables -! ------------------------------------ - call MAML_OpticsTableDestroy(self%mie_ait, __RC__) - call MAML_OpticsTableDestroy(self%mie_acc, __RC__) - call MAML_OpticsTableDestroy(self%mie_pcm, __RC__) - call MAML_OpticsTableDestroy(self%mie_fss, __RC__) - call MAML_OpticsTableDestroy(self%mie_css, __RC__) - call MAML_OpticsTableDestroy(self%mie_fdu, __RC__) - call MAML_OpticsTableDestroy(self%mie_cdu, __RC__) - -! Delete the internal private state -! --------------------------------- - deallocate(self, __STAT__) - - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine Finalize_ - -!....................................................................... - - subroutine extract_ (GC, CLOCK, & - myState, GRID, CF, & - im_World, jm_World,& - im, jm, lm, & - nymd, nhms, & - cdt, rc) - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Comp object - type(ESMF_Clock), intent(in) :: CLOCK ! Clock - - type(MAM_state), pointer :: myState ! Legacy state - type(ESMF_Grid), intent(out) :: GRID ! Grid - type(ESMF_Config), intent(out) :: CF ! Universal Config - - integer, intent(out) :: im_World, jm_World ! Global 2D Dimensions - integer, intent(out) :: im, jm, lm ! 3D Dimensions - - integer, intent(out) :: nymd, nhms ! date, time - real, intent(out) :: cdt ! time step in secs - integer, intent(out), optional :: rc - -! --- - - __Iam__('extract_') - - character(len=ESMF_MAXSTR) :: comp_name - - type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state - type(MAM_Wrap) :: wrap - - integer, dimension(3) :: dims - - type(ESMF_Alarm) :: run_alarm - type(ESMF_TimeInterval) :: ring_interval - real(ESMF_KIND_R8) :: time_step - - type(ESMF_Time) :: time - integer :: iyr, imm, idd, ihr, imn, isc - - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - - rc = 0 - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - -! Get my internal state -! --------------------- - call ESMF_UserCompGetInternalState(GC, 'MAM_state', wrap, STATUS) - VERIFY_(STATUS) - myState => wrap%ptr - -! Get the configuration -! --------------------- - call ESMF_GridCompGet(GC, config=CF, __RC__) - -! Get time step -! ------------- - call MAPL_Get(mgState, RunAlarm=run_alarm, __RC__) - call ESMF_AlarmGet(run_alarm, ringInterval=ring_interval, __RC__) - - call ESMF_TimeIntervalGet(ring_interval, s_r8=time_step, __RC__) - cdt = real(time_step) - -! Extract time as simple integers from clock -! ------------------------------------------ - call ESMF_ClockGet(CLOCK, currTime=time, __RC__) - call ESMF_TimeGet(TIME, yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc, __RC__) - - call MAPL_PackTime(nymd, iyr, imm, idd) - call MAPL_PackTime(nhms, ihr, imn, isc) - -! Extract the ESMF Grid -! --------------------- - call ESMF_GridCompGet(GC, grid=GRID, __RC__) - -! Global dimensions -! ----------------- - call MAPL_GridGet(GRID, globalCellCountPerDim=dims, __RC__) - im_World = dims(1) - jm_World = dims(2) - -! Local dimensions -! ---------------- - call ESMF_GridGet(GRID, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - computationalCount=dims, __RC__) - im = dims(1) - jm = dims(2) - lm = dims(3) - - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MAM_GetTracerName --- returns short and long names of a tracer -! -! !INTERFACE: -! - - subroutine MAM_GetFieldName (mode_short_name, mode_long_name, species, attachment_state, type, short_name, long_name, rc) - -! !USES: - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - -! !INPUT PARAMETERS: - character(len=MAM_MAXSTR), intent(in) :: mode_short_name ! mode short name - character(len=MAM_MAXSTR), intent(in) :: mode_long_name ! mode long name - character(len=MAM_MAXSTR), intent(in) :: species ! species name/alias - character(len=MAM_MAXSTR), intent(in) :: attachment_state ! attachment state = {'interstitial' | 'cloud-borne'} - character(len=MAM_MAXSTR), intent(in) :: type ! tracer type = {'number' | 'mass'} - - -! !OUTPUT PARAMETERS: - character(len=MAM_MAXSTR), intent(out) :: short_name ! short name of tracer - character(len=MAM_MAXSTR), intent(out) :: long_name ! long name of tracer - - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine constructs short and long names of aerosol tracer -! in one of the MAM modes depending on its type and -! attachment state. -! -! !REVISION HISTORY: -! -! 6 May 2014 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'MAM_GetTracerName' - - integer :: STATUS - - character(len=3) :: state - character(len=MAM_MAXSTR) :: name, buff - - -! Initialize local variables -! -------------------------- - rc = ESMF_SUCCESS - - _ASSERT(attachment_state == 'interstitial' .or. attachment_state == 'cloud-borne','needs informative message') - _ASSERT(type == 'number' .or. type == 'mass','needs informative message') - - - if (type == 'number') then - name = 'NUM' - buff = 'number of ' - else - name = trim(species) - buff = 'mass mixing ratio of ' - end if - - if (attachment_state == 'interstitial') then - state = '_A_' - else - state = '_C_' - end if - - - short_name = trim(name) // state // trim(mode_short_name) - long_name = buff // trim(attachment_state) // ' aerosol particles in ' // trim(mode_long_name) // ' mode' - - - RETURN_(ESMF_SUCCESS) - - end subroutine MAM_GetFieldName - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: AqueousChemistry --- Simplified treatment of aqueos chemistry -! -! !INTERFACE: -! - - subroutine AqueousChemistry (self, import, export, qa, cdt, rc) - -! !USES: - - use Chem_ConstMod, only: grav - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine updates mass fields due to aqueos chemistry processes. -! -! !REVISION HISTORY: -! -! 2 June 2014 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'AqueousChemistry' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, i, k, m, s - integer :: ijl, ijkl - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - real, pointer, dimension(:,:,:) :: pSO4_aq, pNH4_aq - -! Exports - diagnostic fields -! --------------------------- - -! Local -! ----- - real, allocatable, dimension(:,:,:) :: num_aq ! total number mixing ratio for modes affected by aqueos chemistry - real, allocatable, dimension(:,:,:) :: f ! fraction of aqueos production - integer :: in_acc, in_fss, in_css, in_fdu, in_cdu ! index of number mixing raio - integer :: iq_acc, iq_fss, iq_css, iq_fdu, iq_cdu ! index of mass mixing raio - -! Parameters -! ---------- - real, parameter :: mw_air = 28.965 ! molar mass of dry air, g mol-1 - real, parameter :: mw_SO4 = 96.07 ! molar mass of sulfate, g mol-1 - real, parameter :: mw_NH4 = 18.0385 ! molar mass of dry air, g mol-1 - - -! Initialize local variables -! -------------------------- - rc = ESMF_SUCCESS - - _ASSERT(self%id == MAM7_SCHEME,'needs informative message') - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - - call MAPL_GetPointer(import, pSO4_aq, 'pSO4_aq', __RC__) - call MAPL_GetPointer(import, pNH4_aq, 'pNH4_aq', __RC__) - - - if ((.not. associated(pSO4_aq)) .or. (.not. associated(pNH4_aq))) then - print *, 'Skipping MAM::AqueousChemistry()' - RETURN_(ESMF_SUCCESS) - end if - - -! Get Exports -! ----------- - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - - in_acc = MAPL_SimpleBundleGetIndex(qa, 'NUM_A_ACC', 3, __RC__) - in_fss = MAPL_SimpleBundleGetIndex(qa, 'NUM_A_FSS', 3, __RC__) - in_css = MAPL_SimpleBundleGetIndex(qa, 'NUM_A_CSS', 3, __RC__) - in_fdu = MAPL_SimpleBundleGetIndex(qa, 'NUM_A_FDU', 3, __RC__) - in_cdu = MAPL_SimpleBundleGetIndex(qa, 'NUM_A_CDU', 3, __RC__) - - allocate(num_aq(i1:i2,j1:j2,km), __STAT__) - allocate(f(i1:i2,j1:j2,km), __STAT__) - - num_aq = 0.0 - num_aq = ( qa%r3(in_acc)%q + & - qa%r3(in_fss)%q + & - qa%r3(in_css)%q + & - qa%r3(in_fdu)%q + & - qa%r3(in_cdu)%q ) - - - ! partition SO4 - iq_acc = MAPL_SimpleBundleGetIndex(qa, 'SU_A_ACC', 3, __RC__) - iq_fss = MAPL_SimpleBundleGetIndex(qa, 'SU_A_FSS', 3, __RC__) - iq_css = MAPL_SimpleBundleGetIndex(qa, 'SU_A_CSS', 3, __RC__) - iq_fdu = MAPL_SimpleBundleGetIndex(qa, 'SU_A_FDU', 3, __RC__) - iq_cdu = MAPL_SimpleBundleGetIndex(qa, 'SU_A_CDU', 3, __RC__) - - ! this is not mass conservative if num_aq = 0, and needs to be revisited!!! - ! i.e., if num_aq is small but the production from aq. processes is > 0, - ! this mass will be lost. a better way is to perhaps create a new particle or - ! and add the mass. - - f = 0.0 - where (num_aq * rhoa > 1.0e-3) ! aerosol particle concentration larger than 1e-3 #/m-3 - f = (pSO4_aq * cdt) / num_aq - end where - - qa%r3(iq_acc)%q = qa%r3(iq_acc)%q + (f * qa%r3(in_acc)%q) - qa%r3(iq_fss)%q = qa%r3(iq_fss)%q + (f * qa%r3(in_fss)%q) - qa%r3(iq_css)%q = qa%r3(iq_css)%q + (f * qa%r3(in_css)%q) - qa%r3(iq_fdu)%q = qa%r3(iq_fdu)%q + (f * qa%r3(in_fdu)%q) - qa%r3(iq_cdu)%q = qa%r3(iq_cdu)%q + (f * qa%r3(in_cdu)%q) - - - ! partition NH4 - iq_acc = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_ACC', 3, __RC__) - iq_fss = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_FSS', 3, __RC__) - iq_css = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_CSS', 3, __RC__) - iq_fdu = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_FDU', 3, __RC__) - iq_cdu = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_CDU', 3, __RC__) - - f = 0.0 - where (num_aq * rhoa > 1.0e-3) - f = (pNH4_aq * cdt) / num_aq - end where - - qa%r3(iq_acc)%q = qa%r3(iq_acc)%q + (f * qa%r3(in_acc)%q) - qa%r3(iq_fss)%q = qa%r3(iq_fss)%q + (f * qa%r3(in_fss)%q) - qa%r3(iq_css)%q = qa%r3(iq_css)%q + (f * qa%r3(in_css)%q) - qa%r3(iq_fdu)%q = qa%r3(iq_fdu)%q + (f * qa%r3(in_fdu)%q) - qa%r3(iq_cdu)%q = qa%r3(iq_cdu)%q + (f * qa%r3(in_cdu)%q) - - - deallocate(num_aq, __STAT__) - deallocate(f, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine AqueousChemistry - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CIM_Diagnostics --- Column integrated mass diagnostics -! -! !INTERFACE: -! - - subroutine CIM_Diagnostics (self, import, export, qa, cdt, rc) - -! !USES: - - use Chem_ConstMod, only: grav - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: qa ! interstitial aerosol tracer fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine computes column integrated (dry) mass fields. -! -! !REVISION HISTORY: -! -! 8 Mar 2013 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'CIM_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, i, k, m, s - integer :: ijl, ijkl - -! Mode parameters -! ------------------------ - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - character(len=MAM_MAXSTR) :: species_name ! aerosol species name - character(len=MAM_MAXSTR) :: field_name ! field name - integer :: n_species ! number of aerosol species - - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, ple, delp - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: colmass ! column integrated mass density, kg m-2 - - -! Initialize local variables -! -------------------------- - rc = ESMF_SUCCESS - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, ple, 'PLE', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - -! Get Exports -! -------------- - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name=mode_name, n_species=n_species) - - call MAPL_GetPointer(export, colmass, trim(mode_name) // 'CMASS', __RC__) - if (associated(colmass)) colmass = 0.0 - - ! mass mixing ratios - do s = 1, n_species - species_name = self%mode(m)%species(s)%name - - field_name = trim(species_name) // '_A_' // trim(mode_name) - - i = MAPL_SimpleBundleGetIndex(qa, trim(field_name), 3, __RC__) - - if (associated(colmass)) then - do k = 1, km - colmass(:,:) = colmass(:,:) + qa%r3(i)%q(:,:,k) * delp(:,:,k)/grav - end do - end if - end do - end do - - RETURN_(ESMF_SUCCESS) - - end subroutine CIM_Diagnostics - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SFC_Diagnostics --- Near-surface diagnostics -! -! !INTERFACE: -! - - subroutine SFC_Diagnostics (self, import, export, qa, Da, cdt, rc) - -! !USES: - - use Chem_ConstMod, only: grav - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(in) :: qa ! interstitial aerosol tracer fields - type(MAPL_SimpleBundle), intent(in) :: Da ! interstitial aerosol size fields - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine computes column integrated (dry) mass fields. -! -! !REVISION HISTORY: -! -! 12 Jun 2015 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - - character(len=*), parameter :: Iam = 'SFC_Diagnostics' - - integer :: STATUS - integer :: i1, i2, j1, j2, k1, km, i, m, s - integer :: ijl, ijkl - -! Mode parameters -! ------------------------ - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - character(len=MAM_MAXSTR) :: species_name ! aerosol species name - character(len=MAM_MAXSTR) :: field_name ! field name - integer :: n_species ! number of aerosol species - - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: rhoa, delp - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: ptr_2d - - -! Initialize local variables -! -------------------------- - rc = ESMF_SUCCESS - - _ASSERT(self%id == MAM7_SCHEME .or. self%id == MAM3_SCHEME,'needs informative message') - - -! Get Imports -! -------------- - call MAPL_GetPointer(import, rhoa, 'AIRDENS', __RC__) - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - -! Get Exports -! -------------- - - -! Local dimensions -! ---------------- - i1 = lbound(rhoa, 1) - i2 = ubound(rhoa, 1) - j1 = lbound(rhoa, 2) - j2 = ubound(rhoa, 2) - k1 = lbound(rhoa, 3) - km = ubound(rhoa, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - -#ifdef DEBUG - call write_parallel(trim(Iam) // '::DEBUG::Indexes:') - call write_parallel((/i1, i2/), format='(("i1, i2 = ", (X2I3)))') - call write_parallel((/j1, j2/), format='(("j1, j2 = ", (XI3)))') - call write_parallel((/k1, km/), format='(("k1, k2 = ", (XI3)))') - - call write_parallel(trim(Iam) // '::DEBUG::Inputs:') - call write_parallel(self%id, format='(("model = ", (I5)))') -#endif - - - ! surface number concentrations in '# m-3' - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name=mode_name, n_species=n_species) - - ! surface number concentrations in '# m-3' - call MAPL_GetPointer(export, ptr_2d, 'SFC_NUM_' // trim(mode_name), __RC__) - if (associated(ptr_2d)) then - field_name = 'NUM_A_' // trim(mode_name) - i = MAPL_SimpleBundleGetIndex(qa, trim(field_name), 3, __RC__) - - ptr_2d(:,:) = qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - end do - - ! number concentrations in 'kg m-3' - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name=mode_name, n_species=n_species) - - call MAPL_GetPointer(export, ptr_2d, 'SFC_WTR_' // trim(mode_name), __RC__) - if (associated(ptr_2d)) then - field_name = 'WTR_A_' // trim(mode_name) - i = MAPL_SimpleBundleGetIndex(qa, trim(field_name), 3, __RC__) - - ptr_2d(:,:) = qa%r3(i)%q(:,:,km) * rhoa(:,:,km) - end if - end do - - - ! dry size in 'm' - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name=mode_name, n_species=n_species) - - call MAPL_GetPointer(export, ptr_2d, 'SFC_DGN_DRY_' // trim(mode_name), __RC__) - if (associated(ptr_2d)) then - field_name = 'DGN_DRY_' // trim(mode_name) - i = MAPL_SimpleBundleGetIndex(Da, trim(field_name), 3, __RC__) - - ptr_2d(:,:) = Da%r3(i)%q(:,:,km) - end if - end do - - ! wet size in 'm' - do m = 1, self%n_modes - call MAM_AerosolModeGet(self%mode(m), name=mode_name, n_species=n_species) - - call MAPL_GetPointer(export, ptr_2d, 'SFC_DGN_WET_' // trim(mode_name), __RC__) - if (associated(ptr_2d)) then - field_name = 'DGN_WET_' // trim(mode_name) - i = MAPL_SimpleBundleGetIndex(Da, trim(field_name), 3, __RC__) - - ptr_2d(:,:) = Da%r3(i)%q(:,:,km) - end if - end do - - - RETURN_(ESMF_SUCCESS) - - end subroutine SFC_Diagnostics - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: AOT_Diagnostics --- Aerosol Optical Thickness -! -! !INTERFACE: -! - subroutine AOT_Diagnostics (self, import, export, qa, Da, mie_ait, mie_acc, mie_pcm, mie_fss, mie_css, mie_fdu, mie_cdu, cdt, rc) - -! !USES: - - use Chem_ConstMod, only: grav - use MAM_ComponentsDataMod, only : MAM_WATER_COMPONENT_DENSITY, & - MAM_SULFATE_COMPONENT_DENSITY, & - MAM_AMMONIUM_COMPONENT_DENSITY, & - MAM_BLACK_CARBON_COMPONENT_DENSITY, & - MAM_DUST_COMPONENT_DENSITY, & - MAM_SEASALT_COMPONENT_DENSITY, & - MAM_SOA_COMPONENT_DENSITY, & - MAM_POM_COMPONENT_DENSITY - - implicit none - -! !INPUT/OUTPUT PARAMETERS: - type(MAPL_SimpleBundle), intent(inout) :: qa ! interstitial aerosol tracer fields - type(MAPL_SimpleBundle), intent(inout) :: Da ! dry and wet sizes of interstital aerosols - type(ESMF_State), intent(inout) :: export ! export fields - -! !INPUT PARAMETERS: - type(MAM_Scheme), intent(in) :: self ! MAM scheme/configuration - - type(ESMF_State), intent(inout) :: import ! import fields - - type(MAML_OpticsTable) :: mie_ait - type(MAML_OpticsTable) :: mie_acc - type(MAML_OpticsTable) :: mie_pcm - type(MAML_OpticsTable) :: mie_fss - type(MAML_OpticsTable) :: mie_css - type(MAML_OpticsTable) :: mie_fdu - type(MAML_OpticsTable) :: mie_cdu - - real, intent(in) :: cdt ! chemical timestep (secs) - -! !OUTPUT PARAMETERS: - integer, intent(out) :: rc ! error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This routine computes aerosol optical thickness. -! -! !REVISION HISTORY: -! -! 23 May 2014 A. Darmenov Initial implementation. -! -!EOP -!------------------------------------------------------------------------- - -! Input fields from fvGCM -! ----------------------- - real, pointer, dimension(:,:,:) :: delp - -! Exports - diagnostic fields -! --------------------------- - real, pointer, dimension(:,:) :: tot_ext, tot_sca ! aerosol optical thickness, '1' - real, pointer, dimension(:,:) :: ait_ext, ait_sca - real, pointer, dimension(:,:) :: acc_ext, acc_sca - real, pointer, dimension(:,:) :: pcm_ext, pcm_sca - real, pointer, dimension(:,:) :: fss_ext, fss_sca - real, pointer, dimension(:,:) :: css_ext, css_sca - real, pointer, dimension(:,:) :: fdu_ext, fdu_sca - real, pointer, dimension(:,:) :: cdu_ext, cdu_sca - - real, dimension(:,:,:), pointer :: rh - - real, dimension(:,:,:,:), allocatable :: qa_ - - integer :: i_mmr - integer :: i_dwet - - real(kind=8), dimension(:,:,:), allocatable :: ext, sca, asy, ssa ! total, (lon:,lat:,lev:,band:) - - real, dimension(:,:,:), allocatable :: ext_, sca_, asy_ ! mode, (lon:,lat:,lev:,band:) - real, dimension(:), allocatable :: density - integer :: nc - - integer :: i1, j1, i2, j2, k1, km - integer :: ijl, ijkl - - integer :: band - - - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam - - - - Iam = 'AOD_Diagnostics' - -! Get Imports -! -------------- - call MAPL_GetPointer(import, delp, 'DELP', __RC__) - -! Get Exports -! -------------- - call MAPL_GetPointer(export, tot_ext, 'TOTEXTTAU', __RC__) - call MAPL_GetPointer(export, tot_sca, 'TOTSCATAU', __RC__) - - call MAPL_GetPointer(export, ait_ext, 'AITEXTTAU', __RC__) - call MAPL_GetPointer(export, ait_sca, 'AITSCATAU', __RC__) - - call MAPL_GetPointer(export, acc_ext, 'ACCEXTTAU', __RC__) - call MAPL_GetPointer(export, acc_sca, 'ACCSCATAU', __RC__) - - call MAPL_GetPointer(export, pcm_ext, 'PCMEXTTAU', __RC__) - call MAPL_GetPointer(export, pcm_sca, 'PCMSCATAU', __RC__) - - call MAPL_GetPointer(export, fss_ext, 'FSSEXTTAU', __RC__) - call MAPL_GetPointer(export, fss_sca, 'FSSSCATAU', __RC__) - - call MAPL_GetPointer(export, css_ext, 'CSSEXTTAU', __RC__) - call MAPL_GetPointer(export, css_sca, 'CSSSCATAU', __RC__) - - call MAPL_GetPointer(export, fdu_ext, 'FDUEXTTAU', __RC__) - call MAPL_GetPointer(export, fdu_sca, 'FDUSCATAU', __RC__) - - call MAPL_GetPointer(export, cdu_ext, 'CDUEXTTAU', __RC__) - call MAPL_GetPointer(export, cdu_sca, 'CDUSCATAU', __RC__) - -! Local dimensions -! ---------------- - i1 = lbound(delp, 1) - i2 = ubound(delp, 1) - j1 = lbound(delp, 2) - j2 = ubound(delp, 2) - k1 = lbound(delp, 3) - km = ubound(delp, 3) - - ijl = (i2 - i1 + 1) * (j2 - j1 + 1) - ijkl = ijl * km - - - ! Radiation band - ! -------------- - band = 7 ! 550nm - - ! Pressure at layer edges - ! ------------------------ - - - - allocate(ext(i1:i2,j1:j2,km), & - sca(i1:i2,j1:j2,km), & - ssa(i1:i2,j1:j2,km), & - asy(i1:i2,j1:j2,km), __STAT__) - - allocate(ext_(i1:i2,j1:j2,km), & - sca_(i1:i2,j1:j2,km), & - asy_(i1:i2,j1:j2,km), __STAT__) - - - ext = 0.0 - sca = 0.0 - ssa = 0.0 - asy = 0.0 - - - ! compute ext, sca and ssa from aerosols in aitken mode; su, amm, soa, ss - nc = 4 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_AIT', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_AIT', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_AIT', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SOA_A_AIT', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_SOA_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SS_A_AIT', 3, __RC__) - qa_(5,:,:,:) = qa%r3(i_mmr)%q - density(5) = MAM_SEASALT_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_AIT', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_ait, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(ait_ext)) ait_ext = sum(ext_, dim=3) - if (associated(ait_sca)) ait_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in accumulation mode: su, amm, soa, pom, bc, ss - nc = 6 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_ACC', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_ACC', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_ACC', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SOA_A_ACC', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_SOA_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'POM_A_ACC', 3, __RC__) - qa_(5,:,:,:) = qa%r3(i_mmr)%q - density(5) = MAM_POM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'BC_A_ACC', 3, __RC__) - qa_(6,:,:,:) = qa%r3(i_mmr)%q - density(6) = MAM_BLACK_CARBON_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SS_A_ACC', 3, __RC__) - qa_(7,:,:,:) = qa%r3(i_mmr)%q - density(7) = MAM_SEASALT_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_ACC', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_acc, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(acc_ext)) acc_ext = sum(ext_, dim=3) - if (associated(acc_sca)) acc_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in primary carbon mode: pom, bc - nc = 2 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_PCM', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'POM_A_PCM', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_POM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'BC_A_PCM', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_BLACK_CARBON_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_PCM', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_pcm, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(pcm_ext)) pcm_ext = sum(ext_, dim=3) - if (associated(pcm_sca)) pcm_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in fine seasalt mode: su, amm, ss - nc = 3 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_FSS', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_FSS', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_FSS', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SS_A_FSS', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_SEASALT_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_FSS', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_fss, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(fss_ext)) fss_ext = sum(ext_, dim=3) - if (associated(fss_sca)) fss_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in coarse seasalt mode: su, amm, ss; lut = ('water', 'su', 'amm', 'ss') - nc = 3 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_CSS', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_CSS', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_CSS', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SS_A_CSS', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_SEASALT_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_CSS', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_css, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(css_ext)) css_ext = sum(ext_, dim=3) - if (associated(css_sca)) css_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in fine dust mode: su, amm, du; lut = ('water', 'su', 'amm', 'du') - nc = 3 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_FDU', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_FDU', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_FDU', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'DU_A_FDU', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_DUST_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_FDU', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_fdu, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(fdu_ext)) fdu_ext = sum(ext_, dim=3) - if (associated(fdu_sca)) fdu_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in coarse dust mode: su, amm, du; lut = ('water', 'su', 'amm', 'du') - nc = 3 + 1 - allocate(qa_(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa_ = 0.0 - density = 0.0 - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'WTR_A_CDU', 3, __RC__) - qa_(1,:,:,:) = qa%r3(i_mmr)%q - density(1) = MAM_WATER_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'SU_A_CDU', 3, __RC__) - qa_(2,:,:,:) = qa%r3(i_mmr)%q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'AMM_A_CDU', 3, __RC__) - qa_(3,:,:,:) = qa%r3(i_mmr)%q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - i_mmr = MAPL_SimpleBundleGetIndex(qa, 'DU_A_CDU', 3, __RC__) - qa_(4,:,:,:) = qa%r3(i_mmr)%q - density(4) = MAM_DUST_COMPONENT_DENSITY - - i_dwet = MAPL_SimpleBundleGetIndex(Da, 'DGN_WET_CDU', 3, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(mie_cdu, band, qa_, density, Da%r3(i_dwet)%q, delp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - if (associated(cdu_ext)) cdu_ext = sum(ext_, dim=3) - if (associated(cdu_sca)) cdu_sca = sum(sca_, dim=3) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - - deallocate(qa_, density, __STAT__) - - - ! total AOT - if (associated(tot_ext)) tot_ext = sum(ext, dim=3) - if (associated(tot_sca)) tot_sca = sum(sca, dim=3) - - - deallocate(ext, sca, ssa, asy, __STAT__) - deallocate(ext_, sca_, asy_, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine AOT_Diagnostics - - -!! -- - - -logical function isDataDrivenGC_(GC, rc) - type(ESMF_GridComp), intent(inout) :: GC - integer, intent(out) :: rc - -! local - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - - integer :: i - character(len=ESMF_MAXSTR) :: comp_name - character(len=*), parameter :: modifier = '.data' - - rc = ESMF_SUCCESS - - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - i = index(trim(comp_name), trim(modifier), back=.true.) - - if (i > 0) then - ! lets be strict - if (comp_name(i:) == modifier) then - isDataDrivenGC_ = .true. - else - isDataDrivenGC_ = .false. - end if - else - isDataDrivenGC_ = .false. - end if - - RETURN_(ESMF_SUCCESS) - -end function isDataDrivenGC_ - - - - subroutine aerosol_optics(state, rc) - - use MAM_ComponentsDataMod, only : MAM_WATER_COMPONENT_DENSITY, & - MAM_SULFATE_COMPONENT_DENSITY, & - MAM_AMMONIUM_COMPONENT_DENSITY, & - MAM_BLACK_CARBON_COMPONENT_DENSITY, & - MAM_DUST_COMPONENT_DENSITY, & - MAM_SEASALT_COMPONENT_DENSITY, & - MAM_SOA_COMPONENT_DENSITY, & - MAM_POM_COMPONENT_DENSITY - - implicit none - - - - - -! Arguments -! --------- - type(ESMF_State):: state - integer, intent(out):: rc - - -! Local -! --------- - type(ESMF_FieldBundle) :: aerosols - - real, dimension(:,:,:), pointer :: ple - real, dimension(:,:,:), pointer :: rh - real, dimension(:,:,:), pointer :: var - real, dimension(:,:,:), pointer :: q - real, dimension(:,:,:), pointer :: dgn_wet - - real, dimension(:,:,:,:), allocatable :: qa - - - real, dimension(:,:,:), allocatable :: dp - - character(len=ESMF_MAXSTR) :: field_name - - real(kind=8), dimension(:,:,:), allocatable :: ext, sca, asy, ssa ! total, (lon:,lat:,lev:,band:) - - real, dimension(:,:,:), allocatable :: ext_, sca_, asy_ ! mode, (lon:,lat:,lev:,band:) - real, dimension(:), allocatable :: density - integer :: nc - - integer :: i1, j1, i2, j2, km - - integer :: band - - - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam - - - - Iam = 'MAM::aerosol_optics()' - - -! Radiation band -! -------------- - call ESMF_AttributeGet(state, name='band_for_aerosol_optics', value=band, __RC__) - -! Pressure at layer edges -! ------------------------ - call ESMF_AttributeGet(state, name='air_pressure_for_aerosol_optics', value=field_name, __RC__) - call MAPL_GetPointer(state, ple, trim(field_name), __RC__) - - i1 = lbound(ple, 1); i2 = ubound(ple, 1) - j1 = lbound(ple, 2); j2 = ubound(ple, 2) - km = ubound(ple, 3) - -! Relative humidity -! ----------------- - call ESMF_AttributeGet(state, name='relative_humidity_for_aerosol_optics', value=field_name, __RC__) - call MAPL_GetPointer(state, rh, trim(field_name), __RC__) - - i1 = lbound(rh, 1); i2 = ubound(rh, 1) - j1 = lbound(rh, 2); j2 = ubound(rh, 2) - km = ubound(rh, 3) - - call ESMF_StateGet(state, 'AEROSOLS', aerosols, __RC__) - - - allocate(dp(i1:i2,j1:j2,km), __STAT__) - dp = (ple(:,:,1:km) - ple(:,:,0:km-1)) - - - allocate(ext(i1:i2,j1:j2,km), & - sca(i1:i2,j1:j2,km), & - ssa(i1:i2,j1:j2,km), & - asy(i1:i2,j1:j2,km), __STAT__) - - allocate(ext_(i1:i2,j1:j2,km), & - sca_(i1:i2,j1:j2,km), & - asy_(i1:i2,j1:j2,km), __STAT__) - - - ext = 0.0 - sca = 0.0 - ssa = 0.0 - asy = 0.0 - - - ! compute ext, sca and ssa from aerosols in aitken mode; su, amm, soa, ss - nc = 4 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa = 0.0 - density = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_AIT', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_AIT', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_AIT', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SOA_A_AIT', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_SOA_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_AIT', q, __RC__) - qa(5,:,:,:) = q - density(5) = MAM_SEASALT_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_AIT', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(1), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in accumulation mode: su, amm, soa, pom, bc, ss - nc = 6 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - qa = 0.0 - density = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_ACC', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_ACC', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_ACC', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SOA_A_ACC', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_SOA_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'POM_A_ACC', q, __RC__) - qa(5,:,:,:) = q - density(5) = MAM_POM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'BC_A_ACC', q, __RC__) - qa(6,:,:,:) = q - density(6) = MAM_BLACK_CARBON_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_ACC', q, __RC__) - qa(7,:,:,:) = q - density(7) = MAM_SEASALT_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_ACC', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(2), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in primary carbon mode: pom, bc - nc = 2 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_PCM', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'POM_A_PCM', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_POM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'BC_A_PCM', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_BLACK_CARBON_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_PCM', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(3), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in fine seasalt mode: su, amm, ss - nc = 3 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_FSS', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_FSS', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_FSS', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_FSS', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_SEASALT_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_FSS', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(4), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in coarse seasalt mode: su, amm, ss; lut = ('water', 'su', 'amm', 'ss') - nc = 3 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_CSS', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_CSS', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_CSS', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_CSS', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_SEASALT_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_CSS', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(5), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in fine dust mode: su, amm, du; lut = ('water', 'su', 'amm', 'du') - nc = 3 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_FDU', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_FDU', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_FDU', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DU_A_FDU', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_DUST_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_FDU', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(6), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! compute ext, sca and ssa from aerosols in coarse dust mode: su, amm, du; lut = ('water', 'su', 'amm', 'du') - nc = 3 + 1 - allocate(qa(nc,i1:i2,j1:j2,km), density(nc), __STAT__) - - call ESMFL_BundleGetPointerToData(aerosols, 'WTR_A_CDU', q, __RC__) - qa(1,:,:,:) = q - density(1) = MAM_WATER_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_CDU', q, __RC__) - qa(2,:,:,:) = q - density(2) = MAM_SULFATE_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_CDU', q, __RC__) - qa(3,:,:,:) = q - density(3) = MAM_AMMONIUM_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DU_A_CDU', q, __RC__) - qa(4,:,:,:) = q - density(4) = MAM_DUST_COMPONENT_DENSITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DGN_WET_CDU', dgn_wet, __RC__) - - ext_ = 0.0 - sca_ = 0.0 - asy_ = 0.0 - - call MAML_OpticsInterpolate(MAM7_MieTable(7), band, qa, density, dgn_wet, dp, ext_, sca_, asy_, nc, i1, i2, j1, j2, 1, km, rc) - - ext = ext + ext_ - sca = sca + sca_ - asy = asy + sca_*asy_ - deallocate(qa, density, __STAT__) - - - ! inputs for radiation: ext, sca and sca*asy - ! in the callback : 'asy' = product of asy and sca - ! 'ssa' = sca - ssa = sca - - - call ESMF_AttributeGet(state, name='extinction_in_air_due_to_ambient_aerosol', value=field_name, __RC__) - if (field_name /= '') then - call MAPL_GetPointer(state, var, trim(field_name), __RC__) - var = ext(:,:,:) - end if - - call ESMF_AttributeGet(state, name='single_scattering_albedo_of_ambient_aerosol', value=field_name, __RC__) - if (field_name /= '') then - call MAPL_GetPointer(state, var, trim(field_name), __RC__) - var = ssa(:,:,:) - end if - - call ESMF_AttributeGet(state, name='asymmetry_parameter_of_ambient_aerosol', value=field_name, __RC__) - if (field_name /= '') then - call MAPL_GetPointer(state, var, trim(field_name), __RC__) - var = asy(:,:,:) - end if - - - deallocate(dp, __STAT__) - deallocate(ext, sca, ssa, asy, __STAT__) - deallocate(ext_, sca_, asy_, __STAT__) - - RETURN_(ESMF_SUCCESS) - - end subroutine aerosol_optics - - -subroutine aerosol_activation_properties(state, rc) - - implicit none - -! Arguments -! --------- - type(ESMF_State) :: state - integer, intent(out) :: rc - - -! Local -! --------- - character(len=ESMF_MAXSTR) :: mode ! mode - type(ESMF_FieldBundle) :: aerosols ! field bundle containing the aerosol mass mixing ratios - - real, dimension(:,:,:), pointer :: q ! aerosol number or mass mixing ratio - - real, dimension(:,:,:), pointer :: num ! number concentration of aerosol particles - real, dimension(:,:,:), pointer :: diameter ! dry size of aerosol - real, dimension(:,:,:), pointer :: sigma ! width of aerosol mode - real, dimension(:,:,:), pointer :: density ! density of aerosol - real, dimension(:,:,:), pointer :: hygroscopicity ! hygroscopicity of aerosol - real, dimension(:,:,:), pointer :: f_dust ! fraction of dust aerosol - real, dimension(:,:,:), pointer :: f_soot ! fraction of soot aerosol - real, dimension(:,:,:), pointer :: f_organic ! fraction of organic aerosol - - real, allocatable, dimension(:,:,:,:) :: qa ! temporary buffers - real, allocatable, dimension(:) :: qa_density - real, allocatable, dimension(:) :: qa_hygroscopicity - real, allocatable, dimension(:) :: qa_f_dust - real, allocatable, dimension(:) :: qa_f_soot - real, allocatable, dimension(:) :: qa_f_organic - - - character(len=ESMF_MAXSTR) :: fld_name - - integer :: i1, j1, i2, j2, km - integer :: i, j, k - - real :: sigma_ - integer :: ns - - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam - - - Iam = 'MAM::aerosol_activation_properties()' - - -! Aerosol mode -! ------------ - call ESMF_AttributeGet(state, name='aerosol_mode', value=mode, __RC__) - - -! Aerosol mass mixing ratio and activation properties -! ------------------------- - call ESMF_StateGet(state, 'AEROSOLS', aerosols, __RC__) - -! Activation activation properties - call ESMF_AttributeGet(state, name='aerosol_number_concentration', value=fld_name, __RC__) - call MAPL_GetPointer(state, num, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='aerosol_dry_size', value=fld_name, __RC__) - call MAPL_GetPointer(state, diameter, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='width_of_aerosol_mode', value=fld_name, __RC__) - call MAPL_GetPointer(state, sigma, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='aerosol_density', value=fld_name, __RC__) - call MAPL_GetPointer(state, density, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='aerosol_hygroscopicity', value=fld_name, __RC__) - call MAPL_GetPointer(state, hygroscopicity, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='fraction_of_dust_aerosol', value=fld_name, __RC__) - call MAPL_GetPointer(state, f_dust, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='fraction_of_soot_aerosol', value=fld_name, __RC__) - call MAPL_GetPointer(state, f_soot, trim(fld_name), __RC__) - - call ESMF_AttributeGet(state, name='fraction_of_organic_aerosol', value=fld_name, __RC__) - call MAPL_GetPointer(state, f_organic, trim(fld_name), __RC__) - - - - -! Obtain aerosol activation properties of this aerosol mode -! --------------------------------------------------------- - i1 = lbound(num, 1); i2 = ubound(num, 1) - j1 = lbound(num, 2); j2 = ubound(num, 2) - km = ubound(num, 3) - - call ESMF_StateGet(state, 'AEROSOLS', aerosols, __RC__) - - call ESMFL_BundleGetPointerToData(aerosols, 'NUM_A_'//trim(mode), q, __RC__) - num = q - - select case(mode) - case (MAM7_AITKEN_MODE_NAME) - sigma_ = MAM7_AITKEN_MODE_SIGMA - - ns = 4 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_AIT', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_AIT', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SOA_A_AIT', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_SOA_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_SOA_COMPONENT_HYGROSCOPICITY - qa_f_organic(3) = 1.0 - - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_AIT', q, __RC__) - qa(4,:,:,:) = q(:,:,:) - qa_density(4) = MAM_SEASALT_COMPONENT_DENSITY - qa_hygroscopicity(4) = MAM_SEASALT_COMPONENT_HYGROSCOPICITY - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - case (MAM7_ACCUMULATION_MODE_NAME) - sigma_ = MAM7_ACCUMULATION_MODE_SIGMA - - ns = 6 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_ACC', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_ACC', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SOA_A_AIT', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_SOA_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_SOA_COMPONENT_HYGROSCOPICITY - qa_f_organic(3) = 1.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'POM_A_ACC', q, __RC__) - qa(4,:,:,:) = q(:,:,:) - qa_density(4) = MAM_POM_COMPONENT_DENSITY - qa_hygroscopicity(4) = MAM_POM_COMPONENT_HYGROSCOPICITY - qa_f_organic(4) = 1.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'BC_A_ACC', q, __RC__) - qa(5,:,:,:) = q(:,:,:) - qa_density(5) = MAM_BLACK_CARBON_COMPONENT_DENSITY - qa_hygroscopicity(5) = MAM_BLACK_CARBON_COMPONENT_HYGROSCOPICITY - qa_f_soot(5) = 1.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_AIT', q, __RC__) - qa(6,:,:,:) = q(:,:,:) - qa_density(6) = MAM_SEASALT_COMPONENT_DENSITY - qa_hygroscopicity(6) = MAM_SEASALT_COMPONENT_HYGROSCOPICITY - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - - case (MAM7_PRIMARY_CARBON_MODE_NAME) - sigma_ = MAM7_PRIMARY_CARBON_MODE_SIGMA - - ns = 2 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'POM_A_PCM', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_POM_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_POM_COMPONENT_HYGROSCOPICITY - qa_f_organic(1) = 1.0 - - - call ESMFL_BundleGetPointerToData(aerosols, 'BC_A_PCM', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_BLACK_CARBON_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_BLACK_CARBON_COMPONENT_HYGROSCOPICITY - qa_f_soot(2) = 1.0 - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - - case (MAM7_FINE_SEASALT_MODE_NAME) - sigma_ = MAM7_FINE_SEASALT_MODE_SIGMA - - ns = 3 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_FSS', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_FSS', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_FSS', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_SEASALT_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_SEASALT_COMPONENT_HYGROSCOPICITY - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - - case (MAM7_FINE_DUST_MODE_NAME) - sigma_ = MAM7_FINE_DUST_MODE_SIGMA - - ns = 3 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_FDU', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_FDU', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DU_A_FDU', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_DUST_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_DUST_COMPONENT_HYGROSCOPICITY - qa_f_dust(3) = 1.0 - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - - case (MAM7_COARSE_SEASALT_MODE_NAME) - sigma_ = MAM7_COARSE_SEASALT_MODE_SIGMA - - ns = 3 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_CSS', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_CSS', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'SS_A_CSS', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_SEASALT_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_SEASALT_COMPONENT_HYGROSCOPICITY - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - - case (MAM7_COARSE_DUST_MODE_NAME) - sigma_ = MAM7_COARSE_DUST_MODE_SIGMA - - ns = 3 - - allocate(qa(ns,i1:i2,j1:j2,km), __STAT__) - allocate(qa_density(ns), qa_hygroscopicity(ns), __STAT__) - allocate(qa_f_dust(ns), qa_f_soot(ns), qa_f_organic(ns), __STAT__) - - qa = 0.0 - qa_density = 0.0 - qa_hygroscopicity = 0.0 - qa_f_dust = 0.0 - qa_f_soot = 0.0 - qa_f_organic = 0.0 - - call ESMFL_BundleGetPointerToData(aerosols, 'SU_A_CDU', q, __RC__) - qa(1,:,:,:) = q(:,:,:) - qa_density(1) = MAM_SULFATE_COMPONENT_DENSITY - qa_hygroscopicity(1) = MAM_SULFATE_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'AMM_A_CDU', q, __RC__) - qa(2,:,:,:) = q(:,:,:) - qa_density(2) = MAM_AMMONIUM_COMPONENT_DENSITY - qa_hygroscopicity(2) = MAM_AMMONIUM_COMPONENT_HYGROSCOPICITY - - call ESMFL_BundleGetPointerToData(aerosols, 'DU_A_CDU', q, __RC__) - qa(3,:,:,:) = q(:,:,:) - qa_density(3) = MAM_DUST_COMPONENT_DENSITY - qa_hygroscopicity(3) = MAM_DUST_COMPONENT_HYGROSCOPICITY - qa_f_dust(3) = 1.0 - - call aap_(diameter, density, hygroscopicity, f_dust, f_soot, f_organic, & - num, sigma_, & - qa, qa_density, qa_hygroscopicity, qa_f_dust, qa_f_soot, qa_f_organic, ns, & - i1, i2, j1, j2, km, rc) - - sigma = log(sigma_) - - deallocate(qa, __STAT__) - deallocate(qa_density, qa_hygroscopicity, __STAT__) - deallocate(qa_f_dust, qa_f_soot, qa_f_organic, __STAT__) - - case default - __raise__(MAM_UNKNOWN_AEROSOL_MODE_ERROR,"Unknown aerosol mode used in the MAM aerosol activation properties method: "//trim(mode)) - - end select - - - RETURN_(ESMF_SUCCESS) - -contains - - subroutine aap_(diameter, density, hygroscopicity, & - f_dust, f_soot, f_organic, & - q_num, sigma, & - q, q_density, q_hygroscopicity, & - q_f_dust, q_f_soot, q_f_organic, & - ns, & - i1, i2, j1, j2, km, & - rc) - - implicit none - - integer, intent(in) :: i1, i2 ! dimension bounds - integer, intent(in) :: j1, j2 ! ... // .. - integer, intent(in) :: km ! ... // .. - - integer, intent(in) :: ns ! number of species - - real, intent(in ), dimension(i1:i2,j1:j2,km) :: q_num ! number mixing ratio, #-particles kg-1 - real, intent(in ) :: sigma ! width of the mode - - real, intent(in ), dimension(ns,i1:i2,j1:j2,km):: q ! aerosol mass mixing ratio, kg kg-1 - real, intent(in ), dimension(ns) :: q_density ! density of species - real, intent(in ), dimension(ns) :: q_hygroscopicity - real, intent(in ), dimension(ns) :: q_f_dust ! - real, intent(in ), dimension(ns) :: q_f_soot ! - real, intent(in ), dimension(ns) :: q_f_organic ! - - real, intent(out), dimension(i1:i2,j1:j2,km) :: diameter ! dry size of aerosol - real, intent(out), dimension(i1:i2,j1:j2,km) :: density ! density of aerosol - real, intent(out), dimension(i1:i2,j1:j2,km) :: hygroscopicity ! hygroscopicity of aerosol - real, intent(out), dimension(i1:i2,j1:j2,km) :: f_dust ! fraction of dust aerosol - real, intent(out), dimension(i1:i2,j1:j2,km) :: f_soot ! fraction of soot aerosol - real, intent(out), dimension(i1:i2,j1:j2,km) :: f_organic ! fraction of organic aerosol - - integer, intent(out) :: rc ! return code - - ! local - real, dimension(ns) :: q_ - real, dimension(ns) :: v_ - - real :: mass, vol - real :: f - - integer :: i, j, k - - integer :: STATUS - character(len=ESMF_MAXSTR) :: Iam = 'MAM::aerosol_activation_properties::aap_()' - - ! vol = number * (MAPL_PI/6) * Dgn**3 * exp(4.5 * log(sigma)**2) - f = 1.0 / ((MAPL_PI/6) * exp(4.5 * log(sigma)*log(sigma))) - - do k = 1, km - do j = j1, j2 - do i = i1, i2 - - q_ = q(:,i,j,k) - v_ = q_ / q_density - - mass = sum(q_) - vol = sum(v_) - - if ((vol > 0) .and. (num(i,j,k) > 0)) then - f_dust(i,j,k) = sum(v_ * q_f_dust) / vol - f_soot(i,j,k) = sum(v_ * q_f_soot) / vol - f_organic(i,j,k) = sum(v_ * q_f_organic) / vol - - hygroscopicity(i,j,k) = sum(v_ * q_hygroscopicity) / vol - - density(i,j,k) = mass / vol - - ! num = (q * air_density) / ((MAPL_PI/6) * density * Dgn**3 * exp(4.5 * log(sigma)*log(sigma))) - diameter(i,j,k) = ((vol / num(i,j,k)) * f)**(1.0/3.0) - else -!!! print *, 'DEBUG::MAM::aap_() ', num(i,j,k), vol - - f_dust(i,j,k) = 0.0 - f_soot(i,j,k) = 0.0 - f_organic(i,j,k) = 0.0 - - density(i,j,k) = q_density(1) - hygroscopicity(i,j,k) = q_hygroscopicity(1) - diameter(i,j,k) = 0.0 - end if - - end do - end do - end do - - RETURN_(ESMF_SUCCESS) - - end subroutine aap_ - - end subroutine aerosol_activation_properties - - - - function constituent_index_(constituent_name, rc) result (i) - - use constituents, only: pcnst, cnst_name - - character(len=*), intent(in) :: constituent_name - integer, optional, intent(out) :: rc - - ! local - integer :: n, i - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - - Iam = 'MAM::constituent_index_()' - - i = 0 - - do n = 1, pcnst - if (constituent_name == cnst_name(n)) then - i = n - exit - end if - end do - - if (i == 0) then - __raise__ (MAM_UNKNOWN_AEROSOL_CONSTITUENT_ERROR, "MAM::Unknown constituent: " // trim(constituent_name)) - end if - - RETURN_(ESMF_SUCCESS) - end function constituent_index_ - - - end module MAMchem_GridCompMod diff --git a/MAMchem_GridComp/MAMchem_Registry.rc b/MAMchem_GridComp/MAMchem_Registry.rc deleted file mode 100644 index affa93d8..00000000 --- a/MAMchem_GridComp/MAMchem_Registry.rc +++ /dev/null @@ -1,259 +0,0 @@ -# -# This the GEOS-Chem Grid Component Registry. It defines Import, -# Internal and Export states for this component as well as -# any -# -# !REVISION HISTORY: -# 16Aug2006 da Silva First Version -# 12Aug2009 Enari & Figueroa First Version (CPTEC Physics) -# 7Dec2009 R. Yantosca - updated import state specifications -# -# ----------------------------------------------------------------- - -COMP_NAME: MAMchem - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - -# ------------ -# Import State -# ------------ - - -# --------------------------------------------------------------------------------------------------- -# | | | V |Item|Intervl| Sub | Def | -# Short Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Long Name -# --------------------|---------------|-----|---|----|---|---|-----|------|-------------------------- - SH | W/m2 | xy | | | | | | | Sensible heat flux - Z0H | m | xy | | | | | | | Surface roughness for heat - LAI | 1 | xy | | | | | | | Leaf area index - LWI | 1 | xy | | | | | | | Land-water-ice flags - ZPBL | m | xy | | | | | | | PBL depth - FRLAND | 1 | xy | | | | | | | Land fraction - FRLAKE | 1 | xy | | | | | | | Lake fraction - FROCEAN | 1 | xy | | | | | | | Ocean fraction - FRACI | 1 | xy | | | | | | | Ice fraction - TS | K | xy | | | | | | | Surface skin temperature - CN_PRCP | kg m-2 s-1 | xy | | | | | | | Conv precip at the ground - NCN_PRCP | kg m-2 s-1 | xy | | | | | | | Non-convective precipitation - TROPP | Pa | xy | | | | | | | Tropopause pressure - USTAR | m s-1 | xy | | | | | | | Surface (friction) velocity scale - U10M | m s-1 | xy | | | | | | | E/W 10-meter wind speed - V10M | m s-1 | xy | | | | | | | N/S 10-meter wind speed - U10N | m s-1 | xy | | | | | | | Equivalent neutral 10-meter eastward wind speed - V10N | m s-1 | xy | | | | | | | Equivalent neutral 10-meter northward wind speed - WET1 | 1 | xy | | | | | | | Surface Soil Wetness - FCLD | 1 | xyz | C | | | | | | Cloud fraction - RH2 | 1 | xyz | C | | | | | | Relative humidity - Q | kg kg-1 | xyz | C | | | | | | Specific Humidity - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - PFL_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D_flux_of_liquid_nonconvective_precipitation - PFI_LSAN | kg m-2 s-1 | xyz | E | | | | | | 3D flux of ice nonconvective precipitation - CNV_MFC | kg m-2 s-1 | xyz | E | | | | | | Cumulative mass flux - CNV_MFD | kg m-2 s-1 | xyz | C | | | | | | Detraining mass flux - DELP | Pa | xyz | C | | | | | | Pressure thickness - PLE | Pa | xyz | E | | | | | | Edge pressure - ZLE | m | xyz | E | | | | | | Edge heights -# PL | Pa | xyz | C | | | | | | Mid-level pressure -# ZL | m | xyz | C | | | | | | Mid-layer heights - U | m s-1 | xyz | C | | | | | | Eastward (E/W) wind - V | m s-1 | xyz | C | | | | | | Northward (N/S) wind -# ------------------------------------------------------------------------------------------------ - SO2 | mol mol-1 | xyz | C | | | | | | Sulfur dioxide (SO2 gas) - H2SO4 | mol mol-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) - NH3 | mol mol-1 | xyz | C | | | | | | Ammonia (NH3 gas) - SOA_GAS | mol mol-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) -# - pSO4_aq | mol mol-1 s-1 | xyz | C | | | | | | Production rate of sulfate (SO4) in aqueous phase - pNH4_aq | mol mol-1 s-1 | xyz | C | | | | | | Production rate of ammonium (NH4) in aqueous phase -# - DDT_DMS_gas | mol mol-1 s-1 | xyz | C | | | | | | Dimethyl sulfide (DMS gas) tendency due to gas phase chemistry - DDT_MSA_gas | mol mol-1 s-1 | xyz | C | | | | | | Methanesulfonic acid (MSA gas) tendency due to gas phase chemistry - DDT_SO2_gas | mol mol-1 s-1 | xyz | C | | | | | | Sulfur dioxide (SO2 gas) tendency due to gas phase chemistry - DDT_H2SO4_gas | mol mol-1 s-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) tendency due to gas phase chemistry - DDT_NH3_gas | mol mol-1 s-1 | xyz | C | | | | | | Ammonia (NH3 gas) tendency due to gas phase chemistry - DDT_SOA_GAS_gas | mol mol-1 s-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) tendency due to gas phase chemistry - _DMS_gas | mol mol-1 s-1 | xyz | C | | | | | | Dimethyl sulfide (DMS) before gas phase chemistry - _MSA_gas | mol mol-1 s-1 | xyz | C | | | | | | Methanesulfonic acid (MSA) befoe gas phase chemistry - _SO2_gas | mol mol-1 s-1 | xyz | C | | | | | | Sulfur dioxide (SO2) before gas phase chemistry - _H2SO4_gas | mol mol-1 s-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) before gas phase chemistry - _NH3_gas | mol mol-1 s-1 | xyz | C | | | | | | Ammonia (NH3) before gas phase chemistry - _SOA_GAS_gas | mol mol-1 s-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) before gas phase chemistry -# - DDT_DMS_aq | mol mol-1 s-1 | xyz | C | | | | | | Dimethyl sulfide (DMS gas) tendency due to aqueous phase chemistry - DDT_MSA_aq | mol mol-1 s-1 | xyz | C | | | | | | Methanesulfonic acid (MSA gas) tendency due to aqueous phase chemistry - DDT_SO2_aq | mol mol-1 s-1 | xyz | C | | | | | | Sulfur dioxide (SO2 gas) tendency due to aqueous phase chemistry - DDT_H2SO4_aq | mol mol-1 s-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) tendency due to aqueous phase chemistry - DDT_NH3_aq | mol mol-1 s-1 | xyz | C | | | | | | Ammonia (NH3 gas) tendency due to aqueous phase chemistry - DDT_SOA_GAS_aq | mol mol-1 s-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) tendency due to aqueous phase chemistry - _DMS_aq | mol mol-1 s-1 | xyz | C | | | | | | Dimethyl sulfide (DMS gas) before aqueous phase chemistry - _MSA_aq | mol mol-1 s-1 | xyz | C | | | | | | Methanesulfonic acid (MSA gas) before aqueous phase chemistry - _SO2_aq | mol mol-1 s-1 | xyz | C | | | | | | Sulfur dioxide (SO2 gas) before aqueous phase chemistry - _H2SO4_aq | mol mol-1 s-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) before aqueous phase chemistry - _NH3_aq | mol mol-1 s-1 | xyz | C | | | | | | Ammonia (NH3 gas) tendency before aqueous phase chemistry - _SOA_GAS_aq | mol mol-1 s-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) before aqueous phase chemistry -# ------------------------------------------------------------------------------------------------ - BC_EMIS_FIRE | kg m-2 s-1 | xy | | | | | | | BC emissions - biomass burning - BC_EMIS_BIOFUEL | kg m-2 s-1 | xy | | | | | | | BC emissions - biofuel - BC_EMIS_FOSSILFUEL | kg m-2 s-1 | xy | | | | | | | BC emissions - fossil fuels - BC_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | BC emissions - ships -# ------------------------------------------------------------------------------------------------ - OC_EMIS_FIRE | kg m-2 s-1 | xy | | | | | | | OC emissions - biomass burning - OC_EMIS_BIOFUEL | kg m-2 s-1 | xy | | | | | | | OC emissions - biofuel - OC_EMIS_FOSSILFUEL | kg m-2 s-1 | xy | | | | | | | OC emissions - fossil fuels - OC_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | OC emissions - ships -# ------------------------------------------------------------------------------------------------ - SO4_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | SO4 emissions - ships -# ------------------------------------------------------------------------------------------------ - GINOUX_DU | 1 | xy | | | | | | | Ginoux dust source -# ------------------------------------------------------------------------------------------------ - - -# ------------ -# Export State -# ------------ - - -# -# ------------------------------------------------------------------------------------------------ -# DIAGNOSTIC QUANTITIES -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| Name -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- -# -# --- Seasalt --- -# - SSMASS | kg kg-1 | xyz | C | | | | | Sea Salt Mass Mixing Ratio - SSMASS25 | kg kg-1 | xyz | C | | | | | Sea Salt Mass Mixing Ratio - PM 2.5 - SSCONC | kg m-3 | xyz | C | | | | | Sea Salt Mass Concentration - SSSMASS | kg m-3 | xy | | | | | | Sea Salt Surface Mass Concentration - SSCMASS | kg m-2 | xy | | | | | | Sea Salt Column Mass Density - SSSMASS25 | kg m-3 | xy | | | | | | Sea Salt Surface Mass Concentration - PM 2.5 - SSCMASS25 | kg m-2 | xy | | | | | | Sea Salt Column Mass Density - PM 2.5 - SSEMAIT | kg m-2 s-1 | xy | | | | | | Sea Salt Emission Aitken mode - SSEMACC | kg m-2 s-1 | xy | | | | | | Sea Salt Emission Accumulation mode - SSEMFSS | kg m-2 s-1 | xy | | | | | | Sea Salt Emission Fine Seasalt mode - SSEMCSS | kg m-2 s-1 | xy | | | | | | Sea Salt Emission Coarse Seasalt mode - DP_SS_AIT | kg m-2 s-1 | xy | | | | | | Sea Salt Dry Deposition Aitken mode - DP_SS_ACC | kg m-2 s-1 | xy | | | | | | Sea Salt Dry Deposition Accumulation mode - DP_SS_FSS | kg m-2 s-1 | xy | | | | | | Sea Salt Dry Deposition Fine Seasalt mode - DP_SS_CSS | kg m-2 s-1 | xy | | | | | | Sea Salt Dry Deposition Coarse Seasalt mode - SSFLUXU | kg m-1 s-1 | xy | | | | | | Sea Salt column u-wind mass flux - SSFLUXV | kg m-1 s-1 | xy | | | | | | Sea Salt column v-wind mass flux - DUMASS | kg kg-1 | xyz | C | | | | | Dust Mass Mixing Ratio - DUMASS25 | kg kg-1 | xyz | C | | | | | Dust Mass Mixing Ratio - PM 2.5 - DUCONC | kg m-3 | xyz | C | | | | | Dust Mass Concentration - DUSMASS | kg m-3 | xy | | | | | | Dust Surface Mass Concentration - DUCMASS | kg m-2 | xy | | | | | | Dust Column Mass Density - DUSMASS25 | kg m-3 | xy | | | | | | Dust Surface Mass Concentration - PM 2.5 - DUCMASS25 | kg m-2 | xy | | | | | | Dust Column Mass Density - PM 2.5 - DUEMFDU | kg m-2 s-1 | xy | | | | | | Dust Emission Fine Dust mode - DUEMCDU | kg m-2 s-1 | xy | | | | | | Dust Emission Coarse Dust mode - DP_DU_FDU | kg m-2 s-1 | xy | | | | | | Dust Dry Deposition Fine Seasalt mode - DP_DU_CDU | kg m-2 s-1 | xy | | | | | | Dust Dry Deposition Coarse Seasalt mode - DUFLUXU | kg m-1 s-1 | xy | | | | | | Dust column u-wind mass flux - DUFLUXV | kg m-1 s-1 | xy | | | | | | Dust column v-wind mass flux - DP_SU_AIT | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Aitken mode - DP_SU_ACC | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Accumulation mode - DP_SU_FSS | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Fine Seasalt mode - DP_SU_FDU | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Fine Dust mode - DP_SU_CSS | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Coarse Seasalt mode - DP_SU_CDU | kg m-2 s-1 | xy | | | | | | Sulfate Sedimentation Coarse Dust mode - DP_AMM_AIT | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Aitken mode - DP_AMM_ACC | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Accumulation mode - DP_AMM_FSS | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Fine Seasalt mode - DP_AMM_FDU | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Fine Dust mode - DP_AMM_CSS | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Coarse Seasalt mode - DP_AMM_CDU | kg m-2 s-1 | xy | | | | | | Ammonium Sedimentation Coarse Dust mode - DP_SOA_AIT | kg m-2 s-1 | xy | | | | | | SOA Sedimentation Aitken mode - DP_SOA_ACC | kg m-2 s-1 | xy | | | | | | SOA Sedimentation Accumulation mode - POMEMPCM | kg m-2 s-1 | xy | | | | | | POM Emission Primary Carbon mode - DP_POM_ACC | kg m-2 s-1 | xy | | | | | | POM Sedimentation Accumulation mode - DP_POM_PCM | kg m-2 s-1 | xy | | | | | | POM Sedimentation Primary Carbon mode - BCEMPCM | kg m-2 s-1 | xy | | | | | | Black Carbon Emission Primary Carbon mode - DP_BC_ACC | kg m-2 s-1 | xy | | | | | | Black Carbon Sedimentation Accumulation mode - DP_BC_PCM | kg m-2 s-1 | xy | | | | | | Black Carbon Sedimentation Primary Carbon mode - SUEMACC | kg m-2 s-1 | xy | | | | | | SO4 Emission Accumulation mode -# | | | | | | | | - AITCMASS | kg m-2 | xy | | | | | | Column Mass Density Aitken mode - ACCCMASS | kg m-2 | xy | | | | | | Column Mass Density Accumulation mode - PCMCMASS | kg m-2 | xy | | | | | | Column Mass Density Primary Carbon mode - FSSCMASS | kg m-2 | xy | | | | | | Column Mass Density Fine Seasalt mode - CSSCMASS | kg m-2 | xy | | | | | | Column Mass Density Coarse Seasalt mode - FDUCMASS | kg m-2 | xy | | | | | | Column Mass Density Fine Dust mode - CDUCMASS | kg m-2 | xy | | | | | | Column Mass Density Coarse Dust mode -# optics - TOTEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness - TOTSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness - AITEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Aitken mode - AITSCATAU | 1 | xy | | | | | | Scattering Optical Thickness Aitken mode - ACCEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Accumulation mode - ACCSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Accumulation mode - PCMEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Primary Carbon mode - PCMSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Primary Carbon mode - FSSEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Fine Seasalt mode - FSSSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Fine Seasalt mode - CSSEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Coarse Seasalt mode - CSSSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Coarse Seasalt mode - FDUEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Fine Dust mode - FDUSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Fine Dust mode - CDUEXTTAU | 1 | xy | | | | | | Aerosol Optical Thickness Coarse Dust mode - CDUSCATAU | 1 | xy | | | | | | Aerosol Scattering Optical Thickness Coarse Dust mode -# surface - SFC_NUM_AIT | m-3 | xy | | | | | | Number of particles in Aitken mode in the surface model layer - SFC_WTR_AIT | kg m-3 | xy | | | | | | Aerosol water in Aitken mode in the surface model layer - SFC_DGN_DRY_AIT | m | xy | | | | | | Dry size of Aitken mode number size distribution in the surface model layer - SFC_DGN_WET_AIT | m | xy | | | | | | Wet size of Aitken mode number size distribution in the surface model layer -# - SFC_NUM_ACC | m-3 | xy | | | | | | Number of particles in Accumulation mode in the surface model layer - SFC_WTR_ACC | kg m-3 | xy | | | | | | Aerosol water in Accumulation mode in the surface model layer - SFC_DGN_DRY_ACC | m | xy | | | | | | Dry size of Accumulation mode number size distribution in the surface model layer - SFC_DGN_WET_ACC | m | xy | | | | | | Wet size of Accumulation mode number size distribution in the surface model layer -# - SFC_NUM_PCM | m-3 | xy | | | | | | Number of particles in Primary Carbon mode in the surface model layer - SFC_WTR_PCM | kg m-3 | xy | | | | | | Aerosol water in Primary Carbon mode in the surface model layer - SFC_DGN_DRY_PCM | m | xy | | | | | | Dry size of Primary Carbon mode number size distribution in the surface model layer - SFC_DGN_WET_PCM | m | xy | | | | | | Wet size of Primary Carbon mode number size distribution in the surface model layer -# - SFC_NUM_FSS | m-3 | xy | | | | | | Number of particles in Fine Sea Salt mode in the surface model layer - SFC_WTR_FSS | kg m-3 | xy | | | | | | Aerosol water in Fine Sea Salt mode in the surface model layer - SFC_DGN_DRY_FSS | m | xy | | | | | | Dry size of Fine Sea Salt mode number size distribution in the surface model layer - SFC_DGN_WET_FSS | m | xy | | | | | | Wet size of Fine Sea Salt mode number size distribution in the surface model layer -# - SFC_NUM_FDU | m-3 | xy | | | | | | Number of particles in Fine Dust mode in the surface model layer - SFC_WTR_FDU | kg m-3 | xy | | | | | | Aerosol water in Fine Dust mode in the surface model layer - SFC_DGN_DRY_FDU | m | xy | | | | | | Dry size of Fine Dust mode number size distribution in the surface model layer - SFC_DGN_WET_FDU | m | xy | | | | | | Wet size of Fine Dust mode number size distribution in the surface model layer -# - SFC_NUM_CSS | m-3 | xy | | | | | | Number of particles in Coarse Sea Salt mode in the surface model layer - SFC_WTR_CSS | kg m-3 | xy | | | | | | Aerosol water in Coarse Sea Salt mode in the surface model layer - SFC_DGN_DRY_CSS | m | xy | | | | | | Dry size of Coarse Sea Salt mode number size distribution in the surface model layer - SFC_DGN_WET_CSS | m | xy | | | | | | Wet size of Coarse Sea Salt mode number size distribution in the surface model layer -# - SFC_NUM_CDU | m-3 | xy | | | | | | Number of particles in Coarse Dust mode in the surface model layer - SFC_WTR_CDU | kg m-3 | xy | | | | | | Aerosol water in Coarse Dust mode in the surface model layer - SFC_DGN_DRY_CDU | m | xy | | | | | | Dry size of Coarse Dust mode number size distribution in the surface model layer - SFC_DGN_WET_CDU | m | xy | | | | | | Wet size of Coarse Dust mode number size distribution in the surface model layer -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection, or "S" for self to add to EXPORT state; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column - - -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# -------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- - - diff --git a/MAMchem_GridComp/README b/MAMchem_GridComp/README deleted file mode 100644 index e69de29b..00000000 diff --git a/MAMchem_GridComp/TODO b/MAMchem_GridComp/TODO deleted file mode 100644 index 2090e109..00000000 --- a/MAMchem_GridComp/TODO +++ /dev/null @@ -1,39 +0,0 @@ -(A) 2015-11-09 Add MAM_ExtData.rc + dito for GEOSachem - -(A) 2015-11-09 Decorate MAM fields with prefix MAM or MAM7|MAM3 depending on the selected scheme - -(A) 2015-10-30 Enable diagnostics from the CAM code + add these fields to the export spec - -(A) 2015-10-30 Update the parameterization of in and below cloud wet scavenging - of aerosols from precip - -(A) 2015-10-30 Two phase run method + revisit gas and aqueous chemistry sequence - -(B) 2015-11-09 Revert to using CESM code for nucleation - -(B) 2015-11-09 Revert to using CESM code for dry and wet sizes - -(B) 2015-10-30 Number of vertical levels is hardcoded to 72 in modal_aero_amicphys.F90, - this needs to be changed to set the number of vertical levels at runtime. - -(B) 2015-10-30 Refactor modal_aero_calcsize.F90 - + use 'fldcw => qc' - + enable modal_aero_calcsize_diag() and call it before the AOT and other diagnostics - -(B) 2015-10-30 Refactor modal_aero_wateruptake.F90 - + enable modal_aero_wateruptake_dr() - + discard MAML_SizeMod.F90 and MAM_SizeMod.F90? - -(B) 2015-10-30 Refactor modal_aero_initialize_data.F90 - + enable 'call modal_aero_bcscavcoef_init' - + is this the correct way: 'tot_spec = imozart+gas_pcnst-2' - -(C) 2015-10-30 Include shr_kind_mod.F90 - + there two such files in GEOS-5, is it safe to add the CAM's version? - -(D) 2015-10-30 Add new directory 'optics' or 'mie' and move the optics LUTs code in it. - + validate the LUTs - -(D) 2015-10-30 Check if the offline extinction calculator works - -(E) 2015-10-30 Optics - treatment of non-spherical particles diff --git a/MAMchem_GridComp/mam_optics_calculator.F90 b/MAMchem_GridComp/mam_optics_calculator.F90 deleted file mode 100644 index dc4d5dc7..00000000 --- a/MAMchem_GridComp/mam_optics_calculator.F90 +++ /dev/null @@ -1,773 +0,0 @@ -#include "MAPL_Generic.h" - -program mam_optics_calculator - -!----------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: mam_optics_calculator --- Extinction calculator -! -! !INTERFACE: -! -! Usage: mam_optics_calculator.xx -! -! !USES: -! - - use ESMF - - use MAPL - - use MAM_BaseMod - use MAM3_DataMod, only: MAM3_MODE_NAME, MAM3_MODES - use MAM7_DataMod, only: MAM7_MODE_NAME, MAM7_MODES - - use MAML_OpticsTableMod - use MAML_OpticsMod - - implicit none - - -! !DESCRIPTION: 2D/3D Aerosol Optics Calculator. -! -! !REVISION HISTORY: -! -! 27Mar2013 A. Darmenov Initial Implementation -! -!EOP -!----------------------------------------------------------------------- - - character(len=*), parameter :: DEFAULT_CONFIG_FILE = 'mam_optics_calculator.rc' - integer, parameter :: MAX_STRFILE = 1024 - - - type MAM_OpticsCalculatorSetup - - type(ESMF_Config) :: config ! private config - - logical :: verbose ! verbosity flag - - ! World - type(ESMF_Grid) :: grid ! grid - type(ESMF_Time) :: time ! time - - integer :: im_world ! global grid dimensions - lon - integer :: jm_world ! global grid dimensions - lat - integer :: lm_world ! global grid dimensions - vertical - - integer :: Nx ! layout - integer :: Ny ! ... - - ! MAM - integer :: scheme_id ! MAM7 or MAM3 - character(len=ESMF_MAXSTR), pointer, dimension(:) :: mode ! mode name - - ! Optics - real, pointer, dimension(:) :: wavelength ! wavelengths of channels/bands - character(len=MAX_STRFILE), pointer, dimension(:) :: optics_lut ! files with optics lookup tables - - ! Files - character(len=MAX_STRFILE) :: aerosol_file ! input file with 3D aerosol number and mass mixing ratios - character(len=MAX_STRFILE) :: optics_file ! output file - - end type MAM_OpticsCalculatorSetup - - - __Iam__('mam_optics_calculator.xx') - - - call main(DEFAULT_CONFIG_FILE, rc=status) - if (MAPL_VRFY(status, Iam, __LINE__)) call MAPL_Abort() - - call exit(status) - -contains - - -subroutine main(config_file, rc) - - implicit none - - character(len=*), intent( in) :: config_file ! config file - integer, optional, intent(out) :: rc ! return code - -! Local variables -! --------------- - type(ESMF_VM) :: vm ! global VM - type(MAM_OpticsCalculatorSetup) :: setup ! setup - - type(MAM_Scheme) :: mam ! MAM scheme/configuration - - type(ESMF_State) :: aero_state ! aerosol state - - type(MAPL_SimpleBundle) :: q ! aerosol mixing ratio - type(MAPL_SimpleBundle) :: o ! - - type(ESMF_Field) :: field - type(ESMF_FieldBundle) :: optics ! optics (extinction, etc.) parameters - type(ESMF_FieldBundle) :: bundle ! field bundle - - - type(MAML_OpticsTable) :: lut ! aerosol optics lookup table - - character(len=MAM_MAXSTR) :: field_name ! field name - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - character(len=MAM_MAXSTR) :: species_name ! aerosol species name - integer :: n_species ! number of aerosol species - integer :: m, s ! mode and species indexes - integer :: iq ! field index - - character(len=1024) :: field_list ! list of comma separated field names - - integer :: im, jm, km ! local dim sizes - - integer :: i, j, k, n ! loop counters - -#ifdef __PGI - interface - subroutine optics_compute(aero_state, rc) - use ESMF_StateMod - implicit none - type(ESMF_State) :: aero_state - integer, intent(out) :: rc - end subroutine - end interface -#endif - - - __Iam__('mam_optics_calculator::main') - -! Initialize the ESMF -! ------------------- - call ESMF_Initialize(vm=vm, logKindFlag=ESMF_LOGKIND_NONE, __RC__) - call ESMF_CalendarSetDefault(calkindflag=ESMF_CALKIND_GREGORIAN, __RC__) - -! Show text banner -! ---------------- - if (MAPL_am_I_root()) then - call text_banner() - end if - -! Initialize the setup -! -------------------- - call setup_initialize(setup, config_file, __RC__) - - -! Set MAM scheme -! -------------- - call MAM_SchemeInit(mam, setup%scheme_id, __RC__) - - -! Create a state - aero_state = ESMF_StateCreate(name='AERO_STATE', __RC__) - -! Create optics bundle and fill it with empty fields -! -------------------------------------------------- - optics = ESMF_FieldBundleCreate(name='MAM::OPTICS', __RC__) - call optics_bundle_initialize(optics, setup%grid, mam, __RC__) - -! Add the optics bundle to the aero state -! --------------------------------------- - call ESMF_StateAdd(aero_state, (/optics/), __RC__) - - - - if (setup%verbose .and. .false.) then - call ESMF_StateGet(aero_state, itemCount=n, __RC__) - - _ASSERT(n > 0,'needs informative message') - - call ESMF_StateGet(aero_state, 'MAM::OPTICS', bundle, __RC__) - o = MAPL_SimpleBundleCreate(bundle, __RC__) - - call MAPL_SimpleBundlePrint(o) - call MAPL_SimpleBundleDestroy(o, __RC__) - end if - - -! Exercise callback mechanism -! --------------------------- - call ESMF_MethodAdd(aero_state, label='OPTICS_COMPUTE', userRoutine=optics_compute, __RC__) - - call ESMF_MethodExecute(aero_state, label='OPTICS_COMPUTE', userRc=rc, __RC__) - - if (setup%verbose) then - call ESMF_StateGet(aero_state, itemCount=n, __RC__) - - _ASSERT(n > 0,'needs informative message') - - call ESMF_StateGet(aero_state, 'MAM::OPTICS', bundle, __RC__) - o = MAPL_SimpleBundleCreate(bundle, __RC__) - - call MAPL_SimpleBundlePrint(o) - call MAPL_SimpleBundleDestroy(o, __RC__) - end if - - - - loop_modes: do m = 1, mam%n_modes - - ! ------------------------------------------------------------------ - ! Read the 3D aerosol fields - ! ------------------------------------------------------------------ - - ! construct a list with 3D aerosol fields to read - field_list = '' - - call MAM_AerosolModeGet(mam%mode(m), name=mode_name, n_species=n_species, __RC__) - - ! interstitial aerosol tracers - field_name = 'NUM_A_' // trim(mode_name) - field_list = trim(field_list) // trim(field_name) // ',' - - ! interstitial aerosol tracers - field_name = 'WTR_A_' // trim(mode_name) - field_list = trim(field_list) // trim(field_name) // ',' - - do s = 1, n_species - species_name = mam%mode(m)%species(s)%name - field_name = trim(species_name) // '_A_' // trim(mode_name) - - ! append to the list of fields to read - field_list = trim(field_list) // trim(field_name) // ',' - end do - - ! strip the trailing comma from the list - field_list = trim(field_list(1:len_trim(field_list)-1)) - - ! read the aerosol fields and bundle them - q = MAPL_SimpleBundleRead(setup%aerosol_file, & - setup%aerosol_file, & - setup%grid, & - setup%time, & - only_vars=field_list, & - verbose=setup%verbose, & - __RC__) - - if (setup%verbose) call MAPL_SimpleBundlePrint(q) - - ! get the size of local dims - im = size(q%coords%lons, 1) - jm = size(q%coords%lons, 2) - km = size(q%coords%levs) - - - ! ------------------------------------------------------------------ - ! Read the optics lookup table - ! ------------------------------------------------------------------ - _ASSERT(associated(setup%optics_lut),'needs informative message') - _ASSERT(associated(setup%mode),'needs informative message') - _ASSERT(size(setup%mode) == size(setup%optics_lut),'needs informative message') - - n = 0 - do n = 1, size(setup%mode) - if (setup%mode(n) == mode_name) then - exit - end if - end do - - _ASSERT(n > 0,'needs informative message') - - lut = MAML_OpticsTableCreate(setup%optics_lut(n), __RC__) - - call MAML_OpticsTableRead(lut, __RC__) - - - ! ------------------------------------------------------------------ - ! Compute the aerosol optical quantities - ! ------------------------------------------------------------------ - -! call MAML_OpticsCalculator(o, q, lut, __RC__) - - call MAML_OpticsTableDestroy(lut, __RC__) - - !TODO - free all associated memory, e.g., ESMF fields, bundle, etc. - call MAPL_SimpleBundleDestroy(q, __RC__) - end do loop_modes - - ! ------------------------------------------------------------------ - ! Write aerosol optics quantities into a file - ! ------------------------------------------------------------------ -! call MAPL_SimpleBundleWrite(o, setup%optics_file, setup%time, __RC__) - - call MAPL_SimpleBundleDestroy(o, __RC__) - - -! Finalize self -! -------------- - call setup_finalize(setup, __RC__) - - - call ESMF_StateDestroy(aero_state, __RC__) - -! Finalize framework -! ------------------ - call ESMF_Finalize(__RC__) - VERIFY_(status) - - - RETURN_(ESMF_SUCCESS) - -end subroutine main - - - - -subroutine setup_initialize(self, config_file, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - character(len=*), intent(in) :: config_file - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_initialize') - -! Local variables -! --------------- - integer :: useShmem - -! Set private config -! ------------------ - call setup_set_config_(self, config_file, __RC__) - -! Set verbose flag -! ---------------- - call setup_set_verbosity_(self, __RC__) - -! Set global grid and time -! ------------------------ - call setup_set_grid_(self, __RC__) - call setup_set_time_(self, __RC__) - -! Set MAM scheme -! -------------- - call setup_set_mam_scheme_id_(self, __RC__) - -! Set modes and optics LUTs: these are tied together, i.e., -! a hash table with keys modes and values the optics LUTs -! --------------------------------------------------------- - call setup_set_mam_modes_(self, __RC__) - call setup_set_mam_optics_lut_(self, __RC__) - -! Set wavelengths of channel/bands -! -------------------------------- - call setup_set_wavelengths_(self, __RC__) - -! Set I/O files -! ------------- - call setup_set_io_files_(self, __RC__) - -! Check if user wants to use node shared memory (default is no) -! ------------------------------------------------------------- - call ESMF_ConfigGetAttribute(self%config, useShmem, label='USE_SHMEM:', default=0, __RC__) - - if (useShmem /= 0) then - call MAPL_InitializeShmem(__RC__) - end if - - RETURN_(ESMF_SUCCESS) -end subroutine setup_initialize - - -subroutine setup_finalize(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_finalize') - - - if (associated(self%mode)) deallocate(self%mode) - if (associated(self%optics_lut)) deallocate(self%optics_lut) - if (associated(self%wavelength)) deallocate(self%wavelength) - - call ESMF_ConfigDestroy(self%config, __RC__) - - call MAPL_FinalizeShmem(__RC__) - - RETURN_(ESMF_SUCCESS) -end subroutine setup_finalize - - -subroutine optics_bundle_initialize(optics, grid, mam, rc) - implicit none - - type(ESMF_FieldBundle) :: optics ! optics (extinction, etc.) parameters - type(ESMF_Grid) :: grid ! grid - type(MAM_Scheme) :: mam ! MAM scheme/configuration - integer, optional, intent(out) :: rc ! return code - - - __Iam__('mam_optics_calculator::optics_bundle_initialize') - - ! local - type(ESMF_Field) :: field - character(len=MAM_MAXSTR) :: field_name ! field name - character(len=MAM_MAXSTR) :: mode_name ! aerosol mode name - integer :: m ! mode index - - - ! Fill in optics bundle with empty fields - ! --------------------------------------- - - ! field for total quantity, e.g., extinction - field_name = 'ext' - field_name = ESMF_UtilStringLowerCase(field_name, __RC__) - field = MAPL_FieldCreateEmpty(trim(field_name), grid, __RC__) - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_FieldBundleAdd(optics, field, __RC__) - - ! fields for mode quantities - do m = 1, mam%n_modes - call MAM_AerosolModeGet(mam%mode(m), name=mode_name, __RC__) - - ! create an empty field - field_name = 'ext_' // trim(mode_name) - field_name = ESMF_UtilStringLowerCase(field_name, __RC__) - field = MAPL_FieldCreateEmpty(trim(field_name), grid, __RC__) - call MAPL_FieldAllocCommit(field, dims=MAPL_DimsHorzVert, location=MAPL_VLocationCenter, typekind=MAPL_R4, hw=0, __RC__) - call MAPL_FieldBundleAdd(optics, field, __RC__) - end do - - RETURN_(ESMF_SUCCESS) - -end subroutine optics_bundle_initialize - - -subroutine optics_compute(aero_state, rc) - use ESMF_StateMod - - implicit none - - type(ESMF_State) :: aero_state ! aerosol state - integer, intent(out) :: rc ! return code - - __Iam__('mam_optics_calculator::optics_bundle_initialize') - - - !local - type(ESMF_FieldBundle) :: optics - type(ESMF_Field) :: field - - character(len=ESMF_MAXSTR) :: name - - real, pointer, dimension(:,:,:) :: q - - - call ESMF_StateGet(aero_state, name=name, __RC__) - - call ESMF_StateGet(aero_state, 'MAM::OPTICS', optics, __RC__) - - call ESMFL_BundleGetPointerToData(optics, 'ext', q, __RC__) - - q = q + 5.0 - - RETURN_(ESMF_SUCCESS) - -end subroutine optics_compute - - - -subroutine setup_set_config_(self, config_file, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - character(len=*), intent(in) :: config_file - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_config_') - - - self%config = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile(self%config, fileName=trim(config_file), __RC__) - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_config_ - - -subroutine setup_set_verbosity_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_verbosity_') - - call ESMF_ConfigGetAttribute(self%config, self%verbose, label='verbose:', __RC__) - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_verbosity_ - - -subroutine setup_set_io_files_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_io_files_') - - call ESMF_ConfigGetAttribute(self%config, self%aerosol_file, label='aerosol_file:', __RC__) - call ESMF_ConfigGetAttribute(self%config, self%optics_file, label='optics_file:', __RC__) - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_io_files_ - - -subroutine setup_set_grid_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_grid_') - - -! World grid dimensions and layout -! -------------------------------- - call ESMF_ConfigGetAttribute(self%config, self%im_world, label='WORLD_IM:', __RC__) - call ESMF_ConfigGetAttribute(self%config, self%jm_world, label='WORLD_JM:', __RC__) - call ESMF_ConfigGetAttribute(self%config, self%lm_world, label='WORLD_LM:', __RC__) - call ESMF_ConfigGetAttribute(self%config, self%Nx, label='NX:', __RC__) - call ESMF_ConfigGetAttribute(self%config, self%Ny, label='NY:', __RC__) - -! Create global grid -! ------------------ - self%grid = MAPL_LatLonGridCreate(name = 'etaGrid', & - Nx = self%Nx, & - Ny = self%Ny, & - IM_World = self%im_world, & - JM_World = self%jm_world, & - LM_World = self%lm_world, & - __RC__) - -! Validate grid -! ------------- - call ESMF_GridValidate(self%grid, __RC__) - - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_grid_ - - -subroutine setup_set_time_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_time_') - -! Local variables -! --------------- - integer :: year, month, day - integer :: hours, minutes, seconds - integer :: nymd, nhms - -! Initialize the date/time -! ------------------------ - nymd = 0 - nhms = 0 - -! Get date/time from config -! ------------------------- - call ESMF_ConfigGetAttribute(self%config, nymd, label='nymd:', __RC__) - call ESMF_ConfigGetAttribute(self%config, nhms, label='nhms:', __RC__) - -! Set ESMF Time -! ------------- - year = nymd / 10000; month = (nymd - 10000 * year) / 100; day = nymd - (10000 * year + 100 * month) - hours = nhms / 10000; minutes = (nhms - 10000 * hours) / 100; seconds = nhms - (10000 * hours + 100 * minutes) - - call ESMF_TimeSet(self%time, yy=year, mm=month, dd=day, h=hours, m=minutes, s=seconds, __RC__) - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_time_ - - -subroutine setup_set_mam_scheme_id_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_mam_scheme_id_') - -! Local variables -! --------------- - character(len=ESMF_MAXSTR) :: scheme ! name of MAM scheme/configuration - - - call ESMF_ConfigGetAttribute(self%config, scheme, label='scheme:', default='MAM7', __RC__) - - scheme = ESMF_UtilStringUpperCase(scheme, __RC__) - - select case (scheme) - case ('MAM7') - self%scheme_id = MAM7_SCHEME - - case default - __raise__(MAM_UNKNOWN_SCHEME_ERROR, "Unsupported MAM scheme: " // trim(scheme)) - end select - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_mam_scheme_id_ - - -subroutine setup_set_mam_modes_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_mam_modes_') - -! Local variables -! --------------- - character(len=ESMF_MAXSTR) :: mode_ - logical :: flag - integer :: i, n - - - call ESMF_ConfigFindLabel(self%config, 'modes:', __RC__) - - n = 0 - do while (.true.) - call ESMF_ConfigGetAttribute(self%config, mode_, rc=status) - if (status == ESMF_SUCCESS) then - n = n + 1 - else - exit - end if - end do - - _ASSERT(n > 0,'needs informative message') - _ASSERT(n < (MAM_MAX_NUMBER_MODES + 1),'needs informative message') - - allocate(self%mode(n), __STAT__) - - call ESMF_ConfigFindLabel(self%config, 'modes:', __RC__) - do i = 1, n - call ESMF_ConfigGetAttribute(self%config, self%mode(i), __RC__) - end do - - select case (self%scheme_id) - case (MAM7_SCHEME) - do i = 1, n - flag = any(MAM7_MODE_NAME(:) .eq. self%mode(i)) - if (flag .eqv. .false.) then - mode_ = self%mode(i) - deallocate(self%mode, __STAT__) - __raise__(MAM_UNKNOWN_AEROSOL_MODE_ERROR, "Unknown MAM mode " // trim(mode_)) - end if - end do - - case (MAM3_SCHEME) - do i = 1, n - flag = any(MAM3_MODE_NAME(:) .eq. self%mode(i)) - if (flag .eqv. .false.) then - mode_ = self%mode(i) - deallocate(self%mode, __STAT__) - __raise__(MAM_UNKNOWN_AEROSOL_MODE_ERROR, "Unknown MAM mode " // trim(mode_)) - end if - end do - - case default - __raise__(MAM_UNKNOWN_SCHEME_ERROR, "Unsupported MAM scheme") - end select - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_mam_modes_ - - -subroutine setup_set_mam_optics_lut_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_mam_optics_lut_') - -! Local variables -! --------------- - character(len=MAX_STRFILE) :: optics_lut_ - character(len=ESMF_MAXSTR) :: optics_lut_label - integer :: i, n - - if (associated(self%mode)) then - n = size(self%mode) - else - n = 0 - end if - - _ASSERT(n > 0,'needs informative message') - _ASSERT(n < (MAM_MAX_NUMBER_MODES + 1),'needs informative message') - - allocate(self%optics_lut(n), __STAT__) - - do i = 1, n - optics_lut_label = 'MAM_' // trim(self%mode(i)) // '_OPTICS:' - call ESMF_ConfigGetAttribute(self%config, self%optics_lut(i), label=trim(optics_lut_label), __RC__) - end do - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_mam_optics_lut_ - - -subroutine setup_set_wavelengths_(self, rc) - implicit none - - type(MAM_OpticsCalculatorSetup), intent(inout) :: self - integer, optional, intent(out) :: rc - - __Iam__('mam_optics_calculator::setup_set_wavelengths_') - -! Local variables -! --------------- - real :: wavelength_ - integer :: i, n - - call ESMF_ConfigFindLabel(self%config, 'wavelength:', __RC__) - - n = 0 - do while (.true.) - call ESMF_ConfigGetAttribute(self%config, wavelength_, rc=status) - if (status == ESMF_SUCCESS) then - n = n + 1 - else - exit - end if - end do - - - _ASSERT(n > 0,'needs informative message') - - allocate(self%wavelength(n), __STAT__) - - call ESMF_ConfigFindLabel(self%config, 'wavelength:', __RC__) - do i = 1, n - call ESMF_ConfigGetAttribute(self%config, self%wavelength(i), __RC__) - end do - - RETURN_(ESMF_SUCCESS) -end subroutine setup_set_wavelengths_ - - -subroutine text_banner() - implicit none - - print * - print *, ' --------------------------------------' - print *, ' MAM - 3D Extinction Calculator ' - print *, ' --------------------------------------' - print * - -end subroutine text_banner - - - -end program mam_optics_calculator - diff --git a/MAMchem_GridComp/mam_optics_calculator.csh b/MAMchem_GridComp/mam_optics_calculator.csh deleted file mode 100755 index a1547b6f..00000000 --- a/MAMchem_GridComp/mam_optics_calculator.csh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/csh -f -# -# Computes aerosol extention files. See usage: below for details. -# - -echo "Beginning Exctinction Calculator $argv" - -# set up executable names (assumes they are on the path) - set chemaod = "${FVROOT}/bin/Chem_Aod3d.x" - set lcv2prs = "${FVROOT}/bin/lcv2prs.x" - -# Did I pass in a filename to operate on? - if ($#argv < 1) then - goto usage - endif - -# Check options - if ( "$1" == "-clean" ) then - set clean = 1 - shift - else - set clean = 0 - endif - -# Setup the input filename - set inpfile = $1 - -# Parse the name of the input filename - set expid = `echo $inpfile:r:r:r` - set inpfiletyp = `echo $inpfile:r:r:e` - set datetag = `echo $inpfile:r:e` - -# Trickery to pull out the YYYYMMDD and HHMMSS from filename - set datevalid = `echo $datetag | cut -d"+" -f2` - set YYYYMMDD = `echo $datevalid | cut -c1-8` - set HHMMSS = `echo $datevalid | cut -c10-13`00 - -# Check the input file passed -# If it is not of type "filetyp" then exit - if ( "$inpfiletyp" =~ *3d_aer_v* ) then - echo "Starting extinction calculation for file $inpfile" - else - exit 0 # Not an error, exit gracefully - endif - /bin/rm -f tau3d.nc4 -# Now run the AOD calculator -# With no other options will produce output file tau3d.nc4 - set cmd = "$chemaod -t Aod_CALIPSO.rc $inpfile" - echo $cmd - $cmd - if ( $status ) then - echo $0": error running the extinction calculator" - exit 2 - endif - -# rename the output file - set extvfile = `echo $inpfile | sed -e 's/_aer_v/_ext_v/g'` - \mv -f tau3d.nc4 $extvfile - -# Now do the pressure level interpolation - set extpfile = `echo $inpfile | sed -e 's/_aer_v/_ext_p/g'` - set savfile = `echo $inpfile | sed -e 's/_aer_v/_sav_v/g'` - $lcv2prs -nStep=1 -date $YYYYMMDD -start $HHMMSS \ - -vars @tavg3d_ext_p -rc tavg3d_ext_p.rc \ - -o $extpfile $extvfile - if ( $status ) then - echo $0": error on return from lcv2prs - aborting" - exit 3 - endif - -# Optional clean-up: delete input and intermediate files - if ( $clean ) then - -# /bin/cp $inpfile $extvfile $extpfile /explore/nobackup/dao_ops/colarco - /bin/mv $inpfile $savfile - \rm -f $inpfile $extvfile - endif - - echo $0":All done" -# Kludge for MPI run - if ( $?MPI_ENVIRONMENT ) ${FVROOT}/bin/makeiau.x - exit - - exit 0 - -#-------------------------------------------------------------- -usage: - -cat < output_unit - implicit none -#endif - -end module cam_logfile diff --git a/MAMchem_GridComp/microphysics/chem_mods.F90 b/MAMchem_GridComp/microphysics/chem_mods.F90 deleted file mode 100644 index b1d414c2..00000000 --- a/MAMchem_GridComp/microphysics/chem_mods.F90 +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - module chem_mods -!-------------------------------------------------------------- -! ... Basic chemistry parameters and arrays -!-------------------------------------------------------------- - -#ifndef GEOS5_PORT - use shr_kind_mod, only : r8 => shr_kind_r8 -#else - use MAPL_ConstantsMod, only: r8 => MAPL_R8 -#endif - - implicit none - - save - - integer, parameter :: phtcnt = 1, & ! number of photolysis reactions - rxntot = 8, & ! number of total reactions - gascnt = 7, & ! number of gas phase reactions - nabscol = 2, & ! number of absorbing column densities - gas_pcnst = 37, & ! number of "gas phase" species - nfs = 8, & ! number of "fixed" species - relcnt = 0, & ! number of relationship species - grpcnt = 0, & ! number of group members - nzcnt = 39, & ! number of non-zero matrix entries - extcnt = 8, & ! number of species with external forcing - clscnt1 = 0, & ! number of species in explicit class - clscnt2 = 0, & ! number of species in hov class - clscnt3 = 0, & ! number of species in ebi class - clscnt4 = 37, & ! number of species in implicit class - clscnt5 = 0, & ! number of species in rodas class - indexm = 1, & ! index of total atm density in invariant array - indexh2o = 4, & ! index of water vapor density - clsze = 1, & ! loop length for implicit chemistry - rxt_tag_cnt = 4, & - nslvd = 0 - - integer :: clscnt(5) = 0 - integer :: cls_rxt_cnt(4,5) = 0 - integer :: clsmap(gas_pcnst,5) = 0 - integer :: permute(gas_pcnst,5) = 0 - - integer :: diag_map(clscnt4) = 0 - - - - real(r8) :: adv_mass(gas_pcnst) = 0._r8 - real(r8) :: crb_mass(gas_pcnst) = 0._r8 - real(r8) :: fix_mass(max(1,nfs)) - - - - - integer, allocatable :: rxt_tag_map(:) - real(r8), allocatable :: pht_alias_mult(:,:) - character(len=16), allocatable :: rxt_tag_lst(:) - character(len=16), allocatable :: pht_alias_lst(:,:) - character(len=16) :: inv_lst(max(1,nfs)) - character(len=16) :: extfrc_lst(max(1,extcnt)) - logical :: frc_from_dataset(max(1,extcnt)) - character(len=16) :: slvd_lst(max(1,nslvd)) - - end module chem_mods diff --git a/MAMchem_GridComp/microphysics/constituents.F90 b/MAMchem_GridComp/microphysics/constituents.F90 deleted file mode 100644 index 0d465659..00000000 --- a/MAMchem_GridComp/microphysics/constituents.F90 +++ /dev/null @@ -1,450 +0,0 @@ - -module constituents - -!---------------------------------------------------------------------------------------------- -! -! Purpose: Contains data and functions for manipulating advected and non-advected constituents. -! -! Revision history: -! B.A. Boville Original version -! June 2003 P. Rasch Add wet/dry m.r. specifier -! 2004-08-28 B. Eaton Add query function to allow turning off the default CAM output of -! constituents so that chemistry module can make the outfld calls. -! Allow cnst_get_ind to return without aborting when constituent not -! found. -! 2006-10-31 B. Eaton Remove 'non-advected' constituent functionality. -!---------------------------------------------------------------------------------------------- -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use physconst, only: r_universal - use spmd_utils, only: masterproc - use abortutils, only: endrun - use cam_logfile, only: iulog -#else - use MAPL_ConstantsMod, only: pi => MAPL_PI, r8 => MAPL_R8 - use MAPL_ConstantsMod, only: r_universal => MAPL_RUNIV - use abortutils, only: endrun - use cam_logfile, only: iulog -#endif - - implicit none - private - save -! -! Public interfaces -! - public cnst_add ! add a constituent to the list of advected constituents - public cnst_num_avail ! returns the number of available slots in the constituent array - public cnst_get_ind ! get the index of a constituent - public cnst_get_type_byind ! get the type of a constituent - public cnst_get_type_byname ! get the type of a constituent - public cnst_get_molec_byind ! get the molecular diffusion type of a constituent - public cnst_read_iv ! query whether constituent initial values are read from initial file - public cnst_chk_dim ! check that number of constituents added equals dimensions (pcnst) - public cnst_cam_outfld ! Returns true if default CAM output was specified in the cnst_add calls. - -! Public data - -#ifndef GEOS5_PORT - integer, parameter, public :: pcnst = PCNST ! number of advected constituents (including water vapor) -#else - integer, parameter, public :: pcnst = 31 + (6) - logical, private :: masterproc = .false. -#endif - - character(len=16), public :: cnst_name(pcnst) ! constituent names - character(len=128),public :: cnst_longname(pcnst) ! long name of constituents - -! Namelist variables - logical, public :: readtrace = .true. ! true => obtain initial tracer data from IC file - -! -! Constants for each tracer - real(r8), public :: cnst_cp (pcnst) ! specific heat at constant pressure (J/kg/K) - real(r8), public :: cnst_cv (pcnst) ! specific heat at constant volume (J/kg/K) - real(r8), public :: cnst_mw (pcnst) ! molecular weight (kg/kmole) - character*3, public :: cnst_type(pcnst) ! wet or dry mixing ratio - character*5, public :: cnst_molec(pcnst) ! major or minor species molecular diffusion - real(r8), public :: cnst_rgas(pcnst) ! gas constant () - real(r8), public :: qmin (pcnst) ! minimum permitted constituent concentration (kg/kg) - real(r8), public :: qmincg (pcnst) ! for backward compatibility only - logical, public :: cnst_fixed_ubc(pcnst) = .false. ! upper bndy condition = fixed ? - logical, public :: cnst_fixed_ubflx(pcnst) = .false.! upper boundary non-zero fixed constituent flux - logical, public :: cnst_is_convtran1(pcnst) = .false. ! convective transport : phase 1 or phase 2? - -!++bee - temporary... These names should be declared in the module that makes the addfld and outfld calls. -! Lists of tracer names and diagnostics - character(len=16), public :: apcnst (pcnst) ! constituents after physics (FV core only) - character(len=16), public :: bpcnst (pcnst) ! constituents before physics (FV core only) - character(len=16), public :: hadvnam (pcnst) ! names of horizontal advection tendencies - character(len=16), public :: vadvnam (pcnst) ! names of vertical advection tendencies - character(len=16), public :: dcconnam (pcnst) ! names of convection tendencies - character(len=16), public :: fixcnam (pcnst) ! names of species slt fixer tendencies - character(len=16), public :: tendnam (pcnst) ! names of total tendencies of species - character(len=16), public :: ptendnam (pcnst) ! names of total physics tendencies of species - character(len=16), public :: dmetendnam(pcnst) ! names of dme adjusted tracers (FV) - character(len=16), public :: sflxnam (pcnst) ! names of surface fluxes of species - character(len=16), public :: tottnam (pcnst) ! names for horz + vert + fixer tendencies - -! Private data - - integer :: padv = 0 ! index pointer to last advected tracer - logical :: read_init_vals(pcnst) ! true => read initial values from initial file - logical :: cam_outfld_(pcnst) ! true => default CAM output of constituents in kg/kg - ! false => chemistry is responsible for making outfld - ! calls for constituents - -!============================================================================================== -CONTAINS -!============================================================================================== - - subroutine cnst_add (name, mwc, cpc, qminc, & - ind, longname, readiv, mixtype, molectype, cam_outfld, & - fixed_ubc, fixed_ubflx, is_convtran1) -!----------------------------------------------------------------------- -! -! Purpose: Register a constituent to be advected by the large scale winds and transported by -! subgrid scale processes. -! -!--------------------------------------------------------------------------------- -! - character(len=*), intent(in) :: & - name ! constituent name used as variable name in history file output (8 char max) - real(r8),intent(in) :: mwc ! constituent molecular weight (kg/kmol) - real(r8),intent(in) :: cpc ! constituent specific heat at constant pressure (J/kg/K) - real(r8),intent(in) :: qminc ! minimum value of mass mixing ratio (kg/kg) - ! normally 0., except water 1.E-12, for radiation. - integer, intent(out) :: ind ! global constituent index (in q array) - - character(len=*), intent(in), optional :: & - longname ! value for long_name attribute in netcdf output (128 char max, defaults to name) - logical, intent(in), optional :: & - readiv ! true => read initial values from initial file (default: true) - character(len=*), intent(in), optional :: & - mixtype ! mixing ratio type (dry, wet) - character(len=*), intent(in), optional :: & - molectype ! molecular diffusion type (minor, major) - logical, intent(in), optional :: & - cam_outfld ! true => default CAM output of constituent in kg/kg - logical, intent(in), optional :: & - fixed_ubc ! true => const has a fixed upper bndy condition - logical, intent(in), optional :: & - fixed_ubflx ! true => const has a non-zero fixed upper bndy flux value - logical, intent(in), optional :: & - is_convtran1 ! true => convect in convtran1 rather than convtran2 - -!----------------------------------------------------------------------- - -! set tracer index and check validity, advected tracer - padv = padv+1 - ind = padv - if (padv > pcnst) then - write(iulog,*) 'CNST_ADD: advected tracer index greater than pcnst = ', pcnst - call endrun - end if - -! set tracer name and constants - cnst_name(ind) = name - if ( present(longname) )then - cnst_longname(ind) = longname - else - cnst_longname(ind) = name - end if - -! set whether to read initial values from initial file - if ( present(readiv) ) then - read_init_vals(ind) = readiv - else - read_init_vals(ind) = readtrace - end if - -! set constituent mixing ratio type - if ( present(mixtype) )then - cnst_type(ind) = mixtype - else - cnst_type(ind) = 'wet' - end if - -! set constituent molecular diffusion type - if ( present(molectype) )then - cnst_molec(ind) = molectype - else - cnst_molec(ind) = 'minor' - end if - -! set outfld type -! (false: the module declaring the constituent is responsible for outfld calls) - if ( present(cam_outfld) ) then - cam_outfld_(ind) = cam_outfld - else - cam_outfld_(ind) = .true. - end if - -! set upper boundary condition type - if ( present(fixed_ubc) ) then - cnst_fixed_ubc(ind) = fixed_ubc - else - cnst_fixed_ubc(ind) = .false. - end if - - ! set upper boundary flux type - if ( present(fixed_ubflx) ) then - cnst_fixed_ubflx(ind) = fixed_ubflx - else - cnst_fixed_ubflx(ind) = .false. - end if - -! set upper convective transport flag - if ( present(is_convtran1) ) then - cnst_is_convtran1(ind) = is_convtran1 - else - cnst_is_convtran1(ind) = .false. - end if - - cnst_cp (ind) = cpc - cnst_mw (ind) = mwc - qmin (ind) = qminc - qmincg (ind) = qminc - if (ind == 1) qmincg = 0._r8 ! This crap is replicate what was there before **** - - cnst_rgas(ind) = r_universal * mwc - cnst_cv (ind) = cpc - cnst_rgas(ind) - - return - end subroutine cnst_add - -!============================================================================== - - function cnst_num_avail() - - ! return number of available slots in the constituent array - - integer cnst_num_avail - - cnst_num_avail = pcnst - padv - - end function cnst_num_avail - -!============================================================================== - - subroutine cnst_get_ind (name, ind, abort) -!----------------------------------------------------------------------- -! -! Purpose: Get the index of a constituent -! -! Author: B.A. Boville -! -!-----------------------------Arguments--------------------------------- -! - character(len=*), intent(in) :: name ! constituent name - integer, intent(out) :: ind ! global constituent index (in q array) - logical, optional, intent(in) :: abort ! optional flag controlling abort - -!---------------------------Local workspace----------------------------- - integer :: m ! tracer index - logical :: abort_on_error -!----------------------------------------------------------------------- - -! Find tracer name in list - do m = 1, pcnst - if (name == cnst_name(m)) then - ind = m - return - end if - end do - -! Unrecognized name - abort_on_error = .true. - if ( present(abort) ) abort_on_error = abort - - if ( abort_on_error ) then - write(iulog,*) 'CNST_GET_IND, name:', name, ' not found in list:', cnst_name(:) - call endrun('CNST_GET_IND: name not found') - end if - -! error return - ind = -1 - - end subroutine cnst_get_ind - -!============================================================================================== - - character*3 function cnst_get_type_byind (ind) -!----------------------------------------------------------------------- -! -! Purpose: Get the type of a constituent -! -! Method: -! -! -! -! Author: P. J. Rasch -! -!-----------------------------Arguments--------------------------------- -! - integer, intent(in) :: ind ! global constituent index (in q array) - -!---------------------------Local workspace----------------------------- - integer :: m ! tracer index - -!----------------------------------------------------------------------- - - if (ind.le.pcnst) then - cnst_get_type_byind = cnst_type(ind) - else - ! Unrecognized name - write(iulog,*) 'CNST_GET_TYPE_BYIND, ind:', ind - call endrun - endif - - - end function cnst_get_type_byind - -!============================================================================================== - - character*3 function cnst_get_type_byname (name) -!----------------------------------------------------------------------- -! -! Purpose: Get the type of a constituent -! -! Method: -! -! -! -! Author: P. J. Rasch -! -!-----------------------------Arguments--------------------------------- -! - character(len=*), intent(in) :: name ! constituent name - -!---------------------------Local workspace----------------------------- - integer :: m ! tracer index - -!----------------------------------------------------------------------- - - do m = 1, pcnst - if (name == cnst_name(m)) then - cnst_get_type_byname = cnst_type(m) - return - end if - end do - -! Unrecognized name - write(iulog,*) 'CNST_GET_TYPE_BYNAME, name:', name, ' not found in list:', cnst_name(:) - call endrun - - end function cnst_get_type_byname - - character*5 function cnst_get_molec_byind (ind) -!----------------------------------------------------------------------- -! -! Purpose: Get the molecular diffusion type of a constituent -! -! Method: -! -! -! -! Author: J. McInerney -! -!-----------------------------Arguments--------------------------------- -! - integer, intent(in) :: ind ! global constituent index (in q array) - -!---------------------------Local workspace----------------------------- - integer :: m ! tracer index - -!----------------------------------------------------------------------- - - if (ind.le.pcnst) then - cnst_get_molec_byind = cnst_molec(ind) - else - ! Unrecognized name - write(iulog,*) 'CNST_GET_MOLEC_BYIND, ind:', ind - call endrun - endif - - end function cnst_get_molec_byind - -!============================================================================== - function cnst_read_iv(m) -!----------------------------------------------------------------------- -! -! Purpose: Query whether constituent initial values are read from initial file. -! -! Author: B. Eaton -! -!-----------------------------Arguments--------------------------------- -! - integer, intent(in) :: m ! constituent index - - logical :: cnst_read_iv ! true => read initial values from inital file -!----------------------------------------------------------------------- - - cnst_read_iv = read_init_vals(m) - end function cnst_read_iv - -!============================================================================== - subroutine cnst_chk_dim -!----------------------------------------------------------------------- -! -! Purpose: Check that the number of registered constituents of each type is the -! same as the dimension -! -! Method: -! -! -! -! Author: B.A. Boville -! - integer i,m -!----------------------------------------------------------------------- -! - if (padv /= pcnst) then - write(iulog,*)'CNST_CHK_DIM: number of advected tracer ',padv, ' not equal to pcnst = ',pcnst - call endrun () - endif - - if (masterproc) then - write(iulog,*) 'Advected constituent list:' - do i = 1, pcnst - write(iulog,'(i4,2x,a8,2x,a128,2x,a3)') i, cnst_name(i), cnst_longname(i), cnst_type(i) - end do - end if - - ! Set names of advected tracer diagnostics - do m=1,pcnst - apcnst (m) = trim(cnst_name(m))//'AP' - bpcnst (m) = trim(cnst_name(m))//'BP' - hadvnam (m) = 'HA'//cnst_name(m) - vadvnam (m) = 'VA'//cnst_name(m) - fixcnam (m) = 'DF'//cnst_name(m) - tendnam (m) = 'TE'//cnst_name(m) - ptendnam (m) = 'PTE'//cnst_name(m) - dmetendnam(m) = 'DME'//cnst_name(m) - tottnam (m) = 'TA'//cnst_name(m) - sflxnam(m) = 'SF'//cnst_name(m) - end do - - - end subroutine cnst_chk_dim - -!============================================================================== - -function cnst_cam_outfld(m) -!----------------------------------------------------------------------- -! -! Purpose: -! Query whether default CAM outfld calls should be made. -! -!----------------------------------------------------------------------- - integer, intent(in) :: m ! constituent index - logical :: cnst_cam_outfld ! true => use default CAM outfld calls -!----------------------------------------------------------------------- - - cnst_cam_outfld = cam_outfld_(m) - -end function cnst_cam_outfld - -!============================================================================== - -end module constituents diff --git a/MAMchem_GridComp/microphysics/infnan.F90 b/MAMchem_GridComp/microphysics/infnan.F90 deleted file mode 100644 index ea7af905..00000000 --- a/MAMchem_GridComp/microphysics/infnan.F90 +++ /dev/null @@ -1,35 +0,0 @@ -module infnan -!------------------------------------------------------------------------- -! -! Purpose: -! -! Set parameters for the floating point flags "inf" Infinity -! and "nan" not-a-number. As well as "bigint" the point -! at which integers start to overflow. These values are used -! to initialize arrays with as a way to detect if arrays -! are being used before being set. -! -! Author: CCM Core group -! -! $Id$ -! -!------------------------------------------------------------------------- -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 -#else - use MAPL_ConstantsMod, only: r8 => MAPL_R8 -#endif - -#ifdef __PGI -! quiet nan for portland group compilers - real(r8), parameter :: inf = O'0777600000000000000000' - real(r8), parameter :: nan = O'0777700000000000000000' - integer, parameter :: bigint = O'17777777777' -#else -! signaling nan otherwise - real(r8), parameter :: inf = O'0777600000000000000000' - real(r8), parameter :: nan = O'0777610000000000000000' - integer, parameter :: bigint = O'17777777777' ! largest possible 32-bit integer -#endif - real(r8), parameter :: uninit_r8 = inf ! uninitialized floating point number -end module infnan diff --git a/MAMchem_GridComp/microphysics/modal_aero_amicphys.F90 b/MAMchem_GridComp/microphysics/modal_aero_amicphys.F90 deleted file mode 100644 index a8a84536..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_amicphys.F90 +++ /dev/null @@ -1,6256 +0,0 @@ -!#define CAM_VERSION_IS_ACME - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -!BOP -! -! !MODULE: modal_aero_amicphys --- does modal aerosol gas-aerosol exchange -! -! !INTERFACE: - module modal_aero_amicphys - -! !USES: -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only: endrun - use cam_logfile, only: iulog - use chem_mods, only: gas_pcnst - use physconst, only: pi - use ppgrid, only: pcols, pver - use modal_aero_data, only: ntot_aspectype, ntot_amode, nsoa, npoa, nbc -! use ref_pres, only: top_lev => clim_modal_aero_top_lev ! this is for gg02a - use ref_pres, only: top_lev => trop_cloud_top_lev ! this is for ee02c -#else - use MAPL_ConstantsMod, only: pi => MAPL_PI, r8 => MAPL_R8 - use abortutils, only: endrun - use cam_logfile, only: iulog - use chem_mods, only: gas_pcnst - use modal_aero_data, only: ntot_aspectype, ntot_amode, nsoa, npoa, nbc -#endif - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: - public modal_aero_amicphys_intr, modal_aero_amicphys_init - -! !PUBLIC DATA MEMBERS: - type :: misc_vars_aa_type -! using this derived type reduces the number of changes needed to add more mosaic diagnostics to history - real(r8) :: ncluster_tend_nnuc_1grid -#if ( defined( MOSAIC_SPECIES ) ) - real(r8) :: cnvrg_fail_1grid - real(r8) :: max_kelvin_iter_1grid - real(r8), dimension(5,4) :: xnerr_astem_negative_1grid -#endif - end type misc_vars_aa_type - - logical, public :: mosaic = .false. !BSINGH - Added logical for mosaic model - -#ifdef GEOS5_PORT - integer, parameter :: pcols = 1 - integer, parameter :: pver = 72 - integer, parameter :: top_lev = 1 - - public pcols - public pver - public top_lev - public pcnstxx -#endif - integer, parameter :: pcnstxx = gas_pcnst - -! real(r8), parameter, public :: n_so4_monolayers_pcage = 1.0_r8 - real(r8), parameter, public :: n_so4_monolayers_pcage = 3.0_r8 -! number of so4(+nh4) monolayers needed to "age" a carbon particle - - real(r8), parameter, public :: & - dr_so4_monolayers_pcage = n_so4_monolayers_pcage * 4.76e-10 -! thickness of the so4 monolayers (m) -! for so4(+nh4), use bi-sulfate mw and 1.77 g/cm3, -! --> 1 mol so4(+nh4) = 65 cm^3 --> 1 molecule = (4.76e-10 m)^3 -! aging criterion is approximate so do not try to distinguish -! sulfuric acid, bisulfate, ammonium sulfate - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - integer, public :: cldy_rh_sameas_clear = 0 -! this is only used for some specific box model tests -#endif - - integer, public :: mdo_gaexch_cldy_subarea = 0 -! controls if gas condensation is done in cloudy subarea -! 1 = yes ; 0 = no - - integer, public :: gaexch_h2so4_uptake_optaa = 2 -! controls treatment of h2so4 condensation in mam_gasaerexch_1subarea -! 1 = sequential calc. of gas-chem prod then condensation loss -! 2 = simultaneous calc. of gas-chem prod and condensation loss - - integer, public :: newnuc_h2so4_conc_optaa = 2 -! controls treatment of h2so4 concentrationin mam_newnuc_1subarea -! 1 = use average value calculated in standard cam5.2.10 and earlier -! 2 = use average value calculated in mam_gasaerexch_1subarea -! 11 = use average of initial and final values from mam_gasaerexch_1subarea -! 12 = use final value from mam_gasaerexch_1subarea - - integer, public :: rename_method_optaa = 40 -! controls renaming parameterization - - integer, public :: update_qaerwat = 0 - integer, public :: update_dgncur_a = 0 - integer, public :: update_dgncur_awet = 0 -! controls updating of qaerwat -! controls updating of dgncur_a -! controls updating of dgncur_awet and wetdens_host - - real (r8) :: newnuc_adjust_factor_dnaitdt = 1.0_r8 - real (r8) :: newnuc_adjust_factor_pbl = 1.0_r8 - - -#if ( defined MODAL_AERO_3MODE ) - integer, parameter :: max_gas = nsoa + 1 - integer, parameter :: max_aer = nsoa + npoa + nbc + 3 -#elif ( ( defined MODAL_AERO_4MODE ) && ( defined MOSAIC_SPECIES ) ) - integer, parameter :: max_gas = nsoa + 4 - integer, parameter :: max_aer = nsoa + npoa + nbc + 8 -#elif ( defined MODAL_AERO_4MODE ) - integer, parameter :: max_gas = nsoa + 1 - integer, parameter :: max_aer = nsoa + npoa + nbc + 3 -#elif ( ( defined MODAL_AERO_7MODE ) && ( defined MOSAIC_SPECIES ) ) - integer, parameter :: max_gas = nsoa + 4 - integer, parameter :: max_aer = nsoa + npoa + nbc + 8 -#elif ( defined MODAL_AERO_7MODE ) - integer, parameter :: max_gas = nsoa + 2 - integer, parameter :: max_aer = nsoa + npoa + nbc + 4 -#elif ( defined MODAL_AERO_8MODE ) - integer, parameter :: max_gas = nsoa + 2 - integer, parameter :: max_aer = nsoa + npoa + nbc + 4 -#elif ( defined MODAL_AERO_9MODE ) - integer, parameter :: max_gas = nsoa + 2 - integer, parameter :: max_aer = nsoa + npoa + nbc + 4 + 5 -#endif - -#if ( defined MODAL_AERO_8MODE ) || ( defined MODAL_AERO_4MODE ) - integer, parameter :: ntot_amode_extd = ntot_amode -#else - integer, parameter :: ntot_amode_extd = ntot_amode + 1 -! integer, parameter :: ntot_amode_extd = ntot_amode -#endif - - integer, parameter :: max_mode_fresh = 1 - - integer, parameter :: max_mode = ntot_amode_extd + max_mode_fresh - public max_mode !BSINGH - used in module_mosaic_cam_init.F90 - - integer, parameter :: max_coagpair = 100 - -#if ( defined MODAL_AERO_9MODE ) - integer, parameter :: max_agepair = 3 -#else - integer, parameter :: max_agepair = 1 -#endif - - integer, parameter :: maxsubarea = 2 - - integer, parameter :: nqtendaa = 4 - integer, parameter :: iqtend_cond = 1 - integer, parameter :: iqtend_rnam = 2 - integer, parameter :: iqtend_nnuc = 3 - integer, parameter :: iqtend_coag = 4 - integer, parameter :: nqqcwtendaa = 1 - integer, parameter :: iqqcwtend_rnam = 1 - -#ifdef GEOS5_PORT - public nqtendaa - public iqtend_cond - public iqtend_rnam - public iqtend_nnuc - public iqtend_coag - public nqqcwtendaa - public iqqcwtend_rnam -#endif - - integer, parameter :: iqqcwtend_match_iqtend(nqtendaa) = (/ 0, iqqcwtend_rnam, 0, 0 /) - - logical, parameter :: aging_include_seasalt = .false. - ! when .true., aging (by coagulation) includes contribution of seasalt - ! early versions of mam neglected the seasalt contribution - - ! species indices for various qgas_--- arrays - integer :: igas_soa, igas_h2so4, igas_nh3, igas_hno3, igas_hcl - ! species indices for various qaer_--- arrays - ! when nsoa > 1, igas_soa and iaer_soa are indices of the first soa species - ! when nbc > 1, iaer_bc is index of the first bc species - ! when npom > 1, iaer_pom is index of the first pom species - integer :: iaer_bc, iaer_dst, iaer_ncl, iaer_nh4, iaer_pom, iaer_soa, iaer_so4, & - iaer_mpoly, iaer_mprot, iaer_mlip, iaer_mhum, iaer_mproc, & - iaer_no3, iaer_cl, iaer_ca, iaer_co3 - integer :: i_agepair_pca, i_agepair_macc, i_agepair_mait - integer :: lmap_gas(max_gas) - integer :: lmap_aer(max_aer,max_mode), lmapbb_aer(max_aer,max_mode), & - lmap_aercw(max_aer,max_mode) - integer :: lmap_num(max_mode), lmap_numcw(max_mode) - integer :: lmapcc_all(gas_pcnst) - integer, parameter :: lmapcc_val_gas = 1, lmapcc_val_aer = 2, lmapcc_val_num = 3 - integer :: ngas, naer - integer :: nacc, nait, npca, nufi, nmacc, nmait - - integer :: n_agepair, n_coagpair - integer :: modefrm_agepair(max_agepair), modetoo_agepair(max_agepair) - integer :: mode_aging_optaa(max_mode) - integer :: modefrm_coagpair(max_coagpair), modetoo_coagpair(max_coagpair), & - modeend_coagpair(max_coagpair) - - integer :: lun82, lun97, lun98, lun13n, lun15n - logical :: ldiag82, ldiag97, ldiag98, ldiag13n, ldiag15n - logical :: ldiagd1 - - real(r8) :: accom_coef_gas(max_gas) - real(r8) :: alnsg_aer(max_mode) - real(r8) :: dgnum_aer(max_mode), dgnumhi_aer(max_mode), dgnumlo_aer(max_mode) - real(r8) :: dens_aer(max_aer) - real(r8) :: dens_so4a_host - real(r8) :: fac_m2v_aer(max_aer) ! converts (mol-aero/mol-air) to (m3-aero/mol-air) - real(r8) :: fac_eqvso4hyg_aer(max_aer) ! converts a species volume to a volume of so4 - ! (or nh4hso4) having same hygroscopicity - real(r8) :: fac_m2v_eqvhyg_aer(max_aer) ! = fac_m2v_aer * fac_eqvso4hyg_aer - - real(r8) :: fcvt_gas(max_gas), fcvt_aer(max_aer), fcvt_num, fcvt_wtr - real(r8) :: fcvt_dgnum_dvolmean(max_mode) - real(r8) :: hygro_aer(max_aer) - real(r8) :: mw_gas(max_gas), mw_aer(max_aer) - real(r8) :: mwhost_gas(max_gas), mwhost_aer(max_aer), mwhost_num - real(r8) :: mw_nh4a_host, mw_so4a_host - real(r8) :: mwuse_soa(nsoa), mwuse_poa(npoa) - real(r8) :: sigmag_aer(max_mode) - real(r8) :: vol_molar_gas(max_gas) - -! following were used in aging calcs but are no longer needed -! fac_m2v_so4, fac_m2v_nh4, fac_m2v_soa(:) -! fac_m2v_pcarbon(:) -! soa_equivso4_factor(:) - - - character(len=16) :: name_gas(max_gas), name_aerpfx(max_aer), & - name_aer(max_aer,max_mode), name_aercw(max_aer,max_mode), & - name_num(max_mode), name_numcw(max_mode) - - character(len=8) :: suffix_q_coltendaa(nqtendaa) = & - (/ '_sfgaex1', '_sfgaex2', '_sfnnuc1', '_sfcoag1' /) - character(len=8) :: suffix_qqcw_coltendaa(nqqcwtendaa) = & - '_sfgaex2' - - logical :: do_q_coltendaa(gas_pcnst,nqtendaa) = .false. - logical :: do_qqcw_coltendaa(gas_pcnst,nqqcwtendaa) = .false. - -! *** following 3 variables should eventually be in modal_aero_data - real(r8) :: specmw2_amode(ntot_aspectype,ntot_amode) - real(r8) :: specdens2_amode(ntot_aspectype,ntot_amode) - real(r8) :: spechygro2(ntot_aspectype,ntot_amode) - - -! !DESCRIPTION: This module implements ... -! -! !REVISION HISTORY: -! -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! list private module data here - -!EOC -!---------------------------------------------------------------------- - - - contains - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- -subroutine modal_aero_amicphys_intr( & - mdo_gasaerexch, mdo_rename, & - mdo_newnuc, mdo_coag, & - lchnk, ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - t, pmid, pdel, & - zm, pblh, & -#ifndef GEOS5_PORT - qv, cld, & -#else - qv, cld, rh, & -#endif - q, qqcw, & - q_pregaschem, & - q_precldchem, qqcw_precldchem, & -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - nqtendbb, nqqcwtendbb, & - q_tendbb, qqcw_tendbb, & -#endif - dgncur_a, dgncur_awet, & - wetdens_host, & -#ifdef GEOS5_PORT - q_coltendaa, qqcw_coltendaa, & -#endif - qaerwat ) - - -! !USES: -#ifndef GEOS5_PORT -use cam_history, only: outfld, fieldname_len -use chem_mods, only: adv_mass -use constituents, only: cnst_name -use physconst, only: gravit, mwdry, r_universal -use wv_saturation, only: qsat -use phys_control, only: phys_getopts -#else -use chem_mods, only: adv_mass -use constituents, only: pcnst, cnst_name, cnst_get_ind -use MAPL_ConstantsMod, only: gravit => MAPL_GRAV, mwdry => MAPL_AIRMW, r_universal => MAPL_RUNIV -use MAPL, only: MAPL_EQSAT -#endif - -use modal_aero_data, only: & - cnst_name_cw, & - lmassptr_amode, lmassptrcw_amode, lptr2_soa_g_amode, & - nspec_amode, & - numptr_amode, numptrcw_amode -use modal_aero_newnuc, only: adjust_factor_pbl_ratenucl - - -implicit none - -! !PARAMETERS: - integer, intent(in) :: mdo_gasaerexch, mdo_rename, mdo_newnuc, mdo_coag - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns in the chunk - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: loffset ! offset applied to modal aero "ptrs" - integer, intent(in) :: latndx(pcols), lonndx(pcols) -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - integer, intent(in) :: nqtendbb ! dimension for q_tendbb - integer, intent(in) :: nqqcwtendbb ! dimension for qqcw_tendbb -#endif - - real(r8), intent(in) :: deltat ! time step (s) - - real(r8), intent(inout) :: q(ncol,pver,pcnstxx) ! current tracer mixing ratios (TMRs) - ! these values are updated (so out /= in) - ! *** MUST BE #/kmol-air for number - ! *** MUST BE mol/mol-air for mass - ! *** NOTE ncol dimension - real(r8), intent(inout) :: qqcw(ncol,pver,pcnstxx) - ! like q but for cloud-borner tracers - ! these values are updated - real(r8), intent(in) :: q_pregaschem(ncol,pver,pcnstxx) ! q TMRs before gas-phase chemistry - real(r8), intent(in) :: q_precldchem(ncol,pver,pcnstxx) ! q TMRs before cloud chemistry - real(r8), intent(in) :: qqcw_precldchem(ncol,pver,pcnstxx) ! qqcw TMRs before cloud chemistry -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - real(r8), intent(inout) :: q_tendbb(ncol,pver,pcnstxx,nqtendbb) ! TMR tendencies for box-model diagnostic output - real(r8), intent(inout) :: qqcw_tendbb(ncol,pver,pcnstxx,nqqcwtendbb) -#endif - - real(r8), intent(in) :: t(pcols,pver) ! temperature at model levels (K) - real(r8), intent(in) :: pmid(pcols,pver) ! pressure at model level centers (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure thickness of levels (Pa) - real(r8), intent(in) :: zm(pcols,pver) ! altitude (above ground) at level centers (m) - real(r8), intent(in) :: pblh(pcols) ! planetary boundary layer depth (m) - real(r8), intent(in) :: qv(pcols,pver) ! specific humidity (kg/kg) -#ifdef GEOS5_PORT - real(r8), intent(in) :: rh(pcols,pver) ! relative humidity (0, 1) -#endif - real(r8), intent(in) :: cld(ncol,pver) ! cloud fraction (-) *** NOTE ncol dimension -#ifndef GEOS5_PORT - real(r8), intent(inout) :: dgncur_a(pcols,pver,ntot_amode) - real(r8), intent(inout) :: dgncur_awet(pcols,pver,ntot_amode) - ! dry & wet geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: wetdens_host(pcols,pver,ntot_amode) - ! interstitial aerosol wet density (kg/m3) -#else - real(r8), intent(in) :: dgncur_a(pcols,pver,ntot_amode) - real(r8), intent(in) :: dgncur_awet(pcols,pver,ntot_amode) - ! dry & wet geo. mean dia. (m) of number distrib. - - real(r8), intent(in) :: wetdens_host(pcols,pver,ntot_amode) - ! interstitial aerosol wet density (kg/m3) -#endif - real(r8), intent(inout), optional :: & - qaerwat(pcols,pver,ntot_amode) - ! aerosol water mixing ratio (kg/kg, NOT mol/mol) -#ifdef GEOS5_PORT -! q_coltendaa and qqcw_coltendaa are column-integrated tendencies -! for different processes, which are output to history -! the processes are condensation/evaporation (and associated aging), -! renaming, coagulation, and nucleation - real(r8), intent(out) :: q_coltendaa(pcols,gas_pcnst,nqtendaa ) - real(r8), intent(out) :: qqcw_coltendaa(pcols,gas_pcnst,nqqcwtendaa) -#endif - -! !DESCRIPTION: -! calculates changes to gas and aerosol TMRs (tracer mixing ratios) from -! gas-aerosol exchange (condensation/evaporation) -! growth from smaller to larger modes (renaming) due to both -! condensation and cloud chemistry -! new particle nucleation -! coagulation -! transfer of particles from hydrophobic modes to hydrophilic modes (aging) -! due to condensation and coagulation -! -! the incoming mixing ratios (q and qqcw) are updated before output -! -! !REVISION HISTORY: -! RCE 07.04.13: Adapted from earlier version of CAM5 modal aerosol routines -! for these processes -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! local variables - integer, parameter :: ldiag1=-1, ldiag2=-1, ldiag3=-1, ldiag4=-1 - integer, parameter :: method_soa = 2 -! method_soa=0 is no uptake -! method_soa=1 is irreversible uptake done like h2so4 uptake -! method_soa=2 is reversible uptake using subr modal_aero_soaexch - - integer :: i, icol_diag, ipass, iq - integer :: itmpa, itmpb, itmpc, itmpd - integer :: iqtend, iqqcwtend - integer :: iaer, igas - integer :: j, jac, jsoa, jsub - integer :: jclea, jcldy - integer :: k - integer :: l, l2, l3, la, lb, lc, lmz, lsfrm, lstoo - integer :: lun, lund - integer :: m - integer :: n, niter, niter_max, ntot_soamode - integer :: nsubarea, ncldy_subarea - - logical :: do_cond, do_rename, do_newnuc, do_coag - logical :: iscldy_subarea(maxsubarea) - -#ifdef GEOS5_PORT - integer, parameter :: fieldname_len = 128 -#endif - character(len=fieldname_len+3) :: fieldname - character(len=6) :: tmpch6a, tmpch6c - character(len=200) :: tmp_str - - real (r8) :: pdel_fac - -!---------------------------------------------------------------------- - logical :: history_aerocom ! Output the aerocom history -!----------------------------------------------------------------------- - - - real(8), parameter :: fcld_locutoff = 1.0e-5_r8 -! cloud chemistry is only on when cld(i,k) >= 1.0e-5_r8 -! it may be that the macrophysics has a higher threshold that this - real(8), parameter :: fcld_hicutoff = 0.999_r8 - - real(r8) :: afracsub(maxsubarea) - real(r8) :: dgn_a(max_mode), dgn_awet(max_mode) - real(r8) :: ev_sat(pcols,pver) - real(r8) :: fclea, fcldy, fcldybb - real(r8) :: nufine_3dtend_nnuc(pcols,pver) - real(r8) :: ncluster_3dtend_nnuc(pcols,pver) - real(r8) :: qv_sat(pcols,pver) - real(r8) :: relhumgcm, relhumsub(maxsubarea) - real(r8) :: soag_3dtend_cond(pcols,pver,nsoa) - real(r8) :: tmpa, tmpb, tmpc - real(r8) :: tmp_qa_clea, tmp_qa_cldy, tmp_qa_gcav - real(r8) :: tmp_qc_cldy, tmp_qc_gcav - real(r8) :: tmp_aa, tmp_aa_clea, tmp_aa_cldy - real(r8) :: tmp_kxt, tmp_kxt2, tmp_pxt, tmp_pok - real(r8) :: tmp_q1, tmp_q2, tmp_q3, tmp_q4, tmp_q5, tmp_qdot4 - real(r8) :: wetdens(max_mode) - - -! qgcmN and qqcwgcmN (N=1:4) are grid-cell mean tracer mixing ratios (TMRs, mol/mol or #/kmol) -! N=1 - before gas-phase chemistry -! N=2 - before cloud chemistry -! N=3 - incoming values (before gas-aerosol exchange, newnuc, coag) -! N=4 - outgoing values (after gas-aerosol exchange, newnuc, coag) - real(r8), dimension( 1:gas_pcnst ) :: & - qgcm1, qgcm2, qgcm3, qgcm4, & - qqcwgcm1, qqcwgcm2, qqcwgcm3, qqcwgcm4 - real(r8), dimension( 1:gas_pcnst, 1:nqtendaa ) :: & - qgcm_tendaa - real(r8), dimension( 1:gas_pcnst, 1:nqqcwtendaa ) :: & - qqcwgcm_tendaa - real(r8), dimension( 1:ntot_amode_extd ) :: & - qaerwatgcm3, qaerwatgcm4 ! aerosol water mixing ratios (mol/mol) - -! qsubN and qqcwsubN (N=1:4) are TMRs in sub-areas -! currently there are just clear and cloudy sub-areas -! the N=1:4 have same meanings as for qgcmN - real(r8), dimension( 1:gas_pcnst, 1:maxsubarea ) :: & - qsub1, qsub2, qsub3, qsub4, & - qqcwsub1, qqcwsub2, qqcwsub3, qqcwsub4 - real(r8), dimension( 1:gas_pcnst, 1:nqtendaa, 1:maxsubarea ) :: & - qsub_tendaa - real(r8), dimension( 1:gas_pcnst, 1:nqqcwtendaa, 1:maxsubarea ) :: & - qqcwsub_tendaa - real(r8), dimension( 1:ntot_amode_extd, 1:maxsubarea ) :: & - qaerwatsub3, qaerwatsub4 ! aerosol water mixing ratios (mol/mol) - -#ifndef GEOS5_PORT -! q_coltendaa and qqcw_coltendaa are column-integrated tendencies -! for different processes, which are output to history -! the processes are condensation/evaporation (and associated aging), -! renaming, coagulation, and nucleation - real(r8), dimension( 1:pcols, 1:gas_pcnst, 1:nqtendaa ) :: & - q_coltendaa - real(r8), dimension( 1:pcols, 1:gas_pcnst, 1:nqqcwtendaa ) :: & - qqcw_coltendaa -#endif - -#if ( defined( MOSAIC_SPECIES ) ) - real(r8) :: cnvrg_fail(pcols,pver) !BSINGH - For tracking MOSAIC convergence failures - real(r8) :: max_kelvin_iter(pcols,pver) !BSINGH - For tracking when max is hit for kelvin iterations - real(r8) :: xnerr_astem_negative(pcols,pver,5,4) -#endif - - type ( misc_vars_aa_type ) :: misc_vars_aa - - - - - adjust_factor_pbl_ratenucl = newnuc_adjust_factor_pbl - -#ifndef GEOS5_PORT -#if ( defined CAM_VERSION_IS_ACME ) - history_aerocom = .false. -#else - call phys_getopts( history_aerocom_out = history_aerocom ) -#endif -#else - history_aerocom = .false. -#endif - - icol_diag = -1 - if (ldiag1 > 0) then - if (nstep < 3) then - do i = 1, ncol -! if ((latndx(i) == 23) .and. (lonndx(i) == 37)) icol_diag = i - if ((latndx(i) == 47) .and. (lonndx(i) ==121)) icol_diag = i ! amazon - end do - end if - end if - - do_cond = ( mdo_gasaerexch > 0 ) - do_rename = ( mdo_rename > 0 ) - do_newnuc = ( mdo_newnuc > 0 ) - do_coag = ( mdo_coag > 0 ) - - q_coltendaa = 0.0_r8 ; qqcw_coltendaa = 0.0_r8 - nufine_3dtend_nnuc = 0.0_r8 - ncluster_3dtend_nnuc = 0.0_r8 - soag_3dtend_cond = 0.0_r8 - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) -! these variables otherwise undefined - q_tendbb = 0.0_r8 ; qqcw_tendbb = 0.0_r8 -#endif - -#if ( defined( MOSAIC_SPECIES ) ) - cnvrg_fail(1:pcols,1:pver) = 0.0_r8 - max_kelvin_iter(1:pcols,1:pver) = 0.0_r8 - xnerr_astem_negative(1:pcols,1:pver,1:5,1:4) = 0.0_r8 -#endif - -! turn off history selectively for comparison with dd06f - if ( (.not. do_cond) .and. (.not. do_rename) ) then - do_q_coltendaa(:,iqtend_cond) = .false. - do_q_coltendaa(:,iqtend_rnam) = .false. - do_qqcw_coltendaa(:,iqqcwtend_rnam) = .false. - end if - if ( .not. do_newnuc ) then - do_q_coltendaa(:,iqtend_nnuc) = .false. - end if - if ( .not. do_coag ) then - do_q_coltendaa(:,iqtend_coag) = .false. - end if - -! get saturation mixing ratio -#ifndef GEOS5_PORT - call qsat( t(1:ncol,1:pver), pmid(1:ncol,1:pver), & - ev_sat(1:ncol,1:pver), qv_sat(1:ncol,1:pver) ) -#else - qv_sat(1:ncol,1:pver) = MAPL_EQSAT(t(1:ncol,1:pver), pmid(1:ncol,1:pver)) -#endif - -main_k_loop: & - do k = top_lev, pver -main_i_loop: & - do i = 1, ncol - - if ( ldiag13n ) lun13n = 129 + i - - -! -! determine the number of sub-areas, their fractional areas, and relative humidities -! -! if cloud fraction ~= 0, the grid-cell has a single clear sub-area (nsubarea = 1) -! if cloud fraction ~= 1, the grid-cell has a single cloudy sub-area (nsubarea = 1) -! otherwise, the grid-cell has a clear and a cloudy sub-area (nsubarea = 2) -! - if (cld(i,k) < fcld_locutoff) then -! note that cloud chemistry is only on when cld(i,k) >= 1.0e-5_r8 -! it may be that the macrophysics has a higher threshold that this - fcldy = 0.0_r8 - nsubarea = 1 ; ncldy_subarea = 0 - jclea = 1 ; jcldy = 0 - else if (cld(i,k) > fcld_hicutoff) then - fcldy = 1.0_r8 - nsubarea = 1 ; ncldy_subarea = 1 - jclea = 0 ; jcldy = 1 - else - fcldy = cld(i,k) - nsubarea = 2 ; ncldy_subarea = 1 - jclea = 1 ; jcldy = 2 - end if - fclea = 1.0_r8 - fcldy - fcldybb = max( cld(i,k), 1.0e-6_r8 ) - - iscldy_subarea(:) = .false. - if (jcldy > 0) iscldy_subarea(jcldy) = .true. - - afracsub(:) = 0.0_r8 - if (jclea > 0) afracsub(jclea) = fclea - if (jcldy > 0) afracsub(jcldy) = fcldy -#ifndef GEOS5_PORT - relhumgcm = max( 0.0_r8, min( 1.0_r8, qv(i,k)/qv_sat(i,k) ) ) -#else - relhumgcm = max( 0.0_r8, min( 1.0_r8, rh(i,k) ) ) -#endif - - if (ncldy_subarea <= 0) then - relhumsub(:) = relhumgcm -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - else if (cldy_rh_sameas_clear > 0) then - relhumsub(:) = relhumgcm -#endif - else - relhumsub(jcldy) = 1.0_r8 - if (jclea > 0) then - tmpa = (relhumgcm - afracsub(jcldy))/afracsub(jclea) - relhumsub(jclea) = max( 0.0_r8, min( 1.0_r8, tmpa ) ) - end if - end if - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag13n ) then - write(lun13n,'(/a,3i5)') 'modal_aero_amicphys_intr mapping at nstep, i, k', nstep, i, k - write(lun13n,'(a,1p,5i12 )') 'jclea, jcldy, ncldy, nsubc', & - jclea, jcldy, ncldy_subarea, nsubarea - write(lun13n,'(a,1p,5e12.4)') 'cld, fcldy, fcldybb, fclea', & - cld(i,k), fcldy, fcldybb, fclea - write(lun13n,'(a,1p,5e12.4)') 'relhumav, relhumsub(1:2) ', & - relhumgcm, relhumsub(1:2) - end if -#endif - - - do lmz = 1, gas_pcnst - qgcm1(lmz) = max( 0.0_r8, q_pregaschem(i,k,lmz) ) - qgcm2(lmz) = max( 0.0_r8, q_precldchem(i,k,lmz) ) - qqcwgcm2(lmz) = max( 0.0_r8, qqcw_precldchem(i,k,lmz) ) - qgcm3(lmz) = max( 0.0_r8, q(i,k,lmz) ) - qqcwgcm3(lmz) = max( 0.0_r8, qqcw(i,k,lmz) ) - end do - qaerwatgcm3(:) = 0.0_r8 - if ( present( qaerwat ) ) then - qaerwatgcm3(1:ntot_amode) = max( 0.0_r8, qaerwat(i,k,1:ntot_amode) ) - end if - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - n = min( maxsubarea, nsubarea+1 ) -#else - n = nsubarea -#endif - qsub1(:,1:n) = 0.0_r8 - qsub2(:,1:n) = 0.0_r8 - qsub3(:,1:n) = 0.0_r8 - qsub4(:,1:n) = 0.0_r8 - qqcwsub1(:,1:n) = 0.0_r8 - qqcwsub2(:,1:n) = 0.0_r8 - qqcwsub3(:,1:n) = 0.0_r8 - qqcwsub4(:,1:n) = 0.0_r8 - qaerwatsub3(:,1:n) = 0.0_r8 - qaerwatsub4(:,1:n) = 0.0_r8 - -! -! calculate initial (i.e., before cond/rnam/nnuc/coag) tracer mixing ratios within the sub-areas -! for all-clear or all-cloudy cases, the sub-area TMRs are equal to the grid-cell means -! for partly cloudy case, they are different. This is primarily because the -! interstitial aerosol mixing ratios are assumed lower in the cloudy sub-area than in -! the clear sub-area, because much of the aerosol is activated in the cloudy sub-area. -! - if ( (jclea > 0) .and. (jcldy > 0) .and. & - (jclea+jcldy == 3) .and. (nsubarea == 2) ) then -! partly cloudy case - -! set gas mixing ratios in sub-areas (for the condensing gases only!!) - do lmz = 1, gas_pcnst - if (lmapcc_all(lmz) /= lmapcc_val_gas) cycle - - ! assume gas in both sub-areas before gas-chem and cloud-chem equal grid-cell mean - qsub1(lmz,1:nsubarea) = qgcm1(lmz) - qsub2(lmz,1:nsubarea) = qgcm2(lmz) - - ! assume gas in clear sub-area after cloud-chem equals before cloud-chem value - qsub3(lmz,jclea) = qsub2(lmz,jclea) - ! gas in cloud sub-area then determined by grid-cell mean and clear values - qsub3(lmz,jcldy) = (qgcm3(lmz) - fclea*qsub3(lmz,jclea))/fcldy - ! check that this does not produce a negative value - if (qsub3(lmz,jcldy) < 0.0_r8) then - qsub3(lmz,jcldy) = 0.0_r8 - qsub3(lmz,jclea) = qgcm3(lmz)/fclea - end if - end do - -! set aerosol mixing ratios in sub-areas - do n = 1, ntot_amode - - do l2 = 0, nspec_amode(n) - - if (l2 <= 1) then - ! calculcate partitioning factors - if (l2 == 0) then - la = numptr_amode(n) - loffset - lc = numptrcw_amode(n) - loffset - tmp_qa_gcav = qgcm2(la) - tmp_qc_gcav = qqcwgcm2(lc) - else - tmp_qa_gcav = 0.0_r8 - tmp_qc_gcav = 0.0_r8 - do l3 = 1, nspec_amode(n) - la = lmassptr_amode(l3,n) - loffset - tmp_qa_gcav = tmp_qa_gcav + qgcm2(la) - lc = lmassptrcw_amode(l3,n) - loffset - tmp_qc_gcav = tmp_qc_gcav + qqcwgcm2(lc) - end do - end if - - tmp_qc_cldy = tmp_qc_gcav/fcldy - tmp_qa_cldy = max( 0.0_r8, ((tmp_qa_gcav+tmp_qc_gcav) - tmp_qc_cldy) ) - tmp_qa_clea = (tmp_qa_gcav - fcldy*tmp_qa_cldy)/fclea - - ! *** question *** - ! use same tmp_aa_clea/cldy for everything ? - ! use one for number and one for all masses (based on total mass) ? - ! use separate ones for everything ? - ! maybe one for number and one for all masses is best, - ! because number and mass have different activation fractions - ! *** question *** - tmp_aa = max( 1.e-35_r8, tmp_qa_clea*fclea ) / max( 1.e-35_r8, tmp_qa_gcav ) - tmp_aa = max( 0.0_r8, min( 1.0_r8, tmp_aa ) ) - tmp_aa_clea = tmp_aa/fclea - tmp_aa_cldy = (1.0_r8-tmp_aa)/fcldy - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( n <= 2 .and. ldiag13n ) then - if (n==1 .and. l2==0) write(lun13n,'(a)') - write(lun13n,'(a,2i3, 1p,6e12.4)') 'n, l2, tmp_aa, tmp_aa_clea, tmp_aa_cldy', & - n, l2, tmp_aa, tmp_aa_clea, tmp_aa_cldy - tmpa = 1.0e-6_r8*mwhost_num/mwdry - if (l2 > 0) tmpa = 1.0e9_r8 - write(lun13n,'(a, 6x, 1p,6e12.4)') 'qct, qcy, qat, qay, qax, qtt ', & - tmpa*tmp_qc_gcav, tmpa*tmp_qc_cldy, tmpa*tmp_qa_gcav, & - tmpa*tmp_qa_cldy, tmpa*tmp_qa_clea, tmpa*(tmp_qc_gcav+tmp_qa_gcav) - end if -#endif - end if ! (l2 <= 1) - - if (l2 == 0) then - la = numptr_amode(n) - loffset - lc = numptrcw_amode(n) - loffset - else - la = lmassptr_amode(l2,n) - loffset - lc = lmassptrcw_amode(l2,n) - loffset - end if - - qsub2(la,jclea) = qgcm2(la)*tmp_aa_clea - qsub2(la,jcldy) = qgcm2(la)*tmp_aa_cldy - qqcwsub2(lc,jclea) = 0.0_r8 - qqcwsub2(lc,jcldy) = qqcwgcm2(lc)/fcldy - - qsub3(la,jclea) = qgcm3(la)*tmp_aa_clea - qsub3(la,jcldy) = qgcm3(la)*tmp_aa_cldy - qqcwsub3(lc,jclea) = 0.0_r8 - qqcwsub3(lc,jcldy) = qqcwgcm3(lc)/fcldy - - end do ! l2 - end do ! n - - else if ((jclea == 1) .and. (jcldy == 0) .and. (nsubarea == 1)) then -! all clear, or cld < 1e-5 -! in this case, fclea=1 and fcldy=0 -! -! put all the gases and interstitial aerosols in the clear sub-area -! and set mix-ratios = 0 in cloudy sub-area -! for cloud-borne aerosol, do nothing -! because the grid-cell-mean cloud-borne aerosol will be left unchanged -! (i.e., this routine only changes qqcw when cld >= 1e-5) -! - do lmz = 1, gas_pcnst - if (lmapcc_all(lmz) <= 0) cycle - qsub1(lmz,jclea) = qgcm1(lmz) - qsub2(lmz,jclea) = qgcm2(lmz) - qsub3(lmz,jclea) = qgcm3(lmz) - qqcwsub2(lmz,jclea) = qqcwgcm2(lmz) - qqcwsub3(lmz,jclea) = qqcwgcm3(lmz) - end do - - else if ((jclea == 0) .and. (jcldy == 1) .and. (nsubarea == 1)) then -! all cloudy, or cld > 0.999 -! in this case, fcldy= and fclea=0 -! -! put all the gases and interstitial aerosols in the cloudy sub-area -! and set mix-ratios = 0 in clear sub-area -! - do lmz = 1, gas_pcnst - if (lmapcc_all(lmz) <= 0) cycle - qsub1(lmz,jcldy) = qgcm1(lmz) - qsub2(lmz,jcldy) = qgcm2(lmz) - qsub3(lmz,jcldy) = qgcm3(lmz) - qqcwsub2(lmz,jcldy) = qqcwgcm2(lmz) - qqcwsub3(lmz,jcldy) = qqcwgcm3(lmz) - end do - - else -! this should not happen - write(tmp_str,'(a,3(1x,i10))') & - '*** modal_aero_amicphys - bad jclea, jcldy, nsubarea', & - jclea, jcldy, nsubarea - call endrun( tmp_str ) - end if - -! aerosol water -- how to treat this in sub-areas needs more work/thinking -! currently modal_aero_water_uptake calculates qaerwat using -! the grid-cell mean interstital-aerosol mix-rats and the clear-area rh - do jsub = 1, nsubarea - qaerwatsub3(:,jsub) = qaerwatgcm3(:) - end do - - if (nsubarea == 1) then -! the j=2 subarea is used for some diagnostics -! but is not used in actual calculations - j = 2 - qsub1(:,j) = 0.0_r8 - qsub2(:,j) = 0.0_r8 - qsub3(:,j) = 0.0_r8 - qqcwsub2(:,j) = 0.0_r8 - qqcwsub3(:,j) = 0.0_r8 - end if - - -! diagnostics after forming sub-areas -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag13n ) then - do l2 = 1, 4 - if (l2 == 1) then - igas = igas_h2so4 - else if (l2 == 3) then - igas = igas_nh3 - if (igas <= 0) cycle - else if (l2 == 4) then - igas = -3 - else - igas = 1 - end if - if (igas > 0) then - l = lmap_gas(igas) - tmpch6a = name_gas(igas) - else - l = -igas - tmpch6a = cnst_name(l+loffset) - end if - tmpa = 1.0e9 - write(lun13n,'(a)') - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' host 1-3', & - q_pregaschem(i,k,l)*tmpa, q_precldchem(i,k,l)*tmpa, q(i,k,l)*tmpa - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' gm 1-3', & - qgcm1(l)*tmpa, qgcm2(l)*tmpa, qgcm3(l)*tmpa - j = jclea ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' clear 1-3', & - qsub1(l,j)*tmpa, qsub2(l,j)*tmpa, qsub3(l,j)*tmpa - j = jcldy ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' cloud 1-3', & - qsub1(l,j)*tmpa, qsub2(l,j)*tmpa, qsub3(l,j)*tmpa - end do ! l2 - - n = 1 - do l2 = 1, 3 - if (l2 == 1) then - tmpa = 1.0e-6_r8/28.966_r8 - la = lmap_num(n) - lc = lmap_numcw(n) - tmpch6a = name_num(n) - tmpch6c = name_numcw(n) - else - if (l2 == 2) then - iaer = iaer_so4 - else - iaer = iaer_soa - end if - tmpa = 1.0e9_r8 - la = lmap_aer(iaer,n) - lc = lmap_aercw(iaer,n) - tmpch6a = name_aer(iaer,n) - tmpch6c = name_aercw(iaer,n) - end if - write(lun13n,'(a)') - write(lun13n,'(4a,1p,2(2x,2e12.4))') tmpch6a, ' host 2-3; ', tmpch6c, ' ...', & - q_precldchem(i,k,la)*tmpa, q(i,k,la)*tmpa, & - qqcw_precldchem(i,k,lc)*tmpa, qqcw(i,k,lc)*tmpa - write(lun13n,'(4a,1p,2(2x,2e12.4))') tmpch6a, ' gm 2-3; ', tmpch6c, ' ...', & - qgcm2(la)*tmpa, qgcm3(la)*tmpa, & - qqcwgcm2(lc)*tmpa, qqcwgcm3(lc)*tmpa - j = jclea ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(4a,1p,2(2x,2e12.4))') tmpch6a, ' clear 2-3; ', tmpch6c, ' ...', & - qsub2(la,j)*tmpa, qsub3(la,j)*tmpa, & - qqcwsub2(lc,j)*tmpa, qqcwsub3(lc,j)*tmpa - j = jcldy ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(4a,1p,2(2x,2e12.4))') tmpch6a, ' cloud 2-3; ', tmpch6c, ' ...', & - qsub2(la,j)*tmpa, qsub3(la,j)*tmpa, & - qqcwsub2(lc,j)*tmpa, qqcwsub3(lc,j)*tmpa - end do ! l2 - end if ! ( ldiag13n ) -#endif - -! -! start integration -! - do n = 1, max_mode - if (n <= ntot_amode) then - dgn_a(n) = dgncur_a(i,k,n) - dgn_awet(n) = dgncur_awet(i,k,n) - wetdens(n) = max( 1000.0_r8, wetdens_host(i,k,n) ) - else - dgn_a(n) = 0.0_r8 - dgn_awet(n) = 0.0_r8 - wetdens(n) = 1000.0_r8 - end if - end do - - misc_vars_aa%ncluster_tend_nnuc_1grid = ncluster_3dtend_nnuc(i,k) -#if ( defined ( MOSAIC_SPECIES ) ) - misc_vars_aa%cnvrg_fail_1grid = cnvrg_fail(i,k) - misc_vars_aa%max_kelvin_iter_1grid = max_kelvin_iter(i,k) - misc_vars_aa%xnerr_astem_negative_1grid(1:5,1:4) = xnerr_astem_negative(pcols,pver,1:5,1:4) -#endif - - - lund = iulog ! for cambox, iulog=93 at this point - -! ubroutine mam_amicphys_1gridcell( & -! do_cond, do_rename, & -! do_newnuc, do_coag, & -! nstep, lchnk, i, k, & -! latndx, lonndx, lund, & -! loffset, deltat, & -! nsubarea, ncldy_subarea, & -! iscldy_subarea, afracsub, & -! temp, pmid, pdel, & -! zmid, pblh, relhumsub, & -! dgn_a, dgn_awet, wetdens, & -! qsub1, & -! qsub2, qqcwsub2, & -! qsub3, qqcwsub3, & -! qsub4, qqcwsub4, & -! qsub_tendaa, qqcwsub_tendaa ) - - call mam_amicphys_1gridcell( & - do_cond, do_rename, & - do_newnuc, do_coag, & - nstep, lchnk, i, k, & - latndx(i), lonndx(i), lund, & - loffset, deltat, & - nsubarea, ncldy_subarea, & - iscldy_subarea, afracsub, & - t(i,k), pmid(i,k), pdel(i,k), & - zm(i,k), pblh(i), relhumsub, & - dgn_a, dgn_awet, wetdens, & - qsub1, & - qsub2, qqcwsub2, & - qsub3, qqcwsub3, qaerwatsub3, & - qsub4, qqcwsub4, qaerwatsub4, & - qsub_tendaa, qqcwsub_tendaa, & - misc_vars_aa ) - - -! -! form new grid-mean mix-ratios -! - if (nsubarea == 1) then - qgcm4(:) = qsub4(:,1) - qgcm_tendaa(:,:) = qsub_tendaa(:,:,1) - qaerwatgcm4(1:ntot_amode) = qaerwatsub4(1:ntot_amode,1) - else - qgcm4(:) = 0.0_r8 - qgcm_tendaa(:,:) = 0.0_r8 - do j = 1, nsubarea - qgcm4(:) = qgcm4(:) + qsub4(:,j)*afracsub(j) - qgcm_tendaa(:,:) = qgcm_tendaa(:,:) + qsub_tendaa(:,:,j)*afracsub(j) - end do - ! for aerosol water use the clear sub-area value - qaerwatgcm4(1:ntot_amode) = qaerwatsub4(1:ntot_amode,jclea) - end if - - if (ncldy_subarea <= 0) then - qqcwgcm4(:) = qqcwgcm3(:) - qqcwgcm_tendaa(:,:) = 0.0_r8 - else if (nsubarea == 1) then - qqcwgcm4(:) = qqcwsub4(:,1) - qqcwgcm_tendaa(:,:) = qqcwsub_tendaa(:,:,1) - else - qqcwgcm4(:) = 0.0_r8 - qqcwgcm_tendaa(:,:) = 0.0_r8 - do j = 1, nsubarea - if ( .not. iscldy_subarea(j) ) cycle - qqcwgcm4(:) = qqcwgcm4(:) + qqcwsub4(:,j)*afracsub(j) - qqcwgcm_tendaa(:,:) = qqcwgcm_tendaa(:,:) + qqcwsub_tendaa(:,:,j)*afracsub(j) - end do - end if - - do lmz = 1, gas_pcnst - if (lmapcc_all(lmz) > 0) then - q(i,k,lmz) = qgcm4(lmz) - if (lmapcc_all(lmz) >= lmapcc_val_aer) then - qqcw(i,k,lmz) = qqcwgcm4(lmz) - end if - end if - end do - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if (iqtend_cond <= nqtendbb) q_tendbb(i,k,:,iqtend_cond) = qgcm_tendaa(:,iqtend_cond) - if (iqtend_rnam <= nqtendbb) q_tendbb(i,k,:,iqtend_rnam) = qgcm_tendaa(:,iqtend_rnam) - if (iqtend_nnuc <= nqtendbb) q_tendbb(i,k,:,iqtend_nnuc) = qgcm_tendaa(:,iqtend_nnuc) - if (iqtend_coag <= nqtendbb) q_tendbb(i,k,:,iqtend_coag) = qgcm_tendaa(:,iqtend_coag) - if (iqqcwtend_rnam <= nqqcwtendbb) qqcw_tendbb(i,k,:,iqqcwtend_rnam) = qqcwgcm_tendaa(:,iqqcwtend_rnam) -#endif - if ( update_qaerwat > 0 .and. present( qaerwat ) ) then - qaerwat(i,k,1:ntot_amode) = qaerwatgcm4(1:ntot_amode) - end if - - -! diagnostics after forming sub-areas -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag13n ) then - do l2 = 1, 4 - if (l2 == 1) then - igas = igas_h2so4 - else if (l2 == 3) then - igas = igas_nh3 - if (igas <= 0) cycle - else if (l2 == 4) then - igas = -3 - else - igas = 1 - end if - if (igas > 0) then - l = lmap_gas(igas) - tmpch6a = name_gas(igas) - else - l = -igas - tmpch6a = cnst_name(l+loffset) - end if - tmpa = 1.0e9 - write(lun13n,'(a)') - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' host 1-4', & - q_pregaschem(i,k,l)*tmpa, q_precldchem(i,k,l)*tmpa, 0.0, q(i,k,l)*tmpa - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' gm 1-4', & - qgcm1(l)*tmpa, qgcm2(l)*tmpa, qgcm3(l)*tmpa, qgcm4(l)*tmpa - j = jclea ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' clear 1-4', & - qsub1(l,j)*tmpa, qsub2(l,j)*tmpa, qsub3(l,j)*tmpa, qsub4(l,j)*tmpa - j = jcldy ; if (j <= 0) j = nsubarea+1 - write(lun13n,'(2a,1p,4e12.4)') tmpch6a, ' cloud 1-4', & - qsub1(l,j)*tmpa, qsub2(l,j)*tmpa, qsub3(l,j)*tmpa, qsub4(l,j)*tmpa - end do ! l2 - end if ! ( ldiag13n ) -#endif - - -! increment column tendencies - pdel_fac = pdel(i,k)/gravit - do iqtend = 1, nqtendaa - do l = 1, gas_pcnst - if ( do_q_coltendaa(l,iqtend) ) then - q_coltendaa(i,l,iqtend) = q_coltendaa(i,l,iqtend) + qgcm_tendaa(l,iqtend)*pdel_fac - end if - if (iqtend <= nqqcwtendaa) then - if ( do_qqcw_coltendaa(l,iqtend) ) then - qqcw_coltendaa(i,l,iqtend) = qqcw_coltendaa(i,l,iqtend) + qqcwgcm_tendaa(l,iqtend)*pdel_fac - end if - end if - end do ! l - end do ! iqtend - - if ( history_aerocom ) then - ! 3d soa tendency for aerocom - ! note that flux units (kg/m2/s) are used here instead of tendency units (kg/kg/s or kg/m3/s) - do jsoa = 1, nsoa - l = lptr2_soa_g_amode(jsoa) - loffset - soag_3dtend_cond(i,k,jsoa) = qgcm_tendaa(l,iqtend_cond)*(adv_mass(l)/mwdry)*(pdel(i,k)/gravit) - end do - ! 3d number nucleation tendency for aerocom - units are (#/m3/s) - ! so multiply qgcm_tendaa (#/kmol/s) by air molar density (kmol/m3) - l = numptr_amode(nait) - loffset - nufine_3dtend_nnuc(i,k) = qgcm_tendaa(l,iqtend_nnuc) * (pmid(i,k)/(r_universal*t(i,k))) - end if - - - ncluster_3dtend_nnuc(i,k) = misc_vars_aa%ncluster_tend_nnuc_1grid -#if ( defined ( MOSAIC_SPECIES ) ) - cnvrg_fail(i,k) = misc_vars_aa%cnvrg_fail_1grid - max_kelvin_iter(i,k) = misc_vars_aa%max_kelvin_iter_1grid - xnerr_astem_negative(pcols,pver,1:5,1:4) = misc_vars_aa%xnerr_astem_negative_1grid(1:5,1:4) -#endif - - end do main_i_loop - - end do main_k_loop - - -! output column tendencies to history -! the ordering here is to allow comparison of fort.90 files from box model testing -! but is not important for regular cam simulations - do ipass = 1, 3 - - if (ipass == 1) then - itmpa = iqtend_cond ; itmpb = iqtend_rnam - itmpc = iqqcwtend_rnam ; itmpd = iqqcwtend_rnam - else if (ipass == 2) then - itmpa = iqtend_nnuc ; itmpb = iqtend_nnuc - itmpc = 0 ; itmpd = 0 - else - itmpa = iqtend_coag ; itmpb = iqtend_coag - itmpc = 0 ; itmpd = 0 - end if - - do l = 1, gas_pcnst - do iqtend = itmpa, itmpb - if (iqtend <= 0) cycle - if ( do_q_coltendaa(l,iqtend) ) then - q_coltendaa(1:ncol,l,iqtend) = q_coltendaa(1:ncol,l,iqtend)*(adv_mass(l)/mwdry) - fieldname = trim(cnst_name(l+loffset)) // suffix_q_coltendaa(iqtend) -#ifndef GEOS5_PORT - call outfld( fieldname, q_coltendaa(1:ncol,l,iqtend), ncol, lchnk ) -#endif - end if - end do ! iqtend - do iqqcwtend = itmpc, itmpd - if (iqqcwtend <= 0) cycle - if ( do_qqcw_coltendaa(l,iqqcwtend) ) then - qqcw_coltendaa(1:ncol,l,iqqcwtend) = qqcw_coltendaa(1:ncol,l,iqqcwtend)* (adv_mass(l)/mwdry) - fieldname = trim(cnst_name_cw(l+loffset)) // suffix_qqcw_coltendaa(iqqcwtend) -#ifndef GEOS5_PORT - call outfld( fieldname, qqcw_coltendaa(1:ncol,l,iqqcwtend), ncol, lchnk ) -#endif - end if - end do ! iqqcwtend - end do ! l - - if ( ipass==1 .and. history_aerocom ) then - do jsoa = 1, nsoa - l = lptr2_soa_g_amode(jsoa) - fieldname = trim(cnst_name(l)) // '_sfgaex3d' -#ifndef GEOS5_PORT - call outfld( fieldname, soag_3dtend_cond(1:ncol,:,jsoa), ncol, lchnk ) -#else - ! TODO: export it! -#endif - end do - l = numptr_amode(nait) - fieldname = trim(cnst_name(l)) // '_nuc1' -#ifndef GEOS5_PORT - call outfld( fieldname, nufine_3dtend_nnuc(1:ncol,:), ncol, lchnk ) -#else - ! TODO: export it -#endif - fieldname = trim(cnst_name(l)) // '_nuc2' -#ifndef GEOS5_PORT - call outfld( fieldname, ncluster_3dtend_nnuc(1:ncol,:), ncol, lchnk ) -#else - ! TODO: export it -#endif - end if - - end do ! ipass - -#if ( defined( MOSAIC_SPECIES ) ) - if ( mosaic ) then - !BSINGH - output MOSAIC convergence fail tracking: - call outfld( 'convergence_fail', cnvrg_fail(1:ncol,:), ncol, lchnk ) - call outfld( 'max_kelvin_iter' , max_kelvin_iter(1:ncol,:), ncol, lchnk ) - - do n = 1, 4 - do m = 1, 5 - fieldname = ' ' - write( fieldname(1:16), '(a,i1,a,i1)') 'astem_negval_', m, '_', n - call outfld( fieldname, xnerr_astem_negative(1:ncol,1:pver,m,n), ncol, lchnk ) - end do - end do - end if -#endif - - return -!EOC - end subroutine modal_aero_amicphys_intr - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine mam_amicphys_1gridcell( & - do_cond, do_rename, & - do_newnuc, do_coag, & - nstep, lchnk, i, k, & - latndx, lonndx, lund, & - loffset, deltat, & - nsubarea, ncldy_subarea, & - iscldy_subarea, afracsub, & - temp, pmid, pdel, & - zmid, pblh, relhumsub, & - dgn_a, dgn_awet, wetdens, & - qsub1, & - qsub2, qqcwsub2, & - qsub3, qqcwsub3, qaerwatsub3, & - qsub4, qqcwsub4, qaerwatsub4, & - qsub_tendaa, qqcwsub_tendaa, & - misc_vars_aa ) -! -! calculates changes to gas and aerosol sub-area TMRs (tracer mixing ratios) -! for the current grid cell (with indices = lchnk,i,k) -! qsub3 and qqcwsub3 are the incoming current TMRs -! qsub4 and qqcwsub4 are the outgoing updated TMRs -! - logical, intent(in) :: do_cond, do_rename, do_newnuc, do_coag - logical, intent(in) :: iscldy_subarea(maxsubarea) - - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: loffset - integer, intent(in) :: nsubarea, ncldy_subarea - - real(r8), intent(in) :: deltat ! time step (s) - real(r8), intent(in) :: afracsub(maxsubarea) ! sub-area fractional area (0-1) - - real(r8), intent(in) :: temp ! temperature at model levels (K) - real(r8), intent(in) :: pmid ! pressure at layer center (Pa) - real(r8), intent(in) :: pdel ! pressure thickness of layer (Pa) - real(r8), intent(in) :: zmid ! altitude (above ground) at layer center (m) - real(r8), intent(in) :: pblh ! planetary boundary layer depth (m) - real(r8), intent(in) :: relhumsub(maxsubarea) ! sub-area relative humidity (0-1) - real(r8), intent(inout) :: dgn_a(max_mode) - real(r8), intent(inout) :: dgn_awet(max_mode) - ! dry & wet geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: wetdens(max_mode) - ! interstitial aerosol wet density (kg/m3) - ! dry & wet geo. mean dia. (m) of number distrib. - -! qsubN and qqcwsubN (N=1:4) are tracer mixing ratios (TMRs, mol/mol or #/kmol) in sub-areas -! currently there are just clear and cloudy sub-areas -! the N=1:4 have same meanings as for qgcmN -! N=1 - before gas-phase chemistry -! N=2 - before cloud chemistry -! N=3 - incoming values (before gas-aerosol exchange, newnuc, coag) -! N=4 - outgoing values (after gas-aerosol exchange, newnuc, coag) - real(r8), intent(in ), dimension( 1:gas_pcnst, 1:maxsubarea ) :: & - qsub1, qsub2, qsub3, qqcwsub2, qqcwsub3 - real(r8), intent(inout), dimension( 1:gas_pcnst, 1:maxsubarea ) :: & - qsub4, qqcwsub4 - real(r8), intent(inout), dimension( 1:ntot_amode_extd, 1:maxsubarea ) :: & - qaerwatsub3, qaerwatsub4 ! aerosol water mixing ratios (mol/mol) -! qsub_tendaa and qqcwsub_tendaa are TMR tendencies -! for different processes, which are used to produce history output -! the processes are condensation/evaporation (and associated aging), -! renaming, coagulation, and nucleation - real(r8), intent(inout), dimension( 1:gas_pcnst, 1:nqtendaa, 1:maxsubarea ) :: & - qsub_tendaa - real(r8), intent(inout), dimension( 1:gas_pcnst, 1:nqqcwtendaa, 1:maxsubarea ) :: & - qqcwsub_tendaa - type ( misc_vars_aa_type ), intent(inout) :: misc_vars_aa - -! local - integer :: iaer, igas - integer :: jsub - integer :: l - integer :: n - logical :: do_cond_sub, do_rename_sub, do_newnuc_sub, do_coag_sub - logical :: do_map_gas_sub - - real(r8), dimension( 1:max_gas ) :: & - qgas1, qgas2, qgas3, qgas4 - real(r8), dimension( 1:max_mode ) :: & - qnum2, qnum3, qnum4, & - qnumcw2, qnumcw3, qnumcw4 - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer2, qaer3, qaer4, & - qaercw2, qaercw3, qaercw4 - real(r8), dimension( 1:max_mode ) :: & - qwtr3, qwtr4 - - real(r8), dimension( 1:max_gas, 1:nqtendaa ) :: & - qgas_delaa - real(r8), dimension( 1:max_mode, 1:nqtendaa ) :: & - qnum_delaa - real(r8), dimension( 1:max_mode, 1:nqqcwtendaa ) :: & - qnumcw_delaa - real(r8), dimension( 1:max_aer, 1:max_mode, 1:nqtendaa ) :: & - qaer_delaa - real(r8), dimension( 1:max_aer, 1:max_mode, 1:nqqcwtendaa ) :: & - qaercw_delaa - - real(r8) :: tmpa, tmpb, tmpc, tmpd, tmpe, tmpf, tmpn - - type ( misc_vars_aa_type ), dimension(nsubarea) :: misc_vars_aa_sub - - -! the q--4 values will be equal to q--3 values unless they get changed - qsub4(:,1:nsubarea) = qsub3(:,1:nsubarea) - qqcwsub4(:,1:nsubarea) = qqcwsub3(:,1:nsubarea) - qaerwatsub4(:,1:nsubarea) = qaerwatsub3(:,1:nsubarea) - - qsub_tendaa(:,:,1:nsubarea) = 0.0_r8 - qqcwsub_tendaa(:,:,1:nsubarea) = 0.0_r8 - - do jsub = 1, nsubarea - misc_vars_aa_sub(jsub) = misc_vars_aa - end do - - -main_jsub_loop: & - do jsub = 1, nsubarea - - if ( iscldy_subarea(jsub) .eqv. .true. ) then - do_cond_sub = do_cond - do_rename_sub = do_rename - do_newnuc_sub = .false. - do_coag_sub = .false. - if (mdo_gaexch_cldy_subarea <= 0) do_cond_sub = .false. - else - do_cond_sub = do_cond - do_rename_sub = do_rename - do_newnuc_sub = do_newnuc - do_coag_sub = do_coag - end if - do_map_gas_sub = do_cond_sub .or. do_newnuc_sub - - -! map incoming sub-area mix-ratios to gas/aer/num arrays - - qgas1(:) = 0.0_r8 - qgas2(:) = 0.0_r8 - qgas3(:) = 0.0_r8 - qgas4(:) = 0.0_r8 - if ( do_map_gas_sub .eqv. .true. ) then -! for cldy subarea, only do gases if doing gaexch - do igas = 1, ngas - l = lmap_gas(igas) - qgas1(igas) = qsub1(l,jsub)*fcvt_gas(igas) - qgas2(igas) = qsub2(l,jsub)*fcvt_gas(igas) - qgas3(igas) = qsub3(l,jsub)*fcvt_gas(igas) - qgas4(igas) = qgas3(igas) - end do - end if - - qaer2(:,:) = 0.0_r8 - qnum2(:) = 0.0_r8 - qaer3(:,:) = 0.0_r8 - qnum3(:) = 0.0_r8 - qaer4(:,:) = 0.0_r8 - qnum4(:) = 0.0_r8 - qwtr3(:) = 0.0_r8 - qwtr4(:) = 0.0_r8 - do n = 1, ntot_amode - l = lmap_num(n) - qnum2(n) = qsub2(l,jsub)*fcvt_num - qnum3(n) = qsub3(l,jsub)*fcvt_num - qnum4(n) = qnum3(n) - do iaer = 1, naer - l = lmap_aer(iaer,n) - if (l > 0) then - qaer2(iaer,n) = qsub2(l,jsub)*fcvt_aer(iaer) - qaer3(iaer,n) = qsub3(l,jsub)*fcvt_aer(iaer) - qaer4(iaer,n) = qaer3(iaer,n) - end if - end do - qwtr3(n) = qaerwatsub3(n,jsub)*fcvt_wtr - qwtr4(n) = qwtr3(n) - end do ! n - - if ( iscldy_subarea(jsub) .eqv. .true. ) then -! only do cloud-borne for cloudy - qaercw2(:,:) = 0.0_r8 - qnumcw2(:) = 0.0_r8 - qaercw3(:,:) = 0.0_r8 - qnumcw3(:) = 0.0_r8 - qaercw4(:,:) = 0.0_r8 - qnumcw4(:) = 0.0_r8 - do n = 1, ntot_amode - l = lmap_numcw(n) - qnumcw2(n) = qqcwsub2(l,jsub)*fcvt_num - qnumcw3(n) = qqcwsub3(l,jsub)*fcvt_num - qnumcw4(n) = qnumcw3(n) - do iaer = 1, naer - l = lmap_aercw(iaer,n) - if (l > 0) then - qaercw2(iaer,n) = qqcwsub2(l,jsub)*fcvt_aer(iaer) - qaercw3(iaer,n) = qqcwsub3(l,jsub)*fcvt_aer(iaer) - qaercw4(iaer,n) = qaercw3(iaer,n) - end if - end do - end do ! n - end if - - - if ( iscldy_subarea(jsub) .eqv. .true. ) then - - call mam_amicphys_1subarea_cloudy( & - do_cond_sub, do_rename_sub, & - do_newnuc_sub, do_coag_sub, & - nstep, lchnk, i, k, & - latndx, lonndx, lund, & - loffset, deltat, & - jsub, nsubarea, & - iscldy_subarea(jsub), afracsub(jsub), & - temp, pmid, pdel, & - zmid, pblh, relhumsub(jsub), & - dgn_a, dgn_awet, wetdens, & - qgas1, qgas3, qgas4, & - qgas_delaa, & - qnum3, qnum4, & - qnum_delaa, & - qaer2, qaer3, qaer4, & - qaer_delaa, & - qwtr3, qwtr4, & - qnumcw3, qnumcw4, & - qnumcw_delaa, & - qaercw2, qaercw3, qaercw4, & - qaercw_delaa, & - misc_vars_aa_sub(jsub) ) - - else - - call mam_amicphys_1subarea_clear( & - do_cond_sub, do_rename_sub, & - do_newnuc_sub, do_coag_sub, & - nstep, lchnk, i, k, & - latndx, lonndx, lund, & - loffset, deltat, & - jsub, nsubarea, & - iscldy_subarea(jsub), afracsub(jsub), & - temp, pmid, pdel, & - zmid, pblh, relhumsub(jsub), & - dgn_a, dgn_awet, wetdens, & - qgas1, qgas3, qgas4, & - qgas_delaa, & - qnum3, qnum4, qnum_delaa, & - qaer3, qaer4, qaer_delaa, & - qwtr3, qwtr4, & - misc_vars_aa_sub(jsub) ) - - end if - - if ((nsubarea == 1) .or. (iscldy_subarea(jsub) .eqv. .false.)) then - misc_vars_aa%ncluster_tend_nnuc_1grid = misc_vars_aa%ncluster_tend_nnuc_1grid & - + misc_vars_aa_sub(jsub)%ncluster_tend_nnuc_1grid*afracsub(jsub) -#if ( defined ( MOSAIC_SPECIES ) ) - misc_vars_aa%cnvrg_fail_1grid = misc_vars_aa_sub(jsub)%cnvrg_fail_1grid - misc_vars_aa%max_kelvin_iter_1grid = misc_vars_aa_sub(jsub)%max_kelvin_iter_1grid - misc_vars_aa%xnerr_astem_negative_1grid(1:5,1:4) = misc_vars_aa_sub(jsub)%xnerr_astem_negative_1grid(1:5,1:4) -#endif - end if - - - -! map gas/aer/num arrays (mix-ratio and del=change) back to sub-area arrays - - if ( do_map_gas_sub .eqv. .true. ) then - do igas = 1, ngas - l = lmap_gas(igas) - qsub4(l,jsub) = qgas4(igas)/fcvt_gas(igas) - qsub_tendaa(l,:,jsub) = qgas_delaa(igas,:)/(fcvt_gas(igas)*deltat) - end do - end if - - do n = 1, ntot_amode - l = lmap_num(n) - qsub4(l,jsub) = qnum4(n)/fcvt_num - qsub_tendaa(l,:,jsub) = qnum_delaa(n,:)/(fcvt_num*deltat) - do iaer = 1, naer - l = lmap_aer(iaer,n) - if (l > 0) then - qsub4(l,jsub) = qaer4(iaer,n)/fcvt_aer(iaer) - qsub_tendaa(l,:,jsub) = qaer_delaa(iaer,n,:)/(fcvt_aer(iaer)*deltat) - end if - end do - qaerwatsub4(n,jsub) = qwtr4(n)/fcvt_wtr - - if ( iscldy_subarea(jsub) ) then - l = lmap_numcw(n) - qqcwsub4(l,jsub) = qnumcw4(n)/fcvt_num - qqcwsub_tendaa(l,:,jsub) = qnumcw_delaa(n,:)/(fcvt_num*deltat) - do iaer = 1, naer - l = lmap_aercw(iaer,n) - if (l > 0) then - qqcwsub4(l,jsub) = qaercw4(iaer,n)/fcvt_aer(iaer) - qqcwsub_tendaa(l,:,jsub) = qaercw_delaa(iaer,n,:)/(fcvt_aer(iaer)*deltat) - end if - end do - end if - end do ! n - - - end do main_jsub_loop - - - - return - end subroutine mam_amicphys_1gridcell - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine mam_amicphys_1subarea_cloudy( & - do_cond, do_rename, & - do_newnuc, do_coag, & - nstep, lchnk, i, k, & - latndx, lonndx, lund, & - loffset, deltat, & - jsub, nsubarea, & - iscldy_subarea, afracsub, & - temp, pmid, pdel, & - zmid, pblh, relhum, & - dgn_a, dgn_awet, wetdens, & - qgas1, qgas3, qgas4, & - qgas_delaa, & - qnum3, qnum4, & - qnum_delaa, & - qaer2, qaer3, qaer4, & - qaer_delaa, & - qwtr3, qwtr4, & - qnumcw3, qnumcw4, & - qnumcw_delaa, & - qaercw2, qaercw3, qaercw4, & - qaercw_delaa, & - misc_vars_aa_sub ) -! -! calculates changes to gas and aerosol sub-area TMRs (tracer mixing ratios) -! for a single cloudy sub-area (with indices = lchnk,i,k,jsub) -! qgas3, qaer3, qaercw3, qnum3, qnumcw3 are the current incoming TMRs -! qgas4, qaer4, qaercw4, qnum4, qnumcw4 are the updated outgoing TMRs -! -! when do_cond = false, this routine only calculates changes involving -! growth from smaller to larger modes (renaming) following cloud chemistry -! so gas TMRs are not changed -! when do_cond = true, this routine also calculates changes involving -! gas-aerosol exchange (condensation/evaporation) -! transfer of particles from hydrophobic modes to hydrophilic modes (aging) -! due to condensation -! currently this routine does not do -! new particle nucleation - because h2so4 gas conc. should be very low in cloudy air -! coagulation - because cloud-borne aerosol would need to be included -! -#ifndef GEOS5_PORT - use physconst, only: r_universal -#else - use MAPL_ConstantsMod, only : gravit => MAPL_GRAV, & - mwdry => MAPL_AIRMW, & - rair => MAPL_RDRY, & - r_universal => MAPL_RUNIV -#endif - logical, intent(in) :: do_cond, do_rename, do_newnuc, do_coag - logical, intent(in) :: iscldy_subarea ! true if sub-area is cloudy - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: loffset - integer, intent(in) :: jsub, nsubarea ! sub-area index, number of sub-areas - - real(r8), intent(in) :: afracsub ! fractional area of sub-area (0-1) - real(r8), intent(in) :: deltat ! time step (s) - - real(r8), intent(in) :: temp ! temperature at model levels (K) - real(r8), intent(in) :: pmid ! pressure at layer center (Pa) - real(r8), intent(in) :: pdel ! pressure thickness of layer (Pa) - real(r8), intent(in) :: zmid ! altitude (above ground) at layer center (m) - real(r8), intent(in) :: pblh ! planetary boundary layer depth (m) - real(r8), intent(in) :: relhum ! relative humidity (0-1) - - real(r8), intent(inout) :: dgn_a(max_mode) - real(r8), intent(inout) :: dgn_awet(max_mode) - ! dry & wet geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: wetdens(max_mode) - ! interstitial aerosol wet density (kg/m3) - ! dry & wet geo. mean dia. (m) of number distrib. - -! qXXXN (X=gas,aer,wat,num; N=1:4) are sub-area mixing ratios -! XXX=gas - gas species -! XXX=aer - aerosol mass species (excluding water) -! XXX=wat - aerosol water -! XXX=num - aerosol number -! N=1 - before gas-phase chemistry -! N=2 - before cloud chemistry -! N=3 - current incoming values (before gas-aerosol exchange, newnuc, coag) -! N=4 - updated outgoing values (after gas-aerosol exchange, newnuc, coag) -! -! qXXX_delaa are TMR changes (not tendencies) -! for different processes, which are used to produce history output -! for a clear sub-area, the processes are condensation/evaporation (and associated aging), -! renaming, coagulation, and nucleation - real(r8), intent(in ), dimension( 1:max_gas ) :: & - qgas1, qgas3 - real(r8), intent(inout), dimension( 1:max_gas ) :: & - qgas4 - real(r8), intent(inout), dimension( 1:max_gas, 1:nqtendaa ) :: & - qgas_delaa - - real(r8), intent(in ), dimension( 1:max_mode ) :: & - qnum3 - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum4 - real(r8), intent(inout), dimension( 1:max_mode, 1:nqtendaa ) :: & - qnum_delaa - - real(r8), intent(in ), dimension( 1:max_aer, 1:max_mode ) :: & - qaer2, qaer3 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer4 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode, 1:nqtendaa ) :: & - qaer_delaa - - real(r8), intent(in ), dimension( 1:max_mode ) :: & - qwtr3 - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr4 - - real(r8), intent(in ), dimension( 1:max_mode ) :: & - qnumcw3 - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnumcw4 - real(r8), intent(inout), dimension( 1:max_mode, 1:nqqcwtendaa ) :: & - qnumcw_delaa - - real(r8), intent(in ), dimension( 1:max_aer, 1:max_mode ) :: & - qaercw2, qaercw3 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaercw4 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode, 1:nqqcwtendaa ) :: & - qaercw_delaa - - type ( misc_vars_aa_type ), intent(inout) :: misc_vars_aa_sub - -! local - integer, parameter :: ntot_poaspec = npoa - integer, parameter :: ntot_soaspec = nsoa - - integer :: iaer, igas, ip - integer :: jtsubstep - integer :: ll - integer :: modefrm, modetoo -! if mtoo_renamexf(n) > 0, then mode n gets renamed into mode mtoo_renamexf(n) -! if mtoo_renamexf(n) <= 0, then mode n does not have renaming - integer :: mtoo_renamexf(max_mode) - integer :: n, ntsubstep - integer :: n_mode - integer :: ntot_soamode - - logical, parameter :: flag_pcarbon_opoa_frac_zero = .true. - logical, parameter :: flag_nh4_lt_2so4_each_step = .false. - - logical :: skip_soamode(max_mode) ! true if this mode does not have soa - - real(r8), dimension( 1:max_gas ) :: & - qgas_cur, qgas_sv1, qgas_avg - real(r8), dimension( 1:max_gas ) :: & - qgas_del_cond, qgas_del_nnuc, qgas_netprod_otrproc - ! qgas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (mol/mol/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently only the values for h2so4 and nh3 should be non-zero - -! qxxx_del_yyyy are mix-ratio changes over full time step (deltat) -! qxxx_delsub_yyyy are mix-ratio changes over time sub-step (dtsubstep) - real(r8), dimension( 1:max_mode ) :: & - qnum_cur, qnum_sv1 - real(r8), dimension( 1:max_mode ) :: & - qnum_del_cond, qnum_del_rnam, qnum_del_nnuc, qnum_del_coag, & - qnum_delsub_cond, qnum_delsub_coag - - real(r8), dimension( 1:max_mode ) :: & - qnumcw_cur, qnumcw_sv1 - real(r8), dimension( 1:max_mode ) :: & - qnumcw_del_rnam - - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur, qaer_sv1 - real(r8), dimension( 1:max_aer, 1:max_agepair ) :: & - qaer_delsub_coag_in - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_del_cond, qaer_del_rnam, qaer_del_nnuc, qaer_del_coag, & - qaer_delsub_grow4rnam, & - qaer_delsub_cond, qaer_delsub_coag - - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaercw_cur, qaercw_sv1 - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaercw_del_rnam, & - qaercw_delsub_grow4rnam - - real(r8), dimension( 1:max_mode ) :: & - qwtr_cur - - real(r8) :: aircon ! air molar density (kmol/m3) - real(r8) :: del_h2so4_gasprod - real(r8) :: del_h2so4_aeruptk - real(r8) :: dnclusterdt - real(r8) :: dtsubstep ! time sub-step - real(r8) :: gas_diffus(max_gas) ! gas diffusivity at current temp and pres (m2/s) - real(r8) :: gas_freepath(max_gas) ! gas mean free path at current temp and pres (m) - - real(r8) :: tmpa, tmpb, tmpc, tmpd, tmpe, tmpf - real(r8) :: tmp_relhum - real(r8) :: uptkaer(max_gas,max_mode) - real(r8) :: uptkrate_h2so4 - - - -! air molar density (kmol/m3) - aircon = pmid/(r_universal*temp) - - n_mode = ntot_amode - - qgas_cur = qgas3 - qaer_cur = qaer3 - qnum_cur = qnum3 - qwtr_cur = qwtr3 - qnumcw_cur = qnumcw3 - qaercw_cur = qaercw3 - - - qgas_netprod_otrproc(:) = 0.0_r8 - if ( ( do_cond ) .and. & - ( gaexch_h2so4_uptake_optaa == 2 ) ) then - do igas = 1, ngas - if ((igas == igas_h2so4) .or. (igas == igas_nh3)) then -! if gaexch_h2so4_uptake_optaa == 2, then -! if qgas increases from pre-gaschem to post-cldchem, -! start from the pre-gaschem mix-ratio and add in the production -! during the integration -! if it decreases, -! start from post-cldchem mix-ratio -! *** currently just do this for h2so4 and nh3 - qgas_netprod_otrproc(igas) = (qgas3(igas) - qgas1(igas))/deltat - if ( qgas_netprod_otrproc(igas) >= 0.0_r8 ) then - qgas_cur(igas) = qgas1(igas) - else - qgas_netprod_otrproc(igas) = 0.0_r8 - end if - end if - end do ! igas - end if - - - qgas_del_cond = 0.0_r8 - qgas_del_nnuc = 0.0_r8 - - qaer_del_cond = 0.0_r8 - qaer_del_rnam = 0.0_r8 - qaer_del_nnuc = 0.0_r8 - qaer_del_coag = 0.0_r8 - qaer_delsub_cond = 0.0_r8 - - qaercw_del_rnam = 0.0_r8 - - qnum_del_cond = 0.0_r8 - qnum_del_rnam = 0.0_r8 - qnum_del_nnuc = 0.0_r8 - qnum_del_coag = 0.0_r8 - qnum_delsub_cond = 0.0_r8 - - qnumcw_del_rnam = 0.0_r8 - - dnclusterdt = 0.0_r8 - - - ntsubstep = 1 - dtsubstep = deltat - if (ntsubstep > 1) dtsubstep = deltat/ntsubstep - - del_h2so4_gasprod = max( qgas3(igas_h2so4)-qgas1(igas_h2so4), 0.0_r8 )/ntsubstep - -! -! -! loop over multiple time sub-steps -! -! -jtsubstep_loop: & - do jtsubstep = 1, ntsubstep - - -! -! -! gas-aerosol exchange -! -! - uptkrate_h2so4 = 0.0_r8 -do_cond_if_block10: & - if ( do_cond ) then - - qgas_sv1 = qgas_cur - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - -#if ( defined( MOSAIC_SPECIES ) ) - if ( mosaic ) then - tmp_relhum = min( relhum, 0.98_r8 ) - call mosaic_gasaerexch_1subarea_intr( nstep, &!Intent(ins) - lchnk, i, k, jsub, & - temp, tmp_relhum, pmid, & - aircon, dtsubstep, n_mode, & - dgn_a, dgn_awet, qaer_cur, &!Intent(inouts) - qgas_cur, qnum_cur, qwtr_cur, & - qgas_avg, qgas_netprod_otrproc, & - uptkrate_h2so4, misc_vars_aa_sub ) - else -#endif - call mam_gasaerexch_1subarea( & - nstep, lchnk, & - i, k, jsub, & - jtsubstep, ntsubstep, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - n_mode, & - qgas_cur, qgas_avg, & - qgas_netprod_otrproc, & - qaer_cur, & - qnum_cur, & - qwtr_cur, & - dgn_a, dgn_awet, wetdens, & - uptkaer, uptkrate_h2so4 ) -#if ( defined( MOSAIC_SPECIES ) ) - end if -#endif - - if (newnuc_h2so4_conc_optaa == 11) then - qgas_avg(igas_h2so4) = 0.5_r8*(qgas_sv1(igas_h2so4) + qgas_cur(igas_h2so4)) - else if (newnuc_h2so4_conc_optaa == 12) then - qgas_avg(igas_h2so4) = qgas_cur(igas_h2so4) - end if - - qgas_del_cond = qgas_del_cond + (qgas_cur - (qgas_sv1 + qgas_netprod_otrproc*dtsubstep)) - qnum_delsub_cond = qnum_cur - qnum_sv1 - qaer_delsub_cond = qaer_cur - qaer_sv1 -! qaer_delsub_grow4rnam = change in qaer_del_cond during latest condensation calculations - qaer_delsub_grow4rnam = qaer_cur - qaer_sv1 - - del_h2so4_aeruptk = qgas_cur(igas_h2so4) & - - (qgas_sv1(igas_h2so4) + qgas_netprod_otrproc(igas_h2so4)*dtsubstep) - - else ! do_cond_if_block10 - - qgas_avg(1:ngas) = qgas_cur(1:ngas) - qaer_delsub_grow4rnam(:,:) = 0.0_r8 - - del_h2so4_aeruptk = 0.0_r8 - - end if do_cond_if_block10 - - -! -! -! renaming after "continuous growth" -! -! -do_rename_if_block30: & - if ( do_rename ) then - - mtoo_renamexf(:) = 0 - mtoo_renamexf(nait) = nacc - -! qaer_delsub_grow4rnam = change in qaer from cloud chemistry and gas condensation -! qaercw_delsub_grow4rnam = change in qaercw from cloud chemistry - qaer_delsub_grow4rnam = (qaer3 - qaer2)/ntsubstep + qaer_delsub_grow4rnam - qaercw_delsub_grow4rnam = (qaercw3 - qaercw2)/ntsubstep - - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - qnumcw_sv1 = qnumcw_cur - qaercw_sv1 = qaercw_cur - - call mam_rename_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - iscldy_subarea, & - mtoo_renamexf, & - n_mode, & - qnum_cur, & - qaer_cur, qaer_delsub_grow4rnam, & - qwtr_cur, & - qnumcw_cur, & - qaercw_cur, qaercw_delsub_grow4rnam ) - - qnum_del_rnam = qnum_del_rnam + (qnum_cur - qnum_sv1) - qaer_del_rnam = qaer_del_rnam + (qaer_cur - qaer_sv1) - qnumcw_del_rnam = qnumcw_del_rnam + (qnumcw_cur - qnumcw_sv1) - qaercw_del_rnam = qaercw_del_rnam + (qaercw_cur - qaercw_sv1) - - end if do_rename_if_block30 - - -! -! -! primary carbon aging -! -! - if ( ( n_agepair > 0 ) .and. & - ( do_cond .eqv. .true. ) ) then - - qaer_delsub_coag_in = 0.0_r8 - qaer_delsub_coag = 0.0_r8 - qnum_delsub_coag = 0.0_r8 - - call mam_pcarbon_aging_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, dgn_a, do_cond, & - n_mode, & - qnum_cur, qnum_delsub_cond, qnum_delsub_coag, & - qaer_cur, qaer_delsub_cond, qaer_delsub_coag, & - qaer_delsub_coag_in, & - qwtr_cur ) - - end if - - -! accumulate sub-step q-dels - if ( do_cond ) then - qnum_del_cond = qnum_del_cond + qnum_delsub_cond - qaer_del_cond = qaer_del_cond + qaer_delsub_cond - end if - - end do jtsubstep_loop - - -! -! -! final mix ratios -! -! - qgas4 = qgas_cur - qaer4 = qaer_cur - qnum4 = qnum_cur - qwtr4 = qwtr_cur - qnumcw4 = qnumcw_cur - qaercw4 = qaercw_cur - -! final mix ratio changes - - qgas_delaa(:,iqtend_cond) = qgas_del_cond(:) - qgas_delaa(:,iqtend_rnam) = 0.0_r8 - qgas_delaa(:,iqtend_nnuc) = 0.0_r8 - qgas_delaa(:,iqtend_coag) = 0.0_r8 - - qnum_delaa(:,iqtend_cond) = qnum_del_cond(:) - qnum_delaa(:,iqtend_rnam) = qnum_del_rnam(:) - qnum_delaa(:,iqtend_nnuc) = 0.0_r8 - qnum_delaa(:,iqtend_coag) = 0.0_r8 - - qaer_delaa(:,:,iqtend_cond) = qaer_del_cond(:,:) - qaer_delaa(:,:,iqtend_rnam) = qaer_del_rnam(:,:) - qaer_delaa(:,:,iqtend_nnuc) = 0.0_r8 - qaer_delaa(:,:,iqtend_coag) = 0.0_r8 - - qnumcw_delaa(:,iqqcwtend_rnam) = qnumcw_del_rnam(:) - - qaercw_delaa(:,:,iqqcwtend_rnam) = qaercw_del_rnam(:,:) - - misc_vars_aa_sub%ncluster_tend_nnuc_1grid = dnclusterdt - - return - end subroutine mam_amicphys_1subarea_cloudy - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine mam_amicphys_1subarea_clear( & - do_cond, do_rename, & - do_newnuc, do_coag, & - nstep, lchnk, i, k, & - latndx, lonndx, lund, & - loffset, deltat, & - jsub, nsubarea, & - iscldy_subarea, afracsub, & - temp, pmid, pdel, & - zmid, pblh, relhum, & - dgn_a, dgn_awet, wetdens, & - qgas1, qgas3, qgas4, & - qgas_delaa, & - qnum3, qnum4, qnum_delaa, & - qaer3, qaer4, qaer_delaa, & - qwtr3, qwtr4, & - misc_vars_aa_sub ) -! -! calculates changes to gas and aerosol sub-area TMRs (tracer mixing ratios) -! for a single clear sub-area (with indices = lchnk,i,k,jsub) -! qgas3, qaer3, qnum3 are the current incoming TMRs -! qgas4, qaer4, qnum4 are the updated outgoing TMRs -! -! this routine calculates changes involving -! gas-aerosol exchange (condensation/evaporation) -! growth from smaller to larger modes (renaming) due to condensation -! new particle nucleation -! coagulation -! transfer of particles from hydrophobic modes to hydrophilic modes (aging) -! due to condensation and coagulation -! -#ifndef GEOS5_PORT - use physconst, only: r_universal -#else - use MAPL_ConstantsMod, only : gravit => MAPL_GRAV, & - mwdry => MAPL_AIRMW, & - rair => MAPL_RDRY, & - r_universal => MAPL_RUNIV -#endif - - logical, intent(in) :: do_cond, do_rename, do_newnuc, do_coag - logical, intent(in) :: iscldy_subarea ! true if sub-area is cloudy - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: loffset - integer, intent(in) :: jsub, nsubarea ! sub-area index, number of sub-areas - - real(r8), intent(in) :: afracsub ! fractional area of sub-area (0-1) - real(r8), intent(in) :: deltat ! time step (s) - - real(r8), intent(in) :: temp ! temperature at model levels (K) - real(r8), intent(in) :: pmid ! pressure at layer center (Pa) - real(r8), intent(in) :: pdel ! pressure thickness of layer (Pa) - real(r8), intent(in) :: zmid ! altitude (above ground) at layer center (m) - real(r8), intent(in) :: pblh ! planetary boundary layer depth (m) - real(r8), intent(in) :: relhum ! relative humidity (0-1) - - real(r8), intent(inout) :: dgn_a(max_mode) - real(r8), intent(inout) :: dgn_awet(max_mode) - ! dry & wet geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: wetdens(max_mode) - ! interstitial aerosol wet density (kg/m3) - ! dry & wet geo. mean dia. (m) of number distrib. - -! qXXXN (X=gas,aer,wat,num; N=1:4) are sub-area mixing ratios -! XXX=gas - gas species -! XXX=aer - aerosol mass species (excluding water) -! XXX=wat - aerosol water -! XXX=num - aerosol number -! N=1 - before gas-phase chemistry -! N=2 - before cloud chemistry -! N=3 - current incoming values (before gas-aerosol exchange, newnuc, coag) -! N=4 - updated outgoing values (after gas-aerosol exchange, newnuc, coag) -! -! qXXX_delaa are TMR changes (not tendencies) -! for different processes, which are used to produce history output -! for a clear sub-area, the processes are condensation/evaporation (and associated aging), -! renaming, coagulation, and nucleation - real(r8), intent(in ), dimension( 1:max_gas ) :: & - qgas1, qgas3 - real(r8), intent(inout), dimension( 1:max_gas ) :: & - qgas4 - real(r8), intent(inout), dimension( 1:max_gas, 1:nqtendaa ) :: & - qgas_delaa - - real(r8), intent(in ), dimension( 1:max_mode ) :: & - qnum3 - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum4 - real(r8), intent(inout), dimension( 1:max_mode, 1:nqtendaa ) :: & - qnum_delaa - - real(r8), intent(in ), dimension( 1:max_aer, 1:max_mode ) :: & - qaer3 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer4 - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode, 1:nqtendaa ) :: & - qaer_delaa - - real(r8), intent(in ), dimension( 1:max_mode ) :: & - qwtr3 - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr4 - - type ( misc_vars_aa_type ), intent(inout) :: misc_vars_aa_sub - -! local - integer, parameter :: ntot_poaspec = npoa - integer, parameter :: ntot_soaspec = nsoa - - integer :: iaer, igas, ip - integer :: jtsubstep - integer :: ll - integer :: modefrm, modetoo -! if mtoo_renamexf(n) > 0, then mode n gets renamed into mode mtoo_renamexf(n) -! if mtoo_renamexf(n) <= 0, then mode n does not have renaming - integer :: mtoo_renamexf(max_mode) - integer :: n, ntsubstep - integer :: n_mode - integer :: ntot_soamode - - logical, parameter :: flag_pcarbon_opoa_frac_zero = .true. - logical, parameter :: flag_nh4_lt_2so4_each_step = .false. - - logical :: skip_soamode(max_mode) ! true if this mode does not have soa - - real(r8), dimension( 1:max_gas ) :: & - qgas_cur, qgas_sv1, qgas_avg - real(r8), dimension( 1:max_gas ) :: & - qgas_del_cond, qgas_del_nnuc, qgas_netprod_otrproc - ! qgas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (mol/mol/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently only the values for h2so4 and nh3 should be non-zero - -! qxxx_del_yyyy are mix-ratio changes over full time step (deltat) -! qxxx_delsub_yyyy are mix-ratio changes over time sub-step (dtsubstep) - real(r8), dimension( 1:max_mode ) :: & - qnum_cur, qnum_sv1 - real(r8), dimension( 1:max_mode ) :: & - qnum_del_cond, qnum_del_rnam, qnum_del_nnuc, qnum_del_coag, & - qnum_delsub_cond, qnum_delsub_coag - - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur, qaer_sv1 - real(r8), dimension( 1:max_aer, 1:max_agepair ) :: & - qaer_delsub_coag_in - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_del_cond, qaer_del_rnam, qaer_del_nnuc, qaer_del_coag, & - qaer_delsub_grow4rnam, & - qaer_delsub_cond, qaer_delsub_coag - - real(r8), dimension( 1:max_mode ) :: & - qwtr_cur - - real(r8) :: aircon ! air molar density (kmol/m3) - real(r8) :: del_h2so4_gasprod - real(r8) :: del_h2so4_aeruptk - real(r8) :: dnclusterdt, dnclusterdt_substep - real(r8) :: dtsubstep ! time sub-step - real(r8) :: gas_diffus(max_gas) ! gas diffusivity at current temp and pres (m2/s) - real(r8) :: gas_freepath(max_gas) ! gas mean free path at current temp and pres (m) - - real(r8) :: tmpa, tmpb, tmpc, tmpd, tmpe, tmpf - real(r8) :: uptkaer(max_gas,max_mode) - real(r8) :: uptkrate_h2so4 - - - -! air molar density (kmol/m3) - aircon = pmid/(r_universal*temp) - - n_mode = ntot_amode - - qgas_cur = qgas3 - qaer_cur = qaer3 - qnum_cur = qnum3 - qwtr_cur = qwtr3 - - qgas_netprod_otrproc(:) = 0.0_r8 - if ( ( do_cond ) .and. & - ( gaexch_h2so4_uptake_optaa == 2 ) ) then - do igas = 1, ngas - if ((igas == igas_h2so4) .or. (igas == igas_nh3)) then -! if gaexch_h2so4_uptake_optaa == 2, then -! if qgas increases from pre-gaschem to post-cldchem, -! start from the pre-gaschem mix-ratio and add in the production -! during the integration -! if it decreases, -! start from post-cldchem mix-ratio -! *** currently just do this for h2so4 and nh3 - qgas_netprod_otrproc(igas) = (qgas3(igas) - qgas1(igas))/deltat - if ( qgas_netprod_otrproc(igas) >= 0.0_r8 ) then - qgas_cur(igas) = qgas1(igas) - else - qgas_netprod_otrproc(igas) = 0.0_r8 - end if - end if - end do ! igas - end if - - qgas_del_cond = 0.0_r8 - qgas_del_nnuc = 0.0_r8 - - qaer_del_cond = 0.0_r8 - qaer_del_rnam = 0.0_r8 - qaer_del_nnuc = 0.0_r8 - qaer_del_coag = 0.0_r8 - qaer_delsub_coag_in = 0.0_r8 - qaer_delsub_cond = 0.0_r8 - qaer_delsub_coag = 0.0_r8 - - qnum_del_cond = 0.0_r8 - qnum_del_rnam = 0.0_r8 - qnum_del_nnuc = 0.0_r8 - qnum_del_coag = 0.0_r8 - qnum_delsub_cond = 0.0_r8 - qnum_delsub_coag = 0.0_r8 - - dnclusterdt = 0.0_r8 - - - ntsubstep = 1 - dtsubstep = deltat - if (ntsubstep > 1) dtsubstep = deltat/ntsubstep - - del_h2so4_gasprod = max( qgas3(igas_h2so4)-qgas1(igas_h2so4), 0.0_r8 )/ntsubstep - -! -! -! loop over multiple time sub-steps -! -! -jtsubstep_loop: & - do jtsubstep = 1, ntsubstep - - -! -! -! gas-aerosol exchange -! -! - uptkrate_h2so4 = 0.0_r8 -do_cond_if_block10: & - if ( do_cond ) then - - qgas_sv1 = qgas_cur - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - -#if ( defined( MOSAIC_SPECIES ) ) - if ( mosaic ) then - call mosaic_gasaerexch_1subarea_intr( nstep, &!Intent(ins) - lchnk, i, k, jsub, & - temp, relhum, pmid, & - aircon, dtsubstep, n_mode, & - dgn_a, dgn_awet, qaer_cur, &!Intent(inouts) - qgas_cur, qnum_cur, qwtr_cur, & - qgas_avg, qgas_netprod_otrproc, & - uptkrate_h2so4, misc_vars_aa_sub ) - else -#endif - call mam_gasaerexch_1subarea( & - nstep, lchnk, & - i, k, jsub, & - jtsubstep, ntsubstep, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - n_mode, & - qgas_cur, qgas_avg, & - qgas_netprod_otrproc, & - qaer_cur, & - qnum_cur, & - qwtr_cur, & - dgn_a, dgn_awet, wetdens, & - uptkaer, uptkrate_h2so4 ) -#if ( defined( MOSAIC_SPECIES ) ) - end if -#endif - - if (newnuc_h2so4_conc_optaa == 11) then - qgas_avg(igas_h2so4) = 0.5_r8*(qgas_sv1(igas_h2so4) + qgas_cur(igas_h2so4)) - else if (newnuc_h2so4_conc_optaa == 12) then - qgas_avg(igas_h2so4) = qgas_cur(igas_h2so4) - end if - - qgas_del_cond = qgas_del_cond + (qgas_cur - (qgas_sv1 + qgas_netprod_otrproc*dtsubstep)) - qnum_delsub_cond = qnum_cur - qnum_sv1 - qaer_delsub_cond = qaer_cur - qaer_sv1 -! qaer_del_grow4rnam = change in qaer_del_cond during latest condensation calculations - qaer_delsub_grow4rnam = qaer_cur - qaer_sv1 - - del_h2so4_aeruptk = qgas_cur(igas_h2so4) & - - (qgas_sv1(igas_h2so4) + qgas_netprod_otrproc(igas_h2so4)*dtsubstep) - - else ! do_cond_if_block10 - - qgas_avg(1:ngas) = qgas_cur(1:ngas) - qaer_delsub_grow4rnam(:,:) = 0.0_r8 - - del_h2so4_aeruptk = 0.0_r8 - - end if do_cond_if_block10 - - -! -! -! renaming after "continuous growth" -! -! -do_rename_if_block30: & - if ( do_rename ) then - - mtoo_renamexf(:) = 0 - mtoo_renamexf(nait) = nacc - - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - - call mam_rename_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - iscldy_subarea, & - mtoo_renamexf, & - n_mode, & - qnum_cur, & - qaer_cur, qaer_delsub_grow4rnam, & - qwtr_cur ) - - qnum_del_rnam = qnum_del_rnam + (qnum_cur - qnum_sv1) - qaer_del_rnam = qaer_del_rnam + (qaer_cur - qaer_sv1) - - end if do_rename_if_block30 - - -! -! -! new particle formation (nucleation) -! -! -do_newnuc_if_block50: & - if ( do_newnuc ) then - - qgas_sv1 = qgas_cur - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - - call mam_newnuc_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - zmid, pblh, relhum, & - uptkrate_h2so4, del_h2so4_gasprod, del_h2so4_aeruptk, & - n_mode, & - qgas_cur, qgas_avg, & - qnum_cur, & - qaer_cur, & - qwtr_cur, & - dnclusterdt_substep ) - - qgas_del_nnuc = qgas_del_nnuc + (qgas_cur - qgas_sv1) - qnum_del_nnuc = qnum_del_nnuc + (qnum_cur - qnum_sv1) - qaer_del_nnuc = qaer_del_nnuc + (qaer_cur - qaer_sv1) - dnclusterdt = dnclusterdt + dnclusterdt_substep*(dtsubstep/deltat) - - end if do_newnuc_if_block50 - - -! -! -! coagulation part -! -! - if ( do_coag ) then - - qnum_sv1 = qnum_cur - qaer_sv1 = qaer_cur - - call mam_coag_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - dgn_a, dgn_awet, wetdens, & - n_mode, & - qnum_cur, & - qaer_cur, qaer_delsub_coag_in, & - qwtr_cur ) - - qnum_delsub_coag = qnum_cur - qnum_sv1 - qaer_delsub_coag = qaer_cur - qaer_sv1 - - end if - - -! -! -! primary carbon aging -! -! - if ( n_agepair > 0 ) then - - call mam_pcarbon_aging_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, dgn_a, do_cond, & - n_mode, & - qnum_cur, qnum_delsub_cond, qnum_delsub_coag, & - qaer_cur, qaer_delsub_cond, qaer_delsub_coag, & - qaer_delsub_coag_in, & - qwtr_cur ) - - end if - - -! accumulate sub-step q-dels - if ( do_coag ) then - qnum_del_coag = qnum_del_coag + qnum_delsub_coag - qaer_del_coag = qaer_del_coag + qaer_delsub_coag - end if - if ( do_cond ) then - qnum_del_cond = qnum_del_cond + qnum_delsub_cond - qaer_del_cond = qaer_del_cond + qaer_delsub_cond - end if - - end do jtsubstep_loop - - -! -! -! final mix ratios -! -! - qgas4 = qgas_cur - qaer4 = qaer_cur - qnum4 = qnum_cur - qwtr4 = qwtr_cur - -! final mix ratio changes - - qgas_delaa(:,iqtend_cond) = qgas_del_cond(:) - qgas_delaa(:,iqtend_rnam) = 0.0_r8 - qgas_delaa(:,iqtend_nnuc) = qgas_del_nnuc(:) - qgas_delaa(:,iqtend_coag) = 0.0_r8 - - qnum_delaa(:,iqtend_cond) = qnum_del_cond(:) - qnum_delaa(:,iqtend_rnam) = qnum_del_rnam(:) - qnum_delaa(:,iqtend_nnuc) = qnum_del_nnuc(:) - qnum_delaa(:,iqtend_coag) = qnum_del_coag(:) - - qaer_delaa(:,:,iqtend_cond) = qaer_del_cond(:,:) - qaer_delaa(:,:,iqtend_rnam) = qaer_del_rnam(:,:) - qaer_delaa(:,:,iqtend_nnuc) = qaer_del_nnuc(:,:) - qaer_delaa(:,:,iqtend_coag) = qaer_del_coag(:,:) - - misc_vars_aa_sub%ncluster_tend_nnuc_1grid = dnclusterdt - - return - end subroutine mam_amicphys_1subarea_clear - - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- -#if ( defined( MOSAIC_SPECIES ) ) - subroutine mosaic_gasaerexch_1subarea_intr( nstep, &!Intent(ins) - lchnk, i_in, k_in, jsub_in, & - temp, relhum, pmid, & - aircon, dtsubstep, n_mode, & - dgn_a, dgn_awet, qaer_cur, &!Intent(inouts) - qgas_cur, qnum_cur, qwtr_cur, & - qgas_avg, qgas_netprod_otrproc, & - uptkrate_h2so4, misc_vars_aa_sub ) - !------------------------------------------------------------------------------! - !Purpose: This routine acts as an interface between Mosaic and CAM - !Future work: - !=========== - !1. Clean Mosaic code and get rid of the arguments which stays constant - ! for the entire simulation - !3. Please handle the Mosaic counters, either use pbuf or make them internal to - ! Mosaic - !4. Use get_nstep() for it_mosaic or pull out the it_mosaic .eq. 1 computation - ! to the init routines - !5. SOA from CAM is stored in LIM2 of Mosaic. Rest of the 7 SOA species in - ! Mosaic are populated with zeros - !6. Some variables in Mosaic had to be initialized to zero. Please revisit and - ! fix whatever is necessary - !7. jhyst_leg is constant for now and is equal to jhyst_up - ! - !Author: Balwinder Singh (PNNL) - !------------------------------------------------------------------------------! - !Use statements - use module_mosaic_box_aerchem, only: mosaic_box_aerchemistry - use infnan, only: nan, bigint -#ifndef GEOS5_PORT - use physconst, only: mwh2o -#else - use MAPL_ConstantsMod, only: mwh2o => MAPL_H2OMW -#endif - use module_data_mosaic_aero, only: naer_mosaic => naer, & - inh4_a, ilim2_a, iso4_a, ina_a, icl_a, ibc_a, ioin_a, ioc_a, & - ino3_a, icl_a, ica_a, ico3_a, & - ilim2_g, ih2so4_g, inh3_g, ihno3_g, ihcl_g, & - jhyst_up, jtotal, & - nbin_a, nbin_a_max, ngas_volatile, nmax_astem, nmax_mesa, nsalt, & - mosaic_vars_aa_type -#ifdef SPMD - use spmd_dyn, only: mpicom_xy, iam - use units, only: getunit, freeunit -#endif - - implicit none - - !Args: intent(in) - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: i_in, k_in ! column and level indices - integer, intent(in) :: jsub_in ! subarea index - - real(r8), intent(in) :: temp !Temperature at model levels (K) - real(r8), intent(in) :: relhum !Relative humidity (0-1) - real(r8), intent(in) :: pmid !Pressure at layer center (Pa) - real(r8), intent(in) :: aircon !Air molar density (kmol/m3) - real(r8), intent(in) :: dtsubstep !Time sub-step (s) - integer, intent(in) :: n_mode !current number of active modes - - !Args: intent(inout) - real(r8), intent(inout) :: dgn_a(max_mode) !Dry geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: dgn_awet(max_mode) !Wet geo. mean dia. (m) of number distrib. - real(r8), intent(inout) :: qaer_cur(max_aer,max_mode) !Current aerosol mass mix ratios (mol/mol) - real(r8), intent(inout) :: qgas_cur(max_gas) !Current gas mix ratios (mol/mol) - real(r8), intent(inout) :: qnum_cur(max_mode) !Current aerosol number mix ratios (#/kmol) - real(r8), intent(inout) :: qwtr_cur(max_mode) !Current aerosol water mix ratios (mol/mol) - real(r8), intent(inout) :: qgas_avg(max_gas) !average gas conc. over dtchem time step (mol/mol) - real(r8), intent(inout) :: qgas_netprod_otrproc(max_gas) - ! qgas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (mol/mol/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently only the values for h2so4 and nh3 should be non-zero - real(r8), intent(inout) :: uptkrate_h2so4 ! rate of h2so4 uptake by aerosols (1/s) - type ( misc_vars_aa_type ), intent(inout) :: misc_vars_aa_sub - - !Local Variables - [To be sent as args to Mosaic code] - integer :: ierr -! integer :: it_mosaic !Time step counter for Mosaic -! integer :: jASTEM_fail !Counter to indicate if the ASTEM convergence failed in Mosaic - real(r8) :: dtchem !Timestep in seconds - real(r8) :: T_K !Temperature in K - - - integer :: mcall_load_mosaic_parameters !Flag to decide whether to call 'load_mosaic_parameters' or not(*BALLI not used anymore) - integer :: mcall_print_aer_in !Flag to decide whether to call 'print_aer' or not - - integer, dimension(nbin_a_max) :: jaerosolstate !Aerosol state (solid, liquid, gas) -! integer, dimension(nbin_a_max) :: iter_mesa !MESA iterations counters - integer, dimension(nbin_a_max) :: jaerosolstate_bgn !Aerosol state at the begining (solid, liquid, gas) - integer, dimension(nbin_a_max) :: jhyst_leg - - - real(r8) :: aH2O !Relative humidity in fraction(variaes between 0 and 1) - real(r8) :: P_atm !Pressure in atm units - real(r8) :: RH_pc !Relative humidity in %age(variaes between 0 and 100) - real(r8) :: cair_mol_m3 !Air molar density (mol/m3) - - real(r8), dimension(nbin_a_max) :: water_a !Current aerosol water mix ratios (kg/m3) - real(r8), dimension(nbin_a_max) :: sigmag_a !Geometric standard deviation for aerosol mode - real(r8), dimension(nbin_a_max) :: Dp_dry_a !Dry geo. mean dia. (cm) of number distrib. - - real(r8), dimension(nbin_a_max) :: num_a !Current aerosol number mix ratios (#/cm3) - real(r8), dimension(nbin_a_max) :: dp_wet_a !Diameter of aerosol in (cm) - real(r8), dimension(nbin_a_max) :: mass_dry_a_bgn !g/cc(air) **BALLI*** comment missing - real(r8), dimension(nbin_a_max) :: mass_dry_a !g/cc(air) **BALLI*** comment missing - real(r8), dimension(nbin_a_max) :: dens_dry_a_bgn !g/cc **BALLI*** comment missing - real(r8), dimension(nbin_a_max) :: dens_dry_a !g/cc **BALLI*** comment missing - real(r8), dimension(nbin_a_max) :: water_a_hyst !kg(water)/m^3(air) hysteresis (at 60% RH) **BALLI*** comment missing - real(r8), dimension(nbin_a_max) :: aH2O_a !Relative humidity in fraction(variaes between 0 and 1) - real(r8), dimension(nbin_a_max) :: gam_ratio - - real(r8), dimension(ngas_volatile) :: gas !Current gas mix ratios (nano mol/m3) - real(r8), dimension(ngas_volatile) :: gas_avg ! average gas conc. over dtchem time step (nmol/m3) - real(r8), dimension(ngas_volatile) :: gas_netprod_otrproc - ! gas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (mol/mol/s) - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently for mosaic, only the value for h2so4 can be non-zero - real(r8), dimension(naer_mosaic,3,nbin_a_max) :: aer !Current aerosol mass mix ratios (nano mol/m3) - - !Local Variables - [other local variables] - character(len=500) :: tmp_str, nlfile, sballi -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - character(len=500) :: infile - logical, parameter :: debug_mosaic = .false. - integer, parameter :: iam = 0 -#endif -! logical :: zero_water_flag, flag_itr_kel - integer :: imode, ibin, iaer, igas, istate, isalt, ibin_in, iaer_in, istate_in - integer :: unitn - - !BALLI - Following should be in the modules as parameter - real(r8), parameter :: oneatminv = 1.0_r8/1.01325e5_r8 - !BALLI - Following should be in the modules as parameter - ENDS - - !BSINGH - For converting CAM units to Mosaic units - real(r8) :: nano_mult_cair, aer_tmp - real(r8) :: num_cam_to_mos_units, wtr_cam_to_mos_units - - !BSINGH - For converting Mosaic units to CAM units - real(r8) :: nano_mult_cair_inv - real(r8) :: num_mos_to_cam_units, wtr_mos_to_cam_units - - !BSINGH - For debugging mosiac code -! integer, dimension(6) :: hostgridinfo - integer, dimension(nbin_a_max) :: jaerosolstate_in - integer, dimension(nbin_a_max) :: jhyst_leg_in - - real(r8), dimension(nbin_a_max) :: num_a_in - real(r8), dimension(nbin_a_max) :: dp_wet_a_in - real(r8), dimension(nbin_a_max) :: water_a_in - real(r8), dimension(nbin_a_max) :: sigmag_a_in - real(r8), dimension(nbin_a_max) :: Dp_dry_a_in - - real(r8), dimension(ngas_volatile) :: gas_in, gas_netprod_otrproc_in, gas_avg_in - - real(r8), dimension(naer_mosaic,3,nbin_a_max) :: aer_in - - real(r8), dimension(naer_mosaic) :: kappa_nonelectro - - type (mosaic_vars_aa_type) :: mosaic_vars_aa - - !BSINGH - For storing points having trouble converging - logical,parameter :: convergence_pt_trk = .true. !For tracking points where convergence failed, let the run proceed -! logical :: f_neg_vol_tmp - - - ! allocate the allocatable parts of mosaic_vars_aa - allocate( mosaic_vars_aa%iter_mesa(nbin_a_max), stat=ierr ) - if (ierr /= 0) then - print *, '*** subr mosaic_gasaerexch_1subarea_intr - allocate error for mosaic_vars_aa%iter_mesa' - stop - end if - - - !if(nstep>17 .and. i_in == 14)write(202,*)'AMICPHYS I K:',i_in,k_in,nstep,lchnk - !------------------------------------------------------------! - !------------------------------------------------------------! - !Populate MOSAIC variables - !------------------------------------------------------------! - !------------------------------------------------------------! - - !Counters: - !BSINGH - This counter is internal to Mosaic model. - ! It indicates if ASTEM convergence failed in Mosaic -! jASTEM_fail = 0 - mosaic_vars_aa%jastem_fail = 0 - - !BSINGH - This is time step number in Mosaic -! it_mosaic = nstep - mosaic_vars_aa%it_mosaic = nstep - - !Inputs for Mosaic model (Should be intent-ins for Mosaic model) - aH2O = relhum !Relative humidity [fraction between 0 and 1] - T_K = temp !Temperature in K - P_atm = pmid * oneatminv !Pressure (atm) - RH_pc = aH2O * 100.0_r8 !Relative humidity [%age between 0 and 100] - cair_mol_m3 = aircon * 1000.0_r8 !Air molar density (mol/m3){units conversion: aircon[kmol/m3] * 1.0e3[mol/kmol]} - dtchem = dtsubstep !timestep (s) - - jhyst_leg(1:nbin_a_max) = jhyst_up - - !Flags to control Mosaic model - mcall_load_mosaic_parameters = 1 !**BALLI.. This flag is not used anymore - mcall_print_aer_in = 0 !**BALLI...insert a dummy call to print_aer - - - !Populate aersols - nbin_a = n_mode ! current number of modes - - aer(:,:,:) = 0.0_r8 !initialized to zero - - !Populate aerosol numbers and water species - num_a(:) = 0.0_r8 !Initialized to zero - water_a(:) = 0.0_r8 !initialized to zero - - !BSINGH - units of qnum_cur in CAM are #/kmol of air. In Mosaic, units are #/cm3 - !Units conversion: qnum_cur[#/kmol] * 1.0e-3[kmol/mol] * cair_mol_m3[mol/m3] * 1.0e-6[m3/cm3] - - num_cam_to_mos_units = 1.0e-3_r8 * cair_mol_m3 * 1.0e-6_r8 - - !BSINGH - units for water in CAM are mol/mol. In Mosaic, units are kg/m3 - !Units conversion: qwtr_cur[mol/mol] * mwh2o[g/mol] * cair_mol_m3[mol/m3] * 1.0e-3[kg/g] - - wtr_cam_to_mos_units = mwh2o * cair_mol_m3 * 1.0e-3_r8 - - - nano_mult_cair = cair_mol_m3 * 1.0e9_r8 - - do imode = 1, n_mode - !Notes: - !1. NCL(sea salt) of CAM is mapped in NA and CL of MOSAIC - !2. SOA of CAM is lumped into LIM2 species of MOSAIC !BALLI *ASK RAHUL and Dick - !3. Species NO3, MSA, CO3, Ca do not exist in CAM therefore not mapped here - !4. Species ARO1, ARO2, ALK1, OLE1, API1, API2, LIM1 are SOA species in MOSAIC - ! which are not used in CAM-MOSAIC framework as of now - !5. CAM units are (mol/mol of air) which are converted to Mosaic units (nano mol/m3). - - !Units conversion:qaer_cur[mol/mol] * cair_mol_m3[mol/m3] * 1.0e9[nmol/mol] - aer(inh4_a, jtotal, imode) = qaer_cur(iaer_nh4, imode) * nano_mult_cair - aer(ilim2_a, jtotal, imode) = qaer_cur(iaer_soa, imode) * nano_mult_cair - aer(iso4_a, jtotal, imode) = qaer_cur(iaer_so4, imode) * nano_mult_cair - aer(ina_a, jtotal, imode) = qaer_cur(iaer_ncl, imode) * nano_mult_cair - if (iaer_cl > 0) then - aer(icl_a, jtotal, imode) = qaer_cur(iaer_cl, imode) * nano_mult_cair - else - aer(icl_a, jtotal, imode) = qaer_cur(iaer_ncl, imode) * nano_mult_cair - end if - if (iaer_no3 > 0) & - aer(ino3_a, jtotal, imode) = qaer_cur(iaer_no3, imode) * nano_mult_cair - if (iaer_ca > 0) & - aer(ica_a, jtotal, imode) = qaer_cur(iaer_ca, imode) * nano_mult_cair - if (iaer_co3 > 0) & - aer(ico3_a, jtotal, imode) = qaer_cur(iaer_co3, imode) * nano_mult_cair - - !Units of BC, OC and DST in CAM are (mol/mol of air) and nano-g/m3 in MOSAIC - !Units conversion:qaer_cur[mol/mol] * mw_aer[g/mol] * cair_mol_m3[mol/m3] * 1.0e9[nano-g/g] - aer(ibc_a, jtotal, imode) = qaer_cur(iaer_bc, imode) * mw_aer(iaer_bc) * nano_mult_cair - aer(ioin_a, jtotal, imode) = qaer_cur(iaer_dst, imode) * mw_aer(iaer_dst) * nano_mult_cair !BSINGH - "Other inorganic(oin)" in Mosaic is DST in CAM - aer(ioc_a, jtotal, imode) = qaer_cur(iaer_pom, imode) * mw_aer(iaer_pom) * nano_mult_cair - - !Populate aerosol number and water species - num_a(imode) = qnum_cur(imode) * num_cam_to_mos_units - water_a(imode) = qwtr_cur(imode) * wtr_cam_to_mos_units - end do - - !Populate gases - gas(:) = 0.0_r8 !Initialized to zero - !BSINGH - only 3 gases are avialble in CAM (SOAG, H2SO4, NH3). - !SOAG is stored in LIM2 gas species as of now - !CAM units are (mol/mol of air) which are converted to Mosaic units (nano mol/m3). - gas_avg(:) = 0.0_r8 - - !Units conversion:qgas_cur[mol/mol] * cair_mol_m3[mol/m3] * 10.0e9[nmol/mol] - gas(ilim2_g) = qgas_cur(igas_soa) * nano_mult_cair - gas(ih2so4_g) = qgas_cur(igas_h2so4) * nano_mult_cair - gas(inh3_g) = qgas_cur(igas_nh3) * nano_mult_cair - if (igas_hno3 > 0) & - gas(ihno3_g) = qgas_cur(igas_hno3) * nano_mult_cair - if (igas_hcl > 0) & - gas(ihcl_g) = qgas_cur(igas_hcl) * nano_mult_cair - - !Populate gas_netprod_otrproc - gas_netprod_otrproc(:) = 0.0_r8 - gas_netprod_otrproc(ih2so4_g) = qgas_netprod_otrproc(igas_h2so4) * nano_mult_cair - ! nh3 gas-phase chem production should be zero (unless we include emissions) - ! and doing simultaneous production and condensation in mosaic is more complicated - ! for nh3 that for h2so4 - ! so for now, just add in the production here - gas(inh3_g) = gas(inh3_g) + max( qgas_netprod_otrproc(igas_nh3)*dtchem, 0.0_r8 ) * nano_mult_cair - - - !BSINGH - Initialize the following variables as 'nan' and then assign values to a subset of their dimesions - Dp_dry_a(:) = nan - sigmag_a(:) = nan - dp_wet_a(:) = nan - - sigmag_a(1:n_mode) = sigmag_aer(1:n_mode) !Geometric standard deviation for aerosol mode - !Dry geo. mean dia.(cm) of number distrib [convert from m to cm]!**BALLI: check if it meant to be in,inout or out only and units also - Dp_dry_a(1:n_mode) = dgn_a(1:n_mode) * 100.0_r8 * fcvt_dgnum_dvolmean(1:n_mode) - !Wet geo. mean dia.(cm) of number distrib [convert from m to cm]!**BALLI: check if it meant to be in,inout or out only and untis also - dp_wet_a(1:n_mode) = dgn_awet(1:n_mode) * 100.0_r8 * fcvt_dgnum_dvolmean(1:n_mode) - - - !BSINGH - These are output variables from Mosaic. - !Declared as nan to make sure that they are not inadvertently 'used' before assignment. -! iter_mesa(:) = bigint - mosaic_vars_aa%iter_mesa(1:nbin_a_max) = 0 - jaerosolstate_bgn(:) = bigint - jaerosolstate(:) = bigint - - mass_dry_a_bgn(:) = nan - mass_dry_a(:) = nan - dens_dry_a_bgn(:) = nan - dens_dry_a(:) = nan - water_a_hyst(:) = nan - aH2O_a(:) = nan - gam_ratio(:) = nan - - - !------------------------------------------------------------! - !------------------------------------------------------------! - !END [Populate MOSAIC variables] - !------------------------------------------------------------! - !------------------------------------------------------------! - - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - !BSINGH - This section is required ONLY for the MAM box model - ! to see if it can reproduce errors encountered by the - ! CAM model during runtime(e.g. convergence errors). - ! This block repopulate all the information which is - ! going into the mosaic box (intent-ins and intent-inouts). - ! It is a binary read to preserve the accuracy. - - if(debug_mosaic) then - !Read a binary file which has all the inputs to the mosaic box - !and stop the model - - unitn = 101 - infile = 'mosaic_error_7.bin' - open( unitn, file=trim(infile), status='old', form='unformatted', CONVERT = 'BIG_ENDIAN' ) - - read(unitn)aH2O - read(unitn)T_K - read(unitn)P_atm - read(unitn)RH_pc - read(unitn)dtchem - - do ibin = 1, ntot_amode !nbin_a_max - read(unitn)num_a(ibin),water_a(ibin),Dp_dry_a(ibin), & - sigmag_a(ibin),dp_wet_a(ibin),jhyst_leg(ibin), & - jaerosolstate(ibin) - end do - - - do igas = 1, ngas_volatile - read(unitn) gas(igas), gas_avg(igas), gas_netprod_otrproc(igas) - enddo - - do ibin = 1, ntot_amode !nbin_a_max - do istate = 1, 3 - do iaer = 1 , naer - read(unitn)iaer_in,istate_in,ibin_in, aer_tmp - aer(iaer_in,istate_in,ibin_in) = aer_tmp - end do - end do - end do - close(unitn) - endif - !BSINGH -----xxx ENDS reading file for debugging mosaic xxxx---- -#endif - - - !Store the variables which are intent(inout) to Mosaic box model - !for debuging purposes - aer_in(:,:,:) = aer(:,:,:) - num_a_in(:) = num_a(:) - water_a_in(:) = water_a(:) - gas_in(:) = gas(:) - Dp_dry_a_in(:) = Dp_dry_a(:) - sigmag_a_in(:) = sigmag_a(:) - dp_wet_a_in(:) = dp_wet_a(:) - jhyst_leg_in(:) = jhyst_leg(:) - jaerosolstate_in(:) = jaerosolstate(:) - gas_netprod_otrproc_in(:) = gas_netprod_otrproc(:) - gas_avg_in(:) = gas_avg(:) - - - !BSINGH - zero_water_flag becomes .true. if water is zero in liquid phase -! zero_water_flag = .false. - mosaic_vars_aa%zero_water_flag = .false. - !BSINGH - flag_itr_kel becomes true when kelvin iteration in mdofule_mosaic_ext.F90 are greater then 100 -! flag_itr_kel = .false. - mosaic_vars_aa%flag_itr_kel = .false. - - - !Store grid info -! hostgridinfo(1) = i_in -! hostgridinfo(2) = k_in -! hostgridinfo(3) = lchnk -! hostgridinfo(4:6) = bigint - mosaic_vars_aa%hostgridinfo(1) = i_in - mosaic_vars_aa%hostgridinfo(2) = k_in - mosaic_vars_aa%hostgridinfo(3) = lchnk - mosaic_vars_aa%hostgridinfo(4:6) = bigint - mosaic_vars_aa%it_host = 0 - - - ! *** maybe these should be bigint or nan ??? - mosaic_vars_aa%f_mos_fail = -1 - mosaic_vars_aa%isteps_astem = 0 - mosaic_vars_aa%isteps_astem_max = 0 - mosaic_vars_aa%jastem_call = 0 - mosaic_vars_aa%jmesa_call = 0 - mosaic_vars_aa%jmesa_fail = 0 - mosaic_vars_aa%niter_mesa_max = 0 - mosaic_vars_aa%nmax_astem = nmax_astem - mosaic_vars_aa%nmax_mesa = nmax_mesa - mosaic_vars_aa%cumul_steps_astem = 0.0_r8 - mosaic_vars_aa%niter_mesa = 0.0_r8 - mosaic_vars_aa%xnerr_astem_negative(:,:) = 0.0_r8 - - - ! set kappa values for non-electrolyte species - ! reason for doing this here is that if cam eventually has multiple varieties of dust and/or pom, - ! then the dust hygroscopicity may vary spatially and temporally, - ! and the kappa values cannot be constants - kappa_nonelectro(:) = 0.0_r8 - kappa_nonelectro(ibc_a ) = 0.0001 ! previously kappa_poa = 0.0001 - kappa_nonelectro(ioc_a ) = 0.0001 ! previously kappa_bc = 0.0001 - kappa_nonelectro(ilim2_a) = 0.1 ! previously kappa_soa = 0.1 - kappa_nonelectro(ioin_a ) = 0.06 ! previously kappa_oin = 0.06 - - - !Call MOSAIC parameterization - !BSINGH - jASTEM_fail is in arg list to know if the mosiac model converged or not - !BSINGH - Following variables are not required by CAM but they still exist in the - ! calling arguments as intent-outs as Mosaic model needs them to be in the - ! arg list: - ! gam_ratio, iter_mesa, aH2O_a,jaerosolstate, mass_dry_a_bgn, mass_dry_a, - ! dens_dry_a_bgn, dens_dry_a, water_a_hyst, jaerosolstate_bgn - -! *** ff03h version *** -! call mosaic_box_aerchemistry( & -! hostgridinfo, it_mosaic, aH2O, T_K, &!Intent-ins -! P_atm, RH_pc, dtchem, & -! mcall_load_mosaic_parameters, mcall_print_aer_in, sigmag_a, & -! jaerosolstate, aer, &!Intent-inouts -! num_a, water_a, gas, & -! gas_avg, gas_netprod_otrproc, Dp_dry_a, & -! dp_wet_a, jhyst_leg, zero_water_flag, flag_itr_kel, & -! mass_dry_a_bgn, mass_dry_a, &!Intent-outs -! dens_dry_a_bgn, dens_dry_a, water_a_hyst, aH2O_a, & -! gam_ratio, jaerosolstate_bgn, jASTEM_fail, & -! iter_MESA, f_neg_vol_tmp ) - -! *** ff04a version *** - call mosaic_box_aerchemistry( aH2O, T_K, &!Intent-ins - P_atm, RH_pc, dtchem, & - mcall_load_mosaic_parameters, mcall_print_aer_in, sigmag_a, & - kappa_nonelectro, & - jaerosolstate, aer, &!Intent-inouts - num_a, water_a, gas, & - gas_avg, gas_netprod_otrproc, Dp_dry_a, & - dp_wet_a, jhyst_leg, & - mosaic_vars_aa, & - mass_dry_a_bgn, mass_dry_a, &!Intent-outs - dens_dry_a_bgn, dens_dry_a, water_a_hyst, aH2O_a, & - uptkrate_h2so4, gam_ratio, jaerosolstate_bgn ) - -! *** ff04a version *** -! subr mosaic_box_aerchemistry( aH2O, T_K, &!Intent-ins -! P_atm, RH_pc, dtchem, & -! mcall_load_mosaic_parameters, mcall_print_aer_in, sigmag_a, & -! kappa_nonelectro, & -! jaerosolstate, aer, &!Intent-inouts -! num_a, water_a, gas, & -! gas_avg, gas_netprod_otrproc, Dp_dry_a, & -! dp_wet_a, jhyst_leg, & -! mosaic_vars_aa, & -! mass_dry_a_bgn, mass_dry_a, &!Intent-outs -! dens_dry_a_bgn, dens_dry_a, water_a_hyst, aH2O_a, & -! uptkrate_h2so4, gam_ratio, jaerosolstate_bgn ) - - if (mosaic_vars_aa%flag_itr_kel) then - misc_vars_aa_sub%max_kelvin_iter_1grid = misc_vars_aa_sub%max_kelvin_iter_1grid + 1.0_r8 - endif - - if (mosaic_vars_aa%jASTEM_fail > 0 .or. mosaic_vars_aa%zero_water_flag .or. mosaic_vars_aa%f_mos_fail > 0 ) then !solver in ASTEM didn't converge - - !Let the run proceed and track the points(i,k) where the run fails convergence - if(convergence_pt_trk .and. mosaic_vars_aa%jASTEM_fail > 0 ) then - misc_vars_aa_sub%cnvrg_fail_1grid = misc_vars_aa_sub%cnvrg_fail_1grid + 1.0_r8 - else - !Printout a binary file which has all the inputs to the mosaic box - !and stop the model - - !Generate a unit number and form file name based on process number -#ifdef SPMD - unitn = getunit() - write(tmp_str,*)iam - write(nlfile,*)'mosaic_error_',trim(adjustl(tmp_str)),'.bin' -#else - unitn = 101 - nlfile = 'mosiac_error.txt' -#endif - !Open a binary file, remember it is written out as BIG ENDIAN - open( unitn, file=trim(nlfile), status='unknown', form = 'unformatted' ) - - write(unitn)aH2O !Write relative humidity - write(unitn)T_K !Write relative temp - write(unitn)P_atm !Write relative pressure - write(unitn)RH_pc - write(unitn)dtchem - !Write variables with 'nbin_a_max' dimension - do ibin = 1, ntot_amode!nbin_a_max - write(unitn)num_a_in(ibin),water_a_in(ibin),Dp_dry_a_in(ibin), & - sigmag_a_in(ibin),dp_wet_a_in(ibin),jhyst_leg_in(ibin), & - jaerosolstate_in(ibin) - end do - - !Write gas array - do igas = 1, ngas_volatile - write(unitn) gas_in(igas), gas_avg_in(igas), gas_netprod_otrproc_in(igas) - enddo - - !Write aerosols - do ibin = 1, ntot_amode !nbin_a_max - do istate = 1, 3 - do iaer = 1 , naer_mosaic - write(unitn)iaer,istate,ibin,aer_in(iaer,istate,ibin) - end do - end do - end do - !Close the file - close(unitn) -#ifdef SPMD - !free unit number - call freeunit(unitn) -#endif - !Write error message and stop the model. - write(tmp_str,*) 'Error in Mosaic, jASTEM_fail= ', mosaic_vars_aa%jASTEM_fail, & - ' zero_water_flag: ', mosaic_vars_aa%zero_water_flag, & - ' f_mos_fail:', mosaic_vars_aa%f_mos_fail - call endrun (tmp_str) - endif - endif - - - ! copy other diagnostic outputs (that are written to history) from mosaic_vars_aa to misc_vars_aa_sub - misc_vars_aa_sub%xnerr_astem_negative_1grid(:,:) = mosaic_vars_aa%xnerr_astem_negative(:,:) - - ! deallocate the allocatable parts of mosaic_vars_aa - deallocate( mosaic_vars_aa%iter_mesa, stat=ierr ) - if (ierr /= 0) then - print *, '*** subr mosaic_gasaerexch_1subarea_intr - deallocate error for mosaic_vars_aa%iter_mesa' - stop - end if - - - !------------------------------------------------------------! - !------------------------------------------------------------! - !Process MOSAIC output and store it in CAM data structures - !------------------------------------------------------------! - !------------------------------------------------------------! - !BSINGH - units of qnum_cur in CAM are #/kmol of air. In Mosaic, units are #/cm3 - num_mos_to_cam_units = 1.0_r8/num_cam_to_mos_units !Take inverse of cam_to_mos units - num_cam_to_mos_units = nan !To avoid inadvertent use - - !BSINGH - units for water in CAM are mol/mol. In Mosaic, units are kg/m3 - wtr_mos_to_cam_units = 1.0_r8/wtr_cam_to_mos_units !Take inverse of cam_to_mos units - wtr_cam_to_mos_units = nan !To avoid inadvertent use - - nano_mult_cair_inv = 1.0_r8/nano_mult_cair !Take inverse of cam to mosaic units - nano_mult_cair = nan !To avoid inadvertent use - - do imode = 1, n_mode - !Notes: - !1. NCL(sea salt) of CAM is mapped in NA and CL of MOSAIC - !2. SOA of CAM is lumped into LIM2 species of MOSAIC !BALLI *ASK RAHUL and Dick - !3. Species NO3, MSA, CO3, Ca do not exist in CAM therefore not mapped here - !4. Species ARO1, ARO2, ALK1, OLE1, API1, API2, LIM1 are SOA species in MOSAIC - ! which are not used in CAM-MOSAIC framework as of now - !5. CAM units are (mol/mol of air) and Mosaic units are (nano mol/m3). - - qaer_cur(iaer_nh4, imode) = aer(inh4_a, jtotal , imode) * nano_mult_cair_inv - qaer_cur(iaer_soa, imode) = aer(ilim2_a, jtotal , imode) * nano_mult_cair_inv - qaer_cur(iaer_so4, imode) = aer(iso4_a, jtotal , imode) * nano_mult_cair_inv - qaer_cur(iaer_ncl, imode) = aer(ina_a, jtotal , imode) * nano_mult_cair_inv - if (iaer_cl > 0) & - qaer_cur(iaer_cl, imode) = aer(icl_a, jtotal , imode) * nano_mult_cair_inv - if (iaer_no3 > 0) & - qaer_cur(iaer_no3, imode) = aer(ino3_a, jtotal , imode) * nano_mult_cair_inv - if (iaer_ca > 0) & - qaer_cur(iaer_ca, imode) = aer(ica_a, jtotal , imode) * nano_mult_cair_inv - if (iaer_co3 > 0) & - qaer_cur(iaer_co3, imode) = aer(ico3_a, jtotal , imode) * nano_mult_cair_inv - - !Units of BC, OC and DST in CAM are (mol/mol of air) and nano-g/m3 in MOSAIC - qaer_cur(iaer_bc, imode) = (aer(ibc_a, jtotal , imode)/mw_aer(iaer_bc)) * nano_mult_cair_inv - qaer_cur(iaer_dst, imode) = (aer(ioin_a, jtotal , imode)/mw_aer(iaer_dst)) * nano_mult_cair_inv !BSINGH - "Other inorganic" in Mosaic is DST in CAM - qaer_cur(iaer_pom, imode) = (aer(ioc_a, jtotal , imode)/mw_aer(iaer_pom)) * nano_mult_cair_inv - - !Populate aerosol number and water species - qnum_cur(imode) = num_a(imode) * num_mos_to_cam_units - qwtr_cur(imode) = water_a(imode) * wtr_mos_to_cam_units - end do - - !BSINGH - only 3 gases are avialble in CAM (SOAG, H2SO4, NH3). - !SOAG is stored in LIM2 gas species as of now - - qgas_cur(igas_soa) = gas(ilim2_g) * nano_mult_cair_inv - qgas_cur(igas_h2so4) = gas(ih2so4_g) * nano_mult_cair_inv - qgas_cur(igas_nh3) = gas(inh3_g) * nano_mult_cair_inv - - qgas_avg(igas_soa) = gas_avg(ilim2_g) * nano_mult_cair_inv - qgas_avg(igas_h2so4) = gas_avg(ih2so4_g) * nano_mult_cair_inv - qgas_avg(igas_nh3) = gas_avg(inh3_g) * nano_mult_cair_inv - - if (igas_hno3 > 0) then - qgas_cur(igas_hno3) = gas( ihno3_g) * nano_mult_cair_inv - qgas_avg(igas_hno3) = gas_avg(ihno3_g) * nano_mult_cair_inv - end if - if (igas_hcl > 0) then - qgas_cur(igas_hcl) = gas( ihcl_g) * nano_mult_cair_inv - qgas_avg(igas_hcl) = gas_avg(ihcl_g) * nano_mult_cair_inv - end if - - !update mode diameters - !Dry geo. mean dia.(m) of number distrib [convert from cm to m] - dgn_a(1:n_mode) = Dp_dry_a(1:n_mode) * 0.01_r8 / fcvt_dgnum_dvolmean(1:n_mode) - !Wet geo. mean dia.(m) of number distrib [convert from cm to m] - dgn_awet(1:n_mode) = dp_wet_a(1:n_mode) * 0.01_r8 / fcvt_dgnum_dvolmean(1:n_mode) - - !------------------------------------------------------------! - !------------------------------------------------------------! - !END [Process MOSAIC output ....] - !------------------------------------------------------------! - !------------------------------------------------------------! - - - end subroutine mosaic_gasaerexch_1subarea_intr -#endif - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine mam_gasaerexch_1subarea( & - nstep, lchnk, & - i, k, jsub, & - jtsubstep, ntsubstep, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - n_mode, & - qgas_cur, qgas_avg, & - qgas_netprod_otrproc, & - qaer_cur, & - qnum_cur, & - qwtr_cur, & - dgn_a, dgn_awet, wetdens, & - uptkaer, uptkrate_h2so4 ) - -! uses - - implicit none - -! arguments - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: jtsubstep, ntsubstep ! time substep info from calling routine - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - real(r8), intent(in) :: dtsubstep ! integration timestep (s) - real(r8), intent(in) :: temp ! air temperature (K) - real(r8), intent(in) :: pmid ! air pressure at model levels (Pa) - real(r8), intent(in) :: aircon ! air molar concentration (kmol/m3) - - real(r8), intent(inout), dimension( 1:max_gas ) :: & - qgas_cur, & ! current gas mix ratios (mol/mol) - qgas_avg ! average gas mix ratios over the dtsubstep integration - real(r8), intent(in ), dimension( 1:max_gas ) :: & - qgas_netprod_otrproc - ! qgas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (mol/mol/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently only the values for h2so4 and nh3 should be non-zero - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur ! current aerosol mass mix ratios (mol/mol) - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur ! current aerosol number mix ratios (#/kmol) - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur ! current aerosol water mix ratios (mol/mol) -! qgas/aer/num/wtr_cur values are updated during the dtsubstep integration - - real(r8), intent(inout), dimension( 1:max_mode ) :: & - dgn_a, & ! dry geo. mean dia. (m) of number distrib. - dgn_awet, & ! wet geo. mean dia. (m) of number distrib. - wetdens ! interstitial aerosol wet density (kg/m3) - real(r8), intent(inout), dimension( 1:max_gas, 1:max_mode ) :: & - uptkaer ! gas to aerosol mass transfer rate (1/s) - real(r8), intent(inout) :: uptkrate_h2so4 - ! h2so4(g) to aerosol mass transfer rate, summed over all modes (1/s) - ! this is needed by the nucleation routine (mam_newnuc_1subarea) - -! local - integer :: iaer, igas, ip - integer :: ll - integer :: n - - logical, parameter :: flag_nh4_lt_2so4_each_step = .false. - - real(r8), dimension( 1:max_gas ) :: & - gas_diffus, & ! gas diffusivity at current temp and pres (m2/s) - gas_freepath ! gas mean free path at current temp and pres (m) - - real(r8), dimension( 1:max_gas ) :: & - qgas_prv - - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_prv - - real(r8) :: tmpa, tmpb, tmpc - real(r8) :: tmp_kxt, tmp_kxt2, tmp_pxt, tmp_pok - real(r8) :: tmp_q1, tmp_q2, tmp_q3, tmp_q4, tmp_q5 - real(r8) :: tmp_qdel_cond - real(r8) :: uptkrate(max_mode) - - - qgas_avg(1:ngas) = 0.0_r8 - - -! calc gas uptake (mass transfer) rates - if (jtsubstep == 1) then - - tmpa = pmid/1.013e5_r8 - do igas = 1, ngas - gas_diffus(igas) = gas_diffusivity( & - temp, tmpa, mw_gas(igas), vol_molar_gas(igas) ) - - tmpb = mean_molecular_speed( temp, mw_gas(igas) ) - - gas_freepath(igas) = 3.0_r8 * gas_diffus(igas) / tmpb - - call gas_aer_uptkrates_1box1gas( & - accom_coef_gas(igas), gas_diffus(igas), gas_freepath(igas), & - 0.0_r8, ntot_amode, dgn_awet, alnsg_aer, uptkrate ) - - iaer = igas - do n = 1, ntot_amode - ! uptkrate is for number = 1 #/m3, so mult. by number conc. (#/m3) - uptkaer(igas,n) = uptkrate(n) * (qnum_cur(n) * aircon) - end do - end do ! igas - - do igas = 1, ngas - ! use cam5.1.00 uptake rates - if (igas <= nsoa ) uptkaer(igas,1:ntot_amode) = uptkaer(igas_h2so4,1:ntot_amode)*0.81 - if (igas == igas_nh3) uptkaer(igas,1:ntot_amode) = uptkaer(igas_h2so4,1:ntot_amode)*2.08 - end do ! igas - - do igas = 1, ngas - iaer = igas - do n = 1, ntot_amode - if ( lmap_aer(iaer,n) > 0 .or. & - mode_aging_optaa(n) > 0 ) cycle - uptkaer(igas,n) = 0.0_r8 ! do this last - end do - end do ! igas - - uptkrate_h2so4 = sum( uptkaer(igas_h2so4,1:ntot_amode) ) - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( k == pver .and. ldiagd1 ) write(lund,'(a,2i4,1p,10e11.3)') 'i,k,h2so4_uprt', i, k, uptkaer(igas_h2so4,1:ntot_amode) -! if (i==1 .and. k==4) then -! write(*,*) 'uptake rates at i=1, k=4, igas down, nmode across' -! do igas = 1, ngas -! write(*,'(1p,10e10.2)') uptkaer(igas,1:ntot_amode) -! end do -! write(*,*) 'dgn_awet then sigmag then qnum' -! write(*,'(1p,10e10.2)') dgn_awet(1:ntot_amode) -! write(*,'(1p,10e10.2)') sigmag_aer(1:ntot_amode) -! write(*,'(1p,10e10.2)') qnum_cur(1:ntot_amode) -! end if -#endif - - end if ! (jtsubstep == 1) - - -! do soa - call mam_soaexch_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - n_mode, & - qgas_cur, qgas_avg, & - qaer_cur, & - qnum_cur, & - qwtr_cur, & - uptkaer ) - - -! do other gases (that are assumed non-volatile) with no time sub-stepping - do igas = nsoa+1, ngas - iaer = igas - qgas_prv(igas) = qgas_cur(igas) - qaer_prv(iaer,1:n_mode) = qaer_cur(iaer,1:n_mode) - end do - - do igas = nsoa+1, ngas - iaer = igas - if ( (igas == igas_hno3) .or. & - (igas == igas_hcl ) ) cycle - - tmpa = sum( uptkaer(igas,1:n_mode) ) - tmp_kxt = tmpa*dtsubstep - tmp_pxt = qgas_netprod_otrproc(igas)*dtsubstep - tmp_q1 = qgas_prv(igas) - ! tmp_q1 = mix-rat at t=tcur - ! tmp_q3 = mix-rat at t=tcur+dtsubstep - ! tmp_q4 = avg mix-rat between t=tcur and t=tcur+dtsubstep - if (tmp_kxt >= 1.0e-20_r8) then - if (tmp_kxt > 0.001_r8) then - tmp_pok = tmp_pxt/tmp_kxt - tmp_q3 = (tmp_q1 - tmp_pok)*exp(-tmp_kxt) + tmp_pok - tmp_q4 = (tmp_q1 - tmp_pok)*(1.0_r8 - exp(-tmp_kxt))/tmp_kxt + tmp_pok - else - tmp_kxt2 = tmp_kxt*tmp_kxt - tmp_q3 = tmp_q1 *(1.0_r8 - tmp_kxt + tmp_kxt2*0.5_r8) & - + tmp_pxt*(1.0_r8 - tmp_kxt*0.5_r8 + tmp_kxt2/6.0_r8) - tmp_q4 = tmp_q1 *(1.0_r8 - tmp_kxt*0.5_r8 + tmp_kxt2/6.0_r8) & - + tmp_pxt*(0.5_r8 - tmp_kxt/6.0_r8 + tmp_kxt2/24.0_r8) - end if - qgas_cur(igas) = tmp_q3 - tmp_qdel_cond = (tmp_q1 + tmp_pxt) - tmp_q3 - qgas_avg(igas) = tmp_q4 - do n = 1, n_mode - if (uptkaer(igas,n) <= 0.0_r8) cycle - tmpc = tmp_qdel_cond*(uptkaer(igas,n)/tmpa) - qaer_cur(iaer,n) = qaer_prv(iaer,n) + tmpc - end do - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag82 ) then - if (i==1 .and. k==pver .and. igas==igas_h2so4) then - tmp_q2 = tmp_q1 + tmp_pxt - - write(lun82,'(/a,2i5,1p,8e17.9)') 'gasaer - i, k, sum_uprt_so4, qav', & - i, k, tmpa, -1.0 - tmp_q2 = max( 1.0e-30_r8, tmp_q2 ) - write(lun82,'(/a,2i5,1p,8e17.9)') 'gasaer - i, k, q1, q2, q3, q4 ', & - i, k, tmp_q1, tmp_q2, tmp_q3, tmp_q4 - write(lun82,'(/a,2i5,1p,8e17.9)') 'gasaer - i, k, k*t, p*t, p/k, t ', & - i, k, tmp_kxt, tmp_pxt, tmp_pok, dtsubstep, tmp_qdel_cond - end if - end if -#endif - - else - ! tmp_kxt < 1.0e-20_r8 so uptake to aerosols ~= 0.0 - ! in this case, do not bother to update qaer_cur - tmp_q3 = tmp_q1 + tmp_pxt - tmp_q4 = tmp_q1 + tmp_pxt*0.5_r8 - qgas_cur(igas) = tmp_q3 - qgas_avg(igas) = tmp_q4 - end if - end do ! igas - - if ( igas_nh3 > 0 ) then -! do not allow nh4 to exceed 2*so4 (molar basis) - iaer = iaer_nh4 ; igas = igas_nh3 - do n = 1, n_mode - if (uptkaer(igas,n) <= 0.0_r8) cycle - tmpa = qaer_cur(iaer,n) - 2.0_r8*qaer_cur(iaer_so4,n) - if (tmpa > 0.0_r8) then - qaer_cur(iaer,n) = qaer_cur(iaer,n) - tmpa - qgas_cur(igas) = qgas_cur(igas) + tmpa - qgas_avg(igas) = qgas_avg(igas) + tmpa*0.5_r8 - end if - end do - end if - - - return - end subroutine mam_gasaerexch_1subarea - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine mam_soaexch_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - dtsubstep, & - temp, pmid, aircon, & - n_mode, & - qgas_cur, qgas_avg, & - qaer_cur, & - qnum_cur, & - qwtr_cur, & - uptkaer ) -! -! calculate soa condensation/evaporation for i,k,jsub over time dtsubstep -! - -! uses - use modal_aero_data, only: lptr2_soa_a_amode - - - implicit none - -! arguments - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - real(r8), intent(in) :: dtsubstep ! current integration timestep (s) - real(r8), intent(in) :: temp ! temperature (K) - real(r8), intent(in) :: pmid ! pressure at model levels (Pa) - real(r8), intent(in) :: aircon ! air molar concentration (kmol/m3) - - real(r8), intent(inout), dimension( 1:max_gas ) :: & - qgas_cur, qgas_avg - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur - real(r8), intent(in ), dimension( 1:max_gas, 1:max_mode ) :: & - uptkaer - -! local - integer, parameter :: ntot_poaspec = npoa - integer, parameter :: ntot_soaspec = nsoa - - integer :: iaer, igas, ip - integer :: ll - integer :: n, niter, niter_max - integer :: ntot_soamode - - logical, parameter :: flag_pcarbon_opoa_frac_zero = .true. - - logical :: skip_soamode(max_mode) ! true if this mode does not have soa - - real(r8), dimension( 1:max_gas ) :: & - qgas_prv - - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_prv - - real(r8) :: uptkaer_soag_tmp(nsoa,max_mode) - - real(r8), parameter :: a_min1 = 1.0e-20 - real(r8), parameter :: g_min1 = 1.0e-20 - real(r8), parameter :: alpha_astem = 0.05_r8 ! parameter used in calc of time step - real(r8), parameter :: dtsub_fixed = -1.0 ! fixed sub-step for time integration (s) -! real(r8), parameter :: dtsub_fixed = 10.0 ! fixed sub-step for time integration (s) - real(r8), parameter :: rgas = 8.3144_r8 ! gas constant in J/K/mol - - real(r8) :: a_ooa_sum_tmp(max_mode) ! total ooa (=soa+opoa) in a mode - real(r8) :: a_opoa(max_mode) ! oxidized-poa aerosol mixrat (mol/mol at actual mw) - real(r8) :: a_soa(ntot_soaspec,max_mode) ! soa aerosol mixrat (mol/mol at actual mw) - real(r8) :: a_soa_tmp(ntot_soaspec,max_mode) ! temporary soa aerosol mixrat (mol/mol) - real(r8) :: beta(ntot_soaspec,max_mode) ! dtcur*xferrate - real(r8) :: delh_vap_soa(ntot_soaspec) ! delh_vap_soa = heat of vaporization for gas soa (J/mol) - real(r8) :: del_g_soa_tmp(ntot_soaspec) - real(r8) :: dtcur ! current time step (s) - real(r8) :: dtfull ! full time step (s) - real(r8) :: dtmax ! = (dtfull-tcur) - real(r8) :: dtsum_qgas_avg - real(r8) :: g0_soa(ntot_soaspec) ! ambient soa gas equilib mixrat (mol/mol at actual mw) - real(r8) :: g_soa(ntot_soaspec) ! soa gas mixrat (mol/mol at actual mw) - real(r8) :: g_star(ntot_soaspec,max_mode) ! soa gas mixrat that is in equilib - ! with each aerosol mode (mol/mol) - real(r8) :: mw_poa(ntot_poaspec) ! actual molec wght of poa - real(r8) :: mw_soa(ntot_soaspec) ! actual molec wght of soa - real(r8) :: opoa_frac(ntot_poaspec,max_mode) ! fraction of poa that is opoa - real(r8) :: phi(ntot_soaspec,max_mode) ! "relative driving force" - real(r8) :: p0_soa(ntot_soaspec) ! soa gas equilib vapor presssure (atm) - real(r8) :: p0_soa_298(ntot_soaspec) ! p0_soa_298 = soa gas equilib vapor presssure (atm) at 298 k - real(r8) :: sat(ntot_soaspec,max_mode) ! sat(m,ll) = g0_soa(ll)/a_ooa_sum_tmp(m) = g_star(m,ll)/a_soa(m,ll) - ! used by the numerical integration scheme -- it is not a saturation rato! - real(r8) :: tcur ! current integration time (from 0 s) - - real(r8) :: tmpa, tmpb, tmpc - - real(r8) :: tot_soa(ntot_soaspec) ! g_soa + sum( a_soa(:) ) - - -! calc ntot_soamode = "last" mode on which soa is allowed to condense - ntot_soamode = 0 - do n = 1, ntot_amode - if (n == nufi) cycle - if (mode_aging_optaa(n) > 0) ntot_soamode = n - if (lptr2_soa_a_amode(n,1) > 0) ntot_soamode = n - end do -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( i*k == top_lev .and. ldiagd1 ) write(lund,'(/a,5i5)') & - 'ntot_amode, ntot_amode_extd, n_mode, ntot_soamode', & - ntot_amode, ntot_amode_extd, n_mode, ntot_soamode -#endif - - opoa_frac = 0.1_r8 -! for primary carbon mode, set opoa_frac=0 for consistency with older code -! (this could be changed) - if ( flag_pcarbon_opoa_frac_zero ) then - if (npca > 0) opoa_frac(:,npca) = 0.0_r8 - end if - - delh_vap_soa = 156.0e3 -! delh_vap_soa = 30.0e3 ! 11-jun-2012 - p0_soa_298 = 1.0e-10 - -! calc ambient equilibrium soa gas - do ll = 1, ntot_soaspec - p0_soa(ll) = p0_soa_298(ll) * & - exp( -(delh_vap_soa(ll)/rgas)*((1.0/temp)-(1.0/298.0)) ) - g0_soa(ll) = 1.01325e5*p0_soa(ll)/pmid - end do - - niter_max = 1000 - niter = 0 - dtfull = dtsubstep - tcur = 0.0 - dtcur = 0.0 - phi(:,:) = 0.0 - g_star(:,:) = 0.0 - g_soa(:) = 0.0 - a_opoa(:) = 0.0 - a_soa(:,:) = 0.0 - -! -! main integration loop -- does multiple substeps to reach dtfull -! - qgas_avg(1:nsoa) = 0.0_r8 - dtsum_qgas_avg = 0.0_r8 - -time_loop: & - do while (tcur < dtfull-1.0e-3_r8 ) - - niter = niter + 1 - if (niter > niter_max) exit - - -! set qxxx_prv to be current value - qgas_prv(1:nsoa) = qgas_cur(1:nsoa) - qaer_prv = qaer_cur -! qaer_num = qnum_cur - - -! determine which modes have non-zero transfer rates -! and are involved in the soa gas-aerosol transfer -! for diameter = 1 nm and number = 1 #/cm3, xferrate ~= 1e-9 s-1 - do n = 1, ntot_soamode - skip_soamode(n) = .true. - do ll = 1, ntot_soaspec - if (uptkaer(ll,n) > 1.0e-15_r8) then - uptkaer_soag_tmp(ll,n) = uptkaer(ll,n) - skip_soamode(n) = .false. - else - uptkaer_soag_tmp(ll,n) = 0.0_r8 - end if - end do - end do - -! load incoming soag and soaa into temporary arrays -! force things to be non-negative -! calc tot_soa(ll) -! calc a_opoa (always slightly >0) -! -! *** questions *** -! > why not use qgas and qaer instead of g_soa and a_soa -! > why not calc the following on every substep because -! nuc and coag may change things: -! skip)soamode, uptkaer_soag_tmp, tot_soa, a_opoa -! > include gasprod for soa ?? -! > create qxxx_bgn = qxxx_cur at the very beginning (is it needed) -! - do ll = 1, ntot_soaspec - g_soa(ll) = max( qgas_prv(ll), 0.0_r8 ) - tot_soa(ll) = g_soa(ll) - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - a_soa(ll,n) = max( qaer_prv(ll,n), 0.0_r8 ) - tot_soa(ll) = tot_soa(ll) + a_soa(ll,n) - end do - end do - - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - a_opoa(n) = 0.0_r8 - do ll = 1, ntot_poaspec - a_opoa(n) = a_opoa(n) + opoa_frac(ll,n) * max( qaer_prv(iaer_pom+ll-1,n), 0.0_r8 ) - end do - end do - - -! determine time step - tmpa = 0.0 ! time integration parameter for all soa species - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - a_ooa_sum_tmp(n) = a_opoa(n) + sum( a_soa(1:ntot_soaspec,n) ) - end do - do ll = 1, ntot_soaspec - tmpb = 0.0 ! time integration parameter for a single soa species - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - sat(ll,n) = g0_soa(ll)/max( a_ooa_sum_tmp(n), a_min1 ) - g_star(ll,n) = sat(ll,n)*a_soa(ll,n) - phi(ll,n) = (g_soa(ll) - g_star(ll,n))/max( g_soa(ll), g_star(ll,n), g_min1 ) - tmpb = tmpb + uptkaer_soag_tmp(ll,n)*abs(phi(ll,n)) - end do - tmpa = max( tmpa, tmpb ) - end do - - if (dtsub_fixed > 0.0_r8) then - dtcur = dtsub_fixed - tcur = tcur + dtcur - else - dtmax = dtfull-tcur - if (dtmax*tmpa <= alpha_astem) then -! here alpha_astem/tmpa >= dtmax, so this is final substep - dtcur = dtmax - tcur = dtfull - else - dtcur = alpha_astem/tmpa - tcur = tcur + dtcur - end if - end if - - -! step 1 - for modes where soa is condensing, estimate "new" a_soa(ll,n) -! using an explicit calculation with "old" g_soa -! and g_star(ll,n) calculated using "old" a_soa(ll,n) -! do this to get better estimate of "new" a_soa(ll,n) and sat(ll,n) - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - do ll = 1, ntot_soaspec - ! first ll loop calcs a_soa_tmp(ll,n) & a_ooa_sum_tmp - a_soa_tmp(ll,n) = a_soa(ll,n) - beta(ll,n) = dtcur*uptkaer_soag_tmp(ll,n) - del_g_soa_tmp(ll) = g_soa(ll) - g_star(ll,n) - if (del_g_soa_tmp(ll) > 0.0_r8) then - a_soa_tmp(ll,n) = a_soa(ll,n) + beta(ll,n)*del_g_soa_tmp(ll) - end if - end do - a_ooa_sum_tmp(n) = a_opoa(n) + sum( a_soa_tmp(1:ntot_soaspec,n) ) - do ll = 1, ntot_soaspec - ! second ll loop calcs sat & g_star - if (del_g_soa_tmp(ll) > 0.0_r8) then - sat(ll,n) = g0_soa(ll)/max( a_ooa_sum_tmp(n), a_min1 ) - g_star(ll,n) = sat(ll,n)*a_soa_tmp(ll,n) ! this just needed for diagnostics - end if - end do - end do - - -! step 2 - implicit in g_soa and semi-implicit in a_soa, -! with g_star(ll,n) calculated semi-implicitly - do ll = 1, ntot_soaspec - tmpa = 0.0 - tmpb = 0.0 - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - tmpa = tmpa + a_soa(ll,n)/(1.0_r8 + beta(ll,n)*sat(ll,n)) - tmpb = tmpb + beta(ll,n)/(1.0_r8 + beta(ll,n)*sat(ll,n)) - end do - - g_soa(ll) = (tot_soa(ll) - tmpa)/(1.0_r8 + tmpb) - g_soa(ll) = max( 0.0_r8, g_soa(ll) ) - do n = 1, ntot_soamode - if ( skip_soamode(n) ) cycle - a_soa(ll,n) = (a_soa(ll,n) + beta(ll,n)*g_soa(ll))/ & - (1.0_r8 + beta(ll,n)*sat(ll,n)) - end do - end do - - -! update mix ratios for soa species - do igas = 1, nsoa - iaer = igas - qgas_cur(igas) = g_soa(igas) - tmpc = qgas_cur(igas) - qgas_prv(igas) - qgas_avg(igas) = qgas_avg(igas) + dtcur*(qgas_prv(igas) + 0.5_r8*tmpc) - do n = 1, ntot_soamode - qaer_cur(iaer,n) = a_soa(iaer,n) - tmpc = qaer_cur(iaer,n) - qaer_prv(iaer,n) - end do - end do - - - dtsum_qgas_avg = dtsum_qgas_avg + dtcur - - end do time_loop - -! convert qgas_avg from sum_over[ qgas*dt_cut ] to an average - do igas = 1, nsoa - qgas_avg(igas) = max( 0.0_r8, qgas_avg(igas)/dtsum_qgas_avg ) - end do - - - return - end subroutine mam_soaexch_1subarea - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine mam_rename_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - iscldy_subarea, & - mtoo_renamexf, & - n_mode, & - qnum_cur, & - qaer_cur, qaer_del_grow4rnam, & - qwtr_cur, & - qnumcw_cur, & - qaercw_cur, qaercw_del_grow4rnam ) - -#ifndef GEOS5_PORT -#if ( defined CAM_VERSION_IS_ACME ) - use shr_spfn_mod, only: erfc => shr_spfn_erfc ! acme version of cam -#else - use error_function, only: erfc ! mozart-mosaic version of cam -#endif -#else - real :: erfc -#endif - - logical, intent(in) :: iscldy_subarea ! true if sub-area is cloudy - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: mtoo_renamexf(max_mode) - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur - real(r8), intent(in ), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_del_grow4rnam - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur - - real(r8), intent(inout), optional, dimension( 1:max_mode ) :: & - qnumcw_cur - real(r8), intent(inout), optional, dimension( 1:max_aer, 1:max_mode ) :: & - qaercw_cur - real(r8), intent(in ), optional, dimension( 1:max_aer, 1:max_mode ) :: & - qaercw_del_grow4rnam - - -! !DESCRIPTION: -! computes TMR (tracer mixing ratio) tendencies for "mode renaming" -! during a continuous growth process -! currently this transfers number and mass (and surface) from the aitken -! to accumulation mode after gas condensation or stratiform-cloud -! aqueous chemistry -! (convective cloud aqueous chemistry not yet implemented) -! -! !REVISION HISTORY: -! - -! local variables - integer :: iaer - integer :: mfrm, mtoo - integer :: n, npair - - integer, parameter :: ldiag1 = 0 - - real(r8), parameter :: frelax = 27.0_r8 - real(r8), parameter :: onethird = 1.0_r8/3.0_r8 - - real(r8) :: deldryvol_a(ntot_amode) - real(r8) :: deldryvol_c(ntot_amode) - real(r8) :: dp_belowcut(max_mode) - real(r8) :: dp_cut(max_mode) - real(r8) :: dgn_aftr, dgn_xfer - real(r8) :: dgn_t_new, dgn_t_old, dgn_t_oldaa - real(r8) :: dryvol_t_del, dryvol_t_new - real(r8) :: dryvol_t_old, dryvol_t_oldaa, dryvol_t_oldbnd - real(r8) :: dryvol_a(ntot_amode) - real(r8) :: dryvol_c(ntot_amode) - real(r8) :: dryvol_smallest(ntot_amode) - real(r8) :: factoraa(ntot_amode) - real(r8) :: factoryy(ntot_amode) - real(r8) :: lndp_cut(max_mode) - real(r8) :: lndgn_new, lndgn_old - real(r8) :: lndgv_new, lndgv_old - real(r8) :: num_t_old, num_t_oldbnd - real(r8) :: tailfr_volnew, tailfr_volold - real(r8) :: tailfr_numnew, tailfr_numold - real(r8) :: tmpa, tmpb, tmpd - real(r8) :: tmp_alnsg2(max_mode) - real(r8) :: v2nhirlx(ntot_amode), v2nlorlx(ntot_amode) - real(r8) :: xfercoef, xfertend - real(r8) :: xferfrac_vol, xferfrac_num, xferfrac_max - real(r8) :: yn_tail, yv_tail - - - xferfrac_max = 1.0_r8 - 10.0_r8*epsilon(1.0_r8) ! 1-eps - -! calculate variable used in the renamingm mode" of each renaming pair -! also compute dry-volume change during the continuous growth process - npair = 0 - do n = 1, ntot_amode - mtoo = mtoo_renamexf(n) - if (mtoo <= 0) cycle - - npair = npair + 1 - mfrm = n - factoraa(mfrm) = (pi/6.)*exp(4.5*(alnsg_aer(mfrm)**2)) - factoraa(mtoo) = (pi/6.)*exp(4.5*(alnsg_aer(mtoo)**2)) - factoryy(mfrm) = sqrt( 0.5 )/alnsg_aer(mfrm) -! dryvol_smallest is a very small volume mixing ratio (m3-AP/kmol-air) -! used for avoiding overflow. it corresponds to dp = 1 nm -! and number = 1e-5 #/mg-air ~= 1e-5 #/cm3-air - dryvol_smallest(mfrm) = 1.0e-25 -! v2nlorlx(mfrm) = voltonumblo_amode(mfrm)*frelax -! v2nhirlx(mfrm) = voltonumbhi_amode(mfrm)/frelax - v2nlorlx(mfrm) = ( 1._r8 / ( (pi/6._r8)* & - (dgnumlo_aer(mfrm)**3._r8)*exp(4.5_r8*alnsg_aer(mfrm)**2._r8) ) ) * frelax - v2nhirlx(mfrm) = ( 1._r8 / ( (pi/6._r8)* & - (dgnumhi_aer(mfrm)**3._r8)*exp(4.5_r8*alnsg_aer(mfrm)**2._r8) ) ) / frelax - - tmp_alnsg2(mfrm) = 3.0 * (alnsg_aer(mfrm)**2) - dp_cut(mfrm) = sqrt( & - dgnum_aer(mfrm)*exp(1.5*(alnsg_aer(mfrm)**2)) * & - dgnum_aer(mtoo)*exp(1.5*(alnsg_aer(mtoo)**2)) ) - lndp_cut(mfrm) = log( dp_cut(mfrm) ) - dp_belowcut(mfrm) = 0.99*dp_cut(mfrm) - end do - if (npair <= 0) return - -! compute aerosol dry-volume for the "from mode" of each renaming pair -! also compute dry-volume change during the continuous growth process - do n = 1, ntot_amode - mtoo = mtoo_renamexf(n) - if (mtoo <= 0) cycle - - tmpa = 0.0_r8 ; tmpb = 0.0_r8 - do iaer = 1, naer -! fac_m2v_aer converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) - tmpa = tmpa + qaer_cur(iaer,n)*fac_m2v_aer(iaer) - tmpb = tmpb + qaer_del_grow4rnam(iaer,n)*fac_m2v_aer(iaer) - end do - dryvol_a(n) = tmpa-tmpb ! dry volume before growth - deldryvol_a(n) = tmpb ! change to dry volume due to growth - - if ( iscldy_subarea ) then - tmpa = 0.0_r8 ; tmpb = 0.0_r8 - do iaer = 1, naer -! fac_m2v_aer converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) - tmpa = tmpa + qaercw_cur(iaer,n)*fac_m2v_aer(iaer) - tmpb = tmpb + qaercw_del_grow4rnam(iaer,n)*fac_m2v_aer(iaer) - end do - dryvol_c(n) = tmpa-tmpb - deldryvol_c(n) = tmpb - end if ! ( iscldy_subarea ) then - - end do - - -! -! loop over renaming pairs -! -mainloop1_ipair: do n = 1, ntot_amode - - mfrm = n - mtoo = mtoo_renamexf(n) - if (mtoo <= 0) cycle mainloop1_ipair - -! dryvol_t_old is the old total (a+c) dry-volume for the "from" mode -! in m^3-AP/kmol-air -! dryvol_t_new is the new total dry-volume -! (old/new = before/after the continuous growth) -! num_t_old is total number in particles/kmol-air - if ( iscldy_subarea ) then - dryvol_t_old = dryvol_a(mfrm) + dryvol_c(mfrm) - dryvol_t_del = deldryvol_a(mfrm) + deldryvol_c(mfrm) - num_t_old = (qnum_cur(mfrm) + qnumcw_cur(mfrm)) - else - dryvol_t_old = dryvol_a(mfrm) - dryvol_t_del = deldryvol_a(mfrm) - num_t_old = qnum_cur(mfrm) - end if - dryvol_t_new = dryvol_t_old + dryvol_t_del - -! no renaming if dryvol_t_new ~ 0 or dryvol_t_del ~ 0 - if (dryvol_t_new .le. dryvol_smallest(mfrm)) cycle mainloop1_ipair - dryvol_t_oldbnd = max( dryvol_t_old, dryvol_smallest(mfrm) ) - if (rename_method_optaa .ne. 40) then - if (dryvol_t_del .le. 1.0e-6*dryvol_t_oldbnd) cycle mainloop1_ipair - end if - - num_t_old = max( 0.0_r8, num_t_old ) - dryvol_t_oldbnd = max( dryvol_t_old, dryvol_smallest(mfrm) ) - num_t_oldbnd = min( dryvol_t_oldbnd*v2nlorlx(mfrm), num_t_old ) - num_t_oldbnd = max( dryvol_t_oldbnd*v2nhirlx(mfrm), num_t_oldbnd ) - -! no renaming if dgnum < "base" dgnum, - dgn_t_new = (dryvol_t_new/(num_t_oldbnd*factoraa(mfrm)))**onethird - if (dgn_t_new .le. dgnum_aer(mfrm)) cycle mainloop1_ipair - -! compute new fraction of number and mass in the tail (dp > dp_cut) - lndgn_new = log( dgn_t_new ) - lndgv_new = lndgn_new + tmp_alnsg2(mfrm) - yn_tail = (lndp_cut(mfrm) - lndgn_new)*factoryy(mfrm) - yv_tail = (lndp_cut(mfrm) - lndgv_new)*factoryy(mfrm) - tailfr_numnew = 0.5_r8*erfc( yn_tail ) - tailfr_volnew = 0.5_r8*erfc( yv_tail ) - -! compute old fraction of number and mass in the tail (dp > dp_cut) - dgn_t_old = & - (dryvol_t_oldbnd/(num_t_oldbnd*factoraa(mfrm)))**onethird - dgn_t_oldaa = dgn_t_old - dryvol_t_oldaa = dryvol_t_old - - if (rename_method_optaa .eq. 40) then - if (dgn_t_old .gt. dp_belowcut(mfrm)) then - ! this revised volume corresponds to dgn_t_old == dp_belowcut, and same number conc - dryvol_t_old = dryvol_t_old * (dp_belowcut(mfrm)/dgn_t_old)**3 - dgn_t_old = dp_belowcut(mfrm) - end if - if ((dryvol_t_new-dryvol_t_old) .le. 1.0e-6_r8*dryvol_t_oldbnd) cycle mainloop1_ipair - else if (dgn_t_new .ge. dp_cut(mfrm)) then -! if dgn_t_new exceeds dp_cut, use the minimum of dgn_t_old and -! dp_belowcut to guarantee some transfer - dgn_t_old = min( dgn_t_old, dp_belowcut(mfrm) ) - end if - lndgn_old = log( dgn_t_old ) - lndgv_old = lndgn_old + tmp_alnsg2(mfrm) - yn_tail = (lndp_cut(mfrm) - lndgn_old)*factoryy(mfrm) - yv_tail = (lndp_cut(mfrm) - lndgv_old)*factoryy(mfrm) - tailfr_numold = 0.5_r8*erfc( yn_tail ) - tailfr_volold = 0.5_r8*erfc( yv_tail ) - -! transfer fraction is difference between new and old tail-fractions -! transfer fraction for number cannot exceed that of mass - tmpa = tailfr_volnew*dryvol_t_new - tailfr_volold*dryvol_t_old - if (tmpa .le. 0.0_r8) cycle mainloop1_ipair - - xferfrac_vol = min( tmpa, dryvol_t_new )/dryvol_t_new - xferfrac_vol = min( xferfrac_vol, xferfrac_max ) - xferfrac_num = tailfr_numnew - tailfr_numold - xferfrac_num = max( 0.0_r8, min( xferfrac_num, xferfrac_vol ) ) -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag98 ) write(lun98,'(/a,2i3,1p,10e11.3)') & - 'rename i,k, xf n/v', i, k, xferfrac_num, xferfrac_vol -#endif - -#if ( defined( CAMBOX_NEVER_ACTIVATE_THIS ) ) -! diagnostic output start ---------------------------------------- - if (ldiag1 > 0) then - icol_diag = -1 - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) icol_diag = i - if ((i == icol_diag) .and. (mod(k-1,5) == 0)) then - ! write(lund,97010) fromwhere, nstep, lchnk, i, k, ipair - write(lund,97010) fromwhere, nstep, latndx(i), lonndx(i), k, ipair - write(lund,97020) 'drv olda/oldbnd/old/new/del', & - dryvol_t_oldaa, dryvol_t_oldbnd, dryvol_t_old, dryvol_t_new, dryvol_t_del - write(lund,97020) 'num old/oldbnd, dgnold/new ', & - num_t_old, num_t_oldbnd, dgn_t_old, dgn_t_new - write(lund,97020) 'tailfr v_old/new, n_old/new', & - tailfr_volold, tailfr_volnew, tailfr_numold, tailfr_numnew - tmpa = max(1.0d-10,xferfrac_vol) / max(1.0d-10,xferfrac_num) - dgn_xfer = dgn_t_new * tmpa**onethird - tmpa = max(1.0d-10,(1.0d0-xferfrac_vol)) / & - max(1.0d-10,(1.0d0-xferfrac_num)) - dgn_aftr = dgn_t_new * tmpa**onethird - write(lund,97020) 'xferfrac_v/n; dgn_xfer/aftr', & - xferfrac_vol, xferfrac_num, dgn_xfer, dgn_aftr - !97010 format( / 'RENAME ', a, ' nx,lc,i,k,ip', i8, 4i4 ) - 97010 format( / 'RENAME ', a, ' nx,lat,lon,k,ip', i8, 4i4 ) - 97020 format( a, 6(1pe15.7) ) - end if - end if ! (ldiag1 > 0) -! diagnostic output end ------------------------------------------ -#endif - - -! -! compute changes to number and species masses -! - tmpd = qnum_cur(mfrm)*xferfrac_num - qnum_cur(mfrm) = qnum_cur(mfrm) - tmpd - qnum_cur(mtoo) = qnum_cur(mtoo) + tmpd - do iaer = 1, naer - tmpd = qaer_cur(iaer,mfrm)*xferfrac_vol - qaer_cur(iaer,mfrm) = qaer_cur(iaer,mfrm) - tmpd - qaer_cur(iaer,mtoo) = qaer_cur(iaer,mtoo) + tmpd - end do ! iaer - - if ( iscldy_subarea ) then - tmpd = qnumcw_cur(mfrm)*xferfrac_num - qnumcw_cur(mfrm) = qnumcw_cur(mfrm) - tmpd - qnumcw_cur(mtoo) = qnumcw_cur(mtoo) + tmpd - do iaer = 1, naer - tmpd = qaercw_cur(iaer,mfrm)*xferfrac_vol - qaercw_cur(iaer,mfrm) = qaercw_cur(iaer,mfrm) - tmpd - qaercw_cur(iaer,mtoo) = qaercw_cur(iaer,mtoo) + tmpd - end do ! iaer - end if ! ( iscldy_subarea ) then - - -#if ( defined( CAMBOX_NEVER_ACTIVATE_THIS ) ) -! diagnostic output start ---------------------------------------- - if (ldiag1 > 0) then - if ((i == icol_diag) .and. (mod(k-1,5) == 0)) then - if (lstooa .gt. 0) then - write(lund,'(a,i4,2(2x,a),1p,10e14.6)') 'RENAME qdels', iq, & - cnst_name(lsfrma+loffset), cnst_name(lstooa+loffset), & - deltat*dqdt(i,k,lsfrma), deltat*(dqdt(i,k,lsfrma) - xfertend), & - deltat*dqdt(i,k,lstooa), deltat*(dqdt(i,k,lstooa) + xfertend) - else - write(lund,'(a,i4,2(2x,a),1p,10e14.6)') 'RENAME qdels', iq, & - cnst_name(lsfrma+loffset), cnst_name(lstooa+loffset), & - deltat*dqdt(i,k,lsfrma), deltat*(dqdt(i,k,lsfrma) - xfertend) - end if - end if - end if -! diagnostic output end ------------------------------------------ -#endif - - - end do mainloop1_ipair - - - return - end subroutine mam_rename_1subarea - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine mam_newnuc_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - deltat, & - temp, pmid, aircon, & - zmid, pblh, relhum, & - uptkrate_h2so4, del_h2so4_gasprod, del_h2so4_aeruptk, & - n_mode, & - qgas_cur, qgas_avg, & - qnum_cur, & - qaer_cur, & - qwtr_cur, & - dnclusterdt ) - -! uses -#ifndef GEOS5_PORT - use chem_mods, only: adv_mass -#endif - - use modal_aero_newnuc, only: & - mer07_veh02_nuc_mosaic_1box, qh2so4_cutoff - - implicit none - -! arguments - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - real(r8), intent(in) :: deltat ! model timestep (s) - real(r8), intent(in) :: temp ! temperature (K) - real(r8), intent(in) :: pmid ! pressure at model levels (Pa) - real(r8), intent(in) :: aircon ! air molar concentration (kmol/m3) - real(r8), intent(in) :: zmid ! midpoint height above surface (m) - real(r8), intent(in) :: pblh ! pbl height (m) - real(r8), intent(in) :: relhum ! relative humidity (0-1) - real(r8), intent(in) :: uptkrate_h2so4 - real(r8), intent(in) :: del_h2so4_gasprod - real(r8), intent(in) :: del_h2so4_aeruptk - - real(r8), intent(inout) :: dnclusterdt ! cluster nucleation rate (#/m3/s) - - real(r8), intent(inout), dimension( 1:max_gas ) :: & - qgas_cur - real(r8), intent(in ), dimension( 1:max_gas ) :: & - qgas_avg - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur - -! DESCRIPTION: -! computes changes due to aerosol nucleation (new particle formation) -! treats both nucleation and subsequent growth of new particles -! to aitken mode size -! uses the following parameterizations -! vehkamaki et al. (2002) parameterization for binary -! homogeneous nucleation (h2so4-h2o) plus -! kerminen and kulmala (2002) parameterization for -! new particle loss during growth to aitken size -! -! REVISION HISTORY: -! R.Easter 2007.09.14: Adapted from MIRAGE2 code and CMAQ V4.6 code -! - -! local variables - integer, parameter :: ldiag1=-1, ldiag2=-1, ldiag3=-1, ldiag4=-1 - integer, parameter :: newnuc_method_flagaa = 11 -! integer, parameter :: newnuc_method_flagaa = 12 - ! 1=merikanto et al (2007) ternary 2=vehkamaki et al (2002) binary - ! 11=merikanto ternary + first-order boundary layer - ! 12=merikanto ternary + second-order boundary layer - - integer :: itmp - integer :: l - integer :: ldiagveh02 - integer :: m - - real(r8) :: dens_nh4so4a - real(r8) :: dmdt_ait, dmdt_aitsv1, dmdt_aitsv2, dmdt_aitsv3 - real(r8) :: dndt_ait, dndt_aitsv1, dndt_aitsv2, dndt_aitsv3 - real(r8) :: dnh4dt_ait, dso4dt_ait - real(r8) :: dpnuc - real(r8) :: dplom_mode(1), dphim_mode(1) - real(r8) :: mass1p - real(r8) :: mass1p_aithi, mass1p_aitlo - real(r8) :: qh2so4_cur, qh2so4_avg, qh2so4_del - real(r8) :: qnh3_cur, qnh3_del, qnh4a_del - real(r8) :: qnuma_del - real(r8) :: qso4a_del - real(r8) :: relhumnn - real(r8) :: tmpa, tmpb, tmpc - real(r8) :: tmp_q2, tmp_q3 - real(r8) :: tmp_q_del - real(r8) :: tmp_frso4, tmp_uptkrate - - character(len=1) :: tmpch1, tmpch2, tmpch3 - - -! begin - dnclusterdt = 0.0_r8 - -! qh2so4_cur = current qh2so4, after aeruptk -! qh2so4_avg = average qh2so4 over time-step - qh2so4_cur = qgas_cur(igas_h2so4) - - if ( (gaexch_h2so4_uptake_optaa == 1) .and. & - (newnuc_h2so4_conc_optaa == 1) ) then -! estimate qh2so4_avg using the method in standard cam5.2 modal_aero_newnuc - - ! skip if h2so4 vapor < qh2so4_cutoff - if (qh2so4_cur <= qh2so4_cutoff) goto 80000 - - tmpa = max( 0.0_r8, del_h2so4_gasprod ) - tmp_q3 = qh2so4_cur - ! tmp_q2 = qh2so4 before aeruptk - ! (note tmp_q3, tmp_q2 both >= 0.0) - tmp_q2 = tmp_q3 + max( 0.0_r8, -del_h2so4_aeruptk ) - - ! tmpb = log( tmp_q2/tmp_q3 ) BUT with some checks added - if (tmp_q2 <= tmp_q3) then - tmpb = 0.0_r8 - else - tmpc = tmp_q2 * exp( -20.0_r8 ) - if (tmp_q3 <= tmpc) then - tmp_q3 = tmpc - tmpb = 20.0_r8 - else - tmpb = log( tmp_q2/tmp_q3 ) - end if - end if - ! d[ln(qh2so4)]/dt (1/s) from uptake (condensation) to aerosol - tmp_uptkrate = tmpb/deltat - -! qh2so4_avg = estimated average qh2so4 -! when production & loss are done simultaneously - if (tmpb <= 0.1_r8) then - qh2so4_avg = tmp_q3*(1.0_r8 + 0.5_r8*tmpb) - 0.5_r8*tmpa - else - tmpc = tmpa/tmpb - qh2so4_avg = (tmp_q3 - tmpc)*((exp(tmpb)-1.0_r8)/tmpb) + tmpc - end if - else -! use qh2so4_avg and first-order loss rate calculated in mam_gasaerexch_1subarea - qh2so4_avg = qgas_avg(igas_h2so4) - tmp_uptkrate = uptkrate_h2so4 - end if - - if (qh2so4_avg <= qh2so4_cutoff) goto 80000 - - if (igas_nh3 > 0) then - qnh3_cur = max( 0.0_r8, qgas_cur(igas_nh3) ) - else - qnh3_cur = 0.0_r8 - end if - -! dry-diameter limits for "grown" new particles - dplom_mode(1) = exp( 0.67_r8*log(dgnumlo_aer(nait)) & - + 0.33_r8*log(dgnum_aer(nait)) ) - dphim_mode(1) = dgnumhi_aer(nait) - -! mass1p_... = mass (kg) of so4 & nh4 in a single particle of diameter ... -! (assuming same dry density for so4 & nh4) -! mass1p_aitlo - dp = dplom_mode(1) -! mass1p_aithi - dp = dphim_mode(1) - tmpa = dens_so4a_host*pi/6.0_r8 - mass1p_aitlo = tmpa*(dplom_mode(1)**3) - mass1p_aithi = tmpa*(dphim_mode(1)**3) - -! limit RH to between 0.1% and 99% - relhumnn = max( 0.01_r8, min( 0.99_r8, relhum ) ) - - -! call ... routine to get nucleation rates - ldiagveh02 = -1 -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if (ldiag2 > 0) then - if ((lonndx == 37) .and. (latndx == 23)) then - if ((k >= 24) .or. (mod(k,4) == 0)) then - ldiagveh02 = +1 - write(lund,'(/a,i8,3i4,f8.2,1p,4e10.2)') & - 'veh02 call - nstep,lat,lon,k; tk,rh,p,cair', & - nstep, latndx, lonndx, k, & - temp, relhumnn, pmid, aircon*1.0e3_r8 - ! output aircon at (mol/m3) - end if - end if - end if ! (ldiag2 > 0) -#endif - - call mer07_veh02_nuc_mosaic_1box( & - newnuc_method_flagaa, & - deltat, temp, relhumnn, pmid, & - zmid, pblh, & - qh2so4_cur, qh2so4_avg, qnh3_cur, tmp_uptkrate, & - mw_so4a_host, & - 1, 1, dplom_mode, dphim_mode, & - itmp, qnuma_del, qso4a_del, qnh4a_del, & - qh2so4_del, qnh3_del, dens_nh4so4a, & - ldiagveh02, dnclusterdt ) -!---------------------------------------------------------------------- -! subr mer07_veh02_nuc_mosaic_1box( & -! newnuc_method_flagaa, & -! dtnuc, temp_in, rh_in, press_in, & -! qh2so4_cur, qh2so4_avg, qnh3_cur, h2so4_uptkrate, & -! nsize, maxd_asize, dplom_sect, dphim_sect, & -! isize_nuc, qnuma_del, qso4a_del, qnh4a_del, & -! qh2so4_del, qnh3_del, dens_nh4so4a ) -! -!! subr arguments (in) -! real(r8), intent(in) :: dtnuc ! nucleation time step (s) -! real(r8), intent(in) :: temp_in ! temperature, in k -! real(r8), intent(in) :: rh_in ! relative humidity, as fraction -! real(r8), intent(in) :: press_in ! air pressure (pa) -! -! real(r8), intent(in) :: qh2so4_cur, qh2so4_avg -! ! gas h2so4 mixing ratios (mol/mol-air) -! real(r8), intent(in) :: qnh3_cur ! gas nh3 mixing ratios (mol/mol-air) -! ! qxxx_cur = current value (after gas chem and condensation) -! ! qxxx_avg = estimated average value (for simultaneous source/sink calcs) -! real(r8), intent(in) :: h2so4_uptkrate ! h2so4 uptake rate to aerosol (1/s) - -! -! integer, intent(in) :: nsize ! number of aerosol size bins -! integer, intent(in) :: maxd_asize ! dimension for dplom_sect, ... -! real(r8), intent(in) :: dplom_sect(maxd_asize) ! dry diameter at lower bnd of bin (m) -! real(r8), intent(in) :: dphim_sect(maxd_asize) ! dry diameter at upper bnd of bin (m) -! -!! subr arguments (out) -! integer, intent(out) :: isize_nuc ! size bin into which new particles go -! real(r8), intent(out) :: qnuma_del ! change to aerosol number mixing ratio (#/mol-air) -! real(r8), intent(out) :: qso4a_del ! change to aerosol so4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qnh4a_del ! change to aerosol nh4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qh2so4_del ! change to gas h2so4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qnh3_del ! change to gas nh3 mixing ratio (mol/mol-air) -! ! aerosol changes are > 0; gas changes are < 0 -! real(r8), intent(out) :: dens_nh4so4a ! dry-density of the new nh4-so4 aerosol mass (kg/m3) -!---------------------------------------------------------------------- - - -! convert qnuma_del from (#/mol-air) to (#/kmol-air) - qnuma_del = qnuma_del*1.0e3_r8 -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag97 ) then - write(lun97,'(/a,2i5,1p,3e11.3,2x,3e11.3)') & - 'newnuc - i, k, qavg s/n, uprt, rh 1/2', & - i, k, qh2so4_avg, qh2so4_cur, qnh3_cur, & - tmp_uptkrate, relhum, relhumnn - write(lun97,'( a,10x,1p,3e11.3,2x,3e11.3)') & - ' del qn, qso4a, qnh4a ', & - qnuma_del, qso4a_del, qnh4a_del - end if -#endif - -! number nuc rate (#/kmol-air/s) from number nuc amt - dndt_ait = qnuma_del/deltat - -! fraction of mass nuc going to so4 - tmpa = qso4a_del*mw_so4a_host - if (igas_nh3 > 0) then - tmpb = tmpa + qnh4a_del*mw_nh4a_host - tmp_frso4 = max( tmpa, 1.0e-35_r8 )/max( tmpb, 1.0e-35_r8 ) - else - tmpb = tmpa - tmp_frso4 = 1.0_r8 - end if - -! mass nuc rate (kg/kmol-air/s) from mass nuc amts - dmdt_ait = max( 0.0_r8, (tmpb/deltat) ) - - dndt_aitsv1 = dndt_ait - dmdt_aitsv1 = dmdt_ait - dndt_aitsv2 = 0.0 - dmdt_aitsv2 = 0.0 - dndt_aitsv3 = 0.0 - dmdt_aitsv3 = 0.0 - tmpch1 = ' ' - tmpch2 = ' ' - - if (dndt_ait < 1.0e2) then -! ignore newnuc if number rate < 100 #/kmol-air/s ~= 0.3 #/mg-air/d - dndt_ait = 0.0 - dmdt_ait = 0.0 - tmpch1 = 'A' - - else - dndt_aitsv2 = dndt_ait - dmdt_aitsv2 = dmdt_ait - tmpch1 = 'B' - -! mirage2 code checked for complete h2so4 depletion here, -! but this is now done in mer07_veh02_nuc_mosaic_1box - mass1p = dmdt_ait/dndt_ait - dndt_aitsv3 = dndt_ait - dmdt_aitsv3 = dmdt_ait - -! apply particle size constraints - if (mass1p < mass1p_aitlo) then -! reduce dndt to increase new particle size - dndt_ait = dmdt_ait/mass1p_aitlo - tmpch1 = 'C' - else if (mass1p > mass1p_aithi) then -! reduce dmdt to decrease new particle size - dmdt_ait = dndt_ait*mass1p_aithi - tmpch1 = 'E' - end if - end if - -! *** apply adjustment factor to avoid unrealistically high -! aitken number concentrations in mid and upper troposphere - dndt_ait = dndt_ait * newnuc_adjust_factor_dnaitdt - dmdt_ait = dmdt_ait * newnuc_adjust_factor_dnaitdt - - tmp_q_del = dndt_ait*deltat - qnum_cur( nait) = qnum_cur( nait) + tmp_q_del - -! dso4dt_ait, dnh4dt_ait are (kmol/kmol-air/s) - dso4dt_ait = dmdt_ait*tmp_frso4/mw_so4a_host - dnh4dt_ait = dmdt_ait*(1.0_r8 - tmp_frso4)/mw_nh4a_host - - if (dso4dt_ait > 0.0_r8) then - tmp_q_del = dso4dt_ait*deltat - qaer_cur( iaer_so4,nait) = qaer_cur( iaer_so4,nait) + tmp_q_del - - tmp_q_del = min( tmp_q_del, qgas_cur(igas_h2so4) ) - qgas_cur( igas_h2so4) = qgas_cur( igas_h2so4) - tmp_q_del - end if - - if ((igas_nh3 > 0) .and. (dnh4dt_ait > 0.0_r8)) then - tmp_q_del = dnh4dt_ait*deltat - qaer_cur( iaer_nh4,nait) = qaer_cur( iaer_nh4,nait) + tmp_q_del - - tmp_q_del = min( tmp_q_del, qgas_cur(igas_nh3) ) - qgas_cur( igas_nh3) = qgas_cur( igas_nh3) - tmp_q_del - end if - -!! temporary diagnostic -! if (ldiag3 > 0) then -! if ((dndt_ait /= 0.0_r8) .or. (dmdt_ait /= 0.0_r8)) then -! write(lund,'(3a,1x,i7,3i5,1p,5e12.4)') & -! 'newnucxx', tmpch1, tmpch2, nstep, lchnk, i, k, & -! dndt_ait, dmdt_ait, cldx -!! call endrun( 'modal_aero_newnuc_sub' ) -! end if -! end if - - -#if ( defined( CAMBOX_NEVER_ACTIVATE_THIS ) ) -! diagnostic output start ---------------------------------------- - if (ldiag4 > 0) then - if ((lonndx == 37) .and. (latndx == 23)) then - if ((k >= 24) .or. (mod(k,4) == 0)) then - write(lund,97010) nstep, latndx, lonndx, k, temp, aircon*1.0e3_r8 - write(lund,97020) 'pmid ', & - pmid - write(lund,97030) 'qv,qvsw, rh_av, rh_clr ', & - qv(i,k), qvswtr, relhumav, relhum - write(lund,97020) 'h2so4_cur, _av, nh3_cur', & - qh2so4_cur, qh2so4_avg, qnh3_cur - write(lund,97020) 'del_h2so4_gasprod, _aeruptk ', & - del_h2so4_gasprod(i,k), del_h2so4_aeruptk(i,k), & - tmp_uptkrate*3600.0 - write(lund,97020) ' ' - write(lund,97050) 'tmpch1, tmpch2 ', tmpch1, tmpch2 - write(lund,97020) 'dndt_, dmdt_aitsv1 ', & - dndt_aitsv1, dmdt_aitsv1 - write(lund,97020) 'dndt_, dmdt_aitsv2 ', & - dndt_aitsv2, dmdt_aitsv2 - write(lund,97020) 'dndt_, dmdt_aitsv3 ', & - dndt_aitsv3, dmdt_aitsv3 - write(lund,97020) 'dndt_, dmdt_ait ', & - dndt_ait, dmdt_ait - write(lund,97020) 'dso4dt_, dnh4dt_ait ', & - dso4dt_ait, dnh4dt_ait - write(lund,97020) 'qso4a_del, qh2so4_del ', & - qso4a_del, qh2so4_del - write(lund,97020) 'qnh4a_del, qnh3_del ', & - qnh4a_del, qnh3_del - write(lund,97020) 'dqdt(h2so4), (nh3) ', & - dqdt(i,k,l_h2so4), dqdt(i,k,l_nh3) - write(lund,97020) 'dqdt(so4a), (nh4a), (numa) ', & - dqdt(i,k,lso4ait), dqdt(i,k,lnh4ait), dqdt(i,k,lnumait) - - dpnuc = 0.0 - if (dndt_aitsv1 > 1.0e-5) dpnuc = (6.0*dmdt_aitsv1/ & - (pi*dens_so4a_host*dndt_aitsv1))**0.3333333 - if (dpnuc > 0.0) then - write(lund,97020) 'dpnuc, dp_aitlo, _aithi ', & - dpnuc, dplom_mode(1), dphim_mode(1) - write(lund,97020) 'mass1p, mass1p_aitlo, _aithi ', & - mass1p, mass1p_aitlo, mass1p_aithi - end if - -97010 format( / 'NEWNUC nstep,lat,lon,k,tk,cair', i8, 3i4, f8.2, 1pe12.4 ) -97020 format( a, 1p, 6e12.4 ) -97030 format( a, 1p, 2e12.4, 0p, 5f10.6 ) -97040 format( 29x, 1p, 6e12.4 ) -97050 format( a, 2(3x,a) ) - end if ! ((k >= 24) .or. (mod(k,4) == 0)) - end if ! ((lonndx == 37) .and. (latndx == 23)) - end if ! (ldiag4 > 0) -! diagnostic output end ------------------------------------------ -#endif - - -80000 continue - - - return - end subroutine mam_newnuc_1subarea - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine mam_coag_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - deltat, & - temp, pmid, aircon, & - dgn_a, dgn_awet, wetdens, & - n_mode, & - qnum_cur, & - qaer_cur, qaer_del_coag_in, & - qwtr_cur ) - -! coag between aitken, pcarbon, and accum modes -! inter-modal coag of ultrafine mode - -! uses - use modal_aero_coag, only: getcoags_wrapper_f - - implicit none - -! arguments - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - real(r8), intent(in) :: deltat ! model timestep (s) - real(r8), intent(in) :: temp ! temperature at model levels (K) - real(r8), intent(in) :: pmid ! pressure at layer center (Pa) - real(r8), intent(in) :: aircon ! air molar concentration (kmol/m3) - real(r8), intent(in) :: dgn_a(max_mode) - real(r8), intent(in) :: dgn_awet(max_mode) - ! dry & wet geo. mean dia. (m) of number distrib. - real(r8), intent(in) :: wetdens(max_mode) - ! interstitial aerosol wet density (kg/m3) - ! dry & wet geo. mean dia. (m) of number distrib. - - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur - real(r8), intent(out), dimension( 1:max_aer, 1:max_agepair ) :: & - qaer_del_coag_in - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur - -! local variables - integer :: iaer, ip - integer :: modefrm, modetoo - integer :: n - - real(r8), parameter :: epsilonx1 = epsilon( 1.0_r8 ) - real(r8), parameter :: epsilonx2 = epsilonx1*2.0_r8 - - real(r8) :: tmp1, tmp2, tmp3, tmp4 - real(r8) :: tmpa, tmpb, tmpc, tmpn - real(r8) :: tmp_dq, tmp_xf - real(r8) :: xbetaij2i, xbetaij2j, xbetaii2, xbetajj2 - real(r8) :: ybetaij0(max_coagpair), ybetaij3(max_coagpair), & - ybetaii0(max_coagpair), ybetajj0(max_coagpair) - - real(r8), dimension( 1:max_mode ) :: & - qnum_tmpa, qnum_tmpb, qnum_tmpc - real(r8), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_tmpa, qaer_tmpb, qaer_tmpc - -! DESCRIPTION: - - qnum_tmpa = max( 0.0_r8, qnum_cur ) - qaer_tmpa = max( 0.0_r8, qaer_cur ) - qnum_tmpb = qnum_tmpa - qaer_tmpb = qaer_tmpa - qaer_del_coag_in = 0.0_r8 - -! -! compute coagulation rates using cmaq "fast" method -! (based on E. Whitby's approximation approach) -! here subr. arguments are all in mks unit -! - lun15n = 149 + i -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag15n ) write(lun15n,'(//a,3i5,1p,e11.3)') 'coag - nstep,i,k', nstep, i, k, aircon -#endif - - do ip = 1, n_coagpair - modefrm = modefrm_coagpair(ip) - modetoo = modetoo_coagpair(ip) - -! call getcoags_wrapper_f( & -! airtemp, airprs, & -! dgatk, dgacc, & -! sgatk, sgacc, & -! xxlsgat, xxlsgac, & -! pdensat, pdensac, & -! betaij0, betaij2i, betaij2j, betaij3, & -! betaii0, betaii2, betajj0, betajj2 ) - call getcoags_wrapper_f( & - temp, pmid, & - dgn_awet(modefrm), dgn_awet(modetoo), & - sigmag_aer(modefrm), sigmag_aer(modetoo), & - alnsg_aer(modefrm), alnsg_aer(modetoo), & - wetdens(modefrm), wetdens(modetoo), & - ybetaij0(ip), xbetaij2i, xbetaij2j, ybetaij3(ip), & - ybetaii0(ip), xbetaii2, ybetajj0(ip), xbetajj2 ) - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) -! short diagnostics for coag coefficients - if ( ldiag15n ) write(lun15n,'(a,i5,1p,10e11.3)') 'ip, ybeta ', ip, & - ybetaij0(ip), ybetaij3(ip), ybetaii0(ip), ybetajj0(ip) - -! long diagnostics for coag coefficients -! if ( ldiag15n ) then -! if ( ip == 1 ) then -! write(lun15n,'(a,1p,2e12.4)') 'temp, pmid', temp, pmid -! write(lun15n,'(a/a/a/a/a)') & -! 'modefrm, modetoo, ip, ', & -! 'ybetaij0(ip), ybetaij3(ip), ybetaii0(ip), ybetajj0(ip), [m3/s]', & -! 'dgn_awet(modefrm)*1.0e6, dgn_awet(modetoo)*1.0e6, ', & -! 'sigmag_aer(modefrm), sigmag_aer(modetoo), ', & -! 'wetdens(modefrm)*1.0e-3, wetdens(modetoo)*1.0e-3 ' -! end if -! write(lun15n,'(a,2i3,i5,1p,4e11.3, 0p,2x,2f7.4,2(2x,2f6.3))') & -! 'ip, ybeta ', modefrm, modetoo, ip, & -! ybetaij0(ip), ybetaij3(ip), ybetaii0(ip), ybetajj0(ip), & -! dgn_awet(modefrm)*1.0e6, dgn_awet(modetoo)*1.0e6, & -! sigmag_aer(modefrm), sigmag_aer(modetoo), & -! wetdens(modefrm)*1.0e-3, wetdens(modetoo)*1.0e-3 -! end if -#endif - - ! convert coag coefficients from (m3/s) to (kmol-air/s) - ybetaij0(ip) = ybetaij0(ip)*aircon - ybetaij3(ip) = ybetaij3(ip)*aircon - ybetaii0(ip) = ybetaii0(ip)*aircon - ybetajj0(ip) = ybetajj0(ip)*aircon - end do ! ip - - -! first calculate changes to number -! use the following order because -! accum number loss depends on accum number -! pcarbon number loss depends on pcarbon and accum number -! maccum number loss depends on maccum, pcarbon, and accum number -! aitken number loss depends on aitken, maccum, pcarbon, and accum number -! maitken number loss depends on maitken, aitken, maccum, pcarbon, and accum number -! the average number concencentrations (over current time step) -! of other modes can thus be used to calculate the number loss of a mode - -! accum mode number loss - analytical solution - tmpa = max( 0.0_r8, deltat*ybetajj0(1) ) - qnum_tmpb(nacc) = qnum_tmpa(nacc) / & - ( 1.0_r8 + ybetajj0(1)*deltat*qnum_tmpa(nacc) ) - qnum_tmpc(nacc) = (qnum_tmpa(nacc) + qnum_tmpb(nacc))*0.5_r8 - -! pcarbon mode number loss - approximate analytical solution -! using average number conc. for accum mode - if (npca > 0) then - tmpa = max( 0.0_r8, deltat*ybetaij0(2)*qnum_tmpc(nacc) ) - tmpb = max( 0.0_r8, deltat*ybetaii0(2) ) - tmpn = qnum_tmpa(npca) - if (tmpa < 1.0e-5_r8) then - qnum_tmpb(npca) = tmpn / & - ( 1.0_r8 + (tmpa+tmpb*tmpn)*(1.0_r8 + 0.5_r8*tmpa) ) - else - tmpc = exp(-tmpa) - qnum_tmpb(npca) = tmpn*tmpc / & - ( 1.0_r8 + (tmpb*tmpn/tmpa)*(1.0_r8-tmpc) ) - end if - qnum_tmpc(npca) = (qnum_tmpa(npca) + qnum_tmpb(npca))*0.5_r8 - end if - -! marine-organics accum mode number loss - approximate analytical solution -! using average number conc. for accum and pcarbon modes - if (nmacc > 0) then - tmpa = ybetaij0( 9)*qnum_tmpc(nacc) & - + ybetaij0(10)*qnum_tmpc(npca) - tmpa = max( 0.0_r8, deltat*tmpa ) - tmpb = max( 0.0_r8, deltat*ybetaii0(9) ) - tmpn = qnum_tmpa(nmacc) - if (tmpa < 1.0e-5_r8) then - qnum_tmpb(nmacc) = tmpn / & - ( 1.0_r8 + (tmpa+tmpb*tmpn)*(1.0_r8 + 0.5_r8*tmpa) ) - else - tmpc = exp(-tmpa) - qnum_tmpb(nmacc) = tmpn*tmpc / & - ( 1.0_r8 + (tmpb*tmpn/tmpa)*(1.0_r8-tmpc) ) - end if - qnum_tmpc(nmacc) = (qnum_tmpa(nmacc) + qnum_tmpb(nmacc))*0.5_r8 - end if - -! aitken mode number loss - approximate analytical solution -! using average number conc. for accum, pcarbon, and marine-org accum modes - tmpa = ybetaij0(1)*qnum_tmpc(nacc) - if (npca > 0) tmpa = tmpa + ybetaij0(3)*qnum_tmpc(npca) - if (nmacc > 0) tmpa = tmpa + ybetaij0(4)*qnum_tmpc(nmacc) - tmpa = max( 0.0_r8, deltat*tmpa ) - tmpb = max( 0.0_r8, deltat*ybetaii0(1) ) - tmpn = qnum_tmpa(nait) - if (tmpa < 1.0e-5_r8) then - qnum_tmpb(nait) = tmpn / & - ( 1.0_r8 + (tmpa+tmpb*tmpn)*(1.0_r8 + 0.5_r8*tmpa) ) - else - tmpc = exp(-tmpa) - qnum_tmpb(nait) = tmpn*tmpc / & - ( 1.0_r8 + (tmpb*tmpn/tmpa)*(1.0_r8-tmpc) ) - end if - qnum_tmpc(nait) = (qnum_tmpa(nait) + qnum_tmpb(nait))*0.5_r8 - -! marine-organics aitken mode number loss - approximate analytical solution -! using average number conc. for accum, pcarbon, aitken, and marine-org accum modes - if (nmait > 0) then - tmpa = ybetaij0(5)*qnum_tmpc(nacc) + ybetaij0(7)*qnum_tmpc(nait) & - + ybetaij0(6)*qnum_tmpc(npca) + ybetaij0(8)*qnum_tmpc(nmacc) - tmpa = max( 0.0_r8, deltat*tmpa ) - tmpb = max( 0.0_r8, deltat*ybetaii0(5) ) - tmpn = qnum_tmpa(nmait) - if (tmpa < 1.0e-5_r8) then - qnum_tmpb(nmait) = tmpn / & - ( 1.0_r8 + (tmpa+tmpb*tmpn)*(1.0_r8 + 0.5_r8*tmpa) ) - else - tmpc = exp(-tmpa) - qnum_tmpb(nmait) = tmpn*tmpc / & - ( 1.0_r8 + (tmpb*tmpn/tmpa)*(1.0_r8-tmpc) ) - end if - qnum_tmpc(nmait) = (qnum_tmpa(nmait) + qnum_tmpb(nmait))*0.5_r8 - end if - - -! now calculate mass transfers between modes -! the transfer amounts are calculated using as an exponential decay of -! the initial mass concentrations, -! where the decay rate is calculated using the average (over time step) -! number concentrations for each mode -! the mass transfer calculations are first-order accurate in time, -! because the mass transferred out of a mode does not -! include any mass transferred in during the time step -! with this approach, the ordering is not important, but the mass transfer -! calculations are done in the reverse order of the number loss calculations - -! mass transfer out of marine-organics aitken mode -! uses average number conc. for accum, aitken, pcarbon, and marine-org accum modes - if (nmait > 0) then - tmp1 = max( 0.0_r8, ybetaij3(5)*qnum_tmpc(nacc) ) - tmp2 = max( 0.0_r8, ybetaij3(6)*qnum_tmpc(npca) ) - tmp3 = max( 0.0_r8, ybetaij3(7)*qnum_tmpc(nait) ) - tmp4 = max( 0.0_r8, ybetaij3(8)*qnum_tmpc(nmacc) ) - tmpa = tmp1 + tmp2 + tmp3 + tmp4 - tmpc = deltat*tmpa - if (tmpc > epsilonx2) then - ! calc coag change only when it is not ~= zero - tmp_xf = 1.0_r8 - exp(-tmpc) - tmp2 = tmp2/tmpa - tmp3 = tmp3/tmpa - tmp4 = tmp4/tmpa - tmp1 = 1.0_r8 - (tmp2 + tmp3 + tmp4) - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,nmait) - qaer_tmpb(iaer,nmait) = qaer_tmpb(iaer,nmait) - tmp_dq - qaer_tmpb(iaer,nacc ) = qaer_tmpb(iaer,nacc ) + tmp_dq*tmp1 - qaer_tmpb(iaer,npca ) = qaer_tmpb(iaer,npca ) + tmp_dq*tmp2 - qaer_tmpb(iaer,nait ) = qaer_tmpb(iaer,nait ) + tmp_dq*tmp3 - qaer_tmpb(iaer,nmacc) = qaer_tmpb(iaer,nmacc) + tmp_dq*tmp4 - qaer_del_coag_in(iaer,i_agepair_pca ) & - = qaer_del_coag_in(iaer,i_agepair_pca ) + tmp_dq*tmp2 - qaer_del_coag_in(iaer,i_agepair_macc) & - = qaer_del_coag_in(iaer,i_agepair_macc) + tmp_dq*tmp4 - end do - end if - end if - -! (ip == 2) modefrm = npca ; modetoo = nacc -! (ip == 1) modefrm = nait ; modetoo = nacc -! (ip == 3) modefrm = nait ; modetoo = npca -! (ip == 4) modefrm = nait ; modetoo = nmacc -! (ip == 5) modefrm = nmait ; modetoo = nacc -! (ip == 6) modefrm = nmait ; modetoo = npca -! (ip == 7) modefrm = nmait ; modetoo = nait -! (ip == 8) modefrm = nmait ; modetoo = nmacc -! (ip == 9) modefrm = nmacc ; modetoo = nacc -! (ip ==10) modefrm = nmacc ; modetoo = npca - -! mass transfer out of aitken mode -! uses average number conc. for accum, pcarbon, and marine-org accum modes - tmp1 = max( 0.0_r8, ybetaij3(1)*qnum_tmpc(nacc) ) - if (nmacc > 0) then - tmp2 = max( 0.0_r8, ybetaij3(3)*qnum_tmpc(npca) ) - tmp3 = max( 0.0_r8, ybetaij3(4)*qnum_tmpc(nmacc) ) - else if (npca > 0) then - tmp2 = max( 0.0_r8, ybetaij3(3)*qnum_tmpc(npca) ) - tmp3 = 0.0_r8 - else - tmp2 = 0.0_r8 - tmp3 = 0.0_r8 - end if - tmpa = tmp1 + tmp2 + tmp3 - tmpc = deltat*tmpa - if (tmpc > epsilonx2) then - ! calc coag change only when it is not ~= zero - tmp_xf = 1.0_r8 - exp(-tmpc) - if (nmacc > 0) then - tmp2 = tmp2/tmpa - tmp3 = tmp3/tmpa - tmp1 = 1.0_r8 - (tmp2 + tmp3) - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,nait) - qaer_tmpb(iaer,nait) = qaer_tmpb(iaer,nait) - tmp_dq - qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq*tmp1 - qaer_tmpb(iaer,npca) = qaer_tmpb(iaer,npca) + tmp_dq*tmp2 - qaer_tmpb(iaer,nmacc) = qaer_tmpb(iaer,nmacc) + tmp_dq*tmp3 - qaer_del_coag_in(iaer,i_agepair_pca) & - = qaer_del_coag_in(iaer,i_agepair_pca) + tmp_dq*tmp2 - qaer_del_coag_in(iaer,i_agepair_macc) & - = qaer_del_coag_in(iaer,i_agepair_macc) + tmp_dq*tmp3 - end do - else if (npca > 0) then - tmp2 = tmp2/tmpa - tmp1 = 1.0_r8 - tmp2 - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,nait) - qaer_tmpb(iaer,nait) = qaer_tmpb(iaer,nait) - tmp_dq - qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq*tmp1 - qaer_tmpb(iaer,npca) = qaer_tmpb(iaer,npca) + tmp_dq*tmp2 - qaer_del_coag_in(iaer,i_agepair_pca) & - = qaer_del_coag_in(iaer,i_agepair_pca) + tmp_dq*tmp2 - end do - else - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,nait) - qaer_tmpb(iaer,nait) = qaer_tmpb(iaer,nait) - tmp_dq - qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq - end do - end if - end if - -!! old version for 3 and 7 mode only -!! mass transfer out of aitken mode mass -!! uses average number conc. for accum and pcarbon modes -! tmpa = max( 0.0_r8, ybetaij3(1)*qnum_tmpc(nacc) ) -! if (npca > 0) then -! tmpb = max( 0.0_r8, ybetaij3(3)*qnum_tmpc(npca) ) -! tmpc = tmpa + tmpb -! else -! tmpc = tmpa -! end if -! tmpc = deltat*tmpc -! if (tmpc > epsilonx2) then -! ! calc coag change only when it is not ~= zero -! tmp_xf = 1.0_r8 - exp(-tmpc) -! if (npca > 0) then -! tmp2 = tmpb/(tmpa + tmpb + epsilonx1) -! tmp1 = 1.0_r8 - tmp2 -! do iaer = 1, naer -! tmp_dq = tmp_xf*qaer_tmpa(iaer,nait) -! qaer_tmpb(iaer,nait) = qaer_tmpb(iaer,nait) - tmp_dq -! qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq*tmp1 -! qaer_tmpb(iaer,npca) = qaer_tmpb(iaer,npca) + tmp_dq*tmp2 -! qaer_del_coag_in(iaer,i_agepair_pca) & -! = qaer_del_coag_in(iaer,i_agepair_pca) + tmp_dq*tmp2 -! end do -! else -! do iaer = 1, naer -! tmp_dq = tmp_xf*qaer_tmpa(iaer,nait) -! qaer_tmpb(iaer,nait) = qaer_tmpb(iaer,nait) - tmp_dq -! qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq -! end do -! end if -! end if - -! mass transfer out of marine-organics accum mode -! uses average number conc. for accum and pcarbon modes - if (nmacc > 0) then - tmp1 = max( 0.0_r8, ybetaij3( 9)*qnum_tmpc(nacc) ) - tmp2 = max( 0.0_r8, ybetaij3(10)*qnum_tmpc(npca) ) - tmpa = tmp1 + tmp2 - tmpc = deltat*tmpa - if (tmpc > epsilonx2) then - ! calc coag change only when it is not ~= zero - tmp_xf = 1.0_r8 - exp(-tmpc) - tmp2 = tmp2/tmpa - tmp1 = 1.0_r8 - tmp2 - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,nmacc) - qaer_tmpb(iaer,nmacc) = qaer_tmpb(iaer,nmacc) - tmp_dq - qaer_tmpb(iaer,nacc ) = qaer_tmpb(iaer,nacc ) + tmp_dq*tmp1 - qaer_tmpb(iaer,npca ) = qaer_tmpb(iaer,npca ) + tmp_dq*tmp2 - qaer_del_coag_in(iaer,i_agepair_pca ) & - = qaer_del_coag_in(iaer,i_agepair_pca ) + tmp_dq*tmp2 - end do - end if - end if - -! mass transfer out of pcarbon mode -! uses average number conc. for accum mode - if (npca > 0) then - tmpc = max( 0.0_r8, ybetaij3(2)*qnum_tmpc(nacc) ) - tmpc = deltat*tmpc - if (tmpc > epsilonx2) then - tmp_xf = 1.0_r8 - exp(-tmpc) - do iaer = 1, naer - tmp_dq = tmp_xf*qaer_tmpa(iaer,npca) - qaer_tmpb(iaer,npca) = qaer_tmpb(iaer,npca) - tmp_dq - qaer_tmpb(iaer,nacc) = qaer_tmpb(iaer,nacc) + tmp_dq - end do - end if - end if - -! mass transfer out of accum mode - there is no transfer out of this mode - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - if ( ldiag15n ) then -! diagnostics - do n = 1, 3 - write(lun15n,'(a,i5,1p,10e11.3)') 'n, qnum_tmpa/b/c', n, & - qnum_tmpa(n), qnum_tmpc(n), qnum_tmpb(n), & - qnum_tmpb(n)-qnum_tmpa(n), & - 1.0_r8-qnum_tmpb(n)/max(1.0e-5_r8,qnum_tmpa(n)) - end do - do n = 1, 3 - write(lun15n,'(a,i5,1p,10e11.3)') 'n, dgnd/w, densw', n, & - dgn_a(n), dgn_awet(n), wetdens(n) - end do - end if -#endif - - qnum_cur = qnum_tmpb - qaer_cur = qaer_tmpb - - return - end subroutine mam_coag_1subarea - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine mam_pcarbon_aging_1subarea( & - nstep, lchnk, & - i, k, jsub, & - latndx, lonndx, lund, & - deltat, dgn_a, do_cond, & - n_mode, & - qnum_cur, qnum_del_cond, qnum_del_coag, & - qaer_cur, qaer_del_cond, qaer_del_coag, & - qaer_del_coag_in, & - qwtr_cur ) - -! uses - - implicit none - -! arguments - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: i, k ! column and level indices - integer, intent(in) :: jsub ! sub-area index - integer, intent(in) :: latndx, lonndx ! lat and lon indices - integer, intent(in) :: lund ! logical unit for diagnostic output - integer, intent(in) :: n_mode ! current number of modes (including temporary) - - logical, intent(in) :: do_cond ! true if condensation (gas-aerosol exch) is on - - real(r8), intent(in) :: deltat ! model timestep (s) - real(r8), intent(in), dimension( 1:max_mode ) :: & - dgn_a ! dgnum_dry of mode - - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qnum_cur, qnum_del_cond, qnum_del_coag - real(r8), intent(inout), dimension( 1:max_aer, 1:max_mode ) :: & - qaer_cur, qaer_del_cond, qaer_del_coag - real(r8), intent(inout), dimension( 1:max_aer, 1:max_agepair ) :: & - qaer_del_coag_in -! *** need to add qaer_del_coag_nmoacc_in - real(r8), intent(inout), dimension( 1:max_mode ) :: & - qwtr_cur - -! local variables - integer :: iaer, ipair, itmpa - integer :: nfrm, ntoo - - real(r8) :: fac_volsfc - real(r8) :: tmpa, tmp1, tmp2, tmp3, tmp4 - real(r8) :: vol_core, vol_shell - real(r8) :: xferfrac_max, xferfrac_pcage - - -! -agepair_loop1: & - do ipair = 1, n_agepair - - nfrm = modefrm_agepair(ipair) - ntoo = modetoo_agepair(ipair) - - vol_shell = qaer_cur(iaer_so4,nfrm)*fac_m2v_aer(iaer_so4) - tmp3 = qaer_del_cond(iaer_so4,nfrm) *fac_m2v_aer(iaer_so4) - tmp4 = qaer_del_coag_in(iaer_so4,ipair)*fac_m2v_aer(iaer_so4) - - do iaer = 1, naer -! species that contribute to aging are -! so4 (but it is already done) -! soa, nh4 and no3 -! ncl and cl (when aging_include_seasalt == .true.) - if ( (iaer <= nsoa ) .or. & - (iaer == iaer_nh4) .or. & - (iaer == iaer_no3) .or. & - (iaer == iaer_cl ) ) then - continue - else if (iaer == iaer_ncl) then - if (aging_include_seasalt .eqv. .false.) cycle - else - cycle - end if - - if ( (iaer == iaer_cl ) .and. & - (aging_include_seasalt .eqv. .false.) ) then - ! special case - only include the cl from condensation - tmp1 = max( qaer_del_cond(iaer,nfrm), 0.0_r8 ) - tmp2 = max( qaer_del_coag_in(iaer,ipair), 0.0_r8 ) + tmp1 - if (tmp2 >= 1.0e-35_r8) then - vol_shell = vol_shell + qaer_cur(iaer,nfrm)*fac_m2v_eqvhyg_aer(iaer)*(tmp1/tmp2) - tmp3 = tmp3 + qaer_del_cond(iaer,nfrm)*fac_m2v_eqvhyg_aer(iaer) - end if - else - vol_shell = vol_shell + qaer_cur(iaer,nfrm)*fac_m2v_eqvhyg_aer(iaer) - tmp3 = tmp3 + qaer_del_cond(iaer,nfrm)*fac_m2v_eqvhyg_aer(iaer) - tmp4 = tmp4 + qaer_del_coag_in(iaer,ipair)*fac_m2v_eqvhyg_aer(iaer) - end if - end do - - if ( do_cond ) then - tmp3 = max( tmp3, 1.0e-35_r8 ) - tmp3 = tmp3/(tmp3 + max( tmp4, 0.0_r8 )) - else - tmp3 = 0.0_r8 - end if - tmp4 = 1.0_r8 - tmp3 - - vol_core = 0.0 - do iaer = 1, naer - ! for core volume, only include the mapped species - ! which are primary and low hygroscopicity - if (lmap_aer(iaer,nfrm) > 0) & - vol_core = vol_core + qaer_cur(iaer,nfrm)*fac_m2v_aer(iaer) - end do -! ratio1 = vol_shell/vol_core = -! actual hygroscopic-shell-volume/carbon-core-volume after gas uptake -! ratio2 = 6.0_r8*dr_so4_monolayers_pcage/(dgncur_a*fac_volsfc) -! = (shell-volume corresponding to n_so4_monolayers_pcage)/core-volume -! The 6.0/(dgncur_a*fac_volsfc) = (mode-surface-area/mode-volume) -! Note that vol_shell includes both so4+nh4 AND soa as "equivalent so4", -! The soa_equivso4_factor accounts for the lower hygroscopicity of soa. -! -! Define xferfrac_pcage = min( 1.0, ratio1/ratio2) -! But ratio1/ratio2 == tmp1/tmp2, and coding below avoids possible overflow -! - fac_volsfc = exp( 2.5*(alnsg_aer(nfrm)**2) ) - xferfrac_max = 1.0_r8 - 10.0_r8*epsilon(1.0_r8) ! 1-eps - - tmp1 = vol_shell*dgn_a(nfrm)*fac_volsfc - tmp2 = max( 6.0_r8*dr_so4_monolayers_pcage*vol_core, 0.0_r8 ) - if (tmp1 >= tmp2) then - xferfrac_pcage = xferfrac_max - else - xferfrac_pcage = min( tmp1/tmp2, xferfrac_max ) - end if - - do iaer = 1, naer - if (lmap_aer(iaer,nfrm) > 0) then - ! species is pom or bc - ! transfer the aged fraction to accum mode - ! include this transfer change in the cond and/or coag change (for mass budget) - tmpa = qaer_cur(iaer,nfrm)*xferfrac_pcage - qaer_cur(iaer,nfrm) = qaer_cur(iaer,nfrm) - tmpa - qaer_cur(iaer,ntoo) = qaer_cur(iaer,ntoo) + tmpa - qaer_del_cond(iaer,nfrm) = qaer_del_cond(iaer,nfrm) - tmpa*tmp3 - qaer_del_cond(iaer,ntoo) = qaer_del_cond(iaer,ntoo) + tmpa*tmp3 - qaer_del_coag(iaer,nfrm) = qaer_del_coag(iaer,nfrm) - tmpa*tmp4 - qaer_del_coag(iaer,ntoo) = qaer_del_coag(iaer,ntoo) + tmpa*tmp4 - else - ! species is soa, so4, or nh4 produced by condensation or coagulation - ! transfer all of it to accum mode - ! also transfer the condensation and coagulation changes - ! to accum mode (for mass budget) - qaer_cur(iaer,ntoo) = qaer_cur(iaer,ntoo) & - + qaer_cur(iaer,nfrm) - qaer_del_cond(iaer,ntoo) = qaer_del_cond(iaer,ntoo) & - + qaer_del_cond(iaer,nfrm) - qaer_del_coag(iaer,ntoo) = qaer_del_coag(iaer,ntoo) & - + qaer_del_coag(iaer,nfrm) - qaer_cur(iaer,nfrm) = 0.0_r8 - qaer_del_cond(iaer,nfrm) = 0.0_r8 - qaer_del_coag(iaer,nfrm) = 0.0_r8 - end if - end do - ! number - transfer the aged fraction to accum mode - ! include this transfer change in the cond and/or coag change (for mass budget) - tmpa = qnum_cur(nfrm)*xferfrac_pcage - qnum_cur(nfrm) = qnum_cur(nfrm) - tmpa - qnum_cur(ntoo) = qnum_cur(ntoo) + tmpa - qnum_del_cond(nfrm) = qnum_del_cond(nfrm) - tmpa*tmp3 - qnum_del_cond(ntoo) = qnum_del_cond(ntoo) + tmpa*tmp3 - qnum_del_coag(nfrm) = qnum_del_coag(nfrm) - tmpa*tmp4 - qnum_del_coag(ntoo) = qnum_del_coag(ntoo) + tmpa*tmp4 - - end do agepair_loop1 - - return - end subroutine mam_pcarbon_aging_1subarea - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - function mean_molecular_speed( temp, rmw ) - implicit none - real(8) :: mean_molecular_speed ! (m/s) - real(8) :: temp ! temperature (K) - real(8) :: rmw ! molec. weight (g/mol) - mean_molecular_speed = 145.5_8 * sqrt(temp/rmw) - return - end function mean_molecular_speed - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - function gas_diffusivity( t_k, p_atm, rmw, vm ) - implicit none - real(8) :: gas_diffusivity ! (m2/s) - real(8) :: t_k ! temperature (K) - real(8) :: p_atm ! pressure (atmospheres) - real(8) :: rmw ! molec. weight (g/mol) - real(8) :: vm ! molar volume (units = ??) - - real(8) :: dgas - - dgas = (1.0e-3_8 * t_k**1.75_8 * sqrt(1./rmw + 0.035_8))/ & - (p_atm * (vm**0.3333333333333333_8 + 2.7189_8)**2) - gas_diffusivity = dgas*1.0e-4_8 - return - end function gas_diffusivity - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine gas_aer_uptkrates_1box1gas( & - accom, gasdiffus, gasfreepath, & - beta_inp, n_mode, dgncur_awet, lnsg, uptkrate ) -! -! / -! computes uptkrate = | dx dN/dx gas_conden_rate(Dp(x)) -! / -! using Gauss-Hermite quadrature of order nghq=2 -! -! Dp = particle diameter (cm) -! x = ln(Dp) -! dN/dx = log-normal particle number density distribution -! gas_conden_rate(Dp) = 2 * pi * gasdiffus * Dp * F(Kn,ac) -! F(Kn,ac) = Fuchs-Sutugin correction factor -! Kn = Knudsen number -! ac = accomodation coefficient -! - implicit none - - integer, parameter :: r8 = 8 - - integer, intent(in) :: n_mode ! number of modes - - real(r8), intent(in) :: accom ! accomodation coefficient (--) - real(r8), intent(in) :: gasdiffus ! gas diffusivity (m2/s) - real(r8), intent(in) :: gasfreepath ! gas mean free path (m) - real(r8), intent(in) :: beta_inp ! quadrature parameter (--) - real(r8), intent(in) :: dgncur_awet(n_mode) - ! mode-median wet diameter of number distribution (m) - real(r8), intent(in) :: lnsg(n_mode) - ! ln( sigmag ) (--) - real(r8), intent(out) :: uptkrate(n_mode) - ! gas-to-aerosol mass transfer rates (1/s) - ! for number concentration = 1 #/m3 - - -! local - integer, parameter :: nghq = 2 - integer :: i, iq, k, l1, l2, la, n - - real(r8), parameter :: tworootpi = 3.5449077018110320_r8 - real(r8), parameter :: root2 = 1.4142135623730950_r8 - real(r8), parameter :: one = 1.0_r8 - real(r8), parameter :: two = 2.0_r8 - - real(r8) :: accomxp283, accomxp75 - real(r8) :: beta - real(r8) :: const - real(r8) :: dp, dum_m2v - real(r8) :: fuchs_sutugin - real(r8) :: knudsen - real(r8) :: lndp, lndpgn - real(r8) :: sumghq - real(r8) :: tmpa - real(r8), save :: xghq(nghq), wghq(nghq) ! quadrature abscissae and weights - - data xghq / 0.70710678, -0.70710678 / - data wghq / 0.88622693, 0.88622693 / - - - accomxp283 = accom * 0.283_r8 - accomxp75 = accom * 0.75_r8 - -! outermost loop over all modes - do n = 1, n_mode - - lndpgn = log( dgncur_awet(n) ) ! (m) - -! beta = dln(uptake_rate)/dln(dp) -! = 2.0 in free molecular regime, 1.0 in continuum regime -! if uptake_rate ~= a * (dp**beta), then the 2 point quadrature is very accurate - if (abs(beta_inp-1.5_r8) > 0.5_r8) then -! dp = dgncur_awet(n) * exp( 1.5_r8*(lnsg(n)**2) ) - dp = dgncur_awet(n) - knudsen = two*gasfreepath/dp - ! tmpa = dln(fuchs_sutugin)/d(knudsen) - tmpa = one/(one+knudsen) - (two*knudsen + one + accomxp283) / & - ( knudsen*( knudsen + one + accomxp283 ) + accomxp75 ) - beta = one - knudsen*tmpa - beta = max( one, min( two, beta ) ) - else - beta = beta_inp - end if - - const = tworootpi * exp( beta*lndpgn + 0.5_r8*(beta*lnsg(n))**2 ) - -! sum over gauss-hermite quadrature points - sumghq = 0.0 - do iq = 1, nghq - lndp = lndpgn + beta*lnsg(n)**2 + root2*lnsg(n)*xghq(iq) - dp = exp(lndp) - - knudsen = two*gasfreepath/dp - -! fkn = ( 0.75*accomcoef*(1. + xkn) ) / & -! ( xkn**2 + xkn + 0.283*xkn*accomcoef + 0.75*accomcoef ) - fuchs_sutugin = & - ( accomxp75*(one + knudsen) ) / & - ( knudsen*( knudsen + one + accomxp283 ) + accomxp75 ) - - sumghq = sumghq + wghq(iq)*dp*fuchs_sutugin/(dp**beta) - end do - uptkrate(n) = const * gasdiffus * sumghq - - end do ! "do n = 1, ntot_soamode" - - - return - end subroutine gas_aer_uptkrates_1box1gas - - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- -#ifndef GEOS5_PORT - subroutine modal_aero_amicphys_init( imozart ) -#else - subroutine modal_aero_amicphys_init( imozart, verbose ) -#endif - -!----------------------------------------------------------------------- -! -! Purpose: -! set do_adjust and do_aitken flags -! create history fields for column tendencies associated with -! modal_aero_calcsize -! -! Author: R. Easter -! -!----------------------------------------------------------------------- - -#ifndef GEOS5_PORT -use cam_history, only : fieldname_len -use cam_logfile, only : iulog -use chem_mods, only : adv_mass -use constituents, only : pcnst, cnst_get_ind, cnst_name -use mo_chem_utls, only : get_spc_ndx -use mo_tracname, only : solsym -use physconst, only : mwdry, mwh2o -use spmd_utils, only : masterproc -use phys_control,only : phys_getopts -#else -use chem_mods, only: adv_mass -use constituents, only: pcnst, cnst_get_ind, cnst_name -use MAPL_ConstantsMod, only: mwdry => MAPL_AIRMW, & - mwh2o => MAPL_H2OMW -#endif - -use modal_aero_data, only : & - cnst_name_cw, & - dgnum_amode, dgnumlo_amode, dgnumhi_amode, & - lmassptr_amode, lmassptrcw_amode, & - modeptr_accum, modeptr_aitken, modeptr_pcarbon, modeptr_ufine, & -#if ( defined MODAL_AERO_9MODE ) - modeptr_maccum, modeptr_maitken, & -#endif - nspec_amode, & - numptr_amode, numptrcw_amode, sigmag_amode, species_class - -implicit none - -!----------------------------------------------------------------------- -! arguments -#ifndef GEOS5_PORT - integer :: imozart -#else - integer, intent(in) :: imozart - logical, intent(in) :: verbose -#endif - -!----------------------------------------------------------------------- -! local - -#ifdef GEOS5_PORT - integer, parameter :: fieldname_len = 128 -#endif - - integer, parameter :: big_neg_int = -999888777 - integer, parameter :: big_pos_int = 999888777 - integer :: iaer, igas, ip, ipair, itmpa - integer :: j, jac, jsoa - integer :: l, l1, l2, lac - integer :: lmz, lmz2, loffset - integer :: l_so4g, l_nh4g, l_msag - integer :: m - integer :: n, na, nb, nc - integer :: nspec - - real(r8) :: tmp1, tmp2 - - character(len=fieldname_len) :: tmpnamea, tmpnameb - character(128) :: msg, fmtaa - character(2) :: tmpch2 - -#ifdef GEOS5_PORT - logical :: masterproc - masterproc = verbose -#endif - - !----------------------------------------------------------------------- - - -#if ( defined( CAMBOX_ACTIVATE_THIS ) ) - ldiag82 = .true. ; lun82 = 82 - ldiag97 = .true. ; lun97 = 97 - ldiag98 = .true. ; lun98 = 98 - ldiag13n = .true. ; lun13n = 130 - ldiag15n = .true. ; lun15n = 150 - ldiagd1 = .true. -#else - ldiag82 = .false. ; lun82 = iulog - ldiag97 = .false. ; lun97 = iulog - ldiag98 = .false. ; lun98 = iulog - ldiag13n = .false. ; lun13n = iulog - ldiag15n = .false. ; lun15n = iulog - ldiagd1 = .false. -#endif - - - call mam_set_lptr2_and_specxxx2 - - - mwuse_soa(:) = 150.0_r8 - mwuse_poa(:) = 150.0_r8 - -! set ngas, name_gas, and igas_xxx -! set naer, name_aerpfx, and iaer_xxx - name_gas = '???' - name_aerpfx = '???' - name_aer = '???' - name_aercw = '???' - name_num = '???' - name_numcw = '???' - - igas_h2so4 = 0 ; igas_nh3 = 0 - iaer_bc = 0 ; iaer_dst = 0 - iaer_ncl = 0 ; iaer_nh4 = 0 - iaer_pom = 0 ; iaer_soa = 0 - iaer_so4 = 0 - iaer_no3 = 0 ; iaer_cl = 0 - iaer_ca = 0 ; iaer_co3 = 0 - iaer_mpoly = 0 ; iaer_mprot = 0 - iaer_mlip = 0 ; iaer_mhum = 0 - iaer_mproc = 0 ; - - if (nsoa == 1) then - name_gas(1) = 'SOAG' - name_aerpfx(1) = 'soa' - else if (nsoa == 2) then - jsoa = 1 ; name_gas(jsoa) = 'SOAGa' ; name_aerpfx(jsoa) = 'soaa' ! jsoa=1 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGb' ; name_aerpfx(jsoa) = 'soab' ! jsoa=2 - else if (nsoa == 6) then - jsoa = 1 ; name_gas(jsoa) = 'SOAGa1' ; name_aerpfx(jsoa) = 'soaa1' ! jsoa=1 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGa2' ; name_aerpfx(jsoa) = 'soaa2' ! jsoa=2 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGa3' ; name_aerpfx(jsoa) = 'soaa3' ! jsoa=3 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGb1' ; name_aerpfx(jsoa) = 'soab1' ! jsoa=4 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGb2' ; name_aerpfx(jsoa) = 'soab2' ! jsoa=5 - jsoa = jsoa+1 ; name_gas(jsoa) = 'SOAGb3' ; name_aerpfx(jsoa) = 'soab3' ! jsoa=6 - else - call endrun( 'modal_aero_amicphys_init ERROR - bad nsoa' ) - end if - ngas = nsoa - naer = nsoa - igas_soa = 1 - iaer_soa = 1 - - ngas = ngas + 1 - name_gas(ngas) = 'H2SO4' - naer = naer + 1 - name_aerpfx(naer) = 'so4' - igas_h2so4 = ngas - iaer_so4 = naer - - if ( (ntot_amode==7) .or. & - (ntot_amode==8) .or. & - (ntot_amode==9) ) then - ngas = ngas + 1 - name_gas(ngas) = 'NH3' - naer = naer + 1 - name_aerpfx(naer) = 'nh4' - igas_nh3 = ngas - iaer_nh4 = naer - end if - -#if ( ( defined MODAL_AERO_4MODE) && ( defined MOSAIC_SPECIES ) ) - ngas = ngas + 1 - name_gas(ngas) = 'NH3' - naer = naer + 1 - name_aerpfx(naer) = 'nh4' - igas_nh3 = ngas - iaer_nh4 = naer -#endif - - -#if ( ( defined MODAL_AERO_7MODE || defined MODAL_AERO_4MODE) && ( defined MOSAIC_SPECIES ) ) - ngas = ngas + 1 - name_gas(ngas) = 'HNO3' - naer = naer + 1 - name_aerpfx(naer) = 'no3' - igas_hno3 = ngas - iaer_no3 = naer - - ngas = ngas + 1 - name_gas(ngas) = 'HCL' - naer = naer + 1 - name_aerpfx(naer) = 'cl' - igas_hcl = ngas - iaer_cl = naer -#endif - - iaer_pom = naer + 1 - if (npoa == 1) then - naer = naer + 1 - name_aerpfx(naer) = 'pom' - else if (npoa == 2) then - naer = naer + 1 - name_aerpfx(naer) = 'poma' - naer = naer + 1 - name_aerpfx(naer) = 'pomb' - else - call endrun( 'modal_aero_amicphys_init ERROR - bad npoa' ) - end if - - iaer_bc = naer + 1 - if (nbc == 1) then - naer = naer + 1 - name_aerpfx(naer) = 'bc' - else if (nbc == 2) then - naer = naer + 1 - name_aerpfx(naer) = 'bca' - naer = naer + 1 - name_aerpfx(naer) = 'bcb' - else - call endrun( 'modal_aero_amicphys_init ERROR - bad nbc' ) - end if - - naer = naer + 1 - name_aerpfx(naer) = 'ncl' - iaer_ncl = naer - naer = naer + 1 - name_aerpfx(naer) = 'dst' - iaer_dst = naer - -#if ( ( defined MODAL_AERO_7MODE || defined MODAL_AERO_4MODE ) && ( defined MOSAIC_SPECIES ) ) - naer = naer + 1 - name_aerpfx(naer) = 'ca' - iaer_ca = naer - naer = naer + 1 - name_aerpfx(naer) = 'co3' - iaer_co3 = naer -#endif - - if (ntot_amode==9) then - naer = naer + 1 - name_aerpfx(naer) = 'mpoly' - iaer_mpoly = naer - naer = naer + 1 - name_aerpfx(naer) = 'mprot' - iaer_mprot = naer - naer = naer + 1 - name_aerpfx(naer) = 'mlip' - iaer_mlip = naer - naer = naer + 1 - name_aerpfx(naer) = 'mhum' - iaer_mhum = naer - naer = naer + 1 - name_aerpfx(naer) = 'mproc' - iaer_mproc = naer - end if - - if ((ngas /= max_gas) .or. (naer /= max_aer)) then - write(iulog,'(a,4i10)') 'ngas, max_gas, naer, max_aer', & - ngas, max_gas, naer, max_aer - call endrun( 'modal_aero_amicphys_init ERROR - bad ngas or naer' ) - end if - - lmapcc_all(:) = 0 - -! set gas mapping - loffset = imozart - 1 - lmap_gas(:) = 0 - mwhost_gas(:) = 1.0_r8 - mw_gas(:) = 1.0_r8 - fcvt_gas(:) = 1.0_r8 - - vol_molar_gas = 42.88_r8 ! value for h2so4 - accom_coef_gas = 0.65_r8 ! value for h2so4 - - do igas = 1, ngas - call cnst_get_ind( name_gas(igas), l, .false. ) - if (l < 1 .or. l > pcnst) then - msg = 'modal_aero_amicphys_init ERROR - lmap_gas for ' // name_gas(igas) - call endrun( msg ) - end if - lmz = l - loffset -#ifndef GEOS5_PORT - lmz2 = get_spc_ndx( name_gas(igas) ) -#else - lmz2 = lmz -#endif - if (lmz /= lmz2 .or. lmz <= 0) then - msg = 'modal_aero_amicphys_init ERROR - lmz /= lmz2 for ' // name_gas(igas) - call endrun( msg ) - end if - lmapcc_all(lmz) = lmapcc_val_gas - lmap_gas(igas) = lmz - - mwhost_gas(igas) = adv_mass(lmz) - mw_gas(igas) = mwhost_gas(igas) - if (igas <= nsoa) mw_gas(igas) = mwuse_soa(igas) - fcvt_gas(igas) = mwhost_gas(igas)/mw_gas(igas) - - if (igas <= nsoa) then - vol_molar_gas(igas) = vol_molar_gas(igas_h2so4) * (mw_gas(igas)/98.0_r8) - else if (igas == igas_nh3) then - vol_molar_gas(igas) = 14.90_r8 - else if (igas == igas_hno3) then - vol_molar_gas(igas) = 24.11_r8 - else if (igas == igas_hcl) then - vol_molar_gas(igas) = 21.48_r8 - end if -! values from mosaic code -! v_molar(iv)= 42.88_r8 ! h2so4 -! v_molar(iv)= 24.11_r8 ! hno3 -! v_molar(iv)= 21.48_r8 ! hcl -! v_molar(iv)= 14.90_r8 ! nh3 -! v_molar(iv)= 65.0_r8 ! soa - - end do ! igas - -! set aerosol mass and number mapping - lmap_aer(:,:) = 0 - lmap_aercw(:,:) = 0 - lmapbb_aer(:,:) = 0 - dens_aer(:) = 1.0_r8 - hygro_aer(:) = 1.0_r8 - mw_aer(:) = 1.0_r8 - fcvt_aer(:) = 1.0_r8 - - lmap_num(:) = 0 - lmap_numcw(:) = 0 - fcvt_num = 1.0_r8 ! leave number mix-ratios unchanged (#/kmol-air) - - fcvt_wtr = mwdry/mwh2o ! convert aerosol water mix-ratios from (kg/kg) to (mol/mol) - - do n = 1, ntot_amode - do lac = 1, 2 - do l1 = 1, nspec_amode(n) - if (lac == 1) then - l = lmassptr_amode(l1,n) - lmz = l - loffset - tmpnamea = cnst_name(l) - tmpch2 = '_a' - else - l = lmassptrcw_amode(l1,n) - lmz = 0 - tmpnamea = cnst_name_cw(l) - tmpch2 = '_c' - end if - iaer = 0 - do j = 1, naer - if (n <= 9) then - write(tmpnameb,'(2a,i1)') trim(name_aerpfx(j)), tmpch2, n - else - write(tmpnameb,'(2a,i2)') trim(name_aerpfx(j)), tmpch2, n - end if - if (tmpnamea == tmpnameb) then - iaer = j - exit - end if - end do - if (iaer <= 0) then - msg = 'modal_aero_amicphys_init ERROR - lmap_aer for ' // tmpnamea - call endrun( msg ) - end if - if (lac == 1) then - name_aer(iaer,n) = tmpnamea -#ifndef GEOS5_PORT - lmz2 = get_spc_ndx( tmpnamea ) -#else - lmz2 = lmz -#endif - if (lmz /= lmz2 .or. lmz <= 0) then - msg = 'modal_aero_amicphys_init ERROR - lmz /= lmz2 for ' // tmpnamea - call endrun( msg ) - end if - lmapcc_all(lmz) = lmapcc_val_aer - lmap_aer(iaer,n) = l - loffset - lmapbb_aer(iaer,n) = l1 - - dens_aer(iaer) = specdens2_amode(l1,n) - hygro_aer(iaer) = spechygro2(l1,n) - mwhost_aer(iaer) = specmw2_amode(l1,n) - mw_aer(iaer) = mwhost_aer(iaer) - - itmpa = iaer - iaer_pom + 1 - if (iaer <= nsoa) then - mw_aer(iaer) = mwuse_soa(iaer) - else if ((1 <= itmpa) .and. (itmpa <= npoa)) then - mw_aer(iaer) = mwuse_poa(itmpa) - end if - fcvt_aer(iaer) = mwhost_aer(iaer)/mw_aer(iaer) - fac_m2v_aer(iaer) = mw_aer(iaer)/dens_aer(iaer) - else - name_aercw(iaer,n) = tmpnamea - lmap_aercw(iaer,n) = l - loffset - end if - - end do ! l1 - end do ! lac - - lmap_num(n) = numptr_amode(n) - loffset - name_num(n) = cnst_name(numptr_amode(n)) - lmz = lmap_num(n) -#ifndef GEOS5_PORT - lmz2 = get_spc_ndx( name_num(n) ) -#else - lmz2 = lmz -#endif - if (lmz /= lmz2 .or. lmz <= 0) then - msg = 'modal_aero_amicphys_init ERROR - lmz /= lmz2 for ' // name_num(n) - call endrun( msg ) - end if - lmapcc_all(lmz) = lmapcc_val_num - - lmap_numcw(n) = numptrcw_amode(n) - loffset - name_numcw(n) = cnst_name_cw(numptrcw_amode(n)) - mwhost_num = 1.0_r8 - - end do ! n - - do iaer = 1, naer - fac_eqvso4hyg_aer(iaer) = hygro_aer(iaer)/hygro_aer(iaer_so4) - fac_m2v_eqvhyg_aer(iaer) = fac_m2v_aer(iaer) * fac_eqvso4hyg_aer(iaer) - end do ! naer - - sigmag_aer(:) = 1.8_r8 - sigmag_aer(1:ntot_amode) = sigmag_amode(1:ntot_amode) - alnsg_aer(1:max_mode) = log(sigmag_aer(1:max_mode)) - - dgnum_aer(:) = 3.0e-9_r8 - dgnumlo_aer(:) = 1.0e-9_r8 - dgnumhi_aer(:) = 10.0e-9_r8 - dgnum_aer(1:ntot_amode) = dgnum_amode(1:ntot_amode) - dgnumhi_aer(1:ntot_amode) = dgnumhi_amode(1:ntot_amode) - dgnumlo_aer(1:ntot_amode) = dgnumlo_amode(1:ntot_amode) - - ! converts number geometric_mean diameter to volume-mean diameter - fcvt_dgnum_dvolmean(1:max_mode) = exp( 1.5_r8*(alnsg_aer(1:max_mode)**2) ) - - dens_so4a_host = dens_aer(iaer_so4) - mw_so4a_host = mwhost_aer(iaer_so4) - if (iaer_nh4 > 0) then - mw_nh4a_host = mwhost_aer(iaer_nh4) - else - mw_nh4a_host = mw_so4a_host - end if - - - nacc = modeptr_accum - nait = modeptr_aitken - npca = modeptr_pcarbon - nufi = modeptr_ufine -#if ( defined MODAL_AERO_9MODE ) - nmacc = modeptr_maccum - nmait = modeptr_maitken -#else - nmacc = big_neg_int - nmait = big_neg_int -#endif - if ( nufi <= 0 .and. & - ntot_amode_extd > ntot_amode ) nufi = ntot_amode_extd - -! aging pairs - ipair = 0 - modefrm_agepair(:) = big_neg_int - modetoo_agepair(:) = big_neg_int - mode_aging_optaa(:) = 0 - i_agepair_pca = big_neg_int ; i_agepair_macc = big_neg_int ; i_agepair_mait = big_neg_int ; - if (npca > 0 .and. nacc > 0) then - ipair = ipair + 1 - modefrm_agepair(ipair) = npca - modetoo_agepair(ipair) = nacc - i_agepair_pca = ipair - mode_aging_optaa(npca) = 1 - end if - if (nmacc > 0 .and. nacc > 0) then - ipair = ipair + 1 - modefrm_agepair(ipair) = nmacc - modetoo_agepair(ipair) = nacc - i_agepair_macc = ipair - mode_aging_optaa(nmacc) = 1 - end if - if (nmait > 0 .and. nait > 0) then - ipair = ipair + 1 - modefrm_agepair(ipair) = nmait - modetoo_agepair(ipair) = nait - i_agepair_mait = ipair - mode_aging_optaa(nmait) = 1 - end if - n_agepair = ipair - -! coagulation pairs -! -! mam version modes involved in coagulation # of coag pairs -! ----------- ----------------------------- --------------- -! 3 mode accum, aitken 1 -! 4,7 mode accum, aitken, pcarbon 3 -! 9 mode accum, aitken, pcarbon, maccum, maitken 10 -! (pcarbon = primary carbon) -! (maccum = primary marine-organics accum) -! (maitken = primary marine-organics aitken) -! -! 9 mode -- 5 participating modes and 10 possible coagulation pairs -! 6 possible coagulation pairs involve a smaller and a larger sized mode -! the resulting particle is placed in the larger-sized mode -! aitken + [ accum, pcarbon, maccum ] -! maitken + [ accum, pcarbon, maccum ] -! 4 possible coagulation pairs involve similar sized modes -! the resulting particle is placed in the mode that is aged -! or contains the largest number of species -! pcarbon + accum --> accum (aged) -! maitken + aitken --> aitken (aged) -! maccum + accum --> accum (aged) -! maccum + pcarbon --> pcarbon (largest number of species) -! note that 2 of the coagulation pairs results in aging, so -! aitken + pcarbon --> pcarbon (temporary) --> accum -! aitken + maccum --> maccum (temporary) --> accum -! each mode also has self-coagulation which only affects number - ipair = 0 - modefrm_coagpair(:) = big_neg_int - modetoo_coagpair(:) = big_neg_int - modeend_coagpair(:) = big_neg_int - do ip = 1, 11 - na = big_neg_int ; nb = big_neg_int - nc = big_pos_int - if (ip == 1) then - na = nait ; nb = nacc - else if (ip == 2) then - na = npca ; nb = nacc - else if (ip == 3) then - na = nait ; nb = npca - nc = nacc - else if (ip == 4) then - na = nait ; nb = nmacc - nc = nacc - else if (ip == 5) then - na = nmait ; nb = nacc - else if (ip == 6) then - na = nmait ; nb = npca - else if (ip == 7) then - na = nmait ; nb = nait - else if (ip == 8) then - na = nmait ; nb = nmacc - else if (ip == 9) then - na = nmacc ; nb = nacc - else if (ip == 10) then - na = nmacc ; nb = npca - end if - if (nc == big_pos_int) nc = nb - - if (na < 1 .or. nb < 1 .or. nc < 1) cycle - ipair = ipair + 1 - modefrm_coagpair(ipair) = na - modetoo_coagpair(ipair) = nb - modeend_coagpair(ipair) = nc - end do - n_coagpair = ipair - - -! diagnostics - if ( masterproc ) then - write(iulog,'(/a)') 'modal_aero_amicphys_init start' - - write(iulog,'(/a,i12)') & - 'mdo_gaexch_cldy_subarea ', mdo_gaexch_cldy_subarea - write(iulog,'( a,i12)') & - 'gaexch_h2so4_uptake_optaa ', gaexch_h2so4_uptake_optaa - write(iulog,'( a,i12)') & - 'newnuc_h2so4_conc_optaa ', newnuc_h2so4_conc_optaa - write(iulog,'( a,i12)') & - 'rename_method_optaa ', rename_method_optaa - write(iulog,'( a,1p,e12.4)') & - 'newnuc_adjust_factor_pbl ', newnuc_adjust_factor_pbl - - write(iulog,'(/a56,10i5)') & - 'ngas, max_gas, naer, max_aer', & - ngas, max_gas, naer, max_aer - write(iulog,'(/a56,10i5)') & - 'nsoa, npoa, nbc', & - nsoa, npoa, nbc - write(iulog,'(/a56,10i5)') & - 'igas_soa, igas_h2so4, igas_nh3, igas_hno3, igas_hcl', & - igas_soa, igas_h2so4, igas_nh3, igas_hno3, igas_hcl - write(iulog,'(/a56,10i5)') & - 'iaer_soa, iaer_so4, iaer_nh4, iaer_no3, iaer_cl', & - iaer_soa, iaer_so4, iaer_nh4, iaer_no3, iaer_cl - write(iulog,'(/a56,10i5)') & - 'iaer_pom, iaer_bc, iaer_ncl, iaer_dst, iaer_ca, iaer_co3', & - iaer_pom, iaer_bc, iaer_ncl, iaer_dst, iaer_ca, iaer_co3 - write(iulog,'(/a56,10i5)') & - 'iaer_mpoly, iaer_mprot, iaer_mlip, iaer_mhum, iaer_mproc', & - iaer_mpoly, iaer_mprot, iaer_mlip, iaer_mhum, iaer_mproc - write(iulog,'(/a)') & - 'fac_eqvso4hyg_aer(1:naer)' - write(iulog,'(4(a,1pe10.3,3x))') & - ( name_aerpfx(iaer)(1:6), fac_eqvso4hyg_aer(iaer), iaer=1,naer ) - - write(iulog,'(/a)') 'igas, lmap, name, mwhost, mw, fcvt, accom, vmol' - do igas = 1, ngas - write(iulog,'(2i4,2x,a,2f10.4,1p,3e12.4)') & - igas, lmap_gas(igas), name_gas(igas), & - mwhost_gas(igas), mw_gas(igas), fcvt_gas(igas), & - accom_coef_gas(igas), vol_molar_gas(igas) - end do - - do n = 1, ntot_amode - write(iulog,'(/a,i5)') & - 'iaer, lmap, name, mwhost, mw, fcvt, dens, fac_m2v, hygro for mode', n - write(iulog,'(2i4,2x,a,20x,1p,e12.4)') & - 0, lmap_num(n), name_num(n), fcvt_num - write(iulog,'(2i4,2x,a,20x,1p,e12.4)') & - 0, lmap_numcw(n), name_numcw(n) - do iaer = 1, naer - if (lmap_aer(iaer,n) > 0) then - if (max(mwhost_aer(iaer),mw_aer(iaer)) <= 9999.9999_r8) then - fmtaa = '(2i4,2x,a,2f10.4,1p,5e12.4)' - else - fmtaa = '(2i4,2x,a,2f10.2,1p,5e12.4)' - end if - write(iulog,fmtaa) & - iaer, lmap_aer(iaer,n), name_aer(iaer,n), & - mwhost_aer(iaer), mw_aer(iaer), fcvt_aer(iaer), & - dens_aer(iaer), fac_m2v_aer(iaer), hygro_aer(iaer) - write(iulog,'(2i4,2x,a,2f10.4,1p,4e12.4)') & - iaer, lmap_aercw(iaer,n), name_aercw(iaer,n) - end if - end do - end do ! n - - write(iulog,'(/a)') 'l, lmz, lmapcc_all, species_class, name' - do lmz = 1, gas_pcnst - l = lmz + loffset - j = -99 - if (l <= pcnst) j = species_class(l) - write(iulog,'(4i5,2x,a)') & -#ifndef GEOS5_PORT - lmz+loffset, lmz, lmapcc_all(lmz), j, solsym(lmz) -#else - lmz+loffset, lmz, lmapcc_all(lmz), j -#endif - end do - - end if ! ( masterproc ) - - -#ifndef GEOS5_PORT - call m_a_amicphys_init_history( loffset ) -#else - call m_a_amicphys_init_history( loffset, verbose ) -#endif - - if ( masterproc ) write(iulog,'(/a)') 'modal_aero_amicphys_init end' - - return - end subroutine modal_aero_amicphys_init - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine mam_set_lptr2_and_specxxx2 -! -! initializes the following -! lptr2_soa_a_amode, lptr2_soa_g_amode, & -! specdens2_amode, spechygro2, specmw2_amode -! when the multiple nbc/npoa/nsoa flavors is implemented, -! this can be done in modal_aero_initialize_data -! - use cam_logfile, only : iulog - use constituents, only : pcnst, cnst_get_ind, cnst_name - - use modal_aero_data, only : & - lspectype_amode, & - lptr_soa_a_amode, lptr2_soa_a_amode, lptr2_soa_g_amode, & - nspec_amode, ntot_amode, & - specdens_amode, spechygro, specmw_amode - - implicit none - - integer :: jsoa - integer :: l1, l2 - integer :: n - - - if (nsoa == 1) then - jsoa = 1 - call cnst_get_ind( 'SOAG', l1, .false. ) - if (l1 < 1 .or. l1 > pcnst) & - call endrun( 'mam_set_lptr2_and_specxxx2 ERROR - no SOAG' ) - lptr2_soa_g_amode(jsoa) = l1 - do n = 1, ntot_amode - lptr2_soa_a_amode(n,jsoa) = lptr_soa_a_amode(n) - end do - else - call endrun( 'mam_set_lptr2_and_specxxx2 ERROR - expecting nsoa = 1' ) - end if - - do n = 1, ntot_amode - do l1 = 1, nspec_amode(n) - l2 = lspectype_amode(l1,n) - specmw2_amode(l1,n) = specmw_amode(l2) - specdens2_amode(l1,n) = specdens_amode(l2) - spechygro2(l1,n) = spechygro(l2) - end do - end do - - - return - end subroutine mam_set_lptr2_and_specxxx2 - - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- -#ifndef GEOS5_PORT - subroutine m_a_amicphys_init_history( loffset ) -#else - subroutine m_a_amicphys_init_history( loffset, verbose ) -#endif - -!----------------------------------------------------------------------- -! -! Purpose: -! set do_adjust and do_aitken flags -! create history fields for column tendencies associated with -! modal_aero_calcsize -! -! Author: R. Easter -! -!----------------------------------------------------------------------- -#ifndef GEOS5_PORT -use cam_history, only : addfld, add_default, fieldname_len, phys_decomp -use cam_logfile, only : iulog -use constituents, only : pcnst, cnst_get_ind, cnst_name -use spmd_utils, only : masterproc -use phys_control,only : phys_getopts -#else -use cam_logfile, only : iulog -use constituents, only : cnst_name -#endif -use modal_aero_data, only : & - cnst_name_cw, & - modeptr_accum, modeptr_aitken, modeptr_pcarbon, modeptr_ufine -!use modal_aero_rename - -implicit none - -!----------------------------------------------------------------------- -! arguments - integer, intent(in) :: loffset -#ifdef GEOS5_PORT - logical, intent(in) :: verbose -#endif - -!----------------------------------------------------------------------- -! local - integer :: iaer, igas, ipair, iok - integer :: lmz, lmza, lmzb, lmzc - integer :: m - integer :: n, na, nb, nc - - real(r8) :: tmp1, tmp2 - -#ifdef GEOS5_PORT - integer, parameter :: fieldname_len = 120 - logical:: masterproc -#endif - - character(len=fieldname_len) :: tmpnamea, tmpnameb - character(len=fieldname_len+3) :: fieldname - character(128) :: long_name - character(128) :: msg - character(8) :: unit - character(2) :: tmpch2 - - logical :: history_aerosol ! Output the MAM aerosol tendencies - logical :: history_aerocom ! Output the aerocom history - !----------------------------------------------------------------------- - -#ifndef GEOS5_PORT - call phys_getopts( history_aerosol_out = history_aerosol ) -#if ( defined CAM_VERSION_IS_ACME ) - history_aerocom = .false. -#else - call phys_getopts( history_aerocom_out = history_aerocom ) -#endif -#else - history_aerosol = .false. - history_aerocom = .false. - - masterproc = verbose -#endif - - -! -! set the do_q_coltendaa -! - do_q_coltendaa(:,:) = .false. - - -! gas-->aer condensation and resulting aging - do igas = 1, ngas - lmz = lmap_gas(igas) - if (lmz <= 0) cycle - do_q_coltendaa(lmz,iqtend_cond) = .true. - iaer = igas - do n = 1, ntot_amode - lmz = lmap_aer(iaer,n) - if (lmz <= 0) cycle - do_q_coltendaa(lmz,iqtend_cond) = .true. - end do ! n - end do ! igas - - do ipair = 1, n_agepair - na = modefrm_agepair(ipair) - nb = modetoo_agepair(ipair) - if (na < 1 .or. nb < 1) cycle - - lmza = lmap_num(na) - lmzb = lmap_num(nb) - do_q_coltendaa(lmza,iqtend_cond) = .true. - do_q_coltendaa(lmzb,iqtend_cond) = .true. - do iaer = 1, naer - lmza = lmap_aer(iaer,na) - lmzb = lmap_aer(iaer,nb) - if (lmza > 0) then - do_q_coltendaa(lmza,iqtend_cond) = .true. - if (lmzb > 0) do_q_coltendaa(lmzb,iqtend_cond) = .true. - end if - end do ! iaer - end do ! ipair - -! define history fields for gas-->aer condensation and resulting aging - do lmz = 1, gas_pcnst - if ( do_q_coltendaa(lmz,iqtend_cond)) then - tmpnamea = cnst_name(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfgaex1' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange primary column tendency' - unit = 'kg/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x))') 'gasaerexch addfld', fieldname, unit -#endif - end if - end do ! lmz - -! define history fields for 3d soa production for aerocom - do igas = 1, nsoa - lmz = lmap_gas(igas) - if (lmz <= 0) cycle - if ( .not. do_q_coltendaa(lmz,iqtend_cond)) cycle - if ( .not. history_aerocom ) cycle - - tmpnamea = cnst_name(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfgaex3d' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange primary 3d tendency' - unit = 'kg/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, pver, 'A', long_name, phys_decomp ) - call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x),2i5)') & - 'gasaerexch addfld', fieldname, unit, igas, lmz+loffset -#endif - end do - - -! renaming during gas-->aer condensation or cloud chemistry - na = modeptr_aitken - nb = modeptr_accum - if (na > 0 .and. nb > 0) then - lmza = lmap_num(na) - lmzb = lmap_num(nb) - do_q_coltendaa(lmza,iqtend_rnam) = .true. - do_q_coltendaa(lmzb,iqtend_rnam) = .true. - lmza = lmap_numcw(na) - lmzb = lmap_numcw(nb) - do_qqcw_coltendaa(lmza,iqqcwtend_rnam) = .true. - do_qqcw_coltendaa(lmzb,iqqcwtend_rnam) = .true. - do iaer = 1, naer - lmza = lmap_aer(iaer,na) - lmzb = lmap_aer(iaer,nb) - if (lmza > 0) then - do_q_coltendaa(lmza,iqtend_rnam) = .true. - if (lmzb > 0) do_q_coltendaa(lmzb,iqtend_rnam) = .true. - end if - lmza = lmap_aercw(iaer,na) - lmzb = lmap_aercw(iaer,nb) - if (lmza > 0) then - do_qqcw_coltendaa(lmza,iqqcwtend_rnam) = .true. - if (lmzb > 0) do_qqcw_coltendaa(lmzb,iqqcwtend_rnam) = .true. - end if - end do ! iaer - end if ! (na > 0 .and. nb > 0) - -! define history fields for renaming during gas-->aer condensation or cloud chemistry - do lmz = 1, gas_pcnst - if ( do_q_coltendaa(lmz,iqtend_rnam)) then - tmpnamea = cnst_name(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfgaex2' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange renaming column tendency' - unit = 'kg/m2/s' - if (tmpnamea(1:4) == 'num_' .or. tmpnamea(1:4) == 'NUM_') unit = '#/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x))') 'gasaerexch addfld', fieldname, unit -#endif - end if - if ( do_qqcw_coltendaa(lmz,iqqcwtend_rnam)) then - tmpnamea = cnst_name_cw(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfgaex2' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange renaming column tendency' - unit = 'kg/m2/s' - if (tmpnamea(1:4) == 'num_' .or. tmpnamea(1:4) == 'NUM_') unit = '#/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x))') 'gasaerexch addfld', fieldname, unit -#endif - end if - end do ! lmz - - - -! coagulation - do ipair = 1, n_coagpair - na = modefrm_coagpair(ipair) - nb = modetoo_coagpair(ipair) - nc = modeend_coagpair(ipair) - if (na < 1 .or. nb < 1 .or. nc < 1) cycle - - lmza = lmap_num(na) - lmzb = lmap_num(nb) - lmzc = lmap_num(nc) - do_q_coltendaa(lmza,iqtend_coag) = .true. - do_q_coltendaa(lmzb,iqtend_coag) = .true. - do_q_coltendaa(lmzc,iqtend_coag) = .true. - do iaer = 1, naer - lmza = lmap_aer(iaer,na) - lmzb = lmap_aer(iaer,nb) - lmzc = lmap_aer(iaer,nc) - if (lmza > 0) then - do_q_coltendaa(lmza,iqtend_coag) = .true. - if (lmzc > 0) do_q_coltendaa(lmzc,iqtend_coag) = .true. - end if - if (nb == nc) cycle - if (lmzb > 0) then - do_q_coltendaa(lmzb,iqtend_coag) = .true. - if (lmzc > 0) do_q_coltendaa(lmzc,iqtend_coag) = .true. - end if - end do ! iaer - end do ! ipair - -! define history fields for coagulation - do lmz = 1, gas_pcnst - if ( do_q_coltendaa(lmz,iqtend_coag)) then - tmpnamea = cnst_name(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfcoag1' - long_name = trim(tmpnamea) // ' modal_aero coagulation column tendency' - unit = 'kg/m2/s' - if (tmpnamea(1:4) == 'num_' .or. tmpnamea(1:4) == 'NUM_') unit = '#/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x))') 'modal_aero_coag_init addfld', fieldname, unit -#endif - end if - end do ! lmz - - -! nucleation - n = modeptr_aitken - do igas = 1, ngas - iok = 0 - if (igas == igas_h2so4) iok = 1 - if (igas == igas_nh3 ) iok = 1 - if (iok <= 0) cycle - lmz = lmap_gas(igas) - if (lmz > 0) then - do_q_coltendaa(lmz,iqtend_nnuc) = .true. - iaer = igas - lmz = lmap_aer(iaer,n) - if (lmz > 0) do_q_coltendaa(lmz,iqtend_nnuc) = .true. - end if - end do ! igas - lmzc = lmap_num(n) - do_q_coltendaa(lmzc,iqtend_nnuc) = .true. - -! define history fields for nucleation - do lmz = 1, gas_pcnst - if ( do_q_coltendaa(lmz,iqtend_nnuc)) then - tmpnamea = cnst_name(lmz+loffset) - fieldname = trim(tmpnamea) // '_sfnnuc1' - long_name = trim(tmpnamea) // ' modal_aero new particle nucleation column tendency' - unit = 'kg/m2/s' - if (tmpnamea(1:4) == 'num_' .or. tmpnamea(1:4) == 'NUM_') unit = '#/m2/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,3x))') 'modal_aero_newnuc_init addfld', fieldname, unit -#endif - end if - end do ! lmz - - if ( history_aerocom ) then - tmpnamea = cnst_name(lmzc+loffset) - fieldname = trim(tmpnamea) // '_nuc1' - long_name = trim(tmpnamea) // ' modal_aero new particle nucleation tendency' - unit = '#/m3/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, pver, 'A', long_name, phys_decomp ) - call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,2x))') & - 'modal_aero_newnuc_init addfld', fieldname, unit -#endif - - fieldname = trim(tmpnamea) // '_nuc2' - long_name = trim(tmpnamea) // ' modal_aero cluster nucleation rate' - unit = '#/m3/s' -#ifndef GEOS5_PORT - call addfld( fieldname, unit, pver, 'A', long_name, phys_decomp ) - call add_default( fieldname, 1, ' ' ) - if ( masterproc ) write(iulog,'(3(a,2x))') & - 'modal_aero_newnuc_init addfld', fieldname, unit -#endif - endif - -#ifndef GEOS5_PORT -#if ( defined( MOSAIC_SPECIES ) ) - if ( mosaic ) then - !BSINGH - Adding addfld and add_default call for tracking convergence failures - call addfld('convergence_fail', 'no units', pver, 'A', 'For tracking MOSAIC convergence failure', phys_decomp ) - call addfld('max_kelvin_iter', 'no units', pver, 'A', 'For tracking when MOSAIC kelvin iterations hit max ', phys_decomp ) - call add_default( 'convergence_fail', 1, ' ' ) - call add_default( 'max_kelvin_iter', 1, ' ' ) - - do n = 1, 4 - do m = 1, 5 - fieldname = ' ' - write( fieldname(1:16), '(a,i1,a,i1)') 'astem_negval_', m, '_', n - call addfld( fieldname, 'no units', pver, 'A', 'For tracking ASTEM negative values', phys_decomp ) - call add_default( fieldname, 1, ' ' ) - end do - end do - end if -#endif -#endif - - return - end subroutine m_a_amicphys_init_history - - -!---------------------------------------------------------------------- - -end module modal_aero_amicphys - - diff --git a/MAMchem_GridComp/microphysics/modal_aero_calcsize.F90 b/MAMchem_GridComp/microphysics/modal_aero_calcsize.F90 deleted file mode 100644 index 22d4e1c5..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_calcsize.F90 +++ /dev/null @@ -1,1611 +0,0 @@ -module modal_aero_calcsize - -! RCE 07.04.13: Adapted from MIRAGE2 code - -#ifndef GEOS5_PORT -use shr_kind_mod, only: r8 => shr_kind_r8 -use spmd_utils, only: masterproc -use physconst, only: pi, rhoh2o, gravit - -use ppgrid, only: pcols, pver -use physics_types, only: physics_state, physics_ptend -use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field - -use phys_control, only: phys_getopts -use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_mmr, rad_cnst_get_aer_props, & - rad_cnst_get_mode_props, rad_cnst_get_mode_num - -use cam_logfile, only: iulog -use abortutils, only: endrun -use cam_history, only: addfld, add_default, fieldname_len, phys_decomp, outfld -use constituents, only: pcnst, cnst_name - -use ref_pres, only: top_lev => trop_cloud_top_lev -#else -use MAPL_ConstantsMod,only: r8 => MAPL_R8, pi => MAPL_PI, gravit => MAPL_GRAV -use cam_logfile, only: iulog -use abortutils, only: endrun -use constituents, only: pcnst, cnst_name -#endif - -#ifdef MODAL_AERO - -! these are the variables needed for the diagnostic calculation of dry radius -use modal_aero_data, only: ntot_amode, nspec_amode, & - numptr_amode, & - alnsg_amode, & - voltonumbhi_amode, voltonumblo_amode, & - dgnum_amode, dgnumhi_amode, dgnumlo_amode - - -! these variables are needed for the prognostic calculations to exchange mass -! between modes -#ifndef GEOS5_PORT -use modal_aero_data, only: numptrcw_amode, mprognum_amode, qqcw_get_field, lmassptrcw_amode, & - lmassptr_amode, modeptr_accum, modeptr_aitken, ntot_aspectype, & - lspectype_amode, specmw_amode, specdens_amode, voltonumb_amode, & - cnst_name_cw -#else -use modal_aero_data, only: numptrcw_amode, mprognum_amode, lmassptrcw_amode, & - lmassptr_amode, modeptr_accum, modeptr_aitken, ntot_aspectype, & - lspectype_amode, specmw_amode, specdens_amode, voltonumb_amode, & - cnst_name_cw -#endif - -#endif - - -implicit none -private -save - -#ifndef GEOS5_PORT -public modal_aero_calcsize_init, modal_aero_calcsize_sub, modal_aero_calcsize_diag -#else -public modal_aero_calcsize_init, modal_aero_calcsize_sub -integer, parameter :: fieldname_len = 120 -#endif - -logical :: do_adjust_default -logical :: do_aitacc_transfer_default - -integer :: dgnum_idx = -1 - -integer, parameter, public :: maxpair_csizxf = 1 -integer, parameter, public :: maxspec_csizxf = ntot_aspectype - -integer, public :: npair_csizxf = -123456789 -integer, public :: modefrm_csizxf(maxpair_csizxf) -integer, public :: modetoo_csizxf(maxpair_csizxf) -integer, public :: nspecfrm_csizxf(maxpair_csizxf) -integer, public :: lspecfrmc_csizxf(maxspec_csizxf,maxpair_csizxf) -integer, public :: lspecfrma_csizxf(maxspec_csizxf,maxpair_csizxf) -integer, public :: lspectooc_csizxf(maxspec_csizxf,maxpair_csizxf) -integer, public :: lspectooa_csizxf(maxspec_csizxf,maxpair_csizxf) - -!=============================================================================== -contains -!=============================================================================== - -#ifndef GEOS5_PORT -subroutine modal_aero_calcsize_init() -#else -subroutine modal_aero_calcsize_init(verbose) -#endif - - !----------------------------------------------------------------------- - ! - ! Purpose: - ! set do_adjust_default and do_aitacc_transfer_default flags - ! create history fields for column tendencies associated with - ! modal_aero_calcsize - ! - ! Author: R. Easter - ! - !----------------------------------------------------------------------- - - use modal_aero_data, only: species_class -#ifdef GEOS5_PORT - implicit none - - logical, intent(in) :: verbose - - logical :: masterproc -#endif - ! local - integer :: ipair, iq, iqfrm, iqtoo - integer :: jac - integer :: lsfrm, lstoo, lsfrma, lsfrmc, lstooa, lstooc, lunout - integer :: mfrm, mtoo - integer :: n, nacc, nait, nspec - integer :: nchfrma, nchfrmc, nchfrmskip, nchtooa, nchtooc, nchtooskip - logical :: history_aerosol - - character(len=fieldname_len) :: tmpnamea, tmpnameb - character(len=fieldname_len+3) :: fieldname - character(128) :: long_name - character(8) :: unit - !----------------------------------------------------------------------- -#ifndef GEOS5 - call phys_getopts(history_aerosol_out=history_aerosol) -#else - history_aerosol = .false. - masterproc = verbose -#endif - - ! init entities required for both prescribed and prognostic modes - -#ifndef GEOS5_PORT - dgnum_idx = pbuf_get_index('DGNUM') -#else - dgnum_idx = -1 -#endif - npair_csizxf = 0 - modefrm_csizxf(1) = 0 - modetoo_csizxf(1) = 0 - -#ifndef MODAL_AERO - do_adjust_default = .false. - do_aitacc_transfer_default = .false. - -#else - ! do_adjust_default allows adjustment to be turned on/off - do_adjust_default = .true. - - ! do_aitacc_transfer_default allows aitken <--> accum mode transfer to be turned on/off - ! *** it can only be true when aitken & accum modes are both present - ! and have prognosed number and diagnosed surface/sigmag - nait = modeptr_aitken - nacc = modeptr_accum - do_aitacc_transfer_default = .false. - if ((modeptr_aitken > 0) .and. & - (modeptr_accum > 0) .and. & - (modeptr_aitken /= modeptr_accum)) then - do_aitacc_transfer_default = .true. - if (mprognum_amode(nait) <= 0) do_aitacc_transfer_default = .false. - if (mprognum_amode(nacc) <= 0) do_aitacc_transfer_default = .false. - end if - - if ( .not. do_adjust_default ) return - -! -! define history fields for number-adjust source-sink for all modes -! - -do_aitacc_transfer_if_block1: & - if ( do_aitacc_transfer_default ) then -! -! compute pointers for aitken <--> accum mode transfer -! (a2 <--> a1 transfer) -! transfers include number_a, number_c, mass_a, mass_c -! - npair_csizxf = 1 - modefrm_csizxf(1) = nait - modetoo_csizxf(1) = nacc - -! -! define species involved in each transfer pairing -! -aa_ipair: do ipair = 1, npair_csizxf - - mfrm = modefrm_csizxf(ipair) - mtoo = modetoo_csizxf(ipair) - if (mfrm < 10) then - nchfrmskip = 1 - else if (mfrm < 100) then - nchfrmskip = 2 - else - nchfrmskip = 3 - end if - if (mtoo < 10) then - nchtooskip = 1 - else if (mtoo < 100) then - nchtooskip = 2 - else - nchtooskip = 3 - end if - nspec = 0 - -aa_iqfrm: do iqfrm = -1, nspec_amode(mfrm) - - if (iqfrm == -1) then - lsfrma = numptr_amode(mfrm) - lstooa = numptr_amode(mtoo) - lsfrmc = numptrcw_amode(mfrm) - lstooc = numptrcw_amode(mtoo) - else if (iqfrm == 0) then -! bypass transfer of aerosol water due to calcsize transfer - cycle aa_iqfrm - else - lsfrma = lmassptr_amode(iqfrm,mfrm) - lsfrmc = lmassptrcw_amode(iqfrm,mfrm) - lstooa = 0 - lstooc = 0 - end if - - if ((lsfrma < 1) .or. (lsfrma > pcnst)) then - write(iulog,9100) mfrm, iqfrm, lsfrma - call endrun( 'modal_aero_calcsize_init error aa' ) - end if - if ((lsfrmc < 1) .or. (lsfrmc > pcnst)) then - write(iulog,9102) mfrm, iqfrm, lsfrmc - call endrun( 'modal_aero_calcsize_init error bb' ) - end if - - if (iqfrm > 0) then - nchfrma = len( trim( cnst_name(lsfrma) ) ) - nchfrmskip - -! find "too" species having same cnst_name as the "frm" species -! (except for last 1/2/3 characters which are the mode index) - do iqtoo = 1, nspec_amode(mtoo) - lstooa = lmassptr_amode(iqtoo,mtoo) - nchtooa = len( trim( cnst_name(lstooa) ) ) - nchtooskip - if (cnst_name(lsfrma)(1:nchfrma) == cnst_name(lstooa)(1:nchtooa)) then - ! interstitial names match, so check cloudborne names too - nchfrmc = len( trim( cnst_name_cw(lsfrmc) ) ) - nchfrmskip - lstooc = lmassptrcw_amode(iqtoo,mtoo) - nchtooc = len( trim( cnst_name_cw(lstooc) ) ) - nchtooskip - if (cnst_name_cw(lsfrmc)(1:nchfrmc) /= & - cnst_name_cw(lstooc)(1:nchtooc)) lstooc = 0 - exit - else - lstooa = 0 - end if - end do - end if ! (iqfrm > 0) - - if ((lstooc < 1) .or. (lstooc > pcnst)) lstooc = 0 - if ((lstooa < 1) .or. (lstooa > pcnst)) lstooa = 0 - if (lstooa == 0) then - write(iulog,9104) mfrm, iqfrm, lsfrma, iqtoo, lstooa - call endrun( 'modal_aero_calcsize_init error cc' ) - end if - if ((lstooc == 0) .and. (iqfrm /= 0)) then - write(iulog,9104) mfrm, iqfrm, lsfrmc, iqtoo, lstooc - call endrun( 'modal_aero_calcsize_init error dd' ) - end if - - nspec = nspec + 1 - lspecfrma_csizxf(nspec,ipair) = lsfrma - lspectooa_csizxf(nspec,ipair) = lstooa - lspecfrmc_csizxf(nspec,ipair) = lsfrmc - lspectooc_csizxf(nspec,ipair) = lstooc - end do aa_iqfrm - - nspecfrm_csizxf(ipair) = nspec - end do aa_ipair - -9100 format( / '*** subr. modal_aero_calcsize_init' / & - 'lspecfrma out of range' / & - 'modefrm, ispecfrm, lspecfrma =', 3i6 / ) -9102 format( / '*** subr. modal_aero_calcsize_init' / & - 'lspecfrmc out of range' / & - 'modefrm, ispecfrm, lspecfrmc =', 3i6 / ) -9104 format( / '*** subr. modal_aero_calcsize_init' / & - 'lspectooa out of range' / & - 'modefrm, ispecfrm, lspecfrma, ispectoo, lspectooa =', 5i6 / ) -9106 format( / '*** subr. modal_aero_calcsize_init' / & - 'lspectooc out of range' / & - 'modefrm, ispecfrm, lspecfrmc, ispectoo, lspectooc =', 5i6 / ) - -! -! output results -! - if ( masterproc ) then - - write(iulog,9310) do_adjust_default, do_aitacc_transfer_default - - do ipair = 1, npair_csizxf - mfrm = modefrm_csizxf(ipair) - mtoo = modetoo_csizxf(ipair) - write(iulog,9320) ipair, mfrm, mtoo - - do iq = 1, nspecfrm_csizxf(ipair) - lsfrma = lspecfrma_csizxf(iq,ipair) - lstooa = lspectooa_csizxf(iq,ipair) - lsfrmc = lspecfrmc_csizxf(iq,ipair) - lstooc = lspectooc_csizxf(iq,ipair) - if (lstooa .gt. 0) then - write(iulog,9330) lsfrma, cnst_name(lsfrma), & - lstooa, cnst_name(lstooa) - else - write(iulog,9340) lsfrma, cnst_name(lsfrma) - end if - if (lstooc .gt. 0) then - write(iulog,9330) lsfrmc, cnst_name_cw(lsfrmc), & - lstooc, cnst_name_cw(lstooc) - else if (lsfrmc .gt. 0) then - write(iulog,9340) lsfrmc, cnst_name_cw(lsfrmc) - else - write(iulog,9350) - end if - end do ! iq - - end do ! ipair - write(iulog,*) - - end if ! ( masterproc ) - - - else ! do_aitacc_transfer_if_block1 - - npair_csizxf = 0 - if ( masterproc ) then - write(iulog,9310) do_adjust_default, do_aitacc_transfer_default - write(iulog,9320) 0, 0, 0 - end if - - end if do_aitacc_transfer_if_block1 - -9310 format( / 'subr. modal_aero_calcsize_init' / & - 'do_adjust_default, do_aitacc_transfer_default = ', 2l10 ) -9320 format( 'pair', i3, 5x, 'mode', i3, ' ---> mode', i3 ) -9330 format( 5x, 'spec', i3, '=', a, ' ---> spec', i3, '=', a ) -9340 format( 5x, 'spec', i3, '=', a, ' ---> LOSS' ) -9350 format( 5x, 'no corresponding activated species' ) - - - -! define history fields for number-adjust source-sink for all modes -do_adjust_if_block2: & - if ( do_adjust_default ) then - - do n = 1, ntot_amode - if (mprognum_amode(n) <= 0) cycle - - do jac = 1, 2 - if (jac == 1) then - tmpnamea = cnst_name(numptr_amode(n)) - else - tmpnamea = cnst_name_cw(numptrcw_amode(n)) - end if -#ifndef GEOS5_PORT - unit = '#/m2/s' - fieldname = trim(tmpnamea) // '_sfcsiz1' - long_name = trim(tmpnamea) // ' calcsize number-adjust column source' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname - - fieldname = trim(tmpnamea) // '_sfcsiz2' - long_name = trim(tmpnamea) // ' calcsize number-adjust column sink' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname -#endif - end do ! jac = ... - - end do ! n = ... - - -! define history fields for aitken-accum transfer -do_aitacc_transfer_if_block2: & - if ( do_aitacc_transfer_default ) then - -! check that calcsize transfer ipair=1 is aitken-->accum - ipair = 1 - if ((modefrm_csizxf(ipair) .ne. nait) .or. & - (modetoo_csizxf(ipair) .ne. nacc)) then - write( iulog, '(//2a//)' ) & - '*** modal_aero_calcaersize_init error -- ', & - 'modefrm/too_csizxf(1) are wrong' - call endrun( 'modal_aero_calcaersize_init error' ) - end if - - do iq = 1, nspecfrm_csizxf(ipair) - -! jac=1 does interstitial ("_a"); jac=2 does activated ("_c"); - do jac = 1, 2 - -! the lspecfrma_csizxf (and lspecfrmc_csizxf) are aitken species -! the lspectooa_csizxf (and lspectooc_csizxf) are accum species - if (jac .eq. 1) then - lsfrm = lspecfrma_csizxf(iq,ipair) - lstoo = lspectooa_csizxf(iq,ipair) - else - lsfrm = lspecfrmc_csizxf(iq,ipair) - lstoo = lspectooc_csizxf(iq,ipair) - end if - if ((lsfrm <= 0) .or. (lstoo <= 0)) cycle - - if (jac .eq. 1) then - tmpnamea = cnst_name(lsfrm) - tmpnameb = cnst_name(lstoo) - else - tmpnamea = cnst_name_cw(lsfrm) - tmpnameb = cnst_name_cw(lstoo) - end if -#ifndef GEOS5_PORT - unit = 'kg/m2/s' - if ((tmpnamea(1:3) == 'num') .or. & - (tmpnamea(1:3) == 'NUM')) unit = '#/m2/s' - fieldname = trim(tmpnamea) // '_sfcsiz3' - long_name = trim(tmpnamea) // ' calcsize aitken-to-accum adjust column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname - - fieldname = trim(tmpnameb) // '_sfcsiz3' - long_name = trim(tmpnameb) // ' calcsize aitken-to-accum adjust column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname - - fieldname = trim(tmpnamea) // '_sfcsiz4' - long_name = trim(tmpnamea) // ' calcsize accum-to-aitken adjust column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname - - fieldname = trim(tmpnameb) // '_sfcsiz4' - long_name = trim(tmpnameb) // ' calcsize accum-to-aitken adjust column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(2a)') 'calcsize addfld - ', fieldname -#endif - end do ! jac = ... - end do ! iq = ... - - end if do_aitacc_transfer_if_block2 - - end if do_adjust_if_block2 - - - if ( masterproc ) then - write(iulog,'(/a)') 'l, species_class, name' - do n = 1, pcnst - write(iulog,'(2i4,2x,a)') n, species_class(n), cnst_name(n) - end do - end if -#endif - -return -end subroutine modal_aero_calcsize_init - -!=============================================================================== -#ifndef GEOS5_PORT -subroutine modal_aero_calcsize_sub(state, ptend, deltat, pbuf, do_adjust_in, & - do_aitacc_transfer_in) -#else -subroutine modal_aero_calcsize_sub(lchnk, top_lev, ncol, pcols, pver, pdel, q, qc, dqdt, dgncur_a, & - deltat, dotend, verbose, do_adjust_in, do_aitacc_transfer_in) -#endif - - !----------------------------------------------------------------------- - ! - ! Calculates aerosol size distribution parameters - ! mprognum_amode > 0 - ! calculate Dgnum from mass, number, and fixed sigmag - ! mprognum_amode <= 0 - ! calculate number from mass, fixed Dgnum, and fixed sigmag - ! - ! Also (optionally) adjusts prognostic number to - ! be within bounds determined by mass, Dgnum bounds, and sigma bounds - ! - ! Author: R. Easter - ! - !----------------------------------------------------------------------- - - ! arguments -#ifndef GEOS5_PORT - type(physics_state), target, intent(in) :: state ! Physics state variables - type(physics_ptend), target, intent(inout) :: ptend ! indivdual parameterization tendencies - real(r8), intent(in) :: deltat ! model time-step size (s) - type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer -#else - integer, intent(in) :: lchnk - integer, intent(in) :: top_lev ! set it to 1 - integer, intent(in) :: ncol - integer, intent(in) :: pcols - integer, intent(in) :: pver - - real(r8), intent(in) :: deltat ! model time-step size (s) -! real(r8), intent(in) :: pmid(:,:) ! pressure at model levels (Pa) - real(r8), intent(in) :: pdel(:,:) ! pressure thickness of levels - real(r8), intent(in) :: q(:,:,:) ! Tracer MR array - real(r8), intent(inout) :: qc(:,:,:) ! Tracer MR array - - logical, intent(inout) :: dotend(:) ! flag for doing tendency - real(r8), intent(out) :: dqdt(:,:,:) ! TMR tendency array - real(r8), intent(inout) :: dgncur_a(:,:,:) - logical, intent(in) :: verbose -#endif - - logical, optional :: do_adjust_in - logical, optional :: do_aitacc_transfer_in - -#ifdef MODAL_AERO - - ! local - - logical :: do_adjust - logical :: do_aitacc_transfer - -#ifndef GEOS5_PORT - integer :: lchnk ! chunk identifier - integer :: ncol ! number of columns - - real(r8), pointer :: t(:,:) ! Temperature in Kelvin - real(r8), pointer :: pmid(:,:) ! pressure at model levels (Pa) - real(r8), pointer :: pdel(:,:) ! pressure thickness of levels - real(r8), pointer :: q(:,:,:) ! Tracer MR array - - logical, pointer :: dotend(:) ! flag for doing tendency - real(r8), pointer :: dqdt(:,:,:) ! TMR tendency array - - real(r8), pointer :: dgncur_a(:,:,:) -#else - logical :: masterproc -#endif - - integer :: i, icol_diag, iduma, ipair, iq - integer :: ixfer_acc2ait, ixfer_ait2acc - integer :: ixfer_acc2ait_sv(pcols,pver), ixfer_ait2acc_sv(pcols,pver) - integer :: j, jac, jsrflx, k - integer :: l, l1, la, lc, lna, lnc, lsfrm, lstoo - integer :: n, nacc, nait - - integer, save :: idiagaa = 1 - - logical :: dotendqqcw(pcnst) - logical :: noxf_acc2ait(ntot_aspectype) - - character(len=fieldname_len) :: tmpnamea, tmpnameb - character(len=fieldname_len+3) :: fieldname - - real(r8), parameter :: third = 1.0_r8/3.0_r8 - real(r8), pointer :: fldcw(:,:) - real(r8) :: delnum_a2, delnum_c2 ! work variables - real(r8) :: delnum_a3, delnum_c3, delnum_t3 ! work variables - real(r8) :: deltatinv ! 1/deltat - real(r8) :: dgncur_c(pcols,pver,ntot_amode) - real(r8) :: dgnyy, dgnxx ! dgnumlo/hi of current mode - real(r8) :: dqqcwdt(pcols,pver,pcnst) ! cloudborne TMR tendency array - real(r8) :: drv_a, drv_c, drv_t ! dry volume (cm3/mol_air) - real(r8) :: drv_t0 - real(r8) :: drv_a_noxf, drv_c_noxf, drv_t_noxf - real(r8) :: drv_a_acc, drv_c_acc - real(r8) :: drv_a_accsv(pcols,pver), drv_c_accsv(pcols,pver) - real(r8) :: drv_a_aitsv(pcols,pver), drv_c_aitsv(pcols,pver) - real(r8) :: drv_a_sv(pcols,pver,ntot_amode), drv_c_sv(pcols,pver,ntot_amode) - real(r8) :: dryvol_a(pcols,pver) ! interstital aerosol dry - ! volume (cm^3/mol_air) - real(r8) :: dryvol_c(pcols,pver) ! activated aerosol dry volume - real(r8) :: duma, dumb, dumc, dumd ! work variables - real(r8) :: dumfac, dummwdens ! work variables - real(r8) :: frelaxadj ! relaxation factor applied - ! to size bounds - real(r8) :: fracadj ! deltat/tadj - real(r8) :: num_a0, num_c0, num_t0 ! initial number (#/mol_air) - real(r8) :: num_a1, num_c1 ! working number (#/mol_air) - real(r8) :: num_a2, num_c2, num_t2 ! working number (#/mol_air) - real(r8) :: num_a, num_c, num_t ! final number (#/mol_air) - real(r8) :: num_t_noxf - real(r8) :: numbnd ! bounded number - real(r8) :: num_a_acc, num_c_acc - real(r8) :: num_a_accsv(pcols,pver), num_c_accsv(pcols,pver) - real(r8) :: num_a_aitsv(pcols,pver), num_c_aitsv(pcols,pver) - real(r8) :: num_a_sv(pcols,pver,ntot_amode), num_c_sv(pcols,pver,ntot_amode) - real(r8) :: pdel_fac ! - real(r8) :: tadj ! adjustment time scale - real(r8) :: tadjinv ! 1/tadj - real(r8) :: v2ncur_a(pcols,pver,ntot_amode) - real(r8) :: v2ncur_c(pcols,pver,ntot_amode) - real(r8) :: v2nyy, v2nxx, v2nzz ! voltonumblo/hi of current mode - real(r8) :: v2nyyrl, v2nxxrl ! relaxed voltonumblo/hi - real(r8) :: xfercoef - real(r8) :: xfercoef_num_acc2ait, xfercoef_vol_acc2ait - real(r8) :: xfercoef_num_ait2acc, xfercoef_vol_ait2acc - real(r8) :: xferfrac_num_acc2ait, xferfrac_vol_acc2ait - real(r8) :: xferfrac_num_ait2acc, xferfrac_vol_ait2acc - real(r8) :: xfertend, xfertend_num(2,2) - - integer, parameter :: nsrflx = 4 ! last dimension of qsrflx - real(r8) :: qsrflx(pcols,pcnst,nsrflx,2) - ! process-specific column tracer tendencies - ! 3rd index -- - ! 1="standard" number adjust gain; - ! 2="standard" number adjust loss; - ! 3=aitken-->accum transfer; 4=accum-->aitken) - ! 4th index -- - ! 1="a" species; 2="c" species - !----------------------------------------------------------------------- - - if (present(do_adjust_in)) then - do_adjust = do_adjust_in - else - do_adjust = do_adjust_default - end if - - if (present(do_aitacc_transfer_in)) then - do_aitacc_transfer = do_aitacc_transfer_in - else - do_aitacc_transfer = do_aitacc_transfer_default - end if - -#ifndef GEOS5_PORT - lchnk = state%lchnk - ncol = state%ncol - - t => state%t - pmid => state%pmid - pdel => state%pdel - q => state%q - - dotend => ptend%lq - dqdt => ptend%q - - call pbuf_get_field(pbuf, dgnum_idx, dgncur_a) -#else - masterproc = verbose -#endif - - dotendqqcw(:) = .false. - dqqcwdt(:,:,:) = 0.0_r8 - qsrflx(:,:,:,:) = 0.0_r8 - - nait = modeptr_aitken - nacc = modeptr_accum - - deltatinv = 1.0_r8/(deltat*(1.0_r8 + 1.0e-15_r8)) - ! tadj = adjustment time scale for number, surface when they are prognosed - ! currently set to deltat - tadj = deltat - tadj = 86400 - tadj = max( tadj, deltat ) - tadjinv = 1.0_r8/(tadj*(1.0_r8 + 1.0e-15_r8)) - fracadj = deltat*tadjinv - fracadj = max( 0.0_r8, min( 1.0_r8, fracadj ) ) - - - ! - ! - ! the "do 40000" loop does the original (pre jan-2006) - ! number adjustment, one mode at a time - ! this artificially adjusts number when mean particle size is too large - ! or too small - ! - ! - do n = 1, ntot_amode - - ! initialize all parameters to the default values for the mode - do k=top_lev,pver - do i=1,ncol - ! sgcur_a(i,k,n) = sigmag_amode(n) - ! sgcur_c(i,k,n) = sigmag_amode(n) - dgncur_a(i,k,n) = dgnum_amode(n) - dgncur_c(i,k,n) = dgnum_amode(n) - v2ncur_a(i,k,n) = voltonumb_amode(n) - v2ncur_c(i,k,n) = voltonumb_amode(n) - dryvol_a(i,k) = 0.0_r8 - dryvol_c(i,k) = 0.0_r8 - end do - end do - - ! compute dry volume mixrats = - ! sum_over_components{ component_mass mixrat / density } - do l1 = 1, nspec_amode(n) - ! need qmass*dummwdens = (kg/kg-air) * [1/(kg/m3)] = m3/kg-air - dummwdens = 1.0_r8 / specdens_amode(lspectype_amode(l1,n)) - la = lmassptr_amode(l1,n) - do k=top_lev,pver - do i=1,ncol - dryvol_a(i,k) = dryvol_a(i,k) & - + max(0.0_r8,q(i,k,la))*dummwdens - end do - end do - -#ifndef GEOS5_PORT - fldcw => qqcw_get_field(pbuf,lmassptrcw_amode(l1,n),lchnk) - do k=top_lev,pver - do i=1,ncol - dryvol_c(i,k) = dryvol_c(i,k) & - + max(0.0_r8,fldcw(i,k))*dummwdens - end do - end do -#else - lc = lmassptrcw_amode(l1,n) - do k=top_lev,pver - do i=1,ncol - dryvol_c(i,k) = dryvol_c(i,k) & - + max(0.0_r8,qc(i,k,lc))*dummwdens - end do - end do -#endif - end do - - ! set "short-hand" number pointers - lna = numptr_amode(n) - lnc = numptrcw_amode(n) -#ifndef GEOS5_PORT - fldcw => qqcw_get_field(pbuf,numptrcw_amode(n),lchnk,.true.) -#endif - - ! go to section for appropriate number/surface diagnosed/prognosed options - if (mprognum_amode(n) <= 0) then - - ! option 1 -- number diagnosed (fixed dgnum and sigmag) - ! compute number tendencies that will bring numbers to their - ! current diagnosed values - ! - if (lna > 0) then - dotend(lna) = .true. - do k=top_lev,pver - do i=1,ncol - dqdt(i,k,lna) = (dryvol_a(i,k)*voltonumb_amode(n) & - - q(i,k,lna)) * deltatinv - end do - end do - end if - if (lnc > 0) then - dotendqqcw(lnc) = .true. - do k=top_lev,pver - do i=1,ncol -#ifndef GEOS5_PORT - dqqcwdt(i,k,lnc) = (dryvol_c(i,k)*voltonumb_amode(n) & - - fldcw(i,k)) * deltatinv -#else - dqqcwdt(i,k,lnc) = (dryvol_c(i,k)*voltonumb_amode(n) & - - qc(i,k,lnc)) * deltatinv -#endif - end do - end do - end if - else - - - ! - ! option 2 -- number prognosed (variable dgnum, fixed sigmag) - ! Compute number tendencies to adjust numbers if they are outside - ! the limits determined by current volume and dgnumlo/hi - ! The interstitial and activated aerosol fractions can, at times, - ! be the lower or upper tail of the "total" distribution. Thus they - ! can be expected to have a greater range of size parameters than - ! what is specified for the total distribution (via dgnumlo/hi) - ! When both the interstitial and activated dry volumes are positive, - ! the adjustment strategy is to (1) adjust the interstitial and activated - ! numbers towards relaxed bounds, then (2) adjust the total/combined - ! number towards the primary bounds. - ! - ! note - ! v2nyy = voltonumblo_amode is proportional to dgnumlo**(-3), - ! and produces the maximum allowed number for a given volume - ! v2nxx = voltonumbhi_amode is proportional to dgnumhi**(-3), - ! and produces the minimum allowed number for a given volume - ! v2nxxrl and v2nyyrl are their "relaxed" equivalents. - ! Setting frelaxadj=27=3**3 means that - ! dgnumlo_relaxed = dgnumlo/3 and dgnumhi_relaxed = dgnumhi*3 - ! - ! if do_aitacc_transfer is .true., then - ! for n=nacc, multiply v2nyy by 1.0e6 to effectively turn off the - ! adjustment when number is too big (size is too small) - ! for n=nait, divide v2nxx by 1.0e6 to effectively turn off the - ! adjustment when number is too small (size is too big) - !OLD however, do not change the v2nyyrl/v2nxxrl so that - !OLD the interstitial<-->activated adjustment is not changed - !NEW also change the v2nyyrl/v2nxxrl so that - !NEW the interstitial<-->activated adjustment is turned off - ! - end if - frelaxadj = 27.0_r8 - dumfac = exp(4.5_r8*alnsg_amode(n)**2)*pi/6.0_r8 - v2nxx = voltonumbhi_amode(n) - v2nyy = voltonumblo_amode(n) - v2nxxrl = v2nxx/frelaxadj - v2nyyrl = v2nyy*frelaxadj - dgnxx = dgnumhi_amode(n) - dgnyy = dgnumlo_amode(n) - if ( do_aitacc_transfer ) then - if (n == nait) v2nxx = v2nxx/1.0e6_r8 - if (n == nacc) v2nyy = v2nyy*1.0e6_r8 - v2nxxrl = v2nxx/frelaxadj ! NEW - v2nyyrl = v2nyy*frelaxadj ! NEW - end if - - if (do_adjust) then - dotend(lna) = .true. - dotendqqcw(lnc) = .true. - end if - - do k = top_lev, pver - do i = 1, ncol - - drv_a = dryvol_a(i,k) - num_a0 = q(i,k,lna) - num_a = max( 0.0_r8, num_a0 ) - drv_c = dryvol_c(i,k) -#ifndef GEOS5_PORT - num_c0 = fldcw(i,k) -#else - num_c0 = qc(i,k,lnc) -#endif - num_c = max( 0.0_r8, num_c0 ) - - if ( do_adjust) then - - ! - ! do number adjustment for interstitial and activated particles - ! adjustments that (1) make numbers non-negative or (2) make numbers - ! zero when volume is zero are applied over time-scale deltat - ! adjustments that bring numbers to within specified bounds are - ! applied over time-scale tadj - ! - if ((drv_a <= 0.0_r8) .and. (drv_c <= 0.0_r8)) then - ! both interstitial and activated volumes are zero - ! adjust both numbers to zero - num_a = 0.0_r8 - dqdt(i,k,lna) = -num_a0*deltatinv - num_c = 0.0_r8 - dqqcwdt(i,k,lnc) = -num_c0*deltatinv - else if (drv_c <= 0.0_r8) then - ! activated volume is zero, so interstitial number/volume == total/combined - ! apply step 1 and 3, but skip the relaxed adjustment (step 2, see below) - num_c = 0.0_r8 - dqqcwdt(i,k,lnc) = -num_c0*deltatinv - num_a1 = num_a - numbnd = max( drv_a*v2nxx, min( drv_a*v2nyy, num_a1 ) ) - num_a = num_a1 + (numbnd - num_a1)*fracadj - dqdt(i,k,lna) = (num_a - num_a0)*deltatinv - - else if (drv_a <= 0.0_r8) then - ! interstitial volume is zero, treat similar to above - num_a = 0.0_r8 - dqdt(i,k,lna) = -num_a0*deltatinv - num_c1 = num_c - numbnd = max( drv_c*v2nxx, min( drv_c*v2nyy, num_c1 ) ) - num_c = num_c1 + (numbnd - num_c1)*fracadj - dqqcwdt(i,k,lnc) = (num_c - num_c0)*deltatinv - else - ! both volumes are positive - ! apply 3 adjustment steps - ! step1: num_a,c0 --> num_a,c1 forces non-negative values - num_a1 = num_a - num_c1 = num_c - ! step2: num_a,c1 --> num_a,c2 applies relaxed bounds to the interstitial - ! and activated number (individually) - ! if only only a or c changes, adjust the other in the opposite direction - ! as much as possible to conserve a+c - numbnd = max( drv_a*v2nxxrl, min( drv_a*v2nyyrl, num_a1 ) ) - delnum_a2 = (numbnd - num_a1)*fracadj - num_a2 = num_a1 + delnum_a2 - numbnd = max( drv_c*v2nxxrl, min( drv_c*v2nyyrl, num_c1 ) ) - delnum_c2 = (numbnd - num_c1)*fracadj - num_c2 = num_c1 + delnum_c2 - if ((delnum_a2 == 0.0_r8) .and. (delnum_c2 /= 0.0_r8)) then - num_a2 = max( drv_a*v2nxxrl, min( drv_a*v2nyyrl, & - num_a1-delnum_c2 ) ) - else if ((delnum_a2 /= 0.0_r8) .and. (delnum_c2 == 0.0_r8)) then - num_c2 = max( drv_c*v2nxxrl, min( drv_c*v2nyyrl, & - num_c1-delnum_a2 ) ) - end if - ! step3: num_a,c2 --> num_a,c3 applies stricter bounds to the - ! combined/total number - drv_t = drv_a + drv_c - num_t2 = num_a2 + num_c2 - delnum_a3 = 0.0_r8 - delnum_c3 = 0.0_r8 - if (num_t2 < drv_t*v2nxx) then - delnum_t3 = (drv_t*v2nxx - num_t2)*fracadj - ! if you are here then (num_a2 < drv_a*v2nxx) and/or - ! (num_c2 < drv_c*v2nxx) must be true - if ((num_a2 < drv_a*v2nxx) .and. (num_c2 < drv_c*v2nxx)) then - delnum_a3 = delnum_t3*(num_a2/num_t2) - delnum_c3 = delnum_t3*(num_c2/num_t2) - else if (num_c2 < drv_c*v2nxx) then - delnum_c3 = delnum_t3 - else if (num_a2 < drv_a*v2nxx) then - delnum_a3 = delnum_t3 - end if - else if (num_t2 > drv_t*v2nyy) then - delnum_t3 = (drv_t*v2nyy - num_t2)*fracadj - ! if you are here then (num_a2 > drv_a*v2nyy) and/or - ! (num_c2 > drv_c*v2nyy) must be true - if ((num_a2 > drv_a*v2nyy) .and. (num_c2 > drv_c*v2nyy)) then - delnum_a3 = delnum_t3*(num_a2/num_t2) - delnum_c3 = delnum_t3*(num_c2/num_t2) - else if (num_c2 > drv_c*v2nyy) then - delnum_c3 = delnum_t3 - else if (num_a2 > drv_a*v2nyy) then - delnum_a3 = delnum_t3 - end if - end if - num_a = num_a2 + delnum_a3 - dqdt(i,k,lna) = (num_a - num_a0)*deltatinv - num_c = num_c2 + delnum_c3 - dqqcwdt(i,k,lnc) = (num_c - num_c0)*deltatinv - end if - - end if ! do_adjust - - ! - ! now compute current dgn and v2n - ! - if (drv_a > 0.0_r8) then - if (num_a <= drv_a*v2nxx) then - dgncur_a(i,k,n) = dgnxx - v2ncur_a(i,k,n) = v2nxx - else if (num_a >= drv_a*v2nyy) then - dgncur_a(i,k,n) = dgnyy - v2ncur_a(i,k,n) = v2nyy - else - dgncur_a(i,k,n) = (drv_a/(dumfac*num_a))**third - v2ncur_a(i,k,n) = num_a/drv_a - end if - end if - pdel_fac = pdel(i,k)/gravit ! = rho*dz - jac = 1 - qsrflx(i,lna,1,jac) = qsrflx(i,lna,1,jac) + max(0.0_r8,dqdt(i,k,lna))*pdel_fac - qsrflx(i,lna,2,jac) = qsrflx(i,lna,2,jac) + min(0.0_r8,dqdt(i,k,lna))*pdel_fac - - if (drv_c > 0.0_r8) then - if (num_c <= drv_c*v2nxx) then - dgncur_c(i,k,n) = dgnumhi_amode(n) - v2ncur_c(i,k,n) = v2nxx - else if (num_c >= drv_c*v2nyy) then - dgncur_c(i,k,n) = dgnumlo_amode(n) - v2ncur_c(i,k,n) = v2nyy - else - dgncur_c(i,k,n) = (drv_c/(dumfac*num_c))**third - v2ncur_c(i,k,n) = num_c/drv_c - end if - end if - jac = 2 - qsrflx(i,lnc,1,jac) = qsrflx(i,lnc,1,jac) + max(0.0_r8,dqqcwdt(i,k,lnc))*pdel_fac - qsrflx(i,lnc,2,jac) = qsrflx(i,lnc,2,jac) + min(0.0_r8,dqqcwdt(i,k,lnc))*pdel_fac - - - ! save number and dryvol for aitken <--> accum transfer - if ( do_aitacc_transfer ) then - if (n == nait) then - drv_a_aitsv(i,k) = drv_a - num_a_aitsv(i,k) = num_a - drv_c_aitsv(i,k) = drv_c - num_c_aitsv(i,k) = num_c - else if (n == nacc) then - drv_a_accsv(i,k) = drv_a - num_a_accsv(i,k) = num_a - drv_c_accsv(i,k) = drv_c - num_c_accsv(i,k) = num_c - end if - end if - drv_a_sv(i,k,n) = drv_a - num_a_sv(i,k,n) = num_a - drv_c_sv(i,k,n) = drv_c - num_c_sv(i,k,n) = num_c - - end do - end do - - - ! - ! option 3 -- number and surface prognosed (variable dgnum and sigmag) - ! this is not implemented - ! - end do ! do n = 1, ntot_amode - - - ! - ! - ! the following section (from here to label 49000) - ! does aitken <--> accum mode transfer - ! - ! when the aitken mode mean size is too big, the largest - ! aitken particles are transferred into the accum mode - ! to reduce the aitken mode mean size - ! when the accum mode mean size is too small, the smallest - ! accum particles are transferred into the aitken mode - ! to increase the accum mode mean size - ! - ! - ixfer_ait2acc_sv(:,:) = 0 - ixfer_acc2ait_sv(:,:) = 0 - if ( do_aitacc_transfer ) then - - if (npair_csizxf .le. 0) then - write( iulog, '(//a//)' ) & - '*** modal_aero_calcaersize_sub error -- npair_csizxf <= 0' - call endrun( 'modal_aero_calcaersize_sub error' ) - end if - - ! check that calcsize transfer ipair=1 is aitken-->accum - ipair = 1 - if ((modefrm_csizxf(ipair) .ne. nait) .or. & - (modetoo_csizxf(ipair) .ne. nacc)) then - write( iulog, '(//2a//)' ) & - '*** modal_aero_calcaersize_sub error -- ', & - 'modefrm/too_csizxf(1) are wrong' - call endrun( 'modal_aero_calcaersize_sub error' ) - end if - - ! set dotend() for species that will be transferred - do iq = 1, nspecfrm_csizxf(ipair) - lsfrm = lspecfrma_csizxf(iq,ipair) - lstoo = lspectooa_csizxf(iq,ipair) - if ((lsfrm > 0) .and. (lstoo > 0)) then - dotend(lsfrm) = .true. - dotend(lstoo) = .true. - end if - lsfrm = lspecfrmc_csizxf(iq,ipair) - lstoo = lspectooc_csizxf(iq,ipair) - if ((lsfrm > 0) .and. (lstoo > 0)) then - dotendqqcw(lsfrm) = .true. - dotendqqcw(lstoo) = .true. - end if - end do - - ! identify accum species cannot be transferred to aitken mode - noxf_acc2ait(:) = .true. - do l1 = 1, nspec_amode(nacc) - la = lmassptr_amode(l1,nacc) - do iq = 1, nspecfrm_csizxf(ipair) - if (lspectooa_csizxf(iq,ipair) == la) then - noxf_acc2ait(l1) = .false. - end if - end do - end do - - ! v2nzz is voltonumb at the "geometrically-defined" mid-point - ! between the aitken and accum modes - v2nzz = sqrt(voltonumb_amode(nait)*voltonumb_amode(nacc)) - - ! loop over columns and levels - do k = top_lev, pver - do i = 1, ncol - - pdel_fac = pdel(i,k)/gravit ! = rho*dz - xfertend_num(:,:) = 0.0_r8 - - ! compute aitken --> accum transfer rates - ixfer_ait2acc = 0 - xfercoef_num_ait2acc = 0.0_r8 - xfercoef_vol_ait2acc = 0.0_r8 - - drv_t = drv_a_aitsv(i,k) + drv_c_aitsv(i,k) - num_t = num_a_aitsv(i,k) + num_c_aitsv(i,k) - if (drv_t > 0.0_r8) then - if (num_t < drv_t*v2nzz) then - ixfer_ait2acc = 1 - if (num_t < drv_t*voltonumb_amode(nacc)) then - xferfrac_num_ait2acc = 1.0_r8 - xferfrac_vol_ait2acc = 1.0_r8 - else - xferfrac_vol_ait2acc = ((num_t/drv_t) - v2nzz)/ & - (voltonumb_amode(nacc) - v2nzz) - xferfrac_num_ait2acc = xferfrac_vol_ait2acc* & - (drv_t*voltonumb_amode(nacc)/num_t) - if ((xferfrac_num_ait2acc <= 0.0_r8) .or. & - (xferfrac_vol_ait2acc <= 0.0_r8)) then - xferfrac_num_ait2acc = 0.0_r8 - xferfrac_vol_ait2acc = 0.0_r8 - else if ((xferfrac_num_ait2acc >= 1.0_r8) .or. & - (xferfrac_vol_ait2acc >= 1.0_r8)) then - xferfrac_num_ait2acc = 1.0_r8 - xferfrac_vol_ait2acc = 1.0_r8 - end if - end if - xfercoef_num_ait2acc = xferfrac_num_ait2acc*tadjinv - xfercoef_vol_ait2acc = xferfrac_vol_ait2acc*tadjinv - xfertend_num(1,1) = num_a_aitsv(i,k)*xfercoef_num_ait2acc - xfertend_num(1,2) = num_c_aitsv(i,k)*xfercoef_num_ait2acc - end if - end if - - ! compute accum --> aitken transfer rates - ! accum may have some species (seasalt, dust, poa, lll) that are - ! not in aitken mode - ! so first divide the accum drv & num into not-transferred (noxf) species - ! and transferred species, and use the transferred-species - ! portion in what follows - ixfer_acc2ait = 0 - xfercoef_num_acc2ait = 0.0_r8 - xfercoef_vol_acc2ait = 0.0_r8 - - drv_t = drv_a_accsv(i,k) + drv_c_accsv(i,k) - num_t = num_a_accsv(i,k) + num_c_accsv(i,k) - drv_a_noxf = 0.0_r8 - drv_c_noxf = 0.0_r8 - if (drv_t > 0.0_r8) then - if (num_t > drv_t*v2nzz) then - do l1 = 1, nspec_amode(nacc) - - if ( noxf_acc2ait(l1) ) then - ! need qmass*dummwdens = (kg/kg-air) * [1/(kg/m3)] = m3/kg-air - dummwdens = 1.0_r8 / specdens_amode(lspectype_amode(l1,nacc)) - la = lmassptr_amode(l1,nacc) - drv_a_noxf = drv_a_noxf & - + max(0.0_r8,q(i,k,la))*dummwdens - lc = lmassptrcw_amode(l1,nacc) - -#ifndef GEOS5_PORT - fldcw => qqcw_get_field(pbuf,lmassptrcw_amode(l1,nacc),lchnk) - drv_c_noxf = drv_c_noxf & - + max(0.0_r8,fldcw(i,k))*dummwdens -#else - drv_c_noxf = drv_c_noxf & - + max(0.0_r8,qc(i,k,lmassptrcw_amode(l1,nacc)))*dummwdens -#endif - end if - end do - drv_t_noxf = drv_a_noxf + drv_c_noxf - num_t_noxf = drv_t_noxf*voltonumblo_amode(nacc) - num_t0 = num_t - drv_t0 = drv_t - num_t = max( 0.0_r8, num_t - num_t_noxf ) - drv_t = max( 0.0_r8, drv_t - drv_t_noxf ) - end if - end if - - if (drv_t > 0.0_r8) then - if (num_t > drv_t*v2nzz) then - ixfer_acc2ait = 1 - if (num_t > drv_t*voltonumb_amode(nait)) then - xferfrac_num_acc2ait = 1.0_r8 - xferfrac_vol_acc2ait = 1.0_r8 - else - xferfrac_vol_acc2ait = ((num_t/drv_t) - v2nzz)/ & - (voltonumb_amode(nait) - v2nzz) - xferfrac_num_acc2ait = xferfrac_vol_acc2ait* & - (drv_t*voltonumb_amode(nait)/num_t) - if ((xferfrac_num_acc2ait <= 0.0_r8) .or. & - (xferfrac_vol_acc2ait <= 0.0_r8)) then - xferfrac_num_acc2ait = 0.0_r8 - xferfrac_vol_acc2ait = 0.0_r8 - else if ((xferfrac_num_acc2ait >= 1.0_r8) .or. & - (xferfrac_vol_acc2ait >= 1.0_r8)) then - xferfrac_num_acc2ait = 1.0_r8 - xferfrac_vol_acc2ait = 1.0_r8 - end if - end if - duma = 1.0e-37_r8 - xferfrac_num_acc2ait = xferfrac_num_acc2ait* & - num_t/max( duma, num_t0 ) - xfercoef_num_acc2ait = xferfrac_num_acc2ait*tadjinv - xfercoef_vol_acc2ait = xferfrac_vol_acc2ait*tadjinv - xfertend_num(2,1) = num_a_accsv(i,k)*xfercoef_num_acc2ait - xfertend_num(2,2) = num_c_accsv(i,k)*xfercoef_num_acc2ait - end if - end if - - ! jump to end-of-loop if no transfer is needed at current i,k - if (ixfer_ait2acc+ixfer_acc2ait > 0) then - ixfer_ait2acc_sv(i,k) = ixfer_ait2acc - ixfer_acc2ait_sv(i,k) = ixfer_acc2ait - - ! - ! compute new dgncur & v2ncur for aitken & accum modes - ! - ! currently inactive - do n = nait, nacc, (nacc-nait) - if (n .eq. nait) then - duma = (xfertend_num(1,1) - xfertend_num(2,1))*deltat - num_a = max( 0.0_r8, num_a_aitsv(i,k) - duma ) - num_a_acc = max( 0.0_r8, num_a_accsv(i,k) + duma ) - duma = (drv_a_aitsv(i,k)*xfercoef_vol_ait2acc - & - (drv_a_accsv(i,k)-drv_a_noxf)*xfercoef_vol_acc2ait)*deltat - drv_a = max( 0.0_r8, drv_a_aitsv(i,k) - duma ) - drv_a_acc = max( 0.0_r8, drv_a_accsv(i,k) + duma ) - duma = (xfertend_num(1,2) - xfertend_num(2,2))*deltat - num_c = max( 0.0_r8, num_c_aitsv(i,k) - duma ) - num_c_acc = max( 0.0_r8, num_c_accsv(i,k) + duma ) - duma = (drv_c_aitsv(i,k)*xfercoef_vol_ait2acc - & - (drv_c_accsv(i,k)-drv_c_noxf)*xfercoef_vol_acc2ait)*deltat - drv_c = max( 0.0_r8, drv_c_aitsv(i,k) - duma ) - drv_c_acc = max( 0.0_r8, drv_c_accsv(i,k) + duma ) - else - num_a = num_a_acc - drv_a = drv_a_acc - num_c = num_c_acc - drv_c = drv_c_acc - end if - - if (drv_a > 0.0_r8) then - if (num_a <= drv_a*voltonumbhi_amode(n)) then - dgncur_a(i,k,n) = dgnumhi_amode(n) - v2ncur_a(i,k,n) = voltonumbhi_amode(n) - else if (num_a >= drv_a*voltonumblo_amode(n)) then - dgncur_a(i,k,n) = dgnumlo_amode(n) - v2ncur_a(i,k,n) = voltonumblo_amode(n) - else - dgncur_a(i,k,n) = (drv_a/(dumfac*num_a))**third - v2ncur_a(i,k,n) = num_a/drv_a - end if - else - dgncur_a(i,k,n) = dgnum_amode(n) - v2ncur_a(i,k,n) = voltonumb_amode(n) - end if - - if (drv_c > 0.0_r8) then - if (num_c <= drv_c*voltonumbhi_amode(n)) then - dgncur_c(i,k,n) = dgnumhi_amode(n) - v2ncur_c(i,k,n) = voltonumbhi_amode(n) - else if (num_c >= drv_c*voltonumblo_amode(n)) then - dgncur_c(i,k,n) = dgnumlo_amode(n) - v2ncur_c(i,k,n) = voltonumblo_amode(n) - else - dgncur_c(i,k,n) = (drv_c/(dumfac*num_c))**third - v2ncur_c(i,k,n) = num_c/drv_c - end if - else - dgncur_c(i,k,n) = dgnum_amode(n) - v2ncur_c(i,k,n) = voltonumb_amode(n) - end if - - end do - - - ! - ! compute tendency amounts for aitken <--> accum transfer - ! -#ifndef GEOS5_PORT - if ( masterproc ) then - if (idiagaa > 0) then - do j = 1, 2 - do iq = 1, nspecfrm_csizxf(ipair) - do jac = 1, 2 - if (j .eq. 1) then - if (jac .eq. 1) then - lsfrm = lspecfrma_csizxf(iq,ipair) - lstoo = lspectooa_csizxf(iq,ipair) - else - lsfrm = lspecfrmc_csizxf(iq,ipair) - lstoo = lspectooc_csizxf(iq,ipair) - end if - else - if (jac .eq. 1) then - lsfrm = lspectooa_csizxf(iq,ipair) - lstoo = lspecfrma_csizxf(iq,ipair) - else - lsfrm = lspectooc_csizxf(iq,ipair) - lstoo = lspecfrmc_csizxf(iq,ipair) - end if - end if - write( iulog, '(a,3i3,2i4)' ) 'calcsize j,iq,jac, lsfrm,lstoo', & - j,iq,jac, lsfrm,lstoo - end do - end do - end do - end if - end if -#endif - idiagaa = -1 - - - ! j=1 does aitken-->accum; j=2 does accum-->aitken - do j = 1, 2 - - if ((j .eq. 1 .and. ixfer_ait2acc > 0) .or. & - (j .eq. 2 .and. ixfer_acc2ait > 0)) then - - jsrflx = j+2 - if (j .eq. 1) then - xfercoef = xfercoef_vol_ait2acc - else - xfercoef = xfercoef_vol_acc2ait - end if - - do iq = 1, nspecfrm_csizxf(ipair) - - ! jac=1 does interstitial ("_a"); jac=2 does activated ("_c"); - do jac = 1, 2 - - ! the lspecfrma_csizxf (and lspecfrmc_csizxf) are aitken species - ! the lspectooa_csizxf (and lspectooc_csizxf) are accum species - ! for j=1, want lsfrm=aitken species, lstoo=accum species - ! for j=2, want lsfrm=accum species, lstoo=aitken species - if (j .eq. 1) then - if (jac .eq. 1) then - lsfrm = lspecfrma_csizxf(iq,ipair) - lstoo = lspectooa_csizxf(iq,ipair) - else - lsfrm = lspecfrmc_csizxf(iq,ipair) - lstoo = lspectooc_csizxf(iq,ipair) - end if - else - if (jac .eq. 1) then - lsfrm = lspectooa_csizxf(iq,ipair) - lstoo = lspecfrma_csizxf(iq,ipair) - else - lsfrm = lspectooc_csizxf(iq,ipair) - lstoo = lspecfrmc_csizxf(iq,ipair) - end if - end if - - if ((lsfrm > 0) .and. (lstoo > 0)) then - if (jac .eq. 1) then - if (iq .eq. 1) then - xfertend = xfertend_num(j,jac) - else - xfertend = max(0.0_r8,q(i,k,lsfrm))*xfercoef - end if - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xfertend - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xfertend - else - if (iq .eq. 1) then - xfertend = xfertend_num(j,jac) - else -#ifndef GEOS5_PORT - fldcw => qqcw_get_field(pbuf,lsfrm,lchnk) - xfertend = max(0.0_r8,fldcw(i,k))*xfercoef -#else - xfertend = max(0.0_r8,qc(i,k,lsfrm))*xfercoef -#endif - end if - dqqcwdt(i,k,lsfrm) = dqqcwdt(i,k,lsfrm) - xfertend - dqqcwdt(i,k,lstoo) = dqqcwdt(i,k,lstoo) + xfertend - end if - qsrflx(i,lsfrm,jsrflx,jac) = qsrflx(i,lsfrm,jsrflx,jac) - xfertend*pdel_fac - qsrflx(i,lstoo,jsrflx,jac) = qsrflx(i,lstoo,jsrflx,jac) + xfertend*pdel_fac - end if - - end do - end do - end if - end do - - end if - end do - end do - - - end if ! do_aitacc_transfer - lsfrm = -123456789 ! executable statement for debugging - - - ! - ! apply tendencies to cloud-borne species MRs - ! - do l = 1, pcnst - lc = l - if ( lc>0 .and. dotendqqcw(lc) ) then -#ifndef GEOS5_PORT - fldcw=> qqcw_get_field(pbuf,l,lchnk) - do k = top_lev, pver - do i = 1, ncol - fldcw(i,k) = max( 0.0_r8, & - (fldcw(i,k) + dqqcwdt(i,k,lc)*deltat) ) - end do - end do -#else - do k = top_lev, pver - do i = 1, ncol - qc(i,k,lc) = max( 0.0_r8, & - (qc(i,k,lc) + dqqcwdt(i,k,lc)*deltat) ) - end do - end do -#endif - end if - end do - -#ifndef GEOS5_PORT - ! - ! do outfld calls - ! - - ! history fields for number-adjust source-sink for all modes - if ( .not. do_adjust ) return - - do n = 1, ntot_amode - if (mprognum_amode(n) <= 0) cycle - - do jac = 1, 2 - if (jac == 1) then - l = numptr_amode(n) - tmpnamea = cnst_name(l) - else - l = numptrcw_amode(n) - tmpnamea = cnst_name_cw(l) - end if - fieldname = trim(tmpnamea) // '_sfcsiz1' - call outfld( fieldname, qsrflx(:,l,1,jac), pcols, lchnk) - - fieldname = trim(tmpnamea) // '_sfcsiz2' - call outfld( fieldname, qsrflx(:,l,2,jac), pcols, lchnk) - end do ! jac = ... - - end do ! n = ... - - - ! history fields for aitken-accum transfer - if ( .not. do_aitacc_transfer ) return - - do iq = 1, nspecfrm_csizxf(ipair) - - ! jac=1 does interstitial ("_a"); jac=2 does activated ("_c"); - do jac = 1, 2 - - ! the lspecfrma_csizxf (and lspecfrmc_csizxf) are aitken species - ! the lspectooa_csizxf (and lspectooc_csizxf) are accum species - if (jac .eq. 1) then - lsfrm = lspecfrma_csizxf(iq,ipair) - lstoo = lspectooa_csizxf(iq,ipair) - else - lsfrm = lspecfrmc_csizxf(iq,ipair) - lstoo = lspectooc_csizxf(iq,ipair) - end if - if ((lsfrm <= 0) .or. (lstoo <= 0)) cycle - - if (jac .eq. 1) then - tmpnamea = cnst_name(lsfrm) - tmpnameb = cnst_name(lstoo) - else - tmpnamea = cnst_name_cw(lsfrm) - tmpnameb = cnst_name_cw(lstoo) - end if - if ((lsfrm <= 0) .or. (lstoo <= 0)) cycle - - fieldname = trim(tmpnamea) // '_sfcsiz3' - call outfld( fieldname, qsrflx(:,lsfrm,3,jac), pcols, lchnk) - - fieldname = trim(tmpnameb) // '_sfcsiz3' - call outfld( fieldname, qsrflx(:,lstoo,3,jac), pcols, lchnk) - - fieldname = trim(tmpnamea) // '_sfcsiz4' - call outfld( fieldname, qsrflx(:,lsfrm,4,jac), pcols, lchnk) - - fieldname = trim(tmpnameb) // '_sfcsiz4' - call outfld( fieldname, qsrflx(:,lstoo,4,jac), pcols, lchnk) - - end do ! jac = ... - end do ! iq = ... -#endif !GEOS5_PORT -#endif - -end subroutine modal_aero_calcsize_sub - - -!---------------------------------------------------------------------- - -#ifndef GEOS5_PORT -subroutine modal_aero_calcsize_diag(state, pbuf, list_idx, dgnum_a) !BSINGH - Added for radiation diagnostics - - !----------------------------------------------------------------------- - ! - ! Calculate aerosol size distribution parameters - ! - ! ***N.B.*** Currently computes DGNUM for the modes in the climate list - ! and puts the result directly into the physics buffer. - !----------------------------------------------------------------------- - - ! arguments - type(physics_state), intent(in) :: state ! Physics state variables - type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer - - !Optional args added by BSINGH for radiation diags - integer, optional, intent(in) :: list_idx - real(r8), optional, intent(out) :: dgnum_a(pcols,pver,ntot_amode) ! interstital aerosol dry number mode radius (m) - - ! local - integer :: i, k, l1, n, idx !BSINGH- defined idx - integer :: lchnk, ncol - integer :: nmodes - integer :: nspec - - real(r8), pointer :: dgncur_a(:,:) ! (pcols,pver) - - - real(r8), parameter :: third = 1.0_r8/3.0_r8 - - real(r8), pointer :: mode_num(:,:) ! mode number mixing ratio - real(r8), pointer :: specmmr(:,:) ! specie mmr - real(r8) :: specdens ! specie density - - real(r8) :: dryvol_a(pcols,pver) ! interstital aerosol dry volume (cm^3/mol_air) - !BSINGH - Added for radiation diags - real(r8) :: dgn(pcols,pver) - - real(r8) :: dgnum, dgnumhi, dgnumlo - real(r8) :: dgnyy, dgnxx ! dgnumlo/hi of current mode - real(r8) :: drv_a ! dry volume (cm3/mol_air) - real(r8) :: dumfac, dummwdens ! work variables - real(r8) :: num_a0 ! initial number (#/mol_air) - real(r8) :: num_a ! final number (#/mol_air) - real(r8) :: voltonumbhi, voltonumblo - real(r8) :: v2nyy, v2nxx ! voltonumblo/hi of current mode - real(r8) :: sigmag, alnsg - !----------------------------------------------------------------------- - - lchnk = state%lchnk - ncol = state%ncol - - !BSINGH - initialize idx to zero (default list) - !and modify it based on the presence of list_idx - idx = 0 - if(present(list_idx))idx = list_idx - - call rad_cnst_get_info(idx, nmodes=nmodes) !BSINGH- replaced 0 by idx - - do n = 1, nmodes - - !BSINGH - Added following if statement for rad diags - if(.not.present(dgnum_a ))call pbuf_get_field(pbuf, dgnum_idx, dgncur_a, start=(/1,1,n/), kount=(/pcols,pver,1/)) - - ! get mode properties - call rad_cnst_get_mode_props(idx, n, dgnum=dgnum, dgnumhi=dgnumhi, dgnumlo=dgnumlo, & - sigmag=sigmag)!BSINGH- replaced 0 by idx - - ! get mode number mixing ratio - call rad_cnst_get_mode_num(idx, n, 'a', state, pbuf, mode_num)!BSINGH- replaced 0 by idx - - !BSINGH - We are storing DGNUM in a temporary variable 'dgn'.Based on the presence of dgnum_a, dgn will be - ! will be assigned to either dgcur_a or dgnum_a in the last step - dgn(:,:) = dgnum - dryvol_a(:,:) = 0.0_r8 - - ! compute dry volume mixrats = - ! sum_over_components{ component_mass mixrat / density } - call rad_cnst_get_info(idx, n, nspec=nspec)!BSINGH- replaced 0 by idx - - do l1 = 1, nspec - - call rad_cnst_get_aer_mmr(idx, n, l1, 'a', state, pbuf, specmmr) ! need to send list_idx as argument. - - call rad_cnst_get_aer_props(idx, n, l1, density_aer=specdens) - - ! need qmass*dummwdens = (kg/kg-air) * [1/(kg/m3)] = m3/kg-air - dummwdens = 1.0_r8 / specdens - - do k=top_lev,pver - do i=1,ncol - dryvol_a(i,k) = dryvol_a(i,k) & - + max(0.0_r8, specmmr(i,k))*dummwdens - end do - end do - end do - - alnsg = log( sigmag ) - dumfac = exp(4.5_r8*alnsg**2)*pi/6.0_r8 - voltonumblo = 1._r8 / ( (pi/6._r8)*(dgnumlo**3)*exp(4.5_r8*alnsg**2) ) - voltonumbhi = 1._r8 / ( (pi/6._r8)*(dgnumhi**3)*exp(4.5_r8*alnsg**2) ) - v2nxx = voltonumbhi - v2nyy = voltonumblo - dgnxx = dgnumhi - dgnyy = dgnumlo - - do k = top_lev, pver - do i = 1, ncol - - drv_a = dryvol_a(i,k) - num_a0 = mode_num(i,k) - num_a = max( 0.0_r8, num_a0 ) - - if (drv_a > 0.0_r8) then - !BSINGH - Storing DGNUM values in the temporary variable DGN - if (num_a <= drv_a*v2nxx) then - dgn(i,k) = dgnxx - else if (num_a >= drv_a*v2nyy) then - dgn(i,k) = dgnyy - else - dgn(i,k) = (drv_a/(dumfac*num_a))**third - end if - end if - !BSINGH - Added following if cond for rad diags - if(present(dgnum_a))then - dgnum_a(i,k,n)=dgn(i,k) - else - dgncur_a(i,k)=dgn(i,k) - endif - - end do - end do - - end do ! nmodes - -end subroutine modal_aero_calcsize_diag - -!---------------------------------------------------------------------- -#endif !GEOS5_PORT - -end module modal_aero_calcsize diff --git a/MAMchem_GridComp/microphysics/modal_aero_coag.F90 b/MAMchem_GridComp/microphysics/modal_aero_coag.F90 deleted file mode 100644 index 13842c54..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_coag.F90 +++ /dev/null @@ -1,3778 +0,0 @@ -! modal_aero_coag.F90 - - -!---------------------------------------------------------------------- -!BOP -! -! !MODULE: modal_aero_coag --- modal aerosol coagulation -! -! !INTERFACE: - module modal_aero_coag - -! !USES: -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_kind_mod, only: r4 => shr_kind_r4 - use cam_logfile, only: iulog - use chem_mods, only: gas_pcnst - use modal_aero_data, only: maxd_aspectype -#else - use MAPL_ConstantsMod, only: r8 => MAPL_R8, r4 => MAPL_R4 - use chem_mods, only: gas_pcnst - use modal_aero_data, only: maxd_aspectype -#endif - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: -#ifndef GEOS5_PORT - public modal_aero_coag_sub, modal_aero_coag_init, & - getcoags_wrapper_f -#else - public getcoags_wrapper_f -#endif - -! !PUBLIC DATA MEMBERS: - integer, parameter :: pcnstxx = gas_pcnst - -#if ( defined MODAL_AERO_7MODE ) || ( defined MODAL_AERO_4MODE ) - integer, parameter, public :: pair_option_acoag = 3 -#elif ( defined MODAL_AERO_3MODE ) - integer, parameter, public :: pair_option_acoag = 1 -#endif -! specifies pairs of modes for which coagulation is calculated -! 1 -- [aitken-->accum] -! 2 -- [aitken-->accum], and [pcarbon-->accum] -! 3 -- [aitken-->accum], [pcarbon-->accum], -! and [aitken-->pcarbon--(aging)-->accum] -! other -- do no coag - - integer, parameter, public :: maxpair_acoag = 10 - integer, parameter, public :: maxspec_acoag = maxd_aspectype - - integer, public :: npair_acoag - integer, public :: modefrm_acoag(maxpair_acoag) - integer, public :: modetoo_acoag(maxpair_acoag) - integer, public :: modetooeff_acoag(maxpair_acoag) - integer, public :: nspecfrm_acoag(maxpair_acoag) - integer, public :: lspecfrm_acoag(maxspec_acoag,maxpair_acoag) - integer, public :: lspectoo_acoag(maxspec_acoag,maxpair_acoag) - -! !DESCRIPTION: This module implements ... -! -! !REVISION HISTORY: -! -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! list private module data here - -!EOC -!---------------------------------------------------------------------- - - - contains - -#ifndef GEOS5_PORT -!---------------------------------------------------------------------- -!BOP -! !ROUTINE: modal_aero_coag_sub --- ... -! -! !INTERFACE: - subroutine modal_aero_coag_sub( & - lchnk, ncol, nstep, & - loffset, deltat_main, & - latndx, lonndx, & - t, pmid, pdel, & - q, & - dgncur_a, dgncur_awet, & - wetdens_a ) - - -!---------------------------------------------------------------------- -! Authors: R. Easter -!---------------------------------------------------------------------- - -! !USES: - use mo_constants, only: pi - use modal_aero_data - use modal_aero_gasaerexch, only: n_so4_monolayers_pcage, & - soa_equivso4_factor - - use abortutils, only: endrun - use cam_history, only: outfld, fieldname_len - use chem_mods, only: adv_mass - use constituents, only: pcnst, cnst_name - use physconst, only: gravit, mwdry, r_universal - use ppgrid, only: pcols, pver - use spmd_utils, only: iam, masterproc - use ref_pres, only: top_lev => trop_cloud_top_lev - - implicit none - -! !PARAMETERS: - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of columns in chunk - integer, intent(in) :: nstep ! model step - integer, intent(in) :: loffset ! offset applied to modal aero "pointers" - integer, intent(in) :: latndx(pcols), lonndx(pcols) - - real(r8), intent(in) :: deltat_main ! model timestep (s) - - real(r8), intent(in) :: t(pcols,pver) ! temperature (K) - real(r8), intent(in) :: pmid(pcols,pver) ! pressure at model levels (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure thickness of levels (Pa) - - real(r8), intent(inout) :: q(ncol,pver,pcnstxx) - ! tracer mixing ratio (TMR) array - ! *** MUST BE mol/mol-air or #/mol-air - ! *** NOTE ncol & pcnstxx dimensions - real(r8), intent(in) :: dgncur_a(pcols,pver,ntot_amode) - ! dry geo. mean dia. (m) of number distrib. - real(r8), intent(in) :: dgncur_awet(pcols,pver,ntot_amode) - ! wet geo. mean dia. (m) of number distrib. - real(r8), intent(in) :: wetdens_a(pcols,pver,ntot_amode) - ! density of wet aerosol (kg/m3) - -! !DESCRIPTION: -! computes changes due to coagulation involving -! aitken mode (modeptr_aitken) with accumulation mode (modeptr_accum) -! this version will -! compute changes to mass and number, but not to surface area -! calculates coagulation rate coefficients using either -! new CMAQ V4.6 fast method -! older cmaq slow method (direct gauss-hermite quadrature) -! -! !REVISION HISTORY: -! RCE 07.04.15: Adapted from MIRAGE2 code and CMAQ V4.6 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! local variables - integer :: i, iok, ipair, ip_aitacc, ip_aitpca, ip_pcaacc, iq - integer :: idomode(ntot_amode), iselfcoagdone(ntot_amode) - integer :: jfreqcoag - integer :: k - integer :: l, l1, l2, la, lmz, lsfrm, lstoo, lunout - integer :: modefrm, modetoo, mait, macc, mpca - integer :: n, nfreqcoag - - - integer, save :: nerr = 0 ! number of errors for entire run - integer, save :: nerrmax = 9999 ! maximum number of errors before abort - integer, parameter :: ldiag1=-1, ldiag2=-1, ldiag3=-1 - - logical, parameter :: fastcoag_flag = .true. ! selects coag rate-coef method - - real(r8) :: aircon - real(r8) :: deltat, deltatinv_main - real(r8) :: dr_so4_monolayers_pcage - real(r8) :: dryvol_a(pcols,pver,ntot_amode) - real(r8) :: dumexp, dumloss, dumprod - real(r8) :: dumsfc_frm_old, dumsfc_frm_new - real(r8) :: dum_m2v - real(r8) :: fac_m2v_aitage(maxd_aspectype), fac_m2v_pcarbon(maxd_aspectype) - real(r8) :: fac_volsfc_pcarbon - real(r8) :: lnsg_frm, lnsg_too - real(r8) :: sg_frm, sg_too - real(r8) :: tmpa, tmpb, tmpc, tmpf, tmpg, tmph, tmpn - real(r8) :: tmp1, tmp2 - real(r8) :: tmp_qold - real(r8) :: v2ncur_a_tmp - real(r8) :: vol_core, vol_shell - real(r8) :: wetdens_frm, wetdens_too, wetdgnum_frm, wetdgnum_too - real(r8) :: xbetaij0, xbetaij2i, xbetaij2j, xbetaij3, & - xbetaii0, xbetaii2, xbetajj0, xbetajj2 - real(r8) :: xferamt, xferfracvol, xferfrac_pcage, xferfrac_max - real(r8) :: xnumbconc(ntot_amode) - real(r8) :: xnumbconcavg(ntot_amode), xnumbconcnew(ntot_amode) - real(r8) :: ybetaij0(maxpair_acoag), ybetaij3(maxpair_acoag) - real(r8) :: ybetaii0(maxpair_acoag), ybetajj0(maxpair_acoag) - - real(r8) :: dqdt(ncol,pver,pcnstxx) ! TMR "dq/dt" array - NOTE dims - logical :: dotend(pcnst) ! identifies the species that - ! tendencies are computed for - real(r8) :: qsrflx(pcols) - - character(len=fieldname_len) :: tmpname - character(len=fieldname_len+3) :: fieldname - -! begin -! check if any coagulation pairs exist - if (npair_acoag <= 0) return - -!-------------------------------------------------------------------------------- - if (ldiag1 > 0) then - if (nstep <= 3) then - do i = 1, ncol - if (lonndx(i) /= 37) cycle - if (latndx(i) /= 23) cycle - if (nstep > 3) cycle - write( *, '(/a,i7,i5,2(2x,2i5))' ) & - '*** modal_aero_coag_sub -- nstep, iam, lat, lon, pcols, ncol =', & - nstep, iam, latndx(i), lonndx(i), pcols, ncol - end do - end if -! if (ncol /= -999888777) return - if (nstep > 3) call endrun( 'modal_aero_coag_sub -- nstep>3 testing halt' ) - end if ! (ldiag1 > 0) -!-------------------------------------------------------------------------------- - - dotend(:) = .false. - dqdt(1:ncol,:,:) = 0.0_r8 - - lunout = 6 - - -! -! determine if coagulation will be done on this time-step -! currently coagulation is done every 3 hours -! -! deltat = 3600.0*3.0 - deltat = deltat_main - nfreqcoag = max( 1, nint( deltat/deltat_main ) ) - jfreqcoag = nfreqcoag/2 - xferfrac_max = 1.0_r8 - 10.0_r8*epsilon(1.0_r8) ! 1-eps - - if (nfreqcoag .gt. 1) then - if ( mod(nstep,nfreqcoag) .ne. jfreqcoag ) return - end if - -! -! set idomode -! - idomode(:) = 0 - do ipair = 1, npair_acoag - idomode(modefrm_acoag(ipair)) = 1 - idomode(modetoo_acoag(ipair)) = 1 - end do - -! -! other init -! - macc = modeptr_accum - mait = modeptr_aitken - mpca = modeptr_pcarbon - - fac_m2v_aitage(:) = 0.0_r8 - fac_m2v_pcarbon(:) = 0.0_r8 - if (pair_option_acoag == 3) then -! following ipair definitions MUST BE CONSISTENT with -! the coding in modal_aero_coag_init for pair_option_acoag == 3 - ip_aitacc = 1 - ip_pcaacc = 2 - ip_aitpca = 3 - - ! use 1 mol (bi-)sulfate = 65 cm^3 --> 1 molecule = (4.76e-10 m)^3 - dr_so4_monolayers_pcage = n_so4_monolayers_pcage * 4.76e-10_r8 - - ipair = ip_aitpca - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - if (lsfrm == lptr_so4_a_amode(mait)) then - fac_m2v_aitage(iq) = specmw_so4_amode / specdens_so4_amode - else if (lsfrm == lptr_nh4_a_amode(mait)) then - fac_m2v_aitage(iq) = specmw_nh4_amode / specdens_nh4_amode - else if (lsfrm == lptr_soa_a_amode(mait)) then - fac_m2v_aitage(iq) = soa_equivso4_factor* & - (specmw_soa_amode / specdens_soa_amode) -! for soa, the soa_equivso4_factor converts the soa volume into an -! so4(+nh4) volume that has same hygroscopicity contribution as soa -! this allows aging calculations to be done in terms of the amount -! of (equivalent) so4(+nh4) in the shell -! (see modal_aero_gasaerexch) - end if - end do - - do l = 1, nspec_amode(mpca) - l2 = lspectype_amode(l,mpca) -! fac_m2v converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) -! [m3-AP/kmol-AP] = [kg-AP/kmol-AP] / [kg-AP/m3-AP] - fac_m2v_pcarbon(l) = specmw_amode(l2) / specdens_amode(l2) - end do - - fac_volsfc_pcarbon = exp( 2.5_r8*(alnsg_amode(mpca)**2) ) - else - ip_aitacc = -999888777 - ip_pcaacc = -999888777 - ip_aitpca = -999888777 - end if - -! -! loop over levels and columns to calc the coagulation -! -! integrate coagulation changes over deltat = nfreqcoag*deltat_main -! then compute tendencies as -! dqdt = (q(t+deltat) - q(t))/deltat_main -! because tendencies are applied (in physics_update) over deltat_main -! - deltat = nfreqcoag*deltat_main - deltatinv_main = 1.0_r8/(deltat_main*(1.0_r8 + 1.0e-15_r8)) - -main_k: do k = top_lev, pver -main_i: do i = 1, ncol - -! air molar density (kmol/m3) - aircon = (pmid(i,k)/(r_universal*t(i,k))) - -! calculate number conc. (#/m3) for modes doing coagulation - do n = 1, ntot_amode - if (idomode(n) .gt. 0) then - xnumbconc(n) = q(i,k,numptr_amode(n)-loffset)*aircon - xnumbconc(n) = max( 0.0_r8, xnumbconc(n) ) - end if - iselfcoagdone(n) = 0 - end do - -! -! calculate coagulation rates for each pair -! -main_ipair1: do ipair = 1, npair_acoag - - modefrm = modefrm_acoag(ipair) - modetoo = modetoo_acoag(ipair) - -! -! compute coagulation rates using cmaq "fast" method -! (based on E. Whitby's approximation approach) -! here subr. arguments are all in mks unit -! - call getcoags_wrapper_f( & - t(i,k), pmid(i,k), & - dgncur_awet(i,k,modefrm), dgncur_awet(i,k,modetoo), & - sigmag_amode(modefrm), sigmag_amode(modetoo), & - alnsg_amode(modefrm), alnsg_amode(modetoo), & - wetdens_a(i,k,modefrm), wetdens_a(i,k,modetoo), & - xbetaij0, xbetaij2i, xbetaij2j, xbetaij3, & - xbetaii0, xbetaii2, xbetajj0, xbetajj2 ) - - -! test diagnostics begin -------------------------------------------- - if (ldiag2 > 0) then - if (nstep <= 3) then - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) then - if ((mod(k-1,5) == 0) .or. (k>=23)) then - - wetdgnum_frm = dgncur_awet(i,k,modefrm) - wetdgnum_too = dgncur_awet(i,k,modetoo) - wetdens_frm = wetdens_a(i,k,modefrm) - wetdens_too = wetdens_a(i,k,modetoo) - sg_frm = sigmag_amode(modefrm) - sg_too = sigmag_amode(modetoo) - lnsg_frm = alnsg_amode(modefrm) - lnsg_too = alnsg_amode(modetoo) - - call getcoags_wrapper_f( & - t(i,k), pmid(i,k), & - wetdgnum_frm, wetdgnum_too, & - sg_frm, sg_too, & - lnsg_frm, lnsg_too, & - wetdens_frm, wetdens_too, & - xbetaij0, xbetaij2i, xbetaij2j, xbetaij3, & - xbetaii0, xbetaii2, xbetajj0, xbetajj2 ) - - - write(lunout,9801) - write(lunout,9810) 'nstep,lat,lon,k,ipair ', & - nstep, latndx(i), lonndx(i), k, ipair - write(lunout,9820) 'tk, pmb, aircon, pdel ', & - t(i,k), pmid(i,k)*1.0e-2_r8, aircon, pdel(i,k)*1.0e-2_r8 - write(lunout,9820) 'wetdens-cgs, sg f/t', & - wetdens_frm*1.0e-3_r8, wetdens_too*1.0e-3_r8, & - sg_frm, sg_too - write(lunout,9820) 'dgnwet-um, dgndry-um f/t', & - 1.0e6_r8*wetdgnum_frm, 1.0e6_r8*wetdgnum_too, & - 1.0e6_r8*dgncur_a(i,k,modefrm), 1.0e6_r8*dgncur_a(i,k,modetoo) - write(lunout,9820) 'xbeta ij0, ij3, ii0, jj0', & - xbetaij0, xbetaij3, xbetaii0, xbetajj0 - write(lunout,9820) 'xbeta ij2i & j, ii2, jj2', & - xbetaij2i, xbetaij2j, xbetaii2, xbetajj2 - write(lunout,9820) 'numbii, numbjj, deltat ', & - xnumbconc(modefrm), xnumbconc(modetoo), deltat - write(lunout,9820) 'loss ij3, ii0, jj0 ', & - (xbetaij3*xnumbconc(modetoo)*deltat), & - (xbetaij0*xnumbconc(modetoo)*deltat+ & - xbetaii0*xnumbconc(modefrm)*deltat), & - (xbetajj0*xnumbconc(modetoo)*deltat) - 9801 format( / 72x, 'ACOAG' ) - 9810 format( 'ACOAG ', a, 2i8, 3i7, 3(1pe15.6) ) - 9820 format( 'ACOAG ', a, 4(1pe15.6) ) - 9830 format( 'ACOAG ', a, i1, a, 4(1pe15.6) ) - end if - end if - end if - end if ! (ldiag2 > 0) -! test diagnostics end ---------------------------------------------- - - ybetaij0(ipair) = xbetaij0 - ybetaij3(ipair) = xbetaij3 - ybetaii0(ipair) = xbetaii0 - ybetajj0(ipair) = xbetajj0 - - end do main_ipair1 - - - - if ( (pair_option_acoag == 1) .or. & - (pair_option_acoag == 2) ) then -! -! calculate number and mass changes for pair_option_acoag == 1,2 -! -main_ipair2: do ipair = 1, npair_acoag - - modefrm = modefrm_acoag(ipair) - modetoo = modetoo_acoag(ipair) - -! calculate number changes -! apply self-coagulation losses only once to a mode (when iselfcoagdone=0) -! first calc change to "too" mode -! next calc change to "frm" mode, using average number conc of "too" - if ( (mprognum_amode(modetoo) > 0) .and. & - (iselfcoagdone(modetoo) <= 0) ) then - iselfcoagdone(modetoo) = 1 - tmpn = xnumbconc(modetoo) - xnumbconcnew(modetoo) = tmpn/(1.0_r8 + deltat*ybetajj0(ipair)*tmpn) - xnumbconcavg(modetoo) = 0.5_r8*(xnumbconcnew(modetoo) + tmpn) - lstoo = numptr_amode(modetoo) - loffset - q(i,k,lstoo) = xnumbconcnew(modetoo)/aircon - dqdt(i,k,lstoo) = (xnumbconcnew(modetoo)-tmpn)*deltatinv_main/aircon - end if - - if ( (mprognum_amode(modefrm) > 0) .and. & - (iselfcoagdone(modefrm) <= 0) ) then - iselfcoagdone(modefrm) = 1 - tmpn = xnumbconc(modefrm) - tmpa = deltat*ybetaij0(ipair)*xnumbconcavg(modetoo) - tmpb = deltat*ybetaii0(ipair) - tmpc = tmpa + tmpb*tmpn - if (abs(tmpc) < 0.01_r8) then - xnumbconcnew(modefrm) = tmpn*exp(-tmpc) - else if (abs(tmpa) < 0.001_r8) then - xnumbconcnew(modefrm) = & - exp(-tmpa)*tmpn/(1.0_r8 + tmpb*tmpn) - else - tmpf = tmpb*tmpn/tmpc - tmpg = exp(-tmpa) - tmph = tmpg*(1.0_r8 - tmpf)/(1.0_r8 - tmpg*tmpf) - xnumbconcnew(modefrm) = tmpn*max( 0.0_r8, min( 1.0_r8, tmph ) ) - end if - xnumbconcavg(modefrm) = 0.5_r8*(xnumbconcnew(modefrm) + tmpn) - lsfrm = numptr_amode(modefrm) - loffset - q(i,k,lsfrm) = xnumbconcnew(modefrm)/aircon - dqdt(i,k,lsfrm) = (xnumbconcnew(modefrm)-tmpn)*deltatinv_main/aircon - end if - -! calculate mass changes -! xbetaij3*xnumbconc(modetoo) = first order loss rate for modefrm volume -! xferfracvol = fraction of modefrm volume transferred to modetoo over deltat - dumloss = ybetaij3(ipair)*xnumbconcavg(modetoo) - xferfracvol = 1.0_r8 - exp( -dumloss*deltat ) - xferfracvol = max( 0.0_r8, min( xferfrac_max, xferfracvol ) ) - - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - loffset - lstoo = lspectoo_acoag(iq,ipair) - loffset - if (lsfrm > 0) then - xferamt = q(i,k,lsfrm)*xferfracvol - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferamt*deltatinv_main - q(i,k,lsfrm) = q(i,k,lsfrm) - xferamt - if (lstoo > 0) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferamt*deltatinv_main - q(i,k,lstoo) = q(i,k,lstoo) + xferamt - end if - end if - end do - - end do main_ipair2 - - - else if (pair_option_acoag == 3) then -! -! calculate number and mass changes for pair_option_acoag == 3 -! - -! calculate number changes to accum mode - if (mprognum_amode(macc) > 0) then - tmpn = xnumbconc(macc) - xnumbconcnew(macc) = tmpn/(1.0_r8 + deltat*ybetajj0(ip_aitacc)*tmpn) - xnumbconcavg(macc) = 0.5_r8*(xnumbconcnew(macc) + tmpn) - lstoo = numptr_amode(macc) - loffset - q(i,k,lstoo) = xnumbconcnew(macc)/aircon - dqdt(i,k,lstoo) = (xnumbconcnew(macc)-tmpn)*deltatinv_main/aircon - end if - -! calculate number changes to primary carbon mode - modefrm = modeptr_pcarbon - if (mprognum_amode(mpca) > 0) then - tmpn = xnumbconc(mpca) - tmpa = deltat*ybetaij0(ip_pcaacc)*xnumbconcavg(macc) - tmpb = deltat*ybetaii0(ip_pcaacc) - tmpc = tmpa + tmpb*tmpn - if (abs(tmpc) < 0.01_r8) then - xnumbconcnew(mpca) = tmpn*exp(-tmpc) - else if (abs(tmpa) < 0.001_r8) then - xnumbconcnew(mpca) = & - exp(-tmpa)*tmpn/(1.0_r8 + tmpb*tmpn) - else - tmpf = tmpb*tmpn/tmpc - tmpg = exp(-tmpa) - tmph = tmpg*(1.0_r8 - tmpf)/(1.0_r8 - tmpg*tmpf) - xnumbconcnew(mpca) = tmpn*max( 0.0_r8, min( 1.0_r8, tmph ) ) - end if - xnumbconcavg(mpca) = 0.5_r8*(xnumbconcnew(mpca) + tmpn) - lsfrm = numptr_amode(mpca) - loffset - q(i,k,lsfrm) = xnumbconcnew(mpca)/aircon - dqdt(i,k,lsfrm) = (xnumbconcnew(mpca)-tmpn)*deltatinv_main/aircon - end if - -! calculate number changes to aitken mode - if (mprognum_amode(mait) > 0) then - tmpn = xnumbconc(mait) - tmpa = deltat*( ybetaij0(ip_aitacc)*xnumbconcavg(macc) & - + ybetaij0(ip_aitpca)*xnumbconcavg(mpca) ) - tmpb = deltat*ybetaii0(ip_aitacc) - tmpc = tmpa + tmpb*tmpn - if (abs(tmpc) < 0.01_r8) then - xnumbconcnew(mait) = tmpn*exp(-tmpc) - else if (abs(tmpa) < 0.001_r8) then - xnumbconcnew(mait) = & - exp(-tmpa)*tmpn/(1.0_r8 + tmpb*tmpn) - else - tmpf = tmpb*tmpn/tmpc - tmpg = exp(-tmpa) - tmph = tmpg*(1.0_r8 - tmpf)/(1.0_r8 - tmpg*tmpf) - xnumbconcnew(mait) = tmpn*max( 0.0_r8, min( 1.0_r8, tmph ) ) - end if - xnumbconcavg(mait) = 0.5_r8*(xnumbconcnew(mait) + tmpn) - lsfrm = numptr_amode(mait) - loffset - q(i,k,lsfrm) = xnumbconcnew(mait)/aircon - dqdt(i,k,lsfrm) = (xnumbconcnew(mait)-tmpn)*deltatinv_main/aircon - end if - - -! calculate mass changes from aitken-->accum direct coagulation and -! aitken-->pcarbon-->accum coagulation/aging -! also calc volume of shell material (so4 & nh4 from aitken-->pcarbon) - dumloss = ybetaij3(ip_aitacc)*xnumbconcavg(macc) & - + ybetaij3(ip_aitpca)*xnumbconcavg(mpca) - tmpa = ybetaij3(ip_aitpca)*xnumbconcavg(mpca)/max( dumloss, 1.0e-37_r8 ) - xferfracvol = 1.0_r8 - exp( -dumloss*deltat ) - xferfracvol = max( 0.0_r8, min( xferfrac_max, xferfracvol ) ) - vol_shell = 0.0_r8 - - ipair = ip_aitacc - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - loffset - lstoo = lspectoo_acoag(iq,ipair) - loffset - if (lsfrm > 0) then - xferamt = q(i,k,lsfrm)*xferfracvol - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferamt*deltatinv_main - q(i,k,lsfrm) = q(i,k,lsfrm) - xferamt - if (lstoo > 0) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferamt*deltatinv_main - q(i,k,lstoo) = q(i,k,lstoo) + xferamt - end if - vol_shell = vol_shell + xferamt*tmpa*fac_m2v_aitage(iq) - end if - end do - - -! now calculate aging transfer fraction for pcarbon-->accum -! this duplicates the code in modal_aero_gasaerexch - vol_core = 0.0_r8 - do l = 1, nspec_amode(mpca) - vol_core = vol_core + & - q(i,k,lmassptr_amode(l,mpca)-loffset)*fac_m2v_pcarbon(l) - end do - tmp1 = vol_shell*dgncur_a(i,k,mpca)*fac_volsfc_pcarbon - tmp2 = 6.0_r8*dr_so4_monolayers_pcage*vol_core - tmp2 = max( tmp2, 0.0_r8 ) - if (tmp1 >= tmp2) then - xferfrac_pcage = xferfrac_max - else - xferfrac_pcage = min( tmp1/tmp2, xferfrac_max ) - end if - - -! calculate mass changes from pcarbon-->accum by direct coagulation -! and aging - dumloss = ybetaij3(ip_pcaacc)*xnumbconcavg(macc) - xferfracvol = 1.0_r8 - exp( -dumloss*deltat ) - xferfracvol = xferfracvol + xferfrac_pcage - xferfracvol = max( 0.0_r8, min( xferfrac_max, xferfracvol ) ) - - ipair = ip_pcaacc - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - loffset - lstoo = lspectoo_acoag(iq,ipair) - loffset - if (lsfrm > 0) then - xferamt = q(i,k,lsfrm)*xferfracvol - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferamt*deltatinv_main - q(i,k,lsfrm) = q(i,k,lsfrm) - xferamt - if (lstoo > 0) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferamt*deltatinv_main - q(i,k,lstoo) = q(i,k,lstoo) + xferamt - end if - end if - end do - - lsfrm = numptr_amode(mpca) - loffset - lstoo = numptr_amode(macc) - loffset - if (lsfrm > 0) then - xferamt = q(i,k,lsfrm)*xferfrac_pcage - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferamt*deltatinv_main - q(i,k,lsfrm) = q(i,k,lsfrm) - xferamt - if (lstoo > 0) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferamt*deltatinv_main - q(i,k,lstoo) = q(i,k,lstoo) + xferamt - end if - end if - - - - else ! (pair_option_acoag /= 1,2,3) then - - write(lunout,*) '*** modal_aero_coag_sub error' - write(lunout,*) ' cannot do _coag_sub error pair_option_acoag =', & - pair_option_acoag - call endrun( 'modal_aero_coag_sub error' ) - - - end if ! (pair_option_acoag == ...) - - -! test diagnostics begin -------------------------------------------- - if (ldiag3 > 0) then - if (nstep <= 3) then - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) then - if ((mod(k-1,5) == 0) .or. (k>=23)) then - if (pair_option_acoag == 3) then - write(*,*) - write(lunout,9820) 'xnumbconcavg ait,acc,pca', & - xnumbconcavg(mait), xnumbconcavg(macc), xnumbconcavg(mpca) - write(lunout,9820) 'vshell, core ', & - vol_shell, vol_core - write(lunout,9820) 'dr_mono, dgn ', & - dr_so4_monolayers_pcage, dgncur_a(i,k,mpca) - write(lunout,9820) 'tmp1, tmp2 ', tmp1, tmp2 - write(lunout,9820) 'xferfrac_age ', xferfrac_pcage - end if - - do ipair = 1, npair_acoag - modefrm = modefrm_acoag(ipair) - modetoo = modetoo_acoag(ipair) - if (npair_acoag > 1) then - write(lunout,*) - write(lunout,9810) 'ipair = ', ipair - end if - - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - loffset - lstoo = lspectoo_acoag(iq,ipair) - loffset - if (lsfrm > 0) then - tmp_qold = q(i,k,lsfrm) - dqdt(i,k,lsfrm)*deltat_main -! write(lunout,9820) 'm1 frm dqdt/q0,dqdt,q0/1', & - write(lunout,9830) 'm', iq, & - ' frm dqdt/q0,dqdt,q0/1', & - dqdt(i,k,lsfrm)/tmp_qold, dqdt(i,k,lsfrm), tmp_qold, q(i,k,lsfrm) - end if - if (lstoo > 0) then - tmp_qold = q(i,k,lstoo) - dqdt(i,k,lstoo)*deltat_main - write(lunout,9830) 'm', iq, & - ' too dqdt/q0,dqdt,q0/1', & - dqdt(i,k,lstoo)/tmp_qold, dqdt(i,k,lstoo), tmp_qold, q(i,k,lstoo) - end if - end do ! iq - - lsfrm = numptr_amode(modefrm) - loffset - lstoo = numptr_amode(modetoo) - loffset - if (lsfrm > 0) then - tmp_qold = q(i,k,lsfrm) - dqdt(i,k,lsfrm)*deltat_main - write(lunout,9820) 'n frm dqdt/q0,dqdt,q0/1', & - dqdt(i,k,lsfrm)/tmp_qold, dqdt(i,k,lsfrm), tmp_qold, q(i,k,lsfrm) - end if - if (lstoo > 0) then - tmp_qold = q(i,k,lstoo) - dqdt(i,k,lstoo)*deltat_main - write(lunout,9820) 'n too dqdt/q0,dqdt,q0/1', & - dqdt(i,k,lstoo)/tmp_qold, dqdt(i,k,lstoo), tmp_qold, q(i,k,lstoo) - end if - - end do ! ipair - end if - end if - end if - end if ! (ldiag3 > 0) -! test diagnostics end ---------------------------------------------- - - - - end do main_i - end do main_k - - -! set dotend's - do ipair = 1, npair_acoag - modefrm = modefrm_acoag(ipair) - modetoo = modetoo_acoag(ipair) - - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - loffset - lstoo = lspectoo_acoag(iq,ipair) - loffset - if (lsfrm > 0) dotend(lsfrm) = .true. - if (lstoo > 0) dotend(lstoo) = .true. - end do - - if (mprognum_amode(modefrm) > 0) then - lsfrm = numptr_amode(modefrm) - loffset - if (lsfrm > 0) dotend(lsfrm) = .true. - end if - if (mprognum_amode(modetoo) > 0) then - lstoo = numptr_amode(modetoo) - loffset - if (lstoo > 0) dotend(lstoo) = .true. - end if - - end do - - -! do history file column-tendency fields - do l = loffset+1, pcnst - lmz = l - loffset - if ( .not. dotend(lmz) ) cycle - - qsrflx(:) = 0.0_r8 - do k = top_lev, pver - do i = 1, ncol - qsrflx(i) = qsrflx(i) + dqdt(i,k,lmz)*pdel(i,k) - end do - end do - qsrflx(:) = qsrflx(:)*(adv_mass(lmz)/(gravit*mwdry)) - fieldname = trim(cnst_name(l)) // '_sfcoag1' - call outfld( fieldname, qsrflx, pcols, lchnk ) -! if (( masterproc ) .and. (nstep < 1)) & -! write(*,'(2(a,2x),1p,e11.3)') & -! 'modal_aero_coag_sub outfld', fieldname, adv_mass(lmz) - end do ! l = ... - - - return - - -!EOC - end subroutine modal_aero_coag_sub - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine modal_aero_coag_init -! -! computes pointers for species transfer during coagulation -! - use modal_aero_data - use modal_aero_gasaerexch, only: & - modefrm_pcage, nspecfrm_pcage, lspecfrm_pcage, lspectoo_pcage - - use abortutils, only: endrun - use cam_history, only: addfld, add_default, fieldname_len, phys_decomp - use constituents, only: pcnst, cnst_name - use spmd_utils, only: masterproc - use phys_control, only: phys_getopts - - implicit none - -! local variables - integer :: ipair, iq, iqfrm, iqfrm_aa, iqtoo, iqtoo_aa - integer :: l, lsfrm, lstoo, lunout - integer :: m, mfrm, mtoo, mtef - integer :: nsamefrm, nsametoo, nspec - - character(len=fieldname_len) :: tmpname - character(len=fieldname_len+3) :: fieldname - character(128) :: long_name - character(8) :: unit - - logical :: dotend(pcnst) - logical :: history_aerosol ! Output the MAM aerosol tendencies - - !----------------------------------------------------------------------- - - call phys_getopts( history_aerosol_out = history_aerosol ) - - lunout = iulog -! -! define "from mode" and "to mode" for each coagulation pairing -! currently just a2-->a1 coagulation -! - if (pair_option_acoag == 1) then - npair_acoag = 1 - modefrm_acoag(1) = modeptr_aitken - modetoo_acoag(1) = modeptr_accum - modetooeff_acoag(1) = modeptr_accum - else if (pair_option_acoag == 2) then - npair_acoag = 2 - modefrm_acoag(1) = modeptr_aitken - modetoo_acoag(1) = modeptr_accum - modetooeff_acoag(1) = modeptr_accum - modefrm_acoag(2) = modeptr_pcarbon - modetoo_acoag(2) = modeptr_accum - modetooeff_acoag(2) = modeptr_accum - else if (pair_option_acoag == 3) then - npair_acoag = 3 - modefrm_acoag(1) = modeptr_aitken - modetoo_acoag(1) = modeptr_accum - modetooeff_acoag(1) = modeptr_accum - modefrm_acoag(2) = modeptr_pcarbon - modetoo_acoag(2) = modeptr_accum - modetooeff_acoag(2) = modeptr_accum - modefrm_acoag(3) = modeptr_aitken - modetoo_acoag(3) = modeptr_pcarbon - modetooeff_acoag(3) = modeptr_accum - if (modefrm_pcage <= 0) then - write(iulog,*) '*** modal_aero_coag_init error' - write(iulog,*) ' pair_option_acoag, modefrm_pcage mismatch' - write(iulog,*) ' pair_option_acoag, modefrm_pcage =', & - pair_option_acoag, modefrm_pcage - call endrun( 'modal_aero_coag_init error' ) - end if - else - npair_acoag = 0 - return - end if - -! -! define species involved in each coagulation pairing -! (include aerosol water) -! -aa_ipair: do ipair = 1, npair_acoag - - mfrm = modefrm_acoag(ipair) - mtoo = modetoo_acoag(ipair) - mtef = modetooeff_acoag(ipair) - if ( (mfrm < 1) .or. (mfrm > ntot_amode) .or. & - (mtoo < 1) .or. (mtoo > ntot_amode) .or. & - (mtef < 1) .or. (mtef > ntot_amode) ) then - write(iulog,*) '*** modal_aero_coag_init error' - write(iulog,*) ' ipair, ntot_amode =', ipair, ntot_amode - write(iulog,*) ' mfrm, mtoo, mtef =', mfrm, mtoo, mtef - call endrun( 'modal_aero_coag_init error' ) - end if - - - mtoo = mtef ! effective modetoo - nspec = 0 -aa_iqfrm: do iqfrm = 1, nspec_amode(mfrm) - lsfrm = lmassptr_amode(iqfrm,mfrm) - if ((lsfrm .lt. 1) .or. (lsfrm .gt. pcnst)) cycle aa_iqfrm - -! find "too" species having same lspectype_amode as the "frm" species -! several species in a mode may have the same lspectype_amode, so also -! use the ordering as a criterion (e.g., 1st <--> 1st, 2nd <--> 2nd) - iqfrm_aa = 1 - iqtoo_aa = 1 - if (iqfrm .gt. nspec_amode(mfrm)) then - iqfrm_aa = nspec_amode(mfrm) + 1 - iqtoo_aa = nspec_amode(mtoo) + 1 - end if - nsamefrm = 0 - do iq = iqfrm_aa, iqfrm - if ( lspectype_amode(iq ,mfrm) .eq. & - lspectype_amode(iqfrm,mfrm) ) then - nsamefrm = nsamefrm + 1 - end if - end do - nsametoo = 0 - lstoo = 0 - do iqtoo = iqtoo_aa, nspec_amode(mtoo) - if ( lspectype_amode(iqtoo,mtoo) .eq. & - lspectype_amode(iqfrm,mfrm) ) then - nsametoo = nsametoo + 1 - if (nsametoo .eq. nsamefrm) then - lstoo = lmassptr_amode(iqtoo,mtoo) - exit - end if - end if - end do - - nspec = nspec + 1 - lspecfrm_acoag(nspec,ipair) = lsfrm - lspectoo_acoag(nspec,ipair) = lstoo - end do aa_iqfrm - -! lsfrm = lwaterptr_amode(mfrm) -! if ((lsfrm .ge. 1) .and. (lsfrm .le. pcnst)) then -! lstoo = lwaterptr_amode(mtoo) -! if ((lstoo .lt. 1) .or. (lstoo .gt. pcnst)) lstoo = 0 -! nspec = nspec + 1 -! lspecfrm_acoag(nspec,ipair) = lsfrm -! lspectoo_acoag(nspec,ipair) = lstoo -! end if - - nspecfrm_acoag(ipair) = nspec - end do aa_ipair - -! -! output results -! - if ( masterproc ) then - - write(lunout,9310) - - do ipair = 1, npair_acoag - mfrm = modefrm_acoag(ipair) - mtoo = modetoo_acoag(ipair) - mtef = modetooeff_acoag(ipair) - write(lunout,9320) ipair, mfrm, mtoo, mtef - - do iq = 1, nspecfrm_acoag(ipair) - lsfrm = lspecfrm_acoag(iq,ipair) - lstoo = lspectoo_acoag(iq,ipair) - if (lstoo .gt. 0) then - write(lunout,9330) lsfrm, cnst_name(lsfrm), & - lstoo, cnst_name(lstoo) - else - write(lunout,9340) lsfrm, cnst_name(lsfrm) - end if - end do - - end do ! ipair = ... - write(lunout,*) - - end if ! ( masterproc ) - -9310 format( / 'subr. modal_aero_coag_init' ) -9320 format( 'pair', i3, 5x, 'mode', i3, & - ' ---> mode', i3, ' eff', i3 ) -9330 format( 5x, 'spec', i3, '=', a, ' ---> spec', i3, '=', a ) -9340 format( 5x, 'spec', i3, '=', a, ' ---> LOSS' ) - - -! -! create history file column-tendency fields -! - dotend(:) = .false. - do ipair = 1, npair_acoag - do iq = 1, nspecfrm_acoag(ipair) - l = lspecfrm_acoag(iq,ipair) - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - l = lspectoo_acoag(iq,ipair) - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - end do - - m = modefrm_acoag(ipair) - if ((m > 0) .and. (m <= ntot_amode)) then - l = numptr_amode(m) - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - end if - m = modetoo_acoag(ipair) - if ((m > 0) .and. (m <= ntot_amode)) then - l = numptr_amode(m) - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - end if - end do ! ipair = ... - - if (pair_option_acoag == 3) then - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq) - lstoo = lspectoo_pcage(iq) - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - end do - end if - - do l = 1, pcnst - if ( .not. dotend(l) ) cycle - tmpname = cnst_name(l) - unit = 'kg/m2/s' - do m = 1, ntot_amode - if (l == numptr_amode(m)) unit = '#/m2/s' - end do - fieldname = trim(tmpname) // '_sfcoag1' - long_name = trim(tmpname) // ' modal_aero coagulation column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(3(a,2x))') & - 'modal_aero_coag_init addfld', fieldname, unit - end do ! l = ... - - - return - end subroutine modal_aero_coag_init -#endif ! GEOS5_PORT - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine calc_coag_coef4( & - dgni, dgnj, alnsgi, alnsgj, rhopi, rhopj, & - wetddrydi, wetddrydj, & - temp, presscgs, lunerr, lunout, iok, & - betaij0, betaij2i, betaij2j, betaij3, & - betaii0, betaii2, betajj0, betajj2 ) -! -! computes the following coagulation rate "coefficients" -! for lognormal modes -! -! self coagulation -! dNi/dt = - betaii0*Ni*Ni -! dNj/dt = - betajj0*Nj*Nj -! dSi/dt = - betaii2*Si*Ni -! dSj/dt = - betajj2*Sj*Nj -! -! modei-modej coagulation -! dNi/dt = - betaij0*Ni*Nj -! dNj/dt = 0. -! dSi/dt = - betaij2i*Si*Nj -! dSj/dt = + betaij2j*Si*Nj -! dVi/dt = - betaij3*Vi*Nj == - dVj/dt -! -! Ni, Nj are number concentrations (particles/cm3) -! Si, Sj are surface concentrations (cm2/cm3) -! Vi, Vj are volume concentrations (cm3/cm3) -! rates are (N,S,V)/s -! -! mode i is the smaller mode (e.g., Aitken) -! mode j is the larger mode (e.g., accumulation) -! -! input arguments -! dgni, dgnj = DRY median diameters for number distribution (cm) -! alnsgi, alnsgj = ln of geometric standard deviations (dimensionless) -! rhopi, rhopj = WET density (g/cm3) -! wetddrydi, wetddrydj = (WET median diameter)/(DRY median diameter) -! temp = air temperature (K) -! presscgs = air pressure (dynes/cm2) -! lunerr, lunout = logical unit for error or diagnostic output -! -! output arguments -! iok = status flag (+1 = success, 0/negative = failure) -! beta--- = see above -! - - implicit none - -! arguments - integer, intent(in) :: lunerr, lunout - integer, intent(out) :: iok - real(r4), intent(in) :: & - dgni, dgnj, alnsgi, alnsgj, rhopi, rhopj, & - wetddrydi, wetddrydj, & - temp, presscgs - real(r4), intent(out) :: & - betaij0, betaij2i, betaij2j, betaij3, & - betaii0, betaii2, betajj0, betajj2 - -! local variables - real(r4) airprs, airtemp - real(r4) dgacc, dgatk, pdensac, pdensat - real(r4) batat(2), batac(2), bacat(2), bacac(2), c3ij - real(r4) dp2bar_mks_i, dp2bar_mks_j, dp3bar_mks_i - -! check for reasonable inputs - iok = -1 - if ((dgni .lt. 1.e-8_r8) .or. (dgni .gt. 1._r8)) then - write(lunerr,9100) 'dgni', dgni - return - else if ((dgnj .lt. 1.e-8_r8) .or. (dgnj .gt. 1._r8)) then - write(lunerr,9100) 'dgnj', dgnj - return -! else if (dgni .gt. dgnj) then -! write(lunerr,9110) dgni, dgnj -! return - else if ((alnsgi .lt. 0.0_r8) .or. (alnsgi .gt. 2.3_r8)) then - write(lunerr,9100) 'alnsgi', alnsgi - return - else if ((alnsgj .lt. 0.0_r8) .or. (alnsgj .gt. 2.3_r8)) then - write(lunerr,9100) 'alnsgj', alnsgj - return - else if ((rhopi .lt. 0.01_r8) .or. (rhopi .gt. 100._r8)) then - write(lunerr,9100) 'rhopi', rhopi - return - else if ((rhopj .lt. 0.01_r8) .or. (rhopj .gt. 100._r8)) then - write(lunerr,9100) 'rhopj', rhopj - return - else if ((temp .lt. 10._r8) .or. (temp .gt. 370._r8)) then - write(lunerr,9100) 'temp', temp - return - else if ((presscgs .lt. 1.e2_r8) .or. (presscgs .gt. 1.5e6_r8)) then - write(lunerr,9100) 'presscgs', presscgs - return - end if -9100 format( '*** subr. calc_coag_coef_4 - bad value for ', a, & - ' = ', 1pe15.5 ) -!9110 format( '*** subr. calc_coag_coef_4 - dgni > dgnj -- ', -! + 2(1pe15.5) ) - iok = +1 - -! -! define mks variables -! - airtemp = temp -! dyne/cm2 to pa - airprs = presscgs * 1.0e-1_r8 - -! cm to m - dgatk = dgni * 1.0e-2_r8 - dgacc = dgnj * 1.0e-2_r8 - -! g/cm3 to kg/m3 - pdensat = rhopi * 1.0e+3_r8 - pdensac = rhopj * 1.0e+3_r8 - -! -! call interace to binkowski routines -! - call bink_coag_rates( & - dgatk, dgacc, alnsgi, alnsgj, pdensat, pdensac, & - wetddrydi, wetddrydj, & - airtemp, airprs, lunerr, iok, & - batat, batac, bacat, bacac, c3ij ) - -! -! transfer the batat, batac, bacat, bacac values -! to the beta--- variables -! - -! self coagulation, number -! dNi/dt = - betaii0*Ni*Ni -! dNXi/dt = - batat(1)*NXi*NXi -! where Ni is (particles/cm3), NXi is (particles/m3) -! the first-order loss rates are just (1/s) and thus are equal -! d[ln(Ni)]/dt = d[ln(NXi)]/dt -! so -! betaii0 = batat(1) * (NXi/Ni) -! conversion factors are -! 1.0e-20 to undo 1.0e+20 scaling done in intercoag & intracoag -! (NXi/Ni) = 1.0e6 -! - betaii0 = batat(1) * 1.0e-14_r8 - betajj0 = bacac(1) * 1.0e-14_r8 - -! self coagulation, surface -! dSi/dt = - betaii2*Si*Ni -! dM2Xi/dt = - batat(1)*NXi*NXi -! where Si is surface in (cm2/cm3) and M2Xi is (surface/pi) in (m2/m3) -! the first-order loss rates are just (1/s) and thus are equal -! betaii2 = batat(2) * (NXi/M2Xi) * (NXi/Ni) -! conversion factors are -! 1.0e-20 to undo 1.0e+20 scaling done in intercoag & intracoag -! (NXi/Ni) = 1.0e6 -! (M2Xi/NXi) = dp2bar_mks_i/pi, where dp2bar_mks_i is the average -! Dp**2 in m**2 -! - dp2bar_mks_j = (dgnj**2) * exp( 2.0_r8*alnsgj*alnsgj ) * 1.0e-4_r8 - - dp2bar_mks_i = (dgni**2) * exp( 2.0_r8*alnsgi*alnsgi ) * 1.0e-4_r8 - dp3bar_mks_i = (dgni**3) * exp( 4.5_r8*alnsgi*alnsgi ) * 1.0e-6_r8 - - betaii2 = (batat(2) / dp2bar_mks_i) * 1.0e-14_r8 - betajj2 = (bacac(2) / dp2bar_mks_j) * 1.0e-14_r8 - -! modei-modej coagulation, number -! dNi/dt = - betaij0*Ni*Nj -! dNj/dt = 0. -! conversions as for self coagulation -! - betaij0 = batac(1) * 1.0e-14_r8 - -! modei-modej coagulation, surface -! dSi/dt = - betaij2i*Si*Nj -! dSj/dt = + betaij2j*Si*Nj -! conversions as for self coagulation -! - betaij2i = (batac(2) / dp2bar_mks_i) * 1.0e-14_r8 - betaij2j = (bacat(2) / dp2bar_mks_i) * 1.0e-14_r8 - -! modei-modej coagulation, volume -! dVi/dt = - betaij3*Vi*Nj -! dM3Xi/dt = - c3ij*NXi*NXj -! where Vi is (cm3/cm3) and M3Xi is (volume*6/pi) in (m3/m3) -! the first-order loss rates are just (1/s) and thus are equal -! betaij3 = c3ij * (NXi/M3Xi) * (NXj/Nj) -! conversion factors are -! 1.0e-20 to undo 1.0e+20 scaling done in intercoag & intracoag -! (NXj/Nj) = 1.0e6 -! (M3Xi/NXi) = dp3bar_mks_i*(6/pi), where dp3bar_mks_i is the average -! Dp**3 in m**3 -! - betaij3 = ( c3ij / dp3bar_mks_i ) * 1.0e-14_r8 - - return - end subroutine calc_coag_coef4 - - - -!----------------------------------------------------------------------- - subroutine bink_coag_rates( & - dgatk, dgacc, xxlsgat, xxlsgac, pdensat, pdensac, & - wetddrydat, wetddrydac, & - airtemp, airprs, lunerr, iok, & - batat, batac, bacat, bacac, c3ij ) - -! -! provides interface to F. Binkowski's intracoag and intercoag -! -! this code was "cut" from F. Binkowski's aero_info_ae3.f & aero_subs3_ae3.f -! -! computes the following coagulation rate "coefficients" -! -! self coagulation -! dNXi/dt = - (1.e-20*batat(1))*NXi*NXi -! dNXj/dt = - (1.e-20*bacac(1))*NXj*NXj -! dM2Xi/dt = - (1.e-20*batat(2))*NXi*NXi -! dM2Xj/dt = - (1.e-20*bacac(2))*NXj*NXj -! -! modei-modej coagulation -! dNXi/dt = - (1.e-20*batac(1))*NXi*NXj -! dNXj/dt = 0. -! dM2Xi/dt = - (1.e-20*batac(2))*NXi*NXj -! dM2Xj/dt = + (1.e-20*bacat(2))*NXi*NXj -! dM3Xi/dt = - (1.e-20*c3ij)*NXi*NXj == - dM3Xj/dt -! -! NXi, NXj are number concentrations (particles/m3) -! M2Xi, M2Xj are 2nd moment (surface/pi) concentrations (m2/m3) -! M3Xi, M3Xj are 2rd moment (volume*6/pi) concentrations (m3/m3) -! -! in the above, mode i is aitken mode, mode j is accumulation mode -! -! *** note that the batat, batac, bacat, bacac, c3ij -! all must be multiplied by 1.e-20 to undo the 1.e+20 scaling -! in the real*4 versions of intracoag and intercoag -! -! input arguments -! dgatk, dgacc = DRY median diameters for number distribution (m) -! for aitken (atk or at) and accumulation (acc or ac) modes -! xxlsgat, xxlsgac = ln of geometric standard deviations (dimensionless) -! pdensat, pdensac = WET density (kg/m3) -! wetddrydat, wetddrydac = (WET median diameter)/(DRY median diameter) -! airtemp = air temperature (K) -! airprs = air pressure (Pa) -! lunerr = logical unit for error output -! -! output arguments -! iok = status flag (+1 = success, 0/negative = failure) -! batat, batac, bacat, bacac, c3ij = see above -! - implicit none - -! arguments - integer lunerr, iok - real(r4) dgatk, dgacc, xxlsgat, xxlsgac, pdensat, pdensac, & - wetddrydat, wetddrydac, & - airtemp, airprs - real(r4) batat(2), batac(2), bacat(2), bacac(2), c3ij - -! *** modal geometric mean diameters: [ m ] -! real dgatk ! nuclei mode -! real dgacc ! accumulation mode -! *** log of modal geometric standard deviation -! real xxlsgat ! aitken mode -! real xxlsgac ! accumulation mode -! *** average modal particle densities [ kg/m**3 ] -! real pdensat ! nuclei mode -! real pdensac ! accumulation mode - -! real airtemp ! air temperature [ k ] -! real airprs ! air pressure in [ pa ] - - -! local variables - - real(r4) two3 - parameter( two3 = 2.0_r8/3.0_r8 ) - - real(r4) avo ! avogadro's constant [ 1/mol ] - parameter ( avo = 6.0221367e23_r8 ) - - real(r4) rgasuniv ! universal gas constant [ j/mol-k ] - parameter ( rgasuniv = 8.314510_r8 ) - - real(r4) boltz ! boltzmann's constant [ j / k] - parameter ( boltz = rgasuniv / avo ) - - real(r4) p0 ! starting standard surface pressure [ pa ] - parameter ( p0 = 101325.0_r8 ) - - real(r4) t0 ! starting standard surface temperature [ k ] - parameter ( t0 = 288.15_r8 ) - - real(r4) xlm ! atmospheric mean free path [ m ] - real(r4) amu ! atmospheric dynamic viscosity [ kg/m s ] - - real(r4) kfm, knc, lamda, sqrt_temp - - -! fsb calculate the square root of the ambient -! temperature for later use - -! *** calculate mean free path [ m ]: -! *** 6.6328e-8 is the sea level values given in table i.2.8 -! *** on page 10 of u.s. standard atmosphere 1962 - xlm = 6.6328e-8_r8 * p0 * airtemp / ( t0 * airprs ) - -! *** calculate dynamic viscosity [ kg m**-1 s**-1 ]: -! *** u.s. standard atmosphere 1962 page 14 expression -! for dynamic viscosity is: -! dynamic viscosity = beta * t * sqrt(t) / ( t + s) -! where beta = 1.458e-6 [ kg sec^-1 k**-0.5 ], s = 110.4 [ k ]. - sqrt_temp = sqrt( airtemp) - amu = 1.458e-6_r8 * airtemp * sqrt_temp / ( airtemp + 110.4_r8 ) - - - -! *** coagulation -! *** set up coagulation rates - -! *** moment independent factors - knc = two3 * boltz * airtemp / amu - lamda = xlm - -! *** calculate the coagulation coefficients for use -! in the aitken (nuclei) & accumulation modes -! *** with gauss-hermite numerical quadrature -! using 10 abscissas. - -! *** aitken - aitken mode coagulation - kfm = sqrt( 3.0_r8 * boltz * airtemp / pdensat ) - call intracoag_gh(lamda, & - kfm, knc, & - dgatk, & - xxlsgat, & - wetddrydat, & - batat(2), & - batat(1) ) - -! *** accumulation - accumulation mode coagulation - kfm = sqrt( 3.0_r8 * boltz * airtemp / pdensac ) - call intracoag_gh(lamda, & - kfm, knc, & - dgacc, & - xxlsgac, & - wetddrydac, & - bacac(2), & - bacac(1) ) - -! *** aitken accumulation mode coagulation - bacat(1) = 0.0_r8 ! not used - kfm = sqrt( 6.0_r8 * boltz * airtemp / & - ( pdensat + pdensac ) ) - call intercoag_gh(lamda, & - kfm, knc, & - dgatk, dgacc , & - xxlsgat, xxlsgac , & - wetddrydat, wetddrydac, & - batac(2), & - bacat(2), & - batac(1), & - c3ij ) - -! c30atac = c3ij * cblk( vac0 ) * cblk( vat0 ) -! loss = c30atac / cblk( vat3 ) - - return - end subroutine bink_coag_rates - - - -! --------------------------------------------------------------------- -! fsb subrs to do gauss-hermite numerical quadrature - - subroutine intracoag_gh( lamda, kfm, knc, & - dg, xlnsig, wetddryd, & - quads11, quadn11) - -! fsb this version is for intramodal coagulation for number -! and second moment - -! fsb this version runs in real*4 arithmetic - -! *** this version calculates the coagulation coefficients -! using the harmonic mean approach for both fm and nc cases. -! *** does gauss-hermite quadrature for intra-modal -! coagulation integrals for 2nd moment -! for a lognormal distribution -! defined by dg,xlnsig, -! *** dg and xlnsig are the geometric mean diameters (meters) -! and the logarithms of the -! geometric standard deviations (dimensionless) -! whose meaning is defined below at the end of the routine -! ghxi, ghwi are the gauss-hermite weights and n is one-half the -! number of abscissas, since an even number of abscissas is used -! -!....................................................................... -! (following comments added by rc_easter) -! -! computes the following coagulation rate "coefficients" -! for intramodal coagulation -! dNX/dt = - (1.e-20*quadn11)*NX1*NX1 -! dM2X/dt = - (1.e-20*quads11)*NX1*NX1 -! -! NX is the mode's number concentration (particles/m3) -! M2X is the mode's 2nd moment (surface/pi) concentration (m2/m3) -! -! input arguments -! lamda = mean free path (m) -! kfm, knc = constants used in free-molecular and near-continuum -! calculations (see subr bink_coag_rates) -! dg = DRY median diameter for number distribution (m) -! xlnsig = ln of geometric standard deviation (dimensionless) -! wetddryd = (WET median diameter)/(DRY median diameter) -! -! output arguments -! quads11, quadn11 = coagulation rate coefficients (see above) -! -! *** note that the quads11, quadn11 -! are all scaled by 1.e+20 to avoid underflow, and they -! must be multiplied by 1.e-20 when they are applied -! -! *** wetddryd1 was added because MIRAGE treats N/S/V of -! the DRY size distribution, so the quadrature should be done -! over the DRY size distribution. However, the coagulation kernel -! must be computed using actual (WET) particle sizes -! -!....................................................................... -! - implicit none - - integer i,j - - real(r4) lamda ! mean free path - real(r4) kfm, knc - real(r4) dg, xlnsig, wetddryd - real(r4) quads11, quadn11 - real(r4) pi - parameter( pi = 3.14159265358979_r8) - real(r4) two3rds - parameter( two3rds = 2.0_r8 / 3.0_r8 ) - real(r4) sqrt2 - parameter(sqrt2 = 1.41421356237309_r8 ) - real(r4) sum1sfm, sum2sfm, sum1nfm, sum2nfm - real(r4) sum1snc, sum2snc, sum1nnc, sum2nnc - real(r4) xi, wxi, xf, dp1p,dp1m,dp1psq,dp1msq, dp1pwet, dp1mwet - real(r4) v1p,v1m, a2p,a2m,v2p,v2m - real(r4) yi,wyi,yf,dp2p,dp2m,dp2psq,dp2msq, dp2pwet, dp2mwet - real(r4) dspp,dsmp,dspm, dsmm - real(r4) bppfm,bmpfm,bpmfm,bmmfm - real(r4) bppnc,bmpnc,bpmnc,bmmnc - real(r4) xx1, xx2 - real(r4) xbsfm, xbsnc, xbnfm, xbnnc - real(r4) betafm, betanc - - real(r4) a ! approx cunningham corr. factor - parameter( a = 1.246_r8 ) - - real(r4) twoa - parameter( twoa = 2.0_r8 * a ) - -! *** has a fixed number of gauss-herimite abscissas (n) - integer n ! one-half the number of abscissas - parameter ( n = 5 ) - real(r4), save :: ghxi(n) ! gauss-hermite abscissas - real(r4), save :: ghwi(n) ! gauss-hermite weights - -! ** values from table 25.10 (page 924) of abramowitz and stegun, -! handbook of mathematical functions, national bureau of standards, -! december 1965. - -! breaks in number to facilitate comparison with printed table - -! *** tests show that 10 point is adquate. - - data ghxi/0.342901327223705_r8, & - 1.036610829789514_r8, & - 1.756683649299882_r8, & - 2.532731674232790_r8, & - 3.436159118837738_r8/ - - data ghwi/6.108626337353e-1_r8, & - 2.401386110823e-1_r8, & - 3.387439445548e-2_r8, & - 1.343645746781e-3_r8, & - 7.640432855233e-6_r8/ - -! *** the following expressions are from binkowski & shanker -! jour. geophys. research. vol. 100,no. d12, pp 26,191-26,209 -! december 20, 1995 -! *** for free molecular eq. a5 - betafm(xx1, xx2) = kfm * & - sqrt(1.0_r8 / xx1**3 + 1.0_r8 / xx2**3 ) * (xx1 + xx2)**2 - -! *** for near continuum eq. a6 - betanc(xx1, xx2) = knc * (xx1 + xx2) * & - ( 1.0_r8 / xx1 + 1.0_r8 / xx2 + & - twoa * lamda * ( 1.0_r8 / xx1 ** 2 & - + 1.0_r8 / xx2 **2 ) ) - - - sum1sfm = 0.0_r8 - sum1snc = 0.0_r8 - - sum1nfm = 0.0_r8 - sum1nnc = 0.0_r8 - do 1 i=1,n - - sum2sfm = 0.0_r8 - sum2snc = 0.0_r8 - sum2nfm = 0.0_r8 - sum2nnc = 0.0_r8 - - xi = ghxi(i) - wxi = ghwi(i) - xf = exp( sqrt2 * xi *xlnsig) - dp1p = dg*xf - dp1m = dg/xf - dp1psq = dp1p*dp1p - dp1msq = dp1m*dp1m - v1p = dp1p*dp1psq - v1m = dp1m*dp1msq - - dp1pwet = dp1p * wetddryd - dp1mwet = dp1m * wetddryd - - do 11 j=1,n - yi = ghxi(j) - wyi = ghwi(j) - yf = exp( sqrt2 * yi * xlnsig) - dp2p = dg*yf - dp2m = dg/yf - dp2psq = dp2p*dp2p - dp2msq = dp2m*dp2m - a2p = dp2psq - a2m = dp2msq - v2p = dp2p*dp2psq - v2m =dp2m*dp2msq - dspp = 0.5_r8*(v1p+v2p)**two3rds - a2p - dsmp = 0.5_r8*(v1m+v2p)**two3rds - a2p - dspm = 0.5_r8*(v1p+v2m)**two3rds - a2m - dsmm = 0.5_r8*(v1m+v2m)**two3rds - a2m - - dp2pwet = dp2p * wetddryd - dp2mwet = dp2m * wetddryd - -! scale by 1.0e+20 to avoid underflow - bppfm = betafm(dp1pwet,dp2pwet) * 1.0e20_r8 - bmpfm = betafm(dp1mwet,dp2pwet) * 1.0e20_r8 - bpmfm = betafm(dp1pwet,dp2mwet) * 1.0e20_r8 - bmmfm = betafm(dp1mwet,dp2mwet) * 1.0e20_r8 - - bppnc = betanc(dp1pwet,dp2pwet) * 1.0e20_r8 - bmpnc = betanc(dp1mwet,dp2pwet) * 1.0e20_r8 - bpmnc = betanc(dp1pwet,dp2mwet) * 1.0e20_r8 - bmmnc = betanc(dp1mwet,dp2mwet) * 1.0e20_r8 - - sum2sfm = sum2sfm + wyi*(dspp * bppfm + dspm * bpmfm & - + dsmp * bmpfm + dsmm * bmmfm ) - - sum2nfm = sum2nfm + wyi*(bppfm + bmpfm + bpmfm + bmmfm) - - sum2snc = sum2snc + wyi*(dspp * bppnc + dspm * bpmnc & - + dsmp * bmpnc + dsmm * bmmnc ) - sum2nnc = sum2nnc + wyi*(bppnc + bmpnc + bpmnc + bmmnc) - - 11 continue - sum1sfm = sum1sfm + wxi * sum2sfm - sum1nfm = sum1nfm + wxi * sum2nfm - - sum1snc = sum1snc + wxi * sum2snc - sum1nnc = sum1nnc + wxi * sum2nnc - - 1 continue - - xbsfm = -sum1sfm / pi - xbsnc = -sum1snc / pi - -! quads11 = xbsfm * xbsnc / ( xbsfm + xbsnc ) - quads11 = ( max(xbsfm,xbsnc) / ( xbsfm + xbsnc ) ) & - * min(xbsfm,xbsnc) - -! *** quads11 is the intra-modal coagulation term for 2nd moment - - xbnfm = 0.5_r8 * sum1nfm / pi - xbnnc = 0.5_r8 * sum1nnc / pi - - -! quadn11 = xbnfm * xbnnc / ( xbnfm + xbnnc ) - quadn11 = ( max(xbnfm,xbnnc) / ( xbnfm + xbnnc ) ) & - * min(xbnfm,xbnnc) - -! *** quadn11 is the intra-modal coagulation term for number - - - return - end subroutine intracoag_gh - - -! --------------------------------------------------------------------- - subroutine intercoag_gh( lamda, kfm, knc, dg1, dg2, & - xlnsig1, xlnsig2, & - wetddryd1, wetddryd2, & - quads12, quads21, quadn12, quadv12 ) - -! fsb this version is for intermodal coagulation for number, -! second, and third moments -! fsb this version runs in real*4 arithmetic - -! *** this version calculates the coagulation coefficients -! using the harmonic mean approach for both fm and nc cases. -! *** does gauss-hermite quadrature for inter-modal -! coagulation integrals for 2nd moment -! for two lognormal distributions -! defined by dg1,xlnsig1, dg2,xlnsig2 -! *** dg and xlnsig are the geometric mean diameters (meters) -! and the logarithms of the -! geometric standard deviations (dimensionless) -! whose meaning is defined below at the end of the routine -! ghxi, ghwi are the gauss-hermite weights and n is one-half the -! number of abscissas, since an even number of abscissas is used -! -!....................................................................... -! (following comments added by rc_easter) -! -! computes the following coagulation rate "coefficients" -! for mode1-mode2 coagulation -! dNX1/dt = - (1.e-20*quadn12)*NX1*NX2 -! dNX2/dt = 0. -! dM2X1/dt = - (1.e-20*quads12)*NX1*NX2 -! dM2X2/dt = + (1.e-20*quads21)*NX1*NX2 -! dM3X1/dt = - (1.e-20*quads12)*NX1*NX2 == - dM3X2/dt -! -! NX1, NX2 are number concentrations (particles/m3) -! M2X1, M2X2 are 2nd moment (surface/pi) concentrations (m2/m3) -! M3X1, M3X2 are 2rd moment (volume*6/pi) concentrations (m3/m3) -! -! in the above, mode 1 is aitken mode, mode 2 is accumulation mode -! -! input arguments -! lamda = mean free path (m) -! kfm, knc = constants used in free-molecular and near-continuum -! calculations (see subr bink_coag_rates) -! dg1, dg2 = DRY median diameters for number distribution (m) -! for aitken and accumulation modes -! xlnsig1, xlnsig2 = ln of geometric standard deviations (dimensionless) -! wetddryd1, wetddryd2 = (WET median diameter)/(DRY median diameter) -! -! output arguments -! quads12, quads21, quadn12, quadv12 = coagulation rate -! coefficients (see above) -! -! *** note that the quads12, quads21, quadn12, quadv12 -! are all scaled by 1.e+20 to avoid underflow, and they -! must be multiplied by 1.e-20 when they are applied -! -! *** wetddryd1/2 were added because MIRAGE treats N/S/V of -! the DRY size distribution, so the quadrature should be done -! over the DRY size distribution. However, the coagulation kernel -! must be computed using actual (WET) particle sizes -! -!....................................................................... - - implicit none - - integer i,j - - real(r4) lamda ! mean free path - real(r4) kfm, knc - real(r4) dg1, xlnsig1, dg2, xlnsig2 - real(r4) wetddryd1, wetddryd2 - real(r4) quads12, quads21, quadn12, quadv12 - real(r4) pi - parameter( pi = 3.14159265358979_r8) - real(r4) two3rds - parameter( two3rds = 2.0_r8 / 3.0_r8 ) - real(r4) sqrt2 - parameter(sqrt2 = 1.41421356237309_r8 ) - real(r4) sum1s12fm, sum1s21fm, sum2s12fm, sum2s21fm - real(r4) sum1nfm, sum2nfm - real(r4) sum1vfm, sum2vfm - real(r4) sum1s12nc, sum1s21nc, sum2s12nc, sum2s21nc - real(r4) sum1nnc, sum2nnc - real(r4) sum1vnc, sum2vnc - real(r4) xi, wxi,xf, dp1p, dp1m, dp1psq, dp1msq, dp1pwet, dp1mwet - real(r4) a1p, a1m, v1p, v1m - real(r4) a2p, a2m, v2p, v2m - real(r4) yi, wyi, yf, dp2p, dp2m, dp2psq, dp2msq, dp2pwet, dp2mwet - real(r4) dspp, dsmp, dspm, dsmm - real(r4) bppfm, bmpfm, bpmfm, bmmfm - real(r4) bppnc, bmpnc, bpmnc, bmmnc - real(r4) xx1, xx2 - real(r4) xbsfm, xbsnc, xbnfm, xbnnc, xbvfm, xbvnc - real(r4) betafm, betanc - - real(r4) a ! approx cunningham corr. factor - parameter( a = 1.246_r8 ) - - real(r4) twoa - parameter( twoa = 2.0_r8 * a ) - -! *** has a fixed number of gauss-herimite abscissas (n) - integer n ! one-half the number of abscissas - parameter ( n = 5 ) - real(r4), save :: ghxi(n) ! gauss-hermite abscissas - real(r4), save :: ghwi(n) ! gauss-hermite weights - -! ** values from table 25.10 (page 924) of abramowitz and stegun, -! handbook of mathematical functions, national bureau of standards, -! december 1965. - -! breaks in number to facilitate comparison with printed table - -! *** tests show that 10 point is adquate. - - data ghxi/0.342901327223705_r8, & - 1.036610829789514_r8, & - 1.756683649299882_r8, & - 2.532731674232790_r8, & - 3.436159118837738_r8/ - - data ghwi/6.108626337353e-1_r8, & - 2.401386110823e-1_r8, & - 3.387439445548e-2_r8, & - 1.343645746781e-3_r8, & - 7.640432855233e-6_r8/ - - -! *** the following expressions are from binkowski & shanker -! jour. geophys. research. vol. 100,no. d12, pp 26,191-26,209 -! december 20, 1995 - -! *** for free molecular eq. a5 - betafm(xx1, xx2) = kfm * & - sqrt(1.0_r8 / xx1**3 + 1.0_r8 / xx2**3 ) * (xx1 + xx2)**2 - -! *** for near continuum eq. a6 - betanc(xx1, xx2) = knc * (xx1 + xx2) * & - ( 1.0_r8 / xx1 + 1.0_r8 / xx2 + & - twoa * lamda * ( 1.0_r8 / xx1 ** 2 & - + 1.0_r8 / xx2 **2 ) ) - - sum1s12fm = 0.0_r8 - sum1s12nc = 0.0_r8 - sum1s21fm = 0.0_r8 - sum1s21nc = 0.0_r8 - sum1vnc = 0.0_r8 - sum1vfm = 0.0_r8 - sum1nfm = 0.0_r8 - sum1nnc = 0.0_r8 - do 1 i=1,n - - sum2s12fm = 0.0_r8 - sum2s12nc = 0.0_r8 - sum2s21fm = 0.0_r8 - sum2s21nc = 0.0_r8 - sum2nfm = 0.0_r8 - sum2nnc = 0.0_r8 - sum2vnc = 0.0_r8 - sum2vfm = 0.0_r8 - xi = ghxi(i) - wxi = ghwi(i) - xf = exp( sqrt2 * xi *xlnsig1) - dp1p = dg1*xf - dp1m = dg1/xf - dp1psq = dp1p*dp1p - dp1msq = dp1m*dp1m - a1p = dp1psq - a1m = dp1msq - v1p = dp1p*dp1psq - v1m = dp1m*dp1msq - - dp1pwet = dp1p * wetddryd1 - dp1mwet = dp1m * wetddryd1 - - do 11 j=1,n - yi = ghxi(j) - wyi = ghwi(j) - yf = exp( sqrt2 * yi * xlnsig2) - dp2p = dg2*yf - dp2m = dg2/yf - dp2psq = dp2p*dp2p - dp2msq = dp2m*dp2m - a2p = dp2psq - a2m = dp2msq - v2p = dp2p*dp2psq - v2m = dp2m*dp2msq - dspp = (v1p+v2p)**two3rds - a2p - dsmp = (v1m+v2p)**two3rds - a2p - dspm = (v1p+v2m)**two3rds - a2m - dsmm = (v1m+v2m)**two3rds - a2m - - dp2pwet = dp2p * wetddryd2 - dp2mwet = dp2m * wetddryd2 - -! scale by 1.0e+20 to avoid underflow - bppfm = betafm(dp1pwet,dp2pwet) * 1.0e20_r8 - bmpfm = betafm(dp1mwet,dp2pwet) * 1.0e20_r8 - bpmfm = betafm(dp1pwet,dp2mwet) * 1.0e20_r8 - bmmfm = betafm(dp1mwet,dp2mwet) * 1.0e20_r8 - - bppnc = betanc(dp1pwet,dp2pwet) * 1.0e20_r8 - bmpnc = betanc(dp1mwet,dp2pwet) * 1.0e20_r8 - bpmnc = betanc(dp1pwet,dp2mwet) * 1.0e20_r8 - bmmnc = betanc(dp1mwet,dp2mwet) * 1.0e20_r8 - - - sum2s12fm = sum2s12fm + wyi*(a1p * bppfm + a1p * bpmfm & - + a1m * bmpfm + a1m * bmmfm ) - - sum2s21fm = sum2s21fm + wyi*(dspp * bppfm + dspm * bpmfm & - + dsmp * bmpfm + dsmm * bmmfm ) - - - sum2s12nc = sum2s12nc + wyi*(a1p * bppnc + a1p * bpmnc & - + a1m * bmpnc + a1m * bmmnc ) - - sum2s21nc = sum2s21nc + wyi*(dspp * bppnc + dspm * bpmnc & - + dsmp * bmpnc + dsmm * bmmnc ) - - sum2nfm = sum2nfm + wyi*(bppfm + bmpfm + bpmfm + bmmfm) - - sum2nnc = sum2nnc + wyi*(bppnc + bmpnc + bpmnc + bmmnc) - - sum2vfm = sum2vfm + wyi*(v1p*(bppfm + bpmfm) + & - v1m*(bmpfm + bmmfm) ) - - sum2vnc = sum2vnc + wyi*(v1p*(bppnc + bpmnc) + & - v1m*(bmpnc + bmmnc) ) - - 11 continue - - sum1s12fm = sum1s12fm + wxi * sum2s12fm - sum1s21fm = sum1s21fm + wxi * sum2s21fm - sum1nfm = sum1nfm + wxi * sum2nfm - sum1vfm = sum1vfm + wxi * sum2vfm - - sum1s12nc = sum1s12nc + wxi * sum2s12nc - sum1s21nc = sum1s21nc + wxi * sum2s21nc - sum1nnc = sum1nnc + wxi * sum2nnc - sum1vnc = sum1vnc + wxi * sum2vnc - - 1 continue - -! *** second moment intermodal coagulation coefficients - -! fsb note: the transfer of second moment is not symmetric. -! see equations a3 & a4 of binkowski & shankar (1995) - -! *** to accumulation mode from aitken mode - - xbsfm = sum1s21fm / pi - xbsnc = sum1s21nc / pi - -! quads21 = xbsfm * xbsnc / ( xbsfm + xbsnc ) - quads21 = ( max(xbsfm,xbsnc) / ( xbsfm + xbsnc ) ) & - * min(xbsfm,xbsnc) - -! *** from aitken mode to accumulation mode - - xbsfm = sum1s12fm / pi - xbsnc = sum1s12nc / pi - -! quads12 = xbsfm * xbsnc / ( xbsfm + xbsnc ) - quads12 = ( max(xbsfm,xbsnc) / ( xbsfm + xbsnc ) ) & - * min(xbsfm,xbsnc) - - - - xbnfm = sum1nfm / pi - xbnnc = sum1nnc / pi - -! quadn12 = xbnfm * xbnnc / ( xbnfm + xbnnc ) - quadn12 = ( max(xbnfm,xbnnc) / ( xbnfm + xbnnc ) ) & - * min(xbnfm,xbnnc) - -! *** quadn12 is the intermodal coagulation coefficient for number - - - xbvfm = sum1vfm / pi - xbvnc = sum1vnc / pi - -! quadv12 = xbvfm * xbvnc / ( xbvfm + xbvnc ) - quadv12 = ( max(xbvfm,xbvnc) / ( xbvfm + xbvnc ) ) & - * min(xbvfm,xbvnc) - -! *** quadv12 is the intermodal coagulation coefficient for 3rd moment - - - return - end subroutine intercoag_gh - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - subroutine getcoags_wrapper_f( & - airtemp, airprs, & - dgatk, dgacc, & - sgatk, sgacc, & - xxlsgat, xxlsgac, & - pdensat, pdensac, & - betaij0, betaij2i, betaij2j, betaij3, & - betaii0, betaii2, betajj0, betajj2 ) -! -! interface to subr. getcoags -! -! interface code adapted from subr. aeroproc of cmaq v4.6, -! with some of the parameter values from module aero_info_ae4 -! - implicit none - -! *** arguments - - real(r8), intent(in) :: airtemp ! air temperature [ k ] - real(r8), intent(in) :: airprs ! air pressure in [ pa ] - - real(r8), intent(in) :: dgatk ! aitken mode geometric mean diameter [m] - real(r8), intent(in) :: dgacc ! accumulation mode geometric mean diam [m] - - real(r8), intent(in) :: sgatk ! aitken mode geometric standard deviation - real(r8), intent(in) :: sgacc ! accumulation mode geometric standard deviation - - real(r8), intent(in) :: xxlsgat ! natural log of geometric standard - real(r8), intent(in) :: xxlsgac ! deviations - - real(r8), intent(in) :: pdensat ! aitken mode particle density [ kg / m**3 ] - real(r8), intent(in) :: pdensac ! accumulation mode density [ kg / m**3 ] - - real(r8), intent(out) :: betaij0, betaij2i, betaij2j, betaij3, & - betaii0, betaii2, betajj0, betajj2 - - -! *** local parameters - real(r8), parameter :: p0 = 101325.0_r8 ! standard surface pressure [ pa ] - real(r8), parameter :: t0 = 288.15_r8 ! standard surface temperature [ k ] - real(r8), parameter :: avo = 6.0221367e23_r8 ! avogadro's constant [ 1/mol ] - real(r8), parameter :: rgasuniv = 8.314510_r8 ! universal gas constant [ j/mol-k ] - real(r8), parameter :: boltz = rgasuniv/avo ! boltzmann's constant [ j / k] - real(r8), parameter :: two3 = 2.0_r8/3.0_r8 - -! *** local variables - real(r8) amu ! atmospheric dynamic viscosity [ kg/m s ] - real(r8) sqrt_temp ! square root of ambient temperature - real(r8) lamda ! mean free path [ m ] - -! *** intramodal coagulation rates [ m**3/s ] ( 0th & 2nd moments ) - real(r8) batat( 2 ) ! aitken mode - real(r8) bacac( 2 ) ! accumulation mode -! *** intermodal coagulation rates [ m**3/s ] ( 0th & 2nd moments ) - real(r8) batac( 2 ) ! aitken to accumulation - real(r8) bacat( 2 ) ! accumulation from aitken -! *** intermodal coagulation rate [ m**3/s ] ( 3rd moment ) - real(r8) c3ij ! aitken to accumulation -! *** 3rd moment intermodal transfer rate by coagulation - real(r8) c30atac ! aitken to accumulation - -! *** near continnuum regime (independent of mode) - real(r8) knc ! knc = two3 * boltz * airtemp / amu -! *** free molecular regime (depends upon modal density) - real(r8) kfmat ! kfmat = sqrt(3.0*boltz*airtemp/pdensat) - real(r8) kfmac ! kfmac = sqrt(3.0*boltz*airtemp/pdensac) - real(r8) kfmatac ! kfmatac = sqrt( 6.0 * boltz * airtemp / - ! ( pdensat + pdensac ) ) - - real(r8) dumacc2, dumatk2, dumatk3 - - - - sqrt_temp = sqrt( airtemp) - -! *** calculate mean free path [ m ]: -! 6.6328e-8 is the sea level value given in table i.2.8 -! on page 10 of u.s. standard atmosphere 1962 - lamda = 6.6328e-8_r8 * p0 * airtemp / ( t0 * airprs ) - -! *** calculate dynamic viscosity [ kg m**-1 s**-1 ]: -! u.s. standard atmosphere 1962 page 14 expression -! for dynamic viscosity is: -! dynamic viscosity = beta * t * sqrt(t) / ( t + s) -! where beta = 1.458e-6 [ kg sec^-1 k**-0.5 ], s = 110.4 [ k ]. - amu = 1.458e-6_r8 * airtemp * sqrt_temp / ( airtemp + 110.4_r8 ) - -! *** coagulation -! calculate coagulation coefficients using a method dictated by -! the value of fastcoag_flag. if true, the computationally- -! efficient getcoags routine is used. if false, the more intensive -! gauss-hermite numerical quadrature method is used. see section -! 2.1 of bhave et al. (2004) for further discussion. - -! *** calculate term used in equation a6 of binkowski & shankar (1995) - knc = two3 * boltz * airtemp / amu -! *** calculate terms used in equation a5 of binkowski & shankar (1995) - kfmat = sqrt( 3.0_r8 * boltz * airtemp / pdensat ) - kfmac = sqrt( 3.0_r8 * boltz * airtemp / pdensac ) - kfmatac = sqrt( 6.0_r8 * boltz * airtemp / ( pdensat + pdensac ) ) - -! *** transfer of number to accumulation mode from aitken mode is zero - bacat(1) = 0.0_r8 - -! *** calculate intermodal and intramodal coagulation coefficients -! for zeroth and second moments, and intermodal coagulation -! coefficient for third moment - call getcoags( lamda, kfmatac, kfmat, kfmac, knc, & - dgatk, dgacc, sgatk, sgacc, & - xxlsgat, xxlsgac, & - batat(2), batat(1), bacac(2), bacac(1), & - batac(2), bacat(2), batac(1), c3ij ) - -! convert from the "cmaq" coag rate parameters -! to the "mirage2" parameters - dumacc2 = ( (dgacc**2) * exp( 2.0_r8*xxlsgac*xxlsgac ) ) - dumatk2 = ( (dgatk**2) * exp( 2.0_r8*xxlsgat*xxlsgat ) ) - dumatk3 = ( (dgatk**3) * exp( 4.5_r8*xxlsgat*xxlsgat ) ) - - betaii0 = max( 0.0_r8, batat(1) ) - betajj0 = max( 0.0_r8, bacac(1) ) - betaij0 = max( 0.0_r8, batac(1) ) - betaij3 = max( 0.0_r8, c3ij / dumatk3 ) - - betajj2 = max( 0.0_r8, bacac(2) / dumacc2 ) - betaii2 = max( 0.0_r8, batat(2) / dumatk2 ) - betaij2i = max( 0.0_r8, batac(2) / dumatk2 ) - betaij2j = max( 0.0_r8, bacat(2) / dumatk2 ) - - - return - end subroutine getcoags_wrapper_f - - - -! ////////////////////////////////////////////////////////////////// -! subroutine getcoags calculates the coagulation rates using a new -! approximate algorithm for the 2nd moment. the 0th and 3rd moments -! are done by analytic expressions from whitby et al. (1991). the -! correction factors are also similar to those from whitby et al. -! (1991), but are derived from the gauss-hermite numerical -! quadratures used by binkowski and roselle (2003). -! -! called from aerostep as: -! call getcoags( lamda, kfmatac, kfmat, kfmac, knc, -! dgat,dgac, sgatk, sgacc, xxlsgat,xxlsgac, -! batat(2), batat(1), bacac(2), bacac(1), -! batac(2), bacat(2), batac(1), c3ij ) -! where all input and outputs are real*8 -! -! revision history: -! fsb 08/25/03 coded by dr. francis s. binkowksi -! -! fsb 08/25/04 added in-line documentation -! -! rce 04/15/2007 -! code taken from cmaq v4.6 code; converted to f90; -! added "intent" to subr arguments; -! renamed "r4" & "r8" variables to "rx4" & "rx8"; -! changed "real*N" declarations to "real(rN)" (N = 4 or 8) -! -! references: -! 1. whitby, e. r., p. h. mcmurry, u. shankar, and f. s. binkowski, -! modal aerosol dynamics modeling, rep. 600/3-91/020, atmospheric -! research and exposure assessment laboratory, -! u.s. environmental protection agency, research triangle park, n.c., -! (ntis pb91-161729/as), 1991 -! -! 2. binkowski, f.s. an u. shankar, the regional particulate matter -! model 1. model decsription and preliminary results, journal of -! geophysical research, 100, d12, pp 26,191-26,209, -! december 20, 1995. -! -! 3. binkowski, f.s. and s.j. roselle, models-3 community -! multiscale air quality (cmaq) model aerosol component 1: -! model description. j. geophys. res., vol 108, no d6, 4183 -! doi:10.1029/2001jd001409, 2003. - - - subroutine getcoags( lamda, kfmatac, kfmat, kfmac, knc, & - dgatk, dgacc, sgatk, sgacc, xxlsgat,xxlsgac, & - qs11, qn11, qs22, qn22, & - qs12, qs21, qn12, qv12 ) - - implicit none - - real(r8), intent(in) :: lamda ! mean free path [ m ] - -! *** coefficients for free molecular regime - real(r8), intent(in) :: kfmat ! aitken mode - real(r8), intent(in) :: kfmac ! accumulation mode - real(r8), intent(in) :: kfmatac ! aitken to accumulation mode - - real(r8), intent(in) :: knc ! coefficient for near continnuum regime - -! *** modal geometric mean diameters: [ m ] - real(r8), intent(in) :: dgatk ! aitken mode - real(r8), intent(in) :: dgacc ! accumulation mode - -! *** modal geometric standard deviation - real(r8), intent(in) :: sgatk ! atken mode - real(r8), intent(in) :: sgacc ! accumulation mode - -! *** natural log of modal geometric standard deviation - real(r8), intent(in) :: xxlsgat ! aitken mode - real(r8), intent(in) :: xxlsgac ! accumulation mode - -! *** coagulation coefficients - real(r8), intent(out) :: qs11, qn11, qs22, qn22, & - qs12, qs21, qn12, qv12 - - integer ibeta, n1, n2a, n2n ! indices for correction factors - - real(r8) i1fm_at - real(r8) i1nc_at - real(r8) i1_at - - real(r8) i1fm_ac - real(r8) i1nc_ac - real(r8) i1_ac - - real(r8) i1fm - real(r8) i1nc - real(r8) i1 - - real(r8) constii - - real(r8) kngat, kngac - real(r8) one, two, half - parameter( one = 1.0_r8, two = 2.0_r8, half = 0.5_r8 ) - real(r8) a -! parameter( a = 2.492_r8) - parameter( a = 1.246_r8) - real(r8) two3rds - parameter( two3rds = 2._r8 / 3._r8) - - real(r8) sqrttwo ! sqrt(two) - real(r8) dlgsqt2 ! 1/ln( sqrt( 2 ) ) - - - real(r8) esat01 ! aitken mode exp( log^2( sigmag )/8 ) - real(r8) esac01 ! accumulation mode exp( log^2( sigmag )/8 ) - - real(r8) esat04 - real(r8) esac04 - - real(r8) esat05 - real(r8) esac05 - - real(r8) esat08 - real(r8) esac08 - - real(r8) esat09 - real(r8) esac09 - - real(r8) esat16 - real(r8) esac16 - - real(r8) esat20 - real(r8) esac20 - - real(r8) esat24 - real(r8) esac24 - - real(r8) esat25 - real(r8) esac25 - - real(r8) esat36 - real(r8) esac36 - - real(r8) esat49 - - real(r8) esat64 - real(r8) esac64 - - real(r8) esat100 - - real(r8) dgat2, dgac2, dgat3, dgac3 - real(r8) sqdgat, sqdgac - real(r8) sqdgat5, sqdgac5 - real(r8) sqdgat7 - real(r8) r, r2, r3, rx4, r5, r6, rx8 - real(r8) ri1, ri2, ri3, ri4 - real(r8) rat - real(r8) coagfm0, coagnc0 - real(r8) coagfm3, coagnc3 - real(r8) coagfm_at, coagfm_ac - real(r8) coagnc_at, coagnc_ac - real(r8) coagatat0 - real(r8) coagacac0 - real(r8) coagatat2 - real(r8) coagacac2 - real(r8) coagatac0, coagatac3 - real(r8) coagatac2 - real(r8) coagacat2 - real(r8) xm2at, xm3at, xm2ac, xm3ac - -! *** correction factors for coagulation rates - real(r4), save :: bm0( 10 ) ! m0 intramodal fm - rpm values - real(r4), save :: bm0ij( 10, 10, 10 ) ! m0 intermodal fm - real(r4), save :: bm3i( 10, 10, 10 ) ! m3 intermodal fm- rpm values - real(r4), save :: bm2ii(10) ! m2 intramodal fm - real(r4), save :: bm2iitt(10) ! m2 intramodal total - real(r4), save :: bm2ij(10,10,10) ! m2 intermodal fm i to j - real(r4), save :: bm2ji(10,10,10) ! m2 total intermodal j from i - -! *** populate the arrays for the correction factors. - -! rpm 0th moment correction factors for unimodal fm coagulation rates - data bm0 / & - 0.707106785165097_r8, 0.726148960080488_r8, 0.766430744110958_r8, & - 0.814106389441342_r8, 0.861679526483207_r8, 0.903600509090092_r8, & - 0.936578814219156_r8, 0.960098926735545_r8, 0.975646823342881_r8, & - 0.985397173215326_r8 / - - -! fsb new fm correction factors for m0 intermodal coagulation - - data (bm0ij ( 1, 1,ibeta), ibeta = 1,10) / & - 0.628539_r8, 0.639610_r8, 0.664514_r8, 0.696278_r8, 0.731558_r8, & - 0.768211_r8, 0.804480_r8, 0.838830_r8, 0.870024_r8, 0.897248_r8/ - data (bm0ij ( 1, 2,ibeta), ibeta = 1,10) / & - 0.639178_r8, 0.649966_r8, 0.674432_r8, 0.705794_r8, 0.740642_r8, & - 0.776751_r8, 0.812323_r8, 0.845827_r8, 0.876076_r8, 0.902324_r8/ - data (bm0ij ( 1, 3,ibeta), ibeta = 1,10) / & - 0.663109_r8, 0.673464_r8, 0.697147_r8, 0.727637_r8, 0.761425_r8, & - 0.796155_r8, 0.829978_r8, 0.861419_r8, 0.889424_r8, 0.913417_r8/ - data (bm0ij ( 1, 4,ibeta), ibeta = 1,10) / & - 0.693693_r8, 0.703654_r8, 0.726478_r8, 0.755786_r8, 0.787980_r8, & - 0.820626_r8, 0.851898_r8, 0.880459_r8, 0.905465_r8, 0.926552_r8/ - data (bm0ij ( 1, 5,ibeta), ibeta = 1,10) / & - 0.727803_r8, 0.737349_r8, 0.759140_r8, 0.786870_r8, 0.816901_r8, & - 0.846813_r8, 0.874906_r8, 0.900060_r8, 0.921679_r8, 0.939614_r8/ - data (bm0ij ( 1, 6,ibeta), ibeta = 1,10) / & - 0.763461_r8, 0.772483_r8, 0.792930_r8, 0.818599_r8, 0.845905_r8, & - 0.872550_r8, 0.897051_r8, 0.918552_r8, 0.936701_r8, 0.951528_r8/ - data (bm0ij ( 1, 7,ibeta), ibeta = 1,10) / & - 0.799021_r8, 0.807365_r8, 0.826094_r8, 0.849230_r8, 0.873358_r8, & - 0.896406_r8, 0.917161_r8, 0.935031_r8, 0.949868_r8, 0.961828_r8/ - data (bm0ij ( 1, 8,ibeta), ibeta = 1,10) / & - 0.833004_r8, 0.840514_r8, 0.857192_r8, 0.877446_r8, 0.898147_r8, & - 0.917518_r8, 0.934627_r8, 0.949106_r8, 0.960958_r8, 0.970403_r8/ - data (bm0ij ( 1, 9,ibeta), ibeta = 1,10) / & - 0.864172_r8, 0.870734_r8, 0.885153_r8, 0.902373_r8, 0.919640_r8, & - 0.935494_r8, 0.949257_r8, 0.960733_r8, 0.970016_r8, 0.977346_r8/ - data (bm0ij ( 1, 10,ibeta), ibeta = 1,10) / & - 0.891658_r8, 0.897227_r8, 0.909343_r8, 0.923588_r8, 0.937629_r8, & - 0.950307_r8, 0.961151_r8, 0.970082_r8, 0.977236_r8, 0.982844_r8/ - data (bm0ij ( 2, 1,ibeta), ibeta = 1,10) / & - 0.658724_r8, 0.670587_r8, 0.697539_r8, 0.731890_r8, 0.769467_r8, & - 0.807391_r8, 0.843410_r8, 0.875847_r8, 0.903700_r8, 0.926645_r8/ - data (bm0ij ( 2, 2,ibeta), ibeta = 1,10) / & - 0.667070_r8, 0.678820_r8, 0.705538_r8, 0.739591_r8, 0.776758_r8, & - 0.814118_r8, 0.849415_r8, 0.881020_r8, 0.908006_r8, 0.930121_r8/ - data (bm0ij ( 2, 3,ibeta), ibeta = 1,10) / & - 0.686356_r8, 0.697839_r8, 0.723997_r8, 0.757285_r8, 0.793389_r8, & - 0.829313_r8, 0.862835_r8, 0.892459_r8, 0.917432_r8, 0.937663_r8/ - data (bm0ij ( 2, 4,ibeta), ibeta = 1,10) / & - 0.711425_r8, 0.722572_r8, 0.747941_r8, 0.780055_r8, 0.814518_r8, & - 0.848315_r8, 0.879335_r8, 0.906290_r8, 0.928658_r8, 0.946526_r8/ - data (bm0ij ( 2, 5,ibeta), ibeta = 1,10) / & - 0.739575_r8, 0.750307_r8, 0.774633_r8, 0.805138_r8, 0.837408_r8, & - 0.868504_r8, 0.896517_r8, 0.920421_r8, 0.939932_r8, 0.955299_r8/ - data (bm0ij ( 2, 6,ibeta), ibeta = 1,10) / & - 0.769143_r8, 0.779346_r8, 0.802314_r8, 0.830752_r8, 0.860333_r8, & - 0.888300_r8, 0.913014_r8, 0.933727_r8, 0.950370_r8, 0.963306_r8/ - data (bm0ij ( 2, 7,ibeta), ibeta = 1,10) / & - 0.798900_r8, 0.808431_r8, 0.829700_r8, 0.855653_r8, 0.882163_r8, & - 0.906749_r8, 0.928075_r8, 0.945654_r8, 0.959579_r8, 0.970280_r8/ - data (bm0ij ( 2, 8,ibeta), ibeta = 1,10) / & - 0.827826_r8, 0.836542_r8, 0.855808_r8, 0.878954_r8, 0.902174_r8, & - 0.923316_r8, 0.941345_r8, 0.955989_r8, 0.967450_r8, 0.976174_r8/ - data (bm0ij ( 2, 9,ibeta), ibeta = 1,10) / & - 0.855068_r8, 0.862856_r8, 0.879900_r8, 0.900068_r8, 0.919956_r8, & - 0.937764_r8, 0.952725_r8, 0.964726_r8, 0.974027_r8, 0.981053_r8/ - data (bm0ij ( 2, 10,ibeta), ibeta = 1,10) / & - 0.879961_r8, 0.886755_r8, 0.901484_r8, 0.918665_r8, 0.935346_r8, & - 0.950065_r8, 0.962277_r8, 0.971974_r8, 0.979432_r8, 0.985033_r8/ - data (bm0ij ( 3, 1,ibeta), ibeta = 1,10) / & - 0.724166_r8, 0.735474_r8, 0.761359_r8, 0.794045_r8, 0.828702_r8, & - 0.862061_r8, 0.891995_r8, 0.917385_r8, 0.937959_r8, 0.954036_r8/ - data (bm0ij ( 3, 2,ibeta), ibeta = 1,10) / & - 0.730416_r8, 0.741780_r8, 0.767647_r8, 0.800116_r8, 0.834344_r8, & - 0.867093_r8, 0.896302_r8, 0.920934_r8, 0.940790_r8, 0.956237_r8/ - data (bm0ij ( 3, 3,ibeta), ibeta = 1,10) / & - 0.745327_r8, 0.756664_r8, 0.782255_r8, 0.814026_r8, 0.847107_r8, & - 0.878339_r8, 0.905820_r8, 0.928699_r8, 0.946931_r8, 0.960977_r8/ - data (bm0ij ( 3, 4,ibeta), ibeta = 1,10) / & - 0.765195_r8, 0.776312_r8, 0.801216_r8, 0.831758_r8, 0.863079_r8, & - 0.892159_r8, 0.917319_r8, 0.937939_r8, 0.954145_r8, 0.966486_r8/ - data (bm0ij ( 3, 5,ibeta), ibeta = 1,10) / & - 0.787632_r8, 0.798347_r8, 0.822165_r8, 0.850985_r8, 0.880049_r8, & - 0.906544_r8, 0.929062_r8, 0.947218_r8, 0.961288_r8, 0.971878_r8/ - data (bm0ij ( 3, 6,ibeta), ibeta = 1,10) / & - 0.811024_r8, 0.821179_r8, 0.843557_r8, 0.870247_r8, 0.896694_r8, & - 0.920365_r8, 0.940131_r8, 0.955821_r8, 0.967820_r8, 0.976753_r8/ - data (bm0ij ( 3, 7,ibeta), ibeta = 1,10) / & - 0.834254_r8, 0.843709_r8, 0.864356_r8, 0.888619_r8, 0.912245_r8, & - 0.933019_r8, 0.950084_r8, 0.963438_r8, 0.973530_r8, 0.980973_r8/ - data (bm0ij ( 3, 8,ibeta), ibeta = 1,10) / & - 0.856531_r8, 0.865176_r8, 0.883881_r8, 0.905544_r8, 0.926290_r8, & - 0.944236_r8, 0.958762_r8, 0.969988_r8, 0.978386_r8, 0.984530_r8/ - data (bm0ij ( 3, 9,ibeta), ibeta = 1,10) / & - 0.877307_r8, 0.885070_r8, 0.901716_r8, 0.920729_r8, 0.938663_r8, & - 0.953951_r8, 0.966169_r8, 0.975512_r8, 0.982442_r8, 0.987477_r8/ - data (bm0ij ( 3, 10,ibeta), ibeta = 1,10) / & - 0.896234_r8, 0.903082_r8, 0.917645_r8, 0.934069_r8, 0.949354_r8, & - 0.962222_r8, 0.972396_r8, 0.980107_r8, 0.985788_r8, 0.989894_r8/ - data (bm0ij ( 4, 1,ibeta), ibeta = 1,10) / & - 0.799294_r8, 0.809144_r8, 0.831293_r8, 0.858395_r8, 0.885897_r8, & - 0.911031_r8, 0.932406_r8, 0.949642_r8, 0.963001_r8, 0.973062_r8/ - data (bm0ij ( 4, 2,ibeta), ibeta = 1,10) / & - 0.804239_r8, 0.814102_r8, 0.836169_r8, 0.862984_r8, 0.890003_r8, & - 0.914535_r8, 0.935274_r8, 0.951910_r8, 0.964748_r8, 0.974381_r8/ - data (bm0ij ( 4, 3,ibeta), ibeta = 1,10) / & - 0.815910_r8, 0.825708_r8, 0.847403_r8, 0.873389_r8, 0.899185_r8, & - 0.922275_r8, 0.941543_r8, 0.956826_r8, 0.968507_r8, 0.977204_r8/ - data (bm0ij ( 4, 4,ibeta), ibeta = 1,10) / & - 0.831348_r8, 0.840892_r8, 0.861793_r8, 0.886428_r8, 0.910463_r8, & - 0.931614_r8, 0.948993_r8, 0.962593_r8, 0.972872_r8, 0.980456_r8/ - data (bm0ij ( 4, 5,ibeta), ibeta = 1,10) / & - 0.848597_r8, 0.857693_r8, 0.877402_r8, 0.900265_r8, 0.922180_r8, & - 0.941134_r8, 0.956464_r8, 0.968298_r8, 0.977143_r8, 0.983611_r8/ - data (bm0ij ( 4, 6,ibeta), ibeta = 1,10) / & - 0.866271_r8, 0.874764_r8, 0.892984_r8, 0.913796_r8, 0.933407_r8, & - 0.950088_r8, 0.963380_r8, 0.973512_r8, 0.981006_r8, 0.986440_r8/ - data (bm0ij ( 4, 7,ibeta), ibeta = 1,10) / & - 0.883430_r8, 0.891216_r8, 0.907762_r8, 0.926388_r8, 0.943660_r8, & - 0.958127_r8, 0.969499_r8, 0.978070_r8, 0.984351_r8, 0.988872_r8/ - data (bm0ij ( 4, 8,ibeta), ibeta = 1,10) / & - 0.899483_r8, 0.906505_r8, 0.921294_r8, 0.937719_r8, 0.952729_r8, & - 0.965131_r8, 0.974762_r8, 0.981950_r8, 0.987175_r8, 0.990912_r8/ - data (bm0ij ( 4, 9,ibeta), ibeta = 1,10) / & - 0.914096_r8, 0.920337_r8, 0.933373_r8, 0.947677_r8, 0.960579_r8, & - 0.971111_r8, 0.979206_r8, 0.985196_r8, 0.989520_r8, 0.992597_r8/ - data (bm0ij ( 4, 10,ibeta), ibeta = 1,10) / & - 0.927122_r8, 0.932597_r8, 0.943952_r8, 0.956277_r8, 0.967268_r8, & - 0.976147_r8, 0.982912_r8, 0.987882_r8, 0.991450_r8, 0.993976_r8/ - data (bm0ij ( 5, 1,ibeta), ibeta = 1,10) / & - 0.865049_r8, 0.872851_r8, 0.889900_r8, 0.909907_r8, 0.929290_r8, & - 0.946205_r8, 0.959991_r8, 0.970706_r8, 0.978764_r8, 0.984692_r8/ - data (bm0ij ( 5, 2,ibeta), ibeta = 1,10) / & - 0.868989_r8, 0.876713_r8, 0.893538_r8, 0.913173_r8, 0.932080_r8, & - 0.948484_r8, 0.961785_r8, 0.972080_r8, 0.979796_r8, 0.985457_r8/ - data (bm0ij ( 5, 3,ibeta), ibeta = 1,10) / & - 0.878010_r8, 0.885524_r8, 0.901756_r8, 0.920464_r8, 0.938235_r8, & - 0.953461_r8, 0.965672_r8, 0.975037_r8, 0.982005_r8, 0.987085_r8/ - data (bm0ij ( 5, 4,ibeta), ibeta = 1,10) / & - 0.889534_r8, 0.896698_r8, 0.912012_r8, 0.929395_r8, 0.945647_r8, & - 0.959366_r8, 0.970227_r8, 0.978469_r8, 0.984547_r8, 0.988950_r8/ - data (bm0ij ( 5, 5,ibeta), ibeta = 1,10) / & - 0.902033_r8, 0.908713_r8, 0.922848_r8, 0.938648_r8, 0.953186_r8, & - 0.965278_r8, 0.974729_r8, 0.981824_r8, 0.987013_r8, 0.990746_r8/ - data (bm0ij ( 5, 6,ibeta), ibeta = 1,10) / & - 0.914496_r8, 0.920599_r8, 0.933389_r8, 0.947485_r8, 0.960262_r8, & - 0.970743_r8, 0.978839_r8, 0.984858_r8, 0.989225_r8, 0.992348_r8/ - data (bm0ij ( 5, 7,ibeta), ibeta = 1,10) / & - 0.926281_r8, 0.931761_r8, 0.943142_r8, 0.955526_r8, 0.966600_r8, & - 0.975573_r8, 0.982431_r8, 0.987485_r8, 0.991128_r8, 0.993718_r8/ - data (bm0ij ( 5, 8,ibeta), ibeta = 1,10) / & - 0.937029_r8, 0.941877_r8, 0.951868_r8, 0.962615_r8, 0.972112_r8, & - 0.979723_r8, 0.985488_r8, 0.989705_r8, 0.992725_r8, 0.994863_r8/ - data (bm0ij ( 5, 9,ibeta), ibeta = 1,10) / & - 0.946580_r8, 0.950819_r8, 0.959494_r8, 0.968732_r8, 0.976811_r8, & - 0.983226_r8, 0.988047_r8, 0.991550_r8, 0.994047_r8, 0.995806_r8/ - data (bm0ij ( 5, 10,ibeta), ibeta = 1,10) / & - 0.954909_r8, 0.958581_r8, 0.966049_r8, 0.973933_r8, 0.980766_r8, & - 0.986149_r8, 0.990166_r8, 0.993070_r8, 0.995130_r8, 0.996577_r8/ - data (bm0ij ( 6, 1,ibeta), ibeta = 1,10) / & - 0.914182_r8, 0.919824_r8, 0.931832_r8, 0.945387_r8, 0.957999_r8, & - 0.968606_r8, 0.976982_r8, 0.983331_r8, 0.988013_r8, 0.991407_r8/ - data (bm0ij ( 6, 2,ibeta), ibeta = 1,10) / & - 0.917139_r8, 0.922665_r8, 0.934395_r8, 0.947580_r8, 0.959792_r8, & - 0.970017_r8, 0.978062_r8, 0.984138_r8, 0.988609_r8, 0.991843_r8/ - data (bm0ij ( 6, 3,ibeta), ibeta = 1,10) / & - 0.923742_r8, 0.928990_r8, 0.940064_r8, 0.952396_r8, 0.963699_r8, & - 0.973070_r8, 0.980381_r8, 0.985866_r8, 0.989878_r8, 0.992768_r8/ - data (bm0ij ( 6, 4,ibeta), ibeta = 1,10) / & - 0.931870_r8, 0.936743_r8, 0.946941_r8, 0.958162_r8, 0.968318_r8, & - 0.976640_r8, 0.983069_r8, 0.987853_r8, 0.991330_r8, 0.993822_r8/ - data (bm0ij ( 6, 5,ibeta), ibeta = 1,10) / & - 0.940376_r8, 0.944807_r8, 0.954004_r8, 0.963999_r8, 0.972928_r8, & - 0.980162_r8, 0.985695_r8, 0.989779_r8, 0.992729_r8, 0.994833_r8/ - data (bm0ij ( 6, 6,ibeta), ibeta = 1,10) / & - 0.948597_r8, 0.952555_r8, 0.960703_r8, 0.969454_r8, 0.977181_r8, & - 0.983373_r8, 0.988067_r8, 0.991507_r8, 0.993977_r8, 0.995730_r8/ - data (bm0ij ( 6, 7,ibeta), ibeta = 1,10) / & - 0.956167_r8, 0.959648_r8, 0.966763_r8, 0.974326_r8, 0.980933_r8, & - 0.986177_r8, 0.990121_r8, 0.992993_r8, 0.995045_r8, 0.996495_r8/ - data (bm0ij ( 6, 8,ibeta), ibeta = 1,10) / & - 0.962913_r8, 0.965937_r8, 0.972080_r8, 0.978552_r8, 0.984153_r8, & - 0.988563_r8, 0.991857_r8, 0.994242_r8, 0.995938_r8, 0.997133_r8/ - data (bm0ij ( 6, 9,ibeta), ibeta = 1,10) / & - 0.968787_r8, 0.971391_r8, 0.976651_r8, 0.982148_r8, 0.986869_r8, & - 0.990560_r8, 0.993301_r8, 0.995275_r8, 0.996675_r8, 0.997657_r8/ - data (bm0ij ( 6, 10,ibeta), ibeta = 1,10) / & - 0.973822_r8, 0.976047_r8, 0.980523_r8, 0.985170_r8, 0.989134_r8, & - 0.992215_r8, 0.994491_r8, 0.996124_r8, 0.997277_r8, 0.998085_r8/ - data (bm0ij ( 7, 1,ibeta), ibeta = 1,10) / & - 0.947410_r8, 0.951207_r8, 0.959119_r8, 0.967781_r8, 0.975592_r8, & - 0.981981_r8, 0.986915_r8, 0.990590_r8, 0.993266_r8, 0.995187_r8/ - data (bm0ij ( 7, 2,ibeta), ibeta = 1,10) / & - 0.949477_r8, 0.953161_r8, 0.960824_r8, 0.969187_r8, 0.976702_r8, & - 0.982831_r8, 0.987550_r8, 0.991057_r8, 0.993606_r8, 0.995434_r8/ - data (bm0ij ( 7, 3,ibeta), ibeta = 1,10) / & - 0.954008_r8, 0.957438_r8, 0.964537_r8, 0.972232_r8, 0.979095_r8, & - 0.984653_r8, 0.988907_r8, 0.992053_r8, 0.994330_r8, 0.995958_r8/ - data (bm0ij ( 7, 4,ibeta), ibeta = 1,10) / & - 0.959431_r8, 0.962539_r8, 0.968935_r8, 0.975808_r8, 0.981882_r8, & - 0.986759_r8, 0.990466_r8, 0.993190_r8, 0.995153_r8, 0.996552_r8/ - data (bm0ij ( 7, 5,ibeta), ibeta = 1,10) / & - 0.964932_r8, 0.967693_r8, 0.973342_r8, 0.979355_r8, 0.984620_r8, & - 0.988812_r8, 0.991974_r8, 0.994285_r8, 0.995943_r8, 0.997119_r8/ - data (bm0ij ( 7, 6,ibeta), ibeta = 1,10) / & - 0.970101_r8, 0.972517_r8, 0.977428_r8, 0.982612_r8, 0.987110_r8, & - 0.990663_r8, 0.993326_r8, 0.995261_r8, 0.996644_r8, 0.997621_r8/ - data (bm0ij ( 7, 7,ibeta), ibeta = 1,10) / & - 0.974746_r8, 0.976834_r8, 0.981055_r8, 0.985475_r8, 0.989280_r8, & - 0.992265_r8, 0.994488_r8, 0.996097_r8, 0.997241_r8, 0.998048_r8/ - data (bm0ij ( 7, 8,ibeta), ibeta = 1,10) / & - 0.978804_r8, 0.980591_r8, 0.984187_r8, 0.987927_r8, 0.991124_r8, & - 0.993617_r8, 0.995464_r8, 0.996795_r8, 0.997739_r8, 0.998403_r8/ - data (bm0ij ( 7, 9,ibeta), ibeta = 1,10) / & - 0.982280_r8, 0.983799_r8, 0.986844_r8, 0.989991_r8, 0.992667_r8, & - 0.994742_r8, 0.996273_r8, 0.997372_r8, 0.998149_r8, 0.998695_r8/ - data (bm0ij ( 7, 10,ibeta), ibeta = 1,10) / & - 0.985218_r8, 0.986503_r8, 0.989071_r8, 0.991711_r8, 0.993945_r8, & - 0.995669_r8, 0.996937_r8, 0.997844_r8, 0.998484_r8, 0.998932_r8/ - data (bm0ij ( 8, 1,ibeta), ibeta = 1,10) / & - 0.968507_r8, 0.970935_r8, 0.975916_r8, 0.981248_r8, 0.985947_r8, & - 0.989716_r8, 0.992580_r8, 0.994689_r8, 0.996210_r8, 0.997297_r8/ - data (bm0ij ( 8, 2,ibeta), ibeta = 1,10) / & - 0.969870_r8, 0.972210_r8, 0.977002_r8, 0.982119_r8, 0.986619_r8, & - 0.990219_r8, 0.992951_r8, 0.994958_r8, 0.996405_r8, 0.997437_r8/ - data (bm0ij ( 8, 3,ibeta), ibeta = 1,10) / & - 0.972820_r8, 0.974963_r8, 0.979339_r8, 0.983988_r8, 0.988054_r8, & - 0.991292_r8, 0.993738_r8, 0.995529_r8, 0.996817_r8, 0.997734_r8/ - data (bm0ij ( 8, 4,ibeta), ibeta = 1,10) / & - 0.976280_r8, 0.978186_r8, 0.982060_r8, 0.986151_r8, 0.989706_r8, & - 0.992520_r8, 0.994636_r8, 0.996179_r8, 0.997284_r8, 0.998069_r8/ - data (bm0ij ( 8, 5,ibeta), ibeta = 1,10) / & - 0.979711_r8, 0.981372_r8, 0.984735_r8, 0.988263_r8, 0.991309_r8, & - 0.993706_r8, 0.995499_r8, 0.996801_r8, 0.997730_r8, 0.998389_r8/ - data (bm0ij ( 8, 6,ibeta), ibeta = 1,10) / & - 0.982863_r8, 0.984292_r8, 0.987172_r8, 0.990174_r8, 0.992750_r8, & - 0.994766_r8, 0.996266_r8, 0.997352_r8, 0.998125_r8, 0.998670_r8/ - data (bm0ij ( 8, 7,ibeta), ibeta = 1,10) / & - 0.985642_r8, 0.986858_r8, 0.989301_r8, 0.991834_r8, 0.993994_r8, & - 0.995676_r8, 0.996923_r8, 0.997822_r8, 0.998460_r8, 0.998910_r8/ - data (bm0ij ( 8, 8,ibeta), ibeta = 1,10) / & - 0.988029_r8, 0.989058_r8, 0.991116_r8, 0.993240_r8, 0.995043_r8, & - 0.996440_r8, 0.997472_r8, 0.998214_r8, 0.998739_r8, 0.999108_r8/ - data (bm0ij ( 8, 9,ibeta), ibeta = 1,10) / & - 0.990046_r8, 0.990912_r8, 0.992640_r8, 0.994415_r8, 0.995914_r8, & - 0.997073_r8, 0.997925_r8, 0.998536_r8, 0.998968_r8, 0.999271_r8/ - data (bm0ij ( 8, 10,ibeta), ibeta = 1,10) / & - 0.991732_r8, 0.992459_r8, 0.993906_r8, 0.995386_r8, 0.996633_r8, & - 0.997592_r8, 0.998296_r8, 0.998799_r8, 0.999154_r8, 0.999403_r8/ - data (bm0ij ( 9, 1,ibeta), ibeta = 1,10) / & - 0.981392_r8, 0.982893_r8, 0.985938_r8, 0.989146_r8, 0.991928_r8, & - 0.994129_r8, 0.995783_r8, 0.996991_r8, 0.997857_r8, 0.998473_r8/ - data (bm0ij ( 9, 2,ibeta), ibeta = 1,10) / & - 0.982254_r8, 0.983693_r8, 0.986608_r8, 0.989673_r8, 0.992328_r8, & - 0.994424_r8, 0.995998_r8, 0.997146_r8, 0.997969_r8, 0.998553_r8/ - data (bm0ij ( 9, 3,ibeta), ibeta = 1,10) / & - 0.984104_r8, 0.985407_r8, 0.988040_r8, 0.990798_r8, 0.993178_r8, & - 0.995052_r8, 0.996454_r8, 0.997474_r8, 0.998204_r8, 0.998722_r8/ - data (bm0ij ( 9, 4,ibeta), ibeta = 1,10) / & - 0.986243_r8, 0.987386_r8, 0.989687_r8, 0.992087_r8, 0.994149_r8, & - 0.995765_r8, 0.996971_r8, 0.997846_r8, 0.998470_r8, 0.998913_r8/ - data (bm0ij ( 9, 5,ibeta), ibeta = 1,10) / & - 0.988332_r8, 0.989313_r8, 0.991284_r8, 0.993332_r8, 0.995082_r8, & - 0.996449_r8, 0.997465_r8, 0.998200_r8, 0.998723_r8, 0.999093_r8/ - data (bm0ij ( 9, 6,ibeta), ibeta = 1,10) / & - 0.990220_r8, 0.991053_r8, 0.992721_r8, 0.994445_r8, 0.995914_r8, & - 0.997056_r8, 0.997902_r8, 0.998513_r8, 0.998947_r8, 0.999253_r8/ - data (bm0ij ( 9, 7,ibeta), ibeta = 1,10) / & - 0.991859_r8, 0.992561_r8, 0.993961_r8, 0.995403_r8, 0.996626_r8, & - 0.997574_r8, 0.998274_r8, 0.998778_r8, 0.999136_r8, 0.999387_r8/ - data (bm0ij ( 9, 8,ibeta), ibeta = 1,10) / & - 0.993250_r8, 0.993837_r8, 0.995007_r8, 0.996208_r8, 0.997223_r8, & - 0.998007_r8, 0.998584_r8, 0.998999_r8, 0.999293_r8, 0.999499_r8/ - data (bm0ij ( 9, 9,ibeta), ibeta = 1,10) / & - 0.994413_r8, 0.994903_r8, 0.995878_r8, 0.996876_r8, 0.997716_r8, & - 0.998363_r8, 0.998839_r8, 0.999180_r8, 0.999421_r8, 0.999591_r8/ - data (bm0ij ( 9, 10,ibeta), ibeta = 1,10) / & - 0.995376_r8, 0.995785_r8, 0.996597_r8, 0.997425_r8, 0.998121_r8, & - 0.998655_r8, 0.999048_r8, 0.999328_r8, 0.999526_r8, 0.999665_r8/ - data (bm0ij ( 10, 1,ibeta), ibeta = 1,10) / & - 0.989082_r8, 0.989991_r8, 0.991819_r8, 0.993723_r8, 0.995357_r8, & - 0.996637_r8, 0.997592_r8, 0.998286_r8, 0.998781_r8, 0.999132_r8/ - data (bm0ij ( 10, 2,ibeta), ibeta = 1,10) / & - 0.989613_r8, 0.990480_r8, 0.992224_r8, 0.994039_r8, 0.995594_r8, & - 0.996810_r8, 0.997717_r8, 0.998375_r8, 0.998845_r8, 0.999178_r8/ - data (bm0ij ( 10, 3,ibeta), ibeta = 1,10) / & - 0.990744_r8, 0.991523_r8, 0.993086_r8, 0.994708_r8, 0.996094_r8, & - 0.997176_r8, 0.997981_r8, 0.998564_r8, 0.998980_r8, 0.999274_r8/ - data (bm0ij ( 10, 4,ibeta), ibeta = 1,10) / & - 0.992041_r8, 0.992716_r8, 0.994070_r8, 0.995470_r8, 0.996662_r8, & - 0.997591_r8, 0.998280_r8, 0.998778_r8, 0.999133_r8, 0.999383_r8/ - data (bm0ij ( 10, 5,ibeta), ibeta = 1,10) / & - 0.993292_r8, 0.993867_r8, 0.995015_r8, 0.996199_r8, 0.997205_r8, & - 0.997985_r8, 0.998564_r8, 0.998981_r8, 0.999277_r8, 0.999487_r8/ - data (bm0ij ( 10, 6,ibeta), ibeta = 1,10) / & - 0.994411_r8, 0.994894_r8, 0.995857_r8, 0.996847_r8, 0.997685_r8, & - 0.998334_r8, 0.998814_r8, 0.999159_r8, 0.999404_r8, 0.999577_r8/ - data (bm0ij ( 10, 7,ibeta), ibeta = 1,10) / & - 0.995373_r8, 0.995776_r8, 0.996577_r8, 0.997400_r8, 0.998094_r8, & - 0.998630_r8, 0.999026_r8, 0.999310_r8, 0.999512_r8, 0.999654_r8/ - data (bm0ij ( 10, 8,ibeta), ibeta = 1,10) / & - 0.996181_r8, 0.996516_r8, 0.997181_r8, 0.997861_r8, 0.998435_r8, & - 0.998877_r8, 0.999202_r8, 0.999435_r8, 0.999601_r8, 0.999717_r8/ - data (bm0ij ( 10, 9,ibeta), ibeta = 1,10) / & - 0.996851_r8, 0.997128_r8, 0.997680_r8, 0.998242_r8, 0.998715_r8, & - 0.999079_r8, 0.999346_r8, 0.999538_r8, 0.999673_r8, 0.999769_r8/ - data (bm0ij ( 10, 10,ibeta), ibeta = 1,10) / & - 0.997402_r8, 0.997632_r8, 0.998089_r8, 0.998554_r8, 0.998945_r8, & - 0.999244_r8, 0.999464_r8, 0.999622_r8, 0.999733_r8, 0.999811_r8/ - - -! rpm.... 3rd moment nuclei mode corr. fac. for bimodal fm coag rate - - data (bm3i( 1, 1,ibeta ), ibeta=1,10)/ & - 0.70708_r8,0.71681_r8,0.73821_r8,0.76477_r8,0.79350_r8,0.82265_r8,0.85090_r8,0.87717_r8, & - 0.90069_r8,0.92097_r8/ - data (bm3i( 1, 2,ibeta ), ibeta=1,10)/ & - 0.72172_r8,0.73022_r8,0.74927_r8,0.77324_r8,0.79936_r8,0.82601_r8,0.85199_r8,0.87637_r8, & - 0.89843_r8,0.91774_r8/ - data (bm3i( 1, 3,ibeta ), ibeta=1,10)/ & - 0.78291_r8,0.78896_r8,0.80286_r8,0.82070_r8,0.84022_r8,0.85997_r8,0.87901_r8,0.89669_r8, & - 0.91258_r8,0.92647_r8/ - data (bm3i( 1, 4,ibeta ), ibeta=1,10)/ & - 0.87760_r8,0.88147_r8,0.89025_r8,0.90127_r8,0.91291_r8,0.92420_r8,0.93452_r8,0.94355_r8, & - 0.95113_r8,0.95726_r8/ - data (bm3i( 1, 5,ibeta ), ibeta=1,10)/ & - 0.94988_r8,0.95184_r8,0.95612_r8,0.96122_r8,0.96628_r8,0.97085_r8,0.97467_r8,0.97763_r8, & - 0.97971_r8,0.98089_r8/ - data (bm3i( 1, 6,ibeta ), ibeta=1,10)/ & - 0.98318_r8,0.98393_r8,0.98551_r8,0.98728_r8,0.98889_r8,0.99014_r8,0.99095_r8,0.99124_r8, & - 0.99100_r8,0.99020_r8/ - data (bm3i( 1, 7,ibeta ), ibeta=1,10)/ & - 0.99480_r8,0.99504_r8,0.99551_r8,0.99598_r8,0.99629_r8,0.99635_r8,0.99611_r8,0.99550_r8, & - 0.99450_r8,0.99306_r8/ - data (bm3i( 1, 8,ibeta ), ibeta=1,10)/ & - 0.99842_r8,0.99848_r8,0.99858_r8,0.99861_r8,0.99850_r8,0.99819_r8,0.99762_r8,0.99674_r8, & - 0.99550_r8,0.99388_r8/ - data (bm3i( 1, 9,ibeta ), ibeta=1,10)/ & - 0.99951_r8,0.99951_r8,0.99949_r8,0.99939_r8,0.99915_r8,0.99872_r8,0.99805_r8,0.99709_r8, & - 0.99579_r8,0.99411_r8/ - data (bm3i( 1,10,ibeta ), ibeta=1,10)/ & - 0.99984_r8,0.99982_r8,0.99976_r8,0.99962_r8,0.99934_r8,0.99888_r8,0.99818_r8,0.99719_r8, & - 0.99587_r8,0.99417_r8/ - data (bm3i( 2, 1,ibeta ), ibeta=1,10)/ & - 0.72957_r8,0.73993_r8,0.76303_r8,0.79178_r8,0.82245_r8,0.85270_r8,0.88085_r8,0.90578_r8, & - 0.92691_r8,0.94415_r8/ - data (bm3i( 2, 2,ibeta ), ibeta=1,10)/ & - 0.72319_r8,0.73320_r8,0.75547_r8,0.78323_r8,0.81307_r8,0.84287_r8,0.87107_r8,0.89651_r8, & - 0.91852_r8,0.93683_r8/ - data (bm3i( 2, 3,ibeta ), ibeta=1,10)/ & - 0.74413_r8,0.75205_r8,0.76998_r8,0.79269_r8,0.81746_r8,0.84258_r8,0.86685_r8,0.88938_r8, & - 0.90953_r8,0.92695_r8/ - data (bm3i( 2, 4,ibeta ), ibeta=1,10)/ & - 0.82588_r8,0.83113_r8,0.84309_r8,0.85825_r8,0.87456_r8,0.89072_r8,0.90594_r8,0.91972_r8, & - 0.93178_r8,0.94203_r8/ - data (bm3i( 2, 5,ibeta ), ibeta=1,10)/ & - 0.91886_r8,0.92179_r8,0.92831_r8,0.93624_r8,0.94434_r8,0.95192_r8,0.95856_r8,0.96409_r8, & - 0.96845_r8,0.97164_r8/ - data (bm3i( 2, 6,ibeta ), ibeta=1,10)/ & - 0.97129_r8,0.97252_r8,0.97515_r8,0.97818_r8,0.98108_r8,0.98354_r8,0.98542_r8,0.98665_r8, & - 0.98721_r8,0.98709_r8/ - data (bm3i( 2, 7,ibeta ), ibeta=1,10)/ & - 0.99104_r8,0.99145_r8,0.99230_r8,0.99320_r8,0.99394_r8,0.99439_r8,0.99448_r8,0.99416_r8, & - 0.99340_r8,0.99217_r8/ - data (bm3i( 2, 8,ibeta ), ibeta=1,10)/ & - 0.99730_r8,0.99741_r8,0.99763_r8,0.99779_r8,0.99782_r8,0.99762_r8,0.99715_r8,0.99636_r8, & - 0.99519_r8,0.99363_r8/ - data (bm3i( 2, 9,ibeta ), ibeta=1,10)/ & - 0.99917_r8,0.99919_r8,0.99921_r8,0.99915_r8,0.99895_r8,0.99856_r8,0.99792_r8,0.99698_r8, & - 0.99570_r8,0.99404_r8/ - data (bm3i( 2,10,ibeta ), ibeta=1,10)/ & - 0.99973_r8,0.99973_r8,0.99968_r8,0.99955_r8,0.99928_r8,0.99883_r8,0.99814_r8,0.99716_r8, & - 0.99584_r8,0.99415_r8/ - data (bm3i( 3, 1,ibeta ), ibeta=1,10)/ & - 0.78358_r8,0.79304_r8,0.81445_r8,0.84105_r8,0.86873_r8,0.89491_r8,0.91805_r8,0.93743_r8, & - 0.95300_r8,0.96510_r8/ - data (bm3i( 3, 2,ibeta ), ibeta=1,10)/ & - 0.76412_r8,0.77404_r8,0.79635_r8,0.82404_r8,0.85312_r8,0.88101_r8,0.90610_r8,0.92751_r8, & - 0.94500_r8,0.95879_r8/ - data (bm3i( 3, 3,ibeta ), ibeta=1,10)/ & - 0.74239_r8,0.75182_r8,0.77301_r8,0.79956_r8,0.82809_r8,0.85639_r8,0.88291_r8,0.90658_r8, & - 0.92683_r8,0.94350_r8/ - data (bm3i( 3, 4,ibeta ), ibeta=1,10)/ & - 0.78072_r8,0.78758_r8,0.80317_r8,0.82293_r8,0.84437_r8,0.86589_r8,0.88643_r8,0.90526_r8, & - 0.92194_r8,0.93625_r8/ - data (bm3i( 3, 5,ibeta ), ibeta=1,10)/ & - 0.87627_r8,0.88044_r8,0.88981_r8,0.90142_r8,0.91357_r8,0.92524_r8,0.93585_r8,0.94510_r8, & - 0.95285_r8,0.95911_r8/ - data (bm3i( 3, 6,ibeta ), ibeta=1,10)/ & - 0.95176_r8,0.95371_r8,0.95796_r8,0.96297_r8,0.96792_r8,0.97233_r8,0.97599_r8,0.97880_r8, & - 0.98072_r8,0.98178_r8/ - data (bm3i( 3, 7,ibeta ), ibeta=1,10)/ & - 0.98453_r8,0.98523_r8,0.98670_r8,0.98833_r8,0.98980_r8,0.99092_r8,0.99160_r8,0.99179_r8, & - 0.99145_r8,0.99058_r8/ - data (bm3i( 3, 8,ibeta ), ibeta=1,10)/ & - 0.99534_r8,0.99555_r8,0.99597_r8,0.99637_r8,0.99662_r8,0.99663_r8,0.99633_r8,0.99569_r8, & - 0.99465_r8,0.99318_r8/ - data (bm3i( 3, 9,ibeta ), ibeta=1,10)/ & - 0.99859_r8,0.99864_r8,0.99872_r8,0.99873_r8,0.99860_r8,0.99827_r8,0.99768_r8,0.99679_r8, & - 0.99555_r8,0.99391_r8/ - data (bm3i( 3,10,ibeta ), ibeta=1,10)/ & - 0.99956_r8,0.99956_r8,0.99953_r8,0.99942_r8,0.99918_r8,0.99875_r8,0.99807_r8,0.99711_r8, & - 0.99580_r8,0.99412_r8/ - data (bm3i( 4, 1,ibeta ), ibeta=1,10)/ & - 0.84432_r8,0.85223_r8,0.86990_r8,0.89131_r8,0.91280_r8,0.93223_r8,0.94861_r8,0.96172_r8, & - 0.97185_r8,0.97945_r8/ - data (bm3i( 4, 2,ibeta ), ibeta=1,10)/ & - 0.82299_r8,0.83164_r8,0.85101_r8,0.87463_r8,0.89857_r8,0.92050_r8,0.93923_r8,0.95443_r8, & - 0.96629_r8,0.97529_r8/ - data (bm3i( 4, 3,ibeta ), ibeta=1,10)/ & - 0.77870_r8,0.78840_r8,0.81011_r8,0.83690_r8,0.86477_r8,0.89124_r8,0.91476_r8,0.93460_r8, & - 0.95063_r8,0.96316_r8/ - data (bm3i( 4, 4,ibeta ), ibeta=1,10)/ & - 0.76386_r8,0.77233_r8,0.79147_r8,0.81557_r8,0.84149_r8,0.86719_r8,0.89126_r8,0.91275_r8, & - 0.93116_r8,0.94637_r8/ - data (bm3i( 4, 5,ibeta ), ibeta=1,10)/ & - 0.82927_r8,0.83488_r8,0.84756_r8,0.86346_r8,0.88040_r8,0.89704_r8,0.91257_r8,0.92649_r8, & - 0.93857_r8,0.94874_r8/ - data (bm3i( 4, 6,ibeta ), ibeta=1,10)/ & - 0.92184_r8,0.92481_r8,0.93136_r8,0.93925_r8,0.94724_r8,0.95462_r8,0.96104_r8,0.96634_r8, & - 0.97048_r8,0.97348_r8/ - data (bm3i( 4, 7,ibeta ), ibeta=1,10)/ & - 0.97341_r8,0.97457_r8,0.97706_r8,0.97991_r8,0.98260_r8,0.98485_r8,0.98654_r8,0.98760_r8, & - 0.98801_r8,0.98777_r8/ - data (bm3i( 4, 8,ibeta ), ibeta=1,10)/ & - 0.99192_r8,0.99229_r8,0.99305_r8,0.99385_r8,0.99449_r8,0.99486_r8,0.99487_r8,0.99449_r8, & - 0.99367_r8,0.99239_r8/ - data (bm3i( 4, 9,ibeta ), ibeta=1,10)/ & - 0.99758_r8,0.99768_r8,0.99787_r8,0.99800_r8,0.99799_r8,0.99777_r8,0.99727_r8,0.99645_r8, & - 0.99527_r8,0.99369_r8/ - data (bm3i( 4,10,ibeta ), ibeta=1,10)/ & - 0.99926_r8,0.99928_r8,0.99928_r8,0.99921_r8,0.99900_r8,0.99860_r8,0.99795_r8,0.99701_r8, & - 0.99572_r8,0.99405_r8/ - data (bm3i( 5, 1,ibeta ), ibeta=1,10)/ & - 0.89577_r8,0.90190_r8,0.91522_r8,0.93076_r8,0.94575_r8,0.95876_r8,0.96932_r8,0.97751_r8, & - 0.98367_r8,0.98820_r8/ - data (bm3i( 5, 2,ibeta ), ibeta=1,10)/ & - 0.87860_r8,0.88547_r8,0.90052_r8,0.91828_r8,0.93557_r8,0.95075_r8,0.96319_r8,0.97292_r8, & - 0.98028_r8,0.98572_r8/ - data (bm3i( 5, 3,ibeta ), ibeta=1,10)/ & - 0.83381_r8,0.84240_r8,0.86141_r8,0.88425_r8,0.90707_r8,0.92770_r8,0.94510_r8,0.95906_r8, & - 0.96986_r8,0.97798_r8/ - data (bm3i( 5, 4,ibeta ), ibeta=1,10)/ & - 0.78530_r8,0.79463_r8,0.81550_r8,0.84127_r8,0.86813_r8,0.89367_r8,0.91642_r8,0.93566_r8, & - 0.95125_r8,0.96347_r8/ - data (bm3i( 5, 5,ibeta ), ibeta=1,10)/ & - 0.79614_r8,0.80332_r8,0.81957_r8,0.84001_r8,0.86190_r8,0.88351_r8,0.90368_r8,0.92169_r8, & - 0.93718_r8,0.95006_r8/ - data (bm3i( 5, 6,ibeta ), ibeta=1,10)/ & - 0.88192_r8,0.88617_r8,0.89565_r8,0.90728_r8,0.91931_r8,0.93076_r8,0.94107_r8,0.94997_r8, & - 0.95739_r8,0.96333_r8/ - data (bm3i( 5, 7,ibeta ), ibeta=1,10)/ & - 0.95509_r8,0.95698_r8,0.96105_r8,0.96583_r8,0.97048_r8,0.97460_r8,0.97796_r8,0.98050_r8, & - 0.98218_r8,0.98304_r8/ - data (bm3i( 5, 8,ibeta ), ibeta=1,10)/ & - 0.98596_r8,0.98660_r8,0.98794_r8,0.98943_r8,0.99074_r8,0.99172_r8,0.99227_r8,0.99235_r8, & - 0.99192_r8,0.99096_r8/ - data (bm3i( 5, 9,ibeta ), ibeta=1,10)/ & - 0.99581_r8,0.99600_r8,0.99637_r8,0.99672_r8,0.99691_r8,0.99687_r8,0.99653_r8,0.99585_r8, & - 0.99478_r8,0.99329_r8/ - data (bm3i( 5,10,ibeta ), ibeta=1,10)/ & - 0.99873_r8,0.99878_r8,0.99884_r8,0.99883_r8,0.99869_r8,0.99834_r8,0.99774_r8,0.99684_r8, & - 0.99558_r8,0.99394_r8/ - data (bm3i( 6, 1,ibeta ), ibeta=1,10)/ & - 0.93335_r8,0.93777_r8,0.94711_r8,0.95764_r8,0.96741_r8,0.97562_r8,0.98210_r8,0.98701_r8, & - 0.99064_r8,0.99327_r8/ - data (bm3i( 6, 2,ibeta ), ibeta=1,10)/ & - 0.92142_r8,0.92646_r8,0.93723_r8,0.94947_r8,0.96096_r8,0.97069_r8,0.97842_r8,0.98431_r8, & - 0.98868_r8,0.99186_r8/ - data (bm3i( 6, 3,ibeta ), ibeta=1,10)/ & - 0.88678_r8,0.89351_r8,0.90810_r8,0.92508_r8,0.94138_r8,0.95549_r8,0.96693_r8,0.97578_r8, & - 0.98243_r8,0.98731_r8/ - data (bm3i( 6, 4,ibeta ), ibeta=1,10)/ & - 0.83249_r8,0.84124_r8,0.86051_r8,0.88357_r8,0.90655_r8,0.92728_r8,0.94477_r8,0.95880_r8, & - 0.96964_r8,0.97779_r8/ - data (bm3i( 6, 5,ibeta ), ibeta=1,10)/ & - 0.79593_r8,0.80444_r8,0.82355_r8,0.84725_r8,0.87211_r8,0.89593_r8,0.91735_r8,0.93566_r8, & - 0.95066_r8,0.96255_r8/ - data (bm3i( 6, 6,ibeta ), ibeta=1,10)/ & - 0.84124_r8,0.84695_r8,0.85980_r8,0.87575_r8,0.89256_r8,0.90885_r8,0.92383_r8,0.93704_r8, & - 0.94830_r8,0.95761_r8/ - data (bm3i( 6, 7,ibeta ), ibeta=1,10)/ & - 0.92721_r8,0.93011_r8,0.93647_r8,0.94406_r8,0.95166_r8,0.95862_r8,0.96460_r8,0.96949_r8, & - 0.97326_r8,0.97595_r8/ - data (bm3i( 6, 8,ibeta ), ibeta=1,10)/ & - 0.97573_r8,0.97681_r8,0.97913_r8,0.98175_r8,0.98421_r8,0.98624_r8,0.98772_r8,0.98860_r8, & - 0.98885_r8,0.98847_r8/ - data (bm3i( 6, 9,ibeta ), ibeta=1,10)/ & - 0.99271_r8,0.99304_r8,0.99373_r8,0.99444_r8,0.99499_r8,0.99528_r8,0.99522_r8,0.99477_r8, & - 0.99390_r8,0.99258_r8/ - data (bm3i( 6,10,ibeta ), ibeta=1,10)/ & - 0.99782_r8,0.99791_r8,0.99807_r8,0.99817_r8,0.99813_r8,0.99788_r8,0.99737_r8,0.99653_r8, & - 0.99533_r8,0.99374_r8/ - data (bm3i( 7, 1,ibeta ), ibeta=1,10)/ & - 0.95858_r8,0.96158_r8,0.96780_r8,0.97460_r8,0.98073_r8,0.98575_r8,0.98963_r8,0.99252_r8, & - 0.99463_r8,0.99615_r8/ - data (bm3i( 7, 2,ibeta ), ibeta=1,10)/ & - 0.95091_r8,0.95438_r8,0.96163_r8,0.96962_r8,0.97688_r8,0.98286_r8,0.98751_r8,0.99099_r8, & - 0.99353_r8,0.99536_r8/ - data (bm3i( 7, 3,ibeta ), ibeta=1,10)/ & - 0.92751_r8,0.93233_r8,0.94255_r8,0.95406_r8,0.96473_r8,0.97366_r8,0.98070_r8,0.98602_r8, & - 0.98994_r8,0.99278_r8/ - data (bm3i( 7, 4,ibeta ), ibeta=1,10)/ & - 0.88371_r8,0.89075_r8,0.90595_r8,0.92351_r8,0.94028_r8,0.95474_r8,0.96642_r8,0.97544_r8, & - 0.98220_r8,0.98715_r8/ - data (bm3i( 7, 5,ibeta ), ibeta=1,10)/ & - 0.82880_r8,0.83750_r8,0.85671_r8,0.87980_r8,0.90297_r8,0.92404_r8,0.94195_r8,0.95644_r8, & - 0.96772_r8,0.97625_r8/ - data (bm3i( 7, 6,ibeta ), ibeta=1,10)/ & - 0.81933_r8,0.82655_r8,0.84279_r8,0.86295_r8,0.88412_r8,0.90449_r8,0.92295_r8,0.93890_r8, & - 0.95215_r8,0.96281_r8/ - data (bm3i( 7, 7,ibeta ), ibeta=1,10)/ & - 0.89099_r8,0.89519_r8,0.90448_r8,0.91577_r8,0.92732_r8,0.93820_r8,0.94789_r8,0.95616_r8, & - 0.96297_r8,0.96838_r8/ - data (bm3i( 7, 8,ibeta ), ibeta=1,10)/ & - 0.95886_r8,0.96064_r8,0.96448_r8,0.96894_r8,0.97324_r8,0.97701_r8,0.98004_r8,0.98228_r8, & - 0.98371_r8,0.98435_r8/ - data (bm3i( 7, 9,ibeta ), ibeta=1,10)/ & - 0.98727_r8,0.98786_r8,0.98908_r8,0.99043_r8,0.99160_r8,0.99245_r8,0.99288_r8,0.99285_r8, & - 0.99234_r8,0.99131_r8/ - data (bm3i( 7,10,ibeta ), ibeta=1,10)/ & - 0.99621_r8,0.99638_r8,0.99671_r8,0.99700_r8,0.99715_r8,0.99707_r8,0.99670_r8,0.99599_r8, & - 0.99489_r8,0.99338_r8/ - data (bm3i( 8, 1,ibeta ), ibeta=1,10)/ & - 0.97470_r8,0.97666_r8,0.98064_r8,0.98491_r8,0.98867_r8,0.99169_r8,0.99399_r8,0.99569_r8, & - 0.99691_r8,0.99779_r8/ - data (bm3i( 8, 2,ibeta ), ibeta=1,10)/ & - 0.96996_r8,0.97225_r8,0.97693_r8,0.98196_r8,0.98643_r8,0.99003_r8,0.99279_r8,0.99482_r8, & - 0.99630_r8,0.99735_r8/ - data (bm3i( 8, 3,ibeta ), ibeta=1,10)/ & - 0.95523_r8,0.95848_r8,0.96522_r8,0.97260_r8,0.97925_r8,0.98468_r8,0.98888_r8,0.99200_r8, & - 0.99427_r8,0.99590_r8/ - data (bm3i( 8, 4,ibeta ), ibeta=1,10)/ & - 0.92524_r8,0.93030_r8,0.94098_r8,0.95294_r8,0.96397_r8,0.97317_r8,0.98038_r8,0.98582_r8, & - 0.98981_r8,0.99270_r8/ - data (bm3i( 8, 5,ibeta ), ibeta=1,10)/ & - 0.87576_r8,0.88323_r8,0.89935_r8,0.91799_r8,0.93583_r8,0.95126_r8,0.96377_r8,0.97345_r8, & - 0.98072_r8,0.98606_r8/ - data (bm3i( 8, 6,ibeta ), ibeta=1,10)/ & - 0.83078_r8,0.83894_r8,0.85705_r8,0.87899_r8,0.90126_r8,0.92179_r8,0.93950_r8,0.95404_r8, & - 0.96551_r8,0.97430_r8/ - data (bm3i( 8, 7,ibeta ), ibeta=1,10)/ & - 0.85727_r8,0.86294_r8,0.87558_r8,0.89111_r8,0.90723_r8,0.92260_r8,0.93645_r8,0.94841_r8, & - 0.95838_r8,0.96643_r8/ - data (bm3i( 8, 8,ibeta ), ibeta=1,10)/ & - 0.93337_r8,0.93615_r8,0.94220_r8,0.94937_r8,0.95647_r8,0.96292_r8,0.96840_r8,0.97283_r8, & - 0.97619_r8,0.97854_r8/ - data (bm3i( 8, 9,ibeta ), ibeta=1,10)/ & - 0.97790_r8,0.97891_r8,0.98105_r8,0.98346_r8,0.98569_r8,0.98751_r8,0.98879_r8,0.98950_r8, & - 0.98961_r8,0.98912_r8/ - data (bm3i( 8,10,ibeta ), ibeta=1,10)/ & - 0.99337_r8,0.99367_r8,0.99430_r8,0.99493_r8,0.99541_r8,0.99562_r8,0.99551_r8,0.99501_r8, & - 0.99410_r8,0.99274_r8/ - data (bm3i( 9, 1,ibeta ), ibeta=1,10)/ & - 0.98470_r8,0.98594_r8,0.98844_r8,0.99106_r8,0.99334_r8,0.99514_r8,0.99650_r8,0.99749_r8, & - 0.99821_r8,0.99872_r8/ - data (bm3i( 9, 2,ibeta ), ibeta=1,10)/ & - 0.98184_r8,0.98330_r8,0.98624_r8,0.98934_r8,0.99205_r8,0.99420_r8,0.99582_r8,0.99701_r8, & - 0.99787_r8,0.99848_r8/ - data (bm3i( 9, 3,ibeta ), ibeta=1,10)/ & - 0.97288_r8,0.97498_r8,0.97927_r8,0.98385_r8,0.98789_r8,0.99113_r8,0.99360_r8,0.99541_r8, & - 0.99673_r8,0.99766_r8/ - data (bm3i( 9, 4,ibeta ), ibeta=1,10)/ & - 0.95403_r8,0.95741_r8,0.96440_r8,0.97202_r8,0.97887_r8,0.98444_r8,0.98872_r8,0.99190_r8, & - 0.99421_r8,0.99586_r8/ - data (bm3i( 9, 5,ibeta ), ibeta=1,10)/ & - 0.91845_r8,0.92399_r8,0.93567_r8,0.94873_r8,0.96076_r8,0.97079_r8,0.97865_r8,0.98457_r8, & - 0.98892_r8,0.99206_r8/ - data (bm3i( 9, 6,ibeta ), ibeta=1,10)/ & - 0.86762_r8,0.87533_r8,0.89202_r8,0.91148_r8,0.93027_r8,0.94669_r8,0.96013_r8,0.97062_r8, & - 0.97855_r8,0.98441_r8/ - data (bm3i( 9, 7,ibeta ), ibeta=1,10)/ & - 0.84550_r8,0.85253_r8,0.86816_r8,0.88721_r8,0.90671_r8,0.92490_r8,0.94083_r8,0.95413_r8, & - 0.96481_r8,0.97314_r8/ - data (bm3i( 9, 8,ibeta ), ibeta=1,10)/ & - 0.90138_r8,0.90544_r8,0.91437_r8,0.92513_r8,0.93602_r8,0.94615_r8,0.95506_r8,0.96258_r8, & - 0.96868_r8,0.97347_r8/ - data (bm3i( 9, 9,ibeta ), ibeta=1,10)/ & - 0.96248_r8,0.96415_r8,0.96773_r8,0.97187_r8,0.97583_r8,0.97925_r8,0.98198_r8,0.98394_r8, & - 0.98514_r8,0.98559_r8/ - data (bm3i( 9,10,ibeta ), ibeta=1,10)/ & - 0.98837_r8,0.98892_r8,0.99005_r8,0.99127_r8,0.99232_r8,0.99306_r8,0.99339_r8,0.99328_r8, & - 0.99269_r8,0.99161_r8/ - data (bm3i(10, 1,ibeta ), ibeta=1,10)/ & - 0.99080_r8,0.99158_r8,0.99311_r8,0.99471_r8,0.99607_r8,0.99715_r8,0.99795_r8,0.99853_r8, & - 0.99895_r8,0.99925_r8/ - data (bm3i(10, 2,ibeta ), ibeta=1,10)/ & - 0.98910_r8,0.99001_r8,0.99182_r8,0.99371_r8,0.99533_r8,0.99661_r8,0.99757_r8,0.99826_r8, & - 0.99876_r8,0.99912_r8/ - data (bm3i(10, 3,ibeta ), ibeta=1,10)/ & - 0.98374_r8,0.98506_r8,0.98772_r8,0.99051_r8,0.99294_r8,0.99486_r8,0.99630_r8,0.99736_r8, & - 0.99812_r8,0.99866_r8/ - data (bm3i(10, 4,ibeta ), ibeta=1,10)/ & - 0.97238_r8,0.97453_r8,0.97892_r8,0.98361_r8,0.98773_r8,0.99104_r8,0.99354_r8,0.99538_r8, & - 0.99671_r8,0.99765_r8/ - data (bm3i(10, 5,ibeta ), ibeta=1,10)/ & - 0.94961_r8,0.95333_r8,0.96103_r8,0.96941_r8,0.97693_r8,0.98303_r8,0.98772_r8,0.99119_r8, & - 0.99371_r8,0.99551_r8/ - data (bm3i(10, 6,ibeta ), ibeta=1,10)/ & - 0.90943_r8,0.91550_r8,0.92834_r8,0.94275_r8,0.95608_r8,0.96723_r8,0.97600_r8,0.98263_r8, & - 0.98751_r8,0.99103_r8/ - data (bm3i(10, 7,ibeta ), ibeta=1,10)/ & - 0.86454_r8,0.87200_r8,0.88829_r8,0.90749_r8,0.92630_r8,0.94300_r8,0.95687_r8,0.96785_r8, & - 0.97626_r8,0.98254_r8/ - data (bm3i(10, 8,ibeta ), ibeta=1,10)/ & - 0.87498_r8,0.88048_r8,0.89264_r8,0.90737_r8,0.92240_r8,0.93642_r8,0.94877_r8,0.95917_r8, & - 0.96762_r8,0.97429_r8/ - data (bm3i(10, 9,ibeta ), ibeta=1,10)/ & - 0.93946_r8,0.94209_r8,0.94781_r8,0.95452_r8,0.96111_r8,0.96704_r8,0.97203_r8,0.97602_r8, & - 0.97900_r8,0.98106_r8/ - data (bm3i(10,10,ibeta ), ibeta=1,10)/ & - 0.97977_r8,0.98071_r8,0.98270_r8,0.98492_r8,0.98695_r8,0.98858_r8,0.98970_r8,0.99027_r8, & - 0.99026_r8,0.98968_r8/ - -! fsb fm correction for intramodal m2 coagulation - data bm2ii / & - 0.707107_r8, 0.720583_r8, 0.745310_r8, 0.748056_r8, 0.696935_r8, & - 0.604164_r8, 0.504622_r8, 0.416559_r8, 0.343394_r8, 0.283641_r8/ - -! *** total correction for intramodal m2 coagulation - - data bm2iitt / & - 1.000000_r8, 0.907452_r8, 0.680931_r8, 0.409815_r8, 0.196425_r8, & - 0.078814_r8, 0.028473_r8, 0.009800_r8, 0.003322_r8, 0.001129_r8/ - - -! fsb fm correction for m2 i to j coagulation - - data (bm2ij ( 1, 1,ibeta), ibeta = 1,10) / & - 0.707107_r8, 0.716828_r8, 0.738240_r8, 0.764827_r8, 0.793610_r8, & - 0.822843_r8, 0.851217_r8, 0.877670_r8, 0.901404_r8, 0.921944_r8/ - data (bm2ij ( 1, 2,ibeta), ibeta = 1,10) / & - 0.719180_r8, 0.727975_r8, 0.747638_r8, 0.772334_r8, 0.799234_r8, & - 0.826666_r8, 0.853406_r8, 0.878482_r8, 0.901162_r8, 0.920987_r8/ - data (bm2ij ( 1, 3,ibeta), ibeta = 1,10) / & - 0.760947_r8, 0.767874_r8, 0.783692_r8, 0.803890_r8, 0.826015_r8, & - 0.848562_r8, 0.870498_r8, 0.891088_r8, 0.909823_r8, 0.926400_r8/ - data (bm2ij ( 1, 4,ibeta), ibeta = 1,10) / & - 0.830926_r8, 0.836034_r8, 0.847708_r8, 0.862528_r8, 0.878521_r8, & - 0.894467_r8, 0.909615_r8, 0.923520_r8, 0.935959_r8, 0.946858_r8/ - data (bm2ij ( 1, 5,ibeta), ibeta = 1,10) / & - 0.903643_r8, 0.907035_r8, 0.914641_r8, 0.924017_r8, 0.933795_r8, & - 0.943194_r8, 0.951806_r8, 0.959449_r8, 0.966087_r8, 0.971761_r8/ - data (bm2ij ( 1, 6,ibeta), ibeta = 1,10) / & - 0.954216_r8, 0.956094_r8, 0.960211_r8, 0.965123_r8, 0.970068_r8, & - 0.974666_r8, 0.978750_r8, 0.982277_r8, 0.985268_r8, 0.987775_r8/ - data (bm2ij ( 1, 7,ibeta), ibeta = 1,10) / & - 0.980546_r8, 0.981433_r8, 0.983343_r8, 0.985568_r8, 0.987751_r8, & - 0.989735_r8, 0.991461_r8, 0.992926_r8, 0.994150_r8, 0.995164_r8/ - data (bm2ij ( 1, 8,ibeta), ibeta = 1,10) / & - 0.992142_r8, 0.992524_r8, 0.993338_r8, 0.994272_r8, 0.995174_r8, & - 0.995981_r8, 0.996675_r8, 0.997257_r8, 0.997740_r8, 0.998137_r8/ - data (bm2ij ( 1, 9,ibeta), ibeta = 1,10) / & - 0.996868_r8, 0.997026_r8, 0.997361_r8, 0.997742_r8, 0.998106_r8, & - 0.998430_r8, 0.998705_r8, 0.998935_r8, 0.999125_r8, 0.999280_r8/ - data (bm2ij ( 1, 10,ibeta), ibeta = 1,10) / & - 0.998737_r8, 0.998802_r8, 0.998939_r8, 0.999094_r8, 0.999241_r8, & - 0.999371_r8, 0.999481_r8, 0.999573_r8, 0.999648_r8, 0.999709_r8/ - data (bm2ij ( 2, 1,ibeta), ibeta = 1,10) / & - 0.729600_r8, 0.739948_r8, 0.763059_r8, 0.791817_r8, 0.822510_r8, & - 0.852795_r8, 0.881000_r8, 0.905999_r8, 0.927206_r8, 0.944532_r8/ - data (bm2ij ( 2, 2,ibeta), ibeta = 1,10) / & - 0.727025_r8, 0.737116_r8, 0.759615_r8, 0.787657_r8, 0.817740_r8, & - 0.847656_r8, 0.875801_r8, 0.901038_r8, 0.922715_r8, 0.940643_r8/ - data (bm2ij ( 2, 3,ibeta), ibeta = 1,10) / & - 0.738035_r8, 0.746779_r8, 0.766484_r8, 0.791340_r8, 0.818324_r8, & - 0.845546_r8, 0.871629_r8, 0.895554_r8, 0.916649_r8, 0.934597_r8/ - data (bm2ij ( 2, 4,ibeta), ibeta = 1,10) / & - 0.784185_r8, 0.790883_r8, 0.806132_r8, 0.825501_r8, 0.846545_r8, & - 0.867745_r8, 0.888085_r8, 0.906881_r8, 0.923705_r8, 0.938349_r8/ - data (bm2ij ( 2, 5,ibeta), ibeta = 1,10) / & - 0.857879_r8, 0.862591_r8, 0.873238_r8, 0.886539_r8, 0.900645_r8, & - 0.914463_r8, 0.927360_r8, 0.939004_r8, 0.949261_r8, 0.958125_r8/ - data (bm2ij ( 2, 6,ibeta), ibeta = 1,10) / & - 0.925441_r8, 0.928304_r8, 0.934645_r8, 0.942324_r8, 0.950181_r8, & - 0.957600_r8, 0.964285_r8, 0.970133_r8, 0.975147_r8, 0.979388_r8/ - data (bm2ij ( 2, 7,ibeta), ibeta = 1,10) / & - 0.966728_r8, 0.968176_r8, 0.971323_r8, 0.975027_r8, 0.978705_r8, & - 0.982080_r8, 0.985044_r8, 0.987578_r8, 0.989710_r8, 0.991485_r8/ - data (bm2ij ( 2, 8,ibeta), ibeta = 1,10) / & - 0.986335_r8, 0.986980_r8, 0.988362_r8, 0.989958_r8, 0.991511_r8, & - 0.992912_r8, 0.994122_r8, 0.995143_r8, 0.995992_r8, 0.996693_r8/ - data (bm2ij ( 2, 9,ibeta), ibeta = 1,10) / & - 0.994547_r8, 0.994817_r8, 0.995391_r8, 0.996046_r8, 0.996677_r8, & - 0.997238_r8, 0.997719_r8, 0.998122_r8, 0.998454_r8, 0.998727_r8/ - data (bm2ij ( 2, 10,ibeta), ibeta = 1,10) / & - 0.997817_r8, 0.997928_r8, 0.998163_r8, 0.998429_r8, 0.998683_r8, & - 0.998908_r8, 0.999099_r8, 0.999258_r8, 0.999389_r8, 0.999497_r8/ - data (bm2ij ( 3, 1,ibeta), ibeta = 1,10) / & - 0.783612_r8, 0.793055_r8, 0.814468_r8, 0.841073_r8, 0.868769_r8, & - 0.894963_r8, 0.918118_r8, 0.937527_r8, 0.953121_r8, 0.965244_r8/ - data (bm2ij ( 3, 2,ibeta), ibeta = 1,10) / & - 0.772083_r8, 0.781870_r8, 0.803911_r8, 0.831238_r8, 0.859802_r8, & - 0.887036_r8, 0.911349_r8, 0.931941_r8, 0.948649_r8, 0.961751_r8/ - data (bm2ij ( 3, 3,ibeta), ibeta = 1,10) / & - 0.755766_r8, 0.765509_r8, 0.787380_r8, 0.814630_r8, 0.843526_r8, & - 0.871670_r8, 0.897443_r8, 0.919870_r8, 0.938557_r8, 0.953576_r8/ - data (bm2ij ( 3, 4,ibeta), ibeta = 1,10) / & - 0.763816_r8, 0.772145_r8, 0.790997_r8, 0.814784_r8, 0.840434_r8, & - 0.865978_r8, 0.890034_r8, 0.911671_r8, 0.930366_r8, 0.945963_r8/ - data (bm2ij ( 3, 5,ibeta), ibeta = 1,10) / & - 0.813597_r8, 0.819809_r8, 0.833889_r8, 0.851618_r8, 0.870640_r8, & - 0.889514_r8, 0.907326_r8, 0.923510_r8, 0.937768_r8, 0.950003_r8/ - data (bm2ij ( 3, 6,ibeta), ibeta = 1,10) / & - 0.886317_r8, 0.890437_r8, 0.899643_r8, 0.910955_r8, 0.922730_r8, & - 0.934048_r8, 0.944422_r8, 0.953632_r8, 0.961624_r8, 0.968444_r8/ - data (bm2ij ( 3, 7,ibeta), ibeta = 1,10) / & - 0.944565_r8, 0.946855_r8, 0.951872_r8, 0.957854_r8, 0.963873_r8, & - 0.969468_r8, 0.974438_r8, 0.978731_r8, 0.982372_r8, 0.985424_r8/ - data (bm2ij ( 3, 8,ibeta), ibeta = 1,10) / & - 0.976358_r8, 0.977435_r8, 0.979759_r8, 0.982467_r8, 0.985125_r8, & - 0.987540_r8, 0.989642_r8, 0.991425_r8, 0.992916_r8, 0.994150_r8/ - data (bm2ij ( 3, 9,ibeta), ibeta = 1,10) / & - 0.990471_r8, 0.990932_r8, 0.991917_r8, 0.993048_r8, 0.994142_r8, & - 0.995121_r8, 0.995964_r8, 0.996671_r8, 0.997258_r8, 0.997740_r8/ - data (bm2ij ( 3, 10,ibeta), ibeta = 1,10) / & - 0.996199_r8, 0.996389_r8, 0.996794_r8, 0.997254_r8, 0.997694_r8, & - 0.998086_r8, 0.998420_r8, 0.998699_r8, 0.998929_r8, 0.999117_r8/ - data (bm2ij ( 4, 1,ibeta), ibeta = 1,10) / & - 0.844355_r8, 0.852251_r8, 0.869914_r8, 0.891330_r8, 0.912823_r8, & - 0.932259_r8, 0.948642_r8, 0.961767_r8, 0.971897_r8, 0.979510_r8/ - data (bm2ij ( 4, 2,ibeta), ibeta = 1,10) / & - 0.831550_r8, 0.839954_r8, 0.858754_r8, 0.881583_r8, 0.904592_r8, & - 0.925533_r8, 0.943309_r8, 0.957647_r8, 0.968779_r8, 0.977185_r8/ - data (bm2ij ( 4, 3,ibeta), ibeta = 1,10) / & - 0.803981_r8, 0.813288_r8, 0.834060_r8, 0.859400_r8, 0.885285_r8, & - 0.909286_r8, 0.930084_r8, 0.947193_r8, 0.960714_r8, 0.971078_r8/ - data (bm2ij ( 4, 4,ibeta), ibeta = 1,10) / & - 0.781787_r8, 0.791080_r8, 0.811931_r8, 0.837749_r8, 0.864768_r8, & - 0.890603_r8, 0.913761_r8, 0.933477_r8, 0.949567_r8, 0.962261_r8/ - data (bm2ij ( 4, 5,ibeta), ibeta = 1,10) / & - 0.791591_r8, 0.799355_r8, 0.816916_r8, 0.838961_r8, 0.862492_r8, & - 0.885595_r8, 0.907003_r8, 0.925942_r8, 0.942052_r8, 0.955310_r8/ - data (bm2ij ( 4, 6,ibeta), ibeta = 1,10) / & - 0.844933_r8, 0.850499_r8, 0.863022_r8, 0.878593_r8, 0.895038_r8, & - 0.911072_r8, 0.925939_r8, 0.939227_r8, 0.950765_r8, 0.960550_r8/ - data (bm2ij ( 4, 7,ibeta), ibeta = 1,10) / & - 0.912591_r8, 0.916022_r8, 0.923607_r8, 0.932777_r8, 0.942151_r8, & - 0.951001_r8, 0.958976_r8, 0.965950_r8, 0.971924_r8, 0.976965_r8/ - data (bm2ij ( 4, 8,ibeta), ibeta = 1,10) / & - 0.959859_r8, 0.961617_r8, 0.965433_r8, 0.969924_r8, 0.974382_r8, & - 0.978472_r8, 0.982063_r8, 0.985134_r8, 0.987716_r8, 0.989865_r8/ - data (bm2ij ( 4, 9,ibeta), ibeta = 1,10) / & - 0.983377_r8, 0.984162_r8, 0.985844_r8, 0.987788_r8, 0.989681_r8, & - 0.991386_r8, 0.992860_r8, 0.994104_r8, 0.995139_r8, 0.995991_r8/ - data (bm2ij ( 4, 10,ibeta), ibeta = 1,10) / & - 0.993343_r8, 0.993672_r8, 0.994370_r8, 0.995169_r8, 0.995937_r8, & - 0.996622_r8, 0.997209_r8, 0.997700_r8, 0.998106_r8, 0.998439_r8/ - data (bm2ij ( 5, 1,ibeta), ibeta = 1,10) / & - 0.895806_r8, 0.901918_r8, 0.915233_r8, 0.930783_r8, 0.945768_r8, & - 0.958781_r8, 0.969347_r8, 0.977540_r8, 0.983697_r8, 0.988225_r8/ - data (bm2ij ( 5, 2,ibeta), ibeta = 1,10) / & - 0.885634_r8, 0.892221_r8, 0.906629_r8, 0.923540_r8, 0.939918_r8, & - 0.954213_r8, 0.965873_r8, 0.974951_r8, 0.981794_r8, 0.986840_r8/ - data (bm2ij ( 5, 3,ibeta), ibeta = 1,10) / & - 0.860120_r8, 0.867858_r8, 0.884865_r8, 0.904996_r8, 0.924724_r8, & - 0.942177_r8, 0.956602_r8, 0.967966_r8, 0.976616_r8, 0.983043_r8/ - data (bm2ij ( 5, 4,ibeta), ibeta = 1,10) / & - 0.827462_r8, 0.836317_r8, 0.855885_r8, 0.879377_r8, 0.902897_r8, & - 0.924232_r8, 0.942318_r8, 0.956900_r8, 0.968222_r8, 0.976774_r8/ - data (bm2ij ( 5, 5,ibeta), ibeta = 1,10) / & - 0.805527_r8, 0.814279_r8, 0.833853_r8, 0.857892_r8, 0.882726_r8, & - 0.906095_r8, 0.926690_r8, 0.943938_r8, 0.957808_r8, 0.968615_r8/ - data (bm2ij ( 5, 6,ibeta), ibeta = 1,10) / & - 0.820143_r8, 0.827223_r8, 0.843166_r8, 0.863002_r8, 0.883905_r8, & - 0.904128_r8, 0.922585_r8, 0.938687_r8, 0.952222_r8, 0.963255_r8/ - data (bm2ij ( 5, 7,ibeta), ibeta = 1,10) / & - 0.875399_r8, 0.880208_r8, 0.890929_r8, 0.904065_r8, 0.917699_r8, & - 0.930756_r8, 0.942656_r8, 0.953131_r8, 0.962113_r8, 0.969657_r8/ - data (bm2ij ( 5, 8,ibeta), ibeta = 1,10) / & - 0.934782_r8, 0.937520_r8, 0.943515_r8, 0.950656_r8, 0.957840_r8, & - 0.964516_r8, 0.970446_r8, 0.975566_r8, 0.979905_r8, 0.983534_r8/ - data (bm2ij ( 5, 9,ibeta), ibeta = 1,10) / & - 0.971369_r8, 0.972679_r8, 0.975505_r8, 0.978797_r8, 0.982029_r8, & - 0.984964_r8, 0.987518_r8, 0.989685_r8, 0.991496_r8, 0.992994_r8/ - data (bm2ij ( 5, 10,ibeta), ibeta = 1,10) / & - 0.988329_r8, 0.988893_r8, 0.990099_r8, 0.991485_r8, 0.992825_r8, & - 0.994025_r8, 0.995058_r8, 0.995925_r8, 0.996643_r8, 0.997234_r8/ - data (bm2ij ( 6, 1,ibeta), ibeta = 1,10) / & - 0.933384_r8, 0.937784_r8, 0.947130_r8, 0.957655_r8, 0.967430_r8, & - 0.975639_r8, 0.982119_r8, 0.987031_r8, 0.990657_r8, 0.993288_r8/ - data (bm2ij ( 6, 2,ibeta), ibeta = 1,10) / & - 0.926445_r8, 0.931227_r8, 0.941426_r8, 0.952975_r8, 0.963754_r8, & - 0.972845_r8, 0.980044_r8, 0.985514_r8, 0.989558_r8, 0.992498_r8/ - data (bm2ij ( 6, 3,ibeta), ibeta = 1,10) / & - 0.907835_r8, 0.913621_r8, 0.926064_r8, 0.940308_r8, 0.953745_r8, & - 0.965189_r8, 0.974327_r8, 0.981316_r8, 0.986510_r8, 0.990297_r8/ - data (bm2ij ( 6, 4,ibeta), ibeta = 1,10) / & - 0.879088_r8, 0.886306_r8, 0.901945_r8, 0.920079_r8, 0.937460_r8, & - 0.952509_r8, 0.964711_r8, 0.974166_r8, 0.981265_r8, 0.986484_r8/ - data (bm2ij ( 6, 5,ibeta), ibeta = 1,10) / & - 0.846500_r8, 0.854862_r8, 0.873189_r8, 0.894891_r8, 0.916264_r8, & - 0.935315_r8, 0.951197_r8, 0.963812_r8, 0.973484_r8, 0.980715_r8/ - data (bm2ij ( 6, 6,ibeta), ibeta = 1,10) / & - 0.828137_r8, 0.836250_r8, 0.854310_r8, 0.876287_r8, 0.898710_r8, & - 0.919518_r8, 0.937603_r8, 0.952560_r8, 0.964461_r8, 0.973656_r8/ - data (bm2ij ( 6, 7,ibeta), ibeta = 1,10) / & - 0.848595_r8, 0.854886_r8, 0.868957_r8, 0.886262_r8, 0.904241_r8, & - 0.921376_r8, 0.936799_r8, 0.950096_r8, 0.961172_r8, 0.970145_r8/ - data (bm2ij ( 6, 8,ibeta), ibeta = 1,10) / & - 0.902919_r8, 0.906922_r8, 0.915760_r8, 0.926427_r8, 0.937312_r8, & - 0.947561_r8, 0.956758_r8, 0.964747_r8, 0.971525_r8, 0.977175_r8/ - data (bm2ij ( 6, 9,ibeta), ibeta = 1,10) / & - 0.952320_r8, 0.954434_r8, 0.959021_r8, 0.964418_r8, 0.969774_r8, & - 0.974688_r8, 0.979003_r8, 0.982690_r8, 0.985789_r8, 0.988364_r8/ - data (bm2ij ( 6, 10,ibeta), ibeta = 1,10) / & - 0.979689_r8, 0.980650_r8, 0.982712_r8, 0.985093_r8, 0.987413_r8, & - 0.989502_r8, 0.991308_r8, 0.992831_r8, 0.994098_r8, 0.995142_r8/ - data (bm2ij ( 7, 1,ibeta), ibeta = 1,10) / & - 0.958611_r8, 0.961598_r8, 0.967817_r8, 0.974620_r8, 0.980752_r8, & - 0.985771_r8, 0.989650_r8, 0.992543_r8, 0.994653_r8, 0.996171_r8/ - data (bm2ij ( 7, 2,ibeta), ibeta = 1,10) / & - 0.954225_r8, 0.957488_r8, 0.964305_r8, 0.971795_r8, 0.978576_r8, & - 0.984144_r8, 0.988458_r8, 0.991681_r8, 0.994034_r8, 0.995728_r8/ - data (bm2ij ( 7, 3,ibeta), ibeta = 1,10) / & - 0.942147_r8, 0.946158_r8, 0.954599_r8, 0.963967_r8, 0.972529_r8, & - 0.979612_r8, 0.985131_r8, 0.989271_r8, 0.992301_r8, 0.994487_r8/ - data (bm2ij ( 7, 4,ibeta), ibeta = 1,10) / & - 0.921821_r8, 0.927048_r8, 0.938140_r8, 0.950598_r8, 0.962118_r8, & - 0.971752_r8, 0.979326_r8, 0.985046_r8, 0.989254_r8, 0.992299_r8/ - data (bm2ij ( 7, 5,ibeta), ibeta = 1,10) / & - 0.893419_r8, 0.900158_r8, 0.914598_r8, 0.931070_r8, 0.946584_r8, & - 0.959795_r8, 0.970350_r8, 0.978427_r8, 0.984432_r8, 0.988811_r8/ - data (bm2ij ( 7, 6,ibeta), ibeta = 1,10) / & - 0.863302_r8, 0.871111_r8, 0.888103_r8, 0.907990_r8, 0.927305_r8, & - 0.944279_r8, 0.958245_r8, 0.969211_r8, 0.977540_r8, 0.983720_r8/ - data (bm2ij ( 7, 7,ibeta), ibeta = 1,10) / & - 0.850182_r8, 0.857560_r8, 0.873890_r8, 0.893568_r8, 0.913408_r8, & - 0.931591_r8, 0.947216_r8, 0.960014_r8, 0.970121_r8, 0.977886_r8/ - data (bm2ij ( 7, 8,ibeta), ibeta = 1,10) / & - 0.875837_r8, 0.881265_r8, 0.893310_r8, 0.907936_r8, 0.922910_r8, & - 0.936977_r8, 0.949480_r8, 0.960154_r8, 0.968985_r8, 0.976111_r8/ - data (bm2ij ( 7, 9,ibeta), ibeta = 1,10) / & - 0.926228_r8, 0.929445_r8, 0.936486_r8, 0.944868_r8, 0.953293_r8, & - 0.961108_r8, 0.968028_r8, 0.973973_r8, 0.978974_r8, 0.983118_r8/ - data (bm2ij ( 7, 10,ibeta), ibeta = 1,10) / & - 0.965533_r8, 0.967125_r8, 0.970558_r8, 0.974557_r8, 0.978484_r8, & - 0.982050_r8, 0.985153_r8, 0.987785_r8, 0.989982_r8, 0.991798_r8/ - data (bm2ij ( 8, 1,ibeta), ibeta = 1,10) / & - 0.974731_r8, 0.976674_r8, 0.980660_r8, 0.984926_r8, 0.988689_r8, & - 0.991710_r8, 0.994009_r8, 0.995703_r8, 0.996929_r8, 0.997805_r8/ - data (bm2ij ( 8, 2,ibeta), ibeta = 1,10) / & - 0.972062_r8, 0.974192_r8, 0.978571_r8, 0.983273_r8, 0.987432_r8, & - 0.990780_r8, 0.993333_r8, 0.995218_r8, 0.996581_r8, 0.997557_r8/ - data (bm2ij ( 8, 3,ibeta), ibeta = 1,10) / & - 0.964662_r8, 0.967300_r8, 0.972755_r8, 0.978659_r8, 0.983921_r8, & - 0.988181_r8, 0.991444_r8, 0.993859_r8, 0.995610_r8, 0.996863_r8/ - data (bm2ij ( 8, 4,ibeta), ibeta = 1,10) / & - 0.951782_r8, 0.955284_r8, 0.962581_r8, 0.970559_r8, 0.977737_r8, & - 0.983593_r8, 0.988103_r8, 0.991454_r8, 0.993889_r8, 0.995635_r8/ - data (bm2ij ( 8, 5,ibeta), ibeta = 1,10) / & - 0.931947_r8, 0.936723_r8, 0.946751_r8, 0.957843_r8, 0.967942_r8, & - 0.976267_r8, 0.982734_r8, 0.987571_r8, 0.991102_r8, 0.993642_r8/ - data (bm2ij ( 8, 6,ibeta), ibeta = 1,10) / & - 0.905410_r8, 0.911665_r8, 0.924950_r8, 0.939908_r8, 0.953798_r8, & - 0.965469_r8, 0.974684_r8, 0.981669_r8, 0.986821_r8, 0.990556_r8/ - data (bm2ij ( 8, 7,ibeta), ibeta = 1,10) / & - 0.878941_r8, 0.886132_r8, 0.901679_r8, 0.919688_r8, 0.936970_r8, & - 0.951980_r8, 0.964199_r8, 0.973709_r8, 0.980881_r8, 0.986174_r8/ - data (bm2ij ( 8, 8,ibeta), ibeta = 1,10) / & - 0.871653_r8, 0.878218_r8, 0.892652_r8, 0.909871_r8, 0.927034_r8, & - 0.942592_r8, 0.955836_r8, 0.966604_r8, 0.975065_r8, 0.981545_r8/ - data (bm2ij ( 8, 9,ibeta), ibeta = 1,10) / & - 0.900693_r8, 0.905239_r8, 0.915242_r8, 0.927232_r8, 0.939335_r8, & - 0.950555_r8, 0.960420_r8, 0.968774_r8, 0.975651_r8, 0.981188_r8/ - data (bm2ij ( 8, 10,ibeta), ibeta = 1,10) / & - 0.944922_r8, 0.947435_r8, 0.952894_r8, 0.959317_r8, 0.965689_r8, & - 0.971529_r8, 0.976645_r8, 0.981001_r8, 0.984641_r8, 0.987642_r8/ - data (bm2ij ( 9, 1,ibeta), ibeta = 1,10) / & - 0.984736_r8, 0.985963_r8, 0.988453_r8, 0.991078_r8, 0.993357_r8, & - 0.995161_r8, 0.996519_r8, 0.997512_r8, 0.998226_r8, 0.998734_r8/ - data (bm2ij ( 9, 2,ibeta), ibeta = 1,10) / & - 0.983141_r8, 0.984488_r8, 0.987227_r8, 0.990119_r8, 0.992636_r8, & - 0.994632_r8, 0.996137_r8, 0.997238_r8, 0.998030_r8, 0.998595_r8/ - data (bm2ij ( 9, 3,ibeta), ibeta = 1,10) / & - 0.978726_r8, 0.980401_r8, 0.983819_r8, 0.987450_r8, 0.990626_r8, & - 0.993157_r8, 0.995071_r8, 0.996475_r8, 0.997486_r8, 0.998206_r8/ - data (bm2ij ( 9, 4,ibeta), ibeta = 1,10) / & - 0.970986_r8, 0.973224_r8, 0.977818_r8, 0.982737_r8, 0.987072_r8, & - 0.990546_r8, 0.993184_r8, 0.995124_r8, 0.996523_r8, 0.997521_r8/ - data (bm2ij ( 9, 5,ibeta), ibeta = 1,10) / & - 0.958579_r8, 0.961700_r8, 0.968149_r8, 0.975116_r8, 0.981307_r8, & - 0.986301_r8, 0.990112_r8, 0.992923_r8, 0.994954_r8, 0.996404_r8/ - data (bm2ij ( 9, 6,ibeta), ibeta = 1,10) / & - 0.940111_r8, 0.944479_r8, 0.953572_r8, 0.963506_r8, 0.972436_r8, & - 0.979714_r8, 0.985313_r8, 0.989468_r8, 0.992483_r8, 0.994641_r8/ - data (bm2ij ( 9, 7,ibeta), ibeta = 1,10) / & - 0.916127_r8, 0.921878_r8, 0.934003_r8, 0.947506_r8, 0.959899_r8, & - 0.970199_r8, 0.978255_r8, 0.984314_r8, 0.988755_r8, 0.991960_r8/ - data (bm2ij ( 9, 8,ibeta), ibeta = 1,10) / & - 0.893848_r8, 0.900364_r8, 0.914368_r8, 0.930438_r8, 0.945700_r8, & - 0.958824_r8, 0.969416_r8, 0.977603_r8, 0.983746_r8, 0.988262_r8/ - data (bm2ij ( 9, 9,ibeta), ibeta = 1,10) / & - 0.892161_r8, 0.897863_r8, 0.910315_r8, 0.925021_r8, 0.939523_r8, & - 0.952544_r8, 0.963544_r8, 0.972442_r8, 0.979411_r8, 0.984742_r8/ - data (bm2ij ( 9, 10,ibeta), ibeta = 1,10) / & - 0.922260_r8, 0.925966_r8, 0.934047_r8, 0.943616_r8, 0.953152_r8, & - 0.961893_r8, 0.969506_r8, 0.975912_r8, 0.981167_r8, 0.985394_r8/ - data (bm2ij ( 10, 1,ibeta), ibeta = 1,10) / & - 0.990838_r8, 0.991598_r8, 0.993128_r8, 0.994723_r8, 0.996092_r8, & - 0.997167_r8, 0.997969_r8, 0.998552_r8, 0.998969_r8, 0.999265_r8/ - data (bm2ij ( 10, 2,ibeta), ibeta = 1,10) / & - 0.989892_r8, 0.990727_r8, 0.992411_r8, 0.994167_r8, 0.995678_r8, & - 0.996864_r8, 0.997751_r8, 0.998396_r8, 0.998858_r8, 0.999186_r8/ - data (bm2ij ( 10, 3,ibeta), ibeta = 1,10) / & - 0.987287_r8, 0.988327_r8, 0.990428_r8, 0.992629_r8, 0.994529_r8, & - 0.996026_r8, 0.997148_r8, 0.997965_r8, 0.998551_r8, 0.998967_r8/ - data (bm2ij ( 10, 4,ibeta), ibeta = 1,10) / & - 0.982740_r8, 0.984130_r8, 0.986952_r8, 0.989926_r8, 0.992508_r8, & - 0.994551_r8, 0.996087_r8, 0.997208_r8, 0.998012_r8, 0.998584_r8/ - data (bm2ij ( 10, 5,ibeta), ibeta = 1,10) / & - 0.975380_r8, 0.977330_r8, 0.981307_r8, 0.985529_r8, 0.989216_r8, & - 0.992147_r8, 0.994358_r8, 0.995975_r8, 0.997136_r8, 0.997961_r8/ - data (bm2ij ( 10, 6,ibeta), ibeta = 1,10) / & - 0.963911_r8, 0.966714_r8, 0.972465_r8, 0.978614_r8, 0.984022_r8, & - 0.988346_r8, 0.991620_r8, 0.994020_r8, 0.995747_r8, 0.996974_r8/ - data (bm2ij ( 10, 7,ibeta), ibeta = 1,10) / & - 0.947187_r8, 0.951161_r8, 0.959375_r8, 0.968258_r8, 0.976160_r8, & - 0.982540_r8, 0.987409_r8, 0.991000_r8, 0.993592_r8, 0.995441_r8/ - data (bm2ij ( 10, 8,ibeta), ibeta = 1,10) / & - 0.926045_r8, 0.931270_r8, 0.942218_r8, 0.954297_r8, 0.965273_r8, & - 0.974311_r8, 0.981326_r8, 0.986569_r8, 0.990394_r8, 0.993143_r8/ - data (bm2ij ( 10, 9,ibeta), ibeta = 1,10) / & - 0.908092_r8, 0.913891_r8, 0.926288_r8, 0.940393_r8, 0.953667_r8, & - 0.964987_r8, 0.974061_r8, 0.981038_r8, 0.986253_r8, 0.990078_r8/ - data (bm2ij ( 10, 10,ibeta), ibeta = 1,10) / & - 0.911143_r8, 0.915972_r8, 0.926455_r8, 0.938721_r8, 0.950701_r8, & - 0.961370_r8, 0.970329_r8, 0.977549_r8, 0.983197_r8, 0.987518_r8/ - - -! fsb total correction factor for m2 coagulation j from i - - data (bm2ji( 1, 1,ibeta), ibeta = 1,10) / & - 0.753466_r8, 0.756888_r8, 0.761008_r8, 0.759432_r8, 0.748675_r8, & - 0.726951_r8, 0.693964_r8, 0.650915_r8, 0.600227_r8, 0.545000_r8/ - data (bm2ji( 1, 2,ibeta), ibeta = 1,10) / & - 0.824078_r8, 0.828698_r8, 0.835988_r8, 0.838943_r8, 0.833454_r8, & - 0.817148_r8, 0.789149_r8, 0.750088_r8, 0.701887_r8, 0.647308_r8/ - data (bm2ji( 1, 3,ibeta), ibeta = 1,10) / & - 1.007389_r8, 1.014362_r8, 1.028151_r8, 1.041011_r8, 1.047939_r8, & - 1.045707_r8, 1.032524_r8, 1.007903_r8, 0.972463_r8, 0.927667_r8/ - data (bm2ji( 1, 4,ibeta), ibeta = 1,10) / & - 1.246157_r8, 1.255135_r8, 1.274249_r8, 1.295351_r8, 1.313362_r8, & - 1.325187_r8, 1.329136_r8, 1.324491_r8, 1.311164_r8, 1.289459_r8/ - data (bm2ji( 1, 5,ibeta), ibeta = 1,10) / & - 1.450823_r8, 1.459551_r8, 1.478182_r8, 1.499143_r8, 1.518224_r8, & - 1.533312_r8, 1.543577_r8, 1.548882_r8, 1.549395_r8, 1.545364_r8/ - data (bm2ji( 1, 6,ibeta), ibeta = 1,10) / & - 1.575248_r8, 1.581832_r8, 1.595643_r8, 1.610866_r8, 1.624601_r8, & - 1.635690_r8, 1.643913_r8, 1.649470_r8, 1.652688_r8, 1.653878_r8/ - data (bm2ji( 1, 7,ibeta), ibeta = 1,10) / & - 1.638426_r8, 1.642626_r8, 1.651293_r8, 1.660641_r8, 1.668926_r8, & - 1.675571_r8, 1.680572_r8, 1.684147_r8, 1.686561_r8, 1.688047_r8/ - data (bm2ji( 1, 8,ibeta), ibeta = 1,10) / & - 1.669996_r8, 1.672392_r8, 1.677283_r8, 1.682480_r8, 1.687028_r8, & - 1.690651_r8, 1.693384_r8, 1.695372_r8, 1.696776_r8, 1.697734_r8/ - data (bm2ji( 1, 9,ibeta), ibeta = 1,10) / & - 1.686148_r8, 1.687419_r8, 1.689993_r8, 1.692704_r8, 1.695057_r8, & - 1.696922_r8, 1.698329_r8, 1.699359_r8, 1.700099_r8, 1.700621_r8/ - data (bm2ji( 1,10,ibeta), ibeta = 1,10) / & - 1.694364_r8, 1.695010_r8, 1.696313_r8, 1.697676_r8, 1.698853_r8, & - 1.699782_r8, 1.700482_r8, 1.700996_r8, 1.701366_r8, 1.701631_r8/ - data (bm2ji( 2, 1,ibeta), ibeta = 1,10) / & - 0.783166_r8, 0.779369_r8, 0.768044_r8, 0.747572_r8, 0.716709_r8, & - 0.675422_r8, 0.624981_r8, 0.567811_r8, 0.507057_r8, 0.445975_r8/ - data (bm2ji( 2, 2,ibeta), ibeta = 1,10) / & - 0.848390_r8, 0.847100_r8, 0.840874_r8, 0.826065_r8, 0.800296_r8, & - 0.762625_r8, 0.713655_r8, 0.655545_r8, 0.591603_r8, 0.525571_r8/ - data (bm2ji( 2, 3,ibeta), ibeta = 1,10) / & - 1.039894_r8, 1.043786_r8, 1.049445_r8, 1.049664_r8, 1.039407_r8, & - 1.015322_r8, 0.975983_r8, 0.922180_r8, 0.856713_r8, 0.783634_r8/ - data (bm2ji( 2, 4,ibeta), ibeta = 1,10) / & - 1.345995_r8, 1.356064_r8, 1.376947_r8, 1.398304_r8, 1.412685_r8, & - 1.414611_r8, 1.400652_r8, 1.369595_r8, 1.322261_r8, 1.260993_r8/ - data (bm2ji( 2, 5,ibeta), ibeta = 1,10) / & - 1.675575_r8, 1.689859_r8, 1.720957_r8, 1.756659_r8, 1.788976_r8, & - 1.812679_r8, 1.824773_r8, 1.824024_r8, 1.810412_r8, 1.784630_r8/ - data (bm2ji( 2, 6,ibeta), ibeta = 1,10) / & - 1.919835_r8, 1.933483_r8, 1.962973_r8, 1.996810_r8, 2.028377_r8, & - 2.054172_r8, 2.072763_r8, 2.083963_r8, 2.088190_r8, 2.086052_r8/ - data (bm2ji( 2, 7,ibeta), ibeta = 1,10) / & - 2.064139_r8, 2.074105_r8, 2.095233_r8, 2.118909_r8, 2.140688_r8, & - 2.158661_r8, 2.172373_r8, 2.182087_r8, 2.188330_r8, 2.191650_r8/ - data (bm2ji( 2, 8,ibeta), ibeta = 1,10) / & - 2.144871_r8, 2.150990_r8, 2.163748_r8, 2.177731_r8, 2.190364_r8, & - 2.200712_r8, 2.208687_r8, 2.214563_r8, 2.218716_r8, 2.221502_r8/ - data (bm2ji( 2, 9,ibeta), ibeta = 1,10) / & - 2.189223_r8, 2.192595_r8, 2.199540_r8, 2.207033_r8, 2.213706_r8, & - 2.219125_r8, 2.223297_r8, 2.226403_r8, 2.228660_r8, 2.230265_r8/ - data (bm2ji( 2,10,ibeta), ibeta = 1,10) / & - 2.212595_r8, 2.214342_r8, 2.217912_r8, 2.221723_r8, 2.225082_r8, & - 2.227791_r8, 2.229869_r8, 2.231417_r8, 2.232551_r8, 2.233372_r8/ - data (bm2ji( 3, 1,ibeta), ibeta = 1,10) / & - 0.837870_r8, 0.824476_r8, 0.793119_r8, 0.750739_r8, 0.700950_r8, & - 0.646691_r8, 0.590508_r8, 0.534354_r8, 0.479532_r8, 0.426856_r8/ - data (bm2ji( 3, 2,ibeta), ibeta = 1,10) / & - 0.896771_r8, 0.885847_r8, 0.859327_r8, 0.821694_r8, 0.775312_r8, & - 0.722402_r8, 0.665196_r8, 0.605731_r8, 0.545742_r8, 0.486687_r8/ - data (bm2ji( 3, 3,ibeta), ibeta = 1,10) / & - 1.076089_r8, 1.071727_r8, 1.058845_r8, 1.036171_r8, 1.002539_r8, & - 0.957521_r8, 0.901640_r8, 0.836481_r8, 0.764597_r8, 0.689151_r8/ - data (bm2ji( 3, 4,ibeta), ibeta = 1,10) / & - 1.409571_r8, 1.415168_r8, 1.425346_r8, 1.432021_r8, 1.428632_r8, & - 1.409696_r8, 1.371485_r8, 1.312958_r8, 1.236092_r8, 1.145293_r8/ - data (bm2ji( 3, 5,ibeta), ibeta = 1,10) / & - 1.862757_r8, 1.880031_r8, 1.918394_r8, 1.963456_r8, 2.004070_r8, & - 2.030730_r8, 2.036144_r8, 2.016159_r8, 1.970059_r8, 1.900079_r8/ - data (bm2ji( 3, 6,ibeta), ibeta = 1,10) / & - 2.289741_r8, 2.313465_r8, 2.366789_r8, 2.431612_r8, 2.495597_r8, & - 2.549838_r8, 2.588523_r8, 2.608665_r8, 2.609488_r8, 2.591662_r8/ - data (bm2ji( 3, 7,ibeta), ibeta = 1,10) / & - 2.597157_r8, 2.618731_r8, 2.666255_r8, 2.722597_r8, 2.777531_r8, & - 2.825187_r8, 2.862794_r8, 2.889648_r8, 2.906199_r8, 2.913380_r8/ - data (bm2ji( 3, 8,ibeta), ibeta = 1,10) / & - 2.797975_r8, 2.813116_r8, 2.845666_r8, 2.882976_r8, 2.918289_r8, & - 2.948461_r8, 2.972524_r8, 2.990687_r8, 3.003664_r8, 3.012284_r8/ - data (bm2ji( 3, 9,ibeta), ibeta = 1,10) / & - 2.920832_r8, 2.929843_r8, 2.948848_r8, 2.970057_r8, 2.989632_r8, & - 3.006057_r8, 3.019067_r8, 3.028979_r8, 3.036307_r8, 3.041574_r8/ - data (bm2ji( 3,10,ibeta), ibeta = 1,10) / & - 2.989627_r8, 2.994491_r8, 3.004620_r8, 3.015720_r8, 3.025789_r8, & - 3.034121_r8, 3.040664_r8, 3.045641_r8, 3.049347_r8, 3.052066_r8/ - data (bm2ji( 4, 1,ibeta), ibeta = 1,10) / & - 0.893179_r8, 0.870897_r8, 0.820996_r8, 0.759486_r8, 0.695488_r8, & - 0.634582_r8, 0.579818_r8, 0.532143_r8, 0.490927_r8, 0.454618_r8/ - data (bm2ji( 4, 2,ibeta), ibeta = 1,10) / & - 0.948355_r8, 0.927427_r8, 0.880215_r8, 0.821146_r8, 0.758524_r8, & - 0.697680_r8, 0.641689_r8, 0.591605_r8, 0.546919_r8, 0.506208_r8/ - data (bm2ji( 4, 3,ibeta), ibeta = 1,10) / & - 1.109562_r8, 1.093648_r8, 1.056438_r8, 1.007310_r8, 0.951960_r8, & - 0.894453_r8, 0.837364_r8, 0.781742_r8, 0.727415_r8, 0.673614_r8/ - data (bm2ji( 4, 4,ibeta), ibeta = 1,10) / & - 1.423321_r8, 1.417557_r8, 1.402442_r8, 1.379079_r8, 1.347687_r8, & - 1.308075_r8, 1.259703_r8, 1.201983_r8, 1.134778_r8, 1.058878_r8/ - data (bm2ji( 4, 5,ibeta), ibeta = 1,10) / & - 1.933434_r8, 1.944347_r8, 1.968765_r8, 1.997653_r8, 2.023054_r8, & - 2.036554_r8, 2.029949_r8, 1.996982_r8, 1.934982_r8, 1.845473_r8/ - data (bm2ji( 4, 6,ibeta), ibeta = 1,10) / & - 2.547772_r8, 2.577105_r8, 2.645918_r8, 2.735407_r8, 2.830691_r8, & - 2.917268_r8, 2.981724_r8, 3.013684_r8, 3.007302_r8, 2.961560_r8/ - data (bm2ji( 4, 7,ibeta), ibeta = 1,10) / & - 3.101817_r8, 3.139271_r8, 3.225851_r8, 3.336402_r8, 3.453409_r8, & - 3.563116_r8, 3.655406_r8, 3.724014_r8, 3.766113_r8, 3.781394_r8/ - data (bm2ji( 4, 8,ibeta), ibeta = 1,10) / & - 3.540920_r8, 3.573780_r8, 3.647439_r8, 3.737365_r8, 3.828468_r8, & - 3.911436_r8, 3.981317_r8, 4.036345_r8, 4.076749_r8, 4.103751_r8/ - data (bm2ji( 4, 9,ibeta), ibeta = 1,10) / & - 3.856771_r8, 3.879363_r8, 3.928579_r8, 3.986207_r8, 4.042173_r8, & - 4.091411_r8, 4.132041_r8, 4.164052_r8, 4.188343_r8, 4.206118_r8/ - data (bm2ji( 4,10,ibeta), ibeta = 1,10) / & - 4.053923_r8, 4.067191_r8, 4.095509_r8, 4.127698_r8, 4.158037_r8, & - 4.184055_r8, 4.205135_r8, 4.221592_r8, 4.234115_r8, 4.243463_r8/ - data (bm2ji( 5, 1,ibeta), ibeta = 1,10) / & - 0.935846_r8, 0.906814_r8, 0.843358_r8, 0.768710_r8, 0.695885_r8, & - 0.631742_r8, 0.579166_r8, 0.538471_r8, 0.508410_r8, 0.486863_r8/ - data (bm2ji( 5, 2,ibeta), ibeta = 1,10) / & - 0.988308_r8, 0.959524_r8, 0.896482_r8, 0.821986_r8, 0.748887_r8, & - 0.684168_r8, 0.630908_r8, 0.589516_r8, 0.558676_r8, 0.536056_r8/ - data (bm2ji( 5, 3,ibeta), ibeta = 1,10) / & - 1.133795_r8, 1.107139_r8, 1.048168_r8, 0.977258_r8, 0.906341_r8, & - 0.842477_r8, 0.789093_r8, 0.746731_r8, 0.713822_r8, 0.687495_r8/ - data (bm2ji( 5, 4,ibeta), ibeta = 1,10) / & - 1.405692_r8, 1.385781_r8, 1.340706_r8, 1.284776_r8, 1.227085_r8, & - 1.173532_r8, 1.127008_r8, 1.087509_r8, 1.052712_r8, 1.018960_r8/ - data (bm2ji( 5, 5,ibeta), ibeta = 1,10) / & - 1.884992_r8, 1.879859_r8, 1.868463_r8, 1.854995_r8, 1.841946_r8, & - 1.829867_r8, 1.816972_r8, 1.799319_r8, 1.771754_r8, 1.729406_r8/ - data (bm2ji( 5, 6,ibeta), ibeta = 1,10) / & - 2.592275_r8, 2.612268_r8, 2.661698_r8, 2.731803_r8, 2.815139_r8, & - 2.901659_r8, 2.978389_r8, 3.031259_r8, 3.048045_r8, 3.021122_r8/ - data (bm2ji( 5, 7,ibeta), ibeta = 1,10) / & - 3.390321_r8, 3.435519_r8, 3.545615_r8, 3.698419_r8, 3.876958_r8, & - 4.062790_r8, 4.236125_r8, 4.378488_r8, 4.475619_r8, 4.519170_r8/ - data (bm2ji( 5, 8,ibeta), ibeta = 1,10) / & - 4.161376_r8, 4.216558_r8, 4.346896_r8, 4.519451_r8, 4.711107_r8, & - 4.902416_r8, 5.077701_r8, 5.226048_r8, 5.341423_r8, 5.421764_r8/ - data (bm2ji( 5, 9,ibeta), ibeta = 1,10) / & - 4.843961_r8, 4.892035_r8, 5.001492_r8, 5.138515_r8, 5.281684_r8, & - 5.416805_r8, 5.535493_r8, 5.634050_r8, 5.712063_r8, 5.770996_r8/ - data (bm2ji( 5,10,ibeta), ibeta = 1,10) / & - 5.352093_r8, 5.385119_r8, 5.458056_r8, 5.545311_r8, 5.632162_r8, & - 5.710566_r8, 5.777005_r8, 5.830863_r8, 5.873123_r8, 5.905442_r8/ - data (bm2ji( 6, 1,ibeta), ibeta = 1,10) / & - 0.964038_r8, 0.930794_r8, 0.859433_r8, 0.777776_r8, 0.700566_r8, & - 0.634671_r8, 0.582396_r8, 0.543656_r8, 0.517284_r8, 0.501694_r8/ - data (bm2ji( 6, 2,ibeta), ibeta = 1,10) / & - 1.013416_r8, 0.979685_r8, 0.907197_r8, 0.824135_r8, 0.745552_r8, & - 0.678616_r8, 0.625870_r8, 0.587348_r8, 0.561864_r8, 0.547674_r8/ - data (bm2ji( 6, 3,ibeta), ibeta = 1,10) / & - 1.145452_r8, 1.111457_r8, 1.038152_r8, 0.953750_r8, 0.873724_r8, & - 0.805955_r8, 0.753621_r8, 0.717052_r8, 0.694920_r8, 0.684910_r8/ - data (bm2ji( 6, 4,ibeta), ibeta = 1,10) / & - 1.376547_r8, 1.345004_r8, 1.276415_r8, 1.196704_r8, 1.121091_r8, & - 1.058249_r8, 1.012197_r8, 0.983522_r8, 0.970323_r8, 0.968933_r8/ - data (bm2ji( 6, 5,ibeta), ibeta = 1,10) / & - 1.778801_r8, 1.755897_r8, 1.706074_r8, 1.649008_r8, 1.597602_r8, & - 1.560087_r8, 1.540365_r8, 1.538205_r8, 1.549738_r8, 1.568333_r8/ - data (bm2ji( 6, 6,ibeta), ibeta = 1,10) / & - 2.447603_r8, 2.445172_r8, 2.443762_r8, 2.451842_r8, 2.475877_r8, & - 2.519039_r8, 2.580118_r8, 2.653004_r8, 2.727234_r8, 2.789738_r8/ - data (bm2ji( 6, 7,ibeta), ibeta = 1,10) / & - 3.368490_r8, 3.399821_r8, 3.481357_r8, 3.606716_r8, 3.772101_r8, & - 3.969416_r8, 4.184167_r8, 4.396163_r8, 4.582502_r8, 4.721838_r8/ - data (bm2ji( 6, 8,ibeta), ibeta = 1,10) / & - 4.426458_r8, 4.489861_r8, 4.648250_r8, 4.877510_r8, 5.160698_r8, & - 5.477495_r8, 5.803123_r8, 6.111250_r8, 6.378153_r8, 6.586050_r8/ - data (bm2ji( 6, 9,ibeta), ibeta = 1,10) / & - 5.568061_r8, 5.644988_r8, 5.829837_r8, 6.081532_r8, 6.371214_r8, & - 6.672902_r8, 6.963737_r8, 7.226172_r8, 7.449199_r8, 7.627886_r8/ - data (bm2ji( 6,10,ibeta), ibeta = 1,10) / & - 6.639152_r8, 6.707020_r8, 6.863974_r8, 7.065285_r8, 7.281744_r8, & - 7.492437_r8, 7.683587_r8, 7.847917_r8, 7.983296_r8, 8.090977_r8/ - data (bm2ji( 7, 1,ibeta), ibeta = 1,10) / & - 0.980853_r8, 0.945724_r8, 0.871244_r8, 0.787311_r8, 0.708818_r8, & - 0.641987_r8, 0.588462_r8, 0.547823_r8, 0.518976_r8, 0.500801_r8/ - data (bm2ji( 7, 2,ibeta), ibeta = 1,10) / & - 1.026738_r8, 0.990726_r8, 0.914306_r8, 0.828140_r8, 0.747637_r8, & - 0.679351_r8, 0.625127_r8, 0.584662_r8, 0.556910_r8, 0.540749_r8/ - data (bm2ji( 7, 3,ibeta), ibeta = 1,10) / & - 1.146496_r8, 1.108808_r8, 1.028695_r8, 0.938291_r8, 0.854101_r8, & - 0.783521_r8, 0.728985_r8, 0.690539_r8, 0.667272_r8, 0.657977_r8/ - data (bm2ji( 7, 4,ibeta), ibeta = 1,10) / & - 1.344846_r8, 1.306434_r8, 1.224543_r8, 1.132031_r8, 1.046571_r8, & - 0.976882_r8, 0.926488_r8, 0.896067_r8, 0.884808_r8, 0.891027_r8/ - data (bm2ji( 7, 5,ibeta), ibeta = 1,10) / & - 1.670227_r8, 1.634583_r8, 1.558421_r8, 1.472939_r8, 1.396496_r8, & - 1.339523_r8, 1.307151_r8, 1.300882_r8, 1.319622_r8, 1.360166_r8/ - data (bm2ji( 7, 6,ibeta), ibeta = 1,10) / & - 2.224548_r8, 2.199698_r8, 2.148284_r8, 2.095736_r8, 2.059319_r8, & - 2.050496_r8, 2.075654_r8, 2.136382_r8, 2.229641_r8, 2.347958_r8/ - data (bm2ji( 7, 7,ibeta), ibeta = 1,10) / & - 3.104483_r8, 3.105947_r8, 3.118398_r8, 3.155809_r8, 3.230427_r8, & - 3.350585_r8, 3.519071_r8, 3.731744_r8, 3.976847_r8, 4.235616_r8/ - data (bm2ji( 7, 8,ibeta), ibeta = 1,10) / & - 4.288426_r8, 4.331456_r8, 4.447024_r8, 4.633023_r8, 4.891991_r8, & - 5.221458_r8, 5.610060_r8, 6.036467_r8, 6.471113_r8, 6.880462_r8/ - data (bm2ji( 7, 9,ibeta), ibeta = 1,10) / & - 5.753934_r8, 5.837061_r8, 6.048530_r8, 6.363800_r8, 6.768061_r8, & - 7.241280_r8, 7.755346_r8, 8.276666_r8, 8.771411_r8, 9.210826_r8/ - data (bm2ji( 7,10,ibeta), ibeta = 1,10) / & - 7.466219_r8, 7.568810_r8, 7.819032_r8, 8.168340_r8, 8.582973_r8, & - 9.030174_r8, 9.478159_r8, 9.899834_r8, 10.275940_r8, 10.595910_r8/ - data (bm2ji( 8, 1,ibeta), ibeta = 1,10) / & - 0.990036_r8, 0.954782_r8, 0.880531_r8, 0.797334_r8, 0.719410_r8, & - 0.652220_r8, 0.596923_r8, 0.552910_r8, 0.519101_r8, 0.494529_r8/ - data (bm2ji( 8, 2,ibeta), ibeta = 1,10) / & - 1.032428_r8, 0.996125_r8, 0.919613_r8, 0.833853_r8, 0.753611_r8, & - 0.684644_r8, 0.628260_r8, 0.583924_r8, 0.550611_r8, 0.527407_r8/ - data (bm2ji( 8, 3,ibeta), ibeta = 1,10) / & - 1.141145_r8, 1.102521_r8, 1.021017_r8, 0.929667_r8, 0.844515_r8, & - 0.772075_r8, 0.714086_r8, 0.670280_r8, 0.639824_r8, 0.621970_r8/ - data (bm2ji( 8, 4,ibeta), ibeta = 1,10) / & - 1.314164_r8, 1.273087_r8, 1.186318_r8, 1.089208_r8, 0.999476_r8, & - 0.924856_r8, 0.867948_r8, 0.829085_r8, 0.807854_r8, 0.803759_r8/ - data (bm2ji( 8, 5,ibeta), ibeta = 1,10) / & - 1.580611_r8, 1.538518_r8, 1.449529_r8, 1.350459_r8, 1.260910_r8, & - 1.190526_r8, 1.143502_r8, 1.121328_r8, 1.124274_r8, 1.151974_r8/ - data (bm2ji( 8, 6,ibeta), ibeta = 1,10) / & - 2.016773_r8, 1.977721_r8, 1.895727_r8, 1.806974_r8, 1.732891_r8, & - 1.685937_r8, 1.673026_r8, 1.697656_r8, 1.761039_r8, 1.862391_r8/ - data (bm2ji( 8, 7,ibeta), ibeta = 1,10) / & - 2.750093_r8, 2.723940_r8, 2.672854_r8, 2.628264_r8, 2.612250_r8, & - 2.640406_r8, 2.723211_r8, 2.866599_r8, 3.071893_r8, 3.335217_r8/ - data (bm2ji( 8, 8,ibeta), ibeta = 1,10) / & - 3.881905_r8, 3.887143_r8, 3.913667_r8, 3.981912_r8, 4.111099_r8, & - 4.316575_r8, 4.608146_r8, 4.988157_r8, 5.449592_r8, 5.974848_r8/ - data (bm2ji( 8, 9,ibeta), ibeta = 1,10) / & - 5.438870_r8, 5.492742_r8, 5.640910_r8, 5.886999_r8, 6.241641_r8, & - 6.710609_r8, 7.289480_r8, 7.960725_r8, 8.693495_r8, 9.446644_r8/ - data (bm2ji( 8,10,ibeta), ibeta = 1,10) / & - 7.521152_r8, 7.624621_r8, 7.892039_r8, 8.300444_r8, 8.839787_r8, & - 9.493227_r8, 10.231770_r8, 11.015642_r8, 11.799990_r8, 12.542260_r8/ - data (bm2ji( 9, 1,ibeta), ibeta = 1,10) / & - 0.994285_r8, 0.960012_r8, 0.887939_r8, 0.807040_r8, 0.730578_r8, & - 0.663410_r8, 0.606466_r8, 0.559137_r8, 0.520426_r8, 0.489429_r8/ - data (bm2ji( 9, 2,ibeta), ibeta = 1,10) / & - 1.033505_r8, 0.998153_r8, 0.923772_r8, 0.840261_r8, 0.761383_r8, & - 0.692242_r8, 0.633873_r8, 0.585709_r8, 0.546777_r8, 0.516215_r8/ - data (bm2ji( 9, 3,ibeta), ibeta = 1,10) / & - 1.132774_r8, 1.094907_r8, 1.015161_r8, 0.925627_r8, 0.841293_r8, & - 0.767888_r8, 0.706741_r8, 0.657439_r8, 0.619135_r8, 0.591119_r8/ - data (bm2ji( 9, 4,ibeta), ibeta = 1,10) / & - 1.286308_r8, 1.245273_r8, 1.158809_r8, 1.061889_r8, 0.971208_r8, & - 0.893476_r8, 0.830599_r8, 0.782561_r8, 0.748870_r8, 0.729198_r8/ - data (bm2ji( 9, 5,ibeta), ibeta = 1,10) / & - 1.511105_r8, 1.467141_r8, 1.374520_r8, 1.271162_r8, 1.175871_r8, & - 1.096887_r8, 1.037243_r8, 0.997820_r8, 0.978924_r8, 0.980962_r8/ - data (bm2ji( 9, 6,ibeta), ibeta = 1,10) / & - 1.857468_r8, 1.812177_r8, 1.717002_r8, 1.612197_r8, 1.519171_r8, & - 1.448660_r8, 1.405871_r8, 1.393541_r8, 1.413549_r8, 1.467532_r8/ - data (bm2ji( 9, 7,ibeta), ibeta = 1,10) / & - 2.430619_r8, 2.388452_r8, 2.301326_r8, 2.210241_r8, 2.139724_r8, & - 2.104571_r8, 2.114085_r8, 2.174696_r8, 2.291294_r8, 2.467500_r8/ - data (bm2ji( 9, 8,ibeta), ibeta = 1,10) / & - 3.385332_r8, 3.357690_r8, 3.306611_r8, 3.269804_r8, 3.274462_r8, & - 3.340862_r8, 3.484609_r8, 3.717740_r8, 4.048748_r8, 4.481588_r8/ - data (bm2ji( 9, 9,ibeta), ibeta = 1,10) / & - 4.850497_r8, 4.858280_r8, 4.896008_r8, 4.991467_r8, 5.171511_r8, & - 5.459421_r8, 5.873700_r8, 6.426128_r8, 7.119061_r8, 7.942603_r8/ - data (bm2ji( 9,10,ibeta), ibeta = 1,10) / & - 6.957098_r8, 7.020164_r8, 7.197272_r8, 7.499331_r8, 7.946554_r8, & - 8.555048_r8, 9.330503_r8, 10.263610_r8, 11.327454_r8, 12.478332_r8/ - data (bm2ji(10, 1,ibeta), ibeta = 1,10) / & - 0.994567_r8, 0.961842_r8, 0.892854_r8, 0.814874_r8, 0.740198_r8, & - 0.673303_r8, 0.615105_r8, 0.565139_r8, 0.522558_r8, 0.486556_r8/ - data (bm2ji(10, 2,ibeta), ibeta = 1,10) / & - 1.031058_r8, 0.997292_r8, 0.926082_r8, 0.845571_r8, 0.768501_r8, & - 0.699549_r8, 0.639710_r8, 0.588538_r8, 0.545197_r8, 0.508894_r8/ - data (bm2ji(10, 3,ibeta), ibeta = 1,10) / & - 1.122535_r8, 1.086287_r8, 1.009790_r8, 0.923292_r8, 0.840626_r8, & - 0.766982_r8, 0.703562_r8, 0.650004_r8, 0.605525_r8, 0.569411_r8/ - data (bm2ji(10, 4,ibeta), ibeta = 1,10) / & - 1.261142_r8, 1.221555_r8, 1.137979_r8, 1.043576_r8, 0.953745_r8, & - 0.874456_r8, 0.807292_r8, 0.752109_r8, 0.708326_r8, 0.675477_r8/ - data (bm2ji(10, 5,ibeta), ibeta = 1,10) / & - 1.456711_r8, 1.413432_r8, 1.322096_r8, 1.219264_r8, 1.122319_r8, & - 1.038381_r8, 0.969743_r8, 0.916811_r8, 0.879544_r8, 0.858099_r8/ - data (bm2ji(10, 6,ibeta), ibeta = 1,10) / & - 1.741792_r8, 1.695157_r8, 1.596897_r8, 1.487124_r8, 1.385734_r8, & - 1.301670_r8, 1.238638_r8, 1.198284_r8, 1.181809_r8, 1.190689_r8/ - data (bm2ji(10, 7,ibeta), ibeta = 1,10) / & - 2.190197_r8, 2.141721_r8, 2.040226_r8, 1.929245_r8, 1.832051_r8, & - 1.760702_r8, 1.721723_r8, 1.719436_r8, 1.757705_r8, 1.840677_r8/ - data (bm2ji(10, 8,ibeta), ibeta = 1,10) / & - 2.940764_r8, 2.895085_r8, 2.801873_r8, 2.707112_r8, 2.638603_r8, & - 2.613764_r8, 2.644686_r8, 2.741255_r8, 2.912790_r8, 3.168519_r8/ - data (bm2ji(10, 9,ibeta), ibeta = 1,10) / & - 4.186191_r8, 4.155844_r8, 4.101953_r8, 4.069102_r8, 4.089886_r8, & - 4.189530_r8, 4.389145_r8, 4.707528_r8, 5.161567_r8, 5.765283_r8/ - data (bm2ji(10,10,ibeta), ibeta = 1,10) / & - 6.119526_r8, 6.127611_r8, 6.171174_r8, 6.286528_r8, 6.508738_r8, & - 6.869521_r8, 7.396912_r8, 8.113749_r8, 9.034683_r8, 10.162190_r8/ - -! *** end of data statements. - - -! *** start calculations: - - constii = abs( half * ( two ) ** two3rds - one ) - sqrttwo = sqrt(two) - dlgsqt2 = one / log( sqrttwo ) - - esat01 = exp( 0.125_r8 * xxlsgat * xxlsgat ) - esac01 = exp( 0.125_r8 * xxlsgac * xxlsgac ) - - esat04 = esat01 ** 4 - esac04 = esac01 ** 4 - - esat05 = esat04 * esat01 - esac05 = esac04 * esac01 - - esat08 = esat04 * esat04 - esac08 = esac04 * esac04 - - esat09 = esat08 * esat01 - esac09 = esac08 * esac01 - - esat16 = esat08 * esat08 - esac16 = esac08 * esac08 - - esat20 = esat16 * esat04 - esac20 = esac16 * esac04 - - esat24 = esat20 * esat04 - esac24 = esac20 * esac04 - - esat25 = esat20 * esat05 - esac25 = esac20 * esac05 - - esat36 = esat20 * esat16 - esac36 = esac20 * esac16 - - esat49 = esat24 * esat25 - - esat64 = esat20 * esat20 * esat24 - esac64 = esac20 * esac20 * esac24 - - esat100 = esat64 * esat36 - - dgat2 = dgatk * dgatk - dgat3 = dgatk * dgatk * dgatk - dgac2 = dgacc * dgacc - dgac3 = dgacc * dgacc * dgacc - - sqdgat = sqrt( dgatk ) - sqdgac = sqrt( dgacc ) - sqdgat5 = dgat2 * sqdgat - sqdgac5 = dgac2 * sqdgac - sqdgat7 = dgat3 * sqdgat - - xm2at = dgat2 * esat16 - xm3at = dgat3 * esat36 - - xm2ac = dgac2 * esac16 - xm3ac = dgac3 * esac36 - -! *** for the free molecular regime: page h.3 of whitby et al. (1991) - - r = sqdgac / sqdgat - r2 = r * r - r3 = r2 * r - rx4 = r2 * r2 - r5 = r3 * r2 - r6 = r3 * r3 - rx8 = rx4 * rx4 - ri1 = one / r - ri2 = one / r2 - ri3 = one / r3 - ri4 = ri2 * ri2 - kngat = two * lamda / dgatk - kngac = two * lamda / dgacc - - -! *** calculate ratio of geometric mean diameters - rat = dgacc / dgatk -! *** trap subscripts for bm0 and bm0i, between 1 and 10 -! see page h.5 of whitby et al. (1991) - - n2n = max( 1, min( 10, & - nint( 4.0_r8 * ( sgatk - 0.75_r8 ) ) ) ) - - n2a = max( 1, min( 10, & - nint( 4.0_r8 * ( sgacc - 0.75_r8 ) ) ) ) - - n1 = max( 1, min( 10, & - 1 + nint( dlgsqt2 * log( rat ) ) ) ) - -! *** intermodal coagulation - - -! *** set up for zeroeth moment - -! *** near-continuum form: equation h.10a of whitby et al. (1991) - - coagnc0 = knc * ( & - two + a * ( kngat * ( esat04 + r2 * esat16 * esac04 ) & - + kngac * ( esac04 + ri2 * esac16 * esat04 ) ) & - + ( r2 + ri2 ) * esat04 * esac04 ) - - -! *** free-molecular form: equation h.7a of whitby et al. (1991) - - coagfm0 = kfmatac * sqdgat * bm0ij(n1,n2n,n2a) * ( & - esat01 + r * esac01 + two * r2 * esat01 * esac04 & - + rx4 * esat09 * esac16 + ri3 * esat16 * esac09 & - + two * ri1 * esat04 + esac01 ) - - -! *** loss to accumulation mode - -! *** harmonic mean - - coagatac0 = coagnc0 * coagfm0 / ( coagnc0 + coagfm0 ) - - qn12 = coagatac0 - - -! *** set up for second moment -! the second moment equations are new and begin with equations a1 -! through a4 of binkowski and shankar (1995). after some algebraic -! rearrangement and application of the extended mean value theorem -! of integral calculus, equations are obtained that can be solved -! analytically with correction factors as has been done by -! whitby et al. (1991) - -! *** the term ( dp1 + dp2 ) ** (2/3) in equations a3 and a4 of -! binkowski and shankar (1995) is approximated by -! (dgat ** 3 + dgac **3 ) ** 2/3 - -! *** near-continuum form - - i1nc = knc * dgat2 * ( & - two * esat16 & - + r2 * esat04 * esac04 & - + ri2 * esat36 * esac04 & - + a * kngat * ( & - esat04 & - + ri2 * esat16 * esac04 & - + ri4 * esat36 * esac16 & - + r2 * esac04 ) ) - - - - -! *** free-molecular form - - i1fm = kfmatac * sqdgat5 * bm2ij(n1,n2n,n2a) * ( & - esat25 & - + two * r2 * esat09 * esac04 & - + rx4 * esat01 * esac16 & - + ri3 * esat64 * esac09 & - + two * ri1 * esat36 * esac01 & - + r * esat16 * esac01 ) - - - -! *** loss to accumulation mode - -! *** harmonic mean - - i1 = ( i1fm * i1nc ) / ( i1fm + i1nc ) - - coagatac2 = i1 - - qs12 = coagatac2 - - -! *** gain by accumulation mode - - coagacat2 = ( ( one + r6 ) ** two3rds - rx4 ) * i1 - - qs21 = coagacat2 * bm2ji(n1,n2n,n2a) - -! *** set up for third moment - -! *** near-continuum form: equation h.10b of whitby et al. (1991) - - coagnc3 = knc * dgat3 * ( & - two * esat36 & - + a * kngat * ( esat16 + r2 * esat04 * esac04 ) & - + a * kngac * ( esat36 * esac04 + ri2 * esat64 * esac16 ) & - + r2 * esat16 * esac04 + ri2 * esat64 * esac04 ) - - -! *** free_molecular form: equation h.7b of whitby et al. (1991) - - coagfm3 = kfmatac * sqdgat7 * bm3i( n1, n2n, n2a ) * ( & - esat49 & - + r * esat36 * esac01 & - + two * r2 * esat25 * esac04 & - + rx4 * esat09 * esac16 & - + ri3 * esat100 * esac09 & - + two * ri1 * esat64 * esac01 ) - -! *** gain by accumulation mode = loss from aitken mode - -! *** harmonic mean - - coagatac3 = coagnc3 * coagfm3 / ( coagnc3 + coagfm3 ) - - qv12 = coagatac3 - -! *** intramodal coagulation - -! *** zeroeth moment - -! *** aitken mode - -! *** near-continuum form: equation h.12a of whitby et al. (1991) - - coagnc_at = knc * (one + esat08 + a * kngat * (esat20 + esat04)) - -! *** free-molecular form: equation h.11a of whitby et al. (1991) - - coagfm_at = kfmat * sqdgat * bm0(n2n) * & - ( esat01 + esat25 + two * esat05 ) - - -! *** harmonic mean - - coagatat0 = coagfm_at * coagnc_at / ( coagfm_at + coagnc_at ) - - qn11 = coagatat0 - - -! *** accumulation mode - -! *** near-continuum form: equation h.12a of whitby et al. (1991) - - coagnc_ac = knc * (one + esac08 + a * kngac * (esac20 + esac04)) - -! *** free-molecular form: equation h.11a of whitby et al. (1991) - - coagfm_ac = kfmac * sqdgac * bm0(n2a) * & - ( esac01 + esac25 + two * esac05 ) - -! *** harmonic mean - - coagacac0 = coagfm_ac * coagnc_ac / ( coagfm_ac + coagnc_ac ) - - qn22 = coagacac0 - - -! *** set up for second moment -! the second moment equations are new and begin with 3.11a on page -! 45 of whitby et al. (1991). after some algebraic rearrangement and -! application of the extended mean value theorem of integral calculus -! equations are obtained that can be solved analytically with -! correction factors as has been done by whitby et al. (1991) - -! *** aitken mode - -! *** near-continuum - - i1nc_at = knc * dgat2 * ( & - two * esat16 & - + esat04 * esat04 & - + esat36 * esat04 & - + a * kngat * ( & - two * esat04 & - + esat16 * esat04 & - + esat36 * esat16 ) ) - -! *** free- molecular form - - i1fm_at = kfmat * sqdgat5 * bm2ii(n2n) * ( & - esat25 & - + two * esat09 * esat04 & - + esat01 * esat16 & - + esat64 * esat09 & - + two * esat36 * esat01 & - + esat16 * esat01 ) - - i1_at = ( i1nc_at * i1fm_at ) / ( i1nc_at + i1fm_at ) - - coagatat2 = constii * i1_at - - qs11 = coagatat2 * bm2iitt(n2n) - -! *** accumulation mode - -! *** near-continuum - - i1nc_ac = knc * dgac2 * ( & - two * esac16 & - + esac04 * esac04 & - + esac36 * esac04 & - + a * kngac * ( & - two * esac04 & - + esac16 * esac04 & - + esac36 * esac16 ) ) - -! *** free- molecular form - - i1fm_ac = kfmac * sqdgac5 * bm2ii(n2a) * ( & - esac25 & - + two * esac09 * esac04 & - + esac01 * esac16 & - + esac64 * esac09 & - + two * esac36 * esac01 & - + esac16 * esac01 ) - - i1_ac = ( i1nc_ac * i1fm_ac ) / ( i1nc_ac + i1fm_ac ) - - coagacac2 = constii * i1_ac - - qs22 = coagacac2 * bm2iitt(n2a) - - - return - - end subroutine getcoags - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- - - end module modal_aero_coag - - - diff --git a/MAMchem_GridComp/microphysics/modal_aero_data.F90 b/MAMchem_GridComp/microphysics/modal_aero_data.F90 deleted file mode 100644 index 3dbc5ff8..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_data.F90 +++ /dev/null @@ -1,470 +0,0 @@ - module modal_aero_data - -!-------------------------------------------------------------- -! ... Basic aerosol mode parameters and arrays -!-------------------------------------------------------------- -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use constituents, only: pcnst - use radconstants, only: nswbands, nlwbands -#else - use MAPL_ConstantsMod, only: r8 => MAPL_R8 - use constituents, only: pcnst -#endif - - implicit none - save - - integer, parameter :: maxd_aspectype = 14 - ! aerosol mode definitions - ! -#if ( defined MODAL_AERO_7MODE ) - integer, parameter :: ntot_amode = 7 -#elif ( defined MODAL_AERO_4MODE ) - integer, parameter :: ntot_amode = 4 -#elif ( defined MODAL_AERO_3MODE ) - integer, parameter :: ntot_amode = 3 -#endif - - integer, parameter :: nbc = 1 ! number of differently tagged black-carbon species - integer, parameter :: npoa = 1 ! number of differently tagged primary-organic species - integer, parameter :: nsoa = 1 ! number of differently tagged secondary-organic species - - ! - ! definitions for aerosol chemical components - ! - integer, parameter :: ntot_aspectype = 8 - character(len=*),parameter :: specname_amode(ntot_aspectype) = (/ 'sulfate ', 'ammonium ', 'nitrate ', & - 'p-organic ', 's-organic ', 'black-c ', & - 'seasalt ', 'dust ' /) - ! set specdens_amode from physprop files via rad_cnst_get_aer_props - !specdens_amode(:ntot_aspectype) = (/1770.0,1770.0,1770.0, 1000.0, 1000.0, 1700.0,1900.0,2600.0 /) - - ! rce - 06-aug-2007 - changed specmw for almost everything to match mozart -#if ( defined MODAL_AERO_7MODE ) - real(r8), parameter :: specmw_amode(ntot_aspectype) = (/ 96.0_r8, 18.0_r8, 62.0_r8, & - 12.0_r8, 12.0_r8, 12.0_r8, 58.5_r8, 135.0_r8 /) -#elif ( defined MODAL_AERO_4MODE ) - real(r8), parameter :: specmw_amode(ntot_aspectype) = (/ 115.0_r8, 115.0_r8, 62.0_r8, & - 12.0_r8, 12.0_r8, 12.0_r8, 58.5_r8, 135.0_r8 /) !zlu+- -#elif ( defined MODAL_AERO_3MODE ) - real(r8), parameter :: specmw_amode(ntot_aspectype) = (/ 115.0_r8, 115.0_r8, 62.0_r8, & - 12.0_r8, 12.0_r8, 12.0_r8, 58.5_r8, 135.0_r8 /) -#endif - - - ! input modename_amode, nspec_amode -#if ( defined MODAL_AERO_7MODE ) - character(len=*), parameter :: modename_amode(ntot_amode) = (/ & - 'accum ', & - 'aitken ', & - 'primary_carbon ', & - 'fine_seasalt ', & - 'fine_dust ', & - 'coarse_seasalt ', & - 'coarse_dust '/) -#elif ( defined MODAL_AERO_4MODE ) - character(len=*), parameter :: modename_amode(ntot_amode) = (/ & - 'accum ', & - 'aitken ', & - 'coarse ', & - 'primary_carbon '/) -#elif ( defined MODAL_AERO_3MODE ) - character(len=*), parameter :: modename_amode(ntot_amode) = (/ & - 'accum ', & - 'aitken ', & - 'coarse '/) -#endif - -#if ( defined MODAL_AERO_7MODE ) -#ifndef MOSAIC_SPECIES !BSINGH - We nedd extra species for mosaic model - integer, parameter :: nspec_amode(ntot_amode) = (/ 6, 4, 2, 3, 3, 3, 3 /) ! SS -#else - integer, parameter :: nspec_amode(ntot_amode) = (/ 8, 6, 2, 5, 7, 5, 7 /) ! SS -#endif - - -#elif ( defined MODAL_AERO_4MODE ) - -#ifndef MOSAIC_SPECIES - integer, parameter :: nspec_amode(ntot_amode) = (/ 6, 3, 3, 2 /) -#else - integer, parameter :: nspec_amode(ntot_amode) = (/ 11, 6, 8, 2 /) -#endif - - -#elif ( defined MODAL_AERO_3MODE ) - integer, parameter :: nspec_amode(ntot_amode) = (/ 6, 3, 3 /) -#endif - integer, parameter :: nspec_amode_max = 6 - ! input mprognum_amode, mdiagnum_amode, mprogsfc_amode, mcalcwater_amode -#if ( defined MODAL_AERO_7MODE ) - integer, parameter :: mprognum_amode(ntot_amode) = (/ 1, 1, 1, 1, 1, 1, 1/) - integer, parameter :: mdiagnum_amode(ntot_amode) = (/ 0, 0, 0, 0, 0, 0, 0/) - integer, parameter :: mprogsfc_amode(ntot_amode) = (/ 0, 0, 0, 0, 0, 0, 0/) - integer, parameter :: mcalcwater_amode(ntot_amode) = (/ 1, 1, 1, 1, 1, 1, 1/) -#elif ( defined MODAL_AERO_4MODE ) - integer, parameter :: mprognum_amode(ntot_amode) = (/ 1, 1, 1, 1/) - integer, parameter :: mdiagnum_amode(ntot_amode) = (/ 0, 0, 0, 0/) - integer, parameter :: mprogsfc_amode(ntot_amode) = (/ 0, 0, 0, 0/) - integer, parameter :: mcalcwater_amode(ntot_amode) = (/ 0, 0, 0, 0/) -#elif ( defined MODAL_AERO_3MODE ) - integer, parameter :: mprognum_amode(ntot_amode) = (/ 1, 1, 1/) - integer, parameter :: mdiagnum_amode(ntot_amode) = (/ 0, 0, 0/) - integer, parameter :: mprogsfc_amode(ntot_amode) = (/ 0, 0, 0/) - integer, parameter :: mcalcwater_amode(ntot_amode) = (/ 0, 0, 0/) -#endif - - ! input dgnum_amode, dgnumlo_amode, dgnumhi_amode (units = m) - real(r8) :: dgnum_amode(ntot_amode) - real(r8) :: dgnumlo_amode(ntot_amode) - real(r8) :: dgnumhi_amode(ntot_amode) - - ! input sigmag_amode - real(r8) :: sigmag_amode(ntot_amode) - - ! input crystalization and deliquescence points - real(r8) :: rhcrystal_amode(ntot_amode) - real(r8) :: rhdeliques_amode(ntot_amode) - - - integer :: msectional = -1 - - - integer & ! - lspectype_amode( maxd_aspectype, ntot_amode ), & ! - lmassptr_amode( maxd_aspectype, ntot_amode ), & ! - lmassptrcw_amode( maxd_aspectype, ntot_amode ), & ! - numptr_amode( ntot_amode ), & ! - numptrcw_amode( ntot_amode ) - - - real(r8) :: & ! - alnsg_amode( ntot_amode ), & ! - voltonumb_amode( ntot_amode ), & ! - voltonumblo_amode( ntot_amode ), & ! - voltonumbhi_amode( ntot_amode ), & ! - alnv2n_amode( ntot_amode ), & ! - alnv2nlo_amode( ntot_amode ), & ! - alnv2nhi_amode( ntot_amode ), & ! - specdens_amode( maxd_aspectype ), & ! - spechygro( maxd_aspectype ) - -#ifndef GEOS5_PORT - complex(r8) & ! - specrefndxsw( nswbands, maxd_aspectype ), & ! - specrefndxlw( nlwbands, maxd_aspectype ) - - - character(len=16) :: cnst_name_cw( pcnst ) - - character(len=8) :: aodvisname(ntot_amode ), & - ssavisname(ntot_amode ) - character(len=48) :: aodvislongname(ntot_amode ), & - ssavislongname(ntot_amode ) - - character(len=8) :: fnactname(ntot_amode ), & - fmactname(ntot_amode ), & - nactname(ntot_amode ) - character(len=48) :: fnactlongname(ntot_amode ), & - fmactlongname(ntot_amode ), & - nactlongname(ntot_amode ) -#else - character(len=16) :: cnst_name_cw( pcnst ) -#endif - - !BSINGH - These definitions are taken from modal_aero_initialize_data.F90 - !as they are needed for modal_aer_opt.F90 for writing modal_optics file - character(len=8) :: & - xname_massptr(maxd_aspectype,ntot_amode), & - xname_massptrcw(maxd_aspectype,ntot_amode) - character(len=10) :: xname_spectype(maxd_aspectype,ntot_amode) - !BSINGH-ENDS - - integer & ! - lptr_so4_a_amode(ntot_amode), lptr_so4_cw_amode(ntot_amode), & ! - lptr_msa_a_amode(ntot_amode), lptr_msa_cw_amode(ntot_amode), & ! - lptr_nh4_a_amode(ntot_amode), lptr_nh4_cw_amode(ntot_amode), & ! - lptr_no3_a_amode(ntot_amode), lptr_no3_cw_amode(ntot_amode), & ! - lptr_pom_a_amode(ntot_amode), lptr_pom_cw_amode(ntot_amode), & ! - lptr_soa_a_amode(ntot_amode), lptr_soa_cw_amode(ntot_amode), & ! - lptr_bc_a_amode(ntot_amode), lptr_bc_cw_amode(ntot_amode), & ! - lptr_nacl_a_amode(ntot_amode), lptr_nacl_cw_amode(ntot_amode),& ! - lptr_dust_a_amode(ntot_amode), lptr_dust_cw_amode(ntot_amode),& ! - modeptr_accum, modeptr_aitken, & ! - modeptr_ufine, modeptr_coarse, & ! - modeptr_pcarbon, & ! - modeptr_finedust, modeptr_fineseas, & ! - modeptr_coardust, modeptr_coarseas - - integer & - lptr2_soa_a_amode(ntot_amode,nsoa), & - lptr2_soa_g_amode(nsoa) - - real(r8) :: & - specmw_so4_amode, specdens_so4_amode, & - specmw_nh4_amode, specdens_nh4_amode, & - specmw_no3_amode, specdens_no3_amode, & - specmw_pom_amode, specdens_pom_amode, & - specmw_soa_amode, specdens_soa_amode, & - specmw_bc_amode, specdens_bc_amode, & - specmw_dust_amode, specdens_dust_amode, & - specmw_seasalt_amode, specdens_seasalt_amode - - integer species_class(pcnst) ! indicates species class ( - ! cldphysics, aerosol, gas ) - - integer spec_class_undefined - parameter ( spec_class_undefined = 0 ) - integer spec_class_cldphysics - parameter ( spec_class_cldphysics = 1 ) - integer spec_class_aerosol - parameter ( spec_class_aerosol = 2 ) - integer spec_class_gas - parameter ( spec_class_gas = 3 ) - integer spec_class_other - parameter ( spec_class_other = 4 ) - - -! threshold for reporting negatives from subr qneg3 - real(r8) :: qneg3_worst_thresh_amode(pcnst) - - integer, private :: qqcw(pcnst)=-1 ! Remaps modal_aero indices into pbuf - - - -! The following variables determine whether convective cloud transport and -! wet removal are done in the standard routines or in modal_aero_convproc -! routines (eventually should be variables set by namelist) - - !BSINGH:02/25/2013: Following variables are NOT read from Namelist as - ! they are not used for any meaningful calc as of now - integer, parameter :: convproc_do_gas = 0 - integer, parameter :: convproc_do_aqch = 0 - - !BSINGH:02/25/2013: Following variables are read from **Namelist** - integer :: convproc_do_aer = 0 - logical :: HD_mods = .false. !default, it is read from namelist now!!! - -! This variable controls history output of additonal deep-convection wet deposition fields -! (in addition to the normal fields for total-convection wet deposition) - logical, parameter :: deepconv_wetdep_history = .true. - - integer, parameter :: mam_amicphys_optaa = 100 -! mam_amicphys_optaa < 100 -- use old microphysics code (separate calls to gasaerexch, -! newnuc, coag routines) -! >= 100 -- use new microphysics code (single call to amicphys routine) - -#ifndef GEOS5_PORT - contains - - subroutine qqcw_set_ptr(index, iptr) - use abortutils, only : endrun - use time_manager, only : is_first_step - - - integer, intent(in) :: index, iptr - - if(index>0 .and. index <= pcnst ) then - qqcw(index)=iptr - else - call endrun('attempting to set qqcw pointer already defined') - end if - end subroutine qqcw_set_ptr - - function qqcw_get_field(pbuf, index, lchnk, errorhandle) - use abortutils, only : endrun - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - integer, intent(in) :: index, lchnk - real(r8), pointer :: qqcw_get_field(:,:) - logical, optional :: errorhandle - type(physics_buffer_desc), pointer :: pbuf(:) - - logical :: error - - nullify(qqcw_get_field) - error = .false. - if (index>0 .and. index <= pcnst) then - if (qqcw(index)>0) then - call pbuf_get_field(pbuf, qqcw(index), qqcw_get_field) - else - error = .true. - endif - else - error = .true. - end if - - if (error .and. .not. present(errorhandle)) then - call endrun('attempt to access undefined qqcw') - end if - - end function qqcw_get_field -#endif ! GEOS5_PORT - end module modal_aero_data - -!---------------------------------------------------------------- -! -! maxd_aspectype = maximum allowable number of chemical species -! in each aerosol mode -! -! ntot_amode = number of aerosol modes -! ( ntot_amode_gchm = number of aerosol modes in gchm -! ntot_amode_ccm2 = number of aerosol modes to be made known to ccm2 -! These are temporary until multi-mode activation scavenging is going. -! Until then, ntot_amode is set to either ntot_amode_gchm or -! ntot_amode_ccm2 depending on which code is active ) -! -! msectional - if positive, moving-center sectional code is utilized, -! and each mode is actually a section. -! msectional_concinit - if positive, special code is used to initialize -! the mixing ratios of all the sections. -! -! nspec_amode(m) = number of chemical species in aerosol mode m -! nspec_amode_ccm2(m) = . . . while in ccm2 code -! nspec_amode_gchm(m) = . . . while in gchm code -! nspec_amode_nontracer(m) = number of "non-tracer" chemical -! species while in gchm code -! lspectype_amode(l,m) = species type/i.d. for chemical species l -! in aerosol mode m. (1=sulfate, others to be defined) -! lmassptr_amode(l,m) = gchm r-array index for the mixing ratio -! (moles-x/mole-air) for chemical species l in aerosol mode m -! that is in clear air or interstitial air (but not in cloud water) -! lmassptrcw_amode(l,m) = gchm r-array index for the mixing ratio -! (moles-x/mole-air) for chemical species l in aerosol mode m -! that is currently bound/dissolved in cloud water -! lwaterptr_amode(m) = gchm r-array index for the mixing ratio -! (moles-water/mole-air) for water associated with aerosol mode m -! that is in clear air or interstitial air -! lkohlercptr_amode(m) = gchm r-array index for the kohler "c" parameter -! for aerosol mode m. This is defined on a per-dry-particle-mass basis: -! c = r(i,j,k,lkohlercptr_amode) * [rhodry * (4*pi/3) * rdry^3] -! numptr_amode(m) = gchm r-array index for the number mixing ratio -! (particles/mole-air) for aerosol mode m that is in clear air or -! interstitial are (but not in cloud water). If zero or negative, -! then number is not being simulated. -! ( numptr_amode_gchm(m) = same thing but for within gchm -! numptr_amode_ccm2(m) = same thing but for within ccm2 -! These are temporary, to allow testing number in gchm before ccm2 ) -! numptrcw_amode(m) = gchm r-array index for the number mixing ratio -! (particles/mole-air) for aerosol mode m -! that is currently bound/dissolved in cloud water -! lsfcptr_amode(m) = gchm r-array index for the surface area mixing ratio -! (cm^2/mole-air) for aerosol mode m that is in clear air or -! interstitial are (but not in cloud water). If zero or negative, -! then surface area is not being simulated. -! lsfcptrcw_amode(m) = gchm r-array index for the surface area mixing ratio -! (cm^2/mole-air) for aerosol mode m that is currently -! bound/dissolved in cloud water. -! lsigptr_amode(m) = gchm r-array index for sigmag for aerosol mode m -! that is in clear air or interstitial are (but not in cloud water). -! If zero or negative, then the constant sigmag_amode(m) is used. -! lsigptrcw_amode(m) = gchm r-array index for sigmag for aerosol mode m -! that is currently bound/dissolved in cloud water. -! If zero or negative, then the constant sigmag_amode(m) is used. -! lsigptrac_amode(m) = gchm r-array index for sigmag for aerosol mode m -! for combined clear-air/interstial plus bound/dissolved in cloud water. -! If zero or negative, then the constant sigmag_amode(m) is used. -! -! dgnum_amode(m) = geometric dry mean diameter (m) of the number -! distribution for aerosol mode m. -! (Only used when numptr_amode(m) is zero or negative.) -! dgnumlo_amode(m), dgnumhi_amode(m) = lower and upper limits on the -! geometric dry mean diameter (m) of the number distribution -! (Used when mprognum_amode>0, to limit dgnum to reasonable values) -! sigmag_amode(m) = geometric standard deviation for aerosol mode m -! sigmaglo_amode(m), sigmaghi_amode(m) = lower and upper limits on the -! geometric standard deviation of the number distribution -! (Used when mprogsfc_amode>0, to limit sigmag to reasonable values) -! alnsg_amode(m) = alog( sigmag_amode(m) ) -! alnsglo_amode(m), alnsghi_amode(m) = alog( sigmaglo/hi_amode(m) ) -! voltonumb_amode(m) = ratio of number to volume for mode m -! voltonumblo_amode(m), voltonumbhi_amode(m) = ratio of number to volume -! when dgnum = dgnumlo_amode or dgnumhi_amode, respectively -! voltosfc_amode(m), voltosfclo_amode(m), voltosfchi_amode(m) - ratio of -! surface to volume for mode m (like the voltonumb_amode's) -! alnv2n_amode(m), alnv2nlo_amode(m), alnv2nhi_amode(m) - -! alnv2n_amode(m) = alog( voltonumblo_amode(m) ), ... -! alnv2s_amode(m), alnv2slo_amode(m), alnv2shi_amode(m) - -! alnv2s_amode(m) = alog( voltosfclo_amode(m) ), ... -! rhcrystal_amode(m) = crystalization r.h. for mode m -! rhdeliques_amode(m) = deliquescence r.h. for mode m -! (*** these r.h. values are 0-1 fractions, not 0-100 percentages) -! -! mcalcwater_amode(m) - if positive, water content for mode m will be -! calculated and stored in rclm(k,lwaterptr_amode(m)). Otherwise, no. -! mprognum_amode(m) - if positive, number mixing-ratio for mode m will -! be prognosed. Otherwise, no. -! mdiagnum_amode(m) - if positive, number mixing-ratio for mode m will -! be diagnosed and put into rclm(k,numptr_amode(m)). Otherwise, no. -! mprogsfc_amode(m) - if positive, surface area mixing-ratio for mode m will -! be prognosed, and sigmag will vary temporally and spatially. -! Otherwise, sigmag is constant. -! *** currently surface area is not prognosed when msectional>0 *** -! -! ntot_aspectype = overall number of aerosol chemical species defined (over all modes) -! specdens_amode(l) = dry density (kg/m^3) of aerosol chemical species type l -! specmw_amode(l) = molecular weight (kg/kmol) of aerosol chemical species type l -! specname_amode(l) = name of aerosol chemical species type l -! specrefndxsw(l) = complex refractive index (visible wavelengths) -! of aerosol chemical species type l -! specrefndxlw(l) = complex refractive index (infrared wavelengths) -! of aerosol chemical species type l -! spechygro(l) = hygroscopicity of aerosol chemical species type l -! -! lptr_so4_a_amode(m), lptr_so4_cw_amode(m) = gchm r-array index for the -! mixing ratio for sulfate associated with aerosol mode m -! ("a" and "cw" phases) -! (similar for msa, oc, bc, nacl, dust) -! -! modename_amode(m) = character-variable name for mode m, -! read from mirage2.inp -! modeptr_accum - mode index for the main accumulation mode -! if modeptr_accum = 1, then mode 1 is the main accumulation mode, -! and modename_amode(1) = "accum" -! modeptr_aitken - mode index for the main aitken mode -! if modeptr_aitken = 2, then mode 2 is the main aitken mode, -! and modename_amode(2) = "aitken" -! modeptr_ufine - mode index for the ultrafine mode -! if modeptr_ufine = 3, then mode 3 is the ultrafine mode, -! and modename_amode(3) = "ufine" -! modeptr_coarseas - mode index for the coarse sea-salt mode -! if modeptr_coarseas = 4, then mode 4 is the coarse sea-salt mode, -! and modename_amode(4) = "coarse_seasalt" -! modeptr_coardust - mode index for the coarse dust mode -! if modeptr_coardust = 5, then mode 5 is the coarse dust mode, -! and modename_amode(5) = "coarse_dust" -! -! specdens_XX_amode = dry density (kg/m^3) of aerosol chemical species type XX -! where XX is so4, om, bc, dust, seasalt -! contains same values as the specdens_amode array -! allows values to be referenced differently -! specmw_XX_amode = molecular weight (kg/kmol) of aerosol chemical species type XX -! contains same values as the specmw_amode array -! -!----------------------------------------------------------------------- - - -!-------------------------------------------------------------- -! -! ... aerosol size information for the current chunk -! -!-------------------------------------------------------------- -! -! dgncur = current geometric mean diameters (cm) for number distributions -! dgncur_a - for unactivated particles, dry -! (in physics buffer as DGNUM) -! dgncur_awet - for unactivated particles, wet at grid-cell ambient RH -! (in physics buffer as DGNUMWET) -! -! the dgncur are computed from current mass and number -! mixing ratios in the grid cell, BUT are then adjusted to be within -! the bounds defined by dgnumlo/hi_amode -! -! v2ncur = current (number/volume) ratio based on dgncur and sgcur -! (volume in cm^3/whatever, number in particles/whatever) -! == 1.0 / ( pi/6 * dgncur**3 * exp(4.5*((log(sgcur))**2)) ) -! v2ncur_a - for unactivated particles -! (currently just defined locally) -! - diff --git a/MAMchem_GridComp/microphysics/modal_aero_gasaerexch.F90 b/MAMchem_GridComp/microphysics/modal_aero_gasaerexch.F90 deleted file mode 100644 index cdd68674..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_gasaerexch.F90 +++ /dev/null @@ -1,1487 +0,0 @@ -! modal_aero_gasaerexch.F90 - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -!BOP -! -! !MODULE: modal_aero_gasaerexch --- does modal aerosol gas-aerosol exchange -! -! !INTERFACE: - module modal_aero_gasaerexch - -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use chem_mods, only: gas_pcnst - use modal_aero_data, only: maxd_aspectype - use ref_pres, only: top_lev => trop_cloud_top_lev - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: - public modal_aero_gasaerexch_sub, modal_aero_gasaerexch_init - -! !PUBLIC DATA MEMBERS: - integer, parameter :: pcnstxx = gas_pcnst - integer, parameter, public :: maxspec_pcage = maxd_aspectype - - integer, public :: npair_pcage - integer, public :: modefrm_pcage - integer, public :: modetoo_pcage - integer, public :: nspecfrm_pcage - integer, public :: lspecfrm_pcage(maxspec_pcage) - integer, public :: lspectoo_pcage(maxspec_pcage) - - -! real(r8), parameter, public :: n_so4_monolayers_pcage = 1.0_r8 - real(r8), parameter, public :: n_so4_monolayers_pcage = 3.0_r8 -! number of so4(+nh4) monolayers needed to "age" a carbon particle - - real(r8), parameter, public :: & - dr_so4_monolayers_pcage = n_so4_monolayers_pcage * 4.76e-10_r8 -! thickness of the so4 monolayers (m) -! for so4(+nh4), use bi-sulfate mw and 1.77 g/cm3, -! --> 1 mol so4(+nh4) = 65 cm^3 --> 1 molecule = (4.76e-10 m)^3 -! aging criterion is approximate so do not try to distinguish -! sulfuric acid, bisulfate, ammonium sulfate - - real(r8), save, public :: soa_equivso4_factor -! this factor converts an soa volume to a volume of so4(+nh4) -! having same hygroscopicity as the soa - - -! !DESCRIPTION: This module implements ... -! -! !REVISION HISTORY: -! -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! list private module data here - -!EOC -!---------------------------------------------------------------------- - - - contains - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -!BOP -! !ROUTINE: modal_aero_gasaerexch_sub --- ... -! -! !INTERFACE: -subroutine modal_aero_gasaerexch_sub( & - lchnk, ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - t, pmid, pdel, & - q, qqcw, & - dqdt_other, dqqcwdt_other, & - dgncur_a, dgncur_awet ) - -! !USES: -use modal_aero_data -use modal_aero_rename, only: modal_aero_rename_sub - -use cam_history, only: outfld, fieldname_len -use chem_mods, only: adv_mass -use constituents, only: pcnst, cnst_name, cnst_get_ind -use mo_tracname, only: solsym -use physconst, only: gravit, mwdry, rair -use ppgrid, only: pcols, pver -use abortutils, only : endrun -use spmd_utils, only : iam, masterproc - - -implicit none - -! !PARAMETERS: - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric column - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: loffset ! offset applied to modal aero "ptrs" - integer, intent(in) :: latndx(pcols), lonndx(pcols) - real(r8), intent(in) :: deltat ! time step (s) - - real(r8), intent(inout) :: q(ncol,pver,pcnstxx) ! tracer mixing ratio (TMR) array - ! *** MUST BE #/kmol-air for number - ! *** MUST BE mol/mol-air for mass - ! *** NOTE ncol dimension - real(r8), intent(inout) :: qqcw(ncol,pver,pcnstxx) - ! like q but for cloud-borner tracers - real(r8), intent(in) :: dqdt_other(ncol,pver,pcnstxx) - ! TMR tendency from other continuous - ! growth processes (aqchem, soa??) - ! *** NOTE ncol dimension - real(r8), intent(in) :: dqqcwdt_other(ncol,pver,pcnstxx) - ! like dqdt_other but for cloud-borner tracers - real(r8), intent(in) :: t(pcols,pver) ! temperature at model levels (K) - real(r8), intent(in) :: pmid(pcols,pver) ! pressure at model levels (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure thickness of levels (Pa) - real(r8), intent(in) :: dgncur_a(pcols,pver,ntot_amode) - real(r8), intent(in) :: dgncur_awet(pcols,pver,ntot_amode) - ! dry & wet geo. mean dia. (m) of number distrib. - -! !DESCRIPTION: -! computes TMR (tracer mixing ratio) tendencies for gas condensation -! onto aerosol particles -! -! this version does condensation of H2SO4, NH3, and MSA, both treated as -! completely non-volatile (gas --> aerosol, but no aerosol --> gas) -! gas H2SO4 goes to aerosol SO4 -! gas MSA (if present) goes to aerosol SO4 -! aerosol MSA is not distinguished from aerosol SO4 -! gas NH3 (if present) goes to aerosol NH4 -! if gas NH3 is not present, then ???? -! -! -! !REVISION HISTORY: -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! local variables - integer, parameter :: jsrflx_gaexch = 1 - integer, parameter :: jsrflx_rename = 2 - integer, parameter :: ldiag1=-1, ldiag2=-1, ldiag3=-1, ldiag4=-1 - integer, parameter :: method_soa = 2 -! method_soa=0 is no uptake -! method_soa=1 is irreversible uptake done like h2so4 uptake -! method_soa=2 is reversible uptake using subr modal_aero_soaexch - - integer :: i, icol_diag, iq - integer :: idiagss - integer :: ido_so4a(ntot_amode), ido_nh4a(ntot_amode), ido_soaa(ntot_amode) - integer :: jac, jsrf - integer :: k - integer :: l, l2, lb, lsfrm, lstoo - integer :: l_so4g, l_nh4g, l_msag, l_soag - integer :: n, niter, niter_max, ntot_soamode - - logical :: is_dorename_atik, dorename_atik(ncol,pver) - - character(len=fieldname_len+3) :: fieldname - - real (r8) :: avg_uprt_nh4, avg_uprt_so4, avg_uprt_soa - real (r8) :: deltatxx - real (r8) :: dqdt_nh4(ntot_amode), dqdt_so4(ntot_amode), dqdt_soa(ntot_amode) - real (r8) :: fac_m2v_nh4, fac_m2v_so4, fac_m2v_soa - real (r8) :: fac_m2v_pcarbon(maxd_aspectype) - real (r8) :: fac_volsfc_pcarbon - real (r8) :: fgain_nh4(ntot_amode), fgain_so4(ntot_amode), fgain_soa(ntot_amode) - real (r8) :: g0_soa - real (r8) :: pdel_fac - real (r8) :: qmax_nh4, qnew_nh4, qnew_so4 - real (r8) :: qold_nh4(ntot_amode), qold_so4(ntot_amode) - real (r8) :: qold_soa(ntot_amode), qold_poa(ntot_amode) - real (r8) :: sum_dqdt_msa, sum_dqdt_so4, sum_dqdt_soa - real (r8) :: sum_dqdt_nh4, sum_dqdt_nh4_b - real (r8) :: sum_uprt_msa, sum_uprt_nh4, sum_uprt_so4, sum_uprt_soa - real (r8) :: tmp1, tmp2 - real (r8) :: uptkrate(ntot_amode,pcols,pver) - real (r8) :: uptkratebb(ntot_amode), uptkrate_soa(ntot_amode) - ! gas-to-aerosol mass transfer rates (1/s) - real (r8) :: vol_core, vol_shell - real (r8) :: xferfrac_pcage, xferfrac_max - real (r8) :: xferrate - - logical :: do_msag ! true if msa gas is a species - logical :: do_nh4g ! true if nh3 gas is a species - logical :: do_soag ! true if soa gas is a species - - logical :: dotend(pcnstxx) ! identifies species directly involved in - ! gas-aerosol exchange (gas condensation) - logical :: dotendqqcw(pcnstxx) ! like dotend but for cloud-borner tracers - logical :: dotendrn(pcnstxx), dotendqqcwrn(pcnstxx) - ! identifies species involved in renaming - ! after "continuous growth" - ! (gas-aerosol exchange and aqchem) - - integer, parameter :: nsrflx = 2 ! last dimension of qsrflx - real(r8) :: dqdt(ncol,pver,pcnstxx) ! TMR "delta q" array - NOTE dims - real(r8) :: dqqcwdt(ncol,pver,pcnstxx) ! like dqdt but for cloud-borner tracers - real(r8) :: qsrflx(pcols,pcnstxx,nsrflx) - ! process-specific column tracer tendencies - ! (1=renaming, 2=gas condensation) - real(r8) :: qqcwsrflx(pcols,pcnstxx,nsrflx) - -! following only needed for diagnostics - real(r8) :: qold(ncol,pver,pcnstxx) ! NOTE dims - real(r8) :: qnew(ncol,pver,pcnstxx) ! NOTE dims - real(r8) :: qdel(ncol,pver,pcnstxx) ! NOTE dims - real(r8) :: dumavec(1000), dumbvec(1000), dumcvec(1000) - real(r8) :: qqcwold(ncol,pver,pcnstxx) - real(r8) :: dqdtsv1(ncol,pver,pcnstxx) - real(r8) :: dqqcwdtsv1(ncol,pver,pcnstxx) - - -!---------------------------------------------------------------------- - - - icol_diag = -1 - if (ldiag1 > 0) then - if (nstep < 3) then - do i = 1, ncol - if ((latndx(i) == 23) .and. (lonndx(i) == 37)) icol_diag = i - end do - end if - end if - - -! set gas species indices - call cnst_get_ind( 'H2SO4', l_so4g, .false. ) - call cnst_get_ind( 'NH3', l_nh4g, .false. ) - call cnst_get_ind( 'MSA', l_msag, .false. ) - call cnst_get_ind( 'SOAG', l_soag, .false. ) - l_so4g = l_so4g - loffset - l_nh4g = l_nh4g - loffset - l_msag = l_msag - loffset - l_soag = l_soag - loffset - if ((l_so4g <= 0) .or. (l_so4g > pcnstxx)) then - write( *, '(/a/a,2i7)' ) & - '*** modal_aero_gasaerexch_sub -- cannot find H2SO4 species', & - ' l_so4g, loffset =', l_so4g, loffset - call endrun( 'modal_aero_gasaerexch_sub error' ) - end if - do_nh4g = .false. - do_msag = .false. - if ((l_nh4g > 0) .and. (l_nh4g <= pcnstxx)) do_nh4g = .true. - if ((l_msag > 0) .and. (l_msag <= pcnstxx)) do_msag = .true. - do_soag = .false. - if ((method_soa == 1) .or. (method_soa == 2)) then - if ((l_soag > 0) .and. (l_soag <= pcnstxx)) do_soag = .true. - else if (method_soa /= 0) then - write(*,'(/a,1x,i10)') '*** modal_aero_gasaerexch_sub - bad method_soa =', method_soa - call endrun( 'modal_aero_gasaerexch_sub error' ) - end if - -! set tendency flags - dotend(:) = .false. - dotendqqcw(:) = .false. - ido_so4a(:) = 0 - ido_nh4a(:) = 0 - ido_soaa(:) = 0 - - dotend(l_so4g) = .true. - if ( do_nh4g ) dotend(l_nh4g) = .true. - if ( do_msag ) dotend(l_msag) = .true. - if ( do_soag ) dotend(l_soag) = .true. - ntot_soamode = 0 - do n = 1, ntot_amode - l = lptr_so4_a_amode(n)-loffset - if ((l > 0) .and. (l <= pcnstxx)) then - dotend(l) = .true. - ido_so4a(n) = 1 - if ( do_nh4g ) then - l = lptr_nh4_a_amode(n)-loffset - if ((l > 0) .and. (l <= pcnstxx)) then - dotend(l) = .true. - ido_nh4a(n) = 1 - end if - end if - end if - if ( do_soag ) then - l = lptr_soa_a_amode(n)-loffset - if ((l > 0) .and. (l <= pcnstxx)) then - dotend(l) = .true. - ido_soaa(n) = 1 - ntot_soamode = n - end if - end if - end do - if ( do_soag ) ntot_soamode = max( ntot_soamode, modefrm_pcage ) - - if (modefrm_pcage > 0) then - ido_so4a(modefrm_pcage) = 2 - if (ido_nh4a(modetoo_pcage) == 1) ido_nh4a(modefrm_pcage) = 2 - if (ido_soaa(modetoo_pcage) == 1) ido_soaa(modefrm_pcage) = 2 - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq)-loffset - lstoo = lspectoo_pcage(iq)-loffset - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - end do - - - fac_m2v_so4 = specmw_so4_amode / specdens_so4_amode - fac_m2v_nh4 = specmw_nh4_amode / specdens_nh4_amode - fac_m2v_soa = specmw_soa_amode / specdens_soa_amode - fac_m2v_pcarbon(:) = 0.0_r8 - n = modeptr_pcarbon - do l = 1, nspec_amode(n) - l2 = lspectype_amode(l,n) -! fac_m2v converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) -! [m3-AP/kmol-AP] = [kg-AP/kmol-AP] / [kg-AP/m3-AP] - fac_m2v_pcarbon(l) = specmw_amode(l2) / specdens_amode(l2) - end do - fac_volsfc_pcarbon = exp( 2.5_r8*(alnsg_amode(n)**2) ) - xferfrac_max = 1.0_r8 - 10.0_r8*epsilon(1.0_r8) ! 1-eps - end if - - -! zero out tendencies and other - dqdt(:,:,:) = 0.0_r8 - dqqcwdt(:,:,:) = 0.0_r8 - qsrflx(:,:,:) = 0.0_r8 - qqcwsrflx(:,:,:) = 0.0_r8 - -! compute gas-to-aerosol mass transfer rates - call gas_aer_uptkrates( ncol, loffset, & - q, t, pmid, & - dgncur_awet, uptkrate ) - - -! use this for tendency calcs to avoid generating very small negative values - deltatxx = deltat * (1.0_r8 + 1.0e-15_r8) - - - jsrf = jsrflx_gaexch - do k=top_lev,pver - do i=1,ncol - -! fgain_so4(n) = fraction of total h2so4 uptake going to mode n -! fgain_nh4(n) = fraction of total nh3 uptake going to mode n - sum_uprt_so4 = 0.0_r8 - sum_uprt_nh4 = 0.0_r8 - sum_uprt_soa = 0.0_r8 - do n = 1, ntot_amode - uptkratebb(n) = uptkrate(n,i,k) - if (ido_so4a(n) > 0) then - fgain_so4(n) = uptkratebb(n) - sum_uprt_so4 = sum_uprt_so4 + fgain_so4(n) - if (ido_so4a(n) == 1) then - qold_so4(n) = q(i,k,lptr_so4_a_amode(n)-loffset) - else - qold_so4(n) = 0.0_r8 - end if - else - fgain_so4(n) = 0.0_r8 - qold_so4(n) = 0.0_r8 - end if - - if (ido_nh4a(n) > 0) then -! 2.08 factor is for gas diffusivity (nh3/h2so4) -! differences in fuch-sutugin and accom coef ignored - fgain_nh4(n) = uptkratebb(n)*2.08_r8 - sum_uprt_nh4 = sum_uprt_nh4 + fgain_nh4(n) - if (ido_nh4a(n) == 1) then - qold_nh4(n) = q(i,k,lptr_nh4_a_amode(n)-loffset) - else - qold_nh4(n) = 0.0_r8 - end if - else - fgain_nh4(n) = 0.0_r8 - qold_nh4(n) = 0.0_r8 - end if - - if (ido_soaa(n) > 0) then -! 0.81 factor is for gas diffusivity (soa/h2so4) -! (differences in fuch-sutugin and accom coef ignored) - fgain_soa(n) = uptkratebb(n)*0.81_r8 - sum_uprt_soa = sum_uprt_soa + fgain_soa(n) - if (ido_soaa(n) == 1) then - qold_soa(n) = q(i,k,lptr_soa_a_amode(n)-loffset) - l = lptr_pom_a_amode(n)-loffset - if (l > 0) then - qold_poa(n) = q(i,k,l) - else - qold_poa(n) = 0.0_r8 - end if - else - qold_soa(n) = 0.0_r8 - qold_poa(n) = 0.0_r8 - end if - else - fgain_soa(n) = 0.0_r8 - qold_soa(n) = 0.0_r8 - qold_poa(n) = 0.0_r8 - end if - uptkrate_soa(n) = fgain_soa(n) - end do - - if (sum_uprt_so4 > 0.0_r8) then - do n = 1, ntot_amode - fgain_so4(n) = fgain_so4(n) / sum_uprt_so4 - end do - end if -! at this point (sum_uprt_so4 <= 0.0) only when all the fgain_so4 are zero - if (sum_uprt_nh4 > 0.0_r8) then - do n = 1, ntot_amode - fgain_nh4(n) = fgain_nh4(n) / sum_uprt_nh4 - end do - end if - if (sum_uprt_soa > 0.0_r8) then - do n = 1, ntot_amode - fgain_soa(n) = fgain_soa(n) / sum_uprt_soa - end do - end if - -! uptake amount (fraction of gas uptaken) over deltat - avg_uprt_so4 = (1.0_r8 - exp(-deltatxx*sum_uprt_so4))/deltatxx - avg_uprt_nh4 = (1.0_r8 - exp(-deltatxx*sum_uprt_nh4))/deltatxx - avg_uprt_soa = (1.0_r8 - exp(-deltatxx*sum_uprt_soa))/deltatxx - -! sum_dqdt_so4 = so4_a tendency from h2so4 gas uptake (mol/mol/s) -! sum_dqdt_msa = msa_a tendency from msa gas uptake (mol/mol/s) -! sum_dqdt_nh4 = nh4_a tendency from nh3 gas uptake (mol/mol/s) -! sum_dqdt_soa = soa_a tendency from soa gas uptake (mol/mol/s) - sum_dqdt_so4 = q(i,k,l_so4g) * avg_uprt_so4 - if ( do_msag ) then - sum_dqdt_msa = q(i,k,l_msag) * avg_uprt_so4 - else - sum_dqdt_msa = 0.0_r8 - end if - if ( do_nh4g ) then - sum_dqdt_nh4 = q(i,k,l_nh4g) * avg_uprt_nh4 - else - sum_dqdt_nh4 = 0.0_r8 - end if - if ( do_soag ) then - sum_dqdt_soa = q(i,k,l_soag) * avg_uprt_soa - else - sum_dqdt_soa = 0.0_r8 - end if - -! compute TMR tendencies for so4, nh4, msa interstial aerosol -! due to simple gas uptake - pdel_fac = pdel(i,k)/gravit - sum_dqdt_nh4_b = 0.0_r8 - do n = 1, ntot_amode - dqdt_so4(n) = fgain_so4(n)*(sum_dqdt_so4 + sum_dqdt_msa) - - if ( do_nh4g ) then - dqdt_nh4(n) = fgain_nh4(n)*sum_dqdt_nh4 - qnew_nh4 = qold_nh4(n) + dqdt_nh4(n)*deltat - qnew_so4 = qold_so4(n) + dqdt_so4(n)*deltat - qmax_nh4 = 2.0_r8*qnew_so4 - if (qnew_nh4 > qmax_nh4) then - dqdt_nh4(n) = (qmax_nh4 - qold_nh4(n))/deltatxx - end if - sum_dqdt_nh4_b = sum_dqdt_nh4_b + dqdt_nh4(n) - end if - end do - - if (( do_soag ) .and. (method_soa > 1)) then -! compute TMR tendencies for soag and soa interstial aerosol -! using soa parameterization - niter_max = 1000 - dqdt_soa(:) = 0.0_r8 - -! idiagss = 0 -! if (ldiag2 > 0) then -! if ((i == icol_diag) .and. (mod(k-1,5) == 0)) then -! idiagss = 1 -! end if -! end if - -! call modal_aero_soaexch( dtfull, temp, pres, & -! niter, niter_max, ntot_soamode, & -! g_soa_in, a_soa_in, a_poa_in, xferrate, & -! g_soa_tend, a_soa_tend ) - call modal_aero_soaexch( deltat, t(i,k), pmid(i,k), & - niter, niter_max, ntot_soamode, & - q(i,k,l_soag), qold_soa, qold_poa, uptkrate_soa, & - tmp1, dqdt_soa ) -! tmp1, dqdt_soa, g0_soa, idiagss ) - sum_dqdt_soa = -tmp1 - - else if ( do_soag ) then -! compute TMR tendencies for soa interstial aerosol -! due to simple gas uptake - do n = 1, ntot_amode - dqdt_soa(n) = fgain_soa(n)*sum_dqdt_soa - end do - else - dqdt_soa(:) = 0.0_r8 - end if - - do n = 1, ntot_amode - if (ido_so4a(n) == 1) then - l = lptr_so4_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_so4(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_so4(n)*pdel_fac - end if - - if ( do_nh4g ) then - if (ido_nh4a(n) == 1) then - l = lptr_nh4_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_nh4(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_nh4(n)*pdel_fac - end if - end if - - if ( do_soag ) then - if (ido_soaa(n) == 1) then - l = lptr_soa_a_amode(n)-loffset - dqdt(i,k,l) = dqdt_soa(n) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_soa(n)*pdel_fac - end if - end if - end do - -! compute TMR tendencies for h2so4, nh3, and msa gas -! due to simple gas uptake - l = l_so4g - dqdt(i,k,l) = -sum_dqdt_so4 - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - - if ( do_msag ) then - l = l_msag - dqdt(i,k,l) = -sum_dqdt_msa - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - - if ( do_nh4g ) then - l = l_nh4g - dqdt(i,k,l) = -sum_dqdt_nh4_b - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - - if ( do_soag ) then - l = l_soag - dqdt(i,k,l) = -sum_dqdt_soa - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt(i,k,l)*pdel_fac - end if - -! compute TMR tendencies associated with primary carbon aging - if (modefrm_pcage > 0) then - n = modeptr_pcarbon - vol_shell = deltat * & - ( dqdt_so4(n)*fac_m2v_so4 + dqdt_nh4(n)*fac_m2v_nh4 + & - dqdt_soa(n)*fac_m2v_soa*soa_equivso4_factor ) - vol_core = 0.0_r8 - do l = 1, nspec_amode(n) - vol_core = vol_core + & - q(i,k,lmassptr_amode(l,n)-loffset)*fac_m2v_pcarbon(l) - end do -! ratio1 = vol_shell/vol_core = -! actual hygroscopic-shell-volume/carbon-core-volume after gas uptake -! ratio2 = 6.0_r8*dr_so4_monolayers_pcage/(dgncur_a*fac_volsfc_pcarbon) -! = (shell-volume corresponding to n_so4_monolayers_pcage)/core-volume -! The 6.0/(dgncur_a*fac_volsfc_pcarbon) = (mode-surface-area/mode-volume) -! Note that vol_shell includes both so4+nh4 AND soa as "equivalent so4", -! The soa_equivso4_factor accounts for the lower hygroscopicity of soa. -! -! Define xferfrac_pcage = min( 1.0, ratio1/ratio2) -! But ratio1/ratio2 == tmp1/tmp2, and coding below avoids possible overflow -! - tmp1 = vol_shell*dgncur_a(i,k,n)*fac_volsfc_pcarbon - tmp2 = max( 6.0_r8*dr_so4_monolayers_pcage*vol_core, 0.0_r8 ) - if (tmp1 >= tmp2) then - xferfrac_pcage = xferfrac_max - else - xferfrac_pcage = min( tmp1/tmp2, xferfrac_max ) - end if - - if (xferfrac_pcage > 0.0_r8) then - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq)-loffset - lstoo = lspectoo_pcage(iq)-loffset - xferrate = (xferfrac_pcage/deltat)*q(i,k,lsfrm) - dqdt(i,k,lsfrm) = dqdt(i,k,lsfrm) - xferrate - qsrflx(i,lsfrm,jsrf) = qsrflx(i,lsfrm,jsrf) - xferrate*pdel_fac - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dqdt(i,k,lstoo) = dqdt(i,k,lstoo) + xferrate - qsrflx(i,lstoo,jsrf) = qsrflx(i,lstoo,jsrf) + xferrate*pdel_fac - end if - end do - - if (ido_so4a(modetoo_pcage) > 0) then - l = lptr_so4_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_so4(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_so4(modefrm_pcage)*pdel_fac - end if - - if (ido_nh4a(modetoo_pcage) > 0) then - l = lptr_nh4_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_nh4(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_nh4(modefrm_pcage)*pdel_fac - end if - - if (ido_soaa(modetoo_pcage) > 0) then - l = lptr_soa_a_amode(modetoo_pcage)-loffset - dqdt(i,k,l) = dqdt(i,k,l) + dqdt_soa(modefrm_pcage) - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf) + dqdt_soa(modefrm_pcage)*pdel_fac - end if - end if - - end if - - -! diagnostics start ------------------------------------------------------- - if (ldiag2 > 0) then - if (i == icol_diag) then - if (mod(k-1,5) == 0) then - write(*,'(a,43i5)') 'gasaerexch aaa nstep,lat,lon,k', nstep, latndx(i), lonndx(i), k - write(*,'(a,1p,10e12.4)') 'uptkratebb ', uptkratebb(:) - write(*,'(a,1p,10e12.4)') 'sum_uprt_so4 ', sum_uprt_so4 - write(*,'(a,1p,10e12.4)') 'fgain_so4 ', fgain_so4(:) - write(*,'(a,1p,10e12.4)') 'sum_uprt_nh4 ', sum_uprt_nh4 - write(*,'(a,1p,10e12.4)') 'fgain_nh4 ', fgain_nh4(:) - write(*,'(a,1p,10e12.4)') 'sum_uprt_soa ', sum_uprt_soa - write(*,'(a,1p,10e12.4)') 'fgain_soa ', fgain_soa(:) - write(*,'(a,1p,10e12.4)') 'so4g o,dqdt,n', q(i,k,l_so4g), sum_dqdt_so4, & - (q(i,k,l_so4g)-deltat*sum_dqdt_so4) - write(*,'(a,1p,10e12.4)') 'nh3g o,dqdt,n', q(i,k,l_nh4g), sum_dqdt_nh4, sum_dqdt_nh4_b, & - (q(i,k,l_nh4g)-deltat*sum_dqdt_nh4_b) - write(*,'(a,1p,10e12.4)') 'soag o,dqdt,n', q(i,k,l_soag), sum_dqdt_soa, & - (q(i,k,l_soag)-deltat*sum_dqdt_soa) - write(*,'(a,i12,1p,10e12.4)') & - 'method,g0,t,p', method_soa, g0_soa, t(i,k), pmid(i,k) - write(*,'(a,1p,10e12.4)') 'so4 old ', qold_so4(:) - write(*,'(a,1p,10e12.4)') 'so4 dqdt ', dqdt_so4(:) - write(*,'(a,1p,10e12.4)') 'so4 new ', (qold_so4(:)+deltat*dqdt_so4(:)) - write(*,'(a,1p,10e12.4)') 'nh4 old ', qold_nh4(:) - write(*,'(a,1p,10e12.4)') 'nh4 dqdt ', dqdt_nh4(:) - write(*,'(a,1p,10e12.4)') 'nh4 new ', (qold_nh4(:)+deltat*dqdt_nh4(:)) - write(*,'(a,1p,10e12.4)') 'soa old ', qold_soa(:) - write(*,'(a,1p,10e12.4)') 'soa dqdt ', dqdt_soa(:) - write(*,'(a,1p,10e12.4)') 'soa new ', (qold_soa(:)+deltat*dqdt_soa(:)) - write(*,'(a,1p,10e12.4)') 'vshell, core ', vol_shell, vol_core - write(*,'(a,1p,10e12.4)') 'dr_mono, ... ', dr_so4_monolayers_pcage, & - soa_equivso4_factor - write(*,'(a,1p,10e12.4)') 'dgn, ... ', dgncur_a(i,k,modefrm_pcage), & - fac_volsfc_pcarbon - write(*,'(a,1p,10e12.4)') 'tmp1, tmp2 ', tmp1, tmp2 - write(*,'(a,1p,10e12.4)') 'xferfrac_age ', xferfrac_pcage - end if - end if - end if -! diagnostics end --------------------------------------------------------- - - - end do ! "i = 1, ncol" - end do ! "k = top_lev, pver" - - -! set "temporary testing arrays" - qold(:,:,:) = q(:,:,:) - qqcwold(:,:,:) = qqcw(:,:,:) - dqdtsv1(:,:,:) = dqdt(:,:,:) - dqqcwdtsv1(:,:,:) = dqqcwdt(:,:,:) - - -! -! do renaming calcs -! - dotendrn(:) = .false. - dotendqqcwrn(:) = .false. - dorename_atik(1:ncol,:) = .true. - is_dorename_atik = .true. - call modal_aero_rename_sub( & - 'modal_aero_gasaerexch_sub', & - lchnk, ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - pdel, & - dotendrn, q, & - dqdt, dqdt_other, & - dotendqqcwrn, qqcw, & - dqqcwdt, dqqcwdt_other, & - is_dorename_atik, dorename_atik, & - jsrflx_rename, nsrflx, & - qsrflx, qqcwsrflx ) - - -! -! apply the dqdt to update q (and same for qqcw) -! - do l = 1, pcnstxx - if ( dotend(l) .or. dotendrn(l) ) then - do k = top_lev, pver - do i = 1, ncol - q(i,k,l) = q(i,k,l) + dqdt(i,k,l)*deltat - end do - end do - end if - if ( dotendqqcw(l) .or. dotendqqcwrn(l) ) then - do k = top_lev, pver - do i = 1, ncol - qqcw(i,k,l) = qqcw(i,k,l) + dqqcwdt(i,k,l)*deltat - end do - end do - end if - end do - - -! diagnostics start ------------------------------------------------------- - if (ldiag3 > 0) then - if (icol_diag > 0) then - i = icol_diag - write(*,'(a,3i5)') 'gasaerexch ppp nstep,lat,lon', nstep, latndx(i), lonndx(i) - write(*,'(2i5,3(2x,a))') 0, 0, 'ppp', 'pdel for all k' - write(*,'(1p,7e12.4)') (pdel(i,k), k=top_lev,pver) - - write(*,'(a,3i5)') 'gasaerexch ddd nstep,lat,lon', nstep, latndx(i), lonndx(i) - do l = 1, pcnstxx - lb = l + loffset - - if ( dotend(l) .or. dotendrn(l) ) then - write(*,'(2i5,3(2x,a))') 1, l, 'ddd1', cnst_name(lb), 'qold for all k' - write(*,'(1p,7e12.4)') (qold(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 1, l, 'ddd2', cnst_name(lb), 'qnew for all k' - write(*,'(1p,7e12.4)') (q(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 1, l, 'ddd3', cnst_name(lb), 'dqdt from conden for all k' - write(*,'(1p,7e12.4)') (dqdtsv1(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 1, l, 'ddd4', cnst_name(lb), 'dqdt from rename for all k' - write(*,'(1p,7e12.4)') ((dqdt(i,k,l)-dqdtsv1(i,k,l)), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 1, l, 'ddd5', cnst_name(lb), 'dqdt other for all k' - write(*,'(1p,7e12.4)') (dqdt_other(i,k,l), k=top_lev,pver) - end if - - if ( dotendqqcw(l) .or. dotendqqcwrn(l) ) then - write(*,'(2i5,3(2x,a))') 2, l, 'ddd1', cnst_name_cw(lb), 'qold for all k' - write(*,'(1p,7e12.4)') (qqcwold(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 2, l, 'ddd2', cnst_name_cw(lb), 'qnew for all k' - write(*,'(1p,7e12.4)') (qqcw(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 2, l, 'ddd3', cnst_name_cw(lb), 'dqdt from conden for all k' - write(*,'(1p,7e12.4)') (dqqcwdtsv1(i,k,l), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 2, l, 'ddd4', cnst_name_cw(lb), 'dqdt from rename for all k' - write(*,'(1p,7e12.4)') ((dqqcwdt(i,k,l)-dqqcwdtsv1(i,k,l)), k=top_lev,pver) - write(*,'(2i5,3(2x,a))') 2, l, 'ddd5', cnst_name_cw(lb), 'dqdt other for all k' - write(*,'(1p,7e12.4)') (dqqcwdt_other(i,k,l), k=top_lev,pver) - end if - - end do - - write(*,'(a,3i5)') 'gasaerexch fff nstep,lat,lon', nstep, latndx(i), lonndx(i) - do l = 1, pcnstxx - lb = l + loffset - if ( dotend(l) .or. dotendrn(l) .or. dotendqqcw(l) .or. dotendqqcwrn(l) ) then - write(*,'(i5,2(2x,a,2l3))') l, & - cnst_name(lb), dotend(l), dotendrn(l), & - cnst_name_cw(lb), dotendqqcw(l), dotendqqcwrn(l) - end if - end do - - end if - end if -! diagnostics end --------------------------------------------------------- - - -! do history file column-tendency fields - do l = 1, pcnstxx - lb = l + loffset - - do jsrf = 1, 2 - - do jac = 1, 2 - - if (jac == 1) then - if (jsrf == jsrflx_gaexch) then - if ( .not. dotend(l) ) cycle - fieldname = trim(cnst_name(lb)) // '_sfgaex1' - else if (jsrf == jsrflx_rename) then - if ( .not. dotendrn(l) ) cycle - fieldname = trim(cnst_name(lb)) // '_sfgaex2' - else - cycle - end if - do i = 1, ncol - qsrflx(i,l,jsrf) = qsrflx(i,l,jsrf)*(adv_mass(l)/mwdry) - end do - call outfld( fieldname, qsrflx(:,l,jsrf), pcols, lchnk ) - - else - if (jsrf == jsrflx_gaexch) then - cycle - else if (jsrf == jsrflx_rename) then - if ( .not. dotendqqcwrn(l) ) cycle - fieldname = trim(cnst_name_cw(lb)) // '_sfgaex2' - else - cycle - end if - do i = 1, ncol - qqcwsrflx(i,l,jsrf) = qqcwsrflx(i,l,jsrf)*(adv_mass(l)/mwdry) - end do - call outfld( fieldname, qqcwsrflx(:,l,jsrf), pcols, lchnk ) - end if - -! if (( masterproc ) .and. (nstep < 1)) & -! write(*,'(2(a,2x),1p,e11.3)') & -! 'modal_aero_newnuc_sub outfld', fieldname, adv_mass(l) - - if (ldiag4 > 0) then - if (icol_diag > 0) then - i = icol_diag - if (jac == 1) then - tmp1 = qsrflx(i,l,jsrf) - else - tmp1 = qqcwsrflx(i,l,jsrf) - end if - write(*,'(a,4i5,2x,a,1p,2e12.4)') & - 'gasaerexch nstep,lat,lon,l,fieldname,qsrflx,adv_mass', & - nstep, latndx(i), lonndx(i), l, fieldname, tmp1, adv_mass(l) - end if - end if - - end do ! jac = ... - end do ! jsrf = ... - end do ! l = ... - - - return -!EOC - end subroutine modal_aero_gasaerexch_sub - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -subroutine gas_aer_uptkrates( ncol, loffset, & - q, t, pmid, & - dgncur_awet, uptkrate ) - -! -! / -! computes uptkrate = | dx dN/dx gas_conden_rate(Dp(x)) -! / -! using Gauss-Hermite quadrature of order nghq=2 -! -! Dp = particle diameter (cm) -! x = ln(Dp) -! dN/dx = log-normal particle number density distribution -! gas_conden_rate(Dp) = 2 * pi * gasdiffus * Dp * F(Kn,ac) -! F(Kn,ac) = Fuchs-Sutugin correction factor -! Kn = Knudsen number -! ac = accomodation coefficient -! - -!use modal_aero_data, only: ntot_amode, ntot_amode, nspec_amode, & -! lspectype_amode, lmassptr_amode, & -! sigmag_amode, & -! specdens_amode, specmw_amode -use modal_aero_data, only: ntot_amode, ntot_amode, & - numptr_amode, & - sigmag_amode - -use ppgrid -use constituents, only: pcnst, cnst_name -use physconst, only: mwdry, rair - -implicit none - - - integer, intent(in) :: ncol ! number of atmospheric column - integer, intent(in) :: loffset - real(r8), intent(in) :: q(ncol,pver,pcnstxx) ! Tracer array (mol,#/mol-air) - real(r8), intent(in) :: t(pcols,pver) ! Temperature in Kelvin - real(r8), intent(in) :: pmid(pcols,pver) ! Air pressure in Pa - real(r8), intent(in) :: dgncur_awet(pcols,pver,ntot_amode) - - real(r8), intent(out) :: uptkrate(ntot_amode,pcols,pver) - ! gas-to-aerosol mass transfer rates (1/s) - - -! local - integer, parameter :: nghq = 2 - integer :: i, iq, k, l1, l2, la, n - - real(r8), parameter :: tworootpi = 3.5449077_r8 - real(r8), parameter :: root2 = 1.4142135_r8 - real(r8), parameter :: beta = 2.0_r8 - - real(r8) :: aircon - real(r8) :: const - real(r8) :: dp, dum_m2v - real(r8) :: dryvol_a(pcols,pver) - real(r8) :: gasdiffus, gasspeed - real(r8) :: freepathx2, fuchs_sutugin - real(r8) :: knudsen - real(r8) :: lndp, lndpgn, lnsg - real(r8) :: num_a - real(r8) :: rhoair - real(r8) :: sumghq - real(r8), save :: xghq(nghq), wghq(nghq) ! quadrature abscissae and weights - - data xghq / 0.70710678_r8, -0.70710678_r8 / - data wghq / 0.88622693_r8, 0.88622693_r8 / - - -! outermost loop over all modes - do n = 1, ntot_amode - -! 22-aug-2007 rc easter - get number from q array rather -! than computing a "bounded" number conc. -!! compute dry volume = sum_over_components{ component_mass / density } -!! (m3-AP/mol-air) -!! compute it for all i,k to improve accessing q array -! dryvol_a(1:ncol,:) = 0.0_r8 -! do l1 = 1, nspec_amode(n) -! l2 = lspectype_amode(l1,n) -!! dum_m2v converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) -!! [m3-AP/kmol-AP]= [kg-AP/kmol-AP] / [kg-AP/m3-AP] -! dum_m2v = specmw_amode(l2) / specdens_amode(l2) -! la = lmassptr_amode(l1,n) -! dryvol_a(1:ncol,:) = dryvol_a(1:ncol,:) & -! + max(0.0_r8,q(1:ncol,:,la))*dum_m2v -! end do - -! loops k and i - do k=top_lev,pver - do i=1,ncol - - rhoair = pmid(i,k)/(rair*t(i,k)) ! (kg-air/m3) -! aircon = 1.0e3*rhoair/mwdry ! (mol-air/m3) - -!! "bounded" number conc. (#/m3) -! num_a = dryvol_a(i,k)*v2ncur_a(i,k,n)*aircon - -! number conc. (#/m3) -- note q(i,k,numptr) is (#/kmol-air) -! so need aircon in (kmol-air/m3) - aircon = rhoair/mwdry ! (kmol-air/m3) - num_a = q(i,k,numptr_amode(n)-loffset)*aircon - -! gasdiffus = h2so4 gas diffusivity from mosaic code (m^2/s) -! (pmid must be Pa) - gasdiffus = 0.557e-4_r8 * (t(i,k)**1.75_r8) / pmid(i,k) -! gasspeed = h2so4 gas mean molecular speed from mosaic code (m/s) - gasspeed = 1.470e1_r8 * sqrt(t(i,k)) -! freepathx2 = 2 * (h2so4 mean free path) (m) - freepathx2 = 6.0_r8*gasdiffus/gasspeed - - lnsg = log( sigmag_amode(n) ) - lndpgn = log( dgncur_awet(i,k,n) ) ! (m) - const = tworootpi * num_a * exp(beta*lndpgn + 0.5_r8*(beta*lnsg)**2) - -! sum over gauss-hermite quadrature points - sumghq = 0.0_r8 - do iq = 1, nghq - lndp = lndpgn + beta*lnsg**2 + root2*lnsg*xghq(iq) - dp = exp(lndp) - -! knudsen number - knudsen = freepathx2/dp -! following assumes accomodation coefficient = ac = 0.65 -! (Adams & Seinfeld, 2002, JGR, and references therein) -! fuchs_sutugin = (0.75*ac*(1. + knudsen)) / -! (knudsen*(1.0 + knudsen + 0.283*ac) + 0.75*ac) - fuchs_sutugin = (0.4875_r8*(1._r8 + knudsen)) / & - (knudsen*(1.184_r8 + knudsen) + 0.4875_r8) - - sumghq = sumghq + wghq(iq)*dp*fuchs_sutugin/(dp**beta) - end do - uptkrate(n,i,k) = const * gasdiffus * sumghq - - end do ! "do i = 1, ncol" - end do ! "do k = 1, pver" - - end do ! "do n = 1, ntot_soamode" - - - return - end subroutine gas_aer_uptkrates - -!---------------------------------------------------------------------- - - - subroutine modal_aero_soaexch( dtfull, temp, pres, & - niter, niter_max, ntot_soamode, & - g_soa_in, a_soa_in, a_poa_in, xferrate, & - g_soa_tend, a_soa_tend ) -! g_soa_tend, a_soa_tend, g0_soa, idiagss ) - -!----------------------------------------------------------------------- -! -! Purpose: -! -! calculates condensation/evaporation of "soa gas" -! to/from multiple aerosol modes in 1 grid cell -! -! key assumptions -! (1) ambient equilibrium vapor pressure of soa gas -! is given by p0_soa_298 and delh_vap_soa -! (2) equilibrium vapor pressure of soa gas at aerosol -! particle surface is given by raoults law in the form -! g_star = g0_soa*[a_soa/(a_soa + a_opoa)] -! (3) (oxidized poa)/(total poa) is equal to frac_opoa (constant) -! -! -! Author: R. Easter and R. Zaveri -! -!----------------------------------------------------------------------- - implicit none - - real(r8), intent(in) :: dtfull ! full integration time step (s) - real(r8), intent(in) :: temp ! air temperature (K) - real(r8), intent(in) :: pres ! air pressure (Pa) - integer, intent(out) :: niter ! number of iterations performed - integer, intent(in) :: niter_max ! max allowed number of iterations - integer, intent(in) :: ntot_soamode ! number of modes having soa - real(r8), intent(in) :: g_soa_in ! initial soa gas mixrat (mol/mol) - real(r8), intent(in) :: a_soa_in(ntot_soamode) ! initial soa aerosol mixrat (mol/mol) - real(r8), intent(in) :: a_poa_in(ntot_soamode) ! initial poa aerosol mixrat (mol/mol) - real(r8), intent(in) :: xferrate(ntot_soamode) ! gas-aerosol mass transfer rate (1/s) - real(r8), intent(out) :: g_soa_tend ! soa gas mixrat tendency (mol/mol/s) - real(r8), intent(out) :: a_soa_tend(ntot_soamode) ! soa aerosol mixrat tendency (mol/mol/s) -! real(r8), intent(out) :: g0_soa ! ambient soa gas equilib mixrat (mol/mol) -! integer, intent(in) :: idiagss - - integer :: luna=6 - integer :: m - - real(r8), parameter :: alpha = 0.05_r8 ! parameter used in calc of time step - real(r8), parameter :: g_min1 = 1.0e-20_r8 - real(r8), parameter :: opoa_frac = 0.1_r8 ! fraction of poa that is opoa - real(r8), parameter :: delh_vap_soa = 156.0e3_r8 - ! delh_vap_soa = heat of vaporization for gas soa (J/mol) - real(r8), parameter :: p0_soa_298 = 1.0e-10_r8 - ! p0_soa_298 = soa gas equilib vapor presssure (atm) at 298 k - real(r8), parameter :: rgas = 8.3144_r8 ! gas constant in J/K/mol - - real(r8) :: a_opoa(ntot_soamode) ! oxidized-poa aerosol mixrat (mol/mol) - real(r8) :: a_soa(ntot_soamode) ! soa aerosol mixrat (mol/mol) - real(r8) :: a_soa_tmp ! temporary soa aerosol mixrat (mol/mol) - real(r8) :: beta(ntot_soamode) ! dtcur*xferrate - real(r8) :: dtcur ! current time step (s) - real(r8) :: dtmax ! = (dtfull-tcur) - real(r8) :: g_soa ! soa gas mixrat (mol/mol) - real(r8) :: g0_soa ! ambient soa gas equilib mixrat (mol/mol) - real(r8) :: g_star(ntot_soamode) ! soa gas mixrat that is in equilib - ! with each aerosol mode (mol/mol) - real(r8) :: phi(ntot_soamode) ! "relative driving force" - real(r8) :: p0_soa ! soa gas equilib vapor presssure (atm) - real(r8) :: sat(ntot_soamode) - real(r8) :: tcur ! current integration time (from 0 s) - real(r8) :: tmpa, tmpb - real(r8) :: tot_soa ! g_soa + sum( a_soa(:) ) - - -! force things to be non-negative and calc tot_soa -! calc a_opoa (always slightly >0) - g_soa = max( g_soa_in, 0.0_r8 ) - tot_soa = g_soa - do m = 1, ntot_soamode - a_soa(m) = max( a_soa_in(m), 0.0_r8 ) - tot_soa = tot_soa + a_soa(m) - a_opoa(m) = opoa_frac*a_poa_in(m) - a_opoa(m) = max( a_opoa(m), 1.0e-20_r8 ) ! force to small non-zero value - end do - -! calc ambient equilibrium soa gas - p0_soa = p0_soa_298 * & - exp( -(delh_vap_soa/rgas)*((1.0_r8/temp)-(1.0_r8/298.0_r8)) ) - g0_soa = 1.01325e5_r8*p0_soa/pres -! molecular weight adjustment -! the soa parameterization assumes that real gsoa and asoa have mw=150 -! currently in cam3, -! mw=12 is used (this has to do with the mozart preprocessor) -! soag emission files (molec/cm2/s units) are set to give the desired -! mass emissions (kg/m2/s) and mass mixing ratios (kg/kg) -! when mw=12 is applied -! as a result, the molar mixing ratios for both gsoa and asoa -! are artificially scaled up by (150/12) -! and g0_soa must be similarly scaled up - g0_soa = g0_soa*(150.0_r8/12.0_r8) -! g0_soa = 0.0 ! force irreversible uptake - - niter = 0 - tcur = 0.0_r8 - dtcur = 0.0_r8 - phi(:) = 0.0_r8 - g_star(:) = 0.0_r8 - -! if (idiagss > 0) then -! write(luna,'(a,1p,10e11.3)') 'p0, g0_soa', p0_soa, g0_soa -! write(luna,'(3a)') & -! 'niter, tcur, dtcur, phi(:), ', & -! 'g_star(:), ', & -! 'a_soa(:), g_soa' -! write(luna,'(3a)') & -! ' sat(:), ', & -! 'sat(:)*a_soa(:) ', & -! 'a_opoa(:)' -! write(luna,'(i3,1p,20e10.2)') niter, tcur, dtcur, & -! phi(:), g_star(:), a_soa(:), g_soa -! end if - - -! integration loop -- does multiple substeps to reach dtfull -timeloop: do while (tcur < dtfull-1.0e-3_r8 ) - - niter = niter + 1 - if (niter > niter_max) exit - - tmpa = 0.0_r8 - do m = 1, ntot_soamode - sat(m) = g0_soa/(a_soa(m) + a_opoa(m)) - g_star(m) = sat(m)*a_soa(m) - phi(m) = (g_soa - g_star(m))/max(g_soa,g_star(m),g_min1) - tmpa = tmpa + xferrate(m)*abs(phi(m)) - end do - - dtmax = dtfull-tcur - if (dtmax*tmpa <= alpha) then -! here alpha/tmpa >= dtmax, so this is final substep - dtcur = dtmax - tcur = dtfull - else - dtcur = alpha/tmpa - tcur = tcur + dtcur - end if - -! step 1 - for modes where soa is condensing, estimate "new" a_soa(m) -! using an explicit calculation with "old" g_soa -! and g_star(m) calculated using "old" a_soa(m) -! do this to get better estimate of "new" a_soa(m) and sat(m) - do m = 1, ntot_soamode - beta(m) = dtcur*xferrate(m) - tmpa = g_soa - g_star(m) - if (tmpa > 0.0_r8) then - a_soa_tmp = a_soa(m) + beta(m)*tmpa - sat(m) = g0_soa/(a_soa_tmp + a_opoa(m)) - g_star(m) = sat(m)*a_soa_tmp ! this just needed for diagnostics - end if - end do - -! step 2 - implicit in g_soa and semi-implicit in a_soa, -! with g_star(m) calculated semi-implicitly - tmpa = 0.0_r8 - tmpb = 0.0_r8 - do m = 1, ntot_soamode - tmpa = tmpa + a_soa(m)/(1.0_r8 + beta(m)*sat(m)) - tmpb = tmpb + beta(m)/(1.0_r8 + beta(m)*sat(m)) - end do - - g_soa = (tot_soa - tmpa)/(1.0_r8 + tmpb) - g_soa = max( 0.0_r8, g_soa ) - do m = 1, ntot_soamode - a_soa(m) = (a_soa(m) + beta(m)*g_soa)/ & - (1.0_r8 + beta(m)*sat(m)) - end do - -! if (idiagss > 0) then -! write(luna,'(i3,1p,20e10.2)') niter, tcur, dtcur, & -! phi(:), g_star(:), a_soa(:), g_soa -! write(luna,'(23x,1p,20e10.2)') & -! sat(:), sat(:)*a_soa(:), a_opoa(:) -! end if - -! if (niter > 9992000) then -! write(luna,'(a)') '*** to many iterations' -! exit -! end if - - end do timeloop - - - g_soa_tend = (g_soa - g_soa_in)/dtfull - do m = 1, ntot_soamode - a_soa_tend(m) = (a_soa(m) - a_soa_in(m))/dtfull - end do - - - return - end subroutine modal_aero_soaexch - -!---------------------------------------------------------------------- - - - subroutine modal_aero_gasaerexch_init - -!----------------------------------------------------------------------- -! -! Purpose: -! set do_adjust and do_aitken flags -! create history fields for column tendencies associated with -! modal_aero_calcsize -! -! Author: R. Easter -! -!----------------------------------------------------------------------- - -use modal_aero_data -use modal_aero_rename - -use abortutils, only : endrun -use cam_history, only : addfld, add_default, fieldname_len, phys_decomp -use constituents, only : pcnst, cnst_get_ind, cnst_name -use spmd_utils, only : masterproc -use phys_control,only : phys_getopts - - -implicit none - -!----------------------------------------------------------------------- -! arguments - -!----------------------------------------------------------------------- -! local - integer :: ipair, iq, iqfrm, iqfrm_aa, iqtoo, iqtoo_aa - integer :: jac - integer :: l, lsfrm, lstoo, lunout - integer :: l_so4g, l_nh4g, l_msag, l_soag - integer :: m, mfrm, mtoo - integer :: nsamefrm, nsametoo, nspec - integer :: n, nacc, nait - - logical :: do_msag, do_nh4g, do_soag - logical :: dotend(pcnst), dotendqqcw(pcnst) - - real(r8) :: tmp1, tmp2 - - character(len=fieldname_len) :: tmpnamea, tmpnameb - character(len=fieldname_len+3) :: fieldname - character(128) :: long_name - character(8) :: unit - - logical :: history_aerosol ! Output the MAM aerosol tendencies - - !----------------------------------------------------------------------- - - call phys_getopts( history_aerosol_out = history_aerosol ) - - lunout = 6 -! -! define "from mode" and "to mode" for primary carbon aging -! -! skip (turn off) aging if either is absent, -! or if accum mode so4 is absent -! - modefrm_pcage = -999888777 - modetoo_pcage = -999888777 - if ((modeptr_pcarbon <= 0) .or. (modeptr_accum <= 0)) goto 15000 - l = lptr_so4_a_amode(modeptr_accum) - if ((l < 1) .or. (l > pcnst)) goto 15000 - - modefrm_pcage = modeptr_pcarbon - modetoo_pcage = modeptr_accum - -! -! define species involved in each primary carbon aging pairing -! (include aerosol water) -! -! - mfrm = modefrm_pcage - mtoo = modetoo_pcage - - nspec = 0 -aa_iqfrm: do iqfrm = -1, nspec_amode(mfrm) - - if (iqfrm == -1) then - lsfrm = numptr_amode(mfrm) - lstoo = numptr_amode(mtoo) - else if (iqfrm == 0) then -! bypass transfer of aerosol water due to primary-carbon aging - cycle aa_iqfrm -! lsfrm = lwaterptr_amode(mfrm) -! lstoo = lwaterptr_amode(mtoo) - else - lsfrm = lmassptr_amode(iqfrm,mfrm) - lstoo = 0 - end if - if ((lsfrm < 1) .or. (lsfrm > pcnst)) cycle aa_iqfrm - - if (lsfrm>0 .and. iqfrm>0 ) then -! find "too" species having same lspectype_amode as the "frm" species - do iqtoo = 1, nspec_amode(mtoo) - if ( lspectype_amode(iqtoo,mtoo) .eq. & - lspectype_amode(iqfrm,mfrm) ) then - lstoo = lmassptr_amode(iqtoo,mtoo) - exit - end if - end do - end if - - if ((lstoo < 1) .or. (lstoo > pcnst)) lstoo = 0 - nspec = nspec + 1 - lspecfrm_pcage(nspec) = lsfrm - lspectoo_pcage(nspec) = lstoo - end do aa_iqfrm - - nspecfrm_pcage = nspec - -! -! output results -! - if ( masterproc ) then - - write(lunout,9310) - - mfrm = modefrm_pcage - mtoo = modetoo_pcage - write(lunout,9320) 1, mfrm, mtoo - - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq) - lstoo = lspectoo_pcage(iq) - if (lstoo .gt. 0) then - write(lunout,9330) lsfrm, cnst_name(lsfrm), & - lstoo, cnst_name(lstoo) - else - write(lunout,9340) lsfrm, cnst_name(lsfrm) - end if - end do - - write(lunout,*) - - end if ! ( masterproc ) - -9310 format( / 'subr. modal_aero_gasaerexch_init - primary carbon aging pointers' ) -9320 format( 'pair', i3, 5x, 'mode', i3, ' ---> mode', i3 ) -9330 format( 5x, 'spec', i3, '=', a, ' ---> spec', i3, '=', a ) -9340 format( 5x, 'spec', i3, '=', a, ' ---> LOSS' ) - - -15000 continue - -! set gas species indices - call cnst_get_ind( 'H2SO4', l_so4g, .false. ) - call cnst_get_ind( 'NH3', l_nh4g, .false. ) - call cnst_get_ind( 'MSA', l_msag, .false. ) - call cnst_get_ind( 'SOAG', l_soag, .false. ) - if ((l_so4g <= 0) .or. (l_so4g > pcnst)) then - write( *, '(/a/a,2i7)' ) & - '*** modal_aero_gasaerexch_init -- cannot find H2SO4 species', & - ' l_so4g=', l_so4g - call endrun( 'modal_aero_gasaerexch_init error' ) - end if - do_nh4g = .false. - do_msag = .false. - do_soag = .false. - if ((l_nh4g > 0) .and. (l_nh4g <= pcnst)) do_nh4g = .true. - if ((l_msag > 0) .and. (l_msag <= pcnst)) do_msag = .true. - if ((l_soag > 0) .and. (l_soag <= pcnst)) do_soag = .true. - -! set tendency flags - dotend(:) = .false. - dotend(l_so4g) = .true. - if ( do_nh4g ) dotend(l_nh4g) = .true. - if ( do_msag ) dotend(l_msag) = .true. - if ( do_soag ) dotend(l_soag) = .true. - do n = 1, ntot_amode - l = lptr_so4_a_amode(n) - if ((l > 0) .and. (l <= pcnst)) then - dotend(l) = .true. - if ( do_nh4g ) then - l = lptr_nh4_a_amode(n) - if ((l > 0) .and. (l <= pcnst)) dotend(l) = .true. - end if - end if - l = lptr_soa_a_amode(n) - if ((l > 0) .and. (l <= pcnst)) then - dotend(l) = .true. - end if - end do - - if (modefrm_pcage > 0) then - do iq = 1, nspecfrm_pcage - lsfrm = lspecfrm_pcage(iq) - lstoo = lspectoo_pcage(iq) - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - end do - end if - - -! define history fields for basic gas-aer exchange -! and primary carbon aging from that - do l = 1, pcnst - if ( .not. dotend(l) ) cycle - - tmpnamea = cnst_name(l) - fieldname = trim(tmpnamea) // '_sfgaex1' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange primary column tendency' - unit = 'kg/m2/s' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(*,'(3(a,3x))') 'gasaerexch addfld', fieldname, unit - - end do ! l = ... - - -! define history fields for aitken-->accum renaming - dotend(:) = .false. - dotendqqcw(:) = .false. - do ipair = 1, npair_renamexf - do iq = 1, nspecfrm_renamexf(ipair) - lsfrm = lspecfrma_renamexf(iq,ipair) - lstoo = lspectooa_renamexf(iq,ipair) - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotend(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotend(lstoo) = .true. - end if - end if - - lsfrm = lspecfrmc_renamexf(iq,ipair) - lstoo = lspectooc_renamexf(iq,ipair) - if ((lsfrm > 0) .and. (lsfrm <= pcnst)) then - dotendqqcw(lsfrm) = .true. - if ((lstoo > 0) .and. (lstoo <= pcnst)) then - dotendqqcw(lstoo) = .true. - end if - end if - end do ! iq = ... - end do ! ipair = ... - - do l = 1, pcnst - do jac = 1, 2 - if (jac == 1) then - if ( .not. dotend(l) ) cycle - tmpnamea = cnst_name(l) - else - if ( .not. dotendqqcw(l) ) cycle - tmpnamea = cnst_name_cw(l) - end if - - fieldname = trim(tmpnamea) // '_sfgaex2' - long_name = trim(tmpnamea) // ' gas-aerosol-exchange renaming column tendency' - unit = 'kg/m2/s' - if ((tmpnamea(1:3) == 'num') .or. & - (tmpnamea(1:3) == 'NUM')) unit = '#/m2/s' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(*,'(3(a,3x))') 'gasaerexch addfld', fieldname, unit - end do ! jac = ... - end do ! l = ... - - -! calculate soa_equivso4_factor -! if do_soag == .false., then set it to zero as a safety measure - soa_equivso4_factor = 0.0_r8 - if ( do_soag ) then - tmp1 = -1.0_r8 ; tmp2 = -1.0_r8 - do l = 1, ntot_aspectype - if (specname_amode(l) == 's-organic') tmp1 = spechygro(l) - if (specname_amode(l) == 'sulfate' ) tmp2 = spechygro(l) - end do - if ((tmp1 > 0.0_r8) .and. (tmp2 > 0.0_r8)) then - soa_equivso4_factor = tmp1/tmp2 - else - write(*,'(a/a,1p,2e10.2)') & - '*** subr modal_aero_gasaerexch_init', & - ' cannot find hygros - tmp1/2 =', tmp1, tmp2 - call endrun() - end if - end if - - return - end subroutine modal_aero_gasaerexch_init - - -!---------------------------------------------------------------------- - -end module modal_aero_gasaerexch - - diff --git a/MAMchem_GridComp/microphysics/modal_aero_initialize_data.F90 b/MAMchem_GridComp/microphysics/modal_aero_initialize_data.F90 deleted file mode 100644 index eea01c9f..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_initialize_data.F90 +++ /dev/null @@ -1,1386 +0,0 @@ -module modal_aero_initialize_data -#ifndef GEOS5_PORT - use cam_logfile, only : iulog - use abortutils, only: endrun - use spmd_utils, only: masterproc, iam - use ppgrid, only: pcols, pver, begchunk, endchunk - use phys_control, only: phys_getopts - use modal_aero_data - use time_manager, only: is_first_step -#else - use cam_logfile, only: iulog - use abortutils, only: endrun - - use modal_aero_data -#endif - - implicit none - private - - public :: modal_aero_register - public :: modal_aero_initialize -#ifndef GEOS5_PORT - public :: modal_aero_initialize_q -#endif - - integer :: convproc_do_aer_nl = 0 !BSINGH:02/25/2013 - logical :: HD_mods_nl = .false. !BSINGH:02/25/2013 - -contains - -#ifndef GEOS5_PORT - subroutine modal_aero_register - use constituents,only: pcnst, cnst_name - use physics_buffer, only : pbuf_add_field, dtype_r8 -#else - subroutine modal_aero_register(verbose) - use cam_logfile, only: iulog - use abortutils, only: endrun - - use constituents, only: pcnst, cnst_name -#endif - -#ifdef GEOS5_PORT - logical, intent(in) :: verbose -#endif - - !BSINGH - Following variables definitions are moved to modal_aero_data.F90 - !as they are needed for modal_aer_opt.F90 for writing modal_optics file - - !character(len=8) :: & - ! xname_massptr(maxd_aspectype,ntot_amode), & - ! xname_massptrcw(maxd_aspectype,ntot_amode) - !character(len=10) :: xname_spectype(maxd_aspectype,ntot_amode) - !BSINGH-ENDS - - ! input species to hold interstitial & activated number -#if ( defined MODAL_AERO_7MODE ) - character(len=*), parameter :: xname_numptr(ntot_amode) = (/ 'num_a1 ', 'num_a2 ', 'num_a3 ', & - 'num_a4 ', 'num_a5 ', 'num_a6 ', 'num_a7 ' /) - character(len=*), parameter :: xname_numptrcw(ntot_amode) = (/ 'num_c1 ', 'num_c2 ', 'num_c3 ', & - 'num_c4 ', 'num_c5 ', 'num_c6 ', 'num_c7 ' /) -#elif ( defined MODAL_AERO_4MODE ) - character(len=*), parameter :: xname_numptr(ntot_amode) = (/ 'num_a1 ', 'num_a2 ', 'num_a3 ', & - 'num_a4 ' /) - character(len=*), parameter :: xname_numptrcw(ntot_amode) = (/ 'num_c1 ', 'num_c2 ', 'num_c3 ', & - 'num_c4 '/) -#elif ( defined MODAL_AERO_3MODE ) - character(len=*), parameter :: xname_numptr(ntot_amode) = (/ 'num_a1 ', 'num_a2 ', & - 'num_a3 ' /) - character(len=*), parameter :: xname_numptrcw(ntot_amode) = (/ 'num_c1 ', 'num_c2 ', & - 'num_c3 ' /) -#endif - -#ifdef GEOS5_PORT - logical :: masterproc - - logical :: HD_mods - integer :: convproc_do_aer -#endif - - - integer :: m, l, iptr - character(len=3) :: trnum ! used to hold mode number (as characters) - -#ifndef GEOS5_PORT - !BSINGH:02/25/2013: Get HD_mods from namelist - call phys_getopts (HD_mods_out = HD_mods_nl, convproc_do_aer_out = convproc_do_aer_nl) - HD_mods = HD_mods_nl - convproc_do_aer = convproc_do_aer_nl -#else - HD_mods = .false. - convproc_do_aer = 0 - - masterproc = verbose -#endif - write(iulog,*)'HD_mods is: ', HD_mods - write(iulog,*)'convproc_do_aer is:', convproc_do_aer - - - ! input species to hold aerosol water and "kohler-c" - ! xname_waterptr(:ntot_amode) = (/ 'wat_a1 ', 'wat_a2 ', 'wat_a3 ', & - ! 'wat_a4 ', 'wat_a5 ', 'wat_a6 ', 'wat_a7 ' /) - ! input chemical species for the mode - ! mode 1 (accumulation) species - ! JPE 02022011: These could also be parameters but a bug in the pathscale compiler prevents - ! parameter initialization of 2D variables -#if ( defined MODAL_AERO_7MODE ) -!BSINGH - Added cl and no3 for mosaic model -#ifndef MOSAIC_SPECIES - xname_massptr(:nspec_amode(1),1) = (/ 'so4_a1 ', 'nh4_a1 ', & - 'pom_a1 ', 'soa_a1 ', 'bc_a1 ', 'ncl_a1 ' /) - xname_massptrcw(:nspec_amode(1),1) = (/ 'so4_c1 ', 'nh4_c1 ', & - 'pom_c1 ', 'soa_c1 ', 'bc_c1 ', 'ncl_c1 ' /) - xname_spectype(:nspec_amode(1),1) = (/ 'sulfate ', 'ammonium ', & - 'p-organic ', 's-organic ', 'black-c ', 'seasalt ' /) -#else - xname_massptr(:nspec_amode(1),1) = (/ 'so4_a1 ', 'nh4_a1 ', & - 'pom_a1 ', 'soa_a1 ', 'bc_a1 ', 'ncl_a1 ', 'cl_a1 ', 'no3_a1 '/) - xname_massptrcw(:nspec_amode(1),1) = (/ 'so4_c1 ', 'nh4_c1 ', & - 'pom_c1 ', 'soa_c1 ', 'bc_c1 ', 'ncl_c1 ', 'cl_c1 ', 'no3_c1 ' /) - xname_spectype(:nspec_amode(1),1) = (/ 'sulfate ', 'ammonium ', & - 'p-organic ', 's-organic ', 'black-c ', 'seasalt ', 'seasalt ', 'sulfate ' /) -#endif - -#elif ( defined MODAL_AERO_4MODE ) -#ifndef MOSAIC_SPECIES - - xname_massptr(:nspec_amode(1),1) = (/ 'so4_a1 ', & - 'pom_a1 ', 'soa_a1 ', 'bc_a1 ', & - 'dst_a1 ', 'ncl_a1 ' /) - xname_massptrcw(:nspec_amode(1),1) = (/ 'so4_c1 ', & - 'pom_c1 ', 'soa_c1 ', 'bc_c1 ', & - 'dst_c1 ', 'ncl_c1 ' /) - xname_spectype(:nspec_amode(1),1) = (/ 'sulfate ', & - 'p-organic ', 's-organic ', 'black-c ', & - 'dust ', 'seasalt ' /) - - -#else - - xname_massptr(:nspec_amode(1),1) = (/ 'so4_a1 ', & - 'pom_a1 ', 'soa_a1 ', 'bc_a1 ', & - 'dst_a1 ' , 'ncl_a1 ' , 'ca_a1 ' , 'co3_a1 ' , 'cl_a1 ', 'no3_a1 ','nh4_a1 ' /) - xname_massptrcw(:nspec_amode(1),1) = (/ 'so4_c1 ', & - 'pom_c1 ', 'soa_c1 ', 'bc_c1 ', & - 'dst_c1 ', 'ncl_c1 ', 'ca_c1 ', 'co3_c1 ' , 'cl_c1 ', 'no3_c1 ','nh4_c1 ' /) - xname_spectype(:nspec_amode(1),1) = (/ 'sulfate ', & - 'p-organic ', 's-organic ', 'black-c ', & - 'dust ','seasalt ', 'dust ','dust ', 'seasalt ', 'sulfate ','ammonium ' /) - - -#endif - -#elif ( defined MODAL_AERO_3MODE ) - xname_massptr(:nspec_amode(1),1) = (/ 'so4_a1 ', & - 'pom_a1 ', 'soa_a1 ', 'bc_a1 ', & - 'dst_a1 ', 'ncl_a1 ' /) - xname_massptrcw(:nspec_amode(1),1) = (/ 'so4_c1 ', & - 'pom_c1 ', 'soa_c1 ', 'bc_c1 ', & - 'dst_c1 ', 'ncl_c1 ' /) - xname_spectype(:nspec_amode(1),1) = (/ 'sulfate ', & - 'p-organic ', 's-organic ', 'black-c ', & - 'dust ', 'seasalt ' /) -#endif - - ! mode 2 (aitken) species -#if ( defined MODAL_AERO_7MODE ) -!BSINGH - Added cl and no3 for mosaic model -#ifndef MOSAIC_SPECIES - xname_massptr(:nspec_amode(2),2) = (/ 'so4_a2 ', 'nh4_a2 ', & - 'soa_a2 ', 'ncl_a2 ' /) - xname_massptrcw(:nspec_amode(2),2) = (/ 'so4_c2 ', 'nh4_c2 ', & - 'soa_c2 ', 'ncl_c2 ' /) - xname_spectype(:nspec_amode(2),2) = (/ 'sulfate ', 'ammonium ', & - 's-organic ', 'seasalt '/) -#else - xname_massptr(:nspec_amode(2),2) = (/ 'so4_a2 ', 'nh4_a2 ', & - 'soa_a2 ', 'ncl_a2 ', 'cl_a2 ', 'no3_a2 ' /) - xname_massptrcw(:nspec_amode(2),2) = (/ 'so4_c2 ', 'nh4_c2 ', & - 'soa_c2 ', 'ncl_c2 ', 'cl_c2 ', 'no3_c2 ' /) - xname_spectype(:nspec_amode(2),2) = (/ 'sulfate ', 'ammonium ', & - 's-organic ', 'seasalt ', 'seasalt ', 'sulfate ' /) -#endif - -#elif ( defined MODAL_AERO_4MODE ) -#ifndef MOSAIC_SPECIES - xname_massptr(:nspec_amode(2),2) = (/ 'so4_a2 ', & - 'soa_a2 ', 'ncl_a2 ' /) - xname_massptrcw(:nspec_amode(2),2) = (/ 'so4_c2 ', & - 'soa_c2 ', 'ncl_c2 ' /) - xname_spectype(:nspec_amode(2),2) = (/ 'sulfate ', & - 's-organic ', 'seasalt ' /) - - -#else - xname_massptr(:nspec_amode(2),2) = (/ 'so4_a2 ', & - 'soa_a2 ', 'ncl_a2 ','cl_a2 ', 'no3_a2 ', 'nh4_a2 '/) - xname_massptrcw(:nspec_amode(2),2) = (/ 'so4_c2 ', & - 'soa_c2 ', 'ncl_c2 ','cl_c2 ', 'no3_c2 ', 'nh4_c2 ' /) - xname_spectype(:nspec_amode(2),2) = (/ 'sulfate ', & - 's-organic ', 'seasalt ','seasalt ', 'sulfate ', 'ammonium ' /) - - -#endif - -#elif ( defined MODAL_AERO_3MODE ) - xname_massptr(:nspec_amode(2),2) = (/ 'so4_a2 ', & - 'soa_a2 ', 'ncl_a2 ' /) - xname_massptrcw(:nspec_amode(2),2) = (/ 'so4_c2 ', & - 'soa_c2 ', 'ncl_c2 ' /) - xname_spectype(:nspec_amode(2),2) = (/ 'sulfate ', & - 's-organic ', 'seasalt ' /) -#endif - -#if ( defined MODAL_AERO_7MODE ) - ! mode 3 (primary carbon) species - xname_massptr(:nspec_amode(3),3) = (/ 'pom_a3 ', 'bc_a3 ' /) - xname_massptrcw(:nspec_amode(3),3) = (/ 'pom_c3 ', 'bc_c3 ' /) - xname_spectype(:nspec_amode(3),3) = (/ 'p-organic ', 'black-c ' /) - -#elif ( defined MODAL_AERO_4MODE ) - ! mode 3 (coarse dust & seasalt) species -#ifndef MOSAIC_SPECIES - xname_massptr(:nspec_amode(3),3) = (/ 'dst_a3 ', 'ncl_a3 ', 'so4_a3 ' /) - xname_massptrcw(:nspec_amode(3),3) = (/ 'dst_c3 ', 'ncl_c3 ', 'so4_c3 ' /) - xname_spectype(:nspec_amode(3),3) = (/ 'dust ', 'seasalt ', 'sulfate ' /) -#else - xname_massptr(:nspec_amode(3),3) = (/ 'dst_a3 ', 'ncl_a3 ', 'so4_a3 ', 'ca_a3 ', 'co3_a3 ' , 'cl_a3 ', 'no3_a3 ', 'nh4_a3 ' /) - xname_massptrcw(:nspec_amode(3),3) = (/ 'dst_c3 ', 'ncl_c3 ', 'so4_c3 ', 'ca_c3 ', 'co3_c3 ' , 'cl_c3 ', 'no3_c3 ', 'nh4_c3 ' /) - xname_spectype(:nspec_amode(3),3) = (/ 'dust ', 'seasalt ', 'sulfate ','dust ','dust ', 'seasalt ', 'sulfate ','ammonium ' /) -#endif - -#elif ( defined MODAL_AERO_3MODE ) - ! mode 3 (coarse dust & seasalt) species - xname_massptr(:nspec_amode(3),3) = (/ 'dst_a3 ', 'ncl_a3 ', 'so4_a3 ' /) - xname_massptrcw(:nspec_amode(3),3) = (/ 'dst_c3 ', 'ncl_c3 ', 'so4_c3 ' /) - xname_spectype(:nspec_amode(3),3) = (/ 'dust ', 'seasalt ', 'sulfate ' /) -#endif - - -#if ( defined MODAL_AERO_4MODE ) - !mode 4 in mam4, primary carbon mode - xname_massptr(:nspec_amode(4),4) = (/ 'pom_a4 ', 'bc_a4 ' /) - xname_massptrcw(:nspec_amode(4),4) = (/ 'pom_c4 ', 'bc_c4 ' /) - xname_spectype(:nspec_amode(4),4) = (/ 'p-organic ', 'black-c ' /) -#endif - -#if ( defined MODAL_AERO_7MODE ) -!BSINGH - Added ca, co3, cl and no3 for mosaic model -#ifndef MOSAIC_SPECIES - ! mode 4 (fine seasalt) species - xname_massptr(:nspec_amode(4),4) = (/ 'ncl_a4 ', 'so4_a4 ', 'nh4_a4 ' /) - xname_massptrcw(:nspec_amode(4),4) = (/ 'ncl_c4 ', 'so4_c4 ', 'nh4_c4 ' /) - xname_spectype(:nspec_amode(4),4) = (/ 'seasalt ', 'sulfate ', 'ammonium ' /) - - ! mode 5 (fine dust) species - xname_massptr(:nspec_amode(5),5) = (/ 'dst_a5 ', 'so4_a5 ', 'nh4_a5 ' /) - xname_massptrcw(:nspec_amode(5),5) = (/ 'dst_c5 ', 'so4_c5 ', 'nh4_c5 ' /) - xname_spectype(:nspec_amode(5),5) = (/ 'dust ', 'sulfate ', 'ammonium ' /) - - ! mode 6 (coarse seasalt) species - xname_massptr(:nspec_amode(6),6) = (/ 'ncl_a6 ', 'so4_a6 ', 'nh4_a6 ' /) - xname_massptrcw(:nspec_amode(6),6) = (/ 'ncl_c6 ', 'so4_c6 ', 'nh4_c6 ' /) - xname_spectype(:nspec_amode(6),6) = (/ 'seasalt ', 'sulfate ', 'ammonium ' /) - - ! mode 7 (coarse dust) species - xname_massptr(:nspec_amode(7),7) = (/ 'dst_a7 ', 'so4_a7 ', 'nh4_a7 ' /) - xname_massptrcw(:nspec_amode(7),7) = (/ 'dst_c7 ', 'so4_c7 ', 'nh4_c7 ' /) - xname_spectype(:nspec_amode(7),7) = (/ 'dust ', 'sulfate ', 'ammonium ' /) -#else - ! mode 4 (fine seasalt) species - xname_massptr(:nspec_amode(4),4) = (/ 'ncl_a4 ', 'so4_a4 ', 'nh4_a4 ', 'cl_a4 ', 'no3_a4 ' /) - xname_massptrcw(:nspec_amode(4),4) = (/ 'ncl_c4 ', 'so4_c4 ', 'nh4_c4 ', 'cl_c4 ', 'no3_c4 '/) - xname_spectype(:nspec_amode(4),4) = (/ 'seasalt ', 'sulfate ', 'ammonium ', 'seasalt ', 'sulfate ' /) - - ! mode 5 (fine dust) species - xname_massptr(:nspec_amode(5),5) = (/ 'dst_a5 ', 'so4_a5 ', 'nh4_a5 ', 'ca_a5 ', 'co3_a5 ', 'cl_a5 ', 'no3_a5 '/) - xname_massptrcw(:nspec_amode(5),5) = (/ 'dst_c5 ', 'so4_c5 ', 'nh4_c5 ', 'ca_c5 ', 'co3_c5 ', 'cl_c5 ', 'no3_c5 '/) - xname_spectype(:nspec_amode(5),5) = (/ 'dust ', 'sulfate ', 'ammonium ','dust ','dust ', 'seasalt ', 'sulfate '/) - - ! mode 6 (coarse seasalt) species - xname_massptr(:nspec_amode(6),6) = (/ 'ncl_a6 ', 'so4_a6 ', 'nh4_a6 ', 'cl_a6 ', 'no3_a6 ' /) - xname_massptrcw(:nspec_amode(6),6) = (/ 'ncl_c6 ', 'so4_c6 ', 'nh4_c6 ', 'cl_c6 ', 'no3_c6 ' /) - xname_spectype(:nspec_amode(6),6) = (/ 'seasalt ', 'sulfate ', 'ammonium ', 'seasalt ', 'sulfate ' /) - - ! mode 7 (coarse dust) species - xname_massptr(:nspec_amode(7),7) = (/ 'dst_a7 ', 'so4_a7 ', 'nh4_a7 ', 'ca_a7 ', 'co3_a7 ' , 'cl_a7 ', 'no3_a7 '/) - xname_massptrcw(:nspec_amode(7),7) = (/ 'dst_c7 ', 'so4_c7 ', 'nh4_c7 ', 'ca_c7 ', 'co3_c7 ' , 'cl_c7 ', 'no3_c7 '/) - xname_spectype(:nspec_amode(7),7) = (/ 'dust ', 'sulfate ', 'ammonium ','dust ','dust ', 'seasalt ', 'sulfate ' /) -#endif -#endif - - if(HD_mods) then !BSINGH - initialize species class (for HD_mods) - species_class(:pcnst) = spec_class_undefined !RCE - endif - - do m = 1, ntot_amode - - if (masterproc) then - write(iulog,9231) m, modename_amode(m) - write(iulog,9232) & - 'nspec ', & - nspec_amode(m) - write(iulog,9232) & - 'mprognum, mdiagnum, mprogsfc', & - mprognum_amode(m), mdiagnum_amode(m), mprogsfc_amode(m) - write(iulog,9232) & - 'mcalcwater ', & - mcalcwater_amode(m) - endif - - ! define species to hold interstitial & activated number - call search_list_of_names( & - xname_numptr(m), numptr_amode(m), cnst_name, pcnst ) - if (numptr_amode(m) .le. 0) then - write(iulog,9061) 'xname_numptr', xname_numptr(m), m - call endrun() - end if - if (numptr_amode(m) .gt. pcnst) then - write(iulog,9061) 'numptr_amode', numptr_amode(m), m - write(iulog,9061) 'xname_numptr', xname_numptr(m), m - call endrun() - end if - - species_class(numptr_amode(m)) = spec_class_aerosol - - - numptrcw_amode(m) = numptr_amode(m) !use the same index for Q and QQCW arrays - if (numptrcw_amode(m) .le. 0) then - write(iulog,9061) 'xname_numptrcw', xname_numptrcw(m), m - call endrun() - end if - if (numptrcw_amode(m) .gt. pcnst) then - write(iulog,9061) 'numptrcw_amode', numptrcw_amode(m), m - write(iulog,9061) 'xname_numptrcw', xname_numptrcw(m), m - call endrun() - end if - species_class(numptrcw_amode(m)) = spec_class_aerosol - -#ifndef GEOS5_PORT - call pbuf_add_field(xname_numptrcw(m),'global',dtype_r8,(/pcols,pver/),iptr) - call qqcw_set_ptr(numptrcw_amode(m),iptr) -#endif - - ! output mode information - if ( masterproc ) then - write(iulog,9233) 'numptr ', & - numptr_amode(m), xname_numptr(m) - write(iulog,9233) 'numptrcw ', & - numptrcw_amode(m), xname_numptrcw(m) - end if - - - ! define the chemical species for the mode - do l = 1, nspec_amode(m) - - call search_list_of_names( & - xname_spectype(l,m), lspectype_amode(l,m), & - specname_amode, ntot_aspectype ) - if (lspectype_amode(l,m) .le. 0) then - write(iulog,9062) 'xname_spectype', xname_spectype(l,m), l, m - call endrun() - end if - - call search_list_of_names( & - xname_massptr(l,m), lmassptr_amode(l,m), cnst_name, pcnst ) - if (lmassptr_amode(l,m) .le. 0) then - write(iulog,9062) 'xname_massptr', xname_massptr(l,m), l, m - call endrun() - end if - species_class(lmassptr_amode(l,m)) = spec_class_aerosol - - lmassptrcw_amode(l,m) = lmassptr_amode(l,m) !use the same index for Q and QQCW arrays - if (lmassptrcw_amode(l,m) .le. 0) then - write(iulog,9062) 'xname_massptrcw', xname_massptrcw(l,m), l, m - call endrun() - end if - -#ifndef GEOS5_PORT - call pbuf_add_field(xname_massptrcw(l,m),'global',dtype_r8,(/pcols,pver/),iptr) - call qqcw_set_ptr(lmassptrcw_amode(l,m), iptr) -#endif - species_class(lmassptrcw_amode(l,m)) = spec_class_aerosol - - if ( masterproc ) then - write(iulog,9236) 'spec, spectype ', l, & - lspectype_amode(l,m), xname_spectype(l,m) - write(iulog,9236) 'spec, massptr ', l, & - lmassptr_amode(l,m), xname_massptr(l,m) - write(iulog,9236) 'spec, massptrcw', l, & - lmassptrcw_amode(l,m), xname_massptrcw(l,m) - end if - - enddo - - if ( masterproc ) write(iulog,*) - -#ifndef GEOS5_PORT - ! set names for aodvis and ssavis - write(unit=trnum,fmt='(i3)') m+100 - aodvisname(m) = 'AODVIS'//trnum(2:3) - aodvislongname(m) = 'Aerosol optical depth for mode '//trnum(2:3) - ssavisname(m) = 'SSAVIS'//trnum(2:3) - ssavislongname(m) = 'Single-scatter albedo for mode '//trnum(2:3) - fnactname(m) = 'FNACT'//trnum(2:3) - fnactlongname(m) = 'Number faction activated for mode '//trnum(2:3) - fmactname(m) = 'FMACT'//trnum(2:3) - fmactlongname(m) = 'Fraction mass activated for mode'//trnum(2:3) -#endif - end do - - if (masterproc) write(iulog,9230) -9230 format( // '*** init_aer_modes mode definitions' ) -9231 format( 'mode = ', i4, ' = "', a, '"' ) -9232 format( 4x, a, 4(1x, i5 ) ) -9233 format( 4x, a15, 4x, i7, '="', a, '"' ) -9236 format( 4x, a15, i4, i7, '="', a, '"' ) -9061 format( '*** subr init_aer_modes - bad ', a / & - 5x, 'name, m = ', a, 5x, i5 ) -9062 format( '*** subr init_aer_modesaeromodeinit - bad ', a / & - 5x, 'name, l, m = ', a, 5x, 2i5 ) - - end subroutine modal_aero_register - - - !============================================================== -#ifndef GEOS5_PORT - subroutine modal_aero_initialize(pbuf2d, imozart) - - use cam_history, only: addfld, add_default, phys_decomp - use constituents, only: pcnst - use physconst, only: rhoh2o, mwh2o - use modal_aero_amicphys, only: modal_aero_amicphys_init - use module_mosaic_cam_init,only: mosaic_cam_init - use modal_aero_calcsize, only: modal_aero_calcsize_init - use modal_aero_coag, only: modal_aero_coag_init - use modal_aero_deposition, only: modal_aero_deposition_init - use modal_aero_gasaerexch, only: modal_aero_gasaerexch_init - use modal_aero_newnuc, only: modal_aero_newnuc_init - use modal_aero_rename, only: modal_aero_rename_init - use mz_aerosols_intr, only: modal_aero_bcscavcoef_init - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_props, & - rad_cnst_get_mode_props - use aerodep_flx, only: aerodep_flx_prescribed - use physics_buffer, only: physics_buffer_desc, pbuf_get_chunk - - !BSINGH - added for HD_mods - use chem_mods, only: gas_pcnst !RCE - use modal_aero_convproc, only: ma_convproc_init !RCE - - !BSINGH (06/26/2014)- For amicphys with MOZART chemsitry - use phys_control, only: cam_chempkg_is -#else - subroutine modal_aero_initialize(imozart, sigma, dgn, dgn_low, dgn_hi, rh_crystal, rh_deliques, spec_dens, spec_hygro, verbose) - use chem_mods, only: gas_pcnst !RCE - use modal_aero_amicphys, only: modal_aero_amicphys_init - use module_mosaic_cam_init,only: mosaic_cam_init - use modal_aero_calcsize, only: modal_aero_calcsize_init - use modal_aero_newnuc, only: modal_aero_newnuc_init -! use wetdep, only: modal_aero_bcscavcoef_init -#endif - - implicit none - - !-------------------------------------------------------------- - ! ... arguments - !-------------------------------------------------------------- -#ifndef GEOS5_PORT - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - integer, intent(in) :: imozart !RCE !BSINGH - added for HD_mods -#else - integer, intent(in) :: imozart - logical, intent(in) :: verbose - - real(r8), intent(in) :: sigma(ntot_amode) - real(r8), intent(in) :: dgn(ntot_amode) - real(r8), intent(in) :: dgn_low(ntot_amode) - real(r8), intent(in) :: dgn_hi(ntot_amode) - real(r8), intent(in) :: rh_crystal(ntot_amode) - real(r8), intent(in) :: rh_deliques(ntot_amode) - real(r8), intent(in) :: spec_dens(ntot_aspectype) - real(r8), intent(in) :: spec_hygro(ntot_aspectype) -#endif - - !-------------------------------------------------------------- - ! ... local variables - !-------------------------------------------------------------- - integer :: l, m, i, lchnk - integer :: m_idx, s_idx - - character(len=3) :: trnum ! used to hold mode number (as characters) - integer :: iaerosol, ibulk, tot_spec - integer :: numaerosols ! number of bulk aerosols in climate list - character(len=20) :: bulkname, num2str - real(r8) :: pi - complex(r8), pointer :: refindex_aer_sw(:), & - refindex_aer_lw(:) - real(r8), pointer :: qqcw(:,:) - real(r8), parameter :: huge_r8 = huge(1._r8) - character(len=*), parameter :: routine='modal_aero_initialize' - logical :: history_aerosol ! Output the MAM aerosol tendencies -#ifdef GEOS5_PORT - logical :: masterproc - masterproc = verbose -#endif - !----------------------------------------------------------------------- - - pi = 4._r8*atan(1._r8) - -#ifndef GEOS5_PORT - call phys_getopts( history_aerosol_out = history_aerosol ) -#else - history_aerosol = .true. -#endif - - ! safety check on modal_aero, and modal_aero_3mode, modal_aero_7mode -!BSINGH -- commented the following for MAM4 - -!#if ( defined MODAL_AERO_3MODE ) && ( defined MODAL_AERO_7MODE ) -! call endrun( 'Error - when modal_aero defined, just 1 of modal_aero_3/7mode must be defined' -!#elif ( ! ( defined MODAL_AERO_3MODE ) ) && ( ! ( defined MODAL_AERO_7MODE ) ) -! call endrun( 'Error - when modal_aero defined, at least 1 of modal_aero_3/7mode must be defined' -!#endif - - i= 0 -#if ( defined MODAL_AERO_3MODE ) - i=i+1 -#endif - -#if ( defined MODAL_AERO_4MODE ) - i=i+1 -#endif - -#if ( defined MODAL_AERO_7MODE ) - i=i+1 -#endif - - if (i > 1) & - call endrun( 'Error - when modal_aero defined, just 1 of modal_aero_3/7mode must be defined') - if (i == 0) & - call endrun( 'Error - when modal_aero defined, at least 1 of modal_aero_3/7mode must be defined') - - - - !Sanity check for HD_mods-BSINGH - if(HD_mods)then - write(num2str,*)convproc_do_aer - if(convproc_do_aer .NE. 1)call endrun('If HD_mods is TRUE then convproc_do_aer should be 1, convproc_do_aer=' // num2str) - endif - - ! Mode specific properties. - do m = 1, ntot_amode -#ifndef GEOS5_PORT - call rad_cnst_get_mode_props(0, m, & - sigmag=sigmag_amode(m), dgnum=dgnum_amode(m), dgnumlo=dgnumlo_amode(m), & - dgnumhi=dgnumhi_amode(m), rhcrystal=rhcrystal_amode(m), rhdeliques=rhdeliques_amode(m)) -#else - ! GET these from MAM7_DataMod or MAM3_DataMod - sigmag_amode(m) = sigma(m) - dgnum_amode(m) = dgn(m) - dgnumlo_amode(m) = dgn_low(m) - dgnumhi_amode(m) = dgn_hi(m) -#endif - - ! compute frequently used parameters: ln(sigmag), - ! volume-to-number and volume-to-surface conversions, ... - alnsg_amode(m) = log( sigmag_amode(m) ) - - voltonumb_amode(m) = 1._r8 / ( (pi/6._r8)* & - (dgnum_amode(m)**3._r8)*exp(4.5_r8*alnsg_amode(m)**2._r8) ) - voltonumblo_amode(m) = 1._r8 / ( (pi/6._r8)* & - (dgnumlo_amode(m)**3._r8)*exp(4.5_r8*alnsg_amode(m)**2._r8) ) - voltonumbhi_amode(m) = 1._r8 / ( (pi/6._r8)* & - (dgnumhi_amode(m)**3._r8)*exp(4.5_r8*alnsg_amode(m)**2._r8) ) - - alnv2n_amode(m) = log( voltonumb_amode(m) ) - alnv2nlo_amode(m) = log( voltonumblo_amode(m) ) - alnv2nhi_amode(m) = log( voltonumbhi_amode(m) ) - end do - - - ! Properties of mode specie types. - - ! values from Koepke, Hess, Schult and Shettle, Global Aerosol Data Set - ! Report #243, Max-Planck Institute for Meteorology, 1997a - ! See also Hess, Koepke and Schult, Optical Properties of Aerosols and Clouds (OPAC) - ! BAMS, 1998. - - ! specrefndxsw(:ntot_aspectype) = (/ (1.53, 0.01), (1.53, 0.01), (1.53, 0.01), & - ! (1.55, 0.01), (1.55, 0.01), (1.90, 0.60), & - ! (1.50, 1.0e-8), (1.50, 0.005) /) - ! specrefndxlw(:ntot_aspectype) = (/ (2.0, 0.5), (2.0, 0.5), (2.0, 0.5), & - ! (1.7, 0.5), (1.7, 0.5), (2.22, 0.73), & - ! (1.50, 0.02), (2.6, 0.6) /) - ! get refractive indices from phys_prop files - -#ifndef GEOS5_PORT - ! The following use of the rad_constituent interfaces makes the assumption that the - ! prognostic modes are used in the mode climate (index 0) list. - do l = 1, ntot_aspectype - - ! specname_amode is the species type. This info call will return the mode and species - ! indices of the first occurance of the species type. - call rad_cnst_get_info(0, specname_amode(l), mode_idx=m_idx, spec_idx=s_idx) - - if (m_idx > 0 .and. s_idx > 0) then - - call rad_cnst_get_aer_props(0, m_idx, s_idx, & - refindex_aer_sw=refindex_aer_sw, & - refindex_aer_lw=refindex_aer_lw, & - density_aer=specdens_amode(l), & - hygro_aer=spechygro(l)) - - specrefndxsw(:nswbands,l) = refindex_aer_sw(:nswbands) - specrefndxlw(:nlwbands,l) = refindex_aer_lw(:nlwbands) - - else - if (masterproc) then - write(iulog,*) routine//': INFO: props not found for species type: ',trim(specname_amode(l)) - end if - specdens_amode(l) = huge_r8 - spechygro(l) = huge_r8 - specrefndxsw(:nswbands,l) = (huge_r8, huge_r8) - specrefndxlw(:nlwbands,l) = (huge_r8, huge_r8) - endif - - end do -#else - specdens_amode(:maxd_aspectype) = huge_r8 - spechygro(:maxd_aspectype) = huge_r8 - - specdens_amode(:ntot_aspectype) = spec_dens - spechygro(:ntot_aspectype) = spec_hygro -#endif - - - if (masterproc) write(iulog,9210) - do l = 1, ntot_aspectype - ! spechygro(l) = specnu(l)*specphi(l)*specsolfrac(l)*mwh2o*specdens_amode(l) / & - ! (rhoh2o*specmw_amode(l)) - if (masterproc) then - write(iulog,9211) l - write(iulog,9212) 'name ', specname_amode(l) - write(iulog,9213) 'density, MW ', & - specdens_amode(l), specmw_amode(l) - write(iulog,9213) 'hygro', spechygro(l) -#ifndef GEOS5_PORT - do i=1,nswbands - write(iulog,9213) 'ref index sw ', (specrefndxsw(i,l)) - end do - do i=1,nlwbands - write(iulog,9213) 'ref index ir ', (specrefndxlw(i,l)) - end do -#endif - end if - end do - -9210 format( // '*** init_aer_modes aerosol species-types' ) -9211 format( 'spectype =', i4) -9212 format( 4x, a, 3x, '"', a, '"' ) -9213 format( 4x, a, 5(1pe14.5) ) - - - - - !if (HD_mods) then !BSINGH - added for HD mods - Commented out(06/26/2014) as species_class is used in amicphys code - !RCE - ! The following is incorrect because it overwrites values set in modal_aero_register, - ! which is called before modal_aero_init - ! do i = 1, pcnst - ! species_class(i) = spec_class_undefined - ! end do - ! At this point, species_class is either undefined or aerosol. - ! For the "chemistry species" (imozart <= i <= imozart+gas_pcnst-1), - ! set the undefined ones to gas, and leave the aerosol ones as is - - !BSINGH (06/26/2014) - In MOZART chemistry, H2O species exists in the Q array which is mapped back to state%q(:,:,1) [water vapor] - !To accomodate that, MOZART chemistry is treated as a special case here - - !To verfy imozart - tot_spec = imozart+gas_pcnst-1 !BSINGH- Total # of species computed using imozart and gas_cnst - !Special case for MOZART chemistry -#ifndef GEOS5_PORT - if(cam_chempkg_is('trop_strat_mam7')) tot_spec = imozart+gas_pcnst-2 !BSINGH - We might have to add trop_strat_mam3, haven't tested yet!! - if(cam_chempkg_is('trop_strat_mam4')) tot_spec = imozart+gas_pcnst-2 -#endif - - if (imozart <= 0) then - call endrun( '*** modal_aero_initialize_data -- bad imozart' ) - else if (tot_spec .ne. pcnst) then - write(iulog,*) gas_pcnst, tot_spec, pcnst, imozart - call endrun( '*** modal_aero_initialize_data -- bad imozart+gas_pcnst-1' ) - end if - do i = imozart, tot_spec - if (species_class(i) == spec_class_undefined) then - species_class(i) = spec_class_gas - end if - end do - !BSINGH - - Commented out following else command (06/26/2014) as species_class is used in amicphys code - !else - ! do i = 1, pcnst - ! species_class(i) = spec_class_undefined - ! end do - !endif - !BSINGH -ENDS (06/26/2014) - - - - ! set cnst_name_cw -#ifndef GEOS5_PORT - call initaermodes_set_cnstnamecw() -#else - call initaermodes_set_cnstnamecw(verbose) -#endif - - - ! - ! set the lptr_so4_a_amode(m), lptr_so4_cw_amode(m), ... - ! -#ifndef GEOS5_PORT - call initaermodes_setspecptrs -#else - call initaermodes_setspecptrs(verbose) -#endif - - if ( masterproc ) write(iulog,*) - - -#ifndef GEOS5_PORT - ! - ! add to history - ! - do m = 1, ntot_amode - - l = lptr_so4_cw_amode(m) - if (l > 0) then - call addfld (& - trim(cnst_name_cw(l))//'AQSO4','kg/m2/s ',1, 'A', & - trim(cnst_name_cw(l))//' aqueous phase chemistry',phys_decomp) - call addfld (& - trim(cnst_name_cw(l))//'AQH2SO4','kg/m2/s ',1, 'A', & - trim(cnst_name_cw(l))//' aqueous phase chemistry',phys_decomp) - if ( history_aerosol ) then - call add_default (trim(cnst_name_cw(l))//'AQSO4', 1, ' ') - call add_default (trim(cnst_name_cw(l))//'AQH2SO4', 1, ' ') - endif - end if - - end do - - call addfld ('AQSO4_H2O2','kg/m2/s ',1, 'A', & - 'SO4 aqueous phase chemistry due to H2O2',phys_decomp) - call addfld ('AQSO4_O3','kg/m2/s ',1, 'A', & - 'SO4 aqueous phase chemistry due to O3',phys_decomp) - call addfld( 'XPH_LWC','kg/kg ',pver, 'A', & - 'pH value multiplied by lwc', phys_decomp) - - if ( history_aerosol ) then - call add_default ('AQSO4_H2O2', 1, ' ') - call add_default ('AQSO4_O3', 1, ' ') - call add_default ('XPH_LWC', 1, ' ') - endif -#endif - - - ! - ! set threshold for reporting negatives from subr qneg3 - ! for aerosol number species set this to - ! 1e3 #/kg ~= 1e-3 #/cm3 for accum, aitken, pcarbon, ufine modes - ! 3e1 #/kg ~= 3e-5 #/cm3 for fineseas and finedust modes - ! 1e0 #/kg ~= 1e-6 #/cm3 for other modes which are coarse - ! for other species, set this to zero so that it will be ignored - ! by qneg3 - ! - if ( masterproc ) write(iulog,'(/a)') & - 'mode, modename_amode, qneg3_worst_thresh_amode' - qneg3_worst_thresh_amode(:) = 0.0_r8 - do m = 1, ntot_amode - l = numptr_amode(m) - if ((l <= 0) .or. (l > pcnst)) cycle - - if (m == modeptr_accum) then - qneg3_worst_thresh_amode(l) = 1.0e3_r8 - else if (m == modeptr_aitken) then - qneg3_worst_thresh_amode(l) = 1.0e3_r8 - else if (m == modeptr_pcarbon) then - qneg3_worst_thresh_amode(l) = 1.0e3_r8 - else if (m == modeptr_ufine) then - qneg3_worst_thresh_amode(l) = 1.0e3_r8 - - else if (m == modeptr_fineseas) then - qneg3_worst_thresh_amode(l) = 3.0e1_r8 - else if (m == modeptr_finedust) then - qneg3_worst_thresh_amode(l) = 3.0e1_r8 - - else - qneg3_worst_thresh_amode(l) = 1.0e0_r8 - end if - - if ( masterproc ) write(iulog,'(i3,2x,a,1p,e12.3)') & - m, modename_amode(m), qneg3_worst_thresh_amode(l) - end do - - - ! - ! call other initialization routines - ! - if (mam_amicphys_optaa >= 100) then -#ifndef GEOS5_PORT - call modal_aero_calcsize_init - call modal_aero_newnuc_init - call modal_aero_amicphys_init( imozart ) - call mosaic_cam_init() -#else - call modal_aero_calcsize_init(verbose) - call modal_aero_newnuc_init - call modal_aero_amicphys_init( imozart, verbose ) - call mosaic_cam_init(verbose) -#endif - else -#ifndef GEOS5_PORT - call modal_aero_rename_init - ! calcsize call must follow rename call - call modal_aero_calcsize_init - call modal_aero_gasaerexch_init - ! coag call must follow gasaerexch call - call modal_aero_coag_init - call modal_aero_newnuc_init -#else - call endrun("This code path is depricated. Please set parameter 'mam_amicphys_optaa' to 100 or larger number.") -#endif - end if - - -#ifndef GEOS5_PORT - call modal_aero_bcscavcoef_init - - ! call modal_aero_deposition_init only if the user has not specified - ! prescribed aerosol deposition fluxes - if (.not.aerodep_flx_prescribed()) then - call modal_aero_deposition_init - endif - - if (is_first_step()) then - ! initialize cloud bourne constituents in physics buffer - - do i = 1, pcnst - do lchnk = begchunk, endchunk - qqcw => qqcw_get_field(pbuf_get_chunk(pbuf2d,lchnk), i, lchnk, .true.) - if (associated(qqcw)) then - qqcw = 1.e-38_r8 - end if - end do - end do - end if - if(HD_mods) then !BSINGH - Initialize convproc (HD mods) - call ma_convproc_init - endif -#endif - - return - end subroutine modal_aero_initialize - - - !============================================================== - subroutine search_list_of_names( & - name_to_find, name_id, list_of_names, list_length ) - ! - ! searches for a name in a list of names - ! - ! name_to_find - the name to be found in the list [input] - ! name_id - the position of "name_to_find" in the "list_of_names". - ! If the name is not found in the list, then name_id=0. [output] - ! list_of_names - the list of names to be searched [input] - ! list_length - the number of names in the list [input] - ! - character(len=*), intent(in):: name_to_find, list_of_names(:) - integer, intent(in) :: list_length - integer, intent(out) :: name_id - - integer :: i - name_id = -999888777 - if (name_to_find .ne. ' ') then - do i = 1, list_length - if (name_to_find .eq. list_of_names(i)) then - name_id = i - exit - end if - end do - end if - end subroutine search_list_of_names - - - !============================================================== -#ifndef GEOS5_PORT - subroutine initaermodes_setspecptrs -#else - subroutine initaermodes_setspecptrs(verbose) -#endif - ! - ! sets the lptr_so4_a_amode(m), lptr_so4_cw_amode(m), ... - ! and writes them to iulog - ! ALSO sets the mode-pointers: modeptr_accum, modeptr_aitken, ... - ! and writes them to iulog - ! ALSO sets values of specdens_XX_amode and specmw_XX_amode - ! (XX = so4, om, bc, dust, seasalt) - ! - implicit none - -#ifdef GEOS5_PORT - ! arguments - logical, intent(in) :: verbose -#endif - - ! local variables - integer l, l2, m - character*8 dumname - integer, parameter :: init_val=-999888777 -#ifdef GEOS5_PORT - logical :: masterproc - masterproc = verbose -#endif - - ! all processes set the pointers - - modeptr_accum = init_val - modeptr_aitken = init_val - modeptr_ufine = init_val - modeptr_coarse = init_val - modeptr_pcarbon = init_val - modeptr_fineseas = init_val - modeptr_finedust = init_val - modeptr_coarseas = init_val - modeptr_coardust = init_val - do m = 1, ntot_amode - if (modename_amode(m) .eq. 'accum') then - modeptr_accum = m - else if (modename_amode(m) .eq. 'aitken') then - modeptr_aitken = m - else if (modename_amode(m) .eq. 'ufine') then - modeptr_ufine = m - else if (modename_amode(m) .eq. 'coarse') then - modeptr_coarse = m - else if (modename_amode(m) .eq. 'primary_carbon') then - modeptr_pcarbon = m - else if (modename_amode(m) .eq. 'fine_seasalt') then - modeptr_fineseas = m - else if (modename_amode(m) .eq. 'fine_dust') then - modeptr_finedust = m - else if (modename_amode(m) .eq. 'coarse_seasalt') then - modeptr_coarseas = m - else if (modename_amode(m) .eq. 'coarse_dust') then - modeptr_coardust = m - end if - end do - - do m = 1, ntot_amode - lptr_so4_a_amode(m) = init_val - lptr_so4_cw_amode(m) = init_val - lptr_msa_a_amode(m) = init_val - lptr_msa_cw_amode(m) = init_val - lptr_nh4_a_amode(m) = init_val - lptr_nh4_cw_amode(m) = init_val - lptr_no3_a_amode(m) = init_val - lptr_no3_cw_amode(m) = init_val - lptr_pom_a_amode(m) = init_val - lptr_pom_cw_amode(m) = init_val - lptr_soa_a_amode(m) = init_val - lptr_soa_cw_amode(m) = init_val - lptr_bc_a_amode(m) = init_val - lptr_bc_cw_amode(m) = init_val - lptr_nacl_a_amode(m) = init_val - lptr_nacl_cw_amode(m) = init_val - lptr_dust_a_amode(m) = init_val - lptr_dust_cw_amode(m) = init_val - do l = 1, nspec_amode(m) - l2 = lspectype_amode(l,m) - if ( (specname_amode(l2) .eq. 'sulfate') .and. & - (lptr_so4_a_amode(m) .le. 0) ) then - lptr_so4_a_amode(m) = lmassptr_amode(l,m) - lptr_so4_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'msa') .and. & - (lptr_msa_a_amode(m) .le. 0) ) then - lptr_msa_a_amode(m) = lmassptr_amode(l,m) - lptr_msa_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'ammonium') .and. & - (lptr_nh4_a_amode(m) .le. 0) ) then - lptr_nh4_a_amode(m) = lmassptr_amode(l,m) - lptr_nh4_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'nitrate') .and. & - (lptr_no3_a_amode(m) .le. 0) ) then - lptr_no3_a_amode(m) = lmassptr_amode(l,m) - lptr_no3_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'p-organic') .and. & - (lptr_pom_a_amode(m) .le. 0) ) then - lptr_pom_a_amode(m) = lmassptr_amode(l,m) - lptr_pom_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 's-organic') .and. & - (lptr_soa_a_amode(m) .le. 0) ) then - lptr_soa_a_amode(m) = lmassptr_amode(l,m) - lptr_soa_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'black-c') .and. & - (lptr_bc_a_amode(m) .le. 0) ) then - lptr_bc_a_amode(m) = lmassptr_amode(l,m) - lptr_bc_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'seasalt') .and. & - (lptr_nacl_a_amode(m) .le. 0) ) then - lptr_nacl_a_amode(m) = lmassptr_amode(l,m) - lptr_nacl_cw_amode(m) = lmassptrcw_amode(l,m) - end if - if ( (specname_amode(l2) .eq. 'dust') .and. & - (lptr_dust_a_amode(m) .le. 0) ) then - lptr_dust_a_amode(m) = lmassptr_amode(l,m) - lptr_dust_cw_amode(m) = lmassptrcw_amode(l,m) - end if - end do - end do - - ! all processes set values of specdens_XX_amode and specmw_XX_amode - specdens_so4_amode = 2.0_r8 - specdens_nh4_amode = 2.0_r8 - specdens_no3_amode = 2.0_r8 - specdens_pom_amode = 2.0_r8 - specdens_soa_amode = 2.0_r8 - specdens_bc_amode = 2.0_r8 - specdens_dust_amode = 2.0_r8 - specdens_seasalt_amode = 2.0_r8 - specmw_so4_amode = 1.0_r8 - specmw_nh4_amode = 1.0_r8 - specmw_no3_amode = 1.0_r8 - specmw_pom_amode = 1.0_r8 - specmw_soa_amode = 1.0_r8 - specmw_bc_amode = 1.0_r8 - specmw_dust_amode = 1.0_r8 - specmw_seasalt_amode = 1.0_r8 - do m = 1, ntot_aspectype - if (specname_amode(m).eq.'sulfate ') then - specdens_so4_amode = specdens_amode(m) - specmw_so4_amode = specmw_amode(m) - else if (specname_amode(m).eq.'ammonium ') then - specdens_nh4_amode = specdens_amode(m) - specmw_nh4_amode = specmw_amode(m) - else if (specname_amode(m).eq.'nitrate ') then - specdens_no3_amode = specdens_amode(m) - specmw_no3_amode = specmw_amode(m) - else if (specname_amode(m).eq.'p-organic ') then - specdens_pom_amode = specdens_amode(m) - specmw_pom_amode = specmw_amode(m) - else if (specname_amode(m).eq.'s-organic ') then - specdens_soa_amode = specdens_amode(m) - specmw_soa_amode = specmw_amode(m) - else if (specname_amode(m).eq.'black-c ') then - specdens_bc_amode = specdens_amode(m) - specmw_bc_amode = specmw_amode(m) - else if (specname_amode(m).eq.'dust ') then - specdens_dust_amode = specdens_amode(m) - specmw_dust_amode = specmw_amode(m) - else if (specname_amode(m).eq.'seasalt ') then - specdens_seasalt_amode = specdens_amode(m) - specmw_seasalt_amode = specmw_amode(m) - end if - enddo - - ! masterproc writes out the pointers - if ( .not. ( masterproc ) ) return - - write(iulog,9230) - write(iulog,*) 'modeptr_accum =', modeptr_accum - write(iulog,*) 'modeptr_aitken =', modeptr_aitken - write(iulog,*) 'modeptr_ufine =', modeptr_ufine - write(iulog,*) 'modeptr_coarse =', modeptr_coarse - write(iulog,*) 'modeptr_pcarbon =', modeptr_pcarbon - write(iulog,*) 'modeptr_fineseas =', modeptr_fineseas - write(iulog,*) 'modeptr_finedust =', modeptr_finedust - write(iulog,*) 'modeptr_coarseas =', modeptr_coarseas - write(iulog,*) 'modeptr_coardust =', modeptr_coardust - - dumname = 'none' - write(iulog,9240) - write(iulog,9000) 'sulfate ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_so4_a_amode(m), lptr_so4_cw_amode(m), 'so4' ) - end do - - write(iulog,9000) 'msa ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_msa_a_amode(m), lptr_msa_cw_amode(m), 'msa' ) - end do - - write(iulog,9000) 'ammonium ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_nh4_a_amode(m), lptr_nh4_cw_amode(m), 'nh4' ) - end do - - write(iulog,9000) 'nitrate ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_no3_a_amode(m), lptr_no3_cw_amode(m), 'no3' ) - end do - - write(iulog,9000) 'p-organic ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_pom_a_amode(m), lptr_pom_cw_amode(m), 'pom' ) - end do - - write(iulog,9000) 's-organic ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_soa_a_amode(m), lptr_soa_cw_amode(m), 'soa' ) - end do - - write(iulog,9000) 'black-c ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_bc_a_amode(m), lptr_bc_cw_amode(m), 'bc' ) - end do - - write(iulog,9000) 'seasalt ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_nacl_a_amode(m), lptr_nacl_cw_amode(m), 'nacl' ) - end do - - write(iulog,9000) 'dust ' - do m = 1, ntot_amode - call initaermodes_setspecptrs_write2( m, & - lptr_dust_a_amode(m), lptr_dust_cw_amode(m), 'dust' ) - end do - -9000 format( a ) -9230 format( & - / 'mode-pointer output from subr initaermodes_setspecptrs' ) -9240 format( & - / 'species-pointer output from subr initaermodes_setspecptrs' / & - 'mode', 12x, 'id name_a ', 12x, 'id name_cw' ) - - return - end subroutine initaermodes_setspecptrs - - - !============================================================== - subroutine initaermodes_setspecptrs_write2( & - m, laptr, lcptr, txtdum ) - ! - ! does some output for initaermodes_setspecptrs - - use constituents, only: pcnst, cnst_name - - implicit none - - ! subr arguments - integer m, laptr, lcptr - character*(*) txtdum - - ! local variables - character*8 dumnamea, dumnamec - - dumnamea = 'none' - dumnamec = 'none' - if (laptr .gt. 0) dumnamea = cnst_name(laptr) - if (lcptr .gt. 0) dumnamec = cnst_name(lcptr) - write(iulog,9241) m, laptr, dumnamea, lcptr, dumnamec, txtdum - -9241 format( i4, 2( 2x, i12, 2x, a ), & - 4x, 'lptr_', a, '_a/cw_amode' ) - - return - end subroutine initaermodes_setspecptrs_write2 - - - !============================================================== -#ifndef GEOS5_PORT - subroutine initaermodes_set_cnstnamecw -#else - subroutine initaermodes_set_cnstnamecw(verbose) -#endif - ! - ! sets the cnst_name_cw - ! - use constituents, only: pcnst, cnst_name - implicit none - -#ifndef GEOS5_PORT - ! subr arguments (none) -#else - ! subr arguments - logical, intent(in) :: verbose -#endif - - ! local variables - integer j, l, la, lc, ll, m -#ifdef GEOS5_PORT - logical :: masterproc - masterproc = verbose -#endif - - ! set cnst_name_cw - cnst_name_cw = ' ' - do m = 1, ntot_amode - do ll = 0, nspec_amode(m) - if (ll == 0) then - la = numptr_amode(m) - lc = numptrcw_amode(m) - else - la = lmassptr_amode(ll,m) - lc = lmassptrcw_amode(ll,m) - end if - if ((la < 1) .or. (la > pcnst) .or. & - (lc < 1) .or. (lc > pcnst)) then - write(*,'(/2a/a,5(1x,i10))') & - '*** initaermodes_set_cnstnamecw error', & - ' -- bad la or lc', & - ' m, ll, la, lc, pcnst =', m, ll, la, lc, pcnst - call endrun( '*** initaermodes_set_cnstnamecw error' ) - end if - do j = 2, len( cnst_name(la) ) - 1 - if (cnst_name(la)(j:j+1) == '_a') then - cnst_name_cw(lc) = cnst_name(la) - cnst_name_cw(lc)(j:j+1) = '_c' - exit - else if (cnst_name(la)(j:j+1) == '_A') then - cnst_name_cw(lc) = cnst_name(la) - cnst_name_cw(lc)(j:j+1) = '_C' - exit - end if - end do - if (cnst_name_cw(lc) == ' ') then - write(*,'(/2a/a,3(1x,i10),2x,a)') & - '*** initaermodes_set_cnstnamecw error', & - ' -- bad cnst_name(la)', & - ' m, ll, la, cnst_name(la) =', & - m, ll, la, cnst_name(la) - call endrun( '*** initaermodes_set_cnstnamecw error' ) - end if - end do ! ll = 0, nspec_amode(m) - end do ! m = 1, ntot_amode - - if ( masterproc ) then - write(*,'(/a)') 'l, cnst_name(l), cnst_name_cw(l)' - do l = 1, pcnst - write(*,'(i4,2(2x,a))') l, cnst_name(l), cnst_name_cw(l) - end do - end if - - return - end subroutine initaermodes_set_cnstnamecw - -#ifndef GEOS5_PORT - !============================================================== - subroutine modal_aero_initialize_q( name, q ) - ! - ! this routine is for initial testing of the modal aerosol cam3 - ! - ! it initializes several gas and aerosol species to - ! "low background" values, so that very short (e.g., 1 day) - ! test runs are working with non-zero values - ! - use constituents, only: pcnst, cnst_name - use pmgrid, only: plat, plon, plev - - implicit none - - !-------------------------------------------------------------- - ! ... arguments - !-------------------------------------------------------------- - character(len=*), intent(in) :: name ! constituent name - real(r8), intent(inout) :: q(plon,plev,plat) ! mass mixing ratio - - !-------------------------------------------------------------- - ! ... local variables - !-------------------------------------------------------------- - integer k, l - real(r8) duma, dumb, dumz - - - ! - ! to deactivate this routine, just return here - ! - ! return - - - if ( masterproc ) then - write( *, '(2a)' ) & - '*** modal_aero_initialize_q - name = ', name - if (name == 'H2O2' ) write( *, '(2a)' ) ' doing ', name - if (name == 'SO2' ) write( *, '(2a)' ) ' doing ', name - if (name == 'H2SO4' ) write( *, '(2a)' ) ' doing ', name - if (name == 'DMS' ) write( *, '(2a)' ) ' doing ', name - if (name == 'NH3' ) write( *, '(2a)' ) ' doing ', name - if (name == 'so4_a1' ) write( *, '(2a)' ) ' doing ', name - if (name == 'so4_a2' ) write( *, '(2a)' ) ' doing ', name - if (name == 'pom_a3' ) write( *, '(2a)' ) ' doing ', name - if (name == 'pom_a4' ) write( *, '(2a)' ) ' doing ', name - if (name == 'ncl_a4' ) write( *, '(2a)' ) ' doing ', name - if (name == 'dst_a5' ) write( *, '(2a)' ) ' doing ', name - if (name == 'ncl_a6' ) write( *, '(2a)' ) ' doing ', name - if (name == 'dst_a7' ) write( *, '(2a)' ) ' doing ', name - end if - - do k = 1, plev - - ! init gases - dumz = (k+1.0e-5_r8)/(plev+1.0e-5_r8) - dumb = dumz*1.0e-9_r8/28.966_r8 - if (name == 'H2O2' ) q(:,k,:) = dumb*34.0_r8*1.0_r8 - if (name == 'SO2' ) q(:,k,:) = dumb*64.0_r8*0.1_r8 - if (name == 'H2SO4' ) q(:,k,:) = dumb*98.0_r8*0.001_r8 - if (name == 'DMS' ) q(:,k,:) = dumb*62.0_r8*0.01_r8 - if (name == 'NH3' ) q(:,k,:) = dumb*17.0_r8*0.1_r8 - - ! init first mass species of each aerosol mode - duma = dumz*1.0e-10_r8 - if (name == 'so4_a1' ) q(:,k,:) = duma*1.0_r8 - if (name == 'so4_a2' ) q(:,k,:) = duma*0.002_r8 - if (name == 'pom_a3' ) q(:,k,:) = duma*0.3_r8 - if (name == 'pom_a4' ) q(:,k,:) = duma*0.3_r8 - if (name == 'ncl_a4' ) q(:,k,:) = duma*0.4_r8 - if (name == 'dst_a5' ) q(:,k,:) = duma*0.5_r8 - if (name == 'ncl_a6' ) q(:,k,:) = duma*0.6_r8 - if (name == 'dst_a7' ) q(:,k,:) = duma*0.7_r8 - - ! init aerosol number - ! - ! at k=plev, duma = 1e-10 kgaero/kgair = 0.1 ugaero/kgair - ! dumb = duma/(2000 kgaero/m3aero) - duma = dumz*1.0e-10_r8 - dumb = duma/2.0e3_r8 - ! following produces number 1000X too small, and Dp 10X too big - ! dumb = dumb*1.0e-3 - ! following produces number 1000X too big, and Dp 10X too small - ! dumb = dumb*1.0e3 - if (name == 'num_a1' ) q(:,k,:) = dumb*1.0_r8 *3.0e20_r8 - if (name == 'num_a2' ) q(:,k,:) = dumb*0.002_r8*4.0e22_r8 - if (name == 'num_a3' ) q(:,k,:) = dumb*0.3_r8 *5.7e21_r8 - if (name == 'num_a4' ) q(:,k,:) = dumb*0.4_r8 *2.7e19_r8 - if (name == 'num_a5' ) q(:,k,:) = dumb*0.5_r8 *4.0e20_r8 - if (name == 'num_a6' ) q(:,k,:) = dumb*0.6_r8 *2.7e16_r8 - if (name == 'num_a7' ) q(:,k,:) = dumb*0.7_r8 *4.0e17_r8 - - !*** modal_aero_calcsize_sub - ntot_amode 7 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 1 1.100E-07 1.847E-07 3.031E+20 4.736E+18 2.635E+21 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 2 2.600E-08 3.621E-08 4.021E+22 5.027E+21 1.073E+24 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 3 5.000E-08 6.964E-08 5.654E+21 7.068E+20 7.068E+23 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 4 2.000E-07 4.112E-07 2.748E+19 2.198E+17 1.758E+21 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 5 1.000E-07 1.679E-07 4.035E+20 3.228E+18 3.228E+21 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 6 2.000E-06 4.112E-06 2.748E+16 3.434E+15 2.198E+17 - !mode, dgn, dp*, v2n, v2nhi, v2nlo 7 1.000E-06 1.679E-06 4.035E+17 5.043E+16 3.228E+18 - - end do ! k - - if ( masterproc ) then - write( *, '(7x,a,1p,10e10.2)' ) & - name, (q(1,k,1), k=plev,1,-5) - end if - - if (plev > 0) return - - - if ( masterproc ) then - write( *, '(/a,i5)' ) & - '*** modal_aero_initialize_q - ntot_amode', ntot_amode - do k = 1, ntot_amode - write( *, '(/a)' ) 'mode, dgn, v2n', & - k, dgnum_amode(k), voltonumb_amode(k) - end do - end if - - return - end subroutine modal_aero_initialize_q -#endif - - - !============================================================== - end module modal_aero_initialize_data - diff --git a/MAMchem_GridComp/microphysics/modal_aero_newnuc.F90 b/MAMchem_GridComp/microphysics/modal_aero_newnuc.F90 deleted file mode 100644 index 4e76d05e..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_newnuc.F90 +++ /dev/null @@ -1,1774 +0,0 @@ -! modal_aero_newnuc.F90 - - -!---------------------------------------------------------------------- -!BOP -! -! !MODULE: modal_aero_newnuc --- modal aerosol new-particle nucleation -! -! !INTERFACE: - module modal_aero_newnuc -#if (defined MODAL_AERO) - -! !USES: -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_kind_mod, only: r4 => shr_kind_r4 - use cam_logfile, only: iulog - use mo_constants, only: pi - use chem_mods, only: gas_pcnst -#else - use MAPL_ConstantsMod, only : pi => MAPL_PI, r8 => MAPL_R8 - use chem_mods, only : gas_pcnst -#endif - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: -#ifndef GEOS5_PORT - public modal_aero_newnuc_sub, modal_aero_newnuc_init, & - mer07_veh02_nuc_mosaic_1box -#else - public modal_aero_newnuc_init, mer07_veh02_nuc_mosaic_1box -#endif - -! !PUBLIC DATA MEMBERS: - integer, public :: newnuc_h2so4_conc_flagaa = 1 - -! min h2so4 vapor for nuc calcs = 4.0e-16 mol/mol-air ~= 1.0e4 molecules/cm3, - real(r8), public, parameter :: qh2so4_cutoff = 4.0e-16_r8 - -! adjustment factors -#ifndef GEOS5_PORT - real(r8), public :: adjust_factor_dnaitdt = 1.0_r8 ! applied to final dnait/dt - real(r8), public :: adjust_factor_bin_tern_ratenucl = 1.0_r8 ! applied to binary/ternary nucleation rate - real(r8), public :: adjust_factor_pbl_ratenucl = 1.0_r8 ! applied to boundary layer nucleation rate -#else - real(r8), parameter, public :: adjust_factor_dnaitdt = 1.0_r8 ! applied to final dnait/dt - real(r8), parameter, public :: adjust_factor_bin_tern_ratenucl = 1.0_r8 ! applied to binary/ternary nucleation rate - real(r8), public :: adjust_factor_pbl_ratenucl = 1.0_r8 ! applied to boundary layer nucleation rate -#endif - -! !NON-PUBLIC DATA MEMBERS: - integer, parameter :: pcnstxx = gas_pcnst - integer :: l_h2so4_sv, l_nh3_sv, lnumait_sv, lnh4ait_sv, lso4ait_sv - -! max cloud fraction for nuc calcs - real(r8), parameter :: cld_cutoff = 0.99_r8 - -! !DESCRIPTION: This module implements ... -! -! !REVISION HISTORY: -! -! R.Easter 2007.09.14: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! list private module data here - -!EOC -!---------------------------------------------------------------------- - - - contains -#ifndef GEOS5_PORT -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -!BOP -! !ROUTINE: modal_aero_newnuc_sub --- ... -! -! !INTERFACE: - subroutine modal_aero_newnuc_sub( & - lchnk, ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - t, pmid, pdel, & - zm, pblh, & - qv, cld, & - q, & - del_h2so4_gasprod, del_h2so4_aeruptk ) - - -! !USES: - use modal_aero_data - use abortutils, only: endrun - use cam_history, only: outfld, fieldname_len - use chem_mods, only: adv_mass - use constituents, only: pcnst, cnst_name - use physconst, only: gravit, mwdry, r_universal - use ppgrid, only: pcols, pver - use spmd_utils, only: iam, masterproc - use wv_saturation, only: qsat - use ref_pres, only: top_lev=>trop_cloud_top_lev - - - implicit none - -! !PARAMETERS: - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of columns in chunk - integer, intent(in) :: nstep ! model step - integer, intent(in) :: latndx(pcols), lonndx(pcols) - integer, intent(in) :: loffset ! offset applied to modal aero "pointers" - real(r8), intent(in) :: deltat ! model timestep (s) - - real(r8), intent(in) :: t(pcols,pver) ! temperature (K) - real(r8), intent(in) :: pmid(pcols,pver) ! pressure at model levels (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure thickness of levels (Pa) - real(r8), intent(in) :: zm(pcols,pver) ! midpoint height above surface (m) - real(r8), intent(in) :: pblh(pcols) ! pbl height (m) - real(r8), intent(in) :: qv(pcols,pver) ! specific humidity (kg/kg) - real(r8), intent(in) :: cld(ncol,pver) ! stratiform cloud fraction - ! *** NOTE ncol dimension - real(r8), intent(inout) :: q(ncol,pver,pcnstxx) - ! tracer mixing ratio (TMR) array - ! *** MUST BE mol/mol-air or #/mol-air - ! *** NOTE ncol & pcnstxx dimensions - real(r8), intent(in) :: del_h2so4_gasprod(ncol,pver) - ! h2so4 gas-phase production - ! change over deltat (mol/mol) - real(r8), intent(in) :: del_h2so4_aeruptk(ncol,pver) - ! h2so4 gas-phase loss to - ! aerosol over deltat (mol/mol) - -! !DESCRIPTION: -! computes changes due to aerosol nucleation (new particle formation) -! treats both nucleation and subsequent growth of new particles -! to aitken mode size -! uses the following parameterizations -! vehkamaki et al. (2002) parameterization for binary -! homogeneous nucleation (h2so4-h2o) plus -! kerminen and kulmala (2002) parameterization for -! new particle loss during growth to aitken size -! -! !REVISION HISTORY: -! R.Easter 2007.09.14: Adapted from MIRAGE2 code and CMAQ V4.6 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! local variables - integer :: i, itmp, k, l, lmz, lun, m, mait - integer :: lnumait, lso4ait, lnh4ait - integer :: l_h2so4, l_nh3 - integer :: ldiagveh02 - integer, parameter :: ldiag1=-1, ldiag2=-1, ldiag3=-1, ldiag4=-1 - integer, parameter :: newnuc_method_flagaa = 11 -! integer, parameter :: newnuc_method_flagaa = 12 - ! 1=merikanto et al (2007) ternary 2=vehkamaki et al (2002) binary - ! 11=merikanto ternary + first-order boundary layer - ! 12=merikanto ternary + second-order boundary layer - - real(r8) :: aircon - real(r8) :: cldx - real(r8) :: dens_nh4so4a - real(r8) :: dmdt_ait, dmdt_aitsv1, dmdt_aitsv2, dmdt_aitsv3 - real(r8) :: dndt_ait, dndt_aitsv1, dndt_aitsv2, dndt_aitsv3 - real(r8) :: dnh4dt_ait, dso4dt_ait - real(r8) :: dpnuc - real(r8) :: dplom_mode(1), dphim_mode(1) - real(r8) :: ev_sat(pcols,pver) - real(r8) :: mass1p - real(r8) :: mass1p_aithi, mass1p_aitlo - real(r8) :: mw_so4a_host - real(r8) :: pdel_fac - real(r8) :: qh2so4_cur, qh2so4_avg, qh2so4_del - real(r8) :: qnh3_cur, qnh3_del, qnh4a_del - real(r8) :: qnuma_del - real(r8) :: qso4a_del - real(r8) :: qv_sat(pcols,pver) - real(r8) :: qvswtr - real(r8) :: relhum, relhumav, relhumnn - real(r8) :: tmpa, tmpb, tmpc - real(r8) :: tmp_q1, tmp_q2, tmp_q3 - real(r8) :: tmp_frso4, tmp_uptkrate - - integer, parameter :: nsrflx = 1 ! last dimension of qsrflx - real(r8) :: qsrflx(pcols,pcnst,nsrflx) - ! process-specific column tracer tendencies - ! 1 = nucleation (for aerocom) - real(r8) :: dqdt(ncol,pver,pcnstxx) ! TMR tendency array -- NOTE dims - logical :: dotend(pcnst) ! flag for doing tendency - logical :: do_nh3 ! flag for doing nh3/nh4 - - - character(len=1) :: tmpch1, tmpch2, tmpch3 - character(len=fieldname_len+3) :: fieldname - - -! begin - lun = 6 - -!-------------------------------------------------------------------------------- - if (ldiag1 > 0) then - do i = 1, ncol - if (lonndx(i) /= 37) cycle - if (latndx(i) /= 23) cycle - if (nstep > 3) cycle - write( lun, '(/a,i7,3i5,f10.2)' ) & - '*** modal_aero_newnuc_sub -- nstep, iam, lat, lon =', & - nstep, iam, latndx(i), lonndx(i) - end do - if (nstep > 3) call endrun( '*** modal_aero_newnuc_sub -- testing halt after step 3' ) -! if (ncol /= -999888777) return - end if -!-------------------------------------------------------------------------------- - -!----------------------------------------------------------------------- - l_h2so4 = l_h2so4_sv - loffset - l_nh3 = l_nh3_sv - loffset - lnumait = lnumait_sv - loffset - lnh4ait = lnh4ait_sv - loffset - lso4ait = lso4ait_sv - loffset - -! skip if no aitken mode OR if no h2so4 species - if ((l_h2so4 <= 0) .or. (lso4ait <= 0) .or. (lnumait <= 0)) return - - dotend(:) = .false. - dqdt(1:ncol,:,:) = 0.0_r8 - qsrflx(1:ncol,:,:) = 0.0_r8 - -! set dotend - mait = modeptr_aitken - dotend(lnumait) = .true. - dotend(lso4ait) = .true. - dotend(l_h2so4) = .true. - - lnh4ait = lptr_nh4_a_amode(mait) - loffset - if ((l_nh3 > 0) .and. (l_nh3 <= pcnst) .and. & - (lnh4ait > 0) .and. (lnh4ait <= pcnst)) then - do_nh3 = .true. - dotend(lnh4ait) = .true. - dotend(l_nh3) = .true. - else - do_nh3 = .false. - end if - - -! dry-diameter limits for "grown" new particles - dplom_mode(1) = exp( 0.67_r8*log(dgnumlo_amode(mait)) & - + 0.33_r8*log(dgnum_amode(mait)) ) - dphim_mode(1) = dgnumhi_amode(mait) - -! mass1p_... = mass (kg) of so4 & nh4 in a single particle of diameter ... -! (assuming same dry density for so4 & nh4) -! mass1p_aitlo - dp = dplom_mode(1) -! mass1p_aithi - dp = dphim_mode(1) - tmpa = specdens_so4_amode*pi/6.0_r8 - mass1p_aitlo = tmpa*(dplom_mode(1)**3) - mass1p_aithi = tmpa*(dphim_mode(1)**3) - -! compute qv_sat = saturation specific humidity - call qsat(t(1:ncol, 1:pver), pmid(1:ncol, 1:pver), & - ev_sat(1:ncol, 1:pver), qv_sat(1:ncol, 1:pver)) - -! mw_so4a_host is molec-wght of sulfate aerosol in host code -! 96 when nh3/nh4 are simulated -! something else when nh3/nh4 are not simulated - mw_so4a_host = specmw_so4_amode - - -! -! loop over levels and columns to calc the renaming -! -main_k: do k = top_lev, pver -main_i: do i = 1, ncol - -! skip if (almost) completely cloudy, -! because all h2so4 vapor should be cloud-borne - if (cld(i,k) >= cld_cutoff) cycle main_i - -! qh2so4_cur = current qh2so4, after aeruptk - qh2so4_cur = q(i,k,l_h2so4) -! skip if h2so4 vapor < qh2so4_cutoff - -! 05-jul-2013 - maybe should only skip here if qh2so4_cur << cutoff -! because may have qh2so4_avg >> qh2so4_cur - if (newnuc_h2so4_conc_flagaa < 10) then - if (qh2so4_cur <= qh2so4_cutoff) cycle main_i - else - if (qh2so4_cur <= qh2so4_cutoff*1.0e-10_r8) cycle main_i - end if - - tmpa = max( 0.0_r8, del_h2so4_gasprod(i,k) ) - tmp_q3 = qh2so4_cur -! tmp_q2 = qh2so4 before aeruptk -! (note tmp_q3, tmp_q2 both >= 0.0) - tmp_q2 = tmp_q3 + max( 0.0_r8, -del_h2so4_aeruptk(i,k) ) - -! *** temporary -- in order to get more nucleation -! qh2so4_cur = qh2so4_cur*1.0e1 -! tmp_q3 = tmp_q3*1.0e1 -! tmp_q2 = tmp_q2*1.0e1 -! tmpa = tmpa *1.0e1 - -! tmpb = log( tmp_q2/tmp_q3 ) BUT with some checks added -! tmp_uptkrate = tmpb/deltat - if (tmp_q2 <= tmp_q3) then - tmpb = 0.0_r8 - else - tmpc = tmp_q2 * exp( -20.0_r8 ) - if (tmp_q3 <= tmpc) then - tmp_q3 = tmpc - tmpb = 20.0_r8 - else - tmpb = log( tmp_q2/tmp_q3 ) - end if - end if -! d[ln(qh2so4)]/dt (1/s) from uptake (condensation) to aerosol - tmp_uptkrate = tmpb/deltat - -! qh2so4_avg = estimated average qh2so4 -! when production & loss are done simultaneously - if (tmpb <= 0.1_r8) then - qh2so4_avg = tmp_q3*(1.0_r8 + 0.5_r8*tmpb) - 0.5_r8*tmpa - else - tmpc = tmpa/tmpb - qh2so4_avg = (tmp_q3 - tmpc)*((exp(tmpb)-1.0_r8)/tmpb) + tmpc - end if - - if (newnuc_h2so4_conc_flagaa == 11) then - qh2so4_avg = qh2so4_cur - else if (newnuc_h2so4_conc_flagaa == 12) then - qh2so4_avg = qh2so4_cur + 0.5_r8*max( 0.0_r8, -del_h2so4_aeruptk(i,k) ) - end if - - if (qh2so4_avg <= qh2so4_cutoff) cycle main_i - - - if ( do_nh3 ) then - qnh3_cur = max( 0.0_r8, q(i,k,l_nh3) ) - else - qnh3_cur = 0.0_r8 - end if - - -! relhumav = grid average RH - qvswtr = qv_sat(i,k) - qvswtr = max( qvswtr, 1.0e-20_r8 ) - relhumav = qv(i,k) / qvswtr - relhumav = max( 0.0_r8, min( 1.0_r8, relhumav ) ) -! relhum = non-cloudy area RH (note that 1-cldx >= .01) - cldx = max( 0.0_r8, cld(i,k) ) - relhum = (relhumav - cldx) / (1.0_r8 - cldx) - relhum = max( 0.0_r8, min( 1.0_r8, relhum ) ) -! limit RH to between 0.1% and 99% - relhumnn = relhum - relhumnn = max( 0.01_r8, min( 0.99_r8, relhumnn ) ) - -! aircon = air concentration (mol-air/m3) - aircon = 1.0e3_r8*pmid(i,k)/(r_universal*t(i,k)) - - -! call ... routine to get nucleation rates - ldiagveh02 = -1 - if (ldiag2 > 0) then - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) then - if ((k >= 24) .or. (mod(k,4) == 0)) then - ldiagveh02 = +1 - write(lun,'(/a,i8,3i4,f8.2,1p,4e10.2)') & - 'veh02 call - nstep,lat,lon,k; tk,rh,p,cair', & - nstep, latndx(i), lonndx(i), k, & - t(i,k), relhumnn, pmid(k,k), aircon - end if - end if - end if - call mer07_veh02_nuc_mosaic_1box( & - newnuc_method_flagaa, & - deltat, t(i,k), relhumnn, pmid(i,k), & - zm(i,k), pblh(i), & - qh2so4_cur, qh2so4_avg, qnh3_cur, tmp_uptkrate, & - mw_so4a_host, & - 1, 1, dplom_mode, dphim_mode, & - itmp, qnuma_del, qso4a_del, qnh4a_del, & - qh2so4_del, qnh3_del, dens_nh4so4a, ldiagveh02 ) -! qh2so4_del, qnh3_del, dens_nh4so4a ) -!---------------------------------------------------------------------- -! subr mer07_veh02_nuc_mosaic_1box( & -! newnuc_method_flagaa, & -! dtnuc, temp_in, rh_in, press_in, & -! qh2so4_cur, qh2so4_avg, qnh3_cur, h2so4_uptkrate, & -! nsize, maxd_asize, dplom_sect, dphim_sect, & -! isize_nuc, qnuma_del, qso4a_del, qnh4a_del, & -! qh2so4_del, qnh3_del, dens_nh4so4a ) -! -!! subr arguments (in) -! real(r8), intent(in) :: dtnuc ! nucleation time step (s) -! real(r8), intent(in) :: temp_in ! temperature, in k -! real(r8), intent(in) :: rh_in ! relative humidity, as fraction -! real(r8), intent(in) :: press_in ! air pressure (pa) -! -! real(r8), intent(in) :: qh2so4_cur, qh2so4_avg -! ! gas h2so4 mixing ratios (mol/mol-air) -! real(r8), intent(in) :: qnh3_cur ! gas nh3 mixing ratios (mol/mol-air) -! ! qxxx_cur = current value (after gas chem and condensation) -! ! qxxx_avg = estimated average value (for simultaneous source/sink calcs) -! real(r8), intent(in) :: h2so4_uptkrate ! h2so4 uptake rate to aerosol (1/s) - -! -! integer, intent(in) :: nsize ! number of aerosol size bins -! integer, intent(in) :: maxd_asize ! dimension for dplom_sect, ... -! real(r8), intent(in) :: dplom_sect(maxd_asize) ! dry diameter at lower bnd of bin (m) -! real(r8), intent(in) :: dphim_sect(maxd_asize) ! dry diameter at upper bnd of bin (m) -! -!! subr arguments (out) -! integer, intent(out) :: isize_nuc ! size bin into which new particles go -! real(r8), intent(out) :: qnuma_del ! change to aerosol number mixing ratio (#/mol-air) -! real(r8), intent(out) :: qso4a_del ! change to aerosol so4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qnh4a_del ! change to aerosol nh4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qh2so4_del ! change to gas h2so4 mixing ratio (mol/mol-air) -! real(r8), intent(out) :: qnh3_del ! change to gas nh3 mixing ratio (mol/mol-air) -! ! aerosol changes are > 0; gas changes are < 0 -! real(r8), intent(out) :: dens_nh4so4a ! dry-density of the new nh4-so4 aerosol mass (kg/m3) -!---------------------------------------------------------------------- - - -! convert qnuma_del from (#/mol-air) to (#/kmol-air) - qnuma_del = qnuma_del*1.0e3_r8 -! number nuc rate (#/kmol-air/s) from number nuc amt - dndt_ait = qnuma_del/deltat -! fraction of mass nuc going to so4 - tmpa = qso4a_del*specmw_so4_amode - tmpb = tmpa + qnh4a_del*specmw_nh4_amode - tmp_frso4 = max( tmpa, 1.0e-35_r8 )/max( tmpb, 1.0e-35_r8 ) -! mass nuc rate (kg/kmol-air/s or g/mol...) hhfrom mass nuc amts - dmdt_ait = max( 0.0_r8, (tmpb/deltat) ) - - dndt_aitsv1 = dndt_ait - dmdt_aitsv1 = dmdt_ait - dndt_aitsv2 = 0.0_r8 - dmdt_aitsv2 = 0.0_r8 - dndt_aitsv3 = 0.0_r8 - dmdt_aitsv3 = 0.0_r8 - tmpch1 = ' ' - tmpch2 = ' ' - - if (dndt_ait < 1.0e2_r8) then -! ignore newnuc if number rate < 100 #/kmol-air/s ~= 0.3 #/mg-air/d - dndt_ait = 0.0_r8 - dmdt_ait = 0.0_r8 - tmpch1 = 'A' - - else - dndt_aitsv2 = dndt_ait - dmdt_aitsv2 = dmdt_ait - tmpch1 = 'B' - -! mirage2 code checked for complete h2so4 depletion here, -! but this is now done in mer07_veh02_nuc_mosaic_1box - mass1p = dmdt_ait/dndt_ait - dndt_aitsv3 = dndt_ait - dmdt_aitsv3 = dmdt_ait - -! apply particle size constraints - if (mass1p < mass1p_aitlo) then -! reduce dndt to increase new particle size - dndt_ait = dmdt_ait/mass1p_aitlo - tmpch1 = 'C' - else if (mass1p > mass1p_aithi) then -! reduce dmdt to decrease new particle size - dmdt_ait = dndt_ait*mass1p_aithi - tmpch1 = 'E' - end if - end if - -! *** apply adjustment factor to avoid unrealistically high -! aitken number concentrations in mid and upper troposphere - dndt_ait = dndt_ait * adjust_factor_dnaitdt - dmdt_ait = dmdt_ait * adjust_factor_dnaitdt - -! set tendencies - pdel_fac = pdel(i,k)/gravit - -! dso4dt_ait, dnh4dt_ait are (kmol/kmol-air/s) - dso4dt_ait = dmdt_ait*tmp_frso4/specmw_so4_amode - dnh4dt_ait = dmdt_ait*(1.0_r8 - tmp_frso4)/specmw_nh4_amode - - dqdt(i,k,l_h2so4) = -dso4dt_ait*(1.0_r8-cldx) - qsrflx(i,l_h2so4,1) = qsrflx(i,l_h2so4,1) + dqdt(i,k,l_h2so4)*pdel_fac - q(i,k,l_h2so4) = q(i,k,l_h2so4) + dqdt(i,k,l_h2so4)*deltat - - dqdt(i,k,lso4ait) = dso4dt_ait*(1.0_r8-cldx) - qsrflx(i,lso4ait,1) = qsrflx(i,lso4ait,1) + dqdt(i,k,lso4ait)*pdel_fac - q(i,k,lso4ait) = q(i,k,lso4ait) + dqdt(i,k,lso4ait)*deltat - if (lnumait > 0) then - dqdt(i,k,lnumait) = dndt_ait*(1.0_r8-cldx) - qsrflx(i,lnumait,1) = qsrflx(i,lnumait,1) & - + dqdt(i,k,lnumait)*pdel_fac - q(i,k,lnumait) = q(i,k,lnumait) + dqdt(i,k,lnumait)*deltat - end if - - if (( do_nh3 ) .and. (dnh4dt_ait > 0.0_r8)) then - dqdt(i,k,l_nh3) = -dnh4dt_ait*(1.0_r8-cldx) - qsrflx(i,l_nh3,1) = qsrflx(i,l_nh3,1) + dqdt(i,k,l_nh3)*pdel_fac - q(i,k,l_nh3) = q(i,k,l_nh3) + dqdt(i,k,l_nh3)*deltat - - dqdt(i,k,lnh4ait) = dnh4dt_ait*(1.0_r8-cldx) - qsrflx(i,lnh4ait,1) = qsrflx(i,lnh4ait,1) + dqdt(i,k,lnh4ait)*pdel_fac - q(i,k,lnh4ait) = q(i,k,lnh4ait) + dqdt(i,k,lnh4ait)*deltat - end if - -!! temporary diagnostic -! if (ldiag3 > 0) then -! if ((dndt_ait /= 0.0_r8) .or. (dmdt_ait /= 0.0_r8)) then -! write(lun,'(3a,1x,i7,3i5,1p,5e12.4)') & -! 'newnucxx', tmpch1, tmpch2, nstep, lchnk, i, k, & -! dndt_ait, dmdt_ait, cldx -!! call endrun( 'modal_aero_newnuc_sub' ) -! end if -! end if - - -! diagnostic output start ---------------------------------------- - if (ldiag4 > 0) then - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) then - if ((k >= 24) .or. (mod(k,4) == 0)) then - write(lun,97010) nstep, latndx(i), lonndx(i), k, t(i,k), aircon - write(lun,97020) 'pmid, pdel ', & - pmid(i,k), pdel(i,k) - write(lun,97030) 'qv,qvsw, cld, rh_av, rh_clr ', & - qv(i,k), qvswtr, cldx, relhumav, relhum - write(lun,97020) 'h2so4_cur, _pre, _av, nh3_cur', & - qh2so4_cur, tmp_q2, qh2so4_avg, qnh3_cur - write(lun,97020) 'del_h2so4_gasprod, _aeruptk ', & - del_h2so4_gasprod(i,k), del_h2so4_aeruptk(i,k), & - tmp_uptkrate*3600.0_r8 - write(lun,97020) ' ' - write(lun,97050) 'tmpch1, tmpch2 ', tmpch1, tmpch2 - write(lun,97020) 'dndt_, dmdt_aitsv1 ', & - dndt_aitsv1, dmdt_aitsv1 - write(lun,97020) 'dndt_, dmdt_aitsv2 ', & - dndt_aitsv2, dmdt_aitsv2 - write(lun,97020) 'dndt_, dmdt_aitsv3 ', & - dndt_aitsv3, dmdt_aitsv3 - write(lun,97020) 'dndt_, dmdt_ait ', & - dndt_ait, dmdt_ait - write(lun,97020) 'dso4dt_, dnh4dt_ait ', & - dso4dt_ait, dnh4dt_ait - write(lun,97020) 'qso4a_del, qh2so4_del ', & - qso4a_del, qh2so4_del - write(lun,97020) 'qnh4a_del, qnh3_del ', & - qnh4a_del, qnh3_del - write(lun,97020) 'dqdt(h2so4), (nh3) ', & - dqdt(i,k,l_h2so4), dqdt(i,k,l_nh3) - write(lun,97020) 'dqdt(so4a), (nh4a), (numa) ', & - dqdt(i,k,lso4ait), dqdt(i,k,lnh4ait), dqdt(i,k,lnumait) - - dpnuc = 0.0_r8 - if (dndt_aitsv1 > 1.0e-5_r8) dpnuc = (6.0_r8*dmdt_aitsv1/ & - (pi*specdens_so4_amode*dndt_aitsv1))**0.3333333_r8 - if (dpnuc > 0.0_r8) then - write(lun,97020) 'dpnuc, dp_aitlo, _aithi ', & - dpnuc, dplom_mode(1), dphim_mode(1) - write(lun,97020) 'mass1p, mass1p_aitlo, _aithi ', & - mass1p, mass1p_aitlo, mass1p_aithi - end if - - 97010 format( / 'NEWNUC nstep,lat,lon,k,tk,cair', i8, 3i4, f8.2, 1pe12.4 ) - 97020 format( a, 1p, 6e12.4 ) - 97030 format( a, 1p, 2e12.4, 0p, 5f10.6 ) - 97040 format( 29x, 1p, 6e12.4 ) - 97050 format( a, 2(3x,a) ) - end if - end if - end if -! diagnostic output end ------------------------------------------ - - - end do main_i - end do main_k - - -! do history file column-tendency fields - do l = loffset+1, pcnst - lmz = l - loffset - if ( .not. dotend(lmz) ) cycle - - do i = 1, ncol - qsrflx(i,lmz,1) = qsrflx(i,lmz,1)*(adv_mass(lmz)/mwdry) - end do - fieldname = trim(cnst_name(l)) // '_sfnnuc1' - call outfld( fieldname, qsrflx(:,lmz,1), pcols, lchnk ) - -! if (( masterproc ) .and. (nstep < 1)) & -! write(lun,'(2(a,2x),1p,e11.3)') & -! 'modal_aero_newnuc_sub outfld', fieldname, adv_mass(lmz) - end do ! l = ... - - - return -!EOC - end subroutine modal_aero_newnuc_sub -#endif ! GEOS5_PORT - - -!---------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine mer07_veh02_nuc_mosaic_1box( & - newnuc_method_flagaa, dtnuc, temp_in, rh_in, press_in, & - zm_in, pblh_in, & - qh2so4_cur, qh2so4_avg, qnh3_cur, h2so4_uptkrate, & - mw_so4a_host, & - nsize, maxd_asize, dplom_sect, dphim_sect, & - isize_nuc, qnuma_del, qso4a_del, qnh4a_del, & - qh2so4_del, qnh3_del, dens_nh4so4a, ldiagaa, & - dnclusterdt ) -!....................................................................... -! -! calculates new particle production from homogeneous nucleation -! over timestep dtnuc, using nucleation rates from either -! merikanto et al. (2007) h2so4-nh3-h2o ternary parameterization -! vehkamaki et al. (2002) h2so4-h2o binary parameterization -! -! the new particles are "grown" to the lower-bound size of the host code's -! smallest size bin. (this "growth" is somewhat ad hoc, and would not be -! necessary if the host code's size bins extend down to ~1 nm.) -! -! if the h2so4 and nh3 mass mixing ratios (mixrats) of the grown new -! particles exceed the current gas mixrats, the new particle production -! is reduced so that the new particle mass mixrats match the gas mixrats. -! -! the correction of kerminen and kulmala (2002) is applied to account -! for loss of the new particles by coagulation as they are -! growing to the "host code mininum size" -! -! revision history -! coded by rc easter, pnnl, xx-apr-2007 -! -! key routines called: subr ternary_nuc_napari -! -! references: -! merikanto, j., i. napari, h. vehkamaki, t. anttila, -! and m. kulmala, 2007, new parameterization of -! sulfuric acid-ammonia-water ternary nucleation -! rates at tropospheric conditions, -! j. geophys. res., 112, d15207, doi:10.1029/2006jd0027977 -! -! vehkamäki, h., m. kulmala, i. napari, k.e.j. lehtinen, -! c. timmreck, m. noppel and a. laaksonen, 2002, -! an improved parameterization for sulfuric acid-water nucleation -! rates for tropospheric and stratospheric conditions, -! j. geophys. res., 107, 4622, doi:10.1029/2002jd002184 -! -! kerminen, v., and m. kulmala, 2002, -! analytical formulae connecting the "real" and the "apparent" -! nucleation rate and the nuclei number concentration -! for atmospheric nucleation events -! -!....................................................................... - implicit none - -! subr arguments (in) - real(r8), intent(in) :: dtnuc ! nucleation time step (s) - real(r8), intent(in) :: temp_in ! temperature, in k - real(r8), intent(in) :: rh_in ! relative humidity, as fraction - real(r8), intent(in) :: press_in ! air pressure (pa) - real(r8), intent(in) :: zm_in ! layer midpoint height (m) - real(r8), intent(in) :: pblh_in ! pbl height (m) - - real(r8), intent(in) :: qh2so4_cur, qh2so4_avg - ! gas h2so4 mixing ratios (mol/mol-air) - real(r8), intent(in) :: qnh3_cur ! gas nh3 mixing ratios (mol/mol-air) - ! qxxx_cur = current value (after gas chem and condensation) - ! qxxx_avg = estimated average value (for simultaneous source/sink calcs) - real(r8), intent(in) :: h2so4_uptkrate ! h2so4 uptake rate to aerosol (1/s) - real(r8), intent(in) :: mw_so4a_host ! mw of so4 aerosol in host code (g/mol) - - integer, intent(in) :: newnuc_method_flagaa ! 1=merikanto et al (2007) ternary - ! 2=vehkamaki et al (2002) binary - integer, intent(in) :: nsize ! number of aerosol size bins - integer, intent(in) :: maxd_asize ! dimension for dplom_sect, ... - real(r8), intent(in) :: dplom_sect(maxd_asize) ! dry diameter at lower bnd of bin (m) - real(r8), intent(in) :: dphim_sect(maxd_asize) ! dry diameter at upper bnd of bin (m) - integer, intent(in) :: ldiagaa - -! subr arguments (out) - integer, intent(out) :: isize_nuc ! size bin into which new particles go - real(r8), intent(out) :: qnuma_del ! change to aerosol number mixing ratio (#/mol-air) - real(r8), intent(out) :: qso4a_del ! change to aerosol so4 mixing ratio (mol/mol-air) - real(r8), intent(out) :: qnh4a_del ! change to aerosol nh4 mixing ratio (mol/mol-air) - real(r8), intent(out) :: qh2so4_del ! change to gas h2so4 mixing ratio (mol/mol-air) - real(r8), intent(out) :: qnh3_del ! change to gas nh3 mixing ratio (mol/mol-air) - ! aerosol changes are > 0; gas changes are < 0 - real(r8), intent(out) :: dens_nh4so4a ! dry-density of the new nh4-so4 aerosol mass (kg/m3) - real(r8), intent(out), optional :: & - dnclusterdt ! cluster nucleation rate (#/m3/s) - -! subr arguments (out) passed via common block -! these are used to duplicate the outputs of yang zhang's original test driver -! they are not really needed in wrf-chem - real(r8) :: ratenuclt ! j = ternary nucleation rate from napari param. (cm-3 s-1) - real(r8) :: rateloge ! ln (j) - real(r8) :: cnum_h2so4 ! number of h2so4 molecules in the critical nucleus - real(r8) :: cnum_nh3 ! number of nh3 molecules in the critical nucleus - real(r8) :: cnum_tot ! total number of molecules in the critical nucleus - real(r8) :: radius_cluster ! the radius of cluster (nm) - - -! local variables - integer :: i - integer :: igrow - integer, save :: icase = 0, icase_reldiffmax = 0 -! integer, parameter :: ldiagaa = -1 - integer :: lun - integer :: newnuc_method_flagaa2 - - real(r8), parameter :: onethird = 1.0_r8/3.0_r8 - real(r8), parameter :: avogad = 6.022e23_r8 ! avogadro number (molecules/mol) - real(r8), parameter :: mw_air = 28.966_r8 ! dry-air mean molecular weight (g/mol) - - real(r8), parameter :: accom_coef_h2so4 = 0.65_r8 ! accomodation coef for h2so4 conden - -! dry densities (kg/m3) molecular weights of aerosol -! ammsulf, ammbisulf, and sulfacid (from mosaic dens_electrolyte values) -! real(r8), parameter :: dens_ammsulf = 1.769e3 -! real(r8), parameter :: dens_ammbisulf = 1.78e3 -! real(r8), parameter :: dens_sulfacid = 1.841e3 -! use following to match cam3 modal_aero densities - real(r8), parameter :: dens_ammsulf = 1.770e3_r8 - real(r8), parameter :: dens_ammbisulf = 1.770e3_r8 - real(r8), parameter :: dens_sulfacid = 1.770e3_r8 - real(r8), parameter :: dens_water = 1.0e3_r8 - -! molecular weights (g/mol) of aerosol ammsulf, ammbisulf, and sulfacid -! for ammbisulf and sulfacid, use 114 & 96 here rather than 115 & 98 -! because we don't keep track of aerosol hion mass - real(r8), parameter :: mw_ammsulf = 132.0_r8 - real(r8), parameter :: mw_ammbisulf = 114.0_r8 - real(r8), parameter :: mw_sulfacid = 96.0_r8 -! molecular weights of aerosol sulfate and ammonium - real(r8), parameter :: mw_so4a = 96.0_r8 - real(r8), parameter :: mw_nh4a = 18.0_r8 - real(r8), parameter :: mw_water = 18.0_r8 - - real(r8), save :: reldiffmax = 0.0_r8 - - real(r8) cair ! dry-air molar density (mol/m3) - real(r8) cs_prime_kk ! kk2002 "cs_prime" parameter (1/m2) - real(r8) cs_kk ! kk2002 "cs" parameter (1/s) - real(r8) dens_part ! "grown" single-particle dry density (kg/m3) - real(r8) dfin_kk, dnuc_kk ! kk2002 final/initial new particle wet diameter (nm) - real(r8) dpdry_clus ! critical cluster diameter (m) - real(r8) dpdry_part ! "grown" single-particle dry diameter (m) - real(r8) tmpa, tmpb, tmpc, tmpe, tmpq - real(r8) tmpa1, tmpb1 - real(r8) tmp_m1, tmp_m2, tmp_m3, tmp_n1, tmp_n2, tmp_n3 - real(r8) tmp_spd ! h2so4 vapor molecular speed (m/s) - real(r8) factor_kk - real(r8) fogas, foso4a, fonh4a, fonuma - real(r8) freduce ! reduction factor applied to nucleation rate - ! due to limited availability of h2so4 & nh3 gases - real(r8) freducea, freduceb - real(r8) gamma_kk ! kk2002 "gamma" parameter (nm2*m2/h) - real(r8) gr_kk ! kk2002 "gr" parameter (nm/h) - real(r8) kgaero_per_moleso4a ! (kg dry aerosol)/(mol aerosol so4) - real(r8) mass_part ! "grown" single-particle dry mass (kg) - real(r8) molenh4a_per_moleso4a ! (mol aerosol nh4)/(mol aerosol so4) - real(r8) nh3ppt, nh3ppt_bb ! actual and bounded nh3 (ppt) - real(r8) nu_kk ! kk2002 "nu" parameter (nm) - real(r8) qmolnh4a_del_max ! max production of aerosol nh4 over dtnuc (mol/mol-air) - real(r8) qmolso4a_del_max ! max production of aerosol so4 over dtnuc (mol/mol-air) - real(r8) ratenuclt_bb ! nucleation rate (#/m3/s) - real(r8) ratenuclt_kk ! nucleation rate after kk2002 adjustment (#/m3/s) - real(r8) rh_bb ! bounded value of rh_in - real(r8) so4vol_in ! concentration of h2so4 for nucl. calc., molecules cm-3 - real(r8) so4vol_bb ! bounded value of so4vol_in - real(r8) temp_bb ! bounded value of temp_in - real(r8) voldry_clus ! critical-cluster dry volume (m3) - real(r8) voldry_part ! "grown" single-particle dry volume (m3) - real(r8) wetvol_dryvol ! grown particle (wet-volume)/(dry-volume) - real(r8) wet_volfrac_so4a ! grown particle (dry-volume-from-so4)/(wet-volume) - - - -! -! if h2so4 vapor < qh2so4_cutoff -! exit with new particle formation = 0 -! - isize_nuc = 1 - qnuma_del = 0.0_r8 - qso4a_del = 0.0_r8 - qnh4a_del = 0.0_r8 - qh2so4_del = 0.0_r8 - qnh3_del = 0.0_r8 - if ( present ( dnclusterdt ) ) dnclusterdt = 0.0_r8 -! if (qh2so4_avg .le. qh2so4_cutoff) return ! this no longer needed -! if (qh2so4_cur .le. qh2so4_cutoff) return ! this no longer needed - - if ((newnuc_method_flagaa /= 1) .and. & - (newnuc_method_flagaa /= 2) .and. & - (newnuc_method_flagaa /= 11) .and. & - (newnuc_method_flagaa /= 12)) return - - -! -! make call to parameterization routine -! - -! calc h2so4 in molecules/cm3 and nh3 in ppt - cair = press_in/(temp_in*8.3144_r8) - so4vol_in = qh2so4_avg * cair * avogad * 1.0e-6_r8 - nh3ppt = qnh3_cur * 1.0e12_r8 - ratenuclt = 1.0e-38_r8 - rateloge = log( ratenuclt ) - - if ( (newnuc_method_flagaa /= 2) .and. & - (nh3ppt >= 0.1_r8) ) then -! make call to merikanto ternary parameterization routine -! (when nh3ppt < 0.1, use binary param instead) - - if (so4vol_in >= 5.0e4_r8) then - temp_bb = max( 235.0_r8, min( 295.0_r8, temp_in ) ) - rh_bb = max( 0.05_r8, min( 0.95_r8, rh_in ) ) - so4vol_bb = max( 5.0e4_r8, min( 1.0e9_r8, so4vol_in ) ) - nh3ppt_bb = max( 0.1_r8, min( 1.0e3_r8, nh3ppt ) ) - call ternary_nuc_merik2007( & - temp_bb, rh_bb, so4vol_bb, nh3ppt_bb, & - rateloge, & - cnum_tot, cnum_h2so4, cnum_nh3, radius_cluster ) - end if - newnuc_method_flagaa2 = 1 - - else -! make call to vehkamaki binary parameterization routine - - if (so4vol_in >= 1.0e4_r8) then - temp_bb = max( 230.15_r8, min( 305.15_r8, temp_in ) ) - rh_bb = max( 1.0e-4_r8, min( 1.0_r8, rh_in ) ) - so4vol_bb = max( 1.0e4_r8, min( 1.0e11_r8, so4vol_in ) ) - call binary_nuc_vehk2002( & - temp_bb, rh_bb, so4vol_bb, & - ratenuclt, rateloge, & - cnum_h2so4, cnum_tot, radius_cluster ) - end if - cnum_nh3 = 0.0_r8 - newnuc_method_flagaa2 = 2 - - end if - rateloge = rateloge & - + log( max( 1.0e-38_r8, adjust_factor_bin_tern_ratenucl ) ) - - -! do boundary layer nuc - if ((newnuc_method_flagaa == 11) .or. & - (newnuc_method_flagaa == 12)) then - if ( zm_in <= max(pblh_in,100.0_r8) ) then - so4vol_bb = so4vol_in - call pbl_nuc_wang2008( so4vol_bb, & - newnuc_method_flagaa, newnuc_method_flagaa2, & - ratenuclt, rateloge, & - cnum_tot, cnum_h2so4, cnum_nh3, radius_cluster ) - end if - end if - - -! if nucleation rate is less than 1e-6 #/cm3/s ~= 0.1 #/cm3/day, -! exit with new particle formation = 0 - if (rateloge .le. -13.82_r8) return -! if (ratenuclt .le. 1.0e-6) return - - ratenuclt = exp( rateloge ) - ratenuclt_bb = ratenuclt*1.0e6_r8 ! ratenuclt_bb is #/m3/s; ratenuclt is #/cm3/s - if ( present ( dnclusterdt ) ) dnclusterdt = ratenuclt_bb - - -! wet/dry volume ratio - use simple kohler approx for ammsulf/ammbisulf - tmpa = max( 0.10_r8, min( 0.95_r8, rh_in ) ) - wetvol_dryvol = 1.0_r8 - 0.56_r8/log(tmpa) - - -! determine size bin into which the new particles go -! (probably it will always be bin #1, but ...) - voldry_clus = ( max(cnum_h2so4,1.0_r8)*mw_so4a + cnum_nh3*mw_nh4a ) / & - (1.0e3_r8*dens_sulfacid*avogad) -! correction when host code sulfate is really ammonium bisulfate/sulfate - voldry_clus = voldry_clus * (mw_so4a_host/mw_so4a) - dpdry_clus = (voldry_clus*6.0_r8/pi)**onethird - - isize_nuc = 1 - dpdry_part = dplom_sect(1) - if (dpdry_clus <= dplom_sect(1)) then - igrow = 1 ! need to clusters to larger size - else if (dpdry_clus >= dphim_sect(nsize)) then - igrow = 0 - isize_nuc = nsize - dpdry_part = dphim_sect(nsize) - else - igrow = 0 - do i = 1, nsize - if (dpdry_clus < dphim_sect(i)) then - isize_nuc = i - dpdry_part = dpdry_clus - dpdry_part = min( dpdry_part, dphim_sect(i) ) - dpdry_part = max( dpdry_part, dplom_sect(i) ) - exit - end if - end do - end if - voldry_part = (pi/6.0_r8)*(dpdry_part**3) - - -! -! determine composition and density of the "grown particles" -! the grown particles are assumed to be liquid -! (since critical clusters contain water) -! so any (nh4/so4) molar ratio between 0 and 2 is allowed -! assume that the grown particles will have -! (nh4/so4 molar ratio) = min( 2, (nh3/h2so4 gas molar ratio) ) -! - if (igrow .le. 0) then -! no "growing" so pure sulfuric acid - tmp_n1 = 0.0_r8 - tmp_n2 = 0.0_r8 - tmp_n3 = 1.0_r8 - else if (qnh3_cur .ge. qh2so4_cur) then -! combination of ammonium sulfate and ammonium bisulfate -! tmp_n1 & tmp_n2 = mole fractions of the ammsulf & ammbisulf - tmp_n1 = (qnh3_cur/qh2so4_cur) - 1.0_r8 - tmp_n1 = max( 0.0_r8, min( 1.0_r8, tmp_n1 ) ) - tmp_n2 = 1.0_r8 - tmp_n1 - tmp_n3 = 0.0_r8 - else -! combination of ammonium bisulfate and sulfuric acid -! tmp_n2 & tmp_n3 = mole fractions of the ammbisulf & sulfacid - tmp_n1 = 0.0_r8 - tmp_n2 = (qnh3_cur/qh2so4_cur) - tmp_n2 = max( 0.0_r8, min( 1.0_r8, tmp_n2 ) ) - tmp_n3 = 1.0_r8 - tmp_n2 - end if - - tmp_m1 = tmp_n1*mw_ammsulf - tmp_m2 = tmp_n2*mw_ammbisulf - tmp_m3 = tmp_n3*mw_sulfacid - dens_part = (tmp_m1 + tmp_m2 + tmp_m3)/ & - ((tmp_m1/dens_ammsulf) + (tmp_m2/dens_ammbisulf) & - + (tmp_m3/dens_sulfacid)) - dens_nh4so4a = dens_part - mass_part = voldry_part*dens_part -! (mol aerosol nh4)/(mol aerosol so4) - molenh4a_per_moleso4a = 2.0_r8*tmp_n1 + tmp_n2 -! (kg dry aerosol)/(mol aerosol so4) - kgaero_per_moleso4a = 1.0e-3_r8*(tmp_m1 + tmp_m2 + tmp_m3) -! correction when host code sulfate is really ammonium bisulfate/sulfate - kgaero_per_moleso4a = kgaero_per_moleso4a * (mw_so4a_host/mw_so4a) - -! fraction of wet volume due to so4a - tmpb = 1.0_r8 + molenh4a_per_moleso4a*17.0_r8/98.0_r8 - wet_volfrac_so4a = 1.0_r8 / ( wetvol_dryvol * tmpb ) - - -! -! calc kerminen & kulmala (2002) correction -! - if (igrow <= 0) then - factor_kk = 1.0_r8 - - else -! "gr" parameter (nm/h) = condensation growth rate of new particles -! use kk2002 eqn 21 for h2so4 uptake, and correct for nh3 & h2o uptake - tmp_spd = 14.7_r8*sqrt(temp_in) ! h2so4 molecular speed (m/s) - gr_kk = 3.0e-9_r8*tmp_spd*mw_sulfacid*so4vol_in/ & - (dens_part*wet_volfrac_so4a) - -! "gamma" parameter (nm2/m2/h) -! use kk2002 eqn 22 -! -! dfin_kk = wet diam (nm) of grown particle having dry dia = dpdry_part (m) - dfin_kk = 1.0e9_r8 * dpdry_part * (wetvol_dryvol**onethird) -! dnuc_kk = wet diam (nm) of cluster - dnuc_kk = 2.0_r8*radius_cluster - dnuc_kk = max( dnuc_kk, 1.0_r8 ) -! neglect (dmean/150)**0.048 factor, -! which should be very close to 1.0 because of small exponent - gamma_kk = 0.23_r8 * (dnuc_kk)**0.2_r8 & - * (dfin_kk/3.0_r8)**0.075_r8 & - * (dens_part*1.0e-3_r8)**(-0.33_r8) & - * (temp_in/293.0_r8)**(-0.75_r8) - -! "cs_prime parameter" (1/m2) -! instead kk2002 eqn 3, use -! cs_prime ~= tmpa / (4*pi*tmpb * h2so4_accom_coef) -! where -! tmpa = -d(ln(h2so4))/dt by conden to particles (1/h units) -! tmpb = h2so4 vapor diffusivity (m2/h units) -! this approx is generally within a few percent of the cs_prime -! calculated directly from eqn 2, -! which is acceptable, given overall uncertainties -! tmpa = -d(ln(h2so4))/dt by conden to particles (1/h units) - tmpa = h2so4_uptkrate * 3600.0_r8 - tmpa1 = tmpa - tmpa = max( tmpa, 0.0_r8 ) -! tmpb = h2so4 gas diffusivity (m2/s, then m2/h) - tmpb = 6.7037e-6_r8 * (temp_in**0.75_r8) / cair - tmpb1 = tmpb ! m2/s - tmpb = tmpb*3600.0_r8 ! m2/h - cs_prime_kk = tmpa/(4.0_r8*pi*tmpb*accom_coef_h2so4) - cs_kk = cs_prime_kk*4.0_r8*pi*tmpb1 - -! "nu" parameter (nm) -- kk2002 eqn 11 - nu_kk = gamma_kk*cs_prime_kk/gr_kk -! nucleation rate adjustment factor (--) -- kk2002 eqn 13 - factor_kk = exp( (nu_kk/dfin_kk) - (nu_kk/dnuc_kk) ) - - end if - ratenuclt_kk = ratenuclt_bb*factor_kk - - -! max production of aerosol dry mass (kg-aero/m3-air) - tmpa = max( 0.0_r8, (ratenuclt_kk*dtnuc*mass_part) ) -! max production of aerosol so4 (mol-so4a/mol-air) - tmpe = tmpa/(kgaero_per_moleso4a*cair) -! max production of aerosol so4 (mol/mol-air) -! based on ratenuclt_kk and mass_part - qmolso4a_del_max = tmpe - -! check if max production exceeds available h2so4 vapor - freducea = 1.0_r8 - if (qmolso4a_del_max .gt. qh2so4_cur) then - freducea = qh2so4_cur/qmolso4a_del_max - end if - -! check if max production exceeds available nh3 vapor - freduceb = 1.0_r8 - if (molenh4a_per_moleso4a .ge. 1.0e-10_r8) then -! max production of aerosol nh4 (ppm) based on ratenuclt_kk and mass_part - qmolnh4a_del_max = qmolso4a_del_max*molenh4a_per_moleso4a - if (qmolnh4a_del_max .gt. qnh3_cur) then - freduceb = qnh3_cur/qmolnh4a_del_max - end if - end if - freduce = min( freducea, freduceb ) - -! if adjusted nucleation rate is less than 1e-12 #/m3/s ~= 0.1 #/cm3/day, -! exit with new particle formation = 0 - if (freduce*ratenuclt_kk .le. 1.0e-12_r8) return - - -! note: suppose that at this point, freduce < 1.0 (no gas-available -! constraints) and molenh4a_per_moleso4a < 2.0 -! if the gas-available constraints is do to h2so4 availability, -! then it would be possible to condense "additional" nh3 and have -! (nh3/h2so4 gas molar ratio) < (nh4/so4 aerosol molar ratio) <= 2 -! one could do some additional calculations of -! dens_part & molenh4a_per_moleso4a to realize this -! however, the particle "growing" is a crude approximate way to get -! the new particles to the host code's minimum particle size, -! are such refinements worth the effort? - - -! changes to h2so4 & nh3 gas (in mol/mol-air), limited by amounts available - tmpa = 0.9999_r8 - qh2so4_del = min( tmpa*qh2so4_cur, freduce*qmolso4a_del_max ) - qnh3_del = min( tmpa*qnh3_cur, qh2so4_del*molenh4a_per_moleso4a ) - qh2so4_del = -qh2so4_del - qnh3_del = -qnh3_del - -! changes to so4 & nh4 aerosol (in mol/mol-air) - qso4a_del = -qh2so4_del - qnh4a_del = -qnh3_del -! change to aerosol number (in #/mol-air) - qnuma_del = 1.0e-3_r8*(qso4a_del*mw_so4a + qnh4a_del*mw_nh4a)/mass_part - -! do the following (tmpa, tmpb, tmpc) calculations as a check -! max production of aerosol number (#/mol-air) - tmpa = max( 0.0_r8, (ratenuclt_kk*dtnuc/cair) ) -! adjusted production of aerosol number (#/mol-air) - tmpb = tmpa*freduce -! relative difference from qnuma_del - tmpc = (tmpb - qnuma_del)/max(tmpb, qnuma_del, 1.0e-35_r8) - - -! -! diagnostic output to fort.41 -! (this should be commented-out or deleted in the wrf-chem version) -! - if (ldiagaa <= 0) return - - icase = icase + 1 - if (abs(tmpc) .gt. abs(reldiffmax)) then - reldiffmax = tmpc - icase_reldiffmax = icase - end if -! do lun = 41, 51, 10 - do lun = 6, 6 -! write(lun,'(/)') - write(lun,'(a,2i9,1p,e10.2)') & - 'vehkam bin-nuc icase, icase_rdmax =', & - icase, icase_reldiffmax, reldiffmax - if (freduceb .lt. freducea) then - if (abs(freducea-freduceb) .gt. & - 3.0e-7_r8*max(freduceb,freducea)) write(lun,'(a,1p,2e15.7)') & - 'freducea, b =', freducea, freduceb - end if - end do - -! output factors so that output matches that of ternucl03 -! fogas = 1.0e6 ! convert mol/mol-air to ppm -! foso4a = 1.0e9*mw_so4a/mw_air ! convert mol-so4a/mol-air to ug/kg-air -! fonh4a = 1.0e9*mw_nh4a/mw_air ! convert mol-nh4a/mol-air to ug/kg-air -! fonuma = 1.0e3/mw_air ! convert #/mol-air to #/kg-air - fogas = 1.0_r8 - foso4a = 1.0_r8 - fonh4a = 1.0_r8 - fonuma = 1.0_r8 - -! do lun = 41, 51, 10 - do lun = 6, 6 - - write(lun,'(a,2i5)') 'newnuc_method_flagaa/aa2', & - newnuc_method_flagaa, newnuc_method_flagaa2 - - write(lun,9210) - write(lun,9201) temp_in, rh_in, & - ratenuclt, 2.0_r8*radius_cluster*1.0e-7_r8, dpdry_part*1.0e2_r8, & - voldry_part*1.0e6_r8, float(igrow) - write(lun,9215) - write(lun,9201) & - qh2so4_avg*fogas, 0.0_r8, & - qh2so4_cur*fogas, qnh3_cur*fogas, & - qh2so4_del*fogas, qnh3_del*fogas, & - qso4a_del*foso4a, qnh4a_del*fonh4a - - write(lun,9220) - write(lun,9201) & - dtnuc, dens_nh4so4a*1.0e-3_r8, & - (qnh3_cur/qh2so4_cur), molenh4a_per_moleso4a, & - qnuma_del*fonuma, tmpb*fonuma, tmpc, freduce - - end do - -! lun = 51 - lun = 6 - write(lun,9230) - write(lun,9201) & - press_in, cair*1.0e-6_r8, so4vol_in, & - wet_volfrac_so4a, wetvol_dryvol, dens_part*1.0e-3_r8 - - if (igrow > 0) then - write(lun,9240) - write(lun,9201) & - tmp_spd, gr_kk, dnuc_kk, dfin_kk, & - gamma_kk, tmpa1, tmpb1, cs_kk - - write(lun,9250) - write(lun,9201) & - cs_prime_kk, nu_kk, factor_kk, ratenuclt, & - ratenuclt_kk*1.0e-6_r8 - end if - -9201 format ( 1p, 40e10.2 ) -9210 format ( & - ' temp rh', & - ' ratenuc dia_clus ddry_part', & - ' vdry_part igrow' ) -9215 format ( & - ' h2so4avg h2so4pre', & - ' h2so4cur nh3_cur', & - ' h2so4del nh3_del', & - ' so4a_del nh4a_del' ) -9220 format ( & - ' dtnuc dens_a nh/so g nh/so a', & - ' numa_del numa_dl2 reldiff freduce' ) -9230 format ( & - ' press_in cair so4_volin', & - ' wet_volfr wetv_dryv dens_part' ) -9240 format ( & - ' tmp_spd gr_kk dnuc_kk dfin_kk', & - ' gamma_kk tmpa1 tmpb1 cs_kk' ) -9250 format ( & - ' cs_pri_kk nu_kk factor_kk ratenuclt', & - ' ratenu_kk' ) - - - return - end subroutine mer07_veh02_nuc_mosaic_1box - - - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine pbl_nuc_wang2008( so4vol, & - newnuc_method_flagaa, newnuc_method_flagaa2, & - ratenucl, rateloge, & - cnum_tot, cnum_h2so4, cnum_nh3, radius_cluster ) -! -! calculates boundary nucleation nucleation rate -! using the first or second-order parameterization in -! wang, m., and j.e. penner, 2008, -! aerosol indirect forcing in a global model with particle nucleation, -! atmos. chem. phys. discuss., 8, 13943-13998 -! - implicit none - -! subr arguments (in) - real(r8), intent(in) :: so4vol ! concentration of h2so4 (molecules cm-3) - integer, intent(in) :: newnuc_method_flagaa - ! [11,12] value selects [first,second]-order parameterization - -! subr arguments (inout) - integer, intent(inout) :: newnuc_method_flagaa2 - real(r8), intent(inout) :: ratenucl ! binary nucleation rate, j (# cm-3 s-1) - real(r8), intent(inout) :: rateloge ! log( ratenucl ) - - real(r8), intent(inout) :: cnum_tot ! total number of molecules - ! in the critical nucleus - real(r8), intent(inout) :: cnum_h2so4 ! number of h2so4 molecules - real(r8), intent(inout) :: cnum_nh3 ! number of nh3 molecules - real(r8), intent(inout) :: radius_cluster ! the radius of cluster (nm) - - -! local variables - real(r8) :: tmp_diam, tmp_mass, tmp_volu - real(r8) :: tmp_rateloge, tmp_ratenucl - -! executable - - -! nucleation rate - if (newnuc_method_flagaa == 11) then - tmp_ratenucl = 1.0e-6_r8 * so4vol - else if (newnuc_method_flagaa == 12) then - tmp_ratenucl = 1.0e-12_r8 * (so4vol**2) - else - return - end if - tmp_ratenucl = tmp_ratenucl * adjust_factor_pbl_ratenucl - tmp_rateloge = log( max( 1.0e-38_r8, tmp_ratenucl ) ) - -! exit if pbl nuc rate is lower than (incoming) ternary/binary rate - if (tmp_rateloge <= rateloge) return - - rateloge = tmp_rateloge - ratenucl = tmp_ratenucl - newnuc_method_flagaa2 = newnuc_method_flagaa - -! following wang 2002, assume fresh nuclei are 1 nm diameter -! subsequent code will "grow" them to aitken mode size - radius_cluster = 0.5_r8 - -! assume fresh nuclei are pure h2so4 -! since aitken size >> initial size, the initial composition -! has very little impact on the results - tmp_diam = radius_cluster * 2.0e-7_r8 ! diameter in cm - tmp_volu = (tmp_diam**3) * (pi/6.0_r8) ! volume in cm^3 - tmp_mass = tmp_volu * 1.8_r8 ! mass in g - cnum_h2so4 = (tmp_mass / 98.0_r8) * 6.023e23_r8 ! no. of h2so4 molec assuming pure h2so4 - cnum_tot = cnum_h2so4 - cnum_nh3 = 0.0_r8 - - - return - end subroutine pbl_nuc_wang2008 - - - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine binary_nuc_vehk2002( temp, rh, so4vol, & - ratenucl, rateloge, & - cnum_h2so4, cnum_tot, radius_cluster ) -! -! calculates binary nucleation rate and critical cluster size -! using the parameterization in -! vehkamäki, h., m. kulmala, i. napari, k.e.j. lehtinen, -! c. timmreck, m. noppel and a. laaksonen, 2002, -! an improved parameterization for sulfuric acid-water nucleation -! rates for tropospheric and stratospheric conditions, -! j. geophys. res., 107, 4622, doi:10.1029/2002jd002184 -! - implicit none - -! subr arguments (in) - real(r8), intent(in) :: temp ! temperature (k) - real(r8), intent(in) :: rh ! relative humidity (0-1) - real(r8), intent(in) :: so4vol ! concentration of h2so4 (molecules cm-3) - -! subr arguments (out) - real(r8), intent(out) :: ratenucl ! binary nucleation rate, j (# cm-3 s-1) - real(r8), intent(out) :: rateloge ! log( ratenucl ) - - real(r8), intent(out) :: cnum_h2so4 ! number of h2so4 molecules - ! in the critical nucleus - real(r8), intent(out) :: cnum_tot ! total number of molecules - ! in the critical nucleus - real(r8), intent(out) :: radius_cluster ! the radius of cluster (nm) - - -! local variables - real(r8) :: crit_x - real(r8) :: acoe, bcoe, ccoe, dcoe, ecoe, fcoe, gcoe, hcoe, icoe, jcoe - real(r8) :: tmpa, tmpb - -! executable - - -! calc sulfuric acid mole fraction in critical cluster - crit_x = 0.740997_r8 - 0.00266379_r8 * temp & - - 0.00349998_r8 * log (so4vol) & - + 0.0000504022_r8 * temp * log (so4vol) & - + 0.00201048_r8 * log (rh) & - - 0.000183289_r8 * temp * log (rh) & - + 0.00157407_r8 * (log (rh)) ** 2.0_r8 & - - 0.0000179059_r8 * temp * (log (rh)) ** 2.0_r8 & - + 0.000184403_r8 * (log (rh)) ** 3.0_r8 & - - 1.50345e-6_r8 * temp * (log (rh)) ** 3.0_r8 - - -! calc nucleation rate - acoe = 0.14309_r8+2.21956_r8*temp & - - 0.0273911_r8 * temp**2.0_r8 & - + 0.0000722811_r8 * temp**3.0_r8 + 5.91822_r8/crit_x - - bcoe = 0.117489_r8 + 0.462532_r8 *temp & - - 0.0118059_r8 * temp**2.0_r8 & - + 0.0000404196_r8 * temp**3.0_r8 + 15.7963_r8/crit_x - - ccoe = -0.215554_r8-0.0810269_r8 * temp & - + 0.00143581_r8 * temp**2.0_r8 & - - 4.7758e-6_r8 * temp**3.0_r8 & - - 2.91297_r8/crit_x - - dcoe = -3.58856_r8+0.049508_r8 * temp & - - 0.00021382_r8 * temp**2.0_r8 & - + 3.10801e-7_r8 * temp**3.0_r8 & - - 0.0293333_r8/crit_x - - ecoe = 1.14598_r8 - 0.600796_r8 * temp & - + 0.00864245_r8 * temp**2.0_r8 & - - 0.0000228947_r8 * temp**3.0_r8 & - - 8.44985_r8/crit_x - - fcoe = 2.15855_r8 + 0.0808121_r8 * temp & - -0.000407382_r8 * temp**2.0_r8 & - -4.01957e-7_r8 * temp**3.0_r8 & - + 0.721326_r8/crit_x - - gcoe = 1.6241_r8 - 0.0160106_r8 * temp & - + 0.0000377124_r8 * temp**2.0_r8 & - + 3.21794e-8_r8 * temp**3.0_r8 & - - 0.0113255_r8/crit_x - - hcoe = 9.71682_r8 - 0.115048_r8 * temp & - + 0.000157098_r8 * temp**2.0_r8 & - + 4.00914e-7_r8 * temp**3.0_r8 & - + 0.71186_r8/crit_x - - icoe = -1.05611_r8 + 0.00903378_r8 * temp & - - 0.0000198417_r8 * temp**2.0_r8 & - + 2.46048e-8_r8 * temp**3.0_r8 & - - 0.0579087_r8/crit_x - - jcoe = -0.148712_r8 + 0.00283508_r8 * temp & - - 9.24619e-6_r8 * temp**2.0_r8 & - + 5.00427e-9_r8 * temp**3.0_r8 & - - 0.0127081_r8/crit_x - - tmpa = ( & - acoe & - + bcoe * log (rh) & - + ccoe * ( log (rh))**2.0_r8 & - + dcoe * ( log (rh))**3.0_r8 & - + ecoe * log (so4vol) & - + fcoe * (log (rh)) * (log (so4vol)) & - + gcoe * ((log (rh) ) **2.0_r8) & - * (log (so4vol)) & - + hcoe * (log (so4vol)) **2.0_r8 & - + icoe * log (rh) & - * ((log (so4vol)) **2.0_r8) & - + jcoe * (log (so4vol)) **3.0_r8 & - ) - rateloge = tmpa - tmpa = min( tmpa, log(1.0e38_r8) ) - ratenucl = exp ( tmpa ) -! write(*,*) 'tmpa, ratenucl =', tmpa, ratenucl - - - -! calc number of molecules in critical cluster - acoe = -0.00295413_r8 - 0.0976834_r8*temp & - + 0.00102485_r8 * temp**2.0_r8 & - - 2.18646e-6_r8 * temp**3.0_r8 - 0.101717_r8/crit_x - - bcoe = -0.00205064_r8 - 0.00758504_r8*temp & - + 0.000192654_r8 * temp**2.0_r8 & - - 6.7043e-7_r8 * temp**3.0_r8 - 0.255774_r8/crit_x - - ccoe = +0.00322308_r8 + 0.000852637_r8 * temp & - - 0.0000154757_r8 * temp**2.0_r8 & - + 5.66661e-8_r8 * temp**3.0_r8 & - + 0.0338444_r8/crit_x - - dcoe = +0.0474323_r8 - 0.000625104_r8 * temp & - + 2.65066e-6_r8 * temp**2.0_r8 & - - 3.67471e-9_r8 * temp**3.0_r8 & - - 0.000267251_r8/crit_x - - ecoe = -0.0125211_r8 + 0.00580655_r8 * temp & - - 0.000101674_r8 * temp**2.0_r8 & - + 2.88195e-7_r8 * temp**3.0_r8 & - + 0.0942243_r8/crit_x - - fcoe = -0.038546_r8 - 0.000672316_r8 * temp & - + 2.60288e-6_r8 * temp**2.0_r8 & - + 1.19416e-8_r8 * temp**3.0_r8 & - - 0.00851515_r8/crit_x - - gcoe = -0.0183749_r8 + 0.000172072_r8 * temp & - - 3.71766e-7_r8 * temp**2.0_r8 & - - 5.14875e-10_r8 * temp**3.0_r8 & - + 0.00026866_r8/crit_x - - hcoe = -0.0619974_r8 + 0.000906958_r8 * temp & - - 9.11728e-7_r8 * temp**2.0_r8 & - - 5.36796e-9_r8 * temp**3.0_r8 & - - 0.00774234_r8/crit_x - - icoe = +0.0121827_r8 - 0.00010665_r8 * temp & - + 2.5346e-7_r8 * temp**2.0_r8 & - - 3.63519e-10_r8 * temp**3.0_r8 & - + 0.000610065_r8/crit_x - - jcoe = +0.000320184_r8 - 0.0000174762_r8 * temp & - + 6.06504e-8_r8 * temp**2.0_r8 & - - 1.4177e-11_r8 * temp**3.0_r8 & - + 0.000135751_r8/crit_x - - cnum_tot = exp ( & - acoe & - + bcoe * log (rh) & - + ccoe * ( log (rh))**2.0_r8 & - + dcoe * ( log (rh))**3.0_r8 & - + ecoe * log (so4vol) & - + fcoe * (log (rh)) * (log (so4vol)) & - + gcoe * ((log (rh) ) **2.0_r8) & - * (log (so4vol)) & - + hcoe * (log (so4vol)) **2.0_r8 & - + icoe * log (rh) & - * ((log (so4vol)) **2.0_r8) & - + jcoe * (log (so4vol)) **3.0_r8 & - ) - - cnum_h2so4 = cnum_tot * crit_x - -! calc radius (nm) of critical cluster - radius_cluster = exp( -1.6524245_r8 + 0.42316402_r8*crit_x & - + 0.3346648_r8*log(cnum_tot) ) - - - return - end subroutine binary_nuc_vehk2002 - - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -subroutine modal_aero_newnuc_init - -!----------------------------------------------------------------------- -! -! Purpose: -! set do_adjust and do_aitken flags -! create history fields for column tendencies associated with -! modal_aero_calcsize -! -! Author: R. Easter -! -!----------------------------------------------------------------------- - -#ifndef GEOS5_PORT -use modal_aero_data -use modal_aero_rename - -use abortutils, only: endrun -use cam_history, only: addfld, add_default, fieldname_len, phys_decomp -use constituents, only: pcnst, cnst_get_ind, cnst_name -use spmd_utils, only: masterproc -use phys_control, only: phys_getopts -#else -use modal_aero_data, only: modeptr_aitken, numptr_amode, ntot_amode, & - lptr_so4_a_amode, lptr_nh4_a_amode, & - mam_amicphys_optaa - -use cam_logfile, only: iulog -use constituents, only: pcnst, cnst_get_ind -#endif - - -implicit none - -!----------------------------------------------------------------------- -! arguments - -!----------------------------------------------------------------------- -! local - integer :: l_h2so4, l_nh3 - integer :: lnumait, lnh4ait, lso4ait - integer :: l - integer :: m, mait - -#ifndef GEOS5_PORT - character(len=fieldname_len) :: tmpname - character(len=fieldname_len+3) :: fieldname - character(128) :: long_name - character(8) :: unit -#endif - - logical :: dotend(pcnst) - logical :: history_aerosol ! Output the MAM aerosol tendencies - - !----------------------------------------------------------------------- - - -! set these indices -! skip if no h2so4 species -! skip if no aitken mode so4 or num species - l_h2so4_sv = 0 - l_nh3_sv = 0 - lnumait_sv = 0 - lnh4ait_sv = 0 - lso4ait_sv = 0 - - call cnst_get_ind( 'H2SO4', l_h2so4, .false. ) - call cnst_get_ind( 'NH3', l_nh3, .false. ) - - mait = modeptr_aitken - if (mait > 0) then - lnumait = numptr_amode(mait) - lso4ait = lptr_so4_a_amode(mait) - lnh4ait = lptr_nh4_a_amode(mait) - end if - if ((l_h2so4 <= 0) .or. (l_h2so4 > pcnst)) then - write(iulog,'(/a/)') & - '*** modal_aero_newnuc bypass -- l_h2so4 <= 0' - return - else if ((lso4ait <= 0) .or. (lso4ait > pcnst)) then - write(iulog,'(/a/)') & - '*** modal_aero_newnuc bypass -- lso4ait <= 0' - return - else if ((lnumait <= 0) .or. (lnumait > pcnst)) then - write(iulog,'(/a/)') & - '*** modal_aero_newnuc bypass -- lnumait <= 0' - return - else if ((mait <= 0) .or. (mait > ntot_amode)) then - write(iulog,'(/a/)') & - '*** modal_aero_newnuc bypass -- modeptr_aitken <= 0' - return - end if - - l_h2so4_sv = l_h2so4 - l_nh3_sv = l_nh3 - lnumait_sv = lnumait - lnh4ait_sv = lnh4ait - lso4ait_sv = lso4ait - -! -! create history file column-tendency fields -! - if (mam_amicphys_optaa >= 100) return - -#ifndef GEOS5_PORT - call phys_getopts( history_aerosol_out = history_aerosol ) -#else - history_aerosol = .false. -#endif - - dotend(:) = .false. - dotend(lnumait) = .true. - dotend(lso4ait) = .true. - dotend(l_h2so4) = .true. - if ((l_nh3 > 0) .and. (l_nh3 <= pcnst) .and. & - (lnh4ait > 0) .and. (lnh4ait <= pcnst)) then - dotend(lnh4ait) = .true. - dotend(l_nh3) = .true. - end if - -#ifndef GEOS5_PORT - do l = 1, pcnst - if ( .not. dotend(l) ) cycle - tmpname = cnst_name(l) - unit = 'kg/m2/s' - do m = 1, ntot_amode - if (l == numptr_amode(m)) unit = '#/m2/s' - end do - fieldname = trim(tmpname) // '_sfnnuc1' - long_name = trim(tmpname) // ' modal_aero new particle nucleation column tendency' - call addfld( fieldname, unit, 1, 'A', long_name, phys_decomp ) - if ( history_aerosol ) then - call add_default( fieldname, 1, ' ' ) - endif - if ( masterproc ) write(iulog,'(3(a,2x))') & - 'modal_aero_newnuc_init addfld', fieldname, unit - end do ! l = ... -#endif - - return - end subroutine modal_aero_newnuc_init - - - -!---------------------------------------------------------------------- -!---------------------------------------------------------------------- -subroutine ternary_nuc_merik2007( t, rh, c2, c3, j_log, ntot, nacid, namm, r ) -!subroutine ternary_fit( t, rh, c2, c3, j_log, ntot, nacid, namm, r ) -! *************************** ternary_fit.f90 ******************************** -! joonas merikanto, 2006 -! -! fortran 90 subroutine that calculates the parameterized composition -! and nucleation rate of critical clusters in h2o-h2so4-nh3 vapor -! -! warning: the fit should not be used outside its limits of validity -! (limits indicated below) -! -! in: -! t: temperature (k), limits 235-295 k -! rh: relative humidity as fraction (eg. 0.5=50%) limits 0.05-0.95 -! c2: sulfuric acid concentration (molecules/cm3) limits 5x10^4 - 10^9 molecules/cm3 -! c3: ammonia mixing ratio (ppt) limits 0.1 - 1000 ppt -! -! out: -! j_log: logarithm of nucleation rate (1/(s cm3)) -! ntot: total number of molecules in the critical cluster -! nacid: number of sulfuric acid molecules in the critical cluster -! namm: number of ammonia molecules in the critical cluster -! r: radius of the critical cluster (nm) -! **************************************************************************** -implicit none - -real(r8), intent(in) :: t, rh, c2, c3 -real(r8), intent(out) :: j_log, ntot, nacid, namm, r -real(r8) :: j, t_onset - -t_onset=143.6002929064716_r8 + 1.0178856665693992_r8*rh + & - 10.196398812974294_r8*log(c2) - & - 0.1849879416839113_r8*log(c2)**2 - 17.161783213150173_r8*log(c3) + & - (109.92469248546053_r8*log(c3))/log(c2) + & - 0.7734119613144357_r8*log(c2)*log(c3) - 0.15576469879527022_r8*log(c3)**2 - -if(t_onset.gt.t) then - - j_log=-12.861848898625231_r8 + 4.905527742256349_r8*c3 - 358.2337705052991_r8*rh -& - 0.05463019231872484_r8*c3*t + 4.8630382337426985_r8*rh*t + & - 0.00020258394697064567_r8*c3*t**2 - 0.02175548069741675_r8*rh*t**2 - & - 2.502406532869512e-7_r8*c3*t**3 + 0.00003212869941055865_r8*rh*t**3 - & - 4.39129415725234e6_r8/log(c2)**2 + (56383.93843154586_r8*t)/log(c2)**2 -& - (239.835990963361_r8*t**2)/log(c2)**2 + & - (0.33765136625580167_r8*t**3)/log(c2)**2 - & - (629.7882041830943_r8*rh)/(c3**3*log(c2)) + & - (7.772806552631709_r8*rh*t)/(c3**3*log(c2)) - & - (0.031974053936299256_r8*rh*t**2)/(c3**3*log(c2)) + & - (0.00004383764128775082_r8*rh*t**3)/(c3**3*log(c2)) + & - 1200.472096232311_r8*log(c2) - 17.37107890065621_r8*t*log(c2) + & - 0.08170681335921742_r8*t**2*log(c2) - 0.00012534476159729881_r8*t**3*log(c2) - & - 14.833042158178936_r8*log(c2)**2 + 0.2932631303555295_r8*t*log(c2)**2 - & - 0.0016497524241142845_r8*t**2*log(c2)**2 + & - 2.844074805239367e-6_r8*t**3*log(c2)**2 - 231375.56676032578_r8*log(c3) - & - 100.21645273730675_r8*rh*log(c3) + 2919.2852552424706_r8*t*log(c3) + & - 0.977886555834732_r8*rh*t*log(c3) - 12.286497122264588_r8*t**2*log(c3) - & - 0.0030511783284506377_r8*rh*t**2*log(c3) + & - 0.017249301826661612_r8*t**3*log(c3) + 2.967320346100855e-6_r8*rh*t**3*log(c3) + & - (2.360931724951942e6_r8*log(c3))/log(c2) - & - (29752.130254319443_r8*t*log(c3))/log(c2) + & - (125.04965118142027_r8*t**2*log(c3))/log(c2) - & - (0.1752996881934318_r8*t**3*log(c3))/log(c2) + & - 5599.912337254629_r8*log(c2)*log(c3) - 70.70896612937771_r8*t*log(c2)*log(c3) + & - 0.2978801613269466_r8*t**2*log(c2)*log(c3) - & - 0.00041866525019504_r8*t**3*log(c2)*log(c3) + 75061.15281456841_r8*log(c3)**2 - & - 931.8802278173565_r8*t*log(c3)**2 + 3.863266220840964_r8*t**2*log(c3)**2 - & - 0.005349472062284983_r8*t**3*log(c3)**2 - & - (732006.8180571689_r8*log(c3)**2)/log(c2) + & - (9100.06398573816_r8*t*log(c3)**2)/log(c2) - & - (37.771091915932004_r8*t**2*log(c3)**2)/log(c2) + & - (0.05235455395566905_r8*t**3*log(c3)**2)/log(c2) - & - 1911.0303773001353_r8*log(c2)*log(c3)**2 + & - 23.6903969622286_r8*t*log(c2)*log(c3)**2 - & - 0.09807872005428583_r8*t**2*log(c2)*log(c3)**2 + & - 0.00013564560238552576_r8*t**3*log(c2)*log(c3)**2 - & - 3180.5610833308_r8*log(c3)**3 + 39.08268568672095_r8*t*log(c3)**3 - & - 0.16048521066690752_r8*t**2*log(c3)**3 + & - 0.00022031380023793877_r8*t**3*log(c3)**3 + & - (40751.075322248245_r8*log(c3)**3)/log(c2) - & - (501.66977622013934_r8*t*log(c3)**3)/log(c2) + & - (2.063469732254135_r8*t**2*log(c3)**3)/log(c2) - & - (0.002836873785758324_r8*t**3*log(c3)**3)/log(c2) + & - 2.792313345723013_r8*log(c2)**2*log(c3)**3 - & - 0.03422552111802899_r8*t*log(c2)**2*log(c3)**3 + & - 0.00014019195277521142_r8*t**2*log(c2)**2*log(c3)**3 - & - 1.9201227328396297e-7_r8*t**3*log(c2)**2*log(c3)**3 - & - 980.923146020468_r8*log(rh) + 10.054155220444462_r8*t*log(rh) - & - 0.03306644502023841_r8*t**2*log(rh) + 0.000034274041225891804_r8*t**3*log(rh) + & - (16597.75554295064_r8*log(rh))/log(c2) - & - (175.2365504237746_r8*t*log(rh))/log(c2) + & - (0.6033215603167458_r8*t**2*log(rh))/log(c2) - & - (0.0006731787599587544_r8*t**3*log(rh))/log(c2) - & - 89.38961120336789_r8*log(c3)*log(rh) + 1.153344219304926_r8*t*log(c3)*log(rh) - & - 0.004954549700267233_r8*t**2*log(c3)*log(rh) + & - 7.096309866238719e-6_r8*t**3*log(c3)*log(rh) + & - 3.1712136610383244_r8*log(c3)**3*log(rh) - & - 0.037822330602328806_r8*t*log(c3)**3*log(rh) + & - 0.0001500555743561457_r8*t**2*log(c3)**3*log(rh) - & - 1.9828365865570703e-7_r8*t**3*log(c3)**3*log(rh) - - j=exp(j_log) - - ntot=57.40091052369212_r8 - 0.2996341884645408_r8*t + & - 0.0007395477768531926_r8*t**2 - & - 5.090604835032423_r8*log(c2) + 0.011016634044531128_r8*t*log(c2) + & - 0.06750032251225707_r8*log(c2)**2 - 0.8102831333223962_r8*log(c3) + & - 0.015905081275952426_r8*t*log(c3) - 0.2044174683159531_r8*log(c2)*log(c3) + & - 0.08918159167625832_r8*log(c3)**2 - 0.0004969033586666147_r8*t*log(c3)**2 + & - 0.005704394549007816_r8*log(c3)**3 + 3.4098703903474368_r8*log(j) - & - 0.014916956508210809_r8*t*log(j) + 0.08459090011666293_r8*log(c3)*log(j) - & - 0.00014800625143907616_r8*t*log(c3)*log(j) + 0.00503804694656905_r8*log(j)**2 - - r=3.2888553966535506e-10_r8 - 3.374171768439839e-12_r8*t + & - 1.8347359507774313e-14_r8*t**2 + 2.5419844298881856e-12_r8*log(c2) - & - 9.498107643050827e-14_r8*t*log(c2) + 7.446266520834559e-13_r8*log(c2)**2 + & - 2.4303397746137294e-11_r8*log(c3) + 1.589324325956633e-14_r8*t*log(c3) - & - 2.034596219775266e-12_r8*log(c2)*log(c3) - 5.59303954457172e-13_r8*log(c3)**2 - & - 4.889507104645867e-16_r8*t*log(c3)**2 + 1.3847024107506764e-13_r8*log(c3)**3 + & - 4.141077193427042e-15_r8*log(j) - 2.6813110884009767e-14_r8*t*log(j) + & - 1.2879071621313094e-12_r8*log(c3)*log(j) - & - 3.80352446061867e-15_r8*t*log(c3)*log(j) - 1.8790172502456827e-14_r8*log(j)**2 - - nacid=-4.7154180661803595_r8 + 0.13436423483953885_r8*t - & - 0.00047184686478816176_r8*t**2 - & - 2.564010713640308_r8*log(c2) + 0.011353312899114723_r8*t*log(c2) + & - 0.0010801941974317014_r8*log(c2)**2 + 0.5171368624197119_r8*log(c3) - & - 0.0027882479896204665_r8*t*log(c3) + 0.8066971907026886_r8*log(c3)**2 - & - 0.0031849094214409335_r8*t*log(c3)**2 - 0.09951184152927882_r8*log(c3)**3 + & - 0.00040072788891745513_r8*t*log(c3)**3 + 1.3276469271073974_r8*log(j) - & - 0.006167654171986281_r8*t*log(j) - 0.11061390967822708_r8*log(c3)*log(j) + & - 0.0004367575329273496_r8*t*log(c3)*log(j) + 0.000916366357266258_r8*log(j)**2 - - namm=71.20073903979772_r8 - 0.8409600103431923_r8*t + & - 0.0024803006590334922_r8*t**2 + & - 2.7798606841602607_r8*log(c2) - 0.01475023348171676_r8*t*log(c2) + & - 0.012264508212031405_r8*log(c2)**2 - 2.009926050440182_r8*log(c3) + & - 0.008689123511431527_r8*t*log(c3) - 0.009141180198955415_r8*log(c2)*log(c3) + & - 0.1374122553905617_r8*log(c3)**2 - 0.0006253227821679215_r8*t*log(c3)**2 + & - 0.00009377332742098946_r8*log(c3)**3 + 0.5202974341687757_r8*log(j) - & - 0.002419872323052805_r8*t*log(j) + 0.07916392322884074_r8*log(c3)*log(j) - & - 0.0003021586030317366_r8*t*log(c3)*log(j) + 0.0046977006608603395_r8*log(j)**2 - -else -! nucleation rate less that 5e-6, setting j_log arbitrary small - j_log=-300._r8 -end if - -return - -end subroutine ternary_nuc_merik2007 - - - -!---------------------------------------------------------------------- -#endif - end module modal_aero_newnuc - - - diff --git a/MAMchem_GridComp/microphysics/modal_aero_rename.F90 b/MAMchem_GridComp/microphysics/modal_aero_rename.F90 deleted file mode 100644 index 28c4423e..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_rename.F90 +++ /dev/null @@ -1,684 +0,0 @@ -! modal_aero_rename.F90 - - -!---------------------------------------------------------------------- -!BOP -! -! !MODULE: modal_aero_rename --- modal aerosol mode merging (renaming) -! -! !INTERFACE: - module modal_aero_rename - -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only: endrun - use modal_aero_data, only: maxd_aspectype - use chem_mods, only: gas_pcnst - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: - public modal_aero_rename_sub, modal_aero_rename_init - -! !PUBLIC DATA MEMBERS: - integer, parameter :: pcnstxx = gas_pcnst - integer, parameter, public :: maxpair_renamexf = 1 - integer, parameter, public :: maxspec_renamexf = maxd_aspectype - - integer, public :: npair_renamexf = -123456789 - integer, public :: modefrm_renamexf(maxpair_renamexf) - integer, public :: modetoo_renamexf(maxpair_renamexf) - integer, public :: nspecfrm_renamexf(maxpair_renamexf) - integer, public :: lspecfrmc_renamexf(maxspec_renamexf,maxpair_renamexf) - integer, public :: lspecfrma_renamexf(maxspec_renamexf,maxpair_renamexf) - integer, public :: lspectooc_renamexf(maxspec_renamexf,maxpair_renamexf) - integer, public :: lspectooa_renamexf(maxspec_renamexf,maxpair_renamexf) - -! !DESCRIPTION: This module implements ... -! -! !REVISION HISTORY: -! -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! list private module data here - -!EOC -!---------------------------------------------------------------------- - contains -!---------------------------------------------------------------------- -!BOP -! !ROUTINE: modal_aero_rename_sub --- ... -! -! !INTERFACE: - subroutine modal_aero_rename_sub( & - fromwhere, lchnk, & - ncol, nstep, & - loffset, deltat, & - latndx, lonndx, & - pdel, & - dotendrn, q, & - dqdt, dqdt_other, & - dotendqqcwrn, qqcw, & - dqqcwdt, dqqcwdt_other, & - is_dorename_atik, dorename_atik, & - jsrflx_rename, nsrflx, & - qsrflx, qqcwsrflx ) - -! !USES: - use modal_aero_data - - use ppgrid, only: pcols, pver - use constituents, only: pcnst, cnst_name - use mo_constants, only: pi - use physconst, only: gravit, mwdry - use units, only: getunit - use shr_spfn_mod, only: erfc => shr_spfn_erfc_nonintrinsic - - implicit none - - -! !PARAMETERS: - character(len=*), intent(in) :: fromwhere ! identifies which module - ! is making the call - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric column - integer, intent(in) :: nstep ! model time-step number - integer, intent(in) :: loffset ! offset applied to modal aero "ptrs" - real(r8), intent(in) :: deltat ! time step (s) - integer, intent(in) :: latndx(pcols), lonndx(pcols) - - real(r8), intent(in) :: pdel(pcols,pver) ! pressure thickness of levels (Pa) - real(r8), intent(in) :: q(ncol,pver,pcnstxx) ! tracer mixing ratio array - ! *** MUST BE mol/mol-air or #/mol-air - ! *** NOTE ncol and pcnstxx dimensions - real(r8), intent(in) :: qqcw(ncol,pver,pcnstxx) ! like q but for cloud-borne species - - real(r8), intent(inout) :: dqdt(ncol,pver,pcnstxx) ! TMR tendency array; - ! incoming dqdt = tendencies for the - ! "fromwhere" continuous growth process - ! the renaming tendencies are added on - ! *** NOTE ncol and pcnstxx dimensions - real(r8), intent(inout) :: dqqcwdt(ncol,pver,pcnstxx) - real(r8), intent(in) :: dqdt_other(ncol,pver,pcnstxx) - ! tendencies for "other" continuous growth process - ! currently in cam3 - ! dqdt is from gas (h2so4, nh3) condensation - ! dqdt_other is from aqchem and soa - ! *** NOTE ncol and pcnstxx dimensions - real(r8), intent(in) :: dqqcwdt_other(ncol,pver,pcnstxx) - logical, intent(inout) :: dotendrn(pcnstxx) ! identifies the species for which - ! renaming dqdt is computed - logical, intent(inout) :: dotendqqcwrn(pcnstxx) - - logical, intent(in) :: is_dorename_atik ! true if dorename_atik is provided - logical, intent(in) :: dorename_atik(ncol,pver) ! true if renaming should - ! be done at i,k - integer, intent(in) :: jsrflx_rename ! qsrflx index for renaming - integer, intent(in) :: nsrflx ! last dimension of qsrflx - - real(r8), intent(inout) :: qsrflx(pcols,pcnstxx,nsrflx) - ! process-specific column tracer tendencies - real(r8), intent(inout) :: qqcwsrflx(pcols,pcnstxx,nsrflx) - -! !DESCRIPTION: -! computes TMR (tracer mixing ratio) tendencies for "mode renaming" -! during a continuous growth process -! currently this transfers number and mass (and surface) from the aitken -! to accumulation mode after gas condensation or stratiform-cloud -! aqueous chemistry -! (convective cloud aqueous chemistry not yet implemented) -! -! !REVISION HISTORY: -! RCE 07.04.13: Adapted from MIRAGE2 code -! -!EOP -!---------------------------------------------------------------------- -!BOC - -! local variables - integer, parameter :: ldiag1=-1 - integer :: i, icol_diag, ipair, iq, j, k, l, l1, l2, la, lc, lunout - integer :: lsfrma, lsfrmc, lstooa, lstooc - integer :: mfrm, mtoo, n, n1, n2, ntot_msa_a - integer :: idomode(ntot_amode) - integer, save :: lun = -1 ! logical unit for diagnostics (6, or other - ! if a special diagnostics file is opened) - - - real (r8) :: deldryvol_a(ncol,pver,ntot_amode) - real (r8) :: deldryvol_c(ncol,pver,ntot_amode) - real (r8) :: deltatinv - real (r8) :: dp_belowcut(maxpair_renamexf) - real (r8) :: dp_cut(maxpair_renamexf) - real (r8) :: dgn_aftr, dgn_xfer - real (r8) :: dgn_t_new, dgn_t_old - real (r8) :: dryvol_t_del, dryvol_t_new - real (r8) :: dryvol_t_old, dryvol_t_oldbnd - real (r8) :: dryvol_a(ncol,pver,ntot_amode) - real (r8) :: dryvol_c(ncol,pver,ntot_amode) - real (r8) :: dryvol_smallest(ntot_amode) - real (r8) :: dum - real (r8) :: dum3alnsg2(maxpair_renamexf) - real (r8) :: dum_m2v, dum_m2vdt - real (r8) :: factoraa(ntot_amode) - real (r8) :: factoryy(ntot_amode) - real (r8) :: frelax - real (r8) :: lndp_cut(maxpair_renamexf) - real (r8) :: lndgn_new, lndgn_old - real (r8) :: lndgv_new, lndgv_old - real (r8) :: num_t_old, num_t_oldbnd - real (r8) :: onethird - real (r8) :: pdel_fac - real (r8) :: tailfr_volnew, tailfr_volold - real (r8) :: tailfr_numnew, tailfr_numold - real (r8) :: v2nhirlx(ntot_amode), v2nlorlx(ntot_amode) - real (r8) :: xfercoef, xfertend - real (r8) :: xferfrac_vol, xferfrac_num, xferfrac_max - - real (r8) :: yn_tail, yv_tail - -! begin - lunout = 6 - -! get logical unit (for output to dumpconv, deactivate the "lun = 6") - lun = 6 - if (lun < 1) then - lun = getunit() - open( unit=lun, file='dump.rename', & - status='unknown', form='formatted' ) - end if - - -! -! calculations done once on initial entry -! -! "init" is now done through chem_init (and things under it) -! if (npair_renamexf .eq. -123456789) then -! npair_renamexf = 0 -! call modal_aero_rename_init -! end if - -! -! check if any renaming pairs exist -! - if (npair_renamexf .le. 0) return -! if (ncol .ne. -123456789) return -! if (fromwhere .eq. 'aqchem') return - -! -! compute aerosol dry-volume for the "from mode" of each renaming pair -! also compute dry-volume change during the continuous growth process -! using the incoming dqdt*deltat -! - deltatinv = 1.0_r8/(deltat*(1.0_r8 + 1.0e-15_r8)) - onethird = 1.0_r8/3.0_r8 - frelax = 27.0_r8 - xferfrac_max = 1.0_r8 - 10.0_r8*epsilon(1.0_r8) ! 1-eps - - do n = 1, ntot_amode - idomode(n) = 0 - end do - - do ipair = 1, npair_renamexf - if (ipair .gt. 1) goto 8100 - idomode(modefrm_renamexf(ipair)) = 1 - - mfrm = modefrm_renamexf(ipair) - mtoo = modetoo_renamexf(ipair) - factoraa(mfrm) = (pi/6._r8)*exp(4.5_r8*(alnsg_amode(mfrm)**2)) - factoraa(mtoo) = (pi/6._r8)*exp(4.5_r8*(alnsg_amode(mtoo)**2)) - factoryy(mfrm) = sqrt( 0.5_r8 )/alnsg_amode(mfrm) -! dryvol_smallest is a very small volume mixing ratio (m3-AP/kmol-air) -! used for avoiding overflow. it corresponds to dp = 1 nm -! and number = 1e-5 #/mg-air ~= 1e-5 #/cm3-air - dryvol_smallest(mfrm) = 1.0e-25_r8 - v2nlorlx(mfrm) = voltonumblo_amode(mfrm)*frelax - v2nhirlx(mfrm) = voltonumbhi_amode(mfrm)/frelax - - dum3alnsg2(ipair) = 3.0_r8 * (alnsg_amode(mfrm)**2) - dp_cut(ipair) = sqrt( & - dgnum_amode(mfrm)*exp(1.5_r8*(alnsg_amode(mfrm)**2)) * & - dgnum_amode(mtoo)*exp(1.5_r8*(alnsg_amode(mtoo)**2)) ) - lndp_cut(ipair) = log( dp_cut(ipair) ) - dp_belowcut(ipair) = 0.99_r8*dp_cut(ipair) - end do - - do n = 1, ntot_amode - if (idomode(n) .gt. 0) then - dryvol_a(1:ncol,:,n) = 0.0_r8 - dryvol_c(1:ncol,:,n) = 0.0_r8 - deldryvol_a(1:ncol,:,n) = 0.0_r8 - deldryvol_c(1:ncol,:,n) = 0.0_r8 - do l1 = 1, nspec_amode(n) - l2 = lspectype_amode(l1,n) -! dum_m2v converts (kmol-AP/kmol-air) to (m3-AP/kmol-air) -! [m3-AP/kmol-AP]= [kg-AP/kmol-AP] / [kg-AP/m3-AP] - dum_m2v = specmw_amode(l2) / specdens_amode(l2) - dum_m2vdt = dum_m2v*deltat - la = lmassptr_amode(l1,n)-loffset - if (la > 0) then - dryvol_a(1:ncol,:,n) = dryvol_a(1:ncol,:,n) & - + dum_m2v*max( 0.0_r8, & - q(1:ncol,:,la)-deltat*dqdt_other(1:ncol,:,la) ) - deldryvol_a(1:ncol,:,n) = deldryvol_a(1:ncol,:,n) & - + (dqdt_other(1:ncol,:,la) + dqdt(1:ncol,:,la))*dum_m2vdt - end if - - lc = lmassptrcw_amode(l1,n)-loffset - if (lc > 0) then - dryvol_c(1:ncol,:,n) = dryvol_c(1:ncol,:,n) & - + dum_m2v*max( 0.0_r8, & - qqcw(1:ncol,:,lc)-deltat*dqqcwdt_other(1:ncol,:,lc) ) - deldryvol_c(1:ncol,:,n) = deldryvol_c(1:ncol,:,n) & - + (dqqcwdt_other(1:ncol,:,lc) + & - dqqcwdt(1:ncol,:,lc))*dum_m2vdt - end if - end do - end if - end do - - - -! -! loop over levels and columns to calc the renaming -! -mainloop1_k: do k = 1, pver -mainloop1_i: do i = 1, ncol - -! if dorename_atik is provided, then check if renaming needed at this i,k - if (is_dorename_atik) then - if (.not. dorename_atik(i,k)) cycle mainloop1_i - end if - pdel_fac = pdel(i,k)/gravit - -! -! loop over renameing pairs -! -mainloop1_ipair: do ipair = 1, npair_renamexf - - mfrm = modefrm_renamexf(ipair) - mtoo = modetoo_renamexf(ipair) - -! dryvol_t_old is the old total (a+c) dry-volume for the "from" mode -! in m^3-AP/kmol-air -! dryvol_t_new is the new total dry-volume -! (old/new = before/after the continuous growth) - dryvol_t_old = dryvol_a(i,k,mfrm) + dryvol_c(i,k,mfrm) - dryvol_t_del = deldryvol_a(i,k,mfrm) + deldryvol_c(i,k,mfrm) - dryvol_t_new = dryvol_t_old + dryvol_t_del - dryvol_t_oldbnd = max( dryvol_t_old, dryvol_smallest(mfrm) ) - -! no renaming if dryvol_t_new ~ 0 or dryvol_t_del ~ 0 - if (dryvol_t_new .le. dryvol_smallest(mfrm)) cycle mainloop1_ipair - if (dryvol_t_del .le. 1.0e-6_r8*dryvol_t_oldbnd) cycle mainloop1_ipair - -! num_t_old is total number in particles/kmol-air - num_t_old = q(i,k,numptr_amode(mfrm)-loffset) - num_t_old = num_t_old + qqcw(i,k,numptrcw_amode(mfrm)-loffset) - num_t_old = max( 0.0_r8, num_t_old ) - dryvol_t_oldbnd = max( dryvol_t_old, dryvol_smallest(mfrm) ) - num_t_oldbnd = min( dryvol_t_oldbnd*v2nlorlx(mfrm), num_t_old ) - num_t_oldbnd = max( dryvol_t_oldbnd*v2nhirlx(mfrm), num_t_oldbnd ) - -! no renaming if dgnum < "base" dgnum, - dgn_t_new = (dryvol_t_new/(num_t_oldbnd*factoraa(mfrm)))**onethird - if (dgn_t_new .le. dgnum_amode(mfrm)) cycle mainloop1_ipair - -! compute new fraction of number and mass in the tail (dp > dp_cut) - lndgn_new = log( dgn_t_new ) - lndgv_new = lndgn_new + dum3alnsg2(ipair) - yn_tail = (lndp_cut(ipair) - lndgn_new)*factoryy(mfrm) - yv_tail = (lndp_cut(ipair) - lndgv_new)*factoryy(mfrm) - tailfr_numnew = 0.5_r8*erfc( yn_tail ) - tailfr_volnew = 0.5_r8*erfc( yv_tail ) - -! compute old fraction of number and mass in the tail (dp > dp_cut) - dgn_t_old = & - (dryvol_t_oldbnd/(num_t_oldbnd*factoraa(mfrm)))**onethird -! if dgn_t_new exceeds dp_cut, use the minimum of dgn_t_old and -! dp_belowcut to guarantee some transfer - if (dgn_t_new .ge. dp_cut(ipair)) then - dgn_t_old = min( dgn_t_old, dp_belowcut(ipair) ) - end if - lndgn_old = log( dgn_t_old ) - lndgv_old = lndgn_old + dum3alnsg2(ipair) - yn_tail = (lndp_cut(ipair) - lndgn_old)*factoryy(mfrm) - yv_tail = (lndp_cut(ipair) - lndgv_old)*factoryy(mfrm) - tailfr_numold = 0.5_r8*erfc( yn_tail ) - tailfr_volold = 0.5_r8*erfc( yv_tail ) - -! transfer fraction is difference between new and old tail-fractions -! transfer fraction for number cannot exceed that of mass - dum = tailfr_volnew*dryvol_t_new - tailfr_volold*dryvol_t_old - if (dum .le. 0.0_r8) cycle mainloop1_ipair - - xferfrac_vol = min( dum, dryvol_t_new )/dryvol_t_new - xferfrac_vol = min( xferfrac_vol, xferfrac_max ) - xferfrac_num = tailfr_numnew - tailfr_numold - xferfrac_num = max( 0.0_r8, min( xferfrac_num, xferfrac_vol ) ) - -! diagnostic output start ---------------------------------------- - if (ldiag1 > 0) then - icol_diag = -1 - if ((lonndx(i) == 37) .and. (latndx(i) == 23)) icol_diag = i - if ((i == icol_diag) .and. (mod(k-1,5) == 0)) then - ! write(lun,97010) fromwhere, nstep, lchnk, i, k, ipair - write(lun,97010) fromwhere, nstep, latndx(i), lonndx(i), k, ipair - write(lun,97020) 'drv old/oldbnd/new/del ', & - dryvol_t_old, dryvol_t_oldbnd, dryvol_t_new, dryvol_t_del - write(lun,97020) 'num old/oldbnd, dgnold/new ', & - num_t_old, num_t_oldbnd, dgn_t_old, dgn_t_new - write(lun,97020) 'tailfr v_old/new, n_old/new', & - tailfr_volold, tailfr_volnew, tailfr_numold, tailfr_numnew - dum = max(1.0e-10_r8,xferfrac_vol) / max(1.0e-10_r8,xferfrac_num) - dgn_xfer = dgn_t_new * dum**onethird - dum = max(1.0e-10_r8,(1.0_r8-xferfrac_vol)) / & - max(1.0e-10_r8,(1.0_r8-xferfrac_num)) - dgn_aftr = dgn_t_new * dum**onethird - write(lun,97020) 'xferfrac_v/n; dgn_xfer/aftr', & - xferfrac_vol, xferfrac_num, dgn_xfer, dgn_aftr - !97010 format( / 'RENAME ', a, ' nx,lc,i,k,ip', i8, 4i4 ) - 97010 format( / 'RENAME ', a, ' nx,lat,lon,k,ip', i8, 4i4 ) - 97020 format( a, 6(1pe15.7) ) - end if - end if -! diagnostic output end ------------------------------------------ - - -! -! compute tendencies for the renaming transfer -! - j = jsrflx_rename - do iq = 1, nspecfrm_renamexf(ipair) - xfercoef = xferfrac_vol*deltatinv - if (iq .eq. 1) xfercoef = xferfrac_num*deltatinv - - lsfrma = lspecfrma_renamexf(iq,ipair)-loffset - lsfrmc = lspecfrmc_renamexf(iq,ipair)-loffset - lstooa = lspectooa_renamexf(iq,ipair)-loffset - lstooc = lspectooc_renamexf(iq,ipair)-loffset - - if (lsfrma .gt. 0) then - xfertend = xfercoef*max( 0.0_r8, & - (q(i,k,lsfrma)+dqdt(i,k,lsfrma)*deltat) ) - -! diagnostic output start ---------------------------------------- - if (ldiag1 > 0) then - if ((i == icol_diag) .and. (mod(k-1,5) == 0)) then - if (lstooa .gt. 0) then - write(*,'(a,i4,2(2x,a),1p,10e14.6)') 'RENAME qdels', iq, & - cnst_name(lsfrma+loffset), cnst_name(lstooa+loffset), & - deltat*dqdt(i,k,lsfrma), deltat*(dqdt(i,k,lsfrma) - xfertend), & - deltat*dqdt(i,k,lstooa), deltat*(dqdt(i,k,lstooa) + xfertend) - else - write(*,'(a,i4,2(2x,a),1p,10e14.6)') 'RENAME qdels', iq, & - cnst_name(lsfrma+loffset), cnst_name(lstooa+loffset), & - deltat*dqdt(i,k,lsfrma), deltat*(dqdt(i,k,lsfrma) - xfertend) - end if - end if - end if -! diagnostic output end ------------------------------------------ - - - dqdt(i,k,lsfrma) = dqdt(i,k,lsfrma) - xfertend - qsrflx(i,lsfrma,j) = qsrflx(i,lsfrma,j) - xfertend*pdel_fac - if (lstooa .gt. 0) then - dqdt(i,k,lstooa) = dqdt(i,k,lstooa) + xfertend - qsrflx(i,lstooa,j) = qsrflx(i,lstooa,j) + xfertend*pdel_fac - end if - end if - - if (lsfrmc .gt. 0) then - xfertend = xfercoef*max( 0.0_r8, & - (qqcw(i,k,lsfrmc)+dqqcwdt(i,k,lsfrmc)*deltat) ) - dqqcwdt(i,k,lsfrmc) = dqqcwdt(i,k,lsfrmc) - xfertend - qqcwsrflx(i,lsfrmc,j) = qqcwsrflx(i,lsfrmc,j) - xfertend*pdel_fac - if (lstooc .gt. 0) then - dqqcwdt(i,k,lstooc) = dqqcwdt(i,k,lstooc) + xfertend - qqcwsrflx(i,lstooc,j) = qqcwsrflx(i,lstooc,j) + xfertend*pdel_fac - end if - end if - - end do ! "iq = 1, nspecfrm_renamexf(ipair)" - - - end do mainloop1_ipair - - - end do mainloop1_i - end do mainloop1_k - -! -! set dotend's -! - dotendrn(:) = .false. - dotendqqcwrn(:) = .false. - do ipair = 1, npair_renamexf - do iq = 1, nspecfrm_renamexf(ipair) - lsfrma = lspecfrma_renamexf(iq,ipair) - loffset - lsfrmc = lspecfrmc_renamexf(iq,ipair) - loffset - lstooa = lspectooa_renamexf(iq,ipair) - loffset - lstooc = lspectooc_renamexf(iq,ipair) - loffset - if (lsfrma .gt. 0) then - dotendrn(lsfrma) = .true. - if (lstooa .gt. 0) dotendrn(lstooa) = .true. - end if - if (lsfrmc .gt. 0) then - dotendqqcwrn(lsfrmc) = .true. - if (lstooc .gt. 0) dotendqqcwrn(lstooc) = .true. - end if - end do - end do - - - return - - -! -! error -- renaming currently just works for 1 pair -! -8100 write(lunout,9050) ipair - call endrun( 'modal_aero_rename_sub error' ) -9050 format( / '*** subr. modal_aero_rename_sub ***' / & - 4x, 'aerosol renaming not implemented for ipair =', i5 ) - -!EOC - end subroutine modal_aero_rename_sub - - - -!------------------------------------------------------------------------- - subroutine modal_aero_rename_init -! -! computes pointers for species transfer during aerosol renaming -! (a2 --> a1 transfer) -! transfers include number_a, number_c, mass_a, mass_c and -! water_a -! - use modal_aero_data - use constituents, only: pcnst, cnst_name - use spmd_utils, only: masterproc - - implicit none - -! local variables - integer ipair, iq, iqfrm, iqfrm_aa, iqtoo, iqtoo_aa, & - lsfrma, lsfrmc, lstooa, lstooc, lunout, & - mfrm, mtoo, n1, n2, nsamefrm, nsametoo, nspec - - - lunout = 6 -! -! define "from mode" and "to mode" for each tail-xfer pairing -! currently just a2-->a1 -! - n1 = modeptr_accum - n2 = modeptr_aitken - if ((n1 .gt. 0) .and. (n2 .gt. 0)) then - npair_renamexf = 1 - modefrm_renamexf(1) = n2 - modetoo_renamexf(1) = n1 - else - npair_renamexf = 0 - return - end if - -! -! define species involved in each tail-xfer pairing -! (include aerosol water) -! - do 1900 ipair = 1, npair_renamexf - mfrm = modefrm_renamexf(ipair) - mtoo = modetoo_renamexf(ipair) - - nspec = 0 - do 1490 iqfrm = -1, nspec_amode(mfrm) - iqtoo = iqfrm - if (iqfrm .eq. -1) then - lsfrma = numptr_amode(mfrm) - lstooa = numptr_amode(mtoo) - lsfrmc = numptrcw_amode(mfrm) - lstooc = numptrcw_amode(mtoo) - else if (iqfrm .eq. 0) then -! bypass transfer of aerosol water due to renaming - goto 1490 -! lsfrma = lwaterptr_amode(mfrm) -! lsfrmc = 0 -! lstooa = lwaterptr_amode(mtoo) -! lstooc = 0 - else - lsfrma = lmassptr_amode(iqfrm,mfrm) - lsfrmc = lmassptrcw_amode(iqfrm,mfrm) - lstooa = 0 - lstooc = 0 - end if - - if ((lsfrma .lt. 1) .or. (lsfrma .gt. pcnst)) then - write(lunout,9100) mfrm, iqfrm, lsfrma - call endrun( 'modal_aero_rename_init error' ) - end if - if (iqfrm .le. 0) goto 1430 - - if ((lsfrmc .lt. 1) .or. (lsfrmc .gt. pcnst)) then - write(lunout,9102) mfrm, iqfrm, lsfrmc - call endrun( 'modal_aero_rename_init error' ) - end if - -! find "too" species having same lspectype_amode as the "frm" species -! several species in a mode may have the same lspectype_amode, so also -! use the ordering as a criterion (e.g., 1st <--> 1st, 2nd <--> 2nd) - iqfrm_aa = 1 - iqtoo_aa = 1 - if (iqfrm .gt. nspec_amode(mfrm)) then - iqfrm_aa = nspec_amode(mfrm) + 1 - iqtoo_aa = nspec_amode(mtoo) + 1 - end if - nsamefrm = 0 - do iq = iqfrm_aa, iqfrm - if ( lspectype_amode(iq ,mfrm) .eq. & - lspectype_amode(iqfrm,mfrm) ) then - nsamefrm = nsamefrm + 1 - end if - end do - nsametoo = 0 - do iqtoo = iqtoo_aa, nspec_amode(mtoo) - if ( lspectype_amode(iqtoo,mtoo) .eq. & - lspectype_amode(iqfrm,mfrm) ) then - nsametoo = nsametoo + 1 - if (nsametoo .eq. nsamefrm) then - lstooc = lmassptrcw_amode(iqtoo,mtoo) - lstooa = lmassptr_amode(iqtoo,mtoo) - goto 1430 - end if - end if - end do - -1430 nspec = nspec + 1 - if ((lstooc .lt. 1) .or. (lstooc .gt. pcnst)) lstooc = 0 - if ((lstooa .lt. 1) .or. (lstooa .gt. pcnst)) lstooa = 0 - if (lstooa .eq. 0) then - write(lunout,9104) mfrm, iqfrm, lsfrma, iqtoo, lstooa - call endrun( 'modal_aero_rename_init error' ) - end if - if ((lstooc .eq. 0) .and. (iqfrm .ne. 0)) then - write(lunout,9104) mfrm, iqfrm, lsfrmc, iqtoo, lstooc - call endrun( 'modal_aero_rename_init error' ) - end if - lspecfrma_renamexf(nspec,ipair) = lsfrma - lspectooa_renamexf(nspec,ipair) = lstooa - lspecfrmc_renamexf(nspec,ipair) = lsfrmc - lspectooc_renamexf(nspec,ipair) = lstooc -1490 continue - - nspecfrm_renamexf(ipair) = nspec -1900 continue - -9100 format( / '*** subr. modal_aero_rename_init' / & - 'lspecfrma out of range' / & - 'modefrm, ispecfrm, lspecfrma =', 3i6 / ) -9102 format( / '*** subr. modal_aero_rename_init' / & - 'lspecfrmc out of range' / & - 'modefrm, ispecfrm, lspecfrmc =', 3i6 / ) -9104 format( / '*** subr. modal_aero_rename_init' / & - 'lspectooa out of range' / & - 'modefrm, ispecfrm, lspecfrma, ispectoo, lspectooa =', 5i6 / ) -9106 format( / '*** subr. modal_aero_rename_init' / & - 'lspectooc out of range' / & - 'modefrm, ispecfrm, lspecfrmc, ispectoo, lspectooc =', 5i6 / ) - -! -! output results -! - if ( masterproc ) then - - write(lunout,9310) - - do 2900 ipair = 1, npair_renamexf - mfrm = modefrm_renamexf(ipair) - mtoo = modetoo_renamexf(ipair) - write(lunout,9320) ipair, mfrm, mtoo - - do iq = 1, nspecfrm_renamexf(ipair) - lsfrma = lspecfrma_renamexf(iq,ipair) - lstooa = lspectooa_renamexf(iq,ipair) - lsfrmc = lspecfrmc_renamexf(iq,ipair) - lstooc = lspectooc_renamexf(iq,ipair) - if (lstooa .gt. 0) then - write(lunout,9330) lsfrma, cnst_name(lsfrma), & - lstooa, cnst_name(lstooa) - else - write(lunout,9340) lsfrma, cnst_name(lsfrma) - end if - if (lstooc .gt. 0) then - write(lunout,9330) lsfrmc, cnst_name_cw(lsfrmc), & - lstooc, cnst_name_cw(lstooc) - else if (lsfrmc .gt. 0) then - write(lunout,9340) lsfrmc, cnst_name_cw(lsfrmc) - else - write(lunout,9350) - end if - end do - -2900 continue - write(lunout,*) - - end if ! ( masterproc ) - -9310 format( / 'subr. modal_aero_rename_init' ) -9320 format( 'pair', i3, 5x, 'mode', i3, ' ---> mode', i3 ) -9330 format( 5x, 'spec', i3, '=', a, ' ---> spec', i3, '=', a ) -9340 format( 5x, 'spec', i3, '=', a, ' ---> LOSS' ) -9350 format( 5x, 'no corresponding activated species' ) - - return - end subroutine modal_aero_rename_init - -!---------------------------------------------------------------------- - - end module modal_aero_rename diff --git a/MAMchem_GridComp/microphysics/modal_aero_wateruptake.F90 b/MAMchem_GridComp/microphysics/modal_aero_wateruptake.F90 deleted file mode 100644 index 9c308e3d..00000000 --- a/MAMchem_GridComp/microphysics/modal_aero_wateruptake.F90 +++ /dev/null @@ -1,747 +0,0 @@ -module modal_aero_wateruptake - -! RCE 07.04.13: Adapted from MIRAGE2 code -#ifndef GEOS5_PORT -use shr_kind_mod, only: r8 => shr_kind_r8 -use physconst, only: pi, rhoh2o -use ppgrid, only: pcols, pver -use physics_types, only: physics_state -use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field - -use wv_saturation, only: qsat_water -use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_mmr, rad_cnst_get_aer_props, & - rad_cnst_get_mode_props, rad_cnst_get_mode_num -use cam_history, only: addfld, add_default, phys_decomp, outfld -use cam_logfile, only: iulog -use ref_pres, only: top_lev => clim_modal_aero_top_lev -use phys_control, only: phys_getopts -use abortutils, only: endrun -#else -use MAPL_ConstantsMod,only: r8 => MAPL_R8, pi => MAPL_PI -use cam_logfile, only: iulog -#endif - -implicit none -private - -#ifndef GEOS5_PORT -save -#endif - -#ifndef GEOS5_PORT -public :: & - modal_aero_wateruptake_init, & - modal_aero_wateruptake_dr -#else -public :: modal_aero_kohler -#endif - -real(r8), parameter :: third = 1._r8/3._r8 -real(r8), parameter :: pi43 = pi*4.0_r8/3.0_r8 - -#ifndef GEOS5_PORT -! Physics buffer indices -integer :: cld_idx = 0 -integer :: dgnum_idx = 0 -integer :: dgnumwet_idx = 0 -integer :: wetdens_ap_idx = 0 -integer :: qaerwat_idx = 0 -#endif - -!=============================================================================== -contains -!=============================================================================== -#ifndef GEOS5_PORT -subroutine modal_aero_wateruptake_init() - - integer :: m, nmodes - logical :: history_aerosol ! Output the MAM aerosol variables and tendencies - - character(len=3) :: trnum ! used to hold mode number (as characters) - !---------------------------------------------------------------------------- - - cld_idx = pbuf_get_index('CLD') - dgnum_idx = pbuf_get_index('DGNUM') - dgnumwet_idx = pbuf_get_index('DGNUMWET') - wetdens_ap_idx = pbuf_get_index('WETDENS_AP') - qaerwat_idx = pbuf_get_index('QAERWAT') - - ! assume for now that will compute wateruptake for climate list modes only - - call rad_cnst_get_info(0, nmodes=nmodes) - - do m = 1, nmodes - write(trnum, '(i3.3)') m - call addfld('dgnd_a'//trnum(2:3), 'm', pver, 'A', & - 'dry dgnum, interstitial, mode '//trnum(2:3), phys_decomp) - call addfld('dgnw_a'//trnum(2:3), 'm', pver, 'A', & - 'wet dgnum, interstitial, mode '//trnum(2:3), phys_decomp) - call addfld('wat_a'//trnum(3:3), 'm', pver, 'A', & - 'aerosol water, interstitial, mode '//trnum(2:3), phys_decomp) - - ! determine default variables - call phys_getopts(history_aerosol_out = history_aerosol) - - if (history_aerosol) then - call add_default('dgnd_a'//trnum(2:3), 1, ' ') - call add_default('dgnw_a'//trnum(2:3), 1, ' ') - call add_default('wat_a'//trnum(3:3), 1, ' ') - endif - - end do - -end subroutine modal_aero_wateruptake_init - -!=============================================================================== - - -subroutine modal_aero_wateruptake_dr(state, pbuf, list_idx_in, dgnumdry_m, dgnumwet_m, & - qaerwat_m, wetdens_m) -!----------------------------------------------------------------------- -! -! CAM specific driver for modal aerosol water uptake code. -! -! *** N.B. *** The calculation has been enabled for diagnostic mode lists -! via optional arguments. If the list_idx arg is present then -! all the optional args must be present. -! -!----------------------------------------------------------------------- - - ! Arguments - type(physics_state), target, intent(in) :: state ! Physics state variables - type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer - - integer, optional, intent(in) :: list_idx_in - real(r8), optional, target, intent(in) :: dgnumdry_m(:,:,:) - real(r8), optional, pointer :: dgnumwet_m(:,:,:) - real(r8), optional, pointer :: qaerwat_m(:,:,:) - real(r8), optional, pointer :: wetdens_m(:,:,:) - - ! local variables - - integer :: lchnk ! chunk index - integer :: ncol ! number of columns - integer :: list_idx ! radiative constituents list index - integer :: stat - - integer :: i, k, l, m - integer :: itim - integer :: nmodes - integer :: nspec - - real(r8), pointer :: h2ommr(:,:) ! specific humidity - real(r8), pointer :: t(:,:) ! temperatures (K) - real(r8), pointer :: pmid(:,:) ! layer pressure (Pa) - real(r8), pointer :: raer(:,:) ! aerosol species MRs (kg/kg and #/kg) - - real(r8), pointer :: cldn(:,:) ! layer cloud fraction (0-1) - real(r8), pointer :: dgncur_a(:,:,:) - real(r8), pointer :: dgncur_awet(:,:,:) - real(r8), pointer :: wetdens(:,:,:) - real(r8), pointer :: qaerwat(:,:,:) - - real(r8), allocatable :: maer(:,:,:) ! aerosol wet mass MR (including water) (kg/kg-air) - real(r8), allocatable :: hygro(:,:,:) ! volume-weighted mean hygroscopicity (--) - real(r8), allocatable :: naer(:,:,:) ! aerosol number MR (bounded!) (#/kg-air) - real(r8), allocatable :: dryvol(:,:,:) ! single-particle-mean dry volume (m3) - real(r8), allocatable :: drymass(:,:,:) ! single-particle-mean dry mass (kg) - real(r8), allocatable :: dryrad(:,:,:) ! dry volume mean radius of aerosol (m) - - real(r8), allocatable :: wetrad(:,:,:) ! wet radius of aerosol (m) - real(r8), allocatable :: wetvol(:,:,:) ! single-particle-mean wet volume (m3) - real(r8), allocatable :: wtrvol(:,:,:) ! single-particle-mean water volume in wet aerosol (m3) - - real(r8), allocatable :: rhcrystal(:) - real(r8), allocatable :: rhdeliques(:) - real(r8), allocatable :: specdens_1(:) - - real(r8) :: dryvolmr(pcols,pver) ! volume MR for aerosol mode (m3/kg) - real(r8) :: specdens - real(r8) :: spechygro, spechygro_1 - real(r8) :: duma, dumb - real(r8) :: sigmag - real(r8) :: alnsg - real(r8) :: v2ncur_a - real(r8) :: drydens ! dry particle density (kg/m^3) - real(r8) :: rh(pcols,pver) ! relative humidity (0-1) - - real(r8) :: es(pcols) ! saturation vapor pressure - real(r8) :: qs(pcols) ! saturation specific humidity - - character(len=3) :: trnum ! used to hold mode number (as characters) - !----------------------------------------------------------------------- - - lchnk = state%lchnk - ncol = state%ncol - - list_idx = 0 - if (present(list_idx_in)) then - list_idx = list_idx_in - - ! check that all optional args are present - if (.not. present(dgnumdry_m) .or. .not. present(dgnumwet_m) .or. & - .not. present(qaerwat_m) .or. .not. present(wetdens_m)) then - call endrun('modal_aero_wateruptake_dr called for'// & - 'diagnostic list but required args not present') - end if - end if - - ! loop over all aerosol modes - call rad_cnst_get_info(list_idx, nmodes=nmodes) - - allocate( & - maer(pcols,pver,nmodes), & - hygro(pcols,pver,nmodes), & - naer(pcols,pver,nmodes), & - dryvol(pcols,pver,nmodes), & - drymass(pcols,pver,nmodes), & - dryrad(pcols,pver,nmodes), & - wetrad(pcols,pver,nmodes), & - wetvol(pcols,pver,nmodes), & - wtrvol(pcols,pver,nmodes), & - rhcrystal(nmodes), & - rhdeliques(nmodes), & - specdens_1(nmodes) ) - - maer(:,:,:) = 0._r8 - hygro(:,:,:) = 0._r8 - - - if (list_idx == 0) then - call pbuf_get_field(pbuf, dgnum_idx, dgncur_a) - else - dgncur_a => dgnumdry_m - end if - - do m = 1, nmodes - - dryvolmr(:,:) = 0._r8 - - ! get mode properties - call rad_cnst_get_mode_props(list_idx, m, sigmag=sigmag, & - rhcrystal=rhcrystal(m), rhdeliques=rhdeliques(m)) - - ! get mode info - call rad_cnst_get_info(list_idx, m, nspec=nspec) - - do l = 1, nspec - - ! get species interstitial mixing ratio ('a') - call rad_cnst_get_aer_mmr(list_idx, m, l, 'a', state, pbuf, raer) - call rad_cnst_get_aer_props(list_idx, m, l, density_aer=specdens, hygro_aer=spechygro) - - if (l == 1) then - ! save off these values to be used as defaults - specdens_1(m) = specdens - spechygro_1 = spechygro - end if - - do k = top_lev, pver - do i = 1, ncol - duma = raer(i,k) - maer(i,k,m) = maer(i,k,m) + duma - dumb = duma/specdens - dryvolmr(i,k) = dryvolmr(i,k) + dumb - hygro(i,k,m) = hygro(i,k,m) + dumb*spechygro - end do - end do - end do - - alnsg = log(sigmag) - - do k = top_lev, pver - do i = 1, ncol - - if (dryvolmr(i,k) > 1.0e-30_r8) then - hygro(i,k,m) = hygro(i,k,m)/dryvolmr(i,k) - else - hygro(i,k,m) = spechygro_1 - end if - - ! dry aerosol properties - - v2ncur_a = 1._r8 / ( (pi/6._r8)*(dgncur_a(i,k,m)**3._r8)*exp(4.5_r8*alnsg**2._r8) ) - ! naer = aerosol number (#/kg) - naer(i,k,m) = dryvolmr(i,k)*v2ncur_a - - ! compute mean (1 particle) dry volume and mass for each mode - ! old coding is replaced because the new (1/v2ncur_a) is equal to - ! the mean particle volume - ! also moletomass forces maer >= 1.0e-30, so (maer/dryvolmr) - ! should never cause problems (but check for maer < 1.0e-31 anyway) - if (maer(i,k,m) .gt. 1.0e-31_r8) then - drydens = maer(i,k,m)/dryvolmr(i,k) - else - drydens = 1.0_r8 - end if - dryvol(i,k,m) = 1.0_r8/v2ncur_a - drymass(i,k,m) = drydens*dryvol(i,k,m) - dryrad(i,k,m) = (dryvol(i,k,m)/pi43)**third - - end do - end do - - end do ! modes - - ! relative humidity calc - - h2ommr => state%q(:,:,1) - t => state%t - pmid => state%pmid - - itim = pbuf_old_tim_idx() - call pbuf_get_field(pbuf, cld_idx, cldn, start=(/1,1,itim/), kount=(/pcols,pver,1/) ) - - do k = top_lev, pver - call qsat_water(t(:ncol,k), pmid(:ncol,k), es(:ncol), qs(:ncol)) - do i = 1, ncol - rh(i,k) = h2ommr(i,k)/qs(i) - rh(i,k) = max(rh(i,k), 0.0_r8) - rh(i,k) = min(rh(i,k), 0.98_r8) - if (cldn(i,k) .lt. 1.0_r8) then - rh(i,k) = (rh(i,k) - cldn(i,k)) / (1.0_r8 - cldn(i,k)) ! clear portion - end if - rh(i,k) = max(rh(i,k), 0.0_r8) - end do - end do - - call modal_aero_wateruptake_sub( & - ncol, nmodes, rhcrystal, rhdeliques, dryrad, & - hygro, rh, dryvol, wetrad, wetvol, & - wtrvol) - - if (list_idx == 0) then - call pbuf_get_field(pbuf, dgnumwet_idx, dgncur_awet) - call pbuf_get_field(pbuf, wetdens_ap_idx, wetdens) - call pbuf_get_field(pbuf, qaerwat_idx, qaerwat) - else - allocate(dgncur_awet(pcols,pver,nmodes), wetdens(pcols,pver,nmodes), & - qaerwat(pcols,pver,nmodes), stat=stat) - if (stat > 0) then - call endrun('modal_aero_wateruptake_dr: allocation FAILURE') - end if - - end if - - do m = 1, nmodes - - do k = top_lev, pver - do i = 1, ncol - - dgncur_awet(i,k,m) = dgncur_a(i,k,m) * (wetrad(i,k,m)/dryrad(i,k,m)) - qaerwat(i,k,m) = rhoh2o*naer(i,k,m)*wtrvol(i,k,m) - - ! compute aerosol wet density (kg/m3) - if (wetvol(i,k,m) > 1.0e-30_r8) then - wetdens(i,k,m) = (drymass(i,k,m) + rhoh2o*wtrvol(i,k,m))/wetvol(i,k,m) - else - wetdens(i,k,m) = specdens_1(m) - end if - end do - end do - - end do ! modes - - if (list_idx == 0) then - - do m = 1, nmodes - ! output to history - write( trnum, '(i3.3)' ) m - call outfld( 'wat_a'//trnum(3:3), qaerwat(:,:,m), pcols, lchnk) - call outfld( 'dgnd_a'//trnum(2:3), dgncur_a(:,:,m), pcols, lchnk) - call outfld( 'dgnw_a'//trnum(2:3), dgncur_awet(:,:,m), pcols, lchnk) - end do - - else - - ! for diagnostic calcs just return results - dgnumwet_m => dgncur_awet - qaerwat_m => qaerwat - wetdens_m => wetdens - - end if - - deallocate( & - maer, hygro, naer, dryvol, drymass, dryrad, & - wetrad, wetvol, wtrvol, rhcrystal, rhdeliques, specdens_1) - -end subroutine modal_aero_wateruptake_dr - -!=============================================================================== - -subroutine modal_aero_wateruptake_sub( & - ncol, nmodes, rhcrystal, rhdeliques, dryrad, & - hygro, rh, dryvol, wetrad, wetvol, & - wtrvol) - -!----------------------------------------------------------------------- -! -! Purpose: Compute aerosol wet radius -! -! Method: Kohler theory -! -! Author: S. Ghan -! -!----------------------------------------------------------------------- - - ! Arguments - integer, intent(in) :: ncol ! number of columns - integer, intent(in) :: nmodes - - real(r8), intent(in) :: rhcrystal(:) - real(r8), intent(in) :: rhdeliques(:) - real(r8), intent(in) :: dryrad(:,:,:) ! dry volume mean radius of aerosol (m) - real(r8), intent(in) :: hygro(:,:,:) ! volume-weighted mean hygroscopicity (--) - real(r8), intent(in) :: rh(:,:) ! relative humidity (0-1) - real(r8), intent(in) :: dryvol(:,:,:) - - real(r8), intent(out) :: wetrad(:,:,:) ! wet radius of aerosol (m) - real(r8), intent(out) :: wetvol(:,:,:) ! single-particle-mean wet volume (m3) - real(r8), intent(out) :: wtrvol(:,:,:) ! single-particle-mean water volume in wet aerosol (m3) - - ! local variables - - integer :: i, k, m - - real(r8) :: hystfac ! working variable for hysteresis - !----------------------------------------------------------------------- - - - ! loop over all aerosol modes - do m = 1, nmodes - - hystfac = 1.0_r8 / max(1.0e-5_r8, (rhdeliques(m) - rhcrystal(m))) - - do k = top_lev, pver - do i = 1, ncol - - ! compute wet radius for each mode - call modal_aero_kohler(dryrad(i:,k,m), hygro(i:,k,m), rh(i:,k), wetrad(i:,k,m), 1, 1) - - wetrad(i,k,m) = max(wetrad(i,k,m), dryrad(i,k,m)) - wetvol(i,k,m) = pi43*wetrad(i,k,m)**3 - wetvol(i,k,m) = max(wetvol(i,k,m), dryvol(i,k,m)) - wtrvol(i,k,m) = wetvol(i,k,m) - dryvol(i,k,m) - wtrvol(i,k,m) = max(wtrvol(i,k,m), 0.0_r8) - - ! apply simple treatment of deliquesence/crystallization hysteresis - ! for rhcrystal < rh < rhdeliques, aerosol water is a fraction of - ! the "upper curve" value, and the fraction is a linear function of rh - if (rh(i,k) < rhcrystal(m)) then - wetrad(i,k,m) = dryrad(i,k,m) - wetvol(i,k,m) = dryvol(i,k,m) - wtrvol(i,k,m) = 0.0_r8 - else if (rh(i,k) < rhdeliques(m)) then - wtrvol(i,k,m) = wtrvol(i,k,m)*hystfac*(rh(i,k) - rhcrystal(m)) - wtrvol(i,k,m) = max(wtrvol(i,k,m), 0.0_r8) - wetvol(i,k,m) = dryvol(i,k,m) + wtrvol(i,k,m) - wetrad(i,k,m) = (wetvol(i,k,m)/pi43)**third - end if - - end do ! columns - end do ! levels - - end do ! modes - -end subroutine modal_aero_wateruptake_sub -#endif - -!----------------------------------------------------------------------- - subroutine modal_aero_kohler( & - rdry_in, hygro, s, rwet_out, im, imx ) - -! calculates equlibrium radius r of haze droplets as function of -! dry particle mass and relative humidity s using kohler solution -! given in pruppacher and klett (eqn 6-35) - -! for multiple aerosol types, assumes an internal mixture of aerosols - - implicit none - -! arguments - integer :: im ! number of grid points to be processed - integer :: imx ! dimensioned number of grid points - real(r8) :: rdry_in(imx) ! aerosol dry radius (m) - real(r8) :: hygro(imx) ! aerosol volume-mean hygroscopicity (--) - real(r8) :: s(imx) ! relative humidity (1 = saturated) - real(r8) :: rwet_out(imx) ! aerosol wet radius (m) - -! local variables - integer, parameter :: imax=200 - integer :: i, n, nsol - - real(r8) :: a, b - real(r8) :: p40(imax),p41(imax),p42(imax),p43(imax) ! coefficients of polynomial - real(r8) :: p30(imax),p31(imax),p32(imax) ! coefficients of polynomial - real(r8) :: p - real(r8) :: r3, r4 - real(r8) :: r(imx) ! wet radius (microns) - real(r8) :: rdry(imax) ! radius of dry particle (microns) - real(r8) :: ss ! relative humidity (1 = saturated) - real(r8) :: slog(imax) ! log relative humidity - real(r8) :: vol(imax) ! total volume of particle (microns**3) - real(r8) :: xi, xr - - complex(r8) :: cx4(4,imax),cx3(3,imax) - - real(r8), parameter :: eps = 1.e-4_r8 - real(r8), parameter :: mw = 18._r8 - real(r8), parameter :: pi = 3.14159_r8 - real(r8), parameter :: rhow = 1._r8 - real(r8), parameter :: surften = 76._r8 - real(r8), parameter :: tair = 273._r8 - real(r8), parameter :: third = 1._r8/3._r8 - real(r8), parameter :: ugascon = 8.3e7_r8 - - -! effect of organics on surface tension is neglected - a=2.e4_r8*mw*surften/(ugascon*tair*rhow) - - do i=1,im - rdry(i) = rdry_in(i)*1.0e6_r8 ! convert (m) to (microns) - vol(i) = rdry(i)**3 ! vol is r**3, not volume - b = vol(i)*hygro(i) - -! quartic - ss=min(s(i),1._r8-eps) - ss=max(ss,1.e-10_r8) - slog(i)=log(ss) - p43(i)=-a/slog(i) - p42(i)=0._r8 - p41(i)=b/slog(i)-vol(i) - p40(i)=a*vol(i)/slog(i) -! cubic for rh=1 - p32(i)=0._r8 - p31(i)=-b/a - p30(i)=-vol(i) - end do - - - do 100 i=1,im - -! if(vol(i).le.1.e-20)then - if(vol(i).le.1.e-12_r8)then - r(i)=rdry(i) - go to 100 - endif - - p=abs(p31(i))/(rdry(i)*rdry(i)) - if(p.lt.eps)then -! approximate solution for small particles - r(i)=rdry(i)*(1._r8+p*third/(1._r8-slog(i)*rdry(i)/a)) - else - call makoh_quartic(cx4(1,i),p43(i),p42(i),p41(i),p40(i),1) -! find smallest real(r8) solution - r(i)=1000._r8*rdry(i) - nsol=0 - do n=1,4 - xr=real(cx4(n,i)) - xi=aimag(cx4(n,i)) - if(abs(xi).gt.abs(xr)*eps) cycle - if(xr.gt.r(i)) cycle - if(xr.lt.rdry(i)*(1._r8-eps)) cycle - if(xr.ne.xr) cycle - r(i)=xr - nsol=n - end do - if(nsol.eq.0)then -#ifndef GEOS5_PORT - write(iulog,*) & - 'ccm kohlerc - no real(r8) solution found (quartic)' - write(iulog,*)'roots =', (cx4(n,i),n=1,4) - write(iulog,*)'p0-p3 =', p40(i), p41(i), p42(i), p43(i) - write(iulog,*)'rh=',s(i) - write(iulog,*)'setting radius to dry radius=',rdry(i) -#else -#if DEBUG - write(iulog,*) & - 'ccm kohlerc - no real(r8) solution found (quartic)' - write(iulog,*)'roots =', (cx4(n,i),n=1,4) - write(iulog,*)'p0-p3 =', p40(i), p41(i), p42(i), p43(i) - write(iulog,*)'rh=',s(i) - write(iulog,*)'setting radius to dry radius=',rdry(i) -#endif -#endif - r(i)=rdry(i) -! stop - endif - endif - - if(s(i).gt.1._r8-eps)then -! save quartic solution at s=1-eps - r4=r(i) -! cubic for rh=1 - p=abs(p31(i))/(rdry(i)*rdry(i)) - if(p.lt.eps)then - r(i)=rdry(i)*(1._r8+p*third) - else - call makoh_cubic(cx3,p32,p31,p30,im) -! find smallest real(r8) solution - r(i)=1000._r8*rdry(i) - nsol=0 - do n=1,3 - xr=real(cx3(n,i)) - xi=aimag(cx3(n,i)) - if(abs(xi).gt.abs(xr)*eps) cycle - if(xr.gt.r(i)) cycle - if(xr.lt.rdry(i)*(1._r8-eps)) cycle - if(xr.ne.xr) cycle - r(i)=xr - nsol=n - end do - if(nsol.eq.0)then -#ifndef GEOS5_PORT - write(iulog,*) & - 'ccm kohlerc - no real(r8) solution found (cubic)' - write(iulog,*)'roots =', (cx3(n,i),n=1,3) - write(iulog,*)'p0-p2 =', p30(i), p31(i), p32(i) - write(iulog,*)'rh=',s(i) - write(iulog,*)'setting radius to dry radius=',rdry(i) -#else -#if DEBUG - write(iulog,*) & - 'ccm kohlerc - no real(r8) solution found (cubic)' - write(iulog,*)'roots =', (cx3(n,i),n=1,3) - write(iulog,*)'p0-p2 =', p30(i), p31(i), p32(i) - write(iulog,*)'rh=',s(i) - write(iulog,*)'setting radius to dry radius=',rdry(i) -#endif -#endif - r(i)=rdry(i) -! stop - endif - endif - r3=r(i) -! now interpolate between quartic, cubic solutions - r(i)=(r4*(1._r8-s(i))+r3*(s(i)-1._r8+eps))/eps - endif - - 100 continue - -! bound and convert from microns to m - do i=1,im - r(i) = min(r(i),30._r8) ! upper bound based on 1 day lifetime - rwet_out(i) = r(i)*1.e-6_r8 - end do - - return - end subroutine modal_aero_kohler - - -!----------------------------------------------------------------------- - subroutine makoh_cubic( cx, p2, p1, p0, im ) -! -! solves x**3 + p2 x**2 + p1 x + p0 = 0 -! where p0, p1, p2 are real -! - integer, parameter :: imx=200 - integer :: im - real(r8) :: p0(imx), p1(imx), p2(imx) - complex(r8) :: cx(3,imx) - - integer :: i - real(r8) :: eps, q(imx), r(imx), sqrt3, third - complex(r8) :: ci, cq, crad(imx), cw, cwsq, cy(imx), cz(imx) - - save eps - data eps/1.e-20_r8/ - - third=1._r8/3._r8 - ci=cmplx(0._r8,1._r8,r8) - sqrt3=sqrt(3._r8) - cw=0.5_r8*(-1+ci*sqrt3) - cwsq=0.5_r8*(-1-ci*sqrt3) - - do i=1,im - if(p1(i).eq.0._r8)then -! completely insoluble particle - cx(1,i)=(-p0(i))**third - cx(2,i)=cx(1,i) - cx(3,i)=cx(1,i) - else - q(i)=p1(i)/3._r8 - r(i)=p0(i)/2._r8 - crad(i)=r(i)*r(i)+q(i)*q(i)*q(i) - crad(i)=sqrt(crad(i)) - - cy(i)=r(i)-crad(i) - if (abs(cy(i)).gt.eps) cy(i)=cy(i)**third - cq=q(i) - cz(i)=-cq/cy(i) - - cx(1,i)=-cy(i)-cz(i) - cx(2,i)=-cw*cy(i)-cwsq*cz(i) - cx(3,i)=-cwsq*cy(i)-cw*cz(i) - endif - enddo - - return - end subroutine makoh_cubic - - -!----------------------------------------------------------------------- - subroutine makoh_quartic( cx, p3, p2, p1, p0, im ) - -! solves x**4 + p3 x**3 + p2 x**2 + p1 x + p0 = 0 -! where p0, p1, p2, p3 are real -! - integer, parameter :: imx=200 - integer :: im - real(r8) :: p0(imx), p1(imx), p2(imx), p3(imx) - complex(r8) :: cx(4,imx) - - integer :: i - real(r8) :: third, q(imx), r(imx) - complex(r8) :: cb(imx), cb0(imx), cb1(imx), & - crad(imx), cy(imx), czero - - - czero=cmplx(0.0_r8,0.0_r8) - third=1._r8/3._r8 - - do 10 i=1,im - - q(i)=-p2(i)*p2(i)/36._r8+(p3(i)*p1(i)-4*p0(i))/12._r8 - r(i)=-(p2(i)/6)**3+p2(i)*(p3(i)*p1(i)-4*p0(i))/48._r8 & - +(4*p0(i)*p2(i)-p0(i)*p3(i)*p3(i)-p1(i)*p1(i))/16 - - crad(i)=r(i)*r(i)+q(i)*q(i)*q(i) - crad(i)=sqrt(crad(i)) - - cb(i)=r(i)-crad(i) - if(cb(i).eq.czero)then -! insoluble particle - cx(1,i)=(-p1(i))**third - cx(2,i)=cx(1,i) - cx(3,i)=cx(1,i) - cx(4,i)=cx(1,i) - else - cb(i)=cb(i)**third - - cy(i)=-cb(i)+q(i)/cb(i)+p2(i)/6 - - cb0(i)=sqrt(cy(i)*cy(i)-p0(i)) - cb1(i)=(p3(i)*cy(i)-p1(i))/(2*cb0(i)) - - cb(i)=p3(i)/2+cb1(i) - crad(i)=cb(i)*cb(i)-4*(cy(i)+cb0(i)) - crad(i)=sqrt(crad(i)) - cx(1,i)=(-cb(i)+crad(i))/2._r8 - cx(2,i)=(-cb(i)-crad(i))/2._r8 - - cb(i)=p3(i)/2-cb1(i) - crad(i)=cb(i)*cb(i)-4*(cy(i)-cb0(i)) - crad(i)=sqrt(crad(i)) - cx(3,i)=(-cb(i)+crad(i))/2._r8 - cx(4,i)=(-cb(i)-crad(i))/2._r8 - endif - 10 continue - - return - end subroutine makoh_quartic - -!---------------------------------------------------------------------- - - end module modal_aero_wateruptake - - diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_aero.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_aero.F90 deleted file mode 100644 index 636baa4b..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_aero.F90 +++ /dev/null @@ -1,437 +0,0 @@ -module module_data_mosaic_aero - - use module_data_mosaic_kind, only: r8 - - implicit none - - ! mosaic.21.0.h - ! 09-jan-07 raz - major clean up of variables - ! 31-jul-06 raz - implemented Li and Lu (2001) surface tension model - ! 19-apr-06 raz - updated max nh4 concentration constraints - ! 11-apr-05 raz - added SOA based on SORGAM mechanism - ! 07-jan-05 raz - updated and cleaned up variable lists - ! 08-jul-03 raz - updated many variables - ! 07-aug-02 rce - this is rahul's latest version from freshair - ! 19-aug-02 raz - declared mass_soluble_a and kg as real - ! 07-oct-02 raz - declared zc and za as integer - ! 09-oct-02 raz - explicitly declared all variables - ! 29-oct-02 raz - defined naercomp as the total number of aerosol compounds - !---------------------------------------------------------------------- - - ! number of aerosol bins - integer, save :: nbin_a_max = -999888777 ! maximum number of aerosol bins !BSINGH - 05/28/2013(RCE updates) - integer, save :: nbin_a = -999888777 ! in-use number of aerosol bins !BSINGH - namelist variable - - ! mosaic-specific parameters - integer, parameter :: ngas_ioa = 4+1 ! inorganic volatile aerosol species that have a gaseous counterpart - integer, parameter :: ngas_soa = 8 ! volatile soa species that have a gaseous counterpart - integer, parameter :: ngas_volatile = ngas_ioa + ngas_soa - integer, parameter :: naer = 19 ! num of chemical species per bin (inorg + org) - integer, parameter :: naercomp= 30+4 ! num of electrolytes + oc, bc, and oin - integer, parameter :: nelectrolyte = 18+4 ! num of electrolytes - integer, parameter :: nsalt = 12+3 ! num of soluble salts - integer, parameter :: nsoluble= 16+4 ! num of soluble electrolytes - integer, parameter :: ncation = 4 ! num of cations - integer, parameter :: nanion = 4+1 ! num of anions - - integer, parameter :: nrxn_aer_gl = 4 ! num of gas-liquid equilibria - integer, parameter :: nrxn_aer_ll = 3 ! num of liquid-liquid equilibria - integer, parameter :: nrxn_aer_sg = 2 ! num of solid-gas equilibria - integer, parameter :: nrxn_aer_sl = nsalt! num of solid-liquid equilibria - - integer, parameter :: mASTEM = 1 ! Adaptive Step Time-Split Euler Method - integer, parameter :: mLSODE = 2 ! LSODES integrator - integer, parameter :: mMODAL = 1 ! Modal size distribution framework - integer, parameter :: mUNSTRUCTURED = 2 ! "unstructured" size distribution framework - ! (no special organization of bins; no transfer of particles between bins) - integer, parameter :: mSECTIONAL = 3 ! Sectional size distribution framework - integer, parameter :: mON = 1 ! flag: ON - integer, parameter :: mOFF = 0 ! flag:OFF - integer, parameter :: mYES = mON ! flag: yes or true - integer, parameter :: mNO = mOFF ! flag: no or false - - integer, parameter :: jsolid = 1 - integer, parameter :: jliquid= 2 - integer, parameter :: jtotal = 3 - - integer, parameter :: jhyst_lo = 0 ! lower hysteresis leg - integer, parameter :: jhyst_up = 1 ! upper hysteresis leg - integer, parameter :: jhyst_undefined = -1 ! undefined - - ! values for mhyst_method - integer, parameter :: mhyst_uporlo_jhyst = 1 - ! select upper/lower using "box method" involving jhyst_leg - ! *** this should only be used for box model applications - ! *** do not use with for transport model applications (cam5, wrf-chem, etc) - integer, parameter :: mhyst_uporlo_waterhyst = 2 - ! select upper/lower using "3-d method" involving water_a_hyst - integer, parameter :: mhyst_force_up = 3 ! force upper leg - integer, parameter :: mhyst_force_lo = 4 ! force lower leg - - integer, parameter :: no_aerosol = 0 ! flag - integer, parameter :: all_solid = 1 ! flag - integer, parameter :: all_liquid = 2 ! flag - integer, parameter :: mixed = 3 ! flag - - integer, parameter :: soluble = 1 ! flag - integer, parameter :: insoluble = 2 ! flag - - integer, parameter :: MDRH_T_NUM = 63 !BSINGH - Number of entities in MDRH_T array - integer, parameter :: jsulf_poor_NUM = 211 !BSINGH - Number of entities in jsulf_poor array - integer, parameter :: jsulf_rich_NUM = 71 !BSINGH - Number of entities in jsulf_rich array - integer, parameter :: d_mdrh_DIM2 = 4 !BSINGH - Number of entities in d_MDRH 2nd dimension - ! real(r8), parameter :: mass_cutoff = 1.e-3 ! ng/m^3 - real(r8), parameter :: mass_cutoff = 1.e-6 ! new value on 02-mar-2010 - - real(r8), parameter :: density_min_allow = 1.0 ! minimum allowed density (g/cc) - real(r8), parameter :: density_max_allow = 3.0 ! maximum allowed density (g/cc) - real(r8), parameter :: ah2o_max = 0.99 ! maximum water activity allowed in aerosol water uptake calculations - - ! note - purpose of this data structure is to simplify passing new variables - ! into and out of the many mosaic routines - type :: mosaic_vars_aa_type - integer :: it_host - integer :: it_mosaic - integer, dimension(6) :: hostgridinfo(6) - integer :: f_mos_fail - integer :: isteps_astem - integer :: isteps_astem_max - integer :: jastem_call - integer :: jastem_fail - integer :: jmesa_call - integer :: jmesa_fail - integer :: niter_mesa_max - integer :: nmax_astem - integer :: nmax_mesa - logical :: flag_itr_kel - logical :: zero_water_flag - real(r8) :: cumul_steps_astem - real(r8) :: niter_mesa - real(r8), dimension(5,4) :: xnerr_astem_negative - integer, dimension(:), allocatable :: iter_mesa - end type mosaic_vars_aa_type - - - - !---------------------------------------------------------------------- - ! MOSAIC species indices - ! - ! gas - integer, save :: & - ih2so4_g, ihno3_g, ihcl_g, inh3_g, & - imsa_g, & - iaro1_g, iaro2_g, ialk1_g, iole1_g, & - iapi1_g, iapi2_g, ilim1_g, ilim2_g - - ! aerosol generic - integer, save :: & - iso4_a, ino3_a, icl_a, inh4_a, ico3_a, & - imsa_a, ina_a, ica_a, ioc_a, ibc_a, & - ioin_a, iaro1_a, iaro2_a, ialk1_a, iole1_a, & - iapi1_a, iapi2_a, ilim1_a, ilim2_a - - ! aerosol elecctrolytes/compounds - integer, save :: & - jnh4so4, jlvcite, jnh4hso4, jnh4no3, jnh4cl, & - jna2so4, jna3hso4, jnahso4, jnano3, jnacl, & - jcaso4, jcano3, jcacl2, jcaco3, jh2so4, & - jhno3, jhcl, jhhso4, & - jnh4msa, jnamsa, jcamsa2, jmsa, & - joc, jbc, join, jaro1, jaro2, & - jalk1, jole1, japi1, japi2, jlim1, & - jlim2, jh2o - - ! aerosol ions - integer, save :: & - jc_h, jc_nh4, jc_na, jc_ca, & - ja_hso4, ja_so4, ja_no3, ja_cl, ja_msa ! , ja_co3 - - !---------------------------------------------------------------------- - ! MOSAIC variables - - ! NOTES on use_cam5mam_soa_params and use_cam5mam_accom_coefs - ! pure MOSAIC box model runs - these should be 0 - ! pure CAM5 runs - these can be 0 or 1 (usually 1) - ! their values are set in module_mosaic_cam_init.F90 - ! MOSAIC box model runs that emulate CAM5 behavior (e.g. for debugging etc.) - - ! their values should match those in the CAM5 run (usually 1) - integer, save :: use_cam5mam_soa_params = 0 ! if >0, use cam5-mam soa/soag parameter values - integer, save :: use_cam5mam_accom_coefs = 0 ! if >0, use cam5-mam accomodation coefficient values - - integer, save :: & - !it_mosaic, & ! time-step index - !irepeat_mosaic, & ! "repeat" index - !iclm_aer, & ! i-location - !jclm_aer, & ! j-location - !kclm_aer, & ! k-location - mclm_aer, & ! m-subarea - mGAS_AER_XFER, & ! flag: mON, mOFF - mDYNAMIC_SOLVER, & ! flag: mASTEM, mLSODE - mSIZE_FRAMEWORK, & ! flag: mMODAL, mSECTIONAL - mhyst_method, & ! flag: 0, 1, 2 - maersize_init_flag1, & ! flag: 0, 1, 2 - mcoag_flag1, & ! flag: 0, 1, 2, ... - mmovesect_flag1, & ! flag: 0, 1, 2, ... - mnewnuc_flag1, & ! flag: 0, 1, 2, ... - msectional_flag1, & ! flag: 0, 1, 2, ... - msectional_flag2, & ! flag: 0, 1, 2, ... - method_bcfrac, & ! flag: ... - method_kappa, & ! flag: ... - ifreq_coag, & ! frequency at which coagulation is done - ipmcmos_aero, & - maeroptic_aero - !jaerosolstate(nbin_a_max), & ! flag: no_aerosol, all_solid, all_liquid, mixed - !jaerosolstate_bgn(nbin_a_max)!, & ! flag: no_aerosol, all_solid, all_liquid, mixed - !jphase(nbin_a_max), & ! phase index: jtotal, jsolid, jliquid - !jhyst_leg(nbin_a_max)!, & ! hysteresis leg: jhyst_up, jhyst_lo - !iprint_input ! flag: mON, mOFF - - !real(r8), save :: & - !num_a(nbin_a_max), & ! #/cc(air) - !Dpgn_a(nbin_a_max), & ! cm - !Dp_dry_a(nbin_a_max), & ! cm - !Dp_wet_a(nbin_a_max), & ! cm - !Dp_core_a(nbin_a_max), & ! diameter of "optical core" (cm) - !area_dry_a(nbin_a_max), & ! cm^2/cc(air) - !area_wet_a(nbin_a_max), & ! cm^2/cc(air) - !mass_dry_salt(nbin_a_max), & ! g/cc(air) - !mass_dry_a_bgn(nbin_a_max), & ! g/cc(air) - !mass_dry_a(nbin_a_max), & ! g/cc(air) - !mass_wet_a(nbin_a_max), & ! g/cc(air) - !mass_soluble_a(nbin_a_max), & ! ng/cc(air) - !vol_dry_a(nbin_a_max), & ! cc/cc(air) - !vol_wet_a(nbin_a_max), & ! cc/cc(air) - !dens_dry_a_bgn(nbin_a_max), & ! g/cc - !dens_dry_a(nbin_a_max), & ! g/cc - !dens_wet_a(nbin_a_max), & ! g/cc - !sigmag_a(nbin_a_max), & ! - - !water_a(nbin_a_max), & ! kg(water)/m^3(air) - !water_a_hyst(nbin_a_max), & ! kg(water)/m^3(air) hysteresis (at 60% RH) - !water_a_up(nbin_a_max), & ! kg(water)/m^3(air) at 60% RH - !pH(nbin_a_max), & ! pH - !aer(naer,3,nbin_a_max), & ! nmol/m^3 - !aer_sum(3,nbin_a_max), & ! nmol/m^3 - !aer_percent(naer,3,nbin_a_max), & ! % - !comp_a(naercomp), & ! g/cc(air) - !electrolyte(nelectrolyte,3,nbin_a_max), & ! nmol/m^3 - !electrolyte_sum(3,nbin_a_max), & ! nmol/m^3 - !epercent(nelectrolyte,3,nbin_a_max), & ! % - !gas(ngas_volatile), & ! nmol/m^3 - !aH2O, & - !aH2O_a(nbin_a_max), & - !DpmV(nbin_a_max), & - !volume_a(nbin_a_max), & - !volume_bin(nbin_a_max), & ! dry volume of one particle - !kelvin(nbin_a_max), & ! kelvin factor for water content - !kel(ngas_volatile,nbin_a_max), & ! kelvin factor for condensing species - !kelvin_nh4no3, & - !kelvin_nh4cl!, & - !total_species(ngas_volatile), & - !ext_cross(nbin_a_max), & ! extinction cross section of a particle (cm^-2) - !scat_cross(nbin_a_max), & ! scattering cross section of a particle (cm^-2) - !asym_particle(nbin_a_max) ! asymmetry parameter of a particle (dimensionless) - - real(r8), save :: & - dlo_aersize_init, & ! lowermost dry Dp for aersize init (micron) - dhi_aersize_init, & ! uppermost dry Dp for aersize init (micron) - xcutlo_atype_md1_init, & ! lowermost & uppermost bc mass fractions for - xcuthi_atype_md1_init, & ! for initializing the "atype_md1" dimension - xcutlo_atype_md2_init, & ! lowermost & uppermost hygroscopicity (kappa) for - xcuthi_atype_md2_init ! for initializing the "atype_md2" dimension - - integer, save :: & - method_atype_md1_init, & ! method for initializing "atype_md1" - method_atype_md2_init ! method for initializing "atype_md2" - - - !---------------------------------------------------------------------- - ! ASTEM variables - integer, save :: & - !idry_case3a(nbin_a_max), & ! mYES, mNO - !ieqblm_bin(nbin_a_max), & ! mYES, mNO - !ieqblm_ASTEM, & ! mYES, mNO - !ieqblm_soa, & ! mYES, mNO - !jASTEM_call, & - !jASTEM_fail, & - !isteps_ASTEM, & - !isteps_SOA, & - !isteps_ASTEM_max, & - nmax_ASTEM!, & - !integrate(ngas_volatile,3,nbin_a_max) ! mYES, mNO - - real(r8), save :: & - !Po_soa(ngas_volatile), & ! Pascal - !sat_soa(ngas_volatile), & ! nmol/m^3(air) - !x_soa(naer), & ! soa mole fraction - !sfc_a(ngas_volatile), & ! nmol/m^3 - !Heff(ngas_volatile,nbin_a_max), & ! - !kg(ngas_volatile,nbin_a_max), & ! 1/s - !df_gas_s(ngas_volatile,nbin_a_max), & ! nmol/m^3 (G-G*) = driving force) - !df_gas_l(ngas_volatile,nbin_a_max), & ! nmol/m^3 (G-G*) = driving force) - !df_gas_o(ngas_volatile,nbin_a_max), & ! nmol/m^3 (G-G*) = driving force) - !df_gas(ngas_volatile,nbin_a_max), & ! nmol/m^3 (G-G*) = driving force) - !flux_s(ngas_volatile,nbin_a_max), & ! nmol/m^3/s - !flux_l(ngas_volatile,nbin_a_max), & ! nmol/m^3/s - !flux_o(ngas_volatile,nbin_a_max), & ! nmol/m^3/s - !flux(ngas_volatile,nbin_a_max), & ! nmol/m^3/s - !sumkg_h2so4, & ! 1/s - !sumkg_msa, & ! 1/s - !sumkg_nh3, & ! 1/s - !sumkg_hno3, & ! 1/s - !sumkg_hcl, & ! 1/s - !delta_nh3_max(nbin_a_max), & ! nmol/m^3 - !delta_hno3_max(nbin_a_max), & ! nmol/m^3 - !delta_hcl_max(nbin_a_max), & ! nmol/m^3 - !Keq_nh4no3, & - !Keq_nh4cl, & - !volatile_s(ngas_volatile,nbin_a_max), & ! nmol/m^3 - !phi_volatile_s(ngas_volatile,nbin_a_max), & ! relative dr. force = (G-G*)/G - !phi_volatile_l(ngas_volatile,nbin_a_max), & ! relative dr. force = (G-G*)/G - !phi_volatile_o(ngas_volatile,nbin_a_max), & ! relative dr. force = (G-G*)/G - !phi_nh4no3_s, & ! relative dr. force: 0 to 1 - !phi_nh4cl_s, & ! relative dr. force: 0 to 1 - !sum_vdf_s(ngas_volatile), & ! (nmol/m^3)^2 - !sum_vol_s(ngas_volatile), & ! nmol/m^3 - !sum_bin_s(ngas_volatile), & ! number of bins that have flux_s(iv) < 0 - !avg_df_gas_s(ngas_volatile), & ! - !h_s_i_m(ngas_volatile,nbin_a_max), & ! s - !alpha_gas(ngas_volatile), & ! - adaptive - alpha_ASTEM, & ! 0.01 to 0.05 - rtol_eqb_ASTEM, & ! 0.01 to 0.03 - ptol_mol_ASTEM!, & ! 0.01 to 1.0 - !cumul_steps_ASTEM, & - !avg_steps_ASTEM - - !---------------------------------------------------------------------- - ! MESA variables - integer, save :: & - jsalt_index(nsalt), & - jsulf_poor(jsulf_poor_NUM), & - jsulf_rich(jsulf_rich_NUM), & - !jsalt_present(nsalt), & - Nmax_mesa!, & - !jMESA_call, & - !jMESA_fail, & - !iter_MESA(nbin_a_max), & - !niter_MESA_max - - real(r8), save :: & - !eleliquid(nelectrolyte), & - !flux_sl(nsalt), & - !phi_salt(nsalt), & - !phi_salt_old(nsalt), & - !phi_bar(nsalt), & - !alpha_salt(nsalt), & - !sat_ratio(nsalt), & - !hsalt(nsalt), & - !hsalt_max, & - !frac_salt_liq(nsalt), & - !frac_salt_solid(nsalt), & - !growth_factor(nbin_a_max), & - d_mdrh(MDRH_T_NUM,d_mdrh_DIM2), & ! mdrh(T) poly coeffs - !MDRH(nbin_a_max), & - !MDRH_T(MDRH_T_NUM), & - !molality0(nelectrolyte), & - rtol_mesa!, & - !niter_MESA, & - !niter_MESA_avg, & - !G_MX(nelectrolyte), & - !K_MX(nelectrolyte) - - !---------------------------------------------------------------------- - ! MOSAIC physico-chemical constants - character(len=6), save :: phasestate(0:4) - character(len=8), save :: ename(nelectrolyte) ! electrolyte names - character(len=8), save :: aer_name(naer) ! generic aerosol species name - character(len=8), save :: gas_name(ngas_volatile) ! gas species name - - real(r8), save :: & - !T_K, & ! temperature (K) - !P_atm, & ! pressure (atm) - !RH_pc, & ! relative humidity (%) - !cair_mol_cc, & ! air conc in mol/cc - !cair_mol_m3, & ! air conc in mol/m^3 - !conv1a, & - !conv1b, & - !conv2a, & - !conv2b, & - mw_electrolyte(nelectrolyte), & ! molecular wt of electrolytes - mw_aer_mac(naer), & ! molecular wt of generic species - mw_comp_a(naercomp), & ! molecular wt of compounds - mw_c(ncation), & ! molecular wt of cations - mw_a(nanion), & ! molecular wt of anions - dens_electrolyte(nelectrolyte), & ! g/cc - dens_aer_mac(naer), & ! g/cc - dens_comp_a(naercomp), & ! g/cc (density of compounds) - kappa_aer_mac(naer), & ! "kappa" value (= hygroscopicity) - partial_molar_vol(ngas_volatile)!, & ! cc/mol - !sigma_water, & ! water surface tension (N/m) - !sigma_soln(nbin_a_max), & ! solution surface tension (N/m) - !Keq_gl(nrxn_aer_gl), & ! gas-liq eqblm const - !Keq_ll(nrxn_aer_ll), & ! liq-liq eqblm const - !Keq_sg(nrxn_aer_sg), & ! solid-gas eqbln const - !Keq_sl(nrxn_aer_sl), & ! solid-liq eqblm const - !Kp_nh3, & ! - !Kp_nh4no3, & ! - !Kp_nh4cl ! - - complex & - ref_index_a(naercomp)!, & ! refractive index of compounds - ! ri_avg_a(nbin_a_max), & ! vol avg ref index of bin - ! ri_shell_a(nbin_a_max), & ! vol avg ref index of bin for shell - ! ri_core_a(nbin_a_max) ! vol avg ref index of bin for core - - !---------------------------------------------------------------------- - ! MOSAIC activity coefficient models variables - - real(r8), save :: & - !mc(Ncation,nbin_a_max), & ! mol/kg(water) - !ma(Nanion,nbin_a_max), & ! mol/kg(water) - !mSULF, & - zc(Ncation), & ! real charge - za(Nanion), & ! real charge - !gam(nelectrolyte,nbin_a_max), & - !gam_ratio(nbin_a_max), & - !log_gamZ(nelectrolyte,nelectrolyte), & - !log_gam(nelectrolyte), & - !activity(nelectrolyte,nbin_a_max), & - !xeq_a(nanion), & - !xeq_c(ncation), & - !na_Ma(nanion), & - !nc_Mc(ncation), & - a_zsr(6,nelectrolyte), & ! binary molality polynomial coeffs - b_zsr(nelectrolyte), & ! binary molality coeff - aw_min(nelectrolyte), & ! minimum frh at which molality polynomial can be used - b_mtem(6,nelectrolyte,nelectrolyte) ! MTEM poly coeffs - - !---------------------------------------------------------------------- - ! MOSAIC massbalance variables -! real(r8), save :: & -! tot_so4_in, & -! tot_no3_in, & -! tot_cl_in, & -! tot_nh4_in, & -! tot_na_in, & -! tot_ca_in, & -! tot_so4_out, & -! tot_no3_out, & -! tot_cl_out, & -! tot_nh4_out, & -! tot_na_out, & -! tot_ca_out, & -! diff_so4, & -! diff_no3, & -! diff_cl, & -! diff_nh4, & -! diff_na, & -! diff_ca, & -! reldiff_so4, & -! reldiff_no3, & -! reldiff_cl, & -! reldiff_nh4, & -! reldiff_na, & -! reldiff_ca - - !---------------------------------------------------------------------- - -end module module_data_mosaic_aero diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_asect.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_asect.F90 deleted file mode 100644 index 073a26e3..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_asect.F90 +++ /dev/null @@ -1,401 +0,0 @@ - module module_data_mosaic_asect - - use module_data_mosaic_kind, only: r8 - use module_data_mosaic_aero, only: nbin_a_max - - implicit none - -!----------------------------------------------------------------------- -! -! The variables in this module provide a means of organizing and accessing -! aerosol species by their chemical component, size bin (or mode), "type", and "phase" -! -! Their purpose is to allow flexible coding of process modules, -! compared to "hard-coding" using specify indices. -! Most (if not all) of these variables are usxwed in the i -! WRF-chem MOSAIC implementation. -! -!----------------------------------------------------------------------- -! -! maxd_atype = maximum allowable number of aerosol types -! maxd_asize = maximum allowable number of aerosol size bins -! maxd_acomp = maximum allowable number of chemical components -! in each aerosol size bin -! maxd_aphase = maximum allowable number of aerosol phases -! (gas, cloud, ice, rain, ...) -! -! ntype_aer = number of aerosol types -! The aerosol type will allow treatment of an externally mixed -! aerosol. For a traditional internally-mixed sectional approach, -! ntype_aer=1. Eventually, multiple types -! could treat fresh primary BC/OC, fresh SO4 from nucleation, -! aged BC/OC/SO4/... mixture, soil dust, sea salt, ... -! -! nphase_aer = number of aerosol phases -! -! ai_phase = phase (p) index for interstitial (unactivated) aerosol particles -! cw_phase = phase (p) index for aerosol particles in cloud water -! ci_phase = phase (p) index for aerosol particles in cloud ice -! rn_phase = phase (p) index for aerosol particles in rain -! sn_phase = phase (p) index for aerosol particles in snow -! gr_phase = phase (p) index for aerosol particles in graupel -! [Note: the value of "xx_phase" will be between 1 and nphase_aer -! for phases that are active in a simulation. The others -! will have non-positive values.] -! -! nsize_aer(t) = number of aerosol size bins for aerosol type t -! -! ncomp_aer(t) = number of "regular" chemical components for aerosol type t -! ncomp_plustracer_aer(t) = number of "regular" plus "tracer" -! chemical components for aerosol type t -! [Note: only "regular" components are used for calculating -! aerosol physical (mass, volume) and chemical properties. -! "Tracer" components are optional, and can be used to track source -! regions, source mechanisms, etc.] -! [Note: for aerosol type t, all phases have the same number of size -! bins, and all size bins have the same number of -! both regular and tracer components.] -! -! ntot_mastercomp_aer = number of aerosol chemical components defined -! in the "master component list". -! [Note: each aerosol type will use some but not necessarily all -! of the components in the "master component list".] -! -! mastercompptr_aer(c,t) = the position/index/i.d. in the -! "master component list" for chemical component c of aerosol type t. -! (1=sulfate, others to be defined by user.) -! -! massptr_aer(c,s,t,p) = the position/index in the chem array for mixing- -! ratio for chemical component c, size bin s, type t, and phase p. -! -! lptr_so4_aer(s,t,p) = the position/index in the chem array for mixing- -! ratio for sulfate for aerosol size bin s, type t, and phase p -! (similar lptr's are defined for no3, cl, msa, co3, -! nh4, na, ca, oin, oc, bc, ...) -! [Note: the massptr_aer allow you to loop over all species of -! an aerosol type. The lptr_so4_aer, etc., allow you to access -! a specific chemical component.] -! -! waterptr_aer(s,t) = the position/index in the chem array for mixing- -! ratio of aerosol water content for size bin s, type t. -! [Note: water content is only carried for the interstitial aerosol -! phase, so there is no p dimension.] -! -! hyswptr_aer(s,t) = the position/index in the chem array for mixing- -! ratio of aerosol "hysteresis water" content for size bin s, type t. -! This is used to determine if aerosol is in the dry or wet state, when -! the ambient RH is between the crystallization and deliquescence RH. -! [Note: hysteresis water content is only carried for the -! interstitial aerosol phase, so there is no p dimension.] -! -! numptr_aer(s,t,p) = the position/index in the chem array for mixing- -! ratio of particle number for size bin s, type t, and phase p. -! -! mprognum_aer(s,t,p) - if positive, number mixing-ratio for size s, type t, -! and phase p will be prognosed. Otherwise, it is diagnosed using -! mass mixing-ratio add assumed/prescribed size. -! -! mixing ratio (mol-water/mol-air) for water -! associated with aerosol size bin s and type t -! -! ibin_of_isize_itype(s,t) - maps from the sectional isize,itype -! to the mosaic "1-D bin index" -! isize_of_ibin(b) - maps from the mosaic "1-D bin index" ibin -! to the sectional isize -! itype_of_ibin(b) - maps from the mosaic "1-D bin index" ibin -! to the sectional itype -! -! itype_of_itype_md1md2(t1,t2) - maps from the "new 3d sectional" -! itype_md1,itype_md2 to the "old sectional" itype -! itype_md1_of_itype(t) - maps from the "old sectional" itype -! to the "new 3d sectional" itype_md1 -! itype_md2_of_itype(t) - maps from the "old sectional" itype -! to the "new 3d sectional" itype_md2 -! -! mastercompindx_so4_aer = the position/index in the -! "master component list" for sulfate. -! (similar lptr's are defined for no3, cl, msa, co3, -! nh4, na, ca, oin, oc, bc, ...) -! [Note: the mastercompindx_xxx_aer are used primarily in -! initialization routines, and generally aren't needed elsewhere.] -! -!----------------------------------------------------------------------- -! -! dens_mastercomp_aer(mc) = dry density (g/cm^3) of component mc -! of the master component list. -! dens_aer(c,t) = dry density (g/cm^3) of aerosol chemical component -! c of type t -! [Note: dens_aer(c,t) == dens_mastercomp_aer(mastercompptr_aer(c,t)) -! The dens_mastercomp_aer is used in some initialization routines. -! The dens_aer is used in most other places because of convenience.] -! -! mw_mastercomp_aer(mc) = molecular weight (g/mol) of component mc -! of the master component list. -! mw_aer(c,t) = molecular weight (g/mol) of aerosol chemical component -! c of type t -! [Note: mw_aer(c,t) == mw_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -! name_mastercomp_aer(mc) = name of component mc of the -! master component list (e.g., "sulfate", "nitrate", ...). -! name_aer(c,t) = name of aerosol chemical component c of type t -! [Note: name_aer(c,t) == name_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -! hygro_mastercomp_aer(mc) = bulk hygroscopicity (--) at dilute conditions -! (RH near 100%) of component mc of the master component list. -! hygro_aer(c,t) = bulk hygroscopicity (--) at dilute conditions -! (RH near 100%) of aerosol chemical component c of type t -! [For definition of bulk hygroscopicity, -! see Abdul-Razzak and Ghan, 2004, J Geophys Res, V105, p. 6837-6844.] -! [*** this bulk hygroscopicity is equivalent to the "kappa" of -! Peters and Kreidenweis, 2007, Atmos Chem Phys, V7, p. 1961-1971.] -! [Note: hygro_aer(c,t) == hygro_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -!----------------------------------------------------------------------- -! -! volumlo_sect(s,t) = 1-particle volume (cm^3) at lower boundary of section m -! volumhi_sect(s,t) = 1-particle volume (cm^3) at upper boundary of section m -! volumcen_sect(s,t)= 1-particle volume (cm^3) at "center" of section m -! -! dlo_sect(s,t) = 1-particle diameter (cm) at lower boundary of section m -! dhi_sect(s,t) = 1-particle diameter (cm) at upper boundary of section m -! dcen_sect(s,t) = 1-particle diameter (cm) at "center" section m -! -! [Note: the "center" values are defined as follows: -! volumcen_sect == 0.5*(volumlo_sect + volumhi_sect) -! == (pi/6) * (dcen_sect**3) ] -! -!----------------------------------------------------------------------- - -! -! the sectional mosaci uses a 2d bin structure -! dimension 1 (dry diameter) = "size" -! dimension 2 (composition ) = "type" -! -! for the newer 3d bin structure, -! dimension 1 (dry diameter) = "size" still -! dimension 2 (bc mass fraction) = "type_md1" -! dimension 3 (hygroscopicity ) = "type_md2" -! -! (dimension 2) x (dimension 3) is mapped to the old 1d "type" -! - !BSINGH - 05/28/2013(RCE updates) - integer, save :: maxd_atype_md1 = -999888777 ! set at run time - integer, save :: maxd_atype_md2 = -999888777 ! set at run time - integer, save :: maxd_atype = -999888777 ! set at run time to maxd_atype_md1*maxd_atype_md2 - - integer, save :: maxd_asize = -999888777 ! set at run time - !BSINGH - 05/28/2013(RCE updates ENDS) - integer, parameter :: maxd_acomp = 19 - integer, parameter :: maxd_aphase = 1 - - integer, parameter :: lunerr = 6 - integer, save :: lunout = 170 - - integer, save :: ai_phase = -999888777 - integer, save :: cw_phase = -999888777 - integer, save :: ci_phase = -999888777 - integer, save :: rn_phase = -999888777 - integer, save :: sn_phase = -999888777 - integer, save :: gr_phase = -999888777 - - integer, save :: ntype_aer = 0 ! number of types - integer, save :: ntype_md1_aer = 0 ! number of md1 types - integer, save :: ntype_md2_aer = 0 ! number of md2 types - - integer, save :: ntot_mastercomp_aer = 0 ! number of master components - integer, save :: nphase_aer = 0 ! number of phases - - !BSINGH - 05/28/2013(RCE updates) - integer, save, allocatable :: & - nsize_aer(:), & ! number of size bins - ncomp_aer(:), & ! number of chemical components - ncomp_plustracer_aer(:), & - mastercompptr_aer(:,:), & ! mastercomp index - massptr_aer(:,:,:,:), & - ! index for mixing ratio - waterptr_aer(:,:), & ! index for aerosol water - hyswptr_aer(:,:), & - numptr_aer(:,:,:), & - ! index for the number mixing ratio - mprognum_aer(:,:,:) - - integer, save, allocatable :: & - ibin_of_isize_itype(:,:), & - isize_of_ibin(:), & - itype_of_ibin(:), & - itype_of_itype_md1md2(:,:), & - itype_md1_of_itype(:), & - itype_md2_of_itype(:) - !BSINGH - 05/28/2013(RCE updates ENDS) - -! these indices give the location in the "mastercomp list" of -! the different aerosol chemical (or tracer) components - integer, save :: mastercompindx_so4_aer = -999888777 - integer, save :: mastercompindx_no3_aer = -999888777 - integer, save :: mastercompindx_cl_aer = -999888777 - integer, save :: mastercompindx_msa_aer = -999888777 - integer, save :: mastercompindx_co3_aer = -999888777 - integer, save :: mastercompindx_nh4_aer = -999888777 - integer, save :: mastercompindx_na_aer = -999888777 - integer, save :: mastercompindx_ca_aer = -999888777 - integer, save :: mastercompindx_oin_aer = -999888777 - integer, save :: mastercompindx_oc_aer = -999888777 - integer, save :: mastercompindx_bc_aer = -999888777 - - !BSINGH - 05/28/2013(RCE updates) - real(r8), save, allocatable :: & - dens_aer(:,:), & - mw_aer(:,:), & - hygro_aer(:,:) - - real(r8), save :: & - dens_mastercomp_aer( maxd_acomp ), & - mw_mastercomp_aer( maxd_acomp ), & - hygro_mastercomp_aer( maxd_acomp ) - - real(r8), save, allocatable :: & - volumcut_sect(:,:), & - volumcen_sect(:,:), & - volumlo_sect(:,:), & - volumhi_sect(:,:), & - dcut_sect(:,:), & - dcen_sect(:,:), & - dlo_sect(:,:), & - dhi_sect(:,:), & - sigmag_aer(:,:) - !BSINGH - 05/28/2013(RCE updates ENDS) - -! these are the cut values that separate the "md1" and "md2" types -! for example, the bc mass fraction (itype_md1) is between -! xcut_atype_md1(0) and xcut_atype_md1(1) for itype_md1=1 -! xcut_atype_md1(2) and xcut_atype_md1(2) for itype_md1=2 - !BSINGH - 05/28/2013(RCE updates) - real(r8), save, allocatable :: & - xcut_atype_md1(:), & - xcut_atype_md2(:) - - character*10, save, allocatable :: & - name_aer(:,:) - - character*10, save :: & - name_mastercomp_aer( maxd_acomp ) - - integer, save, allocatable :: & - lptr_so4_aer(:,:,:), & - lptr_msa_aer(:,:,:), & - lptr_no3_aer(:,:,:), & - lptr_cl_aer(:,:,:), & - lptr_co3_aer(:,:,:), & - lptr_nh4_aer(:,:,:), & - lptr_na_aer(:,:,:), & - lptr_ca_aer(:,:,:), & - lptr_oin_aer(:,:,:), & - lptr_oc_aer(:,:,:), & - lptr_bc_aer(:,:,:) - !BSINGH - 05/28/2013(RCE updates ENDS) -! in the mosaic box model, the molecular weight, densities, -! and hygroscopities in module_data_mosaic_aero are the -! correct ones to use -! those values are copied into the mw_aer and dens_aer arrays -! *** the individual "parameter" values below should not -! be used and thus are left undefined -! -! molecular weights (g/mol) -! real(r8), parameter :: mw_so4_aer = 96.066 -! real(r8), parameter :: mw_no3_aer = 62.007 -! real(r8), parameter :: mw_cl_aer = 35.450 -! real(r8), parameter :: mw_msa_aer = 96.109 -! real(r8), parameter :: mw_co3_aer = 60.007 -! real(r8), parameter :: mw_nh4_aer = 18.042 -! real(r8), parameter :: mw_na_aer = 22.990 -! real(r8), parameter :: mw_ca_aer = 40.080 -! real(r8), parameter :: mw_oin_aer = 1.0 -! real(r8), parameter :: mw_oc_aer = 1.0 -! real(r8), parameter :: mw_bc_aer = 1.0 - -! dry densities (g/cm3) -! real(r8), parameter :: dens_so4_aer = 1.80 -! real(r8), parameter :: dens_no3_aer = 1.80 -! real(r8), parameter :: dens_cl_aer = 2.20 -! real(r8), parameter :: dens_msa_aer = 1.80 -! real(r8), parameter :: dens_co3_aer = 2.60 -! real(r8), parameter :: dens_nh4_aer = 1.80 -! real(r8), parameter :: dens_na_aer = 2.20 -! real(r8), parameter :: dens_ca_aer = 2.60 -! real(r8), parameter :: dens_oin_aer = 2.60 -! real(r8), parameter :: dens_oc_aer = 1.00 -! real(r8), parameter :: dens_bc_aer = 1.70 - -! water molecular weights (g/mol) and density (g/cm3) - real(r8), parameter :: mw_water_aer = 18.0 -! 29-mar-2010 - change to allow testing of non-cgs densities -! real(r8), parameter :: dens_water_aer = 1.0 - real(r8), save :: dens_water_aer = 1.0 - -! hygroscopicities (dimensionless) -! real(r8), parameter :: hygro_so4_aer = 0.5 -! real(r8), parameter :: hygro_no3_aer = 0.5 -! real(r8), parameter :: hygro_ca_aer = 0.1 -! real(r8), parameter :: hygro_co3_aer = 0.1 -! real(r8), parameter :: hygro_nh4_aer = 0.5 -! real(r8), parameter :: hygro_msa_aer = 0.58 -! real(r8), parameter :: hygro_cl_aer = 1.16 -! real(r8), parameter :: hygro_na_aer = 1.16 -! real(r8), parameter :: hygro_oin_aer = 0.14 -! real(r8), parameter :: hygro_oc_aer = 0.14 -! real(r8), parameter :: hygro_bc_aer = 1.e-6 - - -!----------------------------------------------------------------------- -! following are used in movesect, newnuc, and coag routines -! to identify bins with essentially negligible mass -! -! if bin mass mixrat < smallmassaa (1.0e-22 g/g-air), -! then assume no growth AND no water AND conform number so that size is within bin limits - real(r8), parameter :: smallmassaa = 1.0e-22_r8 -! if bin mass mixrat < smallmassab (1.0e-32 g/g-air), -! then assume default density to avoid divide by zero - real(r8), parameter :: smallmassbb = 1.0e-32_r8 -! -! with single-particle diameter = 1 nm and mass ~1e-21 g, -! and number = 1e-4 #/cm3 ~= 1e-1 #/g-air, the mass mixing ratio ~= 1e-22 g/g-air -! for simulations focusing on nucleation and ultrafine particles, -! one might want to use reduce smallmassaa - - -!----------------------------------------------------------------------- -! -! following are used by coag, movesect, and newnuc routines -! which were adapted from wrf-chem version of mosaic -! -!----------------------------------------------------------------------- -! integer, parameter :: lunerr = 6 -! integer, save :: lunout = 6 - - -!----------------------------------------------------------------------- -! -! following are used by coag, movesect, and newnuc routines -! which were adapted from wrf-chem version of mosaic, -! BUT are subr parameters in the mosaic box code -! -! drymass_pregrow(s,t) = dry-mass (g/mol-air) before gas-aerosol mass transfer -! drymass_aftgrow(s,t) = dry-mass (g/mol-air) after " " " " -! drydens_pregrow(s,t) = dry-density (g/cm3) before " " " " -! drydens_aftgrow(s,t) = dry-density (g/cm3) after " " " " -! -! aqvoldry_box(s,t) = dry-volume mixing ratio (cm^3-aerosol/mol-air) -! aqmassdry_box(s,t) = dry-mass mixing ratio (g-aerosol/mol-air) -! -! adrydens_box(s,t) = dry-density (g-aerosol/cm^3-aerosol) -! == amassdry_box/avoldry_box -! awetdens_box(s,t) = wet-density (g-aerosol/cm^3-aerosol) -! -! admeandry_box(s,t) = current mean dry-diameter (cm) for unactivated aerosol -! admeanwet_box(s,t) = current mean wet-diameter (cm) for unactivated aerosol -! -!----------------------------------------------------------------------- - - - - end module module_data_mosaic_asect diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_asecthp.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_asecthp.F90 deleted file mode 100644 index 483677e0..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_asecthp.F90 +++ /dev/null @@ -1,401 +0,0 @@ - module module_data_mosaic_asecthp - - use module_data_mosaic_kind, only: r8 - use module_data_mosaic_aero, only: nbin_a_max - - implicit none - -!----------------------------------------------------------------------- -! -! The variables in this module provide a means of organizing and accessing -! aerosol species by their chemical component, size bin (or mode), "type", and "phase" -! -! Their purpose is to allow flexible coding of process modules, -! compared to "hard-coding" using specify indices. -! Most (if not all) of these variables are usxwed in the i -! WRF-chem MOSAIC implementation. -! -!----------------------------------------------------------------------- -! -! maxd_atype = maximum allowable number of aerosol types -! maxd_asize = maximum allowable number of aerosol size bins -! maxd_acomp = maximum allowable number of chemical components -! in each aerosol size bin -! maxd_aphase = maximum allowable number of aerosol phases -! (gas, cloud, ice, rain, ...) -! -! ntype_aer = number of aerosol types -! The aerosol type will allow treatment of an externally mixed -! aerosol. For a traditional internally-mixed sectional approach, -! ntype_aer=1. Eventually, multiple types -! could treat fresh primary BC/OC, fresh SO4 from nucleation, -! aged BC/OC/SO4/... mixture, soil dust, sea salt, ... -! -! nphase_aer = number of aerosol phases -! -! ai_phase = phase (p) index for interstitial (unactivated) aerosol particles -! cw_phase = phase (p) index for aerosol particles in cloud water -! ci_phase = phase (p) index for aerosol particles in cloud ice -! rn_phase = phase (p) index for aerosol particles in rain -! sn_phase = phase (p) index for aerosol particles in snow -! gr_phase = phase (p) index for aerosol particles in graupel -! [Note: the value of "xx_phase" will be between 1 and nphase_aer -! for phases that are active in a simulation. The others -! will have non-positive values.] -! -! nsize_aer(t) = number of aerosol size bins for aerosol type t -! -! ncomp_aer(t) = number of "regular" chemical components for aerosol type t -! ncomp_plustracer_aer(t) = number of "regular" plus "tracer" -! chemical components for aerosol type t -! [Note: only "regular" components are used for calculating -! aerosol physical (mass, volume) and chemical properties. -! "Tracer" components are optional, and can be used to track source -! regions, source mechanisms, etc.] -! [Note: for aerosol type t, all phases have the same number of size -! bins, and all size bins have the same number of -! both regular and tracer components.] -! -! ntot_mastercomp_aer = number of aerosol chemical components defined -! in the "master component list". -! [Note: each aerosol type will use some but not necessarily all -! of the components in the "master component list".] -! -! mastercompptr_aer(c,t) = the position/index/i.d. in the -! "master component list" for chemical component c of aerosol type t. -! (1=sulfate, others to be defined by user.) -! -! massptr_aer(c,s,t,p) = the position/index in the chem array for mixing- -! ratio for chemical component c, size bin s, type t, and phase p. -! -! lptr_so4_aer(s,t,p) = the position/index in the chem array for mixing- -! ratio for sulfate for aerosol size bin s, type t, and phase p -! (similar lptr's are defined for no3, cl, msa, co3, -! nh4, na, ca, oin, oc, bc, ...) -! [Note: the massptr_aer allow you to loop over all species of -! an aerosol type. The lptr_so4_aer, etc., allow you to access -! a specific chemical component.] -! -! waterptr_aer(s,t) = the position/index in the chem array for mixing- -! ratio of aerosol water content for size bin s, type t. -! [Note: water content is only carried for the interstitial aerosol -! phase, so there is no p dimension.] -! -! hyswptr_aer(s,t) = the position/index in the chem array for mixing- -! ratio of aerosol "hysteresis water" content for size bin s, type t. -! This is used to determine if aerosol is in the dry or wet state, when -! the ambient RH is between the crystallization and deliquescence RH. -! [Note: hysteresis water content is only carried for the -! interstitial aerosol phase, so there is no p dimension.] -! -! numptr_aer(s,t,p) = the position/index in the chem array for mixing- -! ratio of particle number for size bin s, type t, and phase p. -! -! mprognum_aer(s,t,p) - if positive, number mixing-ratio for size s, type t, -! and phase p will be prognosed. Otherwise, it is diagnosed using -! mass mixing-ratio add assumed/prescribed size. -! -! mixing ratio (mol-water/mol-air) for water -! associated with aerosol size bin s and type t -! -! ibin_of_isize_itype(s,t) - maps from the sectional isize,itype -! to the mosaic "1-D bin index" -! isize_of_ibin(b) - maps from the mosaic "1-D bin index" ibin -! to the sectional isize -! itype_of_ibin(b) - maps from the mosaic "1-D bin index" ibin -! to the sectional itype -! -! itype_of_itype_md1md2(t1,t2) - maps from the "new 3d sectional" -! itype_md1,itype_md2 to the "old sectional" itype -! itype_md1_of_itype(t) - maps from the "old sectional" itype -! to the "new 3d sectional" itype_md1 -! itype_md2_of_itype(t) - maps from the "old sectional" itype -! to the "new 3d sectional" itype_md2 -! -! mastercompindx_so4_aer = the position/index in the -! "master component list" for sulfate. -! (similar lptr's are defined for no3, cl, msa, co3, -! nh4, na, ca, oin, oc, bc, ...) -! [Note: the mastercompindx_xxx_aer are used primarily in -! initialization routines, and generally aren't needed elsewhere.] -! -!----------------------------------------------------------------------- -! -! dens_mastercomp_aer(mc) = dry density (g/cm^3) of component mc -! of the master component list. -! dens_aer(c,t) = dry density (g/cm^3) of aerosol chemical component -! c of type t -! [Note: dens_aer(c,t) == dens_mastercomp_aer(mastercompptr_aer(c,t)) -! The dens_mastercomp_aer is used in some initialization routines. -! The dens_aer is used in most other places because of convenience.] -! -! mw_mastercomp_aer(mc) = molecular weight (g/mol) of component mc -! of the master component list. -! mw_aer(c,t) = molecular weight (g/mol) of aerosol chemical component -! c of type t -! [Note: mw_aer(c,t) == mw_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -! name_mastercomp_aer(mc) = name of component mc of the -! master component list (e.g., "sulfate", "nitrate", ...). -! name_aer(c,t) = name of aerosol chemical component c of type t -! [Note: name_aer(c,t) == name_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -! hygro_mastercomp_aer(mc) = bulk hygroscopicity (--) at dilute conditions -! (RH near 100%) of component mc of the master component list. -! hygro_aer(c,t) = bulk hygroscopicity (--) at dilute conditions -! (RH near 100%) of aerosol chemical component c of type t -! [For definition of bulk hygroscopicity, -! see Abdul-Razzak and Ghan, 2004, J Geophys Res, V105, p. 6837-6844.] -! [*** this bulk hygroscopicity is equivalent to the "kappa" of -! Peters and Kreidenweis, 2007, Atmos Chem Phys, V7, p. 1961-1971.] -! [Note: hygro_aer(c,t) == hygro_mastercomp_aer(mastercompptr_aer(c,t)) ] -! -!----------------------------------------------------------------------- -! -! volumlo_sect(s,t) = 1-particle volume (cm^3) at lower boundary of section m -! volumhi_sect(s,t) = 1-particle volume (cm^3) at upper boundary of section m -! volumcen_sect(s,t)= 1-particle volume (cm^3) at "center" of section m -! -! dlo_sect(s,t) = 1-particle diameter (cm) at lower boundary of section m -! dhi_sect(s,t) = 1-particle diameter (cm) at upper boundary of section m -! dcen_sect(s,t) = 1-particle diameter (cm) at "center" section m -! -! [Note: the "center" values are defined as follows: -! volumcen_sect == 0.5*(volumlo_sect + volumhi_sect) -! == (pi/6) * (dcen_sect**3) ] -! -!----------------------------------------------------------------------- - -! -! the sectional mosaci uses a 2d bin structure -! dimension 1 (dry diameter) = "size" -! dimension 2 (composition ) = "type" -! -! for the newer 3d bin structure, -! dimension 1 (dry diameter) = "size" still -! dimension 2 (bc mass fraction) = "type_md1" -! dimension 3 (hygroscopicity ) = "type_md2" -! -! (dimension 2) x (dimension 3) is mapped to the old 1d "type" -! - !BSINGH - 05/28/2013(RCE updates) - integer, save :: maxd_atype_md1 = -999888777 ! set at run time - integer, save :: maxd_atype_md2 = -999888777 ! set at run time - integer, save :: maxd_atype = -999888777 ! set at run time to maxd_atype_md1*maxd_atype_md2 - - integer, save :: maxd_asize = -999888777 ! set at run time - !BSINGH - 05/28/2013(RCE updates ENDS) - integer, parameter :: maxd_acomp = 19 - integer, parameter :: maxd_aphase = 1 - - integer, parameter :: lunerr = 6 - integer, save :: lunout = 170 - - integer, save :: ai_phase = -999888777 - integer, save :: cw_phase = -999888777 - integer, save :: ci_phase = -999888777 - integer, save :: rn_phase = -999888777 - integer, save :: sn_phase = -999888777 - integer, save :: gr_phase = -999888777 - - integer, save :: ntype_aer = 0 ! number of types - integer, save :: ntype_md1_aer = 0 ! number of md1 types - integer, save :: ntype_md2_aer = 0 ! number of md2 types - - integer, save :: ntot_mastercomp_aer = 0 ! number of master components - integer, save :: nphase_aer = 0 ! number of phases - - !BSINGH - 05/28/2013(RCE updates) - integer, save, allocatable :: & - nsize_aer(:), & ! number of size bins - ncomp_aer(:), & ! number of chemical components - ncomp_plustracer_aer(:), & - mastercompptr_aer(:,:), & ! mastercomp index - massptr_aer(:,:,:,:), & - ! index for mixing ratio - waterptr_aer(:,:), & ! index for aerosol water - hyswptr_aer(:,:), & - numptr_aer(:,:,:), & - ! index for the number mixing ratio - mprognum_aer(:,:,:) - - integer, save, allocatable :: & - ibin_of_isize_itype(:,:), & - isize_of_ibin(:), & - itype_of_ibin(:), & - itype_of_itype_md1md2(:,:), & - itype_md1_of_itype(:), & - itype_md2_of_itype(:) - !BSINGH - 05/28/2013(RCE updates ENDS) - -! these indices give the location in the "mastercomp list" of -! the different aerosol chemical (or tracer) components - integer, save :: mastercompindx_so4_aer = -999888777 - integer, save :: mastercompindx_no3_aer = -999888777 - integer, save :: mastercompindx_cl_aer = -999888777 - integer, save :: mastercompindx_msa_aer = -999888777 - integer, save :: mastercompindx_co3_aer = -999888777 - integer, save :: mastercompindx_nh4_aer = -999888777 - integer, save :: mastercompindx_na_aer = -999888777 - integer, save :: mastercompindx_ca_aer = -999888777 - integer, save :: mastercompindx_oin_aer = -999888777 - integer, save :: mastercompindx_oc_aer = -999888777 - integer, save :: mastercompindx_bc_aer = -999888777 - - !BSINGH - 05/28/2013(RCE updates) - real(r8), save, allocatable :: & - dens_aer(:,:), & - mw_aer(:,:), & - hygro_aer(:,:) - - real(r8), save :: & - dens_mastercomp_aer( maxd_acomp ), & - mw_mastercomp_aer( maxd_acomp ), & - hygro_mastercomp_aer( maxd_acomp ) - - real(r8), save, allocatable :: & - volumcut_sect(:,:), & - volumcen_sect(:,:), & - volumlo_sect(:,:), & - volumhi_sect(:,:), & - dcut_sect(:,:), & - dcen_sect(:,:), & - dlo_sect(:,:), & - dhi_sect(:,:), & - sigmag_aer(:,:) - !BSINGH - 05/28/2013(RCE updates ENDS) - -! these are the cut values that separate the "md1" and "md2" types -! for example, the bc mass fraction (itype_md1) is between -! xcut_atype_md1(0) and xcut_atype_md1(1) for itype_md1=1 -! xcut_atype_md1(2) and xcut_atype_md1(2) for itype_md1=2 - !BSINGH - 05/28/2013(RCE updates) - real(r8), save, allocatable :: & - xcut_atype_md1(:), & - xcut_atype_md2(:) - - character*10, save, allocatable :: & - name_aer(:,:) - - character*10, save :: & - name_mastercomp_aer( maxd_acomp ) - - integer, save, allocatable :: & - lptr_so4_aer(:,:,:), & - lptr_msa_aer(:,:,:), & - lptr_no3_aer(:,:,:), & - lptr_cl_aer(:,:,:), & - lptr_co3_aer(:,:,:), & - lptr_nh4_aer(:,:,:), & - lptr_na_aer(:,:,:), & - lptr_ca_aer(:,:,:), & - lptr_oin_aer(:,:,:), & - lptr_oc_aer(:,:,:), & - lptr_bc_aer(:,:,:) - !BSINGH - 05/28/2013(RCE updates ENDS) -! in the mosaic box model, the molecular weight, densities, -! and hygroscopities in module_data_mosaic_aero are the -! correct ones to use -! those values are copied into the mw_aer and dens_aer arrays -! *** the individual "parameter" values below should not -! be used and thus are left undefined -! -! molecular weights (g/mol) -! real(r8), parameter :: mw_so4_aer = 96.066 -! real(r8), parameter :: mw_no3_aer = 62.007 -! real(r8), parameter :: mw_cl_aer = 35.450 -! real(r8), parameter :: mw_msa_aer = 96.109 -! real(r8), parameter :: mw_co3_aer = 60.007 -! real(r8), parameter :: mw_nh4_aer = 18.042 -! real(r8), parameter :: mw_na_aer = 22.990 -! real(r8), parameter :: mw_ca_aer = 40.080 -! real(r8), parameter :: mw_oin_aer = 1.0 -! real(r8), parameter :: mw_oc_aer = 1.0 -! real(r8), parameter :: mw_bc_aer = 1.0 - -! dry densities (g/cm3) -! real(r8), parameter :: dens_so4_aer = 1.80 -! real(r8), parameter :: dens_no3_aer = 1.80 -! real(r8), parameter :: dens_cl_aer = 2.20 -! real(r8), parameter :: dens_msa_aer = 1.80 -! real(r8), parameter :: dens_co3_aer = 2.60 -! real(r8), parameter :: dens_nh4_aer = 1.80 -! real(r8), parameter :: dens_na_aer = 2.20 -! real(r8), parameter :: dens_ca_aer = 2.60 -! real(r8), parameter :: dens_oin_aer = 2.60 -! real(r8), parameter :: dens_oc_aer = 1.00 -! real(r8), parameter :: dens_bc_aer = 1.70 - -! water molecular weights (g/mol) and density (g/cm3) - real(r8), parameter :: mw_water_aer = 18.0 -! 29-mar-2010 - change to allow testing of non-cgs densities -! real(r8), parameter :: dens_water_aer = 1.0 - real(r8), save :: dens_water_aer = 1.0 - -! hygroscopicities (dimensionless) -! real(r8), parameter :: hygro_so4_aer = 0.5 -! real(r8), parameter :: hygro_no3_aer = 0.5 -! real(r8), parameter :: hygro_ca_aer = 0.1 -! real(r8), parameter :: hygro_co3_aer = 0.1 -! real(r8), parameter :: hygro_nh4_aer = 0.5 -! real(r8), parameter :: hygro_msa_aer = 0.58 -! real(r8), parameter :: hygro_cl_aer = 1.16 -! real(r8), parameter :: hygro_na_aer = 1.16 -! real(r8), parameter :: hygro_oin_aer = 0.14 -! real(r8), parameter :: hygro_oc_aer = 0.14 -! real(r8), parameter :: hygro_bc_aer = 1.e-6 - - -!----------------------------------------------------------------------- -! following are used in movesect, newnuc, and coag routines -! to identify bins with essentially negligible mass -! -! if bin mass mixrat < smallmassaa (1.0e-22 g/g-air), -! then assume no growth AND no water AND conform number so that size is within bin limits - real(r8), parameter :: smallmassaa = 1.0e-22_r8 -! if bin mass mixrat < smallmassab (1.0e-32 g/g-air), -! then assume default density to avoid divide by zero - real(r8), parameter :: smallmassbb = 1.0e-32_r8 -! -! with single-particle diameter = 1 nm and mass ~1e-21 g, -! and number = 1e-4 #/cm3 ~= 1e-1 #/g-air, the mass mixing ratio ~= 1e-22 g/g-air -! for simulations focusing on nucleation and ultrafine particles, -! one might want to use reduce smallmassaa - - -!----------------------------------------------------------------------- -! -! following are used by coag, movesect, and newnuc routines -! which were adapted from wrf-chem version of mosaic -! -!----------------------------------------------------------------------- -! integer, parameter :: lunerr = 6 -! integer, save :: lunout = 6 - - -!----------------------------------------------------------------------- -! -! following are used by coag, movesect, and newnuc routines -! which were adapted from wrf-chem version of mosaic, -! BUT are subr parameters in the mosaic box code -! -! drymass_pregrow(s,t) = dry-mass (g/mol-air) before gas-aerosol mass transfer -! drymass_aftgrow(s,t) = dry-mass (g/mol-air) after " " " " -! drydens_pregrow(s,t) = dry-density (g/cm3) before " " " " -! drydens_aftgrow(s,t) = dry-density (g/cm3) after " " " " -! -! aqvoldry_box(s,t) = dry-volume mixing ratio (cm^3-aerosol/mol-air) -! aqmassdry_box(s,t) = dry-mass mixing ratio (g-aerosol/mol-air) -! -! adrydens_box(s,t) = dry-density (g-aerosol/cm^3-aerosol) -! == amassdry_box/avoldry_box -! awetdens_box(s,t) = wet-density (g-aerosol/cm^3-aerosol) -! -! admeandry_box(s,t) = current mean dry-diameter (cm) for unactivated aerosol -! admeanwet_box(s,t) = current mean wet-diameter (cm) for unactivated aerosol -! -!----------------------------------------------------------------------- - - - - end module module_data_mosaic_asecthp diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_cloud.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_cloud.F90 deleted file mode 100644 index 426c4b63..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_cloud.F90 +++ /dev/null @@ -1,25 +0,0 @@ - module module_data_mosaic_cloud - - use module_data_mosaic_kind, only: r8 - - implicit none - - integer, parameter :: nrxn_cld = 2 - -!------------------------------------------------------------------------ - integer, save :: & - iso4_c, ino3_c, icl_c, inh4_c, ioc_c, & - imsa_c, ico2_c, ina_c, ica_c, ibc_c, & - ioin_c, iso2_c, ihono_c, ih2o2_c, ich3ooh_c, & - ihcooh_c, ircooh_c, ihcho_c, io3_c, iho2_c, & - ino2_c, ino3r_c, in2o5_c - - integer, save :: & - jh_c, jnh4_c, jna_c, jhso4_c, jso4_c, & - jno3_c, jcl_c, jno2_c, jhso3_c, jso3_c, & - jhco3_c, jco3_c, jho2_c, jhcoo_c, jrcoo_c, & - jmsa_c, joh_c, jch2oh2_c - -!------------------------------------------------------------------------ - - end module module_data_mosaic_cloud diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_constants.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_constants.F90 deleted file mode 100644 index 53a686b9..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_constants.F90 +++ /dev/null @@ -1,9 +0,0 @@ - module module_data_mosaic_constants - - use module_data_mosaic_kind, only: r8 - - implicit none - - real(r8), save :: avogad, deg2rad, pi, piover4, piover6, third - - end module module_data_mosaic_constants diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_gas.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_gas.F90 deleted file mode 100644 index 2c1ba79c..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_gas.F90 +++ /dev/null @@ -1,105 +0,0 @@ - module module_data_mosaic_gas - - use module_data_mosaic_kind, only: r8 - use module_data_mosaic_main, only: & - ngas_max, ngas_com, ngas_urb, ngas_bio, ngas_mar - - implicit none - - integer, parameter :: & - nperox = 10, & ! total number of alkylperoxy radicals - nphoto = 20 ! total number of photolyzing species - - integer, parameter :: & - nrxn_het = ngas_max, & - nrxn_com = 75, & - nrxn_urb = 44, & - nrxn_bio = 22, & - nrxn_mar = 35 - - integer, parameter :: & - nreg1 = ngas_com, & - nreg2 = (ngas_com + ngas_urb), & - nreg3 = (ngas_com + ngas_urb + ngas_bio), & - nreg4 = (ngas_com + ngas_mar), & - nreg5 = (ngas_com + ngas_urb + ngas_mar), & - nreg6 = (ngas_com + ngas_urb + ngas_bio + ngas_mar) - - real(r8), parameter :: & - foh = 0.228, & - fo3 = 0.772, & - fno3 = 0.0 - -!------------------------------------------------------------------------ - integer, save :: iregime - - real(r8), save :: & - rk_com(nrxn_com), & - rk_urb(nrxn_urb), & - rk_bio(nrxn_bio), & - rk_mar(nrxn_mar), & - rk_het(nrxn_het), & - rk_param(nperox), & - rk_photo(nphoto), & - Aperox(nperox,nperox), & - Bperox(nperox,nperox) - - real(r8), save :: & - r_com(nrxn_com), & - r_urb(nrxn_urb), & - r_bio(nrxn_bio), & - r_mar(nrxn_mar), & - r_het(nrxn_het) - - real(r8), save :: & - p_com(ngas_max), d_com(ngas_max), & - p_urb(ngas_max), d_urb(ngas_max), & - p_bio(ngas_max), d_bio(ngas_max), & - p_mar(ngas_max), d_mar(ngas_max), & - p_het(ngas_max), d_het(ngas_max) -! - real(r8), save :: Npcasp(15), NOy_in, SO2_in, sum_sfc_area -! -! -!------------------------------------------------------------------------ - integer, save :: & - ih2so4, ihno3, ihcl, inh3, ino, & - ino2, ino3, in2o5, ihono, ihno4, & - io3, io1d, io3p, ioh, iho2, & - ih2o2, ico, iso2, ich4, ic2h6, & - ich3o2, iethp, ihcho, ich3oh, ianol, & - ich3ooh, iethooh, iald2, ihcooh, ircooh, & - ic2o3, ipan, & - iaro1, iaro2, ialk1, iole1, iapi1, & - iapi2, ilim1, ilim2, & - ipar, iaone, imgly, ieth, iolet, & - iolei, itol, ixyl, icres, ito2, & - icro, iopen, ionit, irooh, iro2, & - iano2, inap, ixo2, ixpar, & - iisop, iisoprd, iisopp, iisopn, iisopo2, & - iapi, ilim, & - idms, imsa, idmso, idmso2, ich3so2h, & - ich3sch2oo, ich3so2, ich3so3, ich3so2ch2oo,ich3so2oo, & - isulfhox - - integer, save :: & - jch3o2, jethp, jro2, jc2o3, jano2, & - jnap, jisopp, jisopn, jisopo2, jxo2 - - integer, save :: & - jphoto_no2, jphoto_no3, jphoto_hono, jphoto_hno3, & - jphoto_hno4, jphoto_n2o5, jphoto_o3a, jphoto_o3b, & - jphoto_h2o2, jphoto_hchoa, jphoto_hchob, jphoto_ch3ooh, & - jphoto_ethooh, jphoto_ald2, jphoto_aone, jphoto_mgly, & - jphoto_open, jphoto_rooh, jphoto_onit, jphoto_isoprd - - real(r8), save :: & - mw_gas(ngas_max), & - uptake_gas(ngas_max), & - D_gas(ngas_max), & - vel_gas(ngas_max), & - k_gas(ngas_max), & - ihet_gas(ngas_max) - - - end module module_data_mosaic_gas diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_kind.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_kind.F90 deleted file mode 100644 index 7ab13b10..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_kind.F90 +++ /dev/null @@ -1,11 +0,0 @@ - module module_data_mosaic_kind - - implicit none - -! integer, parameter :: r8 = 8 - integer, parameter :: r8 = selected_real_kind(12) ! 8 byte real - -! integer, parameter :: r4 = 4 - integer, parameter :: r4 = selected_real_kind( 6) ! 4 byte real - - end module module_data_mosaic_kind diff --git a/MAMchem_GridComp/microphysics/module_data_mosaic_main.F90 b/MAMchem_GridComp/microphysics/module_data_mosaic_main.F90 deleted file mode 100644 index 77a58158..00000000 --- a/MAMchem_GridComp/microphysics/module_data_mosaic_main.F90 +++ /dev/null @@ -1,104 +0,0 @@ - module module_data_mosaic_main - - use module_data_mosaic_kind, only: r8 - use module_data_mosaic_constants, only: & - avogad, deg2rad, pi, piover4, piover6, third - - - implicit none - - integer, parameter :: & - ngas_com = 40, & - ngas_urb = 19, & - ngas_bio = 7, & - ngas_mar = 11 - !BSINGH - 05/28/2013(RCE updates) - integer, parameter :: & - naer_tot = 24 ! total num of 3-D variables per bin - - integer, save :: & - naerbin = -999888777 ! number of bins (set at run time) - !BSINGH - 05/28/2013(RCE updates ENDS) -! naerbin = 41760 ! ( 48 size)*(29 wbc)*(30 kappa) -! naerbin = 3240 ! ( 24 size)*(15 wbc)*( 9 kappa) -! naerbin = 90000 ! (100 size)*(30 wbc)*(30 kappa) - - integer, parameter :: & - ncld_tot = 13, & ! + 8 = total num of 3-D variables/bin - ncldbin = 4, & ! num of cloud bins - ncld = 22 ! num of dynamic cloud species/bin - - integer, parameter :: ngas_max = ngas_com + ngas_urb + ngas_bio + ngas_mar - - integer, parameter :: ncld_max = ncld_tot*ncldbin - !BSINGH - 05/28/2013(RCE updates) - integer, save :: naer_max = -999888777 ! set at run time to naer_tot*naerbin - - integer, save :: ntot_max = -999888777 ! set at run time to (ngas_max + naer_max + ncld_max) - !BSINGH - 05/28/2013(RCE updates ENDS) - - integer, save :: & - naerbin_used=0, & ! num of aerosol bins being used - ncldbin_used=0, & ! num of cloud bins being used - ntot_used=ngas_max ! portion of cnn array being used - - integer, save :: & - ipmcmos = 0 ! if > 0, do emissions, dilution, air density, - ! and relative humidity as in partmc_mosaic - - real(r8), parameter :: press0_pa = 1.01325d5 ! pressure of 1 atm [Pa] - real(r8), parameter :: mw_air = 28.966d0 ! dry-air mean molecular weight [g/mol] - -!------------------------------------------------------------------------ -! Global Species Indices -! - integer, save :: & - kh2so4, khno3, khcl, knh3, kno, & - kno2, kno3, kn2o5, khono, khno4, & - ko3, ko1d, ko3p, koh, kho2, & - kh2o2, kco, kso2, kch4, kc2h6, & - kch3o2, kethp, khcho, kch3oh, kanol, & - kch3ooh, kethooh, kald2, khcooh, krcooh, & - kc2o3, kpan, & - karo1, karo2, kalk1, kole1, kapi1, & - kapi2, klim1, klim2, & - kpar, kaone, kmgly, keth, kolet, & - kolei, ktol, kxyl, kcres, kto2, & - kcro, kopen, konit, krooh, kro2, & - kano2, knap, kxo2, kxpar, & - kisop, kisoprd, kisopp, kisopn, kisopo2, & - kapi, klim, & - kdms, kmsa, kdmso, kdmso2, kch3so2h, & - kch3sch2oo, kch3so2, kch3so3, kch3so2ch2oo,kch3so2oo, & - ksulfhox - - integer, save :: & - knum_a, kdpdry_a, ksigmag_a, kjhyst_a, & - kwater_a, kso4_a, kno3_a, kcl_a, knh4_a, & - koc_a, kmsa_a, kco3_a, kna_a, kca_a, & - kbc_a, koin_a, karo1_a, karo2_a, kalk1_a, & - kole1_a, kapi1_a, kapi2_a, klim1_a, klim2_a - - integer, save :: & - knum_c, kwater_c, kso4_c, kno3_c, kcl_c, & - kmsa_c, kco3_c, knh4_c, kna_c, kca_c, & - koc_c, kbc_c, koin_c, & - karo1_c, karo2_c, kalk1_c, kole1_c, kapi1_c, & - kapi2_c, klim1_c, klim2_c - - - -!------------------------------------------------------------------------- - - integer, save :: m_partmc_mosaic ! >0 for partmc_mosaic, <=0 for mosaic box model!BSINGH - 05/28/2013(RCE updates) - - integer, save :: mgas, maer, mcld - - integer, save :: maeroptic, mshellcore - - integer, save :: msolar, mphoto - - -!------------------------------------------------------------------------ - - end module module_data_mosaic_main diff --git a/MAMchem_GridComp/microphysics/module_mosaic_astem.F90 b/MAMchem_GridComp/microphysics/module_mosaic_astem.F90 deleted file mode 100644 index 74471e4f..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_astem.F90 +++ /dev/null @@ -1,3934 +0,0 @@ - module module_mosaic_astem - - - use module_mosaic_support, only: mosaic_warn_mess, mosaic_err_mess - use module_data_mosaic_kind, only: r8 - - implicit none - - - contains - - -! feb 22. new flux_mix - -!*********************************************************************** -! ASTEM: Adaptive Step Time-Split Euler Method -! -! author: Rahul A. Zaveri -! update: jan 2007 -!----------------------------------------------------------------------- - - subroutine ASTEM( mcall_print_aer, &!intent-ins - dtchem, sigmag_a, aH2O, T_K, RH_pc, P_atm, & - kappa_nonelectro, & - jaerosolstate, flux_s, flux_l, volatile_s,iprint_input, &!intent -inout - phi_volatile_s,phi_volatile_l, jphase, aer, kg, gas, & - gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, epercent, activity, mc, sat_soa, & - num_a, Dp_dry_a, Dp_wet_a, dp_core_a, mass_dry_a, & - mass_soluble_a,vol_dry_a, dens_dry_a, water_a, water_a_hyst, & - water_a_up, aH2O_a, total_species,tot_cl_in, ma, gam, & - log_gamZ, gam_ratio, Keq_ll, Keq_gl, Keq_sg, Kp_nh4cl,& - Kp_nh4no3, sigma_water, Keq_sl, MDRH_T, molality0, & - uptkrate_h2so4, mosaic_vars_aa, & - area_dry_a, area_wet_a, mass_wet_a,vol_wet_a, &!intent-out - dens_wet_a, ri_shell_a, ri_avg_a, ri_core_a ) - - use module_data_mosaic_aero, only: nbin_a_max, ngas_volatile, nelectrolyte, & - Ncation, naer, mYES, no_aerosol, Nanion, nrxn_aer_gl, nrxn_aer_ll, & - nrxn_aer_sg, nrxn_aer_sl, naercomp, nsalt, MDRH_T_NUM, jsulf_poor_NUM, & - jsulf_rich_NUM, nbin_a, zc, za, & - a_zsr, b_zsr, mw_electrolyte, partial_molar_vol, mw_aer_mac, dens_aer_mac, & - MW_a, MW_c, dens_comp_a, mw_comp_a, ref_index_a, rtol_mesa, jsalt_index, & - jsulf_poor, jsulf_rich, ih2so4_g, & - iso4_a, jtotal, & !for debug only remove it later BALLI - mosaic_vars_aa_type - - use module_mosaic_ext, only: aerosol_phase_state,calc_dry_n_wet_aerosol_props, & - aerosolmtc - -! use module_print_aer, only: print_aer - - - - !Subroutine Arguments - !Intent-ins - integer, intent(in) :: mcall_print_aer - - real(r8), intent(in) :: dtchem - real(r8), intent(in) :: aH2O - real(r8), intent(in) :: T_K, RH_pc, P_atm - real(r8), intent(in), dimension(nbin_a_max) :: sigmag_a - real(r8), intent(in), dimension(ngas_volatile) :: gas_netprod_otrproc - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - !intent-inouts - integer, intent(inout) :: iprint_input - - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate, jphase - integer, intent(inout), dimension(nbin_a_max) :: jhyst_leg - - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout) :: Kp_nh4cl, Kp_nh4no3 - real(r8), intent(inout) :: sigma_water - - real(r8), intent(inout), dimension(nbin_a_max) :: num_a, Dp_dry_a, Dp_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: dp_core_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a, mass_soluble_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_dry_a, dens_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a_hyst,water_a_up - real(r8), intent(inout), dimension(nbin_a_max) :: aH2O_a - real(r8), intent(inout), dimension(nbin_a_max) :: gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(ngas_volatile) :: gas_avg ! average gas conc. over dtchem time step (nmol/m3) - real(r8), intent(inout) :: uptkrate_h2so4 ! rate of h2so4 uptake by aerosols (1/s) - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! gas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (nmol/m3/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - currently for mosaic, only the value for h2so4 can be non-zero - real(r8), intent(inout), dimension(ngas_volatile) :: sat_soa - real(r8), intent(inout), dimension(ngas_volatile) :: total_species - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,flux_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - - - !Intent-out - real(r8), intent(out), dimension(nbin_a_max) :: area_dry_a - real(r8), intent(out), dimension(nbin_a_max) :: area_wet_a,mass_wet_a - real(r8), intent(out), dimension(nbin_a_max) :: vol_wet_a - real(r8), intent(out), dimension(nbin_a_max) :: dens_wet_a - - complex, intent(out), dimension(nbin_a_max) :: ri_shell_a,ri_avg_a,ri_core_a - - !Local variables - integer :: ibin, iv - - integer, dimension(nsalt) :: jsalt_present - integer, dimension(ngas_volatile,3,nbin_a_max) :: integrate - - - real(r8) :: Keq_nh4cl - - real(r8), dimension(nsalt) :: phi_salt_old - real(r8), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), dimension(Nanion) :: xeq_a,na_Ma - real(r8), dimension(nbin_a_max) :: sigma_soln - real(r8), dimension(nbin_a_max) :: delta_nh3_max,delta_hno3_max - real(r8), dimension(nbin_a_max) :: delta_hcl_max - real(r8), dimension(nbin_a_max) :: growth_factor - real(r8), dimension(nbin_a_max) :: MDRH - - real(r8), dimension(ngas_volatile) ::sfc_a - real(r8), dimension(ngas_volatile,nbin_a_max) :: Heff,kel - - mosaic_vars_aa%niter_MESA = 0.0_r8 - mosaic_vars_aa%niter_MESA_max = 0 - mosaic_vars_aa%jMESA_fail = 0 - mosaic_vars_aa%jMESA_call = 0 - mosaic_vars_aa%iter_MESA(:) = 0 - - phi_salt_old(:) = 0.0_r8 - integrate(:,:,:) = 0.0_r8 !BALLI- Ask Dick about this initialization - heff(:,:) = 0.0_r8 !BALLI- Ask Dick about this initialization - - gas_avg(:) = gas(:) ! RCE: set avg. gas conc. = initial conc. - - ! update ASTEM call counter - mosaic_vars_aa%jASTEM_call = mosaic_vars_aa%jASTEM_call + 1 - - ! reset input print flag - iprint_input = mYES - - ! compute aerosol phase state before starting integration - do ibin = 1, nbin_a - area_dry_a(ibin) = 0.0_r8 !BSINGH - Ask Dick about it. The code blows up in print_aer - area_wet_a(ibin) = 0.0_r8 !BSINGH - Ask Dick about it. The code blows up in print_aer - mass_wet_a(ibin) = 0.0_r8 !BSINGH - Ask Dick about it. The code blows up in print_aer - if(jaerosolstate(ibin) .ne. no_aerosol)then - call aerosol_phase_state( ibin, jaerosolstate, jphase, & - aer, jhyst_leg, electrolyte, epercent, kel, activity, mc, num_a, mass_wet_a, & - mass_dry_a, mass_soluble_a, vol_dry_a, vol_wet_a, water_a, water_a_hyst, & - water_a_up, aH2O_a, aH2O, ma, gam, & !BALLI - log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, & ! RAZ deleted a_zsr - mw_electrolyte, partial_molar_vol, sigma_soln, T_K, RH_pc, mw_aer_mac, & - dens_aer_mac, sigma_water, Keq_ll, Keq_sl, MW_a, MW_c, growth_factor, MDRH, & - MDRH_T, molality0, rtol_mesa, jsalt_present, jsalt_index, jsulf_poor, & - jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - - call calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - endif - enddo - call check_astem_negative( 1, mosaic_vars_aa%xnerr_astem_negative, aer, gas ) - - ! BOX - if (mcall_print_aer == 2) then - !call print_aer(0,jaerosolstate,isteps_ASTEM,iter_MESA,aer,gas,electrolyte, & - ! mc,num_a,Dp_dry_a,Dp_wet_a,area_dry_a,area_wet_a,mass_wet_a,mass_dry_a,& - ! water_a) ! UNCOMMENT THIS LINE - endif ! UNCOMMENT THIS LINE - - - ! compute new gas-aerosol mass transfer coefficients - call aerosolmtc( jaerosolstate, aer, kg, electrolyte, num_a, Dp_dry_a, Dp_wet_a, & - dp_core_a, area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, vol_dry_a, vol_wet_a, & - dens_dry_a, dens_wet_a, sigmag_a, water_a, P_atm, T_K, ri_shell_a, dens_comp_a, & - mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, ri_avg_a, ri_core_a, mosaic_vars_aa ) - - uptkrate_h2so4 = sum( kg(ih2so4_g,1:nbin_a) ) - - ! condense h2so4, msa, and nh3 only - call ASTEM_non_volatiles( dtchem, jaerosolstate, jphase, aer, & - kg, gas, gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, epercent, kel, activity, mc, delta_nh3_max, & - delta_hno3_max, delta_hcl_max, num_a, mass_wet_a, mass_dry_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, water_a_hyst, water_a_up, aH2O_a, total_species, & - tot_cl_in, & - aH2O, ma, gam, log_gamZ, zc, za, & - gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, a_zsr, mw_electrolyte, partial_molar_vol, & - sigma_soln, T_K, RH_pc, mw_aer_mac, dens_aer_mac, sigma_water, Keq_ll, Keq_sl, & - MW_a, MW_c, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, & - jsalt_index, jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) ! analytical solution - - call check_astem_negative( 2, mosaic_vars_aa%xnerr_astem_negative, aer, gas ) - - ! condense inorganic semi-volatile gases hno3, hcl, nh3, and co2 - call ASTEM_semi_volatiles( iprint_input, dtchem, jaerosolstate, & - sfc_a, flux_s, flux_l, Heff, volatile_s, phi_volatile_s, & - jphase, aer, kg, gas, jhyst_leg, electrolyte, epercent, kel, activity, mc, & - delta_nh3_max, delta_hno3_max, delta_hcl_max, & - num_a, mass_dry_a, mass_wet_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, total_species, tot_cl_in, & - aH2O_a, aH2O, ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, & - Keq_ll, Keq_gl, Keq_sg, Kp_nh4cl, Kp_nh4no3, Keq_nh4cl, MW_c, MW_a, mw_aer_mac, & - dens_aer_mac, Keq_sl, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, & - jsalt_present, jsalt_index, jsulf_poor, jsulf_rich, phi_salt_old, & - integrate, phi_volatile_l, & - kappa_nonelectro, mosaic_vars_aa ) ! semi-implicit + explicit euler - - if (mosaic_vars_aa%f_mos_fail > 0 ) then - return - endif - call check_astem_negative( 3, mosaic_vars_aa%xnerr_astem_negative, aer, gas ) - - ! condense secondary organic gases (8 sorgam species) - - call ASTEM_secondary_organics(dtchem,jaerosolstate,sfc_a,Heff,phi_volatile_l, & - integrate,aer,kg,gas,sat_soa,total_species) ! semi-implicit euler - call check_astem_negative( 4, mosaic_vars_aa%xnerr_astem_negative, aer, gas ) - - do iv = 1, ngas_volatile - if (iv == ih2so4_g) cycle - ! RCE: avg. gas conc. = 0.5*( initial conc. + current conc. ) - gas_avg(iv) = 0.5_r8*(gas_avg(iv) + gas(iv)) - end do - - return -end subroutine ASTEM - - - -!----------------------------------------------------------------------- - subroutine check_astem_negative( n, xnerr_astem_negative, aer, gas ) -! -! checks for negative values in gas and aer arrays -! when a negative value is found -! xnerr_astem_negative is incremented -! gas/aer value is set to 0.0 -! - use module_data_mosaic_aero, only: naer, nbin_a, nbin_a_max, ngas_volatile - - integer, intent(in) :: n - real(r8), intent(inout) :: xnerr_astem_negative(5,4) - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - - character(len = 100) :: tmp_str - integer :: iaer, ibin, igas, j, m - real(r8) :: tmpa - - if ( n<1 .or. n>4 ) then - write(tmp_str,'(/a,i10/)') '*** check_astem_negative fatal error, n =', n - call mosaic_err_mess(tmp_str) - end if - - do igas = 1, ngas_volatile - tmpa = gas(igas) - if (tmpa >= 0.0_r8) then - cycle - else if (tmpa <= -1.0e-5_r8 ) then - m = 1 - else if (tmpa <= -1.0e-10_r8) then - m = 2 - else if (tmpa <= -1.0e-20_r8) then - m = 3 - else if (tmpa <= -1.0e-30_r8) then - m = 4 - else - m = 5 - end if - xnerr_astem_negative(m,n) = xnerr_astem_negative(m,n) + 1.0_r8 - gas(igas) = 0.0_r8 - end do - - do ibin = 1, nbin_a - do j = 1, 3 - do iaer = 1, naer - tmpa = aer(iaer,j,ibin) - if (tmpa >= 0.0_r8) then - cycle - else if (tmpa <= -1.0e-5_r8 ) then - m = 1 - else if (tmpa <= -1.0e-10_r8) then - m = 2 - else if (tmpa <= -1.0e-20_r8) then - m = 3 - else if (tmpa <= -1.0e-30_r8) then - m = 4 - else - m = 5 - end if - xnerr_astem_negative(m,n) = xnerr_astem_negative(m,n) + 1.0_r8 - aer(iaer,j,ibin) = 0.0_r8 - end do - enddo - enddo - - end subroutine check_astem_negative - - - -!*********************************************************************** -! part of ASTEM: integrates semi-volatile inorganic gases -! -! author: Rahul A. Zaveri -! update: feb 2015 -!----------------------------------------------------------------------- -subroutine ASTEM_semi_volatiles( iprint_input, dtchem, jaerosolstate, & - sfc_a, flux_s, flux_l, Heff, volatile_s, phi_volatile_s, & - jphase, aer, kg, gas, jhyst_leg, electrolyte, epercent, kel, activity, mc, & - delta_nh3_max, delta_hno3_max, delta_hcl_max, & - num_a, mass_dry_a, mass_wet_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, total_species, tot_cl_in, & - aH2O_a, aH2O, ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, Keq_ll, & - Keq_gl, Keq_sg, Kp_nh4cl, Kp_nh4no3, Keq_nh4cl, MW_c, MW_a, mw_aer_mac, & - dens_aer_mac, Keq_sl, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, & - jsalt_present, jsalt_index, jsulf_poor, jsulf_rich, phi_salt_old, & - integrate, phi_volatile_l, & - kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: nbin_a_max, ngas_volatile, nelectrolyte, & - Ncation, naer, mYES, mNO, ngas_ioa, jsolid, jliquid, all_solid, all_liquid, & - mixed, no_aerosol, jtotal, jhyst_lo, Nanion, nrxn_aer_gl, nrxn_aer_ll, & - nrxn_aer_sg, nrxn_aer_sl, nsalt, MDRH_T_NUM, jsulf_poor_NUM, jsulf_rich_NUM, & - nbin_a, &!Input - jnh4cl, jnh4no3, &!TBD - iso4_a, inh3_g, ihno3_g, ihcl_g, & ! RAZ 2/2/2015: bugfix - mosaic_vars_aa_type - - use module_mosaic_ext, only: do_full_deliquescence,form_electrolytes - - - - ! subr arguments - integer, intent(inout) :: iprint_input - integer, intent(in), dimension(nsalt) :: jsalt_index - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase - integer, intent(inout), dimension(nbin_a_max) :: jhyst_leg - integer, intent(in), dimension(jsulf_poor_NUM) :: jsulf_poor - integer, intent(in), dimension(jsulf_rich_NUM) :: jsulf_rich - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: dtchem - real(r8), intent(in) :: aH2O,rtol_mesa - real(r8), intent(inout) :: Kp_nh4cl,Kp_nh4no3,Keq_nh4cl - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: delta_nh3_max,delta_hno3_max - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hcl_max,water_a,num_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a,mass_wet_a,MDRH - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: aH2O_a,vol_wet_a,gam_ratio,growth_factor - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a, gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,flux_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: Heff,volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - - - ! local variables - character(len=500) :: tmp_str - integer ibin, iv, jp, ieqblm_ASTEM, islow_intermassxfer ! RAZ 2/2/2015: bugfix - integer, dimension(nbin_a_max) :: idry_case3a - - real(r8) :: dtmax, t_new, t_old, t_out, XT,kelvin_nh4no3 - real(r8) :: sum1, sum2, sum3, sum4, sum4a, sum4b, h_flux_s - real(r8) :: phi_nh4no3_s, phi_nh4cl_s,kelvin_nh4cl,Keq_nh4no3 - real(r8) :: sumkg_nh3,sumkg_hno3,sumkg_hcl ! RAZ 2/2/2015: bugfix - real(r8), dimension(nbin_a_max) :: kgfrac_nh3,kgfrac_hno3,kgfrac_hcl ! RAZ 2/2/2015: bugfix - real(r8), dimension(ngas_volatile) :: sum_phi_volatile_s, sum_phi_volatile_l, sum_phi_volatile - real(r8), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,df_gas_l - real(r8), dimension(ngas_volatile,nbin_a_max) :: h_s_i_m - real(r8), dimension(3,nbin_a_max) :: electrolyte_sum - - - ! initialize time - t_old = 0.0 - t_out = dtchem - - ! reset ASTEM time steps and MESA iterations counters to zero - mosaic_vars_aa%isteps_ASTEM = 0 - do ibin = 1, nbin_a - mosaic_vars_aa%iter_MESA(ibin) = 0 - enddo - -! RAZ 2/2/2015: begin bugfix - sumkg_nh3 = 0.0 - sumkg_hno3 = 0.0 - sumkg_hcl = 0.0 - do ibin = 1, nbin_a - sumkg_nh3 = sumkg_nh3 + kg(inh3_g,ibin) - sumkg_hno3 = sumkg_hno3 + kg(ihno3_g,ibin) - sumkg_hcl = sumkg_hcl + kg(ihcl_g,ibin) - enddo - do ibin = 1, nbin_a - kgfrac_nh3(ibin) = kg(inh3_g,ibin)/sumkg_nh3 - kgfrac_hno3(ibin) = kg(ihno3_g,ibin)/sumkg_hno3 - kgfrac_hcl(ibin) = kg(ihcl_g,ibin)/sumkg_hcl - enddo -! RAZ 2/2/2015: end bugfix - - - !-------------------------------- - ! overall integration loop begins over dtchem seconds - -10 mosaic_vars_aa%isteps_ASTEM = mosaic_vars_aa%isteps_ASTEM + 1 - - ! compute new fluxes - phi_nh4no3_s = 0.0 - phi_nh4cl_s = 0.0 - ieqblm_ASTEM = mYES ! reset to default - - do 501 ibin = 1, nbin_a - - idry_case3a(ibin) = mNO ! reset to default - ! default fluxes and other stuff - do iv = 1, ngas_ioa - sfc_a(iv) = gas(iv) - df_gas_s(iv,ibin) = 0.0 - df_gas_l(iv,ibin) = 0.0 - flux_s(iv,ibin) = 0.0 - flux_l(iv,ibin) = 0.0 - Heff(iv,ibin) = 0.0 - volatile_s(iv,ibin) = 0.0 - phi_volatile_s(iv,ibin) = 0.0 - phi_volatile_l(iv,ibin) = 0.0 - integrate(iv,jsolid,ibin) = mNO ! reset to default - integrate(iv,jliquid,ibin) = mNO ! reset to default - enddo - -! RAZ 2/2/2015: begin bugfix -! Added this block here to prevent aer going negative in "absorb_tiny_******" subroutines -! update estimated possible condensation for each bin - used to calculate "tiny" amounts - if(jaerosolstate(ibin) .ne. no_aerosol)then - delta_nh3_max(ibin) = 0.1*gas(inh3_g)*kgfrac_nh3(ibin) - delta_hno3_max(ibin)= 0.1*gas(ihno3_g)*kgfrac_hno3(ibin) - delta_hcl_max(ibin) = 0.1*gas(ihcl_g)*kgfrac_hcl(ibin) - endif -! RAZ 2/2/2015: end bugfix - - - if(jaerosolstate(ibin) .eq. all_solid)then - jphase(ibin) = jsolid - call ASTEM_flux_dry(ibin, phi_nh4no3_s, phi_nh4cl_s, ieqblm_ASTEM, & - idry_case3a, sfc_a, df_gas_s, flux_s, phi_volatile_s, integrate, aer, kg, & - gas, electrolyte, epercent, Keq_sg) - - elseif(jaerosolstate(ibin) .eq. all_liquid)then - jphase(ibin) = jliquid - call ASTEM_flux_wet(ibin, ieqblm_ASTEM, sfc_a, df_gas_s, df_gas_l, & - jaerosolstate, flux_s, Heff, phi_volatile_s, phi_volatile_l, integrate, & - jphase, aer, kg, gas, jhyst_leg, electrolyte, kel, activity, mc, & - delta_nh3_max, delta_hno3_max, delta_hcl_max, Keq_nh4cl, Keq_nh4no3, & - num_a, electrolyte_sum, mass_dry_a, mass_soluble_a, water_a, aH2O, & - kelvin_nh4no3, kelvin_nh4cl, ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, & - na_Ma, nc_Mc, xeq_c, mw_electrolyte, Kp_nh4cl, Kp_nh4no3, Keq_gl, Keq_ll, & - MW_c, MW_a, total_species, tot_cl_in, molality0, & - kappa_nonelectro, mosaic_vars_aa ) - - elseif(jaerosolstate(ibin) .eq. mixed)then - call ASTEM_flux_mix(ibin, phi_nh4no3_s, phi_nh4cl_s, ieqblm_ASTEM, & - idry_case3a, sfc_a, df_gas_s, df_gas_l, jaerosolstate, flux_s, Heff, & - phi_volatile_s, phi_volatile_l, integrate, jphase, aer, kg, gas, jhyst_leg, & - electrolyte, epercent, kel, activity, mc, delta_nh3_max, delta_hno3_max, & - delta_hcl_max, Keq_nh4cl, Keq_nh4no3, num_a, electrolyte_sum, mass_dry_a, & - mass_soluble_a, water_a, aH2O, kelvin_nh4no3, kelvin_nh4cl, ma, gam, & - log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, & - Kp_nh4cl, Kp_nh4no3, Keq_ll, Keq_gl, Keq_sg, MW_c, MW_a, total_species, & - tot_cl_in, molality0, kappa_nonelectro, mosaic_vars_aa ) ! jphase(ibin) will be determined in this subr. - - endif - -501 continue - - if(ieqblm_ASTEM .eq. mYES)goto 30 ! all bins have reached eqblm, so quit. - - -! RAZ 2/2/2015: new algorithm begin -! check if extremely slow inter-particle mass transfer is occurring after 20 ASTEM steps - islow_intermassxfer = mNO ! default - if(mosaic_vars_aa%isteps_ASTEM .gt. 20)then - islow_intermassxfer = mYes ! default - - do iv = 2, 4 ! HNO3, HCl, NH3 - sum_phi_volatile_s(iv) = sum(abs(phi_volatile_s(iv,1:nbin_a))) - sum_phi_volatile_l(iv) = sum(abs(phi_volatile_l(iv,1:nbin_a))) - sum_phi_volatile(iv) = sum_phi_volatile_s(iv) + sum_phi_volatile_l(iv) - - if(gas(iv) .gt. 0.01 .and. sum_phi_volatile(iv) .gt. 0.01)islow_intermassxfer = mNO - - enddo - endif - - if(islow_intermassxfer .eq. mYES)goto 30 ! extremely slow interparticle massxfer, so quit. -! RAZ 2/2/2015: new algorithm end - - - !------------------------- - ! calculate maximum possible internal time-step -11 call ASTEM_calculate_dtmax( dtchem, dtmax, jaerosolstate, idry_case3a, df_gas_s, & - flux_s, volatile_s, phi_volatile_l, integrate, aer, kg, gas, electrolyte, & - h_s_i_m, mosaic_vars_aa ) - t_new = t_old + dtmax ! update time - if(t_new .gt. t_out)then ! check if the new time step is too large - dtmax = t_out - t_old - t_new = t_out*1.01 - endif - - - !------------------------------------------ - ! do internal time-step (dtmax) integration - - do 20 iv = 2, 4 - - sum1 = 0.0 - sum2 = 0.0 - sum3 = 0.0 - sum4 = 0.0 - sum4a= 0.0 - sum4b= 0.0 - - do 21 ibin = 1, nbin_a - if(jaerosolstate(ibin) .eq. no_aerosol)goto 21 - - jp = jliquid - sum1 = sum1 + aer(iv,jp,ibin)/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)*integrate(iv,jp,ibin)) - - sum2 = sum2 + kg(iv,ibin)*integrate(iv,jp,ibin)/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)*integrate(iv,jp,ibin)) - - jp = jsolid - sum3 = sum3 + aer(iv,jp,ibin) - - if(flux_s(iv,ibin) .gt. 0.)then - h_flux_s = dtmax*flux_s(iv,ibin) - sum4a = sum4a + h_flux_s - aer(iv,jp,ibin) = aer(iv,jp,ibin) + h_flux_s - elseif(flux_s(iv,ibin) .lt. 0.)then - h_flux_s = min(h_s_i_m(iv,ibin),dtmax)*flux_s(iv,ibin) - sum4b = sum4b + h_flux_s - aer(iv,jp,ibin) = aer(iv,jp,ibin) + h_flux_s - aer(iv,jp,ibin) = max(aer(iv,jp,ibin), 0.0d0) - endif - -21 continue - - sum4 = sum4a + sum4b - - - ! first update gas concentration - gas(iv) = (total_species(iv) - (sum1 + sum3 + sum4) )/ & - (1. + dtmax*sum2) - gas(iv) = max(gas(iv), 0.0d0) - - ! if(gas(iv) .lt. 0.)write(6,*) gas(iv) - - ! now update aer concentration in the liquid phase - do 22 ibin = 1, nbin_a - - if(integrate(iv,jliquid,ibin) .eq. mYES)then - aer(iv,jliquid,ibin) = & - (aer(iv,jliquid,ibin) + dtmax*kg(iv,ibin)*gas(iv))/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)) - endif - -22 continue - - -20 continue - !------------------------------------------ - ! sub-step integration done - - - !------------------------------------------ - ! now update aer(jtotal) and update internal phase equilibrium - ! also do integration of species by mass balance if necessary - ! - do 40 ibin = 1, nbin_a - if(jaerosolstate(ibin) .eq. no_aerosol)goto 40 - - if(jphase(ibin) .eq. jsolid)then - call form_electrolytes(jsolid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! degas excess nh3 (if present) - elseif(jphase(ibin) .eq. jliquid)then - call form_electrolytes(jliquid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! degas excess nh3 (if present) - elseif(jphase(ibin) .eq. jtotal)then - call form_electrolytes(jsolid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! degas excess nh3 (if present) - call form_electrolytes(jliquid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! degas excess nh3 (if present) - endif - - !======================== - ! now update jtotal - do iv = 2, ngas_ioa - aer(iv,jtotal,ibin)=aer(iv,jsolid,ibin)+aer(iv,jliquid,ibin) - enddo - !======================== - - - call form_electrolytes(jtotal,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! for MDRH diagnosis - - - - ! update internal phase equilibrium - if(jhyst_leg(ibin) .eq. jhyst_lo)then - call ASTEM_update_phase_eqblm(ibin, jaerosolstate, & - jphase, aer, jhyst_leg, electrolyte, epercent, activity, mc, num_a, & - mass_dry_a, mass_wet_a, mass_soluble_a, vol_dry_a, vol_wet_a, water_a, & - aH2O_a, aH2O, ma, gam, log_gamZ, zc, za, & - gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, & - dens_aer_mac, Keq_sl, MW_c, MW_a, Keq_ll, growth_factor, MDRH, MDRH_T, & - molality0, rtol_mesa, jsalt_present, jsalt_index, jsulf_poor, jsulf_rich, & - phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - if (mosaic_vars_aa%f_mos_fail > 0) then - return - endif - else - call do_full_deliquescence(ibin,aer,electrolyte) ! simply do liquid <-- total - endif - - -40 continue - !------------------------------------------ - - ! update time - t_old = t_new - - if(mosaic_vars_aa%isteps_ASTEM .ge. mosaic_vars_aa%nmax_ASTEM)then - mosaic_vars_aa%jASTEM_fail = mosaic_vars_aa%jASTEM_fail + 1 - write(tmp_str,*)'ASTEM internal steps exceeded', mosaic_vars_aa%nmax_ASTEM - call mosaic_warn_mess(trim(adjustl(tmp_str))) - - write(tmp_str,*)'ibin =', ibin - call mosaic_warn_mess(trim(adjustl(tmp_str))) - - if(iprint_input .eq. mYES)then - ! call print_input - iprint_input = mNO - endif - goto 30 - elseif(t_new .lt. t_out)then - goto 10 - endif - - - ! check if end of dtchem reached - if(t_new .lt. 0.9999*t_out) goto 10 - -30 mosaic_vars_aa%cumul_steps_ASTEM = mosaic_vars_aa%cumul_steps_ASTEM + mosaic_vars_aa%isteps_ASTEM - mosaic_vars_aa%isteps_ASTEM_max = max( mosaic_vars_aa%isteps_ASTEM_max, mosaic_vars_aa%isteps_ASTEM ) - !================================================ - ! end of overall integration loop over dtchem seconds - - - ! - ! call subs to calculate fluxes over mixed-phase particles to update H+ ions, - ! which were wiped off during update_phase_eqblm - do ibin = 1, nbin_a - - if(jaerosolstate(ibin) .eq. mixed)then - if( electrolyte(jnh4no3,jsolid,ibin).gt. 0.0 .or. & - electrolyte(jnh4cl, jsolid,ibin).gt. 0.0 )then - call ASTEM_flux_mix(ibin, phi_nh4no3_s, phi_nh4cl_s, ieqblm_ASTEM, & - idry_case3a, sfc_a, df_gas_s, df_gas_l, jaerosolstate, flux_s, Heff, & - phi_volatile_s, phi_volatile_l, integrate, jphase, aer, kg, gas, & - jhyst_leg, electrolyte, epercent, kel, activity, mc, delta_nh3_max, & - delta_hno3_max, delta_hcl_max, Keq_nh4cl, Keq_nh4no3, num_a, & - electrolyte_sum, mass_dry_a, mass_soluble_a, water_a, aH2O, & - kelvin_nh4no3, kelvin_nh4cl, ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, & - na_Ma, nc_Mc, xeq_c, mw_electrolyte, Kp_nh4cl, Kp_nh4no3, Keq_ll, & - Keq_gl, Keq_sg, MW_c, MW_a, total_species, tot_cl_in, molality0, & - kappa_nonelectro, mosaic_vars_aa ) ! jphase(ibin) will be determined in this subr. - else - jphase(ibin) = jliquid - call ASTEM_flux_wet(ibin, ieqblm_ASTEM, sfc_a, df_gas_s, df_gas_l, & - jaerosolstate, flux_s, Heff, phi_volatile_s, phi_volatile_l, & - integrate, jphase, aer, kg, gas, jhyst_leg, electrolyte, kel, activity, & - mc, delta_nh3_max, delta_hno3_max, delta_hcl_max, Keq_nh4cl, & - Keq_nh4no3, num_a, electrolyte_sum, mass_dry_a, mass_soluble_a, & - water_a, aH2O, kelvin_nh4no3, kelvin_nh4cl, ma, gam, log_gamZ, zc, za, & - gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, Kp_nh4cl, & - Kp_nh4no3, Keq_gl, Keq_ll, MW_c, MW_a, total_species, tot_cl_in, & - molality0, kappa_nonelectro, mosaic_vars_aa ) - endif - endif - - enddo - - - return -end subroutine ASTEM_semi_volatiles - - - -!*********************************************************************** -! part of ASTEM: computes max time step for gas-aerosol integration -! -! author: Rahul A. Zaveri -! update: jan 2005 -!----------------------------------------------------------------------- -subroutine ASTEM_calculate_dtmax( dtchem, dtmax, jaerosolstate, idry_case3a, & - df_gas_s, flux_s, volatile_s, phi_volatile_l, integrate, aer, kg, gas, electrolyte, & - h_s_i_m, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, naer, & - nelectrolyte, ngas_ioa, mYES, jliquid, jsolid, no_aerosol, & - nbin_a, alpha_astem, & - jnh4no3, ino3_a, jnh4cl, inh4_a, icl_a, & - mosaic_vars_aa_type - - - - ! subr arguments - integer, intent(in), dimension(nbin_a_max) :: jaerosolstate,idry_case3a - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: dtchem - real(r8), intent(out) :: dtmax - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l,kg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: h_s_i_m - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - character(len=500) :: tmp_str - integer :: ibin, iv - real(r8) :: alpha, h_gas, h_sub_max,h_gas_i(ngas_ioa), h_gas_l, h_gas_s - real(r8) :: sum_kg_phi, sum_kg_phi_pos, sum_kg_phi_neg, sumflux_s ! RAZ 2/2/2015: revised algorithm - real(r8), dimension(ngas_volatile) :: sum_bin_s,sum_vdf_s,sum_vol_s - real(r8), dimension(ngas_volatile) :: avg_df_gas_s - - h_sub_max = dtchem/5.0 ! sec RAZ 2/14/2014 - - ! GAS-SIDE - - ! solid-phase - ! calculate h_gas_i and h_gas_l - - h_gas_s = 2.e16 - - do 5 iv = 2, ngas_ioa - h_gas_i(iv) = 1.e16 - sumflux_s = 0.0 - do ibin = 1, nbin_a - if(flux_s(iv,ibin) .gt. 0.0)then - sumflux_s = sumflux_s + flux_s(iv,ibin) - endif - enddo - - if(sumflux_s .gt. 0.0)then - h_gas_i(iv) = 0.1*gas(iv)/sumflux_s - h_gas_s = min(h_gas_s, h_gas_i(iv)) - endif - -5 continue - - - ! liquid-phase - ! calculate h_gas_s and h_gas_l - - h_gas_l = 2.e16 - do 6 iv = 2, ngas_ioa - h_gas_i(iv) = 1.e16 - sum_kg_phi = 0.0 - sum_kg_phi_pos = 0.0 - sum_kg_phi_neg = 0.0 - do ibin = 1, nbin_a - if(integrate(iv,jliquid,ibin) .eq. mYES)then - -! sum_kg_phi = sum_kg_phi + & -! abs(phi_volatile_l(iv,ibin))*kg(iv,ibin) - -! RAZ 2/2/2015: revised algorithm: begin - if(phi_volatile_l(iv,ibin) .gt. 0.0)then - sum_kg_phi_pos = sum_kg_phi_pos + abs(phi_volatile_l(iv,ibin))*kg(iv,ibin) - else - sum_kg_phi_neg = sum_kg_phi_neg + abs(phi_volatile_l(iv,ibin))*kg(iv,ibin) - endif -! RAZ 2/2/2015: revised algorithm: end - - endif - enddo - - sum_kg_phi = max(sum_kg_phi_pos, sum_kg_phi_neg) ! RAZ 2/2/2015: revised algorithm - - if(sum_kg_phi .gt. 0.0)then - h_gas_i(iv) = alpha_astem/sum_kg_phi - h_gas_l = min(h_gas_l, h_gas_i(iv)) - endif - -6 continue - - h_gas = min(h_gas_s, h_gas_l) - h_gas = min(h_gas, h_sub_max) - - - - - ! AEROSOL-SIDE: solid-phase - - ! first load volatile_solid array - do ibin = 1, nbin_a - - volatile_s(ino3_a,ibin) = electrolyte(jnh4no3,jsolid,ibin) - volatile_s(inh4_a,ibin) = electrolyte(jnh4cl,jsolid,ibin) + & - electrolyte(jnh4no3,jsolid,ibin) - - if(idry_case3a(ibin) .eq. mYES)then - volatile_s(icl_a,ibin) = aer(icl_a,jsolid,ibin) - else - volatile_s(icl_a,ibin) = electrolyte(jnh4cl,jsolid,ibin) - endif - - enddo - - - ! next calculate weighted avg_df_gas_s - do iv = 2, ngas_ioa - - sum_bin_s(iv) = 0.0 - sum_vdf_s(iv) = 0.0 - sum_vol_s(iv) = 0.0 - - do ibin = 1, nbin_a - if(flux_s(iv,ibin) .lt. 0.)then ! aer -> gas - sum_bin_s(iv) = sum_bin_s(iv) + 1.0 - sum_vdf_s(iv) = sum_vdf_s(iv) + & - volatile_s(iv,ibin)*df_gas_s(iv,ibin) - sum_vol_s(iv) = sum_vol_s(iv) + volatile_s(iv,ibin) - endif - enddo - - if(sum_vol_s(iv) .gt. 0.0)then - avg_df_gas_s(iv) = sum_vdf_s(iv)/sum_vol_s(iv) - else - avg_df_gas_s(iv) = 1.0 ! never used, but set to 1.0 just to be safe - endif - - enddo - - - ! calculate h_s_i_m - - - do 20 ibin = 1, nbin_a - - if(jaerosolstate(ibin) .eq. no_aerosol) goto 20 - - do 10 iv = 2, ngas_ioa - - if(flux_s(iv,ibin) .lt. 0.)then ! aer -> gas - - alpha = abs(avg_df_gas_s(iv))/ & - (volatile_s(iv,ibin)*sum_bin_s(iv)) - alpha = min(alpha, 1.0d0) - - if(idry_case3a(ibin) .eq. mYES)alpha = 1.0 - - h_s_i_m(iv,ibin) = & - -alpha*volatile_s(iv,ibin)/flux_s(iv,ibin) - - endif - -10 continue - - -20 continue - - - dtmax = min(dtchem, h_gas) - -! dtmax = h_sub_max - - - if(dtmax .eq. 0.0)then - write(tmp_str,*)' dtmax = ', dtmax - call mosaic_warn_mess(trim(adjustl(tmp_str))) - endif - - return -end subroutine ASTEM_calculate_dtmax - - - -!*********************************************************************** -! part of ASTEM: updates solid-liquid partitioning after each gas-aerosol -! mass transfer step -! -! author: Rahul A. Zaveri -! update: sep 2015 -! -! 9/3/2015 RAZ: Bugfix - fixed phase state calculations for aerosols that dont contain any salts, -! but can still contain water due to presence of BC, OC, SOA, and OIN, which are now -! allowed to absorb some water. -!----------------------------------------------------------------------- -subroutine ASTEM_update_phase_eqblm(ibin, jaerosolstate, & - jphase, aer, jhyst_leg, electrolyte, epercent, activity, mc, num_a, mass_dry_a, & - mass_wet_a, mass_soluble_a, vol_dry_a, vol_wet_a, water_a, aH2O_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, & - xeq_c, mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_sl, MW_c, MW_a, Keq_ll, & - growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, jsalt_index, & - jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, nelectrolyte, Ncation, naer, & - jtotal, nsalt, all_solid, jsolid, all_liquid, jliquid, jhyst_lo, jhyst_up, & - Nanion, nrxn_aer_ll, nrxn_aer_sl, MDRH_T_NUM, & - jsulf_poor_NUM, jsulf_rich_NUM, & - ptol_mol_astem, mhyst_force_lo, mhyst_force_up, & - jcacl2, jcano3, mhyst_method, & - mosaic_vars_aa_type - - use module_mosaic_ext, only: do_full_deliquescence, adjust_solid_aerosol, & - MESA_PTC, calculate_XT, aerosol_water, adjust_liquid_aerosol, & - compute_activities - - - ! subr arguments - integer, intent(in):: ibin - integer, intent(in), dimension(nsalt) :: jsalt_index - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - integer, intent(in), dimension(jsulf_poor_NUM) :: jsulf_poor - integer, intent(in), dimension(jsulf_rich_NUM) :: jsulf_rich - - real(r8), intent(in) :: aH2O,rtol_mesa - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_dry_a,mass_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,water_a,gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: aH2O_a,growth_factor,MDRH - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer jsalt_dum, js, j_index, je - real(r8) :: CRH, XT, sum_dum - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do je = 1, nelectrolyte - sum_dum = sum_dum + electrolyte(je,jtotal,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - do je = 1, nelectrolyte - epercent(je,jtotal,ibin) = 100.*electrolyte(je,jtotal,ibin)/sum_dum - enddo - !! EFFI - - - ! calculate overall sulfate ratio - call calculate_XT(ibin,jtotal,XT,aer) ! calc updated XT - - -!! begin new algorithm - 6/3/2015 RAZ - jsalt_dum = 0 ! 9/3/2015 RAZ - do js = 1, nsalt - jsalt_present(js) = 0 ! default value - salt absent - - if(epercent(js,jtotal,ibin) .gt. ptol_mol_astem)then - jsalt_present(js) = 1 ! salt present - jsalt_dum = jsalt_dum + jsalt_index(js) ! 9/3/2015 RAZ - endif - enddo - - - if( (epercent(jcano3,jtotal,ibin) .gt. ptol_mol_astem) .or. & - (epercent(jcacl2,jtotal,ibin) .gt. ptol_mol_astem) )then - CRH = 0.0 ! no crystrallization or efflorescence point - else - CRH = 0.35 ! default value - endif - - - ! now diagnose MDRH - if(jsalt_dum .eq. 0)then ! no salts or acids are present ! 9/3/2015 RAZ: updated algorithm for jsalt_dum = 0 - - CRH = 0.0 - MDRH(ibin) = 0.0 - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & ! 9/3/2015 RAZ: water due to nonelectrolytes (OC, BC, SOA, OIN) - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - return - - elseif(XT .lt. 1. .and. XT .gt. 0.0)then ! excess sulfate, always liquid, MDRH=0.0 - MDRH(ibin) = 0.0 - elseif(XT .ge. 2.0 .or. XT .lt. 0.0)then ! sulfate poor - j_index = jsulf_poor(jsalt_dum) ! 9/3/2015 RAZ - MDRH(ibin) = MDRH_T(j_index) - else ! sulfate rich - j_index = jsulf_rich(jsalt_dum) ! 9/3/2015 RAZ - MDRH(ibin) = MDRH_T(j_index) - endif - - CRH = min(CRH, MDRH(ibin)/100.0) ! 6/3/2015 RAZ - -!! end new algorithm - 6/3/2015 RAZ - - - ! modified step 1: 9/3/2015 RAZ - ! step 1: check if aH2O is below CRH (crystallization or efflorescence point) - if( aH2O_a(ibin).lt.CRH )then - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & ! 9/3/2015 RAZ: water due to nonelectrolytes (OC, BC, SOA, OIN) - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - return - endif - - ! step 2: check mhyst_method - if(mhyst_method == mhyst_force_up .or. jhyst_leg(ibin) == jhyst_up) then ! 9/3/2015 RAZ: either forced up OR (new) already fully deliquesced (may be metastable), so continue on upper leg - call do_full_deliquescence(ibin,aer,electrolyte) ! this call is probably not necessary, but do it just to be safe - jaerosolstate(ibin) = all_liquid - jhyst_leg(ibin) = jhyst_up - jphase(ibin) = jliquid - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - - if(water_a(ibin) .le. 0.0)then ! one last attempt to catch bad input - jaerosolstate(ibin) = all_solid ! no soluble material present - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - else - call adjust_liquid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent) - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a, & - aH2O,ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) - endif - - return - endif - - - ! step 3: diagnose phase state based on MDRH - if(aH2O*100. .lt. MDRH(ibin)) then - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - return - endif - - - ! step 4: none of the above means it must be sub-saturated or mixed-phase -10 if(jphase(ibin) .eq. jsolid)then - call do_full_deliquescence(ibin,aer,electrolyte) - call MESA_PTC( ibin, jaerosolstate, jphase, aer, & - jhyst_leg, electrolyte, epercent, activity, mc, num_a, mass_dry_a, mass_wet_a, & - mass_soluble_a, vol_dry_a, vol_wet_a, water_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, & - nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_sl, MW_c, MW_a, & - Keq_ll, growth_factor, molality0, rtol_mesa, jsalt_present, & - phi_salt_old, kappa_nonelectro, mosaic_vars_aa ) - else - call MESA_PTC( ibin, jaerosolstate, jphase, aer, & - jhyst_leg, electrolyte, epercent, activity, mc, num_a, mass_dry_a, mass_wet_a, & - mass_soluble_a, vol_dry_a, vol_wet_a, water_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, & - nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_sl, MW_c, MW_a, & - Keq_ll, growth_factor, molality0, rtol_mesa, jsalt_present, & - phi_salt_old, kappa_nonelectro, mosaic_vars_aa ) - endif - return - - end subroutine ASTEM_update_phase_eqblm - - - -!================================================================== -! -! LIQUID PARTICLES -! -!*********************************************************************** -! part of ASTEM: computes fluxes over wet aerosols -! -! author: Rahul A. Zaveri -! update: Jan 2007 -!----------------------------------------------------------------------- -subroutine ASTEM_flux_wet(ibin, ieqblm_ASTEM, sfc_a, df_gas_s, df_gas_l, & - jaerosolstate, flux_s, Heff, phi_volatile_s, phi_volatile_l, integrate, jphase, & - aer, kg, gas, jhyst_leg, electrolyte, kel, activity, mc, delta_nh3_max, & - delta_hno3_max, delta_hcl_max, Keq_nh4cl, Keq_nh4no3, num_a, electrolyte_sum, & - mass_dry_a, mass_soluble_a, water_a, aH2O, kelvin_nh4no3, kelvin_nh4cl, ma, gam, & - log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, Kp_nh4cl, & - Kp_nh4no3, Keq_gl, Keq_ll, MW_c, MW_a, total_species, tot_cl_in, molality0, & - kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, nelectrolyte, & - Ncation, naer, jliquid, jsolid, mNO, mYES, Nanion, nrxn_aer_gl, nrxn_aer_ll, & - jcaco3, inh4_a, inh3_g, ihno3_g, ino3_a, ihcl_g, icl_a, jnh4no3, jnh4cl, & - mosaic_vars_aa_type - - use module_mosaic_ext, only: compute_activities, ions_to_electrolytes, & - absorb_tiny_nh4no3, absorb_tiny_nh4cl, absorb_tiny_hno3, absorb_tiny_hcl - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: aH2O - real(r8), intent(inout) :: Keq_nh4cl,Keq_nh4no3,kelvin_nh4no3,kelvin_nh4cl - real(r8), intent(inout) :: Kp_nh4cl,Kp_nh4no3 - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: delta_nh3_max,delta_hno3_max - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hcl_max - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_dry_a,gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,water_a - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,Heff,kg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kel - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(3,nbin_a_max) :: electrolyte_sum - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - character(len=500) :: tmp_str - integer iv, iadjust, iadjust_intermed - real(r8) :: XT, g_nh3_hno3, g_nh3_hcl, a_nh4_no3, a_nh4_cl - - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! for water content calculation - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a, & - water_a,aH2O,ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) - - if(water_a(ibin) .eq. 0.0)then - write(tmp_str,*)'Water is zero in liquid phase' - call mosaic_warn_mess(trim(adjustl(tmp_str))) - write(tmp_str,*)'Stopping in ASTEM_flux_wet' - call mosaic_warn_mess(trim(adjustl(tmp_str))) - mosaic_vars_aa%zero_water_flag = .true. - endif - - !------------------------------------------------------------------- - ! CASE 1: caco3 > 0 absorb acids (and indirectly degas co2) - - if(electrolyte(jcaco3,jsolid,ibin) .gt. 0.0)then - call ASTEM_flux_wet_case1(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,jphase,kg,gas,mc,Keq_ll) - return - endif - - !------------------------------------------------------------------- - ! CASE 2: Sulfate-Rich Domain - -! if(XT.lt.1.9999 .and. XT.ge.0.)then ! RAZ 11/10/2014 - if(XT.lt.2.0 .and. XT.ge.0.)then ! RAZ 11/10/2014 - call ASTEM_flux_wet_case2(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,gas,kel,mc,water_a,ma,gam,gam_ratio,Keq_ll, & - Keq_gl) - return - endif - - !------------------------------------------------------------------- - - if( (gas(inh3_g)+aer(inh4_a,jliquid,ibin)) .lt. 1.e-25)goto 10 ! no ammonia in the system - - !------------------------------------------------------------------- - ! CASE 3: nh4no3 and/or nh4cl maybe active - ! do some small adjustments (if needed) before deciding case 3 - - iadjust = mNO ! default - iadjust_intermed = mNO ! default - - ! nh4no3 - g_nh3_hno3 = gas(inh3_g)*gas(ihno3_g) - a_nh4_no3 = aer(inh4_a,jliquid,ibin)*aer(ino3_a,jliquid,ibin) - - if(g_nh3_hno3 .gt. 0. .and. a_nh4_no3 .eq. 0.)then - call absorb_tiny_nh4no3(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hno3_max,electrolyte_sum) - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - iadjust_intermed = mNO ! reset - endif - - ! nh4cl - g_nh3_hcl = gas(inh3_g)*gas(ihcl_g) - a_nh4_cl = aer(inh4_a,jliquid,ibin)*aer(icl_a,jliquid,ibin) - - if(g_nh3_hcl .gt. 0. .and. a_nh4_cl .eq. 0.)then - call absorb_tiny_nh4cl(ibin,aer,gas,electrolyte,delta_nh3_max,delta_hcl_max,& - electrolyte_sum) - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - endif - - if(iadjust .eq. mYES)then - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg,electrolyte,& - activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam, & - log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - - ! all adjustments done... - - !-------- - kelvin_nh4no3 = kel(inh3_g,ibin)*kel(ihno3_g,ibin) - Keq_nh4no3 = kelvin_nh4no3*activity(jnh4no3,ibin)*Kp_nh4no3 ! = [NH3]s * [HNO3]s - - kelvin_nh4cl = kel(inh3_g,ibin)*kel(ihcl_g,ibin) - Keq_nh4cl = kelvin_nh4cl*activity(jnh4cl,ibin)*Kp_nh4cl ! = [NH3]s * [HCl]s - - call ASTEM_flux_wet_case3(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff,phi_volatile_l,& - integrate,kg,gas,kel,mc,Keq_nh4cl,Keq_nh4no3,water_a,ma,gam,gam_ratio, & - Keq_ll,Keq_gl,aer,total_species,tot_cl_in,activity,electrolyte) - - return - - - !------------------------------------------------------------------- - ! CASE 4: ammonia = 0. hno3 and hcl exchange may happen here - ! do small adjustments (if needed) before deciding case 4 - -10 iadjust = mNO ! default - iadjust_intermed = mNO ! default - - ! hno3 - if(gas(ihno3_g).gt.0. .and. aer(ino3_a,jliquid,ibin).eq.0. .and. & - aer(icl_a,jliquid,ibin) .gt. 0.0)then - call absorb_tiny_hno3(ibin,aer,gas,delta_hno3_max) ! and degas tiny hcl - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - iadjust_intermed = mNO ! reset - endif - - ! hcl - if(gas(ihcl_g).gt.0. .and. aer(icl_a,jliquid,ibin) .eq. 0. .and. & - aer(ino3_a,jliquid,ibin) .gt. 0.0)then - call absorb_tiny_hcl(ibin,aer,gas,delta_hcl_max) ! and degas tiny hno3 - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - endif - - if(iadjust .eq. mYES)then - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg,electrolyte,& - activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam, & - log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - ! all adjustments done... - - call ASTEM_flux_wet_case4(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff,phi_volatile_l,& - integrate,kg,gas,kel,mc,water_a,ma,gam,Keq_ll,Keq_gl) - - - return -end subroutine ASTEM_flux_wet - - - -!*********************************************************************** -! part of ASTEM: subroutines for flux_wet cases -! -! author: Rahul A. Zaveri -! update: Jan 2007 -!----------------------------------------------------------------------- - -! CASE 1: CaCO3 > 0 absorb all acids (and indirectly degas co2) - -subroutine ASTEM_flux_wet_case1(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,jphase,kg,gas,mc,Keq_ll) - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile,Ncation,mYES, & - jsolid,mNO,nrxn_aer_ll, & - jc_h,ihno3_g,ihcl_g - - - ! subr arguments - integer, intent(in):: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: jphase - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - - ! local variables - integer iv - - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - - ! same as dry case1 - if(gas(ihno3_g) .gt. 1.e-6)then - sfc_a(ihno3_g) = 0.0 - df_gas_s(ihno3_g,ibin) = gas(ihno3_g) - phi_volatile_s(ihno3_g,ibin) = 1.0 - flux_s(ihno3_g,ibin) = kg(ihno3_g,ibin)*df_gas_s(ihno3_g,ibin) - integrate(ihno3_g,jsolid,ibin) = mYES - jphase(ibin) = jsolid - ieqblm_ASTEM = mNO - endif - - if(gas(ihcl_g) .gt. 1.e-6)then - sfc_a(ihcl_g) = 0.0 - df_gas_s(ihcl_g,ibin) = gas(ihcl_g) - phi_volatile_s(ihcl_g,ibin) = 1.0 - flux_s(ihcl_g,ibin) = kg(ihcl_g,ibin)*df_gas_s(ihcl_g,ibin) - integrate(ihcl_g,jsolid,ibin) = mYES - jphase(ibin) = jsolid - ieqblm_ASTEM = mNO - endif - - return -end subroutine ASTEM_flux_wet_case1 - - - -!-------------------------------------------------------------------- -! CASE 2: Sulfate-Rich Domain - -subroutine ASTEM_flux_wet_case2(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,gas,kel,mc,water_a,ma,gam,gam_ratio,Keq_ll,Keq_gl) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,Ncation,mYES, & - jliquid,mNO,Nanion,nelectrolyte,nrxn_aer_gl,nrxn_aer_ll, & - jc_h,jc_nh4,inh3_g,jhno3,ja_no3,ihno3_g,jhcl,ja_cl,ihcl_g - - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - ! local variables - real(r8) :: dum_hno3, dum_hcl, dum_nh3 - - - sfc_a(inh3_g) = kel(inh3_g,ibin)* & - gam_ratio(ibin)*mc(jc_nh4,ibin)*Keq_ll(3)/ & - (mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - - sfc_a(ihno3_g) = kel(ihno3_g,ibin)* & - mc(jc_h,ibin)*ma(ja_no3,ibin)*gam(jhno3,ibin)**2/ & - Keq_gl(3) - - sfc_a(ihcl_g) = kel(ihcl_g,ibin)* & - mc(jc_h,ibin)*ma(ja_cl,ibin)*gam(jhcl,ibin)**2/ & - Keq_gl(4) - - dum_hno3 = max(sfc_a(ihno3_g), gas(ihno3_g)) - dum_hcl = max(sfc_a(ihcl_g), gas(ihcl_g)) - dum_nh3 = max(sfc_a(inh3_g), gas(inh3_g)) - - - ! compute relative driving forces - if(dum_hno3 .gt. 0.0)then - df_gas_l(ihno3_g,ibin) = gas(ihno3_g) - sfc_a(ihno3_g) - phi_volatile_l(ihno3_g,ibin)= df_gas_l(ihno3_g,ibin)/dum_hno3 - else - phi_volatile_l(ihno3_g,ibin)= 0.0 - endif - - if(dum_hcl .gt. 0.0)then - df_gas_l(ihcl_g,ibin) = gas(ihcl_g) - sfc_a(ihcl_g) - phi_volatile_l(ihcl_g,ibin) = df_gas_l(ihcl_g,ibin)/dum_hcl - else - phi_volatile_l(ihcl_g,ibin) = 0.0 - endif - - if(dum_nh3 .gt. 0.0)then - df_gas_l(inh3_g,ibin) = gas(inh3_g) - sfc_a(inh3_g) - phi_volatile_l(inh3_g,ibin) = df_gas_l(inh3_g,ibin)/dum_nh3 - else - phi_volatile_l(inh3_g,ibin) = 0.0 - endif - - - ! if(phi_volatile_l(ihno3_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(ihcl_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(inh3_g,ibin) .le. rtol_eqb_astem)then - ! - ! return - ! - ! endif - - - ! compute Heff - if(dum_hno3 .gt. 0.0)then - Heff(ihno3_g,ibin)= & - kel(ihno3_g,ibin)*gam(jhno3,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(3)) - integrate(ihno3_g,jliquid,ibin)= mYES - ieqblm_ASTEM = mNO - endif - - if(dum_hcl .gt. 0.0)then - Heff(ihcl_g,ibin)= & - kel(ihcl_g,ibin)*gam(jhcl,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(4)) - integrate(ihcl_g,jliquid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - if(dum_nh3 .gt. 0.0)then - Heff(inh3_g,ibin) = & - kel(inh3_g,ibin)*gam_ratio(ibin)*1.e-9*Keq_ll(3)/ & - (water_a(ibin)*mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - integrate(inh3_g,jliquid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - - return -end subroutine ASTEM_flux_wet_case2 - - - -!--------------------------------------------------------------------- -! CASE 3: nh4no3 and/or nh4cl may be active - -subroutine ASTEM_flux_wet_case3(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,Keq_nh4cl,Keq_nh4no3,water_a,ma,gam, & - gam_ratio,Keq_ll,Keq_gl,aer,total_species,tot_cl_in,activity,electrolyte) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,Ncation,mYES, & - jliquid,mNO,Nanion,nelectrolyte,nrxn_aer_gl,nrxn_aer_ll,naer, & - inh3_g,ihcl_g,ihno3_g,ja_no3,jhno3,jc_h,ja_cl,jhcl,jc_nh4 - - use module_mosaic_ext, only: quadratic,equilibrate_acids - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout) :: Keq_nh4cl,Keq_nh4no3 - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: gam,activity - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: a, b, c, dum_hno3, dum_hcl, dum_nh3 - ! function - !real(r8) :: quadratic - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihno3_g,ibin)*gas(ihno3_g) & - + kg(ihcl_g,ibin)*gas(ihcl_g) - c = -(kg(ihno3_g,ibin)*Keq_nh4no3 + kg(ihcl_g,ibin)*Keq_nh4cl) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihno3_g) = Keq_nh4no3/max(sfc_a(inh3_g),1.d-20) - sfc_a(ihcl_g) = Keq_nh4cl/max(sfc_a(inh3_g),1.d-20) - - - ! diagnose mH+ - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - elseif(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - call equilibrate_acids(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) ! hno3 and/or hcl may be > 0 in the gas phase - mc(jc_h,ibin) = max(mc(jc_h,ibin), sqrt(Keq_ll(3))) - - sfc_a(inh3_g) = kel(inh3_g,ibin)* & - gam_ratio(ibin)*mc(jc_nh4,ibin)*Keq_ll(3)/ & - (mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - - sfc_a(ihno3_g) = kel(ihno3_g,ibin)* & - mc(jc_h,ibin)*ma(ja_no3,ibin)*gam(jhno3,ibin)**2/ & - Keq_gl(3) - sfc_a(ihcl_g) = kel(ihcl_g,ibin)* & - mc(jc_h,ibin)*ma(ja_cl,ibin)*gam(jhcl,ibin)**2/ & - Keq_gl(4) - endif - - dum_hno3 = max(sfc_a(ihno3_g), gas(ihno3_g)) - dum_hcl = max(sfc_a(ihcl_g), gas(ihcl_g)) - dum_nh3 = max(sfc_a(inh3_g), gas(inh3_g)) - - ! compute relative driving forces - if(dum_hno3 .gt. 0.0)then - df_gas_l(ihno3_g,ibin) = gas(ihno3_g) - sfc_a(ihno3_g) - phi_volatile_l(ihno3_g,ibin)= df_gas_l(ihno3_g,ibin)/dum_hno3 - else - phi_volatile_l(ihno3_g,ibin)= 0.0 - endif - - if(dum_hcl .gt. 0.0)then - df_gas_l(ihcl_g,ibin) = gas(ihcl_g) - sfc_a(ihcl_g) - phi_volatile_l(ihcl_g,ibin) = df_gas_l(ihcl_g,ibin)/dum_hcl - else - phi_volatile_l(ihcl_g,ibin) = 0.0 - endif - - if(dum_nh3 .gt. 0.0)then - df_gas_l(inh3_g,ibin) = gas(inh3_g) - sfc_a(inh3_g) - phi_volatile_l(inh3_g,ibin) = df_gas_l(inh3_g,ibin)/dum_nh3 - else - phi_volatile_l(inh3_g,ibin) = 0.0 - endif - - - - ! if(phi_volatile_l(ihno3_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(ihcl_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(inh3_g,ibin) .le. rtol_eqb_astem)then - ! - ! return - ! - ! endif - - - ! compute Heff - if(dum_hno3 .gt. 0.0)then - Heff(ihno3_g,ibin)= & - kel(ihno3_g,ibin)*gam(jhno3,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(3)) - integrate(ihno3_g,jliquid,ibin)= mYES - ieqblm_ASTEM = mNO - endif - - if(dum_hcl .gt. 0.0)then - Heff(ihcl_g,ibin)= & - kel(ihcl_g,ibin)*gam(jhcl,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(4)) - integrate(ihcl_g,jliquid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - if(dum_nh3 .gt. 0.0)then - Heff(inh3_g,ibin) = & - kel(inh3_g,ibin)*gam_ratio(ibin)*1.e-9*Keq_ll(3)/ & - (water_a(ibin)*mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - integrate(inh3_g,jliquid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - return -end subroutine ASTEM_flux_wet_case3 - - - -!-------------------------------------------------------------------- -! CASE 3a: only NH4NO3 (aq) active - -subroutine ASTEM_flux_wet_case3a(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,Keq_nh4no3,water_a,ma,gam,gam_ratio, & - Keq_ll,Keq_gl) ! NH4NO3 (aq) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,Ncation,mYES, & - jliquid,mNO,Nanion,nelectrolyte,nrxn_aer_gl,nrxn_aer_ll, & - inh3_g,ihno3_g,ja_no3,jhno3,jc_h - - use module_mosaic_ext, only: quadratic - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout) :: Keq_nh4no3 - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - ! local variables - real(r8) :: a, b, c, dum_hno3, dum_nh3 - ! function - !real(r8) :: quadratic - - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihno3_g,ibin)*gas(ihno3_g) - c = -(kg(ihno3_g,ibin)*Keq_nh4no3) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihno3_g) = Keq_nh4no3/sfc_a(inh3_g) - - - ! diagnose mH+ - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - - ! compute Heff - dum_hno3 = max(sfc_a(ihno3_g), gas(ihno3_g)) - dum_nh3 = max(sfc_a(inh3_g), gas(inh3_g)) - - ! compute relative driving forces - if(dum_hno3 .gt. 0.0)then - df_gas_l(ihno3_g,ibin) = gas(ihno3_g) - sfc_a(ihno3_g) - phi_volatile_l(ihno3_g,ibin)= df_gas_l(ihno3_g,ibin)/dum_hno3 - else - phi_volatile_l(ihno3_g,ibin)= 0.0 - endif - - if(dum_nh3 .gt. 0.0)then - df_gas_l(inh3_g,ibin) = gas(inh3_g) - sfc_a(inh3_g) - phi_volatile_l(inh3_g,ibin) = df_gas_l(inh3_g,ibin)/dum_nh3 - else - phi_volatile_l(inh3_g,ibin) = 0.0 - endif - - - ! if(phi_volatile_l(ihno3_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(inh3_g,ibin) .le. rtol_eqb_astem)then - ! - ! return - ! - ! endif - - - ! compute Heff - Heff(ihno3_g,ibin)= & - kel(ihno3_g,ibin)*gam(jhno3,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(3)) - integrate(ihno3_g,jliquid,ibin)= mYES - - - Heff(inh3_g,ibin) = & - kel(inh3_g,ibin)*gam_ratio(ibin)*1.e-9*Keq_ll(3)/ & - (water_a(ibin)*mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - integrate(inh3_g,jliquid,ibin) = mYES - - - ieqblm_ASTEM = mNO - - - return -end subroutine ASTEM_flux_wet_case3a - - - -!-------------------------------------------------------------------- -! CASE 3b: only NH4Cl (aq) active - -subroutine ASTEM_flux_wet_case3b(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,Keq_nh4cl,water_a,ma,gam,gam_ratio, & - Keq_ll,Keq_gl) ! NH4Cl (aq) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,Ncation,mYES, & - jliquid,mNO,Nanion,nelectrolyte,nrxn_aer_gl,nrxn_aer_ll, & - inh3_g,ihcl_g,ja_cl,jhcl,jc_h - - use module_mosaic_ext, only: quadratic - - - ! subr arguments - integer,intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout) :: Keq_nh4cl - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - ! local variables - real(r8) :: a, b, c, dum_hcl, dum_nh3 - ! function - !real(r8) :: quadratic - - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihcl_g,ibin)*gas(ihcl_g) - c = -(kg(ihcl_g,ibin)*Keq_nh4cl) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihcl_g) = Keq_nh4cl /sfc_a(inh3_g) - - - ! diagnose mH+ - if(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - - ! compute Heff - dum_hcl = max(sfc_a(ihcl_g), gas(ihcl_g)) - dum_nh3 = max(sfc_a(inh3_g), gas(inh3_g)) - - - ! compute relative driving forces - if(dum_hcl .gt. 0.0)then - df_gas_l(ihcl_g,ibin) = gas(ihcl_g) - sfc_a(ihcl_g) - phi_volatile_l(ihcl_g,ibin) = df_gas_l(ihcl_g,ibin)/dum_hcl - else - phi_volatile_l(ihcl_g,ibin) = 0.0 - endif - - if(dum_nh3 .gt. 0.0)then - df_gas_l(inh3_g,ibin) = gas(inh3_g) - sfc_a(inh3_g) - phi_volatile_l(inh3_g,ibin) = df_gas_l(inh3_g,ibin)/dum_nh3 - else - phi_volatile_l(inh3_g,ibin) = 0.0 - endif - - - - ! if(phi_volatile_l(ihcl_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(inh3_g,ibin) .le. rtol_eqb_astem)then - ! - ! return - ! - ! endif - - - - ! compute Heff - Heff(ihcl_g,ibin)= & - kel(ihcl_g,ibin)*gam(jhcl,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(4)) - integrate(ihcl_g,jliquid,ibin) = mYES - - - Heff(inh3_g,ibin) = & - kel(inh3_g,ibin)*gam_ratio(ibin)*1.e-9*Keq_ll(3)/ & - (water_a(ibin)*mc(jc_h,ibin)*Keq_ll(2)*Keq_gl(2)) - integrate(inh3_g,jliquid,ibin) = mYES - - - ieqblm_ASTEM = mNO - - - - return -end subroutine ASTEM_flux_wet_case3b - - - -!----------------------------------------------------------------------- -! CASE 4: NH3 = 0 (in gas and aerosol). hno3 and hcl exchange may happen here - -subroutine ASTEM_flux_wet_case4(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,water_a,ma,gam,Keq_ll,Keq_gl) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,Ncation,mYES, & - jliquid,mNO,Nanion,nelectrolyte,nrxn_aer_gl,nrxn_aer_ll, & - jhno3,ja_no3,ihno3_g,jhcl,ja_cl,ihcl_g,jc_h - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max):: gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) ::mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - ! local variables - real(r8) :: dum_numer, dum_denom, gas_eqb_ratio, dum_hno3, dum_hcl - - - dum_numer = kel(ihno3_g,ibin)*Keq_gl(4)*ma(ja_no3,ibin)* & - gam(jhno3,ibin)**2 - dum_denom = kel(ihcl_g,ibin)*Keq_gl(3)*ma(ja_cl ,ibin)* & - gam(jhcl,ibin)**2 - - - if(dum_denom .eq. 0.0 .or. dum_numer .eq. 0.0)then - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - return - endif - - gas_eqb_ratio = dum_numer/dum_denom ! Ce,hno3/Ce,hcl - - - ! compute equilibrium surface concentrations - sfc_a(ihcl_g) = & - ( kg(ihno3_g,ibin)*gas(ihno3_g) + kg(ihcl_g,ibin)*gas(ihcl_g) )/ & - ( kg(ihcl_g,ibin) + gas_eqb_ratio*kg(ihno3_g,ibin) ) - sfc_a(ihno3_g)= gas_eqb_ratio*sfc_a(ihcl_g) - - - ! diagnose mH+ - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - elseif(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - - ! compute Heff - dum_hno3 = max(sfc_a(ihno3_g), gas(ihno3_g)) - dum_hcl = max(sfc_a(ihcl_g), gas(ihcl_g)) - - ! compute relative driving forces - if(dum_hno3 .gt. 0.0)then - df_gas_l(ihno3_g,ibin) = gas(ihno3_g) - sfc_a(ihno3_g) - phi_volatile_l(ihno3_g,ibin)= df_gas_l(ihno3_g,ibin)/dum_hno3 - else - phi_volatile_l(ihno3_g,ibin)= 0.0 - endif - - if(dum_hcl .gt. 0.0)then - df_gas_l(ihcl_g,ibin) = gas(ihcl_g) - sfc_a(ihcl_g) - phi_volatile_l(ihcl_g,ibin)= df_gas_l(ihcl_g,ibin)/dum_hcl - else - phi_volatile_l(ihcl_g,ibin)= 0.0 - endif - - - ! if(phi_volatile_l(ihno3_g,ibin) .le. rtol_eqb_astem .and. - ! & phi_volatile_l(ihcl_g,ibin) .le. rtol_eqb_astem)then - ! - ! return - ! - ! endif - - - - ! compute Heff - Heff(ihno3_g,ibin)= & - kel(ihno3_g,ibin)*gam(jhno3,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(3)) - integrate(ihno3_g,jliquid,ibin)= mYES - - - Heff(ihcl_g,ibin)= & - kel(ihcl_g,ibin)*gam(jhcl,ibin)**2*mc(jc_h,ibin)*1.e-9/ & - (water_a(ibin)*Keq_gl(4)) - integrate(ihcl_g,jliquid,ibin) = mYES - - - ieqblm_ASTEM = mNO - - - - return -end subroutine ASTEM_flux_wet_case4 - - - -!=========================================================== -! -! DRY PARTICLES -! -!=========================================================== -!*********************************************************************** -! part of ASTEM: computes gas-aerosol fluxes over dry aerosols -! -! author: Rahul A. Zaveri -! update: dec 2006 -!----------------------------------------------------------------------- -subroutine ASTEM_flux_dry(ibin, phi_nh4no3_s,phi_nh4cl_s,ieqblm_ASTEM, & - idry_case3a,sfc_a,df_gas_s,flux_s,phi_volatile_s,integrate,aer,kg,gas, & - electrolyte,epercent,Keq_sg) - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile,naer,jsolid, & - nrxn_aer_sg,nelectrolyte, & - jcaco3,jcacl2,jnacl,ihno3_g,jnh4cl,ihcl_g,inh3_g,jnh4no3 - - use module_mosaic_ext, only: calculate_XT - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: idry_case3a - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(out) :: phi_nh4no3_s,phi_nh4cl_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,kg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer iv - real(r8) :: XT, prod_nh4no3, prod_nh4cl, volatile_cl - - - - call calculate_XT(ibin,jsolid,XT,aer) - - !----------------------------------------------------------------- - ! CASE 1: caco3 > 0 absorb all acids (and indirectly degas co2) - - if(electrolyte(jcaco3,jsolid,ibin) .gt. 0.0)then - call ASTEM_flux_dry_case1(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,kg,gas) - - return - endif - - !----------------------------------------------------------------- - ! CASE 2: Sulfate-Rich Domain - -! if(XT.lt.1.9999 .and. XT.ge.0.)then ! excess sulfate (acidic) ! RAZ 11/10/2014 - if(XT.lt.2.0 .and. XT.ge.0.)then ! excess sulfate (acidic) ! RAZ 11/10/2014 - call ASTEM_flux_dry_case2(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,kg,gas) - - return - endif - - !------------------------------------------------------------------- - ! CASE 3: hno3 and hcl exchange may happen here and nh4cl may form/evaporate - - volatile_cl = electrolyte(jnacl,jsolid,ibin) + & - electrolyte(jcacl2,jsolid,ibin) - - - if(volatile_cl .gt. 0.0 .and. gas(ihno3_g).gt. 0.0 )then - - call ASTEM_flux_dry_case3a(ibin,ieqblm_ASTEM,idry_case3a,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas) - - prod_nh4cl = max( (gas(inh3_g)*gas(ihcl_g)-Keq_sg(2)), 0.0d0) + & - electrolyte(jnh4cl, jsolid,ibin) - - if(prod_nh4cl .gt. 0.0)then - call ASTEM_flux_dry_case3b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas,electrolyte,epercent, & - Keq_sg) - endif - - return - endif - - !----------------------------------------------------------------- - ! CASE 4: nh4no3 or nh4cl or both may be active - - prod_nh4no3 = max( (gas(inh3_g)*gas(ihno3_g)-Keq_sg(1)), 0.0d0) + & - electrolyte(jnh4no3,jsolid,ibin) - prod_nh4cl = max( (gas(inh3_g)*gas(ihcl_g) -Keq_sg(2)), 0.0d0) + & - electrolyte(jnh4cl, jsolid,ibin) - - if(prod_nh4no3 .gt. 0.0 .or. prod_nh4cl .gt. 0.0)then - call ASTEM_flux_dry_case4(ibin,phi_nh4no3_s,phi_nh4cl_s,ieqblm_ASTEM,sfc_a, & - df_gas_s,flux_s,phi_volatile_s,integrate,kg,gas,electrolyte,epercent, & - Keq_sg,aer) - return - endif - - !----------------------------------------------------------------- - - return -end subroutine ASTEM_flux_dry - - - -!---------------------------------------------------------------------- - -!*********************************************************************** -! part of ASTEM: subroutines for flux_dry cases -! -! author: Rahul A. Zaveri -! update: dec 2006 -!----------------------------------------------------------------------- - -! CASE 1: caco3 > 0 absorb all acids (and indirectly degas co2) - -subroutine ASTEM_flux_dry_case1(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,kg,gas) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,mYES,jsolid,mNO,& - ihno3_g,ihcl_g - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s,kg - - - if(gas(ihno3_g) .gt. 1.e-6)then - sfc_a(ihno3_g) = 0.0 - df_gas_s(ihno3_g,ibin) = gas(ihno3_g) - phi_volatile_s(ihno3_g,ibin) = 1.0 - flux_s(ihno3_g,ibin) = kg(ihno3_g,ibin)*df_gas_s(ihno3_g,ibin) - integrate(ihno3_g,jsolid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - if(gas(ihcl_g) .gt. 1.e-6)then - sfc_a(ihcl_g) = 0.0 - df_gas_s(ihcl_g,ibin) = gas(ihcl_g) - phi_volatile_s(ihcl_g,ibin) = 1.0 - flux_s(ihcl_g,ibin) = kg(ihcl_g,ibin)*df_gas_s(ihcl_g,ibin) - integrate(ihcl_g,jsolid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - - return -end subroutine ASTEM_flux_dry_case1 - - - -!--------------------------------------------------------------------- -! CASE 2: Sulfate-Rich Domain - -subroutine ASTEM_flux_dry_case2(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,kg,gas) ! TOUCH - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,mYES,jsolid,mNO,& - inh3_g - - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s,kg - - - if(gas(inh3_g).gt.1.e-6)then - sfc_a(inh3_g) = 0.0 - df_gas_s(inh3_g,ibin) = gas(inh3_g) - phi_volatile_s(inh3_g,ibin) = 1.0 - flux_s(inh3_g,ibin) = kg(inh3_g,ibin)*gas(inh3_g) - integrate(inh3_g,jsolid,ibin) = mYES - ieqblm_ASTEM = mNO - endif - - - return -end subroutine ASTEM_flux_dry_case2 - - - -!--------------------------------------------------------------------- -! CASE 3a: degas hcl from nacl or cacl2 by flux_s balance with hno3 - -subroutine ASTEM_flux_dry_case3a(ibin,ieqblm_ASTEM,idry_case3a,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas) - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile,naer,jsolid, & - mYES,mNO, & - ihno3_g,icl_a,ihcl_g - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: idry_case3a ! changed "out" to "inout" RAZ 11/11/2014 - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - - - if(gas(ihno3_g) .gt. 1.e-6)then - sfc_a(ihno3_g) = 0.0 - sfc_a(ihcl_g) = gas(ihcl_g) + aer(icl_a,jsolid,ibin) - - df_gas_s(ihno3_g,ibin) = gas(ihno3_g) - df_gas_s(ihcl_g,ibin) = -aer(icl_a,jsolid,ibin) - - flux_s(ihno3_g,ibin) = kg(ihno3_g,ibin)*gas(ihno3_g) - flux_s(ihcl_g,ibin) = -flux_s(ihno3_g,ibin) - - phi_volatile_s(ihno3_g,ibin) = 1.0 - phi_volatile_s(ihcl_g,ibin)=df_gas_s(ihcl_g,ibin)/sfc_a(ihcl_g) - - integrate(ihno3_g,jsolid,ibin) = mYES - integrate(ihcl_g,jsolid,ibin) = mYES - - idry_case3a(ibin) = mYES - ieqblm_ASTEM = mNO - endif - - return -end subroutine ASTEM_flux_dry_case3a - - - - -!--------------------------------------------------------------------- -! CASE 3b: nh4cl may form/evaporate here - -subroutine ASTEM_flux_dry_case3b(ibin, phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas,electrolyte,epercent,Keq_sg) ! TOUCH - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,naer,nsalt, & - jsolid,mYES,mNO,nrxn_aer_sg, & - rtol_eqb_ASTEM,ptol_mol_ASTEM, & - nelectrolyte,jnh4cl,ihcl_g,inh3_g,icl_a - - use module_mosaic_ext, only: quadratic,degas_solid_nh4cl - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) ::ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(out) :: phi_nh4cl_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer iactive_nh4cl, js - real(r8) :: a, b, c - real(r8) :: sum_dum - ! function - !real(r8) :: quadratic - - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do js = 1, nsalt - sum_dum = sum_dum + electrolyte(js,jsolid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - epercent(jnh4cl,jsolid,ibin) = 100.*electrolyte(jnh4cl,jsolid,ibin)/sum_dum - !! EFFI - - - - !------------------- - ! set default values for flags - iactive_nh4cl = 1 - - - ! compute relative driving force - phi_nh4cl_s = (gas(inh3_g)*gas(ihcl_g) - Keq_sg(2))/ & - max(gas(inh3_g)*gas(ihcl_g),Keq_sg(2)) - - - !------------------- - ! now determine if nh4cl is active or significant - ! nh4cl - if( abs(phi_nh4cl_s) .lt. rtol_eqb_ASTEM )then - iactive_nh4cl = 0 - elseif(gas(inh3_g)*gas(ihcl_g) .lt. Keq_sg(2) .and. & - epercent(jnh4cl, jsolid,ibin) .le. ptol_mol_ASTEM)then - iactive_nh4cl = 0 - if(epercent(jnh4cl, jsolid,ibin) .gt. 0.0)then - call degas_solid_nh4cl(ibin,aer,gas,electrolyte,Keq_sg) - endif - endif - - - ! check the outcome - if(iactive_nh4cl .eq. 0)return - - - !----------------- - ! nh4cl is active - - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihcl_g,ibin)*gas(ihcl_g) - c = -(kg(ihcl_g,ibin)*Keq_sg(2)) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihcl_g) = Keq_sg(2)/sfc_a(inh3_g) - - df_gas_s(ihcl_g,ibin) = gas(ihcl_g) - sfc_a(ihcl_g) - df_gas_s(inh3_g,ibin) = gas(inh3_g) - sfc_a(inh3_g) - - flux_s(inh3_g,ibin) = kg(inh3_g,ibin)*df_gas_s(inh3_g,ibin) - flux_s(ihcl_g,ibin) = flux_s(ihcl_g,ibin) + flux_s(inh3_g,ibin) - - phi_volatile_s(inh3_g,ibin) = phi_nh4cl_s - - if(flux_s(ihcl_g,ibin) .gt. 0.0)then - df_gas_s(ihcl_g,ibin) = flux_s(ihcl_g,ibin)/kg(ihcl_g,ibin) ! recompute df_gas - phi_volatile_s(ihcl_g,ibin) = phi_nh4cl_s - else - sfc_a(ihcl_g) = gas(ihcl_g) + aer(icl_a,jsolid,ibin) - df_gas_s(ihcl_g,ibin) = -aer(icl_a,jsolid,ibin) - phi_volatile_s(ihcl_g,ibin)=df_gas_s(ihcl_g,ibin)/sfc_a(ihcl_g) ! not to be used - endif - - integrate(inh3_g,jsolid,ibin) = mYES - integrate(ihcl_g,jsolid,ibin) = mYES ! integrate HCl with explicit euler - - ieqblm_ASTEM = mNO - - return -end subroutine ASTEM_flux_dry_case3b - - - - -!--------------------------------------------------------------------- -! Case 4: NH4NO3 and/or NH4Cl may be active - -subroutine ASTEM_flux_dry_case4(ibin, phi_nh4no3_s,phi_nh4cl_s,ieqblm_ASTEM, & - sfc_a,df_gas_s,flux_s,phi_volatile_s,integrate,kg,gas,electrolyte,epercent, & - Keq_sg,aer) ! TOUCH - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,nelectrolyte, & - nsalt,jsolid,nrxn_aer_sg,naer, & - rtol_eqb_ASTEM,ptol_mol_ASTEM, & - jnh4no3,jnh4cl,ihno3_g,inh3_g,ihcl_g - - use module_mosaic_ext, only: quadratic,degas_solid_nh4no3,degas_solid_nh4cl - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(out) :: phi_nh4no3_s,phi_nh4cl_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer iactive_nh4no3, iactive_nh4cl, iactive, js - real(r8) :: a, b, c - real(r8) :: sum_dum - ! function - !real(r8) :: quadratic - - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do js = 1, nsalt - sum_dum = sum_dum + electrolyte(js,jsolid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - epercent(jnh4no3,jsolid,ibin) = 100.*electrolyte(jnh4no3,jsolid,ibin)/sum_dum - epercent(jnh4cl, jsolid,ibin) = 100.*electrolyte(jnh4cl, jsolid,ibin)/sum_dum - !! EFFI - - - !------------------- - ! set default values for flags - iactive_nh4no3 = 1 - iactive_nh4cl = 2 - - - ! compute diagnostic products and ratios - phi_nh4no3_s = (gas(inh3_g)*gas(ihno3_g) - Keq_sg(1))/ & - max(gas(inh3_g)*gas(ihno3_g),Keq_sg(1)) - phi_nh4cl_s = (gas(inh3_g)*gas(ihcl_g) - Keq_sg(2))/ & - max(gas(inh3_g)*gas(ihcl_g),Keq_sg(2)) - - - !------------------- - ! now determine if nh4no3 and/or nh4cl are active or significant - - ! nh4no3 - if( abs(phi_nh4no3_s) .lt. rtol_eqb_ASTEM )then - iactive_nh4no3 = 0 - elseif(gas(inh3_g)*gas(ihno3_g) .lt. Keq_sg(1) .and. & - epercent(jnh4no3,jsolid,ibin) .le. ptol_mol_ASTEM)then - iactive_nh4no3 = 0 - if(epercent(jnh4no3,jsolid,ibin) .gt. 0.0)then - call degas_solid_nh4no3(ibin,aer,gas,electrolyte,Keq_sg) - endif - endif - - ! nh4cl - if( abs(phi_nh4cl_s) .lt. rtol_eqb_ASTEM )then - iactive_nh4cl = 0 - elseif(gas(inh3_g)*gas(ihcl_g) .lt. Keq_sg(2) .and. & - epercent(jnh4cl, jsolid,ibin) .le. ptol_mol_ASTEM)then - iactive_nh4cl = 0 - if(epercent(jnh4cl, jsolid,ibin) .gt. 0.0)then - call degas_solid_nh4cl(ibin,aer,gas,electrolyte,Keq_sg) - endif - endif - - - iactive = iactive_nh4no3 + iactive_nh4cl - - ! check the outcome - if(iactive .eq. 0)return - - - goto (1,2,3),iactive - - !--------------------------------- - ! only nh4no3 solid is active -1 call ASTEM_flux_dry_case4a(ibin,phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) - return - - - !----------------- - ! only nh4cl solid is active -2 call ASTEM_flux_dry_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s,& - phi_volatile_s,integrate,kg,gas,Keq_sg) - return - - - !----------------- - ! both nh4no3 and nh4cl are active -3 call ASTEM_flux_dry_case4ab(ibin,phi_nh4no3_s,phi_nh4cl_s,ieqblm_ASTEM,sfc_a, & - df_gas_s,flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) - - - return -end subroutine ASTEM_flux_dry_case4 - - - -!--------------------------------------------------------------------- -! Case 4a - -subroutine ASTEM_flux_dry_case4a(ibin, phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) ! NH4NO3 solid - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,jsolid,mYES,mNO,& - nrxn_aer_sg, & - ihno3_g,inh3_g - - use module_mosaic_ext, only: quadratic - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: phi_nh4no3_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - ! local variables - real(r8) :: a, b, c - ! function - !real(r8) :: quadratic - - - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihno3_g,ibin)*gas(ihno3_g) - c = -(kg(ihno3_g,ibin)*Keq_sg(1)) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihno3_g) = Keq_sg(1)/sfc_a(inh3_g) - - integrate(ihno3_g,jsolid,ibin) = mYES - integrate(inh3_g,jsolid,ibin) = mYES - - df_gas_s(ihno3_g,ibin)=gas(ihno3_g)-sfc_a(ihno3_g) - df_gas_s(inh3_g,ibin) =gas(inh3_g) -sfc_a(inh3_g) - - phi_volatile_s(ihno3_g,ibin)= phi_nh4no3_s - phi_volatile_s(inh3_g,ibin) = phi_nh4no3_s - - flux_s(ihno3_g,ibin) = kg(ihno3_g,ibin)*df_gas_s(ihno3_g,ibin) - flux_s(inh3_g,ibin) = flux_s(ihno3_g,ibin) - - ieqblm_ASTEM = mNO - - return -end subroutine ASTEM_flux_dry_case4a - - - -!---------------------------------------------------------------- -! Case 4b - -subroutine ASTEM_flux_dry_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) ! NH4Cl solid - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,mYES,jsolid, & - mNO,nrxn_aer_sg, & - inh3_g,ihcl_g - - use module_mosaic_ext, only: quadratic - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: phi_nh4cl_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - ! local variables - real(r8) :: a, b, c - ! function - !real(r8) :: quadratic - - - a = kg(inh3_g,ibin) - b = - kg(inh3_g,ibin)*gas(inh3_g) & - + kg(ihcl_g,ibin)*gas(ihcl_g) - c = -(kg(ihcl_g,ibin)*Keq_sg(2)) - - sfc_a(inh3_g) = quadratic(a,b,c) - sfc_a(ihcl_g) = Keq_sg(2) /sfc_a(inh3_g) - - integrate(ihcl_g,jsolid,ibin) = mYES - integrate(inh3_g,jsolid,ibin) = mYES - - df_gas_s(ihcl_g,ibin) = gas(ihcl_g)-sfc_a(ihcl_g) - df_gas_s(inh3_g,ibin) = gas(inh3_g)-sfc_a(inh3_g) - - phi_volatile_s(ihcl_g,ibin) = phi_nh4cl_s - phi_volatile_s(inh3_g,ibin) = phi_nh4cl_s - - flux_s(ihcl_g,ibin) = kg(ihcl_g,ibin)*df_gas_s(ihcl_g,ibin) - flux_s(inh3_g,ibin) = flux_s(ihcl_g,ibin) - - ieqblm_ASTEM = mNO - - return -end subroutine ASTEM_flux_dry_case4b - - - - -!------------------------------------------------------------------- -! Case 4ab - -subroutine ASTEM_flux_dry_case4ab(ibin, phi_nh4no3_s, phi_nh4cl_s,ieqblm_ASTEM, & - sfc_a,df_gas_s,flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) ! NH4NO3 + NH4Cl (solid) - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,mNO,nrxn_aer_sg,& - ihcl_g,ihno3_g,inh3_g - - use module_mosaic_ext, only: quadratic - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: phi_nh4no3_s,phi_nh4cl_s - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,flux_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - ! local variables - real(r8) :: a,b,c,flux_nh3_est, flux_nh3_max, ratio_flux - ! function - !real(r8) :: quadratic - - call ASTEM_flux_dry_case4a(ibin,phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) - call ASTEM_flux_dry_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) - - - ! estimate nh3 flux and adjust hno3 and/or hcl if necessary - - flux_nh3_est = flux_s(ihno3_g,ibin)+flux_s(ihcl_g,ibin) - flux_nh3_max = kg(inh3_g,ibin)*gas(inh3_g) - - - if(flux_nh3_est .le. flux_nh3_max)then - - flux_s(inh3_g,ibin) = flux_nh3_est ! all ok - no adjustments needed - sfc_a(inh3_g) = gas(inh3_g) - & ! recompute sfc_a(ihno3_g) - flux_s(inh3_g,ibin)/kg(inh3_g,ibin) - phi_volatile_s(inh3_g,ibin) = max(abs(phi_nh4no3_s), & - abs(phi_nh4cl_s)) - - else ! reduce hno3 and hcl flux_ses as necessary so that nh3 flux_s = flux_s_nh3_max - - ratio_flux = flux_nh3_max/flux_nh3_est - flux_s(inh3_g,ibin) = flux_nh3_max - flux_s(ihno3_g,ibin)= flux_s(ihno3_g,ibin)*ratio_flux - flux_s(ihcl_g,ibin) = flux_s(ihcl_g,ibin) *ratio_flux - - sfc_a(inh3_g) = 0.0 - sfc_a(ihno3_g)= gas(ihno3_g) - & ! recompute sfc_a(ihno3_g) - flux_s(ihno3_g,ibin)/kg(ihno3_g,ibin) - sfc_a(ihcl_g) = gas(ihcl_g) - & ! recompute sfc_a(ihcl_g) - flux_s(ihcl_g,ibin)/kg(ihcl_g,ibin) - - df_gas_s(inh3_g,ibin) =gas(inh3_g) -sfc_a(inh3_g) - df_gas_s(ihno3_g,ibin)=gas(ihno3_g)-sfc_a(ihno3_g) - df_gas_s(ihcl_g,ibin) =gas(ihcl_g) -sfc_a(ihcl_g) - - phi_volatile_s(inh3_g,ibin) = max(abs(phi_nh4no3_s), & - abs(phi_nh4cl_s)) - - - endif - - ieqblm_ASTEM = mNO - - return -end subroutine ASTEM_flux_dry_case4ab - - - -!======================================================================= -! -! MIXED-PHASE PARTICLES -! -!*********************************************************************** -! part of ASTEM: computes gas-aerosol fluxes over mixed-phase aerosols -! -! author: Rahul A. Zaveri -! update: apr 2006 -!----------------------------------------------------------------------- - -subroutine ASTEM_flux_mix(ibin, phi_nh4no3_s, phi_nh4cl_s, ieqblm_ASTEM, idry_case3a, & - sfc_a, df_gas_s, df_gas_l, jaerosolstate, flux_s, Heff, phi_volatile_s, & - phi_volatile_l, integrate, jphase, aer, kg, gas, jhyst_leg, electrolyte, epercent, & - kel, activity, mc, delta_nh3_max, delta_hno3_max, delta_hcl_max, Keq_nh4cl, & - Keq_nh4no3, num_a, electrolyte_sum, mass_dry_a, mass_soluble_a, water_a, aH2O, & - kelvin_nh4no3, kelvin_nh4cl, ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, & - nc_Mc, xeq_c, mw_electrolyte, Kp_nh4cl, Kp_nh4no3, Keq_ll, Keq_gl, Keq_sg, MW_c, & - MW_a, total_species, tot_cl_in, molality0, kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, nelectrolyte, & - Ncation, naer, jliquid, nsalt, jsolid, mNO, mYES, jtotal, Nanion, nrxn_aer_gl, & - nrxn_aer_ll, nrxn_aer_sg, & - jcaco3, jcacl2, jnacl, ihno3_g, jnh4cl, ihcl_g, inh3_g, jnh4no3, ja_no3, jc_h, & - ja_cl, jhcl, icl_a, inh4_a, ino3_a, jhno3, mosaic_vars_aa_type - - use module_mosaic_ext, only: compute_activities, ions_to_electrolytes, & - absorb_tiny_nh4cl, degas_tiny_nh4cl, absorb_tiny_nh4no3, degas_tiny_nh4no3, & - absorb_tiny_hno3, absorb_tiny_hcl - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: idry_case3a,jaerosolstate - integer, intent(inout), dimension(nbin_a_max) :: jphase,jhyst_leg - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(out) :: phi_nh4no3_s, phi_nh4cl_s - real(r8), intent(in) :: aH2O - real(r8), intent(inout) :: Keq_nh4cl,Keq_nh4no3,kelvin_nh4no3,Kp_nh4cl - real(r8), intent(inout) :: kelvin_nh4cl,Kp_nh4no3 - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: delta_nh3_max,delta_hno3_max - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hcl_max,mass_soluble_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,num_a,mass_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,Heff,kel - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) ::mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(3,nbin_a_max) :: electrolyte_sum - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - character(len=500) :: tmp_str - integer iv, iadjust, iadjust_intermed, js - real(r8) :: XT,g_nh3_hno3,g_nh3_hcl,a_nh4_no3,a_nh4_cl,a_no3,a_cl,prod_nh4no3 - real(r8) :: volatile_cl,sum_dum,prod_nh4cl - - - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! for water content calculation - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg,electrolyte, & - activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam,log_gamZ, & - gam_ratio,Keq_ll,molality0,kappa_nonelectro) - - if(water_a(ibin) .eq. 0.0)then - write(tmp_str,*)'Water is zero in liquid phase' - call mosaic_warn_mess(trim(adjustl(tmp_str))) - write(tmp_str,*)'Stopping in ASTEM_flux_wet' - call mosaic_warn_mess(trim(adjustl(tmp_str))) - mosaic_vars_aa%zero_water_flag = .true. - endif - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do js = 1, nsalt - sum_dum = sum_dum + electrolyte(js,jsolid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - epercent(jcaco3,jsolid,ibin) = 100.*electrolyte(jcaco3,jsolid,ibin)/sum_dum - !! EFFI - - - - !----------------------------------------------------------------- - ! MIXED CASE 1: caco3 > 0 absorb all acids (and indirectly degas co2) - - if(epercent(jcaco3,jsolid,ibin) .gt. 0.0)then - jphase(ibin) = jliquid - call ASTEM_flux_wet_case1(ibin,ieqblm_ASTEM,sfc_a,df_gas_s,flux_s, & - phi_volatile_s,integrate,jphase,kg,gas,mc,Keq_ll) - return - endif - - !----------------------------------------------------------------- - ! MIXED CASE 2: Sulfate-Rich Domain - -! if(XT.lt.1.9999 .and. XT.ge.0.)then ! excess sulfate (acidic) ! RAZ 11/10/2014 - if(XT.lt.2.0 .and. XT.ge.0.)then ! excess sulfate (acidic) ! RAZ 11/10/2014 - jphase(ibin) = jliquid - call ASTEM_flux_wet_case2(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,gas,kel,mc,water_a,ma,gam,gam_ratio,Keq_ll, & - Keq_gl) - return - endif - - !------------------------------------------------------------------- - ! MIXED CASE 3: hno3 and hcl exchange may happen here and nh4cl may form/evaporate - - volatile_cl = electrolyte(jnacl,jsolid,ibin) + & - electrolyte(jcacl2,jsolid,ibin) - - - if(volatile_cl .gt. 0.0 .and. gas(ihno3_g).gt. 0.0 )then - - call ASTEM_flux_dry_case3a(ibin,ieqblm_ASTEM,idry_case3a,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas) - - prod_nh4cl = max( (gas(inh3_g)*gas(ihcl_g)-Keq_sg(2)), 0.0d0) + & - electrolyte(jnh4cl, jsolid,ibin) - - if(prod_nh4cl .gt. 0.0)then - call ASTEM_flux_dry_case3b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,aer,kg,gas,electrolyte,epercent, & - Keq_sg) - endif - - jphase(ibin) = jsolid - - return - endif - - !------------------------------------------------------------------- - ! MIXED CASE 4: nh4no3 or nh4cl or both may be active - - if( electrolyte(jnh4no3,jsolid,ibin).gt.0. .and. & - electrolyte(jnh4cl,jsolid,ibin) .gt.0. )then - jphase(ibin) = jsolid - call ASTEM_flux_dry_case4(ibin,phi_nh4no3_s,phi_nh4cl_s,ieqblm_ASTEM,sfc_a, & - df_gas_s,flux_s,phi_volatile_s,integrate,kg,gas,electrolyte,epercent, & - Keq_sg,aer) - - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - elseif(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - return - - elseif( electrolyte(jnh4no3,jsolid,ibin).gt.0. )then - ! do small adjustments for nh4cl aq - g_nh3_hcl= gas(inh3_g)*gas(ihcl_g) - a_nh4_cl = aer(inh4_a,jliquid,ibin)*aer(icl_a,jliquid,ibin) - - iadjust = mNO ! initialize - if(g_nh3_hcl .gt. 0.0 .and. a_nh4_cl .eq. 0.0)then - call absorb_tiny_nh4cl(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hcl_max,electrolyte_sum) - iadjust = mYES - elseif(g_nh3_hcl .eq. 0.0 .and. a_nh4_cl .gt. 0.0)then - call degas_tiny_nh4cl(ibin,aer,gas,electrolyte) - iadjust = mYES - endif - - if(iadjust .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a, & - na_Ma,nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a, & - aH2O,ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - call ASTEM_flux_mix_case4a(ibin,phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - df_gas_l,flux_s,Heff,phi_volatile_s,phi_volatile_l,integrate,jphase,kg,& - gas,electrolyte,epercent,kel,activity,mc,Keq_nh4cl,water_a, & - kelvin_nh4cl,ma,gam,gam_ratio,Kp_nh4cl,Keq_ll,Keq_gl,Keq_sg,aer) ! nh4no3 solid + nh4cl aq - jphase(ibin) = jtotal - return - - elseif( electrolyte(jnh4cl,jsolid,ibin).gt.0.)then - ! do small adjustments for nh4no3 aq - g_nh3_hno3= gas(inh3_g)*gas(ihno3_g) - a_nh4_no3 = aer(inh4_a,jliquid,ibin)*aer(ino3_a,jliquid,ibin) - - iadjust = mNO ! initialize - if(g_nh3_hno3 .gt. 0.0 .and. a_nh4_no3 .eq. 0.0)then - call absorb_tiny_nh4no3(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hno3_max,electrolyte_sum) - iadjust = mYES - elseif(g_nh3_hno3 .eq. 0.0 .and. a_nh4_no3 .gt. 0.0)then - call degas_tiny_nh4no3(ibin,aer,gas,electrolyte) - iadjust = mYES - endif - - if(iadjust .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a, & - na_Ma,nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a, & - aH2O,ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - kelvin_nh4no3 = kel(inh3_g,ibin)*kel(ihno3_g,ibin) - Keq_nh4no3 = kelvin_nh4no3*activity(jnh4no3,ibin)*Kp_nh4no3 ! = [NH3]s * [HNO3]s - - call ASTEM_flux_mix_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - df_gas_l,flux_s,Heff,phi_volatile_s,phi_volatile_l,integrate,jphase,kg,& - gas,electrolyte,epercent,kel,activity,mc,Keq_nh4no3,water_a, & - kelvin_nh4no3,ma,gam,gam_ratio,Keq_ll,Keq_gl,Kp_nh4no3,Keq_sg,aer) ! nh4cl solid + nh4no3 aq - jphase(ibin) = jtotal - return - endif - - - !------------------------------------------------------------------- - - if( (gas(inh3_g)+aer(inh4_a,jliquid,ibin)) .lt. 1.e-25)goto 10 ! no ammonia in the system - - !------------------------------------------------------------------- - ! MIXED CASE 5: liquid nh4no3 and/or nh4cl maybe active - ! do some small adjustments (if needed) before deciding case 3 - - iadjust = mNO ! default - iadjust_intermed = mNO ! default - - ! nh4no3 - g_nh3_hno3 = gas(inh3_g)*gas(ihno3_g) - a_nh4_no3 = aer(inh4_a,jliquid,ibin)*aer(ino3_a,jliquid,ibin) - - if(g_nh3_hno3 .gt. 0. .and. a_nh4_no3 .eq. 0.)then - call absorb_tiny_nh4no3(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hno3_max,electrolyte_sum) - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - iadjust_intermed = mNO ! reset - endif - - ! nh4cl - g_nh3_hcl = gas(inh3_g)*gas(ihcl_g) - a_nh4_cl = aer(inh4_a,jliquid,ibin)*aer(icl_a,jliquid,ibin) - - if(g_nh3_hcl .gt. 0. .and. a_nh4_cl .eq. 0.)then - call absorb_tiny_nh4cl(ibin,aer,gas,electrolyte,delta_nh3_max,delta_hcl_max,& - electrolyte_sum) - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - endif - - if(iadjust .eq. mYES)then - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg,electrolyte,& - activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam, & - log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - - ! all adjustments done... - - !-------- - kelvin_nh4no3 = kel(inh3_g,ibin)*kel(ihno3_g,ibin) - Keq_nh4no3 = kelvin_nh4no3*activity(jnh4no3,ibin)*Kp_nh4no3 ! = [NH3]s * [HNO3]s - - kelvin_nh4cl = kel(inh3_g,ibin)*kel(ihcl_g,ibin) - Keq_nh4cl = kelvin_nh4cl*activity(jnh4cl,ibin)*Kp_nh4cl ! = [NH3]s * [HCl]s - - call ASTEM_flux_wet_case3(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff,phi_volatile_l,& - integrate,kg,gas,kel,mc,Keq_nh4cl,Keq_nh4no3,water_a,ma,gam,gam_ratio, & - Keq_ll,Keq_gl,aer,total_species,tot_cl_in,activity,electrolyte) - jphase(ibin) = jliquid - - return - - - !------------------------------------------------------------------- - ! MIXED CASE 6: ammonia = 0. liquid hno3 and hcl exchange may happen here - ! do small adjustments (if needed) before deciding case 4 - -10 iadjust = mNO ! default - iadjust_intermed = mNO ! default - - ! hno3 - if(gas(ihno3_g).gt.0. .and. aer(ino3_a,jliquid,ibin).eq.0. .and. & - aer(icl_a,jliquid,ibin) .gt. 0.0)then - call absorb_tiny_hno3(ibin,aer,gas,delta_hno3_max) ! and degas tiny hcl - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - iadjust_intermed = mNO ! reset - endif - - ! hcl - if(gas(ihcl_g).gt.0. .and. aer(icl_a,jliquid,ibin) .eq. 0. .and. & - aer(ino3_a,jliquid,ibin) .gt. 0.0)then - call absorb_tiny_hcl(ibin,aer,gas,delta_hcl_max) ! and degas tiny hno3 - iadjust = mYES - iadjust_intermed = mYES - endif - - if(iadjust_intermed .eq. mYES)then - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,& - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) ! update after adjustments - endif - - if(iadjust .eq. mYES)then - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O, & - ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) ! update after adjustments - endif - - ! all adjustments done... - - call ASTEM_flux_wet_case4(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff,phi_volatile_l,& - integrate,kg,gas,kel,mc,water_a,ma,gam,Keq_ll,Keq_gl) - jphase(ibin) = jliquid - - return -end subroutine ASTEM_flux_mix - -!---------------------------------------------------------------------- - - - -!------------------------------------------------------------------ -! Mix Case 4a: NH4NO3 solid maybe active. NH4Cl aq maybe active - -subroutine ASTEM_flux_mix_case4a(ibin, phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - df_gas_l,flux_s,Heff,phi_volatile_s,phi_volatile_l,integrate,jphase,kg,gas, & - electrolyte,epercent,kel,activity,mc,Keq_nh4cl,water_a,kelvin_nh4cl,ma,gam, & - gam_ratio,Kp_nh4cl,Keq_ll,Keq_gl,Keq_sg,aer) ! TOUCH - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile,nelectrolyte, & - Ncation,mYES,jsolid,mNO,jliquid,jtotal,Nanion,nrxn_aer_gl,nrxn_aer_ll, & - nrxn_aer_sg,naer, & - rtol_eqb_ASTEM,ptol_mol_ASTEM, & - jnh4no3,ihno3_g,inh3_g,ihcl_g,jnh4cl,ja_no3,jhno3,jc_h,ja_cl,jhcl - - use module_mosaic_ext, only: degas_solid_nh4no3 - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: jphase - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout) :: Keq_nh4cl,kelvin_nh4cl,Kp_nh4cl - real(r8), intent(out) :: phi_nh4no3_s - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s,df_gas_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,Heff,kel - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) ::mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer iactive_nh4no3, iactive_nh4cl, js - real(r8) :: sum_dum - - - ! set default values for flags - iactive_nh4no3 = mYES - iactive_nh4cl = mYES - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do js = 1, nelectrolyte - sum_dum = sum_dum + electrolyte(js,jsolid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - epercent(jnh4no3,jsolid,ibin) = 100.*electrolyte(jnh4no3,jsolid,ibin)/sum_dum - !! EFFI - - - - ! nh4no3 (solid) - phi_nh4no3_s = (gas(inh3_g)*gas(ihno3_g) - Keq_sg(1))/ & - max(gas(inh3_g)*gas(ihno3_g),Keq_sg(1)) - - ! nh4cl (liquid) - kelvin_nh4cl = kel(inh3_g,ibin)*kel(ihcl_g,ibin) - Keq_nh4cl = kelvin_nh4cl*activity(jnh4cl,ibin)*Kp_nh4cl ! = [NH3]s * [HCl]s - - - !------------------- - ! now determine if nh4no3 and/or nh4cl are active or significant - ! nh4no3 solid - if( abs(phi_nh4no3_s) .le. rtol_eqb_ASTEM )then - iactive_nh4no3 = mNO - elseif(gas(inh3_g)*gas(ihno3_g) .lt. Keq_sg(1) .and. & - epercent(jnh4no3,jsolid,ibin) .le. ptol_mol_ASTEM)then - iactive_nh4no3 = mNO - if(epercent(jnh4no3,jsolid,ibin) .gt. 0.0)then - call degas_solid_nh4no3(ibin,aer,gas,electrolyte,Keq_sg) - endif - endif - - ! nh4cl aq - if( gas(inh3_g)*gas(ihcl_g).eq.0. .or. Keq_nh4cl.eq.0. )then - iactive_nh4cl = mNO - endif - - - !--------------------------------- - if(iactive_nh4no3 .eq. mYES)then - - jphase(ibin) = jsolid - call ASTEM_flux_dry_case4a(ibin,phi_nh4no3_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) ! NH4NO3 (solid) - - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - elseif(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - endif - - - if(iactive_nh4cl .eq. mYES)then - - jphase(ibin) = jliquid - call ASTEM_flux_wet_case3b(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,Keq_nh4cl,water_a,ma,gam, & - gam_ratio,Keq_ll,Keq_gl) ! NH4Cl (liquid) - - if(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - endif - - - if(iactive_nh4cl .eq. mYES .and. iactive_nh4no3 .eq. mYES)then - jphase(ibin) = jtotal - endif - - - - return -end subroutine ASTEM_flux_mix_case4a - - - -!------------------------------------------------------------------ -! Mix Case 4b: NH4Cl solid maybe active. NH4NO3 aq may or maybe active - -subroutine ASTEM_flux_mix_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - df_gas_l,flux_s,Heff,phi_volatile_s,phi_volatile_l,integrate,jphase,kg,gas, & - electrolyte,epercent,kel,activity,mc,Keq_nh4no3,water_a,kelvin_nh4no3,ma, & - gam,gam_ratio,Keq_ll,Keq_gl,Kp_nh4no3,Keq_sg,aer) ! TOUCH - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile,nelectrolyte, & - Ncation,mYES,nsalt,jsolid,mNO,jliquid,jtotal,Nanion,nrxn_aer_gl,naer, & - nrxn_aer_ll,nrxn_aer_sg, & - rtol_eqb_ASTEM,ptol_mol_ASTEM, & - jnh4cl,ihcl_g,inh3_g,ihno3_g,jnh4no3,ja_cl,jhcl,jc_h,ja_no3,jhno3 - - use module_mosaic_ext, only: degas_solid_nh4cl - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_ASTEM - integer, intent(inout), dimension(nbin_a_max) :: jphase - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout) :: Keq_nh4no3,kelvin_nh4no3,Kp_nh4no3 - real(r8), intent(out) :: phi_nh4cl_s - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: df_gas_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,Heff - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer iactive_nh4no3, iactive_nh4cl, js - real(r8) :: sum_dum - - - ! set default values for flags - iactive_nh4cl = mYES - iactive_nh4no3 = mYES - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do js = 1, nsalt - sum_dum = sum_dum + electrolyte(js,jsolid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - epercent(jnh4cl,jsolid,ibin) = 100.*electrolyte(jnh4cl,jsolid,ibin)/sum_dum - !! EFFI - - - ! nh4cl (solid) - phi_nh4cl_s = (gas(inh3_g)*gas(ihcl_g) - Keq_sg(2))/ & - max(gas(inh3_g)*gas(ihcl_g),Keq_sg(2)) - - ! nh4no3 (liquid) - kelvin_nh4no3 = kel(inh3_g,ibin)*kel(ihno3_g,ibin) - Keq_nh4no3 = kelvin_nh4no3*activity(jnh4no3,ibin)*Kp_nh4no3 ! = [NH3]s * [HNO3]s - - - !------------------- - ! now determine if nh4no3 and/or nh4cl are active or significant - ! nh4cl (solid) - if( abs(phi_nh4cl_s) .le. rtol_eqb_ASTEM )then - iactive_nh4cl = mNO - elseif(gas(inh3_g)*gas(ihcl_g) .lt. Keq_sg(2) .and. & - epercent(jnh4cl,jsolid,ibin) .le. ptol_mol_ASTEM)then - iactive_nh4cl = mNO - if(epercent(jnh4cl,jsolid,ibin) .gt. 0.0)then - call degas_solid_nh4cl(ibin,aer,gas,electrolyte,Keq_sg) - endif - endif - - ! nh4no3 (liquid) - if( gas(inh3_g)*gas(ihno3_g).eq.0. .or. Keq_nh4no3.eq.0. )then - iactive_nh4no3 = mNO - endif - - - !--------------------------------- - if(iactive_nh4cl .eq. mYES)then - - jphase(ibin) = jsolid - call ASTEM_flux_dry_case4b(ibin,phi_nh4cl_s,ieqblm_ASTEM,sfc_a,df_gas_s, & - flux_s,phi_volatile_s,integrate,kg,gas,Keq_sg) ! NH4Cl (solid) - - if(sfc_a(ihcl_g).gt.0.0 .and. ma(ja_cl,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(4)*sfc_a(ihcl_g)/ & - (kel(ihcl_g,ibin)*gam(jhcl,ibin)**2 * ma(ja_cl,ibin)) - elseif(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - endif - - - if(iactive_nh4no3 .eq. mYES)then - - jphase(ibin) = jliquid - call ASTEM_flux_wet_case3a(ibin,ieqblm_ASTEM,sfc_a,df_gas_l,Heff, & - phi_volatile_l,integrate,kg,gas,kel,mc,Keq_nh4no3,water_a,ma,gam, & - gam_ratio,Keq_ll,Keq_gl) ! NH4NO3 (liquid) - - if(sfc_a(ihno3_g).gt.0.0 .and. ma(ja_no3,ibin).gt.0.0)then - mc(jc_h,ibin) = Keq_gl(3)*sfc_a(ihno3_g)/ & - (kel(ihno3_g,ibin)*gam(jhno3,ibin)**2 * ma(ja_no3,ibin)) - else - mc(jc_h,ibin) = sqrt(Keq_ll(3)) - endif - - endif - - - if(iactive_nh4cl .eq. mYES .and. iactive_nh4no3 .eq. mYES)then - jphase(ibin) = jtotal - endif - - - - return -end subroutine ASTEM_flux_mix_case4b - - - -!*********************************************************************** -! part of ASTEM: condenses h2so4, msa, and nh3 analytically over dtchem [s] -! -! author: Rahul A. Zaveri -! update: jan 2007 -!----------------------------------------------------------------------- - -subroutine ASTEM_non_volatiles( dtchem, jaerosolstate, jphase, & - aer, kg, gas, gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, epercent, kel, activity, mc, delta_nh3_max, & - delta_hno3_max, delta_hcl_max, num_a, mass_wet_a, mass_dry_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, water_a_hyst, water_a_up, aH2O_a, total_species, & - tot_cl_in, & - aH2O, ma, gam, log_gamZ, zc, za, gam_ratio, & - xeq_a, na_Ma, nc_Mc, xeq_c, a_zsr, mw_electrolyte, partial_molar_vol, sigma_soln, & - T_K, RH_pc, mw_aer_mac, dens_aer_mac, sigma_water, Keq_ll, Keq_sl, MW_a, MW_c, & - growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, jsalt_index, & - jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) ! TOUCH - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, nelectrolyte, & - Ncation, naer, no_aerosol, jtotal, mNO, mYES, Nanion, nrxn_aer_ll, nrxn_aer_sl, & - nsalt, MDRH_T_NUM, jsulf_poor_NUM, jsulf_rich_NUM, & - nbin_a, & - ih2so4_g, imsa_g, inh3_g, ihno3_g, ihcl_g, iso4_a, imsa_a, jcaco3, jcano3, jnano3, & - jcacl2, jnacl, inh4_a, mosaic_vars_aa_type - - use module_mosaic_ext, only: aerosol_phase_state,conform_electrolytes - - - !Intent ins - integer, intent(in), dimension(nsalt) :: jsalt_index - integer, intent(in), dimension(jsulf_poor_NUM) :: jsulf_poor - integer, intent(in), dimension(jsulf_rich_NUM) :: jsulf_rich - - real(r8), intent(in) :: dtchem - real(r8), intent(in) :: aH2O,T_K,RH_pc,rtol_mesa - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(in), dimension(ngas_volatile) :: gas_netprod_otrproc - real(r8), intent(in), dimension(ngas_volatile) :: partial_molar_vol - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(in), dimension (6,nelectrolyte) :: a_zsr - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - !Intent-inouts - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(inout) :: sigma_water - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_soluble_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,delta_nh3_max - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hno3_max,delta_hcl_max - real(r8), intent(inout), dimension(nbin_a_max) :: water_a_hyst,water_a_up,aH2O_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_wet_a,mass_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: growth_factor,MDRH - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,gam_ratio,sigma_soln - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout), dimension(ngas_volatile) :: gas_avg ! average gas conc. over dtchem time step (nmol/m3) - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! gas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (nmol/m3/s) - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg,kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - - !Local variables - integer ibin,iupdate_phase_state - real(r8) :: decay_h2so4,decay_msa,delta_h2so4,delta_tmsa,delta_nh3,delta_hno3 - real(r8) :: delta_hcl,XT,sumkg_h2so4,sumkg_msa,sumkg_nh3,sumkg_hno3,sumkg_hcl - real(r8) :: tmp_kxt, tmp_kxt2, tmp_pok, tmp_pxt, tmp_q1, tmp_q3, tmp_q4 - real(r8), dimension(nbin_a) :: delta_so4,delta_msa,delta_nh4 - real(r8), dimension(nbin_a) :: new_so4a, old_so4a !BALLI for debugging only - - sumkg_h2so4 = 0.0 - sumkg_msa = 0.0 - sumkg_nh3 = 0.0 - sumkg_hno3 = 0.0 - sumkg_hcl = 0.0 - do ibin = 1, nbin_a - sumkg_h2so4 = sumkg_h2so4 + kg(ih2so4_g,ibin) - sumkg_msa = sumkg_msa + kg(imsa_g,ibin) - sumkg_nh3 = sumkg_nh3 + kg(inh3_g,ibin) - sumkg_hno3 = sumkg_hno3 + kg(ihno3_g,ibin) - sumkg_hcl = sumkg_hcl + kg(ihcl_g,ibin) - enddo - - - - !-------------------------------------- - ! H2SO4 - tmp_q1 = gas(ih2so4_g) - tmp_pxt = max( gas_netprod_otrproc(ih2so4_g)*dtchem, 0.0_r8 ) - tmp_kxt = sumkg_h2so4*dtchem - old_so4a(1:nbin_a) = aer(iso4_a,jtotal,1:nbin_a) ! added for debug REMOVE IT BALLI AFTER DEBUG - if ( (tmp_q1+tmp_pxt > 1.e-14_r8) .and. & - (tmp_kxt >= 1.0e-20_r8) ) then - -! ! integrate h2so4 condensation analytically -! decay_h2so4 = exp(-sumkg_h2so4*dtchem) -! delta_h2so4 = gas(ih2so4_g)*(1.0 - decay_h2so4) -! gas(ih2so4_g) = gas(ih2so4_g)*decay_h2so4 - - ! integrate h2so4 condensation + gas-phase production analytically - ! tmp_q1 = mix-rat at t=tcur - ! tmp_q3 = mix-rat at t=tcur+dtchem - ! tmp_q4 = avg mix-rat between t=tcur and t=tcur+dtchem - if (tmp_kxt > 0.001_r8) then - ! use analytical exponential expression - tmp_pok = tmp_pxt/tmp_kxt - tmp_q3 = (tmp_q1 - tmp_pok)*exp(-tmp_kxt) + tmp_pok - tmp_q4 = (tmp_q1 - tmp_pok)*(1.0_r8 - exp(-tmp_kxt))/tmp_kxt + tmp_pok - else - ! use taylors series expansion - tmp_kxt2 = tmp_kxt*tmp_kxt - tmp_q3 = tmp_q1 *(1.0_r8 - tmp_kxt + tmp_kxt2*0.5_r8) & - + tmp_pxt*(1.0_r8 - tmp_kxt*0.5_r8 + tmp_kxt2/6.0_r8) - tmp_q4 = tmp_q1 *(1.0_r8 - tmp_kxt*0.5_r8 + tmp_kxt2/6.0_r8) & - + tmp_pxt*(0.5_r8 - tmp_kxt/6.0_r8 + tmp_kxt2/24.0_r8) - end if - gas(ih2so4_g) = tmp_q3 - gas_avg(ih2so4_g) = tmp_q4 - delta_h2so4 = (tmp_q1 + tmp_pxt) - tmp_q3 ! this is the change due to condensation - - - ! now distribute delta_h2so4 to each bin and conform the particle (may degas by massbal) - do ibin = 1, nbin_a - if(jaerosolstate(ibin) .ne. no_aerosol)then - delta_so4(ibin) = delta_h2so4*kg(ih2so4_g,ibin)/sumkg_h2so4 - aer(iso4_a,jtotal,ibin) = aer(iso4_a,jtotal,ibin) + & - delta_so4(ibin) - endif - enddo - - else - ! h2so4 conc. (after production) is negligible OR - ! uptake by aerosols is negligible - ! in this case, update gas conc. (production) but do not bother to update aerosol conc. - gas(ih2so4_g) = tmp_q1 + tmp_pxt - gas_avg(ih2so4_g) = tmp_q1 + tmp_pxt*0.5_r8 - delta_h2so4 = 0.0 - do ibin = 1, nbin_a - delta_so4(ibin) = 0.0 - enddo - - endif -! debug output (Remove this BALLI after debugging) - new_so4a(1:nbin_a) = aer(iso4_a,jtotal,1:nbin_a) ! added for debug - ! h2so4 condensation is now complete - !-------------------------------------- - - - - ! MSA - if(gas(imsa_g) .gt. 1.e-14)then - - ! integrate msa condensation analytically - decay_msa = exp(-sumkg_msa*dtchem) - delta_tmsa = gas(imsa_g)*(1.0 - decay_msa) - gas(imsa_g) = gas(imsa_g)*decay_msa - - ! now distribute delta_msa to each bin and conform the particle (may degas by massbal) - do ibin = 1, nbin_a - if(jaerosolstate(ibin) .ne. no_aerosol)then - delta_msa(ibin) = delta_tmsa*kg(imsa_g,ibin)/sumkg_msa - aer(imsa_a,jtotal,ibin) = aer(imsa_a,jtotal,ibin) + & - delta_msa(ibin) - endif - enddo - - else - - delta_tmsa = 0.0 - do ibin = 1, nbin_a - delta_msa(ibin) = 0.0 - enddo - - endif - ! msa condensation is now complete - !------------------------------------- - - - - ! compute max allowable nh3, hno3, and hcl condensation - delta_nh3 = gas(inh3_g) *(1.0 - exp(-sumkg_nh3*dtchem)) - delta_hno3= gas(ihno3_g)*(1.0 - exp(-sumkg_hno3*dtchem)) - delta_hcl = gas(ihcl_g) *(1.0 - exp(-sumkg_hcl*dtchem)) - - ! compute max possible nh4 condensation for each bin - do ibin = 1, nbin_a - if(jaerosolstate(ibin) .ne. no_aerosol)then - delta_nh3_max(ibin) = delta_nh3*kg(inh3_g,ibin)/sumkg_nh3 - delta_hno3_max(ibin)= delta_hno3*kg(ihno3_g,ibin)/sumkg_hno3 - delta_hcl_max(ibin) = delta_hcl*kg(ihcl_g,ibin)/sumkg_hcl - endif - enddo - - - if(delta_h2so4 .eq. 0.0 .and. delta_tmsa .eq. 0.0)then - iupdate_phase_state = mNO - goto 100 - endif - - - ! now condense appropriate amounts of nh3 to each bin EFFI - do ibin = 1, nbin_a - - if(electrolyte(jnacl,jtotal,ibin) .eq. 0.0 .and. & - electrolyte(jcacl2,jtotal,ibin) .eq. 0.0 .and. & - electrolyte(jnano3,jtotal,ibin) .eq. 0.0 .and. & - electrolyte(jcano3,jtotal,ibin) .eq. 0.0 .and. & - electrolyte(jcaco3,jtotal,ibin) .eq. 0.0 .and. & - jaerosolstate(ibin) .ne. no_aerosol)then - - delta_nh4(ibin) = min( (2.*delta_so4(ibin)+delta_msa(ibin)), & - delta_nh3_max(ibin) ) - - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jtotal,ibin) + & ! update aer-phase - delta_nh4(ibin) - - gas(inh3_g) = gas(inh3_g) - delta_nh4(ibin) ! update gas-phase - - else - - delta_nh4(ibin) = 0.0 - - endif - - enddo - - iupdate_phase_state = mYES - - - ! recompute phase equilibrium -100 if(iupdate_phase_state .eq. mYES)then - do ibin = 1, nbin_a - if(jaerosolstate(ibin) .ne. no_aerosol)then - call conform_electrolytes(jtotal, ibin, XT, aer, gas, electrolyte, & - total_species, tot_cl_in) - call aerosol_phase_state( ibin, jaerosolstate, & - jphase, aer, jhyst_leg, electrolyte, epercent, kel, activity, mc, num_a, & - mass_wet_a, mass_dry_a, mass_soluble_a, vol_dry_a, vol_wet_a, water_a, & - water_a_hyst, water_a_up, aH2O_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, & - xeq_c, mw_electrolyte, partial_molar_vol, sigma_soln, T_K, & ! RAZ deleted a_zsr - RH_pc, mw_aer_mac, dens_aer_mac, sigma_water, Keq_ll, Keq_sl, MW_a, & - MW_c, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, & - jsalt_index, jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - endif - enddo - endif - - return -end subroutine ASTEM_non_volatiles - - - -!================================================================= -! SOA module - -!*********************************************************************** -! part of ASTEM: condenses secondary organic species over TSI time interval -! mechanism adapted from SORGAM -! -! author: Rahul A. Zaveri -! update: apr 2005 -!----------------------------------------------------------------------- -subroutine ASTEM_secondary_organics(dtchem, jaerosolstate,sfc_a,Heff, & - phi_volatile_l,integrate,aer,kg,gas,sat_soa,total_species) - - use module_data_mosaic_aero, only: nbin_a_max,ngas_volatile,naer,no_aerosol, & - jtotal,mYES, & - nbin_a, & - iaro1_g - - - ! subr arguments - integer, intent(in), dimension(nbin_a_max) :: jaerosolstate - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: dtchem - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas,sat_soa - real(r8), intent(inout), dimension(ngas_volatile) :: total_species - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: Heff,kg - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - ! local variables - integer ibin, iv, jp,ieqblm, nsteps_max,ieqblm_soa,isteps_SOA - parameter(nsteps_max = 400) - real(r8) :: dtmax, t_new, t_old, t_out - real(r8) :: sum1, sum2 - - - ! initialize time - t_old = 0.0 - t_out = dtchem - isteps_SOA = 0 - - - do iv = iaro1_g, ngas_volatile - total_species(iv) = gas(iv) - do ibin = 1, nbin_a - if (jaerosolstate(ibin) .eq. no_aerosol) cycle - total_species(iv) = total_species(iv) + aer(iv,jtotal,ibin) - enddo - enddo - - - - ! overall integration loop begins over dtchem seconds -10 isteps_SOA = isteps_SOA + 1 - - ! compute new fluxes - ieqblm_soa = mYES ! reset to default - - do 501 ibin = 1, nbin_a - if (jaerosolstate(ibin) .eq. no_aerosol) goto 501 - - call ASTEM_flux_soa(ibin,sfc_a,Heff,integrate,aer,gas,sat_soa,ieqblm_soa) - -501 continue - if(ieqblm_soa .eq. mYES)goto 30 ! all bins have reached equilibrium - - !----------------------- - - -! calculate maximum possible internal time-step -11 call ASTEM_dtmax_soa(dtchem, dtmax, phi_volatile_l,integrate,kg) - t_new = t_old + dtmax ! update time - if(t_new .gt. t_out)then ! check if the new time step is too large - dtmax = t_out - t_old - t_new = t_out*1.01 - endif - - - - - !------------------------------------------ - ! do internal time-step (dtmax) integration - - jp = jtotal - - do 20 iv = iaro1_g, ngas_volatile - - sum1 = 0.0 - sum2 = 0.0 - - do 21 ibin = 1, nbin_a - if(jaerosolstate(ibin) .eq. no_aerosol)goto 21 - - sum1 = sum1 + aer(iv,jp,ibin)/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)*integrate(iv,jp,ibin)) - sum2 = sum2 + kg(iv,ibin)*integrate(iv,jp,ibin)/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)*integrate(iv,jp,ibin)) - -21 continue - - ! first update gas concentration - gas(iv) = (total_species(iv) - sum1)/ & - (1. + dtmax*sum2) - - ! now update aer concentration in the jp phase - do 22 ibin = 1, nbin_a - if (jaerosolstate(ibin) .eq. no_aerosol) goto 22 - - if(integrate(iv,jp,ibin) .eq. mYES)then - aer(iv,jp,ibin) = & - (aer(iv,jp,ibin) + dtmax*kg(iv,ibin)*gas(iv))/ & - (1. + dtmax*kg(iv,ibin)*Heff(iv,ibin)) - endif - -22 continue - -20 continue - !------------------------------------------ - ! sub-step integration done - - - ! update jtotal - ! do iv = iaro1_g, ngas_volatile - ! aer(iv,jtotal,ibin)=aer(iv,jsolid,ibin)+aer(iv,jliquid,ibin) - ! enddo - - - ! update time - t_old = t_new - - if(t_new .lt. 0.9999*t_out) goto 10 - !================================================ - ! end of integration - -30 continue - - - return -end subroutine ASTEM_secondary_organics - - - -!*********************************************************************** -! part of ASTEM: computes fluxes of soa species -! -! author: Rahul A. Zaveri -! update: apr 2005 -!----------------------------------------------------------------------- -subroutine ASTEM_flux_soa(ibin,sfc_a,Heff,integrate,aer,gas,sat_soa,ieqblm_soa) ! TOUCH - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,naer,mNO,jtotal,& - rtol_eqb_ASTEM, & - ioc_a,iaro1_g - - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: ieqblm_soa - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(inout), dimension(ngas_volatile) :: sfc_a,gas,sat_soa - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: Heff - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - ! local variables - integer iv, jp - real(r8) :: dum, sum_dum, sum_soa, small_oc - real(r8), dimension(ngas_volatile,nbin_a_max) :: df_gas_o,flux_o,phi_volatile_o - - small_oc = 1.e-15 ! ng/m^3 - - - ! default fluxes and other stuff - do iv = iaro1_g, ngas_volatile - sfc_a(iv) = gas(iv) - df_gas_o(iv,ibin) = 0.0 - flux_o(iv,ibin) = 0.0 - phi_volatile_o(iv,ibin) = 0.0 - enddo - - - jp = jtotal - - ! compute mole fractions of soa species - sum_soa = 0.0 - do iv = iaro1_g, ngas_volatile - sum_soa = sum_soa + aer(iv,jp,ibin) - enddo - sum_soa = sum_soa + aer(ioc_a,jp,ibin)/200. ! 200 is assumed MW of primary OC - - - ! check threshold concentration for SOA formation in the absence of primary OC - if(aer(ioc_a,jp,ibin) .eq. 0.0)then - sum_dum = 0.0 - do iv = iaro1_g, ngas_volatile - sum_dum = sum_dum + (gas(iv)+aer(iv,jp,ibin))/sat_soa(iv) - enddo - - if(sum_dum .le. 1.0)then ! transfer all aer to gas and quit - do iv = iaro1_g, ngas_volatile - gas(iv) = gas(iv) + aer(iv,jp,ibin) - aer(iv,jp,ibin) = 0.0 - integrate(iv,jp,ibin) = 0.0 - enddo - return - endif - - sum_soa = max(sum_soa, 1.d-10) - - endif - - - - - ! compute Heff - do iv = iaro1_g, ngas_volatile - - Heff(iv,ibin) = sat_soa(iv)/sum_soa - sfc_a(iv) = aer(iv,jp,ibin)*Heff(iv,ibin) ! nmol/m^3 - df_gas_o(iv,ibin) = gas(iv) - sfc_a(iv) - - dum = max(sfc_a(iv),gas(iv)) - if(dum .gt. 0.0)then - phi_volatile_o(iv,ibin) = df_gas_o(iv,ibin)/dum - else - phi_volatile_o(iv,ibin) = 0.0 - endif - - ! check equilibrium - if(abs(phi_volatile_o(iv,ibin)) .le. rtol_eqb_ASTEM)then - integrate(iv,jp,ibin) = 0.0 - else - integrate(iv,jp,ibin) = 1.0 - ieqblm_soa = mNO - endif - - enddo - - - return -end subroutine ASTEM_flux_soa - - - -!*********************************************************************** -! part of ASTEM: computes fluxes of soa species -! -! author: Rahul A. Zaveri -! update: apr 2005 -!----------------------------------------------------------------------- -subroutine ASTEM_dtmax_soa(dtchem, dtmax, phi_volatile_l,integrate,kg) ! TOUCH - - use module_data_mosaic_aero, only: r8,ngas_volatile,nbin_a_max,jtotal,mYES, & - alpha_astem,nbin_a, & - iaro1_g - - - ! subr arguments - integer, intent(inout), dimension(ngas_volatile,3,nbin_a_max) :: integrate - - real(r8), intent(in) :: dtchem - real(r8), intent(out) :: dtmax - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l,kg - - ! local variables - character(len=500) :: tmp_str - integer ibin, iv, jp - real(r8) :: h_gas, h_gas_i(ngas_volatile), h_sub_max, & - sum_kg_phi - - - h_sub_max = dtchem/6. ! sec - - jp = jtotal - - ! GAS-SIDE - ! calculate h_gas_i and h_gas - - h_gas = 2.e16 - - do 6 iv = iaro1_g, ngas_volatile - - h_gas_i(iv) = 1.e16 - sum_kg_phi = 0.0 - - do ibin = 1, nbin_a - if(integrate(iv,jtotal,ibin) .eq. mYES)then - sum_kg_phi = sum_kg_phi + & - abs(phi_volatile_l(iv,ibin))*kg(iv,ibin) - endif - enddo - - if(sum_kg_phi .gt. 0.0)then - h_gas_i(iv) = alpha_astem/sum_kg_phi - h_gas = min(h_gas, h_gas_i(iv)) - endif - -6 continue - - - dtmax = min(h_gas, h_sub_max) - - - if(dtmax .le. 1.0e-10)then - write(tmp_str,*)' SOA dtmax = ', dtmax - call mosaic_warn_mess(trim(adjustl(tmp_str))) - endif - - - return -end subroutine ASTEM_dtmax_soa - - - -end module module_mosaic_astem diff --git a/MAMchem_GridComp/microphysics/module_mosaic_box_aerchem.F90 b/MAMchem_GridComp/microphysics/module_mosaic_box_aerchem.F90 deleted file mode 100644 index aad94972..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_box_aerchem.F90 +++ /dev/null @@ -1,1893 +0,0 @@ -module module_mosaic_box_aerchem - -use module_data_mosaic_kind, only: r8 - -implicit none - -contains - ! zz01aerchemistry.f (mosaic.25.0) - !******************************************************************************************** - ! code history - ! 6/3/2015 RAZ - bound temperature between 220 K and 330 K - ! 6/3/2015 RAZ - bound drh_mutual between 0% and 100% - ! 01-may-07 raz - updated CRH and hysteresis treatment for cano3 and cacl2 salts - ! 09-jan-07 raz - major clean up of variables and subroutines - ! 25-sep-06 raz - added kelvin effect treatment for condensing species - ! 22-sep-06 raz - changed "min" to "max" in ratio_AN and ratio_AC definitions - ! 21-jul-06 raz - revised and debugged kelvin effect algorithm - ! 17-jun-06 raz - added MSA chemistry in particle phase - ! 06-jan-05 raz - implemented revised ASTEM algorithm - ! 08-oct-05 raz - debugged - ! 21-sep-05 raz - revised adaptive time stepping scheme in MESA. - ! 28-apr-05 raz - reversed calls to form_cacl2 and form_nacl - ! fixed caco3 error in subr. electrolytes_to_ions - ! renamed dens_aer to dens_aer_mac; mw_aer to mw_aer_mac - ! 27-apr-05 raz - updated dry_mass calculation approach in MESA_convergence - ! 22-apr-05 raz - fixed CaSO4 mass balance problem and updated algorithm to - ! calculate phi_volatile for nh3, hno3, and hcl. - ! 20-apr-05 raz - updated ASCEEM - ! 19-apr-05 raz - updated the algorithm to constrain the nh4 concentration - ! during simultaneous nh3, hno3, and hcl integration such - ! that it does not exceed the max possible value for a given bin - ! 14-apr-05 raz - fixed ASTEM_flux_wet_case3 and ASTEM_flux_dry_case3c - ! 11-apr-05 raz - added SOA based on SORGAM mechanism - ! 11-jan-05 raz - major updates to many subroutines - ! 18-nov-04 rce - make sure that acos argument is between +/-1.0 - ! 28-jan-04 rce - added subr aerchem_boxtest_output; - ! eliminated some unnecessary "include v33com-" - ! 01-dec-03 rce - added "implicit none" to many routines; - ! eliminated some unnecessary "include v33com-" - ! 05-oct-03 raz - added hysteresis treatment - ! 02-sep-03 raz - implemented ASTEM - ! 10-jul-03 raz - changed ix to ixd in interp. subrs fast*_up and fast*_lo - ! 08-jul-03 raz - implemented ASTEM (adaptive step time-split - ! explicit euler method) - ! 26-jun-03 raz - updated almost all the subrs. this version contains - ! options for rigorous and fast solvers (including lsode solver) - ! - ! 07-oct-02 raz - made zx and zm integers in activity coeff subs. - ! 16-sep-02 raz - updated many subrs to treat calcium salts - ! 19-aug-02 raz - inlcude v33com9a in subr aerosolmtc - ! 14-aug-02 rce - "(msectional.eq.0)" changed to "(msectional.le.0)" - ! 07-aug-02 rce - this is rahul's latest version from freshair - ! AFTER adding "real mean_molecular_speed" wherever it is used - ! 01-apr-02 raz - made final tests and gave the code to jerome - ! - ! 04--14-dec-01 rce - several minor changes during initial testing/debug - ! in 3d los angeles simulation - ! (see earlier versions for details about these changes) - !----------------------------------------------------------------------- - !23456789012345678901234567890123456789012345678901234567890123456789012 - - !*********************************************************************** - ! MOSAIC (Model for Simulating Aerosol Interactions and Chemistry) - ! - ! author: Rahul A. Zaveri - ! update: dec 2004 - !----------------------------------------------------------------------- - - subroutine mosaic_box_aerchemistry( aH2O, T_K, &!Intent-ins - P_atm, RH_pc, dtchem, & - mcall_load_mosaic_parameters, mcall_print_aer_in, sigmag_a, & - kappa_nonelectro, & - jaerosolstate, aer, &!Intent-inouts - num_a, water_a, gas, & - gas_avg, gas_netprod_otrproc, Dp_dry_a, & - dp_wet_a, jhyst_leg, & - mosaic_vars_aa, & - mass_dry_a_bgn, mass_dry_a, &!Intent-outs - dens_dry_a_bgn, dens_dry_a, water_a_hyst, aH2O_a, & - uptkrate_h2so4, gam_ratio, jaerosolstate_bgn ) - - use module_data_mosaic_aero, only: & - nbin_a_max, ngas_volatile, naer, nsalt, &!Parameters - Nanion, Ncation, nrxn_aer_sl, nrxn_aer_ll, nrxn_aer_gl, nrxn_aer_sg, &!Parameters - MDRH_T_NUM, nelectrolyte, &!Parameters - jsalt_index, jsulf_poor, jsulf_rich, rtol_mesa, dens_aer_mac, & - mw_aer_mac, zc, MW_c, za, MW_a, mw_comp_a, dens_comp_a, b_zsr,aw_min, & - mw_electrolyte, partial_molar_vol, a_zsr, d_mdrh, b_mtem, ref_index_a, & - Nmax_mesa, nmax_ASTEM, mosaic_vars_aa_type - - implicit none - - !Intent-ins - integer, intent(in) :: mcall_load_mosaic_parameters, mcall_print_aer_in - - real(r8), intent(in) :: aH2O - real(r8), intent(in) :: T_K, P_atm, RH_pc - real(r8), intent(in) :: dtchem - - real(r8), intent(in), dimension(nbin_a_max) :: sigmag_a - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - !Intent-inouts - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate - integer, intent(inout), dimension(nbin_a_max) :: jhyst_leg - - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nbin_a_max) :: num_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(ngas_volatile) :: gas_avg ! average gas conc. over dtchem time step (nmol/m3) - real(r8), intent(in), dimension(ngas_volatile) :: gas_netprod_otrproc - ! gas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (nmol/m3/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently for mosaic, only the value for h2so4 can be non-zero - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_dry_a, dp_wet_a - - ! note - purpose of this data structure is to simplify passing new variables - ! into and out of the many mosaic routines - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - !Intent-outs - integer, intent(out), dimension(nbin_a_max) :: jaerosolstate_bgn - - real(r8), intent(out), dimension(nbin_a_max) :: mass_dry_a_bgn - real(r8), intent(out), dimension(nbin_a_max) :: mass_dry_a - real(r8), intent(out), dimension(nbin_a_max) :: dens_dry_a_bgn - real(r8), intent(out), dimension(nbin_a_max) :: dens_dry_a - real(r8), intent(out), dimension(nbin_a_max) :: water_a_hyst - real(r8), intent(out), dimension(nbin_a_max) :: aH2O_a - real(r8), intent(out), dimension(nbin_a_max) :: gam_ratio - real(r8), intent(out) :: uptkrate_h2so4 ! rate of h2so4 uptake by aerosols (1/s) - - !Local Variables - integer :: iprint_input, irepeat_mosaic - integer :: mcall_print_aer - integer, dimension(nbin_a_max) :: jphase - - integer :: iaer !BALLI- remove this after debugging - - real(r8) :: sigma_water,Kp_nh4cl - real(r8) :: Kp_nh4no3,Kp_nh3 - real(r8) :: tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, tot_ca_in - - real(r8), dimension(nbin_a_max) :: mass_soluble_a - real(r8), dimension(ngas_volatile) :: sat_soa,total_species - real(r8), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), dimension(ngas_volatile,nbin_a_max) :: flux_s,flux_l - real(r8), dimension(ngas_volatile,nbin_a_max) :: volatile_s - real(r8), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l,kg - real(r8), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), dimension(Ncation,nbin_a_max) :: mc - real(r8), dimension(Nanion,nbin_a_max) :: ma - real(r8), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - - call update_thermodynamic_constants( aH2O, T_K, & !intent-ins - sat_soa, aH2O_a, log_gamZ, Keq_sl, sigma_water, Kp_nh4cl, & !intent-outs - Kp_nh4no3, Kp_nh3, Keq_ll, Keq_gl, Keq_sg, MDRH_T, & - molality0 ) - -! rc_easter 2013-07-30 - -! the purpose of the irepeat loop was to provide more accurate cpu timings -! now that the cnn<-->gas,aer mapping is done earlier, you would have to -! save the gas,aer,num_a,... arrays then restore them for each repeat cycle - do irepeat_mosaic = 1, 1 - mcall_print_aer = mcall_print_aer_in - if (irepeat_mosaic > 1) mcall_print_aer = 0 - - call initialize_mosaic_variables( & !intent-ins - jaerosolstate, flux_s, flux_l, volatile_s, phi_volatile_s, phi_volatile_l, & !intent-outs - jphase, kg, electrolyte, activity, mc, mass_dry_a, mass_soluble_a, & - dens_dry_a, ma, gam, gam_ratio ) - - mosaic_vars_aa%isteps_astem = 0 - mosaic_vars_aa%isteps_astem_max = 0 - mosaic_vars_aa%jastem_call = 0 - mosaic_vars_aa%jmesa_call = 0 - mosaic_vars_aa%jmesa_fail = 0 - mosaic_vars_aa%niter_mesa_max = 0 - mosaic_vars_aa%nmax_astem = nmax_astem - mosaic_vars_aa%nmax_mesa = nmax_mesa - mosaic_vars_aa%cumul_steps_astem = 0.0_r8 - mosaic_vars_aa%niter_mesa = 0.0_r8 - uptkrate_h2so4 = 0.0_r8 - - call overall_massbal_in( aer, gas, gas_netprod_otrproc, dtchem, & !intent-ins - total_species, tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, & !intent-outs - tot_ca_in ) - - call MOSAIC_dynamic_solver( mcall_print_aer, dtchem, & !intent-ins - aH2O, T_K, RH_pc, P_atm, & - irepeat_mosaic, tot_cl_in, sigmag_a, kappa_nonelectro, & - jaerosolstate, flux_s, flux_l, volatile_s, & !intent-inouts - phi_volatile_s, phi_volatile_l, jphase, aer, & - kg, gas, gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, activity, & - mc, sat_soa, num_a, Dp_dry_a, Dp_wet_a,& - mass_dry_a, mass_soluble_a, dens_dry_a, water_a, & - gam, log_gamZ, gam_ratio, Keq_ll, Keq_gl, & - Keq_sg, Keq_sl, Kp_nh4cl, Kp_nh4no3, ma, & - sigma_water, MDRH_T, molality0, & - total_species, aH2O_a, uptkrate_h2so4, & - mosaic_vars_aa, & - iprint_input, & !intent-outs - mass_dry_a_bgn, dens_dry_a_bgn, & - water_a_hyst, jaerosolstate_bgn ) - - if (mosaic_vars_aa%f_mos_fail > 0) then - return - endif - - - call overall_massbal_out( iprint_input, 0, mosaic_vars_aa%isteps_ASTEM, aer, gas, & - tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, tot_ca_in ) - - enddo - - - - - return - end subroutine mosaic_box_aerchemistry - - - - !*********************************************************************** - ! interface to dynamic gas-particle exchange solver - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - - subroutine MOSAIC_dynamic_solver( mcall_print_aer, dtchem, & !intent-ins - aH2O, T_K, RH_pc, P_atm, & - irepeat_mosaic, tot_cl_in, sigmag_a, & - kappa_nonelectro, & - jaerosolstate, flux_s, flux_l, volatile_s, & !intent-inouts - phi_volatile_s, phi_volatile_l, jphase, aer, & - kg, gas, gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, activity, & - mc, sat_soa, num_a, Dp_dry_a, Dp_wet_a,& - mass_dry_a, mass_soluble_a, dens_dry_a, water_a, & - gam, log_gamZ, gam_ratio, Keq_ll, Keq_gl, & - Keq_sg, Keq_sl, Kp_nh4cl, Kp_nh4no3, ma, & - sigma_water, MDRH_T, molality0, & - total_species, aH2O_a, uptkrate_h2so4, & - mosaic_vars_aa, & - iprint_input, & !intent-outs - mass_dry_a_bgn, dens_dry_a_bgn, & - water_a_hyst, jaerosolstate_bgn ) - - use module_data_mosaic_aero, only: nbin_a_max, ngas_volatile, nelectrolyte, &!Parameters - Ncation, naer, no_aerosol, jtotal, mhyst_uporlo_waterhyst, jhyst_lo, &!Parameters - density_max_allow, density_min_allow, mSECTIONAL, mON, mASTEM, mLSODE, &!Parameters - mhyst_uporlo_jhyst, jhyst_up, Nanion, nrxn_aer_gl, nrxn_aer_ll, & - nrxn_aer_sg, nrxn_aer_sl, nsalt, MDRH_T_NUM, mhyst_force_lo, mhyst_force_up, & - nbin_a, mSIZE_FRAMEWORK, mGAS_AER_XFER, mDYNAMIC_SOLVER, mhyst_method, & - zc, za, a_zsr, mw_electrolyte, partial_molar_vol, dens_aer_mac, & - mw_aer_mac, dens_comp_a, mw_comp_a, ref_index_a, MW_a, MW_c, rtol_mesa, & - jsalt_index, jsulf_poor, jsulf_rich, & - iso4_a, & !balli for debug only remove it - mosaic_vars_aa_type - - use module_data_mosaic_asecthp, only: isize_of_ibin,itype_of_ibin,dcen_sect ! TBD - - use module_mosaic_astem, only: ASTEM - - use module_mosaic_ext, only: aerosol_water_up,calc_dry_n_wet_aerosol_props,& - conform_electrolytes -! use module_print_aer, only: print_aer - use module_mosaic_lsode, only: mosaic_lsode - - implicit none - - !Intent-ins - integer, intent(in) :: mcall_print_aer - integer, intent(in) :: irepeat_mosaic - - real(r8), intent(in) :: dtchem - real(r8), intent(in) :: aH2O, T_K, RH_pc, P_atm - - real(r8), intent(in), dimension(nbin_a_max) :: sigmag_a - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - !Intent-inouts - real(r8), intent(inout) :: Kp_nh4cl - real(r8), intent(inout) :: Kp_nh4no3,sigma_water - real(r8), intent(inout) :: tot_cl_in - - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - - integer, intent(inout), dimension(nbin_a_max) :: jhyst_leg - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase - - real(r8), intent(inout), dimension(nbin_a_max) :: num_a, Dp_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_wet_a, gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: aH2O_a - - real(r8), intent(inout), dimension(nbin_a_max) :: dens_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas,sat_soa - real(r8), intent(inout), dimension(ngas_volatile) :: total_species - real(r8), intent(inout), dimension(ngas_volatile) :: gas_avg ! average gas conc. over dtchem time step (nmol/m3) - real(r8), intent(in), dimension(ngas_volatile) :: gas_netprod_otrproc - ! gas_netprod_otrproc = gas net production rate from other processes - ! such as gas-phase chemistry and emissions (nmol/m3/s) - ! this allows the condensation (gasaerexch) routine to apply production and condensation loss - ! together, which is more accurate numerically - ! NOTE - must be >= zero, as numerical method can fail when it is negative - ! NOTE - currently for mosaic, only the value for h2so4 can be non-zero - - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: flux_s,flux_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout) :: uptkrate_h2so4 ! rate of h2so4 uptake by aerosols (1/s) - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - !Intent-outs - integer, intent(out) :: iprint_input - integer, intent(out), dimension(nbin_a_max) :: jaerosolstate_bgn - - real(r8), intent(out), dimension(nbin_a_max) :: water_a_hyst - real(r8), intent(out), dimension(nbin_a_max) :: mass_dry_a_bgn,dens_dry_a_bgn - - !Local variables - integer ibin, isize, itype, iv - - real(r8) :: XT - - - real(r8), dimension(nbin_a_max) :: area_dry_a,water_a_up - real(r8), dimension(nbin_a_max) :: area_wet_a,mass_wet_a,vol_wet_a,dens_wet_a - real(r8), dimension(nbin_a_max) :: vol_dry_a - real(r8), dimension(nbin_a_max) :: dp_core_a - - real(r8), dimension(nelectrolyte,3,nbin_a_max) :: epercent - - complex, dimension(nbin_a_max) :: ri_shell_a,ri_avg_a,ri_core_a - - - vol_dry_a = 0.0_r8!*BALLI- ASK dick, if we dont initialize it here the code blows up. In conform_aerosol_number, vol_dry_a do not get any value as num_a(ibin)>0.0 - - !BSINGH - Initialize counters - mosaic_vars_aa%jASTEM_fail = 0 - mosaic_vars_aa%jASTEM_call = 0 - mosaic_vars_aa%isteps_ASTEM = 0 - mosaic_vars_aa%isteps_ASTEM_max = 0 - mosaic_vars_aa%niter_MESA = 0.0_r8 - mosaic_vars_aa%cumul_steps_ASTEM = 0.0_r8 - - do ibin = 1, nbin_a - call check_aerosol_mass(ibin, jaerosolstate,jphase,aer,num_a, mass_dry_a) - jaerosolstate_bgn(ibin) = jaerosolstate(ibin) - - if(jaerosolstate(ibin) .ne. no_aerosol) then!goto 500 - - !call conform_aerosol_number(ibin,jaerosolstate,aer,num_a,vol_dry_a, Dp_dry_a) ! adjusts number conc so that it conforms with bin mass and diameter - - call conform_electrolytes(jtotal,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) ! conforms aer(jtotal) to a valid aerosol - call check_aerosol_mass(ibin,jaerosolstate,jphase,aer,num_a, mass_dry_a) ! check mass again after conform_electrolytes - - jaerosolstate_bgn(ibin) = jaerosolstate(ibin) - if(jaerosolstate(ibin) .ne. no_aerosol)then !goto 500 ! ignore this bin - - ! *** moved "call conform_aerosol_number" here instead of above by RAZ - call conform_aerosol_number(ibin,jaerosolstate,aer,num_a,vol_dry_a,Dp_dry_a) ! adjusts number conc so that it conforms with bin mass and diameter - - ! when mhyst_method = mhyst_uporlo_waterhyst, - ! initialize water_a_hyst at first time step using the user-input jhyst_leg - !BSINGH - 05/28/2013(RCE updates - if cond structure has been modified) - if (mosaic_vars_aa%it_mosaic == 1) then - if (mhyst_method == mhyst_uporlo_waterhyst) then - if(jhyst_leg(ibin) == jhyst_lo)then - water_a_hyst(ibin) = 0.0 - else - water_a_up(ibin) = aerosol_water_up(ibin,electrolyte,aer,kappa_nonelectro,a_zsr) ! at 60% RH - water_a_hyst(ibin) = water_a_up(ibin) - endif - else if (mhyst_method == mhyst_force_lo) then - jhyst_leg(ibin) = jhyst_lo - water_a_hyst(ibin) = 0.0 - else if (mhyst_method == mhyst_force_up) then - jhyst_leg(ibin) = jhyst_up - water_a_up(ibin) = aerosol_water_up(ibin,electrolyte,aer,kappa_nonelectro,a_zsr) ! at 60% RH - water_a_hyst(ibin) = water_a_up(ibin) - end if - end if - !BSINGH - 05/28/2013(RCE updates) - endif - endif - if (irepeat_mosaic == 1) then - mass_dry_a_bgn(ibin) = mass_dry_a(ibin) - if ( (jaerosolstate(ibin) .eq. no_aerosol) .or. & - (min(mass_dry_a(ibin),vol_dry_a(ibin)) .le. 1.0e-35) ) then - call calc_aerosol_dry_density( ibin,aer,dens_dry_a) - dens_dry_a_bgn(ibin) = dens_dry_a(ibin) - else - dens_dry_a_bgn(ibin) = mass_dry_a(ibin)/vol_dry_a(ibin) - end if - dens_dry_a_bgn(ibin) = max( density_min_allow, & - min( density_max_allow, dens_dry_a_bgn(ibin) ) ) - end if - - if (jaerosolstate(ibin) .eq. no_aerosol) then - if (msize_framework == msectional) then - isize = isize_of_ibin(ibin) - itype = itype_of_ibin(ibin) - Dp_dry_a(ibin) = dcen_sect(isize,itype) - Dp_wet_a(ibin) = Dp_dry_a(ibin) - end if - end if - - enddo - - !cc call save_pregrow_props !3D - !cc call specialoutaa( iclm_aer, jclm_aer, kclm_aer, 77, ! 3D - !cc & 'after_conform' ) - ! - !------------------------------------- - ! do dynamic gas-aerosol mass transfer for dtchem [s] - - if(mGAS_AER_XFER .eq. mON)then - ! call wall_loss(dtchem) - - if(mDYNAMIC_SOLVER .eq. mASTEM)then - call ASTEM( mcall_print_aer, dtchem, &!intent-ins - sigmag_a, aH2O, T_K, RH_pc, P_atm, & - kappa_nonelectro, & - jaerosolstate, flux_s, flux_l, volatile_s, iprint_input, &!intent -inout - phi_volatile_s,phi_volatile_l, jphase, aer, kg, gas, & - gas_avg, gas_netprod_otrproc, & - jhyst_leg, electrolyte, epercent, activity, mc, sat_soa, & - num_a, Dp_dry_a, Dp_wet_a, dp_core_a, mass_dry_a, & - mass_soluble_a,vol_dry_a, dens_dry_a, water_a, water_a_hyst, & - water_a_up, aH2O_a, total_species,tot_cl_in, ma, gam, & - log_gamZ, gam_ratio, Keq_ll, Keq_gl, Keq_sg, Kp_nh4cl,& - Kp_nh4no3, sigma_water, Keq_sl, MDRH_T, molality0, & - uptkrate_h2so4, mosaic_vars_aa, & - area_dry_a, area_wet_a, mass_wet_a,vol_wet_a, &!intent-out - dens_wet_a, ri_shell_a, ri_avg_a, ri_core_a ) - - if (mosaic_vars_aa%f_mos_fail > 0) then - return - endif - - !call ASTEM( mcall_print_aer, & - ! iprint_input,jASTEM_call,dtchem,jaerosolstate,isteps_ASTEM, & - ! iter_MESA,jMESA_call,flux_s,flux_l,volatile_s,phi_volatile_s, & - ! phi_volatile_l,jphase,aer,kg,gas,jhyst_leg,electrolyte,epercent, & - ! activity,mc,sat_soa,delta_nh3_max,delta_hno3_max,delta_hcl_max, & - ! jASTEM_fail,jMESA_fail,isteps_ASTEM_max,nmax_ASTEM,cumul_steps_ASTEM,num_a, & - ! Dp_dry_a,Dp_wet_a,dp_core_a,area_dry_a,area_wet_a,mass_wet_a, & - ! mass_dry_a,mass_soluble_a,vol_dry_a,vol_wet_a,dens_dry_a,dens_wet_a,& - ! sigmag_a,water_a,water_a_hyst,water_a_up,aH2O_a,total_species, & - ! tot_cl_in,aH2O, & - ! niter_MESA_max,niter_MESA,ma,gam,log_gamZ,zc,za,gam_ratio,xeq_a, & - ! na_Ma,nc_Mc,xeq_c,a_zsr,mw_electrolyte,partial_molar_vol,Keq_ll, & - ! Keq_gl,Keq_sg,Kp_nh4cl,Kp_nh4no3,Keq_nh4cl,sigma_soln,T_K,RH_pc, & - ! mw_aer_mac,dens_aer_mac,sigma_water,Keq_sl,MW_a,MW_c,ri_shell_a, & - ! dens_comp_a,mw_comp_a,ref_index_a,ri_avg_a,ri_core_a,P_atm, & - ! growth_factor,MDRH,MDRH_T,molality0,rtol_mesa,jsalt_present, & - ! jsalt_index,jsulf_poor,jsulf_rich,Nmax_mesa, phi_salt_old, & - ! zero_water_flag ) - elseif(mDYNAMIC_SOLVER .eq. mLSODE)then - - call MOSAIC_LSODE(dtchem) - - endif - - endif - - !------------------------------------- - - ! grows or shrinks size depending on mass increase or decrease - - do ibin = 1, nbin_a - if(jaerosolstate(ibin) .ne. no_aerosol)then - call conform_aerosol_size( ibin,jaerosolstate,aer,num_a, Dp_dry_a, & - vol_dry_a,mw_aer_mac,dens_aer_mac, mosaic_vars_aa ) ! BOX - if (mosaic_vars_aa%f_mos_fail > 0) then - return - endif - endif - enddo - - - do ibin = 1, nbin_a - if(jaerosolstate(ibin).ne.no_aerosol) then - - if (mhyst_method == mhyst_uporlo_jhyst) then - if(jhyst_leg(ibin) == jhyst_lo)then - water_a_hyst(ibin) = 0.0 - else - water_a_up(ibin) = aerosol_water_up(ibin,electrolyte,aer,kappa_nonelectro,a_zsr) ! at 60% RH - water_a_hyst(ibin) = water_a_up(ibin) - endif - elseif (mhyst_method == mhyst_uporlo_waterhyst) then - water_a_up(ibin) = aerosol_water_up(ibin,electrolyte,aer,kappa_nonelectro,a_zsr) ! at 60% RH - if (water_a_hyst(ibin) <= 0.5*water_a_up(ibin)) then - jhyst_leg(ibin) = jhyst_lo - water_a_hyst(ibin) = 0.0 - else - jhyst_leg(ibin) = jhyst_up - water_a_hyst(ibin) = water_a_up(ibin) - endif - !BSINGH - 05/28/2013(RCE updates) - else if (mhyst_method == mhyst_force_lo) then - jhyst_leg(ibin) = jhyst_lo - water_a_hyst(ibin) = 0.0 - else if (mhyst_method == mhyst_force_up) then - jhyst_leg(ibin) = jhyst_up - water_a_hyst(ibin) = water_a_up(ibin) - !BSINGH - 05/28/2013(RCE updates ENDS) - else - write(*,*) '*** MOSAIC_dynamic_solver - bad mhyst_method =', mhyst_method!BSINGH - 05/28/2013(RCE updates) - stop - endif - - ! compute final mass and density - call calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - - endif - if ( (jaerosolstate(ibin) .eq. no_aerosol) .or. & - (min(mass_dry_a(ibin),vol_dry_a(ibin)) .le. 1.0e-35) ) then - call calc_aerosol_dry_density( ibin,aer,dens_dry_a) - end if - dens_dry_a(ibin) = max( density_min_allow, & - min( density_max_allow, dens_dry_a(ibin) ) ) - - enddo - - if (mcall_print_aer == 1 .or. mcall_print_aer == 2) then - !call print_aer(1,jaerosolstate,isteps_ASTEM,iter_MESA,aer,gas,electrolyte, & - ! mc,num_a,Dp_dry_a,Dp_wet_a,area_dry_a,area_wet_a,mass_wet_a,mass_dry_a,& - ! water_a) - end if - - return - end subroutine MOSAIC_dynamic_solver - - - - !*********************************************************************** - ! applies first-order wall loss to number and mass - ! - ! author: Rahul A. Zaveri - ! update: jun 2003 - !----------------------------------------------------------------------- - subroutine wall_loss(dtchem,aer,num_a) - use module_data_mosaic_aero, only: nbin_a_max,naer,jtotal,jsolid,jliquid, & !Parameters - nbin_a !Input - - implicit none - ! subr arguments - real(r8), intent(in) :: dtchem - real(r8), intent(inout), dimension(nbin_a_max) :: num_a - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - ! local variables - integer :: iaer, ibin - real(r8) :: kwall - - - kwall = 5.55e-5 ! 1/s - - do ibin = 1, nbin_a - - do iaer = 1, naer - aer(iaer,jtotal,ibin) = aer(iaer,jtotal,ibin)*exp(-kwall*dtchem) - aer(iaer,jsolid,ibin) = aer(iaer,jsolid,ibin)*exp(-kwall*dtchem) - aer(iaer,jliquid,ibin) = aer(iaer,jliquid,ibin)*exp(-kwall*dtchem) - enddo - - num_a(ibin) = num_a(ibin)*exp(-kwall*dtchem) - - enddo - - - return - end subroutine wall_loss - - - - !*********************************************************************** - ! intializes all the MOSAIC variables to zero or their default values. - ! - ! author: Rahul A. Zaveri - ! update: jun 2003 - !----------------------------------------------------------------------- - subroutine initialize_mosaic_variables( & !intent-ins - jaerosolstate, flux_s, flux_l, volatile_s, phi_volatile_s, phi_volatile_l, & !intent-inouts - jphase, kg, electrolyte, activity, mc, mass_dry_a, mass_soluble_a, & - dens_dry_a, ma, gam, gam_ratio ) - - use module_data_mosaic_aero, only: nbin_a_max,naer,ngas_volatile, &!Parameters - nelectrolyte,Ncation,ngas_ioa,jtotal,jsolid,jliquid,nanion, &!Parameters - nbin_a !Input - - - implicit none - - !Subroutine Arguments - integer, intent(out), dimension(nbin_a_max) :: jaerosolstate,jphase - - real(r8), intent(out), dimension(nbin_a_max) :: mass_dry_a,gam_ratio - real(r8), intent(out), dimension(nbin_a_max) :: mass_soluble_a,dens_dry_a - - real(r8), intent(out), dimension(ngas_volatile,nbin_a_max) :: flux_s,kg - real(r8), intent(out), dimension(ngas_volatile,nbin_a_max) :: flux_l - real(r8), intent(out), dimension(ngas_volatile,nbin_a_max) :: volatile_s - real(r8), intent(out), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_s - real(r8), intent(out), dimension(ngas_volatile,nbin_a_max) :: phi_volatile_l - real(r8), intent(out), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(out), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(out), dimension(Nanion,nbin_a_max) :: ma - - real(r8), intent(out), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - ! local variables - integer iaer, ibin, iv, ja, jc, je - - phi_volatile_l(:,:) = 0.0_r8 !BALLI** Ask dick about this initialization - - ! initialize to zero - do ibin = 1, nbin_a - - mass_dry_a(ibin) = 0.0 - mass_soluble_a(ibin) = 0.0 - dens_dry_a(ibin) =-1.0 - - do je = 1, nelectrolyte - electrolyte(je,jtotal,ibin) = 0.0 - electrolyte(je,jsolid,ibin) = 0.0 - electrolyte(je,jliquid,ibin) = 0.0 - activity(je,ibin) = 0.0 - gam(je,ibin) = 0.0 - enddo - - gam_ratio(ibin) = 0.0 - - do iv = 1, ngas_ioa - flux_s(iv,ibin) = 0.0 - flux_l(iv,ibin) = 0.0 - kg(iv,ibin) = 0.0 - phi_volatile_s(iv,ibin) = 0.0 - phi_volatile_l(iv,ibin) = 0.0 - volatile_s(iv,ibin) = 0.0 - enddo - - - jaerosolstate(ibin) = -1 ! initialize to default value - jphase(ibin) = 0 - - do jc = 1, ncation - mc(jc,ibin) = 0.0 - enddo - - do ja = 1, nanion - ma(ja,ibin) = 0.0 - enddo - - enddo ! ibin - - - - return - end subroutine initialize_mosaic_variables - - - - subroutine overall_massbal_in( aer, gas, gas_netprod_otrproc, dtchem, & !intent-ins - total_species, tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, & !intent-outs - tot_ca_in ) - - - use module_data_mosaic_aero, only: ngas_volatile,naer,nbin_a_max,jtotal, &!Parameters - nbin_a, &!Input - ih2so4_g,ihno3_g,ihcl_g,inh3_g,iso4_a,ino3_a,icl_a,inh4_a,ina_a,ica_a !TBD - - implicit none - - !Subroutine Arguments - real(r8), intent(in), dimension(ngas_volatile) :: gas, gas_netprod_otrproc - real(r8), intent(in), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(in) :: dtchem - - real(r8), intent(out) :: tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, tot_ca_in - real(r8), intent(out), dimension(ngas_volatile) ::total_species - - - !local Variables - integer ibin - - tot_so4_in = gas(ih2so4_g) - tot_no3_in = gas(ihno3_g) - tot_cl_in = gas(ihcl_g) - tot_nh4_in = gas(inh3_g) - tot_na_in = 0.0 - tot_ca_in = 0.0 - - tot_so4_in = gas(ih2so4_g) + max( gas_netprod_otrproc(ih2so4_g)*dtchem, 0.0_r8 ) - - - do ibin = 1, nbin_a - tot_so4_in = tot_so4_in + aer(iso4_a,jtotal,ibin) - tot_no3_in = tot_no3_in + aer(ino3_a,jtotal,ibin) - tot_cl_in = tot_cl_in + aer(icl_a, jtotal,ibin) - tot_nh4_in = tot_nh4_in + aer(inh4_a,jtotal,ibin) - tot_na_in = tot_na_in + aer(ina_a,jtotal,ibin) - tot_ca_in = tot_ca_in + aer(ica_a,jtotal,ibin) - enddo - - - total_species(inh3_g) = tot_nh4_in - total_species(ihno3_g)= tot_no3_in - total_species(ihcl_g) = tot_cl_in - - - return - end subroutine overall_massbal_in - - - - subroutine overall_massbal_out( iprint_input, mbin, isteps_ASTEM, aer, gas, & - tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, tot_ca_in ) - ! include 'v33com' - ! include 'v33com3' - ! include 'v33com9a' - ! include 'v33com9b' - use module_data_mosaic_aero, only: ngas_volatile,naer,nbin_a_max,jtotal, &!Parameters - mYES,mNO, &!Parameters - nbin_a, &!Input - ih2so4_g,ihno3_g,ihcl_g,inh3_g,iso4_a,ino3_a,icl_a,inh4_a,ina_a,ica_a !TBD - - implicit none - - ! subr. agrument - - integer, intent(in) :: mbin, isteps_ASTEM - integer, intent(inout) :: iprint_input - - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout) :: tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, tot_na_in, tot_ca_in - - ! local variables - integer ibin - real(r8) :: tot_so4_out, tot_no3_out, tot_cl_out, tot_nh4_out, tot_na_out, tot_ca_out - real(r8) :: diff_so4, diff_no3, diff_cl, diff_nh4, diff_na, diff_ca - real(r8) :: reldiff_so4, reldiff_no3, reldiff_cl, reldiff_nh4, reldiff_na, reldiff_ca - - - - tot_so4_out = gas(ih2so4_g) - tot_no3_out = gas(ihno3_g) - tot_cl_out = gas(ihcl_g) - tot_nh4_out = gas(inh3_g) - tot_na_out = 0.0 - tot_ca_out = 0.0 - - do ibin = 1, nbin_a - tot_so4_out = tot_so4_out + aer(iso4_a,jtotal,ibin) - tot_no3_out = tot_no3_out + aer(ino3_a,jtotal,ibin) - tot_cl_out = tot_cl_out + aer(icl_a,jtotal,ibin) - tot_nh4_out = tot_nh4_out + aer(inh4_a,jtotal,ibin) - tot_na_out = tot_na_out + aer(ina_a,jtotal,ibin) - tot_ca_out = tot_ca_out + aer(ica_a,jtotal,ibin) - enddo - - diff_so4 = tot_so4_out - tot_so4_in - diff_no3 = tot_no3_out - tot_no3_in - diff_cl = tot_cl_out - tot_cl_in - diff_nh4 = tot_nh4_out - tot_nh4_in - diff_na = tot_na_out - tot_na_in - diff_ca = tot_ca_out - tot_ca_in - - - reldiff_so4 = 0.0 - if(tot_so4_in .gt. 1.e-25 .or. tot_so4_out .gt. 1.e-25)then - reldiff_so4 = diff_so4/max(tot_so4_in, tot_so4_out) - endif - - reldiff_no3 = 0.0 - if(tot_no3_in .gt. 1.e-25 .or. tot_no3_out .gt. 1.e-25)then - reldiff_no3 = diff_no3/max(tot_no3_in, tot_no3_out) - endif - - reldiff_cl = 0.0 - if(tot_cl_in .gt. 1.e-25 .or. tot_cl_out .gt. 1.e-25)then - reldiff_cl = diff_cl/max(tot_cl_in, tot_cl_out) - endif - - reldiff_nh4 = 0.0 - if(tot_nh4_in .gt. 1.e-25 .or. tot_nh4_out .gt. 1.e-25)then - reldiff_nh4 = diff_nh4/max(tot_nh4_in, tot_nh4_out) - endif - - reldiff_na = 0.0 - if(tot_na_in .gt. 1.e-25 .or. tot_na_out .gt. 1.e-25)then - reldiff_na = diff_na/max(tot_na_in, tot_na_out) - endif - - reldiff_ca = 0.0 - if(tot_ca_in .gt. 1.e-25 .or. tot_ca_out .gt. 1.e-25)then - reldiff_ca = diff_ca/max(tot_ca_in, tot_ca_out) - endif - - if( abs(reldiff_so4) .gt. 1.e-4 .or. & - abs(reldiff_no3) .gt. 1.e-4 .or. & - abs(reldiff_cl) .gt. 1.e-4 .or. & - abs(reldiff_nh4) .gt. 1.e-4 .or. & - abs(reldiff_na) .gt. 1.e-4 .or. & - abs(reldiff_ca) .gt. 1.e-4)then - - - if(iprint_input .eq. mYES)then - write(6,*)'*** mbin = ', mbin, ' isteps = ', isteps_ASTEM - write(6,*)'reldiff_so4 = ', reldiff_so4 - write(6,*)'reldiff_no3 = ', reldiff_no3 - write(6,*)'reldiff_cl = ', reldiff_cl - write(6,*)'reldiff_nh4 = ', reldiff_nh4 - write(6,*)'reldiff_na = ', reldiff_na - write(6,*)'reldiff_ca = ', reldiff_ca - ! call print_input - iprint_input = mNO - endif - - ! stop - - endif - - - return - end subroutine overall_massbal_out - - - - !*********************************************************************** - ! checks if aerosol mass is too low to be of any significance - ! and determine jaerosolstate - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine check_aerosol_mass(ibin, jaerosolstate,jphase,aer,num_a, mass_dry_a ) - - use module_data_mosaic_aero, only: nbin_a_max,naer,jtotal,no_aerosol, &!Parameters - mass_cutoff, mw_aer_mac, &!Parameters - iso4_a,ino3_a,icl_a,imsa_a,ico3_a,ica_a,ina_a,inh4_a !TBD - - implicit none - - !Intent-ins - integer, intent(in) :: ibin - real(r8), intent(in), dimension(naer,3,nbin_a_max) :: aer - - !Intent-inouts - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase - real(r8), intent(inout), dimension(nbin_a_max) :: num_a, mass_dry_a - - !Local variables - integer iaer - real(r8) :: drymass, aer_H - - mass_dry_a(ibin) = 0.0 - - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - - do iaer = 1, naer - mass_dry_a(ibin) = mass_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer) ! ng/m^3(air) - enddo - mass_dry_a(ibin) = mass_dry_a(ibin) + aer_H - - drymass = mass_dry_a(ibin) ! ng/m^3(air) - mass_dry_a(ibin) = mass_dry_a(ibin)*1.e-15 ! g/cc(air) - - if(drymass .lt. mass_cutoff)then ! bin mass is too small - jaerosolstate(ibin) = no_aerosol - jphase(ibin) = 0 - if(drymass .eq. 0.)num_a(ibin) = 0.0 - endif - - return - end subroutine check_aerosol_mass - - - - !*********************************************************************** - ! checks and conforms number according to the mass and bin size range - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine conform_aerosol_number(ibin,jaerosolstate,aer,num_a,vol_dry_a, Dp_dry_a) - - use module_data_mosaic_constants, only: pi - use module_data_mosaic_aero, only: nbin_a_max,naer,mSECTIONAL,no_aerosol, &!Parameters - jtotal, mw_aer_mac,dens_aer_mac, &!Parameters - msize_framework, &!Input - iso4_a,ino3_a,icl_a,imsa_a,ico3_a,ica_a,ina_a,inh4_a !TBD - - use module_data_mosaic_asecthp, only:isize_of_ibin,itype_of_ibin,volumlo_sect,&!TBD - volumhi_sect !TBD - - implicit none - - !Intent-ins - integer, intent(in) :: ibin - integer, intent(in), dimension(nbin_a_max) :: jaerosolstate - - real(r8), intent(in), dimension(nbin_a_max) :: Dp_dry_a - real(r8), intent(in), dimension(naer,3,nbin_a_max) :: aer - - !intent-inout - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,vol_dry_a - - - !Local variables - integer :: iaer, isize, itype - real(r8) :: num_at_dlo, num_at_dhi, numold - real(r8) :: aer_H - logical, parameter :: nonsect_set_number_always = .false. - - ! when msize_framework = munstructured or mmodal, - ! calculate number from volume concentration and mean dry diameter - ! only when num_a(ibin) <= 0.0 - ! this should only happen at the very start of the simulation - ! when msize_framework = msectional, - ! check that mean dry diameter falls within the section/bin limits, - ! and adjust number is this is not true - if (msize_framework /= msectional) then - if (num_a(ibin) > 0.0) return - end if - - vol_dry_a(ibin) = 0.0 ! initialize to 0.0 - - if(jaerosolstate(ibin) .eq. no_aerosol) return - - - ! calculate dry volume concentration - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - - do iaer = 1, naer - vol_dry_a(ibin) = vol_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer)/dens_aer_mac(iaer) ! ncc/m^3(air) - enddo - vol_dry_a(ibin) = vol_dry_a(ibin) + aer_H - vol_dry_a(ibin) = vol_dry_a(ibin)*1.e-15 ! cc(aer)/cc(air) - - - if (msize_framework /= msectional) then - ! unstructured or modal - set (initialize) number only when incoming value is zero - if (num_a(ibin) <= 0.0) then - num_a(ibin) = vol_dry_a(ibin)/((pi/6.0_r8)*Dp_dry_a(ibin)**3) ! #/cc(air) - end if - else - ! sectional - if (num_a(ibin) <= 0.0) then - ! in this case, num_a has probably not yet been initialized, so do it - num_a(ibin) = vol_dry_a(ibin)/((pi/6.0_r8)*Dp_dry_a(ibin)**3) ! #/cc(air) - else - ! in this case, check that bin mean size is within bounds - isize = isize_of_ibin( ibin ) - itype = itype_of_ibin( ibin ) - num_at_dlo = vol_dry_a(ibin)/volumlo_sect(isize,itype) - num_at_dhi = vol_dry_a(ibin)/volumhi_sect(isize,itype) - numold = num_a(ibin) - num_a(ibin) = min( num_a(ibin), num_at_dlo ) - num_a(ibin) = max( num_a(ibin), num_at_dhi ) - end if - end if - - - return - end subroutine conform_aerosol_number - - - - !*********************************************************************** - ! calculates dry density - ! - ! author: Rahul A. Zaveri - ! update: apr 2010 - !----------------------------------------------------------------------- - subroutine calc_aerosol_dry_density(ibin,aer,dens_dry_a) - ! include 'v33com9a' - - use module_data_mosaic_aero, only: nbin_a_max,naer,jtotal, &!Parameters - inh4_a,ina_a,ica_a,ico3_a,imsa_a,icl_a,ino3_a,iso4_a, & !TBD - mw_aer_mac, dens_aer_mac - - !use module_data_mosaic_asecthp, only: !BSINGH - not needed - - implicit none - - !Intent-in - integer, intent(in) :: ibin - real(r8), intent(in), dimension(naer,3,nbin_a_max) :: aer - - !Intent-inout - real(r8), intent(inout), dimension(nbin_a_max) :: dens_dry_a - - ! local variables - integer :: iaer - real(r8) :: aer_H - real(r8) :: tmpa, tmp_volu, tmp_mass - - - ! calculate dry volume concentration - aer_H = ( 2.*max( 0.0_r8, aer(iso4_a,jtotal,ibin) ) + & - max( 0.0_r8, aer(ino3_a,jtotal,ibin) ) + & - max( 0.0_r8, aer(icl_a,jtotal,ibin) ) + & - max( 0.0_r8, aer(imsa_a,jtotal,ibin) ) + & - 2.*max( 0.0_r8, aer(ico3_a,jtotal,ibin) ) ) & - - ( 2.*max( 0.0_r8, aer(ica_a,jtotal,ibin) ) + & - max( 0.0_r8, aer(ina_a,jtotal,ibin) ) + & - max( 0.0_r8, aer(inh4_a,jtotal,ibin) ) ) - aer_H = max( aer_H, 0.0_r8 ) - - tmp_mass = aer_H - tmp_volu = aer_H ! assume density=1.0 for H+ - - do iaer = 1, naer - tmpa = max( 0.0_r8, aer(iaer,jtotal,ibin) ) * mw_aer_mac(iaer) - tmp_mass = tmp_mass + tmpa ! ng/m^3(air) - tmp_volu = tmp_volu + tmpa/dens_aer_mac(iaer) ! ncc/m^3(air) - enddo - - ! the 1.0e-20 ng/m3 cutoff here is equivalent to the - ! 1.0e-35 g/cm3 cutoff used in mosaic_dynamic_solver - if (min(tmp_mass,tmp_volu) >= 1.0e-20) then - dens_dry_a(ibin) = tmp_mass/tmp_volu ! g/cc - else - dens_dry_a(ibin) = 1.0 - end if - - return - end subroutine calc_aerosol_dry_density - - - - !*********************************************************************** - ! updates/conforms size (diameter) according to the mass and number - ! - ! author: Rahul A. Zaveri - ! update: oct 2005 - !----------------------------------------------------------------------- - subroutine conform_aerosol_size( ibin, jaerosolstate, aer, num_a, Dp_dry_a, & - vol_dry_a, mw_aer_mac, dens_aer_mac, mosaic_vars_aa ) ! TOUCH - - ! include 'v33com9a' - use module_data_mosaic_constants, only : piover6, third - use module_data_mosaic_aero, only : nbin_a_max, naer, no_aerosol, jtotal, &!Parameters - inh4_a, ina_a, ica_a, ico3_a, imsa_a, icl_a, ino3_a, iso4_a, & - mosaic_vars_aa_type !TBD - - implicit none - - ! subr arguments - integer, intent(in):: ibin - integer, intent(in), dimension(nbin_a_max) :: jaerosolstate - - real(r8), intent(in), dimension(nbin_a_max) :: num_a - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_dry_a,vol_dry_a - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer iaer - real(r8) :: num_at_dlo, num_at_dhi - real(r8) :: aer_H - - - vol_dry_a(ibin) = 0.0 ! initialize to 0.0 - - if(jaerosolstate(ibin) .eq. no_aerosol) return - - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - do iaer = 1, naer - vol_dry_a(ibin) = vol_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer)/dens_aer_mac(iaer) ! ng/m^3(air) - enddo - vol_dry_a(ibin) = vol_dry_a(ibin) + aer_H - vol_dry_a(ibin) = vol_dry_a(ibin)*1.e-15 ! cc(aer)/cc(air) - - - ! update size - ! - ! Box-model only - - mosaic_vars_aa%f_mos_fail = -1 - if(vol_dry_a(ibin)<0.0_r8) then - write(202,*)'EXITING due to negative vol_dry_a(',ibin,')=', & - vol_dry_a(ibin), mosaic_vars_aa%it_mosaic, mosaic_vars_aa%hostgridinfo(1:3) - mosaic_vars_aa%f_mos_fail = 1 - return - endif - Dp_dry_a(ibin) = (vol_dry_a(ibin)/(piover6*num_a(ibin)))**third - - return - end subroutine conform_aerosol_size - - - - !*********************************************************************** - ! computes MTEM ternary parameters only once per transport time-step - ! for a given aH2O (= RH) - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - ! reference: Zaveri, R.A., R.C. Easter, and A.S. Wexler, - ! A new method for multicomponent activity coefficients of electrolytes - ! in aqueous atmospheric aerosols, J. Geophys. Res., 2005. - !----------------------------------------------------------------------- - subroutine MTEM_compute_log_gamZ(aH2O,log_gamZ,b_mtem,aw_min) - use module_data_mosaic_aero, only: nelectrolyte, &!Parameters - jhno3,jnh4so4,jnh4no3,jnh4cl,jna2so4,jnano3,jnacl,jcano3,jcacl2,jhcl, & - jh2so4,jnh4hso4,jlvcite,jnahso4,jna3hso4,jhhso4 !TBD - - implicit none - - !Sub args - real(r8), intent(in) :: aH2O - real(r8), intent(in), dimension(nelectrolyte) :: aw_min - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(in), dimension(6,nelectrolyte,nelectrolyte) :: b_mtem - ! local variables - integer jA - ! functions - !real(r8) :: fnlog_gamZ, bin_molality - - - ! sulfate-poor species - jA = jhno3 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - - - jA = jhcl - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - - - jA = jnh4so4 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - - - jA = jnh4no3 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jnh4cl - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jna2so4 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - - - jA = jnano3 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jnacl - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jcano3 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jcacl2 - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4no3) = fnlog_gamZ(jA,jnh4no3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4cl) = fnlog_gamZ(jA,jnh4cl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnano3) = fnlog_gamZ(jA,jnano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnacl) = fnlog_gamZ(jA,jnacl,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcano3) = fnlog_gamZ(jA,jcano3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jcacl2) = fnlog_gamZ(jA,jcacl2,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - ! sulfate-rich species - jA = jh2so4 - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jhhso4 - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jnh4hso4 - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jlvcite - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jnahso4 - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - - jA = jna3hso4 - log_gamZ(jA,jh2so4) = fnlog_gamZ(jA,jh2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4hso4)= fnlog_gamZ(jA,jnh4hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jlvcite) = fnlog_gamZ(jA,jlvcite,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnh4so4) = fnlog_gamZ(jA,jnh4so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jnahso4) = fnlog_gamZ(jA,jnahso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna3hso4)= fnlog_gamZ(jA,jna3hso4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jna2so4) = fnlog_gamZ(jA,jna2so4,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhno3) = fnlog_gamZ(jA,jhno3,aH2O,b_mtem,aw_min) - log_gamZ(jA,jhcl) = fnlog_gamZ(jA,jhcl,aH2O,b_mtem,aw_min) - - return - end subroutine MTEM_compute_log_gamZ - - - - subroutine degas_acids(jp,ibin,XT,aer,gas,electrolyte) - use module_data_mosaic_aero, only: naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jliquid,jsolid,jtotal, & - jhno3,jhcl,ihno3_g,ihcl_g,ino3_a,icl_a - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(in) :: XT - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: ehno3, ehcl - - - - if(jp .ne. jliquid)then - write(6,*)'Error in degas_acids' - write(6,*)'wrong jp' - endif - - ehno3 = electrolyte(jhno3,jp,ibin) - ehcl = electrolyte(jhcl,jp,ibin) - - ! add to gas - gas(ihno3_g) = gas(ihno3_g) + ehno3 - gas(ihcl_g) = gas(ihcl_g) + ehcl - - ! remove from aer - aer(ino3_a,jp,ibin) = aer(ino3_a,jp,ibin) - ehno3 - aer(icl_a, jp,ibin) = aer(icl_a, jp,ibin) - ehcl - - ! update jtotal - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jliquid,ibin) + & - aer(ino3_a,jsolid, ibin) - - aer(icl_a,jtotal,ibin) = aer(icl_a,jliquid,ibin) + & - aer(icl_a,jsolid, ibin) - - electrolyte(jhno3,jp,ibin) = 0.0 - electrolyte(jhcl,jp,ibin) = 0.0 - - return - end subroutine degas_acids - - - - - - !*********************************************************************** - ! updates all temperature dependent thermodynamic parameters - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine update_thermodynamic_constants( aH2O, T_K_in, & !intent-ins - sat_soa, aH2O_a, log_gamZ, Keq_sl, sigma_water, Kp_nh4cl, & !intent-outs - Kp_nh4no3, Kp_nh3, Keq_ll, Keq_gl, Keq_sg, MDRH_T, & - molality0 ) - - use module_data_mosaic_aero, only: r8,nbin_a_max,ngas_volatile, nelectrolyte, & - nrxn_aer_sg,nrxn_aer_gl,nrxn_aer_sl,nrxn_aer_ll,MDRH_T_NUM,d_mdrh_DIM2, & - nbin_a,b_mtem,b_zsr,a_zsr,aw_min,d_mdrh, & - jnh4so4,jlvcite,jnh4hso4,jnh4msa,jnh4no3,jnh4cl,jna2so4,jnahso4,jna3hso4, & - jnamsa,jnano3,jnacl,jcacl2,jcano3,jcamsa2,iaro1_g,iaro2_g,ialk1_g,iole1_g,& - iapi1_g,iapi2_g,ilim1_g,ilim2_g, & - use_cam5mam_soa_params - - use module_mosaic_ext, only: bin_molality - - implicit none - - !Subroutine Arguments - real(r8), intent(in) :: aH2O, T_K_in - - real(r8), intent(out) :: sigma_water,Kp_nh4cl,Kp_nh4no3,Kp_nh3 - real(r8), intent(out), dimension(nbin_a_max) :: aH2O_a - real(r8), intent(out), dimension(ngas_volatile) :: sat_soa - real(r8), intent(out), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(out), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(out), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(out), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(out), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(out), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(out), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - - ! local variables - integer iv, j_index, ibin, je - real(r8) :: tr, rt, term, T_K ! 6/3/2015 RAZ : bound temperature between 220 and 330 K - real(r8) :: sat_factor, MWsoa - real(r8), dimension(ngas_volatile) :: Po_soa - ! function - !real(r8) :: fn_Keq, fn_Po, drh_mutual, bin_molality - -! bound temperature between 220 and 330 K ! 6/3/2015 RAZ - T_K = max( 220.0_r8, T_K_in ) - T_K = min( 330.0_r8, T_K ) - - tr = 298.15 ! reference temperature - rt = 82.056*T_K/(1.e9*1.e6) ! [m^3 atm/nmol] - - ! gas-liquid - Keq_gl(1)= 1.0 ! Kelvin Effect (default) - Keq_gl(2)= fn_Keq(57.64d0, 13.79d0, -5.39d0,T_K)*rt ! NH3(g) <=> NH3(l) - Keq_gl(3)= fn_Keq(2.63d6, 29.17d0, 16.83d0,T_K)*rt ! HNO3(g) <=> NO3- + H+ - Keq_gl(4)= fn_Keq(2.00d6, 30.20d0, 19.91d0,T_K)*rt ! HCl(g) <=> Cl- + H+ - - ! liquid-liquid - Keq_ll(1)= fn_Keq(1.0502d-2, 8.85d0, 25.14d0,T_K) ! HSO4- <=> SO4= + H+ - Keq_ll(2)= fn_Keq(1.805d-5, -1.50d0, 26.92d0,T_K) ! NH3(l) + H2O = NH4+ + OH- - Keq_ll(3)= fn_Keq(1.01d-14,-22.52d0, 26.92d0,T_K) ! H2O(l) <=> H+ + OH- - - - Kp_nh3 = Keq_ll(3)/(Keq_ll(2)*Keq_gl(2)) - Kp_nh4no3= Kp_nh3/Keq_gl(3) - Kp_nh4cl = Kp_nh3/Keq_gl(4) - - - ! solid-gas - Keq_sg(1)= fn_Keq(4.72d-17,-74.38d0,6.12d0,T_K)/rt**2 ! NH4NO3<=>NH3(g)+HNO3(g) - Keq_sg(2)= fn_Keq(8.43d-17,-71.00d0,2.40d0,T_K)/rt**2 ! NH4Cl <=>NH3(g)+HCl(g) - - - ! solid-liquid - Keq_sl(jnh4so4) = fn_Keq(1.040d0,-2.65d0, 38.57d0, T_K) ! amSO4(s) = 2NH4+ + SO4= - Keq_sl(jlvcite) = fn_Keq(11.8d0, -5.19d0, 54.40d0, T_K) ! lvcite(s)= 3NH4+ + HSO4- + SO4= - Keq_sl(jnh4hso4)= fn_Keq(117.0d0,-2.87d0, 15.83d0, T_K) ! amHSO4(s)= NH4+ + HSO4- - Keq_sl(jnh4msa) = 1.e15 ! NH4MSA(s)= NH4+ + MSA- - Keq_sl(jnh4no3) = fn_Keq(12.21d0,-10.4d0, 17.56d0, T_K) ! NH4NO3(s)= NH4+ + NO3- - Keq_sl(jnh4cl) = fn_Keq(17.37d0,-6.03d0, 16.92d0, T_K) ! NH4Cl(s) = NH4+ + Cl- - Keq_sl(jna2so4) = fn_Keq(0.491d0, 0.98d0, 39.75d0, T_K) ! Na2SO4(s)= 2Na+ + SO4= - Keq_sl(jnahso4) = fn_Keq(313.0d0, 0.8d0, 14.79d0, T_K) ! NaHSO4(s)= Na+ + HSO4- - Keq_sl(jna3hso4)= 1.e15 ! Na3H(SO4)2(s) = 2Na+ + HSO4- + SO4= - Keq_sl(jnamsa) = 1.e15 ! NaMSA(s) = Na+ + MSA- - Keq_sl(jnano3) = fn_Keq(11.95d0,-8.22d0, 16.01d0, T_K) ! NaNO3(s) = Na+ + NO3- - Keq_sl(jnacl) = fn_Keq(38.28d0,-1.52d0, 16.89d0, T_K) ! NaCl(s) = Na+ + Cl- - Keq_sl(jcacl2) = fn_Keq(8.0d11, 32.84d0,44.79d0, T_K) ! CaCl2(s) = Ca++ + 2Cl- - Keq_sl(jcano3) = fn_Keq(4.31d5, 7.83d0,42.01d0, T_K) ! Ca(NO3)2(s) = Ca++ + 2NO3- - Keq_sl(jcamsa2) = 1.e15 ! CaMSA2(s)= Ca+ + 2MSA- - - ! vapor pressures of soa species - Po_soa(iaro1_g) = fn_Po(5.7d-5, 156.0d0, T_K) ! [Pascal] - Po_soa(iaro2_g) = fn_Po(1.6d-3, 156.0d0, T_K) ! [Pascal] - Po_soa(ialk1_g) = fn_Po(5.0d-6, 156.0d0, T_K) ! [Pascal] - Po_soa(iole1_g) = fn_Po(5.0d-6, 156.0d0, T_K) ! [Pascal] - Po_soa(iapi1_g) = fn_Po(4.0d-6, 156.0d0, T_K) ! [Pascal] - Po_soa(iapi2_g) = fn_Po(1.7d-4, 156.0d0, T_K) ! [Pascal] - Po_soa(ilim1_g) = fn_Po(2.5d-5, 156.0d0, T_K) ! [Pascal] - Po_soa(ilim2_g) = fn_Po(1.2d-4, 156.0d0, T_K) ! [Pascal] - - sat_factor = 0.5 ! = 1.0 for original SORGAM parameters - do iv = iaro1_g, ngas_volatile - ! sat_soa(iv) = 1.e9*Po_soa(iv)/(8.314*T_K) ! [nmol/m^3(air)] - sat_soa(iv) = sat_factor * 1.e9*Po_soa(iv)/(8.314*T_K) ! [nmol/m^3(air)] - enddo - - if ( use_cam5mam_soa_params > 0 ) then - Po_soa(ilim2_g) = fn_Po(1.0d-10, 156.0d0, T_K) ! [Pascal] - sat_soa(ilim2_g) = 1.e9*Po_soa(ilim2_g)/(8.314*T_K) ! [nmol/m^3(air)] - end if - - MWsoa = 120.0 - ! sat_soa(iapi1_g) = 1000.*2564.1/MWsoa ! [nmol/m^3(air)] - ! sat_soa(iapi2_g) = 1000.*11.803/MWsoa ! [nmol/m^3(air)] - - ! water surface tension - term = (647.15 - T_K)/647.15 - sigma_water = 0.2358*term**1.256 * (1. - 0.625*term) ! surface tension of pure water in N/m - - ! MDRH(T) - do j_index = 1, 63 - MDRH_T(j_index) = drh_mutual(j_index,T_K) - enddo - - - - ! RH dependent parameters - do ibin = 1, nbin_a - aH2O_a(ibin) = aH2O ! initialize - - do je = 1, nelectrolyte - molality0(je,ibin) = bin_molality(je,ibin,aH2O_a,b_zsr,a_zsr,aw_min) ! compute aH2O dependent binary molalities. RAZ 5/20/2014 - enddo - - enddo - - call MTEM_compute_log_gamZ(aH2O,log_gamZ,b_mtem,aw_min) ! function of aH2O and T - - - return - end subroutine update_thermodynamic_constants - - - - - - !*********************************************************************** - ! functions used in MOSAIC - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - - - - !---------------------------------------------------------- - function fn_Keq(Keq_298, a, b, T) - implicit none - real(r8) :: fn_Keq - ! subr. arguments - real(r8) :: Keq_298, a, b, T - ! local variables - real(r8) :: tt - - - tt = 298.15/T - fn_Keq = Keq_298*exp(a*(tt-1.)+b*(1.+log(tt)-tt)) - - return - end function fn_Keq - !---------------------------------------------------------- - - - - !---------------------------------------------------------- - function fn_Po(Po_298, DH, T) ! TOUCH - implicit none - real(r8) :: fn_Po - ! subr. arguments - real(r8) :: Po_298, DH, T - ! local variables - - fn_Po = Po_298*exp(-(DH/8.314e-3)*(1./T - 3.354016435e-3)) - - return - end function fn_Po - !---------------------------------------------------------- - - - - !---------------------------------------------------------- - function drh_mutual(j_index,T_K) ! TOUCH - use module_data_mosaic_aero, only: d_mdrh - - implicit none - - - !Subr. arguments - integer, intent(in) :: j_index - real(r8), intent(in) :: T_K - - !Local variables - integer j - real(r8) :: drh_mutual - - j = j_index - - if(j_index .eq. 7 .or. j_index .eq. 8 .or. & - (j_index.ge. 34 .and. j_index .le. 51))then - - drh_mutual = 10.0 ! cano3 or cacl2 containing mixtures - - else - - drh_mutual = d_mdrh(j,1) + T_K* & - (d_mdrh(j,2) + T_K* & - (d_mdrh(j,3) + T_K* & - d_mdrh(j,4) )) + 1.0 - -! bound drh_mutual between 0% and 100% ! RAZ 6/3/2015 - drh_mutual = max( 0.0_r8, drh_mutual ) - drh_mutual = min( 100.0_r8, drh_mutual ) - - endif - - - return - end function drh_mutual - !---------------------------------------------------------- - - -! RAZ -! Moved the following code to module_mosaic_ext.f90 -! function bin_molality - - - !---------------------------------------------------------- - function fnlog_gamZ(jA,jE,aH2O,b_mtem,aw_min) ! jA in jE - use module_data_mosaic_aero, only: nelectrolyte - - implicit none - - real(r8) :: fnlog_gamZ - ! subr. arguments - integer, intent(in) :: jA, jE - real(r8), intent(in) :: aH2O - real(r8), intent(in),dimension(nelectrolyte) :: aw_min - real(r8), intent(in), dimension(6,nelectrolyte,nelectrolyte) :: b_mtem - ! local variables - real(r8) :: aw - - - aw = max(aH2O, aw_min(jE)) - - fnlog_gamZ = b_mtem(1,jA,jE) + aw* & - (b_mtem(2,jA,jE) + aw* & - (b_mtem(3,jA,jE) + aw* & - (b_mtem(4,jA,jE) + aw* & - (b_mtem(5,jA,jE) + aw* & - b_mtem(6,jA,jE) )))) - - return - end function fnlog_gamZ - !---------------------------------------------------------- - - - - !---------------------------------------------------------- - ! currently not used - ! - ! two roots of a quadratic equation - ! - subroutine quadratix(a,b,c, qx1,qx2) - implicit none - ! subr. arguments - real(r8) :: a, b, c, qx1, qx2 - ! local variables - real(r8) :: x, dum - - - if(b .ne. 0.0)then - x = 4.*(a/b)*(c/b) - else - x = 1.e+6 - endif - - if(abs(x) .lt. 1.e-6)then - dum = ( (0.5*x) + & - (0.125*x**2) + & - (0.0625*x**3) ) - - qx1 = (-0.5*b/a)*dum - qx2 = -b/a - qx1 - - else - - qx1 = ((-b)+sqrt((b*b)-(4.*a*c)))/ & - (2.*a) - qx2 = ((-b)-sqrt((b*b)-(4.*a*c)))/ & - (2.*a) - - endif - - return - end subroutine quadratix - - - - !*********************************************************************** - ! computes aerosol optical properties - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine aerosol_optical_properties( & - gas, aer, num_a, water_a, & - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & - Dp_dry_a, Dp_wet_a, dp_core_a, & - ri_shell_a, ri_core_a, ri_avg_a, jaerosolstate, jphase, & - tot_cl_in, tot_nh4_in, tot_no3_in, XT, area_dry_a, area_wet_a, & - dens_dry_a, dens_wet_a, mass_dry_a, mass_wet_a, vol_dry_a, & - vol_wet_a, total_species, electrolyte ) - - use module_data_mosaic_aero, only: & - icl_a, inh4_a, ino3_a, ihcl_g, inh3_g, ihno3_g, jtotal, & - naer, naercomp, nbin_a, nbin_a_max, nelectrolyte, ngas_volatile, & - no_aerosol - use module_mosaic_ext, only: calc_dry_n_wet_aerosol_props, & - conform_electrolytes - - implicit none - - ! subr arguments - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate, jphase - - real(r8), intent(in), dimension(naer) :: dens_aer_mac, mw_aer_mac - real(r8), intent(in), dimension(naercomp) :: dens_comp_a,mw_comp_a - - real(r8), intent(inout) :: tot_cl_in, tot_nh4_in, tot_no3_in, XT - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(nbin_a_max) :: num_a - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_wet_a, dp_core_a - real(r8), intent(inout), dimension(nbin_a_max) :: area_dry_a, area_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: dens_dry_a, dens_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a, mass_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_dry_a, vol_wet_a - real(r8), intent(inout), dimension(ngas_volatile) :: total_species - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - - complex, intent(in), dimension(naercomp) :: ref_index_a - complex, intent(inout), dimension(nbin_a_max) :: ri_shell_a, ri_avg_a, ri_core_a - - ! local variables - integer iaer, ibin, je, k - - ! initialize to zero - do ibin = 1, nbin_a - do je = 1, nelectrolyte - electrolyte(je,jtotal,ibin) = 0.0 - enddo - jaerosolstate(ibin) = -1 ! initialize to default value - enddo - - ! calc total_species for conform_electrolytes call - total_species(:) = 0.0_r8 - tot_no3_in = gas(ihno3_g) - tot_cl_in = gas(ihcl_g) - tot_nh4_in = gas(inh3_g) - do ibin = 1, nbin_a - tot_no3_in = tot_no3_in + aer(ino3_a,jtotal,ibin) - tot_cl_in = tot_cl_in + aer(icl_a, jtotal,ibin) - tot_nh4_in = tot_nh4_in + aer(inh4_a,jtotal,ibin) - enddo - total_species(inh3_g) = tot_nh4_in - total_species(ihno3_g)= tot_no3_in - total_species(ihcl_g) = tot_cl_in - - - ! calc properties for each bin - do ibin = 1, nbin_a - - call check_aerosol_mass( ibin, jaerosolstate, jphase, aer, num_a, mass_dry_a ) - - if(jaerosolstate(ibin) .ne. no_aerosol) then - - ! conforms aer(jtotal) to a valid aerosol - call conform_electrolytes( jtotal, ibin, XT, aer, gas, electrolyte, total_species, tot_cl_in ) - - ! check mass again after conform_electrolytes - call check_aerosol_mass( ibin, jaerosolstate, jphase, aer, num_a, mass_dry_a ) - - if(jaerosolstate(ibin) .ne. no_aerosol) then - ! adjusts number conc so that it conforms with bin mass and diameter - call conform_aerosol_number( ibin, jaerosolstate, aer, num_a, vol_dry_a, Dp_dry_a) - - ! calc Dp_wet, ref index - call calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - endif - endif - - enddo - - return - end subroutine aerosol_optical_properties - - -end module module_mosaic_box_aerchem - diff --git a/MAMchem_GridComp/microphysics/module_mosaic_cam_init.F90 b/MAMchem_GridComp/microphysics/module_mosaic_cam_init.F90 deleted file mode 100644 index 481533c1..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_cam_init.F90 +++ /dev/null @@ -1,132 +0,0 @@ -module module_mosaic_cam_init - -#ifndef GEOS5_PORT - use shr_kind_mod, only: r8 => shr_kind_r8 - use infnan, only: nan, bigint -#else - use MAPL_ConstantsMod, only: r8 => MAPL_R8 - use infnan, only: nan, bigint -#endif - - !---------------------------------------------------------------------------------------! - !BSINGH: This module initilizes Mosaic chemistry variables. - !---------------------------------------------------------------------------------------! - - implicit none - private - - public:: mosaic_cam_init - -contains - -#ifndef GEOS5_PORT - subroutine mosaic_cam_init -#else - subroutine mosaic_cam_init(verbose) -#endif - !---------------------------------------------------------------------------------------! - !BSINGH: This subroutine initialzies some Mosaic conastans and inpput parameters - ! Called by: modal_aero_initialize_data.F90 - !---------------------------------------------------------------------------------------! -#ifndef GEOS5_PORT - use spmd_utils, only: masterproc -#endif - use cam_logfile, only: iulog - use modal_aero_amicphys, only: max_mode - - use module_data_mosaic_aero, only: nbin_a_max, nbin_a, mhyst_method, mhyst_force_up, & - mGAS_AER_XFER, mDYNAMIC_SOLVER, msize_framework, mmodal, alpha_ASTEM, rtol_eqb_ASTEM, & - ptol_mol_ASTEM, method_bcfrac, method_kappa, maersize_init_flag1, mcoag_flag1, & - ifreq_coag, mmovesect_flag1, mnewnuc_flag1, msectional_flag1, & - use_cam5mam_soa_params, use_cam5mam_accom_coefs - - use module_data_mosaic_main, only: ipmcmos, & - mgas, maer, mcld, maeroptic, mshellcore, msolar, mphoto - - use module_data_mosaic_asecthp, only: ntype_md1_aer, ntype_md2_aer - - use module_data_mosaic_constants, only: pi, piover4, piover6, deg2rad, third -#ifndef GEOS5_PORT - use physconst, only: pi_cam => pi -#else - use MAPL_ConstantsMod, only: pi_cam => MAPL_PI -#endif - use module_mosaic_init_aerpar, only: mosaic_init_aer_params - -#ifdef GEOS5_PORT - implicit none - - ! arguments - logical, intent(in) :: verbose - - ! local - logical :: masterproc - masterproc = verbose -#endif - - - !Initialize Mosaic constants with values from CAM constants - nbin_a_max = max_mode !*BALLI* Ask Dick about it - nbin_a = max_mode !Maximum # of modes is equal to # of bins in Mosaic - if(masterproc) then - write(iulog,*) 'mosaic_cam_init: nbin_a_max=', nbin_a_max - endif - - pi = pi_cam !Pi value from CAM - piover4 = 0.25_r8 * pi - piover6 = pi/6.0_r8 - deg2rad = pi/180.0_r8 - third = 1.0_r8/3.0_r8 - - use_cam5mam_soa_params = 1 ! use cam5-mam soa/soag parameter values - use_cam5mam_accom_coefs = 1 ! use cam5-mam accomodation coefficient values - - !BSINGH - Initialize other constants which sit in the input file of Mosaic - !and are used in the present code(**BALLI Ask Dick about it) - mhyst_method = mhyst_force_up !rceaster !mhyst_method (1=uporlo_jhyst, 2=uporlo_waterhyst, 3=force_up, 4=force_low) - mGAS_AER_XFER = 1 !mGAS_AER_XFER: 1=do gas-aerosol partitioning 0=do not partition - mDYNAMIC_SOLVER = 1 !mDYNAMIC_SOLVER: 1=astem 2=lsodes - msize_framework = mmodal ! rceaster (1=modal, 2=unstructured, 3=sectional) - alpha_ASTEM = 0.5 !Solver parameter. range: 0.01 - 1.0 - rtol_eqb_ASTEM = 0.01 !Relative eqb tolerance. range: 0.01 - 0.03 - ptol_mol_ASTEM = 0.01 !Percent mol tolerance. range: 0.01 - 1.0 - ipmcmos = 0 !Additional inputs needed when ipmcmos > 0 - - - !BSINGH - Initialize constants to 'bigint' which sit in the input file of Mosaic - !and are NOT used in the present code(**BALLI Ask Dick about it) - !'bigint' initialized variables will cause the code to halt on their first use - - ntype_md1_aer = bigint !(number of aerosol types) - ntype_md2_aer = bigint !(number of aerosol types) - method_bcfrac = bigint !(only used for sectional and ntype>1) - method_kappa = bigint !(only used for sectional and ntype>1) - maersize_init_flag1 = bigint !(only used for sectional and ntype>1) - - mcoag_flag1 = bigint !(only used for sectional) - ifreq_coag = bigint !(only used for sectional) - mmovesect_flag1 = bigint !(only used for sectional) - mnewnuc_flag1 = bigint !(only used for sectional) - msectional_flag1 = bigint !(currently not used) - -! these variables are now in module_data_mosaic_boxmod, and can be ignored by cam and cambox codes -! iprint = bigint !freq of output. Every iprint*dt_min mins. -! iwrite_gas = bigint -! iwrite_aer_bin = bigint -! iwrite_aer_dist = bigint -! iwrite_aer_species = bigint -! mmode = bigint !: 1=time integration 2=parametric analysis - - mgas = bigint !: 1=gas chem on, 0=gas chem off** - maer = bigint !: 1=aer chem on, 0=aer chem off** - mcld = bigint !: 1=cld chem on, 0=cld chem off** - maeroptic = bigint !: 1=aer_optical on, 0=aer_optical off ** - mshellcore = bigint !: 0=no shellcore, 1=core is BC only, 2=core is BC and DUST ** - msolar = bigint !: 1=diurnally varying phot, 2=fixed phot** - mphoto = bigint !: 1=Rick's param 2=Yang's param** - - call mosaic_init_aer_params - - end subroutine mosaic_cam_init - -end module module_mosaic_cam_init diff --git a/MAMchem_GridComp/microphysics/module_mosaic_ext.F90 b/MAMchem_GridComp/microphysics/module_mosaic_ext.F90 deleted file mode 100644 index 48ca7f92..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_ext.F90 +++ /dev/null @@ -1,5874 +0,0 @@ -module module_mosaic_ext -contains - !*********************************************************************** - ! determines phase state of an aerosol bin. includes kelvin effect. - ! - ! author: Rahul A. Zaveri - ! update: Sep 2015 - !----------------------------------------------------------------------- - subroutine aerosol_phase_state( ibin, jaerosolstate, jphase, aer, & - jhyst_leg, electrolyte, epercent, kel, activity, mc, num_a, mass_wet_a, mass_dry_a, & - mass_soluble_a, vol_dry_a, vol_wet_a, water_a, water_a_hyst, water_a_up, aH2O_a, & - aH2O, ma, gam, log_gamZ, zc, za, gam_ratio, & - xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, partial_molar_vol, sigma_soln, T_K, & ! RAZ deleted a_zsr - RH_pc, mw_aer_mac, dens_aer_mac, sigma_water, Keq_ll, Keq_sl, MW_a, MW_c, & - growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, jsalt_index, & - jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, nelectrolyte, &!Parameters - Ncation, naer, jtotal, all_solid, jhyst_up, all_liquid, Nanion, nrxn_aer_ll, & - nrxn_aer_sl, nsalt, MDRH_T_NUM, jsulf_poor_NUM, jsulf_rich_NUM, &!Parameters - inh4_a, ina_a, ica_a, ico3_a, imsa_a, icl_a, ino3_a, iso4_a, & ! TBD - a_zsr, b_zsr, aw_min, &! RAZ added a_zsr, b_zsr, aw_min - mosaic_vars_aa_type - - - implicit none - !Intent -ins - - integer, intent(in):: ibin - integer, intent(in), dimension(nsalt) :: jsalt_index - integer, intent(in), dimension(jsulf_poor_NUM) :: jsulf_poor - integer, intent(in), dimension(jsulf_rich_NUM) :: jsulf_rich - - real(r8), intent(in) :: aH2O,T_K,RH_pc,rtol_mesa - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(in), dimension(ngas_volatile) :: partial_molar_vol - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - !Intent - inout - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(inout) :: sigma_water - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_wet_a,mass_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: vol_dry_a,vol_wet_a,water_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a_hyst,water_a_up,aH2O_a - real(r8), intent(inout), dimension(nbin_a_max) :: sigma_soln,growth_factor,MDRH - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 ! RAZ 5/20/2014 - real(r8), intent(inout), dimension (nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension (nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kel - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer, parameter :: aer_pha_sta_diagaa = -1 !BALLI- changed from 100 to -1 - integer, parameter :: iter_kelvin_method = 3 - ! iter_kelvin_method = 1 - use rahuls original iteration method - ! iter_kelvin_method = 2 - use bisection - ! iter_kelvin_method = 3 - start with rahuls original iteration method, but if it fails, switch to bisection - integer, parameter :: iter_kelvin_meth1_max = 10 - integer, parameter :: iter_kelvin_meth2_max = 100 - integer :: iaer, iv, itmpa - integer :: iter_kelvin, iter_kelvin_meth1, iter_kelvin_state - integer :: js, je - - real(r8) :: aer_H - real(r8):: aH2O_range_bisect_toler - real(r8) :: aH2O_a_new, aH2O_a_old, aH2O_a_oldn, aH2O_a_oldp, aH2O_a_del_state3 - real(r8), dimension(nbin_a_max) :: DpmV - real(r8), dimension(nbin_a_max) :: kelvin - real(r8) :: kelvin_old, kelvin_oldn, kelvin_oldp - real(r8) :: kelvin_toler - real(r8) :: rel_err, rel_err_old, rel_err_old2, rel_err_oldn, rel_err_oldp - real(r8) :: term, tmpa - real(r8) :: water_a_old, water_a_oldn, water_a_oldp - - - if (aer_pha_sta_diagaa >= 3) & - write(*,'(/a,5i5,2f12.8,1p,2e11.3)') 'aer_pha_sta_a', ibin, jhyst_leg(ibin), jaerosolstate(ibin), -1, 0, aH2O, aH2O_a(ibin) - !aH2O = RH_pc*0.01 !**BALLI, this is already done in init subr - aH2O_a(ibin) = aH2O - kelvin(ibin) = 1.0 - do iv = 1, ngas_volatile - kel(iv,ibin) = 1.0 - enddo - -! if(RH_pc .le. 97.0)then ! RAZ -! kelvin_toler = 1.e-4 -! else -! kelvin_toler = 1.e-10 ! RAZ -! endif -! define error tolerances become stricter as aH2O approaches 1.0 - kelvin_toler = 1.e-6_r8 * max( 1.0_r8-aH2O, 1.0e-4_r8 ) - aH2O_range_bisect_toler = 1.e-6_r8 * max( 1.0_r8-aH2O, 1.0e-4_r8 ) - - - ! calculate dry mass and dry volume of a bin - mass_dry_a(ibin) = 0.0 ! initialize to 0.0 - vol_dry_a(ibin) = 0.0 ! initialize to 0.0 - - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - - do iaer = 1, naer - mass_dry_a(ibin) = mass_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer) ! ng/m^3(air) - vol_dry_a(ibin) = vol_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer)/dens_aer_mac(iaer) ! ncc/m^3(air) - enddo - mass_dry_a(ibin) = mass_dry_a(ibin) + aer_H - vol_dry_a(ibin) = vol_dry_a(ibin) + aer_H - - mass_dry_a(ibin) = mass_dry_a(ibin)*1.e-15 ! g/cc(air) - vol_dry_a(ibin) = vol_dry_a(ibin)*1.e-15 ! cc(aer)/cc(air) or m^3/m^3(air) - - ! wet mass and wet volume - mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) - - - water_a_up(ibin) = aerosol_water_up(ibin,electrolyte,aer,kappa_nonelectro,a_zsr) ! for hysteresis curve determination - - iter_kelvin = 0 - iter_kelvin_meth1 = 0 - - iter_kelvin_state = 0 - if (iter_kelvin_method == 2) iter_kelvin_state = 2 - - aH2O_a_old = aH2O - kelvin_old = 1.0_r8 - rel_err_old = 1.0e30_r8 - rel_err_old2 = 1.0e30_r8 - water_a_old = 0.0_r8 - - aH2O_a_del_state3 = 1.0e-3_r8 - aH2O_a_oldn = aH2O - aH2O_a_oldp = aH2O - kelvin_oldp = 1.0_r8 - kelvin_oldn = 1.0_r8 - rel_err_oldn = 1.0e30_r8 - rel_err_oldp = 1.0e30_r8 - water_a_oldp = 0.0_r8 - water_a_oldn = 0.0_r8 - aH2O_a_new = aH2O - - -10 iter_kelvin = iter_kelvin + 1 - aH2O_a(ibin) = aH2O_a_new - -! RAZ uncommented the next 3 lines - do je = 1, nelectrolyte - molality0(je,ibin) = bin_molality(je,ibin,aH2O_a,b_zsr,a_zsr,aw_min) ! compute aH2O dependent binary molalities EFFI - enddo - call MESA( ibin, jaerosolstate, jphase, aer, jhyst_leg, & - electrolyte, epercent, activity, mc, num_a, mass_wet_a, mass_dry_a, & - mass_soluble_a, vol_dry_a, vol_wet_a, water_a, water_a_hyst, water_a_up, aH2O_a, & - aH2O, ma, gam, log_gamZ, zc, za, gam_ratio, & - xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_ll, & - Keq_sl, MW_c, MW_a, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, & - jsalt_present, jsalt_index, jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - - if(jaerosolstate(ibin) .eq. all_solid)then - if (aer_pha_sta_diagaa >= 2) & - write(*,'(a,5i5,2f12.8,1p,2e11.3)') 'aer_pha_sta_b', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin) - return - endif - ! new wet mass and wet volume - mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) - - call calculate_kelvin(ibin,num_a,vol_wet_a,aH2O_a,DpmV,kelvin,sigma_soln,T_K, & - sigma_water) - ! kelvin(ibin) = 1.0 - kelvin(ibin) = max( kelvin(ibin), 1.0_r8 ) - if (water_a(ibin) <= 0.0_r8) kelvin(ibin) = 1.0_r8 - - aH2O_a_new = aH2O/kelvin(ibin) - -! if(RH_pc .le. 97.0)then -! rel_err = abs( (aH2O_a_new - aH2O_a(ibin))/aH2O_a(ibin)) -! else -! if(water_a(ibin) .gt. 0.0)then -! rel_err = abs( (water_a(ibin) - water_a_old)/water_a(ibin)) -! else -! rel_err = 0.0 ! no soluble material is present -! endif -! endif -! the above rel_err involve differences between current and previous -! iteration values, and is not suitable for bisection -! this rel_err below uses error from the exact solution, and is suitable for bisection - rel_err = (aH2O_a(ibin)*kelvin(ibin) - aH2O) / max( aH2O, 0.01_r8 ) - - if (aer_pha_sta_diagaa >= 10) & - write(*,'(a,2i5, 1p,e10.2, 0p,f14.10, 2x,2f14.10, 2x,1p,2e18.10)') & - 'iter_kelvin', iter_kelvin_state, iter_kelvin, rel_err, kelvin(ibin), & - aH2O_a(ibin), aH2O_a_new, water_a_old, water_a(ibin) - - if (abs(rel_err) <= kelvin_toler) then - iter_kelvin_state = iter_kelvin_state + 100 - goto 90 - end if - - if (iter_kelvin_state <= 0) then - ! doing rahuls original iteration method - itmpa = 0 - if (iter_kelvin >= iter_kelvin_meth1_max) then - itmpa = 1 - else if (iter_kelvin >= iter_kelvin_meth1_max) then - tmpa = min( rel_err_old, rel_err_old2 ) - if (tmpa < 0.0_r8 .and. rel_err <= tmpa) itmpa = 1 - tmpa = max( rel_err_old, rel_err_old2 ) - if (tmpa > 0.0_r8 .and. rel_err >= tmpa) itmpa = 1 - end if - - if (itmpa > 0) then - if (iter_kelvin_method <= 1) then - ! quit if number of iterations is too large OR - ! rel_err is outside the range of the previous two rel_err values, - ! and one previous rel_err is positive, and one previous rel_err is negative - aH2O_a(ibin) = aH2O_a_new ! do this to get same output as prev version - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_err', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 100 - goto 90 - else - ! switch to method 2 but do not iterate yet - iter_kelvin_state = 1 - iter_kelvin_meth1 = iter_kelvin - end if - else - ! save current values to old then do next iteration - aH2O_a_old = aH2O_a(ibin) - kelvin_old = kelvin(ibin) - rel_err_old2 = rel_err_old - rel_err_old = rel_err - water_a_old = water_a(ibin) - ! aH2O = aH2O_a_new - ! call MTEM_compute_log_gamZ ! recompute activity coeffs (for surface tension and solid-liquid equilibria) - goto 10 - end if - endif - - if (iter_kelvin_state == 1) then - ! rahuls original iteration method failed, so do some things before switching to bisection - iter_kelvin_state = 2 - if (rel_err < 0.0_r8) then - ! current aH2O_a has negative rel_err so must start at the beginning - aH2O_a_new = aH2O - goto 10 - else - ! current aH2O_a has positive rel_err and can be used in bisection - ! do not iterate yet - continue - end if - end if - - if (iter_kelvin_state == 2) then - ! this is first "setup" step of bisection, and the algorithm is expecting that - ! the current aH2O_a has hel_err be > 0, and can be used as one of the 2 bisection points - if (rel_err < 0.0_r8) then - ! error should be positive, so this is a fatal error - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_er2', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 100 - goto 90 - end if - ! current aH2O_a will work as one of the two initial bisection points - ! (the one with a positive error) - aH2O_a_oldp = aH2O_a(ibin) - kelvin_oldp = kelvin(ibin) - rel_err_oldp = rel_err - water_a_oldp = water_a(ibin) - aH2O_a_new = min( aH2O/kelvin(ibin), 0.999999_r8 ) ! is this needed, or should it be 1.0, or ??? - iter_kelvin_state = 3 - goto 10 - end if - - if (iter_kelvin_state == 3) then - ! this is the second "setup" step of bisection, and the algorithm is looking for an aH2O_a - ! that has rel_err < 0, so that the "root" will be bracketed and bisection can begin - if (rel_err < 0.0_r8) then - ! current aH2O_a will work as one of the two initial bisection points - ! (the one with a negative error) - aH2O_a_oldn = aH2O_a(ibin) - kelvin_oldn = kelvin(ibin) - rel_err_oldn = rel_err - water_a_oldn = water_a(ibin) - aH2O_a_new = 0.5_r8*(aH2O_a_oldn + aH2O_a_oldp) - iter_kelvin_state = 4 - goto 10 - else - ! need to find a point with a negative error - if ( (rel_err >= rel_err_oldp) .or. & - (aH2O_a_del_state3 >= 0.999_r8) ) then - ! cannot find such a point -- this is a fatal error - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_er3', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 200 - goto 90 - else - ! save current aH2O_a as the initial bisection point with positive error - ! then calc aH2O_a_new = aH2O_a(ibin) - aH2O_a_del_state3 - ! which will hopefully have a negative error - aH2O_a_oldp = aH2O_a(ibin) - kelvin_oldp = kelvin(ibin) - rel_err_oldp = rel_err - water_a_oldp = water_a(ibin) - aH2O_a_new = aH2O_a(ibin) - aH2O_a_del_state3 - aH2O_a_del_state3 = aH2O_a_del_state3*1.5_r8 - if (aH2O_a_new .le. 0.01_r8) then - aH2O_a_new = 0.01_r8 - aH2O_a_del_state3 = 1.0_r8 - end if - goto 10 - end if - end if - end if - - if (iter_kelvin_state == 4) then - ! at this point, the algorithm is doing bisection - if ( iter_kelvin >= iter_kelvin_meth2_max + iter_kelvin_meth1 ) then - ! maximum iterations is exceeded - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_er4', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 301 - goto 90 - else if ( abs(aH2O_a_oldp - aH2O_a_oldn) <= aH2O_range_bisect_toler ) then - ! the aH2O_a_oldp to aH2O_a_oldn range is very small, which is treated as convergence -! if (aer_pha_sta_diagaa >= 1) & -! write(*,'(a,5i5,2f12.8,1p,4e11.3)') 'iter_kelv_er5', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & -! iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler, & -! aH2O_range_bisect_toler - iter_kelvin_state = 302 - goto 90 - end if - ! decide if the current aH2O_a should replace the old negative-error point - ! or the old positive-error point - if (rel_err >= 0.0_r8) then - if (rel_err >= rel_err_oldp) then - ! current aH2O_a has positive error, but the error is not smaller - ! than the old positive-error point -- this is a fatal error - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_er6', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 303 - goto 90 - else - ! current aH2O_a has positive error and replaces the the old positive-error point - aH2O_a_oldp = aH2O_a(ibin) - kelvin_oldp = kelvin(ibin) - rel_err_oldp = rel_err - water_a_oldp = water_a(ibin) - end if - else - if (rel_err <= rel_err_oldn) then - ! current aH2O_a has negative error, but the error is not smaller - ! than the old negative-error point -- this is a fatal error - if (aer_pha_sta_diagaa >= 1) & - write(*,'(a,5i5,2f12.8,1p,3e11.3)') 'iter_kelv_er7', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, kelvin_toler - iter_kelvin_state = 304 - goto 90 - else - ! current aH2O_a has negative error and replaces the the old negative-error point - aH2O_a_oldn = aH2O_a(ibin) - kelvin_oldn = kelvin(ibin) - rel_err_oldn = rel_err - water_a_oldn = water_a(ibin) - end if - end if - aH2O_a_new = 0.5_r8*(aH2O_a_oldn + aH2O_a_oldp) - goto 10 - end if - - write(*,'(a,4i5)') 'iter_kelv fatal err 1', ibin, iter_kelvin, iter_kelvin_state - stop - - - ! kelvin iterations completed -90 if (iter_kelvin_state == 200) then - ! select aH2O_a(ibin) or aH2O_a_oldp, whichever has lowest error - if (abs(rel_err_oldp) < abs(rel_err)) then - aH2O_a(ibin) = aH2O_a_oldp - rel_err = rel_err_oldp - end if - else if (iter_kelvin_state >= 300 .and. iter_kelvin_state <= 304) then - ! select aH2O_a(ibin) or aH2O_a_oldp or aH2O_a_oldn, whichever has lowest error - tmpa = min( abs(rel_err_oldn), abs(rel_err_oldp), abs(rel_err) ) - if (abs(rel_err_oldp) == tmpa) then - aH2O_a(ibin) = aH2O_a_oldp - rel_err = rel_err_oldp - else if (abs(rel_err_oldn) == tmpa) then - aH2O_a(ibin) = aH2O_a_oldn - rel_err = rel_err_oldn - end if - end if - - if(jaerosolstate(ibin) .eq. all_liquid)jhyst_leg(ibin) = jhyst_up - - ! now compute kelvin effect terms for condensing species (nh3, hno3, and hcl) - do iv = 1, ngas_volatile - term = 4.*sigma_soln(ibin)*partial_molar_vol(iv)/ & - (8.3144e7*T_K*DpmV(ibin)) - kel(iv,ibin) = 1. + term*(1. + 0.5*term*(1. + term/3.)) - enddo - - if (aer_pha_sta_diagaa >= 2) & - write(*,'(a,5i5,2f12.8,1p,e11.3,e14.5)') 'aer_pha_sta_c', ibin, jhyst_leg(ibin), jaerosolstate(ibin), & - iter_kelvin_state, iter_kelvin, aH2O, aH2O_a(ibin), rel_err, water_a(ibin) - return - end subroutine aerosol_phase_state - - - - !**********************************`************************************* - ! MESA: Multicomponent Equilibrium Solver for Aerosols. - ! Computes equilibrum solid and liquid phases by integrating - ! pseudo-transient dissolution and precipitation reactions - ! - ! author: Rahul A. Zaveri - ! update: sep 2015 - ! - ! 9/3/2015 RAZ: Bugfix - fixed phase state calculations for aerosols that dont contain any salts, - ! but can still contain water due to presence of BC, OC, SOA, and OIN, which are now - ! allowed to absorb some water. - !----------------------------------------------------------------------- - subroutine MESA( ibin, jaerosolstate, jphase, aer, jhyst_leg, & - electrolyte, epercent, activity, mc, num_a, mass_wet_a, mass_dry_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, water_a_hyst, water_a_up, aH2O_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, & - na_Ma, nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_ll, Keq_sl, MW_c, & - MW_a, growth_factor, MDRH, MDRH_T, molality0, rtol_mesa, jsalt_present, jsalt_index, & - jsulf_poor, jsulf_rich, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) - - use module_data_mosaic_aero, only: r8, nbin_a_max, nelectrolyte, Ncation, naer, &!Parameters - jtotal, all_solid, jsolid, all_liquid, jliquid, jhyst_lo, mhyst_uporlo_jhyst, &!Parameters - jhyst_up, mhyst_uporlo_waterhyst, nsoluble, nsalt, Nanion, nrxn_aer_sl, & - nrxn_aer_ll, MDRH_T_NUM, jsulf_poor_NUM, jsulf_rich_NUM, &!Parameters - ptol_mol_astem, mhyst_force_lo, mhyst_force_up, &!Input - jcacl2, jcano3, mhyst_method, ioin_a, ibc_a, jcaco3, jcaso4, & !TBD - mosaic_vars_aa_type - - - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nbin_a_max) :: jhyst_leg - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase - integer, intent(in), dimension(nsalt) :: jsalt_index - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(in), dimension(jsulf_poor_NUM) :: jsulf_poor - integer, intent(in), dimension(jsulf_rich_NUM) :: jsulf_rich - - real(r8), intent(in) :: aH2O,rtol_mesa - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_wet_a,mass_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,water_a_hyst,water_a_up - real(r8), intent(inout), dimension(nbin_a_max) :: aH2O_a,growth_factor,MDRH - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(MDRH_T_NUM) :: MDRH_T - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer :: idissolved, j_index, jsalt_dum, jdum, js, je ! 9/3/2015 RAZ: added jsalt_dum - real(r8) :: CRH, solids, sum_soluble, sum_insoluble, XT !BALLI** XT, should it be subr arg? - !real(r8) :: aerosol_water ! mosaic func - !real(r8) :: drh_mutual ! mosaic func - real(r8) :: H_ion, sum_dum - - - !! EFFI - !! calculate percent composition - sum_dum = 0.0 - do je = 1, nelectrolyte - sum_dum = sum_dum + electrolyte(je,jtotal,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - do je = 1, nelectrolyte - epercent(je,jtotal,ibin) = 100.*electrolyte(je,jtotal,ibin)/sum_dum - enddo - - - call calculate_XT(ibin,jtotal,XT,aer) - - - -!! begin new algorithm - 6/3/2015 RAZ - jsalt_dum = 0 ! 9/3/2015 RAZ - do js = 1, nsalt - jsalt_present(js) = 0 ! default value - salt absent - - if(epercent(js,jtotal,ibin) .gt. ptol_mol_astem)then - jsalt_present(js) = 1 ! salt present - jsalt_dum = jsalt_dum + jsalt_index(js) ! 9/3/2015 RAZ - endif - enddo - - - if( (epercent(jcano3,jtotal,ibin) .gt. ptol_mol_astem) .or. & - (epercent(jcacl2,jtotal,ibin) .gt. ptol_mol_astem) )then - CRH = 0.0 ! no crystrallization or efflorescence point - else - CRH = 0.35 ! default value - endif - - ! now diagnose MDRH - if(jsalt_dum .eq. 0)then ! no salts or acids are present ! 9/3/2015 RAZ: updated algorithm for jsalt_dum = 0 - - CRH = 0.0 - MDRH(ibin) = 0.0 - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & ! 9/3/2015 RAZ: water due to nonelectrolytes (OC, BC, SOA, OIN) - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - return - - elseif(XT .lt. 1. .and. XT .gt. 0.0)then ! excess sulfate, always liquid, MDRH=0.0 - MDRH(ibin) = 0.0 - elseif(XT .ge. 2.0 .or. XT .lt. 0.0)then ! sulfate poor - j_index = jsulf_poor(jsalt_dum) ! 9/3/2015 RAZ - MDRH(ibin) = MDRH_T(j_index) - else ! sulfate rich - j_index = jsulf_rich(jsalt_dum) ! 9/3/2015 RAZ - MDRH(ibin) = MDRH_T(j_index) - endif - - CRH = min(CRH, MDRH(ibin)/100.0) ! 6/3/2015 RAZ - -!! end new algorithm - 6/3/2015 RAZ - - - ! modified step 1: 9/3/2015 RAZ - ! step 1: check if aH2O is below CRH (crystallization or efflorescence point) - if( aH2O_a(ibin).lt.CRH )then - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & ! 9/3/2015 RAZ: water due to nonelectrolytes (OC, BC, SOA, OIN) - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - return - endif - - - ! step 2: check mhyst_method for supersaturation/metastable state - jdum = 0 - if (mhyst_method == mhyst_uporlo_jhyst) then ! BOX method/logic - if (jhyst_leg(ibin) == jhyst_up) jdum = 1 - elseif (mhyst_method == mhyst_uporlo_waterhyst) then ! 3-D method/logic - if (water_a_hyst(ibin) > 0.5*water_a_up(ibin)) jdum = 1 - !BSINGH - 05/28/2013(RCE updates) - elseif (mhyst_method == mhyst_force_lo) then - jdum = 0 - elseif (mhyst_method == mhyst_force_up) then - jdum = 1 - !BSINGH - 05/28/2013(RCE updates ENDS) - else - write(*,*) '*** MESA - bad mhyst_method' - stop - endif - if (jdum == 1) then ! the aerosol is fully deliquesced in metastable or subsaturated state - call do_full_deliquescence(ibin,aer,electrolyte) - - ! call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,nc_Mc,xeq_c) ! for Li and Lu surface tension - ! call compute_activities(ibin,jphase,aer,jhyst_leg,electrolyte, & - !activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam,log_gamZ,gam_ratio) ! for Li and Lu surface tension - - - - -! MODIFIED LOGIC IF SOA, POA, BC, OIN ARE ASSUMED TO BE SLIGHTLY HYGROSCOPIC RAZ 4/16/2014 -! sum_soluble = 0.0 -! do js = 1, nsoluble -! sum_soluble = sum_soluble + electrolyte(js,jtotal,ibin) -! enddo -! -! solids = electrolyte(jcaso4,jtotal,ibin) + & -! electrolyte(jcaco3,jtotal,ibin) + & -! aer(ioin_a,jtotal,ibin) + & -! aer(ibc_a,jtotal,ibin) -! -! -! if(sum_soluble .le. 0.0 .and. solids .gt. 0.0)then ! RAZ modified logic -! -! jdum = 0 -! jaerosolstate(ibin) = all_solid ! no soluble material present, so go back to solid state -! jphase(ibin) = jsolid -! call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) -! -! ! new wet mass and wet volume -! mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) -! vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) -! growth_factor(ibin) = mass_wet_a(ibin)/mass_dry_a(ibin) ! mass growth factor -! -! return -! -! elseif(sum_soluble .gt. 0.0)then ! RAZ modified logic -! - jaerosolstate(ibin) = all_liquid - jhyst_leg(ibin) = jhyst_up - jphase(ibin) = jliquid - water_a(ibin) = aerosol_water(jtotal,ibin,jaerosolstate,jphase,jhyst_leg, & - electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O,molality0) - if(water_a(ibin) .le. 0.0)then ! one last attempt to catch bad input - jdum = 0 - jaerosolstate(ibin) = all_solid ! no soluble material present - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - else - call adjust_liquid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent) - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a, & - aH2O,ma,gam,log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) - endif - - ! new wet mass and wet volume - mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) - growth_factor(ibin) = mass_wet_a(ibin)/mass_dry_a(ibin) ! mass growth factor - - return - -! endif - - - endif ! jdum - - - ! step 3: diagnose phase state based on MDRH - if(aH2O_a(ibin)*100. .lt. MDRH(ibin)) then - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent,water_a) - return - endif - - - ! step 4: none of the above means it must be sub-saturated or mixed-phase -10 call do_full_deliquescence(ibin,aer,electrolyte) - call MESA_PTC( ibin, jaerosolstate, jphase, aer, jhyst_leg, & - electrolyte, epercent, activity, mc, num_a, mass_dry_a, mass_wet_a, & - mass_soluble_a, vol_dry_a, vol_wet_a, water_a, aH2O, & - ma, gam, log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, & - mw_electrolyte, mw_aer_mac, dens_aer_mac, Keq_sl, MW_c, MW_a, Keq_ll, & - growth_factor, molality0, rtol_mesa, jsalt_present, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) ! determines jaerosolstate(ibin) - return - end subroutine MESA - - - - !*********************************************************************** - ! computes kelvin effect term (kelvin => 1.0) - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine calculate_kelvin(ibin,num_a,vol_wet_a,aH2O_a,DpmV,kelvin,sigma_soln, & - T_K,sigma_water) - use module_data_mosaic_constants, only: pi - use module_data_mosaic_aero, only: r8,nbin_a_max !Parameters - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(in) :: T_K,sigma_water - real(r8), intent(in), dimension(nbin_a_max) :: num_a - real(r8), intent(inout), dimension(nbin_a_max) :: sigma_soln - real(r8), intent(inout), dimension(nbin_a_max) ::vol_wet_a,aH2O_a,DpmV,kelvin - ! local variables - integer je - real(r8) :: term, sum_dum - real(r8), dimension(nbin_a_max) :: volume_a - - volume_a(ibin) = vol_wet_a(ibin) ! [cc/cc(air)] - DpmV(ibin)=(6.*volume_a(ibin)/(num_a(ibin)*pi))**(1./3.) ! [cm] - - - ! Li and Lu (2001) surface tension model: - ! sum_dum = 0.0 - ! do je = 1, nelectrolyte - ! sum_dum = sum_dum + G_MX(je)* - ! & alog(1./(1.+K_MX(je)*activity(je,ibin))) - ! enddo - ! sigma_soln(ibin) = sigma_water + 8.3144e7*T_K*sum_dum - - - ! simpler correlation for solution surface tension: - sigma_soln(ibin) = sigma_water + 49.0*(1. - aH2O_a(ibin)) ! [dyn/cm] - - - - term = 72.*sigma_soln(ibin)/(8.3144e7*T_K*DpmV(ibin)) ! [-] -! kelvin(ibin) = exp(term) - kelvin(ibin) = 1. + term*(1. + 0.5*term*(1. + term/3.)) - - - return - end subroutine calculate_kelvin - - - - !*********************************************************************** - ! computes sulfate ratio - ! - ! author: Rahul A. Zaveri - ! update: dec 1999 - !----------------------------------------------------------------------- - subroutine calculate_XT(ibin,jp,XT,aer) - use module_data_mosaic_aero, only: r8,naer,nbin_a_max, & - imsa_a,iso4_a,ica_a,ina_a,inh4_a - - implicit none - - ! subr arguments - integer, intent(in) :: ibin, jp - real(r8), intent(inout) :: XT - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - - - if( (aer(iso4_a,jp,ibin)+aer(imsa_a,jp,ibin)) .gt.0.0)then - XT = ( aer(inh4_a,jp,ibin) + & - aer(ina_a,jp,ibin) + & - 2.*aer(ica_a,jp,ibin) )/ & - (aer(iso4_a,jp,ibin)+0.5*aer(imsa_a,jp,ibin)) - else - XT = -1.0 - endif - - - return - end subroutine calculate_XT - - - - !*********************************************************************** - ! called when aerosol bin is completely solid. - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent, & - water_a) - - use module_data_mosaic_aero, only: r8,nbin_a_max,naer,nelectrolyte,jsolid, &!Parameters - jhyst_lo,jtotal,jliquid, &!Parameters - inh4_a,ino3_a,icl_a !TBD - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nbin_a_max) :: jphase,jhyst_leg - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte,epercent - ! local variables - integer iaer, je - - - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo ! lower curve - water_a(ibin) = 0.0 - - ! transfer aer(jtotal) to aer(jsolid) - do iaer = 1, naer - aer(iaer, jsolid, ibin) = aer(iaer,jtotal,ibin) - aer(iaer, jliquid,ibin) = 0.0 - enddo - - ! transfer electrolyte(jtotal) to electrolyte(jsolid) - do je = 1, nelectrolyte - electrolyte(je,jliquid,ibin) = 0.0 - epercent(je,jliquid,ibin) = 0.0 - electrolyte(je,jsolid,ibin) = electrolyte(je,jtotal,ibin) - epercent(je,jsolid,ibin) = epercent(je,jtotal,ibin) - enddo - - ! update aer(jtotal) that may have been affected above - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) - - - return - end subroutine adjust_solid_aerosol - - - - !*********************************************************************** - ! called when aerosol bin is completely liquid. - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine adjust_liquid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent) ! TOUCH - - use module_data_mosaic_aero, only: r8,nbin_a_max,naer,nelectrolyte,jliquid, &!Parameters - jhyst_up,jsolid,jtotal, &!Parameters - jcaco3,jcaso4,inh4_a,ina_a,ica_a,ico3_a,imsa_a,icl_a,ino3_a,iso4_a,ioc_a, &!TBD - ibc_a,iaro1_a,iaro2_a,ialk1_a,iole1_a,iapi1_a,iapi2_a,ilim1_a,ilim2_a, &!TBD - ioin_a !TBD - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nbin_a_max) :: jphase,jhyst_leg - - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - ! local variables - integer je - - jphase(ibin) = jliquid - jhyst_leg(ibin) = jhyst_up ! upper curve - - ! partition all electrolytes into liquid phase - do je = 1, nelectrolyte - electrolyte(je,jsolid,ibin) = 0.0 - epercent(je,jsolid,ibin) = 0.0 - electrolyte(je,jliquid,ibin) = electrolyte(je,jtotal,ibin) - epercent(je,jliquid,ibin) = epercent(je,jtotal,ibin) - enddo - ! except these electrolytes, which always remain in the solid phase - electrolyte(jcaco3,jsolid,ibin) = electrolyte(jcaco3,jtotal,ibin) - electrolyte(jcaso4,jsolid,ibin) = electrolyte(jcaso4,jtotal,ibin) - epercent(jcaco3,jsolid,ibin) = epercent(jcaco3,jtotal,ibin) - epercent(jcaso4,jsolid,ibin) = epercent(jcaso4,jtotal,ibin) - electrolyte(jcaco3,jliquid,ibin)= 0.0 - electrolyte(jcaso4,jliquid,ibin)= 0.0 - epercent(jcaco3,jliquid,ibin) = 0.0 - epercent(jcaso4,jliquid,ibin) = 0.0 - - - ! partition all the aer species into - ! solid phase - aer(iso4_a,jsolid,ibin) = electrolyte(jcaso4,jsolid,ibin) - aer(ino3_a,jsolid,ibin) = 0.0 - aer(icl_a,jsolid,ibin) = 0.0 - aer(inh4_a,jsolid,ibin) = 0.0 - aer(ioc_a,jsolid,ibin) = aer(ioc_a,jtotal,ibin) - aer(imsa_a,jsolid,ibin) = 0.0 - aer(ico3_a,jsolid,ibin) = aer(ico3_a,jtotal,ibin) - aer(ina_a,jsolid,ibin) = 0.0 - aer(ica_a,jsolid,ibin) = electrolyte(jcaco3,jsolid,ibin) + & - electrolyte(jcaso4,jsolid,ibin) - aer(ibc_a,jsolid,ibin) = aer(ibc_a,jtotal,ibin) - aer(ioin_a,jsolid,ibin) = aer(ioin_a,jtotal,ibin) - aer(iaro1_a,jsolid,ibin)= aer(iaro1_a,jtotal,ibin) - aer(iaro2_a,jsolid,ibin)= aer(iaro2_a,jtotal,ibin) - aer(ialk1_a,jsolid,ibin)= aer(ialk1_a,jtotal,ibin) - aer(iole1_a,jsolid,ibin)= aer(iole1_a,jtotal,ibin) - aer(iapi1_a,jsolid,ibin)= aer(iapi1_a,jtotal,ibin) - aer(iapi2_a,jsolid,ibin)= aer(iapi2_a,jtotal,ibin) - aer(ilim1_a,jsolid,ibin)= aer(ilim1_a,jtotal,ibin) - aer(ilim2_a,jsolid,ibin)= aer(ilim2_a,jtotal,ibin) - - ! liquid-phase - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jtotal,ibin) - & - aer(iso4_a,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = max(0.d0, aer(iso4_a,jliquid,ibin)) ! RAZ 4/16/2014 - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jtotal,ibin) - aer(icl_a,jliquid,ibin) = aer(icl_a,jtotal,ibin) - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jtotal,ibin) - aer(ioc_a,jliquid,ibin) = 0.0 - aer(imsa_a,jliquid,ibin) = aer(imsa_a,jtotal,ibin) - aer(ico3_a,jliquid,ibin) = 0.0 - aer(ina_a,jliquid,ibin) = aer(ina_a,jtotal,ibin) - aer(ica_a,jliquid,ibin) = aer(ica_a,jtotal,ibin) - & - aer(ica_a,jsolid,ibin) - aer(ica_a,jliquid,ibin) = max(0.d0, aer(ica_a,jliquid,ibin)) ! RAZ 4/16/2014 - aer(ibc_a,jliquid,ibin) = 0.0 - aer(ioin_a,jliquid,ibin) = 0.0 - aer(iaro1_a,jliquid,ibin)= 0.0 - aer(iaro2_a,jliquid,ibin)= 0.0 - aer(ialk1_a,jliquid,ibin)= 0.0 - aer(iole1_a,jliquid,ibin)= 0.0 - aer(iapi1_a,jliquid,ibin)= 0.0 - aer(iapi2_a,jliquid,ibin)= 0.0 - aer(ilim1_a,jliquid,ibin)= 0.0 - aer(ilim2_a,jliquid,ibin)= 0.0 - - return - end subroutine adjust_liquid_aerosol - - - - !*********************************************************************** - ! this subroutine completely deliquesces an aerosol and partitions - ! all the soluble electrolytes into the liquid phase and insoluble - ! ones into the solid phase. It also calculates the corresponding - ! aer(js,jliquid,ibin) and aer(js,jsolid,ibin) generic species - ! concentrations - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine do_full_deliquescence(ibin,aer,electrolyte) ! TOUCH - use module_data_mosaic_aero, only: r8,naer,nbin_a_max,nelectrolyte,jtotal,jsolid, &!Parameters - jliquid, &!Parameters - jcacl2,jcano3,ioin_a,jcaco3,jcaso4,inh4_a,ina_a,ica_a,ico3_a,imsa_a,icl_a, &!TBD - ino3_a,iso4_a,ioc_a,ibc_a,iaro1_a,iaro2_a,ialk1_a,iole1_a,iapi1_a,iapi2_a, &!TBD - ilim1_a,ilim2_a - - - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer :: js - - ! partition all electrolytes into liquid phase - do js = 1, nelectrolyte - electrolyte(js,jsolid,ibin) = 0.0 - electrolyte(js,jliquid,ibin) = electrolyte(js,jtotal,ibin) - enddo - ! - ! except these electrolytes, which always remain in the solid phase - electrolyte(jcaco3,jsolid,ibin) = electrolyte(jcaco3,jtotal,ibin) - electrolyte(jcaso4,jsolid,ibin) = electrolyte(jcaso4,jtotal,ibin) - electrolyte(jcaco3,jliquid,ibin)= 0.0 - electrolyte(jcaso4,jliquid,ibin)= 0.0 - - - ! partition all the generic aer species into solid and liquid phases - ! solid phase - aer(iso4_a,jsolid,ibin) = electrolyte(jcaso4,jsolid,ibin) - aer(ino3_a,jsolid,ibin) = 0.0 - aer(icl_a, jsolid,ibin) = 0.0 - aer(inh4_a,jsolid,ibin) = 0.0 - aer(ioc_a, jsolid,ibin) = aer(ioc_a,jtotal,ibin) - aer(imsa_a,jsolid,ibin) = 0.0 - aer(ico3_a,jsolid,ibin) = aer(ico3_a,jtotal,ibin) - aer(ina_a, jsolid,ibin) = 0.0 - aer(ica_a, jsolid,ibin) = electrolyte(jcaco3,jsolid,ibin) + & - electrolyte(jcaso4,jsolid,ibin) - aer(ibc_a, jsolid,ibin) = aer(ibc_a,jtotal,ibin) - aer(ioin_a,jsolid,ibin) = aer(ioin_a,jtotal,ibin) - aer(iaro1_a,jsolid,ibin)= aer(iaro1_a,jtotal,ibin) - aer(iaro2_a,jsolid,ibin)= aer(iaro2_a,jtotal,ibin) - aer(ialk1_a,jsolid,ibin)= aer(ialk1_a,jtotal,ibin) - aer(iole1_a,jsolid,ibin)= aer(iole1_a,jtotal,ibin) - aer(iapi1_a,jsolid,ibin)= aer(iapi1_a,jtotal,ibin) - aer(iapi2_a,jsolid,ibin)= aer(iapi2_a,jtotal,ibin) - aer(ilim1_a,jsolid,ibin)= aer(ilim1_a,jtotal,ibin) - aer(ilim2_a,jsolid,ibin)= aer(ilim2_a,jtotal,ibin) - - ! liquid-phase - aer(iso4_a,jliquid,ibin) = max(0.0_r8, aer(iso4_a,jtotal,ibin) - & - electrolyte(jcaso4,jsolid,ibin)) ! added max() RAZ 4/16/2014 - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jtotal,ibin) - aer(icl_a, jliquid,ibin) = aer(icl_a,jtotal,ibin) - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jtotal,ibin) - aer(ioc_a, jliquid,ibin) = 0.0 - aer(imsa_a,jliquid,ibin) = aer(imsa_a,jtotal,ibin) - aer(ico3_a,jliquid,ibin) = 0.0 - aer(ina_a, jliquid,ibin) = aer(ina_a,jtotal,ibin) - aer(ica_a, jliquid,ibin) = electrolyte(jcano3,jtotal,ibin) + & - electrolyte(jcacl2,jtotal,ibin) - aer(ibc_a, jliquid,ibin) = 0.0 - aer(ioin_a,jliquid,ibin) = 0.0 - aer(iaro1_a,jliquid,ibin)= 0.0 - aer(iaro2_a,jliquid,ibin)= 0.0 - aer(ialk1_a,jliquid,ibin)= 0.0 - aer(iole1_a,jliquid,ibin)= 0.0 - aer(iapi1_a,jliquid,ibin)= 0.0 - aer(iapi2_a,jliquid,ibin)= 0.0 - aer(ilim1_a,jliquid,ibin)= 0.0 - aer(ilim2_a,jliquid,ibin)= 0.0 - - return - end subroutine do_full_deliquescence - - - - !*********************************************************************** - ! MESA: Multicomponent Equilibrium Solver for Aerosol-phase - ! computes equilibrum solid and liquid phases by integrating - ! pseudo-transient dissolution and precipitation reactions - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - ! Reference: Zaveri R.A., R.C. Easter, and L.K. Peters, JGR, 2005b - !----------------------------------------------------------------------- - subroutine MESA_PTC(ibin, jaerosolstate, jphase, aer, jhyst_leg, & - electrolyte, epercent, activity, mc, num_a, mass_dry_a, mass_wet_a, mass_soluble_a, & - vol_dry_a, vol_wet_a, water_a, aH2O, ma, gam, & - log_gamZ, zc, za, gam_ratio, xeq_a, na_Ma, nc_Mc, xeq_c, mw_electrolyte, mw_aer_mac, & - dens_aer_mac, Keq_sl, MW_c, MW_a, Keq_ll, growth_factor, molality0, rtol_mesa, & - jsalt_present, phi_salt_old, & - kappa_nonelectro, mosaic_vars_aa ) ! TOUCH - - use module_data_mosaic_aero, only: r8, nbin_a_max, nelectrolyte, Ncation, naer, nsalt, &!Parameters - jhyst_lo, mixed, all_liquid, jsolid, jliquid, jtotal, mYES, &!Parameters - all_solid, Nanion, nrxn_aer_sl, nrxn_aer_ll, &!Parameters - ino3_a, iso4_a, ioc_a, ilim1_a, ilim2_a, inh4_a, ina_a, ica_a, ico3_a, imsa_a, icl_a, & - mosaic_vars_aa_type - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(in) :: aH2O,rtol_mesa - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_dry_a,mass_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: growth_factor - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,water_a,gam_ratio - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: epercent - real(r8), intent(inout), dimension(nsalt) :: phi_salt_old - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer iaer, iconverge, iconverge_flux, iconverge_mass, & - idissolved, itdum, js, je, jp - - real(r8) :: tau_p(nsalt), tau_d(nsalt) - real(r8) :: frac_solid, sumflux, hsalt_min, alpha, XT, dumdum, & - H_ion - real(r8) :: phi_prod, alpha_fac, sum_dum - real(r8) :: aer_H,hsalt_max - real(r8), dimension(nelectrolyte) :: eleliquid - real(r8), dimension(nbin_a_max) :: mass_dry_salt - real(r8), dimension(nsalt) :: phi_salt,flux_sl,phi_bar,alpha_salt - real(r8), dimension(nsalt) :: sat_ratio,hsalt - - ! function - !real(r8) :: aerosol_water - - ! initialize - itdum = 0 ! initialize time - hsalt_max = 1.e25 - - - - do js = 1, nsalt - hsalt(js) = 0.0 - sat_ratio(js) = 0.0 - phi_salt(js) = 0.0 - flux_sl(js) = 0.0 - enddo - - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do je = 1, nelectrolyte - sum_dum = sum_dum + electrolyte(je,jtotal,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - do je = 1, nelectrolyte - epercent(je,jtotal,ibin) = 100.*electrolyte(je,jtotal,ibin)/sum_dum - enddo - !! EFFI - - - - do js = 1, nsalt - jsalt_present(js) = 0 ! default value - salt absent - if(epercent(js,jtotal,ibin) .gt. 1.0)then - jsalt_present(js) = 1 ! salt present - endif - enddo - - - mass_dry_a(ibin) = 0.0 - - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - - do iaer = 1, naer - mass_dry_a(ibin) = mass_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer) ! [ng/m^3(air)] - vol_dry_a(ibin) = vol_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer)/dens_aer_mac(iaer) ! ncc/m^3(air) - enddo - mass_dry_a(ibin) = mass_dry_a(ibin) + aer_H - vol_dry_a(ibin) = vol_dry_a(ibin) + aer_H - - mass_dry_a(ibin) = mass_dry_a(ibin)*1.e-15 ! [g/cc(air)] - vol_dry_a(ibin) = vol_dry_a(ibin)*1.e-15 ! [cc(aer)/cc(air)] - - mass_dry_salt(ibin) = 0.0 ! soluble salts only - do je = 1, nsalt - mass_dry_salt(ibin) = mass_dry_salt(ibin) + & - electrolyte(je,jtotal,ibin)*mw_electrolyte(je)*1.e-15 ! g/cc(air) - enddo - - mosaic_vars_aa%jMESA_call = mosaic_vars_aa%jMESA_call + 1 - - !----begin pseudo time continuation loop------------------------------- - - do 500 itdum = 1, mosaic_vars_aa%Nmax_MESA - - - ! compute new salt fluxes - call MESA_flux_salt(ibin,jaerosolstate,jphase, aer,jhyst_leg,electrolyte, & - epercent,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,& - gam,log_gamZ,zc,za,gam_ratio,xeq_a,na_Ma,nc_Mc,xeq_c,mw_electrolyte, & - Keq_sl,MW_c,MW_a,Keq_ll,eleliquid,flux_sl,phi_salt,sat_ratio, & - molality0,jsalt_present,kappa_nonelectro) - - - ! check convergence - call MESA_convergence_criterion(ibin,iconverge_mass,iconverge_flux,idissolved, & - aer,electrolyte,mass_dry_salt,mw_electrolyte,flux_sl,phi_salt,rtol_mesa) - - if(iconverge_mass .eq. mYES)then - mosaic_vars_aa%iter_MESA(ibin) = mosaic_vars_aa%iter_MESA(ibin) + itdum - mosaic_vars_aa%niter_MESA = mosaic_vars_aa%niter_MESA + float(itdum) - mosaic_vars_aa%niter_MESA_max = max( mosaic_vars_aa%niter_MESA_max, itdum) - jaerosolstate(ibin) = all_solid - call adjust_solid_aerosol(ibin,jphase,aer,jhyst_leg,electrolyte,epercent, & - water_a) - jhyst_leg(ibin) = jhyst_lo - growth_factor(ibin) = 1.0 - return - elseif(iconverge_flux .eq. mYES)then - mosaic_vars_aa%iter_MESA(ibin) = mosaic_vars_aa%iter_MESA(ibin) + itdum - mosaic_vars_aa%niter_MESA = mosaic_vars_aa%niter_MESA + float(itdum) - mosaic_vars_aa%niter_MESA_max = max( mosaic_vars_aa%niter_MESA_max, itdum) - jaerosolstate(ibin) = mixed - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) - growth_factor(ibin) = mass_wet_a(ibin)/mass_dry_a(ibin) ! mass growth factor - - if(idissolved .eq. myes)then - jaerosolstate(ibin) = all_liquid - ! jhyst_leg(ibin) = jhyst_up ! ! do this later (to avoid tripping kelvin iterations) - else - jaerosolstate(ibin) = mixed - jhyst_leg(ibin) = jhyst_lo - endif - - ! calculate epercent(jsolid) composition in mixed-phase aerosol EFFI - !! sum_dum = 0.0 - !! jp = jsolid - !! do je = 1, nelectrolyte - !! electrolyte(je,jp,ibin) = max(0.d0,electrolyte(je,jp,ibin)) ! remove -ve - !! sum_dum = sum_dum + electrolyte(je,jp,ibin) - !! enddo - !! electrolyte_sum(jp,ibin) = sum_dum - !! if(sum_dum .eq. 0.)sum_dum = 1.0 - !! do je = 1, nelectrolyte - !! epercent(je,jp,ibin) = 100.*electrolyte(je,jp,ibin)/sum_dum - !! enddo - - return - endif - - ! calculate hsalt(js) ! time step - hsalt_min = 1.e25 - - do js = 1, nsalt - - phi_prod = phi_salt(js) * phi_salt_old(js) - - if(itdum .gt. 1 .and. phi_prod .gt. 0.0)then - phi_bar(js) = (abs(phi_salt(js))-abs(phi_salt_old(js)))/ & - alpha_salt(js) - else - phi_bar(js) = 0.0 ! oscillating, or phi_salt and/or phi_salt_old may be zero - endif - - if(phi_bar(js) .lt. 0.0)then ! good. phi getting lower. maybe able to take bigger alphas - phi_bar(js) = max(phi_bar(js), -10.0d0) - alpha_fac = 3.0*exp(phi_bar(js)) - alpha_salt(js) = min(alpha_fac*abs(phi_salt(js)), 0.9d0) - elseif(phi_bar(js) .gt. 0.0)then ! bad - phi is getting bigger. so be conservative with alpha - alpha_salt(js) = min(abs(phi_salt(js)), 0.5d0) - else ! very bad - phi is oscillating. be very conservative - alpha_salt(js) = min(abs(phi_salt(js))/3.0d0, 0.5d0) - endif - - ! alpha_salt(js) = max(alpha_salt(js), 0.01) - - phi_salt_old(js) = phi_salt(js) ! update old array - - - if(flux_sl(js) .gt. 0.)then - - tau_p(js) = eleliquid(js)/flux_sl(js) ! precipitation time scale - if(tau_p(js) .eq. 0.0)then - hsalt(js) = 1.e25 - flux_sl(js) = 0.0 - phi_salt(js)= 0.0 - else - hsalt(js) = alpha_salt(js)*tau_p(js) - endif - - elseif(flux_sl(js) .lt. 0.)then - - tau_p(js) = -eleliquid(js)/flux_sl(js) ! precipitation time scale - tau_d(js) = -electrolyte(js,jsolid,ibin)/flux_sl(js) ! dissolution time scale - if(tau_p(js) .eq. 0.0)then - hsalt(js) = alpha_salt(js)*tau_d(js) - else - hsalt(js) = alpha_salt(js)*min(tau_p(js),tau_d(js)) - endif - - else - - hsalt(js) = 1.e25 - - endif - - hsalt_min = min(hsalt(js), hsalt_min) - - enddo - - !--------------------------------- - - ! integrate electrolyte(solid) - do js = 1, nsalt - electrolyte(js,jsolid,ibin) = ( & - (electrolyte(js,jsolid,ibin)) + & - (hsalt(js)) * (flux_sl(js)) ) - enddo - - - ! compute aer(solid) from electrolyte(solid) - call electrolytes_to_ions(jsolid,ibin,aer,electrolyte) - - - ! compute new electrolyte(liquid) from mass balance - do iaer = 1, naer - aer(iaer,jliquid,ibin) = ( (aer(iaer,jtotal,ibin)) - & - (aer(iaer,jsolid,ibin)) ) - enddo - - !--------------------------------- - - - -500 continue ! end time continuation loop - !-------------------------------------------------------------------- - mosaic_vars_aa%jMESA_fail = mosaic_vars_aa%jMESA_fail + 1 - mosaic_vars_aa%iter_MESA(ibin) = mosaic_vars_aa%iter_MESA(ibin) + itdum - mosaic_vars_aa%niter_MESA = mosaic_vars_aa%niter_MESA + float(itdum) - jaerosolstate(ibin) = mixed - jhyst_leg(ibin) = jhyst_lo - mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) or m^3/m^3(air) - growth_factor(ibin) = mass_wet_a(ibin)/mass_dry_a(ibin) ! mass growth factor - - return - end subroutine MESA_PTC - - - - !*********************************************************************** - ! part of MESA: calculates solid-liquid fluxes of soluble salts - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine MESA_flux_salt(ibin, jaerosolstate,jphase,aer,jhyst_leg,electrolyte, & - epercent,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam, & - log_gamZ,zc,za,gam_ratio,xeq_a,na_Ma,nc_Mc,xeq_c,mw_electrolyte,Keq_sl,MW_c,& - MW_a,Keq_ll,eleliquid,flux_sl,phi_salt,sat_ratio,molality0,jsalt_present, & - kappa_nonelectro ) ! TOUCH - - use module_data_mosaic_aero, only: r8,nbin_a_max,nelectrolyte,Ncation,naer, &!Parameters - jliquid,nsalt,jsolid,Nanion,nrxn_aer_sl,nrxn_aer_ll,nrxn_aer_sl, &!Parameter - jna3hso4,ica_a,jcano3,jcacl2 !TBD - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nsalt) :: jsalt_present - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(in) :: aH2O - real(r8), intent(inout), dimension(nsalt) :: flux_sl,phi_salt,sat_ratio - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(inout), dimension(nbin_a_max) :: num_a,mass_dry_a,gam_ratio - real(r8), intent(inout), dimension(nbin_a_max) :: mass_soluble_a,water_a - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte) :: eleliquid - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_sl) :: Keq_sl - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte,epercent - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - ! local variables - integer js, je - real(r8) :: XT, calcium, sum_salt, sum_dum !**BALLI XT should it be subr arg?? - real(r8), dimension(nsalt) :: frac_salt_liq,frac_salt_solid - - - ! compute activities and water content - call ions_to_electrolytes(jliquid,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) - call compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg,electrolyte, & - activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam,log_gamZ, & - gam_ratio,Keq_ll,molality0,kappa_nonelectro) - activity(jna3hso4,ibin) = 0.0 - - if(water_a(ibin) .le. 0.0)then - do js = 1, nsalt - flux_sl(js) = 0.0 - enddo - return - endif - - - call MESA_estimate_eleliquid(ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma,nc_Mc, & - xeq_c,mw_electrolyte,MW_c,MW_a,eleliquid) - - calcium = aer(ica_a,jliquid,ibin) - - - - !! EFFI calculate percent composition - sum_dum = 0.0 - do je = 1, nelectrolyte - sum_dum = sum_dum + electrolyte(je,jliquid,ibin) - enddo - - if(sum_dum .eq. 0.)sum_dum = 1.0 - - do je = 1, nelectrolyte - epercent(je,jliquid,ibin) = 100.*electrolyte(je,jliquid,ibin)/sum_dum - enddo - !! EFFI - - - - ! calculate % electrolyte composition in the solid and liquid phases - sum_salt = 0.0 - do js = 1, nsalt - sum_salt = sum_salt + electrolyte(js,jsolid,ibin) - enddo - - if(sum_salt .eq. 0.0)sum_salt = 1.0 - do js = 1, nsalt - frac_salt_solid(js) = electrolyte(js,jsolid,ibin)/sum_salt - frac_salt_liq(js) = epercent(js,jliquid,ibin)/100. - enddo - - ! compute salt fluxes - do js = 1, nsalt ! soluble solid salts - - ! compute new saturation ratio - sat_ratio(js) = activity(js,ibin)/Keq_sl(js) - ! compute relative driving force - phi_salt(js) = (sat_ratio(js) - 1.0)/max(sat_ratio(js),1.0d0) - - ! check if too little solid-phase salt is trying to dissolve - if(sat_ratio(js) .lt. 1.00 .and. & - frac_salt_solid(js) .lt. 0.01 .and. & - frac_salt_solid(js) .gt. 0.0)then - call MESA_dissolve_small_salt(ibin,js,aer,electrolyte) - call MESA_estimate_eleliquid(ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a,eleliquid) - sat_ratio(js) = activity(js,ibin)/Keq_sl(js) - endif - - ! compute flux - flux_sl(js) = sat_ratio(js) - 1.0 - - ! apply Heaviside function - if( (sat_ratio(js) .lt. 1.0 .and. & - electrolyte(js,jsolid,ibin) .eq. 0.0) .or. & - (calcium .gt. 0.0 .and. frac_salt_liq(js).lt.0.01).or. & - (calcium .gt. 0.0 .and. jsalt_present(js).eq.0) )then - flux_sl(js) = 0.0 - phi_salt(js)= 0.0 - endif - - enddo - - - ! force cacl2 and cano3 fluxes to zero - sat_ratio(jcano3) = 1.0 - phi_salt(jcano3) = 0.0 - flux_sl(jcano3) = 0.0 - - sat_ratio(jcacl2) = 1.0 - phi_salt(jcacl2) = 0.0 - flux_sl(jcacl2) = 0.0 - - - return - end subroutine MESA_flux_salt - - !*********************************************************************** - ! computes activities - ! - ! author: Rahul A. Zaveri - ! update: jan 2007 - !----------------------------------------------------------------------- - subroutine compute_activities(ibin,jaerosolstate,jphase,aer,jhyst_leg, & - electrolyte,activity,mc,num_a,mass_dry_a,mass_soluble_a,water_a,aH2O,ma,gam,& - log_gamZ,gam_ratio,Keq_ll,molality0,kappa_nonelectro) - - use module_data_mosaic_aero, only: r8,nbin_a_max,nelectrolyte,Ncation,naer, & - jliquid,Nanion,nrxn_aer_ll, & - iso4_a,ja_so4,ja_hso4,ino3_a,ja_no3,icl_a,ja_cl,imsa_a,ja_msa,ica_a,jc_ca,& - inh4_a,jc_nh4,ina_a,jc_na,jc_h,jhcl,jhno3,jcacl2,jcano3,jnacl,jnano3, & - jna2so4,jnh4so4,jnh4cl,jnh4no3,jlvcite,jnh4hso4,jnh4msa,jna3hso4,jnahso4, & - jnamsa,jcamsa2,jh2so4,jhhso4,jmsa !TBD - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(in) :: aH2O - real(r8), intent(in), dimension(nbin_a_max) :: num_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a,mass_soluble_a - real(r8), intent(inout), dimension(nbin_a_max) :: water_a,gam_ratio - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(nelectrolyte,nelectrolyte) :: log_gamZ - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - ! local variables - real(r8), dimension(nelectrolyte) :: log_gam - integer jp, jA - real(r8) :: XT, xmol(Nelectrolyte), sum_elec, dumK, c_bal, a_c !BALLI** should xt be subr arg?? - real(r8) :: quad, aq, bq, cq, xq, dum, mSULF - !real(r8) :: aerosol_water ! mosaic function - - - water_a(ibin) = aerosol_water(jliquid,ibin,jaerosolstate,jphase, & - jhyst_leg,electrolyte,aer,kappa_nonelectro,num_a,mass_dry_a,mass_soluble_a,aH2O, & - molality0) ! Kg/m^3(air) - if(water_a(ibin) .eq. 0.0)return - - - call calculate_XT(ibin,jliquid,XT,aer) - - - if(XT.ge.2.0 .or. XT.lt.0.)then ! changed .gt. to .ge. RAZ 4/16/2014 - ! SULFATE POOR: fully dissociated electrolytes - - - ! anion molalities (mol/kg water) - ma(ja_so4,ibin) = 1.e-9*aer(iso4_a,jliquid,ibin)/water_a(ibin) - ma(ja_hso4,ibin) = 0.0 - ma(ja_no3,ibin) = 1.e-9*aer(ino3_a,jliquid,ibin)/water_a(ibin) - ma(ja_cl,ibin) = 1.e-9*aer(icl_a, jliquid,ibin)/water_a(ibin) - ma(ja_msa,ibin) = 1.e-9*aer(imsa_a,jliquid,ibin)/water_a(ibin) - - ! cation molalities (mol/kg water) - mc(jc_ca,ibin) = 1.e-9*aer(ica_a, jliquid,ibin)/water_a(ibin) - mc(jc_nh4,ibin) = 1.e-9*aer(inh4_a,jliquid,ibin)/water_a(ibin) - mc(jc_na,ibin) = 1.e-9*aer(ina_a, jliquid,ibin)/water_a(ibin) - a_c = ( & - (2.*ma(ja_so4,ibin)+ & - ma(ja_no3,ibin)+ & - ma(ja_cl,ibin) + & - ma(ja_msa,ibin)) - & - (2.*mc(jc_ca,ibin) + & - mc(jc_nh4,ibin)+ & - mc(jc_na,ibin)) ) - - mc(jc_h,ibin) = 0.5*( (a_c) + & - (sqrt(a_c**2 + 4.*Keq_ll(3))) ) - - if(mc(jc_h,ibin) .le. 0.0)then ! changed .eq. to .le. RAZ 4/16/2014 - mc(jc_h,ibin) = 1.e-10 - endif - - - jp = jliquid - - - sum_elec = 2.*electrolyte(jnh4no3,jp,ibin) + & - 2.*electrolyte(jnh4cl,jp,ibin) + & - 3.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jnano3,jp,ibin) + & - 2.*electrolyte(jnacl,jp,ibin) + & - 3.*electrolyte(jcano3,jp,ibin) + & - 3.*electrolyte(jcacl2,jp,ibin) + & - 2.*electrolyte(jhno3,jp,ibin) + & - 2.*electrolyte(jhcl,jp,ibin) - - if(sum_elec .eq. 0.0)then - do jA = 1, nelectrolyte - gam(jA,ibin) = 1.0 - enddo - goto 10 - endif - - - ! ionic mole fractions - xmol(jnh4no3) = 2.*electrolyte(jnh4no3,jp,ibin)/sum_elec - xmol(jnh4cl) = 2.*electrolyte(jnh4cl,jp,ibin) /sum_elec - xmol(jnh4so4) = 3.*electrolyte(jnh4so4,jp,ibin)/sum_elec - xmol(jna2so4) = 3.*electrolyte(jna2so4,jp,ibin)/sum_elec - xmol(jnano3) = 2.*electrolyte(jnano3,jp,ibin) /sum_elec - xmol(jnacl) = 2.*electrolyte(jnacl,jp,ibin) /sum_elec - xmol(jcano3) = 3.*electrolyte(jcano3,jp,ibin) /sum_elec - xmol(jcacl2) = 3.*electrolyte(jcacl2,jp,ibin) /sum_elec - xmol(jhno3) = 2.*electrolyte(jhno3,jp,ibin) /sum_elec - xmol(jhcl) = 2.*electrolyte(jhcl,jp,ibin) /sum_elec - - - jA = jnh4so4 - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jnh4so4,ibin) = mc(jc_nh4,ibin)**2 * ma(ja_so4,ibin) * & - gam(jnh4so4,ibin)**3 - endif - - - -! RAZ 11/7/2014 -! always calculate gam(jnh4no3), even if xmol(jnh4no3) = 0. this to calculate gam_ratio - jA = jnh4no3 -! if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jnh4no3,ibin) = mc(jc_nh4,ibin) * ma(ja_no3,ibin) * & - gam(jnh4no3,ibin)**2 -! endif - - - jA = jnh4cl - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jnh4cl,ibin) = mc(jc_nh4,ibin) * ma(ja_cl,ibin) * & - gam(jnh4cl,ibin)**2 - endif - - - jA = jna2so4 - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jna2so4,ibin) = mc(jc_na,ibin)**2 * ma(ja_so4,ibin) * & - gam(jna2so4,ibin)**3 - endif - - - jA = jnano3 - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jnano3,ibin) = mc(jc_na,ibin) * ma(ja_no3,ibin) * & - gam(jnano3,ibin)**2 - endif - - - - jA = jnacl - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jnacl,ibin) = mc(jc_na,ibin) * ma(ja_cl,ibin) * & - gam(jnacl,ibin)**2 - endif - - - - !c jA = jcano3 - !c if(xmol(jA).gt.0.0)then - !c gam(jA,ibin) = 1.0 - !c activity(jcano3,ibin) = 1.0 - !c endif - - - - !c jA = jcacl2 - !c if(xmol(jA).gt.0.0)then - !c gam(jA,ibin) = 1.0 - !c activity(jcacl2,ibin) = 1.0 - !c endif - - jA = jcano3 - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jcano3,ibin) = mc(jc_ca,ibin) * ma(ja_no3,ibin)**2 * & - gam(jcano3,ibin)**3 - endif - - - - jA = jcacl2 - if(xmol(jA).gt.0.0)then - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jcacl2,ibin) = mc(jc_ca,ibin) * ma(ja_cl,ibin)**2 * & - gam(jcacl2,ibin)**3 - endif - - - jA = jhno3 - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jhno3,ibin) = mc(jc_h,ibin) * ma(ja_no3,ibin) * & - gam(jhno3,ibin)**2 - - - jA = jhcl - log_gam(jA) = xmol(jnh4no3)*log_gamZ(jA,jnh4no3) + & - xmol(jnh4cl) *log_gamZ(jA,jnh4cl) + & - xmol(jnh4so4)*log_gamZ(jA,jnh4so4) + & - xmol(jna2so4)*log_gamZ(jA,jna2so4) + & - xmol(jnano3) *log_gamZ(jA,jnano3) + & - xmol(jnacl) *log_gamZ(jA,jnacl) + & - xmol(jcano3) *log_gamZ(jA,jcano3) + & - xmol(jcacl2) *log_gamZ(jA,jcacl2) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - activity(jhcl,ibin) = mc(jc_h,ibin) * ma(ja_cl,ibin) * & - gam(jhcl,ibin)**2 - - !---- -10 gam(jlvcite,ibin) = 1.0 - - gam(jnh4hso4,ibin)= 1.0 - - gam(jnh4msa,ibin) = 1.0 - - gam(jna3hso4,ibin) = 1.0 - - gam(jnahso4,ibin) = 1.0 - - gam(jnamsa,ibin) = 1.0 - - gam(jcamsa2,ibin) = 1.0 - - activity(jlvcite,ibin) = 0.0 - - activity(jnh4hso4,ibin)= 0.0 - - activity(jnh4msa,ibin) = mc(jc_nh4,ibin) * ma(ja_msa,ibin) * & - gam(jnh4msa,ibin)**2 - - activity(jna3hso4,ibin)= 0.0 - - activity(jnahso4,ibin) = 0.0 - - activity(jnamsa,ibin) = mc(jc_na,ibin) * ma(ja_msa,ibin) * & - gam(jnamsa,ibin)**2 - - activity(jcamsa2,ibin) = mc(jc_ca,ibin) * ma(ja_msa,ibin)**2 * & - gam(jcamsa2,ibin)**3 - - gam_ratio(ibin) = gam(jnh4no3,ibin)**2/gam(jhno3,ibin)**2 - - - else - ! SULFATE-RICH: solve for SO4= and HSO4- ions - - jp = jliquid - - sum_elec = 3.*electrolyte(jh2so4,jp,ibin) + & - 2.*electrolyte(jnh4hso4,jp,ibin) + & - 5.*electrolyte(jlvcite,jp,ibin) + & - 3.*electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jnahso4,jp,ibin) + & - 5.*electrolyte(jna3hso4,jp,ibin) + & - 3.*electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jhno3,jp,ibin) + & - 2.*electrolyte(jhcl,jp,ibin) - - - if(sum_elec .eq. 0.0)then - do jA = 1, nelectrolyte - gam(jA,ibin) = 1.0 - enddo - goto 20 - endif - - - xmol(jh2so4) = 3.*electrolyte(jh2so4,jp,ibin)/sum_elec - xmol(jnh4hso4)= 2.*electrolyte(jnh4hso4,jp,ibin)/sum_elec - xmol(jlvcite) = 5.*electrolyte(jlvcite,jp,ibin)/sum_elec - xmol(jnh4so4) = 3.*electrolyte(jnh4so4,jp,ibin)/sum_elec - xmol(jnahso4) = 2.*electrolyte(jnahso4,jp,ibin)/sum_elec - xmol(jna3hso4)= 5.*electrolyte(jna3hso4,jp,ibin)/sum_elec - xmol(jna2so4) = 3.*electrolyte(jna2so4,jp,ibin)/sum_elec - xmol(jhno3) = 2.*electrolyte(jhno3,jp,ibin)/sum_elec - xmol(jhcl) = 2.*electrolyte(jhcl,jp,ibin)/sum_elec - - - ! 2H.SO4 - jA = jh2so4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! H.HSO4 - jA = jhhso4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! NH4HSO4 - jA = jnh4hso4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! LETOVICITE - jA = jlvcite - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! (NH4)2SO4 - jA = jnh4so4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! NaHSO4 - jA = jnahso4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! Na3H(SO4)2 - jA = jna3hso4 - ! log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + - ! & xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ - ! & xmol(jlvcite) *log_gamZ(jA,jlvcite) + - ! & xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + - ! & xmol(jnahso4) *log_gamZ(jA,jnahso4) + - ! & xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ - ! & xmol(jna2so4) *log_gamZ(jA,jna2so4) + - ! & xmol(jhno3) *log_gamZ(jA,jhno3) + - ! & xmol(jhcl) *log_gamZ(jA,jhcl) - ! gam(jA,ibin) = 10.**log_gam(jA) - gam(jA,ibin) = 1.0 - - - ! Na2SO4 - jA = jna2so4 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! HNO3 - jA = jhno3 - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - - ! HCl - jA = jhcl - log_gam(jA) = xmol(jh2so4) *log_gamZ(jA,jh2so4) + & - xmol(jnh4hso4)*log_gamZ(jA,jnh4hso4)+ & - xmol(jlvcite) *log_gamZ(jA,jlvcite) + & - xmol(jnh4so4) *log_gamZ(jA,jnh4so4) + & - xmol(jnahso4) *log_gamZ(jA,jnahso4) + & - xmol(jna3hso4)*log_gamZ(jA,jna3hso4)+ & - xmol(jna2so4) *log_gamZ(jA,jna2so4) + & - xmol(jhno3) *log_gamZ(jA,jhno3) + & - xmol(jhcl) *log_gamZ(jA,jhcl) - gam(jA,ibin) = 10.**log_gam(jA) - - -20 gam(jnh4no3,ibin) = 1.0 - gam(jnh4cl,ibin) = 1.0 - gam(jnano3,ibin) = 1.0 - gam(jnacl,ibin) = 1.0 - gam(jcano3,ibin) = 1.0 - gam(jcacl2,ibin) = 1.0 - - gam(jnh4msa,ibin) = 1.0 - gam(jnamsa,ibin) = 1.0 - gam(jcamsa2,ibin) = 1.0 - - - - ! compute equilibrium pH - ! cation molalities (mol/kg water) - mc(jc_ca,ibin) = 1.e-9*aer(ica_a,jliquid,ibin)/water_a(ibin) - mc(jc_nh4,ibin) = 1.e-9*aer(inh4_a,jliquid,ibin)/water_a(ibin) - mc(jc_na,ibin) = 1.e-9*aer(ina_a, jliquid,ibin)/water_a(ibin) - - ! anion molalities (mol/kg water) - mSULF = 1.e-9*aer(iso4_a,jliquid,ibin)/water_a(ibin) - ma(ja_hso4,ibin) = 0.0 - ma(ja_so4,ibin) = 0.0 - ma(ja_no3,ibin) = 1.e-9*aer(ino3_a,jliquid,ibin)/water_a(ibin) - ma(ja_cl,ibin) = 1.e-9*aer(icl_a, jliquid,ibin)/water_a(ibin) - ma(ja_msa,ibin) = 1.e-9*aer(imsa_a,jliquid,ibin)/water_a(ibin) - - gam_ratio(ibin) = gam(jnh4hso4,ibin)**2/gam(jhhso4,ibin)**2 - dumK = Keq_ll(1)*gam(jhhso4,ibin)**2/gam(jh2so4,ibin)**3 - - c_bal = mc(jc_nh4,ibin) + mc(jc_na,ibin) + 2.*mc(jc_ca,ibin) & - - ma(ja_no3,ibin) - ma(ja_cl,ibin) - mSULF - ma(ja_msa,ibin) - - aq = 1.0 - bq = dumK + c_bal - cq = dumK*(c_bal - mSULF) - - - !--quadratic solution - if(bq .ne. 0.0)then - xq = 4.*(1./bq)*(cq/bq) - else - xq = 1.e+6 - endif - - if(abs(xq) .lt. 1.e-6)then - dum = xq*(0.5 + xq*(0.125 + xq*0.0625)) - quad = (-0.5*bq/aq)*dum - if(quad .lt. 0.)then - quad = -bq/aq - quad - endif - else - quad = 0.5*(-bq+sqrt(bq*bq - 4.*cq)) - endif - !--end of quadratic solution - - mc(jc_h,ibin) = max(quad, 1.d-7) - ma(ja_so4,ibin) = mSULF*dumK/(mc(jc_h,ibin) + dumK) - ma(ja_hso4,ibin)= mSULF - ma(ja_so4,ibin) - - activity(jcamsa2,ibin) = mc(jc_ca,ibin) * ma(ja_msa,ibin)**2 * & - gam(jcamsa2,ibin)**3 - - activity(jnh4so4,ibin) = mc(jc_nh4,ibin)**2 * ma(ja_so4,ibin) * & - gam(jnh4so4,ibin)**3 - - activity(jlvcite,ibin) = mc(jc_nh4,ibin)**3 * ma(ja_hso4,ibin) * & - ma(ja_so4,ibin) * gam(jlvcite,ibin)**5 - - activity(jnh4hso4,ibin)= mc(jc_nh4,ibin) * ma(ja_hso4,ibin) * & - gam(jnh4hso4,ibin)**2 - - activity(jnh4msa,ibin) = mc(jc_nh4,ibin) * ma(ja_msa,ibin) * & - gam(jnh4msa,ibin)**2 - - activity(jna2so4,ibin) = mc(jc_na,ibin)**2 * ma(ja_so4,ibin) * & - gam(jna2so4,ibin)**3 - - activity(jnahso4,ibin) = mc(jc_na,ibin) * ma(ja_hso4,ibin) * & - gam(jnahso4,ibin)**2 - - activity(jnamsa,ibin) = mc(jc_na,ibin) * ma(ja_msa,ibin) * & - gam(jnamsa,ibin)**2 - - ! activity(jna3hso4,ibin)= mc(jc_na,ibin)**3 * ma(ja_hso4,ibin) * - ! & ma(ja_so4,ibin) * gam(jna3hso4,ibin)**5 - - activity(jna3hso4,ibin)= 0.0 - - activity(jhno3,ibin) = mc(jc_h,ibin) * ma(ja_no3,ibin) * & - gam(jhno3,ibin)**2 - - activity(jhcl,ibin) = mc(jc_h,ibin) * ma(ja_cl,ibin) * & - gam(jhcl,ibin)**2 - - activity(jmsa,ibin) = mc(jc_h,ibin) * ma(ja_msa,ibin) * & - gam(jmsa,ibin)**2 - - - ! sulfate-poor species - activity(jnh4no3,ibin) = 0.0 - - activity(jnh4cl,ibin) = 0.0 - - activity(jnano3,ibin) = 0.0 - - activity(jnacl,ibin) = 0.0 - - activity(jcano3,ibin) = 0.0 - - activity(jcacl2,ibin) = 0.0 - - - endif - return - end subroutine compute_activities - - - - !*********************************************************************** - ! part of MESA: checks MESA convergence - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine MESA_convergence_criterion(ibin,iconverge_mass,iconverge_flux, & - idissolved,aer,electrolyte,mass_dry_salt,mw_electrolyte,flux_sl,phi_salt, & - rtol_mesa) ! TOUCH - - use module_data_mosaic_aero, only: r8,nbin_a_max,naer,nelectrolyte,nsalt, &!Parameters - jsolid,mYES, &!Parameters - mno,ioin_a,jcaso4,jcaco3 !TBD - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(inout) :: iconverge_mass, iconverge_flux, idissolved - real(r8), intent(in) :: rtol_mesa - real(r8), intent(inout), dimension(nsalt) :: flux_sl,phi_salt - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_salt - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer je, js, iaer - real(r8) :: mass_solid, mass_solid_salt,frac_solid, XT, H_ion, & - crustal_solids, sumflux - - - idissolved = mno ! default = not completely dissolved - - ! check mass convergence - iconverge_mass = mNO ! default value = no convergence - - ! call electrolytes_to_ions(jsolid,ibin,aer,electrolyte) - ! mass_solid = 0.0 - ! do iaer = 1, naer - ! mass_solid = mass_solid + - ! & aer(iaer,jsolid,ibin)*mw_aer_mac(iaer)*1.e-15 ! g/cc(air) - ! enddo - - mass_solid_salt = 0.0 - do je = 1, nsalt - mass_solid_salt = mass_solid_salt + & - electrolyte(je,jsolid,ibin)*mw_electrolyte(je)*1.e-15 ! g/cc(air) - enddo - - - - ! frac_solid = mass_solid/mass_dry_a(ibin) - - - if(mass_dry_salt(ibin) .le. 0.0)then - frac_solid = 0.0 - else - frac_solid = mass_solid_salt/mass_dry_salt(ibin) - endif - - - if(frac_solid .ge. 0.98)then - iconverge_mass = mYES - return - endif - - - - ! check relative driving force convergence - iconverge_flux = mYES - do js = 1, nsalt - if(abs(phi_salt(js)).gt. rtol_mesa)then - iconverge_flux = mNO - return - endif - enddo - - - - ! check if all the fluxes are zero - - sumflux = 0.0 - do js = 1, nsalt - sumflux = sumflux + abs(flux_sl(js)) - enddo - - crustal_solids = electrolyte(jcaco3,jsolid,ibin) + & - electrolyte(jcaso4,jsolid,ibin) + & - aer(ioin_a,jsolid,ibin) - - if(sumflux .eq. 0.0 .and. crustal_solids .eq. 0.0)then - idissolved = myes - endif - - - - return - end subroutine MESA_convergence_criterion - - - - !*********************************************************************** - ! computes ions from electrolytes - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine electrolytes_to_ions(jp,ibin,aer,electrolyte) - - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, &!Parameters - jh2so4,jnh4hso4,jlvcite,jnh4so4,jnahso4,jna3hso4,jna2so4,jcaso4,iso4_a, &!TBD - jhno3,jnh4no3,jcano3,jnano3,ino3_a,jhcl,jnh4cl,jcacl2,jnacl,icl_a,jmsa, &!TBD - jcamsa2,jnamsa,jnh4msa,imsa_a,jcaco3,ico3_a,ica_a,ina_a,inh4_a !TBD - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: sum_dum - - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - - aer(ino3_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - 2.*electrolyte(jcano3,jp,ibin) + & - electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jhno3,jp,ibin) - - aer(icl_a,jp,ibin) = electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jcacl2,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - electrolyte(jhcl,jp,ibin) - - aer(imsa_a,jp,ibin) = electrolyte(jnh4msa,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) + & - 2.*electrolyte(jcamsa2,jp,ibin) + & - electrolyte(jmsa,jp,ibin) - - aer(ico3_a,jp,ibin) = electrolyte(jcaco3,jp,ibin) - - aer(ica_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jcano3,jp,ibin) + & - electrolyte(jcacl2,jp,ibin) + & - electrolyte(jcaco3,jp,ibin) + & - electrolyte(jcamsa2,jp,ibin) - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - - return - end subroutine electrolytes_to_ions - - - - !*********************************************************************** - ! combinatorial method for computing electrolytes from ions - ! - ! notes: - ! - to be used for liquid-phase or total-phase only - ! - transfers caso4 and caco3 from liquid to solid phase - ! - ! author: Rahul A. Zaveri (based on code provided by A.S. Wexler) - ! update: apr 2005 - !----------------------------------------------------------------------- - subroutine ions_to_electrolytes(jp,ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a) - - use module_data_mosaic_aero, only: r8,naer,nbin_a_max,nelectrolyte,ncation, &!Parameters - nanion,jliquid,jsolid, &!Parameters - ica_a,iso4_a,jcaso4,imsa_a,ina_a,inh4_a,ja_hso4,ja_so4,ino3_a,ja_no3, & - icl_a,ja_cl,ja_msa,jc_ca,jc_na,jc_nh4,jc_h,jna2so4,jnahso4,jnamsa,jnano3, & - jnacl,jnh4so4,jnh4hso4,jnh4msa,jnh4no3,jnh4cl,jcano3,jcacl2,jcamsa2, & - jh2so4,jhno3,jhcl,jmsa,jlvcite,jna3hso4 !TBD - implicit none - - ! subr arguments - integer, intent(in) :: ibin, jp - real(r8), intent(inout) :: XT - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer iaer, je, jc, ja, icase - real(r8) :: store(naer), sum_dum, sum_naza, sum_nczc, sum_na_nh4, & - f_nh4, f_na, xh, xb, xl, xs, cat_net, rem_nh4, rem_na - real(r8) :: nc(ncation), na(nanion) - - - - - if(jp .ne. jliquid)then - write(6,*)' jp must be jliquid' - write(6,*)' in ions_to_electrolytes sub' - write(6,*)' wrong jp = ', jp - stop - endif - - ! remove negative concentrations, if any - ! do iaer = 1, naer - ! aer(iaer,jp,ibin) = max(0.0d0, aer(iaer,jp,ibin)) ! EFFI - ! enddo - - - ! first transfer caso4 from liquid to solid phase (caco3 should not be present here) - store(ica_a) = aer(ica_a, jp,ibin) - store(iso4_a) = aer(iso4_a,jp,ibin) - - call form_caso4(store,jp,ibin,electrolyte) - - if(jp .eq. jliquid)then ! transfer caso4 from liquid to solid phase - aer(ica_a,jliquid,ibin) = aer(ica_a,jliquid,ibin) - & - electrolyte(jcaso4,jliquid,ibin) - - aer(iso4_a,jliquid,ibin)= aer(iso4_a,jliquid,ibin)- & - electrolyte(jcaso4,jliquid,ibin) - - aer(ica_a,jsolid,ibin) = aer(ica_a,jsolid,ibin) + & - electrolyte(jcaso4,jliquid,ibin) - - aer(iso4_a,jsolid,ibin) = aer(iso4_a,jsolid,ibin) + & - electrolyte(jcaso4,jliquid,ibin) - - electrolyte(jcaso4,jsolid,ibin)=electrolyte(jcaso4,jsolid,ibin) & - +electrolyte(jcaso4,jliquid,ibin) - electrolyte(jcaso4,jliquid,ibin)= 0.0 - endif - - - ! calculate sulfate ratio - ! call calculate_XT(ibin,jp,XT,aer) ! EFFI - - if( (aer(iso4_a,jp,ibin)+aer(imsa_a,jp,ibin)) .gt.0.0)then - XT = ( aer(inh4_a,jp,ibin) + & - aer(ina_a,jp,ibin) + & - 2.*aer(ica_a,jp,ibin) )/ & - (aer(iso4_a,jp,ibin)+0.5*aer(imsa_a,jp,ibin)) - else - XT = -1.0 - endif - - - - -! if(XT.ge.1.9999 .or. XT.lt.0.)then ! commented out by RAZ 4/16/2014 - if(XT.ge.2.0 .or. XT.lt.0.)then ! Slightly different logic, consistent with that in compute_activities subr. RAZ 4/16/2014 - icase = 1 ! sulfate poor: near neutral (acidity is caused by HCl and/or HNO3) - else - icase = 2 ! sulfate rich: acidic (acidity is caused by excess SO4) - endif - - - ! initialize to zero - do je = 1, nelectrolyte - electrolyte(je,jp,ibin) = 0.0 - enddo - - ! - !--------------------------------------------------------- - ! initialize moles of ions depending on the sulfate domain - - if(icase.eq.1)then ! XT >= 2 or XT < 0: SULFATE POOR (OR NO SULFATE) DOMAIN. RAZ 4/16/2014 - - na(ja_hso4)= 0.0 - na(ja_so4) = aer(iso4_a,jp,ibin) - na(ja_no3) = aer(ino3_a,jp,ibin) - na(ja_cl) = aer(icl_a, jp,ibin) - na(ja_msa) = aer(imsa_a,jp,ibin) - - nc(jc_ca) = aer(ica_a, jp,ibin) - nc(jc_na) = aer(ina_a, jp,ibin) - nc(jc_nh4) = aer(inh4_a,jp,ibin) - - cat_net = ( & - (2.*na(ja_so4)+na(ja_no3)+na(ja_cl)+na(ja_msa)) - & - (2.*nc(jc_ca) +nc(jc_nh4)+nc(jc_na)) ) - - if(cat_net .lt. 0.0)then - - nc(jc_h) = 0.0 - - else ! cat_net must be 0.0 or positive - - nc(jc_h) = cat_net - - endif - - - ! now compute equivalent fractions - sum_naza = 0.0 - do ja = 1, nanion - sum_naza = sum_naza + na(ja)*za(ja) - enddo - - sum_nczc = 0.0 - do jc = 1, ncation - sum_nczc = sum_nczc + nc(jc)*zc(jc) - enddo - - if(sum_naza .eq. 0. .or. sum_nczc .eq. 0.)then ! it's ok. this may happen if the aerosol is assumed to be composed of hygroscopic SOA, POA, BC, OIN, but does not contain any inorganic electrolytes -! write(6,*)'ionic concentrations are zero in ibin', ibin ! commented out by RAZ 4/16/2014 -! write(6,*)'sum_naza = ', sum_naza ! commented out by RAZ 4/16/2014 -! write(6,*)'sum_nczc = ', sum_nczc ! commented out by RAZ 4/16/2014 - return - endif - - do ja = 1, nanion - xeq_a(ja) = na(ja)*za(ja)/sum_naza - enddo - - do jc = 1, ncation - xeq_c(jc) = nc(jc)*zc(jc)/sum_nczc - enddo - - na_Ma(ja_so4) = na(ja_so4) *MW_a(ja_so4) - na_Ma(ja_no3) = na(ja_no3) *MW_a(ja_no3) - na_Ma(ja_cl) = na(ja_cl) *MW_a(ja_cl) - na_Ma(ja_msa) = na(ja_msa) *MW_a(ja_msa) - na_Ma(ja_hso4)= na(ja_hso4)*MW_a(ja_hso4) - - nc_Mc(jc_ca) = nc(jc_ca) *MW_c(jc_ca) - nc_Mc(jc_na) = nc(jc_na) *MW_c(jc_na) - nc_Mc(jc_nh4) = nc(jc_nh4)*MW_c(jc_nh4) - nc_Mc(jc_h) = nc(jc_h) *MW_c(jc_h) - - - ! now compute electrolyte moles - if(xeq_c(jc_na) .gt. 0. .and. xeq_a(ja_so4) .gt. 0.)then - electrolyte(jna2so4,jp,ibin) = (xeq_c(jc_na) *na_Ma(ja_so4) + & - xeq_a(ja_so4)*nc_Mc(jc_na))/ & - mw_electrolyte(jna2so4) - endif - - electrolyte(jnahso4,jp,ibin) = 0.0 - - if(xeq_c(jc_na) .gt. 0. .and. xeq_a(ja_msa) .gt. 0.)then - electrolyte(jnamsa,jp,ibin) = (xeq_c(jc_na) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_na))/ & - mw_electrolyte(jnamsa) - endif - - if(xeq_c(jc_na) .gt. 0. .and. xeq_a(ja_no3) .gt. 0.)then - electrolyte(jnano3,jp,ibin) = (xeq_c(jc_na) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_na))/ & - mw_electrolyte(jnano3) - endif - - if(xeq_c(jc_na) .gt. 0. .and. xeq_a(ja_cl) .gt. 0.)then - electrolyte(jnacl,jp,ibin) = (xeq_c(jc_na) *na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_na))/ & - mw_electrolyte(jnacl) - endif - - if(xeq_c(jc_nh4) .gt. 0. .and. xeq_a(ja_so4) .gt. 0.)then - electrolyte(jnh4so4,jp,ibin) = (xeq_c(jc_nh4)*na_Ma(ja_so4) + & - xeq_a(ja_so4)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4so4) - endif - - electrolyte(jnh4hso4,jp,ibin)= 0.0 - - if(xeq_c(jc_nh4) .gt. 0. .and. xeq_a(ja_msa) .gt. 0.)then - electrolyte(jnh4msa,jp,ibin) = (xeq_c(jc_nh4)*na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4msa) - endif - - if(xeq_c(jc_nh4) .gt. 0. .and. xeq_a(ja_no3) .gt. 0.)then - electrolyte(jnh4no3,jp,ibin) = (xeq_c(jc_nh4)*na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4no3) - endif - - if(xeq_c(jc_nh4) .gt. 0. .and. xeq_a(ja_cl) .gt. 0.)then - electrolyte(jnh4cl,jp,ibin) = (xeq_c(jc_nh4)*na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4cl) - endif - - if(xeq_c(jc_ca) .gt. 0. .and. xeq_a(ja_no3) .gt. 0.0)then - electrolyte(jcano3, jp,ibin) = (xeq_c(jc_ca) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_ca))/ & - mw_electrolyte(jcano3) - endif - - if(xeq_c(jc_ca) .gt. 0. .and. xeq_a(ja_cl) .gt. 0.)then - electrolyte(jcacl2,jp,ibin) = (xeq_c(jc_ca) *na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_ca))/ & - mw_electrolyte(jcacl2) - endif - - if(xeq_c(jc_ca) .gt. 0. .and. xeq_a(ja_msa) .gt. 0.)then - electrolyte(jcamsa2,jp,ibin) = (xeq_c(jc_ca) *na_Ma(ja_msa) + & - xeq_a(ja_msa) *nc_Mc(jc_ca))/ & - mw_electrolyte(jcamsa2) - endif - - electrolyte(jh2so4, jp,ibin) = 0.0 - - if(xeq_c(jc_h) .gt. 0. .and. xeq_a(ja_no3) .gt. 0.)then - electrolyte(jhno3,jp,ibin) = (xeq_c(jc_h) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_h))/ & - mw_electrolyte(jhno3) - endif - - if(xeq_c(jc_h) .gt. 0. .and. xeq_a(ja_cl) .gt. 0.)then - electrolyte(jhcl,jp,ibin) = (xeq_c(jc_h) *na_Ma(ja_cl) + & - xeq_a(ja_cl)*nc_Mc(jc_h))/ & - mw_electrolyte(jhcl) - endif - - if(xeq_c(jc_h) .gt. 0. .and. xeq_a(ja_msa) .gt. 0.)then - electrolyte(jmsa,jp,ibin) = (xeq_c(jc_h) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_h))/ & - mw_electrolyte(jmsa) - endif - - !-------------------------------------------------------------------- - - elseif(icase.eq.2)then ! XT < 2 : SULFATE RICH DOMAIN - - store(imsa_a) = aer(imsa_a,jp,ibin) - store(ica_a) = aer(ica_a, jp,ibin) - - call form_camsa2(store,jp,ibin,electrolyte) - - sum_na_nh4 = aer(ina_a,jp,ibin) + aer(inh4_a,jp,ibin) - - if(sum_na_nh4 .gt. 0.0)then - f_na = aer(ina_a,jp,ibin)/sum_na_nh4 - f_nh4 = aer(inh4_a,jp,ibin)/sum_na_nh4 - else - f_na = 0.0 - f_nh4 = 0.0 - endif - - ! first form msa electrolytes - if(sum_na_nh4 .gt. store(imsa_a))then - electrolyte(jnamsa,jp,ibin) = f_na *store(imsa_a) - electrolyte(jnh4msa,jp,ibin) = f_nh4*store(imsa_a) - rem_na = max(0.0_r8, aer(ina_a,jp,ibin) - electrolyte(jnamsa,jp,ibin)) ! remaining na RAZ 4/16/2014 - rem_nh4= max(0.0_r8, aer(inh4_a,jp,ibin)- electrolyte(jnh4msa,jp,ibin)) ! remaining nh4 RAZ 4/16/2014 - else - electrolyte(jnamsa,jp,ibin) = aer(ina_a,jp,ibin) - electrolyte(jnh4msa,jp,ibin) = aer(inh4_a,jp,ibin) - electrolyte(jmsa,jp,ibin) = max(0.0_r8, store(imsa_a) - sum_na_nh4) ! RAZ 4/16/2014 - rem_nh4 = 0.0 ! remaining nh4 - rem_na = 0.0 ! remaining na - endif - - - ! recompute XT - if(aer(iso4_a,jp,ibin).gt.0.0)then - XT = (rem_nh4 + rem_na)/aer(iso4_a,jp,ibin) - else - goto 10 - endif - - if(XT .le. 1.0)then ! h2so4 + bisulfate - xh = max(0.0_r8, (1.0_r8 - XT)) ! RAZ 4/16/2014 - xb = XT - electrolyte(jh2so4,jp,ibin) = xh*aer(iso4_a,jp,ibin) - electrolyte(jnh4hso4,jp,ibin) = xb*f_nh4*aer(iso4_a,jp,ibin) - electrolyte(jnahso4,jp,ibin) = xb*f_na *aer(iso4_a,jp,ibin) - elseif(XT .le. 1.5)then ! bisulfate + letovicite - xb = max(0.0_r8, 3.0_r8 - 2.0_r8*XT) ! RAZ 4/16/2014 - xl = max(0.0_r8, XT - 1.0_r8) ! RAZ 4/16/2014 - electrolyte(jnh4hso4,jp,ibin) = xb*f_nh4*aer(iso4_a,jp,ibin) - electrolyte(jnahso4,jp,ibin) = xb*f_na *aer(iso4_a,jp,ibin) - electrolyte(jlvcite,jp,ibin) = xl*f_nh4*aer(iso4_a,jp,ibin) - electrolyte(jna3hso4,jp,ibin) = xl*f_na *aer(iso4_a,jp,ibin) - else ! letovicite + sulfate - xl = max(0.0_r8, 2.0_r8 - XT) ! RAZ 4/16/2014 - xs = max(0.0_r8, 2.0_r8*XT - 3.0_r8) ! RAZ 4/16/2014 - electrolyte(jlvcite,jp,ibin) = xl*f_nh4*aer(iso4_a,jp,ibin) - electrolyte(jna3hso4,jp,ibin) = xl*f_na *aer(iso4_a,jp,ibin) - electrolyte(jnh4so4,jp,ibin) = xs*f_nh4*aer(iso4_a,jp,ibin) - electrolyte(jna2so4,jp,ibin) = xs*f_na *aer(iso4_a,jp,ibin) - endif - - electrolyte(jhno3,jp,ibin) = aer(ino3_a,jp,ibin) - electrolyte(jhcl,jp,ibin) = aer(icl_a,jp,ibin) - - endif - !--------------------------------------------------------- - ! - ! calculate % composition EFFI -10 sum_dum = 0.0 - !! do je = 1, nelectrolyte - !! sum_dum = sum_dum + electrolyte(je,jp,ibin) - !! enddo - !! - !! if(sum_dum .eq. 0.)sum_dum = 1.0 - !! electrolyte_sum(jp,ibin) = sum_dum - !! - !! do je = 1, nelectrolyte - !! epercent(je,jp,ibin) = 100.*electrolyte(je,jp,ibin)/sum_dum - !! enddo - !! - - return - end subroutine ions_to_electrolytes - - - - !*********************************************************************** - ! part of MESA: calculates liquid electrolytes from ions - ! - ! notes: - ! - this subroutine is to be used for liquid-phase or total-phase only - ! - this sub transfers caso4 and caco3 from liquid to solid phase - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine MESA_estimate_eleliquid(ibin,XT,aer,electrolyte,zc,za,xeq_a,na_Ma, & - nc_Mc,xeq_c,mw_electrolyte,MW_c,MW_a,eleliquid) ! TOUCH - use module_data_mosaic_aero, only: r8,naer,nbin_a_max,nelectrolyte,ncation, &!Parameters - nanion,jliquid, &!Parameters - jh2so4,jhno3,jhcl,jmsa,jlvcite,jnh4no3,jnh4cl,jcamsa2,jcano3,jcacl2, & - jnano3,jnacl,jnh4so4,jnh4hso4,jnh4msa,jna2so4,jnahso4,jnamsa,iso4_a, & - ja_so4,ja_no3,ja_cl,imsa_a,ja_msa,jc_ca,ina_a,jc_na,inh4_a,jc_nh4,jc_h, & - ica_a,ino3_a,icl_a,ja_hso4 - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout) :: XT - real(r8), intent(in), dimension(Ncation) :: zc,MW_c - real(r8), intent(inout), dimension(Ncation) :: nc_Mc,xeq_c - real(r8), intent(in), dimension(Nanion) :: za,MW_a - real(r8), intent(inout), dimension(Nanion) :: xeq_a,na_Ma - real(r8), intent(in), dimension(nelectrolyte) :: mw_electrolyte - real(r8), intent(inout), dimension(nelectrolyte) :: eleliquid - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer iaer, je, jc, ja, icase, jp - real(r8) :: store(naer), sum_dum, sum_naza, sum_nczc, sum_na_nh4, & - f_nh4, f_na, xh, xb, xl, xs, XT_d, XNa_d, XNH4_d, & - xdum, dum, cat_net - real(r8) :: nc(ncation), na(nanion) - real(r8) :: dum_ca, dum_no3, dum_cl, cano3, cacl2 - - !nc(:) = 0.0_r8!BSINGH - initialized to zero - - ! remove negative concentrations, if any - do iaer = 1, naer - aer(iaer,jliquid,ibin) = max(0.0d0, aer(iaer,jliquid,ibin)) - enddo - - - ! calculate sulfate ratio - call calculate_XT(ibin,jliquid,XT,aer) - - if(XT .ge. 2.0 .or. XT.lt.0.)then - icase = 1 ! near neutral (acidity is caused by HCl and/or HNO3) - else - icase = 2 ! acidic (acidity is caused by excess SO4) - endif - - - ! initialize to zero - do je = 1, nelectrolyte - eleliquid(je) = 0.0 - enddo - - ! - !--------------------------------------------------------- - ! initialize moles of ions depending on the sulfate domain - - jp = jliquid - - if(icase.eq.1)then ! XT >= 2 : SULFATE POOR DOMAIN - - dum_ca = aer(ica_a,jp,ibin) - dum_no3 = aer(ino3_a,jp,ibin) - dum_cl = aer(icl_a,jp,ibin) - - cano3 = min(dum_ca, 0.5*dum_no3) - dum_ca = max(0.d0, dum_ca - cano3) - dum_no3 = max(0.d0, dum_no3 - 2.*cano3) - - cacl2 = min(dum_ca, 0.5*dum_cl) - dum_ca = max(0.d0, dum_ca - cacl2) - dum_cl = max(0.d0, dum_cl - 2.*cacl2) - - na(ja_hso4)= 0.0 - na(ja_so4) = aer(iso4_a,jp,ibin) - na(ja_no3) = aer(ino3_a,jp,ibin) - na(ja_cl) = aer(icl_a, jp,ibin) - na(ja_msa) = aer(imsa_a,jp,ibin) - - nc(jc_ca) = aer(ica_a, jp,ibin) - nc(jc_na) = aer(ina_a, jp,ibin) - nc(jc_nh4) = aer(inh4_a,jp,ibin) - - cat_net = ( & - (2.*na(ja_so4)+na(ja_no3)+na(ja_cl)+na(ja_msa)) - & - (2.*nc(jc_ca) +nc(jc_nh4)+nc(jc_na)) ) ! RAZ 11/11/2014: bug fix. remove nc(jc_h) - - if(cat_net .lt. 0.0)then - - nc(jc_h) = 0.0 - - else ! cat_net must be 0.0 or positive - - nc(jc_h) = cat_net - - endif - - - ! now compute equivalent fractions - sum_naza = 0.0 - do ja = 1, nanion - sum_naza = sum_naza + na(ja)*za(ja) - enddo - - sum_nczc = 0.0 - do jc = 1, ncation - sum_nczc = sum_nczc + nc(jc)*zc(jc) - enddo - - if(sum_naza .eq. 0. .or. sum_nczc .eq. 0.)then - write(6,*)'ionic concentrations are zero in ibin', ibin - write(6,*)'sum_naza = ', sum_naza - write(6,*)'sum_nczc = ', sum_nczc - return - endif - - do ja = 1, nanion - xeq_a(ja) = na(ja)*za(ja)/sum_naza - enddo - - do jc = 1, ncation - xeq_c(jc) = nc(jc)*zc(jc)/sum_nczc - enddo - - na_Ma(ja_so4) = na(ja_so4) *MW_a(ja_so4) - na_Ma(ja_no3) = na(ja_no3) *MW_a(ja_no3) - na_Ma(ja_cl) = na(ja_cl) *MW_a(ja_cl) - na_Ma(ja_hso4)= na(ja_hso4)*MW_a(ja_hso4) - na_Ma(ja_msa) = na(ja_msa) *MW_a(ja_msa) - - nc_Mc(jc_ca) = nc(jc_ca) *MW_c(jc_ca) - nc_Mc(jc_na) = nc(jc_na) *MW_c(jc_na) - nc_Mc(jc_nh4) = nc(jc_nh4)*MW_c(jc_nh4) - nc_Mc(jc_h) = nc(jc_h) *MW_c(jc_h) - - - ! now compute electrolyte moles - eleliquid(jna2so4) = (xeq_c(jc_na) *na_Ma(ja_so4) + & - xeq_a(ja_so4)*nc_Mc(jc_na))/ & - mw_electrolyte(jna2so4) - - eleliquid(jnahso4) = (xeq_c(jc_na) *na_Ma(ja_hso4) + & - xeq_a(ja_hso4)*nc_Mc(jc_na))/ & - mw_electrolyte(jnahso4) - - eleliquid(jnamsa) = (xeq_c(jc_na) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_na))/ & - mw_electrolyte(jnamsa) - - eleliquid(jnano3) = (xeq_c(jc_na) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_na))/ & - mw_electrolyte(jnano3) - - eleliquid(jnacl) = (xeq_c(jc_na) *na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_na))/ & - mw_electrolyte(jnacl) - - eleliquid(jnh4so4) = (xeq_c(jc_nh4)*na_Ma(ja_so4) + & - xeq_a(ja_so4)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4so4) - - eleliquid(jnh4hso4)= (xeq_c(jc_nh4)*na_Ma(ja_hso4) + & - xeq_a(ja_hso4)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4hso4) - - eleliquid(jnh4msa) = (xeq_c(jc_nh4) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4msa) - - eleliquid(jnh4no3) = (xeq_c(jc_nh4)*na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4no3) - - eleliquid(jnh4cl) = (xeq_c(jc_nh4)*na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_nh4))/ & - mw_electrolyte(jnh4cl) - - eleliquid(jcamsa2) = (xeq_c(jc_ca) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_ca))/ & - mw_electrolyte(jcamsa2) - - eleliquid(jcano3) = (xeq_c(jc_ca) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_ca))/ & - mw_electrolyte(jcano3) - - eleliquid(jcacl2) = (xeq_c(jc_ca) *na_Ma(ja_cl) + & - xeq_a(ja_cl) *nc_Mc(jc_ca))/ & - mw_electrolyte(jcacl2) - - eleliquid(jh2so4) = (xeq_c(jc_h) *na_Ma(ja_hso4) + & - xeq_a(ja_hso4)*nc_Mc(jc_h))/ & - mw_electrolyte(jh2so4) - - eleliquid(jhno3) = (xeq_c(jc_h) *na_Ma(ja_no3) + & - xeq_a(ja_no3)*nc_Mc(jc_h))/ & - mw_electrolyte(jhno3) - - eleliquid(jhcl) = (xeq_c(jc_h) *na_Ma(ja_cl) + & - xeq_a(ja_cl)*nc_Mc(jc_h))/ & - mw_electrolyte(jhcl) - - eleliquid(jmsa) = (xeq_c(jc_h) *na_Ma(ja_msa) + & - xeq_a(ja_msa)*nc_Mc(jc_h))/ & - mw_electrolyte(jmsa) - - !-------------------------------------------------------------------- - - elseif(icase.eq.2)then ! XT < 2 : SULFATE RICH DOMAIN - - jp = jliquid - - store(iso4_a) = aer(iso4_a,jp,ibin) - store(imsa_a) = aer(imsa_a,jp,ibin) - store(inh4_a) = aer(inh4_a,jp,ibin) - store(ina_a) = aer(ina_a, jp,ibin) - store(ica_a) = aer(ica_a, jp,ibin) - - call form_camsa2(store,jp,ibin,electrolyte) - - sum_na_nh4 = store(ina_a) + store(inh4_a) - if(sum_na_nh4 .gt. 0.0)then - f_nh4 = store(inh4_a)/sum_na_nh4 - f_na = store(ina_a)/sum_na_nh4 - else - f_nh4 = 0.0 - f_na = 0.0 - endif - - ! first form msa electrolytes - if(sum_na_nh4 .gt. store(imsa_a))then - eleliquid(jnh4msa) = f_nh4*store(imsa_a) - eleliquid(jnamsa) = f_na *store(imsa_a) - store(inh4_a)= store(inh4_a)-eleliquid(jnh4msa) ! remaining nh4 - store(ina_a) = store(ina_a) -eleliquid(jnamsa) ! remaining na - else - eleliquid(jnh4msa) = store(inh4_a) - eleliquid(jnamsa) = store(ina_a) - eleliquid(jmsa) = store(imsa_a) - sum_na_nh4 - store(inh4_a)= 0.0 ! remaining nh4 - store(ina_a) = 0.0 ! remaining na - endif - - if(store(iso4_a).eq.0.0)goto 10 - - XT_d = XT - XNa_d = 1. + 0.5*store(ina_a)/store(iso4_a) - xdum = store(iso4_a) - store(inh4_a) - - dum = ( (2.*store(iso4_a)) - & - (store(ina_a)) ) - if(store(inh4_a) .gt. 0.0 .and. dum .gt. 0.0)then - XNH4_d = 2.*store(inh4_a)/ & - (2.*store(iso4_a) - store(ina_a)) - else - XNH4_d = 0.0 - endif - - - IF(store(inh4_a) .gt. 0.0)THEN - if(XT_d .ge. XNa_d)then - eleliquid(jna2so4) = 0.5*store(ina_a) - - if(XNH4_d .ge. 5./3.)then - eleliquid(jnh4so4) = 1.5*store(ina_a) & - - 3.*xdum - store(inh4_a) - eleliquid(jlvcite) = 2.*xdum + store(inh4_a) & - - store(ina_a) - elseif(XNH4_d .ge. 1.5)then - eleliquid(jnh4so4) = store(inh4_a)/5. - eleliquid(jlvcite) = store(inh4_a)/5. - elseif(XNH4_d .ge. 1.0)then - eleliquid(jnh4so4) = store(inh4_a)/6. - eleliquid(jlvcite) = store(inh4_a)/6. - eleliquid(jnh4hso4)= store(inh4_a)/6. - endif - - elseif(XT_d .gt. 1.0)then - eleliquid(jnh4so4) = store(inh4_a)/6. - eleliquid(jlvcite) = store(inh4_a)/6. - eleliquid(jnh4hso4) = store(inh4_a)/6. - eleliquid(jna2so4) = store(ina_a)/3. - eleliquid(jnahso4) = store(ina_a)/3. - elseif(XT_d .le. 1.0)then - eleliquid(jna2so4) = store(ina_a)/4. - eleliquid(jnahso4) = store(ina_a)/2. - eleliquid(jlvcite) = store(inh4_a)/6. - eleliquid(jnh4hso4) = store(inh4_a)/2. - endif - - ELSE - - if(XT_d .gt. 1.0)then - eleliquid(jna2so4) = store(ina_a) - store(iso4_a) - eleliquid(jnahso4) = 2.*store(iso4_a) - & - store(ina_a) - else - eleliquid(jna2so4) = store(ina_a)/4. - eleliquid(jnahso4) = store(ina_a)/2. - endif - - - ENDIF - - - - endif - !--------------------------------------------------------- - - -10 return - end subroutine MESA_estimate_eleliquid - - - - !*********************************************************************** - ! part of MESA: completely dissolves small amounts of soluble salts - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine MESA_dissolve_small_salt(ibin,js,aer,electrolyte) - - use module_data_mosaic_aero, only:r8,naer,nbin_a_max,nelectrolyte,jsolid, &!Parameters - jliquid, &!Parameters - jh2so4,jhno3,jhcl,jlvcite,jnh4no3,jnh4cl,jcamsa2,jcano3,jcacl2,jnano3, &!TBD - jnacl,jnh4so4,jnh4hso4,jnh4msa,jna2so4,jnahso4,jnamsa,iso4_a,ina_a, &!TBD - inh4_a,jna3hso4,jcaso4,jcaco3,ica_a,ino3_a,icl_a - - implicit none - - ! subr arguments - integer, intent(in) :: ibin, js - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - !Local variables - integer :: jp - - jp = jsolid - - - if(js .eq. jnh4so4)then - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jlvcite)then - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + & - 3.*electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jnh4hso4)then - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jna2so4)then - aer(ina_a,jliquid,ibin) = aer(ina_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jna3hso4)then - aer(ina_a,jliquid,ibin) = aer(ina_a,jliquid,ibin) + & - 3.*electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jnahso4)then - aer(ina_a,jliquid,ibin) = aer(ina_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(iso4_a,jliquid,ibin) = aer(iso4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(iso4_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jna2so4,jp,ibin) + & - 2.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnh4so4,jp,ibin) + & - 2.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jh2so4,jp,ibin) - return - endif - - - if(js .eq. jnh4no3)then - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - aer(ino3_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - 2.*electrolyte(jcano3,jp,ibin) + & - electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jhno3,jp,ibin) - return - endif - - - if(js .eq. jnh4cl)then - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(icl_a,jliquid,ibin) = aer(icl_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(inh4_a,jp,ibin) = electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - 2.*electrolyte(jnh4so4,jp,ibin) + & - 3.*electrolyte(jlvcite,jp,ibin) + & - electrolyte(jnh4hso4,jp,ibin)+ & - electrolyte(jnh4msa,jp,ibin) - - aer(icl_a,jp,ibin) = electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jcacl2,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - electrolyte(jhcl,jp,ibin) - return - endif - - - if(js .eq. jnano3)then - aer(ina_a,jliquid,ibin) = aer(ina_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(ino3_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - 2.*electrolyte(jcano3,jp,ibin) + & - electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jhno3,jp,ibin) - return - endif - - - if(js .eq. jnacl)then - aer(ina_a,jliquid,ibin) = aer(ina_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(icl_a,jliquid,ibin) = aer(icl_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ina_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jna2so4,jp,ibin) + & - 3.*electrolyte(jna3hso4,jp,ibin)+ & - electrolyte(jnahso4,jp,ibin) + & - electrolyte(jnamsa,jp,ibin) - - aer(icl_a,jp,ibin) = electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jcacl2,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - electrolyte(jhcl,jp,ibin) - return - endif - - - if(js .eq. jcano3)then - aer(ica_a,jliquid,ibin) = aer(ica_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ica_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jcano3,jp,ibin) + & - electrolyte(jcacl2,jp,ibin) + & - electrolyte(jcaco3,jp,ibin) + & - electrolyte(jcamsa2,jp,ibin) - - aer(ino3_a,jp,ibin) = electrolyte(jnano3,jp,ibin) + & - 2.*electrolyte(jcano3,jp,ibin) + & - electrolyte(jnh4no3,jp,ibin) + & - electrolyte(jhno3,jp,ibin) - return - endif - - - if(js .eq. jcacl2)then - aer(ica_a,jliquid,ibin) = aer(ica_a,jliquid,ibin) + & - electrolyte(js,jsolid,ibin) - aer(icl_a,jliquid,ibin) = aer(icl_a,jliquid,ibin) + & - 2.*electrolyte(js,jsolid,ibin) - - electrolyte(js,jsolid,ibin) = 0.0 - - aer(ica_a,jp,ibin) = electrolyte(jcaso4,jp,ibin) + & - electrolyte(jcano3,jp,ibin) + & - electrolyte(jcacl2,jp,ibin) + & - electrolyte(jcaco3,jp,ibin) + & - electrolyte(jcamsa2,jp,ibin) - - aer(icl_a,jp,ibin) = electrolyte(jnacl,jp,ibin) + & - 2.*electrolyte(jcacl2,jp,ibin) + & - electrolyte(jnh4cl,jp,ibin) + & - electrolyte(jhcl,jp,ibin) - return - endif - - return - end subroutine MESA_dissolve_small_salt - - - - !*********************************************************************** - ! electrolyte formation subroutines - ! - ! author: Rahul A. Zaveri - ! update: june 2000 - !----------------------------------------------------------------------- - subroutine form_caso4(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,ica_a,jcaso4 - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jcaso4,jp,ibin) = min(store(ica_a),store(iso4_a)) - store(ica_a) = ( (store(ica_a)) - & - (electrolyte(jcaso4,jp,ibin)) ) - store(iso4_a) = ( (store(iso4_a)) - & - (electrolyte(jcaso4,jp,ibin)) ) - store(ica_a) = max(0.d0, store(ica_a)) - store(iso4_a) = max(0.d0, store(iso4_a)) - - return - end subroutine form_caso4 - - - - subroutine form_camsa2(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - imsa_a,ica_a,jcamsa2 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jcamsa2,jp,ibin) = min(store(ica_a),0.5*store(imsa_a)) - store(ica_a) = ( (store(ica_a)) - & - (electrolyte(jcamsa2,jp,ibin)) ) - store(imsa_a) = ( (store(imsa_a)) - & - (2.*electrolyte(jcamsa2,jp,ibin)) ) - store(ica_a) = max(0.d0, store(ica_a)) - store(imsa_a) = max(0.d0, store(imsa_a)) - - return - end subroutine form_camsa2 - - - - !*********************************************************************** - ! computes mass transfer coefficients for each condensing species for - ! all the aerosol bins - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine aerosolmtc( jaerosolstate, aer, kg, electrolyte, num_a, Dp_dry_a, Dp_wet_a, & - dp_core_a, area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, vol_dry_a, vol_wet_a, & - dens_dry_a, dens_wet_a, sigmag_a, water_a, P_atm, T_K, ri_shell_a, dens_comp_a, & - mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, ri_avg_a, ri_core_a, & - mosaic_vars_aa ) ! TOUCH - - use module_data_mosaic_aero, only: r8, nbin_a_max, ngas_volatile, naer, naercomp, &!Parameters - nelectrolyte, ngas_ioa, mMODAL, no_aerosol, mUNSTRUCTURED, mSECTIONAL, &!Parameters - mSIZE_FRAMEWORK, nbin_a, &!Input - imsa_g, iaro1_g, iaro2_g, ialk1_g, iole1_g, iapi1_g, iapi2_g, ilim1_g, ilim2_g, &!TBD - ih2so4_g, ihno3_g, ihcl_g, inh3_g, &!TBD - use_cam5mam_accom_coefs, mosaic_vars_aa_type - - - implicit none - - !Subroutine Arguments - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate - - real(r8), intent(in) :: P_atm,T_K - real(r8), intent(in), dimension(nbin_a_max) :: num_a - real(r8), intent(in), dimension(naer) :: dens_aer_mac,mw_aer_mac - real(r8), intent(in), dimension(naercomp) :: dens_comp_a,mw_comp_a - real(r8), intent(in), dimension(nbin_a_max) :: sigmag_a - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_dry_a,Dp_wet_a,dp_core_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_wet_a,water_a - real(r8), intent(inout), dimension(nbin_a_max) :: area_dry_a,area_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,dens_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: dens_wet_a - real(r8), intent(inout), dimension(ngas_volatile,nbin_a_max) :: kg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - complex, intent(in), dimension(naercomp) :: ref_index_a - complex, intent(inout), dimension(nbin_a_max) :: ri_shell_a,ri_avg_a,ri_core_a - - type (mosaic_vars_aa_type), intent(inout) :: mosaic_vars_aa - - ! local variables - integer nghq - parameter (nghq = 2) ! gauss-hermite quadrature order - integer ibin, iq, iv - real(r8) :: tworootpi, root2, beta - parameter (tworootpi = 3.5449077, root2 = 1.4142135, beta = 2.0) - real(r8) :: cdum, Dp, Dp_avg, Fkn, Kn, lnsg, lnDpgn, lnDp, speed, & - sumghq, tmpa - real(r8) :: xghq(nghq), wghq(nghq) ! quadrature abscissae and weights - real(r8) :: mw_vol(ngas_volatile), v_molar(ngas_volatile) ! MW and molar vols of volatile species - real(r8) :: freepath(ngas_volatile), accom(ngas_volatile), & ! keep local - Dg(ngas_volatile) ! keep local - !real(r8) :: fuchs_sutugin ! mosaic func - !real(r8) :: gas_diffusivity ! mosaic func - !real(r8) :: mean_molecular_speed ! mosaic func - - ! molecular weights - mw_vol(ih2so4_g) = 98.0 - mw_vol(ihno3_g) = 63.0 - mw_vol(ihcl_g) = 36.5 - mw_vol(inh3_g) = 17.0 - mw_vol(imsa_g) = 96.0 - mw_vol(iaro1_g) = 150.0 - mw_vol(iaro2_g) = 150.0 - mw_vol(ialk1_g) = 140.0 - mw_vol(iole1_g) = 140.0 - mw_vol(iapi1_g) = 184.0 - mw_vol(iapi2_g) = 184.0 - mw_vol(ilim1_g) = 200.0 - mw_vol(ilim2_g) = 200.0 - - v_molar(ih2so4_g)= 42.88 - v_molar(ihno3_g) = 24.11 - v_molar(ihcl_g) = 21.48 - v_molar(inh3_g) = 14.90 - v_molar(imsa_g) = 58.00 - - ! mass accommodation coefficients - tmpa = 0.1 - if ( use_cam5mam_accom_coefs > 0 ) tmpa = 0.65 - accom(ih2so4_g) = tmpa - accom(ihno3_g) = tmpa - accom(ihcl_g) = tmpa - accom(inh3_g) = tmpa - accom(imsa_g) = tmpa - accom(iaro1_g) = tmpa - accom(iaro2_g) = tmpa - accom(ialk1_g) = tmpa - accom(iole1_g) = tmpa - accom(iapi1_g) = tmpa - accom(iapi2_g) = tmpa - accom(ilim1_g) = tmpa - accom(ilim2_g) = tmpa - - ! quadrature weights - xghq(1) = 0.70710678 - xghq(2) = -0.70710678 - wghq(1) = 0.88622693 - wghq(2) = 0.88622693 - - - - ! calculate gas diffusivity and mean free path for condensing gases - ! ioa - do iv = 1, ngas_ioa - speed = mean_molecular_speed(T_K,mw_vol(iv)) ! cm/s - Dg(iv) = gas_diffusivity(T_K,P_atm,mw_vol(iv),v_molar(iv)) ! cm^2/s - freepath(iv) = 3.*Dg(iv)/speed ! cm - enddo - - ! soa - do iv = iaro1_g, ngas_volatile - speed = mean_molecular_speed(T_K,mw_vol(iv)) ! cm/s - Dg(iv) = 0.1 ! cm^2/s - freepath(iv) = 3.*Dg(iv)/speed - enddo - - - ! calc mass transfer coefficients for gases over various aerosol bins - - if (mSIZE_FRAMEWORK .eq. mMODAL) then - - ! for modal approach - do 10 ibin = 1, nbin_a - - if(jaerosolstate(ibin) .eq. no_aerosol)goto 10 - call calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - - lnsg = log(sigmag_a(ibin)) - - ! following 2 lines were incorrect as Dp_wet_a is wet "average" Dp - ! Dpgn_a(ibin) = Dp_wet_a(ibin) ! cm - ! lnDpgn = log(Dpgn_a(ibin)) - ! do this instead which gives - ! lnDpgn = ln( wet geometric-mean Dp of number distribution ) - lnDpgn = log(Dp_wet_a(ibin)) - 1.5*lnsg*lnsg - - cdum = tworootpi*num_a(ibin)* & - exp(beta*lnDpgn + 0.5*(beta*lnsg)**2) - - do 20 iv = 1, ngas_volatile - - sumghq = 0.0_r8 - do 30 iq = 1, nghq ! sum over gauss-hermite quadrature points - lnDp = lnDpgn + beta*lnsg**2 + root2*lnsg*xghq(iq) - Dp = exp(lnDp) - Kn = 2.*freepath(iv)/Dp - Fkn = fuchs_sutugin(Kn,accom(iv)) - sumghq = sumghq + wghq(iq)*Dp*Fkn/(Dp**beta) -30 continue - - kg(iv,ibin) = cdum*Dg(iv)*sumghq ! 1/s - -20 continue -10 continue - - elseif ((mSIZE_FRAMEWORK .eq. mSECTIONAL ) .or. & - (mSIZE_FRAMEWORK .eq. mUNSTRUCTURED)) then - - ! for sectional approach - do 11 ibin = 1, nbin_a - - if(jaerosolstate(ibin) .eq. no_aerosol)goto 11 - - call calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - - cdum = 6.283185*Dp_wet_a(ibin)*num_a(ibin) - - do 21 iv = 1, ngas_volatile - Kn = 2.*freepath(iv)/Dp_wet_a(ibin) - Fkn = fuchs_sutugin(Kn,accom(iv)) - kg(iv,ibin) = cdum*Dg(iv)*Fkn ! 1/s -21 continue - -11 continue - - else - write(6,*)'Error in the choice of mSIZE_FRAMEWORK' - write(6,*)'Stopping in subr. aerosolmtc' - stop - endif - return - end subroutine aerosolmtc - - - - !*********************************************************************** - ! calculates dry and wet aerosol properties: density, refractive indices - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !----------------------------------------------------------------------- - subroutine calc_dry_n_wet_aerosol_props( & - ibin, jaerosolstate, aer, electrolyte, water_a, num_a, & ! input - dens_comp_a, mw_comp_a, dens_aer_mac, mw_aer_mac, ref_index_a, & ! input - Dp_dry_a, Dp_wet_a, dp_core_a, & ! output - area_dry_a, area_wet_a, mass_dry_a, mass_wet_a, & ! output - vol_dry_a, vol_wet_a, dens_dry_a, dens_wet_a, & ! output - ri_shell_a, ri_core_a, ri_avg_a ) ! output - ! include 'v33com9a' - - use module_data_mosaic_constants, only: piover4,piover6,third - use module_data_mosaic_aero, only: r8,nbin_a_max,naer,nelectrolyte,naercomp, &!Parameters - no_aerosol,msectional, &!Parameters - maeroptic_aero,msize_framework, &!Input - inh4_a,ina_a,ica_a,ico3_a,imsa_a,icl_a,ino3_a,jtotal,iso4_a,ioc_a,joc, &!TBD - ibc_a,jbc,ioin_a,join,iaro1_a,jaro1,iaro2_a,jaro2,ialk1_a,jalk1,iole1_a, &!TBD - jole1,iapi1_a,japi1,iapi2_a,japi2,ilim1_a,jlim1,ilim2_a,jlim2,jh2o !TBD - - use module_data_mosaic_asecthp, only: dcen_sect,isize_of_ibin,itype_of_ibin - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - integer, intent(in), dimension(nbin_a_max) :: jaerosolstate - - real(r8), intent(in), dimension(nbin_a_max) :: num_a - real(r8), intent(in), dimension(naer) :: mw_aer_mac,dens_aer_mac - real(r8), intent(in), dimension(naercomp) :: dens_comp_a,mw_comp_a - real(r8), intent(inout), dimension(nbin_a_max) :: Dp_dry_a,Dp_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: dp_core_a,vol_dry_a - real(r8), intent(inout), dimension(nbin_a_max) :: vol_wet_a,dens_wet_a,water_a - real(r8), intent(inout), dimension(nbin_a_max) :: area_dry_a,area_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: mass_dry_a,mass_wet_a - real(r8), intent(inout), dimension(nbin_a_max) :: dens_dry_a - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - complex, intent(in), dimension(naercomp) :: ref_index_a - complex, intent(inout), dimension(nbin_a_max) :: ri_avg_a,ri_core_a,ri_shell_a - ! local variables - integer isize, itype, jc, je, iaer - real(r8) :: aer_H, duma, vol_core, vol_shell, vol_dum - real(r8),dimension(naercomp) :: comp_a - complex rixvol_tot, rixvol_core, rixvol_shell - - - ! calculate dry mass and dry volume of a bin - mass_dry_a(ibin) = 0.0 ! initialize to 0.0 - vol_dry_a(ibin) = 0.0 ! initialize to 0.0 - area_dry_a(ibin) = 0.0 ! initialize to 0.0 - - if(jaerosolstate(ibin) .ne. no_aerosol)then - - aer_H = (2.*aer(iso4_a,jtotal,ibin) + & - aer(ino3_a,jtotal,ibin) + & - aer(icl_a,jtotal,ibin) + & - aer(imsa_a,jtotal,ibin) + & - 2.*aer(ico3_a,jtotal,ibin))- & - (2.*aer(ica_a,jtotal,ibin) + & - aer(ina_a,jtotal,ibin) + & - aer(inh4_a,jtotal,ibin)) - aer_H = max(aer_H, 0.0d0) - - do iaer = 1, naer - mass_dry_a(ibin) = mass_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer) ! ng/m^3(air) - vol_dry_a(ibin) = vol_dry_a(ibin) + & - aer(iaer,jtotal,ibin)*mw_aer_mac(iaer)/dens_aer_mac(iaer) ! ncc/m^3(air) - enddo - mass_dry_a(ibin) = mass_dry_a(ibin) + aer_H - vol_dry_a(ibin) = vol_dry_a(ibin) + aer_H - - mass_dry_a(ibin) = mass_dry_a(ibin)*1.e-15 ! g/cc(air) - vol_dry_a(ibin) = vol_dry_a(ibin)*1.e-15 ! cc(aer)/cc(air) - - ! wet mass and wet volume - mass_wet_a(ibin) = mass_dry_a(ibin) + water_a(ibin)*1.e-3 ! g/cc(air) - vol_wet_a(ibin) = vol_dry_a(ibin) + water_a(ibin)*1.e-3 ! cc(aer)/cc(air) - - ! calculate mean dry and wet particle densities - dens_dry_a(ibin) = mass_dry_a(ibin)/vol_dry_a(ibin) ! g/cc(aerosol) - dens_wet_a(ibin) = mass_wet_a(ibin)/vol_wet_a(ibin) ! g/cc(aerosol) - - ! calculate mean dry and wet particle diameters - Dp_dry_a(ibin)=(vol_dry_a(ibin)/(piover6*num_a(ibin)))**third ! cm - Dp_wet_a(ibin)=(vol_wet_a(ibin)/(piover6*num_a(ibin)))**third ! cm - - ! calculate mean dry and wet particle surface areas - area_dry_a(ibin)= piover4*num_a(ibin)*Dp_dry_a(ibin)**2 ! cm^2/cc(air) - area_wet_a(ibin)= piover4*num_a(ibin)*Dp_wet_a(ibin)**2 ! cm^2/cc(air) - - ! calculate volume average refractive index - ! load comp_a array with component mass concentrations - - ! rahul had turned this off, but it is needed - ! if(1 == 1)go to 100 ! TEMP - if (maeroptic_aero <= 0) goto 100 - - do je = 1, nelectrolyte - comp_a(je)=electrolyte(je,jtotal,ibin)*mw_comp_a(je)*1.e-15 ! g/cc(air) - enddo - comp_a(joc) = aer(ioc_a, jtotal,ibin)*mw_comp_a(joc )*1.e-15 ! g/cc(air) - comp_a(jbc) = aer(ibc_a, jtotal,ibin)*mw_comp_a(jbc )*1.e-15 ! g/cc(air) - comp_a(join) = aer(ioin_a, jtotal,ibin)*mw_comp_a(join )*1.e-15 ! g/cc(air) - comp_a(jaro1)= aer(iaro1_a,jtotal,ibin)*mw_comp_a(jaro1)*1.e-15 ! g/cc(air) - comp_a(jaro2)= aer(iaro2_a,jtotal,ibin)*mw_comp_a(jaro2)*1.e-15 ! g/cc(air) - comp_a(jalk1)= aer(ialk1_a,jtotal,ibin)*mw_comp_a(jalk1)*1.e-15 ! g/cc(air) - comp_a(jole1)= aer(iole1_a,jtotal,ibin)*mw_comp_a(jole1)*1.e-15 ! g/cc(air) - comp_a(japi1)= aer(iapi1_a,jtotal,ibin)*mw_comp_a(japi1)*1.e-15 ! g/cc(air) - comp_a(japi2)= aer(iapi2_a,jtotal,ibin)*mw_comp_a(japi2)*1.e-15 ! g/cc(air) - comp_a(jlim1)= aer(ilim1_a,jtotal,ibin)*mw_comp_a(jlim1)*1.e-15 ! g/cc(air) - comp_a(jlim2)= aer(ilim2_a,jtotal,ibin)*mw_comp_a(jlim2)*1.e-15 ! g/cc(air) - comp_a(jh2o) = water_a(ibin)*1.e-3 ! g/cc(air) - - rixvol_tot = (0.0,0.0) - do jc = 1, naercomp - comp_a(jc) = max( 0.0d0, comp_a(jc) ) - rixvol_tot = rixvol_tot & - + ref_index_a(jc)*comp_a(jc)/dens_comp_a(jc) - enddo - ri_avg_a(ibin) = rixvol_tot/vol_wet_a(ibin) - - ! - ! shell/core calcs - first set values to default (corresponding to zero core) - ! - ri_shell_a(ibin) = ri_avg_a(ibin) - ri_core_a(ibin) = (0.0,0.0) - Dp_core_a(ibin) = 0.0 - - ! sum ri*vol and vol for core species (bc and optionally oin=dust) - ! currently just bc in core, but what about insoluble oin and dust species ??? - jc = jbc - rixvol_core = ref_index_a(jc)*comp_a(jc)/dens_comp_a(jc) - vol_core = comp_a(jc)/dens_comp_a(jc) - vol_core = max( 0.0d0, min( vol_core, vol_wet_a(ibin) ) ) - - ! neglect core if (core volume) < 1.0d-9*(total volume) - ! or (core volume) < 1.0d-22 cm3 = (0.58 nm)**3 - ! neglect shell using similar criteria - vol_dum = max( 1.0d-22, 1.0d-9*vol_wet_a(ibin) ) - vol_shell = vol_wet_a(ibin) - vol_core - if (vol_core >= vol_dum) then - if (vol_shell < vol_dum) then - ri_shell_a(ibin) = (0.0,0.0) - ri_core_a(ibin) = ri_avg_a(ibin) - Dp_core_a(ibin) = Dp_wet_a(ibin) - else - ri_core_a(ibin) = rixvol_core/vol_core - Dp_core_a(ibin) = Dp_wet_a(ibin) & - * (vol_core/vol_wet_a(ibin))**third - - if (vol_shell >= vol_dum) then - rixvol_shell = rixvol_tot - rixvol_core - ri_shell_a(ibin) = rixvol_shell/vol_shell - else - ri_shell_a(ibin) = (0.0,0.0) - endif - endif - endif - - else - ! use defaults when (jaerosolstate(ibin) .eq. no_aerosol) - - dens_dry_a(ibin) = 1.0 ! g/cc(aerosol) - dens_wet_a(ibin) = 1.0 ! g/cc(aerosol) - ! Dp_dry_a(ibin) = dcen_sect(ibin) ! cm - ! Dp_wet_a(ibin) = dcen_sect(ibin) ! cm - if (msize_framework == msectional) then - isize = isize_of_ibin(ibin) - itype = itype_of_ibin(ibin) - Dp_dry_a(ibin) = dcen_sect(isize,itype) - Dp_wet_a(ibin) = Dp_dry_a(ibin) - end if - - ri_avg_a(ibin) = (1.5,0.0) - ri_shell_a(ibin) = (1.5,0.0) - ri_core_a(ibin) = (0.0,0.0) - Dp_core_a(ibin) = 0.0 - - endif ! if(jaerosolstate(ibin) .ne. no_aerosol)then - - -100 continue - - return - end subroutine calc_dry_n_wet_aerosol_props - - - - !*********************************************************************** - ! forms electrolytes from ions - ! - ! author: Rahul A. Zaveri - ! update: june 2000 - !----------------------------------------------------------------------- - subroutine form_electrolytes(jp,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) - use module_data_mosaic_aero, only: r8,ngas_volatile,naer,nbin_a_max, & - nelectrolyte,jsolid, & - imsa_a,iso4_a,ica_a,ina_a,inh4_a,ino3_a,icl_a,ico3_a - - implicit none - - ! subr arguments - integer, intent(in) :: ibin, jp - real(r8), intent(inout) :: XT - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer i, iXT_case, j, je - real(r8) :: sum_dum, XNa_prime, XNH4_prime, XT_prime - real(r8) :: store(naer) - - ! remove negative concentrations, if any - ! do i=1,naer - ! aer(i,jp,ibin) = max(0.0d0, aer(i,jp,ibin)) ! EFFI - ! enddo - - - ! call calculate_XT(ibin,jp,XT,aer) ! EFFI - - if( (aer(iso4_a,jp,ibin)+aer(imsa_a,jp,ibin)) .gt.0.0)then - XT = ( aer(inh4_a,jp,ibin) + & - aer(ina_a,jp,ibin) + & - 2.*aer(ica_a,jp,ibin) )/ & - (aer(iso4_a,jp,ibin)+0.5*aer(imsa_a,jp,ibin)) - else - XT = -1.0 - endif - - - - -! if(XT .ge. 1.9999 .or. XT.lt.0.)then - if(XT .ge. 2.0 .or. XT.lt.0.)then ! RAZ 11/10/2014 - iXT_case = 1 ! near neutral (acidity is caused by HCl and/or HNO3) - else - iXT_case = 2 ! acidic (acidity is caused by excess SO4) - endif - - ! initialize - ! - ! put total aer(*) into store(*) - store(iso4_a) = aer(iso4_a,jp,ibin) - store(ino3_a) = aer(ino3_a,jp,ibin) - store(icl_a) = aer(icl_a, jp,ibin) - store(imsa_a) = aer(imsa_a,jp,ibin) - store(ico3_a) = aer(ico3_a,jp,ibin) - store(inh4_a) = aer(inh4_a,jp,ibin) - store(ina_a) = aer(ina_a, jp,ibin) - store(ica_a) = aer(ica_a, jp,ibin) - - do j=1,nelectrolyte - electrolyte(j,jp,ibin) = 0.0 - enddo - - ! - !--------------------------------------------------------- - ! - if(iXT_case.eq.1)then - - ! XT >= 2 : sulfate deficient - call form_caso4(store,jp,ibin,electrolyte) - call form_camsa2(store,jp,ibin,electrolyte) - call form_na2so4(store,jp,ibin,electrolyte) - call form_namsa(store,jp,ibin,electrolyte) - call form_cano3(store,jp,ibin,electrolyte) - call form_nano3(store,jp,ibin,electrolyte) - call form_nacl(store,jp,ibin,aer,gas,electrolyte,total_species,tot_cl_in) - call form_cacl2(store,jp,ibin,electrolyte) - call form_caco3(store,jp,ibin,aer,electrolyte) - call form_nh4so4(store,jp,ibin,electrolyte) - call form_nh4msa(store,jp,ibin,electrolyte) - call form_nh4no3(store,jp,ibin,electrolyte) - call form_nh4cl(store,jp,ibin,electrolyte) - call form_msa(store,jp,ibin,electrolyte) - - if(jp .eq. jsolid)then - call degas_hno3(store,jp,ibin,aer,gas,electrolyte) - call degas_hcl(store,jp,ibin,aer,gas,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - else - call form_hno3(store,jp,ibin,electrolyte) - call form_hcl(store,jp,ibin,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - endif - - - - elseif(iXT_case.eq.2)then - - ! XT < 2 : sulfate enough or sulfate excess - - call form_caso4(store,jp,ibin,electrolyte) - call form_camsa2(store,jp,ibin,electrolyte) - call form_namsa(store,jp,ibin,electrolyte) - call form_nh4msa(store,jp,ibin,electrolyte) - call form_msa(store,jp,ibin,electrolyte) - - if(store(iso4_a).eq.0.0)goto 10 - - - XT_prime =(store(ina_a)+store(inh4_a))/ & - store(iso4_a) - XNa_prime=0.5*store(ina_a)/store(iso4_a) + 1. - - if(XT_prime.ge.XNa_prime)then - call form_na2so4(store,jp,ibin,electrolyte) - XNH4_prime = 0.0 - if(store(iso4_a).gt.1.e-15)then - XNH4_prime = store(inh4_a)/store(iso4_a) - endif - - if(XNH4_prime .ge. 1.5)then - call form_nh4so4_lvcite(store,jp,ibin,electrolyte) - else - call form_lvcite_nh4hso4(store,jp,ibin,electrolyte) - endif - - elseif(XT_prime.ge.1.)then - call form_nh4hso4(store,jp,ibin,electrolyte) - call form_na2so4_nahso4(store,jp,ibin,electrolyte) - elseif(XT_prime.lt.1.)then - call form_nahso4(store,jp,ibin,electrolyte) - call form_nh4hso4(store,jp,ibin,electrolyte) - call form_h2so4(store,jp,ibin,electrolyte) - endif - -10 if(jp .eq. jsolid)then - call degas_hno3(store,jp,ibin,aer,gas,electrolyte) - call degas_hcl(store,jp,ibin,aer,gas,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - else - call form_hno3(store,jp,ibin,electrolyte) - call form_hcl(store,jp,ibin,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - endif - - endif ! case 1, 2 - - - ! re-calculate ions to eliminate round-off errors - call electrolytes_to_ions(jp, ibin,aer,electrolyte) - !--------------------------------------------------------- - ! - ! calculate % composition EFFI - !! sum_dum = 0.0 - !! do je = 1, nelectrolyte - !! electrolyte(je,jp,ibin) = max(0.d0,electrolyte(je,jp,ibin)) ! remove -ve EFFI - !! sum_dum = sum_dum + electrolyte(je,jp,ibin) - !! enddo - !! - !! if(sum_dum .eq. 0.)sum_dum = 1.0 - !! electrolyte_sum(jp,ibin) = sum_dum - !! - !! do je = 1, nelectrolyte - !! epercent(je,jp,ibin) = 100.*electrolyte(je,jp,ibin)/sum_dum - !! enddo - - - return - end subroutine form_electrolytes - - - - subroutine form_na2so4(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,ina_a,jna2so4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store(naer) - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - electrolyte(jna2so4,jp,ibin) = min(.5*store(ina_a), & - store(iso4_a)) - store(ina_a) =( (store(ina_a)) - & - (2.*electrolyte(jna2so4,jp,ibin)) ) - store(iso4_a)=( (store(iso4_a)) - & - (electrolyte(jna2so4,jp,ibin)) ) - store(ina_a) =max(0.d0, store(ina_a)) - store(iso4_a)=max(0.d0, store(iso4_a)) - - return - end subroutine form_na2so4 - - - - subroutine form_nahso4(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,ina_a,jnahso4 - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnahso4,jp,ibin) = min(store(ina_a), & - store(iso4_a)) - store(ina_a) = ( (store(ina_a)) - & - (electrolyte(jnahso4,jp,ibin)) ) - store(iso4_a) = ( (store(iso4_a)) - & - (electrolyte(jnahso4,jp,ibin)) ) - store(ina_a) = max(0.d0, store(ina_a)) - store(iso4_a) = max(0.d0, store(iso4_a)) - - return - end subroutine form_nahso4 - - - - subroutine form_namsa(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - imsa_a,ina_a,jnamsa - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnamsa,jp,ibin) = min(store(ina_a), & - store(imsa_a)) - store(ina_a) = ( (store(ina_a)) - & - (electrolyte(jnamsa,jp,ibin)) ) - store(imsa_a) = ( (store(imsa_a)) - & - (electrolyte(jnamsa,jp,ibin)) ) - store(ina_a) = max(0.d0, store(ina_a)) - store(imsa_a) = max(0.d0, store(imsa_a)) - - return - end subroutine form_namsa - - - - subroutine form_nano3(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ino3_a,ina_a,jnano3 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnano3,jp,ibin)=min(store(ina_a),store(ino3_a)) - store(ina_a) = ( (store(ina_a)) - & - (electrolyte(jnano3,jp,ibin)) ) - store(ino3_a) = ( (store(ino3_a)) - & - (electrolyte(jnano3,jp,ibin)) ) - store(ina_a) = max(0.d0, store(ina_a)) - store(ino3_a) = max(0.d0, store(ino3_a)) - - return - end subroutine form_nano3 - - - - subroutine form_cano3(store,jp,ibin,electrolyte) ! Ca(NO3)2 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ino3_a,ica_a,jcano3 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jcano3,jp,ibin) = min(store(ica_a),0.5*store(ino3_a)) - - store(ica_a) = ( (store(ica_a)) - & - (electrolyte(jcano3,jp,ibin)) ) - store(ino3_a) = ( (store(ino3_a)) - & - (2.*electrolyte(jcano3,jp,ibin)) ) - store(ica_a) = max(0.d0, store(ica_a)) - store(ino3_a) = max(0.d0, store(ino3_a)) - - return - end subroutine form_cano3 - - - - subroutine form_cacl2(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - icl_a,ica_a,jcacl2 - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jcacl2,jp,ibin) = min(store(ica_a),0.5*store(icl_a)) - - store(ica_a) = ( (store(ica_a)) - & - (electrolyte(jcacl2,jp,ibin)) ) - store(icl_a) = ( (store(icl_a)) - & - (2.*electrolyte(jcacl2,jp,ibin)) ) - store(ica_a) = max(0.d0, store(ica_a)) - store(icl_a) = max(0.d0, store(icl_a)) - - return - end subroutine form_cacl2 - - - subroutine form_caco3(store,jp,ibin,aer,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max,jsolid, & - jtotal, & - ica_a,jcaco3,ico3_a - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - if(jp.eq.jtotal .or. jp.eq.jsolid)then - electrolyte(jcaco3,jp,ibin) = store(ica_a) - - aer(ico3_a,jp,ibin)= electrolyte(jcaco3,jp,ibin) ! force co3 = caco3 - - store(ica_a) = 0.0 - store(ico3_a)= 0.0 - endif - - return - end subroutine form_caco3 - - - - subroutine form_nacl(store,jp,ibin,aer,gas,electrolyte,total_species,tot_cl_in) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jsolid,jliquid, & - ina_a,jnacl,icl_a,ihcl_g - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local - - electrolyte(jnacl,jp,ibin) = store(ina_a) - - store(ina_a) = 0.0 - store(icl_a) = ( (store(icl_a)) - & - (electrolyte(jnacl,jp,ibin)) ) - - if(store(icl_a) .lt. 0.)then ! cl deficit in aerosol. take some from gas - aer(icl_a,jp,ibin)= aer(icl_a,jp,ibin)- store(icl_a) ! update aer(icl_a) - - if(jp .ne. jtotal)then - aer(icl_a,jtotal,ibin)= aer(icl_a,jliquid,ibin)+ & ! update for jtotal - aer(icl_a,jsolid,ibin) - endif - - gas(ihcl_g) = gas(ihcl_g) + store(icl_a) ! update gas(ihcl_g) - - if(gas(ihcl_g) .lt. 0.0)then - total_species(ihcl_g) = total_species(ihcl_g) - gas(ihcl_g) ! update total_species - tot_cl_in = tot_cl_in - gas(ihcl_g) ! update tot_cl_in - endif - - gas(ihcl_g) = max(0.d0, gas(ihcl_g)) ! restrict gas(ihcl_g) to >= 0. - store(icl_a) = 0. ! force store(icl_a) to 0. - - endif - - store(icl_a) = max(0.d0, store(icl_a)) - - return - end subroutine form_nacl - - - - subroutine form_nh4so4(store,jp,ibin,electrolyte) ! (nh4)2so4 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,inh4_a,jnh4so4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4so4,jp,ibin)= min(.5*store(inh4_a), & - store(iso4_a)) - store(inh4_a)= ( (store(inh4_a)) - & - (2.*electrolyte(jnh4so4,jp,ibin)) ) - store(iso4_a)= ( (store(iso4_a)) - & - (electrolyte(jnh4so4,jp,ibin)) ) - store(inh4_a) = max(0.d0, store(inh4_a)) - store(iso4_a) = max(0.d0, store(iso4_a)) - - return - end subroutine form_nh4so4 - - - - subroutine form_nh4hso4(store,jp,ibin,electrolyte) ! nh4hso4 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,inh4_a,jnh4hso4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4hso4,jp,ibin) = min(store(inh4_a), & - store(iso4_a)) - store(inh4_a)= ( (store(inh4_a)) - & - (electrolyte(jnh4hso4,jp,ibin)) ) - store(iso4_a)= ( (store(iso4_a)) - & - (electrolyte(jnh4hso4,jp,ibin)) ) - store(inh4_a) = max(0.d0, store(inh4_a)) - store(iso4_a) = max(0.d0, store(iso4_a)) - - return - end subroutine form_nh4hso4 - - - - subroutine form_nh4msa(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - imsa_a,inh4_a,jnh4msa - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4msa,jp,ibin) = min(store(inh4_a), & - store(imsa_a)) - store(inh4_a) = ( (store(inh4_a)) - & - (electrolyte(jnh4msa,jp,ibin)) ) - store(imsa_a) = ( (store(imsa_a)) - & - (electrolyte(jnh4msa,jp,ibin)) ) - store(inh4_a) = max(0.d0, store(inh4_a)) - store(imsa_a) = max(0.d0, store(imsa_a)) - - return - end subroutine form_nh4msa - - - - subroutine form_nh4cl(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - icl_a,inh4_a,jnh4cl - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4cl,jp,ibin) = min(store(inh4_a), & - store(icl_a)) - store(inh4_a) = ( (store(inh4_a)) - & - (electrolyte(jnh4cl,jp,ibin)) ) - store(icl_a) = ( (store(icl_a)) - & - (electrolyte(jnh4cl,jp,ibin)) ) - store(inh4_a) = max(0.d0, store(inh4_a)) - store(icl_a) = max(0.d0, store(icl_a)) - - return - end subroutine form_nh4cl - - - - subroutine form_nh4no3(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ino3_a,inh4_a,jnh4no3 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4no3,jp,ibin) = min(store(inh4_a), & - store(ino3_a)) - store(inh4_a) = ( (store(inh4_a)) - & - (electrolyte(jnh4no3,jp,ibin)) ) - store(ino3_a) = ( (store(ino3_a)) - & - (electrolyte(jnh4no3,jp,ibin)) ) - store(inh4_a) = max(0.d0, store(inh4_a)) - store(ino3_a) = max(0.d0, store(ino3_a)) - - return - end subroutine form_nh4no3 - - - - subroutine form_nh4so4_lvcite(store,jp,ibin,electrolyte) ! (nh4)2so4 + (nh4)3h(so4)2 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,inh4_a,jnh4so4,jlvcite - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jnh4so4,jp,ibin)= ( (2.*store(inh4_a)) - & - (3.*store(iso4_a)) ) - electrolyte(jlvcite,jp,ibin)= ( (2.*store(iso4_a)) - & - (store(inh4_a)) ) - electrolyte(jnh4so4,jp,ibin)= max(0.d0, & - electrolyte(jnh4so4,jp,ibin)) - electrolyte(jlvcite,jp,ibin)= max(0.d0, & - electrolyte(jlvcite,jp,ibin)) - store(inh4_a) = 0. - store(iso4_a) = 0. - - return - end subroutine form_nh4so4_lvcite - - - - subroutine form_lvcite_nh4hso4(store,jp,ibin,electrolyte) ! (nh4)3h(so4)2 + nh4hso4 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,inh4_a,jlvcite,jnh4hso4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jlvcite,jp,ibin) = ( (store(inh4_a)) - & - (store(iso4_a)) ) - electrolyte(jnh4hso4,jp,ibin)= ( (3.*store(iso4_a)) - & - (2.*store(inh4_a)) ) - electrolyte(jlvcite,jp,ibin) = max(0.d0, & - electrolyte(jlvcite,jp,ibin)) - electrolyte(jnh4hso4,jp,ibin)= max(0.d0, & - electrolyte(jnh4hso4,jp,ibin)) - store(inh4_a) = 0. - store(iso4_a) = 0. - - return - end subroutine form_lvcite_nh4hso4 - - - - subroutine form_na2so4_nahso4(store,jp,ibin,electrolyte) ! na2so4 + nahso4 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,ina_a,jna2so4,jnahso4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jna2so4,jp,ibin)= ( (store(ina_a)) - & - (store(iso4_a)) ) - electrolyte(jnahso4,jp,ibin)= ( (2.*store(iso4_a))- & - (store(ina_a)) ) - electrolyte(jna2so4,jp,ibin)= max(0.d0, & - electrolyte(jna2so4,jp,ibin)) - electrolyte(jnahso4,jp,ibin)= max(0.d0, & - electrolyte(jnahso4,jp,ibin)) - store(ina_a) = 0. - store(iso4_a) = 0. - - ! write(6,*)'na2so4 + nahso4' - - return - end subroutine form_na2so4_nahso4 - - - - subroutine form_h2so4(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - iso4_a,jh2so4 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jh2so4,jp,ibin) = max(0.0d0, store(iso4_a)) - store(iso4_a) = 0.0 - - return - end subroutine form_h2so4 - - - - subroutine form_msa(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - imsa_a,jmsa - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jmsa,jp,ibin) = max(0.0d0, store(imsa_a)) - store(imsa_a) = 0.0 - - return - end subroutine form_msa - - - - subroutine form_hno3(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ino3_a,jhno3 - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jhno3,jp,ibin) = max(0.0d0, store(ino3_a)) - store(ino3_a) = 0.0 - - return - end subroutine form_hno3 - - - - subroutine form_hcl(store,jp,ibin,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - icl_a,jhcl - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - electrolyte(jhcl,jp,ibin) = max(0.0d0, store(icl_a)) - store(icl_a) = 0.0 - - return - end subroutine form_hcl - - - - subroutine degas_hno3(store,jp,ibin,aer,gas,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jliquid,jsolid, & - ino3_a,ihno3_g,jhno3 - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout), dimension(naer) :: store - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - store(ino3_a) = max(0.0d0, store(ino3_a)) - gas(ihno3_g) = gas(ihno3_g) + store(ino3_a) - aer(ino3_a,jp,ibin) = ( (aer(ino3_a,jp,ibin)) - & - (store(ino3_a)) ) - aer(ino3_a,jp,ibin) = max(0.0d0,aer(ino3_a,jp,ibin)) - - ! also do it for jtotal - if(jp .ne. jtotal)then - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid, ibin) + & - aer(ino3_a,jliquid,ibin) - endif - - electrolyte(jhno3,jp,ibin) = 0.0 - store(ino3_a) = 0.0 - - return - end subroutine degas_hno3 - - - - subroutine degas_hcl(store,jp,ibin,aer,gas,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jliquid,jsolid, & - icl_a,ihcl_g,jhcl - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout) :: store(naer) - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - - store(icl_a) = max(0.0d0, store(icl_a)) - gas(ihcl_g) = gas(ihcl_g) + store(icl_a) - aer(icl_a,jp,ibin) = ( (aer(icl_a,jp,ibin)) - & - (store(icl_a)) ) - aer(icl_a,jp,ibin) = max(0.0d0,aer(icl_a,jp,ibin)) - - ! also do it for jtotal - if(jp .ne. jtotal)then - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid, ibin) + & - aer(icl_a,jliquid,ibin) - endif - - electrolyte(jhcl,jp,ibin) = 0.0 - store(icl_a) = 0.0 - - return - end subroutine degas_hcl - - - - subroutine degas_nh3(store,jp,ibin,aer,gas) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jliquid,jsolid, & - inh3_g,inh4_a - - implicit none - - ! subr arguments - integer, intent(in) :: jp, ibin - real(r8), intent(inout) :: store(naer) - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - - store(inh4_a) = max(0.0d0, store(inh4_a)) - gas(inh3_g) = gas(inh3_g) + store(inh4_a) - aer(inh4_a,jp,ibin) = ( (aer(inh4_a,jp,ibin)) - & - (store(inh4_a)) ) - aer(inh4_a,jp,ibin) = max(0.0d0,aer(inh4_a,jp,ibin)) - - ! also do it for jtotal - if(jp .ne. jtotal)then - aer(inh4_a,jtotal,ibin)= aer(inh4_a,jsolid, ibin) + & - aer(inh4_a,jliquid,ibin) - endif - - store(inh4_a) = 0.0 - - return - end subroutine degas_nh3 - - - - !*********************************************************************** - ! subroutines to absorb and degas small amounts of volatile species - ! - ! author: Rahul A. Zaveri - ! update: jun 2002 - !----------------------------------------------------------------------- - ! - ! nh4no3 (liquid) - subroutine absorb_tiny_nh4no3(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hno3_max,electrolyte_sum) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jliquid,jsolid, & - inh4_a,ino3_a,inh3_g,ihno3_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: delta_nh3_max,delta_hno3_max - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(3,nbin_a_max) :: electrolyte_sum - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer je - real(r8) :: small_aer, small_gas, small_amt - - - - !! EFFI - electrolyte_sum(jtotal,ibin) = 0.0 - do je = 1, nelectrolyte - electrolyte_sum(jtotal,ibin) = electrolyte_sum(jtotal,ibin) + & - electrolyte(je,jtotal,ibin) - enddo - !! EFFI - - - small_gas = 0.01 * min(delta_nh3_max(ibin),delta_hno3_max(ibin)) - small_aer = 0.01 * electrolyte_sum(jtotal,ibin) - if(small_aer .eq. 0.0)small_aer = small_gas - - small_amt = min(small_gas, small_aer) - - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + small_amt - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jliquid,ibin) + small_amt - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) + & - aer(ino3_a,jliquid,ibin) - - ! update gas - gas(inh3_g) = ((gas(inh3_g)) - (small_amt)) - gas(ihno3_g) = ((gas(ihno3_g)) - (small_amt)) - - return - end subroutine absorb_tiny_nh4no3 - - - - !-------------------------------------------------------------------- - ! nh4cl (liquid) - subroutine absorb_tiny_nh4cl(ibin,aer,gas,electrolyte,delta_nh3_max, & - delta_hcl_max,electrolyte_sum) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jtotal,jliquid,jsolid, & - inh4_a,icl_a,inh3_g,ihcl_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: delta_nh3_max,delta_hcl_max - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(3,nbin_a_max) :: electrolyte_sum - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer je - real(r8) :: small_aer, small_gas, small_amt - - - !! EFFI - electrolyte_sum(jtotal,ibin) = 0.0 - do je = 1, nelectrolyte - electrolyte_sum(jtotal,ibin) = electrolyte_sum(jtotal,ibin) + & - electrolyte(je,jtotal,ibin) - enddo - !! EFFI - - - - small_gas = 0.01 * min(delta_nh3_max(ibin), delta_hcl_max(ibin)) - small_aer = 0.01 * electrolyte_sum(jtotal,ibin) - if(small_aer .eq. 0.0)small_aer = small_gas - - small_amt = min(small_gas, small_aer) - - aer(inh4_a,jliquid,ibin) = aer(inh4_a,jliquid,ibin) + small_amt - aer(icl_a,jliquid,ibin) = aer(icl_a,jliquid,ibin) + small_amt - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) + & - aer(icl_a,jliquid,ibin) - - ! update gas - gas(inh3_g) = ((gas(inh3_g)) - (small_amt)) - gas(ihcl_g) = ((gas(ihcl_g)) - (small_amt)) - - return - end subroutine absorb_tiny_nh4cl - - - - !-------------------------------------------------------------------- - ! hno3 (liquid) - subroutine absorb_tiny_hno3(ibin,aer,gas,delta_hno3_max) ! and degas tiny hcl - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jliquid,jsolid,jtotal, & - icl_a,ino3_a,ihno3_g,ihcl_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hno3_max - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - ! local variables - real(r8) :: small_aer, small_amt, small_gas - - small_gas = 0.01 * delta_hno3_max(ibin) - small_aer = 0.01 * aer(icl_a,jliquid,ibin) - - small_amt = min(small_gas, small_aer) - - ! absorb tiny hno3 - aer(ino3_a,jliquid,ibin) = aer(ino3_a,jliquid,ibin) + small_amt - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) + & - aer(ino3_a,jliquid,ibin) - gas(ihno3_g) = ((gas(ihno3_g))-(small_amt)) - - ! degas tiny hcl - aer(icl_a,jliquid,ibin) = ((aer(icl_a,jliquid,ibin))- & - (small_amt)) - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) + & - aer(icl_a,jliquid,ibin) - - ! update gas - gas(ihcl_g) = gas(ihcl_g) + small_amt - - return - end subroutine absorb_tiny_hno3 - - - - !-------------------------------------------------------------- - ! hcl (liquid) - subroutine absorb_tiny_hcl(ibin,aer,gas,delta_hcl_max) ! and degas tiny hno3 - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jliquid,jtotal,jsolid, & - ino3_a,icl_a,ihcl_g,ihno3_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: delta_hcl_max - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - ! local variables - real(r8) :: small_aer, small_amt, small_gas - - small_gas = 0.01 * delta_hcl_max(ibin) - small_aer = 0.01 * aer(ino3_a,jliquid,ibin) - - small_amt = min(small_gas, small_aer) - - ! absorb tiny hcl - aer(icl_a,jliquid,ibin)= aer(icl_a,jliquid,ibin) + small_amt - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) + & - aer(icl_a,jliquid,ibin) - gas(ihcl_g) = ((gas(ihcl_g))-(small_amt)) - - ! degas tiny hno3 - aer(ino3_a,jliquid,ibin) = ((aer(ino3_a,jliquid,ibin))- & - (small_amt)) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) + & - aer(ino3_a,jliquid,ibin) - - ! update gas - gas(ihno3_g) = gas(ihno3_g) + small_amt - - return - end subroutine absorb_tiny_hcl - - - - !-------------------------------------------------------------- - ! nh4no3 (liquid) - subroutine degas_tiny_nh4no3(ibin,aer,gas,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jliquid,jsolid,jtotal, & - jnh4no3,inh4_a,ino3_a,inh3_g,ihno3_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: small_amt - - small_amt = 0.01 * electrolyte(jnh4no3,jliquid,ibin) - - aer(inh4_a,jliquid,ibin) = ((aer(inh4_a,jliquid,ibin))- & - (small_amt)) - aer(ino3_a,jliquid,ibin) = ((aer(ino3_a,jliquid,ibin))- & - (small_amt)) - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) + & - aer(ino3_a,jliquid,ibin) - - ! update gas - gas(inh3_g) = gas(inh3_g) + small_amt - gas(ihno3_g) = gas(ihno3_g) + small_amt - - return - end subroutine degas_tiny_nh4no3 - - - - - !-------------------------------------------------------------------- - ! nh4cl (liquid) - subroutine degas_tiny_nh4cl(ibin,aer,gas,electrolyte) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jliquid,jsolid,jtotal, & - jnh4cl,inh4_a,icl_a,inh3_g,ihcl_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: small_amt - - - small_amt = 0.01 * electrolyte(jnh4cl,jliquid,ibin) - - aer(inh4_a,jliquid,ibin) = ((aer(inh4_a,jliquid,ibin))- & - (small_amt)) - aer(icl_a,jliquid,ibin) = ((aer(icl_a,jliquid,ibin))- & - (small_amt)) - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) + & - aer(icl_a,jliquid,ibin) - - ! update gas - gas(inh3_g) = gas(inh3_g) + small_amt - gas(ihcl_g) = gas(ihcl_g) + small_amt - - return - end subroutine degas_tiny_nh4cl - - - - !*********************************************************************** - ! subroutines to equilibrate volatile acids - ! - ! author: Rahul A. Zaveri - ! update: may 2002 - !----------------------------------------------------------------------- - subroutine equilibrate_acids(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,Ncation,Nanion,nrxn_aer_gl,nrxn_aer_ll, & - ihno3_g,ihcl_g - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - - - - if(gas(ihcl_g)*gas(ihno3_g) .gt. 0.)then - call equilibrate_hcl_and_hno3(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - elseif(gas(ihcl_g) .gt. 0.)then - call equilibrate_hcl(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - elseif(gas(ihno3_g) .gt. 0.)then - call equilibrate_hno3(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - endif - - - return - end subroutine equilibrate_acids - - - - ! only hcl - subroutine equilibrate_hcl(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,Ncation,jliquid,jsolid,jtotal,Nanion,nrxn_aer_gl, & - nrxn_aer_ll, & - ja_so4,ja_hso4,ihcl_g,icl_a,jhcl,ino3_a,ica_a,inh4_a,ina_a,jc_h,jc_ca, & - jc_nh4,jc_na,ja_cl,ja_no3,jhno3,jnh4cl - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) ::Keq_gl - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: a, aerH, aerHSO4, aerSO4, b, c, dum, Kdash_hcl, mH, Tcl, & - W, XT, Z - !real(r8) :: quadratic ! mosaic func - - aerSO4 = ma(ja_so4,ibin)*water_a(ibin)*1.e+9 - aerHSO4= ma(ja_hso4,ibin)*water_a(ibin)*1.e+9 - - Tcl = aer(icl_a,jliquid,ibin) + gas(ihcl_g) ! nmol/m^3(air) - Kdash_hcl = Keq_gl(4)*1.e+18/gam(jhcl,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - Z = ( aer(ina_a, jliquid,ibin) + & ! nmol/m^3(air) - aer(inh4_a,jliquid,ibin) + & - 2.*aer(ica_a, jliquid,ibin) ) - & - (2.*aerSO4 + & - aerHSO4 + & - aer(ino3_a,jliquid,ibin) ) - - - W = water_a(ibin) ! kg/m^3(air) - - Kdash_hcl = Keq_gl(4)*1.e+18/gam(jhcl,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - a = 1.0 - b = ((Kdash_hcl*W) + (Z/W))*1.e-9 - c = Kdash_hcl*(Z - Tcl)*1.e-18 - - - dum = ((b*b)-(4.*a*c)) - if (dum .lt. 0.) return ! no real root - - - if(c .lt. 0.)then - mH = quadratic(a,b,c) ! mol/kg(water) - aerH = mH*W*1.e+9 - aer(icl_a,jliquid,ibin) = ((aerH) + (Z)) - else - mH = sqrt(Keq_ll(3)) - endif - - call form_electrolytes(jliquid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) - - ! update gas phase concentration - gas(ihcl_g) = ( (Tcl) - (aer(icl_a,jliquid,ibin)) ) - - - ! update the following molalities - ma(ja_so4,ibin) = 1.e-9*aerSO4/water_a(ibin) - ma(ja_hso4,ibin) = 1.e-9*aerHSO4/water_a(ibin) - ma(ja_no3,ibin) = 1.e-9*aer(ino3_a,jliquid,ibin)/water_a(ibin) - ma(ja_cl,ibin) = 1.e-9*aer(icl_a, jliquid,ibin)/water_a(ibin) - - mc(jc_h,ibin) = mH - mc(jc_ca,ibin) = 1.e-9*aer(ica_a, jliquid,ibin)/water_a(ibin) - mc(jc_nh4,ibin) = 1.e-9*aer(inh4_a,jliquid,ibin)/water_a(ibin) - mc(jc_na,ibin) = 1.e-9*aer(ina_a, jliquid,ibin)/water_a(ibin) - - - ! update the following activities - activity(jhcl,ibin) = mc(jc_h,ibin) *ma(ja_cl,ibin) * & - gam(jhcl,ibin)**2 - - activity(jhno3,ibin) = mc(jc_h,ibin) *ma(ja_no3,ibin) * & - gam(jhno3,ibin)**2 - - activity(jnh4cl,ibin) = mc(jc_nh4,ibin)*ma(ja_cl,ibin) * & - gam(jnh4cl,ibin)**2 - - - ! also update xyz(jtotal) - aer(icl_a,jtotal,ibin) = aer(icl_a,jliquid,ibin) + & - aer(icl_a,jsolid,ibin) - - electrolyte(jhcl,jtotal,ibin) = electrolyte(jhcl,jliquid,ibin) - - return - end subroutine equilibrate_hcl - - - - ! only hno3 - subroutine equilibrate_hno3(ibin,aer,gas,electrolyte,activity,mc,water_a, & - total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,Ncation,jliquid,jsolid,jtotal,Nanion,nrxn_aer_gl, & - nrxn_aer_ll, & - ja_so4,ja_hso4,ihno3_g,ino3_a,jhno3,icl_a,ica_a,inh4_a,ina_a,jc_h,jc_ca, & - jc_nh4,jc_na,ja_cl,jhcl,ja_no3,jnh4no3 - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: a, aerH, aerHSO4, aerSO4, b, c, dum, Kdash_hno3, mH, & - Tno3, W, XT, Z - !real(r8) :: quadratic ! mosaic func - - aerSO4 = ma(ja_so4,ibin)*water_a(ibin)*1.e+9 - aerHSO4= ma(ja_hso4,ibin)*water_a(ibin)*1.e+9 - - Tno3 = aer(ino3_a,jliquid,ibin) + gas(ihno3_g) ! nmol/m^3(air) - Kdash_hno3 = Keq_gl(3)*1.e+18/gam(jhno3,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - Z = ( aer(ina_a, jliquid,ibin) + & ! nmol/m^3(air) - aer(inh4_a,jliquid,ibin) + & - 2.*aer(ica_a, jliquid,ibin) ) - & - (2.*aerSO4 + & - aerHSO4 + & - aer(icl_a,jliquid,ibin) ) - - - W = water_a(ibin) ! kg/m^3(air) - - Kdash_hno3 = Keq_gl(3)*1.e+18/gam(jhno3,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - a = 1.0 - b = ((Kdash_hno3*W) + (Z/W))*1.e-9 - c = Kdash_hno3*(Z - Tno3)*1.e-18 - - dum = ((b*b)-(4.*a*c)) - if (dum .lt. 0.) return ! no real root - - - - if(c .lt. 0.)then - mH = quadratic(a,b,c) ! mol/kg(water) - aerH = mH*W*1.e+9 - aer(ino3_a,jliquid,ibin) = ((aerH) + (Z)) - else - mH = sqrt(Keq_ll(3)) - endif - - call form_electrolytes(jliquid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) - - ! update gas phase concentration - gas(ihno3_g)= ( (Tno3) - (aer(ino3_a,jliquid,ibin)) ) - - - ! update the following molalities - ma(ja_so4,ibin) = 1.e-9*aerSO4/water_a(ibin) - ma(ja_hso4,ibin) = 1.e-9*aerHSO4/water_a(ibin) - ma(ja_no3,ibin) = 1.e-9*aer(ino3_a,jliquid,ibin)/water_a(ibin) - ma(ja_cl,ibin) = 1.e-9*aer(icl_a, jliquid,ibin)/water_a(ibin) - - mc(jc_h,ibin) = mH - mc(jc_ca,ibin) = 1.e-9*aer(ica_a, jliquid,ibin)/water_a(ibin) - mc(jc_nh4,ibin) = 1.e-9*aer(inh4_a,jliquid,ibin)/water_a(ibin) - mc(jc_na,ibin) = 1.e-9*aer(ina_a, jliquid,ibin)/water_a(ibin) - - - ! update the following activities - activity(jhcl,ibin) = mc(jc_h,ibin) *ma(ja_cl,ibin) * & - gam(jhcl,ibin)**2 - - activity(jhno3,ibin) = mc(jc_h,ibin) *ma(ja_no3,ibin) * & - gam(jhno3,ibin)**2 - - activity(jnh4no3,ibin) = mc(jc_nh4,ibin)*ma(ja_no3,ibin) * & - gam(jnh4no3,ibin)**2 - - - ! also update xyz(jtotal) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jliquid,ibin) + & - aer(ino3_a,jsolid,ibin) - - electrolyte(jhno3,jtotal,ibin) = electrolyte(jhno3,jliquid,ibin) - - return - end subroutine equilibrate_hno3 - - - - ! both hcl and hno3 - subroutine equilibrate_hcl_and_hno3(ibin,aer,gas,electrolyte,activity,mc, & - water_a,total_species,tot_cl_in,ma,gam,Keq_ll,Keq_gl) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,Ncation,jliquid,jsolid,jtotal,Nanion,nrxn_aer_gl, & - nrxn_aer_ll, & - ja_so4,ja_hso4,ihcl_g,icl_a,ihno3_g,ino3_a,jhcl,jhno3, & - ica_a,inh4_a,ina_a,jc_h,jc_ca,jc_nh4,jc_na,ja_cl,ja_no3,jnh4no3, & - jnh4cl - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(nbin_a_max) :: water_a - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(nrxn_aer_ll) :: Keq_ll - real(r8), intent(inout), dimension(nrxn_aer_gl) :: Keq_gl - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: activity,gam - real(r8), intent(inout), dimension(Ncation,nbin_a_max) :: mc - real(r8), intent(inout), dimension(Nanion,nbin_a_max) :: ma - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - real(r8) :: aerH, aerHSO4, aerSO4, Kdash_hcl, Kdash_hno3, & - mH, p, q, r, Tcl, Tno3, W, XT, Z - !real(r8) :: cubic ! mosaic func - - - aerSO4 = ma(ja_so4,ibin)*water_a(ibin)*1.e+9 - aerHSO4= ma(ja_hso4,ibin)*water_a(ibin)*1.e+9 - - Tcl = aer(icl_a,jliquid,ibin) + gas(ihcl_g) ! nmol/m^3(air) - Tno3 = aer(ino3_a,jliquid,ibin) + gas(ihno3_g) ! nmol/m^3(air) - - Kdash_hcl = Keq_gl(4)*1.e+18/gam(jhcl,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - Kdash_hno3 = Keq_gl(3)*1.e+18/gam(jhno3,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - - Z = ( aer(ina_a, jliquid,ibin) + & ! nmol/m^3(air) - aer(inh4_a,jliquid,ibin) + & - 2.*aer(ica_a, jliquid,ibin) ) - & - (2.*aerSO4 + aerHSO4 ) - - - W = water_a(ibin) - - Kdash_hcl = Keq_gl(4)*1.e+18/gam(jhcl,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - Kdash_hno3 = Keq_gl(3)*1.e+18/gam(jhno3,ibin)**2 ! (nmol^2/kg^2)/(nmol/m^3(air)) - - p = (Z/W + W*(Kdash_hcl + Kdash_hno3))*1.e-9 - - q = 1.e-18*Kdash_hcl*Kdash_hno3*W**2 + & - 1.e-18*Z*(Kdash_hcl + Kdash_hno3) - & - 1.e-18*Kdash_hcl*Tcl - & - 1.e-18*Kdash_hno3*Tno3 - - r = 1.e-18*Kdash_hcl*Kdash_hno3*W*(Z - Tcl - Tno3)*1.e-9 - - mH = cubic(p,q,r) - - if(mH .gt. 0.0)then - aerH = mH*W*1.e+9 - aer(ino3_a,jliquid,ibin) = Kdash_hno3*W*W*Tno3/ & - (aerH + Kdash_hno3*W*W) - aer(icl_a, jliquid,ibin) = Kdash_hcl*W*W*Tcl/ & - (aerH + Kdash_hcl*W*W) - else - mH = sqrt(Keq_ll(3)) - endif - - call form_electrolytes(jliquid,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) - - ! update gas phase concentration - gas(ihno3_g)= ( (Tno3) - (aer(ino3_a,jliquid,ibin)) ) - gas(ihcl_g) = ( (Tcl) - (aer(icl_a,jliquid,ibin)) ) - - - ! update the following molalities - ma(ja_so4,ibin) = 1.e-9*aerSO4/water_a(ibin) - ma(ja_hso4,ibin) = 1.e-9*aerHSO4/water_a(ibin) - ma(ja_no3,ibin) = 1.e-9*aer(ino3_a,jliquid,ibin)/water_a(ibin) - ma(ja_cl,ibin) = 1.e-9*aer(icl_a, jliquid,ibin)/water_a(ibin) - - mc(jc_h,ibin) = mH - mc(jc_ca,ibin) = 1.e-9*aer(ica_a, jliquid,ibin)/water_a(ibin) - mc(jc_nh4,ibin) = 1.e-9*aer(inh4_a,jliquid,ibin)/water_a(ibin) - mc(jc_na,ibin) = 1.e-9*aer(ina_a, jliquid,ibin)/water_a(ibin) - - - ! update the following activities - activity(jhcl,ibin) = mc(jc_h,ibin)*ma(ja_cl,ibin) * & - gam(jhcl,ibin)**2 - - activity(jhno3,ibin) = mc(jc_h,ibin)*ma(ja_no3,ibin) * & - gam(jhno3,ibin)**2 - - activity(jnh4no3,ibin) = mc(jc_nh4,ibin)*ma(ja_no3,ibin)* & - gam(jnh4no3,ibin)**2 - - activity(jnh4cl,ibin) = mc(jc_nh4,ibin)*ma(ja_cl,ibin) * & - gam(jnh4cl,ibin)**2 - - - ! also update xyz(jtotal) - aer(icl_a,jtotal,ibin) = aer(icl_a,jliquid,ibin) + & - aer(icl_a,jsolid,ibin) - - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jliquid,ibin) + & - aer(ino3_a,jsolid,ibin) - - electrolyte(jhno3,jtotal,ibin) = electrolyte(jhno3,jliquid,ibin) - electrolyte(jhcl, jtotal,ibin) = electrolyte(jhcl, jliquid,ibin) - - return - end subroutine equilibrate_hcl_and_hno3 - - - - !*********************************************************************** - ! subroutines to evaporate solid volatile species - ! - ! author: Rahul A. Zaveri - ! update: sep 2004 - !----------------------------------------------------------------------- - ! - ! nh4no3 (solid) - subroutine degas_solid_nh4no3(ibin,aer,gas,electrolyte,Keq_sg) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jsolid,jliquid,jtotal,nrxn_aer_sg, & - ihno3_g,inh3_g,jnh4no3,inh4_a,ino3_a - - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer jp - real(r8) :: a, b, c, xgas, XT - !real(r8) :: quadratic ! mosaic func - - - jp = jsolid - - a = 1.0 - b = gas(inh3_g) + gas(ihno3_g) - c = gas(inh3_g)*gas(ihno3_g) - Keq_sg(1) - xgas = quadratic(a,b,c) - - if(xgas .ge. electrolyte(jnh4no3,jp,ibin))then ! degas all nh4no3 - - gas(inh3_g) = gas(inh3_g) + electrolyte(jnh4no3,jp,ibin) - gas(ihno3_g)= gas(ihno3_g) + electrolyte(jnh4no3,jp,ibin) - aer(inh4_a,jp,ibin) = aer(inh4_a,jp,ibin) - & - electrolyte(jnh4no3,jp,ibin) - aer(ino3_a,jp,ibin) = aer(ino3_a,jp,ibin) - & - electrolyte(jnh4no3,jp,ibin) - - else ! degas only xgas amount of nh4no3 - - gas(inh3_g) = gas(inh3_g) + xgas - gas(ihno3_g)= gas(ihno3_g) + xgas - aer(inh4_a,jp,ibin) = aer(inh4_a,jp,ibin) - xgas - aer(ino3_a,jp,ibin) = aer(ino3_a,jp,ibin) - xgas - endif - - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(ino3_a,jtotal,ibin) = aer(ino3_a,jsolid,ibin) + & - aer(ino3_a,jliquid,ibin) - - return - end subroutine degas_solid_nh4no3 - - - - ! nh4cl (solid) - subroutine degas_solid_nh4cl(ibin,aer,gas,electrolyte,Keq_sg) - use module_data_mosaic_aero, only: r8,naer,nelectrolyte,nbin_a_max, & - ngas_volatile,jsolid,jliquid,jtotal,nrxn_aer_sg, & - ihcl_g,inh3_g,jnh4cl,inh4_a,icl_a - implicit none - - ! subr arguments - integer, intent(in) :: ibin - real(r8), intent(inout), dimension(ngas_volatile) :: gas - real(r8), intent(inout), dimension(nrxn_aer_sg) :: Keq_sg - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer jp - real(r8) :: a, b, c, xgas, XT - !real(r8) :: quadratic ! mosaic func - - - jp = jsolid - - a = 1.0 - b = gas(inh3_g) + gas(ihcl_g) - c = gas(inh3_g)*gas(ihcl_g) - Keq_sg(2) - xgas = quadratic(a,b,c) - - if(xgas .ge. electrolyte(jnh4cl,jp,ibin))then ! degas all nh4cl - - gas(inh3_g) = gas(inh3_g) + electrolyte(jnh4cl,jp,ibin) - gas(ihcl_g) = gas(ihcl_g) + electrolyte(jnh4cl,jp,ibin) - aer(inh4_a,jp,ibin) = aer(inh4_a,jp,ibin) - & - electrolyte(jnh4cl,jp,ibin) - aer(icl_a,jp,ibin) = aer(icl_a,jp,ibin) - & - electrolyte(jnh4cl,jp,ibin) - - else ! degas only xgas amount of nh4cl - - gas(inh3_g) = gas(inh3_g) + xgas - gas(ihcl_g) = gas(ihcl_g) + xgas - aer(inh4_a,jp,ibin) = aer(inh4_a,jp,ibin) - xgas - aer(icl_a,jp,ibin) = aer(icl_a,jp,ibin) - xgas - - endif - - - ! update jtotal - aer(inh4_a,jtotal,ibin) = aer(inh4_a,jsolid,ibin) + & - aer(inh4_a,jliquid,ibin) - aer(icl_a,jtotal,ibin) = aer(icl_a,jsolid,ibin) + & - aer(icl_a,jliquid,ibin) - - return - end subroutine degas_solid_nh4cl - - - - !*********************************************************************** - ! conforms aerosol generic species to a valid electrolyte composition - ! - ! author: Rahul A. Zaveri - ! update: june 2000 - !----------------------------------------------------------------------- - subroutine conform_electrolytes(jp,ibin,XT,aer,gas,electrolyte,total_species,tot_cl_in) - - use module_data_mosaic_aero, only: r8,ngas_volatile,naer,nbin_a_max, & - nelectrolyte, & - imsa_a,iso4_a,ica_a,ina_a,inh4_a,ino3_a,icl_a,ico3_a - - implicit none - - ! subr arguments - integer, intent(in) :: ibin, jp - real(r8), intent(inout) :: XT - real(r8), intent(inout), dimension(ngas_volatile) :: gas,total_species - real(r8), intent(inout) :: tot_cl_in - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - ! local variables - integer i, iXT_case, je - real(r8) :: sum_dum, XNa_prime, XNH4_prime, XT_prime - real(r8) :: store(naer) - - ! remove negative concentrations, if any - ! do i=1,naer - ! aer(i,jp,ibin) = max(0.0d0, aer(i,jp,ibin)) ! EFFI - ! enddo - - - ! call calculate_XT(ibin,jp,XT,aer) ! EFFI - - if( (aer(iso4_a,jp,ibin)+aer(imsa_a,jp,ibin)) .gt.0.0)then - XT = ( aer(inh4_a,jp,ibin) + & - aer(ina_a,jp,ibin) + & - 2.*aer(ica_a,jp,ibin) )/ & - (aer(iso4_a,jp,ibin)+0.5*aer(imsa_a,jp,ibin)) - else - XT = -1.0 - endif - - -! if(XT .ge. 1.9999 .or. XT.lt.0.)then ! RAZ 11/10/2014 - if(XT .ge. 2.0 .or. XT.lt.0.)then ! RAZ 11/10/2014 - iXT_case = 1 ! near neutral (acidity is caused by HCl and/or HNO3) - else - iXT_case = 2 ! acidic (acidity is caused by excess SO4) - endif - - ! initialize - ! - ! put total aer(*) into store(*) - store(iso4_a) = aer(iso4_a,jp,ibin) - store(ino3_a) = aer(ino3_a,jp,ibin) - store(icl_a) = aer(icl_a, jp,ibin) - store(imsa_a) = aer(imsa_a,jp,ibin) - store(ico3_a) = aer(ico3_a,jp,ibin) - store(inh4_a) = aer(inh4_a,jp,ibin) - store(ina_a) = aer(ina_a, jp,ibin) - store(ica_a) = aer(ica_a, jp,ibin) - - do je=1,nelectrolyte - electrolyte(je,jp,ibin) = 0.0 - enddo - - ! - !--------------------------------------------------------- - ! - if(iXT_case.eq.1)then - - ! XT >= 2 : sulfate deficient - - call form_caso4(store,jp,ibin,electrolyte) - call form_camsa2(store,jp,ibin,electrolyte) - call form_na2so4(store,jp,ibin,electrolyte) - call form_namsa(store,jp,ibin,electrolyte) - call form_cano3(store,jp,ibin,electrolyte) - call form_nano3(store,jp,ibin,electrolyte) - call form_nacl(store,jp,ibin,aer,gas,electrolyte,total_species,tot_cl_in) - call form_cacl2(store,jp,ibin,electrolyte) - call form_caco3(store,jp,ibin,aer,electrolyte) - call form_nh4so4(store,jp,ibin,electrolyte) - call form_nh4msa(store,jp,ibin,electrolyte) - call form_nh4no3(store,jp,ibin,electrolyte) - call form_nh4cl(store,jp,ibin,electrolyte) - call form_msa(store,jp,ibin,electrolyte) - call degas_hno3(store,jp,ibin,aer,gas,electrolyte) - call degas_hcl(store,jp,ibin,aer,gas,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - - elseif(iXT_case.eq.2)then - - ! XT < 2 : sulfate enough or sulfate excess - - call form_caso4(store,jp,ibin,electrolyte) - call form_camsa2(store,jp,ibin,electrolyte) - call form_namsa(store,jp,ibin,electrolyte) - call form_nh4msa(store,jp,ibin,electrolyte) - call form_msa(store,jp,ibin,electrolyte) - - if(store(iso4_a).eq.0.0)goto 10 - - - XT_prime =(store(ina_a)+store(inh4_a))/ & - store(iso4_a) - XNa_prime=0.5*store(ina_a)/store(iso4_a) + 1. - - if(XT_prime.ge.XNa_prime)then - call form_na2so4(store,jp,ibin,electrolyte) - XNH4_prime = 0.0 - if(store(iso4_a).gt.1.e-15)then - XNH4_prime = store(inh4_a)/store(iso4_a) - endif - - if(XNH4_prime .ge. 1.5)then - call form_nh4so4_lvcite(store,jp,ibin,electrolyte) - else - call form_lvcite_nh4hso4(store,jp,ibin,electrolyte) - endif - - elseif(XT_prime.ge.1.)then - call form_nh4hso4(store,jp,ibin,electrolyte) - call form_na2so4_nahso4(store,jp,ibin,electrolyte) - elseif(XT_prime.lt.1.)then - call form_nahso4(store,jp,ibin,electrolyte) - call form_nh4hso4(store,jp,ibin,electrolyte) - call form_h2so4(store,jp,ibin,electrolyte) - endif - -10 call degas_hno3(store,jp,ibin,aer,gas,electrolyte) - call degas_hcl(store,jp,ibin,aer,gas,electrolyte) - call degas_nh3(store,jp,ibin,aer,gas) - - endif ! case 1, 2 - - - ! re-calculate ions to eliminate round-off errors - call electrolytes_to_ions(jp, ibin,aer,electrolyte) - !--------------------------------------------------------- - ! - ! calculate % composition EFFI - !! sum_dum = 0.0 - !! do je = 1, nelectrolyte - !! electrolyte(je,jp,ibin) = max(0.d0,electrolyte(je,jp,ibin)) ! remove -ve - !! sum_dum = sum_dum + electrolyte(je,jp,ibin) - !! enddo - !! - !! if(sum_dum .eq. 0.)sum_dum = 1.0 - !! electrolyte_sum(jp,ibin) = sum_dum - !! - !! do je = 1, nelectrolyte - !! epercent(je,jp,ibin) = 100.*electrolyte(je,jp,ibin)/sum_dum - !! enddo - !! - !! - return - end subroutine conform_electrolytes - - - - !---------------------------------------------------------- - ! solution to x^3 + px^2 + qx + r = 0 - ! - function cubic( psngl, qsngl, rsngl ) - use module_data_mosaic_kind, only: r8 - implicit none - real(r8) :: cubic - ! subr arguments - real(r8) :: psngl, qsngl, rsngl - ! local variables - real(r8) :: p, q, r, A, B, D, M, N, third, y - real(r8) :: k, phi, thesign, x(3), duma - integer icase, kk - - third = 1.d0/3.d0 - - q = (qsngl) - p = (psngl) - r = (rsngl) - - A = (1.d0/3.d0)*((3.d0*q) - (p*p)) - B = (1.d0/27.d0)*((2.d0*p*p*p) - (9.d0*p*q) + (27.d0*r)) - - D = ( ((A*A*A)/27.d0) + ((B*B)/4.d0) ) - - if(D .gt. 0.)then ! => 1 real and 2 complex roots - icase = 1 - elseif(D .eq. 0.)then ! => 3 real roots, atleast 2 identical - icase = 2 - else ! D < 0 => 3 distinct real roots - icase = 3 - endif - - - goto (1,2,3), icase - - ! case 1: D > 0 -1 thesign = 1. - if(B .gt. 0.)then - B = -B - thesign = -1. - endif - - M = thesign*((-B/2.d0) + (sqrt(D)))**(third) - N = thesign*((-B/2.d0) - (sqrt(D)))**(third) - - cubic = ( (M) + (N) - (p/3.d0) ) - return - - ! case 2: D = 0 -2 thesign = 1. - if(B .gt. 0.)then - B = -B - thesign = -1. - endif - - M = thesign*(-B/2.d0)**third - N = M - - x(1) = ( (M) + (N) - (p/3.d0) ) - x(2) = ( (-M/2.d0) + (-N/2.d0) - (p/3.d0) ) - x(2) = ( (-M/2.d0) + (-N/2.d0) - (p/3.d0) ) - - cubic = 0. - do kk = 1, 3 - if(x(kk).gt.cubic) cubic = x(kk) - enddo - return - - ! case 3: D < 0 -3 if(B.gt.0.)then - thesign = -1. - elseif(B.lt.0.)then - thesign = 1. - endif - - ! rce 18-nov-2004 -- make sure that acos argument is between +/-1.0 - ! phi = acos(thesign*sqrt( (B*B/4.d0)/(-A*A*A/27.d0) )) ! radians - duma = thesign*sqrt( (B*B/4.d0)/(-A*A*A/27.d0) ) - duma = min( duma, +1.0d0 ) - duma = max( duma, -1.0d0 ) - phi = acos( duma ) ! radians - - - cubic = 0. - do kk = 1, 3 - k = kk-1 - y = 2.*Sqrt(-A/3.)*cos(phi + 120.*k*0.017453293) - x(kk) = ((y) - (p/3.d0)) - if(x(kk).gt.cubic) cubic = x(kk) - enddo - return - - end function cubic - !---------------------------------------------------------- - - - !---------------------------------------------------------- - function quadratic(a,b,c) - use module_data_mosaic_kind, only: r8 - implicit none - real(r8) :: quadratic - ! subr. arguments - real(r8) :: a, b, c - ! local variables - real(r8) :: x, dum, quad1, quad2 - - - if(b .ne. 0.0)then - x = 4.*(a/b)*(c/b) - else - x = 1.e+6 - endif - - if(abs(x) .lt. 1.e-6)then - dum = ( (0.5*x) + & - (0.125*x**2) + & - (0.0625*x**3) ) - - quadratic = (-0.5*b/a)*dum - - if(quadratic .lt. 0.)then - quadratic = -b/a - quadratic - endif - - else - quad1 = ((-b)+sqrt((b*b)-(4.*a*c)))/ & - (2.*a) - quad2 = ((-b)-sqrt((b*b)-(4.*a*c)))/ & - (2.*a) - - quadratic = max(quad1, quad2) - endif - - return - end function quadratic - !---------------------------------------------------------- - - - !---------------------------------------------------------- - function mean_molecular_speed(T, MW) ! in cm/s - use module_data_mosaic_kind, only: r8 - implicit none - real(r8) :: mean_molecular_speed - ! subr. arguments - real(r8) :: T, MW ! T(K) - - mean_molecular_speed = 1.455e4 * sqrt(T/MW) - - return - end function mean_molecular_speed - !---------------------------------------------------------- - - !---------------------------------------------------------- - function gas_diffusivity(T, P, MW, Vm) ! in cm^2/s - use module_data_mosaic_kind, only: r8 - use module_data_mosaic_constants, only: third - implicit none - real(r8) :: gas_diffusivity - ! subr. arguments - real(r8) :: MW, Vm, T, P ! T(K), P(atm) - - - gas_diffusivity = (1.0e-3 * T**1.75 * sqrt(1./MW + 0.035))/ & - (P * (Vm**third + 2.7189)**2) - - - return - end function gas_diffusivity - !---------------------------------------------------------- - - - !---------------------------------------------------------- - function fuchs_sutugin(rkn,a) - use module_data_mosaic_kind, only: r8 - implicit none - real(r8) :: fuchs_sutugin - ! subr. arguments - real(r8) :: rkn, a - ! local variables - real(r8) :: rnum, denom - - - rnum = 0.75*a*(1. + rkn) - denom = rkn**2 + rkn + 0.283*rkn*a + 0.75*a - fuchs_sutugin = rnum/denom - - return - end function fuchs_sutugin - !---------------------------------------------------------- - - - !---------------------------------------------------------- - ! ZSR method at 60% RH - ! - function aerosol_water_up( ibin, electrolyte, aer, kappa_nonelectro, a_zsr ) ! kg (water)/m^3 (air) - - use module_data_mosaic_aero, only: r8,nelectrolyte,naer,nbin_a_max,jtotal, & - nsalt, ioc_a, ibc_a, ilim2_a, ioin_a, dens_aer_mac ! RAZ 4/16/2014 - - implicit none - - real(r8) :: aerosol_water_up - ! subr. arguments - integer, intent(in) :: ibin - real(r8), intent(in), dimension (6,nelectrolyte) :: a_zsr - real(r8), intent(in), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(in), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - ! local variables - integer :: iaer, jp, je - real(r8) :: tmpa, tmpb, aH2O_60 ! RAZ 4/16/2014 - ! function - !real(r8) :: bin_molality_60 - - - aH2O_60 = 0.6 - - jp = jtotal - tmpa = 0.0_r8 - - do je = 1, (nsalt+4) ! include hno3 and hcl in water calculation - tmpa = tmpa + electrolyte(je,jp,ibin)/bin_molality_60(je,a_zsr) - enddo - -! tmpa = tmpa + & -! ( (aer(ilim2_a,jp,ibin)/dens_aer_mac(ilim2_a))*kappa_nonelectro(ilim2_a) + & ! RCE 5/20/2015 -! (aer(ioin_a, jp,ibin)/dens_aer_mac(ioin_a ))*kappa_nonelectro(ioin_a ) + & ! " " -! (aer(ioc_a, jp,ibin)/dens_aer_mac(ioc_a ))*kappa_nonelectro(ioc_a ) + & ! " " -! (aer(ibc_a, jp,ibin)/dens_aer_mac(ibc_a ))*kappa_nonelectro(ibc_a ) )*aH2O_60/(1.0-aH2O_60) ! RCE 5/20/2015 - - tmpb = 0.0_r8 - do iaer = 1, naer - if (kappa_nonelectro(iaer) > 0.0_r8) then - tmpb = tmpb + (aer(iaer,jp,ibin)/dens_aer_mac(iaer))*kappa_nonelectro(iaer) - end if - end do - tmpa = tmpa + tmpb * aH2O_60/(1.0-aH2O_60) - - aerosol_water_up = tmpa*1.e-9 - - return - end function aerosol_water_up - !---------------------------------------------------------- - - - !---------------------------------------------------------- - function bin_molality_60(je,a_zsr) ! TOUCH - use module_data_mosaic_aero, only: r8,nelectrolyte - - implicit none - - real(r8) :: bin_molality_60 - ! subr. arguments - integer, intent(in) :: je - real(r8), intent(in), dimension (6,nelectrolyte) :: a_zsr - ! local variables - real(r8) :: aw, xm - - - aw = 0.6_r8 - - xm = a_zsr(1,je) + & - aw*(a_zsr(2,je) + & - aw*(a_zsr(3,je) + & - aw*(a_zsr(4,je) + & - aw*(a_zsr(5,je) + & - aw* a_zsr(6,je) )))) - - bin_molality_60 = 55.509_r8*xm/(1. - xm) - - return - end function bin_molality_60 - !---------------------------------------------------------- - - - !---------------------------------------------------------- - ! ZSR method - function aerosol_water( jp, ibin, jaerosolstate, jphase, jhyst_leg, electrolyte, aer, & - kappa_nonelectro, num_a, mass_dry_a, mass_soluble_a, aH2O, molality0 ) ! kg (water)/m^3 (air). RAZ added aer - use module_data_mosaic_aero, only: r8,nbin_a_max,nelectrolyte,nsoluble,naer, & - all_solid,jsolid,jhyst_lo, ioc_a, ibc_a, ilim2_a, ioin_a, dens_aer_mac, & ! RAZ 4/16/2014 - ename, jtotal, ah2o_max - - implicit none - - real(r8) :: aerosol_water - ! subr. arguments - integer, intent(in) :: jp, ibin - integer, intent(inout), dimension(nbin_a_max) :: jaerosolstate,jphase,jhyst_leg - - real(r8), intent(in) :: aH2O - real(r8), intent(in), dimension(nbin_a_max) :: num_a,mass_dry_a,mass_soluble_a - real(r8), intent(inout), dimension(nelectrolyte,nbin_a_max) :: molality0 !BSINGH(05/23/2014) - Added dimension nbin_a_max - real(r8), intent(inout), dimension(nelectrolyte,3,nbin_a_max) :: electrolyte - real(r8), intent(inout), dimension(naer,3,nbin_a_max) :: aer - real(r8), intent(in), dimension(naer) :: kappa_nonelectro - - ! local variables - integer :: iaer, iclm_aer, jclm_aer, je - real(r8) :: tmpa, tmpb - ! function - real(r8) :: bin_molality - - - - tmpa = 0.0_r8 - do je = 1, 19 ! include hno3 and hcl in water calculation - tmpa = tmpa + electrolyte(je,jp,ibin)/molality0(je,ibin) ! RAZ 5/20/2014 - enddo - -! note that this only considers the ilim2_a soa species - -! tmpa = tmpa + & -! ( (aer(ioc_a, jtotal,ibin)/dens_aer_mac(ioc_a ))*kappa_nonelectro(ioc_a ) + & ! RCE 5/20/2015 -! (aer(ilim2_a,jtotal,ibin)/dens_aer_mac(ilim2_a))*kappa_nonelectro(ilim2_a) + & ! RCE 5/20/2015 -! (aer(ioin_a, jtotal,ibin)/dens_aer_mac(ioin_a ))*kappa_nonelectro(ioin_a ) + & ! RCE 5/20/2015 -! (aer(ibc_a, jtotal,ibin)/dens_aer_mac(ibc_a ))*kappa_nonelectro(ibc_a ) ) & ! RCE 5/20/2015 -! * 1.0e-3 * aH2O/(1.0-min(ah2o,ah2o_max)) ! RCE 5/20/2015 - need 1.0e-3 factor - - tmpb = 0.0_r8 - do iaer = 1, naer - if (kappa_nonelectro(iaer) > 0.0_r8) then - tmpb = tmpb + (aer(iaer,jtotal,ibin)/dens_aer_mac(iaer))*kappa_nonelectro(iaer) - end if - end do - tmpa = tmpa + tmpb * 1.0e-3 * ah2o/(1.0-min(ah2o,ah2o_max)) - - aerosol_water = tmpa*1.e-9 ! kg(water)/m^3(air) - - - iclm_aer = 0 !BSINGH- THIS IS WRONG!!! - jclm_aer = 0 !BSINGH- THIS IS WRONG!!! - if(aerosol_water .le. 0.0)then !BALLI- Commented out to avoid slow runtime. - !write(6,*)'iclm jclm ibin jp = ', & - ! iclm_aer, jclm_aer, ibin, jp !BSINGH- iclm_aer and jclm_aer are never set but they are used here.*** - !write(6,*)'aH2O, water = ', aH2O, aerosol_water - !write(6,*)'dry mass = ', mass_dry_a(ibin) - !write(6,*)'soluble mass = ', mass_soluble_a(ibin) - !write(6,*)'number = ', num_a(ibin) - !do je = 1, nsoluble - ! write(6,44)ename(je), electrolyte(je,jp,ibin) - !enddo - !write(6,*)'Error in water calculation' - !write(6,*)'ibin = ', ibin - !write(6,*)'water content cannot be negative or zero' - !write(6,*)'setting jaerosolstate to all_solid' - - ! call print_input - - jaerosolstate(ibin) = all_solid - jphase(ibin) = jsolid - jhyst_leg(ibin) = jhyst_lo - - endif - -44 format(a7, 2x, e11.3) - - - return - end function aerosol_water - - - - - - !---------------------------------------------------------- - function bin_molality(je,ibin,aH2O_a,b_zsr,a_zsr,aw_min) - use module_data_mosaic_aero, only:r8, nbin_a_max, nelectrolyte - - implicit none - - real(r8) :: bin_molality - ! subr. arguments - integer, intent(in) :: je, ibin - real(r8), intent(in), dimension(nbin_a_max) :: aH2O_a - real(r8), intent(in), dimension(nelectrolyte) :: b_zsr,aw_min - real(r8), intent(in), dimension (6,nelectrolyte) :: a_zsr - ! local variables - real(r8) :: aw, xm - - - aw = max(aH2O_a(ibin), aw_min(je)) - aw = min(aw, 0.999999_r8) - - - if(aw .lt. 0.97_r8)then - - xm = a_zsr(1,je) + & - aw*(a_zsr(2,je) + & - aw*(a_zsr(3,je) + & - aw*(a_zsr(4,je) + & - aw*(a_zsr(5,je) + & - aw* a_zsr(6,je) )))) - - bin_molality = 55.509_r8*xm/(1. - xm) - - else - - bin_molality = -b_zsr(je)*log(aw) - - endif - - - return - end function bin_molality - !---------------------------------------------------------- - - - - - - - -end module module_mosaic_ext diff --git a/MAMchem_GridComp/microphysics/module_mosaic_init.F90 b/MAMchem_GridComp/microphysics/module_mosaic_init.F90 deleted file mode 100644 index 381a4888..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_init.F90 +++ /dev/null @@ -1,3173 +0,0 @@ -module module_mosaic_init - - implicit none - private - - public:: mosaic_init - -contains - subroutine mosaic_init - !BSINGH - All initialzations for Mosiac model - - call load_mosaic_parameters - - end subroutine mosaic_init - - !---------------------------------------------------------------------------------------! - !BSINGH: load_mosaic_parameters subroutine is directly copied form the mosaic_box.25.f90 - ! code - !---------------------------------------------------------------------------------------! - - !---------------------------------------------------------------------------------------! - ! Called only once per entire simulation to load gas and aerosol - ! indices, parameters, physico-chemical constants, polynomial coeffs, etc. - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !---------------------------------------------------------------------------------------! - subroutine load_mosaic_parameters - - ! include 'v33com2' - use module_data_mosaic_aero, only: ipmcmos_aero, no_aerosol, all_solid, all_liquid, & - mixed, nelectrolyte, naercomp, naer, Ncation, Nanion, ngas_volatile, nsalt, & - jsulf_poor_NUM, jsulf_rich_NUM, MDRH_T_NUM, d_mdrh_DIM2, phasestate, aer_name, & - gas_name, ename, jnh4so4, jlvcite, jnh4hso4, jnh4msa, jnh4no3, jnh4cl, jna2so4, & - jna3hso4, jnahso4, jnamsa, jnano3, jnacl, jcano3, jcacl2, jcamsa2, jh2so4, jmsa, & - jhno3, jhcl, jhhso4, jcaso4, jcaco3, joc, jbc, join, jaro1, jaro2, jalk1, jole1, & - japi1, japi2, jlim1, jlim2, jh2o, jc_h, jc_nh4, jc_na, jc_ca, ja_hso4, ja_so4, & - ja_no3, ja_cl, ja_msa, ih2so4_g, ihno3_g, ihcl_g, inh3_g, imsa_g, iaro1_g, & - iaro2_g, ialk1_g, iole1_g, iapi1_g, iapi2_g, ilim1_g, ilim2_g, iso4_a, ino3_a, & - icl_a, inh4_a, imsa_a, iaro1_a, iaro2_a, ialk1_a, iole1_a, iapi1_a, iapi2_a, & - ilim1_a, ilim2_a, ico3_a, ina_a, ica_a, ioin_a, ioc_a, ibc_a, nmax_ASTEM, b_mtem,& - zc, za, b_zsr, a_zsr, aw_min, mw_electrolyte, dens_electrolyte, & - partial_molar_vol, MW_c, MW_a, mw_aer_mac,dens_aer_mac, kappa_aer_mac, & - dens_comp_a,mw_comp_a, ref_index_a, rtol_mesa, jsalt_index, jsulf_poor, & - jsulf_rich,Nmax_mesa,d_mdrh, & - use_cam5mam_soa_params - - use module_data_mosaic_kind, only: r8 - - implicit none - - ! local variables - integer iaer, je, ja, j_index, ibin - logical use_mos31e_rz1_densities, use_uniform_densities !BSINGH - 05/28/2013(RCE updates) - real(r8), dimension(nelectrolyte) :: G_MX,K_MX - - !BSINGH - 05/28/2013(RCE updates) - use_mos31e_rz1_densities = .true. - if ( use_mos31e_rz1_densities ) then - use_uniform_densities = .false. - else - use_uniform_densities = .true. - if (ipmcmos_aero > 0) use_uniform_densities = .false. - end if - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! rce 2013-07-31 - - ! using a local saved variable like "first" no longer works - ! the calling routine needs to determine if/when this routine is needed - ! if(first)then - ! first=.false. - - !---------------------------------------------------------------- - ! control settings - ! *** do not change mSIZE_FRAMEWORK here *** - ! mSIZE_FRAMEWORK = mSECTIONAL ! mMODAL or mSECTIONAL - ! mDYNAMIC_SOLVER = mASTEM ! mASTEM, mLSODES - ! mGAS_AER_XFER = mON ! mON, mOFF - - ! ASTEM parameters - nmax_ASTEM = 301 ! max number of time steps in ASTEM - ! alpha_ASTEM = 1.0 ! choose a value between 0.01 and 1.0 - ! rtol_eqb_ASTEM = 0.01 ! equilibrium tolerance in ASTEM - ! ptol_mol_ASTEM = 0.01 ! mol percent tolerance in ASTEM - - ! MESA parameters - Nmax_MESA = 80 ! max number of iterations in MESA_PTC - rtol_mesa = 0.01 ! MESA equilibrium tolerance - !---------------------------------------------------------------- - ! - ! set gas and aerosol indices - ! - ! gas (local) - ih2so4_g = 1 ! ioa (inorganic aerosol) - ihno3_g = 2 ! ioa - ihcl_g = 3 ! ioa - inh3_g = 4 ! ioa - imsa_g = 5 ! ioa - iaro1_g = 6 ! soa (secondary organic aerosol) - iaro2_g = 7 ! soa - ialk1_g = 8 ! soa - iole1_g = 9 ! soa - iapi1_g = 10 ! soa - iapi2_g = 11 ! soa - ilim1_g = 12 ! soa - ilim2_g = 13 ! soa - - ! ico2_g = 14 ! currently not used - ! - ! aer (local): used for total species - iso4_a = 1 ! <-> ih2so4_g - ino3_a = 2 ! <-> ihno3_g - icl_a = 3 ! <-> ihcl_g - inh4_a = 4 ! <-> inh3_g - imsa_a = 5 ! <-> imsa_g - iaro1_a = 6 ! <-> iaro1_g - iaro2_a = 7 ! <-> iaro2_g - ialk1_a = 8 ! <-> ialk1_g - iole1_a = 9 ! <-> iole1_g - iapi1_a = 10 ! <-> iapi1_g - iapi2_a = 11 ! <-> iapi2_g - ilim1_a = 12 ! <-> ilim1_g - ilim2_a = 13 ! <-> ilim2_g - ico3_a = 14 ! <-> ico2_g - ina_a = 15 - ica_a = 16 - ioin_a = 17 - ioc_a = 18 - ibc_a = 19 - - - ! electrolyte indices (used for water content calculations) - ! these indices are order sensitive - jnh4so4 = 1 ! soluble - jlvcite = 2 ! soluble - jnh4hso4 = 3 ! soluble - jnh4msa = 4 ! soluble: new - jnh4no3 = 5 ! soluble - jnh4cl = 6 ! soluble - jna2so4 = 7 ! soluble - jna3hso4 = 8 ! soluble - jnahso4 = 9 ! soluble - jnamsa = 10 ! soluble: new - jnano3 = 11 ! soluble - jnacl = 12 ! soluble - jcano3 = 13 ! soluble - jcacl2 = 14 ! soluble - jcamsa2 = 15 ! soluble nsalt - jh2so4 = 16 ! soluble - jmsa = 17 ! soluble - jhno3 = 18 ! soluble - jhcl = 19 ! soluble - jhhso4 = 20 ! soluble - jcaso4 = 21 ! insoluble - jcaco3 = 22 ! insoluble - joc = 23 ! insoluble - part of naercomp - jbc = 24 ! insoluble - part of naercomp - join = 25 ! insoluble - part of naercomp - jaro1 = 26 ! insoluble - part of naercomp - jaro2 = 27 ! insoluble - part of naercomp - jalk1 = 28 ! insoluble - part of naercomp - jole1 = 29 ! insoluble - part of naercomp - japi1 = 30 ! insoluble - part of naercomp - japi2 = 31 ! insoluble - part of naercomp - jlim1 = 32 ! insoluble - part of naercomp - jlim2 = 33 ! insoluble - part of naercomp - jh2o = 34 ! water - part of naercomp - - - ! local aerosol ions - ! cations - jc_h = 1 - jc_nh4 = 2 - jc_na = 3 - jc_ca = 4 - ! - ! anions - ja_hso4 = 1 - ja_so4 = 2 - ja_no3 = 3 - ja_cl = 4 - ja_msa = 5 - ! ja_co3 = 6 - - !-------------------------------------------------------------------- - ! phase state names - phasestate(no_aerosol) = "NOAERO" - phasestate(all_solid) = "SOLID " - phasestate(all_liquid) = "LIQUID" - phasestate(mixed) = "MIXED " - - ! names of aer species - aer_name(iso4_a) = "SO4" - aer_name(ino3_a) = "NO3" - aer_name(icl_a) = "Cl " - aer_name(inh4_a) = "NH4" - aer_name(ioc_a) = "OC " - aer_name(imsa_a) = "MSA" - aer_name(ico3_a) = "CO3" - aer_name(ina_a) = "Na " - aer_name(ica_a) = "Ca " - aer_name(ibc_a) = "BC " - aer_name(ioin_a) = "OIN" - aer_name(iaro1_a)= "ARO1" - aer_name(iaro2_a)= "ARO2" - aer_name(ialk1_a)= "ALK1" - aer_name(iole1_a)= "OLE1" - aer_name(iapi1_a)= "API1" - aer_name(iapi2_a)= "API2" - aer_name(ilim1_a)= "LIM1" - aer_name(ilim2_a)= "LIM2" - - ! names of gas species - gas_name(ih2so4_g) = "H2SO4" - gas_name(ihno3_g) = "HNO3 " - gas_name(ihcl_g) = "HCl " - gas_name(inh3_g) = "NH3 " - gas_name(imsa_g) = "MSA " - gas_name(iaro1_g) = "ARO1 " - gas_name(iaro2_g) = "ARO2 " - gas_name(ialk1_g) = "ALK1 " - gas_name(iole1_g) = "OLE1 " - gas_name(iapi1_g) = "API1 " - gas_name(iapi2_g) = "API2 " - gas_name(ilim1_g) = "LIM1 " - gas_name(ilim2_g) = "LIM2 " - - ! names of electrolytes - ename(jnh4so4) = "AmSO4" - ename(jlvcite) = "(NH4)3H(SO4)2" - ename(jnh4hso4)= "NH4HSO4" - ename(jnh4msa) = "CH3SO3NH4" - ename(jnh4no3) = "NH4NO3" - ename(jnh4cl) = "NH4Cl" - ename(jnacl) = "NaCl" - ename(jnano3) = "NaNO3" - ename(jna2so4) = "Na2SO4" - ename(jna3hso4)= "Na3H(SO4)2" - ename(jnamsa) = "CH3SO3Na" - ename(jnahso4) = "NaHSO4" - ename(jcaso4) = "CaSO4" - ename(jcamsa2) = "(CH3SO3)2Ca" - ename(jcano3) = "Ca(NO3)2" - ename(jcacl2) = "CaCl2" - ename(jcaco3) = "CaCO3" - ename(jh2so4) = "H2SO4" - ename(jhhso4) = "HHSO4" - ename(jhno3) = "HNO3" - ename(jhcl) = "HCl" - ename(jmsa) = "CH3SO3H" - - ! molecular weights of electrolytes - mw_electrolyte(jnh4so4) = 132.0 - mw_electrolyte(jlvcite) = 247.0 - mw_electrolyte(jnh4hso4)= 115.0 - mw_electrolyte(jnh4msa) = 113.0 - mw_electrolyte(jnh4no3) = 80.0 - mw_electrolyte(jnh4cl) = 53.5 - mw_electrolyte(jnacl) = 58.5 - mw_electrolyte(jnano3) = 85.0 - mw_electrolyte(jna2so4) = 142.0 - mw_electrolyte(jna3hso4)= 262.0 - mw_electrolyte(jnahso4) = 120.0 - mw_electrolyte(jnamsa) = 118.0 - mw_electrolyte(jcaso4) = 136.0 - mw_electrolyte(jcamsa2) = 230.0 - mw_electrolyte(jcano3) = 164.0 - mw_electrolyte(jcacl2) = 111.0 - mw_electrolyte(jcaco3) = 100.0 - mw_electrolyte(jh2so4) = 98.0 - mw_electrolyte(jhno3) = 63.0 - mw_electrolyte(jhcl) = 36.5 - mw_electrolyte(jmsa) = 96.0 - - - ! molecular weights of ions [g/mol] - MW_c(jc_h) = 1.0 - MW_c(jc_nh4)= 18.0 - MW_c(jc_na) = 23.0 - MW_c(jc_ca) = 40.0 - - MW_a(ja_so4) = 96.0 - MW_a(ja_hso4)= 97.0 - MW_a(ja_no3) = 62.0 - MW_a(ja_cl) = 35.5 - MW_a(ja_msa) = 95.0 - - - ! magnitude of the charges on ions - zc(jc_h) = 1 - zc(jc_nh4) = 1 - zc(jc_na) = 1 - zc(jc_ca) = 2 - - za(ja_hso4)= 1 - za(ja_so4) = 2 - za(ja_no3) = 1 - za(ja_cl) = 1 - za(ja_msa) = 1 - - - ! densities of pure electrolytes in g/cc - dens_electrolyte(jnh4so4) = 1.8 - dens_electrolyte(jlvcite) = 1.8 - dens_electrolyte(jnh4hso4) = 1.8 - dens_electrolyte(jnh4msa) = 1.8 ! assumed same as nh4hso4 - dens_electrolyte(jnh4no3) = 1.8 - dens_electrolyte(jnh4cl) = 1.8 - dens_electrolyte(jnacl) = 2.2 - dens_electrolyte(jnano3) = 2.2 - dens_electrolyte(jna2so4) = 2.2 - dens_electrolyte(jna3hso4) = 2.2 - dens_electrolyte(jnahso4) = 2.2 - dens_electrolyte(jnamsa) = 2.2 ! assumed same as nahso4 - dens_electrolyte(jcaso4) = 2.6 - dens_electrolyte(jcamsa2) = 2.6 ! assumed same as caso4 - dens_electrolyte(jcano3) = 2.6 - dens_electrolyte(jcacl2) = 2.6 - dens_electrolyte(jcaco3) = 2.6 - dens_electrolyte(jh2so4) = 1.8 - dens_electrolyte(jhhso4) = 1.8 - dens_electrolyte(jhno3) = 1.8 - dens_electrolyte(jhcl) = 1.8 - dens_electrolyte(jmsa) = 1.8 ! assumed same as h2so4 - if ( use_uniform_densities ) then!BSINGH - 05/28/2013(RCE updates) - do je = 1, nelectrolyte - dens_electrolyte(je) = 1.6 - enddo - endif!BSINGH - 05/28/2013(RCE updates) - - ! densities of compounds in g/cc - dens_comp_a(jnh4so4) = 1.8 - dens_comp_a(jlvcite) = 1.8 - dens_comp_a(jnh4hso4) = 1.8 - dens_comp_a(jnh4msa) = 1.8 ! assumed same as nh4hso4 - dens_comp_a(jnh4no3) = 1.7 - dens_comp_a(jnh4cl) = 1.5 - dens_comp_a(jnacl) = 2.2 - dens_comp_a(jnano3) = 2.2 - dens_comp_a(jna2so4) = 2.2 - dens_comp_a(jna3hso4) = 2.2 - dens_comp_a(jnahso4) = 2.2 - dens_comp_a(jnamsa) = 2.2 ! assumed same as nahso4 - dens_comp_a(jcaso4) = 2.6 - dens_comp_a(jcamsa2) = 2.6 ! assumed same as caso4 - dens_comp_a(jcano3) = 2.6 - dens_comp_a(jcacl2) = 2.6 - dens_comp_a(jcaco3) = 2.6 - dens_comp_a(jh2so4) = 1.8 - dens_comp_a(jhhso4) = 1.8 - dens_comp_a(jhno3) = 1.8 - dens_comp_a(jhcl) = 1.8 - dens_comp_a(jmsa) = 1.8 ! assumed same as h2so4 - dens_comp_a(joc) = 1.0 - dens_comp_a(jbc) = 1.8 - dens_comp_a(join) = 2.6 - dens_comp_a(jaro1) = 1.0 - dens_comp_a(jaro2) = 1.0 - dens_comp_a(jalk1) = 1.0 - dens_comp_a(jole1) = 1.0 - dens_comp_a(japi1) = 1.0 - dens_comp_a(japi2) = 1.0 - dens_comp_a(jlim1) = 1.0 - dens_comp_a(jlim2) = 1.0 - dens_comp_a(jh2o) = 1.0 - !BSINGH - 05/28/2013(RCE updates) - ! following for comparison with mos31d_bs2 and. mos31e_rz1 - if ( use_mos31e_rz1_densities ) then - dens_comp_a(joc) = 1.4 - dens_comp_a(jaro1) = 1.4 - dens_comp_a(jaro2) = 1.4 - dens_comp_a(jalk1) = 1.4 - dens_comp_a(jole1) = 1.4 - dens_comp_a(japi1) = 1.4 - dens_comp_a(japi2) = 1.4 - dens_comp_a(jlim1) = 1.4 - dens_comp_a(jlim2) = 1.4 - end if - - if ( use_uniform_densities ) then - !BSINGH - 05/28/2013(RCE updates ENDS) - do je = 1, naercomp - dens_comp_a(je) = 1.6 - enddo - !BSINGH - 05/28/2013(RCE updates) - endif - - if (ipmcmos_aero > 0) then - dens_comp_a(jnh4no3) = 1.8 - dens_comp_a(jnh4cl) = 1.8 - dens_comp_a(jaro1) = 1.4 - dens_comp_a(jaro2) = 1.4 - dens_comp_a(jalk1) = 1.4 - dens_comp_a(jole1) = 1.4 - dens_comp_a(japi1) = 1.4 - dens_comp_a(japi2) = 1.4 - dens_comp_a(jlim1) = 1.4 - dens_comp_a(jlim2) = 1.4 - endif - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! molecular weights of generic aerosol species - mw_aer_mac(iso4_a) = 96.0 - mw_aer_mac(ino3_a) = 62.0 - mw_aer_mac(icl_a) = 35.5 - mw_aer_mac(imsa_a) = 95.0 ! CH3SO3 - mw_aer_mac(ico3_a) = 60.0 - mw_aer_mac(inh4_a) = 18.0 - mw_aer_mac(ina_a) = 23.0 - mw_aer_mac(ica_a) = 40.0 - mw_aer_mac(ioin_a) = 1.0 ! not used - mw_aer_mac(ibc_a) = 1.0 ! not used - mw_aer_mac(ioc_a) = 1.0 ! 200 assumed for primary organics - mw_aer_mac(iaro1_a)= 150.0 - mw_aer_mac(iaro2_a)= 150.0 - mw_aer_mac(ialk1_a)= 140.0 - mw_aer_mac(iole1_a)= 140.0 - mw_aer_mac(iapi1_a)= 184.0 - mw_aer_mac(iapi2_a)= 184.0 - mw_aer_mac(ilim1_a)= 200.0 - mw_aer_mac(ilim2_a)= 200.0 - - ! molecular weights of compounds - mw_comp_a(jnh4so4) = 132.0 - mw_comp_a(jlvcite) = 247.0 - mw_comp_a(jnh4hso4)= 115.0 - mw_comp_a(jnh4msa) = 113.0 - mw_comp_a(jnh4no3) = 80.0 - mw_comp_a(jnh4cl) = 53.5 - mw_comp_a(jnacl) = 58.5 - mw_comp_a(jnano3) = 85.0 - mw_comp_a(jna2so4) = 142.0 - mw_comp_a(jna3hso4)= 262.0 - mw_comp_a(jnahso4) = 120.0 - mw_comp_a(jnamsa) = 118.0 - mw_comp_a(jcaso4) = 136.0 - mw_comp_a(jcamsa2) = 230.0 - mw_comp_a(jcano3) = 164.0 - mw_comp_a(jcacl2) = 111.0 - mw_comp_a(jcaco3) = 100.0 - mw_comp_a(jh2so4) = 98.0 - mw_comp_a(jhhso4) = 98.0 - mw_comp_a(jhno3) = 63.0 - mw_comp_a(jhcl) = 36.5 - mw_comp_a(jmsa) = 96.0 - mw_comp_a(joc) = 1.0 - mw_comp_a(jbc) = 1.0 - mw_comp_a(join) = 1.0 - mw_comp_a(jaro1) = 150.0 - mw_comp_a(jaro2) = 150.0 - mw_comp_a(jalk1) = 140.0 - mw_comp_a(jole1) = 140.0 - mw_comp_a(japi1) = 184.0 - mw_comp_a(japi2) = 184.0 - mw_comp_a(jlim1) = 200.0 - mw_comp_a(jlim2) = 200.0 - mw_comp_a(jh2o) = 18.0 - !BSINGH - 05/28/2013(RCE updates) - ! partmc-2.2.1 jun-2012 - !# dens (kg/m^3) ions in soln (1) molec wght (kg/mole) kappa (1) - ! SO4 1800 0 96d-3 0.65 - ! NO3 1800 0 62d-3 0.65 - ! Cl 2200 0 35.5d-3 0.53 - ! NH4 1800 0 18d-3 0.65 - ! MSA 1800 0 95d-3 0.53 - ! ARO1 1400 0 150d-3 0.1 - ! ARO2 1400 0 150d-3 0.1 - ! ALK1 1400 0 140d-3 0.1 - ! OLE1 1400 0 140d-3 0.1 - ! API1 1400 0 184d-3 0.1 - ! API2 1400 0 184d-3 0.1 - ! LIM1 1400 0 200d-3 0.1 - ! LIM2 1400 0 200d-3 0.1 - ! CO3 2600 0 60d-3 0.53 - ! Na 2200 0 23d-3 0.53 - ! Ca 2600 0 40d-3 0.53 - ! OIN 2600 0 1d-3 0.1 - ! OC 1000 0 1d-3 0.001 - ! BC 1800 0 1d-3 0 - ! H2O 1000 0 18d-3 0 - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! densities of generic aerosol species - dens_aer_mac(iso4_a) = 1.8 ! used - dens_aer_mac(ino3_a) = 1.8 ! used - dens_aer_mac(icl_a) = 2.2 ! used - dens_aer_mac(imsa_a) = 1.8 ! used - dens_aer_mac(ico3_a) = 2.6 ! used - dens_aer_mac(inh4_a) = 1.8 ! used - dens_aer_mac(ina_a) = 2.2 ! used - dens_aer_mac(ica_a) = 2.6 ! used - dens_aer_mac(ioin_a) = 2.6 ! used - dens_aer_mac(ioc_a) = 1.0 ! used - dens_aer_mac(ibc_a) = 1.8 ! used - dens_aer_mac(iaro1_a)= 1.0 - dens_aer_mac(iaro2_a)= 1.0 - dens_aer_mac(ialk1_a)= 1.0 - dens_aer_mac(iole1_a)= 1.0 - dens_aer_mac(iapi1_a)= 1.0 - dens_aer_mac(iapi2_a)= 1.0 - dens_aer_mac(ilim1_a)= 1.0 - dens_aer_mac(ilim2_a)= 1.0 - !BSINGH - 05/28/2013(RCE updates) - ! following for comparison with mos31d_bs2 and. mos31e_rz1 - if ( use_mos31e_rz1_densities ) then - dens_aer_mac(ioc_a) = 1.4 - dens_aer_mac(iaro1_a)= 1.4 - dens_aer_mac(iaro2_a)= 1.4 - dens_aer_mac(ialk1_a)= 1.4 - dens_aer_mac(iole1_a)= 1.4 - dens_aer_mac(iapi1_a)= 1.4 - dens_aer_mac(iapi2_a)= 1.4 - dens_aer_mac(ilim1_a)= 1.4 - dens_aer_mac(ilim2_a)= 1.4 - end if - - if ( use_uniform_densities ) then - !BSINGH - 05/28/2013(RCE updates ENDS) - - do iaer = 1, naer - dens_aer_mac(iaer) = 1.6 - enddo - endif!BSINGH - 05/28/2013(RCE updates) - - if (ipmcmos_aero > 0) then - ! use partmc-mosaic densities - dens_aer_mac(1:naer) = (/ & - 1.80, 1.80, 2.20, 1.80, 1.80, 1.40, 1.40, 1.40, 1.40, 1.40, & - 1.40, 1.40, 1.40, 2.60, 2.20, 2.60, 2.60, 1.00, 1.80 /)!BSINGH - 05/28/2013(RCE updates) - ! so4 no3 cl nh4 msa aro1 aro2 alk1 ole1 api1 - ! api2 lim1 lim2 co3 na ca oin oc bc - end if - - if ( use_cam5mam_soa_params > 0 ) then - dens_aer_mac(ioc_a) = 1.0 - dens_aer_mac(ilim2_a) = 1.0 - ! for oc, leave mw=1 because some of the mosaic code requires this - mw_aer_mac(ilim2_a) = 150.0 - dens_comp_a(joc) = 1.0 - dens_comp_a(jlim2) = 1.0 - mw_comp_a(jlim2) = 150.0 - end if - - ! kappa values (hygroscopicities) of generic aerosol species - ! - ! for calculation of ccn properties, kappa of electrolytes - ! should be used - ! the multi-dimensional sectional code needs a "fixed" kappa - ! for each generic aerosol species, just as the older - ! 1d sectional code needs a "fixed" dry density - kappa_aer_mac(iso4_a) = 0.65 - kappa_aer_mac(ino3_a) = 0.65 - kappa_aer_mac(imsa_a) = 0.65 - kappa_aer_mac(inh4_a) = 0.65 - kappa_aer_mac(icl_a) = 0.65 - kappa_aer_mac(ina_a) = 0.65 - kappa_aer_mac(ico3_a) = 0.001 ! ?? - kappa_aer_mac(ica_a) = 0.001 ! ?? - kappa_aer_mac(ioin_a) = 0.001 - kappa_aer_mac(ioc_a) = 0.001 - kappa_aer_mac(ibc_a) = 0.001 - kappa_aer_mac(iaro1_a) = 0.1 - kappa_aer_mac(iaro2_a) = 0.1 - kappa_aer_mac(ialk1_a) = 0.1 - kappa_aer_mac(iole1_a) = 0.1 - kappa_aer_mac(iapi1_a) = 0.1 - kappa_aer_mac(iapi2_a) = 0.1 - kappa_aer_mac(ilim1_a) = 0.1 - kappa_aer_mac(ilim2_a) = 0.1 - !BSINGH - 05/28/2013(RCE updates) - if (ipmcmos_aero > 0) then - ! use partmc-mosaic kappas - kappa_aer_mac(1:naer) = (/ & - 0.65, 0.65, 0.53, 0.65, 0.53, 0.10, 0.10, 0.10, 0.10, 0.10, & - 0.10, 0.10, 0.10, 0.53, 0.53, 0.53, 0.10, 0.001, 0.0 /) - ! so4 no3 cl nh4 msa aro1 aro2 alk1 ole1 api1 - ! api2 lim1 lim2 co3 na ca oin oc bc - end if - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! partial molar volumes of condensing species - partial_molar_vol(ih2so4_g) = 51.83 - partial_molar_vol(ihno3_g) = 31.45 - partial_molar_vol(ihcl_g) = 20.96 - partial_molar_vol(inh3_g) = 24.03 - partial_molar_vol(imsa_g) = 53.33 - partial_molar_vol(iaro1_g) = 150.0 - partial_molar_vol(iaro2_g) = 150.0 - partial_molar_vol(ialk1_g) = 140.0 - partial_molar_vol(iole1_g) = 140.0 - partial_molar_vol(iapi1_g) = 184.0 - partial_molar_vol(iapi2_g) = 184.0 - partial_molar_vol(ilim1_g) = 200.0 - partial_molar_vol(ilim2_g) = 200.0 - - ! refractive index - ref_index_a(jnh4so4) = cmplx(1.52,0.) - ref_index_a(jlvcite) = cmplx(1.50,0.) - ref_index_a(jnh4hso4)= cmplx(1.47,0.) - ref_index_a(jnh4msa) = cmplx(1.50,0.) ! assumed - ref_index_a(jnh4no3) = cmplx(1.50,0.) - ref_index_a(jnh4cl) = cmplx(1.50,0.) - ref_index_a(jnacl) = cmplx(1.45,0.) - ref_index_a(jnano3) = cmplx(1.50,0.) - ref_index_a(jna2so4) = cmplx(1.50,0.) - ref_index_a(jna3hso4)= cmplx(1.50,0.) - ref_index_a(jnahso4) = cmplx(1.50,0.) - ref_index_a(jnamsa) = cmplx(1.50,0.) ! assumed - ref_index_a(jcaso4) = cmplx(1.56,0.006) - ref_index_a(jcamsa2) = cmplx(1.56,0.006) ! assumed - ref_index_a(jcano3) = cmplx(1.56,0.006) - ref_index_a(jcacl2) = cmplx(1.52,0.006) - ref_index_a(jcaco3) = cmplx(1.68,0.006) - ref_index_a(jh2so4) = cmplx(1.43,0.) - ref_index_a(jhhso4) = cmplx(1.43,0.) - ref_index_a(jhno3) = cmplx(1.50,0.) - ref_index_a(jhcl) = cmplx(1.50,0.) - ref_index_a(jmsa) = cmplx(1.43,0.) ! assumed - ref_index_a(joc) = cmplx(1.45,0.) - ref_index_a(jbc) = cmplx(1.82,0.74) - ref_index_a(join) = cmplx(1.55,0.006) - ref_index_a(jaro1) = cmplx(1.45,0.) - ref_index_a(jaro2) = cmplx(1.45,0.) - ref_index_a(jalk1) = cmplx(1.45,0.) - ref_index_a(jole1) = cmplx(1.45,0.) - ref_index_a(japi1) = cmplx(1.45,0.) - ref_index_a(japi2) = cmplx(1.45,0.) - ref_index_a(jlim1) = cmplx(1.45,0.) - ref_index_a(jlim2) = cmplx(1.45,0.) - ref_index_a(jh2o) = cmplx(1.33,0.) - - ! jsalt_index - jsalt_index(jnh4so4) = 5 ! AS - jsalt_index(jlvcite) = 2 ! LV - jsalt_index(jnh4hso4)= 1 ! AB - jsalt_index(jnh4no3) = 2 ! AN - jsalt_index(jnh4cl) = 1 ! AC - jsalt_index(jna2so4) = 60 ! SS - jsalt_index(jnahso4) = 10 ! SB - jsalt_index(jnano3) = 40 ! SN - jsalt_index(jnacl) = 10 ! SC - jsalt_index(jcano3) = 120 ! CN - jsalt_index(jcacl2) = 80 ! CC - jsalt_index(jnh4msa) = 0 ! AM zero for now - jsalt_index(jnamsa) = 0 ! SM zero for now - jsalt_index(jcamsa2) = 0 ! CM zero for now - - ! Aerosol Indices - ! AC = 1, AN = 2, AS = 5, SC = 10, SN = 40, SS = 60, CC = 80, CN = 120, - ! AB = 1, LV = 2, SB = 10 - ! - ! SULFATE-POOR DOMAIN - jsulf_poor(1) = 1 ! AC - jsulf_poor(2) = 2 ! AN - jsulf_poor(5) = 3 ! AS - jsulf_poor(10) = 4 ! SC - jsulf_poor(40) = 5 ! SN - jsulf_poor(60) = 6 ! SS - jsulf_poor(80) = 7 ! CC - jsulf_poor(120) = 8 ! CN - jsulf_poor(3) = 9 ! AN + AC - jsulf_poor(6) = 10 ! AS + AC - jsulf_poor(7) = 11 ! AS + AN - jsulf_poor(8) = 12 ! AS + AN + AC - jsulf_poor(11) = 13 ! SC + AC - jsulf_poor(41) = 14 ! SN + AC - jsulf_poor(42) = 15 ! SN + AN - jsulf_poor(43) = 16 ! SN + AN + AC - jsulf_poor(50) = 17 ! SN + SC - jsulf_poor(51) = 18 ! SN + SC + AC - jsulf_poor(61) = 19 ! SS + AC - jsulf_poor(62) = 20 ! SS + AN - jsulf_poor(63) = 21 ! SS + AN + AC - jsulf_poor(65) = 22 ! SS + AS - jsulf_poor(66) = 23 ! SS + AS + AC - jsulf_poor(67) = 24 ! SS + AS + AN - jsulf_poor(68) = 25 ! SS + AS + AN + AC - jsulf_poor(70) = 26 ! SS + SC - jsulf_poor(71) = 27 ! SS + SC + AC - jsulf_poor(100) = 28 ! SS + SN - jsulf_poor(101) = 29 ! SS + SN + AC - jsulf_poor(102) = 30 ! SS + SN + AN - jsulf_poor(103) = 31 ! SS + SN + AN + AC - jsulf_poor(110) = 32 ! SS + SN + SC - jsulf_poor(111) = 33 ! SS + SN + SC + AC - jsulf_poor(81) = 34 ! CC + AC - jsulf_poor(90) = 35 ! CC + SC - jsulf_poor(91) = 36 ! CC + SC + AC - jsulf_poor(121) = 37 ! CN + AC - jsulf_poor(122) = 38 ! CN + AN - jsulf_poor(123) = 39 ! CN + AN + AC - jsulf_poor(130) = 40 ! CN + SC - jsulf_poor(131) = 41 ! CN + SC + AC - jsulf_poor(160) = 42 ! CN + SN - jsulf_poor(161) = 43 ! CN + SN + AC - jsulf_poor(162) = 44 ! CN + SN + AN - jsulf_poor(163) = 45 ! CN + SN + AN + AC - jsulf_poor(170) = 46 ! CN + SN + SC - jsulf_poor(171) = 47 ! CN + SN + SC + AC - jsulf_poor(200) = 48 ! CN + CC - jsulf_poor(201) = 49 ! CN + CC + AC - jsulf_poor(210) = 50 ! CN + CC + SC - jsulf_poor(211) = 51 ! CN + CC + SC + AC - ! - ! SULFATE-RICH DOMAIN - jsulf_rich(1) = 52 ! AB - jsulf_rich(2) = 53 ! LV - jsulf_rich(10) = 54 ! SB - jsulf_rich(3) = 55 ! AB + LV - jsulf_rich(7) = 56 ! AS + LV - jsulf_rich(70) = 57 ! SS + SB - jsulf_rich(62) = 58 ! SS + LV - jsulf_rich(67) = 59 ! SS + AS + LV - jsulf_rich(61) = 60 ! SS + AB - jsulf_rich(63) = 61 ! SS + LV + AB - jsulf_rich(11) = 62 ! SB + AB - jsulf_rich(71) = 63 ! SS + SB + AB - jsulf_rich(5) = 3 ! AS - jsulf_rich(60) = 6 ! SS - jsulf_rich(65) = 22 ! SS + AS - - - - ! - ! polynomial coefficients for binary molality (used in ZSR equation) - ! - ! - ! a_zsr for aw < 0.97 - ! - ! (NH4)2SO4 - je = jnh4so4 - a_zsr(1,je) = 1.30894 - a_zsr(2,je) = -7.09922 - a_zsr(3,je) = 20.62831 - a_zsr(4,je) = -32.19965 - a_zsr(5,je) = 25.17026 - a_zsr(6,je) = -7.81632 - aw_min(je) = 0.1 - ! - ! (NH4)3H(SO4)2 - je = jlvcite - a_zsr(1,je) = 1.10725 - a_zsr(2,je) = -5.17978 - a_zsr(3,je) = 12.29534 - a_zsr(4,je) = -16.32545 - a_zsr(5,je) = 11.29274 - a_zsr(6,je) = -3.19164 - aw_min(je) = 0.1 - ! - ! NH4HSO4 - je = jnh4hso4 - a_zsr(1,je) = 1.15510 - a_zsr(2,je) = -3.20815 - a_zsr(3,je) = 2.71141 - a_zsr(4,je) = 2.01155 - a_zsr(5,je) = -4.71014 - a_zsr(6,je) = 2.04616 - aw_min(je) = 0.1 - ! - ! NH4MSA (assumed same as NH4HSO4) - je = jnh4msa - a_zsr(1,je) = 1.15510 - a_zsr(2,je) = -3.20815 - a_zsr(3,je) = 2.71141 - a_zsr(4,je) = 2.01155 - a_zsr(5,je) = -4.71014 - a_zsr(6,je) = 2.04616 - aw_min(je) = 0.1 - ! - ! NH4NO3 - je = jnh4no3 - a_zsr(1,je) = 0.43507 - a_zsr(2,je) = 6.38220 - a_zsr(3,je) = -30.19797 - a_zsr(4,je) = 53.36470 - a_zsr(5,je) = -43.44203 - a_zsr(6,je) = 13.46158 - aw_min(je) = 0.1 - ! - ! NH4Cl: revised on Nov 13, 2003. based on Chan and Ha (1999) JGR. - je = jnh4cl - a_zsr(1,je) = 0.45309 - a_zsr(2,je) = 2.65606 - a_zsr(3,je) = -14.7730 - a_zsr(4,je) = 26.2936 - a_zsr(5,je) = -20.5735 - a_zsr(6,je) = 5.94255 - aw_min(je) = 0.1 - ! - ! NaCl - je = jnacl - a_zsr(1,je) = 0.42922 - a_zsr(2,je) = -1.17718 - a_zsr(3,je) = 2.80208 - a_zsr(4,je) = -4.51097 - a_zsr(5,je) = 3.76963 - a_zsr(6,je) = -1.31359 - aw_min(je) = 0.1 - ! - ! NaNO3 - je = jnano3 - a_zsr(1,je) = 1.34966 - a_zsr(2,je) = -5.20116 - a_zsr(3,je) = 11.49011 - a_zsr(4,je) = -14.41380 - a_zsr(5,je) = 9.07037 - a_zsr(6,je) = -2.29769 - aw_min(je) = 0.1 - ! - ! Na2SO4 - je = jna2so4 - a_zsr(1,je) = 0.39888 - a_zsr(2,je) = -1.27150 - a_zsr(3,je) = 3.42792 - a_zsr(4,je) = -5.92632 - a_zsr(5,je) = 5.33351 - a_zsr(6,je) = -1.96541 - aw_min(je) = 0.1 - ! - ! Na3H(SO4)2 added on 1/14/2004 - je = jna3hso4 - a_zsr(1,je) = 0.31480 - a_zsr(2,je) = -1.01087 - a_zsr(3,je) = 2.44029 - a_zsr(4,je) = -3.66095 - a_zsr(5,je) = 2.77632 - a_zsr(6,je) = -0.86058 - aw_min(je) = 0.1 - ! - ! NaHSO4 - je = jnahso4 - a_zsr(1,je) = 0.62764 - a_zsr(2,je) = -1.63520 - a_zsr(3,je) = 4.62531 - a_zsr(4,je) = -10.06925 - a_zsr(5,je) = 10.33547 - a_zsr(6,je) = -3.88729 - aw_min(je) = 0.1 - ! - ! NaMSA (assumed same as NaHSO4) - je = jnamsa - a_zsr(1,je) = 0.62764 - a_zsr(2,je) = -1.63520 - a_zsr(3,je) = 4.62531 - a_zsr(4,je) = -10.06925 - a_zsr(5,je) = 10.33547 - a_zsr(6,je) = -3.88729 - aw_min(je) = 0.1 - ! - ! Ca(NO3)2 - je = jcano3 - a_zsr(1,je) = 0.38895 - a_zsr(2,je) = -1.16013 - a_zsr(3,je) = 2.16819 - a_zsr(4,je) = -2.23079 - a_zsr(5,je) = 1.00268 - a_zsr(6,je) = -0.16923 - aw_min(je) = 0.1 - ! - ! CaCl2: Kim and Seinfeld - je = jcacl2 - a_zsr(1,je) = 0.29891 - a_zsr(2,je) = -1.31104 - a_zsr(3,je) = 3.68759 - a_zsr(4,je) = -5.81708 - a_zsr(5,je) = 4.67520 - a_zsr(6,je) = -1.53223 - aw_min(je) = 0.1 - ! - ! H2SO4 - je = jh2so4 - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 0.1 - ! - ! MSA (assumed same as H2SO4) - je = jmsa - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 0.1 - ! - ! HHSO4 - je = jhhso4 - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 1.0 - ! - ! HNO3 - je = jhno3 - a_zsr(1,je) = 0.75876 - a_zsr(2,je) = -3.31529 - a_zsr(3,je) = 9.26392 - a_zsr(4,je) = -14.89799 - a_zsr(5,je) = 12.08781 - a_zsr(6,je) = -3.89958 - aw_min(je) = 0.1 - ! - ! HCl - je = jhcl - a_zsr(1,je) = 0.31133 - a_zsr(2,je) = -0.79688 - a_zsr(3,je) = 1.93995 - a_zsr(4,je) = -3.31582 - a_zsr(5,je) = 2.93513 - a_zsr(6,je) = -1.07268 - aw_min(je) = 0.1 - ! - ! CaSO4 - je = jcaso4 - a_zsr(1,je) = 0.0 - a_zsr(2,je) = 0.0 - a_zsr(3,je) = 0.0 - a_zsr(4,je) = 0.0 - a_zsr(5,je) = 0.0 - a_zsr(6,je) = 0.0 - aw_min(je) = 1.0 - ! - ! Ca(MSA)2 (assumed same as Ca(NO3)2) - je = jcamsa2 - a_zsr(1,je) = 0.38895 - a_zsr(2,je) = -1.16013 - a_zsr(3,je) = 2.16819 - a_zsr(4,je) = -2.23079 - a_zsr(5,je) = 1.00268 - a_zsr(6,je) = -0.16923 - aw_min(je) = 0.1 - ! - ! CaCO3 - je = jcaco3 - a_zsr(1,je) = 0.0 - a_zsr(2,je) = 0.0 - a_zsr(3,je) = 0.0 - a_zsr(4,je) = 0.0 - a_zsr(5,je) = 0.0 - a_zsr(6,je) = 0.0 - aw_min(je) = 1.0 - - - - !------------------------------------------- - ! b_zsr for aw => 0.97 to 0.99999 - ! - ! (NH4)2SO4 - b_zsr(jnh4so4) = 28.0811 - ! - ! (NH4)3H(SO4)2 - b_zsr(jlvcite) = 14.7178 - ! - ! NH4HSO4 - b_zsr(jnh4hso4) = 29.4779 - ! - ! NH4MSA - b_zsr(jnh4msa) = 29.4779 ! assumed same as NH4HSO4 - ! - ! NH4NO3 - b_zsr(jnh4no3) = 33.4049 - ! - ! NH4Cl - b_zsr(jnh4cl) = 30.8888 - ! - ! NaCl - b_zsr(jnacl) = 29.8375 - ! - ! NaNO3 - b_zsr(jnano3) = 32.2756 - ! - ! Na2SO4 - b_zsr(jna2so4) = 27.6889 - ! - ! Na3H(SO4)2 - b_zsr(jna3hso4) = 14.2184 - ! - ! NaHSO4 - b_zsr(jnahso4) = 28.3367 - ! - ! NaMSA - b_zsr(jnamsa) = 28.3367 ! assumed same as NaHSO4 - ! - ! Ca(NO3)2 - b_zsr(jcano3) = 18.3661 - ! - ! CaCl2 - b_zsr(jcacl2) = 20.8792 - ! - ! H2SO4 - b_zsr(jh2so4) = 26.7347 - ! - ! HHSO4 - b_zsr(jhhso4) = 26.7347 - ! - ! HNO3 - b_zsr(jhno3) = 28.8257 - ! - ! HCl - b_zsr(jhcl) = 27.7108 - ! - ! MSA - b_zsr(jmsa) = 26.7347 ! assumed same as H2SO4 - ! - ! CaSO4 - b_zsr(jcaso4) = 0.0 - ! - ! Ca(MSA)2 - b_zsr(jcamsa2) = 18.3661 ! assumed same as Ca(NO3)2 - ! - ! CaCO3 - b_zsr(jcaco3) = 0.0 - - - - - - - - - - !------------------------------------------- - ! Li and Lu (2001) Surface tension model - ! G_MX [mol/cm^2]; K_MX [-] - ! - ! (NH4)2SO4 - G_MX(jnh4so4) = -8.79e-7*1.e-4 - K_MX(jnh4so4) = 3.84e+1 - ! - ! (NH4)3H(SO4)2 - G_MX(jlvcite) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jlvcite) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4HSO4 - G_MX(jnh4hso4) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jnh4hso4) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4MSA - G_MX(jnh4msa) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jnh4msa) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4NO3 - G_MX(jnh4no3) = -3.08e-6*1.e-4 - K_MX(jnh4no3) = 4.89e-1 - ! - ! NH4Cl - G_MX(jnh4cl) = -1.01e-6*1.e-4 - K_MX(jnh4cl) = 1.3 - ! - ! NaCl - G_MX(jnacl) = -1.05e-6*1.e-4 - K_MX(jnacl) = 1.2 - ! - ! NaNO3 - G_MX(jnano3) = -1.66e-6*1.e-4 - K_MX(jnano3) = 1.25 - ! - ! Na2SO4 - G_MX(jna2so4) = -8.37e-7*1.e-4 - K_MX(jna2so4) = 7.57e+1 - ! - ! Na3H(SO4)2 - G_MX(jna3hso4) = -8.37e-7*1.e-4 ! assumed same as Na2SO4 - K_MX(jna3hso4) = 7.57e+1 ! assumed same as Na2SO4 - ! - ! NaHSO4 - G_MX(jnahso4) = -8.37e-7*1.e-4 ! assumed same as Na2SO4 - K_MX(jnahso4) = 7.57e+1 ! assumed same as Na2SO4 - ! - ! NaMSA - G_MX(jnamsa) = -8.37e-7*1.e-4 - K_MX(jnamsa) = 7.57e+1 - ! - ! Ca(NO3)2 - G_MX(jcano3) = -4.88e-7*1.e-4 ! assumed same as CaCl2 - K_MX(jcano3) = 1.50e+1 ! assumed same as CaCl2 - ! - ! CaCl2 - G_MX(jcacl2) = -4.88e-7*1.e-4 - K_MX(jcacl2) = 1.50e+1 - ! - ! H2SO4 - G_MX(jh2so4) = -6.75e-8*1.e-4 - K_MX(jh2so4) = 1.65e+3 - ! - ! HHSO4 - G_MX(jh2so4) = -6.75e-8*1.e-4 ! assumed same as H2SO4 - K_MX(jh2so4) = 1.65e+3 ! assumed same as H2SO4 - ! - ! HNO3 - G_MX(jhno3) = 8.05e-7*1.e-4 - K_MX(jhno3) = 1.06e-1 - ! - ! HCl - G_MX(jhcl) = 4.12e-7*1.e-4 - K_MX(jhcl) = 4.68e-3 - !& - - ! MSA - G_MX(jmsa) = 8.05e-7*1.e-4 ! assumed same as HNO3 - K_MX(jmsa) = 1.06e-1 ! assumed same as HNO3 - ! - ! CaSO4 - G_MX(jmsa) = 0.0*1.e-4 ! assumed - K_MX(jmsa) = 0.0 ! assumed - ! - ! Ca(MSA)2 - G_MX(jcamsa2) = 0.0*1.e-4 ! assumed - K_MX(jcamsa2) = 0.0 ! assumed - ! - ! CaCO3 - G_MX(jcaco3) = 0.0*1.e-4 ! assumed - K_MX(jcaco3) = 0.0 ! assumed - - - - - - - - !---------------------------------------------------------------- - ! parameters for MTEM mixing rule (Zaveri, Easter, and Wexler, 2005) - ! log_gamZ(jA,jE) A in E - !---------------------------------------------------------------- - ! - b_mtem(:,:,:) = 0.0_r8 !BSINGH - Temporarily initialized, please modify if required *Ask dick about it* the code blows up if i initialize it with nan - ! (NH4)2SO4 in E - jA = jnh4so4 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.94685 - b_mtem(2,jA,jE) = 17.3328 - b_mtem(3,jA,jE) = -64.8441 - b_mtem(4,jA,jE) = 122.7070 - b_mtem(5,jA,jE) = -114.4373 - b_mtem(6,jA,jE) = 41.6811 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.7503 - b_mtem(2,jA,jE) = 4.3806 - b_mtem(3,jA,jE) = -1.1110 - b_mtem(4,jA,jE) = -1.7005 - b_mtem(5,jA,jE) = -4.4207 - b_mtem(6,jA,jE) = 5.1990 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -2.06952 - b_mtem(2,jA,jE) = 7.1240 - b_mtem(3,jA,jE) = -24.4274 - b_mtem(4,jA,jE) = 51.1458 - b_mtem(5,jA,jE) = -54.2056 - b_mtem(6,jA,jE) = 22.0606 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -2.17361 - b_mtem(2,jA,jE) = 15.9919 - b_mtem(3,jA,jE) = -69.0952 - b_mtem(4,jA,jE) = 139.8860 - b_mtem(5,jA,jE) = -134.9890 - b_mtem(6,jA,jE) = 49.8877 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -4.4370 - b_mtem(2,jA,jE) = 24.0243 - b_mtem(3,jA,jE) = -76.2437 - b_mtem(4,jA,jE) = 128.6660 - b_mtem(5,jA,jE) = -110.0900 - b_mtem(6,jA,jE) = 37.7414 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -1.5394 - b_mtem(2,jA,jE) = 5.8671 - b_mtem(3,jA,jE) = -22.7726 - b_mtem(4,jA,jE) = 47.0547 - b_mtem(5,jA,jE) = -47.8266 - b_mtem(6,jA,jE) = 18.8489 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -0.35750 - b_mtem(2,jA,jE) = -3.82466 - b_mtem(3,jA,jE) = 4.55462 - b_mtem(4,jA,jE) = 5.05402 - b_mtem(5,jA,jE) = -14.7476 - b_mtem(6,jA,jE) = 8.8009 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -2.15146 - b_mtem(2,jA,jE) = 5.50205 - b_mtem(3,jA,jE) = -19.1476 - b_mtem(4,jA,jE) = 39.1880 - b_mtem(5,jA,jE) = -39.9460 - b_mtem(6,jA,jE) = 16.0700 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -2.52604 - b_mtem(2,jA,jE) = 9.76022 - b_mtem(3,jA,jE) = -35.2540 - b_mtem(4,jA,jE) = 71.2981 - b_mtem(5,jA,jE) = -71.8207 - b_mtem(6,jA,jE) = 28.0758 - - ! - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -4.13219 - b_mtem(2,jA,jE) = 13.8863 - b_mtem(3,jA,jE) = -34.5387 - b_mtem(4,jA,jE) = 56.5012 - b_mtem(5,jA,jE) = -51.8702 - b_mtem(6,jA,jE) = 19.6232 - - ! - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.53482 - b_mtem(2,jA,jE) = 12.3333 - b_mtem(3,jA,jE) = -46.1020 - b_mtem(4,jA,jE) = 90.4775 - b_mtem(5,jA,jE) = -88.1254 - b_mtem(6,jA,jE) = 33.4715 - - ! - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -3.23425 - b_mtem(2,jA,jE) = 18.7842 - b_mtem(3,jA,jE) = -78.7807 - b_mtem(4,jA,jE) = 161.517 - b_mtem(5,jA,jE) = -154.940 - b_mtem(6,jA,jE) = 56.2252 - - ! - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -1.25316 - b_mtem(2,jA,jE) = 7.40960 - b_mtem(3,jA,jE) = -34.8929 - b_mtem(4,jA,jE) = 72.8853 - b_mtem(5,jA,jE) = -72.4503 - b_mtem(6,jA,jE) = 27.7706 - - - !----------------- - ! NH4NO3 in E - jA = jnh4no3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.5201 - b_mtem(2,jA,jE) = 21.6584 - b_mtem(3,jA,jE) = -72.1499 - b_mtem(4,jA,jE) = 126.7000 - b_mtem(5,jA,jE) = -111.4550 - b_mtem(6,jA,jE) = 38.5677 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.2630 - b_mtem(2,jA,jE) = -0.1518 - b_mtem(3,jA,jE) = 17.0898 - b_mtem(4,jA,jE) = -36.7832 - b_mtem(5,jA,jE) = 29.8407 - b_mtem(6,jA,jE) = -7.9314 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.3851 - b_mtem(2,jA,jE) = -0.4462 - b_mtem(3,jA,jE) = 8.4567 - b_mtem(4,jA,jE) = -11.5988 - b_mtem(5,jA,jE) = 2.9802 - b_mtem(6,jA,jE) = 1.8132 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.7602 - b_mtem(2,jA,jE) = 10.4044 - b_mtem(3,jA,jE) = -35.5894 - b_mtem(4,jA,jE) = 64.3584 - b_mtem(5,jA,jE) = -57.8931 - b_mtem(6,jA,jE) = 20.2141 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -3.24346 - b_mtem(2,jA,jE) = 16.2794 - b_mtem(3,jA,jE) = -48.7601 - b_mtem(4,jA,jE) = 79.2246 - b_mtem(5,jA,jE) = -65.8169 - b_mtem(6,jA,jE) = 22.1500 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -1.75658 - b_mtem(2,jA,jE) = 7.71384 - b_mtem(3,jA,jE) = -22.7984 - b_mtem(4,jA,jE) = 39.1532 - b_mtem(5,jA,jE) = -34.6165 - b_mtem(6,jA,jE) = 12.1283 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = -0.97178 - b_mtem(2,jA,jE) = 6.61964 - b_mtem(3,jA,jE) = -26.2353 - b_mtem(4,jA,jE) = 50.5259 - b_mtem(5,jA,jE) = -47.6586 - b_mtem(6,jA,jE) = 17.5074 - - ! in CaCl2 added on 12/22/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = -0.41515 - b_mtem(2,jA,jE) = 6.44101 - b_mtem(3,jA,jE) = -26.4473 - b_mtem(4,jA,jE) = 49.0718 - b_mtem(5,jA,jE) = -44.2631 - b_mtem(6,jA,jE) = 15.3771 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -1.20644 - b_mtem(2,jA,jE) = 5.70117 - b_mtem(3,jA,jE) = -18.2783 - b_mtem(4,jA,jE) = 31.7199 - b_mtem(5,jA,jE) = -27.8703 - b_mtem(6,jA,jE) = 9.7299 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -0.680862 - b_mtem(2,jA,jE) = 3.59456 - b_mtem(3,jA,jE) = -10.7969 - b_mtem(4,jA,jE) = 17.8434 - b_mtem(5,jA,jE) = -15.3165 - b_mtem(6,jA,jE) = 5.17123 - - - !---------- - ! NH4Cl in E - jA = jnh4cl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.8850 - b_mtem(2,jA,jE) = 20.6970 - b_mtem(3,jA,jE) = -70.6810 - b_mtem(4,jA,jE) = 124.3690 - b_mtem(5,jA,jE) = -109.2880 - b_mtem(6,jA,jE) = 37.5831 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.9386 - b_mtem(2,jA,jE) = 1.3238 - b_mtem(3,jA,jE) = 11.8500 - b_mtem(4,jA,jE) = -28.1168 - b_mtem(5,jA,jE) = 21.8543 - b_mtem(6,jA,jE) = -5.1671 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.9559 - b_mtem(2,jA,jE) = 0.8121 - b_mtem(3,jA,jE) = 4.3644 - b_mtem(4,jA,jE) = -8.9258 - b_mtem(5,jA,jE) = 4.2362 - b_mtem(6,jA,jE) = 0.2891 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.0377 - b_mtem(2,jA,jE) = 6.0752 - b_mtem(3,jA,jE) = -30.8641 - b_mtem(4,jA,jE) = 63.3095 - b_mtem(5,jA,jE) = -61.0070 - b_mtem(6,jA,jE) = 22.1734 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.8336 - b_mtem(2,jA,jE) = 12.8160 - b_mtem(3,jA,jE) = -42.3388 - b_mtem(4,jA,jE) = 71.1816 - b_mtem(5,jA,jE) = -60.5708 - b_mtem(6,jA,jE) = 20.5853 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.1429 - b_mtem(2,jA,jE) = 2.3561 - b_mtem(3,jA,jE) = -10.4425 - b_mtem(4,jA,jE) = 20.8951 - b_mtem(5,jA,jE) = -20.7739 - b_mtem(6,jA,jE) = 7.9355 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.76235 - b_mtem(2,jA,jE) = 3.08323 - b_mtem(3,jA,jE) = -23.6772 - b_mtem(4,jA,jE) = 53.7415 - b_mtem(5,jA,jE) = -55.4043 - b_mtem(6,jA,jE) = 21.2944 - - ! in CaCl2 (revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.13864 - b_mtem(2,jA,jE) = -0.340539 - b_mtem(3,jA,jE) = -8.67025 - b_mtem(4,jA,jE) = 22.8008 - b_mtem(5,jA,jE) = -24.5181 - b_mtem(6,jA,jE) = 9.3663 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.42532 - b_mtem(2,jA,jE) = -14.1755 - b_mtem(3,jA,jE) = 38.804 - b_mtem(4,jA,jE) = -58.2437 - b_mtem(5,jA,jE) = 43.5431 - b_mtem(6,jA,jE) = -12.5824 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.330337 - b_mtem(2,jA,jE) = 0.0778934 - b_mtem(3,jA,jE) = -2.30492 - b_mtem(4,jA,jE) = 4.73003 - b_mtem(5,jA,jE) = -4.80849 - b_mtem(6,jA,jE) = 1.78866 - - - - !---------- - ! Na2SO4 in E - jA = jna2so4 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.6982 - b_mtem(2,jA,jE) = 22.9875 - b_mtem(3,jA,jE) = -98.9840 - b_mtem(4,jA,jE) = 198.0180 - b_mtem(5,jA,jE) = -188.7270 - b_mtem(6,jA,jE) = 69.0548 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.4844 - b_mtem(2,jA,jE) = 6.5420 - b_mtem(3,jA,jE) = -9.8998 - b_mtem(4,jA,jE) = 11.3884 - b_mtem(5,jA,jE) = -13.6842 - b_mtem(6,jA,jE) = 7.7411 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.3325 - b_mtem(2,jA,jE) = 13.0406 - b_mtem(3,jA,jE) = -56.1935 - b_mtem(4,jA,jE) = 107.1170 - b_mtem(5,jA,jE) = -97.3721 - b_mtem(6,jA,jE) = 34.3763 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.2832 - b_mtem(2,jA,jE) = 12.8526 - b_mtem(3,jA,jE) = -62.2087 - b_mtem(4,jA,jE) = 130.3876 - b_mtem(5,jA,jE) = -128.2627 - b_mtem(6,jA,jE) = 48.0340 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -3.5384 - b_mtem(2,jA,jE) = 21.3758 - b_mtem(3,jA,jE) = -70.7638 - b_mtem(4,jA,jE) = 121.1580 - b_mtem(5,jA,jE) = -104.6230 - b_mtem(6,jA,jE) = 36.0557 - - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 0.2175 - b_mtem(2,jA,jE) = -0.5648 - b_mtem(3,jA,jE) = -8.0288 - b_mtem(4,jA,jE) = 25.9734 - b_mtem(5,jA,jE) = -32.3577 - b_mtem(6,jA,jE) = 14.3924 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -0.309617 - b_mtem(2,jA,jE) = -1.82899 - b_mtem(3,jA,jE) = -1.5505 - b_mtem(4,jA,jE) = 13.3847 - b_mtem(5,jA,jE) = -20.1284 - b_mtem(6,jA,jE) = 9.93163 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -0.259455 - b_mtem(2,jA,jE) = -0.819366 - b_mtem(3,jA,jE) = -4.28964 - b_mtem(4,jA,jE) = 16.4305 - b_mtem(5,jA,jE) = -21.8546 - b_mtem(6,jA,jE) = 10.3044 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -1.84257 - b_mtem(2,jA,jE) = 7.85788 - b_mtem(3,jA,jE) = -29.9275 - b_mtem(4,jA,jE) = 61.7515 - b_mtem(5,jA,jE) = -63.2308 - b_mtem(6,jA,jE) = 24.9542 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -1.05891 - b_mtem(2,jA,jE) = 2.84831 - b_mtem(3,jA,jE) = -21.1827 - b_mtem(4,jA,jE) = 57.5175 - b_mtem(5,jA,jE) = -64.8120 - b_mtem(6,jA,jE) = 26.1986 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.16584 - b_mtem(2,jA,jE) = 8.50075 - b_mtem(3,jA,jE) = -44.3420 - b_mtem(4,jA,jE) = 97.3974 - b_mtem(5,jA,jE) = -98.4549 - b_mtem(6,jA,jE) = 37.6104 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -1.95805 - b_mtem(2,jA,jE) = 6.62417 - b_mtem(3,jA,jE) = -31.8072 - b_mtem(4,jA,jE) = 77.8603 - b_mtem(5,jA,jE) = -84.6458 - b_mtem(6,jA,jE) = 33.4963 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.36045 - b_mtem(2,jA,jE) = 3.55223 - b_mtem(3,jA,jE) = -24.0327 - b_mtem(4,jA,jE) = 54.4879 - b_mtem(5,jA,jE) = -56.6531 - b_mtem(6,jA,jE) = 22.4956 - - - !---------- - ! NaNO3 in E - jA = jnano3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.5888 - b_mtem(2,jA,jE) = 17.6192 - b_mtem(3,jA,jE) = -63.2183 - b_mtem(4,jA,jE) = 115.3520 - b_mtem(5,jA,jE) = -104.0860 - b_mtem(6,jA,jE) = 36.7390 - - ! in NH4NO3 - jE = jnh4no3 - - b_mtem(1,jA,jE) = -2.0669 - b_mtem(2,jA,jE) = 1.4792 - b_mtem(3,jA,jE) = 10.5261 - b_mtem(4,jA,jE) = -27.0987 - b_mtem(5,jA,jE) = 23.0591 - b_mtem(6,jA,jE) = -6.0938 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.8325 - b_mtem(2,jA,jE) = 3.9933 - b_mtem(3,jA,jE) = -15.3789 - b_mtem(4,jA,jE) = 30.4050 - b_mtem(5,jA,jE) = -29.4204 - b_mtem(6,jA,jE) = 11.0597 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.1233 - b_mtem(2,jA,jE) = 8.3998 - b_mtem(3,jA,jE) = -31.9002 - b_mtem(4,jA,jE) = 60.1450 - b_mtem(5,jA,jE) = -55.5503 - b_mtem(6,jA,jE) = 19.7757 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -2.5386 - b_mtem(2,jA,jE) = 13.9039 - b_mtem(3,jA,jE) = -42.8467 - b_mtem(4,jA,jE) = 69.7442 - b_mtem(5,jA,jE) = -57.8988 - b_mtem(6,jA,jE) = 19.4635 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.4351 - b_mtem(2,jA,jE) = 2.8311 - b_mtem(3,jA,jE) = -11.4485 - b_mtem(4,jA,jE) = 22.7201 - b_mtem(5,jA,jE) = -22.4228 - b_mtem(6,jA,jE) = 8.5792 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = -0.72060 - b_mtem(2,jA,jE) = 5.64915 - b_mtem(3,jA,jE) = -23.5020 - b_mtem(4,jA,jE) = 46.0078 - b_mtem(5,jA,jE) = -43.8075 - b_mtem(6,jA,jE) = 16.1652 - - ! in CaCl2 - jE = jcacl2 - - b_mtem(1,jA,jE) = 0.003928 - b_mtem(2,jA,jE) = 3.54724 - b_mtem(3,jA,jE) = -18.6057 - b_mtem(4,jA,jE) = 38.1445 - b_mtem(5,jA,jE) = -36.7745 - b_mtem(6,jA,jE) = 13.4529 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -1.1712 - b_mtem(2,jA,jE) = 7.20907 - b_mtem(3,jA,jE) = -22.9215 - b_mtem(4,jA,jE) = 38.1257 - b_mtem(5,jA,jE) = -32.0759 - b_mtem(6,jA,jE) = 10.6443 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.738022 - b_mtem(2,jA,jE) = -1.14313 - b_mtem(3,jA,jE) = 0.32251 - b_mtem(4,jA,jE) = 0.838679 - b_mtem(5,jA,jE) = -1.81747 - b_mtem(6,jA,jE) = 0.873986 - - - !---------- - ! NaCl in E - jA = jnacl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.9525 - b_mtem(2,jA,jE) = 16.6433 - b_mtem(3,jA,jE) = -61.7090 - b_mtem(4,jA,jE) = 112.9910 - b_mtem(5,jA,jE) = -101.9370 - b_mtem(6,jA,jE) = 35.7760 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.7525 - b_mtem(2,jA,jE) = 3.0713 - b_mtem(3,jA,jE) = 4.8063 - b_mtem(4,jA,jE) = -17.5334 - b_mtem(5,jA,jE) = 14.2872 - b_mtem(6,jA,jE) = -3.0690 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.4021 - b_mtem(2,jA,jE) = 5.2399 - b_mtem(3,jA,jE) = -19.4278 - b_mtem(4,jA,jE) = 33.0027 - b_mtem(5,jA,jE) = -28.1020 - b_mtem(6,jA,jE) = 9.5159 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.6692 - b_mtem(2,jA,jE) = 4.1207 - b_mtem(3,jA,jE) = -27.3314 - b_mtem(4,jA,jE) = 59.3112 - b_mtem(5,jA,jE) = -58.7998 - b_mtem(6,jA,jE) = 21.7674 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.17444 - b_mtem(2,jA,jE) = 10.9927 - b_mtem(3,jA,jE) = -38.9013 - b_mtem(4,jA,jE) = 66.8521 - b_mtem(5,jA,jE) = -57.6564 - b_mtem(6,jA,jE) = 19.7296 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 1.17679 - b_mtem(2,jA,jE) = -2.5061 - b_mtem(3,jA,jE) = 0.8508 - b_mtem(4,jA,jE) = 4.4802 - b_mtem(5,jA,jE) = -8.4945 - b_mtem(6,jA,jE) = 4.3182 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 1.01450 - b_mtem(2,jA,jE) = 2.10260 - b_mtem(3,jA,jE) = -20.9036 - b_mtem(4,jA,jE) = 49.1481 - b_mtem(5,jA,jE) = -51.4867 - b_mtem(6,jA,jE) = 19.9301 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.55463 - b_mtem(2,jA,jE) = -3.20122 - b_mtem(3,jA,jE) = -0.957075 - b_mtem(4,jA,jE) = 12.103 - b_mtem(5,jA,jE) = -17.221 - b_mtem(6,jA,jE) = 7.50264 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.46187 - b_mtem(2,jA,jE) = -12.6845 - b_mtem(3,jA,jE) = 34.2383 - b_mtem(4,jA,jE) = -51.9992 - b_mtem(5,jA,jE) = 39.4934 - b_mtem(6,jA,jE) = -11.7247 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.74915 - b_mtem(2,jA,jE) = -4.65768 - b_mtem(3,jA,jE) = 8.80287 - b_mtem(4,jA,jE) = -12.2503 - b_mtem(5,jA,jE) = 8.668751 - b_mtem(6,jA,jE) = -2.50158 - - - !---------- - ! Ca(NO3)2 in E - jA = jcano3 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.86260 - b_mtem(2,jA,jE) = 11.6178 - b_mtem(3,jA,jE) = -30.9069 - b_mtem(4,jA,jE) = 41.7578 - b_mtem(5,jA,jE) = -33.7338 - b_mtem(6,jA,jE) = 12.7541 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.1798 - b_mtem(2,jA,jE) = 25.9608 - b_mtem(3,jA,jE) = -98.9373 - b_mtem(4,jA,jE) = 160.2300 - b_mtem(5,jA,jE) = -125.9540 - b_mtem(6,jA,jE) = 39.5130 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.44384 - b_mtem(2,jA,jE) = 13.6044 - b_mtem(3,jA,jE) = -54.4300 - b_mtem(4,jA,jE) = 100.582 - b_mtem(5,jA,jE) = -91.2364 - b_mtem(6,jA,jE) = 32.5970 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.099114 - b_mtem(2,jA,jE) = 2.84091 - b_mtem(3,jA,jE) = -16.9229 - b_mtem(4,jA,jE) = 37.4839 - b_mtem(5,jA,jE) = -39.5132 - b_mtem(6,jA,jE) = 15.8564 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.055116 - b_mtem(2,jA,jE) = 4.58610 - b_mtem(3,jA,jE) = -27.6629 - b_mtem(4,jA,jE) = 60.8288 - b_mtem(5,jA,jE) = -61.4988 - b_mtem(6,jA,jE) = 23.3136 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.57155 - b_mtem(2,jA,jE) = -3.18486 - b_mtem(3,jA,jE) = -3.35758 - b_mtem(4,jA,jE) = 18.7501 - b_mtem(5,jA,jE) = -24.5604 - b_mtem(6,jA,jE) = 10.3798 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 1.04446 - b_mtem(2,jA,jE) = -3.19066 - b_mtem(3,jA,jE) = 2.44714 - b_mtem(4,jA,jE) = 2.07218 - b_mtem(5,jA,jE) = -6.43949 - b_mtem(6,jA,jE) = 3.66471 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.05723 - b_mtem(2,jA,jE) = -1.46826 - b_mtem(3,jA,jE) = -1.0713 - b_mtem(4,jA,jE) = 4.64439 - b_mtem(5,jA,jE) = -6.32402 - b_mtem(6,jA,jE) = 2.78202 - - - !---------- - ! CaCl2 in E - jA = jcacl2 - - ! in NH4NO3 (PSC92: revised on 12/22/2003) - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.43626 - b_mtem(2,jA,jE) = 13.6598 - b_mtem(3,jA,jE) = -38.2068 - b_mtem(4,jA,jE) = 53.9057 - b_mtem(5,jA,jE) = -44.9018 - b_mtem(6,jA,jE) = 16.6120 - - ! in NH4Cl (PSC92: revised on 11/27/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.603965 - b_mtem(2,jA,jE) = 27.6027 - b_mtem(3,jA,jE) = -104.258 - b_mtem(4,jA,jE) = 163.553 - b_mtem(5,jA,jE) = -124.076 - b_mtem(6,jA,jE) = 37.4153 - - ! in NaNO3 (PSC92: revised on 12/22/2003) - jE = jnano3 - b_mtem(1,jA,jE) = 0.44648 - b_mtem(2,jA,jE) = 8.8850 - b_mtem(3,jA,jE) = -45.5232 - b_mtem(4,jA,jE) = 89.3263 - b_mtem(5,jA,jE) = -83.8604 - b_mtem(6,jA,jE) = 30.4069 - - ! in NaCl (PSC92: revised on 11/27/2003) - jE = jnacl - b_mtem(1,jA,jE) = 1.61927 - b_mtem(2,jA,jE) = 0.247547 - b_mtem(3,jA,jE) = -18.1252 - b_mtem(4,jA,jE) = 45.2479 - b_mtem(5,jA,jE) = -48.6072 - b_mtem(6,jA,jE) = 19.2784 - - ! in Ca(NO3)2 (PSC92: revised on 11/27/2003) - jE = jcano3 - b_mtem(1,jA,jE) = 2.36667 - b_mtem(2,jA,jE) = -0.123309 - b_mtem(3,jA,jE) = -24.2723 - b_mtem(4,jA,jE) = 65.1486 - b_mtem(5,jA,jE) = -71.8504 - b_mtem(6,jA,jE) = 28.3696 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 3.64023 - b_mtem(2,jA,jE) = -12.1926 - b_mtem(3,jA,jE) = 20.2028 - b_mtem(4,jA,jE) = -16.0056 - b_mtem(5,jA,jE) = 1.52355 - b_mtem(6,jA,jE) = 2.44709 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 5.88794 - b_mtem(2,jA,jE) = -29.7083 - b_mtem(3,jA,jE) = 78.6309 - b_mtem(4,jA,jE) = -118.037 - b_mtem(5,jA,jE) = 88.932 - b_mtem(6,jA,jE) = -26.1407 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 2.40628 - b_mtem(2,jA,jE) = -6.16566 - b_mtem(3,jA,jE) = 10.2851 - b_mtem(4,jA,jE) = -12.9035 - b_mtem(5,jA,jE) = 7.7441 - b_mtem(6,jA,jE) = -1.74821 - - - !---------- - ! HNO3 in E - jA = jhno3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.57598 - b_mtem(2,jA,jE) = 21.5469 - b_mtem(3,jA,jE) = -77.4111 - b_mtem(4,jA,jE) = 144.136 - b_mtem(5,jA,jE) = -132.849 - b_mtem(6,jA,jE) = 47.9412 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.00209 - b_mtem(2,jA,jE) = -3.48399 - b_mtem(3,jA,jE) = 34.9906 - b_mtem(4,jA,jE) = -68.6653 - b_mtem(5,jA,jE) = 54.0992 - b_mtem(6,jA,jE) = -15.1343 - - ! in NH4Cl revised on 12/22/2003 - jE = jnh4cl - b_mtem(1,jA,jE) = -0.63790 - b_mtem(2,jA,jE) = -1.67730 - b_mtem(3,jA,jE) = 10.1727 - b_mtem(4,jA,jE) = -14.9097 - b_mtem(5,jA,jE) = 7.67410 - b_mtem(6,jA,jE) = -0.79586 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 1.3446 - b_mtem(2,jA,jE) = -2.5578 - b_mtem(3,jA,jE) = 1.3464 - b_mtem(4,jA,jE) = 2.90537 - b_mtem(5,jA,jE) = -6.53014 - b_mtem(6,jA,jE) = 3.31339 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -0.546636 - b_mtem(2,jA,jE) = 10.3127 - b_mtem(3,jA,jE) = -39.9603 - b_mtem(4,jA,jE) = 71.4609 - b_mtem(5,jA,jE) = -63.4958 - b_mtem(6,jA,jE) = 22.0679 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 1.35059 - b_mtem(2,jA,jE) = 4.34557 - b_mtem(3,jA,jE) = -35.8425 - b_mtem(4,jA,jE) = 80.9868 - b_mtem(5,jA,jE) = -81.6544 - b_mtem(6,jA,jE) = 30.4841 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.869414 - b_mtem(2,jA,jE) = 2.98486 - b_mtem(3,jA,jE) = -22.255 - b_mtem(4,jA,jE) = 50.1863 - b_mtem(5,jA,jE) = -51.214 - b_mtem(6,jA,jE) = 19.2235 - - ! in CaCl2 (KM) revised on 12/22/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = 1.42800 - b_mtem(2,jA,jE) = -1.78959 - b_mtem(3,jA,jE) = -2.49075 - b_mtem(4,jA,jE) = 10.1877 - b_mtem(5,jA,jE) = -12.1948 - b_mtem(6,jA,jE) = 4.64475 - - ! in HNO3 (added on 12/06/2004) - jE = jhno3 - b_mtem(1,jA,jE) = 0.22035 - b_mtem(2,jA,jE) = 2.94973 - b_mtem(3,jA,jE) = -12.1469 - b_mtem(4,jA,jE) = 20.4905 - b_mtem(5,jA,jE) = -17.3966 - b_mtem(6,jA,jE) = 5.70779 - - ! in HCl (added on 12/06/2004) - jE = jhcl - b_mtem(1,jA,jE) = 1.55503 - b_mtem(2,jA,jE) = -3.61226 - b_mtem(3,jA,jE) = 6.28265 - b_mtem(4,jA,jE) = -8.69575 - b_mtem(5,jA,jE) = 6.09372 - b_mtem(6,jA,jE) = -1.80898 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 1.10783 - b_mtem(2,jA,jE) = -1.3363 - b_mtem(3,jA,jE) = -1.83525 - b_mtem(4,jA,jE) = 7.47373 - b_mtem(5,jA,jE) = -9.72954 - b_mtem(6,jA,jE) = 4.12248 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.851026 - b_mtem(2,jA,jE) = 12.2515 - b_mtem(3,jA,jE) = -49.788 - b_mtem(4,jA,jE) = 91.6215 - b_mtem(5,jA,jE) = -81.4877 - b_mtem(6,jA,jE) = 28.0002 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -3.09464 - b_mtem(2,jA,jE) = 14.9303 - b_mtem(3,jA,jE) = -43.0454 - b_mtem(4,jA,jE) = 72.6695 - b_mtem(5,jA,jE) = -65.2140 - b_mtem(6,jA,jE) = 23.4814 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 1.22973 - b_mtem(2,jA,jE) = 2.82702 - b_mtem(3,jA,jE) = -17.5869 - b_mtem(4,jA,jE) = 28.9564 - b_mtem(5,jA,jE) = -23.5814 - b_mtem(6,jA,jE) = 7.91153 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 1.64773 - b_mtem(2,jA,jE) = 0.94188 - b_mtem(3,jA,jE) = -19.1242 - b_mtem(4,jA,jE) = 46.9887 - b_mtem(5,jA,jE) = -50.9494 - b_mtem(6,jA,jE) = 20.2169 - - - !---------- - ! HCl in E - jA = jhcl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.93783 - b_mtem(2,jA,jE) = 20.5546 - b_mtem(3,jA,jE) = -75.8548 - b_mtem(4,jA,jE) = 141.729 - b_mtem(5,jA,jE) = -130.697 - b_mtem(6,jA,jE) = 46.9905 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.69063 - b_mtem(2,jA,jE) = -1.85303 - b_mtem(3,jA,jE) = 29.0927 - b_mtem(4,jA,jE) = -58.7401 - b_mtem(5,jA,jE) = 44.999 - b_mtem(6,jA,jE) = -11.9988 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.2073 - b_mtem(2,jA,jE) = -0.4322 - b_mtem(3,jA,jE) = 6.1271 - b_mtem(4,jA,jE) = -12.3146 - b_mtem(5,jA,jE) = 8.9919 - b_mtem(6,jA,jE) = -2.3388 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 2.95913 - b_mtem(2,jA,jE) = -7.92254 - b_mtem(3,jA,jE) = 13.736 - b_mtem(4,jA,jE) = -15.433 - b_mtem(5,jA,jE) = 7.40386 - b_mtem(6,jA,jE) = -0.918641 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = 0.893272 - b_mtem(2,jA,jE) = 6.53768 - b_mtem(3,jA,jE) = -32.3458 - b_mtem(4,jA,jE) = 61.2834 - b_mtem(5,jA,jE) = -56.4446 - b_mtem(6,jA,jE) = 19.9202 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 3.14484 - b_mtem(2,jA,jE) = 0.077019 - b_mtem(3,jA,jE) = -31.4199 - b_mtem(4,jA,jE) = 80.5865 - b_mtem(5,jA,jE) = -85.392 - b_mtem(6,jA,jE) = 32.6644 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 2.60432 - b_mtem(2,jA,jE) = -0.55909 - b_mtem(3,jA,jE) = -19.6671 - b_mtem(4,jA,jE) = 53.3446 - b_mtem(5,jA,jE) = -58.9076 - b_mtem(6,jA,jE) = 22.9927 - - ! in CaCl2 (KM) revised on 3/13/2003 and again on 11/27/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = 2.98036 - b_mtem(2,jA,jE) = -8.55365 - b_mtem(3,jA,jE) = 15.2108 - b_mtem(4,jA,jE) = -15.9359 - b_mtem(5,jA,jE) = 7.41772 - b_mtem(6,jA,jE) = -1.32143 - - ! in HNO3 (added on 12/06/2004) - jE = jhno3 - b_mtem(1,jA,jE) = 3.8533 - b_mtem(2,jA,jE) = -16.9427 - b_mtem(3,jA,jE) = 45.0056 - b_mtem(4,jA,jE) = -69.6145 - b_mtem(5,jA,jE) = 54.1491 - b_mtem(6,jA,jE) = -16.6513 - - ! in HCl (added on 12/06/2004) - jE = jhcl - b_mtem(1,jA,jE) = 2.56665 - b_mtem(2,jA,jE) = -7.13585 - b_mtem(3,jA,jE) = 14.8103 - b_mtem(4,jA,jE) = -21.8881 - b_mtem(5,jA,jE) = 16.6808 - b_mtem(6,jA,jE) = -5.22091 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 2.50179 - b_mtem(2,jA,jE) = -6.69364 - b_mtem(3,jA,jE) = 11.6551 - b_mtem(4,jA,jE) = -13.6897 - b_mtem(5,jA,jE) = 7.36796 - b_mtem(6,jA,jE) = -1.33245 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = 0.149955 - b_mtem(2,jA,jE) = 11.8213 - b_mtem(3,jA,jE) = -53.9164 - b_mtem(4,jA,jE) = 101.574 - b_mtem(5,jA,jE) = -91.4123 - b_mtem(6,jA,jE) = 31.5487 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.36927 - b_mtem(2,jA,jE) = 14.8359 - b_mtem(3,jA,jE) = -44.3443 - b_mtem(4,jA,jE) = 73.6229 - b_mtem(5,jA,jE) = -65.3366 - b_mtem(6,jA,jE) = 23.3250 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 2.72993 - b_mtem(2,jA,jE) = -0.23406 - b_mtem(3,jA,jE) = -10.4103 - b_mtem(4,jA,jE) = 13.1586 - b_mtem(5,jA,jE) = -7.79925 - b_mtem(6,jA,jE) = 2.30843 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 3.51258 - b_mtem(2,jA,jE) = -3.95107 - b_mtem(3,jA,jE) = -11.0175 - b_mtem(4,jA,jE) = 38.8617 - b_mtem(5,jA,jE) = -48.1575 - b_mtem(6,jA,jE) = 20.4717 - - - !---------- - ! 2H.SO4 in E - jA = jh2so4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.76734 - b_mtem(2,jA,jE) = -1.12263 - b_mtem(3,jA,jE) = -9.08728 - b_mtem(4,jA,jE) = 30.3836 - b_mtem(5,jA,jE) = -38.4133 - b_mtem(6,jA,jE) = 17.0106 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -2.03879 - b_mtem(2,jA,jE) = 15.7033 - b_mtem(3,jA,jE) = -58.7363 - b_mtem(4,jA,jE) = 109.242 - b_mtem(5,jA,jE) = -102.237 - b_mtem(6,jA,jE) = 37.5350 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -3.10228 - b_mtem(2,jA,jE) = 16.6920 - b_mtem(3,jA,jE) = -59.1522 - b_mtem(4,jA,jE) = 113.487 - b_mtem(5,jA,jE) = -110.890 - b_mtem(6,jA,jE) = 42.4578 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.43885 - b_mtem(2,jA,jE) = 21.0372 - b_mtem(3,jA,jE) = -84.7026 - b_mtem(4,jA,jE) = 165.324 - b_mtem(5,jA,jE) = -156.101 - b_mtem(6,jA,jE) = 57.3101 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 0.33164 - b_mtem(2,jA,jE) = 6.55864 - b_mtem(3,jA,jE) = -33.5876 - b_mtem(4,jA,jE) = 65.1798 - b_mtem(5,jA,jE) = -63.2046 - b_mtem(6,jA,jE) = 24.1783 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 3.06830 - b_mtem(2,jA,jE) = -3.18408 - b_mtem(3,jA,jE) = -19.6332 - b_mtem(4,jA,jE) = 61.3657 - b_mtem(5,jA,jE) = -73.4438 - b_mtem(6,jA,jE) = 31.2334 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 2.58649 - b_mtem(2,jA,jE) = 0.87921 - b_mtem(3,jA,jE) = -39.3023 - b_mtem(4,jA,jE) = 101.603 - b_mtem(5,jA,jE) = -109.469 - b_mtem(6,jA,jE) = 43.0188 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 1.54587 - b_mtem(2,jA,jE) = -7.50976 - b_mtem(3,jA,jE) = 12.8237 - b_mtem(4,jA,jE) = -10.1452 - b_mtem(5,jA,jE) = -0.541956 - b_mtem(6,jA,jE) = 3.34536 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.829757 - b_mtem(2,jA,jE) = -4.11316 - b_mtem(3,jA,jE) = 3.67111 - b_mtem(4,jA,jE) = 3.6833 - b_mtem(5,jA,jE) = -11.2711 - b_mtem(6,jA,jE) = 6.71421 - - - !---------- - ! H.HSO4 in E - jA = jhhso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 2.63953 - b_mtem(2,jA,jE) = -6.01532 - b_mtem(3,jA,jE) = 10.0204 - b_mtem(4,jA,jE) = -12.4840 - b_mtem(5,jA,jE) = 7.78853 - b_mtem(6,jA,jE) = -2.12638 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.77412 - b_mtem(2,jA,jE) = 14.1656 - b_mtem(3,jA,jE) = -53.4087 - b_mtem(4,jA,jE) = 93.2013 - b_mtem(5,jA,jE) = -80.5723 - b_mtem(6,jA,jE) = 27.1577 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.98882 - b_mtem(2,jA,jE) = 14.4436 - b_mtem(3,jA,jE) = -40.1774 - b_mtem(4,jA,jE) = 67.5937 - b_mtem(5,jA,jE) = -61.5040 - b_mtem(6,jA,jE) = 22.3695 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.15502 - b_mtem(2,jA,jE) = 8.12309 - b_mtem(3,jA,jE) = -38.4726 - b_mtem(4,jA,jE) = 80.8861 - b_mtem(5,jA,jE) = -80.1644 - b_mtem(6,jA,jE) = 30.4717 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 1.99641 - b_mtem(2,jA,jE) = -2.96061 - b_mtem(3,jA,jE) = 5.54778 - b_mtem(4,jA,jE) = -14.5488 - b_mtem(5,jA,jE) = 14.8492 - b_mtem(6,jA,jE) = -5.1389 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 2.23816 - b_mtem(2,jA,jE) = -3.20847 - b_mtem(3,jA,jE) = -4.82853 - b_mtem(4,jA,jE) = 20.9192 - b_mtem(5,jA,jE) = -27.2819 - b_mtem(6,jA,jE) = 11.8655 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 2.56907 - b_mtem(2,jA,jE) = 1.13444 - b_mtem(3,jA,jE) = -34.6853 - b_mtem(4,jA,jE) = 87.9775 - b_mtem(5,jA,jE) = -93.2330 - b_mtem(6,jA,jE) = 35.9260 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.00024 - b_mtem(2,jA,jE) = -4.80868 - b_mtem(3,jA,jE) = 8.29222 - b_mtem(4,jA,jE) = -11.0849 - b_mtem(5,jA,jE) = 7.51262 - b_mtem(6,jA,jE) = -2.07654 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 2.8009 - b_mtem(2,jA,jE) = -6.98416 - b_mtem(3,jA,jE) = 14.3146 - b_mtem(4,jA,jE) = -22.0068 - b_mtem(5,jA,jE) = 17.5557 - b_mtem(6,jA,jE) = -5.84917 - - - !---------- - ! NH4HSO4 in E - jA = jnh4hso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.169160 - b_mtem(2,jA,jE) = 2.15094 - b_mtem(3,jA,jE) = -9.62904 - b_mtem(4,jA,jE) = 18.2631 - b_mtem(5,jA,jE) = -17.3333 - b_mtem(6,jA,jE) = 6.19835 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -2.34457 - b_mtem(2,jA,jE) = 12.8035 - b_mtem(3,jA,jE) = -35.2513 - b_mtem(4,jA,jE) = 53.6153 - b_mtem(5,jA,jE) = -42.7655 - b_mtem(6,jA,jE) = 13.7129 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.56109 - b_mtem(2,jA,jE) = 11.1414 - b_mtem(3,jA,jE) = -30.2361 - b_mtem(4,jA,jE) = 50.0320 - b_mtem(5,jA,jE) = -44.1586 - b_mtem(6,jA,jE) = 15.5393 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -0.97315 - b_mtem(2,jA,jE) = 7.06295 - b_mtem(3,jA,jE) = -29.3032 - b_mtem(4,jA,jE) = 57.6101 - b_mtem(5,jA,jE) = -54.9020 - b_mtem(6,jA,jE) = 20.2222 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -0.44450 - b_mtem(2,jA,jE) = 3.33451 - b_mtem(3,jA,jE) = -15.2791 - b_mtem(4,jA,jE) = 30.1413 - b_mtem(5,jA,jE) = -26.7710 - b_mtem(6,jA,jE) = 8.78462 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.99780 - b_mtem(2,jA,jE) = 4.69200 - b_mtem(3,jA,jE) = -16.1219 - b_mtem(4,jA,jE) = 29.3100 - b_mtem(5,jA,jE) = -26.3383 - b_mtem(6,jA,jE) = 9.20695 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -0.52694 - b_mtem(2,jA,jE) = 7.02684 - b_mtem(3,jA,jE) = -33.7508 - b_mtem(4,jA,jE) = 70.0565 - b_mtem(5,jA,jE) = -68.3226 - b_mtem(6,jA,jE) = 25.2692 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.572926 - b_mtem(2,jA,jE) = -2.04791 - b_mtem(3,jA,jE) = 2.1134 - b_mtem(4,jA,jE) = 0.246654 - b_mtem(5,jA,jE) = -3.06019 - b_mtem(6,jA,jE) = 1.98126 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.56514 - b_mtem(2,jA,jE) = 0.22287 - b_mtem(3,jA,jE) = -2.76973 - b_mtem(4,jA,jE) = 4.54444 - b_mtem(5,jA,jE) = -3.86549 - b_mtem(6,jA,jE) = 1.13441 - - - !---------- - ! (NH4)3H(SO4)2 in E - jA = jlvcite - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -1.44811 - b_mtem(2,jA,jE) = 6.71815 - b_mtem(3,jA,jE) = -25.0141 - b_mtem(4,jA,jE) = 50.1109 - b_mtem(5,jA,jE) = -50.0561 - b_mtem(6,jA,jE) = 19.3370 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -3.41707 - b_mtem(2,jA,jE) = 13.4496 - b_mtem(3,jA,jE) = -34.8018 - b_mtem(4,jA,jE) = 55.2987 - b_mtem(5,jA,jE) = -48.1839 - b_mtem(6,jA,jE) = 17.2444 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.54479 - b_mtem(2,jA,jE) = 11.8501 - b_mtem(3,jA,jE) = -39.7286 - b_mtem(4,jA,jE) = 74.2479 - b_mtem(5,jA,jE) = -70.4934 - b_mtem(6,jA,jE) = 26.2836 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.30561 - b_mtem(2,jA,jE) = 14.5806 - b_mtem(3,jA,jE) = -55.1238 - b_mtem(4,jA,jE) = 103.451 - b_mtem(5,jA,jE) = -95.2571 - b_mtem(6,jA,jE) = 34.2218 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -2.20809 - b_mtem(2,jA,jE) = 13.6391 - b_mtem(3,jA,jE) = -57.8246 - b_mtem(4,jA,jE) = 117.907 - b_mtem(5,jA,jE) = -112.154 - b_mtem(6,jA,jE) = 40.3058 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -1.15099 - b_mtem(2,jA,jE) = 6.32269 - b_mtem(3,jA,jE) = -27.3860 - b_mtem(4,jA,jE) = 55.4592 - b_mtem(5,jA,jE) = -54.0100 - b_mtem(6,jA,jE) = 20.3469 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.15678 - b_mtem(2,jA,jE) = 8.28718 - b_mtem(3,jA,jE) = -37.3231 - b_mtem(4,jA,jE) = 76.6124 - b_mtem(5,jA,jE) = -74.9307 - b_mtem(6,jA,jE) = 28.0559 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.01502 - b_mtem(2,jA,jE) = -3.1197 - b_mtem(3,jA,jE) = 3.61104 - b_mtem(4,jA,jE) = 3.05196 - b_mtem(5,jA,jE) = -9.98957 - b_mtem(6,jA,jE) = 6.04155 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -1.06477 - b_mtem(2,jA,jE) = 3.38801 - b_mtem(3,jA,jE) = -12.5784 - b_mtem(4,jA,jE) = 25.2823 - b_mtem(5,jA,jE) = -25.4611 - b_mtem(6,jA,jE) = 10.0754 - - - !---------- - ! NaHSO4 in E - jA = jnahso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.68259 - b_mtem(2,jA,jE) = 0.71468 - b_mtem(3,jA,jE) = -5.59003 - b_mtem(4,jA,jE) = 11.0089 - b_mtem(5,jA,jE) = -10.7983 - b_mtem(6,jA,jE) = 3.82335 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.03956 - b_mtem(2,jA,jE) = 4.52828 - b_mtem(3,jA,jE) = -25.2557 - b_mtem(4,jA,jE) = 54.4225 - b_mtem(5,jA,jE) = -52.5105 - b_mtem(6,jA,jE) = 18.6562 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.53503 - b_mtem(2,jA,jE) = 8.27608 - b_mtem(3,jA,jE) = -28.9539 - b_mtem(4,jA,jE) = 55.2876 - b_mtem(5,jA,jE) = -51.9563 - b_mtem(6,jA,jE) = 18.6576 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -0.38793 - b_mtem(2,jA,jE) = 7.14680 - b_mtem(3,jA,jE) = -38.7201 - b_mtem(4,jA,jE) = 84.3965 - b_mtem(5,jA,jE) = -84.7453 - b_mtem(6,jA,jE) = 32.1283 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -0.41982 - b_mtem(2,jA,jE) = 4.26491 - b_mtem(3,jA,jE) = -20.2351 - b_mtem(4,jA,jE) = 42.6764 - b_mtem(5,jA,jE) = -40.7503 - b_mtem(6,jA,jE) = 14.2868 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.32912 - b_mtem(2,jA,jE) = 1.80808 - b_mtem(3,jA,jE) = -8.01286 - b_mtem(4,jA,jE) = 15.5791 - b_mtem(5,jA,jE) = -14.5494 - b_mtem(6,jA,jE) = 5.27052 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.10271 - b_mtem(2,jA,jE) = 5.09559 - b_mtem(3,jA,jE) = -30.3295 - b_mtem(4,jA,jE) = 66.2975 - b_mtem(5,jA,jE) = -66.3458 - b_mtem(6,jA,jE) = 24.9443 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.608309 - b_mtem(2,jA,jE) = -0.541905 - b_mtem(3,jA,jE) = -2.52084 - b_mtem(4,jA,jE) = 6.63297 - b_mtem(5,jA,jE) = -7.24599 - b_mtem(6,jA,jE) = 2.88811 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.98399 - b_mtem(2,jA,jE) = -4.51562 - b_mtem(3,jA,jE) = 8.36059 - b_mtem(4,jA,jE) = -12.4948 - b_mtem(5,jA,jE) = 9.67514 - b_mtem(6,jA,jE) = -3.18004 - - - !---------- - ! Na3H(SO4)2 in E - jA = jna3hso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -0.83214 - b_mtem(2,jA,jE) = 4.99572 - b_mtem(3,jA,jE) = -20.1697 - b_mtem(4,jA,jE) = 41.4066 - b_mtem(5,jA,jE) = -42.2119 - b_mtem(6,jA,jE) = 16.4855 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.65139 - b_mtem(2,jA,jE) = 3.52300 - b_mtem(3,jA,jE) = -22.8220 - b_mtem(4,jA,jE) = 56.2956 - b_mtem(5,jA,jE) = -59.9028 - b_mtem(6,jA,jE) = 23.1844 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.31331 - b_mtem(2,jA,jE) = 8.40835 - b_mtem(3,jA,jE) = -38.1757 - b_mtem(4,jA,jE) = 80.5312 - b_mtem(5,jA,jE) = -79.8346 - b_mtem(6,jA,jE) = 30.0219 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.03054 - b_mtem(2,jA,jE) = 8.08155 - b_mtem(3,jA,jE) = -38.1046 - b_mtem(4,jA,jE) = 78.7168 - b_mtem(5,jA,jE) = -77.2263 - b_mtem(6,jA,jE) = 29.1521 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -1.90695 - b_mtem(2,jA,jE) = 11.6241 - b_mtem(3,jA,jE) = -50.3175 - b_mtem(4,jA,jE) = 105.884 - b_mtem(5,jA,jE) = -103.258 - b_mtem(6,jA,jE) = 37.6588 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.34780 - b_mtem(2,jA,jE) = 2.85363 - b_mtem(3,jA,jE) = -17.6224 - b_mtem(4,jA,jE) = 38.9220 - b_mtem(5,jA,jE) = -39.8106 - b_mtem(6,jA,jE) = 15.6055 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -0.75230 - b_mtem(2,jA,jE) = 10.0140 - b_mtem(3,jA,jE) = -50.5677 - b_mtem(4,jA,jE) = 106.941 - b_mtem(5,jA,jE) = -105.534 - b_mtem(6,jA,jE) = 39.5196 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.057456 - b_mtem(2,jA,jE) = -1.31264 - b_mtem(3,jA,jE) = -1.94662 - b_mtem(4,jA,jE) = 10.7024 - b_mtem(5,jA,jE) = -14.9946 - b_mtem(6,jA,jE) = 7.12161 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.637894 - b_mtem(2,jA,jE) = -2.29719 - b_mtem(3,jA,jE) = 0.765361 - b_mtem(4,jA,jE) = 4.8748 - b_mtem(5,jA,jE) = -9.25978 - b_mtem(6,jA,jE) = 4.91773 - ! - ! - ! - !---------------------------------------------------------- - ! Coefficients for %MDRH(T) = d1 + d2*T + d3*T^2 + d4*T^3 (T in Kelvin) - ! valid Temperature Range: 240 - 320 K - !---------------------------------------------------------- - ! - ! SULFATE-POOR SYSTEMS - ! AC - j_index = 1 - d_mdrh(j_index,1) = -58.00268351 - d_mdrh(j_index,2) = 2.031077573 - d_mdrh(j_index,3) = -0.008281218 - d_mdrh(j_index,4) = 1.00447E-05 - - ! AN - j_index = 2 - d_mdrh(j_index,1) = 1039.137773 - d_mdrh(j_index,2) = -11.47847095 - d_mdrh(j_index,3) = 0.047702786 - d_mdrh(j_index,4) = -6.77675E-05 - - ! AS - j_index = 3 - d_mdrh(j_index,1) = 115.8366357 - d_mdrh(j_index,2) = 0.491881663 - d_mdrh(j_index,3) = -0.00422807 - d_mdrh(j_index,4) = 7.29274E-06 - - ! SC - j_index = 4 - d_mdrh(j_index,1) = 253.2424151 - d_mdrh(j_index,2) = -1.429957864 - d_mdrh(j_index,3) = 0.003727554 - d_mdrh(j_index,4) = -3.13037E-06 - - ! SN - j_index = 5 - d_mdrh(j_index,1) = -372.4306506 - d_mdrh(j_index,2) = 5.3955633 - d_mdrh(j_index,3) = -0.019804438 - d_mdrh(j_index,4) = 2.25662E-05 - - ! SS - j_index = 6 - d_mdrh(j_index,1) = 286.1271416 - d_mdrh(j_index,2) = -1.670787758 - d_mdrh(j_index,3) = 0.004431373 - d_mdrh(j_index,4) = -3.57757E-06 - - ! CC - j_index = 7 - d_mdrh(j_index,1) = -1124.07059 - d_mdrh(j_index,2) = 14.26364209 - d_mdrh(j_index,3) = -0.054816822 - d_mdrh(j_index,4) = 6.70107E-05 - - ! CN - j_index = 8 - d_mdrh(j_index,1) = 1855.413934 - d_mdrh(j_index,2) = -20.29219473 - d_mdrh(j_index,3) = 0.07807482 - d_mdrh(j_index,4) = -1.017887858e-4 - - ! AN + AC - j_index = 9 - d_mdrh(j_index,1) = 1761.176886 - d_mdrh(j_index,2) = -19.29811062 - d_mdrh(j_index,3) = 0.075676987 - d_mdrh(j_index,4) = -1.0116959e-4 - - ! AS + AC - j_index = 10 - d_mdrh(j_index,1) = 122.1074303 - d_mdrh(j_index,2) = 0.429692122 - d_mdrh(j_index,3) = -0.003928277 - d_mdrh(j_index,4) = 6.43275E-06 - - ! AS + AN - j_index = 11 - d_mdrh(j_index,1) = 2424.634678 - d_mdrh(j_index,2) = -26.54031307 - d_mdrh(j_index,3) = 0.101625387 - d_mdrh(j_index,4) = -1.31544547798e-4 - - ! AS + AN + AC - j_index = 12 - d_mdrh(j_index,1) = 2912.082599 - d_mdrh(j_index,2) = -31.8894185 - d_mdrh(j_index,3) = 0.121185849 - d_mdrh(j_index,4) = -1.556534623e-4 - - ! SC + AC - j_index = 13 - d_mdrh(j_index,1) = 172.2596493 - d_mdrh(j_index,2) = -0.511006195 - d_mdrh(j_index,3) = 4.27244597e-4 - d_mdrh(j_index,4) = 4.12797E-07 - - ! SN + AC - j_index = 14 - d_mdrh(j_index,1) = 1596.184935 - d_mdrh(j_index,2) = -16.37945565 - d_mdrh(j_index,3) = 0.060281218 - d_mdrh(j_index,4) = -7.6161E-05 - - ! SN + AN - j_index = 15 - d_mdrh(j_index,1) = 1916.072988 - d_mdrh(j_index,2) = -20.85594868 - d_mdrh(j_index,3) = 0.081140141 - d_mdrh(j_index,4) = -1.07954274796e-4 - - ! SN + AN + AC - j_index = 16 - d_mdrh(j_index,1) = 1467.165935 - d_mdrh(j_index,2) = -16.01166196 - d_mdrh(j_index,3) = 0.063505582 - d_mdrh(j_index,4) = -8.66722E-05 - - ! SN + SC - j_index = 17 - d_mdrh(j_index,1) = 158.447059 - d_mdrh(j_index,2) = -0.628167358 - d_mdrh(j_index,3) = 0.002014448 - d_mdrh(j_index,4) = -3.13037E-06 - - ! SN + SC + AC - j_index = 18 - d_mdrh(j_index,1) = 1115.892468 - d_mdrh(j_index,2) = -11.76936534 - d_mdrh(j_index,3) = 0.045577399 - d_mdrh(j_index,4) = -6.05779E-05 - - ! SS + AC - j_index = 19 - d_mdrh(j_index,1) = 269.5432407 - d_mdrh(j_index,2) = -1.319963885 - d_mdrh(j_index,3) = 0.002592363 - d_mdrh(j_index,4) = -1.44479E-06 - - ! SS + AN - j_index = 20 - d_mdrh(j_index,1) = 2841.334784 - d_mdrh(j_index,2) = -31.1889487 - d_mdrh(j_index,3) = 0.118809274 - d_mdrh(j_index,4) = -1.53007e-4 - - ! SS + AN + AC - j_index = 21 - d_mdrh(j_index,1) = 2199.36914 - d_mdrh(j_index,2) = -24.11926569 - d_mdrh(j_index,3) = 0.092932361 - d_mdrh(j_index,4) = -1.21774e-4 - - ! SS + AS - j_index = 22 - d_mdrh(j_index,1) = 395.0051604 - d_mdrh(j_index,2) = -2.521101657 - d_mdrh(j_index,3) = 0.006139319 - d_mdrh(j_index,4) = -4.43756E-06 - - ! SS + AS + AC - j_index = 23 - d_mdrh(j_index,1) = 386.5150675 - d_mdrh(j_index,2) = -2.4632138 - d_mdrh(j_index,3) = 0.006139319 - d_mdrh(j_index,4) = -4.98796E-06 - - ! SS + AS + AN - j_index = 24 - d_mdrh(j_index,1) = 3101.538491 - d_mdrh(j_index,2) = -34.19978105 - d_mdrh(j_index,3) = 0.130118605 - d_mdrh(j_index,4) = -1.66873e-4 - - ! SS + AS + AN + AC - j_index = 25 - d_mdrh(j_index,1) = 2307.579403 - d_mdrh(j_index,2) = -25.43136774 - d_mdrh(j_index,3) = 0.098064728 - d_mdrh(j_index,4) = -1.28301e-4 - - ! SS + SC - j_index = 26 - d_mdrh(j_index,1) = 291.8309602 - d_mdrh(j_index,2) = -1.828912974 - d_mdrh(j_index,3) = 0.005053148 - d_mdrh(j_index,4) = -4.57516E-06 - - ! SS + SC + AC - j_index = 27 - d_mdrh(j_index,1) = 188.3914345 - d_mdrh(j_index,2) = -0.631345031 - d_mdrh(j_index,3) = 0.000622807 - d_mdrh(j_index,4) = 4.47196E-07 - - ! SS + SN - j_index = 28 - d_mdrh(j_index,1) = -167.1252839 - d_mdrh(j_index,2) = 2.969828002 - d_mdrh(j_index,3) = -0.010637255 - d_mdrh(j_index,4) = 1.13175E-05 - - ! SS + SN + AC - j_index = 29 - d_mdrh(j_index,1) = 1516.782768 - d_mdrh(j_index,2) = -15.7922661 - d_mdrh(j_index,3) = 0.058942209 - d_mdrh(j_index,4) = -7.5301E-05 - - ! SS + SN + AN - j_index = 30 - d_mdrh(j_index,1) = 1739.963163 - d_mdrh(j_index,2) = -19.06576022 - d_mdrh(j_index,3) = 0.07454963 - d_mdrh(j_index,4) = -9.94302E-05 - - ! SS + SN + AN + AC - j_index = 31 - d_mdrh(j_index,1) = 2152.104877 - d_mdrh(j_index,2) = -23.74998008 - d_mdrh(j_index,3) = 0.092256654 - d_mdrh(j_index,4) = -1.21953e-4 - - ! SS + SN + SC - j_index = 32 - d_mdrh(j_index,1) = 221.9976265 - d_mdrh(j_index,2) = -1.311331272 - d_mdrh(j_index,3) = 0.004406089 - d_mdrh(j_index,4) = -5.88235E-06 - - ! SS + SN + SC + AC - j_index = 33 - d_mdrh(j_index,1) = 1205.645615 - d_mdrh(j_index,2) = -12.71353459 - d_mdrh(j_index,3) = 0.048803922 - d_mdrh(j_index,4) = -6.41899E-05 - - ! CC + AC - j_index = 34 - d_mdrh(j_index,1) = 506.6737879 - d_mdrh(j_index,2) = -3.723520818 - d_mdrh(j_index,3) = 0.010814242 - d_mdrh(j_index,4) = -1.21087E-05 - - ! CC + SC - j_index = 35 - d_mdrh(j_index,1) = -1123.523841 - d_mdrh(j_index,2) = 14.08345977 - d_mdrh(j_index,3) = -0.053687823 - d_mdrh(j_index,4) = 6.52219E-05 - - ! CC + SC + AC - j_index = 36 - d_mdrh(j_index,1) = -1159.98607 - d_mdrh(j_index,2) = 14.44309169 - d_mdrh(j_index,3) = -0.054841073 - d_mdrh(j_index,4) = 6.64259E-05 - - ! CN + AC - j_index = 37 - d_mdrh(j_index,1) = 756.0747916 - d_mdrh(j_index,2) = -8.546826257 - d_mdrh(j_index,3) = 0.035798677 - d_mdrh(j_index,4) = -5.06629E-05 - - ! CN + AN - j_index = 38 - d_mdrh(j_index,1) = 338.668191 - d_mdrh(j_index,2) = -2.971223403 - d_mdrh(j_index,3) = 0.012294866 - d_mdrh(j_index,4) = -1.87558E-05 - - ! CN + AN + AC - j_index = 39 - d_mdrh(j_index,1) = -53.18033508 - d_mdrh(j_index,2) = 0.663911748 - d_mdrh(j_index,3) = 9.16326e-4 - d_mdrh(j_index,4) = -6.70354E-06 - - ! CN + SC - j_index = 40 - d_mdrh(j_index,1) = 3623.831129 - d_mdrh(j_index,2) = -39.27226457 - d_mdrh(j_index,3) = 0.144559515 - d_mdrh(j_index,4) = -1.78159e-4 - - ! CN + SC + AC - j_index = 41 - d_mdrh(j_index,1) = 3436.656743 - d_mdrh(j_index,2) = -37.16192684 - d_mdrh(j_index,3) = 0.136641377 - d_mdrh(j_index,4) = -1.68262e-4 - - ! CN + SN - j_index = 42 - d_mdrh(j_index,1) = 768.608476 - d_mdrh(j_index,2) = -8.051517149 - d_mdrh(j_index,3) = 0.032342332 - d_mdrh(j_index,4) = -4.52224E-05 - - ! CN + SN + AC - j_index = 43 - d_mdrh(j_index,1) = 33.58027951 - d_mdrh(j_index,2) = -0.308772182 - d_mdrh(j_index,3) = 0.004713639 - d_mdrh(j_index,4) = -1.19658E-05 - - ! CN + SN + AN - j_index = 44 - d_mdrh(j_index,1) = 57.80183041 - d_mdrh(j_index,2) = 0.215264604 - d_mdrh(j_index,3) = 4.11406e-4 - d_mdrh(j_index,4) = -4.30702E-06 - - ! CN + SN + AN + AC - j_index = 45 - d_mdrh(j_index,1) = -234.368984 - d_mdrh(j_index,2) = 2.721045204 - d_mdrh(j_index,3) = -0.006688341 - d_mdrh(j_index,4) = 2.31729E-06 - - ! CN + SN + SC - j_index = 46 - d_mdrh(j_index,1) = 3879.080557 - d_mdrh(j_index,2) = -42.13562874 - d_mdrh(j_index,3) = 0.155235005 - d_mdrh(j_index,4) = -1.91387e-4 - - ! CN + SN + SC + AC - j_index = 47 - d_mdrh(j_index,1) = 3600.576985 - d_mdrh(j_index,2) = -39.0283489 - d_mdrh(j_index,3) = 0.143710316 - d_mdrh(j_index,4) = -1.77167e-4 - - ! CN + CC - j_index = 48 - d_mdrh(j_index,1) = -1009.729826 - d_mdrh(j_index,2) = 12.9145339 - d_mdrh(j_index,3) = -0.049811146 - d_mdrh(j_index,4) = 6.09563E-05 - - ! CN + CC + AC - j_index = 49 - d_mdrh(j_index,1) = -577.0919514 - d_mdrh(j_index,2) = 8.020324227 - d_mdrh(j_index,3) = -0.031469556 - d_mdrh(j_index,4) = 3.82181E-05 - - ! CN + CC + SC - j_index = 50 - d_mdrh(j_index,1) = -728.9983499 - d_mdrh(j_index,2) = 9.849458215 - d_mdrh(j_index,3) = -0.03879257 - d_mdrh(j_index,4) = 4.78844E-05 - - ! CN + CC + SC + AC - j_index = 51 - d_mdrh(j_index,1) = -803.7026845 - d_mdrh(j_index,2) = 10.61881494 - d_mdrh(j_index,3) = -0.041402993 - d_mdrh(j_index,4) = 5.08084E-05 - - ! - ! SULFATE-RICH SYSTEMS - ! AB - j_index = 52 - d_mdrh(j_index,1) = -493.6190458 - d_mdrh(j_index,2) = 6.747053851 - d_mdrh(j_index,3) = -0.026955267 - d_mdrh(j_index,4) = 3.45118E-05 - - ! LV - j_index = 53 - d_mdrh(j_index,1) = 53.37874093 - d_mdrh(j_index,2) = 1.01368249 - d_mdrh(j_index,3) = -0.005887513 - d_mdrh(j_index,4) = 8.94393E-06 - - ! SB - j_index = 54 - d_mdrh(j_index,1) = 206.619047 - d_mdrh(j_index,2) = -1.342735684 - d_mdrh(j_index,3) = 0.003197691 - d_mdrh(j_index,4) = -1.93603E-06 - - ! AB + LV - j_index = 55 - d_mdrh(j_index,1) = -493.6190458 - d_mdrh(j_index,2) = 6.747053851 - d_mdrh(j_index,3) = -0.026955267 - d_mdrh(j_index,4) = 3.45118E-05 - - ! AS + LV - j_index = 56 - d_mdrh(j_index,1) = 53.37874093 - d_mdrh(j_index,2) = 1.01368249 - d_mdrh(j_index,3) = -0.005887513 - d_mdrh(j_index,4) = 8.94393E-06 - - ! SS + SB - j_index = 57 - d_mdrh(j_index,1) = 206.619047 - d_mdrh(j_index,2) = -1.342735684 - d_mdrh(j_index,3) = 0.003197691 - d_mdrh(j_index,4) = -1.93603E-06 - - ! SS + LV - j_index = 58 - d_mdrh(j_index,1) = 41.7619047 - d_mdrh(j_index,2) = 1.303872053 - d_mdrh(j_index,3) = -0.007647908 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + AS + LV - j_index = 59 - d_mdrh(j_index,1) = 41.7619047 - d_mdrh(j_index,2) = 1.303872053 - d_mdrh(j_index,3) = -0.007647908 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + AB - j_index = 60 - d_mdrh(j_index,1) = -369.7142842 - d_mdrh(j_index,2) = 5.512878771 - d_mdrh(j_index,3) = -0.02301948 - d_mdrh(j_index,4) = 3.0303E-05 - - ! SS + LV + AB - j_index = 61 - d_mdrh(j_index,1) = -369.7142842 - d_mdrh(j_index,2) = 5.512878771 - d_mdrh(j_index,3) = -0.02301948 - d_mdrh(j_index,4) = 3.0303E-05 - - ! SB + AB - j_index = 62 - d_mdrh(j_index,1) = -162.8095232 - d_mdrh(j_index,2) = 2.399326592 - d_mdrh(j_index,3) = -0.009336219 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + SB + AB - j_index = 63 - d_mdrh(j_index,1) = -735.4285689 - d_mdrh(j_index,2) = 8.885521857 - d_mdrh(j_index,3) = -0.033488456 - d_mdrh(j_index,4) = 4.12458E-05 - - - ! endif ! first - - return - end subroutine load_mosaic_parameters - - - -end module module_mosaic_init diff --git a/MAMchem_GridComp/microphysics/module_mosaic_init_aerpar.F90 b/MAMchem_GridComp/microphysics/module_mosaic_init_aerpar.F90 deleted file mode 100644 index df499a52..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_init_aerpar.F90 +++ /dev/null @@ -1,3173 +0,0 @@ -module module_mosaic_init_aerpar - - implicit none - private - - public:: mosaic_init_aer_params - -contains - subroutine mosaic_init_aer_params - !BSINGH - All initialzations for Mosiac model - - call load_mosaic_parameters - - end subroutine mosaic_init_aer_params - - !---------------------------------------------------------------------------------------! - !BSINGH: load_mosaic_parameters subroutine is directly copied form the mosaic_box.25.f90 - ! code - !---------------------------------------------------------------------------------------! - - !---------------------------------------------------------------------------------------! - ! Called only once per entire simulation to load gas and aerosol - ! indices, parameters, physico-chemical constants, polynomial coeffs, etc. - ! - ! author: Rahul A. Zaveri - ! update: jan 2005 - !---------------------------------------------------------------------------------------! - subroutine load_mosaic_parameters - - ! include 'v33com2' - use module_data_mosaic_aero, only: ipmcmos_aero, no_aerosol, all_solid, all_liquid, & - mixed, nelectrolyte, naercomp, naer, Ncation, Nanion, ngas_volatile, nsalt, & - jsulf_poor_NUM, jsulf_rich_NUM, MDRH_T_NUM, d_mdrh_DIM2, phasestate, aer_name, & - gas_name, ename, jnh4so4, jlvcite, jnh4hso4, jnh4msa, jnh4no3, jnh4cl, jna2so4, & - jna3hso4, jnahso4, jnamsa, jnano3, jnacl, jcano3, jcacl2, jcamsa2, jh2so4, jmsa, & - jhno3, jhcl, jhhso4, jcaso4, jcaco3, joc, jbc, join, jaro1, jaro2, jalk1, jole1, & - japi1, japi2, jlim1, jlim2, jh2o, jc_h, jc_nh4, jc_na, jc_ca, ja_hso4, ja_so4, & - ja_no3, ja_cl, ja_msa, ih2so4_g, ihno3_g, ihcl_g, inh3_g, imsa_g, iaro1_g, & - iaro2_g, ialk1_g, iole1_g, iapi1_g, iapi2_g, ilim1_g, ilim2_g, iso4_a, ino3_a, & - icl_a, inh4_a, imsa_a, iaro1_a, iaro2_a, ialk1_a, iole1_a, iapi1_a, iapi2_a, & - ilim1_a, ilim2_a, ico3_a, ina_a, ica_a, ioin_a, ioc_a, ibc_a, nmax_ASTEM, b_mtem,& - zc, za, b_zsr, a_zsr, aw_min, mw_electrolyte, dens_electrolyte, & - partial_molar_vol, MW_c, MW_a, mw_aer_mac,dens_aer_mac, kappa_aer_mac, & - dens_comp_a,mw_comp_a, ref_index_a, rtol_mesa, jsalt_index, jsulf_poor, & - jsulf_rich,Nmax_mesa,d_mdrh, & - use_cam5mam_soa_params - - use module_data_mosaic_kind, only: r8 - - implicit none - - ! local variables - integer iaer, je, ja, j_index, ibin - logical use_mos31e_rz1_densities, use_uniform_densities !BSINGH - 05/28/2013(RCE updates) - real(r8), dimension(nelectrolyte) :: G_MX,K_MX - - !BSINGH - 05/28/2013(RCE updates) - use_mos31e_rz1_densities = .true. - if ( use_mos31e_rz1_densities ) then - use_uniform_densities = .false. - else - use_uniform_densities = .true. - if (ipmcmos_aero > 0) use_uniform_densities = .false. - end if - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! rce 2013-07-31 - - ! using a local saved variable like "first" no longer works - ! the calling routine needs to determine if/when this routine is needed - ! if(first)then - ! first=.false. - - !---------------------------------------------------------------- - ! control settings - ! *** do not change mSIZE_FRAMEWORK here *** - ! mSIZE_FRAMEWORK = mSECTIONAL ! mMODAL or mSECTIONAL - ! mDYNAMIC_SOLVER = mASTEM ! mASTEM, mLSODES - ! mGAS_AER_XFER = mON ! mON, mOFF - - ! ASTEM parameters - nmax_ASTEM = 301 ! max number of time steps in ASTEM - ! alpha_ASTEM = 1.0 ! choose a value between 0.01 and 1.0 - ! rtol_eqb_ASTEM = 0.01 ! equilibrium tolerance in ASTEM - ! ptol_mol_ASTEM = 0.01 ! mol percent tolerance in ASTEM - - ! MESA parameters - Nmax_MESA = 80 ! max number of iterations in MESA_PTC - rtol_mesa = 0.01 ! MESA equilibrium tolerance - !---------------------------------------------------------------- - ! - ! set gas and aerosol indices - ! - ! gas (local) - ih2so4_g = 1 ! ioa (inorganic aerosol) - ihno3_g = 2 ! ioa - ihcl_g = 3 ! ioa - inh3_g = 4 ! ioa - imsa_g = 5 ! ioa - iaro1_g = 6 ! soa (secondary organic aerosol) - iaro2_g = 7 ! soa - ialk1_g = 8 ! soa - iole1_g = 9 ! soa - iapi1_g = 10 ! soa - iapi2_g = 11 ! soa - ilim1_g = 12 ! soa - ilim2_g = 13 ! soa - - ! ico2_g = 14 ! currently not used - ! - ! aer (local): used for total species - iso4_a = 1 ! <-> ih2so4_g - ino3_a = 2 ! <-> ihno3_g - icl_a = 3 ! <-> ihcl_g - inh4_a = 4 ! <-> inh3_g - imsa_a = 5 ! <-> imsa_g - iaro1_a = 6 ! <-> iaro1_g - iaro2_a = 7 ! <-> iaro2_g - ialk1_a = 8 ! <-> ialk1_g - iole1_a = 9 ! <-> iole1_g - iapi1_a = 10 ! <-> iapi1_g - iapi2_a = 11 ! <-> iapi2_g - ilim1_a = 12 ! <-> ilim1_g - ilim2_a = 13 ! <-> ilim2_g - ico3_a = 14 ! <-> ico2_g - ina_a = 15 - ica_a = 16 - ioin_a = 17 - ioc_a = 18 - ibc_a = 19 - - - ! electrolyte indices (used for water content calculations) - ! these indices are order sensitive - jnh4so4 = 1 ! soluble - jlvcite = 2 ! soluble - jnh4hso4 = 3 ! soluble - jnh4msa = 4 ! soluble: new - jnh4no3 = 5 ! soluble - jnh4cl = 6 ! soluble - jna2so4 = 7 ! soluble - jna3hso4 = 8 ! soluble - jnahso4 = 9 ! soluble - jnamsa = 10 ! soluble: new - jnano3 = 11 ! soluble - jnacl = 12 ! soluble - jcano3 = 13 ! soluble - jcacl2 = 14 ! soluble - jcamsa2 = 15 ! soluble nsalt - jh2so4 = 16 ! soluble - jmsa = 17 ! soluble - jhno3 = 18 ! soluble - jhcl = 19 ! soluble - jhhso4 = 20 ! soluble - jcaso4 = 21 ! insoluble - jcaco3 = 22 ! insoluble - joc = 23 ! insoluble - part of naercomp - jbc = 24 ! insoluble - part of naercomp - join = 25 ! insoluble - part of naercomp - jaro1 = 26 ! insoluble - part of naercomp - jaro2 = 27 ! insoluble - part of naercomp - jalk1 = 28 ! insoluble - part of naercomp - jole1 = 29 ! insoluble - part of naercomp - japi1 = 30 ! insoluble - part of naercomp - japi2 = 31 ! insoluble - part of naercomp - jlim1 = 32 ! insoluble - part of naercomp - jlim2 = 33 ! insoluble - part of naercomp - jh2o = 34 ! water - part of naercomp - - - ! local aerosol ions - ! cations - jc_h = 1 - jc_nh4 = 2 - jc_na = 3 - jc_ca = 4 - ! - ! anions - ja_hso4 = 1 - ja_so4 = 2 - ja_no3 = 3 - ja_cl = 4 - ja_msa = 5 - ! ja_co3 = 6 - - !-------------------------------------------------------------------- - ! phase state names - phasestate(no_aerosol) = "NOAERO" - phasestate(all_solid) = "SOLID " - phasestate(all_liquid) = "LIQUID" - phasestate(mixed) = "MIXED " - - ! names of aer species - aer_name(iso4_a) = "SO4" - aer_name(ino3_a) = "NO3" - aer_name(icl_a) = "Cl " - aer_name(inh4_a) = "NH4" - aer_name(ioc_a) = "OC " - aer_name(imsa_a) = "MSA" - aer_name(ico3_a) = "CO3" - aer_name(ina_a) = "Na " - aer_name(ica_a) = "Ca " - aer_name(ibc_a) = "BC " - aer_name(ioin_a) = "OIN" - aer_name(iaro1_a)= "ARO1" - aer_name(iaro2_a)= "ARO2" - aer_name(ialk1_a)= "ALK1" - aer_name(iole1_a)= "OLE1" - aer_name(iapi1_a)= "API1" - aer_name(iapi2_a)= "API2" - aer_name(ilim1_a)= "LIM1" - aer_name(ilim2_a)= "LIM2" - - ! names of gas species - gas_name(ih2so4_g) = "H2SO4" - gas_name(ihno3_g) = "HNO3 " - gas_name(ihcl_g) = "HCl " - gas_name(inh3_g) = "NH3 " - gas_name(imsa_g) = "MSA " - gas_name(iaro1_g) = "ARO1 " - gas_name(iaro2_g) = "ARO2 " - gas_name(ialk1_g) = "ALK1 " - gas_name(iole1_g) = "OLE1 " - gas_name(iapi1_g) = "API1 " - gas_name(iapi2_g) = "API2 " - gas_name(ilim1_g) = "LIM1 " - gas_name(ilim2_g) = "LIM2 " - - ! names of electrolytes - ename(jnh4so4) = "AmSO4" - ename(jlvcite) = "(NH4)3H(SO4)2" - ename(jnh4hso4)= "NH4HSO4" - ename(jnh4msa) = "CH3SO3NH4" - ename(jnh4no3) = "NH4NO3" - ename(jnh4cl) = "NH4Cl" - ename(jnacl) = "NaCl" - ename(jnano3) = "NaNO3" - ename(jna2so4) = "Na2SO4" - ename(jna3hso4)= "Na3H(SO4)2" - ename(jnamsa) = "CH3SO3Na" - ename(jnahso4) = "NaHSO4" - ename(jcaso4) = "CaSO4" - ename(jcamsa2) = "(CH3SO3)2Ca" - ename(jcano3) = "Ca(NO3)2" - ename(jcacl2) = "CaCl2" - ename(jcaco3) = "CaCO3" - ename(jh2so4) = "H2SO4" - ename(jhhso4) = "HHSO4" - ename(jhno3) = "HNO3" - ename(jhcl) = "HCl" - ename(jmsa) = "CH3SO3H" - - ! molecular weights of electrolytes - mw_electrolyte(jnh4so4) = 132.0 - mw_electrolyte(jlvcite) = 247.0 - mw_electrolyte(jnh4hso4)= 115.0 - mw_electrolyte(jnh4msa) = 113.0 - mw_electrolyte(jnh4no3) = 80.0 - mw_electrolyte(jnh4cl) = 53.5 - mw_electrolyte(jnacl) = 58.5 - mw_electrolyte(jnano3) = 85.0 - mw_electrolyte(jna2so4) = 142.0 - mw_electrolyte(jna3hso4)= 262.0 - mw_electrolyte(jnahso4) = 120.0 - mw_electrolyte(jnamsa) = 118.0 - mw_electrolyte(jcaso4) = 136.0 - mw_electrolyte(jcamsa2) = 230.0 - mw_electrolyte(jcano3) = 164.0 - mw_electrolyte(jcacl2) = 111.0 - mw_electrolyte(jcaco3) = 100.0 - mw_electrolyte(jh2so4) = 98.0 - mw_electrolyte(jhno3) = 63.0 - mw_electrolyte(jhcl) = 36.5 - mw_electrolyte(jmsa) = 96.0 - - - ! molecular weights of ions [g/mol] - MW_c(jc_h) = 1.0 - MW_c(jc_nh4)= 18.0 - MW_c(jc_na) = 23.0 - MW_c(jc_ca) = 40.0 - - MW_a(ja_so4) = 96.0 - MW_a(ja_hso4)= 97.0 - MW_a(ja_no3) = 62.0 - MW_a(ja_cl) = 35.5 - MW_a(ja_msa) = 95.0 - - - ! magnitude of the charges on ions - zc(jc_h) = 1 - zc(jc_nh4) = 1 - zc(jc_na) = 1 - zc(jc_ca) = 2 - - za(ja_hso4)= 1 - za(ja_so4) = 2 - za(ja_no3) = 1 - za(ja_cl) = 1 - za(ja_msa) = 1 - - - ! densities of pure electrolytes in g/cc - dens_electrolyte(jnh4so4) = 1.8 - dens_electrolyte(jlvcite) = 1.8 - dens_electrolyte(jnh4hso4) = 1.8 - dens_electrolyte(jnh4msa) = 1.8 ! assumed same as nh4hso4 - dens_electrolyte(jnh4no3) = 1.8 - dens_electrolyte(jnh4cl) = 1.8 - dens_electrolyte(jnacl) = 2.2 - dens_electrolyte(jnano3) = 2.2 - dens_electrolyte(jna2so4) = 2.2 - dens_electrolyte(jna3hso4) = 2.2 - dens_electrolyte(jnahso4) = 2.2 - dens_electrolyte(jnamsa) = 2.2 ! assumed same as nahso4 - dens_electrolyte(jcaso4) = 2.6 - dens_electrolyte(jcamsa2) = 2.6 ! assumed same as caso4 - dens_electrolyte(jcano3) = 2.6 - dens_electrolyte(jcacl2) = 2.6 - dens_electrolyte(jcaco3) = 2.6 - dens_electrolyte(jh2so4) = 1.8 - dens_electrolyte(jhhso4) = 1.8 - dens_electrolyte(jhno3) = 1.8 - dens_electrolyte(jhcl) = 1.8 - dens_electrolyte(jmsa) = 1.8 ! assumed same as h2so4 - if ( use_uniform_densities ) then!BSINGH - 05/28/2013(RCE updates) - do je = 1, nelectrolyte - dens_electrolyte(je) = 1.6 - enddo - endif!BSINGH - 05/28/2013(RCE updates) - - ! densities of compounds in g/cc - dens_comp_a(jnh4so4) = 1.8 - dens_comp_a(jlvcite) = 1.8 - dens_comp_a(jnh4hso4) = 1.8 - dens_comp_a(jnh4msa) = 1.8 ! assumed same as nh4hso4 - dens_comp_a(jnh4no3) = 1.7 - dens_comp_a(jnh4cl) = 1.5 - dens_comp_a(jnacl) = 2.2 - dens_comp_a(jnano3) = 2.2 - dens_comp_a(jna2so4) = 2.2 - dens_comp_a(jna3hso4) = 2.2 - dens_comp_a(jnahso4) = 2.2 - dens_comp_a(jnamsa) = 2.2 ! assumed same as nahso4 - dens_comp_a(jcaso4) = 2.6 - dens_comp_a(jcamsa2) = 2.6 ! assumed same as caso4 - dens_comp_a(jcano3) = 2.6 - dens_comp_a(jcacl2) = 2.6 - dens_comp_a(jcaco3) = 2.6 - dens_comp_a(jh2so4) = 1.8 - dens_comp_a(jhhso4) = 1.8 - dens_comp_a(jhno3) = 1.8 - dens_comp_a(jhcl) = 1.8 - dens_comp_a(jmsa) = 1.8 ! assumed same as h2so4 - dens_comp_a(joc) = 1.0 - dens_comp_a(jbc) = 1.8 - dens_comp_a(join) = 2.6 - dens_comp_a(jaro1) = 1.0 - dens_comp_a(jaro2) = 1.0 - dens_comp_a(jalk1) = 1.0 - dens_comp_a(jole1) = 1.0 - dens_comp_a(japi1) = 1.0 - dens_comp_a(japi2) = 1.0 - dens_comp_a(jlim1) = 1.0 - dens_comp_a(jlim2) = 1.0 - dens_comp_a(jh2o) = 1.0 - !BSINGH - 05/28/2013(RCE updates) - ! following for comparison with mos31d_bs2 and. mos31e_rz1 - if ( use_mos31e_rz1_densities ) then - dens_comp_a(joc) = 1.4 - dens_comp_a(jaro1) = 1.4 - dens_comp_a(jaro2) = 1.4 - dens_comp_a(jalk1) = 1.4 - dens_comp_a(jole1) = 1.4 - dens_comp_a(japi1) = 1.4 - dens_comp_a(japi2) = 1.4 - dens_comp_a(jlim1) = 1.4 - dens_comp_a(jlim2) = 1.4 - end if - - if ( use_uniform_densities ) then - !BSINGH - 05/28/2013(RCE updates ENDS) - do je = 1, naercomp - dens_comp_a(je) = 1.6 - enddo - !BSINGH - 05/28/2013(RCE updates) - endif - - if (ipmcmos_aero > 0) then - dens_comp_a(jnh4no3) = 1.8 - dens_comp_a(jnh4cl) = 1.8 - dens_comp_a(jaro1) = 1.4 - dens_comp_a(jaro2) = 1.4 - dens_comp_a(jalk1) = 1.4 - dens_comp_a(jole1) = 1.4 - dens_comp_a(japi1) = 1.4 - dens_comp_a(japi2) = 1.4 - dens_comp_a(jlim1) = 1.4 - dens_comp_a(jlim2) = 1.4 - endif - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! molecular weights of generic aerosol species - mw_aer_mac(iso4_a) = 96.0 - mw_aer_mac(ino3_a) = 62.0 - mw_aer_mac(icl_a) = 35.5 - mw_aer_mac(imsa_a) = 95.0 ! CH3SO3 - mw_aer_mac(ico3_a) = 60.0 - mw_aer_mac(inh4_a) = 18.0 - mw_aer_mac(ina_a) = 23.0 - mw_aer_mac(ica_a) = 40.0 - mw_aer_mac(ioin_a) = 1.0 ! not used - mw_aer_mac(ibc_a) = 1.0 ! not used - mw_aer_mac(ioc_a) = 1.0 ! 200 assumed for primary organics - mw_aer_mac(iaro1_a)= 150.0 - mw_aer_mac(iaro2_a)= 150.0 - mw_aer_mac(ialk1_a)= 140.0 - mw_aer_mac(iole1_a)= 140.0 - mw_aer_mac(iapi1_a)= 184.0 - mw_aer_mac(iapi2_a)= 184.0 - mw_aer_mac(ilim1_a)= 200.0 - mw_aer_mac(ilim2_a)= 200.0 - - ! molecular weights of compounds - mw_comp_a(jnh4so4) = 132.0 - mw_comp_a(jlvcite) = 247.0 - mw_comp_a(jnh4hso4)= 115.0 - mw_comp_a(jnh4msa) = 113.0 - mw_comp_a(jnh4no3) = 80.0 - mw_comp_a(jnh4cl) = 53.5 - mw_comp_a(jnacl) = 58.5 - mw_comp_a(jnano3) = 85.0 - mw_comp_a(jna2so4) = 142.0 - mw_comp_a(jna3hso4)= 262.0 - mw_comp_a(jnahso4) = 120.0 - mw_comp_a(jnamsa) = 118.0 - mw_comp_a(jcaso4) = 136.0 - mw_comp_a(jcamsa2) = 230.0 - mw_comp_a(jcano3) = 164.0 - mw_comp_a(jcacl2) = 111.0 - mw_comp_a(jcaco3) = 100.0 - mw_comp_a(jh2so4) = 98.0 - mw_comp_a(jhhso4) = 98.0 - mw_comp_a(jhno3) = 63.0 - mw_comp_a(jhcl) = 36.5 - mw_comp_a(jmsa) = 96.0 - mw_comp_a(joc) = 1.0 - mw_comp_a(jbc) = 1.0 - mw_comp_a(join) = 1.0 - mw_comp_a(jaro1) = 150.0 - mw_comp_a(jaro2) = 150.0 - mw_comp_a(jalk1) = 140.0 - mw_comp_a(jole1) = 140.0 - mw_comp_a(japi1) = 184.0 - mw_comp_a(japi2) = 184.0 - mw_comp_a(jlim1) = 200.0 - mw_comp_a(jlim2) = 200.0 - mw_comp_a(jh2o) = 18.0 - !BSINGH - 05/28/2013(RCE updates) - ! partmc-2.2.1 jun-2012 - !# dens (kg/m^3) ions in soln (1) molec wght (kg/mole) kappa (1) - ! SO4 1800 0 96d-3 0.65 - ! NO3 1800 0 62d-3 0.65 - ! Cl 2200 0 35.5d-3 0.53 - ! NH4 1800 0 18d-3 0.65 - ! MSA 1800 0 95d-3 0.53 - ! ARO1 1400 0 150d-3 0.1 - ! ARO2 1400 0 150d-3 0.1 - ! ALK1 1400 0 140d-3 0.1 - ! OLE1 1400 0 140d-3 0.1 - ! API1 1400 0 184d-3 0.1 - ! API2 1400 0 184d-3 0.1 - ! LIM1 1400 0 200d-3 0.1 - ! LIM2 1400 0 200d-3 0.1 - ! CO3 2600 0 60d-3 0.53 - ! Na 2200 0 23d-3 0.53 - ! Ca 2600 0 40d-3 0.53 - ! OIN 2600 0 1d-3 0.1 - ! OC 1000 0 1d-3 0.001 - ! BC 1800 0 1d-3 0 - ! H2O 1000 0 18d-3 0 - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! densities of generic aerosol species - dens_aer_mac(iso4_a) = 1.8 ! used - dens_aer_mac(ino3_a) = 1.8 ! used - dens_aer_mac(icl_a) = 2.2 ! used - dens_aer_mac(imsa_a) = 1.8 ! used - dens_aer_mac(ico3_a) = 2.6 ! used - dens_aer_mac(inh4_a) = 1.8 ! used - dens_aer_mac(ina_a) = 2.2 ! used - dens_aer_mac(ica_a) = 2.6 ! used - dens_aer_mac(ioin_a) = 2.6 ! used - dens_aer_mac(ioc_a) = 1.0 ! used - dens_aer_mac(ibc_a) = 1.8 ! used - dens_aer_mac(iaro1_a)= 1.0 - dens_aer_mac(iaro2_a)= 1.0 - dens_aer_mac(ialk1_a)= 1.0 - dens_aer_mac(iole1_a)= 1.0 - dens_aer_mac(iapi1_a)= 1.0 - dens_aer_mac(iapi2_a)= 1.0 - dens_aer_mac(ilim1_a)= 1.0 - dens_aer_mac(ilim2_a)= 1.0 - !BSINGH - 05/28/2013(RCE updates) - ! following for comparison with mos31d_bs2 and. mos31e_rz1 - if ( use_mos31e_rz1_densities ) then - dens_aer_mac(ioc_a) = 1.4 - dens_aer_mac(iaro1_a)= 1.4 - dens_aer_mac(iaro2_a)= 1.4 - dens_aer_mac(ialk1_a)= 1.4 - dens_aer_mac(iole1_a)= 1.4 - dens_aer_mac(iapi1_a)= 1.4 - dens_aer_mac(iapi2_a)= 1.4 - dens_aer_mac(ilim1_a)= 1.4 - dens_aer_mac(ilim2_a)= 1.4 - end if - - if ( use_uniform_densities ) then - !BSINGH - 05/28/2013(RCE updates ENDS) - - do iaer = 1, naer - dens_aer_mac(iaer) = 1.6 - enddo - endif!BSINGH - 05/28/2013(RCE updates) - - if (ipmcmos_aero > 0) then - ! use partmc-mosaic densities - dens_aer_mac(1:naer) = (/ & - 1.80, 1.80, 2.20, 1.80, 1.80, 1.40, 1.40, 1.40, 1.40, 1.40, & - 1.40, 1.40, 1.40, 2.60, 2.20, 2.60, 2.60, 1.00, 1.80 /)!BSINGH - 05/28/2013(RCE updates) - ! so4 no3 cl nh4 msa aro1 aro2 alk1 ole1 api1 - ! api2 lim1 lim2 co3 na ca oin oc bc - end if - - if ( use_cam5mam_soa_params > 0 ) then - dens_aer_mac(ioc_a) = 1.0 - dens_aer_mac(ilim2_a) = 1.0 - ! for oc, leave mw=1 because some of the mosaic code requires this - mw_aer_mac(ilim2_a) = 150.0 - dens_comp_a(joc) = 1.0 - dens_comp_a(jlim2) = 1.0 - mw_comp_a(jlim2) = 150.0 - end if - - ! kappa values (hygroscopicities) of generic aerosol species - ! - ! for calculation of ccn properties, kappa of electrolytes - ! should be used - ! the multi-dimensional sectional code needs a "fixed" kappa - ! for each generic aerosol species, just as the older - ! 1d sectional code needs a "fixed" dry density - kappa_aer_mac(iso4_a) = 0.65 - kappa_aer_mac(ino3_a) = 0.65 - kappa_aer_mac(imsa_a) = 0.65 - kappa_aer_mac(inh4_a) = 0.65 - kappa_aer_mac(icl_a) = 0.65 - kappa_aer_mac(ina_a) = 0.65 - kappa_aer_mac(ico3_a) = 0.001 ! ?? - kappa_aer_mac(ica_a) = 0.001 ! ?? - kappa_aer_mac(ioin_a) = 0.001 - kappa_aer_mac(ioc_a) = 0.001 - kappa_aer_mac(ibc_a) = 0.001 - kappa_aer_mac(iaro1_a) = 0.1 - kappa_aer_mac(iaro2_a) = 0.1 - kappa_aer_mac(ialk1_a) = 0.1 - kappa_aer_mac(iole1_a) = 0.1 - kappa_aer_mac(iapi1_a) = 0.1 - kappa_aer_mac(iapi2_a) = 0.1 - kappa_aer_mac(ilim1_a) = 0.1 - kappa_aer_mac(ilim2_a) = 0.1 - !BSINGH - 05/28/2013(RCE updates) - if (ipmcmos_aero > 0) then - ! use partmc-mosaic kappas - kappa_aer_mac(1:naer) = (/ & - 0.65, 0.65, 0.53, 0.65, 0.53, 0.10, 0.10, 0.10, 0.10, 0.10, & - 0.10, 0.10, 0.10, 0.53, 0.53, 0.53, 0.10, 0.001, 0.0 /) - ! so4 no3 cl nh4 msa aro1 aro2 alk1 ole1 api1 - ! api2 lim1 lim2 co3 na ca oin oc bc - end if - !BSINGH - 05/28/2013(RCE updates ENDS) - - ! partial molar volumes of condensing species - partial_molar_vol(ih2so4_g) = 51.83 - partial_molar_vol(ihno3_g) = 31.45 - partial_molar_vol(ihcl_g) = 20.96 - partial_molar_vol(inh3_g) = 24.03 - partial_molar_vol(imsa_g) = 53.33 - partial_molar_vol(iaro1_g) = 150.0 - partial_molar_vol(iaro2_g) = 150.0 - partial_molar_vol(ialk1_g) = 140.0 - partial_molar_vol(iole1_g) = 140.0 - partial_molar_vol(iapi1_g) = 184.0 - partial_molar_vol(iapi2_g) = 184.0 - partial_molar_vol(ilim1_g) = 200.0 - partial_molar_vol(ilim2_g) = 200.0 - - ! refractive index - ref_index_a(jnh4so4) = cmplx(1.52,0.) - ref_index_a(jlvcite) = cmplx(1.50,0.) - ref_index_a(jnh4hso4)= cmplx(1.47,0.) - ref_index_a(jnh4msa) = cmplx(1.50,0.) ! assumed - ref_index_a(jnh4no3) = cmplx(1.50,0.) - ref_index_a(jnh4cl) = cmplx(1.50,0.) - ref_index_a(jnacl) = cmplx(1.45,0.) - ref_index_a(jnano3) = cmplx(1.50,0.) - ref_index_a(jna2so4) = cmplx(1.50,0.) - ref_index_a(jna3hso4)= cmplx(1.50,0.) - ref_index_a(jnahso4) = cmplx(1.50,0.) - ref_index_a(jnamsa) = cmplx(1.50,0.) ! assumed - ref_index_a(jcaso4) = cmplx(1.56,0.006) - ref_index_a(jcamsa2) = cmplx(1.56,0.006) ! assumed - ref_index_a(jcano3) = cmplx(1.56,0.006) - ref_index_a(jcacl2) = cmplx(1.52,0.006) - ref_index_a(jcaco3) = cmplx(1.68,0.006) - ref_index_a(jh2so4) = cmplx(1.43,0.) - ref_index_a(jhhso4) = cmplx(1.43,0.) - ref_index_a(jhno3) = cmplx(1.50,0.) - ref_index_a(jhcl) = cmplx(1.50,0.) - ref_index_a(jmsa) = cmplx(1.43,0.) ! assumed - ref_index_a(joc) = cmplx(1.45,0.) - ref_index_a(jbc) = cmplx(1.82,0.74) - ref_index_a(join) = cmplx(1.55,0.006) - ref_index_a(jaro1) = cmplx(1.45,0.) - ref_index_a(jaro2) = cmplx(1.45,0.) - ref_index_a(jalk1) = cmplx(1.45,0.) - ref_index_a(jole1) = cmplx(1.45,0.) - ref_index_a(japi1) = cmplx(1.45,0.) - ref_index_a(japi2) = cmplx(1.45,0.) - ref_index_a(jlim1) = cmplx(1.45,0.) - ref_index_a(jlim2) = cmplx(1.45,0.) - ref_index_a(jh2o) = cmplx(1.33,0.) - - ! jsalt_index - jsalt_index(jnh4so4) = 5 ! AS - jsalt_index(jlvcite) = 2 ! LV - jsalt_index(jnh4hso4)= 1 ! AB - jsalt_index(jnh4no3) = 2 ! AN - jsalt_index(jnh4cl) = 1 ! AC - jsalt_index(jna2so4) = 60 ! SS - jsalt_index(jnahso4) = 10 ! SB - jsalt_index(jnano3) = 40 ! SN - jsalt_index(jnacl) = 10 ! SC - jsalt_index(jcano3) = 120 ! CN - jsalt_index(jcacl2) = 80 ! CC - jsalt_index(jnh4msa) = 0 ! AM zero for now - jsalt_index(jnamsa) = 0 ! SM zero for now - jsalt_index(jcamsa2) = 0 ! CM zero for now - - ! Aerosol Indices - ! AC = 1, AN = 2, AS = 5, SC = 10, SN = 40, SS = 60, CC = 80, CN = 120, - ! AB = 1, LV = 2, SB = 10 - ! - ! SULFATE-POOR DOMAIN - jsulf_poor(1) = 1 ! AC - jsulf_poor(2) = 2 ! AN - jsulf_poor(5) = 3 ! AS - jsulf_poor(10) = 4 ! SC - jsulf_poor(40) = 5 ! SN - jsulf_poor(60) = 6 ! SS - jsulf_poor(80) = 7 ! CC - jsulf_poor(120) = 8 ! CN - jsulf_poor(3) = 9 ! AN + AC - jsulf_poor(6) = 10 ! AS + AC - jsulf_poor(7) = 11 ! AS + AN - jsulf_poor(8) = 12 ! AS + AN + AC - jsulf_poor(11) = 13 ! SC + AC - jsulf_poor(41) = 14 ! SN + AC - jsulf_poor(42) = 15 ! SN + AN - jsulf_poor(43) = 16 ! SN + AN + AC - jsulf_poor(50) = 17 ! SN + SC - jsulf_poor(51) = 18 ! SN + SC + AC - jsulf_poor(61) = 19 ! SS + AC - jsulf_poor(62) = 20 ! SS + AN - jsulf_poor(63) = 21 ! SS + AN + AC - jsulf_poor(65) = 22 ! SS + AS - jsulf_poor(66) = 23 ! SS + AS + AC - jsulf_poor(67) = 24 ! SS + AS + AN - jsulf_poor(68) = 25 ! SS + AS + AN + AC - jsulf_poor(70) = 26 ! SS + SC - jsulf_poor(71) = 27 ! SS + SC + AC - jsulf_poor(100) = 28 ! SS + SN - jsulf_poor(101) = 29 ! SS + SN + AC - jsulf_poor(102) = 30 ! SS + SN + AN - jsulf_poor(103) = 31 ! SS + SN + AN + AC - jsulf_poor(110) = 32 ! SS + SN + SC - jsulf_poor(111) = 33 ! SS + SN + SC + AC - jsulf_poor(81) = 34 ! CC + AC - jsulf_poor(90) = 35 ! CC + SC - jsulf_poor(91) = 36 ! CC + SC + AC - jsulf_poor(121) = 37 ! CN + AC - jsulf_poor(122) = 38 ! CN + AN - jsulf_poor(123) = 39 ! CN + AN + AC - jsulf_poor(130) = 40 ! CN + SC - jsulf_poor(131) = 41 ! CN + SC + AC - jsulf_poor(160) = 42 ! CN + SN - jsulf_poor(161) = 43 ! CN + SN + AC - jsulf_poor(162) = 44 ! CN + SN + AN - jsulf_poor(163) = 45 ! CN + SN + AN + AC - jsulf_poor(170) = 46 ! CN + SN + SC - jsulf_poor(171) = 47 ! CN + SN + SC + AC - jsulf_poor(200) = 48 ! CN + CC - jsulf_poor(201) = 49 ! CN + CC + AC - jsulf_poor(210) = 50 ! CN + CC + SC - jsulf_poor(211) = 51 ! CN + CC + SC + AC - ! - ! SULFATE-RICH DOMAIN - jsulf_rich(1) = 52 ! AB - jsulf_rich(2) = 53 ! LV - jsulf_rich(10) = 54 ! SB - jsulf_rich(3) = 55 ! AB + LV - jsulf_rich(7) = 56 ! AS + LV - jsulf_rich(70) = 57 ! SS + SB - jsulf_rich(62) = 58 ! SS + LV - jsulf_rich(67) = 59 ! SS + AS + LV - jsulf_rich(61) = 60 ! SS + AB - jsulf_rich(63) = 61 ! SS + LV + AB - jsulf_rich(11) = 62 ! SB + AB - jsulf_rich(71) = 63 ! SS + SB + AB - jsulf_rich(5) = 3 ! AS - jsulf_rich(60) = 6 ! SS - jsulf_rich(65) = 22 ! SS + AS - - - - ! - ! polynomial coefficients for binary molality (used in ZSR equation) - ! - ! - ! a_zsr for aw < 0.97 - ! - ! (NH4)2SO4 - je = jnh4so4 - a_zsr(1,je) = 1.30894 - a_zsr(2,je) = -7.09922 - a_zsr(3,je) = 20.62831 - a_zsr(4,je) = -32.19965 - a_zsr(5,je) = 25.17026 - a_zsr(6,je) = -7.81632 - aw_min(je) = 0.1 - ! - ! (NH4)3H(SO4)2 - je = jlvcite - a_zsr(1,je) = 1.10725 - a_zsr(2,je) = -5.17978 - a_zsr(3,je) = 12.29534 - a_zsr(4,je) = -16.32545 - a_zsr(5,je) = 11.29274 - a_zsr(6,je) = -3.19164 - aw_min(je) = 0.1 - ! - ! NH4HSO4 - je = jnh4hso4 - a_zsr(1,je) = 1.15510 - a_zsr(2,je) = -3.20815 - a_zsr(3,je) = 2.71141 - a_zsr(4,je) = 2.01155 - a_zsr(5,je) = -4.71014 - a_zsr(6,je) = 2.04616 - aw_min(je) = 0.1 - ! - ! NH4MSA (assumed same as NH4HSO4) - je = jnh4msa - a_zsr(1,je) = 1.15510 - a_zsr(2,je) = -3.20815 - a_zsr(3,je) = 2.71141 - a_zsr(4,je) = 2.01155 - a_zsr(5,je) = -4.71014 - a_zsr(6,je) = 2.04616 - aw_min(je) = 0.1 - ! - ! NH4NO3 - je = jnh4no3 - a_zsr(1,je) = 0.43507 - a_zsr(2,je) = 6.38220 - a_zsr(3,je) = -30.19797 - a_zsr(4,je) = 53.36470 - a_zsr(5,je) = -43.44203 - a_zsr(6,je) = 13.46158 - aw_min(je) = 0.1 - ! - ! NH4Cl: revised on Nov 13, 2003. based on Chan and Ha (1999) JGR. - je = jnh4cl - a_zsr(1,je) = 0.45309 - a_zsr(2,je) = 2.65606 - a_zsr(3,je) = -14.7730 - a_zsr(4,je) = 26.2936 - a_zsr(5,je) = -20.5735 - a_zsr(6,je) = 5.94255 - aw_min(je) = 0.1 - ! - ! NaCl - je = jnacl - a_zsr(1,je) = 0.42922 - a_zsr(2,je) = -1.17718 - a_zsr(3,je) = 2.80208 - a_zsr(4,je) = -4.51097 - a_zsr(5,je) = 3.76963 - a_zsr(6,je) = -1.31359 - aw_min(je) = 0.1 - ! - ! NaNO3 - je = jnano3 - a_zsr(1,je) = 1.34966 - a_zsr(2,je) = -5.20116 - a_zsr(3,je) = 11.49011 - a_zsr(4,je) = -14.41380 - a_zsr(5,je) = 9.07037 - a_zsr(6,je) = -2.29769 - aw_min(je) = 0.1 - ! - ! Na2SO4 - je = jna2so4 - a_zsr(1,je) = 0.39888 - a_zsr(2,je) = -1.27150 - a_zsr(3,je) = 3.42792 - a_zsr(4,je) = -5.92632 - a_zsr(5,je) = 5.33351 - a_zsr(6,je) = -1.96541 - aw_min(je) = 0.1 - ! - ! Na3H(SO4)2 added on 1/14/2004 - je = jna3hso4 - a_zsr(1,je) = 0.31480 - a_zsr(2,je) = -1.01087 - a_zsr(3,je) = 2.44029 - a_zsr(4,je) = -3.66095 - a_zsr(5,je) = 2.77632 - a_zsr(6,je) = -0.86058 - aw_min(je) = 0.1 - ! - ! NaHSO4 - je = jnahso4 - a_zsr(1,je) = 0.62764 - a_zsr(2,je) = -1.63520 - a_zsr(3,je) = 4.62531 - a_zsr(4,je) = -10.06925 - a_zsr(5,je) = 10.33547 - a_zsr(6,je) = -3.88729 - aw_min(je) = 0.1 - ! - ! NaMSA (assumed same as NaHSO4) - je = jnamsa - a_zsr(1,je) = 0.62764 - a_zsr(2,je) = -1.63520 - a_zsr(3,je) = 4.62531 - a_zsr(4,je) = -10.06925 - a_zsr(5,je) = 10.33547 - a_zsr(6,je) = -3.88729 - aw_min(je) = 0.1 - ! - ! Ca(NO3)2 - je = jcano3 - a_zsr(1,je) = 0.38895 - a_zsr(2,je) = -1.16013 - a_zsr(3,je) = 2.16819 - a_zsr(4,je) = -2.23079 - a_zsr(5,je) = 1.00268 - a_zsr(6,je) = -0.16923 - aw_min(je) = 0.1 - ! - ! CaCl2: Kim and Seinfeld - je = jcacl2 - a_zsr(1,je) = 0.29891 - a_zsr(2,je) = -1.31104 - a_zsr(3,je) = 3.68759 - a_zsr(4,je) = -5.81708 - a_zsr(5,je) = 4.67520 - a_zsr(6,je) = -1.53223 - aw_min(je) = 0.1 - ! - ! H2SO4 - je = jh2so4 - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 0.1 - ! - ! MSA (assumed same as H2SO4) - je = jmsa - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 0.1 - ! - ! HHSO4 - je = jhhso4 - a_zsr(1,je) = 0.32751 - a_zsr(2,je) = -1.00692 - a_zsr(3,je) = 2.59750 - a_zsr(4,je) = -4.40014 - a_zsr(5,je) = 3.88212 - a_zsr(6,je) = -1.39916 - aw_min(je) = 1.0 - ! - ! HNO3 - je = jhno3 - a_zsr(1,je) = 0.75876 - a_zsr(2,je) = -3.31529 - a_zsr(3,je) = 9.26392 - a_zsr(4,je) = -14.89799 - a_zsr(5,je) = 12.08781 - a_zsr(6,je) = -3.89958 - aw_min(je) = 0.1 - ! - ! HCl - je = jhcl - a_zsr(1,je) = 0.31133 - a_zsr(2,je) = -0.79688 - a_zsr(3,je) = 1.93995 - a_zsr(4,je) = -3.31582 - a_zsr(5,je) = 2.93513 - a_zsr(6,je) = -1.07268 - aw_min(je) = 0.1 - ! - ! CaSO4 - je = jcaso4 - a_zsr(1,je) = 0.0 - a_zsr(2,je) = 0.0 - a_zsr(3,je) = 0.0 - a_zsr(4,je) = 0.0 - a_zsr(5,je) = 0.0 - a_zsr(6,je) = 0.0 - aw_min(je) = 1.0 - ! - ! Ca(MSA)2 (assumed same as Ca(NO3)2) - je = jcamsa2 - a_zsr(1,je) = 0.38895 - a_zsr(2,je) = -1.16013 - a_zsr(3,je) = 2.16819 - a_zsr(4,je) = -2.23079 - a_zsr(5,je) = 1.00268 - a_zsr(6,je) = -0.16923 - aw_min(je) = 0.1 - ! - ! CaCO3 - je = jcaco3 - a_zsr(1,je) = 0.0 - a_zsr(2,je) = 0.0 - a_zsr(3,je) = 0.0 - a_zsr(4,je) = 0.0 - a_zsr(5,je) = 0.0 - a_zsr(6,je) = 0.0 - aw_min(je) = 1.0 - - - - !------------------------------------------- - ! b_zsr for aw => 0.97 to 0.99999 - ! - ! (NH4)2SO4 - b_zsr(jnh4so4) = 28.0811 - ! - ! (NH4)3H(SO4)2 - b_zsr(jlvcite) = 14.7178 - ! - ! NH4HSO4 - b_zsr(jnh4hso4) = 29.4779 - ! - ! NH4MSA - b_zsr(jnh4msa) = 29.4779 ! assumed same as NH4HSO4 - ! - ! NH4NO3 - b_zsr(jnh4no3) = 33.4049 - ! - ! NH4Cl - b_zsr(jnh4cl) = 30.8888 - ! - ! NaCl - b_zsr(jnacl) = 29.8375 - ! - ! NaNO3 - b_zsr(jnano3) = 32.2756 - ! - ! Na2SO4 - b_zsr(jna2so4) = 27.6889 - ! - ! Na3H(SO4)2 - b_zsr(jna3hso4) = 14.2184 - ! - ! NaHSO4 - b_zsr(jnahso4) = 28.3367 - ! - ! NaMSA - b_zsr(jnamsa) = 28.3367 ! assumed same as NaHSO4 - ! - ! Ca(NO3)2 - b_zsr(jcano3) = 18.3661 - ! - ! CaCl2 - b_zsr(jcacl2) = 20.8792 - ! - ! H2SO4 - b_zsr(jh2so4) = 26.7347 - ! - ! HHSO4 - b_zsr(jhhso4) = 26.7347 - ! - ! HNO3 - b_zsr(jhno3) = 28.8257 - ! - ! HCl - b_zsr(jhcl) = 27.7108 - ! - ! MSA - b_zsr(jmsa) = 26.7347 ! assumed same as H2SO4 - ! - ! CaSO4 - b_zsr(jcaso4) = 0.0 - ! - ! Ca(MSA)2 - b_zsr(jcamsa2) = 18.3661 ! assumed same as Ca(NO3)2 - ! - ! CaCO3 - b_zsr(jcaco3) = 0.0 - - - - - - - - - - !------------------------------------------- - ! Li and Lu (2001) Surface tension model - ! G_MX [mol/cm^2]; K_MX [-] - ! - ! (NH4)2SO4 - G_MX(jnh4so4) = -8.79e-7*1.e-4 - K_MX(jnh4so4) = 3.84e+1 - ! - ! (NH4)3H(SO4)2 - G_MX(jlvcite) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jlvcite) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4HSO4 - G_MX(jnh4hso4) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jnh4hso4) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4MSA - G_MX(jnh4msa) = -8.79e-7*1.e-4 ! assumed same as (NH4)2SO4 - K_MX(jnh4msa) = 3.84e+1 ! assumed same as (NH4)2SO4 - ! - ! NH4NO3 - G_MX(jnh4no3) = -3.08e-6*1.e-4 - K_MX(jnh4no3) = 4.89e-1 - ! - ! NH4Cl - G_MX(jnh4cl) = -1.01e-6*1.e-4 - K_MX(jnh4cl) = 1.3 - ! - ! NaCl - G_MX(jnacl) = -1.05e-6*1.e-4 - K_MX(jnacl) = 1.2 - ! - ! NaNO3 - G_MX(jnano3) = -1.66e-6*1.e-4 - K_MX(jnano3) = 1.25 - ! - ! Na2SO4 - G_MX(jna2so4) = -8.37e-7*1.e-4 - K_MX(jna2so4) = 7.57e+1 - ! - ! Na3H(SO4)2 - G_MX(jna3hso4) = -8.37e-7*1.e-4 ! assumed same as Na2SO4 - K_MX(jna3hso4) = 7.57e+1 ! assumed same as Na2SO4 - ! - ! NaHSO4 - G_MX(jnahso4) = -8.37e-7*1.e-4 ! assumed same as Na2SO4 - K_MX(jnahso4) = 7.57e+1 ! assumed same as Na2SO4 - ! - ! NaMSA - G_MX(jnamsa) = -8.37e-7*1.e-4 - K_MX(jnamsa) = 7.57e+1 - ! - ! Ca(NO3)2 - G_MX(jcano3) = -4.88e-7*1.e-4 ! assumed same as CaCl2 - K_MX(jcano3) = 1.50e+1 ! assumed same as CaCl2 - ! - ! CaCl2 - G_MX(jcacl2) = -4.88e-7*1.e-4 - K_MX(jcacl2) = 1.50e+1 - ! - ! H2SO4 - G_MX(jh2so4) = -6.75e-8*1.e-4 - K_MX(jh2so4) = 1.65e+3 - ! - ! HHSO4 - G_MX(jh2so4) = -6.75e-8*1.e-4 ! assumed same as H2SO4 - K_MX(jh2so4) = 1.65e+3 ! assumed same as H2SO4 - ! - ! HNO3 - G_MX(jhno3) = 8.05e-7*1.e-4 - K_MX(jhno3) = 1.06e-1 - ! - ! HCl - G_MX(jhcl) = 4.12e-7*1.e-4 - K_MX(jhcl) = 4.68e-3 - !& - - ! MSA - G_MX(jmsa) = 8.05e-7*1.e-4 ! assumed same as HNO3 - K_MX(jmsa) = 1.06e-1 ! assumed same as HNO3 - ! - ! CaSO4 - G_MX(jmsa) = 0.0*1.e-4 ! assumed - K_MX(jmsa) = 0.0 ! assumed - ! - ! Ca(MSA)2 - G_MX(jcamsa2) = 0.0*1.e-4 ! assumed - K_MX(jcamsa2) = 0.0 ! assumed - ! - ! CaCO3 - G_MX(jcaco3) = 0.0*1.e-4 ! assumed - K_MX(jcaco3) = 0.0 ! assumed - - - - - - - - !---------------------------------------------------------------- - ! parameters for MTEM mixing rule (Zaveri, Easter, and Wexler, 2005) - ! log_gamZ(jA,jE) A in E - !---------------------------------------------------------------- - ! - b_mtem(:,:,:) = 0.0_r8 !BSINGH - Temporarily initialized, please modify if required *Ask dick about it* the code blows up if i initialize it with nan - ! (NH4)2SO4 in E - jA = jnh4so4 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.94685 - b_mtem(2,jA,jE) = 17.3328 - b_mtem(3,jA,jE) = -64.8441 - b_mtem(4,jA,jE) = 122.7070 - b_mtem(5,jA,jE) = -114.4373 - b_mtem(6,jA,jE) = 41.6811 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.7503 - b_mtem(2,jA,jE) = 4.3806 - b_mtem(3,jA,jE) = -1.1110 - b_mtem(4,jA,jE) = -1.7005 - b_mtem(5,jA,jE) = -4.4207 - b_mtem(6,jA,jE) = 5.1990 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -2.06952 - b_mtem(2,jA,jE) = 7.1240 - b_mtem(3,jA,jE) = -24.4274 - b_mtem(4,jA,jE) = 51.1458 - b_mtem(5,jA,jE) = -54.2056 - b_mtem(6,jA,jE) = 22.0606 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -2.17361 - b_mtem(2,jA,jE) = 15.9919 - b_mtem(3,jA,jE) = -69.0952 - b_mtem(4,jA,jE) = 139.8860 - b_mtem(5,jA,jE) = -134.9890 - b_mtem(6,jA,jE) = 49.8877 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -4.4370 - b_mtem(2,jA,jE) = 24.0243 - b_mtem(3,jA,jE) = -76.2437 - b_mtem(4,jA,jE) = 128.6660 - b_mtem(5,jA,jE) = -110.0900 - b_mtem(6,jA,jE) = 37.7414 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -1.5394 - b_mtem(2,jA,jE) = 5.8671 - b_mtem(3,jA,jE) = -22.7726 - b_mtem(4,jA,jE) = 47.0547 - b_mtem(5,jA,jE) = -47.8266 - b_mtem(6,jA,jE) = 18.8489 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -0.35750 - b_mtem(2,jA,jE) = -3.82466 - b_mtem(3,jA,jE) = 4.55462 - b_mtem(4,jA,jE) = 5.05402 - b_mtem(5,jA,jE) = -14.7476 - b_mtem(6,jA,jE) = 8.8009 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -2.15146 - b_mtem(2,jA,jE) = 5.50205 - b_mtem(3,jA,jE) = -19.1476 - b_mtem(4,jA,jE) = 39.1880 - b_mtem(5,jA,jE) = -39.9460 - b_mtem(6,jA,jE) = 16.0700 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -2.52604 - b_mtem(2,jA,jE) = 9.76022 - b_mtem(3,jA,jE) = -35.2540 - b_mtem(4,jA,jE) = 71.2981 - b_mtem(5,jA,jE) = -71.8207 - b_mtem(6,jA,jE) = 28.0758 - - ! - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -4.13219 - b_mtem(2,jA,jE) = 13.8863 - b_mtem(3,jA,jE) = -34.5387 - b_mtem(4,jA,jE) = 56.5012 - b_mtem(5,jA,jE) = -51.8702 - b_mtem(6,jA,jE) = 19.6232 - - ! - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.53482 - b_mtem(2,jA,jE) = 12.3333 - b_mtem(3,jA,jE) = -46.1020 - b_mtem(4,jA,jE) = 90.4775 - b_mtem(5,jA,jE) = -88.1254 - b_mtem(6,jA,jE) = 33.4715 - - ! - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -3.23425 - b_mtem(2,jA,jE) = 18.7842 - b_mtem(3,jA,jE) = -78.7807 - b_mtem(4,jA,jE) = 161.517 - b_mtem(5,jA,jE) = -154.940 - b_mtem(6,jA,jE) = 56.2252 - - ! - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -1.25316 - b_mtem(2,jA,jE) = 7.40960 - b_mtem(3,jA,jE) = -34.8929 - b_mtem(4,jA,jE) = 72.8853 - b_mtem(5,jA,jE) = -72.4503 - b_mtem(6,jA,jE) = 27.7706 - - - !----------------- - ! NH4NO3 in E - jA = jnh4no3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.5201 - b_mtem(2,jA,jE) = 21.6584 - b_mtem(3,jA,jE) = -72.1499 - b_mtem(4,jA,jE) = 126.7000 - b_mtem(5,jA,jE) = -111.4550 - b_mtem(6,jA,jE) = 38.5677 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.2630 - b_mtem(2,jA,jE) = -0.1518 - b_mtem(3,jA,jE) = 17.0898 - b_mtem(4,jA,jE) = -36.7832 - b_mtem(5,jA,jE) = 29.8407 - b_mtem(6,jA,jE) = -7.9314 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.3851 - b_mtem(2,jA,jE) = -0.4462 - b_mtem(3,jA,jE) = 8.4567 - b_mtem(4,jA,jE) = -11.5988 - b_mtem(5,jA,jE) = 2.9802 - b_mtem(6,jA,jE) = 1.8132 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.7602 - b_mtem(2,jA,jE) = 10.4044 - b_mtem(3,jA,jE) = -35.5894 - b_mtem(4,jA,jE) = 64.3584 - b_mtem(5,jA,jE) = -57.8931 - b_mtem(6,jA,jE) = 20.2141 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -3.24346 - b_mtem(2,jA,jE) = 16.2794 - b_mtem(3,jA,jE) = -48.7601 - b_mtem(4,jA,jE) = 79.2246 - b_mtem(5,jA,jE) = -65.8169 - b_mtem(6,jA,jE) = 22.1500 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -1.75658 - b_mtem(2,jA,jE) = 7.71384 - b_mtem(3,jA,jE) = -22.7984 - b_mtem(4,jA,jE) = 39.1532 - b_mtem(5,jA,jE) = -34.6165 - b_mtem(6,jA,jE) = 12.1283 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = -0.97178 - b_mtem(2,jA,jE) = 6.61964 - b_mtem(3,jA,jE) = -26.2353 - b_mtem(4,jA,jE) = 50.5259 - b_mtem(5,jA,jE) = -47.6586 - b_mtem(6,jA,jE) = 17.5074 - - ! in CaCl2 added on 12/22/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = -0.41515 - b_mtem(2,jA,jE) = 6.44101 - b_mtem(3,jA,jE) = -26.4473 - b_mtem(4,jA,jE) = 49.0718 - b_mtem(5,jA,jE) = -44.2631 - b_mtem(6,jA,jE) = 15.3771 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -1.20644 - b_mtem(2,jA,jE) = 5.70117 - b_mtem(3,jA,jE) = -18.2783 - b_mtem(4,jA,jE) = 31.7199 - b_mtem(5,jA,jE) = -27.8703 - b_mtem(6,jA,jE) = 9.7299 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -0.680862 - b_mtem(2,jA,jE) = 3.59456 - b_mtem(3,jA,jE) = -10.7969 - b_mtem(4,jA,jE) = 17.8434 - b_mtem(5,jA,jE) = -15.3165 - b_mtem(6,jA,jE) = 5.17123 - - - !---------- - ! NH4Cl in E - jA = jnh4cl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.8850 - b_mtem(2,jA,jE) = 20.6970 - b_mtem(3,jA,jE) = -70.6810 - b_mtem(4,jA,jE) = 124.3690 - b_mtem(5,jA,jE) = -109.2880 - b_mtem(6,jA,jE) = 37.5831 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.9386 - b_mtem(2,jA,jE) = 1.3238 - b_mtem(3,jA,jE) = 11.8500 - b_mtem(4,jA,jE) = -28.1168 - b_mtem(5,jA,jE) = 21.8543 - b_mtem(6,jA,jE) = -5.1671 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.9559 - b_mtem(2,jA,jE) = 0.8121 - b_mtem(3,jA,jE) = 4.3644 - b_mtem(4,jA,jE) = -8.9258 - b_mtem(5,jA,jE) = 4.2362 - b_mtem(6,jA,jE) = 0.2891 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.0377 - b_mtem(2,jA,jE) = 6.0752 - b_mtem(3,jA,jE) = -30.8641 - b_mtem(4,jA,jE) = 63.3095 - b_mtem(5,jA,jE) = -61.0070 - b_mtem(6,jA,jE) = 22.1734 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.8336 - b_mtem(2,jA,jE) = 12.8160 - b_mtem(3,jA,jE) = -42.3388 - b_mtem(4,jA,jE) = 71.1816 - b_mtem(5,jA,jE) = -60.5708 - b_mtem(6,jA,jE) = 20.5853 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.1429 - b_mtem(2,jA,jE) = 2.3561 - b_mtem(3,jA,jE) = -10.4425 - b_mtem(4,jA,jE) = 20.8951 - b_mtem(5,jA,jE) = -20.7739 - b_mtem(6,jA,jE) = 7.9355 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.76235 - b_mtem(2,jA,jE) = 3.08323 - b_mtem(3,jA,jE) = -23.6772 - b_mtem(4,jA,jE) = 53.7415 - b_mtem(5,jA,jE) = -55.4043 - b_mtem(6,jA,jE) = 21.2944 - - ! in CaCl2 (revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.13864 - b_mtem(2,jA,jE) = -0.340539 - b_mtem(3,jA,jE) = -8.67025 - b_mtem(4,jA,jE) = 22.8008 - b_mtem(5,jA,jE) = -24.5181 - b_mtem(6,jA,jE) = 9.3663 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.42532 - b_mtem(2,jA,jE) = -14.1755 - b_mtem(3,jA,jE) = 38.804 - b_mtem(4,jA,jE) = -58.2437 - b_mtem(5,jA,jE) = 43.5431 - b_mtem(6,jA,jE) = -12.5824 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.330337 - b_mtem(2,jA,jE) = 0.0778934 - b_mtem(3,jA,jE) = -2.30492 - b_mtem(4,jA,jE) = 4.73003 - b_mtem(5,jA,jE) = -4.80849 - b_mtem(6,jA,jE) = 1.78866 - - - - !---------- - ! Na2SO4 in E - jA = jna2so4 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.6982 - b_mtem(2,jA,jE) = 22.9875 - b_mtem(3,jA,jE) = -98.9840 - b_mtem(4,jA,jE) = 198.0180 - b_mtem(5,jA,jE) = -188.7270 - b_mtem(6,jA,jE) = 69.0548 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.4844 - b_mtem(2,jA,jE) = 6.5420 - b_mtem(3,jA,jE) = -9.8998 - b_mtem(4,jA,jE) = 11.3884 - b_mtem(5,jA,jE) = -13.6842 - b_mtem(6,jA,jE) = 7.7411 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.3325 - b_mtem(2,jA,jE) = 13.0406 - b_mtem(3,jA,jE) = -56.1935 - b_mtem(4,jA,jE) = 107.1170 - b_mtem(5,jA,jE) = -97.3721 - b_mtem(6,jA,jE) = 34.3763 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.2832 - b_mtem(2,jA,jE) = 12.8526 - b_mtem(3,jA,jE) = -62.2087 - b_mtem(4,jA,jE) = 130.3876 - b_mtem(5,jA,jE) = -128.2627 - b_mtem(6,jA,jE) = 48.0340 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -3.5384 - b_mtem(2,jA,jE) = 21.3758 - b_mtem(3,jA,jE) = -70.7638 - b_mtem(4,jA,jE) = 121.1580 - b_mtem(5,jA,jE) = -104.6230 - b_mtem(6,jA,jE) = 36.0557 - - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 0.2175 - b_mtem(2,jA,jE) = -0.5648 - b_mtem(3,jA,jE) = -8.0288 - b_mtem(4,jA,jE) = 25.9734 - b_mtem(5,jA,jE) = -32.3577 - b_mtem(6,jA,jE) = 14.3924 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -0.309617 - b_mtem(2,jA,jE) = -1.82899 - b_mtem(3,jA,jE) = -1.5505 - b_mtem(4,jA,jE) = 13.3847 - b_mtem(5,jA,jE) = -20.1284 - b_mtem(6,jA,jE) = 9.93163 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -0.259455 - b_mtem(2,jA,jE) = -0.819366 - b_mtem(3,jA,jE) = -4.28964 - b_mtem(4,jA,jE) = 16.4305 - b_mtem(5,jA,jE) = -21.8546 - b_mtem(6,jA,jE) = 10.3044 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -1.84257 - b_mtem(2,jA,jE) = 7.85788 - b_mtem(3,jA,jE) = -29.9275 - b_mtem(4,jA,jE) = 61.7515 - b_mtem(5,jA,jE) = -63.2308 - b_mtem(6,jA,jE) = 24.9542 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -1.05891 - b_mtem(2,jA,jE) = 2.84831 - b_mtem(3,jA,jE) = -21.1827 - b_mtem(4,jA,jE) = 57.5175 - b_mtem(5,jA,jE) = -64.8120 - b_mtem(6,jA,jE) = 26.1986 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.16584 - b_mtem(2,jA,jE) = 8.50075 - b_mtem(3,jA,jE) = -44.3420 - b_mtem(4,jA,jE) = 97.3974 - b_mtem(5,jA,jE) = -98.4549 - b_mtem(6,jA,jE) = 37.6104 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -1.95805 - b_mtem(2,jA,jE) = 6.62417 - b_mtem(3,jA,jE) = -31.8072 - b_mtem(4,jA,jE) = 77.8603 - b_mtem(5,jA,jE) = -84.6458 - b_mtem(6,jA,jE) = 33.4963 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.36045 - b_mtem(2,jA,jE) = 3.55223 - b_mtem(3,jA,jE) = -24.0327 - b_mtem(4,jA,jE) = 54.4879 - b_mtem(5,jA,jE) = -56.6531 - b_mtem(6,jA,jE) = 22.4956 - - - !---------- - ! NaNO3 in E - jA = jnano3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.5888 - b_mtem(2,jA,jE) = 17.6192 - b_mtem(3,jA,jE) = -63.2183 - b_mtem(4,jA,jE) = 115.3520 - b_mtem(5,jA,jE) = -104.0860 - b_mtem(6,jA,jE) = 36.7390 - - ! in NH4NO3 - jE = jnh4no3 - - b_mtem(1,jA,jE) = -2.0669 - b_mtem(2,jA,jE) = 1.4792 - b_mtem(3,jA,jE) = 10.5261 - b_mtem(4,jA,jE) = -27.0987 - b_mtem(5,jA,jE) = 23.0591 - b_mtem(6,jA,jE) = -6.0938 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.8325 - b_mtem(2,jA,jE) = 3.9933 - b_mtem(3,jA,jE) = -15.3789 - b_mtem(4,jA,jE) = 30.4050 - b_mtem(5,jA,jE) = -29.4204 - b_mtem(6,jA,jE) = 11.0597 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.1233 - b_mtem(2,jA,jE) = 8.3998 - b_mtem(3,jA,jE) = -31.9002 - b_mtem(4,jA,jE) = 60.1450 - b_mtem(5,jA,jE) = -55.5503 - b_mtem(6,jA,jE) = 19.7757 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -2.5386 - b_mtem(2,jA,jE) = 13.9039 - b_mtem(3,jA,jE) = -42.8467 - b_mtem(4,jA,jE) = 69.7442 - b_mtem(5,jA,jE) = -57.8988 - b_mtem(6,jA,jE) = 19.4635 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.4351 - b_mtem(2,jA,jE) = 2.8311 - b_mtem(3,jA,jE) = -11.4485 - b_mtem(4,jA,jE) = 22.7201 - b_mtem(5,jA,jE) = -22.4228 - b_mtem(6,jA,jE) = 8.5792 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = -0.72060 - b_mtem(2,jA,jE) = 5.64915 - b_mtem(3,jA,jE) = -23.5020 - b_mtem(4,jA,jE) = 46.0078 - b_mtem(5,jA,jE) = -43.8075 - b_mtem(6,jA,jE) = 16.1652 - - ! in CaCl2 - jE = jcacl2 - - b_mtem(1,jA,jE) = 0.003928 - b_mtem(2,jA,jE) = 3.54724 - b_mtem(3,jA,jE) = -18.6057 - b_mtem(4,jA,jE) = 38.1445 - b_mtem(5,jA,jE) = -36.7745 - b_mtem(6,jA,jE) = 13.4529 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = -1.1712 - b_mtem(2,jA,jE) = 7.20907 - b_mtem(3,jA,jE) = -22.9215 - b_mtem(4,jA,jE) = 38.1257 - b_mtem(5,jA,jE) = -32.0759 - b_mtem(6,jA,jE) = 10.6443 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.738022 - b_mtem(2,jA,jE) = -1.14313 - b_mtem(3,jA,jE) = 0.32251 - b_mtem(4,jA,jE) = 0.838679 - b_mtem(5,jA,jE) = -1.81747 - b_mtem(6,jA,jE) = 0.873986 - - - !---------- - ! NaCl in E - jA = jnacl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.9525 - b_mtem(2,jA,jE) = 16.6433 - b_mtem(3,jA,jE) = -61.7090 - b_mtem(4,jA,jE) = 112.9910 - b_mtem(5,jA,jE) = -101.9370 - b_mtem(6,jA,jE) = 35.7760 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.7525 - b_mtem(2,jA,jE) = 3.0713 - b_mtem(3,jA,jE) = 4.8063 - b_mtem(4,jA,jE) = -17.5334 - b_mtem(5,jA,jE) = 14.2872 - b_mtem(6,jA,jE) = -3.0690 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.4021 - b_mtem(2,jA,jE) = 5.2399 - b_mtem(3,jA,jE) = -19.4278 - b_mtem(4,jA,jE) = 33.0027 - b_mtem(5,jA,jE) = -28.1020 - b_mtem(6,jA,jE) = 9.5159 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.6692 - b_mtem(2,jA,jE) = 4.1207 - b_mtem(3,jA,jE) = -27.3314 - b_mtem(4,jA,jE) = 59.3112 - b_mtem(5,jA,jE) = -58.7998 - b_mtem(6,jA,jE) = 21.7674 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.17444 - b_mtem(2,jA,jE) = 10.9927 - b_mtem(3,jA,jE) = -38.9013 - b_mtem(4,jA,jE) = 66.8521 - b_mtem(5,jA,jE) = -57.6564 - b_mtem(6,jA,jE) = 19.7296 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 1.17679 - b_mtem(2,jA,jE) = -2.5061 - b_mtem(3,jA,jE) = 0.8508 - b_mtem(4,jA,jE) = 4.4802 - b_mtem(5,jA,jE) = -8.4945 - b_mtem(6,jA,jE) = 4.3182 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 1.01450 - b_mtem(2,jA,jE) = 2.10260 - b_mtem(3,jA,jE) = -20.9036 - b_mtem(4,jA,jE) = 49.1481 - b_mtem(5,jA,jE) = -51.4867 - b_mtem(6,jA,jE) = 19.9301 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.55463 - b_mtem(2,jA,jE) = -3.20122 - b_mtem(3,jA,jE) = -0.957075 - b_mtem(4,jA,jE) = 12.103 - b_mtem(5,jA,jE) = -17.221 - b_mtem(6,jA,jE) = 7.50264 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.46187 - b_mtem(2,jA,jE) = -12.6845 - b_mtem(3,jA,jE) = 34.2383 - b_mtem(4,jA,jE) = -51.9992 - b_mtem(5,jA,jE) = 39.4934 - b_mtem(6,jA,jE) = -11.7247 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.74915 - b_mtem(2,jA,jE) = -4.65768 - b_mtem(3,jA,jE) = 8.80287 - b_mtem(4,jA,jE) = -12.2503 - b_mtem(5,jA,jE) = 8.668751 - b_mtem(6,jA,jE) = -2.50158 - - - !---------- - ! Ca(NO3)2 in E - jA = jcano3 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.86260 - b_mtem(2,jA,jE) = 11.6178 - b_mtem(3,jA,jE) = -30.9069 - b_mtem(4,jA,jE) = 41.7578 - b_mtem(5,jA,jE) = -33.7338 - b_mtem(6,jA,jE) = 12.7541 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -1.1798 - b_mtem(2,jA,jE) = 25.9608 - b_mtem(3,jA,jE) = -98.9373 - b_mtem(4,jA,jE) = 160.2300 - b_mtem(5,jA,jE) = -125.9540 - b_mtem(6,jA,jE) = 39.5130 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -1.44384 - b_mtem(2,jA,jE) = 13.6044 - b_mtem(3,jA,jE) = -54.4300 - b_mtem(4,jA,jE) = 100.582 - b_mtem(5,jA,jE) = -91.2364 - b_mtem(6,jA,jE) = 32.5970 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = -0.099114 - b_mtem(2,jA,jE) = 2.84091 - b_mtem(3,jA,jE) = -16.9229 - b_mtem(4,jA,jE) = 37.4839 - b_mtem(5,jA,jE) = -39.5132 - b_mtem(6,jA,jE) = 15.8564 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.055116 - b_mtem(2,jA,jE) = 4.58610 - b_mtem(3,jA,jE) = -27.6629 - b_mtem(4,jA,jE) = 60.8288 - b_mtem(5,jA,jE) = -61.4988 - b_mtem(6,jA,jE) = 23.3136 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 1.57155 - b_mtem(2,jA,jE) = -3.18486 - b_mtem(3,jA,jE) = -3.35758 - b_mtem(4,jA,jE) = 18.7501 - b_mtem(5,jA,jE) = -24.5604 - b_mtem(6,jA,jE) = 10.3798 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 1.04446 - b_mtem(2,jA,jE) = -3.19066 - b_mtem(3,jA,jE) = 2.44714 - b_mtem(4,jA,jE) = 2.07218 - b_mtem(5,jA,jE) = -6.43949 - b_mtem(6,jA,jE) = 3.66471 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.05723 - b_mtem(2,jA,jE) = -1.46826 - b_mtem(3,jA,jE) = -1.0713 - b_mtem(4,jA,jE) = 4.64439 - b_mtem(5,jA,jE) = -6.32402 - b_mtem(6,jA,jE) = 2.78202 - - - !---------- - ! CaCl2 in E - jA = jcacl2 - - ! in NH4NO3 (PSC92: revised on 12/22/2003) - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.43626 - b_mtem(2,jA,jE) = 13.6598 - b_mtem(3,jA,jE) = -38.2068 - b_mtem(4,jA,jE) = 53.9057 - b_mtem(5,jA,jE) = -44.9018 - b_mtem(6,jA,jE) = 16.6120 - - ! in NH4Cl (PSC92: revised on 11/27/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.603965 - b_mtem(2,jA,jE) = 27.6027 - b_mtem(3,jA,jE) = -104.258 - b_mtem(4,jA,jE) = 163.553 - b_mtem(5,jA,jE) = -124.076 - b_mtem(6,jA,jE) = 37.4153 - - ! in NaNO3 (PSC92: revised on 12/22/2003) - jE = jnano3 - b_mtem(1,jA,jE) = 0.44648 - b_mtem(2,jA,jE) = 8.8850 - b_mtem(3,jA,jE) = -45.5232 - b_mtem(4,jA,jE) = 89.3263 - b_mtem(5,jA,jE) = -83.8604 - b_mtem(6,jA,jE) = 30.4069 - - ! in NaCl (PSC92: revised on 11/27/2003) - jE = jnacl - b_mtem(1,jA,jE) = 1.61927 - b_mtem(2,jA,jE) = 0.247547 - b_mtem(3,jA,jE) = -18.1252 - b_mtem(4,jA,jE) = 45.2479 - b_mtem(5,jA,jE) = -48.6072 - b_mtem(6,jA,jE) = 19.2784 - - ! in Ca(NO3)2 (PSC92: revised on 11/27/2003) - jE = jcano3 - b_mtem(1,jA,jE) = 2.36667 - b_mtem(2,jA,jE) = -0.123309 - b_mtem(3,jA,jE) = -24.2723 - b_mtem(4,jA,jE) = 65.1486 - b_mtem(5,jA,jE) = -71.8504 - b_mtem(6,jA,jE) = 28.3696 - - ! in CaCl2 (PSC92: revised on 11/27/2003) - jE = jcacl2 - b_mtem(1,jA,jE) = 3.64023 - b_mtem(2,jA,jE) = -12.1926 - b_mtem(3,jA,jE) = 20.2028 - b_mtem(4,jA,jE) = -16.0056 - b_mtem(5,jA,jE) = 1.52355 - b_mtem(6,jA,jE) = 2.44709 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 5.88794 - b_mtem(2,jA,jE) = -29.7083 - b_mtem(3,jA,jE) = 78.6309 - b_mtem(4,jA,jE) = -118.037 - b_mtem(5,jA,jE) = 88.932 - b_mtem(6,jA,jE) = -26.1407 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 2.40628 - b_mtem(2,jA,jE) = -6.16566 - b_mtem(3,jA,jE) = 10.2851 - b_mtem(4,jA,jE) = -12.9035 - b_mtem(5,jA,jE) = 7.7441 - b_mtem(6,jA,jE) = -1.74821 - - - !---------- - ! HNO3 in E - jA = jhno3 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.57598 - b_mtem(2,jA,jE) = 21.5469 - b_mtem(3,jA,jE) = -77.4111 - b_mtem(4,jA,jE) = 144.136 - b_mtem(5,jA,jE) = -132.849 - b_mtem(6,jA,jE) = 47.9412 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -2.00209 - b_mtem(2,jA,jE) = -3.48399 - b_mtem(3,jA,jE) = 34.9906 - b_mtem(4,jA,jE) = -68.6653 - b_mtem(5,jA,jE) = 54.0992 - b_mtem(6,jA,jE) = -15.1343 - - ! in NH4Cl revised on 12/22/2003 - jE = jnh4cl - b_mtem(1,jA,jE) = -0.63790 - b_mtem(2,jA,jE) = -1.67730 - b_mtem(3,jA,jE) = 10.1727 - b_mtem(4,jA,jE) = -14.9097 - b_mtem(5,jA,jE) = 7.67410 - b_mtem(6,jA,jE) = -0.79586 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 1.3446 - b_mtem(2,jA,jE) = -2.5578 - b_mtem(3,jA,jE) = 1.3464 - b_mtem(4,jA,jE) = 2.90537 - b_mtem(5,jA,jE) = -6.53014 - b_mtem(6,jA,jE) = 3.31339 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = -0.546636 - b_mtem(2,jA,jE) = 10.3127 - b_mtem(3,jA,jE) = -39.9603 - b_mtem(4,jA,jE) = 71.4609 - b_mtem(5,jA,jE) = -63.4958 - b_mtem(6,jA,jE) = 22.0679 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 1.35059 - b_mtem(2,jA,jE) = 4.34557 - b_mtem(3,jA,jE) = -35.8425 - b_mtem(4,jA,jE) = 80.9868 - b_mtem(5,jA,jE) = -81.6544 - b_mtem(6,jA,jE) = 30.4841 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 0.869414 - b_mtem(2,jA,jE) = 2.98486 - b_mtem(3,jA,jE) = -22.255 - b_mtem(4,jA,jE) = 50.1863 - b_mtem(5,jA,jE) = -51.214 - b_mtem(6,jA,jE) = 19.2235 - - ! in CaCl2 (KM) revised on 12/22/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = 1.42800 - b_mtem(2,jA,jE) = -1.78959 - b_mtem(3,jA,jE) = -2.49075 - b_mtem(4,jA,jE) = 10.1877 - b_mtem(5,jA,jE) = -12.1948 - b_mtem(6,jA,jE) = 4.64475 - - ! in HNO3 (added on 12/06/2004) - jE = jhno3 - b_mtem(1,jA,jE) = 0.22035 - b_mtem(2,jA,jE) = 2.94973 - b_mtem(3,jA,jE) = -12.1469 - b_mtem(4,jA,jE) = 20.4905 - b_mtem(5,jA,jE) = -17.3966 - b_mtem(6,jA,jE) = 5.70779 - - ! in HCl (added on 12/06/2004) - jE = jhcl - b_mtem(1,jA,jE) = 1.55503 - b_mtem(2,jA,jE) = -3.61226 - b_mtem(3,jA,jE) = 6.28265 - b_mtem(4,jA,jE) = -8.69575 - b_mtem(5,jA,jE) = 6.09372 - b_mtem(6,jA,jE) = -1.80898 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 1.10783 - b_mtem(2,jA,jE) = -1.3363 - b_mtem(3,jA,jE) = -1.83525 - b_mtem(4,jA,jE) = 7.47373 - b_mtem(5,jA,jE) = -9.72954 - b_mtem(6,jA,jE) = 4.12248 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.851026 - b_mtem(2,jA,jE) = 12.2515 - b_mtem(3,jA,jE) = -49.788 - b_mtem(4,jA,jE) = 91.6215 - b_mtem(5,jA,jE) = -81.4877 - b_mtem(6,jA,jE) = 28.0002 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -3.09464 - b_mtem(2,jA,jE) = 14.9303 - b_mtem(3,jA,jE) = -43.0454 - b_mtem(4,jA,jE) = 72.6695 - b_mtem(5,jA,jE) = -65.2140 - b_mtem(6,jA,jE) = 23.4814 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 1.22973 - b_mtem(2,jA,jE) = 2.82702 - b_mtem(3,jA,jE) = -17.5869 - b_mtem(4,jA,jE) = 28.9564 - b_mtem(5,jA,jE) = -23.5814 - b_mtem(6,jA,jE) = 7.91153 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 1.64773 - b_mtem(2,jA,jE) = 0.94188 - b_mtem(3,jA,jE) = -19.1242 - b_mtem(4,jA,jE) = 46.9887 - b_mtem(5,jA,jE) = -50.9494 - b_mtem(6,jA,jE) = 20.2169 - - - !---------- - ! HCl in E - jA = jhcl - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.93783 - b_mtem(2,jA,jE) = 20.5546 - b_mtem(3,jA,jE) = -75.8548 - b_mtem(4,jA,jE) = 141.729 - b_mtem(5,jA,jE) = -130.697 - b_mtem(6,jA,jE) = 46.9905 - - ! in NH4NO3 - jE = jnh4no3 - b_mtem(1,jA,jE) = -1.69063 - b_mtem(2,jA,jE) = -1.85303 - b_mtem(3,jA,jE) = 29.0927 - b_mtem(4,jA,jE) = -58.7401 - b_mtem(5,jA,jE) = 44.999 - b_mtem(6,jA,jE) = -11.9988 - - ! in NH4Cl (revised on 11/15/2003) - jE = jnh4cl - b_mtem(1,jA,jE) = -0.2073 - b_mtem(2,jA,jE) = -0.4322 - b_mtem(3,jA,jE) = 6.1271 - b_mtem(4,jA,jE) = -12.3146 - b_mtem(5,jA,jE) = 8.9919 - b_mtem(6,jA,jE) = -2.3388 - - ! in NaCl - jE = jnacl - b_mtem(1,jA,jE) = 2.95913 - b_mtem(2,jA,jE) = -7.92254 - b_mtem(3,jA,jE) = 13.736 - b_mtem(4,jA,jE) = -15.433 - b_mtem(5,jA,jE) = 7.40386 - b_mtem(6,jA,jE) = -0.918641 - - ! in NaNO3 - jE = jnano3 - b_mtem(1,jA,jE) = 0.893272 - b_mtem(2,jA,jE) = 6.53768 - b_mtem(3,jA,jE) = -32.3458 - b_mtem(4,jA,jE) = 61.2834 - b_mtem(5,jA,jE) = -56.4446 - b_mtem(6,jA,jE) = 19.9202 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 3.14484 - b_mtem(2,jA,jE) = 0.077019 - b_mtem(3,jA,jE) = -31.4199 - b_mtem(4,jA,jE) = 80.5865 - b_mtem(5,jA,jE) = -85.392 - b_mtem(6,jA,jE) = 32.6644 - - ! in Ca(NO3)2 - jE = jcano3 - b_mtem(1,jA,jE) = 2.60432 - b_mtem(2,jA,jE) = -0.55909 - b_mtem(3,jA,jE) = -19.6671 - b_mtem(4,jA,jE) = 53.3446 - b_mtem(5,jA,jE) = -58.9076 - b_mtem(6,jA,jE) = 22.9927 - - ! in CaCl2 (KM) revised on 3/13/2003 and again on 11/27/2003 - jE = jcacl2 - b_mtem(1,jA,jE) = 2.98036 - b_mtem(2,jA,jE) = -8.55365 - b_mtem(3,jA,jE) = 15.2108 - b_mtem(4,jA,jE) = -15.9359 - b_mtem(5,jA,jE) = 7.41772 - b_mtem(6,jA,jE) = -1.32143 - - ! in HNO3 (added on 12/06/2004) - jE = jhno3 - b_mtem(1,jA,jE) = 3.8533 - b_mtem(2,jA,jE) = -16.9427 - b_mtem(3,jA,jE) = 45.0056 - b_mtem(4,jA,jE) = -69.6145 - b_mtem(5,jA,jE) = 54.1491 - b_mtem(6,jA,jE) = -16.6513 - - ! in HCl (added on 12/06/2004) - jE = jhcl - b_mtem(1,jA,jE) = 2.56665 - b_mtem(2,jA,jE) = -7.13585 - b_mtem(3,jA,jE) = 14.8103 - b_mtem(4,jA,jE) = -21.8881 - b_mtem(5,jA,jE) = 16.6808 - b_mtem(6,jA,jE) = -5.22091 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 2.50179 - b_mtem(2,jA,jE) = -6.69364 - b_mtem(3,jA,jE) = 11.6551 - b_mtem(4,jA,jE) = -13.6897 - b_mtem(5,jA,jE) = 7.36796 - b_mtem(6,jA,jE) = -1.33245 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = 0.149955 - b_mtem(2,jA,jE) = 11.8213 - b_mtem(3,jA,jE) = -53.9164 - b_mtem(4,jA,jE) = 101.574 - b_mtem(5,jA,jE) = -91.4123 - b_mtem(6,jA,jE) = 31.5487 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.36927 - b_mtem(2,jA,jE) = 14.8359 - b_mtem(3,jA,jE) = -44.3443 - b_mtem(4,jA,jE) = 73.6229 - b_mtem(5,jA,jE) = -65.3366 - b_mtem(6,jA,jE) = 23.3250 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 2.72993 - b_mtem(2,jA,jE) = -0.23406 - b_mtem(3,jA,jE) = -10.4103 - b_mtem(4,jA,jE) = 13.1586 - b_mtem(5,jA,jE) = -7.79925 - b_mtem(6,jA,jE) = 2.30843 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 3.51258 - b_mtem(2,jA,jE) = -3.95107 - b_mtem(3,jA,jE) = -11.0175 - b_mtem(4,jA,jE) = 38.8617 - b_mtem(5,jA,jE) = -48.1575 - b_mtem(6,jA,jE) = 20.4717 - - - !---------- - ! 2H.SO4 in E - jA = jh2so4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.76734 - b_mtem(2,jA,jE) = -1.12263 - b_mtem(3,jA,jE) = -9.08728 - b_mtem(4,jA,jE) = 30.3836 - b_mtem(5,jA,jE) = -38.4133 - b_mtem(6,jA,jE) = 17.0106 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -2.03879 - b_mtem(2,jA,jE) = 15.7033 - b_mtem(3,jA,jE) = -58.7363 - b_mtem(4,jA,jE) = 109.242 - b_mtem(5,jA,jE) = -102.237 - b_mtem(6,jA,jE) = 37.5350 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -3.10228 - b_mtem(2,jA,jE) = 16.6920 - b_mtem(3,jA,jE) = -59.1522 - b_mtem(4,jA,jE) = 113.487 - b_mtem(5,jA,jE) = -110.890 - b_mtem(6,jA,jE) = 42.4578 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -3.43885 - b_mtem(2,jA,jE) = 21.0372 - b_mtem(3,jA,jE) = -84.7026 - b_mtem(4,jA,jE) = 165.324 - b_mtem(5,jA,jE) = -156.101 - b_mtem(6,jA,jE) = 57.3101 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 0.33164 - b_mtem(2,jA,jE) = 6.55864 - b_mtem(3,jA,jE) = -33.5876 - b_mtem(4,jA,jE) = 65.1798 - b_mtem(5,jA,jE) = -63.2046 - b_mtem(6,jA,jE) = 24.1783 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 3.06830 - b_mtem(2,jA,jE) = -3.18408 - b_mtem(3,jA,jE) = -19.6332 - b_mtem(4,jA,jE) = 61.3657 - b_mtem(5,jA,jE) = -73.4438 - b_mtem(6,jA,jE) = 31.2334 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 2.58649 - b_mtem(2,jA,jE) = 0.87921 - b_mtem(3,jA,jE) = -39.3023 - b_mtem(4,jA,jE) = 101.603 - b_mtem(5,jA,jE) = -109.469 - b_mtem(6,jA,jE) = 43.0188 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 1.54587 - b_mtem(2,jA,jE) = -7.50976 - b_mtem(3,jA,jE) = 12.8237 - b_mtem(4,jA,jE) = -10.1452 - b_mtem(5,jA,jE) = -0.541956 - b_mtem(6,jA,jE) = 3.34536 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.829757 - b_mtem(2,jA,jE) = -4.11316 - b_mtem(3,jA,jE) = 3.67111 - b_mtem(4,jA,jE) = 3.6833 - b_mtem(5,jA,jE) = -11.2711 - b_mtem(6,jA,jE) = 6.71421 - - - !---------- - ! H.HSO4 in E - jA = jhhso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 2.63953 - b_mtem(2,jA,jE) = -6.01532 - b_mtem(3,jA,jE) = 10.0204 - b_mtem(4,jA,jE) = -12.4840 - b_mtem(5,jA,jE) = 7.78853 - b_mtem(6,jA,jE) = -2.12638 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.77412 - b_mtem(2,jA,jE) = 14.1656 - b_mtem(3,jA,jE) = -53.4087 - b_mtem(4,jA,jE) = 93.2013 - b_mtem(5,jA,jE) = -80.5723 - b_mtem(6,jA,jE) = 27.1577 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.98882 - b_mtem(2,jA,jE) = 14.4436 - b_mtem(3,jA,jE) = -40.1774 - b_mtem(4,jA,jE) = 67.5937 - b_mtem(5,jA,jE) = -61.5040 - b_mtem(6,jA,jE) = 22.3695 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.15502 - b_mtem(2,jA,jE) = 8.12309 - b_mtem(3,jA,jE) = -38.4726 - b_mtem(4,jA,jE) = 80.8861 - b_mtem(5,jA,jE) = -80.1644 - b_mtem(6,jA,jE) = 30.4717 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = 1.99641 - b_mtem(2,jA,jE) = -2.96061 - b_mtem(3,jA,jE) = 5.54778 - b_mtem(4,jA,jE) = -14.5488 - b_mtem(5,jA,jE) = 14.8492 - b_mtem(6,jA,jE) = -5.1389 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = 2.23816 - b_mtem(2,jA,jE) = -3.20847 - b_mtem(3,jA,jE) = -4.82853 - b_mtem(4,jA,jE) = 20.9192 - b_mtem(5,jA,jE) = -27.2819 - b_mtem(6,jA,jE) = 11.8655 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 2.56907 - b_mtem(2,jA,jE) = 1.13444 - b_mtem(3,jA,jE) = -34.6853 - b_mtem(4,jA,jE) = 87.9775 - b_mtem(5,jA,jE) = -93.2330 - b_mtem(6,jA,jE) = 35.9260 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 2.00024 - b_mtem(2,jA,jE) = -4.80868 - b_mtem(3,jA,jE) = 8.29222 - b_mtem(4,jA,jE) = -11.0849 - b_mtem(5,jA,jE) = 7.51262 - b_mtem(6,jA,jE) = -2.07654 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 2.8009 - b_mtem(2,jA,jE) = -6.98416 - b_mtem(3,jA,jE) = 14.3146 - b_mtem(4,jA,jE) = -22.0068 - b_mtem(5,jA,jE) = 17.5557 - b_mtem(6,jA,jE) = -5.84917 - - - !---------- - ! NH4HSO4 in E - jA = jnh4hso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.169160 - b_mtem(2,jA,jE) = 2.15094 - b_mtem(3,jA,jE) = -9.62904 - b_mtem(4,jA,jE) = 18.2631 - b_mtem(5,jA,jE) = -17.3333 - b_mtem(6,jA,jE) = 6.19835 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -2.34457 - b_mtem(2,jA,jE) = 12.8035 - b_mtem(3,jA,jE) = -35.2513 - b_mtem(4,jA,jE) = 53.6153 - b_mtem(5,jA,jE) = -42.7655 - b_mtem(6,jA,jE) = 13.7129 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.56109 - b_mtem(2,jA,jE) = 11.1414 - b_mtem(3,jA,jE) = -30.2361 - b_mtem(4,jA,jE) = 50.0320 - b_mtem(5,jA,jE) = -44.1586 - b_mtem(6,jA,jE) = 15.5393 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -0.97315 - b_mtem(2,jA,jE) = 7.06295 - b_mtem(3,jA,jE) = -29.3032 - b_mtem(4,jA,jE) = 57.6101 - b_mtem(5,jA,jE) = -54.9020 - b_mtem(6,jA,jE) = 20.2222 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -0.44450 - b_mtem(2,jA,jE) = 3.33451 - b_mtem(3,jA,jE) = -15.2791 - b_mtem(4,jA,jE) = 30.1413 - b_mtem(5,jA,jE) = -26.7710 - b_mtem(6,jA,jE) = 8.78462 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.99780 - b_mtem(2,jA,jE) = 4.69200 - b_mtem(3,jA,jE) = -16.1219 - b_mtem(4,jA,jE) = 29.3100 - b_mtem(5,jA,jE) = -26.3383 - b_mtem(6,jA,jE) = 9.20695 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -0.52694 - b_mtem(2,jA,jE) = 7.02684 - b_mtem(3,jA,jE) = -33.7508 - b_mtem(4,jA,jE) = 70.0565 - b_mtem(5,jA,jE) = -68.3226 - b_mtem(6,jA,jE) = 25.2692 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.572926 - b_mtem(2,jA,jE) = -2.04791 - b_mtem(3,jA,jE) = 2.1134 - b_mtem(4,jA,jE) = 0.246654 - b_mtem(5,jA,jE) = -3.06019 - b_mtem(6,jA,jE) = 1.98126 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.56514 - b_mtem(2,jA,jE) = 0.22287 - b_mtem(3,jA,jE) = -2.76973 - b_mtem(4,jA,jE) = 4.54444 - b_mtem(5,jA,jE) = -3.86549 - b_mtem(6,jA,jE) = 1.13441 - - - !---------- - ! (NH4)3H(SO4)2 in E - jA = jlvcite - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -1.44811 - b_mtem(2,jA,jE) = 6.71815 - b_mtem(3,jA,jE) = -25.0141 - b_mtem(4,jA,jE) = 50.1109 - b_mtem(5,jA,jE) = -50.0561 - b_mtem(6,jA,jE) = 19.3370 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -3.41707 - b_mtem(2,jA,jE) = 13.4496 - b_mtem(3,jA,jE) = -34.8018 - b_mtem(4,jA,jE) = 55.2987 - b_mtem(5,jA,jE) = -48.1839 - b_mtem(6,jA,jE) = 17.2444 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -2.54479 - b_mtem(2,jA,jE) = 11.8501 - b_mtem(3,jA,jE) = -39.7286 - b_mtem(4,jA,jE) = 74.2479 - b_mtem(5,jA,jE) = -70.4934 - b_mtem(6,jA,jE) = 26.2836 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -2.30561 - b_mtem(2,jA,jE) = 14.5806 - b_mtem(3,jA,jE) = -55.1238 - b_mtem(4,jA,jE) = 103.451 - b_mtem(5,jA,jE) = -95.2571 - b_mtem(6,jA,jE) = 34.2218 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -2.20809 - b_mtem(2,jA,jE) = 13.6391 - b_mtem(3,jA,jE) = -57.8246 - b_mtem(4,jA,jE) = 117.907 - b_mtem(5,jA,jE) = -112.154 - b_mtem(6,jA,jE) = 40.3058 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -1.15099 - b_mtem(2,jA,jE) = 6.32269 - b_mtem(3,jA,jE) = -27.3860 - b_mtem(4,jA,jE) = 55.4592 - b_mtem(5,jA,jE) = -54.0100 - b_mtem(6,jA,jE) = 20.3469 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -1.15678 - b_mtem(2,jA,jE) = 8.28718 - b_mtem(3,jA,jE) = -37.3231 - b_mtem(4,jA,jE) = 76.6124 - b_mtem(5,jA,jE) = -74.9307 - b_mtem(6,jA,jE) = 28.0559 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.01502 - b_mtem(2,jA,jE) = -3.1197 - b_mtem(3,jA,jE) = 3.61104 - b_mtem(4,jA,jE) = 3.05196 - b_mtem(5,jA,jE) = -9.98957 - b_mtem(6,jA,jE) = 6.04155 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = -1.06477 - b_mtem(2,jA,jE) = 3.38801 - b_mtem(3,jA,jE) = -12.5784 - b_mtem(4,jA,jE) = 25.2823 - b_mtem(5,jA,jE) = -25.4611 - b_mtem(6,jA,jE) = 10.0754 - - - !---------- - ! NaHSO4 in E - jA = jnahso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = 0.68259 - b_mtem(2,jA,jE) = 0.71468 - b_mtem(3,jA,jE) = -5.59003 - b_mtem(4,jA,jE) = 11.0089 - b_mtem(5,jA,jE) = -10.7983 - b_mtem(6,jA,jE) = 3.82335 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.03956 - b_mtem(2,jA,jE) = 4.52828 - b_mtem(3,jA,jE) = -25.2557 - b_mtem(4,jA,jE) = 54.4225 - b_mtem(5,jA,jE) = -52.5105 - b_mtem(6,jA,jE) = 18.6562 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.53503 - b_mtem(2,jA,jE) = 8.27608 - b_mtem(3,jA,jE) = -28.9539 - b_mtem(4,jA,jE) = 55.2876 - b_mtem(5,jA,jE) = -51.9563 - b_mtem(6,jA,jE) = 18.6576 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -0.38793 - b_mtem(2,jA,jE) = 7.14680 - b_mtem(3,jA,jE) = -38.7201 - b_mtem(4,jA,jE) = 84.3965 - b_mtem(5,jA,jE) = -84.7453 - b_mtem(6,jA,jE) = 32.1283 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -0.41982 - b_mtem(2,jA,jE) = 4.26491 - b_mtem(3,jA,jE) = -20.2351 - b_mtem(4,jA,jE) = 42.6764 - b_mtem(5,jA,jE) = -40.7503 - b_mtem(6,jA,jE) = 14.2868 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.32912 - b_mtem(2,jA,jE) = 1.80808 - b_mtem(3,jA,jE) = -8.01286 - b_mtem(4,jA,jE) = 15.5791 - b_mtem(5,jA,jE) = -14.5494 - b_mtem(6,jA,jE) = 5.27052 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = 0.10271 - b_mtem(2,jA,jE) = 5.09559 - b_mtem(3,jA,jE) = -30.3295 - b_mtem(4,jA,jE) = 66.2975 - b_mtem(5,jA,jE) = -66.3458 - b_mtem(6,jA,jE) = 24.9443 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.608309 - b_mtem(2,jA,jE) = -0.541905 - b_mtem(3,jA,jE) = -2.52084 - b_mtem(4,jA,jE) = 6.63297 - b_mtem(5,jA,jE) = -7.24599 - b_mtem(6,jA,jE) = 2.88811 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 1.98399 - b_mtem(2,jA,jE) = -4.51562 - b_mtem(3,jA,jE) = 8.36059 - b_mtem(4,jA,jE) = -12.4948 - b_mtem(5,jA,jE) = 9.67514 - b_mtem(6,jA,jE) = -3.18004 - - - !---------- - ! Na3H(SO4)2 in E - jA = jna3hso4 - - ! in H2SO4 - jE = jh2so4 - b_mtem(1,jA,jE) = -0.83214 - b_mtem(2,jA,jE) = 4.99572 - b_mtem(3,jA,jE) = -20.1697 - b_mtem(4,jA,jE) = 41.4066 - b_mtem(5,jA,jE) = -42.2119 - b_mtem(6,jA,jE) = 16.4855 - - ! in NH4HSO4 - jE = jnh4hso4 - b_mtem(1,jA,jE) = -0.65139 - b_mtem(2,jA,jE) = 3.52300 - b_mtem(3,jA,jE) = -22.8220 - b_mtem(4,jA,jE) = 56.2956 - b_mtem(5,jA,jE) = -59.9028 - b_mtem(6,jA,jE) = 23.1844 - - ! in (NH4)3H(SO4)2 - jE = jlvcite - b_mtem(1,jA,jE) = -1.31331 - b_mtem(2,jA,jE) = 8.40835 - b_mtem(3,jA,jE) = -38.1757 - b_mtem(4,jA,jE) = 80.5312 - b_mtem(5,jA,jE) = -79.8346 - b_mtem(6,jA,jE) = 30.0219 - - ! in (NH4)2SO4 - jE = jnh4so4 - b_mtem(1,jA,jE) = -1.03054 - b_mtem(2,jA,jE) = 8.08155 - b_mtem(3,jA,jE) = -38.1046 - b_mtem(4,jA,jE) = 78.7168 - b_mtem(5,jA,jE) = -77.2263 - b_mtem(6,jA,jE) = 29.1521 - - ! in NaHSO4 - jE = jnahso4 - b_mtem(1,jA,jE) = -1.90695 - b_mtem(2,jA,jE) = 11.6241 - b_mtem(3,jA,jE) = -50.3175 - b_mtem(4,jA,jE) = 105.884 - b_mtem(5,jA,jE) = -103.258 - b_mtem(6,jA,jE) = 37.6588 - - ! in Na3H(SO4)2 - jE = jna3hso4 - b_mtem(1,jA,jE) = -0.34780 - b_mtem(2,jA,jE) = 2.85363 - b_mtem(3,jA,jE) = -17.6224 - b_mtem(4,jA,jE) = 38.9220 - b_mtem(5,jA,jE) = -39.8106 - b_mtem(6,jA,jE) = 15.6055 - - ! in Na2SO4 - jE = jna2so4 - b_mtem(1,jA,jE) = -0.75230 - b_mtem(2,jA,jE) = 10.0140 - b_mtem(3,jA,jE) = -50.5677 - b_mtem(4,jA,jE) = 106.941 - b_mtem(5,jA,jE) = -105.534 - b_mtem(6,jA,jE) = 39.5196 - - ! in HNO3 - jE = jhno3 - b_mtem(1,jA,jE) = 0.057456 - b_mtem(2,jA,jE) = -1.31264 - b_mtem(3,jA,jE) = -1.94662 - b_mtem(4,jA,jE) = 10.7024 - b_mtem(5,jA,jE) = -14.9946 - b_mtem(6,jA,jE) = 7.12161 - - ! in HCl - jE = jhcl - b_mtem(1,jA,jE) = 0.637894 - b_mtem(2,jA,jE) = -2.29719 - b_mtem(3,jA,jE) = 0.765361 - b_mtem(4,jA,jE) = 4.8748 - b_mtem(5,jA,jE) = -9.25978 - b_mtem(6,jA,jE) = 4.91773 - ! - ! - ! - !---------------------------------------------------------- - ! Coefficients for %MDRH(T) = d1 + d2*T + d3*T^2 + d4*T^3 (T in Kelvin) - ! valid Temperature Range: 240 - 320 K - !---------------------------------------------------------- - ! - ! SULFATE-POOR SYSTEMS - ! AC - j_index = 1 - d_mdrh(j_index,1) = -58.00268351 - d_mdrh(j_index,2) = 2.031077573 - d_mdrh(j_index,3) = -0.008281218 - d_mdrh(j_index,4) = 1.00447E-05 - - ! AN - j_index = 2 - d_mdrh(j_index,1) = 1039.137773 - d_mdrh(j_index,2) = -11.47847095 - d_mdrh(j_index,3) = 0.047702786 - d_mdrh(j_index,4) = -6.77675E-05 - - ! AS - j_index = 3 - d_mdrh(j_index,1) = 115.8366357 - d_mdrh(j_index,2) = 0.491881663 - d_mdrh(j_index,3) = -0.00422807 - d_mdrh(j_index,4) = 7.29274E-06 - - ! SC - j_index = 4 - d_mdrh(j_index,1) = 253.2424151 - d_mdrh(j_index,2) = -1.429957864 - d_mdrh(j_index,3) = 0.003727554 - d_mdrh(j_index,4) = -3.13037E-06 - - ! SN - j_index = 5 - d_mdrh(j_index,1) = -372.4306506 - d_mdrh(j_index,2) = 5.3955633 - d_mdrh(j_index,3) = -0.019804438 - d_mdrh(j_index,4) = 2.25662E-05 - - ! SS - j_index = 6 - d_mdrh(j_index,1) = 286.1271416 - d_mdrh(j_index,2) = -1.670787758 - d_mdrh(j_index,3) = 0.004431373 - d_mdrh(j_index,4) = -3.57757E-06 - - ! CC - j_index = 7 - d_mdrh(j_index,1) = -1124.07059 - d_mdrh(j_index,2) = 14.26364209 - d_mdrh(j_index,3) = -0.054816822 - d_mdrh(j_index,4) = 6.70107E-05 - - ! CN - j_index = 8 - d_mdrh(j_index,1) = 1855.413934 - d_mdrh(j_index,2) = -20.29219473 - d_mdrh(j_index,3) = 0.07807482 - d_mdrh(j_index,4) = -1.017887858e-4 - - ! AN + AC - j_index = 9 - d_mdrh(j_index,1) = 1761.176886 - d_mdrh(j_index,2) = -19.29811062 - d_mdrh(j_index,3) = 0.075676987 - d_mdrh(j_index,4) = -1.0116959e-4 - - ! AS + AC - j_index = 10 - d_mdrh(j_index,1) = 122.1074303 - d_mdrh(j_index,2) = 0.429692122 - d_mdrh(j_index,3) = -0.003928277 - d_mdrh(j_index,4) = 6.43275E-06 - - ! AS + AN - j_index = 11 - d_mdrh(j_index,1) = 2424.634678 - d_mdrh(j_index,2) = -26.54031307 - d_mdrh(j_index,3) = 0.101625387 - d_mdrh(j_index,4) = -1.31544547798e-4 - - ! AS + AN + AC - j_index = 12 - d_mdrh(j_index,1) = 2912.082599 - d_mdrh(j_index,2) = -31.8894185 - d_mdrh(j_index,3) = 0.121185849 - d_mdrh(j_index,4) = -1.556534623e-4 - - ! SC + AC - j_index = 13 - d_mdrh(j_index,1) = 172.2596493 - d_mdrh(j_index,2) = -0.511006195 - d_mdrh(j_index,3) = 4.27244597e-4 - d_mdrh(j_index,4) = 4.12797E-07 - - ! SN + AC - j_index = 14 - d_mdrh(j_index,1) = 1596.184935 - d_mdrh(j_index,2) = -16.37945565 - d_mdrh(j_index,3) = 0.060281218 - d_mdrh(j_index,4) = -7.6161E-05 - - ! SN + AN - j_index = 15 - d_mdrh(j_index,1) = 1916.072988 - d_mdrh(j_index,2) = -20.85594868 - d_mdrh(j_index,3) = 0.081140141 - d_mdrh(j_index,4) = -1.07954274796e-4 - - ! SN + AN + AC - j_index = 16 - d_mdrh(j_index,1) = 1467.165935 - d_mdrh(j_index,2) = -16.01166196 - d_mdrh(j_index,3) = 0.063505582 - d_mdrh(j_index,4) = -8.66722E-05 - - ! SN + SC - j_index = 17 - d_mdrh(j_index,1) = 158.447059 - d_mdrh(j_index,2) = -0.628167358 - d_mdrh(j_index,3) = 0.002014448 - d_mdrh(j_index,4) = -3.13037E-06 - - ! SN + SC + AC - j_index = 18 - d_mdrh(j_index,1) = 1115.892468 - d_mdrh(j_index,2) = -11.76936534 - d_mdrh(j_index,3) = 0.045577399 - d_mdrh(j_index,4) = -6.05779E-05 - - ! SS + AC - j_index = 19 - d_mdrh(j_index,1) = 269.5432407 - d_mdrh(j_index,2) = -1.319963885 - d_mdrh(j_index,3) = 0.002592363 - d_mdrh(j_index,4) = -1.44479E-06 - - ! SS + AN - j_index = 20 - d_mdrh(j_index,1) = 2841.334784 - d_mdrh(j_index,2) = -31.1889487 - d_mdrh(j_index,3) = 0.118809274 - d_mdrh(j_index,4) = -1.53007e-4 - - ! SS + AN + AC - j_index = 21 - d_mdrh(j_index,1) = 2199.36914 - d_mdrh(j_index,2) = -24.11926569 - d_mdrh(j_index,3) = 0.092932361 - d_mdrh(j_index,4) = -1.21774e-4 - - ! SS + AS - j_index = 22 - d_mdrh(j_index,1) = 395.0051604 - d_mdrh(j_index,2) = -2.521101657 - d_mdrh(j_index,3) = 0.006139319 - d_mdrh(j_index,4) = -4.43756E-06 - - ! SS + AS + AC - j_index = 23 - d_mdrh(j_index,1) = 386.5150675 - d_mdrh(j_index,2) = -2.4632138 - d_mdrh(j_index,3) = 0.006139319 - d_mdrh(j_index,4) = -4.98796E-06 - - ! SS + AS + AN - j_index = 24 - d_mdrh(j_index,1) = 3101.538491 - d_mdrh(j_index,2) = -34.19978105 - d_mdrh(j_index,3) = 0.130118605 - d_mdrh(j_index,4) = -1.66873e-4 - - ! SS + AS + AN + AC - j_index = 25 - d_mdrh(j_index,1) = 2307.579403 - d_mdrh(j_index,2) = -25.43136774 - d_mdrh(j_index,3) = 0.098064728 - d_mdrh(j_index,4) = -1.28301e-4 - - ! SS + SC - j_index = 26 - d_mdrh(j_index,1) = 291.8309602 - d_mdrh(j_index,2) = -1.828912974 - d_mdrh(j_index,3) = 0.005053148 - d_mdrh(j_index,4) = -4.57516E-06 - - ! SS + SC + AC - j_index = 27 - d_mdrh(j_index,1) = 188.3914345 - d_mdrh(j_index,2) = -0.631345031 - d_mdrh(j_index,3) = 0.000622807 - d_mdrh(j_index,4) = 4.47196E-07 - - ! SS + SN - j_index = 28 - d_mdrh(j_index,1) = -167.1252839 - d_mdrh(j_index,2) = 2.969828002 - d_mdrh(j_index,3) = -0.010637255 - d_mdrh(j_index,4) = 1.13175E-05 - - ! SS + SN + AC - j_index = 29 - d_mdrh(j_index,1) = 1516.782768 - d_mdrh(j_index,2) = -15.7922661 - d_mdrh(j_index,3) = 0.058942209 - d_mdrh(j_index,4) = -7.5301E-05 - - ! SS + SN + AN - j_index = 30 - d_mdrh(j_index,1) = 1739.963163 - d_mdrh(j_index,2) = -19.06576022 - d_mdrh(j_index,3) = 0.07454963 - d_mdrh(j_index,4) = -9.94302E-05 - - ! SS + SN + AN + AC - j_index = 31 - d_mdrh(j_index,1) = 2152.104877 - d_mdrh(j_index,2) = -23.74998008 - d_mdrh(j_index,3) = 0.092256654 - d_mdrh(j_index,4) = -1.21953e-4 - - ! SS + SN + SC - j_index = 32 - d_mdrh(j_index,1) = 221.9976265 - d_mdrh(j_index,2) = -1.311331272 - d_mdrh(j_index,3) = 0.004406089 - d_mdrh(j_index,4) = -5.88235E-06 - - ! SS + SN + SC + AC - j_index = 33 - d_mdrh(j_index,1) = 1205.645615 - d_mdrh(j_index,2) = -12.71353459 - d_mdrh(j_index,3) = 0.048803922 - d_mdrh(j_index,4) = -6.41899E-05 - - ! CC + AC - j_index = 34 - d_mdrh(j_index,1) = 506.6737879 - d_mdrh(j_index,2) = -3.723520818 - d_mdrh(j_index,3) = 0.010814242 - d_mdrh(j_index,4) = -1.21087E-05 - - ! CC + SC - j_index = 35 - d_mdrh(j_index,1) = -1123.523841 - d_mdrh(j_index,2) = 14.08345977 - d_mdrh(j_index,3) = -0.053687823 - d_mdrh(j_index,4) = 6.52219E-05 - - ! CC + SC + AC - j_index = 36 - d_mdrh(j_index,1) = -1159.98607 - d_mdrh(j_index,2) = 14.44309169 - d_mdrh(j_index,3) = -0.054841073 - d_mdrh(j_index,4) = 6.64259E-05 - - ! CN + AC - j_index = 37 - d_mdrh(j_index,1) = 756.0747916 - d_mdrh(j_index,2) = -8.546826257 - d_mdrh(j_index,3) = 0.035798677 - d_mdrh(j_index,4) = -5.06629E-05 - - ! CN + AN - j_index = 38 - d_mdrh(j_index,1) = 338.668191 - d_mdrh(j_index,2) = -2.971223403 - d_mdrh(j_index,3) = 0.012294866 - d_mdrh(j_index,4) = -1.87558E-05 - - ! CN + AN + AC - j_index = 39 - d_mdrh(j_index,1) = -53.18033508 - d_mdrh(j_index,2) = 0.663911748 - d_mdrh(j_index,3) = 9.16326e-4 - d_mdrh(j_index,4) = -6.70354E-06 - - ! CN + SC - j_index = 40 - d_mdrh(j_index,1) = 3623.831129 - d_mdrh(j_index,2) = -39.27226457 - d_mdrh(j_index,3) = 0.144559515 - d_mdrh(j_index,4) = -1.78159e-4 - - ! CN + SC + AC - j_index = 41 - d_mdrh(j_index,1) = 3436.656743 - d_mdrh(j_index,2) = -37.16192684 - d_mdrh(j_index,3) = 0.136641377 - d_mdrh(j_index,4) = -1.68262e-4 - - ! CN + SN - j_index = 42 - d_mdrh(j_index,1) = 768.608476 - d_mdrh(j_index,2) = -8.051517149 - d_mdrh(j_index,3) = 0.032342332 - d_mdrh(j_index,4) = -4.52224E-05 - - ! CN + SN + AC - j_index = 43 - d_mdrh(j_index,1) = 33.58027951 - d_mdrh(j_index,2) = -0.308772182 - d_mdrh(j_index,3) = 0.004713639 - d_mdrh(j_index,4) = -1.19658E-05 - - ! CN + SN + AN - j_index = 44 - d_mdrh(j_index,1) = 57.80183041 - d_mdrh(j_index,2) = 0.215264604 - d_mdrh(j_index,3) = 4.11406e-4 - d_mdrh(j_index,4) = -4.30702E-06 - - ! CN + SN + AN + AC - j_index = 45 - d_mdrh(j_index,1) = -234.368984 - d_mdrh(j_index,2) = 2.721045204 - d_mdrh(j_index,3) = -0.006688341 - d_mdrh(j_index,4) = 2.31729E-06 - - ! CN + SN + SC - j_index = 46 - d_mdrh(j_index,1) = 3879.080557 - d_mdrh(j_index,2) = -42.13562874 - d_mdrh(j_index,3) = 0.155235005 - d_mdrh(j_index,4) = -1.91387e-4 - - ! CN + SN + SC + AC - j_index = 47 - d_mdrh(j_index,1) = 3600.576985 - d_mdrh(j_index,2) = -39.0283489 - d_mdrh(j_index,3) = 0.143710316 - d_mdrh(j_index,4) = -1.77167e-4 - - ! CN + CC - j_index = 48 - d_mdrh(j_index,1) = -1009.729826 - d_mdrh(j_index,2) = 12.9145339 - d_mdrh(j_index,3) = -0.049811146 - d_mdrh(j_index,4) = 6.09563E-05 - - ! CN + CC + AC - j_index = 49 - d_mdrh(j_index,1) = -577.0919514 - d_mdrh(j_index,2) = 8.020324227 - d_mdrh(j_index,3) = -0.031469556 - d_mdrh(j_index,4) = 3.82181E-05 - - ! CN + CC + SC - j_index = 50 - d_mdrh(j_index,1) = -728.9983499 - d_mdrh(j_index,2) = 9.849458215 - d_mdrh(j_index,3) = -0.03879257 - d_mdrh(j_index,4) = 4.78844E-05 - - ! CN + CC + SC + AC - j_index = 51 - d_mdrh(j_index,1) = -803.7026845 - d_mdrh(j_index,2) = 10.61881494 - d_mdrh(j_index,3) = -0.041402993 - d_mdrh(j_index,4) = 5.08084E-05 - - ! - ! SULFATE-RICH SYSTEMS - ! AB - j_index = 52 - d_mdrh(j_index,1) = -493.6190458 - d_mdrh(j_index,2) = 6.747053851 - d_mdrh(j_index,3) = -0.026955267 - d_mdrh(j_index,4) = 3.45118E-05 - - ! LV - j_index = 53 - d_mdrh(j_index,1) = 53.37874093 - d_mdrh(j_index,2) = 1.01368249 - d_mdrh(j_index,3) = -0.005887513 - d_mdrh(j_index,4) = 8.94393E-06 - - ! SB - j_index = 54 - d_mdrh(j_index,1) = 206.619047 - d_mdrh(j_index,2) = -1.342735684 - d_mdrh(j_index,3) = 0.003197691 - d_mdrh(j_index,4) = -1.93603E-06 - - ! AB + LV - j_index = 55 - d_mdrh(j_index,1) = -493.6190458 - d_mdrh(j_index,2) = 6.747053851 - d_mdrh(j_index,3) = -0.026955267 - d_mdrh(j_index,4) = 3.45118E-05 - - ! AS + LV - j_index = 56 - d_mdrh(j_index,1) = 53.37874093 - d_mdrh(j_index,2) = 1.01368249 - d_mdrh(j_index,3) = -0.005887513 - d_mdrh(j_index,4) = 8.94393E-06 - - ! SS + SB - j_index = 57 - d_mdrh(j_index,1) = 206.619047 - d_mdrh(j_index,2) = -1.342735684 - d_mdrh(j_index,3) = 0.003197691 - d_mdrh(j_index,4) = -1.93603E-06 - - ! SS + LV - j_index = 58 - d_mdrh(j_index,1) = 41.7619047 - d_mdrh(j_index,2) = 1.303872053 - d_mdrh(j_index,3) = -0.007647908 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + AS + LV - j_index = 59 - d_mdrh(j_index,1) = 41.7619047 - d_mdrh(j_index,2) = 1.303872053 - d_mdrh(j_index,3) = -0.007647908 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + AB - j_index = 60 - d_mdrh(j_index,1) = -369.7142842 - d_mdrh(j_index,2) = 5.512878771 - d_mdrh(j_index,3) = -0.02301948 - d_mdrh(j_index,4) = 3.0303E-05 - - ! SS + LV + AB - j_index = 61 - d_mdrh(j_index,1) = -369.7142842 - d_mdrh(j_index,2) = 5.512878771 - d_mdrh(j_index,3) = -0.02301948 - d_mdrh(j_index,4) = 3.0303E-05 - - ! SB + AB - j_index = 62 - d_mdrh(j_index,1) = -162.8095232 - d_mdrh(j_index,2) = 2.399326592 - d_mdrh(j_index,3) = -0.009336219 - d_mdrh(j_index,4) = 1.17845E-05 - - ! SS + SB + AB - j_index = 63 - d_mdrh(j_index,1) = -735.4285689 - d_mdrh(j_index,2) = 8.885521857 - d_mdrh(j_index,3) = -0.033488456 - d_mdrh(j_index,4) = 4.12458E-05 - - - ! endif ! first - - return - end subroutine load_mosaic_parameters - - - -end module module_mosaic_init_aerpar diff --git a/MAMchem_GridComp/microphysics/module_mosaic_lsode.F90 b/MAMchem_GridComp/microphysics/module_mosaic_lsode.F90 deleted file mode 100644 index e1462f26..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_lsode.F90 +++ /dev/null @@ -1,27 +0,0 @@ -module module_mosaic_lsode - ! - ! double precision lsodes solver - ! - implicit none - private - - public :: MOSAIC_LSODE - -contains - subroutine MOSAIC_LSODE(dtchem) - use module_data_mosaic_kind - - implicit none - - - ! subr arguments - real(r8), intent(in) :: dtchem - - write(*,'(//a//)') & - '*** error - mosaic_lsode has been deactivated ***' - stop - - return - end subroutine MOSAIC_LSODE - -end module module_mosaic_lsode diff --git a/MAMchem_GridComp/microphysics/module_mosaic_support.F90 b/MAMchem_GridComp/microphysics/module_mosaic_support.F90 deleted file mode 100644 index 3fec3eca..00000000 --- a/MAMchem_GridComp/microphysics/module_mosaic_support.F90 +++ /dev/null @@ -1,64 +0,0 @@ -#define CAM -module module_mosaic_support - !Purpose: This module contains subroutines which have codes which depend upon - ! the host code (CAM, WRF etc.). #defines are used to seprate codes - ! which depends on the host code - -#ifdef CAM - use cam_logfile, only: iulog - use abortutils, only: endrun -#endif - - implicit none - private - - public:: mosaic_warn_mess - public:: mosaic_err_mess - - -contains - - subroutine mosaic_warn_mess(message) - !Purpose: Print out the warning messages from Mosaic code - - character(len=*), intent(in) :: message - - !Local variables - character(len=16), parameter :: warn_str = 'MOSAIC WARNING: ' - -#ifdef CAM - !write(iulog,*)warn_str,message!BALLI -comment out to avoid exxcessive warning messages. -#endif - -#ifdef MOSAIC_BOX - write(*,*)warn_str,message -#endif - - - - end subroutine mosaic_warn_mess - - - subroutine mosaic_err_mess(message) - !Purpose - character(len=*), intent(in) :: message - - !Local variables - character(len=14), parameter :: err_str = 'MOSAIC ERROR: ' - character(len=500) :: str_to_prnt - - write(str_to_prnt,*)err_str,message - -#ifdef CAM - call endrun(trim(adjustl(str_to_prnt))) -#endif - -#ifdef MOSAIC_BOX - write(*,*)(trim(adjustl(str_to_prnt))) - stop -#endif - end subroutine mosaic_err_mess - - - -end module module_mosaic_support diff --git a/MAMchem_GridComp/optics/CMakeLists.txt b/MAMchem_GridComp/optics/CMakeLists.txt deleted file mode 100644 index 929563b6..00000000 --- a/MAMchem_GridComp/optics/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -set(miev_srcs - miev/ErrPack.f - miev/MIEV0.F - ) - -add_library(miev ${miev_srcs}) -target_link_libraries(miev PUBLIC OpenMP::OpenMP_Fortran) - -string(REPLACE " " ";" tmp ${FREAL8}) -foreach(flag ${tmp}) - target_compile_options (miev PRIVATE $<$:${flag}>) -endforeach() - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -if (USE_F2PY) - find_package(F2PY2) - if (F2PY2_FOUND) - esma_add_f2py2_module(optics_ - SOURCES mie.F90 - DESTINATION lib/Python2/optics - ONLY scattering_lognormal - LIBRARIES miev - INCLUDEDIRS ${CMAKE_CURRENT_BINARY_DIR} - USE_OPENMP DOUBLE_PRECISION - ) - add_dependencies(optics_ miev) - endif () -endif () - -install( - FILES radiation.py gads.py mam7-optics.lut.py - DESTINATION lib/Python2/optics - ) diff --git a/MAMchem_GridComp/optics/gads.py b/MAMchem_GridComp/optics/gads.py deleted file mode 100644 index 1c3bb8b1..00000000 --- a/MAMchem_GridComp/optics/gads.py +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env python - -import os -import numpy as np - -import scipy.interpolate - -class GADS: - - def __init__(self, file): - - self.file = file - - self.parse_optical_parameters() - - - def parse_optical_parameters(self): - - _optical_parameters = [] - - with open(self.file) as f: - for line in f: - data = line.split() - - if data[0] == '#' and len(data[1:]) == 9: - - try: - values = [float(v) for v in data[1:]] - except: - continue - - _optical_parameters.append(values) - - optical_parameters = np.array(_optical_parameters) - - self._wavelength = 1e-6*optical_parameters[:, 0] - self._refractive_index_real = np.array(optical_parameters[:,-2]) - self._refractive_index_imag = -np.array(optical_parameters[:,-1]) # note that GADS Im(n) <= 0, we make them positive - - - def refractive_index(self, wavelengths=None, extend=True, bands=None, k=1, s=0): - ''' - Returns the rafractive indexes at list of wavelengths or - bands. - ''' - - result = {'re': [], 'im': []} - - if wavelengths is None and bands is None: - result['re'] = self._refractive_index_real - result['im'] = self._refractive_index_imag - else: - if extend: - N = 100 - - _w = np.zeros(len(self._wavelength) + 2*N) - _n_re = np.zeros(len(self._refractive_index_real) + 2*N) - _n_im = np.zeros(len(self._refractive_index_imag) + 2*N) - - _w[:N] = np.linspace(0.0, np.min(self._wavelength), N, endpoint=False) - _n_re[:N] = self._refractive_index_real[0] - _n_im[:N] = self._refractive_index_imag[0] - - _w[N:-N] = self._wavelength[:] - _n_re[N:-N] = self._refractive_index_real[:] - _n_im[N:-N] = self._refractive_index_imag[:] - - _w[-N:] = np.linspace(10*np.max(self._wavelength), np.max(self._wavelength), N, endpoint=False)[::-1] - _n_re[-N:] = self._refractive_index_real[-1] - _n_im[-N:] = self._refractive_index_imag[-1] - else: - _w = self._wavelength - _n_re = self._refractive_index_imag - _n_im = self._refractive_index_imag - - spline_n_re = scipy.interpolate.UnivariateSpline(_w, _n_re, k=k, s=s) - spline_n_im = scipy.interpolate.UnivariateSpline(_w, _n_im, k=k, s=s) - - if wavelengths is not None: - result['re'] = spline_n_re(wavelengths) - result['im'] = spline_n_im(wavelengths) - else: - for b in bands: - assert b[1] > b[0] - _n_re = spline_n_re.integral(b[0], b[1]) / (b[1] - b[0]) - _n_im = spline_n_im.integral(b[0], b[1]) / (b[1] - b[0]) - - result['re'].append(_n_re) - result['im'].append(_n_im) - - result['re'] = np.array(result['re']) - result['im'] = np.array(result['im']) - - return result - - def wavelengths(self, bands=None): - ''' - Returns an array of all wavelenghts or the waveleghts in a list of - bands. - ''' - - if bands is None: - result = self._wavelength - else: - result = [] - for b in band: - i = np.logical_and(self._wavelengt >= b[0], self.wavelength <= b[1]) - - result.append(self._wavelengt[i]) - - return np.array(result) - - - -def refractive_index(components=('OC', 'BC', 'SU', 'SS', 'DU', 'AMM', 'SOA', 'POM', 'WATER'), bands=None, wavelengths=None, - dir='/home/adarmeno/sandbox/colarco/radiation/gads/optdat/', verbose=False): - - ''' - Returns min and max of real and imaginary part of refractive indexes as well as - a dictionary with refractive indexes of aerosol components interpolated at the - specified wavelengths or their mean values in bands. - ''' - - _components = [c.lower() for c in components] - - - # Organic carbon - waso = GADS(os.path.join(dir, 'waso00')) - oc = waso - - # Black carbon - soot = GADS(os.path.join(dir, 'soot00')) - bc = soot - - # Sulfate - suso = GADS(os.path.join(dir, 'suso00')) - su = suso - - # Dust: same spectral refractive indexes - miam = GADS(os.path.join(dir, 'miam00')) - micm = GADS(os.path.join(dir, 'micm00')) - minm = GADS(os.path.join(dir, 'minm00')) - mitr = GADS(os.path.join(dir, 'mitr00')) - du = miam - - # Sea salt: same spectral refractive indexes - ssam = GADS(os.path.join(dir, 'ssam00')) - sscm = GADS(os.path.join(dir, 'sscm00')) - ss = ssam - - # water (clouds) - cucc = GADS(os.path.join(dir, 'cucc00')) - cucp = GADS(os.path.join(dir, 'cucp00')) - cuma = GADS(os.path.join(dir, 'cuma00')) - stco = GADS(os.path.join(dir, 'stco00')) - stma = GADS(os.path.join(dir, 'stma00')) - water= cucc - - - species = {} - if 'oc' in _components: species['oc' ] = oc - if 'bc' in _components: species['bc' ] = bc - if 'su' in _components: species['su' ] = su - if 'ss' in _components: species['ss' ] = ss - if 'du' in _components: species['du' ] = du - if 'amm' in _components: species['amm'] = su # ammonium == sulfate - if 'pom' in _components: species['pom'] = oc - if 'soa' in _components: species['soa'] = oc - if 'water' in _components: species['water'] = water - - #_s = species.keys()[-1] - #for s in species.keys(): - # assert np.array_equal(species[s].wavelengths(), species[_s].wavelengths()) - - n = None - if wavelengths is not None: - n = {} - for s in species.keys(): - n[s] = species[s].refractive_index(wavelengths=wavelengths) - - if bands is not None: - n = {} - for s in species.keys(): - n[s] = species[s].refractive_index(bands=bands) - - - _s = species.keys()[-1] - _l = len(n[_s]['re']) # number of bands or wavelengths - n_re_min = np.zeros(_l) - n_re_max = np.zeros(_l) - n_im_min = np.zeros(_l) - n_im_max = np.zeros(_l) - - for i in range(_l): - # refractive indexes in this band or at this wavelength - _n_re = [n[s]['re'][i] for s in species.keys()] - _n_im = [n[s]['im'][i] for s in species.keys()] - - n_re_min[i] = np.min(_n_re) - n_re_max[i] = np.max(_n_re) - - n_im_min[i] = np.min(_n_im) - n_im_max[i] = np.max(_n_im) - - if verbose: - for i in range(_l): - print 'band %2i n_re = [%.3e, %.3e] n_im = [%.3e, %.3e]' % (i+1, n_re_min[i], n_re_max[i], n_im_min[i], n_im_max[i]) - - print - print - - result = (n_re_min, n_re_max, n_im_min, n_im_max, n) - - return result - - diff --git a/MAMchem_GridComp/optics/mam7-optics.lut.batch.csh b/MAMchem_GridComp/optics/mam7-optics.lut.batch.csh deleted file mode 100755 index d03c5652..00000000 --- a/MAMchem_GridComp/optics/mam7-optics.lut.batch.csh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/csh - - -ssh dali02 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=ait ./_opticsBands_MAM7_AIT.v0.3-rc2.nc4 >& logs/log.lut-ait.v0.3-rc2 & -EOF - -ssh dali03 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=acc ./_opticsBands_MAM7_ACC.v0.3-rc2.nc4 >& logs/log.lut-acc.v0.3-rc2 & -EOF - -ssh dali04 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=pcm ./_opticsBands_MAM7_PCM.v0.3-rc2.nc4 >& logs/log.lut-pcm.v0.3-rc2 & -EOF - -ssh dali05 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=fss ./_opticsBands_MAM7_FSS.v0.3-rc2.nc4 >& logs/log.lut-fss.v0.3-rc2 & -EOF - -ssh dali06 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=css ./_opticsBands_MAM7_CSS.v0.3-rc2.nc4 >& logs/log.lut-css.v0.3-rc2 & -EOF - -ssh dali07 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=cdu ./_opticsBands_MAM7_CDU.v0.3-rc2.nc4 >& logs/log.lut-cdu.v0.3-rc2 & -EOF - -ssh dali08 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --chou-suarez --mode=fdu ./_opticsBands_MAM7_FDU.v0.3-rc2.nc4 >& logs/log.lut-fdu.v0.3-rc2 & -EOF - - -ssh dali09 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=ait ./_optics_MAM7_AIT.v0.3-rc2.nc4 >& logs/log.lut-ait & -EOF - -ssh dali10 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=acc ./_optics_MAM7_ACC.v0.3-rc2.nc4 >& logs/log.lut-acc & -EOF - -ssh dali11 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=pcm ./_optics_MAM7_PCM.v0.3-rc2.nc4 >& logs/log.lut-pcm & -EOF - -ssh dali12 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=fss ./_optics_MAM7_FSS.v0.3-rc2.nc4 >& logs/log.lut-fss & -EOF - -ssh dali13 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=css ./_optics_MAM7_CSS.v0.3-rc2.nc4 >& logs/log.lut-css & -EOF - -ssh dali14 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=cdu ./_optics_MAM7_CDU.v0.3-rc2.nc4 >& logs/log.lut-cdu & -EOF - -ssh dali15 << EOF - source /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/g5_modules - cd /home/adarmeno/models/geos-5/ganymed-4.0-radiation/src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSchem_GridComp/MAMchem_GridComp/optics/ - nohup python ./mam7-optics.lut.py --gads --mode=fdu ./_optics_MAM7_FDU.v0.3-rc2.nc4 >& logs/log.lut-fdu & -EOF - diff --git a/MAMchem_GridComp/optics/mam7-optics.lut.py b/MAMchem_GridComp/optics/mam7-optics.lut.py deleted file mode 100644 index baf68279..00000000 --- a/MAMchem_GridComp/optics/mam7-optics.lut.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python - -''' -Create and save MAM7 mie lookup tables. -''' - -import os - -import argparse - -import gads -import radiation - -LUT_VERSION = '0.3-rc2' -LUT_FILE_TEMPLATE = 'opticsBands_MAM7_{mode}.v{version}.nc4' - -MAM7 = {} - -MAM7['AIT'] = dict(name = 'Aitken', - components = ('water', 'su', 'amm', 'soa', 'ss'), - sigma = 1.6, - dileq = 0.80, - cryst = 0.35) - -MAM7['ACC'] = dict(name = 'Accumulation', - components = ('water', 'su', 'amm', 'soa', 'pom', 'bc', 'ss'), - sigma = 1.8, - dileq = 0.80, - cryst = 0.35) - -MAM7['PCM'] = dict(name = 'Primary Carbon', - components = ('water', 'pom', 'bc'), - sigma = 1.6, - dileq = 0.80, - cryst = 0.35) - -MAM7['FSS'] = dict(name = 'Fine Seasalt', - components = ('water', 'su', 'amm', 'ss'), - sigma = 2.0, - dileq = 0.80, - cryst = 0.35) - -MAM7['CSS'] = dict(name = 'Coarse Seasalt', - components = ('water', 'su', 'amm', 'ss'), - sigma = 2.0, - dileq = 0.80, - cryst = 0.35) - -MAM7['FDU'] = dict(name = 'Fine Dust', - components=('water', 'su', 'amm', 'du'), - sigma = 1.8, - dileq = 0.80, - cryst = 0.35) - -MAM7['CDU'] = dict(name = 'Coarse Dust', - components = ('water', 'su', 'amm', 'du'), - sigma = 1.8, - dileq = 0.80, - cryst = 0.35) - - - -if __name__ == '__main__': - - ''' - Example usage: - - source $ESMADIR/src/g5_modules - - # create broadband optical properties LUTs for Chou-Suarez scheme - nohup python ./mam7-optics.lut.py --chou-suarez --mode=ait ./_opticsBands_MAM7_AIT.v0.3-rc2.nc4 >& logs/log.lut-ait.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=acc ./_opticsBands_MAM7_ACC.v0.3-rc2.nc4 >& logs/log.lut-acc.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=pcm ./_opticsBands_MAM7_PCM.v0.3-rc2.nc4 >& logs/log.lut-pcm.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=fss ./_opticsBands_MAM7_FSS.v0.3-rc2.nc4 >& logs/log.lut-fss.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=css ./_opticsBands_MAM7_CSS.v0.3-rc2.nc4 >& logs/log.lut-css.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=cdu ./_opticsBands_MAM7_CDU.v0.3-rc2.nc4 >& logs/log.lut-cdu.v0.3-rc2 & - nohup python ./mam7-optics.lut.py --chou-suarez --mode=fdu ./_opticsBands_MAM7_FDU.v0.3-rc2.nc4 >& logs/log.lut-fdu.v0.3-rc2 & - - # create monochromatic (at GADS wavelengths) optical properties LUTs for Chou-Suarez scheme - nohup python ./mam7-optics.lut.py --gads --mode=ait ./_optics_MAM7_AIT.v0.3-rc2.nc4 >& logs/log.lut-ait & - nohup python ./mam7-optics.lut.py --gads --mode=acc ./_optics_MAM7_ACC.v0.3-rc2.nc4 >& logs/log.lut-acc & - nohup python ./mam7-optics.lut.py --gads --mode=pcm ./_optics_MAM7_PCM.v0.3-rc2.nc4 >& logs/log.lut-pcm & - nohup python ./mam7-optics.lut.py --gads --mode=fss ./_optics_MAM7_FSS.v0.3-rc2.nc4 >& logs/log.lut-fss & - nohup python ./mam7-optics.lut.py --gads --mode=css ./_optics_MAM7_CSS.v0.3-rc2.nc4 >& logs/log.lut-css & - nohup python ./mam7-optics.lut.py --gads --mode=cdu ./_optics_MAM7_CDU.v0.3-rc2.nc4 >& logs/log.lut-cdu & - nohup python ./mam7-optics.lut.py --gads --mode=fdu ./_optics_MAM7_FDU.v0.3-rc2.nc4 >& logs/log.lut-fdu & - ''' - - - # parse arguments - parser = argparse.ArgumentParser(description='MAM7 mie lookup tables generator.') - - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument('--gads', action='store_true', help='Monochromatic optics at the 61 GADS wavelengths.') - group.add_argument('--chou-suarez', action='store_true', help='Band-averaged optics for the Chow-Suarez radiation scheme.') - group.add_argument('--rrtmg', action='store_true', help='Band-averaged optics for the RRTMG radiation scheme.') - - parser.add_argument('--mode', choices=('ait', 'acc', 'pcm', 'fdu', 'cdu', 'fss', 'css'), required=True, help='MAM7 mode: Aitken, Accumulation, Primary Carbon, Fine dust, Coarse dust, Fine seasalt, Coarse seasalt.') - parser.add_argument('file', help='Output file.') - - args = parser.parse_args() - - - # LUT setup - mode = args.mode.upper() - - # next three choices are exclusive - if args.gads: - gads_dir = '/home/adarmeno/sandbox/colarco/radiation/gads/optdat/' - - # greate GADS object to read the GADS/OPAC wavelegths - insol = gads.GADS(os.path.join(gads_dir, 'inso00')) - wavelengths_gads = insol.wavelengths() - - wavelengths = wavelengths_gads # ... or reduce to (470e-9, 550e-9, 660e-9, 870e-9) - bands = None - else: - wavelengths = None - - if args.chou_suarez: - bands = radiation.geos5_bands(scheme=radiation.scheme_cs) - - if args.rrtmg: - assert False # not fully implemented yet - bands = radiation.geos5_bands(scheme=radiation.scheme_rrtmg) - - - description = 'Aerosol optical properties: MAM7 - {name} Mode'.format(name=MAM7[mode]['name']) - print description - - lut = radiation.LUT(wavelengths=wavelengths, - bands=bands, - surface_mode_diameter=(2*0.01e-6, 2*25.0e-6), - sigma=MAM7[mode]['sigma'], - components=MAM7[mode]['components'], - N_re=20, - N_im=30, - N_cheb=20, - N_size=200, - N_integration_bins=10000, - verbose=False) - - ext, sca, g, c_ext, c_sca, c_g = lut.compute() - - lut.save(args.file, c_ext, c_sca, c_g, title=description, comment='', history='') - - - - diff --git a/MAMchem_GridComp/optics/mie.F90 b/MAMchem_GridComp/optics/mie.F90 deleted file mode 100644 index 346f152c..00000000 --- a/MAMchem_GridComp/optics/mie.F90 +++ /dev/null @@ -1,525 +0,0 @@ -module mie - - use omp_lib - - implicit none - - private - - real, parameter :: pi = 3.141592653589793d0 - - public scattering_lognormal - - integer, public, parameter :: integration_method_midpoint = 1 ! midpoint method for numerical integration - integer, public, parameter :: integration_method_simpson = 2 ! Simpson's method for numerical integration - - integer, public, parameter :: psd_number = 1 ! particle size distrbution: number - integer, public, parameter :: psd_surface = 2 ! particle size distrbution: surface area - integer, public, parameter :: psd_volume = 3 ! particle size distrbution: volume - - integer, public, parameter :: ERROR_UNSUPORTED_PSD = 100 - - -contains - - subroutine scattering_lognormal(psd, Dg, sigma, refractive_index, wavelength, ext, sca, g, & - size_min, size_max, intervals, specific, method) - - ! - ! Returns (optionally specific) extinction and scattering, and asimmetry parameter of - ! a population of homogeneous spherical particles with lognormal size distribution - ! and density equal to density of water. - ! - ! Note: PDF of the size distribution is assumed to be normalized, therefore extinction and - ! scattering computed with surface distribution parameters need to be multiplied by a - ! factor (pi * (2 * Dgn)**2 * exp(2 * log(sigma)**2)) in order to compare them with the - ! results obtained with number distribution parameters. However there is no need to - ! apply this factor if mass specific extinction and scattering are computed, they can be - ! directly compared regardless of the types of size distribution. - ! - - implicit none - - ! input - integer, intent(in) :: psd ! particle syze distribution: number of surface - real, intent(in) :: Dg ! geometric mean (median) diameter of number or surface distribution - real, intent(in) :: sigma ! standard deviation of the lognormal size distribution - complex, intent(in) :: refractive_index ! particle refractive index - real, intent(in) :: wavelength ! radiation wavelength - real, intent(in) :: size_min ! lower bound for integration over the size distribution - real, intent(in) :: size_max ! upper bound for integration over the size distribution - integer, intent(in) :: intervals ! number of intervals/bins for unerical integration - logical, intent(in) :: specific ! mass specific optical properties - integer, intent(in) :: method ! integration method -! real, intent(in) :: spike_threshold ! MIEV0 specific, values below about 0.3 signify a ripple spike - - ! output - real, intent(out) :: ext ! extinction - real, intent(out) :: sca ! scattering - real, intent(out) :: g ! asimmetry factor - - ! local - real, parameter :: density_water = 1000d0 ! density of water, 'kg m-3' - - select case (method) - case (integration_method_simpson) - call integrate_simpson_(psd, Dg, sigma, refractive_index, wavelength, ext, sca, g, & - size_min, size_max, intervals, specific) - case default - call integrate_midpoint_(psd, Dg, sigma, refractive_index, wavelength, ext, sca, g, & - size_min, size_max, intervals, specific) - end select - - contains - subroutine integrate_midpoint_(psd, Dg, sigma, refractive_index, wavelength, ext, sca, g, & - size_min, size_max, intervals, specific) - - ! - ! Use midpoint rule to do integration of optical properties - ! over the number size distribution. - ! - - implicit none - - ! input - integer, intent(in) :: psd ! particle syze distribution: number of surface - real, intent(in) :: Dg ! geometric mean (median) diameter of number of surface distribution - real, intent(in) :: sigma ! standard deviation of the lognormal size distribution - complex, intent(in) :: refractive_index ! particle refractive index - real, intent(in) :: wavelength ! radiation wavelength - real, intent(in) :: size_min ! lower bound for integration over the size distribution - real, intent(in) :: size_max ! upper bound for integration over the size distribution - integer, intent(in) :: intervals ! number of intervals/bins for unerical integration - logical, intent(in) :: specific ! mass specific optical properties - - ! output - real, intent(out) :: ext ! extinction - real, intent(out) :: sca ! scattering - real, intent(out) :: g ! asimmetry factor - - ! local - real :: delta ! integration step - real :: d, s ! diameter, crossection - real :: n, m ! number, mass~volume - real :: dN, dS ! number of particles, volume of particles in a size bin - integer :: i ! index - real :: q_ext, q_sca ! extinction amd scattering efficiencies - real :: gq_sca ! asimmetry factor times scattering efficiency - real :: spike ! MIEV0 spike indicator - real :: q_ext_, q_sca_, gq_sca_ ! last good values without resonance spike - - - if ((psd /= psd_number) .and. (psd /= psd_surface)) then - print *, "ERROR:: 'Unsuported PSD' RC=", ERROR_UNSUPORTED_PSD - stop ERROR_UNSUPORTED_PSD - end if - - delta = (size_max - size_min)/intervals - - ext = 0.0d0 - sca = 0.0d0 - g = 0.0d0 - - m = 0.0d0 - n = 0.0d0 - - q_ext_ = 0.0 - q_sca_ = 0.0 - gq_sca_ = 0.0 - - NUMBER_DISTRIBUTION: if (psd == psd_number) then - !$omp parallel default( none ) & - !$omp shared ( intervals, size_min, delta, refractive_index, wavelength, Dg, sigma, ext, sca, g, m ) & - !$omp private ( i, d, q_ext, q_sca, gq_sca, spike, dN, s ) - !$omp do reduction ( + : ext, sca, g, m ) & - !$omp& schedule(guided) - do i = 0, intervals - 1 - - d = size_min + (i + 0.5d0)*delta - - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - !if (spike > 0.3) then - ! q_ext = q_ext_ - ! q_sca = q_sca_ - ! gq_sca = gq_sca_ - !else - ! print *, 'mie: spike resonance detected in size integration... [excluded]' - !end if - - dN = psd_lognormal(d, Dg, sigma) * delta ! number of particles in (d, d+delta) size interval - s = (pi / 4d0) * d**2 ! cross-section - - ext = ext + (s * q_ext) * dN ! integrated size dependent optical properties - sca = sca + (s * q_sca) * dN ! ... - g = g + (s * gq_sca) * dN ! ... - - m = m + (pi / 6d0) * d**3 * dN ! population volume - end do - !$omp end do - !$omp end parallel - end if NUMBER_DISTRIBUTION - - SURFACE_DISTRIBUTION: if (psd == psd_surface) then - !$omp parallel default( none ) & - !$omp shared ( intervals, size_min, delta, refractive_index, wavelength, Dg, sigma, ext, sca, g, m) & - !$omp private ( i, d, q_ext, q_sca, gq_sca, spike, dS ) - !$omp do reduction ( + : ext, sca, g, m ) & - !$omp& schedule(guided) - do i = 0, intervals - 1 - d = size_min + (i + 0.5d0)*delta - - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - !if (spike > 0.3) then - ! q_ext = q_ext_ - ! q_sca = q_sca_ - ! gq_sca = gq_sca_ - !else - ! print *, 'mie: spike resonance detected in size integration... [excluded]' - !end if - - dS = psd_lognormal(d, Dg, sigma) * delta ! surface of particles in (d, d+delta) size interval - - ext = ext + q_ext * dS ! integrated size dependent optical properties - sca = sca + q_sca * dS ! ... - g = g + gq_sca * dS ! ... - - m = m + (1d0 / 6d0) * d * dS ! population volume - end do - !$omp end do - !$omp end parallel - - ext = 0.25d0 * ext ! surface factor = 1/4 - sca = 0.25d0 * sca ! ... - g = 0.25d0 * g ! ... - - end if SURFACE_DISTRIBUTION - - if (specific) then - m = density_water * m ! population mass - else - m = 1.0d0 - end if - - g = g / sca - ext = ext / m - sca = sca / m - - end subroutine integrate_midpoint_ - - - subroutine integrate_simpson_(psd, Dg, sigma, refractive_index, wavelength, ext, sca, g, & - size_min, size_max, intervals, specific) - - ! - ! Use midpoint rule to do integration of optical properties - ! over the number size distribution. - ! - - implicit none - - ! input - integer, intent(in) :: psd ! particle syze distribution: number of surface - real, intent(in) :: Dg ! geometric mean (median) diameter of number size distribution - real, intent(in) :: sigma ! standard deviation of the lognormal size distribution - complex, intent(in) :: refractive_index ! particle refractive index - real, intent(in) :: wavelength ! radiation wavelength - real, intent(in) :: size_min ! lower bound for integration over the size distribution - real, intent(in) :: size_max ! upper bound for integration over the size distribution - integer, intent(in) :: intervals ! number of intervals/bins for unerical integration - logical, intent(in) :: specific ! mass specific optical properties - - ! output - real, intent(out) :: ext ! extinction - real, intent(out) :: sca ! scattering - real, intent(out) :: g ! asimmetry factor - - - ! local - real :: delta ! integration step - real :: w ! weight factor - real :: d ! diameter - real :: s, m, dN ! crossection, mass|volume, number of particles - integer :: i, n ! index - real :: q_ext, q_sca ! extinction amd scattering efficiencies - real :: gq_sca ! asimmetry factor times scattering efficiency - real :: spike ! MIEV0 spike indicator - - - if ((psd /= psd_number)) then - stop ERROR_UNSUPORTED_PSD - end if - - ! number if intervals has to be even - if ((intervals/2)*2 == intervals) then - n = intervals - else - n = intervals + 1 - end if - - delta = (size_max - size_min)/n - - ext = 0.0d0 - sca = 0.0d0 - g = 0.0d0 - - m = 0.0d0 - - ! step 1 - d = size_min - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - dN = psd_lognormal(d, Dg, sigma) * delta ! number of particles in (d, d+delta) size interval - s = (pi / 4d0) * d**2 ! cross-section - - ext = ext + (s * q_ext) * dN ! integrated size dependent optical properties - sca = sca + (s * q_sca) * dN ! - g = g + (s * gq_sca) * dN ! - - m = m + (pi / 6d0) * d**3 * dN ! population volume - - - ! step 2 - d = size_max - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - dN = psd_lognormal(d, Dg, sigma) * delta ! number of particles in (d, d+delta) size interval - s = (pi / 4d0) * d**2 ! cross-section - - ext = ext + (s * q_ext) * dN ! integrated size dependent optical properties - sca = sca + (s * q_sca) * dN ! - g = g + (s * gq_sca) * dN ! - - m = m + (pi / 6d0) * d**3 * dN ! population volume - - - ! step 3 - w = 4.0d0 - do i = 1, (n - 1), 2 - d = size_min + i*delta - - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - dN = psd_lognormal(d, Dg, sigma) * delta ! number of particles in (d, d+delta) size interval - s = (pi / 4d0) * d**2 ! cross-section - - ext = ext + w * (s * q_ext) * dN ! integrated size dependent optical properties - sca = sca + w * (s * q_sca) * dN ! - g = g + w * (s * gq_sca) * dN ! - - m = m + w * (pi / 6d0) * d**3 * dN ! population volume - end do - - - ! step 4 - w = 2.0d0 - do i = 2, (n - 2), 2 - d = size_min + i*delta - - call scattering_sphere(d, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - dN = psd_lognormal(d, Dg, sigma) * delta ! number of particles in (d, d+delta) size interval - s = (pi / 4d0) * d**2 ! cross-section - - ext = ext + w * (s * q_ext) * dN ! integrated size dependent optical properties - sca = sca + w * (s * q_sca) * dN ! - g = g + w * (s * gq_sca) * dN ! - - m = m + w * (pi / 6d0) * d**3 * dN ! population volume - end do - - - ! step 5 - ext = ext / 3.0d0 - sca = sca / 3.0d0 - g = g / 3.0d0 - m = m / 3.0d0 - - - ! return optics - if (specific) then - m = density_water * m ! population mass - else - m = 1.0d0 - end if - - g = g / sca - ext = ext / m - sca = sca / m - - end subroutine integrate_simpson_ - - end subroutine scattering_lognormal - -#if (0) - subroutine scattering_sphere(diameter, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - ! - ! Returns extinction and scattering efficiencies, and asimmetry parameter of - ! a homogeneous spherical particle at some wavelegth. - ! - ! This subroutine provides simplified interface to the bhmie code. - ! - - implicit none - - ! input - real, intent(in) :: diameter ! sphere diameter - complex, intent(in) :: refractive_index ! sphere refractive index - real, intent(in) :: wavelength ! radiation wavelength - - ! output - real, intent(out) :: q_ext ! extinction efficiency - real, intent(out) :: q_sca ! scattering efficiency - real, intent(out) :: gq_sca ! asymmetry parameter (g) times scattering efficiency (q_sca) - real, intent(out) :: spike ! defaults to 1.0 when not on a spike. - ! values below about 0.3 signify a ripple spike. - - ! local - real :: x ! size paramter - - integer, parameter :: MXNANG=1000 ! see BHMIEV/README - complex :: S1(2*MXNANG-1) - complex :: S2(2*MXNANG-1) - - integer :: n_ang - real :: q_back - - ! initialize some of the BHMIE inputs - - n_ang = 2 - - q_ext = 0.0 - q_sca = 0.0 - q_back = 0.0 - gq_sca = 0.0 - - x = size_parameter(diameter, wavelength) - - call bhmie(x, refractive_index, n_ang, S1, S2, q_ext, q_sca, q_back, gq_sca) - gq_sca = gq_sca*q_sca - - spike = 1.0 - - end subroutine scattering_sphere -#else - subroutine scattering_sphere(diameter, refractive_index, wavelength, q_ext, q_sca, gq_sca, spike) - - ! - ! Returns extinction and scattering efficiencies, and asimmetry parameter of - ! a homogeneous spherical particle at some wavelegth. - ! - ! This subroutine provides simplified interface to the MIEV0 code. - ! - - implicit none - - ! input - real, intent(in) :: diameter ! sphere diameter - complex, intent(in) :: refractive_index ! sphere refractive index - real, intent(in) :: wavelength ! radiation wavelength - - ! output - real, intent(out) :: q_ext ! extinction efficiency - real, intent(out) :: q_sca ! scattering efficiency - real, intent(out) :: gq_sca ! asymmetry parameter (g) times scattering efficiency (q_sca) - real, intent(out) :: spike ! defaults to 1.0 when not on a spike. - ! values below about 0.3 signify a ripple spike. - - ! local - real :: x ! size paramter - - logical :: perfct ! see MIEV0.doc - real :: mimcut ! - logical :: anyang ! - integer :: numang ! - real :: xmu(2) ! - integer :: nmom ! - integer :: ipolzn ! - integer :: momdim ! determines first dimension of PMOM - logical :: prnt(2) ! - real :: p_mom(0:1,4) ! - complex :: sforw ! - complex :: sback ! - complex :: s1(2) ! - complex :: s2(2) ! - complex :: t_forw(2) ! - complex :: t_back(2) ! - - - ! initialize some of the MIEV0 inputs - perfct = .false. - mimcut = 1.0d-6 - anyang = .false. - numang = 0 ! skip calculation of S1 and S2 - xmu = 0 - nmom = 0 ! prevent calculation of PMOM - ipolzn = 0 - momdim = 1 - prnt = .false. - p_mom = 0.0 - s1 = (0.0, 0.0) - s2 = (0.0, 0.0) - t_forw = (0.0, 0.0) - t_back = (0.0, 0.0) - - q_ext = 0.0 - q_sca = 0.0 - gq_sca = 0.0 - spike = 0.0 - - x = size_parameter(diameter, wavelength) - - call miev0(x, refractive_index, perfct, mimcut, anyang, & - numang, xmu, nmom, ipolzn, momdim, prnt, q_ext, q_sca, gq_sca, & - p_mom, sforw, sback, s1, s2, t_forw, t_back, spike) - - end subroutine scattering_sphere -#endif - - function size_parameter(diameter, wavelength) - - ! - ! Returns the size parameter of a spherical - ! particle at some wavelegth. - ! - - implicit none - - real :: size_parameter ! result - - ! input - real, intent(in) :: diameter ! sphere size/diameter - real, intent(in) :: wavelength ! radiation wavelength - - size_parameter = pi * diameter / wavelength - - end function size_parameter - - - function psd_lognormal(x, median, sigma) - - ! - ! Computes lognormal particle size distribution. - ! - - implicit none - - real :: psd_lognormal ! result - - ! input - real, intent(in) :: x ! parameter - real, intent(in) :: median ! geometric median - real, intent(in) :: sigma ! standard deviation - - ! local - real :: log_sigma - - log_sigma = log(sigma) - - psd_lognormal = 1/(x * log_sigma * sqrt(2*pi)) * exp(-(log(x) - log(median))**2 / (2*log_sigma*log_sigma)) - - end function psd_lognormal - -end module mie diff --git a/MAMchem_GridComp/optics/miev/ErrPack.f b/MAMchem_GridComp/optics/miev/ErrPack.f deleted file mode 100644 index f9ac8d06..00000000 --- a/MAMchem_GridComp/optics/miev/ErrPack.f +++ /dev/null @@ -1,94 +0,0 @@ - - SUBROUTINE ErrMsg( MESSAG, FATAL ) - -c Print out a warning or error message; abort if error - - LOGICAL FATAL, MsgLim - CHARACTER*(*) MESSAG - INTEGER MaxMsg, NumMsg - SAVE MaxMsg, NumMsg, MsgLim - DATA NumMsg / 0 /, MaxMsg / 100 /, MsgLim / .FALSE. / - - - IF ( FATAL ) THEN - WRITE ( *, '(/,2A,/)' ) ' ******* ERROR >>>>>> ', MESSAG - STOP - END IF - - NumMsg = NumMsg + 1 - IF( MsgLim ) RETURN - - IF ( NumMsg.LE.MaxMsg ) THEN - WRITE ( *, '(/,2A,/)' ) ' ******* WARNING >>>>>> ', MESSAG - ELSE - WRITE ( *,99 ) - MsgLim = .True. - ENDIF - - RETURN - - 99 FORMAT( //,' >>>>>> TOO MANY WARNING MESSAGES -- ', - & 'They will no longer be printed <<<<<<<', // ) - END - - LOGICAL FUNCTION WrtBad ( VarNam ) - -c Write names of erroneous variables and return 'TRUE' - -c INPUT : VarNam = Name of erroneous variable to be written -c ( CHARACTER, any length ) - - CHARACTER*(*) VarNam - INTEGER MaxMsg, NumMsg - SAVE NumMsg, MaxMsg - DATA NumMsg / 0 /, MaxMsg / 50 / - - - WrtBad = .TRUE. - NumMsg = NumMsg + 1 - WRITE ( *, '(3A)' ) ' **** Input variable ', VarNam, - & ' in error ****' - IF ( NumMsg.EQ.MaxMsg ) - & CALL ErrMsg ( 'Too many input errors. Aborting...', .TRUE. ) - - RETURN - END - - LOGICAL FUNCTION WrtDim ( DimNam, MinVal ) - -c Write name of too-small symbolic dimension and -c the value it should be increased to; return 'TRUE' - -c INPUT : DimNam = Name of symbolic dimension which is too small -c ( CHARACTER, any length ) -c Minval = Value to which that dimension should be -c increased (at least) - - CHARACTER*(*) DimNam - INTEGER MinVal - - - WRITE ( *, '(/,3A,I7)' ) ' **** Symbolic dimension ', DimNam, - & ' should be increased to at least ', MinVal - WrtDim = .TRUE. - - RETURN - END - - LOGICAL FUNCTION TstBad( VarNam, RelErr ) - -c Write name (VarNam) of variable failing self-test and its -c percent error from the correct value; return 'FALSE'. - - CHARACTER*(*) VarNam - REAL RelErr - - - TstBad = .FALSE. - WRITE( *, '(/,3A,1P,E11.2,A)' ) - & ' Output variable ', VarNam,' differed by ', 100.*RelErr, - & ' per cent from correct value. Self-test failed.' - - RETURN - END - diff --git a/MAMchem_GridComp/optics/miev/MIEV.doc b/MAMchem_GridComp/optics/miev/MIEV.doc deleted file mode 100644 index a7d8a28d..00000000 --- a/MAMchem_GridComp/optics/miev/MIEV.doc +++ /dev/null @@ -1,509 +0,0 @@ - M I E V D O C U M E N T A T I O N - ------------------------------------ - -** NEWS ** Aug 1996: The 1979 NCAR Mie report, long out of print, has -been converted to electronic form and considerably edited and brought -up to date. Look for it in this directory in various forms: PostScript -(.ps) and PDF (.pdf), mainly. The PDF version is very nice if you -will take the time to get the free Adobe Acrobat Reader from the web -site http://www.adobe.com/. - -** NOTE ** The output variable SPIKE, having to do with the detection -of resonances, is still under research and will undoubtedly change in -the future. Presently, SPIKE only detects the broadest spikes, of width -roughly 0.1 in size parameter; ultimately narrower spikes should also -be detected, although the probability of hitting them is much smaller. -SPIKE is mainly of use in avoiding spikes during numerical integration -over a size distribution. - -Author: Dr. Warren J. Wiscombe (wiscombe@climate.gsfc.nasa.gov) - NASA Goddard Space Flight Center - Code 913 - Greenbelt, MD 20771 - -FTP availability: The entire package is available by anonymous ftp - from Internet site climate.gsfc.nasa.gov in subdirectory - pub/wiscombe. (ftp to 'climate', login as 'anonymous', give - your e-mail address as password, then 'cd' to pub/wiscombe.) - - -The MIEV package contains the following files (besides the present one): - -(1) MIEV0.f, the main subroutine which a user calls, plus ancillary - subroutines - -(1a) MIEV0noP.f: MIEV0.f with all the code relating to Legendre - moments PMOM removed (smaller and requires less array storage); - just created 12/89 and seems to be working fine but has not had - the benefit of years of user testing like MIEVO.f; argument - list same as MIEV0.f in order to allow swapping of this with - MIEV0.f without changing calling program(s) - -(2) ErrPack.f: a set of 4 error-handling routines needed by both - MIEV0.f and MIEV0noP.f - -(3) MVTstOld.f, the main program for running the 8 test cases at - the end of Reference (1) below (the NCAR Mie report) - -(4) MVTstOld.out, the output generated by MVTstOld.f - -(5) MVTstNew.f, the main program for running an exhaustive set of - 19 test cases. - -(6) MVTstNew.out, the output generated by MVTstNew.f; usually Unix- - compressed (.Z on end of file name) - -(7) PMOMTest.f, a program to test the Legendre coefficients computed - by MIEV0.f against those computed approximately by numerical - quadrature of the phase matrix - -Note that MIEV1, the Cray-customized version of MIEV0 described in -Ref.(1) below, is omitted from this package. It is no longer supported, -for reasons given in the new (Aug 96) version of Ref. (1) available -in electronic form. - -All subroutines and functions have some internal documentation in -addition to that in this file. Also, all the declaration statements -were standardized using the NAG Fortran Tools. - -MIEV0 computes the following quantities involved in eletromagnetic -scattering from a homogeneous sphere: - - * scattering and extinction efficiencies; - * asymmetry factor; - * forward- and backscatter amplitude; - * scattering amplitudes vs. scattering angle for incident - polarization parallel and perpendicular to the plane - of scattering; - * coefficients in the Legendre polynomial expansions of - either the unpolarized phase function or the polarized - phase matrix; - * some quantities needed in polarized radiative transfer; - * information about whether or not a resonance has been hit. - -NOTE -- MIEV0 differs from the original code published - in Ref. (1) below in the following ways : - - * computes Legendre moments, based on vast - improvements to the formulas of Sekera (see Refs. 3-5) - and correction of errors in the formulas of Ref. 3 - - * returns a measure of how nasty of a spike (resonance) you - are sitting on ( this is invaluable when integrating over - size and you want to exclude unrepresentative points); - this part of the program is a work-in-progress and - is far from finished, but it may prove useful even - in its present form - - * allows real refractive indices less than unity - - * adds a totally reflecting special case - - * performs a self-test on the first call to the routine - - * adds several new input and output variables, and makes - all I/O through arguments of the subroutine - - * allows complete freedom in specifying angles - - * allows printing of all output variables at user option - - * some variables names are more mnemonic - - Also, major improvements have been made, based on - modern ideas of documentation and program structure (e.g., - Kernighan and Plauger, The Elements of Programming Style). - Those interested in my thoughts in this area may find - PostScript documents in the anonymous ftp directory cited - above, under pub/wiscombe/Writing_Programs. - - - REFERENCES - ---------- - - (1) Wiscombe, W., 1979: Mie Scattering Calculations--Advances - in Technique And Fast, Vector-Speed Computer Codes, - Ncar Tech Note TN-140+STR, National Center For - Atmospheric Research, Boulder, Colorado (out of print - but an updated electronic version available) - - (2) Wiscombe, W., 1980: Improved Mie scattering algorithms, - Appl. Opt. 19, 1505-1509 - - (3) Dave, J.V., 1970a: Coefficients of the Legendre and - Fourier series for the scattering functions of - spherical particles, Appl. Opt. 9, 1888-1896 - - (4) Dave, J.V., 1970b: Intensity and polarization of the - radiation emerging from a plane-parallel atmosphere - containing monodisperse aerosols, Appl. Opt. 9, 2673-84 - - (5) Van De Hulst, 1957, 1982: Light Scattering by Small - Particles, Dover Press, New York. - - (6) Bohren, C. and D. Huffman, 1983: Absorption and Scattering - of Light by Small Particles, Wiley, New York. (has a - Mie program in the back of the book) - - - I N P U T V A R I A B L E S - ----------------------------- - - ( Even if an input variable is not needed for a particular - application, make sure it has a legitimate value that can - be written out and read in -- no indefinites, etc. ) - - XX Mie size parameter ( 2 * pi * radius / wavelength ) - - CREFIN Complex refractive index ( imag part can be + or -, - but internally a negative imaginary index is assumed ). - If imag part is - , scattering amplitudes as in Van - de Hulst are returned; if imag part is + , complex - conjugates of those scattering amplitudes are returned - (the latter is the convention in physics). - ** NOTE ** In the 'PERFECT' case, scattering amplitudes - in the Van de Hulst (Ref. 6 above) convention will - automatically be returned unless Im(CREFIN) is - positive; otherwise, CREFIN plays no role. - - PERFCT TRUE, assume refractive index is infinite and use - special case formulas for Mie coefficients 'a' - and 'b' ( see Kerker, M., The Scattering of - Light and Other Electromagnetic Radiation, p. 90 ). - This is sometimes called the 'totally reflecting', - sometimes the 'perfectly conducting' case. - ( see CREFIN for additional information ) - - MIMCUT (positive) value below which imaginary refractive - index is regarded as zero (computation proceeds - faster for zero imaginary index) - - ANYANG TRUE, any angles whatsoever may be input through - XMU. FALSE, the angles are monotone increasing - and mirror symmetric about 90 degrees (this option - is advantageous because the scattering amplitudes - S1,S2 for the angles between 90 and 180 degrees - are evaluable from symmetry relations, and hence - are obtained with little added computational cost.) - - NUMANG No. of angles at which scattering amplitudes - S1,S2 are to be evaluated ( set = 0 to skip - calculation of S1,S2 ). Make sure NUMANG does - not exceed the parameter MAXANG in the program. - - XMU(N) Cosines of angles ( N = 1 TO NUMANG ) at which S1,S2 - are to be evaluated. If ANYANG = FALSE, then - - (a) the angles must be monotone increasing and - mirror symmetric about 90 degrees (if 90-A is - an angle, then 90+A must be also) - - (b) if NUMANG is odd, 90 degrees must be among - the angles - - NMOM Highest Legendre moment PMOM to calculate, - numbering from zero ( NMOM = 0 prevents - calculation of PMOM ) - - IPOLZN POSITIVE, Compute Legendre moments PMOM for the - Mueller matrix elements determined by the - digits of IPOLZN, with 1 referring to M1, - 2 to M2, 3 to S21, and 4 to D21 (Ref. 3). - E.g., if IPOLZN = 14 then only moments for - M1 and D21 will be returned. - - 0, Compute Legendre moments PMOM for the - unpolarized unnormalized phase function. - - NEGATIVE, Compute Legendre moments PMOM for the - Sekera phase quantities determined by the - digits of ABS(IPOLZN), with 1 referring to - R1, 2 to R2, 3 to R3, and 4 to R4 (REF. 4). - E.g., if IPOLZN = -14 then only moments for - R1 and R4 will be returned. - - ( NOT USED IF NMOM = 0 ) - - MOMDIM Determines first dimension of PMOM, which is dimensioned - internally as PMOM( 0:MOMDIM, * ) (second dimension must - be the larger of unity and the highest digit in - IPOLZN; if not, serious errors will occur). - Must be given a value, even if NMOM = 0. Minimum: 1. - - PRT(L) Print flags (LOGICAL). L = 1 prints S1,S2, their - squared absolute values, and degree of polarization, - provided NUMANG is non-zero. L = 2 prints all - output variables other than S1,S2. - - -O U T P U T V A R I A B L E S -------------------------------- - - QEXT (REAL) extinction efficiency factor ( Ref. 2, Eq. 1A ) - - QSCA (REAL) scattering efficiency factor ( Ref. 2, Eq. 1B ) - - GQSC (REAL) asymmetry factor times scattering efficiency - ( Ref. 2, Eq. 1C ) ( allows calculation of radiation - pressure efficiency factor QPR = QEXT - GQSC ) - - ===================================================================== - ==== NOTE -- S1, S2, SFORW, SBACK, TFORW, AND TBACK are calculated - ==== internally for negative imaginary refractive index; - ==== for positive imaginary index, their complex conjugates - ==== are taken before they are returned, to correspond to - ==== customary usage in some parts of physics ( in parti- - ==== cular, in papers on CAM approximations to Mie theory ). - ===================================================================== - - S1(N), (COMPLEX) Mie scattering amplitudes at angles specified - S2(N) by XMU(N) ( N=1 to NUMANG ) ( Ref. 2, Eqs. 1d-e ). - - SFORW (COMPLEX) forward-scattering amplitude S1 at - 0 degrees. ( S2(0 deg) = S1(0 deg) ) - - SBACK (COMPLEX) backscattering amplitude S1 at - 180 degrees. ( S2(180 deg) = - S1(180 deg) ) - - TFORW(I) (COMPLEX) values of - - I=1: T1 = ( S2 - (MU)*S1 ) / ( 1 - MU**2 ) - I=2: T2 = ( S1 - (MU)*S2 ) / ( 1 - MU**2 ) - - At angle theta = 0 ( MU = COS(theta) = 1 ), where the - expressions on the right-hand side are indeterminate. - ( these quantities are required for doing polarized - radiative transfer (Ref. 4, Appendix). ) - - TBACK(I) (COMPLEX) values of T1 (for I=1) or T2 (for I=2) at - angle theta = 180 degrees ( MU = COS(theta) = - 1 ). - - SPIKE (REAL) magnitude of the smallest denominator of - either Mie coefficient (a-sub-n or b-sub-n), - taken over all terms in the Mie series past - N = size parameter XX. Values of SPIKE below - about 0.3 signify a ripple spike, since these - spikes are produced by abnormally small denominators - in the Mie coefficients (normal denominators are of - order unity or higher). Defaults to 1.0 when not - on a spike. Does not identify all resonances - (we are still working on that). - - PMOM(M,NP) (REAL) moments M = 0 to NMOM of unnormalized NP-th - phase quantity PQ ( moments with M .GT. 2*NTRM are - zero, where NTRM = no. terms in Mie series = - XX + 4*XX**1/3 + 1 ) : - - PQ( MU, NP ) = sum( M=0 to infinity ) ( (2M+1) - * PMOM( M,NP ) * P-sub-M( MU ) ) - - WHERE MU = COS( scattering angle ) - P-sub-M = M-th Legendre polynomial - - and the definition of 'PQ' is as follows: - - IPOLZN.GT.0: PQ(MU,1) = CABS( S1(MU) )**2 - PQ(MU,2) = CABS( S2(MU) )**2 - PQ(MU,3) = RE( S1(MU)*CONJG( S2(MU) ) ) - PQ(MU,4) = - IM( S1(MU)*CONJG( S2(MU) ) ) - ( called M1, M2, S21, D21 in literature ) - - IPOLZN=0: PQ(MU,1) = ( CABS(S1)**2 + CABS(S2)**2 ) / 2 - ( the unnormalized phase function ) - - IPOLZN.LT.0: PQ(MU,1) = CABS( T1(MU) )**2 - PQ(MU,2) = CABS( T2(MU) )**2 - PQ(MU,3) = RE( T1(MU)*CONJG( T2(MU) ) ) - PQ(MU,4) = - IM( T1(MU)*CONJG( T2(MU) ) ) - ( called R1, R2, R3, R4 in literature ) - - The sign of the 4th phase quantity is a source of - confusion. It flips if the complex conjugates of - S1,S2 or T1,T2 are used, as occurs when a - refractive index with positive imaginary part is - used (see discussion below). The definition above - is consistent with a negative imaginary part. - - See Ref. 5 for correct formulae for PMOM ( Eqs. 2-5 - of Ref. 3 contain typographical errors ). Ref. 5 also - contains numerous improvements to the Ref. 3 formulas. - - NOTE THAT OUR DEFINITION OF MOMENTS DIFFERS FROM REF. 3 - in that we divide out the factor (2M+1) and number the - moments from zero instead of one. - - ** WARNING ** Make sure the second dimension of PMOM - in the calling program is at least as large as the - absolute value of IPOLZN. - - For small enough values of XX, or large enough values - of M, PMOM will tend to underflow. Thus, it is - unwise to assume the values returned are non-zero and, - for example, to divide some quantity by them. - - - INTEGRATING OVER SIZES - ---------------------- - - The normalized phase function for a single size parameter is - - P(one size) = 4 / ( XX**2 * QSCA ) * ( i1 + i2 ) / 2 - - where i1 + i2 = CABS(S1)**2 + CABS(S2)**2. But it is - ( i1 + i2 ), not P(one size), that must be integrated - over sizes when a size distribution is involved. - (Physically, this means that intensities are added, - not probabilities. ) An a posteriori normalization - then gives the correct size-averaged phase function. - - Similarly, it is the CROSS-SECTIONS, proportional to - XX**2 times QEXT,QSCA,QPR, which should be integrated - over sizes, not QEXT,QSCA,QPR themselves. - - Similar remarks apply to PMOM. The normalized moments are - 4 / ( XX**2 * QSCA ) * PMOM, but it is PMOM itself, not - these normalized moments, which should be integrated over - a size distribution. - - Unless avoided, ripple spikes can cause a systematic upward - bias in any integration over size parameter, because these - spikes tend to be smeared out by typical quadrature rules and - thus over-represented in the final result. Checking the output - parameter SPIKE allows the user to filter out these cases. - - - NOTES ON PROGRAM USE - -------------------- - - *** PMOM dimensioning: - - One user dimensioned PMOM(1,1) in his calling program and - managed to clobber SFORW because he set MOMDIM=1 and - internally PMOM is dimensioned PMOM( 0:MOMDIM, * ). - Fortran seems to allow PMOM(0:0,*) so he could have - saved himself by setting MOMDIM=0, but this is confusing - and it is better to start your PMOM array at 0 just as - the program does internally. - - Be sure to use the test problem drivers as templates - when designing your calls to MIEV0 in order to avoid this - kind of problem. - - *** ON PORTABILITY : - - This package is written entirely in ANSI standard FORTRAN 77 - and should work on any computer. - - *** ON PRECISION : - - "You should be aware that a complex program can produce - different results on one computer than another because of - differences in internal precision. The difference can be - minimized, but not necessarily eliminated, by using double- - precision arithmetic and by using numerical methods that tend - to retain maximum precision." - (IBM Professional FORTRAN Manual) - - This package was developed on computers offering 14-digit - single-precision computation. On IBM-type machines with their - 7-digit single precision, parts of the computation ( like the - upward recurrence for the Ricatti-Bessel functions ) might need - to be done in double precision, depending on how big the Mie - size paramter XX is. See Ref. (1) for further discussion - of this point. - - The package has only been tested for XX up to 20,000 and - for real and imaginary part of CREFIN up to 10 ( this - accomodates almost all imaginable applications ). Slow - deterioration of accuracy may be expected if the program - is pushed beyond these limits. ( Accuracy may degrade well - before XX = 20000 with IBM-type 7-digit precision. ) - - Precision problems are most likely to OVERTLY afflict - users - - (a) in the self-test subroutine TESTMI, where it may be - necessary to lower the required agreement with tabulated - results by changing the variable ACCUR. For example, - to run on the IBM PC in single precision using 'IBM - Professional FORTRAN', a value ACCUR = 1.E-4 was - necessary. - - (b) in the testing routines MVTst..., where the user's - precision may be unsatisfactory for numerically - 'sensitive' quantities. - - The quantities most sensitive to precision are those involving - series of positive and negative terms with much cancellation. - The smaller the end result of summing compared to the average - term size, the worse the problem. The problem can occur - in either of the scattering amplitudes (S1,S2) away from the - forward scattering angle, esp. near a relative minimum. When - the real and imaginary parts of S1 or S2 differ by - orders of magnitude, the smaller part is likely to be less - accurate than the larger. - - The least accurate output quantities will be : - - ** TFORW and TBACK, because the numerical factors - involved are on the order of XX**3 - - ** PMOM( M, 4 ) for any M and larger XX - - ** PMOM( M, NP ) for M approaching 2*XX - - The most accurate will be QEXT, QSCA, GQSC, being sums - of all positive terms. - - Please do not call the author about precision problems. - They are endemic and cannot be solved as long as different - computers do arithmetic differently. - - - *** ON MEMORY REQUIREMENTS : - - The parameter MaxTrm in MIEV0, LPCOEF must be - set to 10,100 in order to do the test problems with - size parameter = 10,000. Memory used by these routines can - be significantly, often dramatically, reduced by lowering - MaxTrm to a value no bigger than XMAX + 4*XMAX**1/3, - where XMAX is the largest size parameter expected. - - If PMOM is never needed, the version MIEV0noP.f should - be used instead of MIEV0.f. This can substantially cut memory - requirements. - - - *** The self-test on the first call to the program is a novel - feature intended to catch bugs which users may introduce into - the code. But it does not begin to test all the possible - branches in the code. The test programs included with - this package should be used for thorough checkout of all - branches. - - *** The arithmetic statement function F3 is built into - MIEV0, but not used. It corresponds to the function - f-sub-3 in Ref. 2, Eq. 8, and should be used instead - of F2 when only intensity and degree of polarization - are required. This can be implemented just by - changing F2 to F3 in a single executable statement. - - *** To avoid littering up the code with temporary variables, - a reasonably optimizing compiler (one that recognizes - invariant and repeated sub-expressions in DO-loops) - has been assumed. This may make the code look wasteful - to those accustomed to dumb FORTRAN compilers. - - *** Equivalenced arrays have been used in one place (module - LPCOEF). (EQUIVALENCE is a dangerous feature of FORTRAN - and should generally be avoided.) - - *** MIEV0 sacrifices some computational speed on vector computers - in order to use the minimum possible amount of computer - memory; however, it still allows loops over scattering - angle to vectorize; and on vector computers which vectorize - summing loops ( like the Cray ), the potentially - time-consuming inner loops in the Legendre coefficient - subroutine will also vectorize ( these two kinds of loops - account for the lion's share of computing time in a typical - application ). diff --git a/MAMchem_GridComp/optics/miev/MIEV0.F b/MAMchem_GridComp/optics/miev/MIEV0.F deleted file mode 100644 index d3808a55..00000000 --- a/MAMchem_GridComp/optics/miev/MIEV0.F +++ /dev/null @@ -1,2291 +0,0 @@ - - SUBROUTINE MIEV0( XX, CREFIN, PERFCT, MIMCUT, ANYANG, NUMANG, XMU, - & NMOM, IPOLZN, MOMDIM, PRNT, QEXT, QSCA, GQSC, - & PMOM, SFORW, SBACK, S1, S2, TFORW, TBACK, - & SPIKE ) - -c Computes Mie scattering and extinction efficiencies; asymmetry -c factor; forward- and backscatter amplitude; scattering -c amplitudes vs. scattering angle for incident polarization parallel -c and perpendicular to the plane of scattering; -c coefficients in the Legendre polynomial expansions of either the -c unpolarized phase function or the polarized phase matrix; -c some quantities needed in polarized radiative transfer; and -c information about whether or not a resonance has been hit. - -c Input and output variables are described in file MIEV.doc. -c Many statements are accompanied by comments referring to -c references in MIEV.doc, notably the NCAR Mie report which is now -c available electronically and which is referred to using the -c shorthand (Rn), meaning Eq. (n) of the report. - -c CALLING TREE: - -c MIEV0 -c TESTMI -c TSTBAD -c MIPRNT -c ERRMSG -c CKINMI -c WRTBAD -c WRTDIM -c ERRMSG -c SMALL1 -c SMALL2 -c ERRMSG -c BIGA -c CONFRA -c ERRMSG -c LPCOEF -c LPCO1T -c LPCO2T -c ERRMSG -c MIPRNT - - -c I N T E R N A L V A R I A B L E S -c ----------------------------------- - -c AN,BN Mie coefficients a-sub-n, b-sub-n ( Ref. 1, Eq. 16 ) - -c ANM1,BNM1 Mie coefficients a-sub-(n-1), -c b-sub-(n-1); used in GQSC sum - -c ANP Coeffs. in S+ expansion ( Ref. 2, p. 1507 ) -c BNP Coeffs. in S- expansion ( Ref. 2, p. 1507 ) -c ANPM Coeffs. in S+ expansion ( Ref. 2, p. 1507 ) -c when MU is replaced by - MU -c BNPM Coeffs. in S- expansion ( Ref. 2, p. 1507 ) -c when MU is replaced by - MU - -c CALCMO(K) TRUE, calculate moments for K-th phase quantity -c (derived from IPOLZN) - -c CBIGA(N) Bessel function ratio A-sub-N (Ref. 2, Eq. 2) -c ( COMPLEX version ) - -c CDENAN, (COMPLEX) denominators of An,Bn -c CDENBN - -c CIOR Complex index of refraction with negative -c imaginary part (Van de Hulst convention) -c CIORIV 1 / cIoR - -c COEFF ( 2N + 1 ) / ( N ( N + 1 ) ) - -c CSUM1,2 temporary sum variables for TFORW, TBACK - -c FN Floating point version of loop index for -c Mie series summation - -c LITA,LITB(N) Mie coefficients An, Bn, saved in arrays for -c use in calculating Legendre moments PMOM - -c MAXTRM Max. possible no. of terms in Mie series - -c MM (-1)^(n+1), where n is Mie series sum index - -c MIM Magnitude of imaginary refractive index -c MRE Real part of refractive index - -c MAXANG Max. possible value of input variable NUMANG -c NANGD2 (NUMANG+1)/2 ( no. of angles in 0-90 deg; ANYANG=F ) - -c NOABS TRUE, sphere non-absorbing (determined by MIMCUT) - -c NP1DN ( N + 1 ) / N - -c NPQUAN Highest-numbered phase quantity for which moments are -c to be calculated (the largest digit in IPOLZN -c if IPOLZN .NE. 0) - -c NTRM No. of terms in Mie series - -c PASS1 TRUE on first entry, FALSE thereafter; for self-test - -c PIN(J) Angular function pi-sub-n ( Ref. 2, Eq. 3 ) -c at J-th angle -c PINM1(J) pi-sub-(n-1) ( see PIn ) at J-th angle - -c PSINM1 Ricatti-Bessel function psi-sub-(n-1), argument XX -c PSIN Ricatti-Bessel function psi-sub-n of argument XX -c ( Ref. 1, p. 11 ff. ) - -c RBIGA(N) Bessel function ratio A-sub-N (Ref. 2, Eq. 2) -c ( REAL version, for when imag refrac index = 0 ) - -c RIORIV 1 / Mre - -c RN 1 / N - -c RTMP (REAL) temporary variable - -c SP(J) S+ for J-th angle ( Ref. 2, p. 1507 ) -c SM(J) S- for J-TH angle ( Ref. 2, p. 1507 ) -c SPS(J) S+ for (NUMANG+1-J)-th angle ( ANYANG=FALSE ) -c SMS(J) S- for (NUMANG+1-J)-th angle ( ANYANG=FALSE ) - -c TAUN Angular function tau-sub-n ( Ref. 2, Eq. 4 ) -c at J-th angle - -c TCOEF N ( N+1 ) ( 2N+1 ) (for summing TFORW,TBACK series) - -c TWONP1 2N + 1 - -c YESANG TRUE if scattering amplitudes are to be calculated - -c ZETNM1 Ricatti-Bessel function zeta-sub-(n-1) of argument -c XX ( Ref. 2, Eq. 17 ) -c ZETN Ricatti-Bessel function zeta-sub-n of argument XX -c ---------------------------------------------------------------------- - - - IMPLICIT NONE - -c ---------------------------------------------------------------------- -c -------- I / O SPECIFICATIONS FOR SUBROUTINE MIEV0 ----------------- -c ---------------------------------------------------------------------- - LOGICAL ANYANG, PERFCT, PRNT(*) - INTEGER IPOLZN, MOMDIM, NUMANG, NMOM - REAL GQSC, MIMCUT, PMOM( 0:MOMDIM, * ), QEXT, QSCA, SPIKE, - & XMU(*), XX - COMPLEX CREFIN, SFORW, SBACK, S1(*), S2(*), TFORW(*), TBACK(*) -c ---------------------------------------------------------------------- - -c ** NOTE -- MAXTRM = 10100 is neces- -c ** sary to do some of the test probs, -c ** but 1100 is sufficient for most -c ** conceivable applications -c .. Parameters .. - - INTEGER MAXANG, MXANG2 - PARAMETER ( MAXANG = 1801, MXANG2 = MAXANG / 2 + 1 ) - INTEGER MAXTRM - PARAMETER ( MAXTRM = 20000 ) - REAL ONETHR - PARAMETER ( ONETHR = 1. / 3. ) -c .. -c .. Local Scalars .. - - LOGICAL NOABS, PASS1, YESANG - INTEGER I, J, N, NANGD2, NPQUAN, NTRM - REAL CHIN, CHINM1, COEFF, DENAN, DENBN, FN, MIM, MM, MRE, - & NP1DN, PSIN, PSINM1, RATIO, RIORIV, RN, RTMP, TAUN, - & TCOEF, TWONP1, XINV - COMPLEX AN, ANM1, ANP, ANPM, BN, BNM1, BNP, BNPM, CDENAN, - & CDENBN, CIOR, CIORIV, CSUM1, CSUM2, CTMP, ZET, - & ZETN, ZETNM1 -c .. -c .. Local Arrays .. - - LOGICAL CALCMO( 4 ) - REAL PIN( MAXANG ), PINM1( MAXANG ), RBIGA( MAXTRM ) - COMPLEX CBIGA( MAXTRM ), LITA( MAXTRM ), LITB( MAXTRM ), - & SM( MAXANG ), SMS( MXANG2 ), SP( MAXANG ), SPS( MXANG2 ) -c .. -c .. External Subroutines .. - - EXTERNAL BIGA, CKINMI, ERRMSG, LPCOEF, MIPRNT, SMALL1, SMALL2, - & TESTMI -c .. -c .. Intrinsic Functions .. - - INTRINSIC ABS, AIMAG, CMPLX, CONJG, COS, MAX, MIN, REAL, SIN -c .. - SAVE PASS1 - -c .. Statement Functions .. - - REAL SQ -c .. -c .. Statement Function definitions .. - - SQ( CTMP ) = REAL( CTMP )**2 + AIMAG( CTMP )**2 -c .. -#ifndef _OPENMP - DATA PASS1 / .TRUE. / -#else - DATA PASS1 / .FALSE. / -#endif - - -c ** Save some input variables and replace them -c ** with values needed to do the self-test - - IF( PASS1 ) CALL TESTMI( .FALSE., XX, CREFIN, MIMCUT, PERFCT, - & ANYANG, NMOM, IPOLZN, NUMANG, XMU, QEXT, - & QSCA, GQSC, SFORW, SBACK, S1, S2, TFORW, - & TBACK, PMOM, MOMDIM ) - - 10 CONTINUE -c ** Check input and calculate -c ** certain variables from input - - CALL CKINMI( NUMANG, MAXANG, XX, PERFCT, CREFIN, MOMDIM, NMOM, - & IPOLZN, ANYANG, XMU, CALCMO, NPQUAN ) - - - IF( PERFCT .AND. XX.LE.0.1 ) THEN -c ** Use totally-reflecting -c ** small-particle limit - - CALL SMALL1( XX, NUMANG, XMU, QEXT, QSCA, GQSC, SFORW, SBACK, - & S1, S2, TFORW, TBACK, LITA, LITB ) - - NTRM = 2 - GO TO 100 - - END IF - - - NOABS = .TRUE. - - IF( .NOT.PERFCT ) THEN - - CIOR = CREFIN - - IF( AIMAG(CIOR).GT.0.0 ) CIOR = CONJG( CIOR ) - - MRE = REAL( CIOR ) - MIM = -AIMAG( CIOR ) - NOABS = MIM.LE.MIMCUT - CIORIV = 1.0 / CIOR - RIORIV = 1.0 / MRE - - IF( XX*MAX( 1.0, ABS(CIOR) ).LE.0.1 ) THEN - -c ** Use general-refractive-index -c ** small-particle limit - - CALL SMALL2( XX, CIOR, MIM.GT.MIMCUT, NUMANG, XMU, QEXT, - & QSCA, GQSC, SFORW, SBACK, S1, S2, TFORW, - & TBACK, LITA, LITB ) - - NTRM = 2 - GO TO 100 - - END IF - - END IF - - - NANGD2 = ( NUMANG + 1 ) / 2 - YESANG = NUMANG.GT.0 - -c ** Number of terms in Mie series; Eq R50 - IF( XX.LE.8.0 ) THEN - - NTRM = XX + 4.*XX**ONETHR + 1. - - ELSE IF( XX.LT.4200. ) THEN - - NTRM = XX + 4.05*XX**ONETHR + 2. - - ELSE - - NTRM = XX + 4.*XX**ONETHR + 2. - - END IF - - IF( NTRM+1 .GT. MAXTRM ) - & CALL ERRMSG('MIEV0--PARAMETER MaxTrm TOO SMALL',.TRUE.) - -c ** Calculate logarithmic derivatives of -c ** J-Bessel-fcn., A-sub-(1 to NTrm) - - IF( .NOT.PERFCT ) CALL BIGA( CIOR, XX, NTRM, NOABS, YESANG, RBIGA, - & CBIGA ) - -c ** Initialize Ricatti-Bessel functions -c ** (psi,chi,zeta)-sub-(0,1) for upward -c ** recurrence ( Eq. R19 ) - XINV = 1.0 / XX - PSINM1 = SIN( XX ) - CHINM1 = COS( XX ) - PSIN = PSINM1*XINV - CHINM1 - CHIN = CHINM1*XINV + PSINM1 - ZETNM1 = CMPLX( PSINM1, CHINM1 ) - ZETN = CMPLX( PSIN, CHIN ) -c ** Initialize previous coeffi- -c ** cients for GQSC series - ANM1 = ( 0.0, 0.0 ) - BNM1 = ( 0.0, 0.0 ) -c ** Initialize angular function pi -c ** and sums for S+, S- ( Ref. 2, p. 1507 ) - IF( ANYANG ) THEN - - DO 20 J = 1, NUMANG -c ** Eq. R39 - PINM1( J ) = 0.0 - PIN( J ) = 1.0 - - SP( J ) = ( 0.0, 0.0 ) - SM( J ) = ( 0.0, 0.0 ) - 20 CONTINUE - - ELSE - - DO 30 J = 1, NANGD2 -c ** Eq. R39 - PINM1( J ) = 0.0 - PIN( J ) = 1.0 - - SP( J ) = ( 0.0, 0.0 ) - SM( J ) = ( 0.0, 0.0 ) - SPS( J ) = ( 0.0, 0.0 ) - SMS( J ) = ( 0.0, 0.0 ) - 30 CONTINUE - - END IF - -c ** Initialize Mie sums for efficiencies, etc. - QSCA = 0.0 - GQSC = 0.0 - SFORW = ( 0., 0. ) - SBACK = ( 0., 0. ) - CSUM1 = ( 0., 0. ) - CSUM2 = ( 0., 0. ) - - -c --------- LOOP TO SUM MIE SERIES ----------------------------------- - - MM = +1.0 - SPIKE = 1.0 - - DO 60 N = 1, NTRM -c ** Compute various numerical coefficients - FN = N - RN = 1.0 / FN - NP1DN = 1.0 + RN - TWONP1 = 2*N + 1 - COEFF = TWONP1 / ( FN * ( N + 1 ) ) - TCOEF = TWONP1 * ( FN * ( N + 1 ) ) - -c ** Calculate Mie series coefficients - IF( PERFCT ) THEN -c ** Totally-reflecting case; Eq R/A.1,2 - - AN = ( ( FN*XINV )*PSIN - PSINM1 ) / - & ( ( FN*XINV )*ZETN - ZETNM1 ) - BN = PSIN / ZETN - - ELSE IF( NOABS ) THEN -c ** No-absorption case; Eq (R16) - - CDENAN = ( RIORIV*RBIGA(N) + ( FN*XINV ) ) * ZETN - ZETNM1 - AN = ( ( RIORIV*RBIGA(N) + ( FN*XINV ) ) * PSIN - PSINM1 ) - & / CDENAN - CDENBN = ( MRE*RBIGA(N) + ( FN*XINV ) ) * ZETN - ZETNM1 - BN = ( ( MRE*RBIGA(N) + ( FN*XINV ) ) * PSIN - PSINM1 ) - & / CDENBN - - ELSE -c ** Absorptive case; Eq (R16) - - CDENAN = ( CIORIV*CBIGA( N ) + ( FN*XINV ) )*ZETN - ZETNM1 - CDENBN = ( CIOR*CBIGA( N ) + ( FN*XINV ) )*ZETN - ZETNM1 - AN = ( ( CIORIV*CBIGA( N ) + ( FN*XINV ) )*PSIN - PSINM1 ) - & / CDENAN - BN = ( ( CIOR*CBIGA( N ) + ( FN*XINV ) )*PSIN - PSINM1 ) - & / CDENBN -c ** Eq (R7) - - QSCA = QSCA + TWONP1*( SQ( AN ) + SQ( BN ) ) - - END IF -c ** Save Mie coefficients for PMOM calculation - - LITA( N ) = AN - LITB( N ) = BN - - - IF( .NOT.PERFCT .AND. N.GT.XX ) THEN -c ** Flag resonance spikes - DENAN = ABS( CDENAN ) - DENBN = ABS( CDENBN ) -c ** Eq. R/B.9 - RATIO = DENAN / DENBN -c ** Eq. R/B.10 - IF( RATIO.LE.0.2 .OR. RATIO.GE.5.0 ) - & SPIKE = MIN( SPIKE, DENAN, DENBN ) - - END IF -c ** Increment Mie sums for non-angle- -c ** dependent quantities - -c ** Eq. R/B.2 - SFORW = SFORW + TWONP1*( AN + BN ) -c ** Eq. R/B.5,6 - CSUM1 = CSUM1 + TCOEF *( AN - BN ) -c ** Eq. R/B.1 - SBACK = SBACK + ( MM*TWONP1 )*( AN - BN ) -c ** Eq. R/B.7,8 - CSUM2 = CSUM2 + ( MM*TCOEF ) *( AN + BN ) - -c ** Eq (R8) - - GQSC = GQSC + ( FN - RN ) * REAL( ANM1 * CONJG( AN ) + - & BNM1 * CONJG( BN ) ) - & + COEFF * REAL( AN * CONJG( BN ) ) - - - IF( YESANG ) THEN -c ** Put Mie coefficients in form -c ** needed for computing S+, S- -c ** ( Eq R10 ) - ANP = COEFF*( AN + BN ) - BNP = COEFF*( AN - BN ) - -c ** Increment Mie sums for S+, S- -c ** while upward recursing -c ** angular functions pi and tau - IF( ANYANG ) THEN -c ** Arbitrary angles - -c ** vectorizable loop - DO 40 J = 1, NUMANG -c ** Eq. (R37b) - - RTMP = ( XMU(J) * PIN(J) ) - PINM1( J ) - -c ** Eq. (R38b) - TAUN = FN * RTMP - PINM1( J ) - -c ** Eq (R10) - - SP( J ) = SP( J ) + ANP * ( PIN( J ) + TAUN ) - SM( J ) = SM( J ) + BNP * ( PIN( J ) - TAUN ) - - PINM1( J ) = PIN( J ) -c ** Eq. R37c - - PIN( J ) = ( XMU( J ) * PIN( J ) ) + NP1DN * RTMP - 40 CONTINUE - - ELSE -c ** Angles symmetric about 90 degrees - ANPM = MM*ANP - BNPM = MM*BNP -c ** vectorizable loop - DO 50 J = 1, NANGD2 -c ** Eq. (R37b) - - RTMP = ( XMU(J) * PIN(J) ) - PINM1( J ) - -c ** Eq. (R38b) - TAUN = FN * RTMP - PINM1( J ) - -c ** Eq (R10,12) - - SP ( J ) = SP ( J ) + ANP * ( PIN( J ) + TAUN ) - SMS( J ) = SMS( J ) + BNPM *( PIN( J ) + TAUN ) - SM ( J ) = SM ( J ) + BNP * ( PIN( J ) - TAUN ) - SPS( J ) = SPS( J ) + ANPM *( PIN( J ) - TAUN ) - - PINM1( J ) = PIN( J ) -c ** Eq. R37c - - PIN( J ) = ( XMU(J) * PIN(J) ) + NP1DN * RTMP - 50 CONTINUE - - END IF - - END IF -c ** Update relevant quantities for next -c ** pass through loop - MM = - MM - ANM1 = AN - BNM1 = BN -c ** Upward recurrence for Ricatti-Bessel -c ** functions ( Eq. R17 ) - - ZET = ( TWONP1*XINV ) * ZETN - ZETNM1 - ZETNM1 = ZETN - ZETN = ZET - PSINM1 = PSIN - PSIN = REAL( ZETN ) - - 60 CONTINUE - -c ---------- END LOOP TO SUM MIE SERIES -------------------------------- - - -c ** Eq (R6) - QEXT = 2. / XX**2*REAL( SFORW ) - - IF( PERFCT .OR. NOABS ) THEN - - QSCA = QEXT - - ELSE - - QSCA = 2./ XX**2 * QSCA - - END IF - - GQSC = 4./ XX**2 * GQSC - SFORW = 0.5*SFORW - SBACK = 0.5*SBACK - TFORW( 1 ) = 0.5*SFORW - 0.125*CSUM1 - TFORW( 2 ) = 0.5*SFORW + 0.125*CSUM1 - TBACK( 1 ) = -0.5*SBACK + 0.125*CSUM2 - TBACK( 2 ) = 0.5*SBACK + 0.125*CSUM2 - - - IF( YESANG ) THEN -c ** Recover scattering amplitudes -c ** from S+, S- ( Eq (R11) ) - - IF( ANYANG ) THEN -c ** vectorizable loop - DO 70 J = 1, NUMANG -c ** Eq (R11) - S1( J ) = 0.5*( SP( J ) + SM( J ) ) - S2( J ) = 0.5*( SP( J ) - SM( J ) ) - 70 CONTINUE - - ELSE -c ** vectorizable loop - DO 80 J = 1, NANGD2 -c ** Eq (R11) - S1( J ) = 0.5*( SP( J ) + SM( J ) ) - S2( J ) = 0.5*( SP( J ) - SM( J ) ) - 80 CONTINUE -c ** vectorizable loop - DO 90 J = 1, NANGD2 - S1( NUMANG + 1 - J ) = 0.5*( SPS( J ) + SMS( J ) ) - S2( NUMANG + 1 - J ) = 0.5*( SPS( J ) - SMS( J ) ) - 90 CONTINUE - - END IF - - END IF -c ** Calculate Legendre moments - - 100 CONTINUE - IF( NMOM.GT.0 ) CALL LPCOEF( NTRM, NMOM, IPOLZN, MOMDIM, CALCMO, - & NPQUAN, LITA, LITB, PMOM ) - - - IF( AIMAG( CREFIN ).GT.0.0 ) THEN -c ** Take complex conjugates -c ** of scattering amplitudes - - SFORW = CONJG( SFORW ) - SBACK = CONJG( SBACK ) - - DO 110 I = 1, 2 - TFORW( I ) = CONJG( TFORW( I ) ) - TBACK( I ) = CONJG( TBACK( I ) ) - 110 CONTINUE - - DO 120 J = 1, NUMANG - S1( J ) = CONJG( S1( J ) ) - S2( J ) = CONJG( S2( J ) ) - 120 CONTINUE - - END IF - - - IF( PASS1 ) THEN -c ** Compare test case results with -c ** correct answers and abort if bad; -c ** otherwise restore user input and proceed - - CALL TESTMI( .TRUE., XX, CREFIN, MIMCUT, PERFCT, ANYANG, NMOM, - & IPOLZN, NUMANG, XMU, QEXT, QSCA, GQSC, SFORW, - & SBACK, S1, S2, TFORW, TBACK, PMOM, MOMDIM ) - - PASS1 = .FALSE. - GO TO 10 - - END IF - - - IF( PRNT( 1 ) .OR. PRNT( 2 ) ) - & CALL MIPRNT( PRNT, XX, PERFCT, CREFIN, NUMANG, XMU, QEXT, - & QSCA, GQSC, NMOM, IPOLZN, MOMDIM, CALCMO, PMOM, - & SFORW, SBACK, TFORW, TBACK, S1, S2 ) - - RETURN - - END - - SUBROUTINE CKINMI( NUMANG, MAXANG, XX, PERFCT, CREFIN, MOMDIM, - & NMOM, IPOLZN, ANYANG, XMU, CALCMO, NPQUAN ) - -c Check for bad input to MIEV0 and calculate CALCMO, NPQUAN - -c Routines called : ERRMSG, WRTBAD, WRTDIM - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - LOGICAL ANYANG, PERFCT - INTEGER IPOLZN, MAXANG, MOMDIM, NMOM, NPQUAN, NUMANG - REAL XX - COMPLEX CREFIN -c .. -c .. Array Arguments .. - - LOGICAL CALCMO( * ) - REAL XMU( * ) -c .. -c .. Local Scalars .. - - CHARACTER STRING*4 - LOGICAL INPERR - INTEGER I, IP, J, L -c .. -c .. External Functions .. - - LOGICAL WRTBAD, WRTDIM - EXTERNAL WRTBAD, WRTDIM -c .. -c .. External Subroutines .. - - EXTERNAL ERRMSG -c .. -c .. Intrinsic Functions .. - - INTRINSIC ABS, AIMAG, ICHAR, MAX, REAL -c .. - - - INPERR = .FALSE. - - IF( NUMANG.GT.MAXANG ) INPERR = WRTDIM( 'MaxAng', NUMANG ) - IF( NUMANG.LT.0 ) INPERR = WRTBAD( 'NUMANG' ) - - IF( XX.LT.0. ) INPERR = WRTBAD( 'XX' ) - - IF( .NOT.PERFCT .AND. REAL( CREFIN ).LE.0. ) - & INPERR = WRTBAD( 'CREFIN' ) - - IF( MOMDIM.LT.0 ) INPERR = WRTBAD( 'MOMDIM' ) - - - IF( NMOM.NE.0 ) THEN - - IF( NMOM.LT.0 .OR. NMOM.GT.MOMDIM ) INPERR = WRTBAD( 'NMOM' ) - - IF( ABS( IPOLZN ).GT.4444 ) INPERR = WRTBAD( 'IPOLZN' ) - - NPQUAN = 0 - - DO 10 L = 1, 4 - CALCMO( L ) = .FALSE. - 10 CONTINUE - - IF( IPOLZN.NE.0 ) THEN -c ** Parse out IPOLZN into its digits -c ** to find which phase quantities are -c ** to have their moments calculated - - WRITE( STRING, '(I4)' ) ABS( IPOLZN ) - - DO 20 J = 1, 4 - IP = ICHAR( STRING( J:J ) ) - ICHAR( '0' ) - - IF( IP.GE.1 .AND. IP.LE.4 ) CALCMO( IP ) = .TRUE. - - IF( IP.EQ.0 .OR. ( IP.GE.5 .AND. IP.LE.9 ) ) - & INPERR = WRTBAD( 'IPOLZN' ) - - NPQUAN = MAX( NPQUAN, IP ) - 20 CONTINUE - - END IF - - END IF - - - IF( ANYANG ) THEN -c ** Allow for slight imperfections in -c ** computation of cosine - DO 30 I = 1, NUMANG - - IF( XMU( I ).LT.-1.00001 .OR. XMU( I ).GT.1.00001 ) - & INPERR = WRTBAD( 'XMU' ) - - 30 CONTINUE - - ELSE - - DO 40 I = 1, ( NUMANG + 1 ) / 2 - - IF( XMU( I ).LT.-0.00001 .OR. XMU( I ).GT.1.00001 ) - & INPERR = WRTBAD( 'XMU' ) - - 40 CONTINUE - - END IF - - - IF( INPERR ) CALL ERRMSG( 'MIEV0--Input error(S). Aborting...', - & .TRUE. ) - - IF( XX.GT.20000.0 .OR. REAL( CREFIN ).GT.10.0 .OR. - & ABS( AIMAG( CREFIN ) ).GT.10.0 ) - & CALL ERRMSG( 'MIEV0--XX or CREFIN outside tested range', - & .FALSE.) - - RETURN - END - - SUBROUTINE LPCOEF( NTRM, NMOM, IPOLZN, MOMDIM, CALCMO, NPQUAN, A, - & B, PMOM ) - -c Calculate Legendre polynomial expansion coefficients (also -c called moments) for phase quantities ( Ref. 5 formulation ) - -c INPUT: NTRM Number terms in Mie series -c NMOM, IPOLZN, MOMDIM MIEV0 arguments -c CALCMO Flags calculated from IPOLZN -c NPQUAN Defined in MIEV0 -c A, B Mie series coefficients - -c OUTPUT: PMOM Legendre moments (MIEV0 argument) - -c Routines called : ERRMSG, LPCO1T, LPCO2T - -c *** NOTES *** - -c (1) Eqs. 2-5 are in error in Dave, Appl. Opt. 9, -c 1888 (1970). Eq. 2 refers to M1, not M2; eq. 3 refers to -c M2, not M1. In eqs. 4 and 5, the subscripts on the second -c term in square brackets should be interchanged. - -c (2) The general-case logic in this subroutine works correctly -c in the two-term Mie series case, but subroutine LPCO2T -c is called instead, for speed. - -c (3) Subroutine LPCO1T, to do the one-term case, is never -c called within the context of MIEV0, but is included for -c complete generality. - -c (4) Some improvement in speed is obtainable by combining the -c 310- and 410-loops, if moments for both the third and fourth -c phase quantities are desired, because the third phase quantity -c is the real part of a complex series, while the fourth phase -c quantity is the imaginary part of that very same series. But -c most users are not interested in the fourth phase quantity, -c which is related to circular polarization, so the present -c scheme is usually more efficient. - - -c ** Definitions of local variables *** - -c AM(M) Numerical coefficients a-sub-m-super-l -c in Dave, Eqs. 1-15, as simplified in Ref. 5. - -c BI(I) Numerical coefficients b-sub-i-super-l -c in Dave, Eqs. 1-15, as simplified in Ref. 5. - -c BIDEL(I) 1/2 Bi(I) times factor capital-del in Dave - -c CM,DM() Arrays C and D in Dave, Eqs. 16-17 (Mueller form), -c calculated using recurrence derived in Ref. 5 - -c CS,DS() Arrays C and D in Ref. 4, Eqs. A5-A6 (Sekera form), -c calculated using recurrence derived in Ref. 5 - -c C,D() Either CM,DM or CS,DS, depending on IPOLZN - -c EVENL True for even-numbered moments; false otherwise - -c IDEL 1 + little-del in Dave - -c MAXTRM Max. no. of terms in Mie series - -c MAXMOM Max. no. of non-zero moments - -c NUMMOM Number of non-zero moments - -c RECIP(K) 1 / K - - - IMPLICIT NONE - -c .. Parameters .. - - INTEGER MAXTRM, MAXMOM, MXMOM2, MAXRCP - PARAMETER ( MAXTRM = 20000, MAXMOM = 2*MAXTRM, MXMOM2 = MAXMOM/2, - & MAXRCP = 4*MAXTRM + 2 ) -c .. -c .. Scalar Arguments .. - - INTEGER IPOLZN, MOMDIM, NMOM, NPQUAN, NTRM -c .. -c .. Array Arguments .. - - LOGICAL CALCMO( * ) - REAL PMOM( 0:MOMDIM, * ) - COMPLEX A( * ), B( * ) -c .. -c .. Local Scalars .. - - LOGICAL EVENL, PASS1 - INTEGER I, IDEL, IMAX, J, K, L, LD2, M, MMAX, NUMMOM - REAL SUM -c .. -c .. Local Arrays .. - - REAL AM( 0:MAXTRM ), BI( 0:MXMOM2 ), BIDEL( 0:MXMOM2 ), - & RECIP( MAXRCP ) - COMPLEX C( MAXTRM ), CM( MAXTRM ), CS( MAXTRM ), D( MAXTRM ), - & DM( MAXTRM ), DS( MAXTRM ) -c .. -c .. External Subroutines .. - - EXTERNAL ERRMSG, LPCO1T, LPCO2T -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CONJG, MAX, MIN, MOD, REAL -c .. -c .. Equivalences .. - - EQUIVALENCE ( C, CM ), ( D, DM ) -c .. -#ifndef _OPENMP - SAVE PASS1, RECIP - - DATA PASS1 / .TRUE. / - - IF( PASS1 ) THEN - - DO 10 K = 1, MAXRCP - RECIP( K ) = 1.0 / K - 10 CONTINUE - - PASS1 = .FALSE. - - END IF -#else - DO 10 K = 1, MAXRCP - RECIP( K ) = 1.0 / K - 10 CONTINUE -#endif - - - DO 30 J = 1, MAX( 1, NPQUAN ) - - DO 20 L = 0, NMOM - PMOM( L, J ) = 0.0 - 20 CONTINUE - - 30 CONTINUE - - - IF( NTRM.EQ.1 ) THEN - - CALL LPCO1T( NMOM, IPOLZN, MOMDIM, CALCMO, A, B, PMOM ) - - RETURN - - ELSE IF( NTRM.EQ.2 ) THEN - - CALL LPCO2T( NMOM, IPOLZN, MOMDIM, CALCMO, A, B, PMOM ) - - RETURN - - END IF - - - IF( NTRM + 2.GT.MAXTRM ) - & CALL ERRMSG('LPCoef--PARAMETER MaxTrm too small',.TRUE.) - -c ** Calculate Mueller C, D arrays - CM( NTRM + 2 ) = ( 0., 0. ) - DM( NTRM + 2 ) = ( 0., 0. ) - CM( NTRM + 1 ) = ( 1. - RECIP( NTRM+1 ) ) * B( NTRM ) - DM( NTRM + 1 ) = ( 1. - RECIP( NTRM+1 ) ) * A( NTRM ) - CM( NTRM ) = ( RECIP( NTRM ) + RECIP( NTRM+1 ) ) * A( NTRM ) + - & ( 1. - RECIP( NTRM ) )*B( NTRM-1 ) - DM( NTRM ) = ( RECIP( NTRM ) + RECIP( NTRM+1 ) ) * B( NTRM ) + - & ( 1. - RECIP( NTRM ) )*A( NTRM-1 ) - - DO 40 K = NTRM-1, 2, -1 - CM( K ) = CM( K+2 ) - ( 1. + RECIP(K+1) ) * B( K+1 ) - & + ( RECIP(K) + RECIP(K+1) ) * A( K ) - & + ( 1. - RECIP(K) ) * B( K-1 ) - DM( K ) = DM( K+2 ) - ( 1. + RECIP(K+1) ) * A( K+1 ) - & + ( RECIP(K) + RECIP(K+1) ) * B( K ) - & + ( 1. - RECIP(K) ) * A( K-1 ) - 40 CONTINUE - - CM( 1 ) = CM( 3 ) + 1.5 * ( A( 1 ) - B( 2 ) ) - DM( 1 ) = DM( 3 ) + 1.5 * ( B( 1 ) - A( 2 ) ) - - - IF( IPOLZN.GE.0 ) THEN - - DO 50 K = 1, NTRM + 2 - C( K ) = ( 2*K - 1 ) * CM( K ) - D( K ) = ( 2*K - 1 ) * DM( K ) - 50 CONTINUE - - ELSE -c ** Compute Sekera C and D arrays - CS( NTRM + 2 ) = ( 0., 0. ) - DS( NTRM + 2 ) = ( 0., 0. ) - CS( NTRM + 1 ) = ( 0., 0. ) - DS( NTRM + 1 ) = ( 0., 0. ) - - DO 60 K = NTRM, 1, -1 - CS( K ) = CS( K+2 ) + ( 2*K + 1 ) * ( CM( K+1 ) - B( K ) ) - DS( K ) = DS( K+2 ) + ( 2*K + 1 ) * ( DM( K+1 ) - A( K ) ) - 60 CONTINUE - - DO 70 K = 1, NTRM + 2 - C( K ) = ( 2*K - 1 ) * CS( K ) - D( K ) = ( 2*K - 1 ) * DS( K ) - 70 CONTINUE - - END IF - - - IF( IPOLZN.LT.0 ) NUMMOM = MIN( NMOM, 2*NTRM - 2 ) - IF( IPOLZN.GE.0 ) NUMMOM = MIN( NMOM, 2*NTRM ) - - IF( NUMMOM.GT.MAXMOM ) - & CALL ERRMSG('LPCoef--PARAMETER MaxTrm too small',.TRUE.) - - -c ** Loop over moments - - DO 240 L = 0, NUMMOM - - LD2 = L / 2 - EVENL = MOD( L, 2 ).EQ.0 -c ** Calculate numerical coefficients -c ** a-sub-m and b-sub-i in Dave -c ** double-sums for moments - IF( L.EQ.0 ) THEN - - IDEL = 1 - - DO 80 M = 0, NTRM - AM( M ) = 2.0 * RECIP( 2*M + 1 ) - 80 CONTINUE - - BI( 0 ) = 1.0 - - ELSE IF( EVENL ) THEN - - IDEL = 1 - - DO 90 M = LD2, NTRM - AM( M ) = ( 1. + RECIP( 2*M - L + 1 ) ) * AM( M ) - 90 CONTINUE - - DO 100 I = 0, LD2 - 1 - BI( I ) = ( 1. - RECIP( L - 2*I ) ) * BI( I ) - 100 CONTINUE - - BI( LD2 ) = ( 2. - RECIP( L ) ) * BI( LD2 - 1 ) - - ELSE - - IDEL = 2 - - DO 110 M = LD2, NTRM - AM( M ) = ( 1. - RECIP( 2*M + L + 2 ) ) * AM( M ) - 110 CONTINUE - - DO 120 I = 0, LD2 - BI( I ) = ( 1. - RECIP( L + 2*I + 1 ) ) * BI( I ) - 120 CONTINUE - - END IF -c ** Establish upper limits for sums -c ** and incorporate factor capital- -c ** del into b-sub-i - MMAX = NTRM - IDEL - IF( IPOLZN.GE.0 ) MMAX = MMAX + 1 - IMAX = MIN( LD2, MMAX - LD2 ) - - IF( IMAX.LT.0 ) GO TO 250 - - DO 130 I = 0, IMAX - BIDEL( I ) = BI( I ) - 130 CONTINUE - - IF( EVENL ) BIDEL( 0 ) = 0.5*BIDEL( 0 ) - -c ** Perform double sums just for -c ** phase quantities desired by user - IF( IPOLZN.EQ.0 ) THEN - - DO 150 I = 0, IMAX -c ** vectorizable loop - - SUM = 0.0 - - DO 140 M = LD2, MMAX - I - SUM = SUM + AM( M ) * - & ( REAL( C(M-I+1) * CONJG( C(M+I+IDEL) ) ) - & + REAL( D(M-I+1) * CONJG( D(M+I+IDEL) ) ) ) - 140 CONTINUE - - PMOM( L, 1 ) = PMOM( L, 1 ) + BIDEL( I ) * SUM - - 150 CONTINUE - - PMOM( L, 1 ) = 0.5*PMOM( L, 1 ) - GO TO 240 - - END IF - - - IF( CALCMO( 1 ) ) THEN - - DO 170 I = 0, IMAX - - SUM = 0.0 -c ** vectorizable loop - DO 160 M = LD2, MMAX - I - SUM = SUM + AM( M ) * - & REAL( C(M-I+1) * CONJG( C(M+I+IDEL) ) ) - 160 CONTINUE - - PMOM( L, 1 ) = PMOM( L, 1 ) + BIDEL( I ) * SUM - - 170 CONTINUE - - END IF - - - IF( CALCMO( 2 ) ) THEN - - DO 190 I = 0, IMAX - - SUM = 0.0 -c ** vectorizable loop - DO 180 M = LD2, MMAX - I - SUM = SUM + AM( M ) * - & REAL( D(M-I+1) * CONJG( D(M+I+IDEL) ) ) - 180 CONTINUE - - PMOM( L, 2 ) = PMOM( L, 2 ) + BIDEL( I ) * SUM - - 190 CONTINUE - - END IF - - - IF( CALCMO( 3 ) ) THEN - - DO 210 I = 0, IMAX - - SUM = 0.0 -c ** vectorizable loop - DO 200 M = LD2, MMAX - I - SUM = SUM + AM( M ) * - & ( REAL( C(M-I+1) * CONJG( D(M+I+IDEL) ) ) - & + REAL( C(M+I+IDEL) * CONJG( D(M-I+1) ) ) ) - 200 CONTINUE - - PMOM( L, 3 ) = PMOM( L, 3 ) + BIDEL( I ) * SUM - - 210 CONTINUE - - PMOM( L, 3 ) = 0.5*PMOM( L, 3 ) - END IF - - - IF( CALCMO( 4 ) ) THEN - - DO 230 I = 0, IMAX - - SUM= 0.0 -c ** vectorizable loop - DO 220 M = LD2, MMAX - I - SUM = SUM + AM( M ) * - & ( AIMAG( C(M-I+1) * CONJG( D(M+I+IDEL) ) ) - & + AIMAG( C(M+I+IDEL) * CONJG( D(M-I+1) ) ) ) - 220 CONTINUE - - PMOM( L, 4 ) = PMOM( L, 4 ) + BIDEL( I ) * SUM - - 230 CONTINUE - - PMOM( L, 4 ) = - 0.5 * PMOM( L, 4 ) - - END IF - - 240 CONTINUE - - - 250 CONTINUE - - RETURN - END - - SUBROUTINE LPCO1T( NMOM, IPOLZN, MOMDIM, CALCMO, A, B, PMOM ) - -c Calculate Legendre polynomial expansion coefficients (also -c called moments) for phase quantities in special case where -c no. terms in Mie series = 1 - -c INPUT: NMOM, IPOLZN, MOMDIM MIEV0 arguments -c CALCMO Flags calculated from IPOLZN -c A(1), B(1) Mie series coefficients - -c OUTPUT: PMOM Legendre moments - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - INTEGER IPOLZN, MOMDIM, NMOM -c .. -c .. Array Arguments .. - - LOGICAL CALCMO( * ) - REAL PMOM( 0:MOMDIM, * ) - COMPLEX A( * ), B( * ) -c .. -c .. Local Scalars .. - - INTEGER L, NUMMOM - REAL A1SQ, B1SQ - COMPLEX A1B1C, CTMP -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CONJG, MIN, REAL -c .. -c .. Statement Functions .. - - REAL SQ -c .. -c .. Statement Function definitions .. - - SQ( CTMP ) = REAL( CTMP )**2 + AIMAG( CTMP )**2 -c .. - - - A1SQ = SQ( A( 1 ) ) - B1SQ = SQ( B( 1 ) ) - A1B1C = A( 1 ) * CONJG( B( 1 ) ) - - - IF( IPOLZN.LT.0 ) THEN - - IF( CALCMO( 1 ) ) PMOM( 0, 1 ) = 2.25*B1SQ - - IF( CALCMO( 2 ) ) PMOM( 0, 2 ) = 2.25*A1SQ - - IF( CALCMO( 3 ) ) PMOM( 0, 3 ) = 2.25*REAL( A1B1C ) - - IF( CALCMO( 4 ) ) PMOM( 0, 4 ) = 2.25*AIMAG( A1B1C ) - - ELSE - - NUMMOM = MIN( NMOM, 2 ) - -c ** Loop over moments - DO 10 L = 0, NUMMOM - - IF( IPOLZN.EQ.0 ) THEN - - IF( L.EQ.0 ) PMOM( L, 1 ) = 1.5*( A1SQ + B1SQ ) - - IF( L.EQ.1 ) PMOM( L, 1 ) = 1.5*REAL( A1B1C ) - - IF( L.EQ.2 ) PMOM( L, 1 ) = 0.15*( A1SQ + B1SQ ) - - GO TO 10 - - END IF - - - IF( CALCMO( 1 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 1 ) = 2.25*( A1SQ + B1SQ / 3.) - - IF( L.EQ.1 ) PMOM( L, 1 ) = 1.5*REAL( A1B1C ) - - IF( L.EQ.2 ) PMOM( L, 1 ) = 0.3*B1SQ - - END IF - - - IF( CALCMO( 2 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 2 ) = 2.25*( B1SQ + A1SQ / 3. ) - - IF( L.EQ.1 ) PMOM( L, 2 ) = 1.5*REAL( A1B1C ) - - IF( L.EQ.2 ) PMOM( L, 2 ) = 0.3*A1SQ - - END IF - - - IF( CALCMO( 3 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 3 ) = 3.0*REAL( A1B1C ) - - IF( L.EQ.1 ) PMOM( L, 3 ) = 0.75*( A1SQ + B1SQ ) - - IF( L.EQ.2 ) PMOM( L, 3 ) = 0.3*REAL( A1B1C ) - - END IF - - - IF( CALCMO( 4 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 4 ) = -1.5*AIMAG( A1B1C ) - - IF( L.EQ.1 ) PMOM( L, 4 ) = 0.0 - - IF( L.EQ.2 ) PMOM( L, 4 ) = 0.3*AIMAG( A1B1C ) - - END IF - - - 10 CONTINUE - - END IF - - RETURN - END - - SUBROUTINE LPCO2T( NMOM, IPOLZN, MOMDIM, CALCMO, A, B, PMOM ) - -c Calculate Legendre polynomial expansion coefficients (also -c called moments) for phase quantities in special case where -c no. terms in Mie series = 2 - -c INPUT: NMOM, IPOLZN, MOMDIM MIEV0 arguments -c CALCMO Flags calculated from IPOLZN -c A(1-2), B(1-2) Mie series coefficients - -c OUTPUT: PMOM Legendre moments - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - INTEGER IPOLZN, MOMDIM, NMOM -c .. -c .. Array Arguments .. - - LOGICAL CALCMO( * ) - REAL PMOM( 0:MOMDIM, * ) - COMPLEX A( * ), B( * ) -c .. -c .. Local Scalars .. - - INTEGER L, NUMMOM - REAL A2SQ, B2SQ, PM1, PM2 - COMPLEX A2C, B2C, CA, CAC, CAT, CB, CBC, CBT, CG, CH, CTMP -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CONJG, MIN, REAL -c .. -c .. Statement Functions .. - - REAL SQ -c .. -c .. Statement Function definitions .. - - SQ( CTMP ) = REAL( CTMP )**2 + AIMAG( CTMP )**2 -c .. - - - CA = 3.*A( 1 ) - 5.*B( 2 ) - CAT = 3.*B( 1 ) - 5.*A( 2 ) - CAC = CONJG( CA ) - A2SQ = SQ( A( 2 ) ) - B2SQ = SQ( B( 2 ) ) - A2C = CONJG( A( 2 ) ) - B2C = CONJG( B( 2 ) ) - - - IF( IPOLZN.LT.0 ) THEN - -c ** Loop over Sekera moments - NUMMOM = MIN( NMOM, 2 ) - - DO 10 L = 0, NUMMOM - - IF( CALCMO( 1 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 1 ) = 0.25 * ( SQ( CAT ) - & + (100./3.)* B2SQ ) - - IF( L.EQ.1 ) PMOM( L, 1 ) = (5./3.)*REAL( CAT*B2C ) - - IF( L.EQ.2 ) PMOM( L, 1 ) = (10./3.)*B2SQ - - END IF - - - IF( CALCMO( 2 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 2 ) = 0.25 * ( SQ( CA ) - & + (100./3.) * A2SQ ) - - IF( L.EQ.1 ) PMOM( L, 2 ) = (5./3.)*REAL( CA*A2C ) - - IF( L.EQ.2 ) PMOM( L, 2 ) = (10./3.)*A2SQ - - END IF - - - IF( CALCMO( 3 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 3 ) = 0.25 * REAL( CAT * CAC - & + (100./3.) * B(2) * A2C ) - - IF( L.EQ.1 ) PMOM( L, 3 ) = 5./6.* - & REAL( B(2)*CAC + CAT*A2C ) - - IF( L.EQ.2 ) PMOM( L, 3 ) = 10./3.* REAL( B(2)*A2C ) - - END IF - - - IF( CALCMO( 4 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 4 ) = -0.25 * AIMAG( CAT * CAC - & + (100./3.)* B(2) * A2C ) - - IF( L.EQ.1 ) PMOM( L, 4 ) = -5./ 6.* - & AIMAG( B(2)*CAC + CAT*A2C ) - - IF( L.EQ.2 ) PMOM( L, 4 ) = -10./ 3.* AIMAG( B(2)*A2C ) - - END IF - - - 10 CONTINUE - - - ELSE - - CB = 3.*B( 1 ) + 5.*A( 2 ) - CBT = 3.*A( 1 ) + 5.*B( 2 ) - CBC = CONJG( CB ) - CG = ( CBC*CBT + 10.*( CAC*A( 2 ) + B2C*CAT ) ) / 3. - CH = 2.*( CBC*A( 2 ) + B2C*CBT ) - -c ** Loop over Mueller moments - NUMMOM = MIN( NMOM, 4 ) - - DO 20 L = 0, NUMMOM - - - IF( IPOLZN.EQ.0 .OR. CALCMO( 1 ) ) THEN - - IF( L.EQ.0 ) PM1 = 0.25*SQ( CA ) + SQ( CB ) / 12. - & + (5./3.)*REAL( CA*B2C ) + 5.*B2SQ - - IF( L.EQ.1 ) PM1 = REAL( CB * ( CAC / 6.+ B2C ) ) - - IF( L.EQ.2 ) PM1 = SQ( CB ) / 30.+ (20./7.)*B2SQ - & + (2./3.)*REAL( CA*B2C ) - - IF( L.EQ.3 ) PM1 = (2./7.) * REAL( CB*B2C ) - - IF( L.EQ.4 ) PM1 = (40./63.) * B2SQ - - IF( CALCMO( 1 ) ) PMOM( L, 1 ) = PM1 - - END IF - - - IF( IPOLZN.EQ.0 .OR. CALCMO( 2 ) ) THEN - - IF( L.EQ.0 ) PM2 = 0.25*SQ( CAT ) + SQ( CBT ) / 12. - & + ( 5./ 3.) * REAL( CAT*A2C ) - & + 5.*A2SQ - - IF( L.EQ.1 ) PM2 = REAL( CBT * - & ( CONJG( CAT ) / 6.+ A2C ) ) - - IF( L.EQ.2 ) PM2 = SQ( CBT ) / 30. - & + ( 20./7.) * A2SQ - & + ( 2./3.) * REAL( CAT*A2C ) - - IF( L.EQ.3 ) PM2 = (2./7.) * REAL( CBT*A2C ) - - IF( L.EQ.4 ) PM2 = (40./63.) * A2SQ - - IF( CALCMO( 2 ) ) PMOM( L, 2 ) = PM2 - - END IF - - - IF( IPOLZN.EQ.0 ) THEN - - PMOM( L, 1 ) = 0.5*( PM1 + PM2 ) - GO TO 20 - - END IF - - - IF( CALCMO( 3 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 3 ) = 0.25 * REAL( CAC*CAT + CG - & + 20.* B2C * A(2) ) - - IF( L.EQ.1 ) PMOM( L, 3 ) = REAL( CAC*CBT + CBC*CAT - & + 3.*CH ) / 12. - - IF( L.EQ.2 ) PMOM( L, 3 ) = 0.1 * REAL( CG - & + (200./7.) * B2C * A(2) ) - - IF( L.EQ.3 ) PMOM( L, 3 ) = REAL( CH ) / 14. - - IF( L.EQ.4 ) PMOM( L, 3 ) = 40./63.* REAL( B2C*A(2) ) - - END IF - - - IF( CALCMO( 4 ) ) THEN - - IF( L.EQ.0 ) PMOM( L, 4 ) = 0.25 * AIMAG( CAC*CAT + CG - & + 20.* B2C * A(2) ) - - IF( L.EQ.1 ) PMOM( L, 4 ) = AIMAG( CAC*CBT + CBC*CAT - & + 3.*CH ) / 12. - - IF( L.EQ.2 ) PMOM( L, 4 ) = 0.1 * AIMAG( CG - & + (200./7.) * B2C * A(2) ) - - IF( L.EQ.3 ) PMOM( L, 4 ) = AIMAG( CH ) / 14. - - IF( L.EQ.4 ) PMOM( L, 4 ) = 40./63.* AIMAG( B2C*A(2) ) - - END IF - - - 20 CONTINUE - - END IF - - RETURN - END - - SUBROUTINE BIGA( CIOR, XX, NTRM, NOABS, YESANG, RBIGA, CBIGA ) - -c Calculate logarithmic derivatives of J-Bessel-function - -c Input : CIOR, XX, NTRM, NOABS, YESANG (defined in MIEV0) - -c Output : RBIGA or CBIGA (defined in MIEV0) - -c Routines called : CONFRA - - -c INTERNAL VARIABLES : - -c CONFRA Value of Lentz continued fraction for CBIGA(NTRM), -c used to initialize downward recurrence - -c DOWN = True, use down-recurrence. False, do not. - -c F1,F2,F3 Arithmetic statement functions used in determining -c whether to use up- or down-recurrence -c ( Ref. 2, Eqs. 6-8 ) - -c MRE Real refractive index -c MIM Imaginary refractive index - -c REZINV 1 / ( MRE * XX ); temporary variable for recurrence -c ZINV 1 / ( CIOR * XX ); temporary variable for recurrence - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - LOGICAL NOABS, YESANG - INTEGER NTRM - REAL XX - COMPLEX CIOR -c .. -c .. Array Arguments .. - - REAL RBIGA( * ) - COMPLEX CBIGA( * ) -c .. -c .. Local Scalars .. - - LOGICAL DOWN - INTEGER N - REAL MIM, MRE, REZINV, RTMP - COMPLEX CTMP, ZINV -c .. -c .. External Functions .. - - COMPLEX CONFRA - EXTERNAL CONFRA -c .. -c .. Intrinsic Functions .. - - INTRINSIC ABS, AIMAG, COS, EXP, REAL, SIN -c .. -c .. Statement Functions .. - - REAL F1, F2, F3 -c .. -c .. Statement Function definitions .. - -c ** Eq. R47c - F1( MRE ) = -8.0 + MRE**2*( 26.22 + - & MRE*( -0.4474 + MRE**3*( 0.00204 - 0.000175*MRE ) ) ) - -c ** Eq. R47b - F2( MRE ) = 3.9 + MRE*( -10.8 + 13.78*MRE ) -c ** Eq. R47a - F3( MRE ) = -15.04 + MRE*( 8.42 + 16.35*MRE ) -c .. - -c ** Decide whether BigA can be -c ** calculated by up-recurrence - MRE = REAL( CIOR ) - MIM = ABS( AIMAG( CIOR ) ) - - IF( MRE.LT.1.0 .OR. MRE.GT.10.0 .OR. MIM.GT.10.0 ) THEN - - DOWN = .TRUE. - - ELSE IF( YESANG ) THEN - - DOWN = .TRUE. -c ** Eq. R48 - IF( MIM*XX .LT. F2( MRE ) ) DOWN = .FALSE. - - ELSE - - DOWN = .TRUE. -c ** Eq. R48 - IF( MIM*XX .LT. F1( MRE ) ) DOWN = .FALSE. - - END IF - - - ZINV = 1.0 / ( CIOR*XX ) - REZINV = 1.0 / ( MRE*XX ) - - - IF( DOWN ) THEN -c ** Compute initial high-order BigA using -c ** Lentz method ( Ref. 1, pp. 17-20 ) - - CTMP = CONFRA( NTRM, ZINV ) - -c *** Downward recurrence for BigA - IF( NOABS ) THEN -c ** No-absorption case; Eq (R23) - RBIGA( NTRM ) = REAL( CTMP ) - - DO 10 N = NTRM, 2, -1 - RBIGA( N - 1 ) = ( N*REZINV ) - - & 1.0 / ( ( N*REZINV ) + RBIGA( N ) ) - 10 CONTINUE - - ELSE -c ** Absorptive case; Eq (R23) - CBIGA( NTRM ) = CTMP - - DO 20 N = NTRM, 2, -1 - CBIGA( N-1 ) = (N*ZINV) - 1.0 / ( (N*ZINV) + CBIGA( N ) ) - 20 CONTINUE - - END IF - - - ELSE -c *** Upward recurrence for BigA - IF( NOABS ) THEN -c ** No-absorption case; Eq (R20,21) - RTMP = SIN( MRE*XX ) - RBIGA( 1 ) = - REZINV + RTMP / - & ( RTMP*REZINV - COS( MRE*XX ) ) - - DO 30 N = 2, NTRM - RBIGA( N ) = -( N*REZINV ) + - & 1.0 / ( ( N*REZINV ) - RBIGA( N - 1 ) ) - 30 CONTINUE - - ELSE -c ** Absorptive case; Eq (R20,22) - - CTMP = EXP( - (0.,2.)*CIOR*XX ) - CBIGA( 1 ) = - ZINV + (1.-CTMP) / - & ( ZINV * (1.-CTMP) - (0.,1.)*(1.+CTMP) ) - - DO 40 N = 2, NTRM - CBIGA( N ) = - (N*ZINV) + 1.0 / ((N*ZINV) - CBIGA( N-1 )) - 40 CONTINUE - - END IF - - END IF - - RETURN - END - - COMPLEX FUNCTION CONFRA( N, ZINV ) - -c Compute Bessel function ratio A-sub-N from its -c continued fraction using Lentz method - -c ZINV = Reciprocal of argument of A - - -c I N T E R N A L V A R I A B L E S -c ------------------------------------ - -c CAK Term in continued fraction expansion of A (Eq. R25) - -c CAPT Factor used in Lentz iteration for A (Eq. R27) - -c CNUMER Numerator in capT ( Eq. R28A ) -c CDENOM Denominator in capT ( Eq. R28B ) - -c CDTD Product of two successive denominators of capT factors -c ( Eq. R34C ) -c CNTN Product of two successive numerators of capT factors -c ( Eq. R34B ) - -c EPS1 Ill-conditioning criterion -c EPS2 Convergence criterion - -c KK Subscript k of cAk ( Eq. R25B ) - -c KOUNT Iteration counter ( used to prevent infinite looping ) - -c MAXIT Max. allowed no. of iterations - -c MM + 1 and - 1, alternately -c -------------------------------------------------------------------- - - IMPLICIT NONE - -c .. Scalar Arguments .. - - INTEGER N - COMPLEX ZINV -c .. -c .. Local Scalars .. - - INTEGER KK, KOUNT, MAXIT, MM - REAL EPS1, EPS2 - COMPLEX CAK, CAPT, CDENOM, CDTD, CNTN, CNUMER -c .. -c .. External Subroutines .. - - EXTERNAL ERRMSG -c .. -c .. Intrinsic Functions .. - - INTRINSIC ABS, AIMAG, REAL -c .. - DATA EPS1 / 1.E-2 / , EPS2 / 1.E-8 / - DATA MAXIT / 10000 / - - -c ** Eq. R25a - CONFRA = ( N + 1 ) * ZINV - MM = - 1 - KK = 2*N + 3 -c ** Eq. R25b, k=2 - CAK = ( MM*KK ) * ZINV - CDENOM = CAK - CNUMER = CDENOM + 1.0 / CONFRA - KOUNT = 1 - - 10 CONTINUE - KOUNT = KOUNT + 1 - - IF( KOUNT.GT.MAXIT ) - & CALL ERRMSG('ConFra--Iteration failed to converge',.TRUE.) - - MM = - MM - KK = KK + 2 -c ** Eq. R25b - CAK = ( MM*KK ) * ZINV -c ** Eq. R32 - IF( ABS( CNUMER / CAK ).LE.EPS1 .OR. - & ABS( CDENOM / CAK ).LE.EPS1 ) THEN - -c ** Ill-conditioned case -- stride -c ** two terms instead of one - -c ** Eq. R34 - CNTN = CAK * CNUMER + 1.0 - CDTD = CAK * CDENOM + 1.0 -c ** Eq. R33 - CONFRA = ( CNTN / CDTD ) * CONFRA - - MM = - MM - KK = KK + 2 -c ** Eq. R25b - CAK = ( MM*KK ) * ZINV -c ** Eq. R35 - CNUMER = CAK + CNUMER / CNTN - CDENOM = CAK + CDENOM / CDTD - KOUNT = KOUNT + 1 - GO TO 10 - - ELSE -c *** Well-conditioned case - -c ** Eq. R27 - CAPT = CNUMER / CDENOM -c ** Eq. R26 - CONFRA = CAPT * CONFRA -c ** Check for convergence; Eq. R31 - - IF ( ABS( REAL (CAPT) - 1.0 ).GE.EPS2 - & .OR. ABS( AIMAG(CAPT) ) .GE.EPS2 ) THEN - -c ** Eq. R30 - CNUMER = CAK + 1.0 / CNUMER - CDENOM = CAK + 1.0 / CDENOM - - GO TO 10 - - END IF - - END IF - - - RETURN - - END - - SUBROUTINE MIPRNT( PRNT, XX, PERFCT, CREFIN, NUMANG, XMU, QEXT, - & QSCA, GQSC, NMOM, IPOLZN, MOMDIM, CALCMO, PMOM, - & SFORW, SBACK, TFORW, TBACK, S1, S2 ) - -c Print scattering quantities of a single particle - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - LOGICAL PERFCT - INTEGER IPOLZN, MOMDIM, NMOM, NUMANG - REAL GQSC, QEXT, QSCA, XX - COMPLEX CREFIN, SBACK, SFORW -c .. -c .. Array Arguments .. - - LOGICAL CALCMO( * ), PRNT( * ) - REAL PMOM( 0:MOMDIM, * ), XMU( * ) - COMPLEX S1( * ), S2( * ), TBACK( * ), TFORW( * ) -c .. -c .. Local Scalars .. - - CHARACTER FMAT*22 - INTEGER I, J, M - REAL FNORM, I1, I2 -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CONJG, REAL -c .. - - - IF( PERFCT ) WRITE( *, '(''1'',10X,A,1P,E11.4)' ) - & 'Perfectly Conducting Case, size parameter =', XX - - IF( .NOT.PERFCT ) WRITE( *, '(''1'',10X,3(A,1P,E11.4))' ) - & 'Refractive Index: Real ', REAL( CREFIN ), ' Imag ', - & AIMAG( CREFIN ), ', Size Parameter =', XX - - - IF( PRNT( 1 ) .AND. NUMANG.GT.0 ) THEN - - WRITE( *, '(/,A)' ) - & ' cos(angle) ------- S1 --------- ------- S2 ---------' - & // ' --- S1*conjg(S2) --- i1=S1**2 i2=S2**2 (i1+i2)/2' - & // ' DEG POLZN' - - DO 10 I = 1, NUMANG - I1 = REAL( S1( I ) )**2 + AIMAG( S1( I ) )**2 - I2 = REAL( S2( I ) )**2 + AIMAG( S2( I ) )**2 - WRITE( *, '( I4, F10.6, 1P,10E11.3 )' ) - & I, XMU(I), S1(I), S2(I), S1(I)*CONJG(S2(I)), - & I1, I2, 0.5*(I1+I2), (I2-I1)/(I2+I1) - 10 CONTINUE - - END IF - - - IF( PRNT( 2 ) ) THEN - - WRITE ( *, '(/,A,9X,A,17X,A,17X,A,/,(0P,F7.2, 1P,6E12.3) )' ) - & ' Angle', 'S-sub-1', 'T-sub-1', 'T-sub-2', - & 0.0, SFORW, TFORW(1), TFORW(2), - & 180., SBACK, TBACK(1), TBACK(2) - WRITE ( *, '(/,4(A,1P,E11.4))' ) - & ' Efficiency Factors, extinction:', QEXT, - & ' scattering:', QSCA, - & ' absorption:', QEXT-QSCA, - & ' rad. pressure:', QEXT-GQSC - - IF( NMOM.GT.0 ) THEN - - WRITE( *, '(/,A)' ) ' Normalized moments of :' - - IF( IPOLZN.EQ.0 ) WRITE( *, '(''+'',27X,A)' ) - & 'Phase Fcn' - - IF( IPOLZN.GT.0 ) WRITE( *, '(''+'',33X,A)' ) - & 'M1 M2 S21 D21' - - IF( IPOLZN.LT.0 ) WRITE( *, '(''+'',33X,A)' ) - & 'R1 R2 R3 R4' - - FNORM = 4./ ( XX**2 * QSCA ) - - DO 30 M = 0, NMOM - - WRITE( *, '(A,I4)' ) ' Moment no.', M - - DO 20 J = 1, 4 - - IF( CALCMO( J ) ) THEN - WRITE( FMAT, '(A,I2,A)' ) - & '( ''+'', T', 24+(J-1)*13, ', 1P,E13.4 )' - WRITE( *, FMAT ) FNORM * PMOM( M, J ) - END IF - - 20 CONTINUE - 30 CONTINUE - - END IF - - END IF - - - RETURN - - END - - SUBROUTINE SMALL1( XX, NUMANG, XMU, QEXT, QSCA, GQSC, SFORW, - & SBACK, S1, S2, TFORW, TBACK, A, B ) - -c Small-particle limit of Mie quantities in totally reflecting -c limit ( Mie series truncated after 2 terms ) - -c A,B First two Mie coefficients, with numerator and -c denominator expanded in powers of XX ( a factor -c of XX**3 is missing but is restored before return -c to calling program ) ( Ref. 2, p. 1508 ) - - IMPLICIT NONE - -c .. Parameters .. - - REAL TWOTHR, FIVTHR, FIVNIN - PARAMETER ( TWOTHR = 2./3., FIVTHR = 5./3., FIVNIN = 5./9. ) -c .. -c .. Scalar Arguments .. - - INTEGER NUMANG - REAL GQSC, QEXT, QSCA, XX - COMPLEX SBACK, SFORW -c .. -c .. Array Arguments .. - - REAL XMU( * ) - COMPLEX A( * ), B( * ), S1( * ), S2( * ), TBACK( * ), TFORW( * ) -c .. -c .. Local Scalars .. - - INTEGER J - REAL RTMP - COMPLEX CTMP -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CMPLX, CONJG, REAL -c .. -c .. Statement Functions .. - - REAL SQ -c .. -c .. Statement Function definitions .. - - SQ( CTMP ) = REAL( CTMP )**2 + AIMAG( CTMP )**2 -c .. - -c ** Eq. R/A.5 - A( 1 ) = CMPLX( 0., TWOTHR*( 1. - 0.2*XX**2 ) ) / - & CMPLX( 1. - 0.5*XX**2, TWOTHR*XX**3 ) -c ** Eq. R/A.6 - B( 1 ) = CMPLX( 0., - ( 1. - 0.1*XX**2 ) / 3.) / - & CMPLX( 1. + 0.5*XX**2, - XX**3 / 3.) -c ** Eq. R/A.7,8 - A( 2 ) = CMPLX( 0., XX**2 / 30.) - B( 2 ) = CMPLX( 0., - XX**2 / 45.) -c ** Eq. R/A.9 - QSCA = 6.* XX**4 *( SQ( A(1) ) + SQ( B(1) ) + - & FIVTHR*( SQ( A(2) ) + SQ( B(2) ) ) ) - QEXT = QSCA -c ** Eq. R/A.10 - GQSC = 6.* XX**4 *REAL( A(1)*CONJG( A(2) + B(1) ) + - & ( B(1) + FIVNIN*A(2) )*CONJG( B(2) ) ) - - RTMP = 1.5 * XX**3 - SFORW = RTMP*( A(1) + B(1) + FIVTHR*( A(2) + B(2) ) ) - SBACK = RTMP*( A(1) - B(1) - FIVTHR*( A(2) - B(2) ) ) - TFORW( 1 ) = RTMP*( B(1) + FIVTHR*( 2.*B(2) - A(2) ) ) - TFORW( 2 ) = RTMP*( A(1) + FIVTHR*( 2.*A(2) - B(2) ) ) - TBACK( 1 ) = RTMP*( B(1) - FIVTHR*( 2.*B(2) + A(2) ) ) - TBACK( 2 ) = RTMP*( A(1) - FIVTHR*( 2.*A(2) + B(2) ) ) - - - DO 10 J = 1, NUMANG -c ** Eq. R/A.11,12 - - S1( J ) = RTMP*( A(1) + B(1)*XMU( J ) + - & FIVTHR*( A(2)*XMU( J ) + - & B(2)*( 2.*XMU( J )**2 - 1.) ) ) - S2( J ) = RTMP*( B(1) + A(1)*XMU( J ) + - & FIVTHR*( B(2)*XMU( J ) + - & A(2)*( 2.*XMU( J )**2 - 1.) ) ) - 10 CONTINUE - -c ** Recover actual Mie coefficients - A( 1 ) = XX**3 * A(1) - A( 2 ) = XX**3 * A(2) - B( 1 ) = XX**3 * B(1) - B( 2 ) = XX**3 * B(2) - - RETURN - END - - SUBROUTINE SMALL2( XX, CIOR, CALCQE, NUMANG, XMU, QEXT, QSCA, - & GQSC, SFORW, SBACK, S1, S2, TFORW, TBACK, - & A, B ) - -c Small-particle limit of Mie quantities for general refractive -c index ( Mie series truncated after 2 terms ) - -c A,B First two Mie coefficients, with numerator and -c denominator expanded in powers of XX ( a factor -c of XX**3 is missing but is restored before return -c to calling program ) - -c CIORSQ Square of refractive index - - - IMPLICIT NONE - -c .. Parameters .. - - REAL TWOTHR, FIVTHR - PARAMETER ( TWOTHR = 2./3., FIVTHR = 5./3.) -c .. -c .. Scalar Arguments .. - - LOGICAL CALCQE - INTEGER NUMANG - REAL GQSC, QEXT, QSCA, XX - COMPLEX CIOR, SBACK, SFORW -c .. -c .. Array Arguments .. - - REAL XMU( * ) - COMPLEX A( * ), B( * ), S1( * ), S2( * ), TBACK( * ), TFORW( * ) -c .. -c .. Local Scalars .. - - INTEGER J - REAL RTMP - COMPLEX CIORSQ, CTMP -c .. -c .. Intrinsic Functions .. - - INTRINSIC AIMAG, CMPLX, CONJG, REAL -c .. -c .. Statement Functions .. - - REAL SQ -c .. -c .. Statement Function definitions .. - - SQ( CTMP ) = REAL( CTMP )**2 + AIMAG( CTMP )**2 -c .. - - - CIORSQ = CIOR**2 - CTMP = CMPLX( 0., TWOTHR )*( CIORSQ - 1.0 ) - -c ** Eq. R42a - A( 1 ) = CTMP*( 1.- 0.1*XX**2 + - & ( CIORSQ / 350. + 1./280.)*XX**4 ) / - & ( CIORSQ + 2.+ ( 1.- 0.7*CIORSQ )*XX**2 - - & ( CIORSQ**2 / 175.- 0.275*CIORSQ + 0.25 )*XX**4 + - & XX**3 * CTMP * ( 1.- 0.1*XX**2 ) ) - -c ** Eq. R42b - B( 1 ) = ( XX**2 / 30. )*CTMP*( 1.+ - & ( CIORSQ / 35. - 1./ 14.)*XX**2 ) / - & ( 1.- ( CIORSQ / 15. - 1./6.)*XX**2 ) - -c ** Eq. R42c - - A( 2 ) = ( 0.1*XX**2 )*CTMP*( 1.- XX**2 / 14. ) / - & ( 2.*CIORSQ + 3.- ( CIORSQ / 7.- 0.5 ) * XX**2 ) - -c ** Eq. R40a - - QSCA = (6.*XX**4) * ( SQ( A(1) ) + SQ( B(1) ) + - & FIVTHR * SQ( A(2) ) ) - -c ** Eq. R40b - QEXT = QSCA - IF( CALCQE ) QEXT = 6.*XX * REAL( A(1) + B(1) + FIVTHR*A(2) ) - -c ** Eq. R40c - - GQSC = (6.*XX**4) * REAL( A(1)*CONJG( A(2) + B(1) ) ) - - RTMP = 1.5 * XX**3 - SFORW = RTMP*( A(1) + B(1) + FIVTHR*A(2) ) - SBACK = RTMP*( A(1) - B(1) - FIVTHR*A(2) ) - TFORW( 1 ) = RTMP*( B(1) - FIVTHR*A(2) ) - TFORW( 2 ) = RTMP*( A(1) + 2.*FIVTHR*A(2) ) - TBACK( 1 ) = TFORW(1) - TBACK( 2 ) = RTMP*( A(1) - 2.*FIVTHR*A(2) ) - - - DO 10 J = 1, NUMANG -c ** Eq. R40d,e - - S1( J ) = RTMP*( A(1) + ( B(1) + FIVTHR*A(2) )*XMU( J ) ) - S2( J ) = RTMP*( B(1) + A(1)*XMU( J ) + - & FIVTHR*A(2)*( 2.*XMU( J )**2 - 1.) ) - 10 CONTINUE - -c ** Recover actual Mie coefficients - A( 1 ) = XX**3 * A(1) - A( 2 ) = XX**3 * A(2) - B( 1 ) = XX**3 * B(1) - B( 2 ) = ( 0., 0.) - - RETURN - END - - SUBROUTINE TESTMI( COMPAR, XX, CREFIN, MIMCUT, PERFCT, ANYANG, - & NMOM, IPOLZN, NUMANG, XMU, QEXT, QSCA, GQSC, - & SFORW, SBACK, S1, S2, TFORW, TBACK, PMOM, - & MOMDIM ) - -c Set up to run test case when COMPAR = False; when = True, -c compare Mie code test case results with correct answers -c and abort if even one result is inaccurate. - -c The test case is : Mie size parameter = 10 -c refractive index = 1.5 - 0.1 i -c scattering angle = 140 degrees -c 1 Sekera moment - -c Results for this case may be found among the test cases -c at the end of reference (1). - -c *** NOTE *** When running on some computers, esp. in single -c precision, the Accur criterion below may have to be relaxed. -c However, if Accur must be set larger than 10**-3 for some -c size parameters, your computer is probably not accurate -c enough to do Mie computations for those size parameters. - -c Routines called : ERRMSG, MIPRNT, TSTBAD - - - IMPLICIT NONE - -c .. Scalar Arguments .. - - LOGICAL ANYANG, COMPAR, PERFCT - INTEGER IPOLZN, MOMDIM, NMOM, NUMANG - REAL GQSC, MIMCUT, QEXT, QSCA, XX - COMPLEX CREFIN, SBACK, SFORW -c .. -c .. Array Arguments .. - - REAL PMOM( 0:MOMDIM, * ), XMU( * ) - COMPLEX S1( * ), S2( * ), TBACK( * ), TFORW( * ) -c .. -c .. Local Scalars .. - - LOGICAL ANYSAV, OK, PERSAV - INTEGER IPOSAV, M, N, NMOSAV, NUMSAV - REAL ACCUR, CALC, EXACT, MIMSAV, TESTGQ, TESTQE, TESTQS, - & XMUSAV, XXSAV - COMPLEX CRESAV, TESTS1, TESTS2, TESTSB, TESTSF -c .. -c .. Local Arrays .. - - LOGICAL CALCMO( 4 ), PRNT( 2 ) - REAL TESTPM( 0:1 ) - COMPLEX TESTTB( 2 ), TESTTF( 2 ) -c .. -c .. External Functions .. - - LOGICAL TSTBAD - EXTERNAL TSTBAD -c .. -c .. External Subroutines .. - - EXTERNAL ERRMSG, MIPRNT -c .. -c .. Intrinsic Functions .. - - INTRINSIC ABS, AIMAG, REAL -c .. -c .. Statement Functions .. - - LOGICAL WRONG -c .. - SAVE XXSAV, CRESAV, MIMSAV, PERSAV, ANYSAV, NMOSAV, IPOSAV, - & NUMSAV, XMUSAV - - DATA TESTQE / 2.459791 /, - & TESTQS / 1.235144 /, - & TESTGQ / 1.139235 /, - & TESTSF / ( 61.49476, -3.177994 ) /, - & TESTSB / ( 1.493434, 0.2963657 ) /, - & TESTS1 / ( -0.1548380, -1.128972 ) /, - & TESTS2 / ( 0.05669755, 0.5425681 ) /, - & TESTTF / ( 12.95238, -136.6436 ), - & ( 48.54238, 133.4656 ) /, - & TESTTB / ( 41.88414, -15.57833 ), - & ( 43.37758, -15.28196 ) /, - & TESTPM / 227.1975, 183.6898 / - - DATA ACCUR / 1.E-4 / -c .. -c .. Statement Function definitions .. - - WRONG( CALC, EXACT ) = ABS( ( CALC - EXACT ) / EXACT ).GT.ACCUR -c .. - - - IF( .NOT.COMPAR ) THEN -c ** Save certain user input values - XXSAV = XX - CRESAV = CREFIN - MIMSAV = MIMCUT - PERSAV = PERFCT - ANYSAV = ANYANG - NMOSAV = NMOM - IPOSAV = IPOLZN - NUMSAV = NUMANG - XMUSAV = XMU( 1 ) -c ** Reset input values for test case - XX = 10.0 - CREFIN = ( 1.5, -0.1 ) - MIMCUT = 0.0 - PERFCT = .FALSE. - ANYANG = .TRUE. - NMOM = 1 - IPOLZN = -1 - NUMANG = 1 - XMU( 1 ) = -0.7660444 - - ELSE -c ** Compare test case results with -c ** correct answers and abort if bad - OK = .TRUE. - - IF( WRONG( QEXT,TESTQE ) ) - & OK = TSTBAD( 'QEXT', ABS( ( QEXT - TESTQE ) / TESTQE ) ) - - IF( WRONG( QSCA,TESTQS ) ) - & OK = TSTBAD( 'QSCA', ABS( ( QSCA - TESTQS ) / TESTQS ) ) - - IF( WRONG( GQSC,TESTGQ ) ) - & OK = TSTBAD( 'GQSC', ABS( ( GQSC - TESTGQ ) / TESTGQ ) ) - - IF( WRONG( REAL( SFORW ),REAL( TESTSF ) ) .OR. - & WRONG( AIMAG( SFORW ),AIMAG( TESTSF ) ) ) - & OK = TSTBAD( 'SFORW', ABS( ( SFORW - TESTSF ) / TESTSF ) ) - - IF( WRONG( REAL( SBACK ),REAL( TESTSB ) ) .OR. - & WRONG( AIMAG( SBACK ),AIMAG( TESTSB ) ) ) - & OK = TSTBAD( 'SBACK', ABS( ( SBACK - TESTSB ) / TESTSB ) ) - - IF( WRONG( REAL( S1(1) ),REAL( TESTS1 ) ) .OR. - & WRONG( AIMAG( S1(1) ),AIMAG( TESTS1 ) ) ) - & OK = TSTBAD( 'S1', ABS( ( S1(1) - TESTS1 ) / TESTS1 ) ) - - IF( WRONG( REAL( S2(1) ),REAL( TESTS2 ) ) .OR. - & WRONG( AIMAG( S2(1) ),AIMAG( TESTS2 ) ) ) - & OK = TSTBAD( 'S2', ABS( ( S2(1) - TESTS2 ) / TESTS2 ) ) - - - DO 10 N = 1, 2 - - IF( WRONG( REAL( TFORW(N) ),REAL( TESTTF(N) ) ) .OR. - & WRONG( AIMAG( TFORW(N) ), - & AIMAG( TESTTF(N) ) ) ) OK = TSTBAD( 'TFORW', - & ABS( ( TFORW(N) - TESTTF(N) ) / TESTTF(N) ) ) - - IF( WRONG( REAL( TBACK(N) ),REAL( TESTTB(N) ) ) .OR. - & WRONG( AIMAG( TBACK(N) ), - & AIMAG( TESTTB(N) ) ) ) OK = TSTBAD( 'TBACK', - & ABS( ( TBACK(N) - TESTTB(N) ) / TESTTB(N) ) ) - - 10 CONTINUE - - - DO 20 M = 0, 1 - - IF ( WRONG( PMOM(M,1), TESTPM(M) ) ) - & OK = TSTBAD( 'PMOM', ABS( (PMOM(M,1)-TESTPM(M)) / - & TESTPM(M) ) ) - - 20 CONTINUE - - - IF( .NOT.OK ) THEN - - PRNT( 1 ) = .TRUE. - PRNT( 2 ) = .TRUE. - CALCMO( 1 ) = .TRUE. - CALCMO( 2 ) = .FALSE. - CALCMO( 3 ) = .FALSE. - CALCMO( 4 ) = .FALSE. - - CALL MIPRNT( PRNT, XX, PERFCT, CREFIN, NUMANG, XMU, QEXT, - & QSCA, GQSC, NMOM, IPOLZN, MOMDIM, CALCMO, PMOM, - & SFORW, SBACK, TFORW, TBACK, S1, S2 ) - - CALL ERRMSG( 'MIEV0 -- Self-test failed',.TRUE.) - - END IF -c ** Restore user input values - XX = XXSAV - CREFIN = CRESAV - MIMCUT = MIMSAV - PERFCT = PERSAV - ANYANG = ANYSAV - NMOM = NMOSAV - IPOLZN = IPOSAV - NUMANG = NUMSAV - XMU( 1 ) = XMUSAV - - END IF - - RETURN - END - diff --git a/MAMchem_GridComp/optics/radiation.py b/MAMchem_GridComp/optics/radiation.py deleted file mode 100644 index 8c003aeb..00000000 --- a/MAMchem_GridComp/optics/radiation.py +++ /dev/null @@ -1,848 +0,0 @@ -#!/usr/bin/env python - -import os -from datetime import datetime -from math import sqrt, exp, log - -from scipy.special import erf, erfinv -import numpy as np -import netCDF4 - -from optics_ import mie -import gads - - -psd_number = 1 # number size distribution -psd_surface = 2 # surface size distrubution - -scheme_cs = 'Chou-Suarez' -scheme_rrtmg = 'RRTMG' - -bands_cs = {'shortwave': ( ( 0.175, 0.225), # 0 - ( 0.225, 0.285), # 1 - ( 0.285, 0.300), # 2 := 2 & 0 - ( 0.300, 0.325), # 3 - ( 0.325, 0.400), # ... - ( 0.400, 0.690), - ( 0.690, 1.220), - ( 1.220, 2.270), - ( 2.270, 3.850) ), - 'longwave': ( (29.412, 40.000), - (18.519, 29.412), - (12.500, 18.519), - (10.204, 12.500), - ( 9.091, 10.204), - ( 8.230, 9.091), - ( 7.246, 8.230), - ( 5.263, 7.246), - ( 3.333, 5.263), - (16.129, 18.519) ), - 'units': '1e-6 m'} - - -bands_rrtmg = {'shortwave': ( ( 2600, 3250), - ( 3250, 4000), - ( 4000, 4650), - ( 4650, 5150), - ( 5150, 6150), - ( 6150, 7700), - ( 7700, 8050), - ( 8050, 12850), - (12850, 16000), - (16000, 22650), - (22650, 29000), - (29000, 38000), - (38000, 50000), - ( 820, 2600) ), - 'longwave': ( ( 10, 350), - ( 350, 500), - ( 500, 630), - ( 630, 700), - ( 700, 820), - ( 820, 980), - ( 980, 1080), - ( 1080, 1180), - ( 1180, 1390), - ( 1390, 1480), - ( 1480, 1800), - ( 1800, 2080), - ( 2080, 2250), - ( 2250, 2380), - ( 2380, 2600), - ( 2600, 3250) ), - 'units': 'cm-1'} - - -def geos5_bands(scheme=scheme_cs, units='m', spectrum=None): - - ''' - Returns bands of GEOS-5 radiation scheme. - ''' - - assert scheme == scheme_cs - - assert units == 'm' - - - bands = None - - if scheme == scheme_cs: - bands = bands_cs - - if scheme == scheme_rrtmg: - bands = bands_rrtmg - - - if spectrum is not None: - if spectrum.lower() == 'shortwave' or spectrum.lower() == 'solar': - _spectrum = 'shortwave' - - if spectrum.lower() == 'longwave' or spectrum.lower() == 'infrared': - _spectrum = 'longwave' - else: - _spectrum = None - - - if _spectrum is None: - result = 1e-6 * np.array(bands['shortwave'] + bands['longwave']) - else: - result = 1e-6 * np.array(bands[_spectrum]) - - return result - - -class LUT: - ''' - Class to compute and write aerosol optics lookup tables - following the approach of Ghan and Zaveri (JGR, 2007). - ''' - - def __init__(self, wavelengths=None, bands=None, - N_re=10, N_im=20, N_size=100, N_cheb=20, - components=('OC', 'BC', 'SU', 'SS', 'DU', 'AMM', 'WATER'), - sigma=2.0, surface_mode_diameter=(2*0.01e-6, 2*25.0e-6), - deliq=0.80, cryst=0.35, - scheme=scheme_cs, dir='/home/adarmeno/sandbox/colarco/radiation/gads/optdat/', - N_integration_bins=10000, verbose=False): - - - assert (wavelengths is not None) != (bands is not None) - - # LUT's parameters - self.wavelengths = wavelengths # monochromatic wavelengths, 'm' - self.bands = bands # bands, 'm' - - self.N_re = N_re # number of discrete refractive indexes - self.N_im = N_im # for real and imaginary parts - - self.N_size = N_size # number of discrete sizes - - self.N_cheb = N_cheb # number of Chebyshev's expansion terms - - self.N_integration_bins = N_integration_bins # number of bins used to integrate optics over the size distribution - - # aerosol mode parameters - self.components = components # aerosol components in aerosol mode - self.sigma = sigma # geometric standard deviation of aerosol mode size distribution - self.deliq = deliq # deliq. point - self.cryst = cryst # cryst. point - self.Dgs_min = np.min(surface_mode_diameter[:2]) # range of surface mode sizes, 'm' - self.Dgs_max = np.max(surface_mode_diameter[:2]) # ... - - # misc - self.verbose = verbose # verbosity - self.scheme = scheme # flag to handle the odd/compound bands in Chow-Suarez scheme - self.gads_optics_dir = dir # full path to GADS aerosol files - - - # quire GADS optics - n_re_min, n_re_max, n_im_min, n_im_max, n = gads.refractive_index(components = self.components, - bands = self.bands, - wavelengths = self.wavelengths, - dir = self.gads_optics_dir, - verbose = verbose) - - print 'Re(n)', n_re_min, n_re_max - print 'Im(n)', n_im_min, n_im_max - print 'n =', n - - if self.bands is not None and self.scheme == scheme_cs: - # widths of band 0 and 2 - d0 = self.bands[0][1] - self.bands[0][0] - d2 = self.bands[2][1] - self.bands[2][0] - - # weights for band 0 and 2 - w0 = d0 / (d0 + d2) - w2 = d2 / (d0 + d2) - - for s in self.components: - n[s]['re'][2] = w0*n[s]['re'][0] + w2*n[s]['re'][2] - n[s]['im'][2] = w0*n[s]['im'][0] + w2*n[s]['im'][2] - - n_re_min[2] = np.min((n_re_min[2], n[s]['re'][2])) - n_re_max[2] = np.max((n_re_min[2], n[s]['re'][2])) - n_im_min[2] = np.min((n_im_min[2], n[s]['im'][2])) - n_im_max[2] = np.max((n_im_min[2], n[s]['im'][2])) - - - print 'Re(n)', n_re_min, n_re_max - print 'Im(n)', n_im_min, n_im_max - print 'n =', n - - # set refractive indexes for sampling - self.n_component = n # refractive indexes of the aerosol components at wavelengths/bands - - self.n_re = None # sampled refractive_indexes - real part - self.n_im = None # sampled refractive_indexes - imaginary part - - if self.bands is not None: - self.n_re = [self.__sample_refractive_index_real(min=n_re_min[b], max=n_re_max[b]) for b in range(len(self.bands))] - self.n_im = [self.__sample_refractive_index_imaginary(min=n_im_min[b], max=n_im_max[b]) for b in range(len(self.bands))] - - if self.wavelengths is not None: - self.n_re = [self.__sample_refractive_index_real(min=n_re_min[w], max=n_re_max[w]) for w in range(len(self.wavelengths))] - self.n_im = [self.__sample_refractive_index_imaginary(min=n_im_min[w], max=n_im_max[w]) for w in range(len(self.wavelengths))] - - - # set sizes for sampling - self.Dgs = self.__sample_size() - - - def __sample_refractive_index_real(self, min, max): - ''' - Returns the values of the real component of the refractive index - used to create the Mie LUT. - - Ghan and Zaveri (JGR, 2007) recommend values that are equally - spaced. - ''' - - result = np.linspace(min, max, num=self.N_re, endpoint=True) - return result - - - def __sample_refractive_index_imaginary(self, min, max): - ''' - Returns the values of the imaginary component of the refractive index - used to create the Mie LUT. - - Ghan and Zaveri (JGR, 2007) recommend values that are equally - spaced in log-space. - ''' - - # note that 0.0 is added as the first value - result = [0.0, ] + [max * pow(max/min, float(n - self.N_im + 1)/(self.N_im-2)) for n in range(1, self.N_im)] - return result - - - def __sample_size(self, logspace=True): - ''' - Returns discretized values of aerosol mode size. - ''' - - if logspace: - # x = (2log(D) - log(D_min) - log(D_max)) / (log(D_max) - log(D_min)) - x = np.linspace(-1.0, 1.0, num=self.N_size, endpoint=True) - result = np.exp(0.5 * (x * (log(self.Dgs_max) - log(self.Dgs_min)) + log(self.Dgs_max) + log(self.Dgs_min))) - else: - result = np.linspace(self.Dgs_min, self.Dgs_max, num=self.N_size, endpoint=True) - - return result - - - def __psd_lognormal_bounds(self, Dg, sigma, eps=1e-5): - ''' - Computes lower and upper bounds such that - CDF(x_low) = eps/2 = (1 - integral)/2 - 1 - CDF(x_up) = eps/2 = (1 - integral)/2 - - The PSD is assumed to be normalized. - ''' - - def CDF(x, Dg, sigma): - return 0.5 + 0.5*erf((log(x) - log(Dg))/sqrt(2*log(sigma)*log(sigma))) - - def CDFinv(cdf, Dg, sigma): - return Dg * exp(sqrt(2*log(sigma)*log(sigma)) * erfinv(2*cdf - 1)) - - D_low = CDFinv(0.5*eps, Dg, sigma) - D_up = CDFinv(1.0 - 0.5*eps, Dg, sigma) - - return (D_low, D_up) - - - def _monochromatic_optics(self, refractive_index=complex(1.75, -4.5e-1), wavelength=0.550e-6, psd=psd_surface): - ''' - Monochromatic optics calculations for a list of surface sizes and - fixed wavelength and refractive index: - - wavelength wavelength for Mie calculations, 'm' - integration_bins number of bins used to integrate the size distribution - psd particle size distribution, psd_number=1 or psd_surface=2 - - Returns mass specific extinction, scattering and asymmetry parameter. - ''' - - # integration methods - nim_midpoint = 1 - nim_simpson = 2 - - ext = np.zeros(self.N_size) - sca = np.zeros_like(ext) - g = np.zeros_like(ext) - - for i in range(self.N_size): - - D = self.Dgs[i] - D_min, D_max = self.__psd_lognormal_bounds(D, self.sigma) - - ext[i], sca[i], g[i] = mie.scattering_lognormal(psd, - D, - self.sigma, - refractive_index, - wavelength, - D_min, - D_max, - intervals=self.N_integration_bins, - specific=True, - method=nim_midpoint) - - return ext, sca, g - - - def __compute_monochromatic_optics(self): - ''' - Computes monochromatic LUT. - ''' - - assert self.wavelengths is not None - - # x in [-1, 1] - x = (2*np.log(self.Dgs) - log(self.Dgs_min) - log(self.Dgs_max)) / (log(self.Dgs_max) - log(self.Dgs_min)) - - - fit_dims = (self.N_cheb, self.N_re, self.N_im, len(self.wavelengths)) - - c_sca = np.zeros(fit_dims) - c_ext = np.zeros(fit_dims) - c_g = np.zeros(fit_dims) - - for i in range(self.N_re): - for j in range(self.N_im): - - for l in range(len(self.wavelengths)): - - print i, j, l - - n = complex(self.n_re[l][i], self.n_im[l][j]) - w = self.wavelengths[l] - - ext, sca, g = self._monochromatic_optics(refractive_index=n, wavelength=w) - - c_ext[:,i,j,l] = np.polynomial.chebyshev.chebfit(x, ext, self.N_cheb-1) - c_sca[:,i,j,l] = np.polynomial.chebyshev.chebfit(x, sca, self.N_cheb-1) - c_g [:,i,j,l] = np.polynomial.chebyshev.chebfit(x, g, self.N_cheb-1) - - return ext, sca, g, c_ext, c_sca, c_g - - - def __compute_bandaveraged_optics(self, glq_order=7): - ''' - Computes band-averaged LUT. - ''' - - assert self.bands is not None - - # Gauss-Legendre quadrature (n=3) - glq_w_n3 = (0.8888888888888888, 0.5555555555555556, 0.5555555555555556) - glq_x_n3 = (0.0000000000000000,-0.7745966692414834, 0.7745966692414834) - - # Gauss-Legendre quadrature (n=5) - glq_w_n5 = (0.5688888888888889, 0.4786286704993665, 0.4786286704993665, 0.2369268850561891, 0.2369268850561891) - glq_x_n5 = (0.0000000000000000,-0.5384693101056831, 0.5384693101056831,-0.9061798459386640, 0.9061798459386640) - - # Gauss-Legendre quadrature (n=7) - glq_w_n7 = (0.4179591836734694, 0.3818300505051189, 0.3818300505051189, 0.2797053914892766, 0.2797053914892766, 0.1294849661688697, 0.1294849661688697) - glq_x_n7 = (0.0000000000000000, 0.4058451513773972,-0.4058451513773972,-0.7415311855993945, 0.7415311855993945,-0.9491079123427585, 0.9491079123427585) - - # Gauss-Legendre quadrature (n=9) - glq_w_n9 = (0.3302393550012598, 0.1806481606948574, 0.1806481606948574, 0.0812743883615744, 0.0812743883615744, 0.3123470770400029, 0.3123470770400029, 0.2606106964029354, 0.2606106964029354) - glq_x_n9 = (0.0000000000000000,-0.8360311073266358, 0.8360311073266358,-0.9681602395076261, 0.9681602395076261,-0.3242534234038089, 0.3242534234038089,-0.6133714327005904, 0.6133714327005904) - - - if glq_order == 3: - glq_w = glq_w_n3 - glq_x = glq_x_n3 - elif glq_order == 5: - glq_w = glq_w_n5 - glq_x = glq_x_n5 - elif glq_order == 7: - glq_w = glq_w_n7 - glq_x = glq_x_n7 - else: - glq_w = glq_w_n9 - glq_x = glq_x_n9 - - - # x in [-1, 1] - x = (2*np.log(self.Dgs) - log(self.Dgs_min) - log(self.Dgs_max)) / (log(self.Dgs_max) - log(self.Dgs_min)) - - dims = (self.N_size, self.N_re, self.N_im, len(self.bands)) - - ext = np.zeros(dims) - sca = np.zeros(dims) - g = np.zeros(dims) - - for i in range(self.N_re): - for j in range(self.N_im): - - for l in range(len(self.bands)): - - print i, j, l - n = complex(self.n_re[l][i], self.n_im[l][j]) - - # integrate - w_l, w_u = self.bands[l] # band range - b_w = 0.5*(w_u - w_l) # band half width - b_c = 0.5*(w_u + w_l) # band center - - for q in range(len(glq_w)): - w = b_w * glq_x[q] + b_c - - _ext, _sca, _g = self._monochromatic_optics(refractive_index=n, wavelength=w) - - ext[:,i,j,l] = ext[:,i,j,l] + 0.5 * glq_w[q] * _ext - sca[:,i,j,l] = sca[:,i,j,l] + 0.5 * glq_w[q] * _sca - g[:,i,j,l] = g[:,i,j,l] + 0.5 * glq_w[q] * _g - - - # compound bands - # code is not safe because it assumes that band[0] and band[2] are in the list of bands - if self.scheme == scheme_cs: - - # widths of band 0 and 2 - d0 = self.bands[0][1] - self.bands[0][0] - d2 = self.bands[2][1] - self.bands[2][0] - - # weights for band 0 and 2 - w0 = d0 / (d0 + d2) - w2 = d2 / (d0 + d2) - - ext[:,:,:,2] = w0*ext[:,:,:,0] + w2*ext[:,:,:,2] - sca[:,:,:,2] = w0*sca[:,:,:,0] + w2*sca[:,:,:,2] - g [:,:,:,2] = w0* g[:,:,:,0] + w2*g [:,:,:,2] - - - # ... let's assume we are working with Chow-Suarez scheme for now - fit_dims = (self.N_cheb, self.N_re, self.N_im, len(self.bands)) - - c_sca = np.zeros(fit_dims) - c_ext = np.zeros(fit_dims) - c_g = np.zeros(fit_dims) - - for i in range(self.N_re): - for j in range(self.N_im): - - for l in range(len(self.bands)): - - c_ext[:,i,j,l] = np.polynomial.chebyshev.chebfit(x, ext[:,i,j,l], self.N_cheb-1) - c_sca[:,i,j,l] = np.polynomial.chebyshev.chebfit(x, sca[:,i,j,l], self.N_cheb-1) - c_g [:,i,j,l] = np.polynomial.chebyshev.chebfit(x, g[:,i,j,l], self.N_cheb-1) - - return ext, sca, g, c_ext, c_sca, c_g - - - def compute(self): - ''' - Computes and returns ext, sca, asymmetry paramter and corresponding - coefficients of chebyshev expansion. - ''' - - if self.wavelengths is not None: - result = self.__compute_monochromatic_optics() - - if self.bands is not None: - result = self.__compute_bandaveraged_optics() - - return result - - def save(self, file, c_ext=None, c_sca=None, c_g=None, title='', comment='', history='', n_chars=80): - - if self.wavelengths is not None: - self.__save_monochromatic(file, c_ext, c_sca, c_g, title, comment, history, n_chars) - - if self.bands is not None: - self.__save_band_averaged(file, c_ext, c_sca, c_g, title, comment, history, n_chars) - - - def __save_monochromatic(self, file, c_ext, c_sca, c_g, title, comment, history, n_chars): - - f = netCDF4.Dataset(file, 'w', format='NETCDF4') - - # global attributes - f.Conventions = 'CF' - f.institution = 'NASA ' - f.source = 'NASA/GSFC/GMAO GEOS-5 Aerosol Group' - f.contact = 'Anton Darmenov, anton.s.darmenov@nasa.gov' - f.creation_date = datetime.isoformat(datetime.now()) - f.title = title - f.comment = comment - f.references = 'Ghan, S. J., and R. A. Zaveri (2007, doi:10.1029/2006JD007927); Global Aerosol Data Set (GADS).' - f.history = history - f.aerosol_method= 'modal' - f.optics = 'monochromatic' - f.mode_width = self.sigma - f.mode_deliq = self.deliq - f.mode_cryst = self.cryst - f.Dgs_min = self.Dgs_min - f.Dgs_max = self.Dgs_max - f.x = '(2*np.log(Dgs) - log(Dgs_min) - log(Dgs_max)) / (log(Dgs_max) - log(Dgs_min))' - - # dimensions - f.createDimension('band', len(self.wavelengths)) - - f.createDimension('n_re', self.N_re) - f.createDimension('n_im', self.N_im) - f.createDimension('k', self.N_cheb) - f.createDimension('component', len(self.components)) - f.createDimension('nchars', n_chars) - f.createDimension('range', 2) - - # variables - var_k = f.createVariable('k', 'i4', ('k')) - var_band = f.createVariable('band', 'i4', ('band')) - var_wavelength = f.createVariable('wavelength', 'f8', ('range', 'band')) - var_component = f.createVariable('component', 'S1', ('component', 'nchars')) - - var_component_n_re = f.createVariable('component_n_re', 'f8', ('component', 'band')) - var_component_n_im = f.createVariable('component_n_im', 'f8', ('component', 'band')) - - var_n_re = f.createVariable('n_re', 'f8', ('n_re', 'band')) - var_n_im = f.createVariable('n_im', 'f8', ('n_im', 'band')) - - assert c_ext.shape == (self.N_cheb, self.N_re, self.N_im, len(self.wavelengths)) - assert c_sca.shape == c_ext.shape - assert c_g.shape == c_ext.shape - - var_c_ext = f.createVariable('c_ext', 'f8', ('k', 'n_re', 'n_im', 'band')) - var_c_sca = f.createVariable('c_sca', 'f8', ('k', 'n_re', 'n_im', 'band')) - var_c_asy = f.createVariable('c_asy', 'f8', ('k', 'n_re', 'n_im', 'band')) - - # variables attributes - var_band.long_name = 'radiation_band' - var_band.standard_name = 'radiation_band' - var_band.units = '1' - - var_wavelength.long_name = 'wavelength_range' - var_wavelength.standard_name = 'wavelength_range_of_radiation_band' - var_wavelength.units = 'm' - - var_k.long_name = 'degree_of_chebyshev_polynomial' - var_k.standard_name = 'degree_of_chebyshev_polynomial' - var_k.units = '1' - - var_component.long_name = 'aerosol_component' - var_component.standard_name = 'name_of_aerosol_component' - - var_component_n_re.long_name = 'component_refractive_index_real_part' - var_component_n_re.standard_name = 'real_part_of_refractive_index_of_aerosol_component' - var_component_n_re.units = '1' - - var_component_n_im.long_name = 'component_refractive_index_real_part' - var_component_n_im.standard_name = 'imaginary_part_of_refractive_index_of_aerosol_component' - var_component_n_im.units = '1' - - var_n_re.long_name = 'refractive_index_real_part' - var_n_re.standard_name = 'real_part_of_refractive_index_of_ambient_aerosol' - var_n_re.units = '1' - - var_n_im.long_name = 'refractive_index_imaginary_part' - var_n_im.standard_name = 'imaginary_part_of_refractive_index_of_ambient_aerosol' - var_n_im.units = '1' - - var_c_ext.long_name = 'c_ext' - var_c_ext.standard_name = 'coefficients_of_chebyshev_expansion_of_extinction_coefficient' - var_c_ext.units = 'm-2 kg' - - var_c_sca.long_name = 'c_sca' - var_c_sca.standard_name = 'coefficients_of_chebyshev_expansion_of_scattering_coefficient' - var_c_sca.units = 'm-2 kg' - - var_c_asy.long_name = 'c_asy' - var_c_asy.standard_name = 'coefficients_of_chebyshev_expansion_of_asymmetry_parameter' - var_c_asy.units = '1' - - # data - var_band[:] = 1 + np.arange(len(self.wavelengths)) - - var_wavelength[0,:] = self.wavelengths[:] - var_wavelength[1,:] = self.wavelengths[:] - - var_k[:] = range(self.N_cheb) - - for c in range(len(self.components)): - var_component[c] = netCDF4.stringtoarr(self.components[c], n_chars) - - var_component_n_re[c,:] = self.n_component[self.components[c]]['re'] - var_component_n_im[c,:] = self.n_component[self.components[c]]['im'] - - for w in range(len(self.wavelengths)): - var_n_re[:,w] = self.n_re[w] - var_n_im[:,w] = self.n_im[w] - - for w in range(len(self.wavelengths)): - var_c_ext[:,:,:,w] = c_ext[:,:,:,w] - var_c_sca[:,:,:,w] = c_sca[:,:,:,w] - var_c_asy[:,:,:,w] = c_g[:,:,:,w] - - f.close() - - - def __save_band_averaged(self, file, c_ext, c_sca, c_g, title, comment, history, n_chars): - - f = netCDF4.Dataset(file, 'w', format='NETCDF4') - - # global attributes - f.Conventions = 'CF' - f.institution = 'NASA ' - f.source = 'NASA/GSFC/GMAO GEOS-5 Aerosol Group' - f.contact = 'Anton Darmenov, anton.s.darmenov@nasa.gov' - f.creation_date = datetime.isoformat(datetime.now()) - f.title = title - f.comment = comment - f.references = 'Ghan, S. J., and R. A. Zaveri (2007, doi:10.1029/2006JD007927); Global Aerosol Data Set (GADS).' - f.history = history - f.aerosol_method= 'modal' - f.optics = 'band averaged' - f.mode_width = self.sigma - f.mode_deliq = self.deliq - f.mode_cryst = self.cryst - f.Dgs_min = self.Dgs_min - f.Dgs_max = self.Dgs_max - f.x = '(2*np.log(Dgs) - log(Dgs_min) - log(Dgs_max)) / (log(Dgs_max) - log(Dgs_min))' - - - # dimensions - f.createDimension('band', len(self.bands[1:])) - - f.createDimension('n_re', self.N_re) - f.createDimension('n_im', self.N_im) - f.createDimension('k', self.N_cheb) - f.createDimension('component', len(self.components)) - f.createDimension('nchars', n_chars) - f.createDimension('range', 2) - - # variables - var_k = f.createVariable('k', 'i4', ('k')) - var_band = f.createVariable('band', 'i4', ('band')) - var_wavelength = f.createVariable('wavelength', 'f8', ('range', 'band')) - var_component = f.createVariable('component', 'S1', ('component', 'nchars')) - - var_component_n_re = f.createVariable('component_n_re', 'f8', ('component', 'band')) - var_component_n_im = f.createVariable('component_n_im', 'f8', ('component', 'band')) - - var_n_re = f.createVariable('n_re', 'f8', ('n_re', 'band')) - var_n_im = f.createVariable('n_im', 'f8', ('n_im', 'band')) - - assert c_ext.shape == (self.N_cheb, self.N_re, self.N_im, len(self.bands)) - assert c_sca.shape == c_ext.shape - assert c_g.shape == c_ext.shape - - var_c_ext = f.createVariable('c_ext', 'f8', ('k', 'n_re', 'n_im', 'band')) - var_c_sca = f.createVariable('c_sca', 'f8', ('k', 'n_re', 'n_im', 'band')) - var_c_asy = f.createVariable('c_asy', 'f8', ('k', 'n_re', 'n_im', 'band')) - - # variables attributes - var_band.long_name = 'radiation_band' - var_band.standard_name = 'radiation_band' - var_band.units = '1' - - var_wavelength.long_name = 'wavelength_range' - var_wavelength.standard_name = 'wavelength_range_of_radiation_band' - var_wavelength.units = ('m') - - var_k.long_name = 'degree_of_chebyshev_polynomial' - var_k.standard_name = 'degree_of_chebyshev_polynomial' - var_k.units = '1' - - var_component.long_name = 'aerosol_component' - var_component.standard_name = 'name_of_aerosol_component' - - var_component_n_re.long_name = 'component_refractive_index_real_part' - var_component_n_re.standard_name = 'real_part_of_refractive_index_of_aerosol_component' - var_component_n_re.units = '1' - - var_component_n_im.long_name = 'component_refractive_index_real_part' - var_component_n_im.standard_name = 'imaginary_part_of_refractive_index_of_aerosol_component' - var_component_n_im.units = '1' - - var_n_re.long_name = 'refractive_index_real_part' - var_n_re.standard_name = 'real_part_of_refractive_index_of_ambient_aerosol' - var_n_re.units = '1' - - var_n_im.long_name = 'refractive_index_imaginary_part' - var_n_im.standard_name = 'imaginary_part_of_refractive_index_of_ambient_aerosol' - var_n_im.units = '1' - - var_c_ext.long_name = 'c_ext' - var_c_ext.standard_name = 'coefficients_of_chebyshev_expansion_of_extinction_coefficient' - var_c_ext.units = 'm-2 kg' - - var_c_sca.long_name = 'c_sca' - var_c_sca.standard_name = 'coefficients_of_chebyshev_expansion_of_scattering_coefficient' - var_c_sca.units = 'm-2 kg' - - var_c_asy.long_name = 'c_asy' - var_c_asy.standard_name = 'coefficients_of_chebyshev_expansion_of_asymmetry_parameter' - var_c_asy.units = '1' - - # data - var_band[:] = 1 + np.arange(len(self.bands[1:])) - - for b in 1 + np.arange(len(self.bands[1:])): - var_wavelength[:, b-1] = self.bands[b] - - var_k[:] = range(self.N_cheb) - - for c in range(len(self.components)): - var_component[c] = netCDF4.stringtoarr(self.components[c], n_chars) - - var_component_n_re[c,:] = self.n_component[self.components[c]]['re'][1:] - var_component_n_im[c,:] = self.n_component[self.components[c]]['im'][1:] - - for b in 1 + np.arange(len(self.bands[1:])): - var_n_re[:,b-1] = self.n_re[b] - var_n_im[:,b-1] = self.n_im[b] - - for b in 1 + np.arange(len(self.bands[1:])): - var_c_ext[:,:,:,b-1] = c_ext[:,:,:,b] - var_c_sca[:,:,:,b-1] = c_sca[:,:,:,b] - var_c_asy[:,:,:,b-1] = c_g[:,:,:,b] - - f.close() - - -def test_specific_monochromatic_optics(figure='optics-specific.png'): - - def num2surf(Dgn, sigma): - return Dgn * np.exp(2.0*np.log(sigma)*np.log(sigma)) - - def surf2num(Dgs, sigma): - return Dgs / np.exp(2.0*np.log(sigma)*np.log(sigma)) - - from matplotlib import pyplot as plt - - wavelengths = (0.550e-6,) - - lut = LUT(wavelengths=wavelengths, - surface_mode_diameter=(2*0.01e-6, 2*25.0e-6), - sigma=2.0, - components=('su', 'water'), - N_size=100, - N_integration_bins=10000, - verbose=False) - - ext, sca, g = lut._monochromatic_optics(wavelength=0.550e-6, refractive_index=complex(1.9, -0.6), psd=psd_surface) - - plt.clf() - - fig, ax1 = plt.subplots() - l1 = ax1.plot(1e6*0.5*lut.Dgs, 1e-3*ext , color='gray', label=r'specific extinction, $m^2 g^{-1}$') - l2 = ax1.plot(1e6*0.5*lut.Dgs, 1e-3*(ext-sca), color='red', label=r'specific absorption, $m^2 g^{-1}$') - l3 = ax1.plot(1e6*0.5*lut.Dgs, 1e-3*( sca), color='blue', label=r'specific scattering, $m^2 g^{-1}$') - ax1.set_xscale('log', basex=10) - - ax2 = ax1.twinx() - ax2.set_ylim((0.0, 1.0)) - l4 = ax2.plot(1e6*0.5*lut.Dgs, g, linestyle='-' , color='black', label=r'asymmetry parameter') - l5 = ax2.plot(1e6*0.5*lut.Dgs, sca/ext, linestyle='--', color='black', label=r'single scattering albedo') - - lines = l1 + l2 + l3 + l4 + l5 - lbls = [l.get_label() for l in lines] - ax1.legend(lines, lbls, loc='lower right', frameon=False, prop={'size': 18}) - - ax1.set_xlabel(r'Surface mode radius, ${\mu}m$', fontsize=18) - - plt.title(r'Black Carbon, $\lambda = 0.55 {\mu}m$, $n=1.9 -i0.6$, $\sigma = 2$', fontsize=18) - plt.savefig('optics-specific.psd-surface.png', bbox_inches='tight') - - - lut = LUT(wavelengths=wavelengths, - surface_mode_diameter=(surf2num(2*0.01e-6,2), surf2num(2*25.0e-6,2)), - sigma=2.0, - components=('su', 'water'), - N_size=100, - N_integration_bins=10000, - verbose=False) - - ext, sca, g = lut._monochromatic_optics(wavelength=0.550e-6, refractive_index=complex(1.9, -0.6), psd=psd_number) - - plt.clf() - plt.plot(1e6*0.5*num2surf(lut.Dgs,2), 1e-3*ext , color='gray', label=r'specific extinction, $m^2 g^{-1}$') - plt.plot(1e6*0.5*num2surf(lut.Dgs,2), 1e-3*(ext-sca), color='red', label=r'specific absorption, $m^2 g^{-1}$') - plt.plot(1e6*0.5*num2surf(lut.Dgs,2), 1e-3*( sca), color='blue', label=r'specific scattering, $m^2 g^{-1}$') - plt.plot(1e6*0.5*num2surf(lut.Dgs,2), g, color='black', label=r'asymmetry parameter') - plt.xscale('log', basex=10) - plt.legend(loc='upper right', frameon=False, prop={'size': 18}) - plt.title(r'Black Carbon, $\lambda = 0.55 {\mu}m$, $n=1.9 -i0.6$, $\sigma = 2$', fontsize=18) - plt.xlabel(r'Surface mode radius, ${\mu}m$', fontsize=18) - plt.savefig('optics-specific.psd-number.png', bbox_inches='tight') - - - - -if __name__ == '__main__': - - tests = True - - gads_dir = '/home/adarmeno/sandbox/colarco/radiation/gads/optdat/' - - # greate GADS object to read the GADS/OPAC wavelegths - insol = gads.GADS(os.path.join(gads_dir, 'inso00')) - - - wavelengths_gads = insol.wavelengths() - bands_geos5 = geos5_bands(scheme=scheme_cs) - - ''' - # monochromatic LUT - wavelengths = (0.50e-6, 0.550e-6, 0.600e-6) - - lut = LUT(wavelengths=wavelengths, - surface_mode_diameter=(2*0.01e-6, 2*25.0e-6), - sigma=2.0, - components=('su', 'water', 'oc', 'bc', 'du'), - N_re=3, - N_im=4, - N_cheb=5, - N_size=10, - N_integration_bins=20, - verbose=False) - - ext, sca, g, c_ext, c_sca, c_g = lut.compute() - - lut.save('foo-mono.nc4', c_ext, c_sca, c_g, title='', comment='', history='') - ''' - - - # band-averaged LUT - bands = bands_geos5[:] - - lut = LUT(bands=bands, - surface_mode_diameter=(2*0.01e-6, 2*25.0e-6), - sigma=2.0, - components=('su', 'water', 'oc', 'bc', 'du'), - N_re=3, - N_im=4, - N_cheb=5, - N_size=10, - N_integration_bins=20, - verbose=False) - - ext, sca, g, c_ext, c_sca, c_g = lut.compute() - - lut.save('foo-band.nc4', c_ext, c_sca, c_g, title='', comment='', history='') - - - if tests: - test_specific_monochromatic_optics() diff --git a/MAMchem_GridComp/optics/tests/ut_gads.py b/MAMchem_GridComp/optics/tests/ut_gads.py deleted file mode 100755 index 105d05d4..00000000 --- a/MAMchem_GridComp/optics/tests/ut_gads.py +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/env python - -import numpy as np - -import gads - - -if __name__ == '__main__': - - from matplotlib import pyplot as plt - - OPT_DATA = '/home/adarmeno/sandbox/colarco/radiation/gads/optdat/' - - BANDS_CS = {'shortwave': ( ( 0.225, 0.285), - ( 0.175, 0.225), (0.285, 0.300), - ( 0.300, 0.325), - ( 0.325, 0.400), - ( 0.400, 0.690), - ( 0.690, 1.220), - ( 1.220, 2.270), - ( 2.270, 3.850) ), - 'longwave': ( (18.519, 29.412), - (12.500, 18.519), - (10.204, 12.500), - ( 9.091, 10.204), - ( 8.230, 9.091), - ( 7.246, 8.230), - ( 5.263, 7.246), - ( 3.333, 5.263), - (16.129, 18.519) ), - 'units': '1e-6 m'} - - - BANDS_RRTMG = {'shortwave': ( ( 2600, 3250), - ( 3250, 4000), - ( 4000, 4650), - ( 4650, 5150), - ( 5150, 6150), - ( 6150, 7700), - ( 7700, 8050), - ( 8050, 12850), - (12850, 16000), - (16000, 22650), - (22650, 29000), - (29000, 38000), - (38000, 50000), - ( 820, 2600) ), - 'longwave': ( ( 10, 350), - ( 350, 500), - ( 500, 630), - ( 630, 700), - ( 700, 820), - ( 820, 980), - ( 980, 1080), - ( 1080, 1180), - ( 1180, 1390), - ( 1390, 1480), - ( 1480, 1800), - ( 1800, 2080), - ( 2080, 2250), - ( 2250, 2380), - ( 2380, 2600), - ( 2600, 3250) ), - 'units': 'cm-1'} - - - # test min/max refractive insex of aerosol components - bands = 1e-6 * np.array(BANDS_CS['shortwave'] + BANDS_CS['longwave']) - _ = refractive_index(components=('OC', 'BC', 'SU', 'SS', 'DU', 'AMM', 'WATER'), bands=bands, verbose=True ) - - - # Organic carbon - insol = GADS(os.path.join(OPT_DATA, 'inso00')) - oc = insol - - # Black carbon - soot = GADS(os.path.join(OPT_DATA, 'soot00')) - bc = soot - - - # Sulfate - waso = GADS(os.path.join(OPT_DATA, 'waso00')) - su = waso - - # Dust: same spectral refractive indexes - miam = GADS(os.path.join(OPT_DATA, 'miam00')) - micm = GADS(os.path.join(OPT_DATA, 'micm00')) - minm = GADS(os.path.join(OPT_DATA, 'minm00')) - mitr = GADS(os.path.join(OPT_DATA, 'mitr00')) - du = miam - - # Sea salt: same spectral refractive indexes - ssam = GADS(os.path.join(OPT_DATA, 'ssam00')) - sscm = GADS(os.path.join(OPT_DATA, 'sscm00')) - ss = ssam - - # water (clouds) - cucc = GADS(os.path.join(OPT_DATA, 'cucc00')) - cucp = GADS(os.path.join(OPT_DATA, 'cucp00')) - cuma = GADS(os.path.join(OPT_DATA, 'cuma00')) - stco = GADS(os.path.join(OPT_DATA, 'stco00')) - stma = GADS(os.path.join(OPT_DATA, 'stma00')) - water= cucc - - - species = {'OC' : (oc, 'gray' ), - 'BC' : (bc, 'black'), - 'SU' : (su, 'green'), - 'SS' : (ss, 'lightblue' ), - 'DU' : (du, 'red' ), - 'WATER': (water, 'blue' )} - - - assert np.array_equal(oc.wavelengths(), bc.wavelengths()) - assert np.array_equal(oc.wavelengths(), du.wavelengths()) - assert np.array_equal(oc.wavelengths(), su.wavelengths()) - assert np.array_equal(oc.wavelengths(), ss.wavelengths()) - - - # GADS/OPAC wavelength in 'um' - w = 1e6*oc.wavelengths() - print 'GADS/OPAC wavelengths [um] = ', w - - BANDS = BANDS_CS - - - band = 1e-6*np.array(BANDS['shortwave'] + BANDS['longwave']) - band_center = [0.5*(b[0] + b[1]) for b in band] - band_lbound = [b[0] for b in band] - band_ubound = [b[1] for b in band] - - n_oc_center = oc.refractive_index(wavelengths=band_center) - n_oc_lbound = oc.refractive_index(wavelengths=band_lbound) - n_oc_ubound = oc.refractive_index(wavelengths=band_ubound) - n_oc_ave = oc.refractive_index(bands=band) - - n_bc_center = bc.refractive_index(wavelengths=band_center) - n_bc_lbound = bc.refractive_index(wavelengths=band_lbound) - n_bc_ubound = bc.refractive_index(wavelengths=band_ubound) - n_bc_ave = bc.refractive_index(bands=band) - - n_su_center = su.refractive_index(wavelengths=band_center) - n_su_lbound = su.refractive_index(wavelengths=band_lbound) - n_su_ubound = su.refractive_index(wavelengths=band_ubound) - n_su_ave = su.refractive_index(bands=band) - - n_du_center = du.refractive_index(wavelengths=band_center) - n_du_lbound = du.refractive_index(wavelengths=band_lbound) - n_du_ubound = du.refractive_index(wavelengths=band_ubound) - n_du_ave = du.refractive_index(bands=band) - - n_ss_center = ss.refractive_index(wavelengths=band_center) - n_ss_lbound = ss.refractive_index(wavelengths=band_lbound) - n_ss_ubound = ss.refractive_index(wavelengths=band_ubound) - n_ss_ave = ss.refractive_index(bands=band) - - n_wt_center = water.refractive_index(wavelengths=band_center) - n_wt_lbound = water.refractive_index(wavelengths=band_lbound) - n_wt_ubound = water.refractive_index(wavelengths=band_ubound) - n_wt_ave = water.refractive_index(bands=band) - - - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print ' Chou-Suarez OC BC SU DU SS Water Effective ' - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print 'band center[um] bounds[um] center averaged center averaged center averaged center averaged center averaged center averaged min max ' - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - for n in range(len(band)): - print '%2d %7.4f %7.4f, %7.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f' % (n+1, 1e6*band_center[n], 1e6*band[n][0], 1e6*band[n][1], - n_oc_center['re'][n], n_oc_ave['re'][n], - n_bc_center['re'][n], n_bc_ave['re'][n], - n_su_center['re'][n], n_su_ave['re'][n], - n_du_center['re'][n], n_du_ave['re'][n], - n_ss_center['re'][n], n_ss_ave['re'][n], - n_wt_center['re'][n], n_wt_ave['re'][n], - np.min((n_oc_center['re'][n], n_oc_ave['re'][n], - n_bc_center['re'][n], n_bc_ave['re'][n], - n_su_center['re'][n], n_su_ave['re'][n], - n_du_center['re'][n], n_du_ave['re'][n], - n_ss_center['re'][n], n_ss_ave['re'][n], - n_wt_center['re'][n], n_wt_ave['re'][n])), - np.max((n_oc_center['re'][n], n_oc_ave['re'][n], - n_bc_center['re'][n], n_bc_ave['re'][n], - n_su_center['re'][n], n_su_ave['re'][n], - n_du_center['re'][n], n_du_ave['re'][n], - n_ss_center['re'][n], n_ss_ave['re'][n], - n_wt_center['re'][n], n_wt_ave['re'][n]))) - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print - - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print ' Chou-Suarez OC BC SU DU SS Water Effective ' - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print 'band center[um] bounds[um] center averaged center averaged center averaged center averaged center averaged center averaged min max' - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - for n in range(len(band)): - print '%2d %7.4f %7.4f, %7.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f' % (n+1, 1e6*band_center[n], 1e6*band[n][0], 1e6*band[n][1], - n_oc_center['im'][n], n_oc_ave['im'][n], - n_bc_center['im'][n], n_bc_ave['im'][n], - n_su_center['im'][n], n_su_ave['im'][n], - n_du_center['im'][n], n_du_ave['im'][n], - n_ss_center['im'][n], n_ss_ave['im'][n], - n_wt_center['im'][n], n_wt_ave['im'][n], - np.min((n_oc_center['im'][n], n_oc_ave['im'][n], - n_bc_center['im'][n], n_bc_ave['im'][n], - n_su_center['im'][n], n_su_ave['im'][n], - n_du_center['im'][n], n_du_ave['im'][n], - n_ss_center['im'][n], n_ss_ave['im'][n], - n_wt_center['im'][n], n_wt_ave['im'][n])), - np.max((n_oc_center['im'][n], n_oc_ave['im'][n], - n_bc_center['im'][n], n_bc_ave['im'][n], - n_su_center['im'][n], n_su_ave['im'][n], - n_du_center['im'][n], n_du_ave['im'][n], - n_ss_center['im'][n], n_ss_ave['im'][n], - n_wt_center['im'][n], n_wt_ave['im'][n]))) - - print '-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' - print - - - print - print band_center[0], n_ss_center['im'][0], n_ss_center['re'][0] - print band_lbound[0], n_ss_lbound['im'][0], n_ss_lbound['re'][0] - print band_ubound[0], n_ss_ubound['im'][0], n_ss_ubound['re'][0] - print band_lbound[0], band_ubound[0], n_ss_ave['im'][0], n_ss_ave['re'][0] - - - - plt.clf() - plt.title('GADS/OPAC refractive indexes - real part') - for name, (s, color) in species.items(): - n = s.refractive_index(wavelengths=band_center) - print name, n['re'] - print name, 'min/max =', np.min(n['re']), np.max(n['re']) - - n = s.refractive_index(bands=band) - print name, n['re'] - print name, 'min/max =', np.min(n['re']), np.max(n['re']) - print - - n_gads_opac = s.refractive_index() - plt.plot(1e6*s.wavelengths(), n_gads_opac['re'], #label=name, - linestyle='', - marker='o', - mec=color, - mfc=color, - ms=3, - mew=1) - - w = 1e-6*np.linspace(0.01, 100.0, 10000) - n = s.refractive_index(wavelengths=w) - plt.plot(1e6*w, n['re'], label=name, - linestyle='-', - color=color) - plt.xlim(0, 40.0) - plt.ylim(0, 4) - plt.legend(loc='upper left', frameon=False) - plt.xlabel('wavelength, um') - plt.savefig('plt-refr_index.real.opac.png') - - - - plt.clf() - plt.title('GADS/OPAC refractive indexes - imaginary part') - for name, (s, color) in species.items(): - n = s.refractive_index(wavelengths=band_center) - print name, n['im'] - print name, 'min/max =', np.min(n['im']), np.max(n['im']) - - n = s.refractive_index(bands=band) - print name, n['im'] - print name, 'min/max =', np.min(n['im']), np.max(n['im']) - print - - - n_gads_opac = s.refractive_index() - plt.plot(1e6*s.wavelengths(), n_gads_opac['im'], #label=name, - linestyle='', - marker='o', - mec=color, - mfc=color, - ms=3, - mew=1) - - - w = 1e-6*np.linspace(0.01, 100, 10000) - n = s.refractive_index(wavelengths=w, extend=True) - plt.plot(1e6*w, n['im'], label=name, - linestyle='-', - color=color) - plt.xlim(0.0, 40.0) - plt.ylim(-2.0,0.2) - plt.legend(loc='lower left', frameon=False) - plt.xlabel('wavelength, um') - plt.savefig('plt-refr_index.imaginary.opac.png') - - diff --git a/MAMchem_GridComp/optics/tests/ut_mie.F90 b/MAMchem_GridComp/optics/tests/ut_mie.F90 deleted file mode 100644 index 88cb8956..00000000 --- a/MAMchem_GridComp/optics/tests/ut_mie.F90 +++ /dev/null @@ -1,107 +0,0 @@ -program testMie - - use mie, only : mie_scattering_lognormal => scattering_lognormal, & - integration_method_midpoint, & - integration_method_simpson, & - psd_number, & - psd_surface - - implicit none - - complex :: m = (1.75, -4.5e-1) ! OPAC/soot refractive index - real :: sigma = 2.00 ! standard deviation - real :: median = 0.0118d-6 ! radius, 1e-6 m - - real :: r_min = 0.005d-6 ! 'm' - real :: r_max = 20.00d-6 ! 'm' - real :: wavelength = 0.500d-6 ! 'm' - - integer :: N = 10000 ! number of intervals for integration - logical :: mass_specific = .false. ! if true return mass specific optical properties - - real :: ext, sca, g - - ! reported values - print *, "GADS/OPAC results for 'soot': (reported with three significant digits)" - print *, 'extinction = ', 6.385d-7, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', 1.441d-7, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', 2.257d-1 - print *, 'asimm. fact. = ', 0.353d0 - print * - - ! base-line (midpoint method with very large number of intervals): number distribution - call mie_scattering_lognormal(psd_number, 2*median, sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, 100*N, mass_specific, integration_method_midpoint) - print *, "Results using 'midpoint' method: N = ", 100*N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - ! midpoint method - call mie_scattering_lognormal(psd_number, 2*median, sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, N, mass_specific, integration_method_midpoint) - print *, "Results using 'midpoint' method: N = ", N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - ! Simpson's composite method - call mie_scattering_lognormal(psd_number, 2*median, sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, N, mass_specific, integration_method_simpson) - print *, "Results using Simpson's composite method: N = ", N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - - print *, 'TEST SURFACE SIZE DISTRIBUTION: MASS_SPECIFIC = False' - mass_specific = .false. - - ! base-line (midpoint method with very large number of intervals): number distribution - call mie_scattering_lognormal(psd_number, 2*median, sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, 100*N, mass_specific, integration_method_midpoint) - print *, "Results using 'midpoint' method: N = ", 100*N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - ! base-line (midpoint method with very large number of intervals): number distribution - call mie_scattering_lognormal(psd_surface, 2*median*exp(2*log(sigma)**2), sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, 100*N, mass_specific, integration_method_midpoint) - ext = (3.14159265358979d0 * (2 * median)**2 * exp(2 * log(sigma)**2)) * ext ! normalize N = 1 - sca = (3.14159265358979d0 * (2 * median)**2 * exp(2 * log(sigma)**2)) * sca ! ... - - print *, "Results using 'midpoint' method: N = ", 100*N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - print *, 'TEST SURFACE SIZE DISTRIBUTION: MASS_SPECIFIC = True' - mass_specific = .true. - - ! base-line (midpoint method with very large number of intervals): number distribution - call mie_scattering_lognormal(psd_number, 2*median, sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, 100*N, mass_specific, integration_method_midpoint) - print *, "Results using 'midpoint' method: N = ", 100*N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - ! base-line (midpoint method with very large number of intervals): number distribution - call mie_scattering_lognormal(psd_surface, 2*median*exp(2*log(sigma)**2), sigma, m, wavelength, ext, sca, g, 2*r_min, 2*r_max, 100*N, mass_specific, integration_method_midpoint) - print *, "Results using 'midpoint' method: N = ", 100*N - print *, 'extinction = ', ext * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'scattering = ', sca * 1d9, 'm-1, [N] = 1 particle cm-3' - print *, 'ssa = ', sca/ext - print *, 'asimm. fact. = ', g - print * - - - -end program testMie diff --git a/MAMchem_GridComp/optics/tests/ut_mie.py b/MAMchem_GridComp/optics/tests/ut_mie.py deleted file mode 100755 index d5860aec..00000000 --- a/MAMchem_GridComp/optics/tests/ut_mie.py +++ /dev/null @@ -1,113 +0,0 @@ -#! /usr/bin/env python - -import optics_ - -PSD_NUMBER = 1 -PSD_SURFACE = 2 - -def scattering(psd, Dg, sigma, refractive_index, wavelength, D_min, D_max, N=10000, specific=True, method=0): - - ext, sca, asy = optics_.mie.scattering_lognormal(psd, Dg, sigma, refractive_index, wavelength, D_min, D_max, N, specific, method) - - return (ext, sca, asy) - - -if __name__ == '__main__': - - # test parameters ---------------------------- - verbose = False - - bins = 10000 - wavelength = 0.50e-6 - component = 'soot' - - # OPAC parameters of the *number* size distribution - # - # Source(s): - # 1. GEISA-2003 OPAC Database Content - # 2. Van de Hulst, 1981 - # 3. OPAC software package (BAMS98) - # - # URL(s): - # 1. http://ether.ipsl.jussieu.fr/etherTypo/index.php?id=1058&L=0 - # 2. http://ether.ipsl.jussieu.fr/etherTypo/fileadmin/files/GEISA/hess-etal2.pdf - # - - OPAC = {} - OPAC['insoluble' ] = dict(m = complex(1.53, -8.0e-3), sigma = 2.51, median = 0.471, r_min = 0.005, r_max = 20.0) - OPAC['water-soluble' ] = dict(m = complex(0.00, -0.00 ), sigma = 2.24, median = 0.0212, r_min = 0.005, r_max = 20.0) - OPAC['soot' ] = dict(m = complex(1.75, -4.5e-1), sigma = 2.00, median = 0.0118, r_min = 0.005, r_max = 20.0) - OPAC['sea salt (acc. mode)'] = dict(m = complex(0.00, -0.00 ), sigma = 2.03, median = 0.209 , r_min = 0.005, r_max = 20.0) - OPAC['sea salt (coa. mode)'] = dict(m = complex(0.00, -0.00 ), sigma = 2.03, median = 1.75 , r_min = 0.005, r_max = 60.0) - OPAC['mineral (nuc. mode)' ] = dict(m = complex(1.53, -7.8e-3), sigma = 1.95, median = 0.07 , r_min = 0.005, r_max = 20.0) - OPAC['mineral (acc. mode)' ] = dict(m = complex(1.53, -7.8e-3), sigma = 2.00, median = 0.39 , r_min = 0.005, r_max = 20.0) - OPAC['mineral (coa. mode)' ] = dict(m = complex(1.53, -7.8e-3), sigma = 2.15, median = 1.90 , r_min = 0.005, r_max = 60.0) - OPAC['mineral transported' ] = dict(m = complex(1.53, -7.8e-3), sigma = 2.20, median = 0.50 , r_min = 0.020, r_max = 5.0) - OPAC['sulfate droplets' ] = dict(m = complex(0.00, -0.00 ), sigma = 2.03, median = 0.0695, r_min = 0.005, r_max = 20.0) - # -------------------------------------------- - - if component in OPAC.keys(): - refractive_index = OPAC[component]['m'] - r_min = OPAC[component]['r_min'] * 1e-6 - r_max = OPAC[component]['r_max'] * 1e-6 - median = OPAC[component]['median'] * 1e-6 - sigma = OPAC[component]['sigma'] - else: - refractive_index = complex(1.75, -0.45) - r_min = 0.00001 * 1e-6 - r_max = 1000.00 * 1e-6 - median = 20.0e-6 #0.0118 * 1e-6 - sigma = 1.5 - - - print 'Results using prescribed range of sizes:' - print 'Size range = (%.3e, %.3e) microns' % (1e6*r_min, 1e6*r_max) - - b_ext, b_sca, g = scattering(PSD_NUMBER, - 2*median, - sigma, - refractive_index, - wavelength, - 2*r_min, - 2*r_max, - N=bins, - specific=False) - - print 'Effective extinction factor and scattering factor units are m-1, assuming number density of 1 particle m-3' - print 'b_ext = %.3e %s' % (b_ext, 'm-1, [N] = 1 particle m-3') - print 'b_sca = %.3e %s' % (b_sca, 'm-1, [N] = 1 particle m-3') - print 'g = %.3e %s' % (g, '1 , [N] = 1 particle m-3') - - print - - print 'Effective extinction factor and scattering factor units are km-1, assuming number density of 1 particle cm-3' - print 'b_ext = %.3e %s' % (b_ext * 1e9, 'km-1, [N] = 1 particle cm-3') - print 'b_sca = %.3e %s' % (b_sca * 1e9, 'km-1, [N] = 1 particle cm-3') - print 'g = %.3e %s' % (g, '1 , [N] = 1 particle cm-3') - - print - print - - - print 'Results using automatically set range of sizes:' - r_low, r_up = psd_lognormal_bounds(median * exp(2*log(sigma)*log(sigma)), sigma, eps=1e-5) - print 'Size range = (%.3e, %.3e)' % (1e6*r_low, 1e6*r_up) - b_ext, b_sca, g = population(psd_lognormal, refractive_index, - wavelength, - r_low, - r_up, - N=bins, - median=median, - sigma=sigma) - - print 'Effective extinction factor and scattering factor units are m-1, assuming number density of 1 particle m-3' - print 'b_ext = %.3e %s' % (b_ext, 'm-1, [N] = 1 particle m-3') - print 'b_sca = %.3e %s' % (b_sca, 'm-1, [N] = 1 particle m-3') - print 'g = %.3e %s' % (g, '1 , [N] = 1 particle m-3') - - print - - print 'Effective extinction factor and scattering factor units are km-1, assuming number density of 1 particle cm-3' - print 'b_ext = %.3e %s' % (b_ext * 1e9, 'km-1, [N] = 1 particle cm-3') - print 'b_sca = %.3e %s' % (b_sca * 1e9, 'km-1, [N] = 1 particle cm-3') - print 'g = %.3e %s' % (g, '1 , [N] = 1 particle cm-3') diff --git a/MATRIXchem_GridComp/CMakeLists.txt b/MATRIXchem_GridComp/CMakeLists.txt deleted file mode 100644 index cd2d1bf3..00000000 --- a/MATRIXchem_GridComp/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -esma_set_this () - -set (srcs - microphysics/CONST.F - microphysics/TRAMP_param.F - microphysics/TRAMP_config.F90 - microphysics/TRAMP_setup.F - microphysics/TRAMP_quad.F - microphysics/TRAMP_coag.F - microphysics/TRAMP_npf.F - microphysics/TRAMP_actv.F - microphysics/TRAMP_diam.F - microphysics/TRAMP_drv.F - microphysics/TRAMP_subs.F - microphysics/TRAMP_depv.F - microphysics/TRAMP_nomicrophysics.F - microphysics/TRAMP_isofwd2.F - microphysics/TRAMP_isorev2.F - microphysics/TRAMP_isocom2.F - microphysics/TRAMP_thermo_isorr2.F - microphysics/TRAMP_matrix.F - MATRIXchem_GridCompMod.F90 - ) - -esma_add_library (${this} SRCS ${srcs} DEPENDENCIES Chem_Shared MAPL ESMF::ESMF) -if (EXTENDED_SOURCE) - set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${EXTENDED_SOURCE}) -endif () -target_compile_definitions (${this} PRIVATE TRACERS_AMP TRACERS_AMP_M1 GEOS5_PORT) - -esma_generate_gocart_code (${this} -F) - -file (GLOB resource_files CONFIGURE_DEPENDS "*.rc") - -install( - FILES ${resource_files} - DESTINATION etc - ) diff --git a/MATRIXchem_GridComp/ChangeLog b/MATRIXchem_GridComp/ChangeLog deleted file mode 100644 index 2b3e9a24..00000000 --- a/MATRIXchem_GridComp/ChangeLog +++ /dev/null @@ -1,7 +0,0 @@ -MATRIXchem ChangeLog - - -2015-04-20 Anton Darmenov - * Tag: Heracles-UNSTABLE - * Initial import of the MATRIX(v2-032015) code from GISS ModelE - diff --git a/MATRIXchem_GridComp/MATRIXchem_GridComp.rc b/MATRIXchem_GridComp/MATRIXchem_GridComp.rc deleted file mode 100644 index c9f9788e..00000000 --- a/MATRIXchem_GridComp/MATRIXchem_GridComp.rc +++ /dev/null @@ -1,17 +0,0 @@ -# -# Resource file for the MATRIXchem Grid Component. -# -# 13 Mar 2015 - A. Darmenov - GEOS-5/MATRIX -# 06 Oct 2009 - P. Le Sager - Initial -# 06 Dec 2009 - da Silva - onverted from NAMELIST to ESMF Config -#-------------------------------------------------------------------- - -verbose: .FALSE. - - -# Prognostics emissions parameters (resolution: a, b, c, d, e, f) -# --------------------------------------------------------------- -f_emissions_seasalt: 0.875 1.1 0.875 0.875 0.612 0.612 -f_emissions_dust: 0.2 0.46 0.08 0.08 0.08 0.067 - - diff --git a/MATRIXchem_GridComp/MATRIXchem_GridCompMod.F90 b/MATRIXchem_GridComp/MATRIXchem_GridCompMod.F90 deleted file mode 100644 index 6812df1f..00000000 --- a/MATRIXchem_GridComp/MATRIXchem_GridCompMod.F90 +++ /dev/null @@ -1,1270 +0,0 @@ -#include "MAPL_Generic.h" - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: MATRIXchem_GridCompMod - Implements MATRIX Chemistry -! -! !INTERFACE: -! -module MATRIXchem_GridCompMod -! -! !USES: -! - use ESMF - use MAPL - - use Chem_UtilMod, only: Chem_UtilResVal - - use SeasaltEmissionMod, only: SeasaltEmission - - use DustEmissionMod, only: MAM_DustEmissionGOCART, MAM_DustEmission - - use aero_config, only: MATRIX_CONFIGURATION => MECH, & - MATRIX_N_AEROSOL_MODES => NMODES, & - MATRIX_N_AEROSOLS => NAEROBOX - - use aero_param, only: MATRIX_N_GASES => NGASES, & - MATRIX_N_EMIS_SPECIES => NEMIS_SPCS, & - MATRIX_N_AEROSOL_DIAG => NDIAG_AERO, & - MATRIX_N_MASS_SPECIES => NMASS_SPCS, & - MATRIX_I => IXXX, & - MATRIX_J => IYYY, & - MATRIX_L => ILAY, & - MATRIX_MW_H2SO4 => MW_H2SO4, & - MATRIX_MW_NH3 => MW_NH3, & - MATRIX_MASS_NO3 => MASS_NO3, & - MATRIX_MASS_NH4 => MASS_NH4, & - MATRIX_MASS_H2O => MASS_H2O, & - MATRIX_NUMB_AKK => NUMB_AKK_1, & - MATRIX_MASS_AKK_SU => MASS_AKK_SULF, & - MATRIX_NUMB_ACC => NUMB_ACC_1, & - MATRIX_MASS_ACC_SU => MASS_ACC_SULF, & - MATRIX_NUMB_DD1 => NUMB_DD1_1, & - MATRIX_MASS_DD1_SU => MASS_DD1_SULF, & - MATRIX_MASS_DD1_DU => MASS_DD1_DUST, & - MATRIX_NUMB_DS1 => NUMB_DS1_1, & - MATRIX_MASS_DS1_SU => MASS_DS1_SULF, & - MATRIX_MASS_DS1_DU => MASS_DS1_DUST, & - MATRIX_NUMB_DD2 => NUMB_DD2_1, & - MATRIX_MASS_DD2_SU => MASS_DD2_SULF, & - MATRIX_MASS_DD2_DU => MASS_DD2_DUST, & - MATRIX_NUMB_DS2 => NUMB_DS2_1, & - MATRIX_MASS_DS2_SU => MASS_DS2_SULF, & - MATRIX_MASS_DS2_DU => MASS_DS2_DUST, & - MATRIX_NUMB_SSA => NUMB_SSA_1, & - MATRIX_MASS_SSA_SU => MASS_SSA_SULF, & - MATRIX_MASS_SSA_SS => MASS_SSA_SEAS, & - MATRIX_NUMB_SSC => NUMB_SSC_1, & - MATRIX_MASS_SSC_SU => MASS_SSC_SULF, & - MATRIX_MASS_SSC_SS => MASS_SSC_SEAS, & - MATRIX_NUMB_OCC => NUMB_OCC_1, & - MATRIX_MASS_OCC_SU => MASS_OCC_SULF, & - MATRIX_MASS_OCC_OC => MASS_OCC_OCAR, & - MATRIX_NUMB_BC1 => NUMB_BC1_1, & - MATRIX_MASS_BC1_SU => MASS_BC1_SULF, & - MATRIX_MASS_BC1_BC => MASS_BC1_BCAR, & - MATRIX_NUMB_BC2 => NUMB_BC2_1, & - MATRIX_MASS_BC2_SU => MASS_BC2_SULF, & - MATRIX_MASS_BC2_BC => MASS_BC2_BCAR, & - MATRIX_NUMB_BC3 => NUMB_BC3_1, & - MATRIX_MASS_BC3_SU => MASS_BC3_SULF, & - MATRIX_MASS_BC3_BC => MASS_BC3_BCAR, & - MATRIX_NUMB_DBC => NUMB_DBC_1, & - MATRIX_MASS_DBC_SU => MASS_DBC_SULF, & - MATRIX_MASS_DBC_BC => MASS_DBC_BCAR, & - MATRIX_MASS_DBC_DU => MASS_DBC_DUST, & - MATRIX_NUMB_BOC => NUMB_BOC_1, & - MATRIX_MASS_BOC_SU => MASS_BOC_SULF, & - MATRIX_MASS_BOC_BC => MASS_BOC_BCAR, & - MATRIX_MASS_BOC_OC => MASS_BOC_OCAR, & - MATRIX_NUMB_BCS => NUMB_BCS_1, & - MATRIX_MASS_BCS_SU => MASS_BCS_SULF, & - MATRIX_MASS_BCS_BC => MASS_BCS_BCAR, & - MATRIX_NUMB_MXX => NUMB_MXX_1, & - MATRIX_MASS_MXX_SU => MASS_MXX_SULF, & - MATRIX_MASS_MXX_BC => MASS_MXX_BCAR, & - MATRIX_MASS_MXX_OC => MASS_MXX_OCAR, & - MATRIX_MASS_MXX_DU => MASS_MXX_DUST, & - MATRIX_MASS_MXX_SS => MASS_MXX_SEAS - - use aero_setup, only: MATRIX_SU_MAP => SULF_MAP, & - MATRIX_DU_MAP => DUST_MAP, & - MATRIX_SS_MAP => SEAS_MAP, & - MATRIX_OC_MAP => OCAR_MAP, & - MATRIX_BC_MAP => BCAR_MAP, & - MATRIX_setup_config => SETUP_CONFIG, & - MATRIX_setup_species_maps => SETUP_SPECIES_MAPS, & - MATRIX_setup_dp0 => SETUP_DP0, & - MATRIX_setup_aero_mass_map => SETUP_AERO_MASS_MAP, & - MATRIX_setup_coag_tensors => SETUP_COAG_TENSORS, & - MATRIX_setup_emis => SETUP_EMIS, & - MATRIX_setup_kci => SETUP_KCI - - use aero_coag, only: MATRIX_setup_kij => SETUP_KIJ - - use aero_npf, only: MATRIX_setup_npfmass => SETUP_NPFMASS - - use amp_aerosol, only: MATRIX_VDDEP_AERO => VDDEP_AERO, & - MATRIX_DIAMETER => DIAM, & - MATRIX_NACTV => NACTV, & - MATRIX_CCNSS => CCNSS - - - use constant, only: MATRIX_MW_AIR => mair - - use aero_diam, only: MATRIX_setup_diam => SETUP_DIAM - - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices -! -! !DESCRIPTION: -! -! {\tt MATRIXchem\_GridComp} is an ESMF gridded component implementing -! the MATRIX aerosol microphysical processes. -! -! Developed for GEOS-5 release Fortuna 2.0 and later. -! -! !REVISION HISTORY: -! -! 13 Mar 2015 A.Darmenov Coupled the MATRIX module with GEOS-5. -! 06 Dec 2009 da Silva Created the MATRIX skeleton. -! -!EOP -!------------------------------------------------------------------------- - -! Legacy state -! ------------ - type MATRIX_State - private - - integer :: configuration = 1 ! MATRIX configuration - - type(ESMF_Config) :: CF ! Private Config - type(ESMF_Grid) :: grid ! Grid - - integer :: im_world ! Horizontal dimensions - lon - integer :: jm_world ! Horizontal dimensions - lat - - real :: dt ! Model time step - - real :: f_emiss_seasalt ! Global seasalt emissions tuning parameter - real :: f_emiss_dust ! Global dust emissions tuning parameter - - logical :: verbose ! verbosity flag - end type MATRIX_State - -! Hook for the ESMF -! ----------------- - type MATRIX_Wrap - type (MATRIX_State), pointer :: PTR => null() - end type MATRIX_Wrap - -contains - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 910.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices --- Sets IRF services for the MATRIXchem Grid Component -! -! !INTERFACE: - - subroutine SetServices(GC, rc) - -! !ARGUMENTS: - - type(ESMF_GridComp), intent(INOUT) :: GC ! gridded component - integer, optional :: rc ! return code - -! !DESCRIPTION: Sets Initialize, Run and Finalize services. -! -! !REVISION HISTORY: -! -! 13 Mar 2015 A.Darmenov Coupled the MATRIX module with GEOS-5. -! 01 Dec 2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('SetServices') - -! Local derived type aliases -! -------------------------- - type (MATRIX_State), pointer :: self ! internal private, that is - type (MATRIX_wrap) :: wrap - - character(len=ESMF_MAXSTR) :: comp_name - -! ------------ - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - - -! Wrap internal state for storing in GC; rename legacyState -! ------------------------------------- - allocate(self, __STAT__) - wrap%ptr => self - - -! Load private Config Attributes -! ------------------------------ - self%CF = ESMF_ConfigCreate(__RC__) - call ESMF_ConfigLoadFile(self%CF, 'MATRIXchem_GridComp.rc', __RC__) - - call ESMF_ConfigGetAttribute(self%CF, self%verbose, Label='verbose:', default=.false., __RC__) - - call ESMF_ConfigGetAttribute(self%CF, self%configuration, Label='matrix:', default=1, __RC__) - _ASSERT(self%configuration == MATRIX_CONFIGURATION,'needs informative message') - - - -! Set the profiling timers -! ------------------------ - call MAPL_TimerAdd(GC, name='RUN', __RC__) -#ifdef __MATRIX_TODO__ - call MAPL_TimerAdd(GC, name='-EMISSIONS', __RC__) - call MAPL_TimerAdd(GC, name='-MICROPHYSICS', __RC__) - call MAPL_TimerAdd(GC, name='-REMOVAL', __RC__) - call MAPL_TimerAdd(GC, name='--REMOVAL_DRY', __RC__) - call MAPL_TimerAdd(GC, name='--REMOVAL_WET', __RC__) - call MAPL_TimerAdd(GC, name='-DIAGNOSTICS', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_SEASALT', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_DUST', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_CIM', __RC__) - call MAPL_TimerAdd(GC, name='--DIAGNOSTICS_AOT', __RC__) -#endif - -! ------------------------ -! ESMF Functional Services -! ------------------------ - -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, Initialize_, __RC__) - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_RUN, Run_, __RC__) - call MAPL_GridCompSetEntryPoint(GC, ESMF_METHOD_FINALIZE, Finalize_, __RC__) - -! Store internal state in GC -! -------------------------- - call ESMF_UserCompSetInternalState(GC, 'MATRIX_state', wrap, STATUS) - VERIFY_(STATUS) - -! ------------------ -! MAPL Data Services -! ------------------ - -!BOP -! -! !IMPORT STATE: - -#include "MATRIXchem_ImportSpec___.h" - -! !INTERNAL STATE: - -#include "MATRIXchem_InternalSpec___.h" - -! !EXTERNAL STATE: - -#include "MATRIXchem_ExportSpec___.h" - -! Generic Set Services -! -------------------- - call MAPL_GenericSetServices(GC, __RC__) - -! Anounce that MATRIX is active -! ----------------------------- - if (MAPL_AM_I_ROOT()) then - write (*,*) trim(Iam)//': ACTIVE' - write (*,*) - end if - -! All done -! -------- - - RETURN_(ESMF_SUCCESS) - - end subroutine SetServices - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize MATRIXchem -! -! !INTERFACE: -! - - subroutine Initialize_(GC, IMPORT, EXPORT, clock, rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 13 Mar 2015 A.Darmenov Coupled the MATRIX module with GEOS-5. -! 01 Dec 2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Initialize_') - - type(MATRIX_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - integer :: im_World, jm_World ! Global 2D Dimensions - integer :: im, jm, lm ! 3D Dimensions - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name ! name of the component - - integer, parameter :: n_res = 6 ! number of horizontal resolutions (a, b, c, d, e) - real, dimension(n_res) :: f_res ! buffer for the resolution dependent factors - integer :: n ! counter - - integer, allocatable :: matrix_aerosol_indexes(:) - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -#include "MATRIXchem_DeclarePointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // trim(Iam) - -! -------- - if (MAPL_AM_I_ROOT()) then - write (*,*) trim(Iam)//': Starting...' - write (*,*) - end if - - -! Initialize MAPL Generic -! ----------------------- - call MAPL_GenericInitialize (GC, IMPORT, EXPORT, clock, __RC__) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -#include "MATRIXchem_GetPointer___.h" - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, clock, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, lons, lats, & - nymd, nhms, cdt, __RC__) - -! Set the grid and dimensions -! --------------------------- - self%grid = GRID - - self%im_world = im_World - self%jm_world = jm_World - -! Set the time step -! ----------------- - self%dt = cdt - - -! Set resolution dependent parameters -! ----------------------------------- - call ESMF_ConfigFindLabel(self%CF, 'f_emissions_seasalt:', __RC__) - do n = 1, n_res - call ESMF_ConfigGetAttribute(self%CF, f_res(n), __RC__) - end do - self%f_emiss_seasalt = Chem_UtilResVal(self%im_world, self%jm_world, f_res(:), __RC__) - - call ESMF_ConfigFindLabel(self%CF, 'f_emissions_dust:', __RC__) - do n = 1, n_res - call ESMF_ConfigGetAttribute(self%CF, f_res(n), __RC__) - end do - self%f_emiss_dust = Chem_UtilResVal(self%im_world, self%jm_world, f_res(:), __RC__) - - -! MATRIX core -! ----------- - call MATRIX_setup_config - call MATRIX_setup_species_maps - call MATRIX_setup_dp0 - call MATRIX_setup_aero_mass_map - call MATRIX_setup_coag_tensors - call MATRIX_setup_dp0 - call MATRIX_setup_kij - call MATRIX_setup_emis - call MATRIX_setup_kci - call MATRIX_setup_npfmass -! call MATRIX_setup_diam - -#ifdef __MATRIX_TODO__ -! CALL SETUP_RAD -#endif - - -#ifdef __MATRIX_TODO__ - 1. 'FIRSTIME' code goes here and gets dissabled in the MATRIX core. - 2. ...might need to add fields to the private internal state. -#endif - - if (MAPL_AM_I_ROOT() .and. self%verbose) then - write (*,*) 'MODES : ', MATRIX_N_AEROSOL_MODES - write (*,*) 'AEROSOLS : ', MATRIX_N_AEROSOLS - write (*,*) 'MAP SU : ', MATRIX_SU_MAP - write (*,*) 'MAP OC : ', MATRIX_OC_MAP - write (*,*) 'MAP BC : ', MATRIX_BC_MAP - write (*,*) 'MAP SS : ', MATRIX_SS_MAP - write (*,*) 'MAP DU : ', MATRIX_DU_MAP - write (*,*) - write (*,*) 'MATRIX_MASS_NO3 : ', MATRIX_MASS_NO3 - write (*,*) 'MATRIX_MASS_NH4 : ', MATRIX_MASS_NH4 - write (*,*) 'MATRIX_MASS_H2O : ', MATRIX_MASS_H2O - write (*,*) 'MATRIX_NUMB_AKK : ', MATRIX_NUMB_AKK - write (*,*) 'MATRIX_MASS_AKK_SU : ', MATRIX_MASS_AKK_SU - write (*,*) 'MATRIX_NUMB_ACC : ', MATRIX_NUMB_ACC - write (*,*) 'MATRIX_MASS_ACC_SU : ', MATRIX_MASS_ACC_SU - write (*,*) 'MATRIX_NUMB_DD1 : ', MATRIX_NUMB_DD1 - write (*,*) 'MATRIX_MASS_DD1_SU : ', MATRIX_MASS_DD1_SU - write (*,*) 'MATRIX_MASS_DD1_DU : ', MATRIX_MASS_DD1_DU - write (*,*) 'MATRIX_NUMB_DS1 : ', MATRIX_NUMB_DS1 - write (*,*) 'MATRIX_MASS_DS1_SU : ', MATRIX_MASS_DS1_SU - write (*,*) 'MATRIX_MASS_DS1_DU : ', MATRIX_MASS_DS1_DU - write (*,*) 'MATRIX_NUMB_DD2 : ', MATRIX_NUMB_DD2 - write (*,*) 'MATRIX_MASS_DD2_SU : ', MATRIX_MASS_DD2_SU - write (*,*) 'MATRIX_MASS_DD2_DU : ', MATRIX_MASS_DD2_DU - write (*,*) 'MATRIX_NUMB_DS2 : ', MATRIX_NUMB_DS2 - write (*,*) 'MATRIX_MASS_DS2_SU : ', MATRIX_MASS_DS2_SU - write (*,*) 'MATRIX_MASS_DS2_DU : ', MATRIX_MASS_DS2_DU - write (*,*) 'MATRIX_NUMB_SSA : ', MATRIX_NUMB_SSA - write (*,*) 'MATRIX_MASS_SSA_SU : ', MATRIX_MASS_SSA_SU - write (*,*) 'MATRIX_MASS_SSA_SS : ', MATRIX_MASS_SSA_SS - write (*,*) 'MATRIX_NUMB_SSC : ', MATRIX_NUMB_SSC - write (*,*) 'MATRIX_MASS_SSC_SU : ', MATRIX_MASS_SSC_SU - write (*,*) 'MATRIX_MASS_SSC_SS : ', MATRIX_MASS_SSC_SS - write (*,*) 'MATRIX_NUMB_OCC : ', MATRIX_NUMB_OCC - write (*,*) 'MATRIX_MASS_OCC_SU : ', MATRIX_MASS_OCC_SU - write (*,*) 'MATRIX_MASS_OCC_OC : ', MATRIX_MASS_OCC_OC - write (*,*) 'MATRIX_NUMB_BC1 : ', MATRIX_NUMB_BC1 - write (*,*) 'MATRIX_MASS_BC1_SU : ', MATRIX_MASS_BC1_SU - write (*,*) 'MATRIX_MASS_BC1_BC : ', MATRIX_MASS_BC1_BC - write (*,*) 'MATRIX_NUMB_BC2 : ', MATRIX_NUMB_BC2 - write (*,*) 'MATRIX_MASS_BC2_SU : ', MATRIX_MASS_BC2_SU - write (*,*) 'MATRIX_MASS_BC2_BC : ', MATRIX_MASS_BC2_BC - write (*,*) 'MATRIX_NUMB_BC3 : ', MATRIX_NUMB_BC3 - write (*,*) 'MATRIX_MASS_BC3_SU : ', MATRIX_MASS_BC3_SU - write (*,*) 'MATRIX_MASS_BC3_BC : ', MATRIX_MASS_BC3_BC - write (*,*) 'MATRIX_NUMB_DBC : ', MATRIX_NUMB_DBC - write (*,*) 'MATRIX_MASS_DBC_SU : ', MATRIX_MASS_DBC_SU - write (*,*) 'MATRIX_MASS_DBC_BC : ', MATRIX_MASS_DBC_BC - write (*,*) 'MATRIX_MASS_DBC_DU : ', MATRIX_MASS_DBC_DU - write (*,*) 'MATRIX_NUMB_BOC : ', MATRIX_NUMB_BOC - write (*,*) 'MATRIX_MASS_BOC_SU : ', MATRIX_MASS_BOC_SU - write (*,*) 'MATRIX_MASS_BOC_BC : ', MATRIX_MASS_BOC_BC - write (*,*) 'MATRIX_MASS_BOC_OC : ', MATRIX_MASS_BOC_OC - write (*,*) 'MATRIX_NUMB_BCS : ', MATRIX_NUMB_BCS - write (*,*) 'MATRIX_MASS_BCS_SU : ', MATRIX_MASS_BCS_SU - write (*,*) 'MATRIX_MASS_BCS_BC : ', MATRIX_MASS_BCS_BC - write (*,*) 'MATRIX_NUMB_MXX : ', MATRIX_NUMB_MXX - write (*,*) 'MATRIX_MASS_MXX_SU : ', MATRIX_MASS_MXX_SU - write (*,*) 'MATRIX_MASS_MXX_BC : ', MATRIX_MASS_MXX_BC - write (*,*) 'MATRIX_MASS_MXX_OC : ', MATRIX_MASS_MXX_OC - write (*,*) 'MATRIX_MASS_MXX_DU : ', MATRIX_MASS_MXX_DU - write (*,*) 'MATRIX_MASS_MXX_SS : ', MATRIX_MASS_MXX_SS - end if - - allocate(matrix_aerosol_indexes(MATRIX_N_AEROSOLS), __STAT__) - matrix_aerosol_indexes = 0 - - ! verify MATRIX::AEROSOL array indexes - matrix_aerosol_indexes = (/MATRIX_MASS_NO3, MATRIX_MASS_NH4, MATRIX_MASS_H2O, & - MATRIX_NUMB_AKK, MATRIX_MASS_AKK_SU, & - MATRIX_NUMB_ACC, MATRIX_MASS_ACC_SU, & - MATRIX_NUMB_DD1, MATRIX_MASS_DD1_SU, MATRIX_MASS_DD1_DU, & - MATRIX_NUMB_DS1, MATRIX_MASS_DS1_SU, MATRIX_MASS_DS1_DU, & - MATRIX_NUMB_DD2, MATRIX_MASS_DD2_SU, MATRIX_MASS_DD2_DU, & - MATRIX_NUMB_DS2, MATRIX_MASS_DS2_SU, MATRIX_MASS_DS2_DU, & - MATRIX_NUMB_SSA, MATRIX_MASS_SSA_SU, MATRIX_MASS_SSA_SS, & - MATRIX_NUMB_SSC, MATRIX_MASS_SSC_SU, MATRIX_MASS_SSC_SS, & - MATRIX_NUMB_OCC, MATRIX_MASS_OCC_SU, MATRIX_MASS_OCC_OC, & - MATRIX_NUMB_BC1, MATRIX_MASS_BC1_SU, MATRIX_MASS_BC1_BC, & - MATRIX_NUMB_BC2, MATRIX_MASS_BC2_SU, MATRIX_MASS_BC2_BC, & - MATRIX_NUMB_BC3, MATRIX_MASS_BC3_SU, MATRIX_MASS_BC3_BC, & - MATRIX_NUMB_DBC, MATRIX_MASS_DBC_SU, MATRIX_MASS_DBC_BC, MATRIX_MASS_DBC_DU, & - MATRIX_NUMB_BOC, MATRIX_MASS_BOC_SU, MATRIX_MASS_BOC_BC, MATRIX_MASS_BOC_OC, & - MATRIX_NUMB_BCS, MATRIX_MASS_BCS_SU, MATRIX_MASS_BCS_BC, & - MATRIX_NUMB_MXX, MATRIX_MASS_MXX_SU, MATRIX_MASS_MXX_BC, MATRIX_MASS_MXX_OC, & - MATRIX_MASS_MXX_DU, MATRIX_MASS_MXX_SS/) - - _ASSERT(any(matrix_aerosol_indexes > 0),'needs informative message') - deallocate(matrix_aerosol_indexes, __STAT__) - - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs MATRIXchem -! -! !INTERFACE: -! - - subroutine Run_(GC, IMPORT, EXPORT, clock, rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 13 Mar 2015 A.Darmenov Coupled the MATRIX module with GEOS-5. -! 27 Feb 2005 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Run_') - - type(MATRIX_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - integer :: im_World, jm_World ! Global 2D Dimensions - integer :: im, jm, lm ! 3D Dimensions - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name ! name of the component - - integer :: i, j, l ! current 3D indexes - -! --- MATRIX --- - real(8) :: T_ ! absolute temperature [K] - real(8) :: RH_ ! relative humidity [0-1] - real(8) :: P_ ! ambient pressure [Pa] - real(8) :: so4_aq_rate_ ! in-cloud SO4 production rate [ug/m^3/s] - real(8) :: w_updraft_ ! cloud updraft velocity [m/s] - - real(8) :: aerosol_(MATRIX_N_AEROSOLS) ! aerosol conc. [ug/m^3] or [#/m^3] - real(8) :: gas_(MATRIX_N_GASES) ! gas-phase conc. [ug/m^3] - real(8) :: emissions_(MATRIX_N_EMIS_SPECIES) ! mass emission rates [ug/m^3/s] - real(8) :: diagnostics_(MATRIX_N_AEROSOL_DIAG, MATRIX_N_AEROSOLS) ! budget or tendency diagnostics [ug/m^3/s] or [#/m^3/s] - real(8) :: species_mass_(MATRIX_N_MASS_SPECIES+2) ! total mass concentration of each model species (SU, BC, OC, DU, SS, NO3, NH4; but not water) - - real(8) :: f_emiss ! units factor - - integer, parameter :: ss_emiss_method = 1 - real, parameter, dimension(2) :: ssa_size_range = (/0.05, 0.5/) ! lower and upper size|diameter range in 'um' - real, parameter, dimension(2) :: ssc_size_range = (/ 0.5, 8.0/) ! lower and upper size|diameter range in 'um' - real, pointer, dimension(:,:) :: ssa_emiss_mass, ssa_emiss_num ! fine - real, pointer, dimension(:,:) :: ssc_emiss_mass, ssc_emiss_num ! coarse - real, pointer, dimension(:,:) :: f_grid_efficiency - real, pointer, dimension(:,:) :: w10m - - real, parameter, dimension(2) :: duf_size_range = (/0.1, 2.5/) ! lower and upper size|diameter range in 'um' - real, parameter, dimension(2) :: duc_size_range = (/2.0,10.0/) ! lower and upper size|diameter range in 'um' - real, pointer, dimension(:,:) :: duf_emiss_mass, duf_emiss_num ! fine - real, pointer, dimension(:,:) :: duc_emiss_mass, duc_emiss_num ! coarse - real, pointer, dimension(:,:) :: dust_emiss_tot ! total is the sum of the emissions in the 5 GOCART bins - - - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -#include "MATRIXchem_DeclarePointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // trim(Iam) - -! Get pointers to IMPORT/EXPORT/INTERNAL states -! --------------------------------------------- -#include "MATRIXchem_GetPointer___.h" - - -! Start the main timer -! -------------------- - call MAPL_TimerOn(MetaComp, 'RUN', __RC__) - - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, CLOCK, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, lons, lats, & - nymd, nhms, cdt, __RC__) - - - -! Aerosol emissions -! ----------------- - call MAPL_TimerOn(MetaComp, '-EMISSIONS', __RC__) - - -! Seasalt emissions -! ----------------- - allocate(ssa_emiss_mass(im,jm), __STAT__) - allocate(ssa_emiss_num (im,jm), __STAT__) - - allocate(ssc_emiss_mass(im,jm), __STAT__) - allocate(ssc_emiss_num (im,jm), __STAT__) - - allocate(f_grid_efficiency(im,jm), __STAT__) - allocate(w10m(im,jm), __STAT__) - - ! define 10-m wind speed - w10m = sqrt(u10m*u10m + v10m*v10m) - - ! fefine grid emission efficiency - f_grid_efficiency = 0.0 - where(LWI < 1) f_grid_efficiency = 1.0 ! water points (should use fractional water cover) - - ! seasalt emissions: accumulation mode - ssa_emiss_num = 0.0 - ssa_emiss_mass = 0.0 - - call SeasaltEmission(0.5*ssa_size_range(1), 0.5*ssa_size_range(2), ss_emiss_method, & - w10m, ustar, ssa_emiss_mass, ssa_emiss_num, __RC__) - - ssa_emiss_mass = self%f_emiss_seasalt * f_grid_efficiency * ssa_emiss_mass - ssa_emiss_num = self%f_emiss_seasalt * f_grid_efficiency * ssa_emiss_num - - ! seasalt emissions: coarse mode - ssc_emiss_num = 0.0 - ssc_emiss_mass = 0.0 - - call SeasaltEmission(0.5*ssc_size_range(1), 0.5*ssc_size_range(2), ss_emiss_method, & - w10m, ustar, ssc_emiss_mass, ssc_emiss_num, __RC__) - - ssc_emiss_mass = self%f_emiss_seasalt * f_grid_efficiency * ssc_emiss_mass - ssc_emiss_num = self%f_emiss_seasalt * f_grid_efficiency * ssc_emiss_num - - if (associated(emiss_ssa)) emiss_ssa = ssa_emiss_mass - if (associated(emiss_ssc)) emiss_ssc = ssc_emiss_mass - if (associated(emiss_ss )) emiss_ss = ssa_emiss_mass + ssc_emiss_mass - - -! Dust emissions -! ----------------- - allocate(dust_emiss_tot(im,jm), __STAT__) - allocate(duf_emiss_mass(im,jm), __STAT__) - allocate(duf_emiss_num (im,jm), __STAT__) - allocate(duc_emiss_mass(im,jm), __STAT__) - allocate(duc_emiss_num (im,jm), __STAT__) - - - dust_emiss_tot = 0.0 - call MAM_DustEmissionGOCART(1, im, 1, jm, lm, frlake, wet1, lwi, u10m, v10m, dust_emiss_tot, __RC__) - - ! apply the dust emission tuning coefficient [kg s2 m-5] and Ginoux dust source function - dust_emiss_tot = (self%f_emiss_dust * 1e-9) * GINOUX_DU * dust_emiss_tot - - call MAM_DustEmission(1, im, 1, jm, lm, 1e-6*duf_size_range(1), 1e-6*duf_size_range(2), dust_emiss_tot, duf_emiss_mass, duf_emiss_num, __RC__) - call MAM_DustEmission(1, im, 1, jm, lm, 1e-6*duc_size_range(1), 1e-6*duc_size_range(2), dust_emiss_tot, duc_emiss_mass, duc_emiss_num, __RC__) - - if (associated(emiss_duf)) emiss_duf = duf_emiss_mass - if (associated(emiss_duc)) emiss_duc = duc_emiss_mass - if (associated(emiss_du )) emiss_du = duf_emiss_mass + duc_emiss_mass - - - -#ifdef __MATRIX_TODO__ -! Dust emissions -! ----------------- - call MX_DU_Emissions(self%scheme, import, export, self%qa, self%femisDU, self%dt, __RC__) - -! Black Carbon emissions -! ---------------------- - call MX_BC_Emissions(self%scheme, import, export, self%qa, self%dt, __RC__) - -! Organic Carbon emissions -! ---------------------- - call MX_OC_Emissions(self%scheme, import, export, self%qa, self%pom_oc_ratio, self%dt, __RC__) -#endif - call MAPL_TimerOff(MetaComp, '-EMISSIONS', __RC__) - - - -! Aerosol microphysics -! -------------------- - call MAPL_TimerOn(MetaComp, '-MICROPHYSICS', __RC__) - - allocate(MATRIX_VDDEP_AERO(im,jm,MATRIX_N_AEROSOL_MODES,2), __STAT__) ! [m/s] - allocate(MATRIX_DIAMETER(im,jm,lm,MATRIX_N_AEROSOL_MODES), __STAT__) ! [m ] - allocate(MATRIX_NACTV(im,jm,lm,MATRIX_N_AEROSOL_MODES), __STAT__) ! [#/m^3] - allocate(MATRIX_CCNSS(im,jm,lm,MATRIX_N_AEROSOL_MODES,3), __STAT__) ! [#/m^3] - - - if (associated(total_su)) total_su = 0.0 - if (associated(total_du)) total_du = 0.0 - if (associated(total_ss)) total_ss = 0.0 - if (associated(total_oc)) total_oc = 0.0 - if (associated(total_bc)) total_bc = 0.0 - - do l = 1, lm - do j = 1, jm - do i = 1, im - - ! set indexes for MATRIX - MATRIX_I = i - MATRIX_J = j - MATRIX_L = lm - l + 1 - - ! set atm state - T_ = T(i,j,l) - RH_ = min(RH2(i,j,l), 0.95) - P_ = 0.5*(PLE(i,j,l) + PLE(i,j,l-1)) - w_updraft_ = 0.05d0 - - ! aerosol emissions and microphysics - aerosol_ = 0.0d0 - gas_ = 0.0d0 - emissions_ = 0.0d0 - - - ! in-cloud SO4 production rate [ug/m^3/s] - so4_aq_rate_ = tiny(0.0d0) !FCLD(i,j,l) * 1e3*4.43D-11 !0.1 * FCLD(i,j,l) * SO2(i,j,l) * 1.0d9 * (64.066 / MATRIX_MW_AIR) * airdens(i,j,l) / self%dt - - ! set concetrations of gases, 'ug(constituent) m-3' - gas_(1) = tiny(0.0d0) ! h2so4(i,j,l) * 1.0d9 * (MATRIX_MW_H2SO4 / MATRIX_MW_AIR) * airdens(i,j,l) - gas_(2) = tiny(0.0d0) ! 0.01 * gas_(1)!1.0d9 * (MATRIX_MW_HNO3 / MATRIX_MW_AIR) * airdens(i,j,l) ! ug(HNO3) m-3 - gas_(3) = tiny(0.0d0) ! NH3(i,j,l) * 1.0d9 * (MATRIX_MW_NH3 / MATRIX_MW_AIR) * airdens(i,j,l) - - where (gas_ < tiny(0.0d0)) - gas_ = 1e3*tiny(0.0d0) - end where - - - ! set concentrations of aerosols: mass is in 'ug m-3', number is in '# m-3' - ! total - aerosol_(MATRIX_MASS_NO3) = M_NO3(i,j,l) - aerosol_(MATRIX_MASS_NH4) = M_NH4(i,j,l) - aerosol_(MATRIX_MASS_H2O) = M_H2O(i,j,l) - ! AKK - aerosol_(MATRIX_MASS_AKK_SU) = M_AKK_SU(i,j,l) - aerosol_(MATRIX_NUMB_AKK) = N_AKK(i,j,l) - ! ACC - aerosol_(MATRIX_MASS_ACC_SU) = M_ACC_SU(i,j,l) - aerosol_(MATRIX_NUMB_ACC) = N_ACC(i,j,l) - ! DD1 - aerosol_(MATRIX_MASS_DD1_SU) = M_DD1_SU(i,j,l) - aerosol_(MATRIX_MASS_DD1_DU) = M_DD1_DU(i,j,l) - aerosol_(MATRIX_NUMB_DD1) = N_DD1(i,j,l) - ! DS1 - aerosol_(MATRIX_MASS_DS1_SU) = M_DS1_SU(i,j,l) - aerosol_(MATRIX_MASS_DS1_DU) = M_DS1_DU(i,j,l) - aerosol_(MATRIX_NUMB_DS1) = N_DS1(i,j,l) - ! DD2 - aerosol_(MATRIX_MASS_DD2_SU) = M_DD2_SU(i,j,l) - aerosol_(MATRIX_MASS_DD2_DU) = M_DD2_DU(i,j,l) - aerosol_(MATRIX_NUMB_DD2) = N_DD2(i,j,l) - ! DS2 - aerosol_(MATRIX_MASS_DS2_SU) = M_DS2_SU(i,j,l) - aerosol_(MATRIX_MASS_DS2_DU) = M_DS2_DU(i,j,l) - aerosol_(MATRIX_NUMB_DS2) = N_DS2(i,j,l) - - ! SSA - aerosol_(MATRIX_MASS_SSA_SU) = M_SSA_SU(i,j,l) - aerosol_(MATRIX_MASS_SSA_SS) = M_SSA_SS(i,j,l) - aerosol_(MATRIX_NUMB_SSA) = N_SSA(i,j,l) - !SSC - aerosol_(MATRIX_MASS_SSC_SU) = M_SSC_SU(i,j,l) - aerosol_(MATRIX_MASS_SSC_SS) = M_SSC_SS(i,j,l) - aerosol_(MATRIX_NUMB_SSC) = N_SSC(i,j,l) - ! OCC - aerosol_(MATRIX_MASS_OCC_SU) = M_OCC_SU(i,j,l) - aerosol_(MATRIX_MASS_OCC_OC) = M_OCC_OC(i,j,l) - aerosol_(MATRIX_NUMB_OCC) = N_OCC(i,j,l) - ! BC1 - aerosol_(MATRIX_MASS_BC1_SU) = M_BC1_SU(i,j,l) - aerosol_(MATRIX_MASS_BC1_BC) = M_BC1_BC(i,j,l) - aerosol_(MATRIX_NUMB_BC1) = N_BC1(i,j,l) - ! BC2 - aerosol_(MATRIX_MASS_BC2_SU) = M_BC2_SU(i,j,l) - aerosol_(MATRIX_MASS_BC2_BC) = M_BC2_BC(i,j,l) - aerosol_(MATRIX_NUMB_BC2) = N_BC2(i,j,l) - ! BC3 - aerosol_(MATRIX_MASS_BC3_SU) = M_BC3_SU(i,j,l) - aerosol_(MATRIX_MASS_BC3_BC) = M_BC3_BC(i,j,l) - aerosol_(MATRIX_NUMB_BC3) = N_BC3(i,j,l) - ! DBC - aerosol_(MATRIX_MASS_DBC_SU) = M_DBC_SU(i,j,l) - aerosol_(MATRIX_MASS_DBC_BC) = M_DBC_BC(i,j,l) - aerosol_(MATRIX_MASS_DBC_DU) = M_DBC_DU(i,j,l) - aerosol_(MATRIX_NUMB_DBC) = N_DBC(i,j,l) - ! BOC - aerosol_(MATRIX_MASS_BOC_SU) = M_BOC_SU(i,j,l) - aerosol_(MATRIX_MASS_BOC_BC) = M_BOC_BC(i,j,l) - aerosol_(MATRIX_MASS_BOC_OC) = M_BOC_OC(i,j,l) - aerosol_(MATRIX_NUMB_BOC) = N_BOC(i,j,l) - ! BCS - aerosol_(MATRIX_MASS_BCS_SU) = M_BCS_SU(i,j,l) - aerosol_(MATRIX_MASS_BCS_BC) = M_BCS_BC(i,j,l) - aerosol_(MATRIX_NUMB_BCS) = N_BCS(i,j,l) - ! MXX - aerosol_(MATRIX_MASS_MXX_SU) = M_MXX_SU(i,j,l) - aerosol_(MATRIX_MASS_MXX_BC) = M_MXX_BC(i,j,l) - aerosol_(MATRIX_MASS_MXX_OC) = M_MXX_OC(i,j,l) - aerosol_(MATRIX_MASS_MXX_DU) = M_MXX_DU(i,j,l) - aerosol_(MATRIX_MASS_MXX_SS) = M_MXX_SS(i,j,l) - aerosol_(MATRIX_NUMB_MXX) = N_MXX(i,j,l) - - if (l == lm) then - aerosol_ = aerosol_ * exp(-0.5d-2 * self%dt * (MAPL_GRAV * airdens(i,j,l) / delp(i,j,l))) - endif - - where (aerosol_ < tiny(0.0d0)) - aerosol_ = 1e3*tiny(0.0d0) - end where - - - - - ! set emissions - if (l == lm) then - - ! did I get the emissions indexes right? - ! REAL, DIMENSION(NEMIS_SPCS) :: EMIS_DENS = (/ EMIS_DENS_SULF, - ! EMIS_DENS_SULF, - ! EMIS_DENS_BCAR, - ! EMIS_DENS_OCAR, - ! EMIS_DENS_DUST, - ! EMIS_DENS_SEAS, - ! EMIS_DENS_SEAS, - ! EMIS_DENS_BOCC, - ! EMIS_DENS_BOCC, - ! EMIS_DENS_DUST /) - ! - ! CHEM_SPC_NAME(NMASS_SPCS) = (/'SULF','BCAR','OCAR','DUST','SEAS'/) - ! EMIS_SPCS_MAP = (/1,1,2,3,4,5,5,2,3,4/) - - f_emiss = 1.0d9 * MAPL_GRAV * airdens(i,j,l) / delp(i,j,l) - - emissions_(1) = f_emiss * 0.025*(SO2_EMIS_FIRES(i,j) + & - SO2_EMIS_NONENERGY(i,j) + & - SO2_EMIS_ENERGY(i,j) + & - SO2_EMIS_SHIPPING(i,j)) ! AKK SU: volc + biomass - emissions_(2) = f_emiss * SO4_EMIS_SHIP(i,j) ! ACC SU: volc + biomass - emissions_(3) = f_emiss * BC_EMIS_FIRE(i,j) ! BC1 BC: - emissions_(4) = f_emiss * OC_EMIS_FIRE(i,j) ! OC - emissions_(5) = f_emiss * duf_emiss_mass(i,j) ! DU - emissions_(6) = f_emiss * ssa_emiss_mass(i,j) ! Accumulation mode: 0.01 -- 0.5 microns - emissions_(7) = f_emiss * ssc_emiss_mass(i,j) ! Coarse mode: 0.50 -- 8.0 microns - emissions_(8) = f_emiss * (BC_EMIS_BIOFUEL(i,j) + BC_EMIS_FOSSILFUEL(i,j) + BC_EMIS_SHIP(i,j)) - emissions_(9) = f_emiss * (OC_EMIS_BIOFUEL(i,j) + OC_EMIS_FOSSILFUEL(i,j) + OC_EMIS_SHIP(i,j)) - emissions_(10)= f_emiss * duc_emiss_mass(i,j) - end if - - - where (aerosol_ < tiny(0.0d0)) - aerosol_ = tiny(0.0d0) - end where - - - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 1) = DGN_AKK(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 2) = DGN_ACC(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 3) = DGN_DD1(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 4) = DGN_DS1(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 5) = DGN_DD2(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 6) = DGN_DS2(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 7) = DGN_SSA(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 8) = DGN_SSC(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 9) = DGN_OCC(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,10) = DGN_BC1(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,11) = DGN_BC2(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,12) = DGN_BC3(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,13) = DGN_DBC(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,14) = DGN_BOC(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,15) = DGN_BCS(i,j,l) - MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,16) = DGN_MXX(i,j,l) - - - diagnostics_ = tiny(0.0) - - call SPCMASSES(aerosol_, gas_, species_mass_) - call MATRIX(aerosol_, gas_, emissions_, self%dt, T_, RH_, P_, so4_aq_rate_, w_updraft_, diagnostics_) - - ! diagnostics - if (associated(total_su)) total_su(i,j,l) = sum(aerosol_(MATRIX_SU_MAP(:))) - if (associated(total_du)) total_du(i,j,l) = sum(aerosol_(MATRIX_DU_MAP(:))) - if (associated(total_ss)) total_ss(i,j,l) = sum(aerosol_(MATRIX_SS_MAP(:))) - if (associated(total_oc)) total_oc(i,j,l) = sum(aerosol_(MATRIX_OC_MAP(:))) - if (associated(total_bc)) total_bc(i,j,l) = sum(aerosol_(MATRIX_BC_MAP(:))) - - ! total - M_NO3(i,j,l) = aerosol_(MATRIX_MASS_NO3) - M_NH4(i,j,l) = aerosol_(MATRIX_MASS_NH4) - M_H2O(i,j,l) = aerosol_(MATRIX_MASS_H2O) - ! AKK - M_AKK_SU(i,j,l) = aerosol_(MATRIX_MASS_AKK_SU) - N_AKK(i,j,l) = aerosol_(MATRIX_NUMB_AKK) - ! ACC - M_ACC_SU(i,j,l) = aerosol_(MATRIX_MASS_ACC_SU) - N_ACC(i,j,l) = aerosol_(MATRIX_NUMB_ACC) - ! DD1 - M_DD1_SU(i,j,l) = aerosol_(MATRIX_MASS_DD1_SU) - M_DD1_DU(i,j,l) = aerosol_(MATRIX_MASS_DD1_DU) - N_DD1(i,j,l) = aerosol_(MATRIX_NUMB_DD1) - ! DS1 - M_DS1_SU(i,j,l) = aerosol_(MATRIX_MASS_DS1_SU) - M_DS1_DU(i,j,l) = aerosol_(MATRIX_MASS_DS1_DU) - N_DS1(i,j,l) = aerosol_(MATRIX_NUMB_DS1) - ! DD2 - M_DD2_SU(i,j,l) = aerosol_(MATRIX_MASS_DD2_SU) - M_DD2_DU(i,j,l) = aerosol_(MATRIX_MASS_DD2_DU) - N_DD2(i,j,l) = aerosol_(MATRIX_NUMB_DD2) - ! DS2 - M_DS2_SU(i,j,l) = aerosol_(MATRIX_MASS_DS2_SU) - M_DS2_DU(i,j,l) = aerosol_(MATRIX_MASS_DS2_DU) - N_DS2(i,j,l) = aerosol_(MATRIX_NUMB_DS2) - ! SSA - M_SSA_SU(i,j,l) = aerosol_(MATRIX_MASS_SSA_SU) - M_SSA_SS(i,j,l) = aerosol_(MATRIX_MASS_SSA_SS) - N_SSA = aerosol_(MATRIX_NUMB_SSA) - !SSC - M_SSC_SU(i,j,l) = aerosol_(MATRIX_MASS_SSC_SU) - M_SSC_SS(i,j,l) = aerosol_(MATRIX_MASS_SSC_SS) - N_SSC (i,j,l) = aerosol_(MATRIX_NUMB_SSC) - ! OCC - M_OCC_SU(i,j,l) = aerosol_(MATRIX_MASS_OCC_SU) - M_OCC_OC(i,j,l) = aerosol_(MATRIX_MASS_OCC_OC) - N_OCC(i,j,l) = aerosol_(MATRIX_NUMB_OCC) - ! BC1 - M_BC1_SU(i,j,l) = aerosol_(MATRIX_MASS_BC1_SU) - M_BC1_BC(i,j,l) = aerosol_(MATRIX_MASS_BC1_BC) - N_BC1(i,j,l) = aerosol_(MATRIX_NUMB_BC1) - ! BC2 - M_BC2_SU(i,j,l) = aerosol_(MATRIX_MASS_BC2_SU) - M_BC2_BC(i,j,l) = aerosol_(MATRIX_MASS_BC2_BC) - N_BC2(i,j,l) = aerosol_(MATRIX_NUMB_BC2) - ! BC3 - M_BC3_SU(i,j,l) = aerosol_(MATRIX_MASS_BC3_SU) - M_BC3_BC(i,j,l) = aerosol_(MATRIX_MASS_BC3_BC) - N_BC3(i,j,l) = aerosol_(MATRIX_NUMB_BC3) - ! DBC - M_DBC_SU(i,j,l) = aerosol_(MATRIX_MASS_DBC_SU) - M_DBC_BC(i,j,l) = aerosol_(MATRIX_MASS_DBC_BC) - M_DBC_DU(i,j,l) = aerosol_(MATRIX_MASS_DBC_DU) - N_DBC(i,j,l) = aerosol_(MATRIX_NUMB_DBC) - ! BOC - M_BOC_SU(i,j,l) = aerosol_(MATRIX_MASS_BOC_SU) - M_BOC_BC(i,j,l) = aerosol_(MATRIX_MASS_BOC_BC) - M_BOC_OC(i,j,l) = aerosol_(MATRIX_MASS_BOC_OC) - N_BOC(i,j,l) = aerosol_(MATRIX_NUMB_BOC) - ! BCS - M_BCS_SU(i,j,l) = aerosol_(MATRIX_MASS_BCS_SU) - M_BCS_BC(i,j,l) = aerosol_(MATRIX_MASS_BCS_BC) - N_BCS(i,j,l) = aerosol_(MATRIX_NUMB_BCS) - ! MXX - M_MXX_SU(i,j,l) = aerosol_(MATRIX_MASS_MXX_SU) - M_MXX_BC(i,j,l) = aerosol_(MATRIX_MASS_MXX_BC) - M_MXX_OC(i,j,l) = aerosol_(MATRIX_MASS_MXX_OC) - M_MXX_DU(i,j,l) = aerosol_(MATRIX_MASS_MXX_DU) - M_MXX_SS(i,j,l) = aerosol_(MATRIX_MASS_MXX_SS) - N_MXX(i,j,l) = aerosol_(MATRIX_NUMB_MXX) - - ! update sizes - DGN_AKK(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 1) - DGN_ACC(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 2) - DGN_DD1(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 3) - DGN_DS1(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 4) - DGN_DD2(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 5) - DGN_DS2(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 6) - DGN_SSA(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 7) - DGN_SSC(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 8) - DGN_OCC(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L, 9) - DGN_BC1(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,10) - DGN_BC2(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,11) - DGN_BC3(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,12) - DGN_DBC(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,13) - DGN_BOC(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,14) - DGN_BCS(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,15) - DGN_MXX(i,j,l) = MATRIX_DIAMETER(MATRIX_I,MATRIX_J,MATRIX_L,16) - end do - end do - end do - - deallocate(MATRIX_NACTV, __STAT__) - deallocate(MATRIX_CCNSS, __STAT__) - deallocate(MATRIX_DIAMETER, __STAT__) - deallocate(MATRIX_VDDEP_AERO, __STAT__) - - - call MAPL_TimerOff(MetaComp, '-MICROPHYSICS', __RC__) - - deallocate(ssa_emiss_mass, __STAT__) - deallocate(ssa_emiss_num, __STAT__) - deallocate(ssc_emiss_mass, __STAT__) - deallocate(ssc_emiss_num, __STAT__) - deallocate(f_grid_efficiency, __STAT__) - deallocate(w10m, __STAT__) - - deallocate(dust_emiss_tot, __STAT__) - deallocate(duf_emiss_mass, __STAT__) - deallocate(duf_emiss_num, __STAT__) - deallocate(duc_emiss_mass, __STAT__) - deallocate(duc_emiss_num, __STAT__) - - -! Stop the main timer -! ------------------- - call MAPL_TimerOff(MetaComp, 'RUN', __RC__) - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine Run_ - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ --- Finalize MATRIXchem -! -! !INTERFACE: -! - - subroutine Finalize_(GC, IMPORT, EXPORT, clock, rc) - -! !USES: - - implicit none - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: clock ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 01Dec2009 da Silva First crack. -! -!EOP -!------------------------------------------------------------------------- - - __Iam__('Finalize_') - - type(MATRIX_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF ! Universal Config - - integer :: im_World, jm_World ! Global 2D Dimensions - integer :: im, jm, lm ! 3D Dimensions - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - integer :: nymd, nhms ! date, time - real :: cdt ! time step in secs - - character(len=ESMF_MAXSTR) :: comp_name ! name of the component - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // trim(Iam) - -! Finalize MAPL Generic -! --------------------- - call MAPL_GenericFinalize(GC, IMPORT, EXPORT, clock, __RC__) - -! Extract relevant runtime information -! ------------------------------------ - call extract_(GC, CLOCK, self, GRID, CF, & - im_World, jm_World, & - im, jm, lm, lons, lats, & - nymd, nhms, cdt, __RC__) - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine Finalize_ - -!....................................................................... - - subroutine extract_(GC, clock, & - myState, GRID, CF, & - im_World, jm_World, & - im, jm, lm, & - lons, lats, & - nymd, nhms, & - cdt, rc) - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Comp object - type(ESMF_Clock), intent(in) :: clock ! Clock - - type(MATRIX_state), pointer, intent(out) :: myState ! Legacy state - type(ESMF_Grid), intent(out) :: GRID ! Grid - type(ESMF_Config), intent(out) :: CF ! Universal Config - - integer, intent(out) :: im_World, jm_World ! Global 2D Dimensions - integer, intent(out) :: im, jm, lm ! 3D Dimensions - - real(ESMF_KIND_R4), pointer :: lons(:,:) ! Longitudes - real(ESMF_KIND_R4), pointer :: lats(:,:) ! Latitudes - - - - integer, intent(out) :: nymd, nhms ! date, time - real, intent(out) :: cdt ! time step in secs - integer, optional, intent(out) :: rc - -! --- - - __Iam__('extract_') - - character(len=ESMF_MAXSTR) :: comp_name - - type(MAPL_MetaComp), pointer :: mgState ! MAPL generic state - type(MATRIX_Wrap) :: wrap - - integer, dimension(3) :: dims - - type(ESMF_Alarm) :: run_alarm - type(ESMF_TimeInterval) :: ring_interval - real(ESMF_KIND_R8) :: time_step - - type(ESMF_Time) :: time - integer :: iyr, imm, idd, ihr, imn, isc - - -! Get my name and set-up traceback handle -! --------------------------------------- - call ESMF_GridCompGet(GC, name=comp_name, __RC__) - Iam = trim(comp_name) // '::' // trim(Iam) - - rc = 0 - -! Get my internal MAPL_Generic state -! ----------------------------------- - call MAPL_GetObjectFromGC(GC, mgState, __RC__) - -! Get my internal state -! --------------------- - call ESMF_UserCompGetInternalState(GC, 'MATRIX_state', wrap, STATUS) - VERIFY_(STATUS) - myState => wrap%ptr - -! Get the configuration -! --------------------- - call ESMF_GridCompGet(GC, config=CF, __RC__) - -! Get time step -! ------------- - call MAPL_Get(mgState, RunAlarm=run_alarm, __RC__) - call ESMF_AlarmGet(run_alarm, ringInterval=ring_interval, __RC__) - - call ESMF_TimeIntervalGet(ring_interval, s_r8=time_step, __RC__) - cdt = real(time_step) - -! Extract time as simple integers from clock -! ------------------------------------------ - call ESMF_ClockGet(CLOCK, currTime=time, __RC__) - call ESMF_TimeGet(TIME, yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc, __RC__) - - call MAPL_PackTime(nymd, iyr, imm, idd) - call MAPL_PackTime(nhms, ihr, imn, isc) - -! Extract the ESMF Grid -! --------------------- - call ESMF_GridCompGet(GC, grid=GRID, __RC__) - -! Global dimensions -! ----------------- - call MAPL_GridGet(GRID, globalCellCountPerDim=dims, __RC__) - im_World = dims(1) - jm_World = dims(2) - -! Local dimensions -! ---------------- - call ESMF_GridGet(GRID, localDE=0, staggerloc=ESMF_STAGGERLOC_CENTER, & - computationalCount=dims, __RC__) - im = dims(1) - jm = dims(2) - lm = dims(3) - -! Get horizontal coordinate variables -! ----------------------------------- - call MAPL_Get(mgState, lons=lons, lats=lats, __RC__) - - - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - -end module MATRIXchem_GridCompMod diff --git a/MATRIXchem_GridComp/MATRIXchem_Registry.rc b/MATRIXchem_GridComp/MATRIXchem_Registry.rc deleted file mode 100644 index a2286d3f..00000000 --- a/MATRIXchem_GridComp/MATRIXchem_Registry.rc +++ /dev/null @@ -1,226 +0,0 @@ -# -# This the GEOS-Chem Grid Component Registry. It defines Import, -# Internal and Export states for this component as well as -# any -# -# !REVISION HISTORY: -# 16Aug2006 da Silva First Version -# 12Aug2009 Enari & Figueroa First Version (CPTEC Physics) -# 7Dec2009 R. Yantosca - updated import state specifications -# -# ----------------------------------------------------------------- - -COMP_NAME: MATRIXchem - -# Only change the Registry version when major structural changes -# occurs, not changes in content -# -------------------------------------------------------------- - MAPL_REGISTRY_VERSION: 1.00 - - -# ------------ -# Import State -# ------------ - - -# ----------------------------------------------------------------------------------------------------- -# | | | V |Item|Intervl| Sub | Def | -# Short Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Long Name -# ----------------------|---------------|-----|---|----|---|---|-----|------|-------------------------- - SH | W/m2 | xy | | | | | | | Sensible heat flux - Z0H | m | xy | | | | | | | Surface roughness for heat - LAI | 1 | xy | | | | | | | Leaf area index - LWI | 1 | xy | | | | | | | Land-water-ice flags - ZPBL | m | xy | | | | | | | PBL depth - FRLAND | 1 | xy | | | | | | | Land fraction - FRLAKE | 1 | xy | | | | | | | Lake fraction - FRACI | 1 | xy | | | | | | | Ice fraction -# CN_PRCP | kg m-2 s-1 | xy | | | | | | | Conv precip at the ground -# NCN_PRCP | kg m-2 s-1 | xy | | | | | | | Non-convective precipitation - TROPP | Pa | xy | | | | | | | Tropopause pressure - USTAR | m s-1 | xy | | | | | | | Surface (friction) velocity scale - U10M | m s-1 | xy | | | | | | | E/W 10-meter wind speed - V10M | m s-1 | xy | | | | | | | N/S 10-meter wind speed - U10N | m s-1 | xy | | | | | | | Equivalent neutral 10-meter eastward wind speed - V10N | m s-1 | xy | | | | | | | Equivalent neutral 10-meter northward wind speed - WET1 | 1 | xy | | | | | | | Surface Soil Wetness - FCLD | 1 | xyz | C | | | | | | Cloud fraction - RH2 | 1 | xyz | C | | | | | | Relative humidity - Q | kg kg-1 | xyz | C | | | | | | Specific Humidity - T | K | xyz | C | | | | | | Air Temperature (from Dynamics) - AIRDENS | kg m-3 | xyz | C | | | | | | Air density - DQDT | kg kg-1 s-1 | xyz | C | | | | | | Q tendency - moist physics -# CNV_QC | kg kg-1 | xyz | C | | | | | | Grid mean convective condensate -# CNV_MFC | kg m-2 s-1 | xyz | E | | | | | | Cumulative mass flux -# CNV_MFD | kg m-2 s-1 | xyz | C | | | | | | Detraining mass flux - DELP | Pa | xyz | C | | | | | | Pressure thickness - PLE | Pa | xyz | E | | | | | | Edge pressure - ZLE | m | xyz | E | | | | | | Edge heights -# PL | Pa | xyz | C | | | | | | Mid-level pressure -# ZL | m | xyz | C | | | | | | Mid-layer heights - U | m s-1 | xyz | C | | | | | | Eastward (E/W) wind - V | m s-1 | xyz | C | | | | | | Northward (N/S) wind -# ------------------------------------------------------------------------------------------------ - SO2 | mol mol-1 | xyz | C | | | | | | Sulfur dioxide (SO2 gas) - H2SO4 | mol mol-1 | xyz | C | | | | | | Sulfuric acid (H2SO4 gas) - NH3 | mol mol-1 | xyz | C | | | | | | Ammonia (NH3 gas) - SOA_GAS | mol mol-1 | xyz | C | | | | | | Secondary Organic Aerosols (SOA gas) - pSO4_aq | mol mol-1 s-1 | xyz | C | | | | | | Production rate of sulfate (SO4) in aqueous phase - pNH4_aq | mol mol-1 s-1 | xyz | C | | | | | | Production rate of ammonium (NH4) in aqueous phase -# ------------------------------------------------------------------------------------------------ - SO2_EMIS_FIRES | kg m-2 s-1 | xy | | | | | | | SO2 emissions from biomass burning - SO2_EMIS_NONENERGY | kg m-2 s-1 | xy | | | | | | | SO2 emissions from non-energy sectors - SO2_EMIS_ENERGY | kg m-2 s-1 | xy | | | | | | | SO2 emissions from energy sector - SO2_EMIS_SHIPPING | kg m-2 s-1 | xy | | | | | | | SO2 emissions from shipping sector - SO2_EMIS_AVIATION_LTO | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (LTO layer) - SO2_EMIS_AVIATION_CDS | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (CDS layer) - SO2_EMIS_AVIATION_CRS | kg m-2 s-1 | xy | | | | | | | SO2 emissions from aviation (CRS layer) -# ------------------------------------------------------------------------------------------------ - BC_EMIS_FIRE | kg m-2 s-1 | xy | | | | | | | BC emissions - biomass burning - BC_EMIS_BIOFUEL | kg m-2 s-1 | xy | | | | | | | BC emissions - biofuel - BC_EMIS_FOSSILFUEL | kg m-2 s-1 | xy | | | | | | | BC emissions - fossil fuels - BC_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | BC emissions - ships -# ------------------------------------------------------------------------------------------------ - OC_EMIS_FIRE | kg m-2 s-1 | xy | | | | | | | OC emissions - biomass burning - OC_EMIS_BIOFUEL | kg m-2 s-1 | xy | | | | | | | OC emissions - biofuel - OC_EMIS_FOSSILFUEL | kg m-2 s-1 | xy | | | | | | | OC emissions - fossil fuels - OC_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | OC emissions - ships -# ------------------------------------------------------------------------------------------------ - SO4_EMIS_SHIP | kg m-2 s-1 | xy | | | | | | | SO4 emissions - ships -# ------------------------------------------------------------------------------------------------ - GINOUX_DU | 1 | xy | | | | | | | Ginoux dust source -# ------------------------------------------------------------------------------------------------ - - -# ------------ -# Export State -# ------------ - - -# -# ------------------------------------------------------------------------------------------------ -# DIAGNOSTIC QUANTITIES -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| Name -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- -TOTAL_SU | ug m-3 | xyz | C | | | | | -TOTAL_DU | ug m-3 | xyz | C | | | | | -TOTAL_SS | ug m-3 | xyz | C | | | | | -TOTAL_OC | ug m-3 | xyz | C | | | | | -TOTAL_BC | ug m-3 | xyz | C | | | | | -# -EMISS_SSA | ug m-3 | xy | C | | | | | aitken seasalt emissions -EMISS_SSC | ug m-3 | xy | C | | | | | coarse seasalt emissions -EMISS_SS | ug m-3 | xy | C | | | | | seasalt emissions -# -EMISS_DUF | ug m-3 | xy | C | | | | | fine dust emissions -EMISS_DUC | ug m-3 | xy | C | | | | | coarse dust emissions -EMISS_DU | ug m-3 | xy | C | | | | | dust emissions -# --------------------|------------|-----|---|----|---|---|-----|--------------------------------- - - -# -------------- -# Internal State -# -------------- - -# -# Note: 1) For friendlies, use "D" for dynamics, "T" for turbulence and "C" for convection, or "S" for self to add to EXPORT state; leave blank otherwise -# 2) If quantity requires no restart, put an 'x' in the No Rst column - - -# -------------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# Short | | | V |Item|Intervl| Sub | Def | No | Ha | Friends | Long -# Name | Units | Dim |Loc|Type| R | A |Tiles| ault | Rst| lo | | Name -# -------------------|------------|-----|---|----|---|---|-----|------|----|----|---------|--------------------------------- -# | | | | | | | | | | | | AKK: sulfate Aitken mode - N_AKK | | xyz | C | | | | | | | | D:T:C | - M_AKK_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | ACC: sulfate accumulation mode - N_ACC | | xyz | C | | | | | | | | D:T:C | - M_ACC_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | DD1: dust accumulation mode (<= 5% inorg.) - N_DD1 | | xyz | C | | | | | | | | D:T:C | - M_DD1_DU | | xyz | C | | | | | | | | D:T:C | - M_DD1_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | DS1: dust accumulation mode ( > 5% inorg.) - N_DS1 | | xyz | C | | | | | | | | D:T:C | - M_DS1_DU | | xyz | C | | | | | | | | D:T:C | - M_DS1_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | DD1: dust coarse mode (<= 5% inorg.) - N_DD2 | | xyz | C | | | | | | | | D:T:C | - M_DD2_DU | | xyz | C | | | | | | | | D:T:C | - M_DD2_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | DS2: dust coarse mode ( > 5% inorg.) - N_DS2 | | xyz | C | | | | | | | | D:T:C | - M_DS2_DU | | xyz | C | | | | | | | | D:T:C | - M_DS2_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | SSA: sea salt accumulation mode - M_SSA_SS | | xyz | C | | | | | | | | D:T:C | - M_SSA_SU | | xyz | C | | | | | | | | D:T:C | - N_SSA | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | SSC: sea salt coarse mode - M_SSC_SS | | xyz | C | | | | | | | | D:T:C | - M_SSC_SU | | xyz | C | | | | | | | | D:T:C | - N_SSC | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | OCC: OC - N_OCC | | xyz | C | | | | | | | | D:T:C | - M_OCC_OC | | xyz | C | | | | | | | | D:T:C | - M_OCC_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | BC1: BC (<= 5% inorg.) - N_BC1 | | xyz | C | | | | | | | | D:T:C | - M_BC1_BC | | xyz | C | | | | | | | | D:T:C | - M_BC1_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | BC2: BC (5-20% inorg.) - N_BC2 | | xyz | C | | | | | | | | D:T:C | - M_BC2_BC | | xyz | C | | | | | | | | D:T:C | - M_BC2_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | BC3: BC (>20% inorg.) - N_BC3 | | xyz | C | | | | | | | | D:T:C | - M_BC3_BC | | xyz | C | | | | | | | | D:T:C | - M_BC3_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | DBC: BC-mineral dust - N_DBC | | xyz | C | | | | | | | | D:T:C | - M_DBC_DU | | xyz | C | | | | | | | | D:T:C | - M_DBC_BC | | xyz | C | | | | | | | | D:T:C | - M_DBC_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | BOC: BC-OC - N_BOC | | xyz | C | | | | | | | | D:T:C | - M_BOC_BC | | xyz | C | | | | | | | | D:T:C | - M_BOC_OC | | xyz | C | | | | | | | | D:T:C | - M_BOC_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | BC-sulfate - N_BCS | | xyz | C | | | | | | | | D:T:C | - M_BCS_BC | | xyz | C | | | | | | | | D:T:C | - M_BCS_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | MXX: mixed - N_MXX | | xyz | C | | | | | | | | D:T:C | - M_MXX_BC | | xyz | C | | | | | | | | D:T:C | - M_MXX_OC | | xyz | C | | | | | | | | D:T:C | - M_MXX_DU | | xyz | C | | | | | | | | D:T:C | - M_MXX_SS | | xyz | C | | | | | | | | D:T:C | - M_MXX_SU | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | total - M_NH4 | | xyz | C | | | | | | | | D:T:C | - M_NO3 | | xyz | C | | | | | | | | D:T:C | - M_H2O | | xyz | C | | | | | | | | D:T:C | -# | | | | | | | | | | | | size -DGN_AKK | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_ACC | m | xyz | C | | | | | | x | | S | diameter of ACC -DGN_DD1 | m | xyz | C | | | | | | x | | S | diameter of DD1 -DGN_DS1 | m | xyz | C | | | | | | x | | S | diameter of DS1 -DGN_DD2 | m | xyz | C | | | | | | x | | S | diameter of -DGN_DS2 | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_SSA | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_SSC | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_OCC | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_BC1 | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_BC2 | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_BC3 | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_DBC | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_BOC | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_BCS | m | xyz | C | | | | | | x | | S | diameter of AKK -DGN_MXX | m | xyz | C | | | | | | x | | S | diameter of AKK -# -------------------|------------|-----|---|----|---|---|-----|------|----|----|---------| - - diff --git a/MATRIXchem_GridComp/README b/MATRIXchem_GridComp/README deleted file mode 100644 index d65ddac4..00000000 --- a/MATRIXchem_GridComp/README +++ /dev/null @@ -1,20 +0,0 @@ -MATRIXchem README - - -* Importing/tracking code from GISS/MATRIX - - - Change file extensions to *.F and *.F90 - - - Use 'GISS' as the name of the vendor branch, e.g., - GISS ModelE MATRIX-V2_032015 was imported using the following - steps - - $ cd matrix-v2_032015 # directory containing the original MATRIX code, but - # with Fortran files having *.F or *.F90 extensions - - $ cvs -nq import -m "asd: import of GISS ModelE/MATRIX (v2-032015)" \ - esma/src/Components/MATRIXchem_GridComp/microphysics \ - GISS \ - GISS_MATRIX_V2_032015 - - diff --git a/MATRIXchem_GridComp/microphysics/CONST.F b/MATRIXchem_GridComp/microphysics/CONST.F deleted file mode 100644 index 1cbd0777..00000000 --- a/MATRIXchem_GridComp/microphysics/CONST.F +++ /dev/null @@ -1,235 +0,0 @@ - MODULE CONSTANT -!@sum CONSTANT definitions for physical constants and useful numbers -!@auth G. Schmidt -!@ver 1.0 - IMPLICIT NONE - SAVE -C**** Conventions: 'by' implies reciprocal, 'rt' implies square root - -C**** Numerical constants - - real*8,parameter :: pi = 3.1415926535897932d0 !@param pi pi - real*8,parameter :: twopi = 2d0*pi !@param twopi 2*pi - real*8,parameter :: radian = pi/180d0 !@param radian pi/180 -!@param zero,one 0 and 1 for occasional use as arguments - real*8,parameter :: zero = 0d0, one=1d0 -!@param rt2,byrt2 sqrt(2), 1/sqrt(2) - real*8,parameter :: rt2 = 1.4142135623730950d0 - real*8,parameter :: byrt2 = 1./rt2 -!@param rt3,byrt3 sqrt(3), 1/sqrt(3) - real*8,parameter :: rt3 = 1.7320508075688772d0 - real*8,parameter :: byrt3 = 1./rt3 -!@param rt12,byrt12 sqrt(12), 1/sqrt(12) - real*8,parameter :: rt12 = 3.4641016151377546d0 - real*8,parameter :: byrt12 = 1./rt12 - real*8,parameter :: by3 =1./3d0 !@param by3 1/3 - real*8,parameter :: by6 =1./6d0 !@param by6 1/6 - real*8,parameter :: by9 =1./9d0 !@param by9 1/9 - real*8,parameter :: by12=1./12d0 !@param by12 1/12 -!@param undef Missing value - real*8,parameter :: undef=-1.d30 -!@param teeny small positive value used in num/(den+teeny) to avoid 0/0 - real*8,parameter :: teeny=1.d-30 - integer*8,parameter :: intNaN=-1 ! i.e. = Z'FFFFFFFFFFFFFFFF' -!@param NaN NaN -#if (defined COMPILER_PGI || defined COMPILER_NAG) - real*8,parameter :: NaN=1d30 -#else - real*8,parameter :: NaN=transfer(intNaN,1.d0) -#endif - -C**** Physical constants - -!@param stbo Stefan-Boltzmann constant (W/m^2 K^4) - real*8,parameter :: stbo =5.67051d-8 !current best estimate - -c**** Latent heats: -c**** Note that for energy conservation the efective latent heat at any -c**** temperature must follow these formulae (assuming a reference -c**** temperature of 0 Celcius, and constant specific heats). -c**** If specific heats vary as a function of temperature, the extra -c**** term becomes an integral -c**** lhe(T) = lhe(0) + (shv-shw) T (in C) -c**** lhm(T) = lhm(0) + (shw-shi) T (in C) -c**** lhs(T) = lhs(0) + (shv-shi) T (in C) -!@param lhe latent heat of evap at 0 C (2.5008d6 J/kg) - real*8,parameter :: lhe = 2.5d6 -!@param lhm latent heat of melt at 0 C (334590 J/kg) - real*8,parameter :: lhm = 3.34d5 -!@param bylhm 1/lhm - real*8,parameter :: bylhm = 1./lhm -!@param lhs latent heat of sublimation at 0 C (J/kg) - real*8,parameter :: lhs = lhe+lhm - -!@param rhow density of pure water (1000 kg/m^3) - real*8,parameter :: rhow = 1d3 -!@param rhows density of average sea water (1030 kg/m^3) - real*8,parameter :: rhows = 1030d0 -!@param byrhows recip. density of average sea water (1/1030 m^3/kg) - real*8,parameter :: byrhows = 1d0/rhows -!@param rhoi density of pure ice (916.6 kg/m^3) - real*8,parameter :: rhoi = 916.6d0 -!@param byrhoi 1/rhoi (m^3/kg) - real*8,parameter :: byrhoi = 1d0/rhoi - -!@param tf freezing point of water at 1 atm (273.16 K) - real*8,parameter :: tf = 273.16d0 -!@param bytf 1/tf (K^-1) - real*8,parameter :: bytf = 1d0/tf - -!@param shw heat capacity of water (at 20 C) (4185 J/kg C) - real*8,parameter :: shw = 4185. -!@param byshw 1/shw - real*8,parameter :: byshw = 1d0/shw - -!@param shi heat capacity of pure ice (at 0 C) (2060 J/kg C) - real*8,parameter :: shi = 2060. -!@param byshi 1/shi - real*8,parameter :: byshi = 1d0/shi - -!@param fraction of O2 in the atmosphere (0-1) - real*8,parameter :: pO2 = 0.209476d0 - -c**** RGAS = R/M_A = 1000* 8.314510 J/mol K /28.9655 g/mol -c**** For values of CO2 much larger than present day (> 4x conc) -c**** the molecular weight of dry air M_A could change. -c**** Assume that M_O2 = 31.9988 and M_CO2 = 44.00995 -c**** and current percentages 20.946% and 0.0350% (US Stand. Atm.) -c**** Assuming CO2 displaces other gases equally M_A=28.9602 + n*0.00527 -c**** where n is multiple of present day CO2 conc (350 ppm) -c**** For 4xCO2 M_A = 28.9813 => rgas = 286.89 -c**** For 10xCO2 M_A = 29.0129 => rgas = 286.58 -!@param gasc gas constant (8.314510 J/mol K) - real*8,parameter :: gasc = 8.314510d0 -!@param bygasc 1/gasc - real*8,parameter :: bygasc = 1./gasc -!@param mair molecular weight of dry air (28.9655 g/mol) - real*8,parameter :: mair = 28.9655d0 -!@param rgas gas constant (287.05 J/K kg) - real*8,parameter :: rgas = 1d3 * gasc / mair ! = 287.05... - -!@param mwat molecular weight of water vapour - real*8,parameter :: mwat = 18.015d0 -!@param rvap gas constant for water vapour (461.5 J/K kg) -c**** defined as R/M_W = 1000* 8.314510 J/mol K /18.015 g/mol - real*8,parameter :: rvap = 1d3 * gasc / mwat ! = 461.5... - -!@param mrat mass ratio of air to water vapour (0.62197) - real*8,parameter :: mrat = mwat/mair ! = 0.62197.... -!@param bymrat 1/mrat (1.6078) - real*8,parameter :: bymrat = 1./mrat ! = 1.6078.... -!@param deltx coeff. of humidity in virtual temperature defn. (0.6078) - real*8,parameter :: deltx = bymrat-1. ! = 0.6078.... - -!@param srat ratio of specific heats at const. press. and vol. (=1.401) - real*8,parameter :: srat = 1.401d0 -!@param kapa ideal gas law exponent for dry air (.2862) -c**** kapa = (g-1)/g where g=1.401 = c_p/c_v - real*8,parameter :: kapa = (srat - 1.)/srat ! =.2862.... -!@param bykapa,bykapap1,bykapap2 various useful reciprocals of kapa - real*8,parameter :: bykapa = 1./kapa - real*8,parameter :: bykapap1 = 1./(kapa+1.) - real*8,parameter :: bykapap2 = 1./(kapa+2.) - -!@param sha specific heat of dry air (const. pres.) (rgas/kapa J/kg C) - real*8,parameter :: sha = rgas/kapa -!@param bysha 1/sha - real*8,parameter :: bysha = 1./sha - -!@param shv specific heat of water vapour (const. pres.) (J/kg C) -c**** shv is currently assumed to be zero to aid energy conservation in -c**** the atmosphere. Once the heat content associated with water -c**** vapour is included, this can be set to the standard value -c**** Literature values are 1911 (Arakawa), 1952 (Wallace and Hobbs) -c**** Smithsonian Met Tables = 4*rvap + delta = 1858--1869 ???? -c real*8,parameter :: shv = 4.*rvap ???? - real*8,parameter :: shv = 0. - -C**** air viscosity - temperature independent -!@var visc_air0 dynamic viscosity of air (kg/m s) - real*8,parameter :: visc_air0 = 1.7d-5 - -!@var visc_air_kin0 kinematic viscosity of air (1 bar 15 deg C) (m^2/s) - real*8,parameter :: visc_air_kin0 = 1.46d-5 - -!@var visc_wtr_kin kinematic viscosity of water (35 psu, 20 deg C) (m^2/s) - real*8,parameter :: visc_wtr_kin = 1.05d-6 - -!@var avog Avogadro's constant (atmos/mole) - real*8,parameter :: avog=6.023d23 - -C**** Astronomical constants - -!@param sday sec per day (s) - real*8,parameter :: sday = 86400. -!@param syr sec per year (s) - real*8,parameter :: syr = sday*365. - -!@param hrday hours in a day (hrs) - real*8,parameter :: hrday = sday/3600. - -!@param omega earth's rotation rate (7.29 s^-1) -c real*8,parameter :: omega = 7.2921151467d-5 ! NOVAS value - real*8,parameter :: EDPERD = 1. - real*8,parameter :: EDPERY = 365. - real*8,parameter :: omega = TWOPI*(EDPERD+EDPERY)/ - * (EDPERD*EDPERY*SDAY) -!@param omega2 2*omega - real*8,parameter :: omega2 = 2.*omega - -!@param radius radius of the earth (6371000 m, IUGG) - real*8,parameter :: radius = 6371000. -!@param areag surface area of the earth (m^2) - real*8,parameter :: areag = 4.*pi*radius*radius - -!@param grav gravitaional accelaration (9.80665 m/s^2) -c**** SI reference gravity (at 45 deg) = 9.80665 - real*8,parameter :: grav = 9.80665d0 -!@param bygrav 1/grav - real*8,parameter :: bygrav = 1d0/grav - -C**** lapse rate related variables -!@param GAMD dry adiabatic lapse rate (=0.0098 K/m) - real*8, parameter :: gamd = grav*kapa/rgas -!@param BMOIST moist adiabatic lapse rate (K/m) - real*8, parameter :: bmoist = 0.0065d0 -!@param BBYG moist adiabatic lapse rate divided by grav - real*8, parameter :: bbyg = bmoist*bygrav -!@param GBYRB grav divided by rgas and bmoist - real*8, parameter :: gbyrb = grav/(rgas*bmoist) - -C**** Useful conversion factors - -!@param kg2mb,mb2kg conversion from milli-bars to kg/m^2 - real*8,parameter :: kg2mb = 1d-2*grav, mb2kg = 1d2*bygrav -!@param kgpa2mm,mm2kgpa conversion from kg/m^2 water to mm - real*8,parameter :: kgpa2mm = 1d0, mm2kgpa = 1d0 - - CONTAINS - - real*8 function visc_air(T) -!@sum visc_air dynamic viscosity of air (function of T) (kg/m s) -!@auth Sutherland formula - real*8, intent(in) :: T ! temperature (K) - real*8, parameter :: n0=1.827d-5, T0=291.15d0, C=120d0 - - visc_air = n0*sqrt((T/T0)**3)*(T0+C)/(T+C) - - return - end function - - real*8 function visc_air_kin(T) -!@sum visc_air_kin kinematic viscosity of air (function of T) (m2/s) -!@auth COARE formula - Andreas (1989) CRREL Rep. 89-11 - real*8, intent(in) :: T ! temperature (K) - real*8, parameter :: nu0=1.326d-5, a0=6.542d-3, b0=8.301d-6, - * c0=4.84d-9 - real*8 :: Tc ! temperature in deg C - - Tc=T-tf - visc_air_kin = nu0*(1.+Tc*(a0+Tc*(b0-c0*Tc))) !m2/s - - return - end function - - END MODULE CONSTANT diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_actv.F b/MATRIXchem_GridComp/microphysics/TRAMP_actv.F deleted file mode 100644 index c86b5972..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_actv.F +++ /dev/null @@ -1,504 +0,0 @@ - MODULE AERO_ACTV -! USE AMP_AEROSOL, ONLY: NACTV - USE AERO_PARAM, ONLY: NLAYS, AUNIT1 - USE AERO_CONFIG, ONLY: NMODES -!------------------------------------------------------------------------------------------------------------------------- -!@sum The array NACTV(X,Y,Z,I) contains current values of the number of aerosol particles -!@+ activated in clouds for each mode I for use outside of the MATRIX microphysical module. -!@+ Values in NACTV are saved in subr. MATRIX at each time step. -! -!@auth Susanne Bauer/Doug Wright -! -!------------------------------------------------------------------------------------------------------------------------- - - REAL(8), PARAMETER :: DENS_SULF = 1.77D+03 ! [kg/m^3] NH42SO4 - REAL(8), PARAMETER :: DENS_BCAR = 1.70D+03 ! [kg/m^3] Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: DENS_OCAR = 1.00D+03 ! [kg/m^3] Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: DENS_DUST = 2.60D+03 ! [kg/m^3] Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: DENS_SEAS = 2.165D+03 ! [kg/m^3] NaCl, Ghan et al. (2001) used 1.90D+03 - - CONTAINS - - - SUBROUTINE GETACTFRAC(NMODEX,XNAP,XMAP5,RG,SIGMAG,TKELVIN,PTOT,WUPDRAFT, - & AC,FRACACTN,FRACACTM,NACT,CCN,MACT) -!---------------------------------------------------------------------------------------------------------------------- -! 12-12-06, DLW: Routine to set up the call to subr. ACTFRAC_MAT to calculate the -! activated fraction of the number and mass concentrations, -! as well as the number and mass concentrations activated -! for each of NMODEX modes. The minimum dry radius for activation -! for each mode is also returned. -! -! Each mode is assumed to potentially contains 5 chemical species: -! (1) sulfate -! (2) BC -! (3) OC -! (4) mineral dust -! (5) sea salt -! -! The aerosol activation parameterizations are described in -! -! 1. Abdul-Razzak et al. 1998, JGR, vol.103, p.6123-6131. -! 2. Abdul-Razzak and Ghan 2000, JGR, vol.105, p.6837-6844. -! -! and values for many of the required parameters were taken from -! -! 3. Ghan et al. 2001, JGR vol 106, p.5295-5316. -! -! With the density of sea salt set to the value used in ref. 3 (1900 kg/m^3), this routine -! yields values for the hygroscopicity parameters Bi in agreement with ref. 3. -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - INTEGER, PARAMETER :: NCOMPS = 5 - - ! Arguments. - - INTEGER :: NMODEX ! number of modes [1] - REAL(8) :: XNAP(NMODEX) ! number concentration for each mode [#/m^3] - REAL(8) :: XMAP5(NMODEX,NCOMPS) ! mass concentration of each of the 5 species for each mode [ug/m^3] - REAL(8) :: RG(NMODEX) ! geometric mean dry radius for each mode [um] - REAL(8) :: SIGMAG(NMODEX) ! geometric standard deviation for each mode [um] - REAL(8) :: TKELVIN ! absolute temperature [K] - REAL(8) :: PTOT ! ambient pressure [Pa] - REAL(8) :: WUPDRAFT ! updraft velocity [m/s] - REAL(8) :: AC(NMODEX) ! minimum dry radius for activation for each mode [um] - REAL(8) :: FRACACTN(NMODEX) ! activating fraction of number conc. for each mode [1] - REAL(8) :: FRACACTM(NMODEX) ! activating fraction of mass conc. for each mode [1] - REAL(8) :: NACT(NMODEX) ! activating number concentration for each mode [#/m^3] - REAL(8) :: CCN(NMODEX,3) ! activating number concentration for each mode [#/m^3] - REAL(8) :: MACT(NMODEX) ! activating mass concentration for each mode [ug/m^3] - - ! Local variables. - - INTEGER :: I, J ! loop counters - REAL(8) :: XMAP(NMODEX) ! total mass concentration for each mode [ug/m^3] - REAL(8) :: BIBAR(NMODEX) ! hygroscopicity parameter for each mode [1] - - ! Variables for mode-average hygroscopicity parameters. - - REAL(8) :: XR (NMODEX,NCOMPS) ! mass fraction for component J in mode I [1] - REAL(8), SAVE :: XNU (NCOMPS) ! # of ions formed per formula unit solute for component J in mode I [1] - REAL(8), SAVE :: XPHI(NCOMPS) ! osmotic coefficient for component J in mode I [1] - REAL(8), SAVE :: XMW (NCOMPS) ! molecular weight for component J in mode I [kg/mol] - REAL(8), SAVE :: XRHO(NCOMPS) ! density of component J in mode I [kg/m^3] - REAL(8), SAVE :: XEPS(NCOMPS) ! soluble fraction of component J in mode I [1] - - REAL(8) :: SUMNUMER, SUMDENOM ! scratch variables - - REAL(8), PARAMETER :: NION_SULF = 3.00D+00 ! [1] - REAL(8), PARAMETER :: NION_BCAR = 1.00D+00 ! [1] - REAL(8), PARAMETER :: NION_OCAR = 1.00D+00 ! [1] - REAL(8), PARAMETER :: NION_DUST = 2.30D+00 ! [1] - REAL(8), PARAMETER :: NION_SEAS = 2.00D+00 ! [1] NaCl - - REAL(8), PARAMETER :: XPHI_SULF = 0.70D+00 ! [1] - REAL(8), PARAMETER :: XPHI_BCAR = 1.00D+00 ! [1] - REAL(8), PARAMETER :: XPHI_OCAR = 1.00D+00 ! [1] - REAL(8), PARAMETER :: XPHI_DUST = 1.00D+00 ! [1] - REAL(8), PARAMETER :: XPHI_SEAS = 1.00D+00 ! [1] NaCl - - REAL(8), PARAMETER :: MOLW_SULF = 132.0D-03 ! [kg/mol] - REAL(8), PARAMETER :: MOLW_BCAR = 100.0D-03 ! [kg/mol] - REAL(8), PARAMETER :: MOLW_OCAR = 100.0D-03 ! [kg/mol] - REAL(8), PARAMETER :: MOLW_DUST = 100.0D-03 ! [kg/mol] - REAL(8), PARAMETER :: MOLW_SEAS = 58.44D-03 ! [kg/m^3] NaCl - - REAL(8), PARAMETER :: XEPS_SULF = 1.00D+00 ! [1] - REAL(8), PARAMETER :: XEPS_BCAR = 1.67D-06 ! [1] - REAL(8), PARAMETER :: XEPS_OCAR = 0.78D+00 ! [1] - REAL(8), PARAMETER :: XEPS_DUST = 0.13D+00 ! [1] - REAL(8), PARAMETER :: XEPS_SEAS = 1.00D+00 ! [1] NaCl - - REAL(8), PARAMETER :: WMOLMASS = 18.01528D-03 ! molar mass of H2O [kg/mol] - REAL(8), PARAMETER :: DENH2O = 1.00D+03 ! density of water [kg/m^3] - - LOGICAL, SAVE :: FIRSTIME = .TRUE. - - IF( FIRSTIME ) THEN - FIRSTIME = .FALSE. - XNU (1) = NION_SULF - XNU (2) = NION_BCAR - XNU (3) = NION_OCAR - XNU (4) = NION_DUST - XNU (5) = NION_SEAS - XPHI(1) = XPHI_SULF - XPHI(2) = XPHI_BCAR - XPHI(3) = XPHI_OCAR - XPHI(4) = XPHI_DUST - XPHI(5) = XPHI_SEAS - XMW (1) = MOLW_SULF - XMW (2) = MOLW_BCAR - XMW (3) = MOLW_OCAR - XMW (4) = MOLW_DUST - XMW (5) = MOLW_SEAS - XRHO(1) = DENS_SULF - XRHO(2) = DENS_BCAR - XRHO(3) = DENS_OCAR - XRHO(4) = DENS_DUST - XRHO(5) = DENS_SEAS - XEPS(1) = XEPS_SULF - XEPS(2) = XEPS_BCAR - XEPS(3) = XEPS_OCAR - XEPS(4) = XEPS_DUST - XEPS(5) = XEPS_SEAS - ENDIF - - !-------------------------------------------------------------------------------------------------------------- - ! Calculate the mass fraction component J for each mode I. - !-------------------------------------------------------------------------------------------------------------- - DO I=1, NMODEX - XMAP(I) = 0.0D+00 - DO J=1, NCOMPS - XMAP(I) = XMAP(I) + XMAP5(I,J) - ENDDO - XR(I,:) = XMAP5(I,:) / MAX( XMAP(I), 1.0D-30 ) - ! WRITE(*,'(I4,5F12.6)') I,XR(I,:) - ENDDO - - !-------------------------------------------------------------------------------------------------------------- - ! Calculate the hygroscopicity parameter for each mode. - !-------------------------------------------------------------------------------------------------------------- - DO I=1, NMODEX - SUMNUMER = 0.0D+00 - SUMDENOM = 0.0D+00 - DO J=1, NCOMPS - SUMNUMER = SUMNUMER + XR(I,J)*XNU(J)*XPHI(J)*XEPS(J)/XMW(J) ! [mol/kg] - SUMDENOM = SUMDENOM + XR(I,J)/XRHO(J) ! [m^3/kg] - ENDDO - BIBAR(I) = ( WMOLMASS*SUMNUMER ) / ( DENH2O*SUMDENOM ) ! [1] - ENDDO - ! WRITE(*,'(8D15.6)') BIBAR(:) - - !-------------------------------------------------------------------------------------------------------------- - ! Calculate the droplet activation parameters for each mode. - !-------------------------------------------------------------------------------------------------------------- - CALL ACTFRAC_MAT(NMODEX,XNAP,XMAP,RG,SIGMAG,BIBAR,TKELVIN,PTOT,WUPDRAFT, - & AC,FRACACTN,FRACACTM,NACT,CCN,MACT) - - DO I=1, NMODEX - IF(XNAP(I) .LT. 1.0D-06 ) FRACACTN(I) = 1.0D-30 - ENDDO - - RETURN - END SUBROUTINE GETACTFRAC - - - SUBROUTINE ACTFRAC_MAT(NMODEX,XNAP,XMAP,RG,SIGMAG,BIBAR,TKELVIN,PTOT,WUPDRAFT, - & AC,FRACACTN,FRACACTM,NACT,CCN,MACT) -!---------------------------------------------------------------------------------------------------------------------- -! 12-12-06, DLW: Routine to calculate the activated fraction of the number -! and mass concentrations, as well as the number and mass -! concentrations activated for each of NMODEX modes. The -! minimum dry radius for activation for each mode is also returned. -! -! The aerosol activation parameterizations are described in -! -! 1. Abdul-Razzak et al. 1998, JGR, vol.103, p.6123-6131. -! 2. Abdul-Razzak and Ghan 2000, JGR, vol.105, p.6837-6844. -! -! This routine is for the multiple-aerosol type parameterization. -!---------------------------------------------------------------------------------------------------------------------- -#ifndef GEOS5_PORT - USE DOMAIN_DECOMP_ATM,only: am_i_root -#endif - IMPLICIT NONE - - ! Arguments. - - INTEGER :: NMODEX ! number of modes [1] - REAL(8) :: XNAP(NMODEX) ! number concentration for each mode [#/m^3] - REAL(8) :: XMAP(NMODEX) ! mass concentration for each mode [ug/m^3] - REAL(8) :: RG(NMODEX) ! geometric mean radius for each mode [um] - REAL(8) :: SIGMAG(NMODEX) ! geometric standard deviation for each mode [um] - REAL(8) :: BIBAR(NMODEX) ! hygroscopicity parameter for each mode [1] - REAL(8) :: TKELVIN ! absolute temperature [K] - REAL(8) :: PTOT ! ambient pressure [Pa] - REAL(8) :: WUPDRAFT ! updraft velocity [m/s] - REAL(8) :: AC(NMODEX) ! minimum dry radius for activation for each mode [um] - REAL(8) :: AC_2(NMODEX) ! minimum dry radius for activation for each mode [um] - REAL(8) :: AC_3(NMODEX) ! minimum dry radius for activation for each mode [um] - REAL(8) :: AC_5(NMODEX) ! minimum dry radius for activation for each mode [um] - REAL(8) :: FRACACTN(NMODEX) ! activating fraction of number conc. for each mode [1] - REAL(8) :: FRACACTN_2(NMODEX) ! activating fraction of number conc. for each mode [1] - REAL(8) :: FRACACTN_3(NMODEX) ! activating fraction of number conc. for each mode [1] - REAL(8) :: FRACACTN_5(NMODEX) ! activating fraction of number conc. for each mode [1] - REAL(8) :: FRACACTM(NMODEX) ! activating fraction of mass conc. for each mode [1] - REAL(8) :: NACT(NMODEX) ! activating number concentration for each mode [#/m^3] - REAL(8) :: CCN(NMODEX,3) ! CCN at 0.2 9.3 and 0.5 % Supersaturation - REAL(8) :: MACT(NMODEX) ! activating mass concentration for each mode [ug/m^3] - - ! Parameters. - - REAL(8), PARAMETER :: PI = 3.141592653589793D+00 - REAL(8), PARAMETER :: TWOPI = 2.0D+00 * PI - REAL(8), PARAMETER :: SQRT2 = 1.414213562D+00 - REAL(8), PARAMETER :: THREESQRT2BY2 = 1.5D+00 * SQRT2 - - REAL(8), PARAMETER :: AVGNUM = 6.0221367D+23 ! [1/mol] - REAL(8), PARAMETER :: RGASJMOL = 8.31451D+00 ! [J/mol/K] - REAL(8), PARAMETER :: WMOLMASS = 18.01528D-03 ! molar mass of H2O [kg/mol] - REAL(8), PARAMETER :: AMOLMASS = 28.966D-03 ! molar mass of air [kg/mol] - REAL(8), PARAMETER :: ASMOLMSS = 132.1406D-03 ! molar mass of NH42SO4 [kg/mol] - REAL(8), PARAMETER :: DENH2O = 1.00D+03 ! density of water [kg/m^3] - REAL(8), PARAMETER :: DENAMSUL = 1.77D+03 ! density of pure ammonium sulfate [kg/m^3] - REAL(8), PARAMETER :: XNUAMSUL = 3.00D+00 ! # of ions formed when the salt is dissolved in water [1] - REAL(8), PARAMETER :: PHIAMSUL = 1.000D+00 ! osmotic coefficient value in A-R 1998. [1] - REAL(8), PARAMETER :: GRAVITY = 9.81D+00 ! grav. accel. at the Earth's surface [m/s/s] - REAL(8), PARAMETER :: HEATVAP = 40.66D+03/WMOLMASS ! latent heat of vap. for water and Tnbp [J/kg] - REAL(8), PARAMETER :: CPAIR = 1006.0D+00 ! heat capacity of air [J/kg/K] - REAL(8), PARAMETER :: T0DIJ = 273.15D+00 ! reference temp. for DV [K] - REAL(8), PARAMETER :: P0DIJ = 101325.0D+00 ! reference pressure for DV [Pa] - REAL(8), PARAMETER :: DIJH2O0 = 0.211D-04 ! reference value of DV [m^2/s] (P&K,2nd ed., p.503) - !---------------------------------------------------------------------------------------------------------------- - ! REAL(8), PARAMETER :: T0DIJ = 283.15D+00 ! reference temp. for DV [K] - ! REAL(8), PARAMETER :: P0DIJ = 80000.0D+00 ! reference pressure for DV [Pa] - ! REAL(8), PARAMETER :: DIJH2O0 = 0.300D-04 ! reference value of DV [m^2/s] (P&K,2nd ed., p.503) - !---------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DELTAV = 1.096D-07 ! vapor jump length [m] - REAL(8), PARAMETER :: DELTAT = 2.160D-07 ! thermal jump length [m] - REAL(8), PARAMETER :: ALPHAC = 1.000D+00 ! condensation mass accommodation coefficient [1] - REAL(8), PARAMETER :: ALPHAT = 0.960D+00 ! thermal accommodation coefficient [1] - - ! Local variables. - - INTEGER :: I ! loop counter - REAL(8) :: DV ! diffusion coefficient for water [m^2/s] - REAL(8) :: DVPRIME ! modified diffusion coefficient for water [m^2/s] - REAL(8) :: DUMW, DUMA ! scratch variables [s/m] - REAL(8) :: WPE ! saturation vapor pressure of water [Pa] - REAL(8) :: SURTEN ! surface tension of air-water interface [J/m^2] - REAL(8) :: XKA ! thermal conductivity of air [J/m/s/K] - REAL(8) :: XKAPRIME ! modified thermal conductivity of air [J/m/s/K] - REAL(8) :: ETA(NMODEX) ! model parameter [1] - REAL(8) :: ZETA ! model parameter [1] - REAL(8) :: XLOGSIGM(NMODEX) ! ln(sigmag) [1] - REAL(8) :: A ! [m] - REAL(8) :: G ! [m^2/s] - REAL(8) :: RDRP ! [m] - REAL(8) :: F1 ! [1] - REAL(8) :: F2 ! [1] - REAL(8) :: ALPHA ! [1/m] - REAL(8) :: GAMMA ! [m^3/kg] - REAL(8) :: SM(NMODEX) ! [1] - REAL(8) :: DUM ! [1/m] - REAL(8) :: U ! argument to error function [1] - REAL(8) :: ERF ! error function [1], but not declared in an f90 module - REAL(8) :: SMAX ! maximum supersaturation [1] - -!---------------------------------------------------------------------------------------------------------------------- -! RDRP is the radius value used in Eqs.(17) & (18) and was adjusted to yield eta and zeta -! values close to those given in A-Z et al. 1998 Figure 5. -!---------------------------------------------------------------------------------------------------------------------- - RDRP = 0.105D-06 ! [m] Tuned to approximate the results in Figures 1-5 in A-Z et al. 1998. -!---------------------------------------------------------------------------------------------------------------------- -! These variables are common to all modes and need only be computed once. -!---------------------------------------------------------------------------------------------------------------------- - DV = DIJH2O0*(P0DIJ/PTOT)*(TKELVIN/T0DIJ)**1.94D+00 ! [m^2/s] (P&K,2nd ed., p.503) - SURTEN = 76.10D-03 - 0.155D-03 * (TKELVIN-273.15D+00) ! [J/m^2] - WPE = EXP( 77.34491296D+00 - 7235.424651D+00/TKELVIN - 8.2D+00*LOG(TKELVIN) + TKELVIN*5.7113D-03 ) ! [Pa] - DUMW = SQRT(TWOPI*WMOLMASS/RGASJMOL/TKELVIN) ! [s/m] - DVPRIME = DV / ( (RDRP/(RDRP+DELTAV)) + (DV*DUMW/(RDRP*ALPHAC)) ) ! [m^2/s] - Eq. (17) - XKA = (5.69D+00+0.017D+00*(TKELVIN-273.15D+00))*418.4D-05 ! [J/m/s/K] (0.0238 J/m/s/K at 273.15 K) - DUMA = SQRT(TWOPI*AMOLMASS/RGASJMOL/TKELVIN) ! [s/m] - XKAPRIME = XKA / ( ( RDRP/(RDRP+DELTAT) ) + ( XKA*DUMA/(RDRP*ALPHAT*DENH2O*CPAIR) ) ) ! [J/m/s/K] - G = 1.0D+00 / ( (DENH2O*RGASJMOL*TKELVIN) / (WPE*DVPRIME*WMOLMASS) - : + ( (HEATVAP*DENH2O) / (XKAPRIME*TKELVIN) ) - : * ( (HEATVAP*WMOLMASS) / (RGASJMOL*TKELVIN) - 1.0D+00 ) ) ! [m^2/s] - A = (2.0D+00*SURTEN*WMOLMASS)/(DENH2O*RGASJMOL*TKELVIN) ! [m] - ALPHA = (GRAVITY/(RGASJMOL*TKELVIN))*((WMOLMASS*HEATVAP)/(CPAIR*TKELVIN) - AMOLMASS) ! [1/m] - GAMMA = (RGASJMOL*TKELVIN)/(WPE*WMOLMASS) - & + (WMOLMASS*HEATVAP*HEATVAP)/(CPAIR*PTOT*AMOLMASS*TKELVIN) ! [m^3/kg] - DUM = SQRT(ALPHA*WUPDRAFT/G) ! [1/m] - ZETA = 2.D+00*A*DUM/3.D+00 ! [1] - !---------------------------------------------------------------------------------------------------------------- - ! WRITE(1,'(A27,4D15.5)')'SURTEN,WPE,A =',SURTEN,WPE,A - ! WRITE(1,'(A27,4D15.5)')'XKA,XKAPRIME,DV,DVPRIME =',XKA,XKAPRIME,DV,DVPRIME - ! WRITE(1,'(A27,4D15.5)')'ALPHA,GAMMA,G, ZETA =',ALPHA,GAMMA,G,ZETA -!---------------------------------------------------------------------------------------------------------------------- -! These variables must be computed for each mode. -!---------------------------------------------------------------------------------------------------------------------- - XLOGSIGM(:) = LOG(SIGMAG(:)) ! [1] - SMAX = 0.0D+00 ! [1] - DO I=1, NMODEX - SM(I) = ( 2.0D+00/SQRT(BIBAR(I)) ) * ( A/(3.0D-06*RG(I)) )**1.5D+00 ! [1] - ETA(I) = DUM**3 / (TWOPI*DENH2O*GAMMA*XNAP(I)) ! [1] - !-------------------------------------------------------------------------------------------------------------- - ! WRITE(1,'(A27,I4,4D15.5)')'I,ETA(I),SM(I) =',I,ETA(I),SM(I) - !-------------------------------------------------------------------------------------------------------------- - F1 = 0.5D+00 * EXP(2.50D+00 * XLOGSIGM(I)**2) ! [1] - F2 = 1.0D+00 + 0.25D+00 * XLOGSIGM(I) ! [1] - SMAX = SMAX + ( F1*( ZETA / ETA(I) )**1.50D+00 - & + F2*(SM(I)**2/(ETA(I)+3.0D+00*ZETA))**0.75D+00 ) / SM(I)**2 ! [1] - Eq. (6) - ENDDO - SMAX = 1.0D+00 / SQRT(SMAX) ! [1] - DO I=1, NMODEX - AC(I) = RG(I) * ( SM(I) / SMAX )**0.66666666666666667D+00 ! [um] - U = LOG(AC(I)/RG(I)) / ( SQRT2 * XLOGSIGM(I) ) ! [1] - FRACACTN(I) = 0.5D+00 * (1.0D+00 - ERF(U)) ! [1] - FRACACTM(I) = 0.5D+00 * (1.0D+00 - ERF(U - THREESQRT2BY2*XLOGSIGM(I) ) ) ! [1] - NACT(I) = FRACACTN(I) * XNAP(I) ! [#/m^3] - MACT(I) = FRACACTM(I) * XMAP(I) ! [ug/m^3] -c CCN at 0.2 % - AC_2(I) = RG(I) * ( SM(I) / 0.002d+00 )**0.66666666666666667D+00 ! [um] - U = LOG(AC_2(I)/RG(I)) / ( SQRT2 * XLOGSIGM(I) ) ! [1] - FRACACTN_2(I) = 0.5D+00 * (1.0D+00 - ERF(U)) ! [1] - CCN(I,1) = FRACACTN_2(I) * XNAP(I) ! [#/m^3] -c CCN at 0.3 % - AC_3(I) = RG(I) * ( SM(I) / 0.003d+00 )**0.66666666666666667D+00 ! [um] - U = LOG(AC_3(I)/RG(I)) / ( SQRT2 * XLOGSIGM(I) ) ! [1] - FRACACTN_3(I) = 0.5D+00 * (1.0D+00 - ERF(U)) ! [1] - CCN(I,2) = FRACACTN_3(I) * XNAP(I) ! [#/m^3] -c CCN at 0.1 % - AC_5(I) = RG(I) * ( SM(I) / 0.001d+00 )**0.66666666666666667D+00 ! [um] - U = LOG(AC_5(I)/RG(I)) / ( SQRT2 * XLOGSIGM(I) ) ! [1] - FRACACTN_5(I) = 0.5D+00 * (1.0D+00 - ERF(U)) ! [1] - CCN(I,3) = FRACACTN_5(I) * XNAP(I) ! [#/m^3] - !-------------------------------------------------------------------------------------------------------------- - !IF(FRACACTN(I) .GT. 0.9999999D+00 ) THEN - ! WRITE(*,*)I,AC(I),U,FRACACTN(I),XNAP(I) - ! PRINT*,' SUSA',I,AC(I),U,FRACACTN(I) - ! PRINT*,' SUSACCN',CCN - ! STOP - ! ENDIF - !-------------------------------------------------------------------------------------------------------------- - ENDDO - - RETURN - END SUBROUTINE ACTFRAC_MAT - - - SUBROUTINE GCF(GAMMCF,A,X,GLN) - - IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!----------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: ITMAX=10000 - REAL(8), PARAMETER :: EPS=3.0D-07 - REAL(8), PARAMETER :: FPMIN=1.0D-30 - REAL(8) :: A,GAMMCF,GLN,X - INTEGER :: I - REAL(8) :: AN,B,C,D,DEL,H - GLN=GAMMLN(A) - B=X+1.0D+00-A - C=1.0D+00/FPMIN - D=1.0D+00/B - H=D - DO I=1,ITMAX - AN=-I*(I-A) - B=B+2.0D+00 - D=AN*D+B - IF(ABS(D).LT.FPMIN)D=FPMIN - C=B+AN/C - IF(ABS(C).LT.FPMIN)C=FPMIN - D=1.0D+00/D - DEL=D*C - H=H*DEL - IF(ABS(DEL-1.0D+00).LT.EPS)GOTO 1 - ENDDO - WRITE(*,*)'AERO_ACTV: SUBROUTINE GCF: A TOO LARGE, ITMAX TOO SMALL', GAMMCF,A,X,GLN -1 GAMMCF=EXP(-X+A*LOG(X)-GLN)*H - RETURN - END SUBROUTINE GCF - - - SUBROUTINE GSER(GAMSER,A,X,GLN) - - IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!----------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: ITMAX=10000 ! was ITMAX=100 in Press et al. - REAL(8), PARAMETER :: EPS=3.0D-09 ! was EPS=3.0D-07 in Press et al. - REAL(8) :: A,GAMSER,GLN,X - INTEGER :: N - REAL(8) :: AP,DEL,SUM - GLN=GAMMLN(A) - IF(X.LE.0.D+00)THEN - IF(X.LT.0.)STOP 'AERO_ACTV: SUBROUTINE GSER: X < 0 IN GSER' - GAMSER=0.D+00 - RETURN - ENDIF - AP=A - SUM=1.D+00/A - DEL=SUM - DO N=1,ITMAX - AP=AP+1.D+00 - DEL=DEL*X/AP - SUM=SUM+DEL - IF(ABS(DEL).LT.ABS(SUM)*EPS)GOTO 1 - ENDDO - WRITE(*,*)'AERO_ACTV: SUBROUTINE GSER: A TOO LARGE, ITMAX TOO SMALL' -1 GAMSER=SUM*EXP(-X+A*LOG(X)-GLN) - RETURN - END SUBROUTINE GSER - - - DOUBLE PRECISION FUNCTION GAMMLN(XX) - - IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!----------------------------------------------------------------------------------------------------------------------- - REAL(8) :: XX - INTEGER J - DOUBLE PRECISION SER,STP,TMP,X,Y,COF(6) - SAVE COF,STP - DATA COF,STP/76.18009172947146D0,-86.50532032941677D0, - &24.01409824083091D0,-1.231739572450155D0,.1208650973866179D-2, - &-.5395239384953D-5,2.5066282746310005D0/ - X=XX - Y=X - TMP=X+5.5D0 - TMP=(X+0.5D0)*LOG(TMP)-TMP - SER=1.000000000190015D0 - DO J=1,6 - Y=Y+1.D0 - SER=SER+COF(J)/Y - ENDDO - GAMMLN=TMP+LOG(STP*SER/X) - RETURN - END FUNCTION GAMMLN - - - DOUBLE PRECISION FUNCTION ERF(X) - IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!----------------------------------------------------------------------------------------------------------------------- - REAL(8) :: X -!U USES GAMMP - ERF = 0.d0 - IF(X.LT.0.0D+00)THEN - ERF=-GAMMP(0.5D0,X**2) - ELSE - ERF= GAMMP(0.5D0,X**2) - ENDIF - RETURN - END FUNCTION ERF - - - DOUBLE PRECISION FUNCTION GAMMP(A,X) - IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!----------------------------------------------------------------------------------------------------------------------- - REAL(8) :: A,X - REAL(8) :: GAMMCF,GAMSER,GLN - IF(X.LT.0.0D+00.OR.A.LE.0.0D+00)THEN - WRITE(*,*)'AERO_ACTV: FUNCTION GAMMP: BAD ARGUMENTS' - ENDIF - IF(X.LT.A+1.0D+00)THEN - CALL GSER(GAMSER,A,X,GLN) - GAMMP=GAMSER - ELSE - CALL GCF(GAMMCF,A,X,GLN) - GAMMP=1.0D+00-GAMMCF - ENDIF - RETURN - END FUNCTION GAMMP - - - END MODULE AERO_ACTV - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_coag.F b/MATRIXchem_GridComp/microphysics/TRAMP_coag.F deleted file mode 100644 index e117b3cd..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_coag.F +++ /dev/null @@ -1,1204 +0,0 @@ - MODULE AERO_COAG -!------------------------------------------------------------------------------------------------------------------------------------- -! -!@sum This module contains all routines for coagulation coefficients. -!@auth Susanne Bauer/Doug Wright -! -! The routines are included in this file in the following order. -! Only routine KBARNIJ is called after initialization is complete. -! -! SETUP_KIJ_DIAMETERS -! SETUP_KIJ -! SETUP_KIJ_TABLES -! BUILD_KIJ_TABLES -! GET_KNIJ -! GET_KBARNIJ -! BROWNIAN_COAG_COEF -! CBDE_COAG_COEF -! GRAVCOLL_COAG_COEF -! TURB_COAG_COEF -! TOTAL_COAG_COEF -! TEST_COAG_COEF -! -!------------------------------------------------------------------------------------------------------------------------------------- - USE AERO_PARAM, ONLY: AUNIT1, AUNIT2, WRITE_LOG, KIJ_NDGS_SET, DPMIN_GLOBAL - USE AERO_CONFIG, ONLY: NWEIGHTS - USE AERO_SETUP, ONLY: CITABLE - IMPLICIT NONE - - !------------------------------------------------------------------------------------------------------------------------------- - ! Constant coagulation coefficients for each mode-mode (I-J) interaction, - ! based upon characteristic sizes for each mode. - ! These are not mode-averaged and are no longer in use. - !------------------------------------------------------------------------------------------------------------------------------- - REAL(4), SAVE :: KIJ(NWEIGHTS,NWEIGHTS) ! [m^3/s] - - !------------------------------------------------------------------------------------------------------------------------------- - ! Mode-average coagulation coefficients for mode-mode (I-J) interactions. - !------------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: KIJ_NDGS = KIJ_NDGS_SET ! number of geo. mean diameters - INTEGER, PARAMETER :: KIJ_NSGS = 3 ! number of geo. std. deviations - REAL(4), PARAMETER :: KIJ_TEMP1 = 325.0 ! [K] - REAL(4), PARAMETER :: KIJ_TEMP2 = 260.0 ! [K] - must have T1 > T2 > T3 - REAL(4), PARAMETER :: KIJ_TEMP3 = 200.0 ! [K] - REAL(4), PARAMETER :: KIJ_PRES1 = 101325.0 ! [Pa] - REAL(4), PARAMETER :: KIJ_PRES2 = 10132.50 ! [Pa] - must have p1 > p2 > p3 - REAL(4), PARAMETER :: KIJ_PRES3 = 1013.250 ! [Pa] - REAL(4), PARAMETER :: KIJ_SIGM1 = 1.6 ! [1] - REAL(4), PARAMETER :: KIJ_SIGM2 = 1.8 ! [1] - REAL(4), PARAMETER :: KIJ_SIGM3 = 2.0 ! [1] - !------------------------------------------------------------------------------------------------------------------------------- - ! KIJ_DGMIN must be smaller than DPMIN_GLOBAL / Smax, where Smax = exp[1.5(ln Sigma_max)^2] where Sigma_max is the largest - ! lognormal geometric standard deviation occurring for any mode. Currently set for sigma_max = 2.0. - !------------------------------------------------------------------------------------------------------------------------------- - REAL(4), PARAMETER :: KIJ_DGMIN = 1.0D+06 * DPMIN_GLOBAL / 2.1D+00 ! [um] If any mode has Sigma>2.0, must modify. - REAL(4), PARAMETER :: KIJ_DGMAX = 100.0000 ! [um] - REAL(4), SAVE :: K0IJ_TEMP1PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP1PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP1PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP2PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP2PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP2PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP3PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP3PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K0IJ_TEMP3PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP1PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP1PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP1PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP2PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP2PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP2PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP3PRES1(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP3PRES2(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4), SAVE :: K3IJ_TEMP3PRES3(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - !----------------------------------------------------------------------------------------------------------------- - ! KIJ_DIAMETERS contains the values of Dg used in building the lookup tables. - ! KIJ_SIGMAS contains the values of Sigmag used in building the lookup tables. - ! INDEX_SIGG(I) is the index of KIJ_SIGMAS to obtain the Sigmag value for mode I. - !----------------------------------------------------------------------------------------------------------------- - REAL(4), SAVE :: KIJ_DIAMETERS(KIJ_NDGS) ! [um] - REAL(4), DIMENSION(KIJ_NSGS) :: KIJ_SIGMAS = (/ KIJ_SIGM1, KIJ_SIGM2, KIJ_SIGM3 /) ! [1] - INTEGER, SAVE :: INDEX_SIGG(NWEIGHTS) ! [1] - - CONTAINS - - - SUBROUTINE SETUP_KIJ_DIAMETERS -!----------------------------------------------------------------------------------------------------------------------- -! Routine to define the geometric mean diameters Dg of the lookup tables. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I - REAL(4) :: E, SCALE - E = 1.0 / REAL( KIJ_NDGS - 1 ) - SCALE = ( KIJ_DGMAX / KIJ_DGMIN )**E - DO I=1, KIJ_NDGS - KIJ_DIAMETERS(I) = KIJ_DGMIN * SCALE**(I-1) ! [um] - ! WRITE(*,'(I6,F16.6)') I, KIJ_DIAMETERS(I) - ENDDO - RETURN - END SUBROUTINE SETUP_KIJ_DIAMETERS - - - SUBROUTINE SETUP_KIJ -!----------------------------------------------------------------------------------------------------------------------- -! Routine to setup the KIJ array of coagulation coefficients [m^3/s]. -! These are not currently used. -! -! The KIJ(NWEIGHTS,NWEIGHTS) are constant coagulation coefficients -! for each mode-mode interaction, based upon characteristic sizes -! for each mode. A uniform and constant temperature and pressure are used. -!----------------------------------------------------------------------------------------------------------------------- - USE AERO_SETUP, ONLY: DP0 ! [m] default value of diameter of average mass - IMPLICIT NONE ! for the assumed lognormal for each mode - INTEGER :: I, J - REAL(4) :: DPI, DPJ ! [um] - REAL(4) :: BETAIJ ! [m^3/s] - REAL(4), PARAMETER :: SET_TEMP = 288.15 ! [K] - REAL(4), PARAMETER :: SET_PRES = 101325.0 ! {Pa] - - BETAIJ = 0.0 - IF( WRITE_LOG ) WRITE(AUNIT1,'(/5A17/)') 'I','J','DPI[um]','DPJ[um]','KIJ(I,J)[m^3/s]' - DO I=1, NWEIGHTS - DO J=1, NWEIGHTS - DPI = DP0(I)*1.0E+06 - DPJ = DP0(J)*1.0E+06 -! CALL BROWNIAN_COAG_COEF( DPI, DPJ, SET_TEMP, SET_PRES, BETAIJ ) - CALL TOTAL_COAG_COEF ( DPI, DPJ, SET_TEMP, SET_PRES, BETAIJ ) - KIJ(I,J) = BETAIJ - KIJ(J,I) = KIJ(I,J) - ! IF( WRITE_LOG ) WRITE(AUNIT1,90000) I, J, DPI, DPJ, KIJ(I,J) - ENDDO - ENDDO - -90000 FORMAT(2I17,2F17.6,D17.5) - RETURN - END SUBROUTINE SETUP_KIJ - - - SUBROUTINE SETUP_KIJ_TABLES -!----------------------------------------------------------------------------------------------------------------------- -! Routine to setup tables of mode-average coagulation coefficients [m^3/s]. -! Several temperatures and pressures are currently used. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I - REAL(4) :: K0IJ_TABLE(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4) :: K3IJ_TABLE(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - - !------------------------------------------------------------------------- - ! Build the table for each choice of temperature and pressure. - !------------------------------------------------------------------------- - CALL BUILD_KIJ_TABLES(KIJ_TEMP1,KIJ_PRES1,K0IJ_TABLE,K3IJ_TABLE) ! T1, p1 - K0IJ_TEMP1PRES1(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP1PRES1(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP1,KIJ_PRES2,K0IJ_TABLE,K3IJ_TABLE) ! T1, p2 - K0IJ_TEMP1PRES2(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP1PRES2(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP1,KIJ_PRES3,K0IJ_TABLE,K3IJ_TABLE) ! T1, p3 - K0IJ_TEMP1PRES3(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP1PRES3(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP2,KIJ_PRES1,K0IJ_TABLE,K3IJ_TABLE) ! T2, p1 - K0IJ_TEMP2PRES1(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP2PRES1(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP2,KIJ_PRES2,K0IJ_TABLE,K3IJ_TABLE) ! T2, p2 - K0IJ_TEMP2PRES2(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP2PRES2(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP2,KIJ_PRES3,K0IJ_TABLE,K3IJ_TABLE) ! T2, p3 - K0IJ_TEMP2PRES3(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP2PRES3(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP3,KIJ_PRES1,K0IJ_TABLE,K3IJ_TABLE) ! T3, p1 - K0IJ_TEMP3PRES1(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP3PRES1(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP3,KIJ_PRES2,K0IJ_TABLE,K3IJ_TABLE) ! T3, p2 - K0IJ_TEMP3PRES2(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP3PRES2(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - CALL BUILD_KIJ_TABLES(KIJ_TEMP3,KIJ_PRES3,K0IJ_TABLE,K3IJ_TABLE) ! T3, p3 - K0IJ_TEMP3PRES3(:,:,:,:) = K0IJ_TABLE(:,:,:,:) ! [m^3/s] - K3IJ_TEMP3PRES3(:,:,:,:) = K3IJ_TABLE(:,:,:,:) ! [m^3/s] - - RETURN - END SUBROUTINE SETUP_KIJ_TABLES - - - SUBROUTINE BUILD_KIJ_TABLES( TEMP, PRES, K0IJ_TABLE, K3IJ_TABLE ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to setup a table of mode-average coagulation coefficients [m^3/s] -! for a given temperature and pressure. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I, J, K, L - REAL(4) :: TEMP ! [K] - REAL(4) :: PRES ! [Pa] - REAL(4) :: K0IJ_TABLE(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4) :: K3IJ_TABLE(KIJ_NDGS,KIJ_NSGS,KIJ_NDGS,KIJ_NSGS) ! [m^3/s] - REAL(4) :: K0IJ, K3IJ ! [m^3/s] - - DO I=1, KIJ_NDGS - DO J=1, KIJ_NDGS - DO K=1, KIJ_NSGS - DO L=1, KIJ_NSGS - CALL GET_KNIJ(TEMP,PRES,KIJ_DIAMETERS(I),KIJ_SIGMAS(K),KIJ_DIAMETERS(J),KIJ_SIGMAS(L),K0IJ,K3IJ) - K0IJ_TABLE(I,K,J,L) = K0IJ ! [m^3/s] - K3IJ_TABLE(I,K,J,L) = K3IJ ! [m^3/s] - ENDDO - ENDDO - ENDDO - ENDDO - - RETURN - END SUBROUTINE BUILD_KIJ_TABLES - - - SUBROUTINE GET_KNIJ( TEMP, PRES, DGI, SIGGI, DGJ, SIGGJ, K0IJ, K3IJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the mode-average coagulation coefficients -! K0IJ and K3IJ [m^3/s] for the coagulation of mode I, having lognormal -! parameters DGI and SIGGI, with mode J, having lognormal parameters -! DGJ and SIGGJ, at a given temperature and pressure. -! -! The integrals necessary to evaluate the mode-average coagulation -! coefficients are evaluated using n-point quadrature from 2n moments -! calculated from the lognormal parameters for each mode. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(4) :: TEMP ! [K] ambient temperature - REAL(4) :: PRES ! [Pa] ambient pressure - REAL(4) :: DGI, DGJ ! [um] geometric mean diameters - REAL(4) :: SIGGI, SIGGJ ! [1] geometric standard deviations - REAL(4) :: K0IJ, K3IJ ! [m^3/s] mode-average coagulation coefficients - - ! Local variables. - - INTEGER, PARAMETER :: NPOINTS = 4 ! number of quadrature points for each mode - - INTEGER :: I, J, K, L ! loop indices - REAL(8) :: SGI, SGJ ! [1] function of geometric standard deviation - REAL(8) :: UKI(2*NPOINTS) ! [um^k] normalized moments for mode I - REAL(8) :: UKJ(2*NPOINTS) ! [um^k] normalized moments for mode J - REAL(8) :: XI(NPOINTS), XJ(NPOINTS) ! [um] quadrature abscissas for modes I and J - REAL(8) :: WI(NPOINTS), WJ(NPOINTS) ! [1] normalized quadrature weights for modes I and J - REAL(8) :: ZFI, ZFJ ! [1] flags for failed quadrature inversion - REAL(8) :: K0IJ_TMP, K3IJ_TMP ! [m^3/s] double precision accumulators for K0IJ and K3IJ - REAL(4) :: DI, DJ ! [um] single precision particle diameters for modes I and J - REAL(4) :: BETAIJ ! [m^3/s] single precision coagulation coefficient - - SGI = EXP( 0.5D+00 * ( LOG( DBLE(SIGGI) )**2 ) ) - SGJ = EXP( 0.5D+00 * ( LOG( DBLE(SIGGJ) )**2 ) ) - !------------------------------------------------------------------------- - ! WRITE(*,*) 'DGI,SIGGI,SGI,DGJ,SIGGJ,SGJ' - ! WRITE(*,'(6F13.8)') DGI,SIGGI,SGI,DGJ,SIGGJ,SGJ - !------------------------------------------------------------------------- - - !------------------------------------------------------------------------- - ! Compute the first 2*NPOINTS diameter moments for each lognormal mode. - !------------------------------------------------------------------------- - DO L=1, 2*NPOINTS - K = L-1 - UKI(L) = DBLE(DGI)**K * SGI**(K*K) - UKJ(L) = DBLE(DGJ)**K * SGJ**(K*K) - !----------------------------------------------------------------------- - ! WRITE(*,'(I6,2D15.5)') K, UKI(L), UKJ(L) - !----------------------------------------------------------------------- - ENDDO - - !------------------------------------------------------------------------- - ! Get the quadrature abscissas and weights for modes I and J. - !------------------------------------------------------------------------- - CALL GAUSS(NPOINTS,UKI,XI,WI,ZFI) - IF( ZFI .GT. 1.0D-15 ) THEN - WRITE(*,*)'Failed quadrature for mode I in subr. GET_KNIJ' - WRITE(*,*)'ABSCISSAS = ', XI(:) - WRITE(*,*)'WEIGHTS = ', WI(:) - STOP - ENDIF - CALL GAUSS(NPOINTS,UKJ,XJ,WJ,ZFJ) - IF( ZFJ .GT. 1.0D-15 ) THEN - WRITE(*,*)'Failed quadrature for mode J in subr. GET_KNIJ' - WRITE(*,*)'ABSCISSAS = ', XJ(:) - WRITE(*,*)'WEIGHTS = ', WJ(:) - STOP - ENDIF - - !------------------------------------------------------------------------- - ! Write the abscissas and weights for modes I and J. - !------------------------------------------------------------------------- - ! DO L=1, NPOINTS - ! WRITE(*,'(I6,4D15.5)') L, XI(L), WI(L), XJ(L), WJ(L) - ! ENDDO - !------------------------------------------------------------------------- - - K0IJ_TMP = 0.0D+00 - K3IJ_TMP = 0.0D+00 - - DO I=1, NPOINTS - DO J=1, NPOINTS - DI = REAL(XI(I)) ! convert to single precision - DJ = REAL(XJ(J)) ! convert to single precision -! CALL BROWNIAN_COAG_COEF( DI, DJ, TEMP, PRES, BETAIJ ) ! all variables single precision - CALL TOTAL_COAG_COEF ( DI, DJ, TEMP, PRES, BETAIJ ) ! all variables single precision - K0IJ_TMP = K0IJ_TMP + DBLE(BETAIJ)*WI(I)*WJ(J) ! all factors are REAL(8) - K3IJ_TMP = K3IJ_TMP + DBLE(BETAIJ)*WI(I)*WJ(J)*XI(I)**3 ! all factors are REAL(8) - ENDDO - ENDDO - - K0IJ = REAL(K0IJ_TMP) ! divide by U0i*U0j= 1.0*1.0 - K3IJ = REAL(K3IJ_TMP/UKI(4)) ! divide by U3i*U0j=UKI(4)*1.0 - -!------------------------------------------------------------------------------- -! WRITE(AUNIT2,'(A,4F9.4,2E13.5)') 'DGI, SIGGI, DGJ, SIGGJ, K0IJ, K3IJ = ', -! & DGI, SIGGI, DGJ, SIGGJ, K0IJ, K3IJ -!------------------------------------------------------------------------------- - - RETURN - END SUBROUTINE GET_KNIJ - - - SUBROUTINE GET_KBARNIJ( IUPDATE, TK, PRES, DIAM, KBAR0IJ, KBAR3IJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to setup tables of mode-average coagulation coefficients -! KBAR0IJ and KBAR3IJ [m^3/s] for arbitrary temperature and pressure. -! Modes are assumed to be lognormal, and Sigmag values are set to -! constants for each mode, and Dg values are derived from the current -! value of the diameter of average mass for each mode, before being passed -! to this routine. -!------------------------------------------------------------------------------------------------------------------------------------- - USE AERO_SETUP, ONLY: SIG0 ! [um], [1], default lognormal parameters - IMPLICIT NONE ! for each mode - - ! Arguments. - - INTEGER :: IUPDATE ! [1] control flag - REAL(8) :: TK ! [K] ambient temperature - REAL(8) :: PRES ! [Pa] ambient pressure - REAL(8) :: DIAM(NWEIGHTS) ! [um] geo. mean diameter for each mode - REAL(8) :: KBAR0IJ(NWEIGHTS,NWEIGHTS) ! [m^3/s] 0th mode-average coag. coef. - REAL(8) :: KBAR3IJ(NWEIGHTS,NWEIGHTS) ! [m^3/s] 3th mode-average coag. coef. - - ! Local variables. - - INTEGER :: INDEX_DIAMI, INDEX_DIAMJ, INDEX_DIAMIP1, INDEX_DIAMJP1 - INTEGER :: I, J, ITRANGE, IPRANGE - !------------------------------------------------------------------------------------------------------------ - ! INDEX_SIGG(I) is the index of KIJ_SIGMAS to obtain Sigmag for mode I. - !------------------------------------------------------------------------------------------------------------ - INTEGER, SAVE :: INDEX_SIGG(NWEIGHTS) ! [1] - REAL(4), SAVE :: DELTALNDG ! [1] table spacing in ln(Dg) - REAL(4) :: KBAR0IJ_LL, KBAR0IJ_LU, KBAR0IJ_UL, KBAR0IJ_UU ! [m^3/s] for bilinear interpolation - REAL(4) :: KBAR3IJ_LL, KBAR3IJ_LU, KBAR3IJ_UL, KBAR3IJ_UU ! [m^3/s] for bilinear interpolation - REAL(4) :: XINTERPI, XINTERPJ, XINTERPT, XINTERPP ! [1] for bilinear interpolation - REAL(4) :: TMP0, TMP3 ! [m^3/s] scratch variables - REAL(4) :: TPINTERP_LL, TPINTERP_LU, TPINTERP_UL, TPINTERP_UU ! [1] scratch variables - REAL(4) :: TUSE ! [K] ambient temperature local variable - REAL(4) :: PUSE ! [Pa] ambient pressure local variable - REAL(4) :: KBAR0IJ_LL_LL, KBAR0IJ_LU_LL, KBAR0IJ_UL_LL, KBAR0IJ_UU_LL ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR3IJ_LL_LL, KBAR3IJ_LU_LL, KBAR3IJ_UL_LL, KBAR3IJ_UU_LL ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR0IJ_LL_LU, KBAR0IJ_LU_LU, KBAR0IJ_UL_LU, KBAR0IJ_UU_LU ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR3IJ_LL_LU, KBAR3IJ_LU_LU, KBAR3IJ_UL_LU, KBAR3IJ_UU_LU ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR0IJ_LL_UL, KBAR0IJ_LU_UL, KBAR0IJ_UL_UL, KBAR0IJ_UU_UL ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR3IJ_LL_UL, KBAR3IJ_LU_UL, KBAR3IJ_UL_UL, KBAR3IJ_UU_UL ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR0IJ_LL_UU, KBAR0IJ_LU_UU, KBAR0IJ_UL_UU, KBAR0IJ_UU_UU ! [m^3/s] for bilinear interp. - REAL(4) :: KBAR3IJ_LL_UU, KBAR3IJ_LU_UU, KBAR3IJ_UL_UU, KBAR3IJ_UU_UU ! [m^3/s] for bilinear interp. - LOGICAL, SAVE :: FIRSTIME = .TRUE. - LOGICAL :: FLAG - - integer :: arrindex_diam(NWEIGHTS) - real(4) :: arrxinterp(NWEIGHTS) - - IF( FIRSTIME ) THEN - FIRSTIME = .FALSE. - !------------------------------------------------------------------------------------------------------------ - ! DELTALNG is the table spacing in ln(Dg) and needed for interpolation. - !------------------------------------------------------------------------------------------------------------ - DELTALNDG = LOG( KIJ_DGMAX / KIJ_DGMIN ) / REAL( KIJ_NDGS - 1 ) ! to interpolate in Dg - !------------------------------------------------------------------------------------------------------------ - ! To efficiently identify the Sigmag value assigned to each mode. - !------------------------------------------------------------------------------------------------------------ - INDEX_SIGG(:) = 1 - DO I=1, NWEIGHTS - DO J=1, KIJ_NSGS - IF( ABS( SIG0(I) - DBLE( KIJ_SIGMAS(J) ) ) .LT. 1.0D-03 ) INDEX_SIGG(I) = J - ENDDO - ! WRITE(AUNIT2,'(I6,F12.6,I6,F12.6)') I, SIG0(I), INDEX_SIGG(I), DIAM(I) - ENDDO - ENDIF - - !-------------------------------------------------------------------------------------------------------------- - ! Temporary code to check the new value of KIJ_DGMIN. - !-------------------------------------------------------------------------------------------------------------- - ! IF( MINVAL( DIAM(:) ) .LT. KIJ_DGMIN ) THEN - ! WRITE(*,*)'MINVAL( DIAM(:) ) .LT. KIJ_DGMIN in subr. GET_KBARNIJ. :', MINVAL( DIAM(:) ) - ! STOP - ! ENDIF - !-------------------------------------------------------------------------------------------------------------- - - ! precompute common elements - DO I=1, NWEIGHTS - !---------------------------------------------------------------------------------------------------------- - ! For mode I, get the lower and upper bounding table diameters and the interpolation variable XINTERPI. - !---------------------------------------------------------------------------------------------------------- - INDEX_DIAMI = ( log( DIAM(I) / KIJ_DGMIN ) / DELTALNDG ) + 1 - INDEX_DIAMI = MIN( MAX( INDEX_DIAMI, 1 ), KIJ_NDGS-1 ) - arrindex_diam(I) = INDEX_DIAMI - - XINTERPI = log( DIAM(I) / KIJ_DIAMETERS(INDEX_DIAMI) ) / DELTALNDG - arrxinterp(I) = XINTERPI - END DO - !-------------------------------------------------------------------------------------------------------------- - ! IUPDATE .EQ. 0: The mode-average coagulation coefficients are held constant throughout the simulation. - !-------------------------------------------------------------------------------------------------------------- - IF( IUPDATE .EQ. 0 ) THEN - FLAG = .FALSE. - DO I=1, NWEIGHTS - !---------------------------------------------------------------------------------------------------------- - ! For mode I, get the lower and upper bounding table diameters and the interpolation variable XINTERPI. - !---------------------------------------------------------------------------------------------------------- - INDEX_DIAMI = arrindex_diam(I) - INDEX_DIAMIP1 = INDEX_DIAMI+1 - IF(DIAM(I) .LT. KIJ_DIAMETERS(INDEX_DIAMI )) FLAG = .TRUE. - IF(DIAM(I) .GT. KIJ_DIAMETERS(INDEX_DIAMIP1)) FLAG = .TRUE. - - IF( FLAG ) THEN - WRITE(*,*)'Problem in GET_KBARNIJ for IUPDATE = 0' - WRITE(*,'(2I6,8F11.5)')I,KIJ_DIAMETERS(INDEX_DIAMI),DIAM(I),KIJ_DIAMETERS(INDEX_DIAMIP1) - STOP - ENDIF -!-------------------------------------------------------------------------------------------------------------------- -! The lower and upper table diameters bounding DIAM(I)), and the interpolation variables -! XINTERPI were checked and found correct. -!-------------------------------------------------------------------------------------------------------------------- -! WRITE(AUNIT2,'(2I6,8F11.5)')I,KIJ_DIAMETERS(INDEX_DIAMI),DIAM(I),KIJ_DIAMETERS(INDEX_DIAMIP1),XINTERPI -!-------------------------------------------------------------------------------------------------------------------- - END DO - - DO I=1, NWEIGHTS - !---------------------------------------------------------------------------------------------------------- - ! For mode I, get the lower and upper bounding table diameters and the interpolation variable XINTERPI. - !---------------------------------------------------------------------------------------------------------- - INDEX_DIAMI = arrindex_diam(I) - INDEX_DIAMIP1 = INDEX_DIAMI+1 - XINTERPI = arrxinterp(I) - - DO J=1, NWEIGHTS - !-------------------------------------------------------------------------------------------------------- - ! For mode J, get the lower and upper bounding table diameters and the interpolation variable XINTERPJ. - !-------------------------------------------------------------------------------------------------------- - INDEX_DIAMJ = arrindex_diam(J) - INDEX_DIAMJP1 = INDEX_DIAMJ+1 - XINTERPJ = arrxinterp(J) - !-------------------------------------------------------------------------------------------------------- - ! For each of the four points needed for bilinear interpolation, get the mode-average coagulation - ! coefficients at the selected temperature and pressure. - !-------------------------------------------------------------------------------------------------------- - KBAR0IJ_LL = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - !-------------------------------------------------------------------------------------------------------- - ! Interpolate in Dg(I) and Dg(J) for modes I and J. - ! - ! When DIAM(I) = KIJ_DIAMETERS(INDEX_DIAMI), the lower I-mode Dg value, XINTERPI = 0.0, so - ! KBAR0IJ_LL and KBAR0IJ_LU should be multiplied by (1.0 - XINTERPI ) = 1.0. - !-------------------------------------------------------------------------------------------------------- - TMP0 = KBAR0IJ_LL*(1.0-XINTERPI)*(1.0-XINTERPJ) - & + KBAR0IJ_LU*(1.0-XINTERPI)*( XINTERPJ) - & + KBAR0IJ_UL*( XINTERPI)*(1.0-XINTERPJ) - & + KBAR0IJ_UU*( XINTERPI)*( XINTERPJ) - TMP3 = KBAR3IJ_LL*(1.0-XINTERPI)*(1.0-XINTERPJ) - & + KBAR3IJ_LU*(1.0-XINTERPI)*( XINTERPJ) - & + KBAR3IJ_UL*( XINTERPI)*(1.0-XINTERPJ) - & + KBAR3IJ_UU*( XINTERPI)*( XINTERPJ) - KBAR0IJ(I,J) = DBLE( TMP0 ) - KBAR3IJ(I,J) = DBLE( TMP3 ) - !-------------------------------------------------------------------------------------------------------- - ! For narrow distributions, KBAR0IJ and KBAR3IJ should be nearly equal, and were found to be so - ! with Sigmag = 1.1 for all modes. - !-------------------------------------------------------------------------------------------------------- - ! WRITE(AUNIT2,'(2I6,2E15.5)')I,J,KBAR0IJ(I,J),KBAR3IJ(I,J) - !-------------------------------------------------------------------------------------------------------- - ENDDO - ENDDO - !-------------------------------------------------------------------------------------------------------------- - ! IUPDATE .EQ. 1: The mode-average coagulation coefficients are updated at each time step. - !-------------------------------------------------------------------------------------------------------------- - ELSEIF( IUPDATE .EQ. 1 ) THEN - TUSE = MIN( MAX( REAL(TK), KIJ_TEMP3 ), KIJ_TEMP1 ) ! Tmin=KIJ_TEMP3, Tmax=KIJ_TEMP1 - PUSE = MIN( MAX( REAL(PRES), KIJ_PRES3 ), KIJ_PRES1 ) ! pmin=KIJ_PRES3, pmax=KIJ_PRES1 - IF( TUSE .GT. KIJ_TEMP2 ) THEN ! Tmiddle value=KIJ_TEMP2 - ITRANGE = 12 ! use temperatures 1 and 2 - XINTERPT = ( TUSE - KIJ_TEMP2 ) / ( KIJ_TEMP1 - KIJ_TEMP2 ) - ELSE - ITRANGE = 23 ! use temperatures 2 and 3 - XINTERPT = ( TUSE - KIJ_TEMP3 ) / ( KIJ_TEMP2 - KIJ_TEMP3 ) - ENDIF - IF( PUSE .GT. KIJ_PRES2 ) THEN ! pmiddle value=KIJ_PRES2 - IPRANGE = 12 ! use pressures 1 and 2 - XINTERPP = ( PUSE - KIJ_PRES2 ) / ( KIJ_PRES1 - KIJ_PRES2 ) - ELSE - IPRANGE = 23 ! use pressures 2 and 3 - XINTERPP = ( PUSE - KIJ_PRES3 ) / ( KIJ_PRES2 - KIJ_PRES3 ) - ENDIF - TPINTERP_LL = (1.0-XINTERPT)*(1.0-XINTERPP) ! all weight at T_lower, p_lower - TPINTERP_LU = (1.0-XINTERPT)*( XINTERPP) ! all weight at T_lower, p_upper - TPINTERP_UL = ( XINTERPT)*(1.0-XINTERPP) ! all weight at T_upper, p_lower - TPINTERP_UU = 1.0-TPINTERP_LL-TPINTERP_LU-TPINTERP_UL ! all weight at T_upper, p_upper -!-------------------------------------------------------------------------------------------------------------------- -! WRITE(AUNIT2,'(/A/)')'new step' -! WRITE(AUNIT2,'(A40,2F15.6 )')'TUSE, PUSE = ', TUSE, PUSE -! WRITE(AUNIT2,'(A40,2I4,2F13.7)')'ITRANGE, IPRANGE, XINTERPT, XINTERPP = ', -! & ITRANGE, IPRANGE, XINTERPT, XINTERPP -! WRITE(AUNIT2,'(A40,4F12.6 )')'TPINTERP_LL, TPINTERP_LU, TPINTERP_UL, TPINTERP_UU = ', -! & TPINTERP_LL, TPINTERP_LU, TPINTERP_UL, TPINTERP_UU -!-------------------------------------------------------------------------------------------------------------------- - DO I=1, NWEIGHTS - !---------------------------------------------------------------------------------------------------------- - ! For mode I, get the lower and upper bounding table diameters and the interpolation variable XINTERPI. - !---------------------------------------------------------------------------------------------------------- - INDEX_DIAMI = arrindex_diam(I) - INDEX_DIAMIP1 = INDEX_DIAMI+1 - XINTERPI = arrxinterp(I) - DO J=1, NWEIGHTS - - if (CITABLE(I,J) == 'OFF') then ! Turn off coagulation between selected modes. - KBAR0IJ(I,J) = 1.0D-30 - KBAR3IJ(I,J) = 1.0D-30 - cycle - end if - - !-------------------------------------------------------------------------------------------------------- - ! For mode J, get the lower and upper bounding table diameters and the interpolation variable XINTERPJ. - !-------------------------------------------------------------------------------------------------------- - INDEX_DIAMJ = arrindex_diam(J) - INDEX_DIAMJP1 = INDEX_DIAMJ+1 - XINTERPJ = arrxinterp(J) - !-------------------------------------------------------------------------------------------------------- - ! For each of the four points needed for bilinear interpolation in Dg(I) and Dg(J), get the - ! mode-average coagulation coefficients at each of the four temperature-pressure points. - ! - ! In KBAR0IJ_AB_CD, A indicates the upper or lower value of Dg(I) - ! B indicates the upper or lower value of Dg(J) - ! C indicates the upper or lower value of temperature: T1 > T2 > T3 - ! D indicates the upper or lower value of pressure: p1 > p2 > p3 - !-------------------------------------------------------------------------------------------------------- - IF( ITRANGE .EQ. 12 .AND. IPRANGE .EQ. 12 ) THEN - - KBAR0IJ_LL_LL = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LL = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LL = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LL = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LL = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LL = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LL = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LL = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_LU = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LU = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LU = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LU = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LU = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LU = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LU = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LU = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UL = K0IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UL = K0IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UL = K0IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UL = K0IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UL = K3IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UL = K3IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UL = K3IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UL = K3IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UU = K0IJ_TEMP1PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UU = K0IJ_TEMP1PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UU = K0IJ_TEMP1PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UU = K0IJ_TEMP1PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UU = K3IJ_TEMP1PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UU = K3IJ_TEMP1PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UU = K3IJ_TEMP1PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UU = K3IJ_TEMP1PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - ELSEIF( ITRANGE .EQ. 12 .AND. IPRANGE .EQ. 23 ) THEN - - KBAR0IJ_LL_LL = K0IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LL = K0IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LL = K0IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LL = K0IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LL = K3IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LL = K3IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LL = K3IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LL = K3IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_LU = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LU = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LU = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LU = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LU = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LU = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LU = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LU = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UL = K0IJ_TEMP1PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UL = K0IJ_TEMP1PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UL = K0IJ_TEMP1PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UL = K0IJ_TEMP1PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UL = K3IJ_TEMP1PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UL = K3IJ_TEMP1PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UL = K3IJ_TEMP1PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UL = K3IJ_TEMP1PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UU = K0IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UU = K0IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UU = K0IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UU = K0IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UU = K3IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UU = K3IJ_TEMP1PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UU = K3IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UU = K3IJ_TEMP1PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - ELSEIF( ITRANGE .EQ. 23 .AND. IPRANGE .EQ. 12 ) THEN - - KBAR0IJ_LL_LL = K0IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LL = K0IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LL = K0IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LL = K0IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LL = K3IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LL = K3IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LL = K3IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LL = K3IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_LU = K0IJ_TEMP3PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LU = K0IJ_TEMP3PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LU = K0IJ_TEMP3PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LU = K0IJ_TEMP3PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LU = K3IJ_TEMP3PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LU = K3IJ_TEMP3PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LU = K3IJ_TEMP3PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LU = K3IJ_TEMP3PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UL = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UL = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UL = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UL = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UL = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UL = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UL = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UL = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UU = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UU = K0IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UU = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UU = K0IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UU = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UU = K3IJ_TEMP2PRES1( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UU = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UU = K3IJ_TEMP2PRES1( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - ELSEIF( ITRANGE .EQ. 23 .AND. IPRANGE .EQ. 23 ) THEN - - KBAR0IJ_LL_LL = K0IJ_TEMP3PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LL = K0IJ_TEMP3PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LL = K0IJ_TEMP3PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LL = K0IJ_TEMP3PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LL = K3IJ_TEMP3PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LL = K3IJ_TEMP3PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LL = K3IJ_TEMP3PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LL = K3IJ_TEMP3PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_LU = K0IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_LU = K0IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_LU = K0IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_LU = K0IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_LU = K3IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_LU = K3IJ_TEMP3PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_LU = K3IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_LU = K3IJ_TEMP3PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UL = K0IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UL = K0IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UL = K0IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UL = K0IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UL = K3IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UL = K3IJ_TEMP2PRES3( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UL = K3IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UL = K3IJ_TEMP2PRES3( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - KBAR0IJ_LL_UU = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_LU_UU = K0IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR0IJ_UL_UU = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR0IJ_UU_UU = K0IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_LL_UU = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_LU_UU = K3IJ_TEMP2PRES2( INDEX_DIAMI, INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - KBAR3IJ_UL_UU = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJ, INDEX_SIGG(J) ) - KBAR3IJ_UU_UU = K3IJ_TEMP2PRES2( INDEX_DIAMIP1,INDEX_SIGG(I),INDEX_DIAMJP1,INDEX_SIGG(J) ) - - ELSE - - WRITE(*,*)'Error in GET_KBARNIJ: ITRANGE, IPRANGE = ', ITRANGE, IPRANGE - STOP - - ENDIF - !-------------------------------------------------------------------------------------------------------- - ! Interpolate in T and p for each of the four points needed for the Dg(I) and Dg(J) interpolation. - !-------------------------------------------------------------------------------------------------------- - KBAR0IJ_LL = TPINTERP_LL*KBAR0IJ_LL_LL + TPINTERP_LU*KBAR0IJ_LL_LU - & + TPINTERP_UL*KBAR0IJ_LL_UL + TPINTERP_UU*KBAR0IJ_LL_UU - KBAR0IJ_LU = TPINTERP_LL*KBAR0IJ_LU_LL + TPINTERP_LU*KBAR0IJ_LU_LU - & + TPINTERP_UL*KBAR0IJ_LU_UL + TPINTERP_UU*KBAR0IJ_LU_UU - KBAR0IJ_UL = TPINTERP_LL*KBAR0IJ_UL_LL + TPINTERP_LU*KBAR0IJ_UL_LU - & + TPINTERP_UL*KBAR0IJ_UL_UL + TPINTERP_UU*KBAR0IJ_UL_UU - KBAR0IJ_UU = TPINTERP_LL*KBAR0IJ_UU_LL + TPINTERP_LU*KBAR0IJ_UU_LU - & + TPINTERP_UL*KBAR0IJ_UU_UL + TPINTERP_UU*KBAR0IJ_UU_UU - - KBAR3IJ_LL = TPINTERP_LL*KBAR3IJ_LL_LL + TPINTERP_LU*KBAR3IJ_LL_LU - & + TPINTERP_UL*KBAR3IJ_LL_UL + TPINTERP_UU*KBAR3IJ_LL_UU - KBAR3IJ_LU = TPINTERP_LL*KBAR3IJ_LU_LL + TPINTERP_LU*KBAR3IJ_LU_LU - & + TPINTERP_UL*KBAR3IJ_LU_UL + TPINTERP_UU*KBAR3IJ_LU_UU - KBAR3IJ_UL = TPINTERP_LL*KBAR3IJ_UL_LL + TPINTERP_LU*KBAR3IJ_UL_LU - & + TPINTERP_UL*KBAR3IJ_UL_UL + TPINTERP_UU*KBAR3IJ_UL_UU - KBAR3IJ_UU = TPINTERP_LL*KBAR3IJ_UU_LL + TPINTERP_LU*KBAR3IJ_UU_LU - & + TPINTERP_UL*KBAR3IJ_UU_UL + TPINTERP_UU*KBAR3IJ_UU_UU -!-------------------------------------------------------------------------------------------------------------------- -! WRITE(AUNIT2,'(A40,4E13.5)')'KBAR0IJ_LL, KBAR0IJ_LU, KBAR0IJ_UL, KBAR0IJ_UU = ', -! & KBAR0IJ_LL, KBAR0IJ_LU, KBAR0IJ_UL, KBAR0IJ_UU -! WRITE(AUNIT2,'(A40,4E13.5)')'KBAR3IJ_LL, KBAR3IJ_LU, KBAR3IJ_UL, KBAR3IJ_UU = ', -! & KBAR3IJ_LL, KBAR3IJ_LU, KBAR3IJ_UL, KBAR3IJ_UU -!-------------------------------------------------------------------------------------------------------------------- - ! Interpolate in Dg(I) and Dg(J) for modes I and J. - !-------------------------------------------------------------------------------------------------------- - TMP0 = KBAR0IJ_LL*(1.0-XINTERPI)*(1.0-XINTERPJ) - & + KBAR0IJ_LU*(1.0-XINTERPI)*( XINTERPJ) - & + KBAR0IJ_UL*( XINTERPI)*(1.0-XINTERPJ) - & + KBAR0IJ_UU*( XINTERPI)*( XINTERPJ) - TMP3 = KBAR3IJ_LL*(1.0-XINTERPI)*(1.0-XINTERPJ) - & + KBAR3IJ_LU*(1.0-XINTERPI)*( XINTERPJ) - & + KBAR3IJ_UL*( XINTERPI)*(1.0-XINTERPJ) - & + KBAR3IJ_UU*( XINTERPI)*( XINTERPJ) - KBAR0IJ(I,J) = DBLE( TMP0 ) - KBAR3IJ(I,J) = DBLE( TMP3 ) - !-------------------------------------------------------------------------------------------------------- - ! For narrow distributions, KBAR0IJ and KBAR3IJ should be nearly equal, and were found to be so - ! with Sigmag = 1.1 for all modes. - !-------------------------------------------------------------------------------------------------------- - ! WRITE(AUNIT2,'(A40,2I6,4E15.5)')'I,J,KBAR0IJ,KBAR3IJ=',I,J,KBAR0IJ(I,J),KBAR3IJ(I,J) - !-------------------------------------------------------------------------------------------------------- - ENDDO - ENDDO - ENDIF - - RETURN - END SUBROUTINE GET_KBARNIJ - - - SUBROUTINE BROWNIAN_COAG_COEF( DI, DJ, TEMPK, PRES, BETAIJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the Brownian coagulation coefficient BETAIJ -! for particles of diameters DI and DJ at ambient temperature TEMPK -! and pressure PRES, using the interpolation formula of Fuchs (1964), -! as given in Jacobson 1999, p.446, eq.(16.28) -! or Jacobson 2005, p.509, eq.(15.33). -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - REAL(4) :: DI, DJ ! particle diameters [um] - REAL(4) :: TEMPK ! ambient temperature [K] - REAL(4) :: PRES ! ambient pressure [Pa] - REAL(4) :: BETAIJ ! coagulation coefficient [m^3/s/particle] - - REAL(4), PARAMETER :: PI = 3.141592653589793 - REAL(4), PARAMETER :: FOURPI = 4.0 * PI - REAL(4), PARAMETER :: SIXPI = 6.0 * PI - REAL(4), PARAMETER :: FOURPIBY3 = 4.0 * PI / 3.0 - REAL(4), PARAMETER :: KB = 1.38065E-23 ! Boltzmann's constant [J/K] - REAL(4), PARAMETER :: NA = 6.0221367E+23 ! Avogadro's number [#/mole] - REAL(4), PARAMETER :: MWAIR = 28.9628E-03 ! molecular weight of air in [kg/mole] - REAL(4), PARAMETER :: M1AIR = MWAIR/NA ! average mass of one air molecule [kg] - REAL(4), PARAMETER :: VACONST = 8.0*KB/PI/M1AIR ! used in eq.(16.21) for VABAR - REAL(4), PARAMETER :: APRIME = 1.249 ! for Cunningham slip-flow correction - REAL(4), PARAMETER :: BPRIME = 0.42 ! as given in eq.(16.25); - REAL(4), PARAMETER :: CPRIME = 0.87 ! Kasten (1968) values used here - REAL(4), PARAMETER :: VPCONST = 8.0*KB/PI ! used in eq.(16.27) for VPIBAR [J/K] - REAL(4), PARAMETER :: DENSP_KGM3 = 1.4E+03 ! particle density [kg/m^3] - - REAL(4) :: RI, RJ ! particle radii [m] - REAL(4) :: DPI, DPJ ! particle diffusion coefficients [m^2/s] - REAL(4) :: GI, GJ ! Cunningham slip-flow corrections for particles I, J [1] - REAL(4) :: ETAA ! dynamic viscosity of air [kg/m/s] - REAL(4) :: VABAR ! mean thermal velocity of an air molecule [m/s] - REAL(4) :: RHOA ! density of air [kg/m^3] - REAL(4) :: LAMBDAA ! mean free path of air [m] - REAL(4) :: KNAI, KNAJ ! Knudsen numbers in air for particles I, J [1] - REAL(4) :: VPIBAR, VPJBAR ! mean thermal velocity for particles I, J [m/s] - REAL(4) :: MPI, MPJ ! particle masses [kg] - REAL(4) :: VOLI, VOLJ ! particle volumes [m^3] - REAL(4) :: LAMBDAPI ! mean free path for particle I [m] - REAL(4) :: LAMBDAPJ ! mean free path for particle J [m] - REAL(4) :: DELTAI, DELTAJ ! see eq.(16.29), p. 446 of MZJ 1999 - REAL(4) :: DENOM1, DENOM2 ! scratch variables -! REAL(4) :: DUM1, DUM2 ! scratch variables - - RI = 0.5E-06 * DI ! convert from [um] to [m] - RJ = 0.5E-06 * DJ ! convert from [um] to [m] - VOLI = FOURPIBY3 * RI**3 ! volume of particle I [m^3] - VOLJ = FOURPIBY3 * RJ**3 ! volume of particle J [m^3] - !------------------------------------------------------------------------- - ! Dynamic viscosity of air [kg/m/s], Jacobson, 2005, eq.(4.54). - ! Mean thermal velocity of an air molecule [m/s]. - ! Density of air [kg/m^3] from the ideal gas law. - ! Mean free path of an air molecule [m], Jacobson, 2005, eq.(15.24). - !------------------------------------------------------------------------- - ETAA = 1.8325E-05 * (416.16/(TEMPK + 120.0)) * (TEMPK/296.16)**1.5 - VABAR = SQRT( VACONST * TEMPK ) - RHOA = PRES * M1AIR / ( KB * TEMPK ) - LAMBDAA = 2.0 * ETAA / ( RHOA * VABAR ) - KNAI = LAMBDAA / RI - KNAJ = LAMBDAA / RJ -!------------------------------------------------------------------------------- -! DUM1 = 0.0 -! DUM2 = 0.0 -! WRITE(*, '(12D11.3)') DUM1, DUM2 -!------------------------------------------------------------------------------- -! DUM1 = KNAI * ( APRIME + BPRIME * EXP(-CPRIME/KNAI) ) -! DUM2 = KNAJ * ( APRIME + BPRIME * EXP(-CPRIME/KNAJ) ) -!------------------------------------------------------------------------------- -! WRITE(*, '(12D11.3)') DUM1, DUM2 -!------------------------------------------------------------------------------- -! GI = 1.0 + DUM1 -! GJ = 1.0 + DUM2 -!------------------------------------------------------------------------------- -! WRITE(*, '(12D11.3)') DI,DJ,KNAI,KNAJ,GI,GJ -!------------------------------------------------------------------------------- - GI = 1.0 + KNAI * ( APRIME + BPRIME * EXP(-CPRIME/KNAI) ) - GJ = 1.0 + KNAJ * ( APRIME + BPRIME * EXP(-CPRIME/KNAJ) ) - DPI = KB * TEMPK * GI / ( SIXPI * RI * ETAA ) - DPJ = KB * TEMPK * GJ / ( SIXPI * RJ * ETAA ) - MPI = VOLI * DENSP_KGM3 - MPJ = VOLJ * DENSP_KGM3 - VPIBAR = SQRT ( VPCONST * TEMPK / MPI ) - VPJBAR = SQRT ( VPCONST * TEMPK / MPJ ) - LAMBDAPI = 2.0 * DPI / ( PI * VPIBAR ) - LAMBDAPJ = 2.0 * DPJ / ( PI * VPJBAR ) - DELTAI = (2.0*RI + LAMBDAPI)**3 - (4.0*RI*RI + LAMBDAPI*LAMBDAPI)**1.5 - DELTAI = DELTAI / ( 6.0*RI*LAMBDAPI ) - 2.0*RI - DELTAJ = (2.0*RJ + LAMBDAPJ)**3 - (4.0*RJ*RJ + LAMBDAPJ*LAMBDAPJ)**1.5 - DELTAJ = DELTAJ / ( 6.0*RJ*LAMBDAPJ ) - 2.0*RJ - DENOM1 = (RI+RJ) / ( (RI+RJ) + SQRT(DELTAI*DELTAI + DELTAJ*DELTAJ) ) - DENOM2 = 4.0*(DPI+DPJ) / ( (RI+RJ) * SQRT(VPIBAR*VPIBAR + VPJBAR*VPJBAR) ) - BETAIJ = FOURPI * ( RI + RJ ) * ( DPI + DPJ ) / ( DENOM1 + DENOM2 ) -!------------------------------------------------------------------------------- -! WRITE(AUNIT2,'(12D11.3)') PRES,RHOA,LAMBDAA,DI,DJ,KNAI,KNAJ,GI,GJ,DPI,DPJ,BETAIJ -! WRITE(*, '(12D11.3)') PRES,RHOA,LAMBDAA,DI,DJ,KNAI,KNAJ,GI,GJ,DPI,DPJ,BETAIJ -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'DI,DJ,TEMPK,PRES' -! WRITE(AUNIT2,*) DI,DJ,TEMPK,PRES -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'ETAA,VABAR,RHOA,LAMBDAA' -! WRITE(AUNIT2,*) ETAA,VABAR,RHOA,LAMBDAA -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'KNAI,KNAJ,GI,GJ,DPI,DPJ' -! WRITE(AUNIT2,*) KNAI,KNAJ,GI,GJ,DPI,DPJ -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'MPI,MPJ,VOLI,VOLJ,VPIBAR,VPJBAR' -! WRITE(AUNIT2,*) MPI,MPJ,VOLI,VOLJ,VPIBAR,VPJBAR -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'LAMBDAPI,LAMBDAPJ,DELTAI,DELTAJ,DENOM1,DENOM2' -! WRITE(AUNIT2,*) LAMBDAPI,LAMBDAPJ,DELTAI,DELTAJ,DENOM1,DENOM2 -! WRITE(AUNIT2,*)' ' -! WRITE(AUNIT2,*)'BETAIJ=',BETAIJ -!------------------------------------------------------------------------------- - RETURN - END SUBROUTINE BROWNIAN_COAG_COEF - - - SUBROUTINE CBDE_COAG_COEF( DI, DJ, TEMPK, PRES, KDEIJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the convective Brownian diffusion enhancement coagulation coefficient. -! See MZJ, 2005, p. 510, Eq.15.35. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - REAL(4) :: DI, DJ ! particle diameters [um] - REAL(4) :: TEMPK ! ambient temperature [K] - REAL(4) :: PRES ! ambient pressure [Pa] - REAL(4) :: KDEIJ ! coagulation coefficient [m^3/s/particle] - REAL(4), PARAMETER :: PI = 3.141592653589793 - REAL(4), PARAMETER :: SIXPI = 6.0 * PI - REAL(4), PARAMETER :: KB = 1.38065E-23 ! Boltzmann's constant [J/K] - REAL(4), PARAMETER :: NA = 6.0221367E+23 ! Avogadro's number [#/mole] - REAL(4), PARAMETER :: MWAIR = 28.9628E-03 ! molecular weight of air in [kg/mole] - REAL(4), PARAMETER :: M1AIR = MWAIR/NA ! average mass of one air molecule [kg] - REAL(4), PARAMETER :: VACONST = 8.0*KB/PI/M1AIR ! used in eq.(16.21) for VABAR - REAL(4), PARAMETER :: APRIME = 1.249 ! for Cunningham slip-flow correction - REAL(4), PARAMETER :: BPRIME = 0.42 ! as given in eq.(16.25); - REAL(4), PARAMETER :: CPRIME = 0.87 ! Kasten (1968) values used here - REAL(4), PARAMETER :: DENSP_KGM3 = 1.4E+03 ! particle density [kg/m^3] - REAL(4), PARAMETER :: GGRAV = 9.81 ! gravitational acceleration [m/s^2] - REAL(4) :: RI, RJ ! particle radii [um] - REAL(4) :: DPI ! particle diffusion coefficients [m^2/s] - REAL(4) :: GI, GJ ! Cunningham slip-flow corrections for particles I, J [1] - REAL(4) :: ETAA ! dynamic viscosity of air [kg/m/s] - REAL(4) :: VABAR ! mean thermal velocity of an air molecule [m/s] - REAL(4) :: RHOA ! density of air [kg/m^3] - REAL(4) :: LAMBDAA ! mean free path of air [m] - REAL(4) :: KNAI, KNAJ ! Knudsen numbers in air for particles I, J [1] - REAL(4) :: NUA ! kinematic viscosity of air [m^2/s] - REAL(4) :: VFJ ! terminal fall speed [m/s] - REAL(4) :: REJ ! particle Reynolds number [1] - REAL(4) :: SCPI ! particle Schmidt number [1] - REAL(4) :: KBIJ ! Brownian diffusion coefficient [m^3/s] - - !----------------------------------------------------------------------------------------------------------------- - ! RJ must be larger than or equal to RI for this coagulation mechanism. - ! Make RJ greater than or equal RI for all pairs of particles. - !----------------------------------------------------------------------------------------------------------------- - IF( DJ .GE. DI ) THEN - RI = 0.5E-06 * DI ! convert from [um] to [m] - RJ = 0.5E-06 * DJ ! convert from [um] to [m] - ELSE - RJ = 0.5E-06 * DI ! convert from [um] to [m] - RI = 0.5E-06 * DJ ! convert from [um] to [m] - ENDIF - !----------------------------------------------------------------------------------------------------------------- - ! Dynamic viscosity of air [kg/m/s], Jacobson, 2005, eq.(4.54). - ! Mean thermal velocity of an air molecule [m/s]. - ! Density of air [kg/m^3] from the ideal gas law. - ! Mean free path of an air molecule [m], Jacobson, 2005, eq.(15.24). - !----------------------------------------------------------------------------------------------------------------- - ETAA = 1.8325E-05 * (416.16/(TEMPK + 120.0)) * (TEMPK/296.16)**1.5 ! [kg/m/s] - VABAR = SQRT( VACONST * TEMPK ) ! [m/s] - RHOA = PRES * M1AIR / ( KB * TEMPK ) ! [kg/m^3] - LAMBDAA = 2.0 * ETAA / ( RHOA * VABAR ) ! [m] - KNAI = LAMBDAA / RI ! [1] - KNAJ = LAMBDAA / RJ ! [1] - GI = 1.0 + KNAI * ( APRIME + BPRIME * EXP(-CPRIME/KNAI) ) ! Cunningham slip-flow correction [1] - GJ = 1.0 + KNAJ * ( APRIME + BPRIME * EXP(-CPRIME/KNAJ) ) ! Cunningham slip-flow correction [1] - DPI = KB * TEMPK * GI / ( SIXPI * RI * ETAA ) ! particle diffusion coefficient [m^2/s] - NUA = ETAA / RHOA ! kinematic viscosity of air [m^2/s] - VFJ = 2.0 * RJ*RJ*(DENSP_KGM3-RHOA)*GGRAV*GJ/(9.0*ETAA) ! fall velocity [m/s] - REJ = 2.0 * RJ * VFJ / NUA ! particle Reynolds number [1] - SCPI = NUA / DPI ! particle Schmidt number [1] - CALL BROWNIAN_COAG_COEF ( DI, DJ, TEMPK, PRES, KBIJ ) ! Brownian coag. coef. [m^3/s] - IF( REJ .LE. 1.0 ) KDEIJ = 0.45 * KBIJ * REJ**0.3333333 * SCPI**0.3333333 ! CBDE coag. coef. [m^3/s] - IF( REJ .GT. 1.0 ) KDEIJ = 0.45 * KBIJ * REJ**0.5000000 * SCPI**0.3333333 ! CBDE coag. coef. [m^3/s] - ! WRITE(*,*) 'VFJ = ', VFJ - RETURN - END SUBROUTINE CBDE_COAG_COEF - - - SUBROUTINE GRAVCOLL_COAG_COEF( DI, DJ, TEMPK, PRES, KGCIJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the gravitational collection coagulation coefficient. -! See MZJ, 2005, p. 510, Eq.15.37. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - REAL(4) :: DI, DJ ! particle diameters [um] - REAL(4) :: TEMPK ! ambient temperature [K] - REAL(4) :: PRES ! ambient pressure [Pa] - REAL(4) :: KGCIJ ! coagulation coefficient [m^3/s/particle] - REAL(4), PARAMETER :: PI = 3.141592653589793 - REAL(4), PARAMETER :: SIXPI = 6.0 * PI - REAL(4), PARAMETER :: KB = 1.38065E-23 ! Boltzmann's constant [J/K] - REAL(4), PARAMETER :: NA = 6.0221367E+23 ! Avogadro's number [#/mole] - REAL(4), PARAMETER :: MWAIR = 28.9628E-03 ! molecular weight of air in [kg/mole] - REAL(4), PARAMETER :: M1AIR = MWAIR/NA ! average mass of one air molecule [kg] - REAL(4), PARAMETER :: VACONST = 8.0*KB/PI/M1AIR ! used in eq.(16.21) for VABAR - REAL(4), PARAMETER :: APRIME = 1.249 ! for Cunningham slip-flow correction - REAL(4), PARAMETER :: BPRIME = 0.42 ! as given in eq.(16.25); - REAL(4), PARAMETER :: CPRIME = 0.87 ! Kasten (1968) values used here - REAL(4), PARAMETER :: DENSP_KGM3 = 1.4E+03 ! particle density [kg/m^3] - REAL(4), PARAMETER :: GGRAV = 9.81 ! gravitational acceleration [m/s^2] - REAL(4) :: RI, RJ ! particle radii [um] - REAL(4) :: GI, GJ ! Cunningham slip-flow corrections for particles I, J [1] - REAL(4) :: ETAA ! dynamic viscosity of air [kg/m/s] - REAL(4) :: VABAR ! mean thermal velocity of an air molecule [m/s] - REAL(4) :: RHOA ! density of air [kg/m^3] - REAL(4) :: LAMBDAA ! mean free path of air [m] - REAL(4) :: KNAI, KNAJ ! Knudsen numbers in air for particles I, J [1] - REAL(4) :: VFI, VFJ ! terminal fall speed [m/s] - REAL(4) :: ECOLLIJ ! collision efficiency [1] - REAL(4) :: P ! p = min(ri,rj)/max(ri,rj) from Pruppacher and Klett 1980, p.377. - - RI = 0.5E-06 * DI ! convert from [um] to [m] - RJ = 0.5E-06 * DJ ! convert from [um] to [m] - !----------------------------------------------------------------------------------------------------------------- - ! Dynamic viscosity of air [kg/m/s], Jacobson, 2005, eq.(4.54). - ! Mean thermal velocity of an air molecule [m/s]. - ! Density of air [kg/m^3] from the ideal gas law. - ! Mean free path of an air molecule [m], Jacobson, 2005, eq.(15.24). - !----------------------------------------------------------------------------------------------------------------- - ETAA = 1.8325E-05 * (416.16/(TEMPK + 120.0)) * (TEMPK/296.16)**1.5 ! [kg/m/s] - VABAR = SQRT( VACONST * TEMPK ) ! [m/s] - RHOA = PRES * M1AIR / ( KB * TEMPK ) ! [kg/m^3] - LAMBDAA = 2.0 * ETAA / ( RHOA * VABAR ) ! [m] - KNAI = LAMBDAA / RI ! [1] - KNAJ = LAMBDAA / RJ ! [1] - GI = 1.0 + KNAI * ( APRIME + BPRIME * EXP(-CPRIME/KNAI) ) ! Cunningham slip-flow correction [1] - GJ = 1.0 + KNAJ * ( APRIME + BPRIME * EXP(-CPRIME/KNAJ) ) ! Cunningham slip-flow correction [1] - VFI = 2.0 * RI*RI*(DENSP_KGM3-RHOA)*GGRAV*GI/(9.0*ETAA) ! fall velocity [m/s] - VFJ = 2.0 * RJ*RJ*(DENSP_KGM3-RHOA)*GGRAV*GJ/(9.0*ETAA) ! fall velocity [m/s] -!------------------------------------------------------------------------------------------------------------------------- -! Taking the collision efficiency from Pruppacher and Klett, 1980, Eq.12-78. -!------------------------------------------------------------------------------------------------------------------------- - IF( RJ .GT. RI ) THEN - P = RI / RJ - ELSE - P = RJ / RI - ENDIF - ECOLLIJ = 0.5 * ( P / ( 1.0 + P ) )**2 ! collision efficiency [1], Eq.12-78 - KGCIJ = ECOLLIJ * PI * ( RI + RJ )**2 * ABS( VFI - VFJ ) ! grav. collection coag. coef. [m^3/s] -!------------------------------------------------------------------------------------------------------------------------- -! WRITE(*,'(/,A )')'KGCIJ, RI, RJ, VFI, VFJ, ECOLLIJ, STIJ, REJ, EVIJ, EAIJ' -! WRITE(*,'(10D12.4)') KGCIJ, RI, RJ, VFI, VFJ, ECOLLIJ, STIJ, REJ, EVIJ, EAIJ -! WRITE(*,*) 'NUA = ', NUA -!------------------------------------------------------------------------------------------------------------------------- - RETURN - END SUBROUTINE GRAVCOLL_COAG_COEF - - - SUBROUTINE TURB_COAG_COEF( DI, DJ, TEMPK, PRES, KTIIJ, KTSIJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the turbulent inertial coagulation coefficient. See MZJ, 2005, p. 511, Eq.15.40. -! Routine to calculate the turbulent shear coagulation coefficient. See MZJ, 2005, p. 511, Eq.15.41. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - REAL(4) :: DI, DJ ! particle diameters [um] - REAL(4) :: TEMPK ! ambient temperature [K] - REAL(4) :: PRES ! ambient pressure [Pa] - REAL(4) :: KTIIJ ! turbulent inertial coagulation coefficient [m^3/s/particle] - REAL(4) :: KTSIJ ! turbulent shear coagulation coefficient [m^3/s/particle] - REAL(4), PARAMETER :: PI = 3.141592653589793 - REAL(4), PARAMETER :: KB = 1.38065E-23 ! Boltzmann's constant [J/K] - REAL(4), PARAMETER :: NA = 6.0221367E+23 ! Avogadro's number [#/mole] - REAL(4), PARAMETER :: MWAIR = 28.9628E-03 ! molecular weight of air in [kg/mole] - REAL(4), PARAMETER :: M1AIR = MWAIR/NA ! average mass of one air molecule [kg] - REAL(4), PARAMETER :: VACONST = 8.0*KB/PI/M1AIR ! used in eq.(16.21) for VABAR - REAL(4), PARAMETER :: APRIME = 1.249 ! for Cunningham slip-flow correction - REAL(4), PARAMETER :: BPRIME = 0.42 ! as given in eq.(16.25); - REAL(4), PARAMETER :: CPRIME = 0.87 ! Kasten (1968) values used here - REAL(4), PARAMETER :: DENSP_KGM3 = 1.4E+03 ! particle density [kg/m^3] - REAL(4), PARAMETER :: GGRAV = 9.81 ! gravitational acceleration [m/s^2] - REAL(4), PARAMETER :: ED = 5.0E-04 ! dissipation rate of turbulent kinetic energy per gram of medium [m^2/s^3] - ! Typical clear-sky value from MZJ (2005, p.511,p.236) of 5.0E-05 [m^2/s^3] - ! from Pruppacher and Klett (1997). - REAL(4) :: RI, RJ ! particle radii [um] - REAL(4) :: GI, GJ ! Cunningham slip-flow corrections for particles I, J [1] - REAL(4) :: ETAA ! dynamic viscosity of air [kg/m/s] - REAL(4) :: VABAR ! mean thermal velocity of an air molecule [m/s] - REAL(4) :: RHOA ! density of air [kg/m^3] - REAL(4) :: LAMBDAA ! mean free path of air [m] - REAL(4) :: KNAI, KNAJ ! Knudsen numbers in air for particles I, J [1] - REAL(4) :: NUA ! kinematic viscosity of air [m^2/s] - REAL(4) :: VFI, VFJ ! terminal fall speed [m/s] - - RI = 0.5E-06 * DI ! convert from [um] to [m] - RJ = 0.5E-06 * DJ ! convert from [um] to [m] - !----------------------------------------------------------------------------------------------------------------- - ! Dynamic viscosity of air [kg/m/s], Jacobson, 2005, eq.(4.54). - ! Mean thermal velocity of an air molecule [m/s]. - ! Density of air [kg/m^3] from the ideal gas law. - ! Mean free path of an air molecule [m], Jacobson, 2005, eq.(15.24). - !----------------------------------------------------------------------------------------------------------------- - ETAA = 1.8325E-05 * (416.16/(TEMPK + 120.0)) * (TEMPK/296.16)**1.5 ! [kg/m/s] - VABAR = SQRT( VACONST * TEMPK ) ! [m/s] - RHOA = PRES * M1AIR / ( KB * TEMPK ) ! [kg/m^3] - LAMBDAA = 2.0 * ETAA / ( RHOA * VABAR ) ! [m] - KNAI = LAMBDAA / RI ! [1] - KNAJ = LAMBDAA / RJ ! [1] - GI = 1.0 + KNAI * ( APRIME + BPRIME * EXP(-CPRIME/KNAI) ) ! Cunningham slip-flow correction [1] - GJ = 1.0 + KNAJ * ( APRIME + BPRIME * EXP(-CPRIME/KNAJ) ) ! Cunningham slip-flow correction [1] - VFI = 2.0 * RI*RI*(DENSP_KGM3-RHOA)*GGRAV*GI/(9.0*ETAA) ! fall velocity [m/s] - VFJ = 2.0 * RJ*RJ*(DENSP_KGM3-RHOA)*GGRAV*GJ/(9.0*ETAA) ! fall velocity [m/s] - NUA = ETAA / RHOA ! kinematic viscosity of air [m^2/s] - KTIIJ = (PI*ED**0.75/(GGRAV*NUA**0.25))*(RI+RJ)**2*ABS(VFI-VFJ) ! turbulent inertial coag. coef. [m^3/s] - KTSIJ = SQRT(8.0*PI*ED/(15.0*NUA))*(RI+RJ)**3 ! turbulent shear coag. coef. [m^3/s] - ! WRITE(*,'(10D12.4)') KTIIJ, KTSIJ, RI, RJ, VFI, VFJ - RETURN - END SUBROUTINE TURB_COAG_COEF - - - SUBROUTINE TOTAL_COAG_COEF( DI, DJ, TEMPK, PRES, KTOTIJ ) -!------------------------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the total coagulation coefficient. -!------------------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - REAL(4) :: DI, DJ ! particle diameters [um] - REAL(4) :: TEMPK ! ambient temperature [K] - REAL(4) :: PRES ! ambient pressure [Pa] - REAL(4) :: KBIJ ! Brownian kernel [m^3/s/particle] - REAL(4) :: KDEIJ ! convective Brownian diffusion enhancement kernel [m^3/s/particle] - REAL(4) :: KGCIJ ! gravitational collection kernel [m^3/s/particle] - REAL(4) :: KTIIJ ! turbulent inertial kernel [m^3/s/particle] - REAL(4) :: KTSIJ ! turbulent shear kernel [m^3/s/particle] - REAL(4) :: KTOTIJ ! total kernel [m^3/s/particle] - CALL BROWNIAN_COAG_COEF( DI, DJ, TEMPK, PRES, KBIJ ) - CALL CBDE_COAG_COEF ( DI, DJ, TEMPK, PRES, KDEIJ ) - CALL GRAVCOLL_COAG_COEF( DI, DJ, TEMPK, PRES, KGCIJ ) - CALL TURB_COAG_COEF ( DI, DJ, TEMPK, PRES, KTIIJ, KTSIJ ) - KTOTIJ = KBIJ + KDEIJ + KGCIJ + KTIIJ + KTSIJ - RETURN - END SUBROUTINE TOTAL_COAG_COEF - - - SUBROUTINE TEST_COAG_COEF -!----------------------------------------------------------------------------------------------------------------------- -! Routine to test the various routines for coagulation coefficients. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER, PARAMETER :: NSIZES = 81 ! was 501 for MZJ Figure 15.7 - REAL(4), PARAMETER :: DLOWER = 0.0030 ! [um] - REAL(4), PARAMETER :: DUPPER = 30.0000 ! [um] - REAL(4) :: D(NSIZES) ! [um] - REAL(4) :: DRAT,DTEST1,DTEST2,BETA ! scratch variables - REAL(4) :: TEMPK ! temperature [K] - REAL(4) :: PRES ! pressure [Pa] - REAL(4) :: KBIJ ! Brownian kernel [m^3/s/particle] - REAL(4) :: KDEIJ ! convective Brownian diffusion enhancement kernel [m^3/s/particle] - REAL(4) :: KGCIJ ! gravitational collection kernel [m^3/s/particle] - REAL(4) :: KTIIJ ! turbulent inertial kernel [m^3/s/particle] - REAL(4) :: KTSIJ ! turbulent shear kernel [m^3/s/particle] - REAL(4) :: KTOTIJ, KTOTIJ_TMP ! total kernel [m^3/s/particle] - INTEGER :: I,J,N - INTEGER, PARAMETER :: SIZE_NUMBER = 1 - LOGICAL, PARAMETER :: MZJ_FIGURE = .FALSE. - LOGICAL, PARAMETER :: TP_DEPENDENCE = .TRUE. - LOGICAL, PARAMETER :: WRITE_TABLE = .FALSE. - - OPEN(AUNIT2,FILE='kij.out',STATUS='REPLACE') - - ! WRITE(AUNIT2,*)'N,D(N)' - DRAT = (DUPPER/DLOWER)**(1.0/REAL(NSIZES-1)) - DO N=1,NSIZES - D(N) = DLOWER*(DRAT**(N-1)) - ! WRITE(AUNIT2,90000)N,D(N) - ENDDO -!--------------------------------------------------------------------------------------------------------------------------- -! For comparison with Figure 16.4, p.448 of MZJ 1999. -! For comparison with Figure 15.7, p.512 of MZJ 2005. -! DLW, 082906: Checked against Fig.15.7 of MZJ 2005; gives close agreement. -!--------------------------------------------------------------------------------------------------------------------------- - IF( MZJ_FIGURE ) THEN - WRITE(AUNIT2,'(/A/)')' N RTEST[um] R(N)[um] KBIJ[cm3/s] KDEIJ[cm3/s] KGCIJ[cm3/s] KTIIJ[cm3/s] KTSIJ[cm3/s]' - PRES = 101325.0 - TEMPK = 298.0 - IF( SIZE_NUMBER .EQ. 1 ) DTEST1 = 0.02 ! for r= 0.01 um test - IF( SIZE_NUMBER .EQ. 2 ) DTEST1 = 20.00 ! for r=10.00 um test - IF( SIZE_NUMBER .EQ. 3 ) DTEST1 = 2.00 ! for r= 1.00 um test - DO N=1,NSIZES - CALL BROWNIAN_COAG_COEF( DTEST1, D(N), TEMPK, PRES, KBIJ ) - CALL CBDE_COAG_COEF ( DTEST1, D(N), TEMPK, PRES, KDEIJ ) - CALL GRAVCOLL_COAG_COEF( D(N), DTEST1, TEMPK, PRES, KGCIJ ) - CALL TURB_COAG_COEF ( DTEST1, D(N), TEMPK, PRES, KTIIJ, KTSIJ ) - CALL TOTAL_COAG_COEF ( DTEST1, D(N), TEMPK, PRES, KTOTIJ ) - KTOTIJ_TMP = KBIJ + KDEIJ + KGCIJ + KTIIJ + KTSIJ ! For check of routine TOTAL_COAG_COEF. - WRITE(AUNIT2,90001)N,0.5*DTEST1,0.5*D(N),1.0E+06*KBIJ,1.0E+06*KDEIJ,1.0E+06*KGCIJ,1.0E+06*KTIIJ,1.0E+06*KTSIJ, - & 1.0E+06*KTOTIJ, 1.0E+06*KTOTIJ_TMP - ENDDO - ENDIF -!--------------------------------------------------------------------------------------------------------------------------- -! For examination of the temperature and pressure dependence. -!--------------------------------------------------------------------------------------------------------------------------- - IF( TP_DEPENDENCE ) THEN - WRITE(AUNIT2,*)'N,DTEST1,DTEST2,BROWNIAN_BETA,TEMPK,PRES' - PRES = 101325.0 - TEMPK = 288.0 - DTEST1 = 0.003 - DTEST2 = 30.000 - DO N=1,14 - CALL BROWNIAN_COAG_COEF(DTEST1,DTEST2,TEMPK,PRES,BETA) - WRITE(AUNIT2,90008)N,DTEST1,DTEST2,1.0E+06*BETA,TEMPK,PRES - ! TEMPK = TEMPK + 10.0 - PRES = 0.70*PRES - ENDDO - ENDIF -!--------------------------------------------------------------------------------------------------------------------------- -! Table of coagulation coefficients. -!--------------------------------------------------------------------------------------------------------------------------- - IF( WRITE_TABLE ) THEN - WRITE(AUNIT2,'(2A)')'I, J, R(I)[um], R(J)[um],',' KTOTIJ[cm^3/s]' - PRES = 101325.0 ! For examination of the pressure dependence: *0.1, *0.01 - TEMPK = 288.00 ! For examination of the temperature dependence: 200.0, 325.0 - DO J=1,NSIZES - DO I=1,NSIZES - CALL TOTAL_COAG_COEF ( D(I), D(J), TEMPK, PRES, KTOTIJ ) - WRITE(AUNIT2,90002) I, J, 0.5*D(I), 0.5*D(J), 1.0E+06*KTOTIJ - ENDDO - ENDDO - ENDIF -!--------------------------------------------------------------------------------------------------------------------------- - CLOSE(AUNIT2) -90000 FORMAT(I5,F15.6) -90001 FORMAT(I4,2F10.5,7E13.4) -90002 FORMAT(2I5,2F12.6,2E16.6) -90008 FORMAT(I5,2F12.6,F16.6,2F12.2) - RETURN - END SUBROUTINE TEST_COAG_COEF - - - END MODULE AERO_COAG - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_config.F90 b/MATRIXchem_GridComp/microphysics/TRAMP_config.F90 deleted file mode 100644 index c81b1e44..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_config.F90 +++ /dev/null @@ -1,771 +0,0 @@ -#ifndef GEOS5_PORT -#include "rundeck_opts.h" -#endif - - MODULE AERO_CONFIG - USE AERO_PARAM, ONLY: NM1, NM2, NM3, NM4, NM5, NM6, NM7, NM8 - IMPLICIT NONE -!------------------------------------------------------------------------------------------------------------------------- -! -! MATRIX CONFIGURATION MODULE. -! -!------------------------------------------------------------------------------------------------------------------------- -! 1. Uncomment the line for the desired mechanism (1-8). -!------------------------------------------------------------------------------------------------------------------------- -#ifdef TRACERS_AMP_M1 - INTEGER, PARAMETER :: MECH=1,NAEROVARS=51,NEXTRA=3,NMODES=16 ! Mechanism 1 -#endif -#ifdef TRACERS_AMP_M2 - INTEGER, PARAMETER :: MECH=2,NAEROVARS=51,NEXTRA=3,NMODES=16 ! Mechanism 2 -#endif -#ifdef TRACERS_AMP_M3 - INTEGER, PARAMETER :: MECH=3,NAEROVARS=41,NEXTRA=3,NMODES=13 ! Mechanism 3 -#endif -#ifdef TRACERS_AMP_M4 - INTEGER, PARAMETER :: MECH=4,NAEROVARS=34,NEXTRA=1,NMODES=10 ! Mechanism 4 -#endif -#ifdef TRACERS_AMP_M5 - INTEGER, PARAMETER :: MECH=5,NAEROVARS=45,NEXTRA=3,NMODES=14 ! Mechanism 5 -#endif -#ifdef TRACERS_AMP_M6 - INTEGER, PARAMETER :: MECH=6,NAEROVARS=45,NEXTRA=3,NMODES=14 ! Mechanism 6 -#endif -#ifdef TRACERS_AMP_M7 - INTEGER, PARAMETER :: MECH=7,NAEROVARS=35,NEXTRA=3,NMODES=11 ! Mechanism 7 -#endif -#ifdef TRACERS_AMP_M8 - INTEGER, PARAMETER :: MECH=8,NAEROVARS=28,NEXTRA=1,NMODES= 8 ! Mechanism 8 -#endif -!------------------------------------------------------------------------------------------------------------------------- -! 2. Set the number of quadrature points per mode (1-2); must use NPOINTS=1 for the present. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: NPOINTS=1 -!------------------------------------------------------------------------------------------------------------------------- -! 3. Select modes to undergo condensational growth for the desired mechanism (1-8). (Ignore other mechanisms.) -! ICONDn(I)=1, condensational growth done; ICONDn(I)=0, condensational growth not done. -! Ordinarily, all modes would undergo condenational growth. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, SAVE, DIMENSION(NM1) :: ICOND1=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 1 - INTEGER, SAVE, DIMENSION(NM2) :: ICOND2=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 2 - INTEGER, SAVE, DIMENSION(NM3) :: ICOND3=(/1,1,1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 3 - INTEGER, SAVE, DIMENSION(NM4) :: ICOND4=(/1,1,1,1,1,1,1,1,1,1/) ! Mechanism 4 - INTEGER, SAVE, DIMENSION(NM5) :: ICOND5=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 5 - INTEGER, SAVE, DIMENSION(NM6) :: ICOND6=(/1,1,1,1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 6 - INTEGER, SAVE, DIMENSION(NM7) :: ICOND7=(/1,1,1,1,1,1,1,1,1,1,1/) ! Mechanism 7 - INTEGER, SAVE, DIMENSION(NM8) :: ICOND8=(/1,1,1,1,1,1,1,1/) ! Mechanism 8 -!------------------------------------------------------------------------------------------------------------------------- -! These require no editing. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: NAEROBOX=NAEROVARS+NEXTRA - INTEGER, PARAMETER :: NWEIGHTS=NMODES*NPOINTS - INTEGER, PARAMETER :: NBINS = 30 -!------------------------------------------------------------------------------------------------------------------------------------- -! 4. Optionally edit the table of coagulation interactions. -! The donor modes may not be modified. Each receptor mode must contain all species present in either donor mode. -! Entering 'OFF' for the receptor mode name disables coagulation between the two donor modes. -!------------------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 1. -! -! FIRST MODE AKK ACC DD1 DS1 DD2 DS2 SSA SSC OCC BC1 BC2 BC3 DBC BOC BCS MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE1(NM1,NM1) - DATA CITABLE1(1:NM1, 1)/'AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! AKK - DATA CITABLE1(1:NM1, 2)/'ACC','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! ACC - DATA CITABLE1(1:NM1, 3)/'DD1','DD1','DD1','DD1','DD2','DD2','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DD1 - DATA CITABLE1(1:NM1, 4)/'DS1','DS1','DD1','DS1','DD2','DS2','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DS1 - DATA CITABLE1(1:NM1, 5)/'DD2','DD2','DD2','DD2','DD2','DD2','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DD2 - DATA CITABLE1(1:NM1, 6)/'DS2','DS2','DD2','DS2','DD2','DS2','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DS2 - DATA CITABLE1(1:NM1, 7)/'SSA','SSA','MXX','MXX','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE1(1:NM1, 8)/'SSC','SSC','MXX','MXX','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE1(1:NM1, 9)/'OCC','OCC','MXX','MXX','MXX','MXX','MXX','MXX','OCC','BOC','BOC','BOC','MXX','BOC','BOC','MXX'/ ! OCC - DATA CITABLE1(1:NM1,10)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BC1','BC1','BC1','DBC','BOC','BCS','MXX'/ ! BC1 - DATA CITABLE1(1:NM1,11)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BC2','DBC','BOC','BCS','MXX'/ ! BC2 - DATA CITABLE1(1:NM1,12)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BC3','DBC','BOC','BCS','MXX'/ ! BC3 - DATA CITABLE1(1:NM1,13)/'DBC','DBC','DBC','DBC','DBC','DBC','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DBC - DATA CITABLE1(1:NM1,14)/'BOC','BOC','MXX','MXX','MXX','MXX','MXX','MXX','BOC','BOC','BOC','BOC','MXX','BOC','BOC','MXX'/ ! BOC - DATA CITABLE1(1:NM1,15)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! BCS - DATA CITABLE1(1:NM1,16)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 2. -! -! FIRST MODE AKK ACC DD1 DS1 DD2 DS2 SSA SSC OCC BC1 BC2 OCS DBC BOC BCS MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE2(NM2,NM2) - DATA CITABLE2(1:NM2, 1)/'AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCS','BCS','BCS','OCS','DBC','BOC','BCS','MXX'/ ! AKK - DATA CITABLE2(1:NM2, 2)/'ACC','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCS','BCS','BCS','OCS','DBC','BOC','BCS','MXX'/ ! ACC - DATA CITABLE2(1:NM2, 3)/'DD1','DD1','DD1','DD1','DD2','DD2','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DD1 - DATA CITABLE2(1:NM2, 4)/'DS1','DS1','DD1','DS1','DD2','DS2','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DS1 - DATA CITABLE2(1:NM2, 5)/'DD2','DD2','DD2','DD2','DD2','DD2','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DD2 - DATA CITABLE2(1:NM2, 6)/'DS2','DS2','DD2','DS2','DD2','DS2','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DS2 - DATA CITABLE2(1:NM2, 7)/'SSA','SSA','MXX','MXX','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE2(1:NM2, 8)/'SSC','SSC','MXX','MXX','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE2(1:NM2, 9)/'OCS','OCS','MXX','MXX','MXX','MXX','MXX','MXX','OCC','BOC','BOC','OCS','MXX','BOC','BOC','MXX'/ ! OCC - DATA CITABLE2(1:NM2,10)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BC1','BC1','BOC','DBC','BOC','BCS','MXX'/ ! BC1 - DATA CITABLE2(1:NM2,11)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BOC','DBC','BOC','BCS','MXX'/ ! BC2 - DATA CITABLE2(1:NM2,12)/'OCS','OCS','MXX','MXX','MXX','MXX','MXX','MXX','OCS','BOC','BOC','OCS','MXX','BOC','BOC','MXX'/ ! OCS - DATA CITABLE2(1:NM2,13)/'DBC','DBC','DBC','DBC','DBC','DBC','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DBC - DATA CITABLE2(1:NM2,14)/'BOC','BOC','MXX','MXX','MXX','MXX','MXX','MXX','BOC','BOC','BOC','BOC','MXX','BOC','BOC','MXX'/ ! BOC - DATA CITABLE2(1:NM2,15)/'BCS','BCS','DBC','DBC','DBC','DBC','MXX','MXX','BOC','BCS','BCS','BOC','DBC','BOC','BCS','MXX'/ ! BCS - DATA CITABLE2(1:NM2,16)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 3. -! -! FIRST MODE AKK ACC DD1 DS1 DD2 DS2 SSA SSC OCC BC1 BC2 BOC MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE3(NM3,NM3) - DATA CITABLE3(1:NM3, 1)/'AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','BC1','BC2','BOC','MXX'/ ! AKK - DATA CITABLE3(1:NM3, 2)/'ACC','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','BC1','BC2','BOC','MXX'/ ! ACC - DATA CITABLE3(1:NM3, 3)/'DD1','DD1','DD1','DD1','DD2','DD2','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DD1 - DATA CITABLE3(1:NM3, 4)/'DS1','DS1','DD1','DS1','DD2','DS2','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DS1 - DATA CITABLE3(1:NM3, 5)/'DD2','DD2','DD2','DD2','DD2','DD2','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DD2 - DATA CITABLE3(1:NM3, 6)/'DS2','DS2','DD2','DS2','DD2','DS2','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DS2 - DATA CITABLE3(1:NM3, 7)/'SSA','SSA','MXX','MXX','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE3(1:NM3, 8)/'SSC','SSC','MXX','MXX','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE3(1:NM3, 9)/'OCC','OCC','MXX','MXX','MXX','MXX','MXX','MXX','OCC','BOC','BOC','BOC','MXX'/ ! OCC - DATA CITABLE3(1:NM3,10)/'BC1','BC1','MXX','MXX','MXX','MXX','MXX','MXX','BOC','BC1','BC1','BOC','MXX'/ ! BC1 - DATA CITABLE3(1:NM3,11)/'BC2','BC2','MXX','MXX','MXX','MXX','MXX','MXX','BOC','BC1','BC2','BOC','MXX'/ ! BC2 - DATA CITABLE3(1:NM3,12)/'BOC','BOC','MXX','MXX','MXX','MXX','MXX','MXX','BOC','BOC','BOC','BOC','MXX'/ ! BOC - DATA CITABLE3(1:NM3,13)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 4. -! -! FIRST MODE ACC DD1 DS1 DD2 DS2 SSS OCC BC1 BC2 MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE4(NM4,NM4) - DATA CITABLE4(1:NM4, 1)/'ACC','DD1','DS1','DD2','DS2','SSS','OCC','BC1','BC2','MXX'/ ! ACC - DATA CITABLE4(1:NM4, 2)/'DD1','DD1','DD1','DD2','DD2','MXX','MXX','MXX','MXX','MXX'/ ! DD1 - DATA CITABLE4(1:NM4, 3)/'DS1','DD1','DS1','DD2','DS2','MXX','MXX','MXX','MXX','MXX'/ ! DS1 - DATA CITABLE4(1:NM4, 4)/'DD2','DD2','DD2','DD2','DD2','MXX','MXX','MXX','MXX','MXX'/ ! DD2 - DATA CITABLE4(1:NM4, 5)/'DS2','DD2','DS2','DD2','DS2','MXX','MXX','MXX','MXX','MXX'/ ! DS2 - DATA CITABLE4(1:NM4, 6)/'SSS','MXX','MXX','MXX','MXX','SSS','MXX','MXX','MXX','MXX'/ ! SSS - DATA CITABLE4(1:NM4, 7)/'OCC','MXX','MXX','MXX','MXX','MXX','OCC','MXX','MXX','MXX'/ ! OCC - DATA CITABLE4(1:NM4, 8)/'BC1','MXX','MXX','MXX','MXX','MXX','MXX','BC1','BC1','MXX'/ ! BC1 - DATA CITABLE4(1:NM4, 9)/'BC2','MXX','MXX','MXX','MXX','MXX','MXX','BC1','BC2','MXX'/ ! BC2 - DATA CITABLE4(1:NM4,10)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 5. -! -! FIRST MODE AKK ACC DD1 DS1 SSA SSC OCC BC1 BC2 BC3 DBC BOC BCS MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE5(NM5,NM5) - DATA CITABLE5(1:NM5, 1)/'AKK','ACC','DD1','DS1','SSA','SSC','OCC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! AKK - DATA CITABLE5(1:NM5, 2)/'ACC','ACC','DD1','DS1','SSA','SSC','OCC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! ACC - DATA CITABLE5(1:NM5, 3)/'DD1','DD1','DD1','DD1','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DD1 - DATA CITABLE5(1:NM5, 4)/'DS1','DS1','DD1','DS1','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DS1 - DATA CITABLE5(1:NM5, 5)/'SSA','SSA','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE5(1:NM5, 6)/'SSC','SSC','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE5(1:NM5, 7)/'OCC','OCC','MXX','MXX','MXX','MXX','OCC','BOC','BOC','BOC','MXX','BOC','BOC','MXX'/ ! OCC - DATA CITABLE5(1:NM5, 8)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BC1','BC1','BC1','DBC','BOC','BCS','MXX'/ ! BC1 - DATA CITABLE5(1:NM5, 9)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BC2','DBC','BOC','BCS','MXX'/ ! BC2 - DATA CITABLE5(1:NM5,10)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BC3','DBC','BOC','BCS','MXX'/ ! BC3 - DATA CITABLE5(1:NM5,11)/'DBC','DBC','DBC','DBC','MXX','MXX','MXX','DBC','DBC','DBC','DBC','MXX','DBC','MXX'/ ! DBC - DATA CITABLE5(1:NM5,12)/'BOC','BOC','MXX','MXX','MXX','MXX','BOC','BOC','BOC','BOC','MXX','BOC','BOC','MXX'/ ! BOC - DATA CITABLE5(1:NM5,13)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BCS','BCS','BCS','DBC','BOC','BCS','MXX'/ ! BCS - DATA CITABLE5(1:NM5,14)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 6. -! -! FIRST MODE AKK ACC DD1 DS1 SSA SSC OCC BC1 BC2 OCS DBC BOC BCS MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE6(NM6,NM6) - DATA CITABLE6(1:NM6, 1)/'AKK','ACC','DD1','DS1','SSA','SSC','OCS','BCS','BCS','OCS','DBC','BOC','BCS','MXX'/ ! AKK - DATA CITABLE6(1:NM6, 2)/'ACC','ACC','DD1','DS1','SSA','SSC','OCS','BCS','BCS','OCS','DBC','BOC','BCS','MXX'/ ! ACC - DATA CITABLE6(1:NM6, 3)/'DD1','DD1','DD1','DD1','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DD1 - DATA CITABLE6(1:NM6, 4)/'DS1','DS1','DD1','DS1','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','DBC','MXX'/ ! DS2 - DATA CITABLE6(1:NM6, 5)/'SSA','SSA','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE6(1:NM6, 6)/'SSC','SSC','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE6(1:NM6, 7)/'OCS','OCS','MXX','MXX','MXX','MXX','OCC','BOC','BOC','OCS','MXX','BOC','BOC','MXX'/ ! OCC - DATA CITABLE6(1:NM6, 8)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BC1','BC1','BOC','DBC','BOC','BCS','MXX'/ ! BC1 - DATA CITABLE6(1:NM6, 9)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BC1','BC2','BOC','DBC','BOC','BCS','MXX'/ ! BC2 - DATA CITABLE6(1:NM6,10)/'OCS','OCS','MXX','MXX','MXX','MXX','OCS','BOC','BOC','OCS','MXX','MXX','MXX','MXX'/ ! OCS - DATA CITABLE6(1:NM6,11)/'DBC','DBC','DBC','DBC','MXX','MXX','MXX','DBC','DBC','MXX','DBC','MXX','MXX','MXX'/ ! DBC - DATA CITABLE6(1:NM6,12)/'BOC','BOC','MXX','MXX','MXX','MXX','BOC','BOC','BOC','MXX','MXX','BOC','MXX','MXX'/ ! BOC - DATA CITABLE6(1:NM6,13)/'BCS','BCS','DBC','DBC','MXX','MXX','BOC','BCS','BCS','MXX','MXX','MXX','BCS','MXX'/ ! BCS - DATA CITABLE6(1:NM6,14)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 7. -! -! FIRST MODE AKK ACC DD1 DS1 SSA SSC OCC BC1 BC2 BOC MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE7(NM7,NM7) - DATA CITABLE7(1:NM7, 1)/'AKK','ACC','DD1','DS1','SSA','SSC','OCC','BC1','BC2','BOC','MXX'/ ! AKK - DATA CITABLE7(1:NM7, 2)/'ACC','ACC','DD1','DS1','SSA','SSC','OCC','BC1','BC2','BOC','MXX'/ ! ACC - DATA CITABLE7(1:NM7, 3)/'DD1','DD1','DD1','DD1','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DD1 - DATA CITABLE7(1:NM7, 4)/'DS1','DS1','DD1','DS1','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! DS1 - DATA CITABLE7(1:NM7, 5)/'SSA','SSA','MXX','MXX','SSA','SSC','MXX','MXX','MXX','MXX','MXX'/ ! SSA - DATA CITABLE7(1:NM7, 6)/'SSC','SSC','MXX','MXX','SSC','SSC','MXX','MXX','MXX','MXX','MXX'/ ! SSC - DATA CITABLE7(1:NM7, 7)/'OCC','OCC','MXX','MXX','MXX','MXX','OCC','BOC','BOC','BOC','MXX'/ ! OCC - DATA CITABLE7(1:NM7, 8)/'BC1','BC1','MXX','MXX','MXX','MXX','BOC','BC1','BC1','BOC','MXX'/ ! BC1 - DATA CITABLE7(1:NM7, 9)/'BC2','BC2','MXX','MXX','MXX','MXX','BOC','BC1','BC2','BOC','MXX'/ ! BC2 - DATA CITABLE7(1:NM7,10)/'BOC','BOC','MXX','MXX','MXX','MXX','BOC','BOC','BOC','BOC','MXX'/ ! BOC - DATA CITABLE7(1:NM7,11)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX -!------------------------------------------------------------------------------------------------------------------------- -! -! Mechanism 8. -! -! FIRST MODE ACC DD1 DS1 SSS OCC BC1 BC2 MXX SECOND -! MODE -!------------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=3) :: CITABLE8(NM8,NM8) - DATA CITABLE8(1:NM8, 1)/'ACC','DD1','DS1','SSS','OCC','BC1','BC2','MXX'/ ! ACC - DATA CITABLE8(1:NM8, 2)/'DD1','DD1','DD1','MXX','MXX','MXX','MXX','MXX'/ ! DD1 - DATA CITABLE8(1:NM8, 3)/'DS1','DD1','DS1','MXX','MXX','MXX','MXX','MXX'/ ! DS1 - DATA CITABLE8(1:NM8, 4)/'SSS','MXX','MXX','SSS','MXX','MXX','MXX','MXX'/ ! SSS - DATA CITABLE8(1:NM8, 5)/'OCC','MXX','MXX','MXX','OCC','MXX','MXX','MXX'/ ! OCC - DATA CITABLE8(1:NM8, 6)/'BC1','MXX','MXX','MXX','MXX','BC1','BC1','MXX'/ ! BC1 - DATA CITABLE8(1:NM8, 7)/'BC2','MXX','MXX','MXX','MXX','BC1','BC2','MXX'/ ! BC2 - DATA CITABLE8(1:NM8, 8)/'MXX','MXX','MXX','MXX','MXX','MXX','MXX','MXX'/ ! MXX - - END MODULE AERO_CONFIG -!------------------------------------------------------------------------------------------------------------------------- -! -! Information for the transported species for each mechanism. -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 1 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 DD2 1 SULF 14 MASS_DD2_SULF 14 -! 5 DD2 4 DUST 15 MASS_DD2_DUST 15 -! 5 DD2 1 NUMB 16 NUMB_DD2_1 16 -! 6 DS2 1 SULF 17 MASS_DS2_SULF 17 -! 6 DS2 4 DUST 18 MASS_DS2_DUST 18 -! 6 DS2 1 NUMB 19 NUMB_DS2_1 19 -! 7 SSA 1 SULF 20 MASS_SSA_SULF 20 -! 7 SSA 5 SEAS 21 MASS_SSA_SEAS 21 -! 7 SSA 1 NUMB 22 NUMB_SSA_1 -! 8 SSC 1 SULF 23 MASS_SSC_SULF -! 8 SSC 5 SEAS 24 MASS_SSC_SEAS 22 -! 8 SSC 1 NUMB 25 NUMB_SSC_1 -! 9 OCC 1 SULF 26 MASS_OCC_SULF 23 -! 9 OCC 3 OCAR 27 MASS_OCC_OCAR 24 -! 9 OCC 1 NUMB 28 NUMB_OCC_1 25 -! 10 BC1 1 SULF 29 MASS_BC1_SULF 26 -! 10 BC1 2 BCAR 30 MASS_BC1_BCAR 27 -! 10 BC1 1 NUMB 31 NUMB_BC1_1 28 -! 11 BC2 1 SULF 32 MASS_BC2_SULF 29 -! 11 BC2 2 BCAR 33 MASS_BC2_BCAR 30 -! 11 BC2 1 NUMB 34 NUMB_BC2_1 31 -! 12 BC3 1 SULF 35 MASS_BC3_SULF 32 -! 12 BC3 2 BCAR 36 MASS_BC3_BCAR 33 -! 12 BC3 1 NUMB 37 NUMB_BC3_1 34 -! 13 DBC 1 SULF 38 MASS_DBC_SULF 35 -! 13 DBC 2 BCAR 39 MASS_DBC_BCAR 36 -! 13 DBC 4 DUST 40 MASS_DBC_DUST 37 -! 13 DBC 1 NUMB 41 NUMB_DBC_1 38 -! 14 BOC 1 SULF 42 MASS_BOC_SULF 39 -! 14 BOC 2 BCAR 43 MASS_BOC_BCAR 40 -! 14 BOC 3 OCAR 44 MASS_BOC_OCAR 41 -! 14 BOC 1 NUMB 45 NUMB_BOC_1 42 -! 15 BCS 1 SULF 46 MASS_BCS_SULF 43 -! 15 BCS 2 BCAR 47 MASS_BCS_BCAR 44 -! 15 BCS 1 NUMB 48 NUMB_BCS_1 45 -! 16 MXX 1 SULF 49 MASS_MXX_SULF 46 -! 16 MXX 2 BCAR 50 MASS_MXX_BCAR 47 -! 16 MXX 3 OCAR 51 MASS_MXX_OCAR 48 -! 16 MXX 4 DUST 52 MASS_MXX_DUST 49 -! 16 MXX 5 SEAS 53 MASS_MXX_SEAS 50 -! 16 MXX 1 NUMB 54 NUMB_MXX_1 51 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! DD2 5 -! DS2 6 -! SSA 7 -! SSC 8 -! OCC 9 -! BC1 10 -! BC2 11 -! BC3 12 -! DBC 13 -! BOC 14 -! BCS 15 -! MXX 16 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 2 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 DD2 1 SULF 14 MASS_DD2_SULF 14 -! 5 DD2 4 DUST 15 MASS_DD2_DUST 15 -! 5 DD2 1 NUMB 16 NUMB_DD2_1 16 -! 6 DS2 1 SULF 17 MASS_DS2_SULF 17 -! 6 DS2 4 DUST 18 MASS_DS2_DUST 18 -! 6 DS2 1 NUMB 19 NUMB_DS2_1 19 -! 7 SSA 1 SULF 20 MASS_SSA_SULF 20 -! 7 SSA 5 SEAS 21 MASS_SSA_SEAS 21 -! 7 SSA 1 NUMB 22 NUMB_SSA_1 -! 8 SSC 1 SULF 23 MASS_SSC_SULF -! 8 SSC 5 SEAS 24 MASS_SSC_SEAS 22 -! 8 SSC 1 NUMB 25 NUMB_SSC_1 -! 9 OCC 1 SULF 26 MASS_OCC_SULF 23 -! 9 OCC 3 OCAR 27 MASS_OCC_OCAR 24 -! 9 OCC 1 NUMB 28 NUMB_OCC_1 25 -! 10 BC1 1 SULF 29 MASS_BC1_SULF 26 -! 10 BC1 2 BCAR 30 MASS_BC1_BCAR 27 -! 10 BC1 1 NUMB 31 NUMB_BC1_1 28 -! 11 BC2 1 SULF 32 MASS_BC2_SULF 29 -! 11 BC2 2 BCAR 33 MASS_BC2_BCAR 30 -! 11 BC2 1 NUMB 34 NUMB_BC2_1 31 -! 12 OCS 1 SULF 35 MASS_OCS_SULF 32 -! 12 OCS 3 OCAR 36 MASS_OCS_OCAR 33 -! 12 OCS 1 NUMB 37 NUMB_OCS_1 34 -! 13 DBC 1 SULF 38 MASS_DBC_SULF 35 -! 13 DBC 2 BCAR 39 MASS_DBC_BCAR 36 -! 13 DBC 4 DUST 40 MASS_DBC_DUST 37 -! 13 DBC 1 NUMB 41 NUMB_DBC_1 38 -! 14 BOC 1 SULF 42 MASS_BOC_SULF 39 -! 14 BOC 2 BCAR 43 MASS_BOC_BCAR 40 -! 14 BOC 3 OCAR 44 MASS_BOC_OCAR 41 -! 14 BOC 1 NUMB 45 NUMB_BOC_1 42 -! 15 BCS 1 SULF 46 MASS_BCS_SULF 43 -! 15 BCS 2 BCAR 47 MASS_BCS_BCAR 44 -! 15 BCS 1 NUMB 48 NUMB_BCS_1 45 -! 16 MXX 1 SULF 49 MASS_MXX_SULF 46 -! 16 MXX 2 BCAR 50 MASS_MXX_BCAR 47 -! 16 MXX 3 OCAR 51 MASS_MXX_OCAR 48 -! 16 MXX 4 DUST 52 MASS_MXX_DUST 49 -! 16 MXX 5 SEAS 53 MASS_MXX_SEAS 50 -! 16 MXX 1 NUMB 54 NUMB_MXX_1 51 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! DD2 5 -! DS2 6 -! SSA 7 -! SSC 8 -! OCC 9 -! BC1 10 -! BC2 11 -! DBC 13 -! BOC 14 -! BCS 15 -! OCS 12 -! MXX 16 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 3 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 DD2 1 SULF 14 MASS_DD2_SULF 14 -! 5 DD2 4 DUST 15 MASS_DD2_DUST 15 -! 5 DD2 1 NUMB 16 NUMB_DD2_1 16 -! 6 DS2 1 SULF 17 MASS_DS2_SULF 17 -! 6 DS2 4 DUST 18 MASS_DS2_DUST 18 -! 6 DS2 1 NUMB 19 NUMB_DS2_1 19 -! 7 SSA 1 SULF 20 MASS_SSA_SULF 20 -! 7 SSA 5 SEAS 21 MASS_SSA_SEAS 21 -! 7 SSA 1 NUMB 22 NUMB_SSA_1 -! 8 SSC 1 SULF 23 MASS_SSC_SULF -! 8 SSC 5 SEAS 24 MASS_SSC_SEAS 22 -! 8 SSC 1 NUMB 25 NUMB_SSC_1 -! 9 OCC 1 SULF 26 MASS_OCC_SULF 23 -! 9 OCC 3 OCAR 27 MASS_OCC_OCAR 24 -! 9 OCC 1 NUMB 28 NUMB_OCC_1 25 -! 10 BC1 1 SULF 29 MASS_BC1_SULF 26 -! 10 BC1 2 BCAR 30 MASS_BC1_BCAR 27 -! 10 BC1 1 NUMB 31 NUMB_BC1_1 28 -! 11 BC2 1 SULF 32 MASS_BC2_SULF 29 -! 11 BC2 2 BCAR 33 MASS_BC2_BCAR 30 -! 11 BC2 1 NUMB 34 NUMB_BC2_1 31 -! 12 BOC 1 SULF 35 MASS_BOC_SULF 32 -! 12 BOC 2 BCAR 36 MASS_BOC_BCAR 33 -! 12 BOC 3 OCAR 37 MASS_BOC_OCAR 34 -! 12 BOC 1 NUMB 38 NUMB_BOC_1 35 -! 13 MXX 1 SULF 39 MASS_MXX_SULF 36 -! 13 MXX 2 BCAR 40 MASS_MXX_BCAR 37 -! 13 MXX 3 OCAR 41 MASS_MXX_OCAR 38 -! 13 MXX 4 DUST 42 MASS_MXX_DUST 39 -! 13 MXX 5 SEAS 43 MASS_MXX_SEAS 40 -! 13 MXX 1 NUMB 44 NUMB_MXX_1 41 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! DD2 5 -! DS2 6 -! SSA 7 -! SSC 8 -! OCC 9 -! BC1 10 -! BC2 11 -! BOC 12 -! MXX 13 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 4 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 ACC 1 SULF 4 MASS_ACC_SULF 4 -! 1 ACC 1 NUMB 5 NUMB_ACC_1 5 -! 2 DD1 1 SULF 6 MASS_DD1_SULF 6 -! 2 DD1 4 DUST 7 MASS_DD1_DUST 7 -! 2 DD1 1 NUMB 8 NUMB_DD1_1 8 -! 3 DS1 1 SULF 9 MASS_DS1_SULF 9 -! 3 DS1 4 DUST 10 MASS_DS1_DUST 10 -! 3 DS1 1 NUMB 11 NUMB_DS1_1 11 -! 4 DD2 1 SULF 12 MASS_DD2_SULF 12 -! 4 DD2 4 DUST 13 MASS_DD2_DUST 13 -! 4 DD2 1 NUMB 14 NUMB_DD2_1 14 -! 5 DS2 1 SULF 15 MASS_DS2_SULF 15 -! 5 DS2 4 DUST 16 MASS_DS2_DUST 16 -! 5 DS2 1 NUMB 17 NUMB_DS2_1 17 -! 6 SSS 1 SULF 18 MASS_SSS_SULF 18 -! 6 SSS 5 SEAS 19 MASS_SSS_SEAS 19 -! 6 SSS 1 NUMB 20 NUMB_SSS_1 -! 7 OCC 1 SULF 21 MASS_OCC_SULF 20 -! 7 OCC 3 OCAR 22 MASS_OCC_OCAR 21 -! 7 OCC 1 NUMB 23 NUMB_OCC_1 22 -! 8 BC1 1 SULF 24 MASS_BC1_SULF 23 -! 8 BC1 2 BCAR 25 MASS_BC1_BCAR 24 -! 8 BC1 1 NUMB 26 NUMB_BC1_1 25 -! 9 BC2 1 SULF 27 MASS_BC2_SULF 26 -! 9 BC2 2 BCAR 28 MASS_BC2_BCAR 27 -! 9 BC2 1 NUMB 29 NUMB_BC2_1 28 -! 10 MXX 1 SULF 30 MASS_MXX_SULF 29 -! 10 MXX 2 BCAR 31 MASS_MXX_BCAR 30 -! 10 MXX 3 OCAR 32 MASS_MXX_OCAR 31 -! 10 MXX 4 DUST 33 MASS_MXX_DUST 32 -! 10 MXX 5 SEAS 34 MASS_MXX_SEAS 33 -! 10 MXX 1 NUMB 35 NUMB_MXX_1 34 -! -!MODE_NAME MODE NUMBER -! -! ACC 1 -! DD1 2 -! DS1 3 -! DD2 4 -! DS2 5 -! SSS 6 -! OCC 7 -! BC1 8 -! BC2 9 -! MXX 10 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 5 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 SSA 1 SULF 14 MASS_SSA_SULF 14 -! 5 SSA 5 SEAS 15 MASS_SSA_SEAS 15 -! 5 SSA 1 NUMB 16 NUMB_SSA_1 -! 6 SSC 1 SULF 17 MASS_SSC_SULF -! 6 SSC 5 SEAS 18 MASS_SSC_SEAS 16 -! 6 SSC 1 NUMB 19 NUMB_SSC_1 -! 7 OCC 1 SULF 20 MASS_OCC_SULF 17 -! 7 OCC 3 OCAR 21 MASS_OCC_OCAR 18 -! 7 OCC 1 NUMB 22 NUMB_OCC_1 19 -! 8 BC1 1 SULF 23 MASS_BC1_SULF 20 -! 8 BC1 2 BCAR 24 MASS_BC1_BCAR 21 -! 8 BC1 1 NUMB 25 NUMB_BC1_1 22 -! 9 BC2 1 SULF 26 MASS_BC2_SULF 23 -! 9 BC2 2 BCAR 27 MASS_BC2_BCAR 24 -! 9 BC2 1 NUMB 28 NUMB_BC2_1 25 -! 10 BC3 1 SULF 29 MASS_BC3_SULF 26 -! 10 BC3 2 BCAR 30 MASS_BC3_BCAR 27 -! 10 BC3 1 NUMB 31 NUMB_BC3_1 28 -! 11 DBC 1 SULF 32 MASS_DBC_SULF 29 -! 11 DBC 2 BCAR 33 MASS_DBC_BCAR 30 -! 11 DBC 4 DUST 34 MASS_DBC_DUST 31 -! 11 DBC 1 NUMB 35 NUMB_DBC_1 32 -! 12 BOC 1 SULF 36 MASS_BOC_SULF 33 -! 12 BOC 2 BCAR 37 MASS_BOC_BCAR 34 -! 12 BOC 3 OCAR 38 MASS_BOC_OCAR 35 -! 12 BOC 1 NUMB 39 NUMB_BOC_1 36 -! 13 BCS 1 SULF 40 MASS_BCS_SULF 37 -! 13 BCS 2 BCAR 41 MASS_BCS_BCAR 38 -! 13 BCS 1 NUMB 42 NUMB_BCS_1 39 -! 14 MXX 1 SULF 43 MASS_MXX_SULF 40 -! 14 MXX 2 BCAR 44 MASS_MXX_BCAR 41 -! 14 MXX 3 OCAR 45 MASS_MXX_OCAR 42 -! 14 MXX 4 DUST 46 MASS_MXX_DUST 43 -! 14 MXX 5 SEAS 47 MASS_MXX_SEAS 44 -! 14 MXX 1 NUMB 48 NUMB_MXX_1 45 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! SSA 5 -! SSC 6 -! OCC 7 -! BC1 8 -! BC2 9 -! BC3 10 -! DBC 11 -! BOC 12 -! BCS 13 -! MXX 14 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 6 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 SSA 1 SULF 14 MASS_SSA_SULF 14 -! 5 SSA 5 SEAS 15 MASS_SSA_SEAS 15 -! 5 SSA 1 NUMB 16 NUMB_SSA_1 -! 6 SSC 1 SULF 17 MASS_SSC_SULF -! 6 SSC 5 SEAS 18 MASS_SSC_SEAS 16 -! 6 SSC 1 NUMB 19 NUMB_SSC_1 -! 7 OCC 1 SULF 20 MASS_OCC_SULF 17 -! 7 OCC 3 OCAR 21 MASS_OCC_OCAR 18 -! 7 OCC 1 NUMB 22 NUMB_OCC_1 19 -! 8 BC1 1 SULF 23 MASS_BC1_SULF 20 -! 8 BC1 2 BCAR 24 MASS_BC1_BCAR 21 -! 8 BC1 1 NUMB 25 NUMB_BC1_1 22 -! 9 BC2 1 SULF 26 MASS_BC2_SULF 23 -! 9 BC2 2 BCAR 27 MASS_BC2_BCAR 24 -! 9 BC2 1 NUMB 28 NUMB_BC2_1 25 -! 10 OCS 1 SULF 29 MASS_OCS_SULF 26 -! 10 OCS 3 OCAR 30 MASS_OCS_OCAR 27 -! 10 OCS 1 NUMB 31 NUMB_OCS_1 28 -! 11 DBC 1 SULF 32 MASS_DBC_SULF 29 -! 11 DBC 2 BCAR 33 MASS_DBC_BCAR 30 -! 11 DBC 4 DUST 34 MASS_DBC_DUST 31 -! 11 DBC 1 NUMB 35 NUMB_DBC_1 32 -! 12 BOC 1 SULF 36 MASS_BOC_SULF 33 -! 12 BOC 2 BCAR 37 MASS_BOC_BCAR 34 -! 12 BOC 3 OCAR 38 MASS_BOC_OCAR 35 -! 12 BOC 1 NUMB 39 NUMB_BOC_1 36 -! 13 BCS 1 SULF 40 MASS_BCS_SULF 37 -! 13 BCS 2 BCAR 41 MASS_BCS_BCAR 38 -! 13 BCS 1 NUMB 42 NUMB_BCS_1 39 -! 14 MXX 1 SULF 43 MASS_MXX_SULF 40 -! 14 MXX 2 BCAR 44 MASS_MXX_BCAR 41 -! 14 MXX 3 OCAR 45 MASS_MXX_OCAR 42 -! 14 MXX 4 DUST 46 MASS_MXX_DUST 43 -! 14 MXX 5 SEAS 47 MASS_MXX_SEAS 44 -! 14 MXX 1 NUMB 48 NUMB_MXX_1 45 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! SSA 5 -! SSC 6 -! OCC 7 -! BC1 8 -! BC2 9 -! DBC 11 -! BOC 12 -! BCS 13 -! OCS 10 -! MXX 14 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 7 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 AKK 1 SULF 4 MASS_AKK_SULF 4 -! 1 AKK 1 NUMB 5 NUMB_AKK_1 5 -! 2 ACC 1 SULF 6 MASS_ACC_SULF 6 -! 2 ACC 1 NUMB 7 NUMB_ACC_1 7 -! 3 DD1 1 SULF 8 MASS_DD1_SULF 8 -! 3 DD1 4 DUST 9 MASS_DD1_DUST 9 -! 3 DD1 1 NUMB 10 NUMB_DD1_1 10 -! 4 DS1 1 SULF 11 MASS_DS1_SULF 11 -! 4 DS1 4 DUST 12 MASS_DS1_DUST 12 -! 4 DS1 1 NUMB 13 NUMB_DS1_1 13 -! 5 SSA 1 SULF 14 MASS_SSA_SULF 14 -! 5 SSA 5 SEAS 15 MASS_SSA_SEAS 15 -! 5 SSA 1 NUMB 16 NUMB_SSA_1 -! 6 SSC 1 SULF 17 MASS_SSC_SULF -! 6 SSC 5 SEAS 18 MASS_SSC_SEAS 16 -! 6 SSC 1 NUMB 19 NUMB_SSC_1 -! 7 OCC 1 SULF 20 MASS_OCC_SULF 17 -! 7 OCC 3 OCAR 21 MASS_OCC_OCAR 18 -! 7 OCC 1 NUMB 22 NUMB_OCC_1 19 -! 8 BC1 1 SULF 23 MASS_BC1_SULF 20 -! 8 BC1 2 BCAR 24 MASS_BC1_BCAR 21 -! 8 BC1 1 NUMB 25 NUMB_BC1_1 22 -! 9 BC2 1 SULF 26 MASS_BC2_SULF 23 -! 9 BC2 2 BCAR 27 MASS_BC2_BCAR 24 -! 9 BC2 1 NUMB 28 NUMB_BC2_1 25 -! 10 BOC 1 SULF 29 MASS_BOC_SULF 26 -! 10 BOC 2 BCAR 30 MASS_BOC_BCAR 27 -! 10 BOC 3 OCAR 31 MASS_BOC_OCAR 28 -! 10 BOC 1 NUMB 32 NUMB_BOC_1 29 -! 11 MXX 1 SULF 33 MASS_MXX_SULF 30 -! 11 MXX 2 BCAR 34 MASS_MXX_BCAR 31 -! 11 MXX 3 OCAR 35 MASS_MXX_OCAR 32 -! 11 MXX 4 DUST 36 MASS_MXX_DUST 33 -! 11 MXX 5 SEAS 37 MASS_MXX_SEAS 34 -! 11 MXX 1 NUMB 38 NUMB_MXX_1 35 -! -!MODE_NAME MODE NUMBER -! -! AKK 1 -! ACC 2 -! DD1 3 -! DS1 4 -! SSA 5 -! SSC 6 -! OCC 7 -! BC1 8 -! BC2 9 -! BOC 10 -! MXX 11 -! -!------------------------------------------------------------------------------------------------------------------------- -!MECHANISM 8 -!------------------------------------------------------------------------------------------------------------------------- -! -!MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO AERO_SPCS TRACER NUMBER -! -! 0 NO3 0 ANO3 1 MASS_NO3 1 -! 0 NH4 0 ANH4 2 MASS_NH4 2 -! 0 H2O 0 AH2O 3 MASS_H2O 3 -! 1 ACC 1 SULF 4 MASS_ACC_SULF 4 -! 1 ACC 1 NUMB 5 NUMB_ACC_1 5 -! 2 DD1 1 SULF 6 MASS_DD1_SULF 6 -! 2 DD1 4 DUST 7 MASS_DD1_DUST 7 -! 2 DD1 1 NUMB 8 NUMB_DD1_1 8 -! 3 DS1 1 SULF 9 MASS_DS1_SULF 9 -! 3 DS1 4 DUST 10 MASS_DS1_DUST 10 -! 3 DS1 1 NUMB 11 NUMB_DS1_1 11 -! 4 SSS 1 SULF 12 MASS_SSS_SULF 12 -! 4 SSS 5 SEAS 13 MASS_SSS_SEAS 13 -! 4 SSS 1 NUMB 14 NUMB_SSS_1 -! 5 OCC 1 SULF 15 MASS_OCC_SULF 14 -! 5 OCC 3 OCAR 16 MASS_OCC_OCAR 15 -! 5 OCC 1 NUMB 17 NUMB_OCC_1 16 -! 6 BC1 1 SULF 18 MASS_BC1_SULF 17 -! 6 BC1 2 BCAR 19 MASS_BC1_BCAR 18 -! 6 BC1 1 NUMB 20 NUMB_BC1_1 19 -! 7 BC2 1 SULF 21 MASS_BC2_SULF 20 -! 7 BC2 2 BCAR 22 MASS_BC2_BCAR 21 -! 7 BC2 1 NUMB 23 NUMB_BC2_1 22 -! 8 MXX 1 SULF 24 MASS_MXX_SULF 23 -! 8 MXX 2 BCAR 25 MASS_MXX_BCAR 24 -! 8 MXX 3 OCAR 26 MASS_MXX_OCAR 25 -! 8 MXX 4 DUST 27 MASS_MXX_DUST 26 -! 8 MXX 5 SEAS 28 MASS_MXX_SEAS 27 -! 8 MXX 1 NUMB 29 NUMB_MXX_1 28 -! -!MODE_NAME MODE NUMBER -! -! ACC 1 -! DD1 2 -! DS1 3 -! SSS 4 -! OCC 5 -! BC1 6 -! BC2 7 -! MXX 8 -!------------------------------------------------------------------------------------------------------------------------- - - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_depv.F b/MATRIXchem_GridComp/microphysics/TRAMP_depv.F deleted file mode 100644 index 2039987f..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_depv.F +++ /dev/null @@ -1,180 +0,0 @@ - MODULE AERO_DEPV - USE AERO_PARAM, ONLY: NLAYS, IXXX, IYYY, ILAY - USE AERO_CONFIG, ONLY: NMODES - USE AMP_AEROSOL, ONLY: VDDEP_AERO -!------------------------------------------------------------------------------------------------------------------------- -! The array VDDEP_AERO(X,Y,Z,I,1) contains current values for the dry deposition velocities -! for aerosol number concentrations for mode I. -! The array VDDEP_AERO(X,Y,Z,I,2) contains current values for the dry deposition velocities -! for aerosol mass concentrations for mode I. -! Values in VDDEP_AERO are saved in subr. MATRIX at each time step. -!------------------------------------------------------------------------------------------------------------------------- - - CONTAINS - - - SUBROUTINE GET_AERO_DEPV(N,TK,RHOA,XLM,AMU,WSTAR,USTAR,RA,DGN_DDEP,XLS_DDEP,DEN_DDEP) -!---------------------------------------------------------------------------------------------------------------------- -! Calculate deposition velocity for Aitken, accumulation, and coarse modes. -! Reference: Binkowski F. S., and U. Shankar, The regional particulate model -! 1. Model description and preliminary results. J. Geophys. Res., 100, D12, 26191-26209, 1995. -! -! 12-18-06, DLW: Derived from the CMAQ routine aero_depv.f originally coded by F. S. Binkowski. :: -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - INTEGER :: N ! number of modes [1] - REAL(8) :: TK ! air temperature [K] - REAL(8) :: RHOA ! air density [kg/m^3] - REAL(8) :: XLM ! atmospheric mean free path [m] - REAL(8) :: AMU ! atmospheric dynamic viscosity [kg/(m s)] - REAL(8) :: WSTAR ! convective velocity scale [m/s] - REAL(8) :: USTAR ! friction velocity [m/s] - REAL(8) :: RA ! aerodynamic resistance [s/m] - REAL(8) :: DGN_DDEP(N) ! geo. mean diameter for each mode [um] - REAL(8) :: XLS_DDEP(N) ! ln(geo. std. dev.) for each mode [1] - REAL(8) :: DEN_DDEP(N) ! avg. particle density for each mode [g/cm^3] - - ! Local variables. - - INTEGER :: I - REAL(8) :: DGN_M ! geo. mean diameter [m] - REAL(8) :: DEN_KGM3 ! avg. particle density [kg/m^3] - REAL(8) :: VDEP(2) ! deposition velocities [m/s] - - - DO I=1, N - DGN_M = DGN_DDEP(I) * 1.0D-06 ! convert from [um] to [m] - DEN_KGM3 = DEN_DDEP(I) * 1.0D+03 ! convert from [g/cm^3] to [kg/m^3] - CALL GETDEP_V( TK, RHOA, XLM, AMU, WSTAR, USTAR, RA, DGN_M, XLS_DDEP(I), DEN_KGM3, VDEP ) -! VDEP(:) = MIN( VDEP(:), 10.0D+00 ) ! cap at 10 [m/s] = 1000 [cm/s]; should have no effect - VDDEP_AERO(IXXX,IYYY,I,1) = VDEP(1) ! for deposition of number [m/s] - VDDEP_AERO(IXXX,IYYY,I,2) = VDEP(2) ! for deposition of mass [m/s] - ENDDO - - RETURN - END SUBROUTINE GET_AERO_DEPV - - - SUBROUTINE GETDEP_V( BLKTA, BLKDENS, XLM, AMU, BLKWSTAR, BLKUSTAR, BLKRA, DGACC, XXLSGAC, PDENSAC, VDEP ) -!---------------------------------------------------------------------------------------------------------------------- -! Calculate deposition velocity for Aitken, accumulation, and coarse modes. -! Reference: Binkowski F. S., and U. Shankar, The regional particulate model -! 1. Model description and preliminary results. J. Geophys. Res., 100, D12, 26191-26209, 1995. -! -! 12-18-06, DLW: Derived from the CMAQ routine aero_depv.f originally coded by F. S. Binkowski. :: -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: BLKTA ! air temperature [K] - REAL(8) :: BLKDENS ! air density [kg/m^3] - REAL(8) :: XLM ! atmospheric mean free path [m] - REAL(8) :: AMU ! atmospheric dynamic viscosity [kg/(m s)] - REAL(8) :: BLKWSTAR ! convective velocity scale [m/s] - REAL(8) :: BLKUSTAR ! friction velocity [m/s] - REAL(8) :: BLKRA ! aerodynamic resistance [s/m] - REAL(8) :: DGACC ! geo. mean diamter [m] - REAL(8) :: XXLSGAC ! ln(geo. std. dev.) [1] - REAL(8) :: PDENSAC ! average particle density [kg/m^3] - REAL(8) :: VDEP(2) ! deposition velocity [ m/s ] - - ! Local variables. - - REAL(8) :: KNACC ! Modal Knudsen [1] - REAL(8) :: DCHAT0A ! Modal particle diffusivity for number [m^2/s] - REAL(8) :: DCHAT3A ! Modal particle diffusivity for mass [m^2/s] - REAL(8) :: VGHAT0A ! Modal sedimentation velocity for number [m/s] - REAL(8) :: VGHAT3A ! Modal sedimentation velocity for mass [m/s] - REAL(8) :: DCONST1, DCONST1A - REAL(8) :: DCONST2, DCONST3A - REAL(8) :: SC0A ! Schmidt numbers for number - REAL(8) :: SC3A ! Schmidt numbers for 3rd moment - REAL(8) :: ST0A ! Stokes numbers for number - REAL(8) :: ST3A ! Stokes numbers for 3rd moment - REAL(8) :: RD0A ! canopy resistance for number - REAL(8) :: RD3A ! canopy resisteance for 3rd moment - REAL(8) :: UTSCALE ! scratch function of USTAR and WSTAR - REAL(8) :: NU ! kinematic viscosity [ m**2 s**-1 ] - REAL(8) :: USTFAC ! scratch function of USTAR, NU, and GRAV - - REAL(8), PARAMETER :: BHAT = 1.246D+00 ! Constant from Cunningham slip correction - REAL(8), PARAMETER :: PI = 3.141592653589793D+00 - REAL(8), PARAMETER :: PI6 = PI / 6.0D+00 - REAL(8), PARAMETER :: THREEPI = 3.0D+00 * PI - REAL(8), PARAMETER :: ONE3 = 1.0D+00 / 3.0D+00 - REAL(8), PARAMETER :: TWO3 = 2.0D+00 / 3.0D+00 - REAL(8), PARAMETER :: AVO = 6.0221367D+23 ! Avogadro's Constant [1/mol] - REAL(8), PARAMETER :: RGASUNIV = 8.314510D+00 ! universal gas const [J/mol/K] - REAL(8), PARAMETER :: BOLTZ = RGASUNIV / AVO ! Boltzmann's Constant [J/K] - !---------------------------------------------------------------------------------------------------------------- - ! Value is the mean of polar and equatorial values. CRC Handbook (76th Ed) page 14-6. (FSB) - !---------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: GRAV = 9.80622D+00 ! mean gravitational accel [m/s^2] - REAL(8), PARAMETER :: DGACC_MAX = 1.0D-06 ! 1.0 um, min. value for elimination of impaction term [m] - REAL(8), PARAMETER :: XXLSGAC_MAX = 0.6931472D+00 ! ln(2), min. value for elimination of impaction term [1] - - ! Scratch variables for standard deviations. - - REAL(8) :: L2SGAC - REAL(8) :: EAC1 - REAL(8) :: ESAC04 - REAL(8) :: ESAC08 - REAL(8) :: ESAC16 - REAL(8) :: ESAC20 - REAL(8) :: ESAC28 - REAL(8) :: ESAC32 - REAL(8) :: ESAC64 - - - KNACC = 2.0D+00 * XLM / DGACC - L2SGAC = XXLSGAC * XXLSGAC - EAC1 = EXP( 0.125D+00 * L2SGAC ) - ESAC04 = EAC1**4 - ESAC08 = ESAC04 * ESAC04 - ESAC16 = ESAC08 * ESAC08 - ESAC20 = ESAC16 * ESAC04 - ESAC28 = ESAC20 * ESAC08 - ESAC32 = ESAC16 * ESAC16 - ESAC64 = ESAC32 * ESAC32 - - DCONST1 = BOLTZ * BLKTA / ( THREEPI * AMU ) - DCONST1A = DCONST1 / DGACC - DCONST2 = GRAV / ( 18.0D+00 * AMU ) - DCONST3A = DCONST2 * PDENSAC * DGACC*DGACC - - DCHAT0A = DCONST1A * ( ESAC04 + BHAT * KNACC * ESAC16 ) - DCHAT3A = DCONST1A * ( ( 1.0D+00 / ESAC20 ) + BHAT * KNACC / ESAC32 ) - VGHAT0A = DCONST3A * ( ESAC16 + BHAT * KNACC * ESAC04 ) - VGHAT3A = DCONST3A * ( ESAC64 + BHAT * KNACC * ESAC28 ) - - NU = AMU / BLKDENS - USTFAC = BLKUSTAR * BLKUSTAR / ( GRAV * NU ) - UTSCALE = BLKUSTAR + 0.24D+00 * BLKWSTAR * BLKWSTAR / BLKUSTAR - - SC0A = NU / DCHAT0A - ST0A = MAX ( VGHAT0A * USTFAC, 0.01D+00 ) - IF( DGACC .LT. DGACC_MAX ) THEN ! Not a coarse mode ... - RD0A = 1.0D+00 / ( UTSCALE * ( SC0A**( -TWO3 ) + 10.0**( -3.0D+00 / ST0A ) ) ) - ELSE - RD0A = 1.0D+00 / ( UTSCALE * ( SC0A**( -TWO3 ) ) ) ! Eliminate impaction term for coarse modes as in CMAQ. - ENDIF - VDEP(1) = VGHAT0A + 1.0D+00 / ( BLKRA + RD0A + RD0A * BLKRA * VGHAT0A ) ! For deposition of number. - - SC3A = NU / DCHAT3A - ST3A = MAX( VGHAT3A * USTFAC , 0.01D+00 ) - IF( DGACC .LT. DGACC_MAX ) THEN ! Not a coarse mode ... - RD3A = 1.0D+00 / ( UTSCALE * ( SC3A**( -TWO3 ) + 10.0**( -3.0D+00 / ST3A ) ) ) - ELSE - RD3A = 1.0D+00 / ( UTSCALE * ( SC3A**( -TWO3 ) ) ) ! Eliminate impaction term for coarse modes as in CMAQ. - ENDIF - VDEP(2) = VGHAT3A + 1.0D+00 / ( BLKRA + RD3A + RD3A * BLKRA * VGHAT3A ) ! For deposition of mass. - - RETURN - END SUBROUTINE GETDEP_V - - - END MODULE AERO_DEPV diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_diam.F b/MATRIXchem_GridComp/microphysics/TRAMP_diam.F deleted file mode 100644 index 515378e7..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_diam.F +++ /dev/null @@ -1,129 +0,0 @@ - MODULE AERO_DIAM - USE AERO_PARAM, ONLY: NLAYS, AUNIT1, WRITE_LOG - USE AERO_CONFIG, ONLY: NMODES, MECH - USE AERO_SETUP, ONLY: N_DP_CONDTABLE, DP_CONDTABLE, MODE_NAME - USE AMP_AEROSOL, ONLY: DIAM -!------------------------------------------------------------------------------------------------------------------------- -! The array DIAM(x,y,z) contains current values of some measure of average ambient mode diameter for each mode -! for use outside of the MATRIX microphysical module where it is calculated. -! Values in DIAM are saved at the top of the subr. MATRIX before microphysical evolution -! for the current time step is done. -! -! The current measure of particle diameter is the diameter of average mass: -! -! DIAM(x,y,z) = [ (6/pi) * (Mi/Ni) * (1/D) ]^(1/3) -! -! with Mi the total mass concentration (including water) in mode i, Ni the number concentration in mode i, and -! D is the particle density. -!------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - REAL(8) :: DIAM_HISTOGRAM(NMODES,N_DP_CONDTABLE,2) ! [1] - - CONTAINS - - SUBROUTINE SETUP_DIAM -!------------------------------------------------------------------------------------------------------------------------- -!@sum Routine to initialize DIAM before model time stepping is begun. -!@+ This routine should be called only once. -!@+ The diameter of average mass is the cube root of the normalized third diameter moment: (M3/M0)**(1/3) = Dg*Sg**3 -!@auth Susanne Bauer/Doug Wright -!------------------------------------------------------------------------------------------------------------------------- - USE AERO_SETUP, ONLY: DGN0, SIG0 - INTEGER :: I - REAL(8) :: SG, D_NUMBER_MEAN - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A/)') 'I,DGN0(I),SIG0(I),SG,DIAM(1,1,1,I)*1.0D+06,D_NUMBER_MEAN' - DO I=1, NMODES - SG = EXP( 0.5d+00*( LOG(SIG0(I)) )**2 ) - DIAM(:,:,:,I) = 1.0D-06 * DGN0(I)*SG**3 ! convert from [um] to [m] - D_NUMBER_MEAN = DGN0(I)*SG - IF( WRITE_LOG ) WRITE(AUNIT1,90) I,DGN0(I),SIG0(I),SG,DIAM(1,1,1,I)*1.0D+06,D_NUMBER_MEAN - ENDDO - WRITE(AUNIT1,'(A)') ' ' - - ! Zero histogram for DIAM values. - - DIAM_HISTOGRAM(:,:,:) = 0.0D+00 - -90 FORMAT(I5,6F12.5) - RETURN - END SUBROUTINE SETUP_DIAM - - - SUBROUTINE WRITE_DIAM_HISTOGRAM -!------------------------------------------------------------------------------------------------------------------------- -! Call this routine at the end of all time stepping. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER :: I, N - INTEGER, PARAMETER :: OUTUNIT = 93 - INTEGER, PARAMETER :: NBINSSUM = 5 - REAL(8) :: SUM_HIST(NMODES),SUM_HIST_DRY(NMODES),D,F16,F18,F20 - - SELECT CASE( MECH ) - CASE( 1 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech1_diam_histogram.plt') - CASE( 2 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech2_diam_histogram.plt') - CASE( 3 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech3_diam_histogram.plt') - CASE( 4 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech4_diam_histogram.plt') - CASE( 5 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech5_diam_histogram.plt') - CASE( 6 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech6_diam_histogram.plt') - CASE( 7 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech7_diam_histogram.plt') - CASE( 8 ) - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mech8_diam_histogram.plt') - CASE DEFAULT - OPEN(OUTUNIT,STATUS='REPLACE',FILE='mechx_diam_histogram.plt') - END SELECT - - !------------------------------------------------------------------------------------------------------------------- - ! F16, F18, and F20 convert the diameter of average mass (D) to the number mean diameter for - ! geometric standard deviations of 1.6, 1.8, and 2.0, respectively. - !------------------------------------------------------------------------------------------------------------------- - F16 = 1.0D+00 / ( EXP( ( LOG(1.6D+00) )**2 ) ) - F18 = 1.0D+00 / ( EXP( ( LOG(1.8D+00) )**2 ) ) - F20 = 1.0D+00 / ( EXP( ( LOG(2.0D+00) )**2 ) ) - - !------------------------------------------------------------------------------------------------------------------- - ! For each mode, normalize the histogram to unity. - !------------------------------------------------------------------------------------------------------------------- - DO I=1, NMODES - SUM_HIST(I) = 0.0D+00 - DO N=1, N_DP_CONDTABLE - SUM_HIST(I) = SUM_HIST(I) + DIAM_HISTOGRAM(I,N,1) - ENDDO - DIAM_HISTOGRAM(I,:,1) = DIAM_HISTOGRAM(I,:,1) / ( SUM_HIST(I) + 1.0D-30 ) - DIAM_HISTOGRAM(I,:,2) = DIAM_HISTOGRAM(I,:,2) / ( SUM_HIST(I) + 1.0D-30 ) - WRITE(OUTUNIT,'(A,I3,1X,A,F15.1)') 'Total count for mode I = ',I,' is ', SUM_HIST(I) - ENDDO - - WRITE(OUTUNIT,91) ' DAM',' DNM16',' DNM18',' DNM20', - & ' DGN16',' DGN18',' DGN20',MODE_NAME(:),MODE_NAME(:) - SUM_HIST (:) = 0.0D+00 - SUM_HIST_DRY(:) = 0.0D+00 - D = 1.0D+00 - N = 0 - DO I=1, N_DP_CONDTABLE - SUM_HIST (1:NMODES) = SUM_HIST (1:NMODES) + DIAM_HISTOGRAM(1:NMODES,I,1) + 1.0D-20 - SUM_HIST_DRY(1:NMODES) = SUM_HIST_DRY(1:NMODES) + DIAM_HISTOGRAM(1:NMODES,I,2) + 1.0D-20 - D = D*DP_CONDTABLE(I) - IF( MOD( I, NBINSSUM ) .EQ. 0 ) THEN - N = N + 1 - D = 1.0D+06 * D**(1.0D+00/REAL(NBINSSUM)) - WRITE(OUTUNIT,90)N,I,D,D*F16,D*F18,D*F20,D*F16**1.5,D*F18**1.5,D*F20**1.5,SUM_HIST(1:NMODES),SUM_HIST_DRY(1:NMODES) - SUM_HIST (:) = 0.0D+00 - SUM_HIST_DRY(:) = 0.0D+00 - D = 1.0D+00 - ENDIF - ENDDO - CLOSE(OUTUNIT) -90 FORMAT(2I5,7F12.7,32F14.10) -91 FORMAT(10X,7A12,32A14) - RETURN - END SUBROUTINE WRITE_DIAM_HISTOGRAM - - END MODULE AERO_DIAM - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_dicrete.F b/MATRIXchem_GridComp/microphysics/TRAMP_dicrete.F deleted file mode 100644 index 0c15b825..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_dicrete.F +++ /dev/null @@ -1,635 +0,0 @@ - MODULE AERO_DISCRETE - USE AERO_PARAM, ONLY: DENSP, PI6 - USE AERO_COAG, ONLY: TOTAL_COAG_COEF, BROWNIAN_COAG_COEF - IMPLICIT NONE - INTEGER, PARAMETER :: NBINS = 200 - INTEGER, PARAMETER :: NSPCS = 2 - REAL(8) :: APDF(NBINS,1+NSPCS) ! mode A: number conc. [#/m^3] and mass concs. [ug/m^3] for each bin. - REAL(8) :: BPDF(NBINS,1+NSPCS) ! mode B: number conc. [#/m^3] and mass concs. [ug/m^3] for each bin. - REAL(8) :: CPDF(NBINS,1+NSPCS) ! mode C: number conc. [#/m^3] and mass concs. [ug/m^3] for each bin. - REAL(8) :: DGRID(NBINS) ! fixed diameter grid [um] - REAL(8) :: VGRID(NBINS) ! fixed volume/particle grid [um^3/particle] - REAL(8) :: MGRID(NBINS) ! fixed mass/particle grid [ug/particle] - REAL(8) :: D3GRID(NBINS) ! fixed diameter-cubed grid [um^3/particle] - REAL(8) :: DLOWER(NBINS) ! lower boundary fixed diameter grid [um] - REAL(8) :: DUPPER(NBINS) ! upper boundary fixed diameter grid [um] - REAL(8), PARAMETER :: DMIN = 0.001D+00 ! smallest particle diameter of the discrete grid [um] - REAL(8), PARAMETER :: DMAX = 20.000D+00 ! largest particle diameter of the discrete grid [um] - REAL(8), SAVE :: RDMIN = 0.000D+00 ! reciprocal of DMIN to optimize coagulation [1/um] - REAL(8), SAVE :: RDLOGDSC = 0.000D+00 ! reciprocal of log10 of the grid spacing [1] - REAL(8), PARAMETER :: XKB = 1.3806505D-23 ! [J/K] http://en.wikipedia.org/wiki/Boltzmann_constant - !----------------------------------------------------------------------------------------------------------------- - ! ISPCA, ISPCB, ISPCC: 1=SULF, 2=BCAR, 3=OCAR, 4=DUST, 5=SEAS - !----------------------------------------------------------------------------------------------------------------- - INTEGER, SAVE :: ISPCA ! index of the chemical species for mode A: set in AERO_INIT - INTEGER, SAVE :: ISPCB ! index of the chemical species for mode B: set in AERO_INIT - INTEGER, SAVE :: ISPCC ! index of the chemical species for mode C: set in AERO_INIT - INTEGER, PARAMETER :: ITCOAG = 10 ! number of subdivisions of the time step for integration of coagulation - REAL(8) :: DTCOAG = 0.0D+00 - REAL(8) :: KIJ_DISCRETE(NBINS,NBINS) ! fixed coagulation coefficients for the discrete grid [m^3/s/particle] - REAL(8) :: FRAC_LO (NBINS,NBINS) ! used in DISCRETE_INTRACOAG [1] - REAL(8) :: FRAC_HI (NBINS,NBINS) ! used in DISCRETE_INTRACOAG [1] - INTEGER :: NLO_GRID(NBINS,NBINS) ! used in DISCRETE_INTRACOAG [1] - INTEGER :: NHI_GRID(NBINS,NBINS) ! used in DISCRETE_INTRACOAG [1] - - - CONTAINS - - - SUBROUTINE DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) -!----------------------------------------------------------------------------------------------------------------------- -!@auth Susanne Bauer/Doug Wright -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - INTEGER, INTENT( IN) :: ICSET ! identifies test case [1] - REAL(8), INTENT( IN) :: NA, NB, NC ! number concentrations for modes A, B, and C [#/m^3] - REAL(8), INTENT( IN) :: DGA, DGB, DGC ! geo. mean diameters for modes A, B, and C [um] - REAL(8), INTENT( IN) :: SIGMAGA, SIGMAGB, SIGMAGC ! geo. std. deviations for modes A, B, and C [1] - REAL(8), INTENT( IN) :: TEMP ! ambient temperature [K] - REAL(8), INTENT( IN) :: PRES ! ambient pressure [Pa] - REAL(8), INTENT( OUT) :: MASSA, MASSB, MASSC ! mass concentrations for modes A, B, and C [ug/m^3] - - ! Local variables. - - INTEGER :: I, J, NHI, NLO - REAL(8) :: SCALE, FA, FB, FC, WA(NBINS), WB(NBINS), WC(NBINS), WTOTA, WTOTB, WTOTC, DNEWCUB - REAL(8) :: DMINL, DMAXL, ETAA, VP_PDF, MFRAC(NBINS,NSPCS) - - ! For the call to the coagulation coefficient routines - - REAL(4) :: DI, DJ ! ambient particle diameters [um] - REAL(4) :: BETAIJ ! coagulation coefficients [m^2/s/particle] - REAL(4) :: TEMPL ! ambient temperature [K] - REAL(4) :: PRESL ! ambient pressure [Pa] - - REAL(8), PARAMETER :: ONETHIRD = 1.0D+00 / 3.0D+00 - - - APDF(:,:) = 0.0D+00 - BPDF(:,:) = 0.0D+00 - CPDF(:,:) = 0.0D+00 - - ! Set up discrete grid. - - SELECT CASE( ICSET ) - CASE ( 10 ) - DMAXL = 0.600D+00 - DMINL = 0.006D+00 - CASE ( 11 ) - DMAXL = 1.000D+00 - DMINL = 0.001D+00 - CASE ( 12 ) - DMAXL = DMAX - DMINL = DMIN - CASE ( 13 ) - DMAXL = DMAX - DMINL = DMIN - CASE ( 14 ) - DMAXL = 100.000D+00 - DMINL = 0.001D+00 - CASE ( 15 ) - DMAXL = DMAX - DMINL = DMIN - CASE ( 16 ) - DMAXL = DMAX - DMINL = DMIN - CASE ( 17 ) - DMAXL = 200.000D+00 - DMINL = 0.001D+00 - CASE ( 18 ) - DMAXL = 8.000D+00 - DMINL = 0.001D+00 - CASE ( 19 ) - DMAXL = DMAX - DMINL = DMIN - CASE ( 20 ) - DMAXL = DMAX - DMINL = DMIN - CASE DEFAULT - WRITE(*,*)'Should not reach CASE DEFAULT in subr. discrete_init (A).' - STOP - END SELECT - SCALE = ( DMAXL / DMINL )**(1.0D+00/REAL(NBINS-1)) - RDLOGDSC = 1.0D+00 / LOG10( SCALE ) - RDMIN = 1.0D+00 / DMINL - ! WRITE(*,'(I4,5D14.5)') ICSET,DMINL,DMAXL,SCALE,RDLOGDSC,RDMIN - WRITE(36,'(/A,I6,/)') 'ICSET = ', ICSET - WRITE(36,*)'I, DLOWER(I) [um], DGRID(I) [um], DUPPER(I) [um], VGRID(I) [um^3/particle], MGRID(I) [ug/particle]' - DO I=1, NBINS - DGRID(I) = DMINL * SCALE**(I-1) ! [um] - DLOWER(I) = DGRID(I) / SCALE**0.5D+00 ! [um] - DUPPER(I) = DGRID(I) * SCALE**0.5D+00 ! [um] - D3GRID(I) = DGRID(I)**3 ! [um^3/particle] - VGRID(I) = PI6 * DGRID(I)**3 ! [um^3/particle] - MGRID(I) = 1.0D-06 * DENSP * VGRID(I) ! [ug/particle] - WRITE(36,'(I4,3F12.7,2D16.7)') I, DLOWER(I), DGRID(I), DUPPER(I), VGRID(I), MGRID(I) - ENDDO - - WTOTA = 0.0D+00 - WTOTB = 0.0D+00 - WTOTC = 0.0D+00 - FA = 0.0D+00 - FB = 0.0D+00 - FC = 0.0D+00 - WRITE(36,'(/A,I6,/)') 'ICSET = ', ICSET - WRITE(36,*)'I, DGRID(I) [um], FLN [/m^3/um], W(I) [#/m^3], WTOT [#/m^3]' - WRITE(36,*)'I, DGRID(I), FA, FB, FC, WA(I), WB(I), WC(I), WTOTA, WTOTB, WTOTC' - SELECT CASE( ICSET ) - CASE ( 10 ) - WA(:) = 0.0D+00 - WB(:) = 0.0D+00 - WC(:) = 0.0D+00 - WA(1) = NA - WTOTA = SUM( WA(:) ) - WTOTB = SUM( WB(:) ) - WTOTC = SUM( WC(:) ) - DO I=1, NBINS - WRITE(36,'(I4,F10.5,9D14.6)') I, DGRID(I), 0D0, 0D0, 0D0, WA(I), WB(I), WC(I), WTOTA, WTOTB, WTOTC - ENDDO - CASE ( 11 ) - VP_PDF = 0.0005236D+00 - WB(:) = 0.0D+00 - WC(:) = 0.0D+00 - WTOTB = 0.0D+00 - WTOTC = 0.0D+00 - DO I=1, NBINS - WA(I) = NA * ( (PI6*(DUPPER(I)**3-DLOWER(I)**3))/VP_PDF ) * EXP( -VGRID(I)/VP_PDF ) - WTOTA = WTOTA + WA(I) - WRITE(36,'(I4,F10.5,9D14.6)') I, DGRID(I), 0D0, 0D0, 0D0, WA(I), WB(I), WC(I), WTOTA, WTOTB, WTOTC - ENDDO - CASE ( 12, 13, 14, 15, 16, 17, 18, 19, 20 ) - DO I=1, NBINS - FA = NA * FLN( DGRID(I), DGA, SIGMAGA ) - FB = NB * FLN( DGRID(I), DGB, SIGMAGB ) - FC = NC * FLN( DGRID(I), DGC, SIGMAGC ) - WA(I) = FA * ( DUPPER(I) - DLOWER(I) ) - WB(I) = FB * ( DUPPER(I) - DLOWER(I) ) - WC(I) = FC * ( DUPPER(I) - DLOWER(I) ) - WTOTA = WTOTA + WA(I) - WTOTB = WTOTB + WB(I) - WTOTC = WTOTC + WC(I) - WRITE(36,'(I4,F10.5,9D14.6)') I, DGRID(I), FA, FB, FC, WA(I), WB(I), WC(I), WTOTA, WTOTB, WTOTC - ENDDO - CASE DEFAULT - WRITE(*,*)'Should not reach CASE DEFAULT in subr. discrete_init (B).' - STOP - END SELECT - - WA(:) = WA(:) * ( NA / MAX( WTOTA, 1.0D-30) ) ! Renormalize to the precise input number concentration. - WB(:) = WB(:) * ( NB / MAX( WTOTB, 1.0D-30) ) ! Renormalize to the precise input number concentration. - WC(:) = WC(:) * ( NC / MAX( WTOTC, 1.0D-30) ) ! Renormalize to the precise input number concentration. - - WRITE(36,*)'Check sums on WA(:), WB(:), WC(:)' - WRITE(36,'(3D22.14)') NA, NB, NC - WRITE(36,'(3D22.14)') SUM(WA(:)),SUM(WB(:)),SUM(WC(:)) - - ! Get total mass concentration summed over all bins. - - MASSA = SUM( WA(:) * MGRID(:) ) - MASSB = SUM( WB(:) * MGRID(:) ) - MASSC = SUM( WC(:) * MGRID(:) ) - - ! Initialize the main discrete grids for number and mass concentrations. - ! WRITE(*,*)ISPCA,ISPCB,ISPCC - - APDF(:,1) = WA(:) ! [#/m^3] - BPDF(:,1) = WB(:) ! [#/m^3] - CPDF(:,1) = WC(:) ! [#/m^3] - MFRAC(:,:) = 0.0D+00 ! [1] - SELECT CASE( ICSET ) - CASE( 10, 11 ) ! one-component for all modes - DO I=1, NBINS - MFRAC(I,2) = REAL(I) / REAL(NBINS) ! [1] - MFRAC(I,1) = 1.0D+00 - MFRAC(I,2) ! [1] - ENDDO - DO I=1, NBINS - DO J=1, ISPCA - APDF(I,1+J) = WA(I) * MGRID(I) * MFRAC(I,J) ! [ug/m^3] - BPDF(I,1+J) = WB(I) * MGRID(I) * MFRAC(I,J) ! [ug/m^3] - CPDF(I,1+J) = WC(I) * MGRID(I) * MFRAC(I,J) ! [ug/m^3] - ENDDO - ENDDO - CASE( 12 ) - APDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - BPDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - CPDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - APDF(:,2) = WA(:) * MGRID(:) ! [ug/m^3] pure sulfate - BPDF(:,2) = WB(:) * MGRID(:) ! [ug/m^3] pure BC - CASE( 13, 14, 15, 16, 17, 18, 19, 20 ) - APDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - BPDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - CPDF(:,2:NSPCS+1) = 0.0D+00 ! [ug/m^3] - APDF(:,2) = WA(:) * MGRID(:) ! [ug/m^3] pure sulfate - BPDF(:,3) = WB(:) * MGRID(:) ! [ug/m^3] pure BC - CASE DEFAULT - WRITE(*,*)'Should not reach CASE DEFAULT in subr. discrete_init (C).' - STOP - END SELECT - - ! Calculate particle partitioning between adjacient grid points to optimize the coagulation integration. - - FRAC_LO(:,:) = 0.0D+00 - FRAC_HI(:,:) = 0.0D+00 - NLO_GRID(:,:) = 1 - NHI_GRID(:,:) = 1 - DO I=1, NBINS - DO J=1, NBINS - DNEWCUB = D3GRID(I) + D3GRID(J) - NLO = INT( LOG10( RDMIN * DNEWCUB**ONETHIRD ) * RDLOGDSC ) + 1 - NLO = MIN( NBINS-1, NLO ) - NHI = NLO + 1 - NHI = MIN( NBINS, NHI ) - NLO_GRID(I,J) = NLO - NHI_GRID(I,J) = NHI - IF( 1.000000001D+00*DNEWCUB .LT. D3GRID(NLO) ) THEN - FRAC_LO(I,J) = 1.0D+00 - FRAC_HI(I,J) = 1.0D+00 - FRAC_LO(I,J) - IF( NLO .EQ. 1 .OR. NLO .EQ. NBINS-1 ) GOTO 101 - IF( NHI .EQ. 2 .OR. NHI .EQ. NBINS ) GOTO 101 - WRITE(*,90) NLO, NHI, D3GRID(NLO), DNEWCUB, D3GRID(NHI) - STOP - ELSEIF( 0.999999999D+00*DNEWCUB .GT. D3GRID(NHI) ) THEN - FRAC_LO(I,J) = 0.0D+00 - FRAC_HI(I,J) = 1.0D+00 - FRAC_LO(I,J) - IF( NLO .EQ. 1 .OR. NLO .EQ. NBINS-1 ) GOTO 101 - IF( NHI .EQ. 2 .OR. NHI .EQ. NBINS ) GOTO 101 - WRITE(*,90) NLO, NHI, D3GRID(NLO), DNEWCUB, D3GRID(NHI) - STOP - ELSE - FRAC_LO(I,J) = ( D3GRID(NHI) - DNEWCUB ) / ( D3GRID(NHI) - D3GRID(NLO) ) - FRAC_HI(I,J) = 1.0D+00 - FRAC_LO(I,J) - ENDIF -101 CONTINUE - ! WRITE(36,'(4I5,2D15.5)') I,J,NLO,NHI,FRAC_LO(I,J), FRAC_HI(I,J) - ENDDO - ENDDO - - ! Calculate the fixed grid coagulation coefficients. - - SELECT CASE( ICSET ) - CASE ( 10, 11 ) - !--------------------------------------------------------------------------------------------------------------- - ! ETAA: Dynamic viscosity of air [kg/m/s], Jacobson, 1999, eq.(4.55) - !--------------------------------------------------------------------------------------------------------------- - ETAA = 1.832D-05*(416.16D+00/(TEMP+120.0D+00))*(TEMP/296.16D+00)**1.5D+00 - KIJ_DISCRETE(:,:) = 8.0D+00 * XKB * TEMP / ( 3.0D+00 * ETAA ) - CASE( 12, 13, 14, 15, 16, 17, 18, 19, 20 ) - KIJ_DISCRETE(:,:) = 0.0D+00 - TEMPL = REAL( TEMP ) ! convert to single precision - PRESL = REAL( PRES ) ! convert to single precision - DO I=1, NBINS - DO J=I, NBINS - DI = REAL( DGRID(I) ) ! convert to single precision - DJ = REAL( DGRID(J) ) ! convert to single precision -! CALL BROWNIAN_COAG_COEF( DI, DJ, TEMPL, PRESL, BETAIJ ) ! all variables single precision - CALL TOTAL_COAG_COEF ( DI, DJ, TEMPL, PRESL, BETAIJ ) ! all variables single precision - KIJ_DISCRETE(I,J) = REAL( BETAIJ ) ! convert to double precision - KIJ_DISCRETE(J,I) = REAL( BETAIJ ) ! convert to double precision - ENDDO - ENDDO - CASE DEFAULT - WRITE(*,*)'Should not reach CASE DEFAULT in subr. discrete_init (D).' - STOP - !--------------------------------------------------------------------------------------------------------------- - ! ETAA = 1.832D-05*(416.16D+00/(TEMP+120.0D+00))*(TEMP/296.16D+00)**1.5D+00 - ! KIJ_DISCRETE(:,:) = 8.0D+00 * XKB * TEMP / ( 3.0D+00 * ETAA ) - ! KIJ_DISCRETE(:,:) = 1.0D-14 - !--------------------------------------------------------------------------------------------------------------- - END SELECT - - WRITE(37,'(F8.2,11D13.5)') 0D0, - & 1.0D-06*SUM(APDF(:,1)), 1.0D-06*SUM(BPDF(:,1)), 1.0D-06*SUM(CPDF(:,1)), - & SUM( APDF(:,2) ), SUM( BPDF(:,2) ), SUM( CPDF(:,2) ), - & SUM( APDF(:,3) ), SUM( BPDF(:,3) ), SUM( CPDF(:,3) ), - & SUM( APDF(:,2) ) + SUM( BPDF(:,2) ) + SUM( CPDF(:,2) ), - & SUM( APDF(:,3) ) + SUM( BPDF(:,3) ) + SUM( CPDF(:,3) ) - - CALL DISCRETE_OUT(38,ICSET,0D0) - -90 FORMAT('DISCRETE_INIT: Bad NLO or NHI: NLO, NHI, D3GRID(NLO), DNEWCUB, D3GRID(NHI) = ',/,2I10,3D22.14) - RETURN - END SUBROUTINE DISCRETE_INIT - - - SUBROUTINE DISCRETE( ICSET, TIMEH, TSTEP ) -!----------------------------------------------------------------------------------------------------------------------- -! 10-30-06, DLW: Discrete model of the pdf used to obtain results for evaluation of MATRIX. -!----------------------------------------------------------------------------------------------------------------------- - - ! Arguments. - - INTEGER :: ICSET ! label for set of initial conditions [1] - REAL(8), INTENT(IN) :: TIMEH ! model time [h] - REAL(8), INTENT(IN) :: TSTEP ! model physics time step [s] - - ! Local variables. - - INTEGER :: IT - LOGICAL, SAVE :: FIRSTIME = .TRUE. - LOGICAL, PARAMETER :: DISCRETE_COAG_FLAG = .TRUE. - -!---------------------------------------------------------------------------------------------------------------------- -! Begin execution. -!---------------------------------------------------------------------------------------------------------------------- - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - DTCOAG = TSTEP / REAL( ITCOAG ) - ENDIF - - - IF( DISCRETE_COAG_FLAG ) THEN - SELECT CASE( ICSET ) - CASE ( 10, 11, 18 ) - DO IT=1, ITCOAG - CALL DISCRETE_INTRACOAG ( APDF ) - ENDDO - CASE ( 12, 20 ) - DO IT=1, ITCOAG - CALL DISCRETE_INTRACOAG ( APDF ) - CALL DISCRETE_INTRACOAG ( BPDF ) - CALL DISCRETE_INTERCOAG_AB ( APDF, BPDF ) - ENDDO - CASE ( 13, 14, 15, 16, 17, 19 ) - DO IT=1, ITCOAG - CALL DISCRETE_INTRACOAG ( APDF ) - CALL DISCRETE_INTRACOAG ( BPDF ) - CALL DISCRETE_INTRACOAG ( CPDF ) - CALL DISCRETE_INTERCOAG_AB ( APDF, CPDF ) - CALL DISCRETE_INTERCOAG_AB ( BPDF, CPDF ) - CALL DISCRETE_INTERCOAG_ABC( APDF, BPDF, CPDF ) - ENDDO - CASE DEFAULT - WRITE(*,*)'Should not reach CASE DEFAULT in subr. discrete.' - STOP - END SELECT - ENDIF - - WRITE(37,'(F8.2,11D13.5)') TIMEH+TSTEP/3.6D+03, - & 1.0D-06*SUM(APDF(:,1)), 1.0D-06*SUM(BPDF(:,1)), 1.0D-06*SUM(CPDF(:,1)), - & SUM( APDF(:,2) ), SUM( BPDF(:,2) ), SUM( CPDF(:,2) ), - & SUM( APDF(:,3) ), SUM( BPDF(:,3) ), SUM( CPDF(:,3) ), - & SUM( APDF(:,2) ) + SUM( BPDF(:,2) ) + SUM( CPDF(:,2) ), - & SUM( APDF(:,3) ) + SUM( BPDF(:,3) ) + SUM( CPDF(:,3) ) - - RETURN - END SUBROUTINE DISCRETE - - - SUBROUTINE DISCRETE_INTRACOAG( PDF ) -!----------------------------------------------------------------------------------------------------------------------- -! 10-30-06, DLW: Discrete model of the pdf used to obtain results for evaluation of MATRIX. -!----------------------------------------------------------------------------------------------------------------------- - - ! Arguments. - - REAL(8), INTENT(INOUT) :: PDF(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - - ! Local variables. - - INTEGER :: I, J, NLO, NHI - REAL(8) :: W(NBINS), DELW(NBINS), DW, DELM(NBINS,NSPCS), MP(NBINS,NSPCS), DM(NSPCS) - - W(:) = PDF(:,1) ! load number concentrations in work array [#/m^3] - DELW(:) = 0.0D+00 - DELM(:,:) = 0.0D+00 - DO I=1, NBINS - MP(I,:) = PDF(I,2:NSPCS+1) / MAX( W(I), 1.0D-30 ) ! load mass per particle for each bin and species [ug] - ENDDO - DO I=1, NBINS - DO J=I, NBINS - IF(I.EQ.J) THEN - DW = 0.5D+00*KIJ_DISCRETE(I,J)*W(I)*W(J)*DTCOAG - DM(:) = 2.0D+00 * DW * MP(I,:) - DELW(I) = DELW(I) - 2.0D+00*DW - DELM(I,:) = DELM(I,:) - DM(:) - ELSE - DW = KIJ_DISCRETE(I,J)*W(I)*W(J)*DTCOAG - DM(:) = DW * ( MP(I,:) + MP(J,:) ) - DELW(I) = DELW(I) - DW - DELW(J) = DELW(J) - DW - DELM(I,:) = DELM(I,:) - DW*MP(I,:) - DELM(J,:) = DELM(J,:) - DW*MP(J,:) - ENDIF - ! WRITE(*,'(2I4,7D12.3)')I,J,DW,WLO,WHI,W(I),W(J),FRAC_LO(I,J),FRAC_HI(I,J) - NLO = NLO_GRID(I,J) - NHI = NHI_GRID(I,J) - DELW(NLO) = DELW(NLO) + DW * FRAC_LO(I,J) - DELW(NHI) = DELW(NHI) + DW * FRAC_HI(I,J) - DELM(NLO,:) = DELM(NLO,:) + DM(:) * FRAC_LO(I,J) - DELM(NHI,:) = DELM(NHI,:) + DM(:) * FRAC_HI(I,J) - ENDDO - ENDDO - PDF(:,1) = W(:) + DELW(:) ! update output array [#/m^3] - PDF(:,2:NSPCS+1) = PDF(:,2:NSPCS+1) + DELM(:,:) ! update output array [ug/m^3] - DO I=1, NSPCS+1 - PDF(:,I) = MAX( PDF(:,I), 0.0D-30 ) - ENDDO - - - RETURN - END SUBROUTINE DISCRETE_INTRACOAG - - - SUBROUTINE DISCRETE_INTERCOAG_AB( PDFA, PDFB ) -!----------------------------------------------------------------------------------------------------------------------- -! 10-30-06, DLW: Discrete model of the pdf used to obtain results for evaluation of MATRIX. -! -! PDFA coagulates with PDFB to produce additional particles in PDFB. -!----------------------------------------------------------------------------------------------------------------------- - - ! Arguments. - - REAL(8), INTENT(INOUT) :: PDFA(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - REAL(8), INTENT(INOUT) :: PDFB(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - - ! Local variables. - - INTEGER :: I, J, NLO, NHI - REAL(8) :: DW, DM(NSPCS) - REAL(8) :: WA(NBINS), DELWA(NBINS), DELMA(NBINS,NSPCS), MPA(NBINS,NSPCS), DMA(NSPCS) - REAL(8) :: WB(NBINS), DELWB(NBINS), DELMB(NBINS,NSPCS), MPB(NBINS,NSPCS), DMB(NSPCS) - - WA(:) = PDFA(:,1) ! load number concentrations in work array [#/m^3] - WB(:) = PDFB(:,1) ! load number concentrations in work array [#/m^3] - DELWA(:) = 0.0D+00 - DELWB(:) = 0.0D+00 - DELMA(:,:) = 0.0D+00 - DELMB(:,:) = 0.0D+00 - DO I=1, NBINS - MPA(I,:) = PDFA(I,2:NSPCS+1) / MAX( WA(I), 1.0D-30 ) ! load mass per particle for each bin and species [ug] - MPB(I,:) = PDFB(I,2:NSPCS+1) / MAX( WB(I), 1.0D-30 ) ! load mass per particle for each bin and species [ug] - ENDDO - DO I=1, NBINS - DO J=1, NBINS - DW = KIJ_DISCRETE(I,J)*WA(I)*WB(J)*DTCOAG - DMA(:) = DW * MPA(I,:) - DMB(:) = DW * MPB(J,:) - DM(:) = DMA(:) + DMB(:) - DELWA(I) = DELWA(I) - DW - DELWB(J) = DELWB(J) - DW - DELMA(I,:) = DELMA(I,:) - DMA(:) - DELMB(J,:) = DELMB(J,:) - DMB(:) - NLO = NLO_GRID(I,J) - NHI = NHI_GRID(I,J) - DELWB(NLO) = DELWB(NLO) + DW * FRAC_LO(I,J) - DELWB(NHI) = DELWB(NHI) + DW * FRAC_HI(I,J) - DELMB(NLO,:) = DELMB(NLO,:) + DM(:) * FRAC_LO(I,J) - DELMB(NHI,:) = DELMB(NHI,:) + DM(:) * FRAC_HI(I,J) - ENDDO - ENDDO - PDFA(:,1) = WA(:) + DELWA(:) ! update output array [#/m^3] - PDFB(:,1) = WB(:) + DELWB(:) ! update output array [#/m^3] - PDFA(:,2:NSPCS+1) = PDFA(:,2:NSPCS+1) + DELMA(:,:) ! update output array [ug/m^3] - PDFB(:,2:NSPCS+1) = PDFB(:,2:NSPCS+1) + DELMB(:,:) ! update output array [ug/m^3] - - DO I=1, NSPCS+1 - PDFA(:,I) = MAX( PDFA(:,I), 0.0D-30 ) - PDFB(:,I) = MAX( PDFB(:,I), 0.0D-30 ) - ENDDO - - RETURN - END SUBROUTINE DISCRETE_INTERCOAG_AB - - - SUBROUTINE DISCRETE_INTERCOAG_ABC( PDFA, PDFB, PDFC ) -!----------------------------------------------------------------------------------------------------------------------- -! 10-30-06, DLW: Discrete model of the pdf used to obtain results for evaluation of MATRIX. -! -! PDFA coagulates with PDFB to produce additional particles in PDFC. -! Either PDFA or PDFB may be identical with PDFC, but PDFA and PDFB cannot be identical. -! -! IF PDFA is not PDFC, and PDFB is not PDFC --> ICASE = 0 -! IF PDFA is. PDFC --> ICASE = 1 -! IF PDFB is. PDFC --> ICASE = 2 -!----------------------------------------------------------------------------------------------------------------------- - - ! Arguments. - - REAL(8), INTENT(INOUT) :: PDFA(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - REAL(8), INTENT(INOUT) :: PDFB(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - REAL(8), INTENT(INOUT) :: PDFC(NBINS,1+NSPCS) ! working array for discrete variables [#/m^3], [ug/m^3] - - ! Local variables. - - INTEGER :: I, J, NLO, NHI - REAL(8) :: DW, DM(NSPCS) - REAL(8) :: WA(NBINS), DELWA(NBINS), DELMA(NBINS,NSPCS), MPA(NBINS,NSPCS), DMA(NSPCS) - REAL(8) :: WB(NBINS), DELWB(NBINS), DELMB(NBINS,NSPCS), MPB(NBINS,NSPCS), DMB(NSPCS) - REAL(8) :: DELWC(NBINS), DELMC(NBINS,NSPCS) - - WA(:) = PDFA(:,1) ! load number concentrations in work array [#/m^3] - WB(:) = PDFB(:,1) ! load number concentrations in work array [#/m^3] - DELWA(:) = 0.0D+00 - DELWB(:) = 0.0D+00 - DELWC(:) = 0.0D+00 - DELMA(:,:) = 0.0D+00 - DELMB(:,:) = 0.0D+00 - DELMC(:,:) = 0.0D+00 - DO I=1, NBINS - MPA(I,:) = PDFA(I,2:NSPCS+1) / MAX( WA(I), 1.0D-30 ) ! load mass per particle for each bin and species [ug] - MPB(I,:) = PDFB(I,2:NSPCS+1) / MAX( WB(I), 1.0D-30 ) ! load mass per particle for each bin and species [ug] - ! WRITE(39,'(I6,8D15.5)') I, MPB(I,:), PDFB(I,2:NSPCS+1), WB(I) - ENDDO - ! WRITE(39,*)' ' - DO I=1, NBINS - DO J=1, NBINS - DW = KIJ_DISCRETE(I,J)*WA(I)*WB(J)*DTCOAG -! IF( DW .GT. MIN( WA(I), WB(J) ) ) THEN -! WRITE(*,*)'DW .GT. MIN( WA(I), WB(J) ): I,J, DW, WA, WB = ', I, J, DW, WA(I), WB(J) -! STOP -! ENDIF - DMA(:) = DW * MPA(I,:) - DMB(:) = DW * MPB(J,:) - DM(:) = DMA(:) + DMB(:) - DELWA(I) = DELWA(I) - DW - DELWB(J) = DELWB(J) - DW - DELMA(I,:) = DELMA(I,:) - DMA(:) - DELMB(J,:) = DELMB(J,:) - DMB(:) - NLO = NLO_GRID(I,J) - NHI = NHI_GRID(I,J) - DELWC(NLO) = DELWC(NLO) + DW * FRAC_LO(I,J) - DELWC(NHI) = DELWC(NHI) + DW * FRAC_HI(I,J) - DELMC(NLO,:) = DELMC(NLO,:) + DM(:) * FRAC_LO(I,J) - DELMC(NHI,:) = DELMC(NHI,:) + DM(:) * FRAC_HI(I,J) - ENDDO - ENDDO - PDFA(:,1) = WA(:) + DELWA(:) ! update output array [#/m^3] - PDFB(:,1) = WB(:) + DELWB(:) ! update output array [#/m^3] - PDFC(:,1) = PDFC(:,1) + DELWC(:) ! update output array [#/m^3] - PDFA(:,2:NSPCS+1) = PDFA(:,2:NSPCS+1) + DELMA(:,:) ! update output array [ug/m^3] - PDFB(:,2:NSPCS+1) = PDFB(:,2:NSPCS+1) + DELMB(:,:) ! update output array [ug/m^3] - PDFC(:,2:NSPCS+1) = PDFC(:,2:NSPCS+1) + DELMC(:,:) ! update output array [ug/m^3] - - DO I=1, NSPCS+1 - PDFA(:,I) = MAX( PDFA(:,I), 0.0D-30 ) - PDFB(:,I) = MAX( PDFB(:,I), 0.0D-30 ) - ENDDO - - RETURN - END SUBROUTINE DISCRETE_INTERCOAG_ABC - - - SUBROUTINE DISCRETE_OUT(IUNIT,ICSET,TIMEH) -!----------------------------------------------------------------------------------------------------------------------- -! 11-01-06, DLW -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - INTEGER, INTENT( IN) :: IUNIT ! output logical unit number [1] - INTEGER, INTENT( IN) :: ICSET ! identifies test case [1] - REAL(8), INTENT( IN) :: TIMEH ! model time [h] - - ! Local variables. - - INTEGER :: I - REAL(8) :: ADNDLOGD, BDNDLOGD, CDNDLOGD - REAL(8) :: ADM1DLOGD, BDM1DLOGD, CDM1DLOGD - REAL(8) :: ADM2DLOGD, BDM2DLOGD, CDM2DLOGD - - DO I=1, NBINS - ADNDLOGD = APDF(I,1) * RDLOGDSC * 1.0D-06 ! convert from [#/m^3] to [#/cm^3] - BDNDLOGD = BPDF(I,1) * RDLOGDSC * 1.0D-06 ! convert from [#/m^3] to [#/cm^3] - CDNDLOGD = CPDF(I,1) * RDLOGDSC * 1.0D-06 ! convert from [#/m^3] to [#/cm^3] - ADNDLOGD = MAX( ADNDLOGD, 1.0D-30 ) - BDNDLOGD = MAX( BDNDLOGD, 1.0D-30 ) - CDNDLOGD = MAX( CDNDLOGD, 1.0D-30 ) - ADM1DLOGD = APDF(I,2) * RDLOGDSC ! [ug/m^3] - BDM1DLOGD = BPDF(I,2) * RDLOGDSC ! [ug/m^3] - CDM1DLOGD = CPDF(I,2) * RDLOGDSC ! [ug/m^3] - ADM1DLOGD = MAX( ADM1DLOGD, 1.0D-30 ) - BDM1DLOGD = MAX( BDM1DLOGD, 1.0D-30 ) - CDM1DLOGD = MAX( CDM1DLOGD, 1.0D-30 ) - ADM2DLOGD = APDF(I,3) * RDLOGDSC ! [ug/m^3] - BDM2DLOGD = BPDF(I,3) * RDLOGDSC ! [ug/m^3] - CDM2DLOGD = CPDF(I,3) * RDLOGDSC ! [ug/m^3] - ADM2DLOGD = MAX( ADM2DLOGD, 1.0D-30 ) - BDM2DLOGD = MAX( BDM2DLOGD, 1.0D-30 ) - CDM2DLOGD = MAX( CDM2DLOGD, 1.0D-30 ) - WRITE(IUNIT,91) I, DGRID(I), ADNDLOGD, BDNDLOGD, CDNDLOGD, - & ADM1DLOGD, BDM1DLOGD, CDM1DLOGD, - & ADM2DLOGD, BDM2DLOGD, CDM2DLOGD - - ENDDO - -91 FORMAT(I5,10D14.6) - RETURN - END SUBROUTINE DISCRETE_OUT - - - REAL(8) FUNCTION FLN(X,XG,SIGMAG) - REAL(8) :: X ! particle radius or diameter [any units] - REAL(8) :: XG ! geometric mean radius or diameter [any units] - REAL(8) :: SIGMAG ! geometric standard deviation [monodisperse = 1.0] - REAL(8), PARAMETER :: SQRTTWOPI = 2.506628275D+00 - FLN = EXP(-0.5D+00*(LOG(X/XG)/LOG(SIGMAG))**2) / (X*LOG(SIGMAG)*SQRTTWOPI) - RETURN - END FUNCTION FLN - - - END MODULE AERO_DISCRETE - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_drv.F b/MATRIXchem_GridComp/microphysics/TRAMP_drv.F deleted file mode 100644 index 1d10ec33..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_drv.F +++ /dev/null @@ -1,713 +0,0 @@ -#ifndef GEOS5_PORT -#include "rundeck_opts.h" -#endif - - MODULE AMP_AEROSOL -!@sum Driver for Aerosol Microphysics -!@auth Susanne Bauer -#ifndef GEOS5_PORT - USE TRACER_COM - USE AERO_CONFIG, ONLY: NMODES - USE AERO_PARAM, ONLY: NEMIS_SPCS - USE MODEL_COM, ONLY: LM, jhour, jdate -#else - USE AERO_CONFIG, ONLY: NMODES - USE AERO_PARAM, ONLY: NEMIS_SPCS -#endif - IMPLICIT NONE - SAVE - -C************** Latitude-Dependant (allocatable) ******************* -#ifndef GEOS5_PORT - ! Mie lookup tables - REAL*8, DIMENSION(15,17,23,6) :: AMP_EXT, AMP_ASY, AMP_SCA !(15,17,23,6) (RE,IM,size,lambda) - REAL*8, DIMENSION(15,17,23) :: AMP_Q55 - REAL*8, DIMENSION(23,26,26,26,6) :: AMP_EXT_CS,AMP_ASY_CS,AMP_SCA_CS !(23,26,26,26,6) (radius,OC,SO4,H2O,lambda) - REAL*8, DIMENSION(23,26,26,26) :: AMP_Q55_CS - ! 1 Dim arrays for Radiation - REAL*8, DIMENSION(LM,nmodes) :: Reff_LEV, NUMB_LEV - REAL*8, DIMENSION(LM,nmodes) :: MIX_OC, MIX_SU, MIX_AQ - COMPLEX*8, DIMENSION(LM,nmodes,6) :: RindexAMP - REAL*8, DIMENSION(LM,nmodes,7) :: dry_Vf_LEV - ! FALSE : one Radiation call - ! TRUE : nmodes Radiation calls - INTEGER :: AMP_RAD_KEY = 1 ! 1=Volume Mixing || 2=Core - Shell || 3=Maxwell Garnett - INTEGER :: AMP_DIAG_FC = 1 ! 2=nmode radiation calls || 1=one radiation call - - REAL*8, ALLOCATABLE, DIMENSION(:,:,:) :: AQsulfRATE !(i,j,l) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: DIAM ![m](i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: AMP_dens !density(i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: AMP_TR_MM !molec. mass(i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: NACTV != 1.0D-30 ![#/m^3](i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: CCNSS != 1.0D-30 ![#/m^3](i,j,l,nmodes,3) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: VDDEP_AERO != 1.0D-30 ![m/s](i,j,nmodes,2) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: NUMB_SS ! Sea salt number concentration [#/gb] -#else - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: DIAM ![m](i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: NACTV != 1.0D-30 ![#/m^3](i,j,l,nmodes) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: CCNSS != 1.0D-30 ![#/m^3](i,j,l,nmodes,3) - REAL*8, ALLOCATABLE, DIMENSION(:,:,:,:) :: VDDEP_AERO != 1.0D-30 ![m/s](i,j,nmodes,2) -#endif - -#ifndef NO_HDIURN - REAL*8, ALLOCATABLE, DIMENSION(:,:) :: DIURN_LWP ! lwp hourly output - REAL*8, ALLOCATABLE, DIMENSION(:,:,:) :: DIURN_LWC ! lwc hourly output -#endif -!------------------------------------------------------------------------------------------------------------------------- -! The array VDDEP_AERO(X,Y,Z,I,1) contains current values for the dry deposition velocities -! for aerosol number concentrations for mode I. -! The array VDDEP_AERO(X,Y,Z,I,2) contains current values for the dry deposition velocities -! for aerosol mass concentrations for mode I. -! Values in VDDEP_AERO are saved in subr. MATRIX at each time step. -!------------------------------------------------------------------------------------------------------------------------- -!------------------------------------------------------------------------------------------------------------------------- -! The array NACTV(X,Y,Z,I) contains current values of the number of aerosol particles -! activated in clouds for each mode I for use outside of the MATRIX microphysical module. -! Values in NACTV are saved in subr. MATRIX at each time step. -!------------------------------------------------------------------------------------------------------------------------- -!------------------------------------------------------------------------------------------------------------------------- -! 1 - BC 2-BCmix 3-OC 4-OCmix 5-SS1 6-SS2 7-D1 8-D2 -!------------------------------------------------------------------------------------------------------------------------- -!------------------------------------------------------------------------------------------------------------------------- -! The array DIAM(x,y,z) contains current values of some measure of average ambient mode diameter for each mode -! for use outside of the MATRIX microphysical module where it is calculated. -! Values in DIAM are saved at the top of the subr. MATRIX before microphysical evolution -! for the current time step is done. -! -! The current measure of particle diameter is the diameter of average mass: -! -! DIAM(x,y,z) = [ (6/pi) * (Mi/Ni) * (1/D) ]^(1/3) -! -! with Mi the total mass concentration (including water) in mode i, Ni the number concentration in mode i, and -! D a constant ambient particle density, currently set to D = DENSP = 1.4 g/cm^3. -!------------------------------------------------------------------------------------------------------------------------- - END MODULE AMP_AEROSOL - -#ifndef GEOS5_PORT - SUBROUTINE MATRIX_DRV - USE TRACER_COM - USE TRDIAG_COM, only : taijs=>taijs_loc,taijls=>taijls_loc - * ,ijts_AMPp,ijlt_AMPm,ijlt_AMPext,ijts_AMPpdf - * ,itcon_AMP,itcon_AMPm - USE AMP_AEROSOL - - USE MODEL_COM, only : im,jm,lm ! dimensions - $ ,t ! potential temperature (C) - $ ,q ! saturated pressure - $ ,dtsrc - USE GEOM, only: axyp,imaxj,BYAXYP - USE CONSTANT, only: lhe,mair,gasc - USE FLUXES, only: tr3Dsource,trsource,trsrfflx,trflux1 - USE DYNAMICS, only: pmid,pk,byam,gz, am ! midpoint pressure in hPa (mb) -! and pk is t mess up factor -! BYAM 1/Air mass (m^2/kg) - USE AERO_CONFIG - USE AERO_INIT - USE AERO_PARAM, only: IXXX, IYYY, ILAY, NEMIS_SPCS - USE AERO_SETUP - USE PBLCOM, only: EGCM !(LM,IM,JM) 3-D turbulent kinetic energy [m^2/s^2] - USE DOMAIN_DECOMP_ATM,only: GRID, GET, am_i_root -#ifndef NO_HDIURN -c for the hourly diagnostic -#ifdef CLD_AER_CDNC - USE CLOUDS_COM, only: CDN3D ! CDNC -#endif - USE DIAG_COM, only: adiurn=>adiurn_loc,ndiuvar,iwrite,jwrite,itwrite,ndiupt,idd_diam - * ,ijdd, idd_ccn, idd_cdnc, idd_lwp, idd_numb, idd_mass, idd_so2, - * idd_lwc, idd_ncL, idd_pres - * ,hdiurn=>hdiurn_loc -#endif -#ifdef CACHED_SUBDD - use subdd_mod, only : subdd_groups,subdd_type,subdd_ngroups, - & inc_subdd,find_groups -#endif - IMPLICIT NONE - - REAL(8):: TK,RH,PRES,TSTEP,AQSO4RATE - REAL(8):: AERO(NAEROBOX) ! aerosol conc. [ug/m^3] or [#/m^3] - REAL(8):: GAS(NGASES) ! gas-phase conc. [ug/m^3] - REAL(8):: EMIS_MASS(NEMIS_SPCS) ! mass emission rates [ug/m^3] - REAL(8):: SPCMASS(NMASS_SPCS+2) - REAL(8):: DT_AERO(NDIAG_AERO,NAEROBOX) !NDIAG_AERO=15 - REAL(8):: yS, yM, ZHEIGHT1,WUP,AVOL - REAL(8) :: PDF1(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: PDF2(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - INTEGER:: j,l,i,n,J_0, J_1, I_0, I_1, m,nAMP -C**** functions - REAL(8):: QSAT -#ifdef CACHED_SUBDD - integer :: igrp,ngroups,grpids(subdd_ngroups) - type(subdd_type), pointer :: subdd - - REAL*8, dimension(grid%i_strt_halo:grid%i_stop_halo, - & grid%j_strt_halo:grid%j_stop_halo) :: - & PN_subdd, APN_subdd - REAL*8, dimension(grid%i_strt_halo:grid%i_stop_halo, - & grid%j_strt_halo:grid%j_stop_halo,lm) :: - & PN_3d_subdd, APN_3d_subdd,p_3d_subdd, rh_3d_subdd, - & c1_3d_subdd, c2_3d_subdd, c5_3d_subdd - -#endif -#ifndef NO_HDIURN -c for the hourly diagnostic - REAL*8 :: TMP(NDIUVAR) - INTEGER, PARAMETER :: NLOC_DIU_VAR = nmodes + nmodes + 38 + 2 - INTEGER, PARAMETER :: NLOC_DIU_VARL = 5 - INTEGER :: idxd(NLOC_DIU_VAR),idxl(NLOC_DIU_VARL) - INTEGER :: ih, ihm, kr,ii -#endif - REAL*8 :: HD_NUMB(nmodes) - - CALL GET(grid, J_STRT =J_0, J_STOP =J_1) - I_0 = grid%I_STRT - I_1 = grid%I_STOP - - NACTV(I_0:I_1,J_0:J_1,:,:) = 0.d0 - CCNSS(I_0:I_1,J_0:J_1,:,:,:) = 0.d0 - VDDEP_AERO(I_0:I_1,J_0:J_1,:,:) = 0.d0 - DIAM(I_0:I_1,J_0:J_1,:,:) = 0.d0 - AMP_dens(I_0:I_1,J_0:J_1,:,:) = 0.d0 - AMP_TR_MM(I_0:I_1,J_0:J_1,:,:) = 0.d0 - NUMB_SS(I_0:I_1,J_0:J_1,:,:) = 0.d0 -#ifdef CACHED_SUBDD - PN_subdd(I_0:I_1,J_0:J_1) = 0.d0 - APN_subdd(I_0:I_1,J_0:J_1) = 0.d0 - PN_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - APN_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - c1_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - c2_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - c5_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - P_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 - RH_3d_subdd(I_0:I_1,J_0:J_1,:) = 0.d0 -#endif - DO L=1,LM - DO J=J_0,J_1 - DO I=I_0,I_1 - - IXXX = I - IYYY = J - ILAY = L - DT_AERO(:,:) = 0.d0 - EMIS_MASS(:) = 0.d0 - AERO(:) = 0.d0 - HD_NUMB(:) = 0.d0 -! meteo - TK = pk(l,i,j)*t(i,j,l) !should be in [K] - RH = MIN(1.,q(i,j,l)/QSAT(TK,lhe,pmid(l,i,j))) ! rH [0-1] - PRES= pmid(l,i,j)*100. ! pmid in [hPa] - TSTEP=dtsrc - ZHEIGHT1 = GZ(i,j,l) /1000./9.81 - WUP = SQRT(.6666667*EGCM(l,i,j)) ! updraft velocity - -c avol [m3/gb] mass of air pro m3 - AVOL = am(l,i,j)*axyp(i,j)/mair*1000.d0*gasc*tk/pres -! in-cloud SO4 production rate [ug/m^3/s] ::: AQsulfRATE [kg] - AQSO4RATE = AQsulfRATE (i,j,l)* 1.d9 / AVOL /dtsrc -c conversion trm [kg/gb] -> [ug /m^3] - GAS(1) = trm(i,j,l,n_H2SO4)* 1.d9 / AVOL! [ug H2SO4/m^3] -c conversion trm [kg/kg] -> [ug /m^3] - GAS(2) = trm(i,j,l,n_HNO3)*1.d9 / AVOL! [ug HNO3/m^3] -c conversion trm [kg/gb] -> [ug /m^3] - GAS(3) = trm(i,j,l,n_NH3)* 1.d9 / AVOL! [ug NH3 /m^3] -! [kg/s] -> [ug/m3/s] - - DO n=ntmAMPi,ntmAMPe - nAMP=n-ntmAMPi+1 -c conversion trm [kg/gb] -> AERO [ug/m3] - if(AMP_NUMB_MAP(nAMP).eq. 0) then - AERO(AMP_AERO_MAP(nAMP)) =trm(i,j,l,n)*1.d9 / AVOL ! ug/m3 - else - - AERO(AMP_AERO_MAP(nAMP)) =trm(i,j,l,n)/ AVOL ! #/m3 - endif - ENDDO - - if (L.eq.1) then -! Emis Mass [ug/m3/s] <-- trflux1[kg/s] -#ifdef TRACERS_AMP_M4 - EMIS_MASS(2) = MAX(trflux1(i,j,n_M_ACC_SU)*1.d9 / AVOL,0.d0) - EMIS_MASS(3) = MAX(trflux1(i,j,n_M_BC1_BC)*1.d9 / AVOL,0.d0) - EMIS_MASS(4) = MAX(trflux1(i,j,n_M_OCC_OC)*1.d9 / AVOL,0.d0) - EMIS_MASS(5) = MAX(trflux1(i,j,n_M_DD1_DU)*1.d9 / AVOL,0.d0) - EMIS_MASS(6) = MAX(trflux1(i,j,n_M_SSS_SS)*1.d9 / AVOL,0.d0) - EMIS_MASS(10)= MAX(trflux1(i,j,n_M_DD2_DU)*1.d9 / AVOL,0.d0) -#else - EMIS_MASS(1) = MAX(trflux1(i,j,n_M_AKK_SU)*1.d9 / AVOL,0.d0) - EMIS_MASS(2) = MAX(trflux1(i,j,n_M_ACC_SU)*1.d9 / AVOL,0.d0) - EMIS_MASS(3) = MAX(trflux1(i,j,n_M_BC1_BC)*1.d9 / AVOL,0.d0) - EMIS_MASS(4) = MAX(trflux1(i,j,n_M_OCC_OC)*1.d9 / AVOL,0.d0) - EMIS_MASS(5) = MAX(trflux1(i,j,n_M_DD1_DU)*1.d9 / AVOL,0.d0) - EMIS_MASS(6) = MAX(trflux1(i,j,n_M_SSA_SS)*1.d9 / AVOL,0.d0) - EMIS_MASS(7) = MAX(trflux1(i,j,n_M_SSC_SS)*1.d9 / AVOL,0.d0) - EMIS_MASS(10)= MAX(trflux1(i,j,n_M_DD2_DU)*1.d9 / AVOL,0.d0) -#endif - endif -! Emis Mass [ug/m3/s] <-- trflux1[kg/s] -#ifdef TRACERS_AMP_M4 - EMIS_MASS(2) = EMIS_MASS(2) + ((tr3Dsource(i,j,l,nVolcanic,n_M_ACC_SU)+ - * tr3Dsource(i,j,l,nBiomass,n_M_ACC_SU))*1.d9 / AVOL) - EMIS_MASS(3) = EMIS_MASS(3) + (tr3Dsource(i,j,l,nBiomass,n_M_BC1_BC)*1.d9 / AVOL) - EMIS_MASS(9) = EMIS_MASS(9) + (tr3Dsource(i,j,l,nBiomass,n_M_OCC_OC)*1.d9 / AVOL) -#else - EMIS_MASS(1) = EMIS_MASS(1) + ((tr3Dsource(i,j,l,nVolcanic,n_M_AKK_SU)+ - * tr3Dsource(i,j,l,nBiomass,n_M_AKK_SU))*1.d9 / AVOL) - EMIS_MASS(2) = EMIS_MASS(2) + ((tr3Dsource(i,j,l,nVolcanic,n_M_ACC_SU)+ - * tr3Dsource(i,j,l,nBiomass,n_M_ACC_SU))*1.d9 / AVOL) - EMIS_MASS(3) = EMIS_MASS(3) + (tr3Dsource(i,j,l,nBiomass,n_M_BC1_BC)*1.d9 / AVOL) -c Biomass BC OC is Mixed -c EMIS_MASS(8) = EMIS_MASS(8) + (tr3Dsource(i,j,l,nBiomass,n_M_BOC_BC)*1.d9 / AVOL) -c EMIS_MASS(9) = EMIS_MASS(9) + (tr3Dsource(i,j,l,nBiomass,n_M_BOC_OC)*1.d9 / AVOL) -c Biomass BC OC is NOT mixed - EMIS_MASS(3) = EMIS_MASS(3) + (tr3Dsource(i,j,l,nBiomass,n_M_BC1_BC)*1.d9 / AVOL) - EMIS_MASS(4) = EMIS_MASS(4) + (tr3Dsource(i,j,l,nBiomass,n_M_OCC_OC)*1.d9 / AVOL) -#endif - CALL SPCMASSES(AERO,GAS,SPCMASS) - - CALL MATRIX(AERO,GAS,EMIS_MASS,TSTEP,TK,RH,PRES,AQSO4RATE,WUP,DT_AERO) -c CALL SIZE_PDFS(AERO,PDF1,PDF2) - - DO n=ntmAMPi,ntmAMPe - nAMP=n-ntmAMPi+1 - if(AMP_NUMB_MAP(nAMP).eq. 0) then -! Mass loop - tr3Dsource(i,j,l,nChemistry,n) =((AERO(AMP_AERO_MAP(nAMP)) *AVOL *1.d-9) -trm(i,j,l,n)) /dtsrc - else -! Number loop - tr3Dsource(i,j,l,nChemistry,n) =((AERO(AMP_AERO_MAP(nAMP)) *AVOL) -trm(i,j,l,n)) /dtsrc -#ifndef NO_HDIURN - if (DIAM(i,j,l,AMP_MODES_MAP(nAMP))*1.e6.ge.0.1 ) HD_NUMB(AMP_MODES_MAP(nAMP)) = AERO(AMP_AERO_MAP(nAMP)) -#endif -#ifdef CACHED_SUBDD -C**** -C**** Collect some high-frequency outputs -C**** - if (DIAM(i,j,l,AMP_MODES_MAP(nAMP))*1.e6.ge.0.1 ) HD_NUMB(AMP_MODES_MAP(nAMP)) = AERO(AMP_AERO_MAP(nAMP)) - PN_subdd(i,j) = PN_subdd(i,j) + (HD_NUMB(AMP_MODES_MAP(nAMP))) * ZHEIGHT1 - PN_3d_subdd(i,j,l) = PN_3d_subdd(i,j,l) + (HD_NUMB(AMP_MODES_MAP(nAMP))) -#endif /* CACHED_SUBDD */ - endif - ENDDO -#ifdef CACHED_SUBDD - APN_subdd(i,j) = APN_subdd(i,j) + sum(NACTV(i,j,l,:)) * ZHEIGHT1 - APN_3d_subdd(i,j,l) = APN_3d_subdd(i,j,l) + sum(NACTV(i,j,l,:)) - c1_3d_subdd(i,j,l) = c1_3d_subdd(i,j,l) + sum(CCNSS(i,j,l,:,1)) - c2_3d_subdd(i,j,l) = c2_3d_subdd(i,j,l) + sum(CCNSS(i,j,l,:,2)) - c5_3d_subdd(i,j,l) = c5_3d_subdd(i,j,l) + sum(CCNSS(i,j,l,:,3)) - p_3d_subdd(i,j,l) = PRES - rh_3d_subdd(i,j,l) = RH -#endif - NUMB_SS(i,j,l,1) = AERO(22) *AVOL - NUMB_SS(i,j,l,2) = AERO(25) *AVOL ! but has only tiny number in it - - - tr3Dsource(i,j,l,nChemistry,n_H2SO4) =((GAS(1)*AVOL *1.d-9) - * -trm(i,j,l,n_H2SO4)) /dtsrc - tr3Dsource(i,j,l,nChemistry,n_NH3) =((GAS(3)*AVOL *1.d-9) - * -trm(i,j,l,n_NH3)) /dtsrc - tr3Dsource(i,j,l,3,n_HNO3) =((GAS(2)*AVOL *1.d-9) - * -trm(i,j,l,n_HNO3))/dtsrc - -c DT_AERO(:,:) = DT_AERO(:,:) * dtsrc !DT_AERO [# or ug/m3/s] , taijs [kg m2/kg(air)], byam [kg/m2] - -c Update physical properties per mode - do n=ntmAMPi,ntmAMPe - nAMP=n-ntmAMPi+1 -c Diagnostic of Processes - Sources and Sincs - timestep included - if(AMP_NUMB_MAP(nAMP).eq. 0) then !taijs [kg/s] -> in acc [kg/m2*s] - do m=1,7 - taijs(i,j,ijts_AMPp(m,n)) =taijs(i,j,ijts_AMPp(m,n)) +(DT_AERO(m+8,AMP_AERO_MAP(nAMP))* AVOL * 1.d-9) - if (itcon_amp(m,n).gt.0) call inc_diagtcb(i,j,(DT_AERO(m+8,AMP_AERO_MAP(nAMP))* AVOL * 1.d-9),itcon_amp(m,n),n) - end do - - else - taijs(i,j,ijts_AMPp(1,n)) =taijs(i,j,ijts_AMPp(1,n))+(DT_AERO(2,AMP_AERO_MAP(nAMP))* AVOL) - if (itcon_amp(1,n).gt.0) call inc_diagtcb(i,j,(DT_AERO(2,AMP_AERO_MAP(nAMP))* AVOL),itcon_amp(1,n),n) - taijs(i,j,ijts_AMPp(2,n)) =taijs(i,j,ijts_AMPp(2,n))+(DT_AERO(3,AMP_AERO_MAP(nAMP))* AVOL) - if (itcon_amp(2,n).gt.0) call inc_diagtcb(i,j,(DT_AERO(3,AMP_AERO_MAP(nAMP))* AVOL),itcon_amp(2,n),n) - taijs(i,j,ijts_AMPp(3,n)) =taijs(i,j,ijts_AMPp(3,n))+(DT_AERO(1,AMP_AERO_MAP(nAMP))* AVOL) - if (itcon_amp(3,n).gt.0) call inc_diagtcb(i,j,(DT_AERO(1,AMP_AERO_MAP(nAMP))* AVOL),itcon_amp(3,n),n) - do m=4,7 - taijs(i,j,ijts_AMPp(m,n)) =taijs(i,j,ijts_AMPp(m,n))+(DT_AERO(m,AMP_AERO_MAP(nAMP))* AVOL) - if (itcon_amp(m,n).gt.0) call inc_diagtcb(i,j,(DT_AERO(m,AMP_AERO_MAP(nAMP))* AVOL),itcon_amp(m,n),n) - end do - - endif - select case (trname(n)) !taijs [kg * m2/kg air] -> in acc [kg/kg air] - CASE('N_AKK_1 ','N_ACC_1 ','N_DD1_1 ','N_DS1_1 ','N_DD2_1 ','N_DS2_1 ','N_OCC_1 ','N_BC1_1 ', - * 'N_BC2_1 ','N_BC3_1 ','N_DBC_1 ','N_BOC_1 ','N_BCS_1 ','N_MXX_1 ','N_OCS_1 ') -c - 3d acc output - taijls(i,j,l,ijlt_AMPm(1,n))=taijls(i,j,l,ijlt_AMPm(1,n)) + DIAM(i,j,l,AMP_MODES_MAP(nAMP)) - taijls(i,j,l,ijlt_AMPm(2,n))=taijls(i,j,l,ijlt_AMPm(2,n)) + (NACTV(i,j,l,AMP_MODES_MAP(nAMP))*AVOL*byam(l,i,j)/axyp(i,j)) - -c - 2d PRT Diagnostic - if (itcon_AMPm(1,n) .gt.0) call inc_diagtcb(i,j,(DIAM(i,j,l,AMP_MODES_MAP(nAMP))*1d6),itcon_AMPm(1,n),n) - if (itcon_AMPm(2,n) .gt.0) call inc_diagtcb(i,j,NACTV(i,j,l,AMP_MODES_MAP(nAMP))*AVOL ,itcon_AMPm(2,n),n) - end select - - enddo !n -c - special diag: Size distribution pdfs -c if (l.eq.1) taijs(i,j,ijts_AMPpdf(l,:))=taijs(i,j,ijts_AMPpdf(l,:)) + (PDF1(:)*AVOL*byam(l,i,j)) -c - N_SSA, N_SSC, M_SSA_SU - taijls(i,j,l,ijlt_AMPext(1))=taijls(i,j,l,ijlt_AMPext(1)) + (NACTV(i,j,l,SEAS_MODE_MAP(1))*AVOL*byam(l,i,j)/axyp(i,j)) - taijls(i,j,l,ijlt_AMPext(2))=taijls(i,j,l,ijlt_AMPext(2)) + (NACTV(i,j,l,SEAS_MODE_MAP(2))*AVOL*byam(l,i,j)/axyp(i,j)) - taijls(i,j,l,ijlt_AMPext(3))=taijls(i,j,l,ijlt_AMPext(3)) + DIAM(i,j,l,SEAS_MODE_MAP(1)) - taijls(i,j,l,ijlt_AMPext(4))=taijls(i,j,l,ijlt_AMPext(4)) + DIAM(i,j,l,SEAS_MODE_MAP(2)) - taijls(i,j,l,ijlt_AMPext(5))=taijls(i,j,l,ijlt_AMPext(5)) + (AERO(22) *AVOL*byam(l,i,j)/axyp(i,j)) - taijls(i,j,l,ijlt_AMPext(6))=taijls(i,j,l,ijlt_AMPext(6)) + (AERO(25) *AVOL*byam(l,i,j)/axyp(i,j)) - - taijls(i,j,l,ijlt_AMPext(7))=taijls(i,j,l,ijlt_AMPext(7)) + (SUM(CCNSS(i,j,l,:,1))*AVOL*byam(l,i,j)/axyp(i,j)) - taijls(i,j,l,ijlt_AMPext(8))=taijls(i,j,l,ijlt_AMPext(8)) + (SUM(CCNSS(i,j,l,:,2))*AVOL*byam(l,i,j)/axyp(i,j)) - taijls(i,j,l,ijlt_AMPext(9))=taijls(i,j,l,ijlt_AMPext(9)) + (SUM(CCNSS(i,j,l,:,3))*AVOL*byam(l,i,j)/axyp(i,j)) - -#ifndef NO_HDIURN -c Hourly Station Diagnostic ------------------------------------------------------------------------------- - idxd=(/(idd_diam+ii-1,ii=1,nmodes),(idd_numb+ii-1,ii=1,nmodes),(idd_mass+ii-1,ii=1,38), - * idd_so2, idd_lwp /) - idxl=(/ (idd_ncL+l-1), (idd_ccn+l-1), (idd_cdnc+l-1),(idd_lwc+l-1),(idd_pres+l-1)/) - ih=jhour+1 - ihm=ih+(jdate-1)*24 - - do kr=1,ndiupt - if(i.eq.ijdd(1,kr).and.j.eq.ijdd(2,kr)) then - - if (l.eq.1) then ! only surface diagnostic -c surface - tmp(idd_diam:idd_diam+nmodes-1)=diam(i,j,1,1:nmodes) - tmp(idd_numb:idd_numb+nmodes-1)= HD_NUMB(1:nmodes) ! #/m3 - tmp(idd_mass) = AERO(1) ! ug/m3; - tmp(idd_mass+1)= AERO(2) ! ug/m3; - tmp(idd_mass+2)= AERO(3) ! ug/m3; - tmp(idd_mass+3)= AERO(4) ! ug/m3; - tmp(idd_mass+4)= AERO(6) ! ug/m3; - tmp(idd_mass+5)= AERO(8) ! ug/m3; - tmp(idd_mass+6)= AERO(9) ! ug/m3; - tmp(idd_mass+7)= AERO(11) ! ug/m3; - tmp(idd_mass+8)= AERO(12) ! ug/m3; - tmp(idd_mass+9)= AERO(14) ! ug/m3; - tmp(idd_mass+10)= AERO(15) ! ug/m3; - tmp(idd_mass+11)= AERO(17) ! ug/m3; - tmp(idd_mass+12)= AERO(18) ! ug/m3; - tmp(idd_mass+13)= AERO(20) ! ug/m3; - tmp(idd_mass+14)= AERO(21) ! ug/m3; - tmp(idd_mass+15)= AERO(23) ! ug/m3; - tmp(idd_mass+16)= AERO(24) ! ug/m3; - tmp(idd_mass+17)= AERO(26) ! ug/m3; - tmp(idd_mass+18)= AERO(27) ! ug/m3; - tmp(idd_mass+19)= AERO(29) ! ug/m3; - tmp(idd_mass+20)= AERO(30) ! ug/m3; - tmp(idd_mass+21)= AERO(32) ! ug/m3; - tmp(idd_mass+22)= AERO(33) ! ug/m3; - tmp(idd_mass+23)= AERO(35) ! ug/m3; - tmp(idd_mass+24)= AERO(36) ! ug/m3; - tmp(idd_mass+25)= AERO(38) ! ug/m3; - tmp(idd_mass+26)= AERO(39) ! ug/m3; - tmp(idd_mass+27)= AERO(40) ! ug/m3; - tmp(idd_mass+28)= AERO(42) ! ug/m3; - tmp(idd_mass+29)= AERO(43) ! ug/m3; - tmp(idd_mass+30)= AERO(44) ! ug/m3; - tmp(idd_mass+31)= AERO(46) ! ug/m3; - tmp(idd_mass+32)= AERO(47) ! ug/m3; - tmp(idd_mass+33)= AERO(49) ! ug/m3; - tmp(idd_mass+34)= AERO(50) ! ug/m3; - tmp(idd_mass+35)= AERO(51) ! ug/m3; - tmp(idd_mass+36)= AERO(52) ! ug/m3; - tmp(idd_mass+37)= AERO(53) ! ug/m3; - tmp(idd_so2) = trm(i,j,l,n_SO2)* 1.d9 / AVOL!ug/m3 - tmp(idd_lwp) = DIURN_LWP(i,j) ! kg/m2 - - ADIURN(idxd(:),kr,ih) =ADIURN(idxd(:),kr,ih)+tmp(idxd(:)) - HDIURN(idxd(:),kr,ihm)=HDIURN(idxd(:),kr,ihm)+tmp(idxd(:)) - - end if ! level 1 only - -c profile - tmp(idd_ccn+L-1) = sum(nactv(i,j,l,:)) *1.e-6 ! #/cm3 - tmp(idd_ncL+L-1) = sum(HD_NUMB(:)) *1.e-6 ! #/cm3 -#ifdef CLD_AER_CDNC - tmp(idd_cdnc+L-1) = CDN3d(l,i,j) -#else - tmp(idd_cdnc+L-1) = 0.d0 -#endif - tmp(idd_lwc+L-1) = DIURN_LWC(i,j,l) ! kg/kg(air) - tmp(idd_pres+L-1) = pres ! hPa - - - ADIURN(idxl(:),kr,ih) =ADIURN(idxl(:),kr,ih)+tmp(idxl(:)) - HDIURN(idxl(:),kr,ihm)=HDIURN(idxl(:),kr,ihm)+tmp(idxl(:)) - - end if - end do -#endif - - - ENDDO !i - ENDDO !j - ENDDO !l - - -#ifdef CACHED_SUBDD -C**** -C**** Collect some high-frequency outputs -C**** - call find_groups('aijh',grpids,ngroups) - do igrp=1,ngroups - subdd => subdd_groups(grpids(igrp)) - do kr=1,subdd%ndiags - select case (subdd%name(kr)) - - case ('pn') - call inc_subdd(subdd,kr,PN_subdd) - PN_subdd(:,:) = 0.d0 - case ('apn') - call inc_subdd(subdd,kr,APN_subdd) - APN_subdd(:,:) = 0.d0 - end select - enddo - enddo - - - call find_groups('aijlh',grpids,ngroups) - do igrp=1,ngroups - subdd => subdd_groups(grpids(igrp)) - do kr=1,subdd%ndiags - select case (subdd%name(kr)) - case ('apn_3d') - call inc_subdd(subdd,kr,apn_3d_subdd) - case ('pn_3d') - call inc_subdd(subdd,kr,pn_3d_subdd) - case ('p_3d') - call inc_subdd(subdd,kr,p_3d_subdd) - case ('rh_3d') - call inc_subdd(subdd,kr,rh_3d_subdd) - case ('ccn01_3d') - call inc_subdd(subdd,kr,c1_3d_subdd) - case ('ccn02_3d') - call inc_subdd(subdd,kr,c2_3d_subdd) - case ('ccn05_3d') - call inc_subdd(subdd,kr,c5_3d_subdd) - end select - enddo - enddo - -#endif /* CACHED_SUBDD */ - - - - RETURN - END SUBROUTINE MATRIX_DRV -c ----------------------------------------------------------------- - -c ----------------------------------------------------------------- - SUBROUTINE AMPtrdens(i,j,l,n) -!---------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the actual density per mode -!---------------------------------------------------------------------------------------------------------------------- - USE TRACER_COM - USE AMP_AEROSOL, only : AMP_dens - USE AERO_CONFIG, ONLY: NMODES - - IMPLICIT NONE - Integer :: i,j,l,n,x,nAMP - real*8, dimension(:), allocatable :: trpdens_local - - allocate(trpdens_local(ntm)) - do x=1,ntm - trpdens_local(x)=trpdens(x) - enddo - - nAMP=n-ntmAMPi+1 - if(AMP_MODES_MAP(nAMP).gt.0) - & AMP_dens(i,j,l,AMP_MODES_MAP(nAMP)) = - & sum(trpdens_local(AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP)) * trm(i,j,l,AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP))) - & / (sum(trm(i,j,l,AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP))) + 1.0D-30) - if (AMP_dens(i,j,l,AMP_MODES_MAP(nAMP)).le.0) AMP_dens(i,j,l,AMP_MODES_MAP(nAMP)) = trpdens_local(AMP_MODES_MAP(nAMP)) - - deallocate(trpdens_local) - - RETURN - END SUBROUTINE AMPtrdens -c ----------------------------------------------------------------- -c ----------------------------------------------------------------- - SUBROUTINE AMPtrmass(i,j,l,n) -!---------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the actual molecular mass per mode -!---------------------------------------------------------------------------------------------------------------------- - USE TRACER_COM - USE AMP_AEROSOL, only : AMP_TR_MM - USE AERO_CONFIG, ONLY: NMODES - - IMPLICIT NONE - Integer :: i,j,l,n,x,nAMP - real*8, dimension(:), allocatable :: tr_mm_local - - allocate(tr_mm_local(ntm)) - do x=1,ntm - tr_mm_local(x)=tr_mm(x) - enddo - - nAMP=n-ntmAMPi+1 - if(AMP_MODES_MAP(nAMP).gt.0.and.sum(trm(i,j,l,AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP))).gt.0. ) - & AMP_TR_MM(i,j,l,AMP_MODES_MAP(nAMP)) = - & sum(tr_mm_local(AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP)) * trm(i,j,l,AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP))) - & / sum(trm(i,j,l,AMP_trm_nm1(nAMP):AMP_trm_nm2(nAMP))) - if (AMP_TR_MM(i,j,l,AMP_MODES_MAP(nAMP)).le.0) AMP_TR_MM(i,j,l,AMP_MODES_MAP(nAMP)) = tr_mm_local(AMP_MODES_MAP(nAMP)) - - deallocate(tr_mm_local) - - RETURN - END SUBROUTINE AMPtrmass -c ----------------------------------------------------------------- -#endif GEOS5_PORT - - SUBROUTINE SPCMASSES(AERO,GAS,SPCMASS) -!---------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the total mass concentration of each model species: -! SULF, BCAR, OCAR, DUST, SEAS, NO3, NH4. Aerosol water is not treated. -!---------------------------------------------------------------------------------------------------------------------- - USE AERO_SETUP, ONLY: SULF_MAP, BCAR_MAP, OCAR_MAP, DUST_MAP, SEAS_MAP - USE AERO_PARAM - USE AERO_CONFIG - IMPLICIT NONE - REAL(8) :: AERO(NAEROBOX) - REAL(8) :: GAS(NGASES) - REAL(8) :: SPCMASS(NMASS_SPCS+2) - SPCMASS(1) = SUM( AERO( SULF_MAP(:) ) ) + GAS( GAS_H2SO4 ) - SPCMASS(2) = SUM( AERO( BCAR_MAP(:) ) ) - SPCMASS(3) = SUM( AERO( OCAR_MAP(:) ) ) - SPCMASS(4) = SUM( AERO( DUST_MAP(:) ) ) - SPCMASS(5) = SUM( AERO( SEAS_MAP(:) ) ) - SPCMASS(6) = AERO( MASS_NO3 ) + GAS( GAS_HNO3 ) - SPCMASS(7) = AERO( MASS_NH4 ) + GAS( GAS_NH3 ) - - - RETURN - END SUBROUTINE SPCMASSES - - SUBROUTINE SIZE_PDFS(AERO,PDF1,PDF2) - USE AERO_PARAM, ONLY: PI6, DENSP, IXXX, IYYY, ILAY - USE AERO_CONFIG, ONLY: NMODES, NAEROBOX,NBINS - USE AERO_SETUP, ONLY: SIG0, CONV_DPAM_TO_DGN, NUMB_MAP, MODE_NAME - USE AMP_AEROSOL, only: DIAM - IMPLICIT NONE - - ! Arguments. - REAL(8), INTENT(IN) :: AERO(NAEROBOX)! aerosol conc. [ug/m^3] or [#/m^3] - - ! Local variables. - - INTEGER :: I, N -! INTEGER, PARAMETER :: NBINS = 30! 200 ! number of bins [1] defined in config - REAL(8) :: DGRID(NBINS) ! fixed diameter grid [um] - REAL(8) :: MGRID(NBINS) ! fixed mass/particle grid [ug/particle] - REAL(8) :: DLOWER(NBINS) ! lower boundary fixed diameter grid [um] - REAL(8) :: DUPPER(NBINS) ! upper boundary fixed diameter grid [um] - REAL(8) :: NTOT(NMODES) ! number concentration for each mode [#/m^3] - REAL(8) :: PDF(NBINS,2,NMODES) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: PDF1(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: PDF2(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: DNDLOGD(NMODES) ! dN/dlog10(Dp) [ #/m^3] - REAL(8) :: DMDLOGD(NMODES) ! dM/dlog10(Dp) [ug/m^3] - REAL(8) :: RDMIN ! reciprocal of DMIN to optimize coagulation [1/um] - REAL(8) :: RDLOGDSC ! reciprocal of log10 of the grid spacing [1] - REAL(8) :: SCALE, F, SUM1, SUM2 ! scratch variables - REAL(8) :: DMINL, DMAXL, DG ! diameters [um] - REAL(8) :: FLN ! function for lognormal distribution [1] - REAL(8), PARAMETER :: DMIN = 0.001D+00 ! smallest particle diameter of the discrete grid [um] - REAL(8), PARAMETER :: DMAX = 20.000D+00 ! largest particle diameter of the discrete grid [um] - - - DMAXL = DMAX - DMINL = DMIN - - SCALE = ( DMAXL / DMINL )**(1.0D+00/REAL(NBINS-1)) - RDLOGDSC = 1.0D+00 / LOG10( SCALE ) - RDMIN = 1.0D+00 / DMINL - DO I=1, NBINS - DGRID(I) = DMINL * SCALE**(I-1) ! [um] - DLOWER(I) = DGRID(I) / SCALE**0.5D+00 ! [um] - DUPPER(I) = DGRID(I) * SCALE**0.5D+00 ! [um] - MGRID(I) = 1.0D-06 * DENSP * PI6 * DGRID(I)**3 ! [ug/particle] - DO N=1, NMODES - DG = 1.0D+06 * DIAM(IXXX,IYYY,ILAY,N) * CONV_DPAM_TO_DGN(N) ! convert [m] to [um] and Dbar to Dg - NTOT(N) = AERO( NUMB_MAP(N) ) - F = NTOT(N) * FLN( DGRID(I), DG, SIG0(N) ) - PDF(I,1,N) = F * ( DUPPER(I) - DLOWER(I) ) - PDF(I,2,N) = PDF(I,1,N) * MGRID(I) - DNDLOGD(N) = PDF(I,1,N) * RDLOGDSC * 1.0D-06 ! convert from [#/m^3] to [#/cm^3] - DNDLOGD(N) = MAX( DNDLOGD(N), 1.0D-30 ) - DMDLOGD(N) = PDF(I,2,N) * RDLOGDSC ! [ug/m^3] - DMDLOGD(N) = MAX( DMDLOGD(N), 1.0D-30 ) - ENDDO -c WRITE(IUNIT,91) I, DGRID(I), DNDLOGD(:) -c WRITE(JUNIT,91) I, DGRID(I), DMDLOGD(:) - ENDDO - - PDF1(:) = 0.0D+00 - PDF2(:) = 0.0D+00 - DO N=1, NMODES - DO I=1, NBINS - PDF1(I) = PDF1(I) + PDF(I,1,N) - PDF2(I) = PDF2(I) + PDF(I,2,N) - SUM1 = SUM1 + PDF(I,1,N) - SUM2 = SUM2 + PDF(I,2,N) - ENDDO - ENDDO - - RETURN - END SUBROUTINE SIZE_PDFS - - - REAL(8) FUNCTION FLN(X,XG,SIGMAG) - REAL(8) :: X ! particle radius or diameter [any units] - REAL(8) :: XG ! geometric mean radius or diameter [any units] - REAL(8) :: SIGMAG ! geometric standard deviation [monodisperse = 1.0] - REAL(8), PARAMETER :: SQRTTWOPI = 2.506628275D+00 - FLN = EXP(-0.5D+00*(LOG(X/XG)/LOG(SIGMAG))**2) / (X*LOG(SIGMAG)*SQRTTWOPI) - RETURN - END FUNCTION FLN - -#ifndef GEOS5_PORT - subroutine alloc_tracer_amp_com(grid) -!@SUM To alllocate arrays whose sizes now need to be determined -!@+ at run-time -!@auth Susanne Bauer -!@ver 1.0 - use domain_decomp_atm, only : dist_grid, get - use model_com, only : im,lm - use amp_aerosol - use aero_config, only : nmodes - - IMPLICIT NONE - - type (dist_grid), intent(in) :: grid - integer :: ier, J_1H, J_0H, I_1H, I_0H - logical :: init = .false. - - if(init)return - init=.true. - - call get( grid , J_STRT_HALO=J_0H, J_STOP_HALO=J_1H ) - I_0H=GRID%I_STRT_HALO - I_1H=GRID%I_STOP_HALO - -! I,J,L - allocate( AQsulfRATE(I_0H:I_1H,J_0H:J_1H,LM) ) -! other dimensions - allocate( DIAM(I_0H:I_1H,J_0H:J_1H,LM,nmodes) ) - allocate( AMP_TR_MM(I_0H:I_1H,J_0H:J_1H,LM,nmodes) ) - allocate( AMP_dens(I_0H:I_1H,J_0H:J_1H,LM,nmodes) ) - allocate( NACTV(I_0H:I_1H,J_0H:J_1H,LM,nmodes) ) - allocate( CCNSS(I_0H:I_1H,J_0H:J_1H,LM,nmodes,3) ) - allocate( VDDEP_AERO(I_0H:I_1H,J_0H:J_1H,nmodes,2)) - allocate( NUMB_SS(I_0H:I_1H,J_0H:J_1H,LM,2)) -#ifndef NO_HDIURN - allocate( DIURN_LWP(I_0H:I_1H,J_0H:J_1H)) ! lwp hourly output - allocate( DIURN_LWC(I_0H:I_1H,J_0H:J_1H,LM)) ! lwc hourly output -#endif - - NACTV = 1.0D-30 - DIAM = 1.0D-30 - NUMB_SS = 1.0D-30 - return - end subroutine alloc_tracer_amp_com -#endif diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_eqsam_v03d.F90 b/MATRIXchem_GridComp/microphysics/TRAMP_eqsam_v03d.F90 deleted file mode 100644 index 9e3297c2..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_eqsam_v03d.F90 +++ /dev/null @@ -1,700 +0,0 @@ -subroutine eqsam_v03d(yi,yo,nca,nco,iopt,loop,imax,ipunit)!,in) -! -implicit none -! -!@auth Swen Metzger/Susanne Bauer/Doug Wright -!___________________________________________________________________________________________________________________________________ -! Written by Swen Metzger 3/11/99. Modified 2002, 2003. -! -! Department of Atmospheric Chemistry, Max-Planck-Institute for Chemistry. -! email: metzger@mpch-mainz.mpg.de -! http://www.mpch-mainz.mpg.de/~metzger -! -! COPYRIGHT 1999-2003 -! -! purpose -! ------- -! EQSAM (EQuilibrium Simplified Aerosol Model) is a new and computationally efficient thermodynamic -! aerosol composition model that allows to calculate the gas/aerosol equilibrium partitioning, -! including aerosol water, sufficiently fast and accurate for global (or even regional) modeling. -! EQSAM is based on a number of parameterizations, including single solute molalities and activity -! coefficients (AC). The thermodynamic framework (domains and subdomains, internally mixed aerosols) -! is the same as of more sophisticated thermodynamic equilibrium models (EQMs), e.g. of ISORROPIA -! (Nenes et al., 1998). Details are given in the references below (and the references therein). -! -! The main assumption on which EQSAM/EQMs are based is thermodynamical and chemical equilibrium. -! From this assumption it directly follows that the aerosol water activity (aw) equals the ambient -! relative humidity (RH), if the water vapor pressure is sufficiently larger than the partial vapor -! pressure of the aerosol compounds. This is approximately true for tropospheric aerosols. Given the -! large amount of water vapor present, water vapor and aerosol water equilibrate relatively faster -! compared to all other aerosol compounds. This is subsequently also true for single aerosol compounds. -! The water activity of single solutes must also equal RH under this assumption. Therefore, the so -! called ZSR-relation is (and can be) used to calculate the aerosol associated water mass (simply -! from the sum of all water mass fractions that are derived from measured single solute molalities). -! -! In contrast to other EQMs, EQSAM utilizes the fact that the RH fixes the water activity -! (under the above assumptions) and the consequence that any changes in RH also causes changes in -! the aerosol water mass and, hence, aerosol activity (including activity coefficients). Thus, an decrease -! (increase) in RH decrease (increases) the aerosol water mass (and water activity). This can change the -! aerosol composition, e.g. due to condensation (evaporation/crystallization), because the vapor pressure -! above the aerosol reduces (increases). In turn, a vapor pressure reduction (increase) due to changes -! in the aerosol composition is compensated by an associated condensation (evaporation) of water vapor -! to maintain the aerosol molality to remain constant (because aw=RH). Furthermore, the aerosol water -! mainly depends on the aerosol mass and the type of solute, so that parameterizations of single solute -! molalities and activity coefficients can be defined, only depending on the type of solute and RH. -! The advantage of using such parameterizations is that the entire aerosol equilibrium composition -! can be solved analytically, i.e. non-iteratively, which considerably reduces the amount of CPU time -! that is usually need for aerosol thermodynamic calculations (especially if an EQM is incorporated in -! an aerosol dynamical model that is in turn embedded in a high resolution regional or global model). -! -! However, EQSAM should still be regarded as a starting point for further developments. There is still -! room for improvements. For instance, this code is not yet numerically optimized (vectorized) and a -! number of improvements with respect to an explicit treatment of additional equilibrium reactions, -! missing (or only implicit) dissociation, and a basic parameterization of the water uptake. -! -! Note that EQSAM was originally developed to calculate the gas/aerosol equilibrium partitioning of the -! ammonium-sulfate-nitrate-water system for climate models, excluding solid compounds. -! This version (eqsam_v03d.f90) is extended with respect to sea salt. Solids/hysteresis are treated in a -! simplified manner. Results of a box model comparison with ISORROPIA will be available from the web page. -! Please also note that the water uptake is based on additional (unpublished) parameterizations for single -! solute molalities, which are derived from tabulated measurements used in ISORROPIA. Note further that -! this extended version (eqsam_v03d.f90) is not yet published. A publication is in progress. -! -! ToDo: -! Split ion-pairs into ions for water parameterizations (since info is actually available) -! Include uptake/dissociation of NH3, HNO3, HCl (mainly to get pH right at near neutral conditions) -! Extension to K+,Ca++,Mg++, CO2/(CO3)2--/HCO3-,SOA,etc.. (maybe not) -! Vectorization. Translation of hardcoded formulas in array syntax. -! I/O Interface and program structure clean up. -! EQSAM info webpage. -! -! Version History: -! -! eqsam_v03d.f90 (MPI-CH, June 2003): -! - gama parameterizations now according to Metzger 2002 (JGR Appendix) -! - improved pH calculations (still restricted to strong acids) -! - removed bug that lead to too high nitrate formation at dry and cold regions (UT/LS) -! - removed bug in solid/hysteresis calculations -! (both bugs introduced in eqsam_v03b.f90 by cleaning up eqsam_v02a.f90) -! -! eqsam_v03c.f90 (MPI-CH, April 2003): -! - more accurate paramterizations of single solute molalities (Na, Cl species) -! - cleanded up RHD subdomain structure -! - improved water uptake (Na, Cl species) -! -! eqsam_v03b.f90 (MPI-CH, March 2003): -! System extended to HCl,Cl-/Na+. -! Parameterization (fit) of additional HNO3 uptake removed. -! Instead, complete analytical solution of equilibrium reactions, based on the AC-RH relationship. -! eqsam_v03.f90 (IMAU, October 1999): -! Test version (included in TM3). -! eqsam_v02a.f90 (IMAU, April 2000): -! Box model version. -! eqsam_v02.f90 (IMAU, October 1999): -! TM3 version. -! Version including solids and additional HNO3 uptake on acidic aerosols (parameterized). -! eqsam_v01b.f90 (MPI-CH, January 2003): -! Same as eqsam_v01a.f90 (additional lines though uncommented for test purposes only). -! eqsam_v01a.f90 (IMAU, April 2000): -! Box model version. -! eqsam_v01.f90 (IMAU, October 1999): -! TM3 version. -! First and most basic version (without solids) for better vectorization (for global modeling). -! System: NH3,NH4+/H2SO4+,HSO4-,SO4--/HNO3,NO3-, H2O -! based on equilibrium / internal mixture assumption / aw=rh / ZSR-relation -! parameterization of activcity coefficients (AC), i.e. an AC-RH relationship -! -! -! interface -! --------- -! call eqsam_v03d(yi,yo,nca,nco,iopt,loop,imax,ipunit,in) -! -! yi = input array (imax, nca) -! yo = output array (imax, nco) -! imax = max loop (e.g. time steps) -! nca >= 11 -! nc0 >= 35 -! iopt = 1 metastable -! iopt = 2 solids -! iopt = 3 hysteresis (metastable/solids) for online calculations -! iopt = 31 hysteresis lower branch -! iopt = 32 hysteresis upper branch -! ipunit = I/O unit (can be skipped) -! in = array (can be skipped) -! -! method -! ------ -! equilibrium / internal mixture assumption / aw=rh -! System: NH3,NH4+/H2SO4+,HSO4-,SO4--/HNO3,NO3-, HCl,Cl-/Na+, H2O -! (K+,Ca++,Mg++) -! external -! -------- -! program eqmd.f90 (driver only needed for the box model version) -! subroutine gribio.f90 (provides diagnostics output in grib/binary/ascii format) -! -! references -! --------- -! Swen Metzger Ph.D Thesis, University Utrecht, 2000. -! http://www.library.uu.nl/digiarchief/dip/diss/1930853/inhoud.htm -! -! Metzger, S. M., F. J. Dentener, J. Lelieveld, and S. N. Pandis, -! GAS/AEROSOL PARTITIONING I: A COMPUTATIONALLY EFFICIENT MODEL, -! J Geophys. Res., 107, D16, 10.1029/2001JD001102, 2002 -! http://www.agu.org/journals/jd/jd0216/2001JD001102/index.html -! Metzger, S. M., F. J. Dentener, A. Jeuken, and M. Krol, J. Lelieveld, -! GAS/AEROSOL PARTITIONING II: GLOBAL MODELING RESULTS, -! J Geophys. Res., 107, D16, 10.1029/2001JD001103, 2002. -! http://www.agu.org/journals/jd/jd0216/2001JD001103/index.html -!___________________________________________________________________________________________________________________________________ -real,parameter :: RH_HIST_DW=1.50 ! mean value for mixture of wet (2) and dry (1) gridboxes (needed for HYSTERESIS) -real,parameter :: T0=298.15,T1=298.0,AVO=6.03e23,R=82.0567e-6, & ! in cu.m*atm/deg/mole - r_kcal = 1.986E-3 ! Ideal gas constant [kcal K-1.mole-1] -real,parameter :: RHMAX=0.99,RHMIN=0.0001 ! restrict to max / min RH -real,parameter :: MWNH4=18.,MWSO4=96.,MWNO3=62.,MWCl=35.5 ! mole mass of species considered -real,parameter :: MWNa=23.0,MWCa=40.1,MWN=14.0, MWS=32.1 -real,parameter :: MWH20=55.51*18.01,ZERO=0.0 -real,parameter :: GF1=0.25,GF2=0.50,GF3=0.40,GF4=1.00,K=2. ! exponents of AC-RH functions -!______________________________________________ -integer,parameter :: NPAIR=10 -! -integer :: ii,il,IHYST -integer,intent(in) :: nca,nco,imax,loop,ipunit -integer,intent(inout) :: iopt -!______________________________________________ -!integer,dimension(6),intent(in) :: in -!______________________________________________ -real :: T0T,TT,RH,PX,RHD,KAN,KAC,ZIONIC,RH_HIST,GAMA,GG,GF,GFN -real :: X00,X01,X02,X03,X04,X05,X08,X09,X10,X11 -real :: X0,X1,X2,X3,X4,X5,X6,XK10,XK6 -real :: ZFLAG,ZKAN,ZKAC,PH,COEF,HPLUS,AKW,XKW,MOLAL -real :: TNH4,TSO4,TNO3,TNa,TCl,TPo,TCa,TMg -real :: PNH4,PSO4,PNO3,PCl,PNa,GNO3,GNH3,GSO4,GHCl -real :: ASO4,ANO3,ANH4,ACl,ANa,SNH4,SSO4,SNO3,SCl,SNa -real :: WH2O,PM,PMs,PMt,RINC,DON,RATIONS,GR,NO3P,NH4P -!_______________________________________________ -real,dimension(imax,nca),intent(in) :: yi -real,dimension(imax,nco),intent(out) :: yo -real,dimension(8) :: w1,w2 -real,dimension(8) :: RHDA,RHDE,RHDX,RHDZ ! RHD / MRHD arrays for different aerosol types -real,dimension(NPAIR) :: M0,MW,NW,ZW ! arrays of ion pairs -! -! salt solutes: -! 1 = NACl, 2 = (NA)2SO4, 3 = NANO3, 4 = (NH4)2SO4, 5 = NH4NO3, 6 = NH4CL, 7 = 2H-SO4 -! 8 = NH4HSO4, 9 = NAHSO4, 10 = (NH4)3H(SO4)2 -! -DATA MW(1:NPAIR)/ 58.5, 142.0, 88.0, 132.0, 80.0, 53.5, 98.0, 115.0, 120.0, 247.0/ ! mole mass of the salt solute -DATA NW(1:NPAIR)/ 2.0, 2.5, 2.5, 2.5, 3.5, 1.0, 4.5, 2.0, 2.0, 2.5/ ! square of max. dissocation number (not consistent) -DATA ZW(1:NPAIR)/ 0.67, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0/ ! exponents of water activity functions -! -DATA RHDA(1:8)/0.32840, 0.4906, 0.6183, 0.7997, 0.67500, 0.5000, 0.4000, 0.0000/ ! RHD / MRHD values as of ISORROPIA / SCAPE (T=298.15K) -DATA RHDE(1:8)/-1860.0, -431.0, 852.00, 80.000, 262.000, 3951.0, 384.00, 0.0000/ ! Temp. coeff. -!___________________________________________________________________________________________________________________________________ -IHYST=2 -IF(IOPT.EQ.31) THEN ! SOLID HYSTORY - IHYST=1 - IOPT=3 -ELSEIF(IOPT.EQ.32) THEN ! WET HISTORY - IHYST=2 - IOPT=3 -ENDIF -!------------------------------------------------------------------------------- -!DLW:010406: Commented out print block. -!------------------------------------------------------------------------------- -!write(ipunit,*)'eqsam_v03d ...' -!print*,' ' -!print*,' EQuilibrium Simplified Aerosol Model (EQSAM)' -!print*,' for global modeling ' -!print*,' by ' -!print*,' Swen Metzger, MPI-CH ' -!print*,' Copyright 1999-2003 ' -!print*,' >> metzger@mpch-mainz.mpg.de << ' -!print*,' last change: 04. June, 2003 ' -!print*,' (version 3.0d) ' -!print*,' gas/aerosol calculations assuming ' -!print*,' System: NH3,NH4+/H2SO4+,HSO4-,SO4-- ' -!print*,' HNO3,NO3-, HCl,Cl-/Na+, H2O ' -!if(iopt.eq.1) then -!print*,' metastable aeorsols ' -!elseif(iopt.eq.2) then -!print*,' solid aeorsols ' -!elseif(iopt.eq.3) then -!print*,' hysteresis ' -!print*,' (metastable/solids) ' -!if(IHYST.eq.1) then -!print*,' solid hystory ' -!elseif(IHYST.eq.2) then -!print*,' wet hystory ' -!endif -!endif -!print*,' ' -!print*,'loop over ',loop,' data sets' -!print*,' ' -!------------------------------------------------------------------------------- -!DLW:010406: End comment out print block. -!------------------------------------------------------------------------------- -!___________________________________________________________________________________________________________________________________ -yo=0.;w1=0.;w2=0. ! init/reset -!___________________________________________________________________________________________________________________________________ -do il=1,loop - -! get old relative humidity to calculate aerosol hysteresis (online only) - - RH_HIST = 2. ! WET HISTORY (DEFAULT) - IF(IHYST.EQ.1.OR.IOPT.EQ.2) RH_HIST = 1. ! SET TO SOLIDS - -! meteorology - TT = yi(il,1) ! T [K] - RH = yi(il,2) ! RH [0-1] - PX = yi(il,11) ! p [hPa] -! -! gas+aerosol: - w1(1) = yi(il,6) ! Na+ (ss + xsod) (a) [umol/m^3 air] - w1(2) = yi(il,4) ! H2SO4 + SO4-- (p) [umol/m^3 air] - w1(3) = yi(il,3) ! NH3 (g) + NH4+ (p) [umol/m^3 air] - w1(4) = yi(il,5) ! HNO3 (g) + NO3- (p) [umol/m^3 air] - w1(5) = yi(il,7) ! HCl (g) + Cl- (p) [umol/m^3 air] - w1(6) = yi(il, 8) ! K+ (p) from Dust [umol/m^3 air] - w1(7) = yi(il, 9) ! Ca++ (p) from Dust [umol/m^3 air] - w1(8) = yi(il,10) ! Mg++ (p) from Dust [umol/m^3 air] -!______________________________________________ - - zflag=1. - - w1=w1*1.0e-6 ! [mol/m^3 air] - - TNa = w1(1) ! total input sodium (g+p) - TSO4 = w1(2) ! total input sulfate (g+p) - TNH4 = w1(3) ! total input ammonium (g+p) - TNO3 = w1(4) ! total input nitrate (g+p) - TCl = w1(5) ! total input chloride (g+p) - TPo = w1(6) ! total input potasium (g+p) - TCa = w1(7) ! total input calcium (g+p) - TMg = w1(8) ! total input magnesium(g+p) - -! SULFATE RICH - - if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).le.(2.*w1(2))) then - zflag=3. - endif - -! SULFATE VERY RICH CASE if (NH4+Na+K+2(Ca+Mg))/SO4 < 1 - - if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).le.w1(2)) then - zflag=4. - endif - -! SULFATE NEUTRAL CASE - - if((w1(1)+w1(3)+w1(6)+2.*(w1(7)+w1(8))).gt.(2.*w1(2))) then - zflag=2. - endif - -! SULFATE POOR AND CATION POOR CASE - - if((w1(1)+w1(6)+2.*(w1(7)+w1(8))).gt.(2.*w1(2))) then - zflag=1. - endif - - IF ( RH .LT. RHMIN ) RH=RHMIN - IF ( RH .GT. RHMAX ) RH=RHMAX - -! CALCULATE TEMPERATURE DEPENDENCY FOR SOME RHDs - - RHDX(:)=RHDA(:)*exp(RHDE(:)*(1./TT-1./T0)) - RHDZ(:)=RHDX(:) - -! ACCOUNT FOR VARIOUS AMMOMIUM/SODIUM SULFATE SALTS ACCORDING TO MEAN VALUE AS OF ISORROPIA - - GG=2.0 ! (Na)2SO4 / (NH4)2SO4 IS THE PREFFERED SPECIES FOR SULFATE DEFICIENT CASES - IF(ZFLAG.EQ.3.) THEN - IF(RH.LE.RHDZ(7)) THEN ! ACCOUNT FOR MIXTURE OF (NH4)2SO4(s) & NH4HSO4(s) & (NH4)3H(SO4)2(s) - GG=1.677 ! (Na)2SO4 & NaHSO4 -! GG=1.5 - ELSEIF(RH.GT.RHDZ(7).AND.RH.LE.RHDZ(5)) THEN ! MAINLY (Na)2SO4 / (NH4)2SO4(s) & (NH4)3H(SO4)2(s) - GG=1.75 -! GG=1.5 - ELSEIF(RH.GE.RHDZ(5)) THEN ! (NH4)2SO4(S) & NH4HSO4(S) & SO4-- & HSO4- - GG=1.5 ! (Na)2SO4 & NaHSO4 - ENDIF - ENDIF - IF(ZFLAG.EQ.4.) GG=1.0 ! IF SO4 NEUTRALIZED, THEN ONLY AS NaHSO4 / NH4HSO4(S) OR HSO4- / H2SO4 - - RHD=RH - IF(IOPT.EQ.2.OR.RH_HIST.LT.RH_HIST_DW) THEN ! GET RHD FOR SOLIDS / HYSTERESIS -! -! GET LOWEST DELIQUESCENCE RELATIVE HUMIDITIES ACCORDING TO THE CONCENTRATION DOMAIN (APROXIMATION) -! BASED ON RHD / MRHD ISORROPIA/SCAPE -! - w2(:)=1. - do ii=1,8 - if(w1(ii).le.1.e-12) w2(ii)=0. ! skip compound in RHD calculation if value is concentration is zero or rather small - enddo - -! GET LOWEST RHD ACCORDING TO THE CONCENTRATION DOMAIN - -! zflag=1. (cation rich) ... -! 1. sea salt aerosol : RHDX(1)=MgCl2 -! 2. mineral dust aerosol : RHDX(2)=Ca(NO3)2 -! -! zflag=2. (sulfate neutral) ... -! 3. ammonium + nitrate : RHDX(3)= NH4NO3 -! 4. ammonium + sulfate : RHDX(4)=(NH4)2SO4 -! 5. ammonium + sulfate mixed salt : RHDX(5)=(NH4)3H(SO4)2, (NH4)2SO4 -! 6. ammonium + nitrate + sulfate : RHDX(6)=(NH4)2SO4, NH4NO3, NA2SO4, NH4CL -! -! zflag=3. (sulfate poor) ... -! 7. ammonium + sulfate (1:1,1.5) : RHDX(7)= NH4HSO4 -! -! zflag=4. (sulfate very poor) ... -! 8. sulfuric acid : RHDX(8)= H2SO4 - -!WRITE(IPUNIT,*)'zflag = ', ZFLAG !DLW -!WRITE(IPUNIT,*)'GG = ', GG !DLW -!WRITE(IPUNIT,*)'w1(1:8) = ', W1(1:8) !DLW -!WRITE(IPUNIT,*)'w2(1:8) = ', W2(1:8) !DLW - - IF(ZFLAG.EQ.1.)THEN - - RHD=W2(1)+W2(5) ! Na+ dependency - IF(RHD.EQ.0.) RHDX(1)=1. - RHD=W2(6)+W2(7)+W2(8) ! K+/Ca++/Mg++ dependency (incl. ss) - IF(RHD.EQ.0.) RHDX(2)=1. - - RHD=MINVAL(RHDX(1:2)) - - ELSEIF(ZFLAG.EQ.2.)THEN - - RHD=W2(3)*W2(4) ! NH4+ & NO3- dependency - IF(RHD.EQ.0.) RHDX(3)=1. - RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency - IF(GG.NE.2.) RHD=0. ! account only for pure (NH4)2SO4 - IF(RHD.EQ.0.) RHDX(4)=1. - RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency - IF(RHD.EQ.0.) RHDX(5)=1. - RHD=W2(2)+W2(3)+W2(4)+W2(5) ! (NH4)2SO4, NH4NO3, NA2SO4, NH4CL dependency - IF(RHD.EQ.0.) RHDX(6)=1. - -! RHD=MINVAL(RHDX(3:4)) - RHD=MINVAL(RHDX(3:6)) - - ELSEIF(ZFLAG.EQ.3.)THEN - - RHD=W2(2)+W2(3) ! NH4+ & SO4-- dependency - IF(RHD.EQ.0.) RHDX(7)=1. - RHD=RHDX(7) - - ELSEIF(ZFLAG.EQ.4.)THEN - - RHD=W2(2) ! H2SO4 dependency (assume no dry aerosol) - IF(RHD.EQ.0.) RHDX(8)=1. - - RHD=RHDX(8) - - ENDIF ! ZFLAG - ! WRITE(IPUNIT,*)'RHDX(1:8) = ', RHDX(1:8) !DLW - ENDIF ! SOLIDS - -! GET WATER ACTIVITIES ACCORDING TO METZGER, 2000. -! FUNCTION DERIVED FROM ZSR RELATIONSHIP DATA (AS USED IN ISORROPIA) - - M0(:) = ((NW(:)*MWH20/MW(:)*(1./RH-1.)))**ZW(:) - -! CALCULATE TEMPERATURE DEPENDENT EQUILIBRIUM CONSTANTS - - T0T=T0/TT - COEF=1.0+LOG(T0T)-T0T - -! EQUILIBRIUM CONSTANT NH4NO3(s) <==> NH3(g) + HNO3(g) [atm^2] (ISORROPIA) - - XK10 = 5.746e-17 - XK10= XK10 * EXP(-74.38*(T0T-1.0) + 6.120*COEF) - KAN = XK10/(R*TT)/(R*TT) - -! EQUILIBRIUM CONSTANT NH4CL(s) <==> NH3(g) + HCL(g) [atm^2] (ISORROPIA) - - XK6 = 1.086e-16 - XK6 = XK6 * EXP(-71.00*(T0T-1.0) + 2.400*COEF) - KAC = XK6/(R*TT)/(R*TT) - -! -! CALCULATE AUTODISSOCIATION CONSTANT (KW) FOR WATER H2O <==> H(aq) + OH(aq) [mol^2/kg^2] (ISORROPIA) - - XKW = 1.010e-14 - XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF) - -! GET MEAN MOLAL IONIC ACTIVITY COEFF ACCORDING TO METZGER, 2002. - - GAMA=0.0 - IF(RH.GE.RHD) GAMA=(RH**ZFLAG/(1000./ZFLAG*(1.-RH)+ZFLAG)) - GAMA = GAMA**GF1 ! ONLY GAMA TYPE OF NH4NO3, NaCl, etc. NEEDED SO FAR - - GAMA=0.0 - GFN=K*K ! K=2, i.e. condensation of 2 water molecules per 1 mole ion pair - GF=GFN*GF1 ! = GFN[=Nw=4] * GF1[=(1*1^1+1*1^1)/2/Nw=1/4] = 1 - ! ONLY GAMA TYPE OF NH4NO3, NH4Cl, etc. needed so far - - IF(RH.GE.RHD) GAMA=RH**GF/((GFN*MWH20*(1./RH-1.)))**GF1 - - GAMA = min(GAMA,1.0) ! FOCUS ON 0-1 SCALE - GAMA = max(GAMA,0.0) - GAMA = (1.-GAMA)**K ! transplate into aqueous phase equillibrium and account for - ! enhanced uptake of aerosol precursor gases with increasing RH - ! (to match the results of ISORROPIA) - -! CALCULATE RHD DEPENDENT EQ: IF RH < RHD => NH4NO3(s) <==> NH3 (g) + HNO3(g) (ISORROPIA) -! IF RH >> RHD => HNO3 (g) -> NO3 (aq) - - X00 = MAX(ZERO,MIN(TNa,GG*TSO4)) ! MAX SODIUM SULFATE - X0 = MAX(ZERO,MIN(TNH4,GG*TSO4-X00)) ! MAX AMMOMIUM SULFATE - X01 = MAX(ZERO,MIN(TNa-X00, TNO3)) ! MAX SODIUM NITRATE - X1 = MAX(ZERO,MIN(TNH4-X0,TNO3-X01)) ! MAX AMMOMIUM NITRATE -! - X02 = MAX(ZERO,MIN(TNa-X01-X00,TCl)) ! MAX SODIUM CHLORIDE - X03 = MAX(ZERO,MIN(TNH4-X0-X1,TCl-X02))! MAX AMMOMIUM CHLORIDE - - X2 = MAX(TNH4-X1-X0-X03,ZERO) ! INTERIM RESIDUAL NH3 - X3 = MAX(TNO3-X1-X01,ZERO) ! INTERIM RESIDUAL HNO3 - X04 = MAX(TSO4-(X0+X00)/GG,ZERO) ! INTERIM RESIDUAL H2SO4 - X05 = MAX(TCl-X03-X02,ZERO) ! INTERIM RESIDUAL HCl -! X06 = MAX(TNa-X02-X01-X00,ZERO) ! INTERIM RESIDUAL Na (should be zero for electro-neutrality in input data) -! - ZKAN=2. - IF(RH.GE.RHD) ZKAN=ZKAN*GAMA - - X4 = X2 + X3 - X5 = SQRT(X4*X4+KAN*ZKAN*ZKAN) - X6 = 0.5*(-X4+X5) - X6 = MIN(X1,X6) - - GHCl = X05 ! INTERIM RESIDUAl HCl - GNH3 = X2 + X6 ! INTERIM RESIDUAl NH3 - GNO3 = X3 + X6 ! RESIDUAl HNO3 - GSO4 = X04 ! RESIDUAl H2SO4 - PNa = X02 + X01 + X00 ! RESIDUAl Na (neutralized) - - ZKAC=2. - IF(RH.GE.RHD) ZKAC=ZKAC*GAMA - - X08 = GNH3 + GHCl - X09 = SQRT(X08*X08+KAC*ZKAC*ZKAC) - X10 = 0.5*(-X08+X09) - X11 = MIN(X03,X10) - - GHCl = GHCl + X11 ! RESIDUAL HCl - GNH3 = GNH3 + X11 ! RESIDUAL NH3 - -! GO SAVE ... - - IF(GHCl.LT.0.) GHCl=0. - IF(GSO4.LT.0.) GSO4=0. - IF(GNH3.LT.0.) GNH3=0. - IF(GNO3.LT.0.) GNO3=0. - IF(PNa.LT.0.) PNa=0. - IF(GSO4.GT.TSO4) GSO4=TSO4 - IF(GNH3.GT.TNH4) GNH3=TNH4 - IF(GNO3.GT.TNO3) GNO3=TNO3 - IF(GHCl.GT.TCl) GHCl=TCl - IF(PNa.GT.TNa) PNa=TNa -! IF(PNa.LT.TNa) print*,il,' PNa.LT.TNa => no electro-neutrality in input data! ',PNa,TNa - - -! DEFINE AQUEOUSE PHASE (NO SOLID NH4NO3 IF NO3/SO4>1, TEN BRINK, ET AL., 1996, ATMOS ENV, 24, 4251-4261) - -! IF(TSO4.EQ.ZERO.AND.TNO3.GT.ZERO.OR.TNO3/TSO4.GE.1.) RHD=RH - -! IF(IOPT.EQ.2.AND.RH.LT.RHD.OR.IOPT.EQ.2.AND.RH_HIST.LT.RH_HIST_DW) THEN ! SOLIDS / HYSTERESIS - IF(RH_HIST.EQ.1.AND.RH.LT.RHD) THEN ! SOLIDS / HYSTERESIS - - ! EVERYTHING DRY, ONLY H2SO4 (GSO4) REMAINS IN THE AQUEOUSE PHASE - - ANH4 = 0. - ASO4 = 0. - ANO3 = 0. - ACl = 0. - ANa = 0. - - ELSE ! SUPERSATURATED SOLUTIONS NO SOLID FORMATION - - ASO4 = TSO4 - GSO4 - ANH4 = TNH4 - GNH3 - ANO3 = TNO3 - GNO3 - ACl = TCl - GHCl - ANa = PNa - - ENDIF ! SOLIDS / HYSTERESIS - -! CALCULATE AEROSOL WATER [kg/m^3(air)] -! -! salt solutes: -! 1 = NACl, 2 = (NA)2SO4, 3 = NANO3, 4 = (NH4)2SO4, 5 = NH4NO3, 6 = NH4CL, 7 = 2H-SO4 -! 8 = NH4HSO4, 9 = NAHSO4, 10 = (NH4)3H(SO4)2 -! - IF(ZFLAG.EQ.1.) WH2O = ASO4/M0( 2) + ANO3/M0(3) + ACl/M0(6) - IF(ZFLAG.EQ.2.) WH2O = ASO4/M0( 9) + ANO3/M0(5) + ACl/M0(6) - IF(ZFLAG.EQ.3.) WH2O = ASO4/M0( 8) + ANO3/M0(5) + ACl/M0(6) - IF(ZFLAG.EQ.4.) WH2O = ASO4/M0( 8) + GSO4/M0(7) - -! CALCULATE AQUEOUS PHASE PROPERTIES - -! PH = 9999. - PH = 7. - MOLAL = 0. - HPLUS = 0. - ZIONIC= 0. - - IF(WH2O.GT.0.) THEN - - ! CALCULATE AUTODISSOCIATION CONSTANT (KW) FOR WATER - - AKW=XKW*RH*WH2O*WH2O ! H2O <==> H+ + OH- with kw [mol^2/kg^2] - AKW=AKW**0.5 ! [OH-] = [H+] [mol] - AKW=MAX( AKW, 1.0E-30 ) ! DLW, 11-14-06, to prevent division by 0 in HPLUS below. - - ! Calculate hydrogen molality [mol/kg], i.e. H+ of the ions: - ! Na+, NH4+, NO3-, Cl-, SO4--, HH-SO4- [mol/kg(water)] - ! with [OH-] = kw/[H+] - - HPLUS = (-ANa/WH2O-ANH4/WH2O+ANO3/WH2O+ACl/WH2O+GG*ASO4/WH2O+GG*GSO4/WH2O+ & - SQRT(( ANa/WH2O+ANH4/WH2O-ANO3/WH2O-ACl/WH2O-GG*ASO4/WH2O-GG*GSO4/WH2O)**2+XKW/AKW*WH2O))/2. - - ! Calculate pH - -! PH is not used in modelE, so this line is commented out until the HPLUS calculation is rewritten for -! robustness with respect to real*4 roundoff errors. These errors might be associated with the inputs -! to this subroutine, so no rewrite yet. -! PH=-ALOG10(HPLUS) ! aerosol pH - - ! Calculate ionic strength [mol/kg] - - ZIONIC=0.5*(ANa+ANH4+ANO3+ACl+ASO4*GG*GG+GSO4*GG*GG+XKW/AKW*WH2O*WH2O) - ZIONIC=ZIONIC/WH2O ! ionic strength [mol/kg] -! ZIONIC=min(ZIONIC,200.0) ! limit for output -! ZIONIC=max(ZIONIC,0.0) - - ENDIF ! AQUEOUS PHASE -! -!------------------------------------------------------- -! calculate diagnostic output consistent with other EQMs ... -! - ASO4 = ASO4 + GSO4 ! assuming H2SO4 remains aqueous - - TNa = TNa * 1.e6 ! total input sodium (g+p) [umol/m^3] - TSO4 = TSO4 * 1.e6 ! total input sulfate (g+p) [umol/m^3] - TNH4 = TNH4 * 1.e6 ! total input ammonium (g+p) [umol/m^3] - TNO3 = TNO3 * 1.e6 ! total input nitrate (g+p) [umol/m^3] - TCl = TCl * 1.e6 ! total input chloride (g+p) [umol/m^3] - TPo = TPo * 1.e6 ! total input potasium (g+p) [umol/m^3] - TCa = TCa * 1.e6 ! total input calcium (g+p) [umol/m^3] - TMg = TMg * 1.e6 ! total input magnesium(g+p) [umol/m^3] -! -! residual gas: - GNH3 = GNH3 * 1.e6 ! residual NH3 - GSO4 = GSO4 * 1.e6 ! residual H2SO4 - GNO3 = GNO3 * 1.e6 ! residual HNO3 - GHCl = GHCl * 1.e6 ! residual HCl - -! total particulate matter (neutralized) - PNH4=TNH4-GNH3 ! particulate ammonium [umol/m^3] - PNO3=TNO3-GNO3 ! particulate nitrate [umol/m^3] - PCl =TCl -GHCl ! particulate chloride [umol/m^3] - PNa =TNa ! particulate sodium [umol/m^3] - PSO4=TSO4 ! particulate sulfate [umol/m^3] - -! liquid matter - ASO4 = ASO4 * 1.e6 ! aqueous phase sulfate [umol/m^3] - ANH4 = ANH4 * 1.e6 ! aqueous phase ammonium [umol/m^3] - ANO3 = ANO3 * 1.e6 ! aqueous phase nitrate [umol/m^3] - ACl = ACl * 1.e6 ! aqueous phase chloride [umol/m^3] - ANa = ANa * 1.e6 ! aqueous phase sodium [umol/m^3] - -! solid matter - SNH4=PNH4-ANH4 ! solid phase ammonium [umol/m^3] - SSO4=PSO4-ASO4 ! solid phase sulfate [umol/m^3] - SNO3=PNO3-ANO3 ! solid phase nitrate [umol/m^3] - SCl =PCl -ACl ! solid phase chloride [umol/m^3] - SNa =PNa -ANa ! solid phase sodium [umol/m^3] - -! GO SAVE ... - - IF(SNH4.LT.0.) SNH4=0. - IF(SSO4.LT.0.) SSO4=0. - IF(SNO3.LT.0.) SNO3=0. - IF(SCl.LT.0.) SCl=0. - IF(SNa.LT.0.) SNa=0. - - PM=SNH4+SSO4+SNO3+SNH4+SCl+SNa+ANH4+ASO4+ANO3+ACl+ANa ! total PM [umol/m^3] - PMs=SNH4*MWNH4+SSO4*MWSO4+SNO3*MWNO3+SCl*MWCl+SNa*MWNa ! dry particulate matter (PM) [ug/m^3] - PMt=PMs+ANH4*MWNH4+ASO4*MWSO4+ANO3*MWNO3+ACl*MWCl+ & - ANa*MWNa ! total (dry + wet) PM, excl. H20 [ug/m^3] - - WH2O = WH2O * 1.e9 ! convert aerosol water from [kg/m^3] to [ug/m^3] - IF(WH2O.LT.1.e-3) WH2O=0. - -! UPDATE HISTORY RH FOR HYSTERESIS (ONLINE CALCULATIONS ONLY) - - RH_HIST=2. ! wet - IF(WH2O.EQ.0.) RH_HIST=1. ! dry - - RINC = 1. - IF(PMt.GT.0.) RINC = (WH2O/PMt+1)**(1./3.) ! approx. radius increase due to water uptake - IF(RINC.EQ.0.) RINC = 1. - - RATIONS = 0. - IF(PSO4.GT.0.) RATIONS = PNO3/PSO4 ! nitrate / sulfate mol ratio - - GR = 0. - IF(GNO3.GT.0.) GR = GNH3/GNO3 ! gas ratio = residual NH3 / residual HNO3 [-] - - DON = 0. - IF((PNO3+2.*PSO4).GT.0.) DON = 100.*PNH4/(PNO3+2.*PSO4)! degree of neutralization by ammonia : ammonium / total nitrate + sulfate [%] - - NO3P = 0. - IF(TNO3.GT.0.) NO3P = 100.*PNO3/TNO3 ! nitrate partitioning = nitrate / total nitrate [%] - - NH4P = 0. - IF(TNH4.GT.0.) NH4P = 100.*PNH4/TNH4 ! ammonium partitioning = ammonium / total ammonium [%] -! -! store aerosol species for diagnostic output: -!______________________________________________________________ -! Input values: - yo(il, 1) = TT - 273.15 ! T [degC] - yo(il, 2) = RH * 100.00 ! RH [%] - yo(il, 3) = TNH4 ! total input ammonium (g+p) [umol/m^3] - yo(il, 4) = TSO4 ! total input sulfate (g+p) [umol/m^3] - yo(il, 5) = TNO3 ! total input nitrate (g+p) [umol/m^3] - yo(il, 6) = TNa ! total input sodium (p) [umol/m^3] - yo(il,33) = TCl ! total input chloride (g+p) [umol/m^3] - yo(il, 7) = TPo ! total input potasium (p) [umol/m^3] - yo(il,34) = TCa ! total input calcium (p) [umol/m^3] - yo(il,35) = TMg ! total input magnesium(p) [umol/m^3] - yo(il,25) = PX ! atmospheric pressure [hPa] -! Output values: - yo(il, 8) = GHCL ! residual HCl (g) [umol/m^3] - yo(il, 9) = GNO3 ! residual HNO3 (g) [umol/m^3] - yo(il,10) = GNH3 ! residual NH3 (g) [umol/m^3] - yo(il,11) = GSO4 ! residual H2SO4 (aq) [umol/m^3] - yo(il,12) = WH2O ! aerosol Water (aq) [ug/m^3] - yo(il,13) = PH ! aerosol pH [log] - yo(il,14) = ZFLAG ! concnetration domain [1=SP,2=SN,3=SR,4=SVR] - yo(il,15) = PM ! total particulate matter [umol/m^3] - yo(il,16) = SNH4 ! solid ammonium (s) [umol/m^3] - yo(il,17) = SNO3 ! solid nitrate (s) [umol/m^3] - yo(il,18) = SSO4 ! solid sulfate (s) [umol/m^3] - yo(il,19) = PNH4 ! particulate ammonium (p=a+s) [umol/m^3] - yo(il,20) = PNO3 ! particulate nitrate (p=a+s) [umol/m^3] - yo(il,21) = PSO4 ! particulate sulfate (p=a+s) [umol/m^3] - yo(il,22) = RATIONS ! mol ratio Nitrate/Sulfate (p) [-] - yo(il,23) = GAMA ! activity coefficient (e.g. NH4NO3) [-] - yo(il,24) = ZIONIC ! ionic strength (aq) [mol/kg] - yo(il,26) = PMt ! total PM (liquids & solids) [ug/m^3] - yo(il,27) = PMs ! total PM (solid) [ug/m^3] - yo(il,28) = RINC ! radius increase (H2O/PMt+1)**(1/3) [-] - yo(il,29) = SCl ! solid chloride (s) [umol/m^3] - yo(il,30) = SNa ! solid sodium (s) [umol/m^3] - yo(il,31) = PCl ! particulate chloride (p=a+s) [umol/m^3] - yo(il,32) = PNa ! particulate sodium (p=a+s) [umol/m^3] - yo(il,36) = RHD ! RH of deliquescence - yo(il,37) = HPLUS ! H+ molality (mol/kg) -enddo -! -end subroutine eqsam_v03d diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_init.F b/MATRIXchem_GridComp/microphysics/TRAMP_init.F deleted file mode 100644 index 8ee8311a..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_init.F +++ /dev/null @@ -1,562 +0,0 @@ - MODULE AERO_INIT -!---------------------------------------------------------------------------------------------------------------------- -! -!@sum Defines initial values for the aerosol and gas-phase species for the -!@+ stand-alone version of the MATRIX microphysical module. -!@auth Susanne Bauer/Doug Wright -!---------------------------------------------------------------------------------------------------------------------- - USE AERO_PARAM, ONLY: CONV_DP_TO_MASS, MINCONC, DENSP, AUNIT1, WRITE_LOG - USE AERO_CONFIG, ONLY: NWEIGHTS - USE AERO_SETUP - USE AERO_DISCRETE, ONLY: DISCRETE_INIT, ISPCA, ISPCB, ISPCC - IMPLICIT NONE - REAL(8), SAVE :: AERO_IN(NAEROBOX) - REAL(8), SAVE :: GAS_IN(NGASES) = 0.0D-30 - - CONTAINS - - - SUBROUTINE INIT_AERO( ICSET, TEMP, PRES ) -!---------------------------------------------------------------------------------------------------------------------- -! Routine to set initial concentrations for various test cases. -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I, INDEX, INDEX1, INDEX2 - INTEGER :: ICSET ! identifier of the desired set of initial concentrations - REAL(8) :: TEMP ! ambient temperature [K] - REAL(8) :: PRES ! ambient pressure [Pa] - REAL(8) :: MPP(NWEIGHTS) ! mass per particle in mode I [ug] - REAL(8), PARAMETER :: DEFAULT_N_AKK = 1.0D+10 ! 1.0D+10 - REAL(8), PARAMETER :: DEFAULT_N_ACC = 1.0D+09 ! 1.0D+09 - REAL(8), PARAMETER :: DEFAULT_N_DD1 = 1.0D+07 ! 1.0D+07 - REAL(8), PARAMETER :: DEFAULT_N_DD2 = 1.0D+06 ! 1.0D+06 - REAL(8), PARAMETER :: DEFAULT_N_SSA = 1.0D+08 ! 1.0D+08 - REAL(8), PARAMETER :: DEFAULT_N_SSC = 1.0D+05 ! 1.0D+05 - REAL(8), PARAMETER :: DEFAULT_N_SSS = 1.0D+05 ! 1.0D+05 - REAL(8), PARAMETER :: DEFAULT_N_OCC = 1.0D+08 ! 1.0D+08 - REAL(8), PARAMETER :: DEFAULT_N_BC1 = 1.0D+08 ! 1.0D+08 - - ! Varibles for the discrete pdf model. - - REAL(8) :: NA, NB, NC ! number concentrations for modes A, B, and C [#/m^3] - REAL(8) :: DGA, DGB, DGC ! geo. mean diameters for modes A, B, and C [um] - REAL(8) :: SIGMAGA, SIGMAGB, SIGMAGC ! geo. std. deviations for modes A, B, and C [1] - REAL(8) :: MASSA, MASSB, MASSC ! mass concentrations for modes A, B, and C [ug/m^3] - REAL(8) :: MAFORM, MBFORM, MCFORM ! formula mass concentrations for modes A, B, and C [ug/m^3] - REAL(8), PARAMETER :: DG_DEFAULT = 0.08D+00 ! [um] - REAL(8), PARAMETER :: SIGMAG_DEFAULT = 1.80D+00 ! [1] - - - AERO_IN(:) = MINCONC - - !---------------------------------------------------------------------------------------------------------------- - ! Use the default mode lognormal parameters and default particle densities for each mode to get a mean mass - ! per particle to obtain initial mass concentrations from initial number concentrations. - ! - ! DENSPI(:) contains the default density for mode I based on its principal chemical component. - ! Parameter CONV_DP_TO_MASS contains the default ambient aerosol density DENSP, which is - ! divided out in favor of DENSPI(:). - !---------------------------------------------------------------------------------------------------------------- - MPP(:) = DENSPI(:) * ( CONV_DP_TO_MASS / DENSP ) - & * ( 1.0D-06 * DGN0(:) )**3 * EXP( 4.5D+00 * ( LOG( SIG0(:) ) )**2 ) ! [ug/particle] - - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)') ' I MPP(I) [ug] <-- Initial mean mass per particle in subr. INIT_AERO' - DO I=1, NWEIGHTS - WRITE(AUNIT1,'(I4,D15.5,F12.5)') I, MPP(I), DENSPI(I) - ENDDO - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Set number concentrations for each mode. - !---------------------------------------------------------------------------------------------------------------- - SELECT CASE ( ICSET ) - - CASE( 0 ) - - CASE( 1 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - - CASE( 2 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - - CASE( 3 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - - CASE( 4 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - - CASE( 5 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = DEFAULT_N_SSC - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - - CASE( 6 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = DEFAULT_N_SSC - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - AERO_IN( NUMB_OCC_1 ) = DEFAULT_N_OCC - - CASE( 7 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = DEFAULT_N_SSC - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - AERO_IN( NUMB_OCC_1 ) = DEFAULT_N_OCC - AERO_IN( NUMB_BC1_1 ) = DEFAULT_N_BC1 - - CASE( 8 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC * 1.0D+01 - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 * 1.0D+01 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 * 1.0D+01 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = DEFAULT_N_SSC - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - AERO_IN( NUMB_OCC_1 ) = DEFAULT_N_OCC * 1.0D+01 - AERO_IN( NUMB_BC1_1 ) = DEFAULT_N_BC1 * 1.0D+01 - - CASE( 9 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - AERO_IN( NUMB_ACC_1 ) = DEFAULT_N_ACC - AERO_IN( NUMB_DD1_1 ) = DEFAULT_N_DD1 - IF ( NUMB_DD2_1 .GT. 0 ) AERO_IN( NUMB_DD2_1 ) = DEFAULT_N_DD2 - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = DEFAULT_N_SSA - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = DEFAULT_N_SSC - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = DEFAULT_N_SSS - AERO_IN( NUMB_OCC_1 ) = DEFAULT_N_OCC - AERO_IN( NUMB_BC1_1 ) = DEFAULT_N_BC1 - - !---------------------------------------------------------------------------------------------------------------- - ! Case 10 is for testing the discrete model of the PDF. MZJ 2005, Figure 15.2. - !---------------------------------------------------------------------------------------------------------------- - CASE( 10 ) - - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - NA = 1.0D+12 - DGA = DG_DEFAULT - SIGMAGA = SIGMAG_DEFAULT - NB = 0.0D+00 - DGB = DG_DEFAULT - SIGMAGB = SIGMAG_DEFAULT - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - AERO_IN( MASS_AKK_SULF ) = AERO_IN( NUMB_MAP(1) ) * MPP(1) - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 11 is for testing the discrete model of the PDF. MZJ 2005, Figure 15.3. - !---------------------------------------------------------------------------------------------------------------- - CASE( 11 ) - - ISPCA = 1 - ISPCB = 1 - ISPCC = 1 - NA = 1.0D+11 - DGA = DG_DEFAULT - SIGMAGA = SIGMAG_DEFAULT - NB = 0.0D+00 - DGB = DG_DEFAULT - SIGMAGB = SIGMAG_DEFAULT - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - AERO_IN( MASS_AKK_SULF ) = AERO_IN( NUMB_MAP(1) ) * MPP(1) - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 12 is for comparison with results for the discrete model of the PDF. Modes AKK and ACC only. - !---------------------------------------------------------------------------------------------------------------- - CASE( 12 ) - - AERO_IN( NUMB_AKK_1 ) = 1.0D+10 ! [#/m^3] - AERO_IN( NUMB_ACC_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 1 - INDEX2 = 2 - NA = AERO_IN( NUMB_AKK_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_ACC_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_AKK_SULF ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_ACC_SULF ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 13 is for comparison with results for the discrete model of the PDF. ACC + BC1 --> BCS. - !---------------------------------------------------------------------------------------------------------------- - CASE( 13 ) - - AERO_IN( NUMB_ACC_1 ) = 1.0D+09 ! [#/m^3] - AERO_IN( NUMB_BC1_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 2 - INDEX2 = 10 - NA = AERO_IN( NUMB_ACC_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_BC1_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_ACC_SULF ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_BC1_BCAR ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 14 is for comparison with results for the discrete model of the PDF. DD2 + OCC --> MXX. - !---------------------------------------------------------------------------------------------------------------- - CASE( 14 ) - - IF ( NUMB_DD2_1 .GT. 0 ) THEN - AERO_IN( NUMB_DD2_1 ) = 1.0D+07 ! [#/m^3] - ELSE - WRITE(*,*)'Cannot use ICSET = 14 with this mechanism - must have mode DD2 to use this ICSET.' - STOP - ENDIF - AERO_IN( NUMB_OCC_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 5 - INDEX2 = 9 - NA = AERO_IN( NUMB_DD2_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_OCC_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_DD2_DUST ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_OCC_OCAR ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 15 is for comparison with results for the discrete model of the PDF. AKK + BC1 --> BCS. - !---------------------------------------------------------------------------------------------------------------- - CASE( 15 ) - - AERO_IN( NUMB_AKK_1 ) = 1.0D+10 ! [#/m^3] - AERO_IN( NUMB_BC1_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 1 - INDEX2 = 10 - NA = AERO_IN( NUMB_AKK_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_BC1_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_AKK_SULF ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_BC1_BCAR ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 16 is for comparison with results for the discrete model of the PDF. DD1 + OCC --> MXX. - !---------------------------------------------------------------------------------------------------------------- - CASE( 16 ) - - AERO_IN( NUMB_DD1_1 ) = 1.0D+09 ! [#/m^3] - AERO_IN( NUMB_OCC_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 3 - INDEX2 = 9 - NA = AERO_IN( NUMB_DD1_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_OCC_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_DD1_DUST ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_OCC_OCAR ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 17 is for comparison with results for the discrete model of the PDF. DD1 + SSC --> MXX. - !---------------------------------------------------------------------------------------------------------------- - CASE( 17 ) - - AERO_IN( NUMB_DD1_1 ) = 1.00D+09 ! [#/m^3] - AERO_IN( NUMB_SSC_1 ) = 0.40D+06 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 3 - INDEX2 = 8 - NA = AERO_IN( NUMB_DD1_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_SSC_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_DD1_DUST ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_SSC_SEAS ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 18 is for comparison with the discrete model of the PDF. Mode AKK. Intramodal coagulation only. - !---------------------------------------------------------------------------------------------------------------- - CASE( 18 ) - - IF ( NUMB_AKK_1 .GT. 0 ) AERO_IN( NUMB_AKK_1 ) = DEFAULT_N_AKK - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 1 - INDEX2 = 2 - NA = AERO_IN( NUMB_AKK_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_ACC_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_AKK_SULF ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_ACC_SULF ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 19 is for comparison with results for the discrete model of the PDF. BC1 + OCC --> BOC. - !---------------------------------------------------------------------------------------------------------------- - CASE( 19 ) - - AERO_IN( NUMB_OCC_1 ) = 1.0D+09 ! [#/m^3] - AERO_IN( NUMB_BC1_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 9 - INDEX2 = 10 - NA = AERO_IN( NUMB_OCC_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_BC1_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_OCC_OCAR ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_BC1_BCAR ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 20 is for comparison with results for the discrete model of the PDF. ACC + DD1 --> DD1. (no DS1 transfer) - !---------------------------------------------------------------------------------------------------------------- - CASE( 20 ) - - AERO_IN( NUMB_ACC_1 ) = 1.0D+09 ! [#/m^3] - AERO_IN( NUMB_DD1_1 ) = 1.0D+09 ! [#/m^3] - ISPCA = 2 - ISPCB = 2 - ISPCC = 2 - INDEX1 = 2 - INDEX2 = 3 - NA = AERO_IN( NUMB_ACC_1 ) - DGA = DGN0(INDEX1) - SIGMAGA = SIG0(INDEX1) - NB = AERO_IN( NUMB_DD1_1 ) - DGB = DGN0(INDEX2) - SIGMAGB = SIG0(INDEX2) - NC = 0.0D+00 - DGC = DG_DEFAULT - SIGMAGC = SIGMAG_DEFAULT - CALL DISCRETE_INIT(ICSET,NA,DGA,SIGMAGA,NB,DGB,SIGMAGB,NC,DGC,SIGMAGC,TEMP,PRES,MASSA,MASSB,MASSC) - MAFORM = AERO_IN( NUMB_MAP(INDEX1) ) * MPP(INDEX1) - WRITE(36,'(A,2D20.12)')'MASSA from discrete pdf model = ', MASSA - WRITE(36,'(A,2D20.12)')'MASSA from analytic formula = ', MAFORM - AERO_IN( MASS_ACC_SULF ) = MASSA - MBFORM = AERO_IN( NUMB_MAP(INDEX2) ) * MPP(INDEX2) - WRITE(36,'(A,2D20.12)')'MASSB from discrete pdf model = ', MASSB - WRITE(36,'(A,2D20.12)')'MASSB from analytic formula = ', MBFORM - AERO_IN( MASS_DD1_DUST ) = MASSB - RETURN - - !---------------------------------------------------------------------------------------------------------------- - ! Case 21 is for illustration of aerosol activation. - !---------------------------------------------------------------------------------------------------------------- - CASE( 21 ) - - IF ( NUMB_AKK_1 .GT. 0 ) THEN - AERO_IN( NUMB_AKK_1 ) = 1.0D+09 * 2.0D+00 - AERO_IN( NUMB_ACC_1 ) = 1.0D+08 * 2.0D+00 - ELSE - AERO_IN( NUMB_ACC_1 ) = 1.1D+09 * 2.0D+00 - ENDIF - IF ( NUMB_DD2_1 .GT. 0 ) THEN - AERO_IN( NUMB_DD1_1 ) = 1.0D+08 * 0.1D+00 - AERO_IN( NUMB_DD2_1 ) = 1.0D+07 * 0.1D+00 - ELSE - AERO_IN( NUMB_DD1_1 ) = 1.1D+08 * 0.1D+00 - ENDIF - IF ( NUMB_SSA_1 .GT. 0 ) AERO_IN( NUMB_SSA_1 ) = 1.000D+08 * 0.2D+00 - IF ( NUMB_SSC_1 .GT. 0 ) AERO_IN( NUMB_SSC_1 ) = 0.004D+08 * 0.2D+00 - IF ( NUMB_SSS_1 .GT. 0 ) AERO_IN( NUMB_SSS_1 ) = 1.004D+08 * 0.2D+00 - AERO_IN( NUMB_OCC_1 ) = 1.0D+08 * 1.0D+01 - AERO_IN( NUMB_BC1_1 ) = 1.0D+08 * 1.0D+01 - - CASE DEFAULT - - WRITE(*,*)'BAD VALUE OF ICSET IN SUBR. INIT_AERO' - STOP - - END SELECT - - !---------------------------------------------------------------------------------------------------------------- - ! Calculate masses for all primary modes. - !---------------------------------------------------------------------------------------------------------------- - DO I=1, NMODES - - ! Set the defining chemical species for each mode to receive the initial concentrations. - - INDEX = 0 - IF( MODE_NAME(I) .EQ. 'AKK' ) INDEX = MASS_AKK_SULF - IF( MODE_NAME(I) .EQ. 'ACC' ) INDEX = MASS_ACC_SULF - IF( MODE_NAME(I) .EQ. 'DD1' ) INDEX = MASS_DD1_DUST - IF( MODE_NAME(I) .EQ. 'DD2' ) INDEX = MASS_DD2_DUST - IF( MODE_NAME(I) .EQ. 'SSA' ) INDEX = MASS_SSA_SEAS - IF( MODE_NAME(I) .EQ. 'SSC' ) INDEX = MASS_SSC_SEAS - IF( MODE_NAME(I) .EQ. 'SSS' ) INDEX = MASS_SSS_SEAS - IF( MODE_NAME(I) .EQ. 'OCC' ) INDEX = MASS_OCC_OCAR - IF( MODE_NAME(I) .EQ. 'BC1' ) INDEX = MASS_BC1_BCAR - - IF( INDEX .GT. 0 ) THEN - - ! WRITE(*,*)'INDEX = ', INDEX - AERO_IN( INDEX ) = AERO_IN( NUMB_MAP(I) ) * MPP(I) - - ! For some IC sets, initial sulfate concentrations are also given to these modes. - - IF( ICSET.EQ.9 .AND. MODE_NAME(I).NE.'SSC' ) AERO_IN( SULF_MAP(I) ) = AERO_IN( NUMB_MAP(I) ) * MPP(I) - - ENDIF - ENDDO - - ! Set ammonium assuming ammonium sulfate. - - IF( ICSET .EQ. 21 ) AERO_IN( 2 ) = 0.3755532793D+00 * SUM( AERO_IN(SULF_MAP(:)) ) - - RETURN - END SUBROUTINE INIT_AERO - - - END MODULE AERO_INIT - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_isocom2.F b/MATRIXchem_GridComp/microphysics/TRAMP_isocom2.F deleted file mode 100644 index a5b99780..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_isocom2.F +++ /dev/null @@ -1,16625 +0,0 @@ -C ====================================================================== -C -C *** ISORROPIA CODE II -C *** SUBROUTINE ISOROPIA -C *** THIS SUBROUTINE IS THE MASTER ROUTINE FOR THE ISORROPIA -C THERMODYNAMIC EQUILIBRIUM AEROSOL MODEL (VERSION 1.1 and above) -C -C ======================== ARGUMENTS / USAGE =========================== -C -C INPUT: -C 1. [WI] -C DOUBLE PRECISION array of length [8]. -C Concentrations, expressed in moles/m3. Depending on the type of -C problem solved (specified in CNTRL(1)), WI contains either -C GAS+AEROSOL or AEROSOL only concentratios. -C WI(1) - sodium -C WI(2) - sulfate -C WI(3) - ammonium -C WI(4) - nitrate -C WI(5) - chloride -C WI(6) - calcium -C WI(7) - potassium -C WI(8) - magnesium -C -C 2. [RHI] -C DOUBLE PRECISION variable. -C Ambient relative humidity expressed on a (0,1) scale. -C -C 3. [TEMPI] -C DOUBLE PRECISION variable. -C Ambient temperature expressed in Kelvins. -C -C 4. [CNTRL] -C DOUBLE PRECISION array of length [2]. -C Parameters that control the type of problem solved. -C -C CNTRL(1): Defines the type of problem solved. -C 0 - Forward problem is solved. In this case, array WI contains -C GAS and AEROSOL concentrations together. -C 1 - Reverse problem is solved. In this case, array WI contains -C AEROSOL concentrations only. -C -C CNTRL(2): Defines the state of the aerosol -C 0 - The aerosol can have both solid+liquid phases (deliquescent) -C 1 - The aerosol is in only liquid state (metastable aerosol) -C -C OUTPUT: -C 1. [WT] -C DOUBLE PRECISION array of length [8]. -C Total concentrations (GAS+AEROSOL) of species, expressed in moles/m3. -C If the foreward probelm is solved (CNTRL(1)=0), array WT is -C identical to array WI. -C WT(1) - total sodium -C WT(2) - total sulfate -C WT(3) - total ammonium -C WT(4) - total nitrate -C WT(5) - total chloride -C WT(6) - total calcium -C WT(7) - total potassium -C WT(8) - total magnesium -C -C 2. [GAS] -C DOUBLE PRECISION array of length [03]. -C Gaseous species concentrations, expressed in moles/m3. -C GAS(1) - NH3 -C GAS(2) - HNO3 -C GAS(3) - HCl -C -C 3. [AERLIQ] -C DOUBLE PRECISION array of length [15]. -C Liquid aerosol species concentrations, expressed in moles/m3. -C AERLIQ(01) - H+(aq) -C AERLIQ(02) - Na+(aq) -C AERLIQ(03) - NH4+(aq) -C AERLIQ(04) - Cl-(aq) -C AERLIQ(05) - SO4--(aq) -C AERLIQ(06) - HSO4-(aq) -C AERLIQ(07) - NO3-(aq) -C AERLIQ(08) - H2O -C AERLIQ(09) - NH3(aq) (undissociated) -C AERLIQ(10) - HNCl(aq) (undissociated) -C AERLIQ(11) - HNO3(aq) (undissociated) -C AERLIQ(12) - OH-(aq) -C AERLIQ(13) - Ca2+(aq) -C AERLIQ(14) - K+(aq) -C AERLIQ(15) - Mg2+(aq) -C -C 4. [AERSLD] -C DOUBLE PRECISION array of length [19]. -C Solid aerosol species concentrations, expressed in moles/m3. -C AERSLD(01) - NaNO3(s) -C AERSLD(02) - NH4NO3(s) -C AERSLD(03) - NaCl(s) -C AERSLD(04) - NH4Cl(s) -C AERSLD(05) - Na2SO4(s) -C AERSLD(06) - (NH4)2SO4(s) -C AERSLD(07) - NaHSO4(s) -C AERSLD(08) - NH4HSO4(s) -C AERSLD(09) - (NH4)4H(SO4)2(s) -C AERSLD(10) - CaSO4(s) -C AERSLD(11) - Ca(NO3)2(s) -C AERSLD(12) - CaCl2(s) -C AERSLD(13) - K2SO4(s) -C AERSLD(14) - KHSO4(s) -C AERSLD(15) - KNO3(s) -C AERSLD(16) - KCl(s) -C AERSLD(17) - MgSO4(s) -C AERSLD(18) - Mg(NO3)2(s) -C AERSLD(19) - MgCl2(s) -C -C 5. [SCASI] -C CHARACTER*15 variable. -C Returns the subcase which the input corresponds to. -C -C 6. [OTHER] -C DOUBLE PRECISION array of length [9]. -C Returns solution information. -C -C OTHER(1): Shows if aerosol water exists. -C 0 - Aerosol is WET -C 1 - Aerosol is DRY -C -C OTHER(2): Aerosol Sulfate ratio, defined as (in moles/m3) : -C (total ammonia + total Na) / (total sulfate) -C -C OTHER(3): Sulfate ratio based on aerosol properties that defines -C a sulfate poor system: -C (aerosol ammonia + aerosol Na) / (aerosol sulfate) -C -C OTHER(4): Aerosol sodium ratio, defined as (in moles/m3) : -C (total Na) / (total sulfate) -C -C OTHER(5): Ionic strength of the aqueous aerosol (if it exists). -C -C OTHER(6): Total number of calls to the activity coefficient -C calculation subroutine. -C -C OTHER(7): Sulfate ratio with crustal species, defined as (in moles/m3) : -C (total ammonia + total crustal species + total Na) / (total sulfate) -C -C OTHER(8): Crustal species + sodium ratio, defined as (in moles/m3) : -C (total crustal species + total Na) / (total sulfate) -C -C OTHER(9): Crustal species ratio, defined as (in moles/m3) : -C (total crustal species) / (total sulfate) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISOROPIA (WI, RHI, TEMPI, CNTRL, - & WT, GAS, AERLIQ, AERSLD, SCASI, OTHER) - INCLUDE 'isrpia.inc' - PARAMETER (NCTRL=2,NOTHER=9) - CHARACTER SCASI*15 - DIMENSION WI(NCOMP), WT(NCOMP), GAS(NGASAQ), AERSLD(NSLDS), - & AERLIQ(NIONS+NGASAQ+2), CNTRL(NCTRL), OTHER(NOTHER) -C -C *** PROBLEM TYPE (0=FOREWARD, 1=REVERSE) ****************************** -C - IPROB = NINT(CNTRL(1)) -C -C *** AEROSOL STATE (0=SOLID+LIQUID, 1=METASTABLE) ********************** -C - METSTBL = NINT(CNTRL(2)) -C -C *** SOLVE FOREWARD PROBLEM ******************************************** -C -50 IF (IPROB.EQ.0) THEN - IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) - & THEN !Everything=0 - CALL INIT1 (WI, RHI, TEMPI) - ELSE IF (WI(1)+WI(4)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl,NO3=0 - CALL ISRP1F (WI, RHI, TEMPI) - ELSE IF (WI(1)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl=0 - CALL ISRP2F (WI, RHI, TEMPI) - ELSE IF (WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg=0 - CALL ISRP3F (WI, RHI, TEMPI) - ELSE - CALL ISRP4F (WI, RHI, TEMPI) - ENDIF -C -C *** SOLVE REVERSE PROBLEM ********************************************* -C - ELSE - IF (WI(1)+WI(2)+WI(3)+WI(4)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) - & THEN !Everything=0 - CALL INIT1 (WI, RHI, TEMPI) - ELSE IF (WI(1)+WI(4)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl,NO3=0 - CALL ISRP1R (WI, RHI, TEMPI) - ELSE IF (WI(1)+WI(5)+WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl=0 - CALL ISRP2R (WI, RHI, TEMPI) - ELSE IF (WI(6)+WI(7)+WI(8) .LE. TINY) THEN !Ca,K,Mg=0 - CALL ISRP3R (WI, RHI, TEMPI) - ELSE - CALL ISRP4R (WI, RHI, TEMPI) - ENDIF - ENDIF -C -C *** ADJUST MASS BALANCE *********************************************** -C - IF (NADJ.EQ.1) CALL ADJUST (WI) -ccC -ccC *** IF METASTABLE AND NO WATER - RESOLVE AS NORMAL ******************** -ccC -cc IF (WATER.LE.TINY .AND. METSTBL.EQ.1) THEN -cc METSTBL = 0 -cc GOTO 50 -cc ENDIF - -C -C *** SAVE RESULTS TO ARRAYS (units = mole/m3) **************************** -C - GAS(1) = GNH3 ! Gaseous aerosol species - GAS(2) = GHNO3 - GAS(3) = GHCL -C - DO 10 I=1,7 ! Liquid aerosol species - AERLIQ(I) = MOLAL(I) - 10 CONTINUE - DO 20 I=1,NGASAQ - AERLIQ(7+1+I) = GASAQ(I) - 20 CONTINUE - AERLIQ(7+1) = WATER*1.0D3/18.0D0 - AERLIQ(7+NGASAQ+2) = COH -C - DO 250 I=8,10 ! Liquid aerosol species - AERLIQ(I+5) = MOLAL(I) - 250 CONTINUE -C - AERSLD(1) = CNANO3 ! Solid aerosol species - AERSLD(2) = CNH4NO3 - AERSLD(3) = CNACL - AERSLD(4) = CNH4CL - AERSLD(5) = CNA2SO4 - AERSLD(6) = CNH42S4 - AERSLD(7) = CNAHSO4 - AERSLD(8) = CNH4HS4 - AERSLD(9) = CLC - AERSLD(10) = CCASO4 - AERSLD(11) = CCANO32 - AERSLD(12) = CCACL2 - AERSLD(13) = CK2SO4 - AERSLD(14) = CKHSO4 - AERSLD(15) = CKNO3 - AERSLD(16) = CKCL - AERSLD(17) = CMGSO4 - AERSLD(18) = CMGNO32 - AERSLD(19) = CMGCL2 -C - IF(WATER.LE.TINY) THEN ! Dry flag - OTHER(1) = 1.d0 - ELSE - OTHER(1) = 0.d0 - ENDIF -C - OTHER(2) = SULRAT ! Other stuff - OTHER(3) = SULRATW - OTHER(4) = SODRAT - OTHER(5) = IONIC - OTHER(6) = ICLACT - OTHER(7) = SO4RAT - OTHER(8) = CRNARAT - OTHER(9) = CRRAT -C - SCASI = SCASE -C - WT(1) = WI(1) ! Total gas+aerosol phase - WT(2) = WI(2) - WT(3) = WI(3) - WT(4) = WI(4) - WT(5) = WI(5) - WT(6) = WI(6) - WT(7) = WI(7) - WT(8) = WI(8) - - - IF (IPROB.GT.0 .AND. WATER.GT.TINY) THEN - WT(3) = WT(3) + GNH3 - WT(4) = WT(4) + GHNO3 - WT(5) = WT(5) + GHCL - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE ISOROPIA ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE SETPARM -C *** THIS SUBROUTINE REDEFINES THE SOLUTION PARAMETERS OF ISORROPIA -C -C ======================== ARGUMENTS / USAGE =========================== -C -C *** NOTE: IF NEGATIVE VALUES ARE GIVEN FOR A PARAMETER, IT IS -C IGNORED AND THE CURRENT VALUE IS USED INSTEAD. -C -C INPUT: -C 1. [WFTYPI] -C INTEGER variable. -C Defines the type of weighting algorithm for the solution in Mutual -C Deliquescence Regions (MDR's): -C 0 - MDR's are assumed dry. This is equivalent to the approach -C used by SEQUILIB. -C 1 - The solution is assumed "half" dry and "half" wet throughout -C the MDR. -C 2 - The solution is a relative-humidity weighted mean of the -C dry and wet solutions (as defined in Nenes et al., 1998) -C -C 2. [IACALCI] -C INTEGER variable. -C Method of activity coefficient calculation: -C 0 - Calculate coefficients during runtime -C 1 - Use precalculated tables -C -C 3. [EPSI] -C DOUBLE PRECITION variable. -C Defines the convergence criterion for all iterative processes -C in ISORROPIA, except those for activity coefficient calculations -C (EPSACTI controls that). -C -C 4. [MAXITI] -C INTEGER variable. -C Defines the maximum number of iterations for all iterative -C processes in ISORROPIA, except for activity coefficient calculations -C (NSWEEPI controls that). -C -C 5. [NSWEEPI] -C INTEGER variable. -C Defines the maximum number of iterations for activity coefficient -C calculations. -C -C 6. [EPSACTI] -C DOUBLE PRECISION variable. -C Defines the convergence criterion for activity coefficient -C calculations. -C -C 7. [NDIV] -C INTEGER variable. -C Defines the number of subdivisions needed for the initial root -C tracking for the bisection method. Usually this parameter should -C not be altered, but is included for completeness. -C -C 8. [NADJ] -C INTEGER variable. -C Forces the solution obtained to satisfy total mass balance -C to machine precision -C 0 - No adjustment done (default) -C 1 - Do adjustment -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE SETPARM (WFTYPI, IACALCI, EPSI, MAXITI, NSWEEPI, - & EPSACTI, NDIVI, NADJI) - INCLUDE 'isrpia.inc' - INTEGER WFTYPI -C -C *** SETUP SOLUTION PARAMETERS ***************************************** -C - IF (WFTYPI .GE. 0) WFTYP = WFTYPI - IF (IACALCI.GE. 0) IACALC = IACALCI - IF (EPSI .GE.ZERO) EPS = EPSI - IF (MAXITI .GT. 0) MAXIT = MAXITI - IF (NSWEEPI.GT. 0) NSWEEP = NSWEEPI - IF (EPSACTI.GE.ZERO) EPSACT = EPSACTI - IF (NDIVI .GT. 0) NDIV = NDIVI - IF (NADJI .GE. 0) NADJ = NADJI -C -C *** END OF SUBROUTINE SETPARM ***************************************** -C - RETURN - END - -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE GETPARM -C *** THIS SUBROUTINE OBTAINS THE CURRENT VAULES OF THE SOLUTION -C PARAMETERS OF ISORROPIA -C -C ======================== ARGUMENTS / USAGE =========================== -C -C *** THE PARAMETERS ARE THOSE OF SUBROUTINE SETPARM -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE GETPARM (WFTYPI, IACALCI, EPSI, MAXITI, NSWEEPI, - & EPSACTI, NDIVI, NADJI) - INCLUDE 'isrpia.inc' - INTEGER WFTYPI -C -C *** GET SOLUTION PARAMETERS ******************************************* -C - WFTYPI = WFTYP - IACALCI = IACALC - EPSI = EPS - MAXITI = MAXIT - NSWEEPI = NSWEEP - EPSACTI = EPSACT - NDIVI = NDIV - NADJI = NADJ -C -C *** END OF SUBROUTINE GETPARM ***************************************** -C - RETURN - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** BLOCK DATA BLKISO -C *** THIS SUBROUTINE PROVIDES INITIAL (DEFAULT) VALUES TO PROGRAM -C PARAMETERS VIA DATA STATEMENTS -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C *** ZSR RELATIONSHIP PARAMETERS MODIFIED BY DOUGLAS WALDRON -C *** OCTOBER 2003 -C *** BASED ON AIM MODEL III (http://mae.ucdavis.edu/wexler/aim) -C -C======================================================================= -C - BLOCK DATA BLKISO - INCLUDE 'isrpia.inc' -C -C *** DEFAULT VALUES ************************************************* -C - DATA TEMP/298.0/, R/82.0567D-6/, RH/0.9D0/, EPS/1D-6/, MAXIT/100/, - & TINY/1D-20/, GREAT/1D10/, ZERO/0.0D0/, ONE/1.0D0/,NSWEEP/4/, - & TINY2/1D-11/,NDIV/5/ -C - DATA MOLAL/NIONS*0.0D0/, MOLALR/NPAIR*0.0D0/, GAMA/NPAIR*0.1D0/, - & GAMOU/NPAIR*1D10/, GAMIN/NPAIR*1D10/, CALAIN/.TRUE./, - & CALAOU/.TRUE./, EPSACT/5D-2/, ICLACT/0/, - & IACALC/1/, NADJ/0/, WFTYP/2/ -C - DATA ERRSTK/NERRMX*0/, ERRMSG/NERRMX*' '/, NOFER/0/, - & STKOFL/.FALSE./ -C - DATA IPROB/0/, METSTBL/0/ -C - DATA VERSION /'2.1 (07/19/09)'/ -C -C *** OTHER PARAMETERS *********************************************** -C - DATA SMW/58.5,142.,85.0,132.,80.0,53.5,98.0,98.0,115.,63.0, - & 36.5,120.,247.,136.1,164.,111.,174.2,136.1,101.1,74.5, - & 120.3,148.3,95.2/ - & IMW/ 1.0,23.0,18.0,35.5,96.0,97.0,62.0,40.1,39.1,24.3/ - & WMW/23.0,98.0,17.0,63.0,36.5,40.1,39.1,24.3/ -C - DATA ZZ /1,2,1,2,1,1,2,1,1,1,1,1,2,4,2,2,2,1,1,1,4,2,2/ - & Z /1,1,1,1,2,1,1,2,1,2/ -C -C *** ZSR RELATIONSHIP PARAMETERS ************************************** -C -C awas= ammonium sulfate -C - DATA AWAS/10*187.72, - & 158.13,134.41,115.37,100.10, 87.86, 78.00, 70.00, 63.45, 58.02, - & 53.46, - & 49.59, 46.26, 43.37, 40.84, 38.59, 36.59, 34.79, 33.16, 31.67, - & 30.31, - & 29.07, 27.91, 26.84, 25.84, 24.91, 24.03, 23.21, 22.44, 21.70, - & 21.01, - & 20.34, 19.71, 19.11, 18.54, 17.99, 17.46, 16.95, 16.46, 15.99, - & 15.54, - & 15.10, 14.67, 14.26, 13.86, 13.47, 13.09, 12.72, 12.36, 12.01, - & 11.67, - & 11.33, 11.00, 10.68, 10.37, 10.06, 9.75, 9.45, 9.15, 8.86, - & 8.57, - & 8.29, 8.01, 7.73, 7.45, 7.18, 6.91, 6.64, 6.37, 6.10, - & 5.83, - & 5.56, 5.29, 5.02, 4.74, 4.47, 4.19, 3.91, 3.63, 3.34, - & 3.05, - & 2.75, 2.45, 2.14, 1.83, 1.51, 1.19, 0.87, 0.56, 0.26, - & 0.1/ -C -C awsn= sodium nitrate -C - DATA AWSN/10*394.54, - & 338.91,293.01,254.73,222.61,195.56,172.76,153.53,137.32,123.65, - & 112.08, - & 102.26, 93.88, 86.68, 80.45, 75.02, 70.24, 66.02, 62.26, 58.89, - & 55.85, - & 53.09, 50.57, 48.26, 46.14, 44.17, 42.35, 40.65, 39.06, 37.57, - & 36.17, - & 34.85, 33.60, 32.42, 31.29, 30.22, 29.20, 28.22, 27.28, 26.39, - & 25.52, - & 24.69, 23.89, 23.12, 22.37, 21.65, 20.94, 20.26, 19.60, 18.96, - & 18.33, - & 17.72, 17.12, 16.53, 15.96, 15.40, 14.85, 14.31, 13.78, 13.26, - & 12.75, - & 12.25, 11.75, 11.26, 10.77, 10.29, 9.82, 9.35, 8.88, 8.42, - & 7.97, - & 7.52, 7.07, 6.62, 6.18, 5.75, 5.32, 4.89, 4.47, 4.05, - & 3.64, - & 3.24, 2.84, 2.45, 2.07, 1.70, 1.34, 0.99, 0.65, 0.31, - & 0.1/ -C -C awsc= sodium chloride -C - DATA AWSC/10*28.16, - & 27.17, 26.27, 25.45, 24.69, 23.98, 23.33, 22.72, 22.14, 21.59, - & 21.08, - & 20.58, 20.12, 19.67, 19.24, 18.82, 18.43, 18.04, 17.67, 17.32, - & 16.97, - & 16.63, 16.31, 15.99, 15.68, 15.38, 15.08, 14.79, 14.51, 14.24, - & 13.97, - & 13.70, 13.44, 13.18, 12.93, 12.68, 12.44, 12.20, 11.96, 11.73, - & 11.50, - & 11.27, 11.05, 10.82, 10.60, 10.38, 10.16, 9.95, 9.74, 9.52, - & 9.31, - & 9.10, 8.89, 8.69, 8.48, 8.27, 8.07, 7.86, 7.65, 7.45, - & 7.24, - & 7.04, 6.83, 6.62, 6.42, 6.21, 6.00, 5.79, 5.58, 5.36, - & 5.15, - & 4.93, 4.71, 4.48, 4.26, 4.03, 3.80, 3.56, 3.32, 3.07, - & 2.82, - & 2.57, 2.30, 2.04, 1.76, 1.48, 1.20, 0.91, 0.61, 0.30, - & 0.1/ -C -C awac= ammonium chloride -C - DATA AWAC/10*1209.00, - & 1067.60,949.27,848.62,761.82,686.04,619.16,559.55,505.92,457.25, - & 412.69, - & 371.55,333.21,297.13,262.81,229.78,197.59,165.98,135.49,108.57, - & 88.29, - & 74.40, 64.75, 57.69, 52.25, 47.90, 44.30, 41.27, 38.65, 36.36, - & 34.34, - & 32.52, 30.88, 29.39, 28.02, 26.76, 25.60, 24.51, 23.50, 22.55, - & 21.65, - & 20.80, 20.00, 19.24, 18.52, 17.83, 17.17, 16.54, 15.93, 15.35, - & 14.79, - & 14.25, 13.73, 13.22, 12.73, 12.26, 11.80, 11.35, 10.92, 10.49, - & 10.08, - & 9.67, 9.28, 8.89, 8.51, 8.14, 7.77, 7.42, 7.06, 6.72, - & 6.37, - & 6.03, 5.70, 5.37, 5.05, 4.72, 4.40, 4.08, 3.77, 3.45, - & 3.14, - & 2.82, 2.51, 2.20, 1.89, 1.57, 1.26, 0.94, 0.62, 0.31, - & 0.1/ -C -C awss= sodium sulfate -C - DATA AWSS/10*24.10, - & 23.17, 22.34, 21.58, 20.90, 20.27, 19.69, 19.15, 18.64, 18.17, - & 17.72, - & 17.30, 16.90, 16.52, 16.16, 15.81, 15.48, 15.16, 14.85, 14.55, - & 14.27, - & 13.99, 13.73, 13.47, 13.21, 12.97, 12.73, 12.50, 12.27, 12.05, - & 11.84, - & 11.62, 11.42, 11.21, 11.01, 10.82, 10.63, 10.44, 10.25, 10.07, - & 9.89, - & 9.71, 9.53, 9.36, 9.19, 9.02, 8.85, 8.68, 8.51, 8.35, - & 8.19, - & 8.02, 7.86, 7.70, 7.54, 7.38, 7.22, 7.06, 6.90, 6.74, - & 6.58, - & 6.42, 6.26, 6.10, 5.94, 5.78, 5.61, 5.45, 5.28, 5.11, - & 4.93, - & 4.76, 4.58, 4.39, 4.20, 4.01, 3.81, 3.60, 3.39, 3.16, - & 2.93, - & 2.68, 2.41, 2.13, 1.83, 1.52, 1.19, 0.86, 0.54, 0.25, - & 0.1/ -C -C awab= ammonium bisulfate -C - DATA AWAB/10*312.84, - & 271.43,237.19,208.52,184.28,163.64,145.97,130.79,117.72,106.42, - & 96.64, - & 88.16, 80.77, 74.33, 68.67, 63.70, 59.30, 55.39, 51.89, 48.76, - & 45.93, - & 43.38, 41.05, 38.92, 36.97, 35.18, 33.52, 31.98, 30.55, 29.22, - & 27.98, - & 26.81, 25.71, 24.67, 23.70, 22.77, 21.90, 21.06, 20.27, 19.52, - & 18.80, - & 18.11, 17.45, 16.82, 16.21, 15.63, 15.07, 14.53, 14.01, 13.51, - & 13.02, - & 12.56, 12.10, 11.66, 11.24, 10.82, 10.42, 10.04, 9.66, 9.29, - & 8.93, - & 8.58, 8.24, 7.91, 7.58, 7.26, 6.95, 6.65, 6.35, 6.05, - & 5.76, - & 5.48, 5.20, 4.92, 4.64, 4.37, 4.09, 3.82, 3.54, 3.27, - & 2.99, - & 2.70, 2.42, 2.12, 1.83, 1.52, 1.22, 0.90, 0.59, 0.28, - & 0.1/ -C -C awsa= sulfuric acid -C - DATA AWSA/34.00, 33.56, 29.22, 26.55, 24.61, 23.11, 21.89, 20.87, - & 19.99, 18.45, - & 17.83, 17.26, 16.73, 16.25, 15.80, 15.38, 14.98, 14.61, 14.26, - & 13.93, - & 13.61, 13.30, 13.01, 12.73, 12.47, 12.21, 11.96, 11.72, 11.49, - & 11.26, - & 11.04, 10.83, 10.62, 10.42, 10.23, 10.03, 9.85, 9.67, 9.49, - & 9.31, - & 9.14, 8.97, 8.81, 8.65, 8.49, 8.33, 8.18, 8.02, 7.87, - & 7.73, - & 7.58, 7.44, 7.29, 7.15, 7.01, 6.88, 6.74, 6.61, 6.47, - & 6.34, - & 6.21, 6.07, 5.94, 5.81, 5.68, 5.55, 5.43, 5.30, 5.17, - & 5.04, - & 4.91, 4.78, 4.65, 4.52, 4.39, 4.26, 4.13, 4.00, 3.86, - & 3.73, - & 3.59, 3.45, 3.31, 3.17, 3.02, 2.87, 2.71, 2.56, 2.39, - & 2.22, - & 2.05, 1.87, 1.68, 1.48, 1.27, 1.04, 0.80, 0.55, 0.28, - & 0.1/ -C -C awlc= (NH4)3H(SO4)2 -C - DATA AWLC/10*125.37, - & 110.10, 97.50, 86.98, 78.08, 70.49, 63.97, 58.33, 53.43, 49.14, - & 45.36, - & 42.03, 39.07, 36.44, 34.08, 31.97, 30.06, 28.33, 26.76, 25.32, - & 24.01, - & 22.81, 21.70, 20.67, 19.71, 18.83, 18.00, 17.23, 16.50, 15.82, - & 15.18, - & 14.58, 14.01, 13.46, 12.95, 12.46, 11.99, 11.55, 11.13, 10.72, - & 10.33, - & 9.96, 9.60, 9.26, 8.93, 8.61, 8.30, 8.00, 7.72, 7.44, - & 7.17, - & 6.91, 6.66, 6.42, 6.19, 5.96, 5.74, 5.52, 5.31, 5.11, - & 4.91, - & 4.71, 4.53, 4.34, 4.16, 3.99, 3.81, 3.64, 3.48, 3.31, - & 3.15, - & 2.99, 2.84, 2.68, 2.53, 2.37, 2.22, 2.06, 1.91, 1.75, - & 1.60, - & 1.44, 1.28, 1.12, 0.95, 0.79, 0.62, 0.45, 0.29, 0.14, - & 0.1/ -C -C awan= ammonium nitrate -C - DATA AWAN/10*960.19, - & 853.15,763.85,688.20,623.27,566.92,517.54,473.91,435.06,400.26, - & 368.89, - & 340.48,314.63,291.01,269.36,249.46,231.11,214.17,198.50,184.00, - & 170.58, - & 158.15,146.66,136.04,126.25,117.24,108.97,101.39, 94.45, 88.11, - & 82.33, - & 77.06, 72.25, 67.85, 63.84, 60.16, 56.78, 53.68, 50.81, 48.17, - & 45.71, - & 43.43, 41.31, 39.32, 37.46, 35.71, 34.06, 32.50, 31.03, 29.63, - & 28.30, - & 27.03, 25.82, 24.67, 23.56, 22.49, 21.47, 20.48, 19.53, 18.61, - & 17.72, - & 16.86, 16.02, 15.20, 14.41, 13.64, 12.89, 12.15, 11.43, 10.73, - & 10.05, - & 9.38, 8.73, 8.09, 7.47, 6.86, 6.27, 5.70, 5.15, 4.61, - & 4.09, - & 3.60, 3.12, 2.66, 2.23, 1.81, 1.41, 1.03, 0.67, 0.32, - & 0.1/ -C -C awsb= sodium bisulfate -C - DATA AWSB/10*55.99, - & 53.79, 51.81, 49.99, 48.31, 46.75, 45.28, 43.91, 42.62, 41.39, - & 40.22, - & 39.10, 38.02, 36.99, 36.00, 35.04, 34.11, 33.21, 32.34, 31.49, - & 30.65, - & 29.84, 29.04, 28.27, 27.50, 26.75, 26.01, 25.29, 24.57, 23.87, - & 23.17, - & 22.49, 21.81, 21.15, 20.49, 19.84, 19.21, 18.58, 17.97, 17.37, - & 16.77, - & 16.19, 15.63, 15.08, 14.54, 14.01, 13.51, 13.01, 12.53, 12.07, - & 11.62, - & 11.19, 10.77, 10.36, 9.97, 9.59, 9.23, 8.87, 8.53, 8.20, - & 7.88, - & 7.57, 7.27, 6.97, 6.69, 6.41, 6.14, 5.88, 5.62, 5.36, - & 5.11, - & 4.87, 4.63, 4.39, 4.15, 3.92, 3.68, 3.45, 3.21, 2.98, - & 2.74, - & 2.49, 2.24, 1.98, 1.72, 1.44, 1.16, 0.87, 0.57, 0.28, - & 0.1/ -C -C awpc= potassium chloride -C - DATA AWPC/172.62, 165.75, 159.10, 152.67, 146.46, 140.45, 134.64, - & 129.03, 123.61, 118.38, 113.34, 108.48, 103.79, 99.27, - & 94.93, 90.74, 86.71, 82.84, 79.11, 75.53, 72.09, 68.79, - & 65.63, 62.59, 59.68, 56.90, 54.23, 51.68, 49.24, 46.91, - & 44.68, 42.56, 40.53, 38.60, 36.76, 35.00, 33.33, 31.75, - & 30.24, 28.81, 27.45, 26.16, 24.94, 23.78, 22.68, 21.64, - & 20.66, 19.74, 18.86, 18.03, 17.25, 16.51, 15.82, 15.16, - & 14.54, 13.96, 13.41, 12.89, 12.40, 11.94, 11.50, 11.08, - & 10.69, 10.32, 9.96, 9.62, 9.30, 8.99, 8.69, 8.40, 8.12, - & 7.85, 7.59, 7.33, 7.08, 6.83, 6.58, 6.33, 6.08, 5.84, - & 5.59, 5.34, 5.09, 4.83, 4.57, 4.31, 4.04, 3.76, 3.48, - & 3.19, 2.90, 2.60, 2.29, 1.98, 1.66, 1.33, 0.99, 0.65, - & 0.30, 0.1/ -C -C awps= potassium sulfate -C - DATA AWPS/1014.82, 969.72, 926.16, 884.11, 843.54, 804.41, 766.68, - & 730.32, 695.30, 661.58, 629.14, 597.93, 567.92, 539.09, - & 511.41, 484.83, 459.34, 434.89, 411.47, 389.04, 367.58, - & 347.05, 327.43, 308.69, 290.80, 273.73, 257.47, 241.98, - & 227.24, 213.22, 199.90, 187.26, 175.27, 163.91, 153.15, - & 142.97, 133.36, 124.28, 115.73, 107.66, 100.08, 92.95, - & 86.26, 79.99, 74.12, 68.63, 63.50, 58.73, 54.27, 50.14, - & 46.30, 42.74, 39.44, 36.40, 33.59, 31.00, 28.63, 26.45, - & 24.45, 22.62, 20.95, 19.43, 18.05, 16.79, 15.64, 14.61, - & 13.66, 12.81, 12.03, 11.33, 10.68, 10.09, 9.55, 9.06, - & 8.60, 8.17, 7.76, 7.38, 7.02, 6.66, 6.32, 5.98, 5.65, - & 5.31, 4.98, 4.64, 4.31, 3.96, 3.62, 3.27, 2.92, 2.57, - & 2.22, 1.87, 1.53, 1.20, 0.87, 0.57, 0.28, 0.1/ -C -C awpn= potassium nitrate -C - DATA AWPN/44*1000.00, 953.05, 881.09, 813.39, - & 749.78, 690.09, 634.14, 581.77, 532.83, 487.16, 444.61, - & 405.02, 368.26, 334.18, 302.64, 273.51, 246.67, 221.97, - & 199.31, 178.56, 159.60, 142.33, 126.63, 112.40, 99.54, - & 87.96, 77.55, 68.24, 59.92, 52.53, 45.98, 40.2, 35.11, - & 30.65, 26.75, 23.35, 20.40, 17.85, 15.63, 13.72, 12.06, - & 10.61, 9.35, 8.24, 7.25, 6.37, 5.56, 4.82, 4.12, 3.47, - & 2.86, 2.28, 1.74, 1.24, 0.79, 0.40, 0.1/ -C -C awpb= potassium bisulfate -C - DATA AWPB/10*55.99, - & 53.79, 51.81, 49.99, 48.31, 46.75, 45.28, 43.91, 42.62, 41.39, - & 40.22, - & 39.10, 38.02, 36.99, 36.00, 35.04, 34.11, 33.21, 32.34, 31.49, - & 30.65, - & 29.84, 29.04, 28.27, 27.50, 26.75, 26.01, 25.29, 24.57, 23.87, - & 23.17, - & 22.49, 21.81, 21.15, 20.49, 19.84, 19.21, 18.58, 17.97, 17.37, - & 16.77, - & 16.19, 15.63, 15.08, 14.54, 14.01, 13.51, 13.01, 12.53, 12.07, - & 11.62, - & 11.19, 10.77, 10.36, 9.97, 9.59, 9.23, 8.87, 8.53, 8.20, - & 7.88, - & 7.57, 7.27, 6.97, 6.69, 6.41, 6.14, 5.88, 5.62, 5.36, - & 5.11, - & 4.87, 4.63, 4.39, 4.15, 3.92, 3.68, 3.45, 3.21, 2.98, - & 2.74, - & 2.49, 2.24, 1.98, 1.72, 1.44, 1.16, 0.87, 0.57, 0.28, - & 0.1/ -C -C awcc= calcium chloride -C - DATA AWCC/19.9, 19.0, 18.15, 17.35, 16.6, 15.89, 15.22, 14.58, - & 13.99, 13.43, 12.90, 12.41, 11.94, 11.50, 11.09, 10.7, - & 10.34, 9.99, 9.67, 9.37, 9.09, 8.83, 8.57, 8.34, 8.12, - & 7.91, 7.71, 7.53, 7.35, 7.19, 7.03, 6.88, 6.74, 6.6, - & 6.47, 6.35, 6.23, 6.12, 6.01, 5.90, 5.80, 5.70, 5.61, - & 5.51, 5.42, 5.33, 5.24, 5.16, 5.07, 4.99, 4.91, 4.82, - & 4.74, 4.66, 4.58, 4.50, 4.42, 4.34, 4.26, 4.19, 4.11, - & 4.03, 3.95, 3.87, 3.79, 3.72, 3.64, 3.56, 3.48, 3.41, - & 3.33, 3.25, 3.17, 3.09, 3.01, 2.93, 2.85, 2.76, 2.68, - & 2.59, 2.50, 2.41, 2.32, 2.23, 2.13, 2.03, 1.93, 1.82, - & 1.71, 1.59, 1.47, 1.35, 1.22, 1.07, 0.93, 0.77, 0.61, - & 0.44, 0.25, 0.1/ -C -C awcn= calcium nitrate -C - DATA AWCN/32.89, 31.46, 30.12, 28.84, 27.64, 26.51, 25.44, 24.44, - & 23.49, 22.59, 21.75, 20.96, 20.22, 19.51, 18.85, 18.23, - & 17.64, 17.09, 16.56, 16.07, 15.61, 15.17, 14.75, 14.36, - & 13.99, 13.63, 13.3, 12.98, 12.68, 12.39, 12.11, 11.84, - & 11.59, 11.35, 11.11, 10.88, 10.66, 10.45, 10.24, 10.04, - & 9.84, 9.65, 9.46, 9.28, 9.1, 8.92, 8.74, 8.57, 8.4, - & 8.23, 8.06, 7.9, 7.73, 7.57, 7.41, 7.25, 7.1,6.94, 6.79, - & 6.63, 6.48, 6.33, 6.18, 6.03, 5.89, 5.74, 5.60, 5.46, - & 5.32, 5.17, 5.04, 4.9, 4.76, 4.62, 4.49, 4.35, 4.22, - & 4.08, 3.94, 3.80, 3.66, 3.52, 3.38, 3.23, 3.08, 2.93, - & 2.77, 2.60, 2.43, 2.25, 2.07, 1.87, 1.67, 1.45, 1.22, - & 0.97, 0.72, 0.44, 0.14, 0.1/ -C -C awmc= magnesium chloride -C - DATA AWMC/11.24, 10.99, 10.74, 10.5, 10.26, 10.03, 9.81, 9.59, - & 9.38, 9.18, 8.98, 8.79, 8.60, 8.42, 8.25, 8.07, 7.91, - & 7.75, 7.59, 7.44, 7.29, 7.15, 7.01, 6.88, 6.75, 6.62, - & 6.5, 6.38, 6.27, 6.16, 6.05, 5.94, 5.85, 5.75, 5.65, - & 5.56, 5.47, 5.38, 5.30, 5.22, 5.14, 5.06, 4.98, 4.91, - & 4.84, 4.77, 4.7, 4.63, 4.57, 4.5, 4.44, 4.37, 4.31, - & 4.25, 4.19, 4.13, 4.07, 4.01, 3.95, 3.89, 3.83, 3.77, - & 3.71, 3.65, 3.58, 3.52, 3.46, 3.39, 3.33, 3.26, 3.19, - & 3.12, 3.05, 2.98, 2.9, 2.82, 2.75, 2.67, 2.58, 2.49, - & 2.41, 2.32, 2.22, 2.13, 2.03, 1.92, 1.82, 1.71, 1.60, - & 1.48, 1.36, 1.24, 1.11, 0.98, 0.84, 0.70, 0.56, 0.41, - & 0.25, 0.1/ -C -C awmn= magnesium nitrate -C - DATA AWMN/12.00, 11.84, 11.68, 11.52, 11.36, 11.2, 11.04, 10.88, - & 10.72, 10.56, 10.40, 10.25, 10.09, 9.93, 9.78, 9.63, - & 9.47, 9.32, 9.17, 9.02, 8.87, 8.72, 8.58, 8.43, 8.29, - & 8.15, 8.01, 7.87, 7.73, 7.59, 7.46, 7.33, 7.2, 7.07, - & 6.94, 6.82, 6.69, 6.57, 6.45, 6.33, 6.21, 6.01, 5.98, - & 5.87, 5.76, 5.65, 5.55, 5.44, 5.34, 5.24, 5.14, 5.04, - & 4.94, 4.84, 4.75, 4.66, 4.56, 4.47, 4.38, 4.29, 4.21, - & 4.12, 4.03, 3.95, 3.86, 3.78, 3.69, 3.61, 3.53, 3.45, - & 3.36, 3.28, 3.19, 3.11, 3.03, 2.94, 2.85, 2.76, 2.67, - & 2.58, 2.49, 2.39, 2.3, 2.2, 2.1, 1.99, 1.88, 1.77, 1.66, - & 1.54, 1.42, 1.29, 1.16, 1.02, 0.88, 0.73, 0.58, 0.42, - & 0.25, 0.1/ -C -C awmn= magnesium sulfate -C - DATA AWMS/0.93, 2.5, 3.94, 5.25, 6.45, 7.54, 8.52, 9.40, 10.19, - & 10.89, 11.50, 12.04, 12.51, 12.90, 13.23, 13.50, 13.72, - & 13.88, 13.99, 14.07, 14.1, 14.09, 14.05, 13.98, 13.88, - & 13.75, 13.6, 13.43, 13.25, 13.05, 12.83, 12.61, 12.37, - & 12.13, 11.88, 11.63, 11.37, 11.12, 10.86, 10.60, 10.35, - & 10.09, 9.85, 9.6, 9.36, 9.13, 8.9, 8.68, 8.47, 8.26, - & 8.07, 7.87, 7.69, 7.52, 7.35, 7.19, 7.03, 6.89, 6.75, - & 6.62, 6.49, 6.37, 6.26, 6.15, 6.04, 5.94, 5.84, 5.75, - & 5.65, 5.56, 5.47, 5.38, 5.29, 5.20, 5.11, 5.01, 4.92, - & 4.82, 4.71, 4.60, 4.49, 4.36, 4.24, 4.10, 3.96, 3.81, - & 3.65, 3.48, 3.30, 3.11, 2.92, 2.71, 2.49, 2.26, 2.02, - & 1.76, 1.50, 1.22, 0.94, 0.64/ -C -C *** ZSR RELATIONSHIP PARAMETERS ************************************** -C -C awas= ammonium sulfate -C -C DATA AWAS/33*100.,30,30,30,29.54,28.25,27.06,25.94, -C & 24.89,23.90,22.97,22.10,21.27,20.48,19.73,19.02,18.34,17.69, -C & 17.07,16.48,15.91,15.37,14.85,14.34,13.86,13.39,12.94,12.50, -C & 12.08,11.67,11.27,10.88,10.51,10.14, 9.79, 9.44, 9.10, 8.78, -C & 8.45, 8.14, 7.83, 7.53, 7.23, 6.94, 6.65, 6.36, 6.08, 5.81, -C & 5.53, 5.26, 4.99, 4.72, 4.46, 4.19, 3.92, 3.65, 3.38, 3.11, -C & 2.83, 2.54, 2.25, 1.95, 1.63, 1.31, 0.97, 0.63, 0.30, 0.001/ -C -C awsn= sodium nitrate -C -C DATA AWSN/ 9*1.e5,685.59, -C & 451.00,336.46,268.48,223.41,191.28, -C & 167.20,148.46,133.44,121.12,110.83, -C & 102.09,94.57,88.03,82.29,77.20,72.65,68.56,64.87,61.51,58.44, -C & 55.62,53.03,50.63,48.40,46.32,44.39,42.57,40.87,39.27,37.76, -C & 36.33,34.98,33.70,32.48,31.32,30.21,29.16,28.14,27.18,26.25, -C & 25.35,24.50,23.67,22.87,22.11,21.36,20.65,19.95,19.28,18.62, -C & 17.99,17.37,16.77,16.18,15.61,15.05,14.51,13.98,13.45,12.94, -C & 12.44,11.94,11.46,10.98,10.51,10.04, 9.58, 9.12, 8.67, 8.22, -C & 7.77, 7.32, 6.88, 6.43, 5.98, 5.53, 5.07, 4.61, 4.15, 3.69, -C & 3.22, 2.76, 2.31, 1.87, 1.47, 1.10, 0.77, 0.48, 0.23, 0.001/ -C -C awsc= sodium chloride -C -C DATA AWSC/ -C & 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., -C & 100., 100., 100., 100., 100., 100., 100., 100., 100.,16.34, -C & 16.28,16.22,16.15,16.09,16.02,15.95,15.88,15.80,15.72,15.64, -C & 15.55,15.45,15.36,15.25,15.14,15.02,14.89,14.75,14.60,14.43, -C & 14.25,14.04,13.81,13.55,13.25,12.92,12.56,12.19,11.82,11.47, -C & 11.13,10.82,10.53,10.26,10.00, 9.76, 9.53, 9.30, 9.09, 8.88, -C & 8.67, 8.48, 8.28, 8.09, 7.90, 7.72, 7.54, 7.36, 7.17, 6.99, -C & 6.81, 6.63, 6.45, 6.27, 6.09, 5.91, 5.72, 5.53, 5.34, 5.14, -C & 4.94, 4.74, 4.53, 4.31, 4.09, 3.86, 3.62, 3.37, 3.12, 2.85, -C & 2.58, 2.30, 2.01, 1.72, 1.44, 1.16, 0.89, 0.64, 0.40, 0.18/ -C -C awac= ammonium chloride -C -C DATA AWAC/ -C & 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., -C & 100., 100., 100., 100., 100., 100., 100., 100., 100.,31.45, -C & 31.30,31.14,30.98,30.82,30.65,30.48,30.30,30.11,29.92,29.71, -C & 29.50,29.29,29.06,28.82,28.57,28.30,28.03,27.78,27.78,27.77, -C & 27.77,27.43,27.07,26.67,26.21,25.73,25.18,24.56,23.84,23.01, -C & 22.05,20.97,19.85,18.77,17.78,16.89,16.10,15.39,14.74,14.14, -C & 13.59,13.06,12.56,12.09,11.65,11.22,10.81,10.42,10.03, 9.66, -C & 9.30, 8.94, 8.59, 8.25, 7.92, 7.59, 7.27, 6.95, 6.63, 6.32, -C & 6.01, 5.70, 5.39, 5.08, 4.78, 4.47, 4.17, 3.86, 3.56, 3.25, -C & 2.94, 2.62, 2.30, 1.98, 1.65, 1.32, 0.97, 0.62, 0.26, 0.13/ -C -C awss= sodium sulfate -C -C DATA AWSS/34*1.e5,23*14.30,14.21,12.53,11.47, -C & 10.66,10.01, 9.46, 8.99, 8.57, 8.19, 7.85, 7.54, 7.25, 6.98, -C & 6.74, 6.50, 6.29, 6.08, 5.88, 5.70, 5.52, 5.36, 5.20, 5.04, -C & 4.90, 4.75, 4.54, 4.34, 4.14, 3.93, 3.71, 3.49, 3.26, 3.02, -C & 2.76, 2.49, 2.20, 1.89, 1.55, 1.18, 0.82, 0.49, 0.22, 0.001/ -C -C awab= ammonium bisulfate -C -C DATA AWAB/356.45,296.51,253.21,220.47,194.85, -C & 174.24,157.31,143.16,131.15,120.82, -C & 111.86,103.99,97.04,90.86,85.31,80.31,75.78,71.66,67.90,64.44, -C & 61.25,58.31,55.58,53.04,50.68,48.47,46.40,44.46,42.63,40.91, -C & 39.29,37.75,36.30,34.92,33.61,32.36,31.18,30.04,28.96,27.93, -C & 26.94,25.99,25.08,24.21,23.37,22.57,21.79,21.05,20.32,19.63, -C & 18.96,18.31,17.68,17.07,16.49,15.92,15.36,14.83,14.31,13.80, -C & 13.31,12.83,12.36,11.91,11.46,11.03,10.61,10.20, 9.80, 9.41, -C & 9.02, 8.64, 8.28, 7.91, 7.56, 7.21, 6.87, 6.54, 6.21, 5.88, -C & 5.56, 5.25, 4.94, 4.63, 4.33, 4.03, 3.73, 3.44, 3.14, 2.85, -C & 2.57, 2.28, 1.99, 1.71, 1.42, 1.14, 0.86, 0.57, 0.29, 0.001/ -C -C awsa= sulfuric acid -C -C DATA AWSA/ -C & 34.0,33.56,29.22,26.55,24.61,23.11,21.89,20.87,19.99, -C & 19.21,18.51,17.87,17.29,16.76,16.26,15.8,15.37,14.95,14.56, -C & 14.20,13.85,13.53,13.22,12.93,12.66,12.40,12.14,11.90,11.67, -C & 11.44,11.22,11.01,10.8,10.60,10.4,10.2,10.01,9.83,9.65,9.47, -C & 9.3,9.13,8.96,8.81,8.64,8.48,8.33,8.17,8.02,7.87,7.72,7.58, -C & 7.44,7.30,7.16,7.02,6.88,6.75,6.61,6.48,6.35,6.21,6.08,5.95, -C & 5.82,5.69,5.56,5.44,5.31,5.18,5.05,4.92,4.79,4.66,4.53,4.40, -C & 4.27,4.14,4.,3.87,3.73,3.6,3.46,3.31,3.17,3.02,2.87,2.72, -C & 2.56,2.4,2.23,2.05,1.87,1.68,1.48,1.27,1.05,0.807,0.552,0.281/ -C -C awlc= (NH4)3H(SO4)2 -C -C DATA AWLC/34*1.e5,17.0,16.5,15.94,15.31,14.71,14.14, -C & 13.60,13.08,12.59,12.12,11.68,11.25,10.84,10.44,10.07, 9.71, -C & 9.36, 9.02, 8.70, 8.39, 8.09, 7.80, 7.52, 7.25, 6.99, 6.73, -C & 6.49, 6.25, 6.02, 5.79, 5.57, 5.36, 5.15, 4.95, 4.76, 4.56, -C & 4.38, 4.20, 4.02, 3.84, 3.67, 3.51, 3.34, 3.18, 3.02, 2.87, -C & 2.72, 2.57, 2.42, 2.28, 2.13, 1.99, 1.85, 1.71, 1.57, 1.43, -C & 1.30, 1.16, 1.02, 0.89, 0.75, 0.61, 0.46, 0.32, 0.16, 0.001/ -C -C awan= ammonium nitrate -C -C DATA AWAN/31*1.e5, -C & 97.17,92.28,87.66,83.15,78.87,74.84,70.98,67.46,64.11, -C & 60.98,58.07,55.37,52.85,50.43,48.24,46.19,44.26,42.40,40.70, -C & 39.10,37.54,36.10,34.69,33.35,32.11,30.89,29.71,28.58,27.46, -C & 26.42,25.37,24.33,23.89,22.42,21.48,20.56,19.65,18.76,17.91, -C & 17.05,16.23,15.40,14.61,13.82,13.03,12.30,11.55,10.83,10.14, -C & 9.44, 8.79, 8.13, 7.51, 6.91, 6.32, 5.75, 5.18, 4.65, 4.14, -C & 3.65, 3.16, 2.71, 2.26, 1.83, 1.42, 1.03, 0.66, 0.30, 0.001/ -C -C awsb= sodium bisulfate -C -C DATA AWSB/173.72,156.88,142.80,130.85,120.57, -C & 111.64,103.80,96.88,90.71,85.18, -C & 80.20,75.69,71.58,67.82,64.37,61.19,58.26,55.53,53.00,50.64, -C & 48.44,46.37,44.44,42.61,40.90,39.27,37.74,36.29,34.91,33.61, -C & 32.36,31.18,30.05,28.97,27.94,26.95,26.00,25.10,24.23,23.39, -C & 22.59,21.81,21.07,20.35,19.65,18.98,18.34,17.71,17.11,16.52, -C & 15.95,15.40,14.87,14.35,13.85,13.36,12.88,12.42,11.97,11.53, -C & 11.10,10.69,10.28, 9.88, 9.49, 9.12, 8.75, 8.38, 8.03, 7.68, -C & 7.34, 7.01, 6.69, 6.37, 6.06, 5.75, 5.45, 5.15, 4.86, 4.58, -C & 4.30, 4.02, 3.76, 3.49, 3.23, 2.98, 2.73, 2.48, 2.24, 2.01, -C & 1.78, 1.56, 1.34, 1.13, 0.92, 0.73, 0.53, 0.35, 0.17, 0.001/ -C -C *** END OF BLOCK DATA SUBPROGRAM ************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE INIT1 -C *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM -C SULFATE AEROSOL SYSTEMS (SUBROUTINE ISRP1) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE INIT1 (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - REAL IC,GII,GI0,XX,LN10 - PARAMETER (LN10=2.3025851) -C -C *** SAVE INPUT VARIABLES IN COMMON BLOCK ****************************** -C - IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION - DO 10 I=1,NCOMP - W(I) = MAX(WI(I), TINY) -10 CONTINUE - ELSE - DO 15 I=1,NCOMP ! REVERSE CALCULATION - WAER(I) = MAX(WI(I), TINY) - W(I) = ZERO -15 CONTINUE - ENDIF - RH = RHI - TEMP = TEMPI -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - XK1 = 1.015e-2 ! HSO4(aq) <==> H(aq) + SO4(aq) - XK21 = 57.639 ! NH3(g) <==> NH3(aq) - XK22 = 1.805e-5 ! NH3(aq) <==> NH4(aq) + OH(aq) - XK7 = 1.817 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq) - XK12 = 1.382e2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq) - XK13 = 29.268 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq) - XKW = 1.010e-14 ! H2O <==> H(aq) + OH(aq) -C - IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K - T0 = 298.15 - T0T = T0/TEMP - COEF= 1.0+LOG(T0T)-T0T - XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF) - XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF) - XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF) - XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF) - XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF) - XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF) - XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF) - ENDIF - XK2 = XK21*XK22 -C -C *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ******** -C - DRH2SO4 = 0.0000D0 - DRNH42S4 = 0.7997D0 - DRNH4HS4 = 0.4000D0 - DRLC = 0.6900D0 - IF (INT(TEMP) .NE. 298) THEN - T0 = 298.15d0 - TCF = 1.0/TEMP - 1.0/T0 - DRNH42S4 = DRNH42S4*EXP( 80.*TCF) - DRNH4HS4 = DRNH4HS4*EXP(384.*TCF) - DRLC = DRLC *EXP(186.*TCF) - ENDIF -C -C *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES **************** -C - DRMLCAB = 0.3780D0 ! (NH4)3H(SO4)2 & NH4HSO4 - DRMLCAS = 0.6900D0 ! (NH4)3H(SO4)2 & (NH4)2SO4 -CCC IF (INT(TEMP) .NE. 298) THEN ! For the time being. -CCC T0 = 298.15d0 -CCC TCF = 1.0/TEMP - 1.0/T0 -CCC DRMLCAB = DRMLCAB*EXP(507.506*TCF) -CCC DRMLCAS = DRMLCAS*EXP(133.865*TCF) -CCC ENDIF -C -C *** LIQUID PHASE ****************************************************** -C - CHNO3 = ZERO - CHCL = ZERO - CH2SO4 = ZERO - COH = ZERO - WATER = TINY -C - DO 20 I=1,NPAIR - MOLALR(I)=ZERO - GAMA(I) =0.1 - GAMIN(I) =GREAT - GAMOU(I) =GREAT - M0(I) =1d5 - 20 CONTINUE -C - DO 30 I=1,NPAIR - GAMA(I) = 0.1d0 - 30 CONTINUE -C - DO 40 I=1,NIONS - MOLAL(I)=ZERO -40 CONTINUE - COH = ZERO -C - DO 50 I=1,NGASAQ - GASAQ(I)=ZERO -50 CONTINUE -C -C *** SOLID PHASE ******************************************************* -C - CNH42S4= ZERO - CNH4HS4= ZERO - CNACL = ZERO - CNA2SO4= ZERO - CNANO3 = ZERO - CNH4NO3= ZERO - CNH4CL = ZERO - CNAHSO4= ZERO - CLC = ZERO - CCASO4 = ZERO - CCANO32= ZERO - CCACL2 = ZERO - CK2SO4 = ZERO - CKHSO4 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGSO4 = ZERO - CMGNO32= ZERO - CMGCL2 = ZERO -C -C *** GAS PHASE ********************************************************* -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C -C *** CALCULATE ZSR PARAMETERS ****************************************** -C - IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays - IRH = MAX (IRH, 1) -C -C M0(01) = AWSC(IRH) ! NACl -C IF (M0(01) .LT. 100.0) THEN -C IC = M0(01) -C CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(01) = M0(01)*EXP(LN10*(GI0-GII)) -C ENDIF -CC -C M0(02) = AWSS(IRH) ! (NA)2SO4 -C IF (M0(02) .LT. 100.0) THEN -C IC = 3.0*M0(02) -C CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(02) = M0(02)*EXP(LN10*(GI0-GII)) -C ENDIF -CC -C M0(03) = AWSN(IRH) ! NANO3 -C IF (M0(03) .LT. 100.0) THEN -C IC = M0(03) -C CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(03) = M0(03)*EXP(LN10*(GI0-GII)) -C ENDIF -CC - M0(04) = AWAS(IRH) ! (NH4)2SO4 -CC IF (M0(04) .LT. 100.0) THEN -CC IC = 3.0*M0(04) -C C CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(04) = M0(04)*EXP(LN10*(GI0-GII)) -CC ENDIF -C -C M0(05) = AWAN(IRH) ! NH4NO3 -C IF (M0(05) .LT. 100.0) THEN -C IC = M0(05) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(05) = M0(05)*EXP(LN10*(GI0-GII)) -C ENDIF -CC -C M0(06) = AWAC(IRH) ! NH4CL -C IF (M0(06) .LT. 100.0) THEN -C IC = M0(06) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(06) = M0(06)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(07) = AWSA(IRH) ! 2H-SO4 -CC IF (M0(07) .LT. 100.0) THEN -CC IC = 3.0*M0(07) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(07) = M0(07)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(08) = AWSA(IRH) ! H-HSO4 -CCC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used -CCC IC = M0(08) -CCC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX) -CCC M0(08) = M0(08)*EXP(LN10*(GI0-GII)) -CCC ENDIF -C - M0(09) = AWAB(IRH) ! NH4HSO4 -CC IF (M0(09) .LT. 100.0) THEN -CC IC = M0(09) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(09) = M0(09)*EXP(LN10*(GI0-GII)) -CC ENDIF -C -C M0(12) = AWSB(IRH) ! NAHSO4 -C IF (M0(12) .LT. 100.0) THEN -C IC = M0(12) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(12) = M0(12)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2 -CC IF (M0(13) .LT. 100.0) THEN -CC IC = 4.0*M0(13) -CC CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC G130 = 0.2*(3.0*GI0+2.0*GII) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC G13I = 0.2*(3.0*GI0+2.0*GII) -CC M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I)) -CC ENDIF -C -C *** OTHER INITIALIZATIONS ********************************************* -C - ICLACT = 0 - CALAOU = .TRUE. - CALAIN = .TRUE. - FRST = .TRUE. - SCASE = '??' - SULRATW = 2.D0 - SODRAT = ZERO - CRNARAT = ZERO - CRRAT = ZERO - NOFER = 0 - STKOFL =.FALSE. - DO 60 I=1,NERRMX - ERRSTK(I) =-999 - ERRMSG(I) = 'MESSAGE N/A' - 60 CONTINUE -C -C *** END OF SUBROUTINE INIT1 ******************************************* -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE INIT2 -C *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM, -C NITRATE, SULFATE AEROSOL SYSTEMS (SUBROUTINE ISRP2) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE INIT2 (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - REAL IC,GII,GI0,XX,LN10 - PARAMETER (LN10=2.3025851) -C -C *** SAVE INPUT VARIABLES IN COMMON BLOCK ****************************** -C - IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION - DO 10 I=1,NCOMP - W(I) = MAX(WI(I), TINY) -10 CONTINUE - ELSE - DO 15 I=1,NCOMP ! REVERSE CALCULATION - WAER(I) = MAX(WI(I), TINY) - W(I) = ZERO -15 CONTINUE - ENDIF - RH = RHI - TEMP = TEMPI -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - XK1 = 1.015e-2 ! HSO4(aq) <==> H(aq) + SO4(aq) - XK21 = 57.639 ! NH3(g) <==> NH3(aq) - XK22 = 1.805e-5 ! NH3(aq) <==> NH4(aq) + OH(aq) - XK4 = 2.511e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! ISORR -CCC XK4 = 3.638e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! SEQUIL - XK41 = 2.100e5 ! HNO3(g) <==> HNO3(aq) - XK7 = 1.817 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq) - XK10 = 5.746e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! ISORR -CCC XK10 = 2.985e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! SEQUIL - XK12 = 1.382e2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq) - XK13 = 29.268 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq) - XKW = 1.010e-14 ! H2O <==> H(aq) + OH(aq) -C - IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K - T0 = 298.15D0 - T0T = T0/TEMP - COEF= 1.0+LOG(T0T)-T0T - XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF) - XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF) - XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF) - XK4 = XK4 *EXP( 29.17*(T0T-1.0) + 16.830*COEF) !ISORR -CCC XK4 = XK4 *EXP( 29.47*(T0T-1.0) + 16.840*COEF) ! SEQUIL - XK41= XK41*EXP( 29.17*(T0T-1.0) + 16.830*COEF) - XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF) - XK10= XK10*EXP(-74.38*(T0T-1.0) + 6.120*COEF) ! ISORR -CCC XK10= XK10*EXP(-75.11*(T0T-1.0) + 13.460*COEF) ! SEQUIL - XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF) - XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF) - XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF) - ENDIF - XK2 = XK21*XK22 - XK42 = XK4/XK41 -C -C *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ******** -C - DRH2SO4 = ZERO - DRNH42S4 = 0.7997D0 - DRNH4HS4 = 0.4000D0 - DRNH4NO3 = 0.6183D0 - DRLC = 0.6900D0 - IF (INT(TEMP) .NE. 298) THEN - T0 = 298.15D0 - TCF = 1.0/TEMP - 1.0/T0 - DRNH4NO3 = DRNH4NO3*EXP(852.*TCF) - DRNH42S4 = DRNH42S4*EXP( 80.*TCF) - DRNH4HS4 = DRNH4HS4*EXP(384.*TCF) - DRLC = DRLC *EXP(186.*TCF) - DRNH4NO3 = MIN (DRNH4NO3,DRNH42S4) ! ADJUST FOR DRH CROSSOVER AT T<271K - ENDIF -C -C *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES **************** -C - DRMLCAB = 0.3780D0 ! (NH4)3H(SO4)2 & NH4HSO4 - DRMLCAS = 0.6900D0 ! (NH4)3H(SO4)2 & (NH4)2SO4 - DRMASAN = 0.6000D0 ! (NH4)2SO4 & NH4NO3 -CCC IF (INT(TEMP) .NE. 298) THEN ! For the time being -CCC T0 = 298.15d0 -CCC TCF = 1.0/TEMP - 1.0/T0 -CCC DRMLCAB = DRMLCAB*EXP( 507.506*TCF) -CCC DRMLCAS = DRMLCAS*EXP( 133.865*TCF) -CCC DRMASAN = DRMASAN*EXP(1269.068*TCF) -CCC ENDIF -C -C *** LIQUID PHASE ****************************************************** -C - CHNO3 = ZERO - CHCL = ZERO - CH2SO4 = ZERO - COH = ZERO - WATER = TINY -C - DO 20 I=1,NPAIR - MOLALR(I)=ZERO - GAMA(I) =0.1 - GAMIN(I) =GREAT - GAMOU(I) =GREAT - M0(I) =1d5 - 20 CONTINUE -C - DO 30 I=1,NPAIR - GAMA(I) = 0.1d0 - 30 CONTINUE -C - DO 40 I=1,NIONS - MOLAL(I)=ZERO -40 CONTINUE - COH = ZERO -C - DO 50 I=1,NGASAQ - GASAQ(I)=ZERO -50 CONTINUE -C -C *** SOLID PHASE ****************************************************** -C - CNH42S4= ZERO - CNH4HS4= ZERO - CNACL = ZERO - CNA2SO4= ZERO - CNANO3 = ZERO - CNH4NO3= ZERO - CNH4CL = ZERO - CNAHSO4= ZERO - CLC = ZERO - CCASO4 = ZERO - CCANO32= ZERO - CCACL2 = ZERO - CK2SO4 = ZERO - CKHSO4 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGSO4 = ZERO - CMGNO32= ZERO - CMGCL2 = ZERO -C -C *** GAS PHASE ******************************************************** -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C -C *** CALCULATE ZSR PARAMETERS ***************************************** -C - IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays - IRH = MAX (IRH, 1) -C -C M0(01) = AWSC(IRH) ! NACl -C IF (M0(01) .LT. 100.0) THEN -C IC = M0(01) -C CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(01) = M0(01)*EXP(LN10*(GI0-GII)) -C ENDIF -CC -C M0(02) = AWSS(IRH) ! (NA)2SO4 -C IF (M0(02) .LT. 100.0) THEN -C IC = 3.0*M0(02) -C CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(02) = M0(02)*EXP(LN10*(GI0-GII)) -C ENDIF -CCC -C M0(03) = AWSN(IRH) ! NANO3 -C IF (M0(03) .LT. 100.0) THEN -C IC = M0(03) -C CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(03) = M0(03)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(04) = AWAS(IRH) ! (NH4)2SO4 -CC IF (M0(04) .LT. 100.0) THEN -CC IC = 3.0*M0(04) -CC CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(04) = M0(04)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(05) = AWAN(IRH) ! NH4NO3 -CC IF (M0(05) .LT. 100.0) THEN -CC IC = M0(05) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(05) = M0(05)*EXP(LN10*(GI0-GII)) -CC ENDIF -C -C M0(06) = AWAC(IRH) ! NH4CL -C IF (M0(06) .LT. 100.0) THEN -C IC = M0(06) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(06) = M0(06)*EXP(LN10*(GI0-GII)) -C ENDIF -CC - M0(07) = AWSA(IRH) ! 2H-SO4 -CC IF (M0(07) .LT. 100.0) THEN -CC IC = 3.0*M0(07) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(07) = M0(07)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(08) = AWSA(IRH) ! H-HSO4 -CCC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used -CCC IC = M0(08) -CCC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX) -CCC M0(08) = M0(08)*EXP(LN10*(GI0-GII)) -CCC ENDIF -C - M0(09) = AWAB(IRH) ! NH4HSO4 -CC IF (M0(09) .LT. 100.0) THEN -CC IC = M0(09) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(09) = M0(09)*EXP(LN10*(GI0-GII)) -CC ENDIF -C -C M0(12) = AWSB(IRH) ! NAHSO4 -C IF (M0(12) .LT. 100.0) THEN -C IC = M0(12) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(12) = M0(12)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2 -C IF (M0(13) .LT. 100.0) THEN -C IC = 4.0*M0(13) -C CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C G130 = 0.2*(3.0*GI0+2.0*GII) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C G13I = 0.2*(3.0*GI0+2.0*GII) -C M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I)) -C ENDIF -C -C *** OTHER INITIALIZATIONS ********************************************* -C - ICLACT = 0 - CALAOU = .TRUE. - CALAIN = .TRUE. - FRST = .TRUE. - SCASE = '??' - SULRATW = 2.D0 - SODRAT = ZERO - CRNARAT = ZERO - CRRAT = ZERO - NOFER = 0 - STKOFL =.FALSE. - DO 60 I=1,NERRMX - ERRSTK(I) =-999 - ERRMSG(I) = 'MESSAGE N/A' - 60 CONTINUE -C -C *** END OF SUBROUTINE INIT2 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISOINIT3 -C *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM, -C SODIUM, CHLORIDE, NITRATE, SULFATE AEROSOL SYSTEMS (SUBROUTINE -C ISRP3) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISOINIT3 (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - REAL IC,GII,GI0,XX,LN10 - PARAMETER (LN10=2.3025851) -C -C *** SAVE INPUT VARIABLES IN COMMON BLOCK ****************************** -C - IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION - DO 10 I=1,NCOMP - W(I) = MAX(WI(I), TINY) -10 CONTINUE - ELSE - DO 15 I=1,NCOMP ! REVERSE CALCULATION - WAER(I) = MAX(WI(I), TINY) - W(I) = ZERO -15 CONTINUE - ENDIF - RH = RHI - TEMP = TEMPI -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - XK1 = 1.015D-2 ! HSO4(aq) <==> H(aq) + SO4(aq) - XK21 = 57.639D0 ! NH3(g) <==> NH3(aq) - XK22 = 1.805D-5 ! NH3(aq) <==> NH4(aq) + OH(aq) - XK3 = 1.971D6 ! HCL(g) <==> H(aq) + CL(aq) - XK31 = 2.500e3 ! HCL(g) <==> HCL(aq) - XK4 = 2.511e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! ISORR -CCC XK4 = 3.638e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! SEQUIL - XK41 = 2.100e5 ! HNO3(g) <==> HNO3(aq) - XK5 = 0.4799D0 ! NA2SO4(s) <==> 2*NA(aq) + SO4(aq) - XK6 = 1.086D-16 ! NH4CL(s) <==> NH3(g) + HCL(g) - XK7 = 1.817D0 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq) - XK8 = 37.661D0 ! NACL(s) <==> NA(aq) + CL(aq) - XK10 = 5.746D-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! ISORR -CCC XK10 = 2.985e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! SEQUIL - XK11 = 2.413D4 ! NAHSO4(s) <==> NA(aq) + HSO4(aq) - XK12 = 1.382D2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq) - XK13 = 29.268D0 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq) - XK14 = 22.05D0 ! NH4CL(s) <==> NH4(aq) + CL(aq) - XKW = 1.010D-14 ! H2O <==> H(aq) + OH(aq) - XK9 = 11.977D0 ! NANO3(s) <==> NA(aq) + NO3(aq) -C - IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K - T0 = 298.15D0 - T0T = T0/TEMP - COEF= 1.0+LOG(T0T)-T0T - XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF) - XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF) - XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF) - XK3 = XK3 *EXP( 30.20*(T0T-1.0) + 19.910*COEF) - XK31= XK31*EXP( 30.20*(T0T-1.0) + 19.910*COEF) - XK4 = XK4 *EXP( 29.17*(T0T-1.0) + 16.830*COEF) !ISORR -CCC XK4 = XK4 *EXP( 29.47*(T0T-1.0) + 16.840*COEF) ! SEQUIL - XK41= XK41*EXP( 29.17*(T0T-1.0) + 16.830*COEF) - XK5 = XK5 *EXP( 0.98*(T0T-1.0) + 39.500*COEF) - XK6 = XK6 *EXP(-71.00*(T0T-1.0) + 2.400*COEF) - XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF) - XK8 = XK8 *EXP( -1.56*(T0T-1.0) + 16.900*COEF) - XK9 = XK9 *EXP( -8.22*(T0T-1.0) + 16.010*COEF) - XK10= XK10*EXP(-74.38*(T0T-1.0) + 6.120*COEF) ! ISORR -CCC XK10= XK10*EXP(-75.11*(T0T-1.0) + 13.460*COEF) ! SEQUIL - XK11= XK11*EXP( 0.79*(T0T-1.0) + 14.746*COEF) - XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF) - XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF) - XK14= XK14*EXP( 24.55*(T0T-1.0) + 16.900*COEF) - XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF) - ENDIF - XK2 = XK21*XK22 - XK42 = XK4/XK41 - XK32 = XK3/XK31 -C -C *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ******** -C - DRH2SO4 = ZERO - DRNH42S4 = 0.7997D0 - DRNH4HS4 = 0.4000D0 - DRLC = 0.6900D0 - DRNACL = 0.7528D0 - DRNANO3 = 0.7379D0 - DRNH4CL = 0.7710D0 - DRNH4NO3 = 0.6183D0 - DRNA2SO4 = 0.9300D0 - DRNAHSO4 = 0.5200D0 - IF (INT(TEMP) .NE. 298) THEN - T0 = 298.15D0 - TCF = 1.0/TEMP - 1.0/T0 - DRNACL = DRNACL *EXP( 25.*TCF) - DRNANO3 = DRNANO3 *EXP(304.*TCF) - DRNA2SO4 = DRNA2SO4*EXP( 80.*TCF) - DRNH4NO3 = DRNH4NO3*EXP(852.*TCF) - DRNH42S4 = DRNH42S4*EXP( 80.*TCF) - DRNH4HS4 = DRNH4HS4*EXP(384.*TCF) - DRLC = DRLC *EXP(186.*TCF) - DRNH4CL = DRNH4Cl *EXP(239.*TCF) - DRNAHSO4 = DRNAHSO4*EXP(-45.*TCF) -C -C *** ADJUST FOR DRH "CROSSOVER" AT LOW TEMPERATURES -C - DRNH4NO3 = MIN (DRNH4NO3, DRNH4CL, DRNH42S4, DRNANO3, DRNACL) - DRNANO3 = MIN (DRNANO3, DRNACL) - DRNH4CL = MIN (DRNH4Cl, DRNH42S4) -C - ENDIF -C -C *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES **************** -C - DRMLCAB = 0.378D0 ! (NH4)3H(SO4)2 & NH4HSO4 - DRMLCAS = 0.690D0 ! (NH4)3H(SO4)2 & (NH4)2SO4 - DRMASAN = 0.600D0 ! (NH4)2SO4 & NH4NO3 - DRMG1 = 0.460D0 ! (NH4)2SO4, NH4NO3, NA2SO4, NH4CL - DRMG2 = 0.691D0 ! (NH4)2SO4, NA2SO4, NH4CL - DRMG3 = 0.697D0 ! (NH4)2SO4, NA2SO4 - DRMH1 = 0.240D0 ! NA2SO4, NANO3, NACL, NH4NO3, NH4CL - DRMH2 = 0.596D0 ! NA2SO4, NANO3, NACL, NH4CL - DRMI1 = 0.240D0 ! LC, NAHSO4, NH4HSO4, NA2SO4, (NH4)2SO4 - DRMI2 = 0.363D0 ! LC, NAHSO4, NA2SO4, (NH4)2SO4 - NO DATA - - DRMI3 = 0.610D0 ! LC, NA2SO4, (NH4)2SO4 - DRMQ1 = 0.494D0 ! (NH4)2SO4, NH4NO3, NA2SO4 - DRMR1 = 0.663D0 ! NA2SO4, NANO3, NACL - DRMR2 = 0.735D0 ! NA2SO4, NACL - DRMR3 = 0.673D0 ! NANO3, NACL - DRMR4 = 0.694D0 ! NA2SO4, NACL, NH4CL - DRMR5 = 0.731D0 ! NA2SO4, NH4CL - DRMR6 = 0.596D0 ! NA2SO4, NANO3, NH4CL - DRMR7 = 0.380D0 ! NA2SO4, NANO3, NACL, NH4NO3 - DRMR8 = 0.380D0 ! NA2SO4, NACL, NH4NO3 - DRMR9 = 0.494D0 ! NA2SO4, NH4NO3 - DRMR10 = 0.476D0 ! NA2SO4, NANO3, NH4NO3 - DRMR11 = 0.340D0 ! NA2SO4, NACL, NH4NO3, NH4CL - DRMR12 = 0.460D0 ! NA2SO4, NH4NO3, NH4CL - DRMR13 = 0.438D0 ! NA2SO4, NANO3, NH4NO3, NH4CL -CCC IF (INT(TEMP) .NE. 298) THEN -CCC T0 = 298.15d0 -CCC TCF = 1.0/TEMP - 1.0/T0 -CCC DRMLCAB = DRMLCAB*EXP( 507.506*TCF) -CCC DRMLCAS = DRMLCAS*EXP( 133.865*TCF) -CCC DRMASAN = DRMASAN*EXP(1269.068*TCF) -CCC DRMG1 = DRMG1 *EXP( 572.207*TCF) -CCC DRMG2 = DRMG2 *EXP( 58.166*TCF) -CCC DRMG3 = DRMG3 *EXP( 22.253*TCF) -CCC DRMH1 = DRMH1 *EXP(2116.542*TCF) -CCC DRMH2 = DRMH2 *EXP( 650.549*TCF) -CCC DRMI1 = DRMI1 *EXP( 565.743*TCF) -CCC DRMI2 = DRMI2 *EXP( 91.745*TCF) -CCC DRMI3 = DRMI3 *EXP( 161.272*TCF) -CCC DRMQ1 = DRMQ1 *EXP(1616.621*TCF) -CCC DRMR1 = DRMR1 *EXP( 292.564*TCF) -CCC DRMR2 = DRMR2 *EXP( 14.587*TCF) -CCC DRMR3 = DRMR3 *EXP( 307.907*TCF) -CCC DRMR4 = DRMR4 *EXP( 97.605*TCF) -CCC DRMR5 = DRMR5 *EXP( 98.523*TCF) -CCC DRMR6 = DRMR6 *EXP( 465.500*TCF) -CCC DRMR7 = DRMR7 *EXP( 324.425*TCF) -CCC DRMR8 = DRMR8 *EXP(2660.184*TCF) -CCC DRMR9 = DRMR9 *EXP(1617.178*TCF) -CCC DRMR10 = DRMR10 *EXP(1745.226*TCF) -CCC DRMR11 = DRMR11 *EXP(3691.328*TCF) -CCC DRMR12 = DRMR12 *EXP(1836.842*TCF) -CCC DRMR13 = DRMR13 *EXP(1967.938*TCF) -CCC ENDIF -C -C *** LIQUID PHASE ****************************************************** -C - CHNO3 = ZERO - CHCL = ZERO - CH2SO4 = ZERO - COH = ZERO - WATER = TINY -C - DO 20 I=1,NPAIR - MOLALR(I)=ZERO - GAMA(I) =0.1 - GAMIN(I) =GREAT - GAMOU(I) =GREAT - M0(I) =1d5 - 20 CONTINUE -C - DO 30 I=1,NPAIR - GAMA(I) = 0.1d0 - 30 CONTINUE -C - DO 40 I=1,NIONS - MOLAL(I)=ZERO -40 CONTINUE - COH = ZERO -C - DO 50 I=1,NGASAQ - GASAQ(I)=ZERO -50 CONTINUE -C -C *** SOLID PHASE ******************************************************* -C - CNH42S4= ZERO - CNH4HS4= ZERO - CNACL = ZERO - CNA2SO4= ZERO - CNANO3 = ZERO - CNH4NO3= ZERO - CNH4CL = ZERO - CNAHSO4= ZERO - CLC = ZERO - CCASO4 = ZERO - CCANO32= ZERO - CCACL2 = ZERO - CK2SO4 = ZERO - CKHSO4 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGSO4 = ZERO - CMGNO32= ZERO - CMGCL2 = ZERO -C -C *** GAS PHASE ********************************************************* -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C -C *** CALCULATE ZSR PARAMETERS ****************************************** -C - IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays - IRH = MAX (IRH, 1) -C - M0(01) = AWSC(IRH) ! NACl -CC IF (M0(01) .LT. 100.0) THEN -CC IC = M0(01) -CC CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(01) = M0(01)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(02) = AWSS(IRH) ! (NA)2SO4 -CC IF (M0(02) .LT. 100.0) THEN -CC IC = 3.0*M0(02) -CC CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(02) = M0(02)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(03) = AWSN(IRH) ! NANO3 -CC IF (M0(03) .LT. 100.0) THEN -CC IC = M0(03) -CC CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C C M0(03) = M0(03)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(04) = AWAS(IRH) ! (NH4)2SO4 -CC IF (M0(04) .LT. 100.0) THEN -CC IC = 3.0*M0(04) -CC CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(04) = M0(04)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(05) = AWAN(IRH) ! NH4NO3 -CC IF (M0(05) .LT. 100.0) THEN -CC IC = M0(05) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(05) = M0(05)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(06) = AWAC(IRH) ! NH4CL -CC IF (M0(06) .LT. 100.0) THEN -CC IC = M0(06) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(06) = M0(06)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(07) = AWSA(IRH) ! 2H-SO4 -CC IF (M0(07) .LT. 100.0) THEN -CC IC = 3.0*M0(07) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(07) = M0(07)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(08) = AWSA(IRH) ! H-HSO4 -CCC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used -CCC IC = M0(08) -CCC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX) -CCC M0(08) = M0(08)*EXP(LN10*(GI0-GII)) -CCC ENDIF -C - M0(09) = AWAB(IRH) ! NH4HSO4 -CC IF (M0(09) .LT. 100.0) THEN -CC IC = M0(09) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(09) = M0(09)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(12) = AWSB(IRH) ! NAHSO4 -CC IF (M0(12) .LT. 100.0) THEN -CC IC = M0(12) -CC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC M0(12) = M0(12)*EXP(LN10*(GI0-GII)) -CC ENDIF -C - M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2 -CC IF (M0(13) .LT. 100.0) THEN -CC IC = 4.0*M0(13) -CC CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC G130 = 0.2*(3.0*GI0+2.0*GII) -CC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -CC & XX,XX,XX,XX,XX,XX,XX,XX,XX) -CC G13I = 0.2*(3.0*GI0+2.0*GII) -CC M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I)) -CC ENDIF -C -C *** OTHER INITIALIZATIONS ********************************************* -C - ICLACT = 0 - CALAOU = .TRUE. - CALAIN = .TRUE. - FRST = .TRUE. - SCASE = '??' - SULRATW = 2.D0 - CRNARAT = ZERO - CRRAT = ZERO - NOFER = 0 - STKOFL =.FALSE. - DO 60 I=1,NERRMX - ERRSTK(I) =-999 - ERRMSG(I) = 'MESSAGE N/A' - 60 CONTINUE -C -C *** END OF SUBROUTINE ISOINIT3 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE INIT4 -C *** THIS SUBROUTINE INITIALIZES ALL GLOBAL VARIABLES FOR AMMONIUM, -C SODIUM, CHLORIDE, NITRATE, SULFATE, CALCIUM, POTASSIUM, MAGNESIUM -C AEROSOL SYSTEMS (SUBROUTINE ISRP4) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE INIT4 (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - REAL IC,GII,GI0,XX,LN10 - PARAMETER (LN10=2.3025851) -C -C *** SAVE INPUT VARIABLES IN COMMON BLOCK ****************************** -C - IF (IPROB.EQ.0) THEN ! FORWARD CALCULATION - DO 10 I=1,NCOMP - W(I) = MAX(WI(I), TINY) -10 CONTINUE - ELSE - DO 15 I=1,NCOMP ! REVERSE CALCULATION - WAER(I) = MAX(WI(I), TINY) - W(I) = ZERO -15 CONTINUE - ENDIF - RH = RHI - TEMP = TEMPI -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - XK1 = 1.015D-2 ! HSO4(aq) <==> H(aq) + SO4(aq) - XK21 = 57.639D0 ! NH3(g) <==> NH3(aq) - XK22 = 1.805D-5 ! NH3(aq) <==> NH4(aq) + OH(aq) - XK3 = 1.971D6 ! HCL(g) <==> H(aq) + CL(aq) - XK31 = 2.500e3 ! HCL(g) <==> HCL(aq) - XK4 = 2.511e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! ISORR -C XK4 = 3.638e6 ! HNO3(g) <==> H(aq) + NO3(aq) ! SEQUIL - XK41 = 2.100e5 ! HNO3(g) <==> HNO3(aq) - XK5 = 0.4799D0 ! NA2SO4(s) <==> 2*NA(aq) + SO4(aq) - XK6 = 1.086D-16 ! NH4CL(s) <==> NH3(g) + HCL(g) - XK7 = 1.817D0 ! (NH4)2SO4(s) <==> 2*NH4(aq) + SO4(aq) - XK8 = 37.661D0 ! NACL(s) <==> NA(aq) + CL(aq) -C XK10 = 5.746D-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! ISORR - XK10 = 4.199D-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! (Mozurkewich, 1993) -C XK10 = 2.985e-17 ! NH4NO3(s) <==> NH3(g) + HNO3(g) ! SEQUIL - XK11 = 2.413D4 ! NAHSO4(s) <==> NA(aq) + HSO4(aq) - XK12 = 1.382D2 ! NH4HSO4(s) <==> NH4(aq) + HSO4(aq) - XK13 = 29.268D0 ! (NH4)3H(SO4)2(s) <==> 3*NH4(aq) + HSO4(aq) + SO4(aq) - XK14 = 22.05D0 ! NH4CL(s) <==> NH4(aq) + CL(aq) - XKW = 1.010D-14 ! H2O <==> H(aq) + OH(aq) - XK9 = 11.977D0 ! NANO3(s) <==> NA(aq) + NO3(aq) -CCC - XK15 = 6.067D5 ! CA(NO3)2(s) <==> CA(aq) + 2NO3(aq) - XK16 = 7.974D11 ! CACL2(s) <==> CA(aq) + 2CL(aq) - XK17 = 1.569D-2 ! K2SO4(s) <==> 2K(aq) + SO4(aq) - XK18 = 24.016 ! KHSO4(s) <==> K(aq) + HSO4(aq) - XK19 = 0.872 ! KNO3(s) <==> K(aq) + NO3(aq) - XK20 = 8.680 ! KCL(s) <==> K(aq) + CL(aq) - XK23 = 1.079D5 ! MGS04(s) <==> MG(aq) + SO4(aq) - XK24 = 2.507D15 ! MG(NO3)2(s) <==> MG(aq) + 2NO3(aq) - XK25 = 9.557D21 ! MGCL2(s) <==> MG(aq) + 2CL(aq) -C XK26 = 4.299D-7 ! CO2(aq) + H2O <==> HCO3(aq) + H(aq) -C XK27 = 4.678D-11 ! HCO3(aq) <==> CO3(aq) + H(aq) - -C - IF (INT(TEMP) .NE. 298) THEN ! FOR T != 298K or 298.15K - T0 = 298.15D0 - T0T = T0/TEMP - COEF= 1.0+LOG(T0T)-T0T - XK1 = XK1 *EXP( 8.85*(T0T-1.0) + 25.140*COEF) - XK21= XK21*EXP( 13.79*(T0T-1.0) - 5.393*COEF) - XK22= XK22*EXP( -1.50*(T0T-1.0) + 26.920*COEF) - XK3 = XK3 *EXP( 30.20*(T0T-1.0) + 19.910*COEF) - XK31= XK31*EXP( 30.20*(T0T-1.0) + 19.910*COEF) - XK4 = XK4 *EXP( 29.17*(T0T-1.0) + 16.830*COEF) !ISORR -C XK4 = XK4 *EXP( 29.47*(T0T-1.0) + 16.840*COEF) ! SEQUIL - XK41= XK41*EXP( 29.17*(T0T-1.0) + 16.830*COEF) - XK5 = XK5 *EXP( 0.98*(T0T-1.0) + 39.500*COEF) - XK6 = XK6 *EXP(-71.00*(T0T-1.0) + 2.400*COEF) - XK7 = XK7 *EXP( -2.65*(T0T-1.0) + 38.570*COEF) - XK8 = XK8 *EXP( -1.56*(T0T-1.0) + 16.900*COEF) - XK9 = XK9 *EXP( -8.22*(T0T-1.0) + 16.010*COEF) -C XK10= XK10*EXP(-74.38*(T0T-1.0) + 6.120*COEF) ! ISORR - XK10= XK10*EXP(-74.7351*(T0T-1.0) + 6.025*COEF) ! (Mozurkewich, 1993) -C XK10= XK10*EXP(-75.11*(T0T-1.0) + 13.460*COEF) ! SEQUIL - XK11= XK11*EXP( 0.79*(T0T-1.0) + 14.746*COEF) - XK12= XK12*EXP( -2.87*(T0T-1.0) + 15.830*COEF) - XK13= XK13*EXP( -5.19*(T0T-1.0) + 54.400*COEF) - XK14= XK14*EXP( 24.55*(T0T-1.0) + 16.900*COEF) - XKW = XKW *EXP(-22.52*(T0T-1.0) + 26.920*COEF) -CCC -C XK15= XK15 *EXP( .0*(T0T-1.0) + .0*COEF) -C XK16= XK16 *EXP( .0*(T0T-1.0) + .0*COEF) - XK17= XK17 *EXP(-9.585*(T0T-1.0) + 45.81*COEF) - XK18= XK18 *EXP(-8.423*(T0T-1.0) + 17.96*COEF) - XK19= XK19 *EXP(-14.08*(T0T-1.0) + 19.39*COEF) - XK20= XK20 *EXP(-6.902*(T0T-1.0) + 19.95*COEF) -C XK23= XK23 *EXP( .0*(T0T-1.0) + .0*COEF) -C XK24= XK24 *EXP( .0*(T0T-1.0) + .0*COEF) -C XK25= XK25 *EXP( .0*(T0T-1.0) + .0*COEF) -C XK26= XK26 *EXP(-3.0821*(T0T-1.0) + 31.8139*COEF) -C XK27= XK27 *EXP(-5.9908*(T0T-1.0) + 38.844*COEF) - - ENDIF - XK2 = XK21*XK22 - XK42 = XK4/XK41 - XK32 = XK3/XK31 -C -C *** CALCULATE DELIQUESCENCE RELATIVE HUMIDITIES (UNICOMPONENT) ******** -C - DRH2SO4 = ZERO - DRNH42S4 = 0.7997D0 - DRNH4HS4 = 0.4000D0 - DRLC = 0.6900D0 - DRNACL = 0.7528D0 - DRNANO3 = 0.7379D0 - DRNH4CL = 0.7710D0 - DRNH4NO3 = 0.6183D0 - DRNA2SO4 = 0.9300D0 - DRNAHSO4 = 0.5200D0 - DRCANO32 = 0.4906D0 - DRCACL2 = 0.2830D0 - DRK2SO4 = 0.9750D0 - DRKHSO4 = 0.8600D0 - DRKNO3 = 0.9248D0 - DRKCL = 0.8426D0 - DRMGSO4 = 0.8613D0 - DRMGNO32 = 0.5400D0 - DRMGCL2 = 0.3284D0 - IF (INT(TEMP) .NE. 298) THEN - T0 = 298.15D0 - TCF = 1.0/TEMP - 1.0/T0 - DRNACL = DRNACL *EXP( 25.*TCF) - DRNANO3 = DRNANO3 *EXP(304.*TCF) - DRNA2SO4 = DRNA2SO4*EXP( 80.*TCF) - DRNH4NO3 = DRNH4NO3*EXP(852.*TCF) - DRNH42S4 = DRNH42S4*EXP( 80.*TCF) - DRNH4HS4 = DRNH4HS4*EXP(384.*TCF) - DRLC = DRLC *EXP(186.*TCF) - DRNH4CL = DRNH4Cl *EXP(239.*TCF) - DRNAHSO4 = DRNAHSO4*EXP(-45.*TCF) -C DRCANO32 = DRCANO32*EXP(-430.5*TCF) - DRCANO32 = DRCANO32*EXP(509.4*TCF) ! KELLY & WEXLER (2005) FOR CANO32.4H20 -C DRCACL2 = DRCACL2 *EXP(-1121.*TCF) - DRCACL2 = DRCACL2 *EXP(551.1*TCF) ! KELLY & WEXLER (2005) FOR CACL2.6H20 - DRK2SO4 = DRK2SO4 *EXP(35.6*TCF) -C DRKHSO4 = DRKHSO4 *EXP( 0.*TCF) -C DRKNO3 = DRKNO3 *EXP( 0.*TCF) - DRKCL = DRKCL *EXP(159.*TCF) - DRMGSO4 = DRMGSO4 *EXP(-714.45*TCF) - DRMGNO32 = DRMGNO32*EXP(230.2*TCF) ! KELLY & WEXLER (2005) FOR MGNO32.6H20 -C DRMGCL2 = DRMGCL2 *EXP(-1860.*TCF) - DRMGCL2 = DRMGCL2 *EXP(42.23*TCF) ! KELLY & WEXLER (2005) FOR MGCL2.6H20 -C - ENDIF -C -C *** CALCULATE MUTUAL DELIQUESCENCE RELATIVE HUMIDITIES **************** -C - DRMLCAB = 0.378D0 ! (NH4)3H(SO4)2 & NH4HSO4 - DRMLCAS = 0.690D0 ! (NH4)3H(SO4)2 & (NH4)2SO4 - DRMASAN = 0.600D0 ! (NH4)2SO4 & NH4NO3 - DRMG1 = 0.460D0 ! (NH4)2SO4, NH4NO3, NA2SO4, NH4CL - DRMG2 = 0.691D0 ! (NH4)2SO4, NA2SO4, NH4CL - DRMG3 = 0.697D0 ! (NH4)2SO4, NA2SO4 - DRMH1 = 0.240D0 ! NA2SO4, NANO3, NACL, NH4NO3, NH4CL - DRMH2 = 0.596D0 ! NA2SO4, NANO3, NACL, NH4CL - DRMI1 = 0.240D0 ! LC, NAHSO4, NH4HSO4, NA2SO4, (NH4)2SO4 - DRMI2 = 0.363D0 ! LC, NAHSO4, NA2SO4, (NH4)2SO4 - NO DATA - - DRMI3 = 0.610D0 ! LC, NA2SO4, (NH4)2SO4 - DRMQ1 = 0.494D0 ! (NH4)2SO4, NH4NO3, NA2SO4 - DRMR1 = 0.663D0 ! NA2SO4, NANO3, NACL - DRMR2 = 0.735D0 ! NA2SO4, NACL - DRMR3 = 0.673D0 ! NANO3, NACL - DRMR4 = 0.694D0 ! NA2SO4, NACL, NH4CL - DRMR5 = 0.731D0 ! NA2SO4, NH4CL - DRMR6 = 0.596D0 ! NA2SO4, NANO3, NH4CL - DRMR7 = 0.380D0 ! NA2SO4, NANO3, NACL, NH4NO3 - DRMR8 = 0.380D0 ! NA2SO4, NACL, NH4NO3 - DRMR9 = 0.494D0 ! NA2SO4, NH4NO3 - DRMR10 = 0.476D0 ! NA2SO4, NANO3, NH4NO3 - DRMR11 = 0.340D0 ! NA2SO4, NACL, NH4NO3, NH4CL - DRMR12 = 0.460D0 ! NA2SO4, NH4NO3, NH4CL - DRMR13 = 0.438D0 ! NA2SO4, NANO3, NH4NO3, NH4CL -C - DRMO1 = 0.460D0 ! (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4 - DRMO2 = 0.691D0 ! (NH4)2SO4, NH4Cl, NA2SO4, K2SO4, MGSO4 - DRMO3 = 0.697D0 ! (NH4)2SO4, NA2SO4, K2SO4, MGSO4 - DRML1 = 0.240D0 ! K2SO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC - DRML2 = 0.363D0 ! K2SO4, MGSO4, KHSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC - DRML3 = 0.610D0 ! K2SO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4, LC - DRMM1 = 0.240D0 ! K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3, NH4NO3 - DRMM2 = 0.596D0 ! K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 - DRMP1 = 0.200D0 ! CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL - DRMP2 = 0.240D0 ! CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL - DRMP3 = 0.240D0 ! CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL - DRMP4 = 0.240D0 ! K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL - DRMP5 = 0.240D0 ! K2SO4, KNO3, KCL, MGSO4, NANO3, NACL, NH4NO3, NH4CL -CC - DRMV1 = 0.494D0 ! (NH4)2SO4, NH4NO3, NA2SO4, K2SO4, MGSO4 -CC -CC -C DRMO1 = 0.1D0 ! (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4 -C DRMO2 = 0.1D0 ! (NH4)2SO4, NH4Cl, NA2SO4, K2SO4, MGSO4 -C DRMO3 = 0.1D0 ! (NH4)2SO4, NA2SO4, K2SO4, MGSO4 -C DRML1 = 0.1D0 ! K2SO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C DRML2 = 0.1D0 ! K2SO4, MGSO4, KHSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C DRML3 = 0.1D0 ! K2SO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4, LC -C DRMM1 = 0.1D0 ! K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3, NH4NO3 -C DRMM2 = 0.1D0 ! K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 -C DRMP1 = 0.1D0 ! CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C DRMP2 = 0.1D0 ! CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C DRMP3 = 0.1D0 ! CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C DRMP4 = 0.1D0 ! K2SO4, KNO3, KCL, MGSO4, MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C DRMP5 = 0.1D0 ! K2SO4, KNO3, KCL, MGSO4, NANO3, NACL, NH4NO3, NH4CL -CC -C DRMV1 = 0.1D0 ! (NH4)2SO4, NH4NO3, NA2SO4, K2SO4, MGSO4 -C -CCC IF (INT(TEMP) .NE. 298) THEN -CCC T0 = 298.15d0 -CCC TCF = 1.0/TEMP - 1.0/T0 -CCC DRMLCAB = DRMLCAB*EXP( 507.506*TCF) -CCC DRMLCAS = DRMLCAS*EXP( 133.865*TCF) -CCC DRMASAN = DRMASAN*EXP(1269.068*TCF) -CCC DRMG1 = DRMG1 *EXP( 572.207*TCF) -CCC DRMG2 = DRMG2 *EXP( 58.166*TCF) -CCC DRMG3 = DRMG3 *EXP( 22.253*TCF) -CCC DRMH1 = DRMH1 *EXP(2116.542*TCF) -CCC DRMH2 = DRMH2 *EXP( 650.549*TCF) -CCC DRMI1 = DRMI1 *EXP( 565.743*TCF) -CCC DRMI2 = DRMI2 *EXP( 91.745*TCF) -CCC DRMI3 = DRMI3 *EXP( 161.272*TCF) -CCC DRMQ1 = DRMQ1 *EXP(1616.621*TCF) -CCC DRMR1 = DRMR1 *EXP( 292.564*TCF) -CCC DRMR2 = DRMR2 *EXP( 14.587*TCF) -CCC DRMR3 = DRMR3 *EXP( 307.907*TCF) -CCC DRMR4 = DRMR4 *EXP( 97.605*TCF) -CCC DRMR5 = DRMR5 *EXP( 98.523*TCF) -CCC DRMR6 = DRMR6 *EXP( 465.500*TCF) -CCC DRMR7 = DRMR7 *EXP( 324.425*TCF) -CCC DRMR8 = DRMR8 *EXP(2660.184*TCF) -CCC DRMR9 = DRMR9 *EXP(1617.178*TCF) -CCC DRMR10 = DRMR10 *EXP(1745.226*TCF) -CCC DRMR11 = DRMR11 *EXP(3691.328*TCF) -CCC DRMR12 = DRMR12 *EXP(1836.842*TCF) -CCC DRMR13 = DRMR13 *EXP(1967.938*TCF) -CCC ENDIF -C -C *** LIQUID PHASE ****************************************************** -C - CHNO3 = ZERO - CHCL = ZERO - CH2SO4 = ZERO - COH = ZERO - WATER = TINY -C - DO 20 I=1,NPAIR - MOLALR(I)=ZERO - GAMA(I) =0.1 - GAMIN(I) =GREAT - GAMOU(I) =GREAT - M0(I) =1d5 - 20 CONTINUE -C - DO 30 I=1,NPAIR - GAMA(I) = 0.1d0 - 30 CONTINUE -C - DO 40 I=1,NIONS - MOLAL(I)=ZERO -40 CONTINUE - COH = ZERO -C - DO 50 I=1,NGASAQ - GASAQ(I)=ZERO -50 CONTINUE -C -C *** SOLID PHASE ******************************************************* -C - CNH42S4= ZERO - CNH4HS4= ZERO - CNACL = ZERO - CNA2SO4= ZERO - CNANO3 = ZERO - CNH4NO3= ZERO - CNH4CL = ZERO - CNAHSO4= ZERO - CLC = ZERO - CCASO4 = ZERO - CCANO32= ZERO - CCACL2 = ZERO - CK2SO4 = ZERO - CKHSO4 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGSO4 = ZERO - CMGNO32= ZERO - CMGCL2 = ZERO -C -C *** GAS PHASE ********************************************************* -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C -C *** CALCULATE ZSR PARAMETERS ****************************************** -C - IRH = MIN (INT(RH*NZSR+0.5),NZSR) ! Position in ZSR arrays - IRH = MAX (IRH, 1) -C - M0(01) = AWSC(IRH) ! NACl -C IF (M0(01) .LT. 100.0) THEN -C IC = M0(01) -C CALL KMTAB(IC,298.0, GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(01) = M0(01)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(02) = AWSS(IRH) ! (NA)2SO4 -C IF (M0(02) .LT. 100.0) THEN -C IC = 3.0*M0(02) -C CALL KMTAB(IC,298.0, XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(02) = M0(02)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(03) = AWSN(IRH) ! NANO3 -C IF (M0(03) .LT. 100.0) THEN -C IC = M0(03) -C CALL KMTAB(IC,298.0, XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(03) = M0(03)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(04) = AWAS(IRH) ! (NH4)2SO4 -C IF (M0(04) .LT. 100.0) THEN -C IC = 3.0*M0(04) -C CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(04) = M0(04)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(05) = AWAN(IRH) ! NH4NO3 -C IF (M0(05) .LT. 100.0) THEN -C IC = M0(05) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(05) = M0(05)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(06) = AWAC(IRH) ! NH4CL -C IF (M0(06) .LT. 100.0) THEN -C IC = M0(06) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(06) = M0(06)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(07) = AWSA(IRH) ! 2H-SO4 -C IF (M0(07) .LT. 100.0) THEN -C IC = 3.0*M0(07) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(07) = M0(07)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(08) = AWSA(IRH) ! H-HSO4 -CCC IF (M0(08) .LT. 100.0) THEN ! These are redundant, because M0(8) is not used -CCC IC = M0(08) -CCC CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX,XX) -CCCCCC CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX,XX) -CCC M0(08) = M0(08)*EXP(LN10*(GI0-GII)) -CCC ENDIF -C - M0(09) = AWAB(IRH) ! NH4HSO4 -C IF (M0(09) .LT. 100.0) THEN -C IC = M0(09) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,GI0,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,GII,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(09) = M0(09)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(12) = AWSB(IRH) ! NAHSO4 -C IF (M0(12) .LT. 100.0) THEN -C IC = M0(12) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GI0, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,GII, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(12) = M0(12)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(13) = AWLC(IRH) ! (NH4)3H(SO4)2 -C IF (M0(13) .LT. 100.0) THEN -C IC = 4.0*M0(13) -C CALL KMTAB(IC,298.0, XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C G130 = 0.2*(3.0*GI0+2.0*GII) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,GI0,XX,XX,XX,XX,GII,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,XX) -C G13I = 0.2*(3.0*GI0+2.0*GII) -C M0(13) = M0(13)*EXP(LN10*SNGL(G130-G13I)) -C ENDIF -C - M0(15) = AWCN(IRH) ! CA(NO3)2 -C IF (M0(15) .LT. 100.0) THEN -C IC = M0(15) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & GI0,XX,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & GII,XX,XX,XX,XX,XX,XX,XX,XX) -C M0(15) = M0(15)*EXP(LN10*(GI0-GII)) -C ENDIF -CC - M0(16) = AWCC(IRH) ! CACl2 -C IF (M0(16) .LT. 100.0) THEN -C IC = M0(16) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,GI0,XX,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,GII,XX,XX,XX,XX,XX,XX,XX) -C M0(16) = M0(16)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(17) = AWPS(IRH) ! K2SO4 -C IF (M0(17) .LT. 100.0) THEN -C IC = M0(17) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,GI0,XX,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,GII,XX,XX,XX,XX,XX,XX) -C M0(17) = M0(17)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(18) = AWPB(IRH) ! KHSO4 -C IF (M0(18) .LT. 100.0) THEN -C IC = M0(18) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,GI0,XX,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,GII,XX,XX,XX,XX,XX) -C M0(18) = M0(18)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(19) = AWPN(IRH) ! KNO3 -C IF (M0(19) .LT. 100.0) THEN -C IC = M0(19) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,GI0,XX,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,GII,XX,XX,XX,XX) -C M0(19) = M0(19)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(20) = AWPC(IRH) ! KCl -C IF (M0(20) .LT. 100.0) THEN -C IC = M0(20) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,GI0,XX,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,GII,XX,XX,XX) -C M0(20) = M0(20)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(21) = AWMS(IRH) ! MGSO4 -C IF (M0(21) .LT. 100.0) THEN -C IC = M0(21) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,GI0,XX,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,GII,XX,XX) -C M0(21) = M0(21)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(22) = AWMN(IRH) ! MG(NO3)2 -C IF (M0(22) .LT. 100.0) THEN -C IC = M0(22) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,GI0,XX) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,GII,XX) -C M0(22) = M0(22)*EXP(LN10*(GI0-GII)) -C ENDIF -C - M0(23) = AWMC(IRH) ! MGCL2 -C IF (M0(23) .LT. 100.0) THEN -C IC = M0(23) -C CALL KMTAB(IC,298.0, XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,GI0) -C CALL KMTAB(IC,SNGL(TEMP),XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX,XX, -C & XX,XX,XX,XX,XX,XX,XX,XX,GII) -C M0(23) = M0(23)*EXP(LN10*(GI0-GII)) -C ENDIF -C -C *** OTHER INITIALIZATIONS ********************************************* -C - ICLACT = 0 - CALAOU = .TRUE. - CALAIN = .TRUE. - FRST = .TRUE. - SCASE = '??' - SULRATW = 2.D0 - SO4RAT = 2.D0 - CRNARAT = 2.D0 - CRRAT = 2.D0 - NOFER = 0 - STKOFL =.FALSE. - DO 60 I=1,NERRMX - ERRSTK(I) =-999 - ERRMSG(I) = 'MESSAGE N/A' - 60 CONTINUE -C -C *** END OF SUBROUTINE INIT4 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ADJUST -C *** ADJUSTS FOR MASS BALANCE BETWEEN VOLATILE SPECIES AND SULFATE -C FIRST CALCULATE THE EXCESS OF EACH PRECURSOR, AND IF IT EXISTS, THEN -C ADJUST SEQUENTIALY AEROSOL PHASE SPECIES WHICH CONTAIN THE EXCESS -C PRECURSOR. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ADJUST (WI) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION WI(*) -C -C *** FOR AMMONIUM ***************************************************** -C - IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input) - EXNH4 = GNH3 + MOLAL(3) + CNH4CL + CNH4NO3 + CNH4HS4 - & + 2D0*CNH42S4 + 3D0*CLC - & -WI(3) - ELSE - EXNH4 = MOLAL(3) + CNH4CL + CNH4NO3 + CNH4HS4 + 2D0*CNH42S4 - & + 3D0*CLC - & -WI(3) - - ENDIF - EXNH4 = MAX(EXNH4,ZERO) - IF (EXNH4.LT.TINY) GOTO 20 ! No excess NH4, go to next precursor -C - IF (MOLAL(3).GT.EXNH4) THEN ! Adjust aqueous phase NH4 - MOLAL(3) = MOLAL(3) - EXNH4 - GOTO 20 - ELSE - EXNH4 = EXNH4 - MOLAL(3) - MOLAL(3) = ZERO - ENDIF -C - IF (CNH4CL.GT.EXNH4) THEN ! Adjust NH4Cl(s) - CNH4CL = CNH4CL - EXNH4 ! more solid than excess - GHCL = GHCL + EXNH4 ! evaporate Cl to gas phase - GOTO 20 - ELSE ! less solid than excess - GHCL = GHCL + CNH4CL ! evaporate into gas phase - EXNH4 = EXNH4 - CNH4CL ! reduce excess - CNH4CL = ZERO ! zero salt concentration - ENDIF -C - IF (CNH4NO3.GT.EXNH4) THEN ! Adjust NH4NO3(s) - CNH4NO3 = CNH4NO3- EXNH4 ! more solid than excess - GHNO3 = GHNO3 + EXNH4 ! evaporate NO3 to gas phase - GOTO 20 - ELSE ! less solid than excess - GHNO3 = GHNO3 + CNH4NO3! evaporate into gas phase - EXNH4 = EXNH4 - CNH4NO3! reduce excess - CNH4NO3 = ZERO ! zero salt concentration - ENDIF -C - IF (CLC.GT.3d0*EXNH4) THEN ! Adjust (NH4)3H(SO4)2(s) - CLC = CLC - EXNH4/3d0 ! more solid than excess - GOTO 20 - ELSE ! less solid than excess - EXNH4 = EXNH4 - 3d0*CLC ! reduce excess - CLC = ZERO ! zero salt concentration - ENDIF -C - IF (CNH4HS4.GT.EXNH4) THEN ! Adjust NH4HSO4(s) - CNH4HS4 = CNH4HS4- EXNH4 ! more solid than excess - GOTO 20 - ELSE ! less solid than excess - EXNH4 = EXNH4 - CNH4HS4! reduce excess - CNH4HS4 = ZERO ! zero salt concentration - ENDIF -C - IF (CNH42S4.GT.EXNH4) THEN ! Adjust (NH4)2SO4(s) - CNH42S4 = CNH42S4- EXNH4 ! more solid than excess - GOTO 20 - ELSE ! less solid than excess - EXNH4 = EXNH4 - CNH42S4! reduce excess - CNH42S4 = ZERO ! zero salt concentration - ENDIF -C -C *** FOR NITRATE ****************************************************** -C - 20 IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input) - EXNO3 = GHNO3 + MOLAL(7) + CNH4NO3 - & -WI(4) - ELSE - EXNO3 = MOLAL(7) + CNH4NO3 - & -WI(4) - ENDIF - EXNO3 = MAX(EXNO3,ZERO) - IF (EXNO3.LT.TINY) GOTO 30 ! No excess NO3, go to next precursor -C - IF (MOLAL(7).GT.EXNO3) THEN ! Adjust aqueous phase NO3 - MOLAL(7) = MOLAL(7) - EXNO3 - GOTO 30 - ELSE - EXNO3 = EXNO3 - MOLAL(7) - MOLAL(7) = ZERO - ENDIF -C - IF (CNH4NO3.GT.EXNO3) THEN ! Adjust NH4NO3(s) - CNH4NO3 = CNH4NO3- EXNO3 ! more solid than excess - GNH3 = GNH3 + EXNO3 ! evaporate NO3 to gas phase - GOTO 30 - ELSE ! less solid than excess - GNH3 = GNH3 + CNH4NO3! evaporate into gas phase - EXNO3 = EXNO3 - CNH4NO3! reduce excess - CNH4NO3 = ZERO ! zero salt concentration - ENDIF -C -C *** FOR CHLORIDE ***************************************************** -C - 30 IF (IPROB.EQ.0) THEN ! Calculate excess (solution - input) - EXCl = GHCL + MOLAL(4) + CNH4CL - & -WI(5) - ELSE - EXCl = MOLAL(4) + CNH4CL - & -WI(5) - ENDIF - EXCl = MAX(EXCl,ZERO) - IF (EXCl.LT.TINY) GOTO 40 ! No excess Cl, go to next precursor -C - IF (MOLAL(4).GT.EXCL) THEN ! Adjust aqueous phase Cl - MOLAL(4) = MOLAL(4) - EXCL - GOTO 40 - ELSE - EXCL = EXCL - MOLAL(4) - MOLAL(4) = ZERO - ENDIF -C - IF (CNH4CL.GT.EXCL) THEN ! Adjust NH4Cl(s) - CNH4CL = CNH4CL - EXCL ! more solid than excess - GHCL = GHCL + EXCL ! evaporate Cl to gas phase - GOTO 40 - ELSE ! less solid than excess - GHCL = GHCL + CNH4CL ! evaporate into gas phase - EXCL = EXCL - CNH4CL ! reduce excess - CNH4CL = ZERO ! zero salt concentration - ENDIF -C -C *** FOR SULFATE ****************************************************** -C - 40 EXS4 = MOLAL(5) + MOLAL(6) + 2.d0*CLC + CNH42S4 + CNH4HS4 + - & CNA2SO4 + CNAHSO4 - WI(2) - EXS4 = MAX(EXS4,ZERO) ! Calculate excess (solution - input) - IF (EXS4.LT.TINY) GOTO 50 ! No excess SO4, return -C - IF (MOLAL(6).GT.EXS4) THEN ! Adjust aqueous phase HSO4 - MOLAL(6) = MOLAL(6) - EXS4 - GOTO 50 - ELSE - EXS4 = EXS4 - MOLAL(6) - MOLAL(6) = ZERO - ENDIF -C - IF (MOLAL(5).GT.EXS4) THEN ! Adjust aqueous phase SO4 - MOLAL(5) = MOLAL(5) - EXS4 - GOTO 50 - ELSE - EXS4 = EXS4 - MOLAL(5) - MOLAL(5) = ZERO - ENDIF -C - IF (CLC.GT.2d0*EXS4) THEN ! Adjust (NH4)3H(SO4)2(s) - CLC = CLC - EXS4/2d0 ! more solid than excess - GNH3 = GNH3 +1.5d0*EXS4! evaporate NH3 to gas phase - GOTO 50 - ELSE ! less solid than excess - GNH3 = GNH3 + 1.5d0*CLC! evaporate NH3 to gas phase - EXS4 = EXS4 - 2d0*CLC ! reduce excess - CLC = ZERO ! zero salt concentration - ENDIF -C - IF (CNH4HS4.GT.EXS4) THEN ! Adjust NH4HSO4(s) - CNH4HS4 = CNH4HS4 - EXS4 ! more solid than excess - GNH3 = GNH3 + EXS4 ! evaporate NH3 to gas phase - GOTO 50 - ELSE ! less solid than excess - GNH3 = GNH3 + CNH4HS4 ! evaporate NH3 to gas phase - EXS4 = EXS4 - CNH4HS4 ! reduce excess - CNH4HS4 = ZERO ! zero salt concentration - ENDIF -C - IF (CNH42S4.GT.EXS4) THEN ! Adjust (NH4)2SO4(s) - CNH42S4 = CNH42S4- EXS4 ! more solid than excess - GNH3 = GNH3 + 2.d0*EXS4! evaporate NH3 to gas phase - GOTO 50 - ELSE ! less solid than excess - GNH3 = GNH3+2.d0*CNH42S4 ! evaporate NH3 to gas phase - EXS4 = EXS4 - CNH42S4 ! reduce excess - CNH42S4 = ZERO ! zero salt concentration - ENDIF -C -C *** RETURN ********************************************************** -C - 50 RETURN - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION GETASR -C *** CALCULATES THE LIMITING NH4+/SO4 RATIO OF A SULFATE POOR SYSTEM -C (i.e. SULFATE RATIO = 2.0) FOR GIVEN SO4 LEVEL AND RH -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION GETASR (SO4I, RHI) - PARAMETER (NSO4S=14, NRHS=20, NASRD=NSO4S*NRHS) - COMMON /ASRC/ ASRAT(NASRD), ASSO4(NSO4S) - DOUBLE PRECISION SO4I, RHI -CCC -CCC *** SOLVE USING FULL COMPUTATIONS, NOT LOOK-UP TABLES ************** -CCC -CCC W(2) = WAER(2) -CCC W(3) = WAER(2)*2.0001D0 -CCC CALL CALCA2 -CCC SULRATW = MOLAL(3)/WAER(2) -CCC CALL INIT1 (WI, RHI, TEMPI) ! Re-initialize COMMON BLOCK -C -C *** CALCULATE INDICES ************************************************ -C - RAT = SO4I/1.E-9 - A1 = INT(ALOG10(RAT)) ! Magnitude of RAT - IA1 = INT(RAT/2.5/10.0**A1) -C - INDS = 4.0*A1 + MIN(IA1,4) - INDS = MIN(MAX(0, INDS), NSO4S-1) + 1 ! SO4 component of IPOS -C - INDR = INT(99.0-RHI*100.0) + 1 - INDR = MIN(MAX(1, INDR), NRHS) ! RH component of IPOS -C -C *** GET VALUE AND RETURN ********************************************* -C - INDSL = INDS - INDSH = MIN(INDSL+1, NSO4S) - IPOSL = (INDSL-1)*NRHS + INDR ! Low position in array - IPOSH = (INDSH-1)*NRHS + INDR ! High position in array -C - WF = (SO4I-ASSO4(INDSL))/(ASSO4(INDSH)-ASSO4(INDSL) + 1e-7) - WF = MIN(MAX(WF, 0.0), 1.0) -C - GETASR = WF*ASRAT(IPOSH) + (1.0-WF)*ASRAT(IPOSL) -C -C *** END OF FUNCTION GETASR ******************************************* -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** BLOCK DATA AERSR -C *** CONTAINS DATA FOR AEROSOL SULFATE RATIO ARRAY NEEDED IN FUNCTION -C GETASR -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - BLOCK DATA AERSR - PARAMETER (NSO4S=14, NRHS=20, NASRD=NSO4S*NRHS) - COMMON /ASRC/ ASRAT(NASRD), ASSO4(NSO4S) -C - DATA ASSO4/1.0E-9, 2.5E-9, 5.0E-9, 7.5E-9, 1.0E-8, - & 2.5E-8, 5.0E-8, 7.5E-8, 1.0E-7, 2.5E-7, - & 5.0E-7, 7.5E-7, 1.0E-6, 5.0E-6/ -C - DATA (ASRAT(I), I=1,100)/ - & 1.020464, 0.9998130, 0.9960167, 0.9984423, 1.004004, - & 1.010885, 1.018356, 1.026726, 1.034268, 1.043846, - & 1.052933, 1.062230, 1.062213, 1.080050, 1.088350, - & 1.096603, 1.104289, 1.111745, 1.094662, 1.121594, - & 1.268909, 1.242444, 1.233815, 1.232088, 1.234020, - & 1.238068, 1.243455, 1.250636, 1.258734, 1.267543, - & 1.276948, 1.286642, 1.293337, 1.305592, 1.314726, - & 1.323463, 1.333258, 1.343604, 1.344793, 1.355571, - & 1.431463, 1.405204, 1.395791, 1.393190, 1.394403, - & 1.398107, 1.403811, 1.411744, 1.420560, 1.429990, - & 1.439742, 1.449507, 1.458986, 1.468403, 1.477394, - & 1.487373, 1.495385, 1.503854, 1.512281, 1.520394, - & 1.514464, 1.489699, 1.480686, 1.478187, 1.479446, - & 1.483310, 1.489316, 1.497517, 1.506501, 1.515816, - & 1.524724, 1.533950, 1.542758, 1.551730, 1.559587, - & 1.568343, 1.575610, 1.583140, 1.590440, 1.596481, - & 1.567743, 1.544426, 1.535928, 1.533645, 1.535016, - & 1.539003, 1.545124, 1.553283, 1.561886, 1.570530, - & 1.579234, 1.587813, 1.595956, 1.603901, 1.611349, - & 1.618833, 1.625819, 1.632543, 1.639032, 1.645276/ - - DATA (ASRAT(I), I=101,200)/ - & 1.707390, 1.689553, 1.683198, 1.681810, 1.683490, - & 1.687477, 1.693148, 1.700084, 1.706917, 1.713507, - & 1.719952, 1.726190, 1.731985, 1.737544, 1.742673, - & 1.747756, 1.752431, 1.756890, 1.761141, 1.765190, - & 1.785657, 1.771851, 1.767063, 1.766229, 1.767901, - & 1.771455, 1.776223, 1.781769, 1.787065, 1.792081, - & 1.796922, 1.801561, 1.805832, 1.809896, 1.813622, - & 1.817292, 1.820651, 1.823841, 1.826871, 1.829745, - & 1.822215, 1.810497, 1.806496, 1.805898, 1.807480, - & 1.810684, 1.814860, 1.819613, 1.824093, 1.828306, - & 1.832352, 1.836209, 1.839748, 1.843105, 1.846175, - & 1.849192, 1.851948, 1.854574, 1.857038, 1.859387, - & 1.844588, 1.834208, 1.830701, 1.830233, 1.831727, - & 1.834665, 1.838429, 1.842658, 1.846615, 1.850321, - & 1.853869, 1.857243, 1.860332, 1.863257, 1.865928, - & 1.868550, 1.870942, 1.873208, 1.875355, 1.877389, - & 1.899556, 1.892637, 1.890367, 1.890165, 1.891317, - & 1.893436, 1.896036, 1.898872, 1.901485, 1.903908, - & 1.906212, 1.908391, 1.910375, 1.912248, 1.913952, - & 1.915621, 1.917140, 1.918576, 1.919934, 1.921220/ - - DATA (ASRAT(I), I=201,280)/ - & 1.928264, 1.923245, 1.921625, 1.921523, 1.922421, - & 1.924016, 1.925931, 1.927991, 1.929875, 1.931614, - & 1.933262, 1.934816, 1.936229, 1.937560, 1.938769, - & 1.939951, 1.941026, 1.942042, 1.943003, 1.943911, - & 1.941205, 1.937060, 1.935734, 1.935666, 1.936430, - & 1.937769, 1.939359, 1.941061, 1.942612, 1.944041, - & 1.945393, 1.946666, 1.947823, 1.948911, 1.949900, - & 1.950866, 1.951744, 1.952574, 1.953358, 1.954099, - & 1.948985, 1.945372, 1.944221, 1.944171, 1.944850, - & 1.946027, 1.947419, 1.948902, 1.950251, 1.951494, - & 1.952668, 1.953773, 1.954776, 1.955719, 1.956576, - & 1.957413, 1.958174, 1.958892, 1.959571, 1.960213, - & 1.977193, 1.975540, 1.975023, 1.975015, 1.975346, - & 1.975903, 1.976547, 1.977225, 1.977838, 1.978401, - & 1.978930, 1.979428, 1.979879, 1.980302, 1.980686, - & 1.981060, 1.981401, 1.981722, 1.982025, 1.982312/ -C -C *** END OF BLOCK DATA AERSR ****************************************** -C - END - -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCHA -C *** CALCULATES CHLORIDES SPECIATION -C -C HYDROCHLORIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, -C AND DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE -C HYDROCHLORIC ACID DISSOLVED IS CALCULATED FROM THE -C HCL(G) <-> (H+) + (CL-) -C EQUILIBRIUM, USING THE (H+) FROM THE SULFATES. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCHA - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KAPA -CC CHARACTER ERRINF*40 -C -C *** CALCULATE HCL DISSOLUTION ***************************************** -C - X = W(5) - DELT = 0.0d0 - IF (WATER.GT.TINY) THEN - KAPA = MOLAL(1) - ALFA = XK3*R*TEMP*(WATER/GAMA(11))**2.0 - DIAK = SQRT( (KAPA+ALFA)**2.0 + 4.0*ALFA*X) - DELT = 0.5*(-(KAPA+ALFA) + DIAK) -CC IF (DELT/KAPA.GT.0.1d0) THEN -CC WRITE (ERRINF,'(1PE10.3)') DELT/KAPA*100.0 -CC CALL PUSHERR (0033, ERRINF) -CC ENDIF - ENDIF -C -C *** CALCULATE HCL SPECIATION IN THE GAS PHASE ************************* -C - GHCL = MAX(X-DELT, 0.0d0) ! GAS HCL -C -C *** CALCULATE HCL SPECIATION IN THE LIQUID PHASE ********************** -C - MOLAL(4) = DELT ! CL- - MOLAL(1) = MOLAL(1) + DELT ! H+ -C - RETURN -C -C *** END OF SUBROUTINE CALCHA ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCHAP -C *** CALCULATES CHLORIDES SPECIATION -C -C HYDROCHLORIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, -C THAT DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. -C THE HYDROCHLORIC ACID DISSOLVED IS CALCULATED FROM THE -C HCL(G) -> HCL(AQ) AND HCL(AQ) -> (H+) + (CL-) -C EQUILIBRIA, USING (H+) FROM THE SULFATES. -C -C THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOVER -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCHAP - INCLUDE 'isrpia.inc' -C -C *** IS THERE A LIQUID PHASE? ****************************************** -C - IF (WATER.LE.TINY) RETURN -C -C *** CALCULATE HCL SPECIATION IN THE GAS PHASE ************************* -C - CALL CALCCLAQ (MOLAL(4), MOLAL(1), DELT) - ALFA = XK3*R*TEMP*(WATER/GAMA(11))**2.0 - GASAQ(3) = DELT - MOLAL(1) = MOLAL(1) - DELT - MOLAL(4) = MOLAL(4) - DELT - GHCL = MOLAL(1)*MOLAL(4)/ALFA -C - RETURN -C -C *** END OF SUBROUTINE CALCHAP ***************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNA -C *** CALCULATES NITRATES SPECIATION -C -C NITRIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, THAT -C DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE NITRIC -C ACID DISSOLVED IS CALCULATED FROM THE HNO3(G) -> (H+) + (NO3-) -C EQUILIBRIUM, USING THE (H+) FROM THE SULFATES. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNA - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KAPA -CC CHARACTER ERRINF*40 -C -C *** CALCULATE HNO3 DISSOLUTION **************************************** -C - X = W(4) - DELT = 0.0d0 - IF (WATER.GT.TINY) THEN - KAPA = MOLAL(1) - ALFA = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - DIAK = SQRT( (KAPA+ALFA)**2.0 + 4.0*ALFA*X) - DELT = 0.5*(-(KAPA+ALFA) + DIAK) -CC IF (DELT/KAPA.GT.0.1d0) THEN -CC WRITE (ERRINF,'(1PE10.3)') DELT/KAPA*100.0 -CC CALL PUSHERR (0019, ERRINF) ! WARNING ERROR: NO SOLUTION -CC ENDIF - ENDIF -C -C *** CALCULATE HNO3 SPECIATION IN THE GAS PHASE ************************ -C - GHNO3 = MAX(X-DELT, 0.0d0) ! GAS HNO3 -C -C *** CALCULATE HNO3 SPECIATION IN THE LIQUID PHASE ********************* -C - MOLAL(7) = DELT ! NO3- - MOLAL(1) = MOLAL(1) + DELT ! H+ -C - RETURN -C -C *** END OF SUBROUTINE CALCNA ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNAP -C *** CALCULATES NITRATES SPECIATION -C -C NITRIC ACID IN THE LIQUID PHASE IS ASSUMED A MINOR SPECIES, THAT -C DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. THE NITRIC -C ACID DISSOLVED IS CALCULATED FROM THE HNO3(G) -> HNO3(AQ) AND -C HNO3(AQ) -> (H+) + (CL-) EQUILIBRIA, USING (H+) FROM THE SULFATES. -C -C THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOVER -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNAP - INCLUDE 'isrpia.inc' -C -C *** IS THERE A LIQUID PHASE? ****************************************** -C - IF (WATER.LE.TINY) RETURN -C -C *** CALCULATE HNO3 SPECIATION IN THE GAS PHASE ************************ -C - CALL CALCNIAQ (MOLAL(7), MOLAL(1), DELT) - ALFA = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - GASAQ(3) = DELT - MOLAL(1) = MOLAL(1) - DELT - MOLAL(7) = MOLAL(7) - DELT - GHNO3 = MOLAL(1)*MOLAL(7)/ALFA - - write (*,*) ALFA, MOLAL(1), MOLAL(7), GHNO3, DELT -C - RETURN -C -C *** END OF SUBROUTINE CALCNAP ***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNH3 -C *** CALCULATES AMMONIA IN GAS PHASE -C -C AMMONIA IN THE GAS PHASE IS ASSUMED A MINOR SPECIES, THAT -C DOES NOT SIGNIFICANTLY PERTURB THE AEROSOL EQUILIBRIUM. -C AMMONIA GAS IS CALCULATED FROM THE NH3(g) + (H+)(l) <==> (NH4+)(l) -C EQUILIBRIUM, USING (H+), (NH4+) FROM THE AEROSOL SOLUTION. -C -C THIS IS THE VERSION USED BY THE DIRECT PROBLEM -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNH3 - INCLUDE 'isrpia.inc' -C -C *** IS THERE A LIQUID PHASE? ****************************************** -C - IF (WATER.LE.TINY) RETURN -C -C *** CALCULATE NH3 SUBLIMATION ***************************************** -C - A1 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - CHI1 = MOLAL(3) - CHI2 = MOLAL(1) -C - BB =(CHI2 + ONE/A1) ! a=1; b!=1; c!=1 - CC =-CHI1/A1 - DIAK = SQRT(BB*BB - 4.D0*CC) ! Always > 0 - PSI = 0.5*(-BB + DIAK) ! One positive root - PSI = MAX(TINY, MIN(PSI,CHI1))! Constrict in acceptible range -C -C *** CALCULATE NH3 SPECIATION IN THE GAS PHASE ************************* -C - GNH3 = PSI ! GAS HNO3 -C -C *** CALCULATE NH3 AFFECT IN THE LIQUID PHASE ************************** -C - MOLAL(3) = CHI1 - PSI ! NH4+ - MOLAL(1) = CHI2 + PSI ! H+ -C - RETURN -C -C *** END OF SUBROUTINE CALCNH3 ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNH3P -C *** CALCULATES AMMONIA IN GAS PHASE -C -C AMMONIA GAS IS CALCULATED FROM THE NH3(g) + (H+)(l) <==> (NH4+)(l) -C EQUILIBRIUM, USING (H+), (NH4+) FROM THE AEROSOL SOLUTION. -C -C THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOLVER -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNH3P - INCLUDE 'isrpia.inc' -C -C *** IS THERE A LIQUID PHASE? ****************************************** -C - IF (WATER.LE.TINY) RETURN -C -C *** CALCULATE NH3 GAS PHASE CONCENTRATION ***************************** -C - A1 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - GNH3 = MOLAL(3)/MOLAL(1)/A1 -C - RETURN -C -C *** END OF SUBROUTINE CALCNH3P **************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNHA -C -C THIS SUBROUTINE CALCULATES THE DISSOLUTION OF HCL, HNO3 AT -C THE PRESENCE OF (H,SO4). HCL, HNO3 ARE CONSIDERED MINOR SPECIES, -C THAT DO NOT SIGNIFICANTLY AFFECT THE EQUILIBRIUM POINT. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNHA - INCLUDE 'isrpia.inc' - DOUBLE PRECISION M1, M2, M3 - CHARACTER ERRINF*40 -C -C *** SPECIAL CASE; WATER=ZERO ****************************************** -C - IF (WATER.LE.TINY) THEN - GOTO 55 -C -C *** SPECIAL CASE; HCL=HNO3=ZERO *************************************** -C - ELSEIF (W(5).LE.TINY .AND. W(4).LE.TINY) THEN - GOTO 60 -C -C *** SPECIAL CASE; HCL=ZERO ******************************************** -C - ELSE IF (W(5).LE.TINY) THEN - CALL CALCNA ! CALL HNO3 DISSOLUTION ROUTINE - GOTO 60 -C -C *** SPECIAL CASE; HNO3=ZERO ******************************************* -C - ELSE IF (W(4).LE.TINY) THEN - CALL CALCHA ! CALL HCL DISSOLUTION ROUTINE - GOTO 60 - ENDIF -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 ! HNO3 - A4 = XK3*R*TEMP*(WATER/GAMA(11))**2.0 ! HCL -C -C *** CALCULATE CUBIC EQUATION COEFFICIENTS ***************************** -C - DELCL = ZERO - DELNO = ZERO -C - OMEGA = MOLAL(1) ! H+ - CHI3 = W(4) ! HNO3 - CHI4 = W(5) ! HCL -C - C1 = A3*CHI3 - C2 = A4*CHI4 - C3 = A3 - A4 -C - M1 = (C1 + C2 + (OMEGA+A4)*C3)/C3 - M2 = ((OMEGA+A4)*C2 - A4*C3*CHI4)/C3 - M3 =-A4*C2*CHI4/C3 -C -C *** CALCULATE ROOTS *************************************************** -C - CALL POLY3 (M1, M2, M3, DELCL, ISLV) ! HCL DISSOLUTION - IF (ISLV.NE.0) THEN - DELCL = TINY ! TINY AMOUNTS OF HCL ASSUMED WHEN NO ROOT - WRITE (ERRINF,'(1PE7.1)') TINY - CALL PUSHERR (0022, ERRINF) ! WARNING ERROR: NO SOLUTION - ENDIF - DELCL = MIN(DELCL, CHI4) -C - DELNO = C1*DELCL/(C2 + C3*DELCL) - DELNO = MIN(DELNO, CHI3) -C - IF (DELCL.LT.ZERO .OR. DELNO.LT.ZERO .OR. - & DELCL.GT.CHI4 .OR. DELNO.GT.CHI3 ) THEN - DELCL = TINY ! TINY AMOUNTS OF HCL ASSUMED WHEN NO ROOT - DELNO = TINY - WRITE (ERRINF,'(1PE7.1)') TINY - CALL PUSHERR (0022, ERRINF) ! WARNING ERROR: NO SOLUTION - ENDIF -CCC -CCC *** COMPARE DELTA TO TOTAL H+ ; ESTIMATE EFFECT TO HSO4 *************** -CCC -CC IF ((DELCL+DELNO)/MOLAL(1).GT.0.1d0) THEN -CC WRITE (ERRINF,'(1PE10.3)') (DELCL+DELNO)/MOLAL(1)*100.0 -CC CALL PUSHERR (0021, ERRINF) -CC ENDIF -C -C *** EFFECT ON LIQUID PHASE ******************************************** -C -50 MOLAL(1) = MOLAL(1) + (DELNO+DELCL) ! H+ CHANGE - MOLAL(4) = MOLAL(4) + DELCL ! CL- CHANGE - MOLAL(7) = MOLAL(7) + DELNO ! NO3- CHANGE -C -C *** EFFECT ON GAS PHASE *********************************************** -C -55 GHCL = MAX(W(5) - MOLAL(4), TINY) - GHNO3 = MAX(W(4) - MOLAL(7), TINY) -C -60 RETURN -C -C *** END OF SUBROUTINE CALCNHA ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNHP -C -C THIS SUBROUTINE CALCULATES THE GAS PHASE NITRIC AND HYDROCHLORIC -C ACID. CONCENTRATIONS ARE CALCULATED FROM THE DISSOLUTION -C EQUILIBRIA, USING (H+), (Cl-), (NO3-) IN THE AEROSOL PHASE. -C -C THIS IS THE VERSION USED BY THE INVERSE PROBLEM SOLVER -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNHP - INCLUDE 'isrpia.inc' -C -C *** IS THERE A LIQUID PHASE? ****************************************** -C - IF (WATER.LE.TINY) RETURN -C -C *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -C - A3 = XK3*R*TEMP*(WATER/GAMA(11))**2.0 - A4 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - MOLAL(1) = MOLAL(1) + WAER(4) + WAER(5) ! H+ increases because NO3, Cl are added. -C -C *** CALCULATE CONCENTRATIONS ****************************************** -C *** ASSUME THAT 'DELT' FROM HNO3 >> 'DELT' FROM HCL -C - CALL CALCNIAQ (WAER(4), MOLAL(1)+MOLAL(7)+MOLAL(4), DELT) - MOLAL(1) = MOLAL(1) - DELT - MOLAL(7) = WAER(4) - DELT ! NO3- = Waer(4) minus any turned into (HNO3aq) - GASAQ(3) = DELT -C - CALL CALCCLAQ (WAER(5), MOLAL(1)+MOLAL(7)+MOLAL(4), DELT) - MOLAL(1) = MOLAL(1) - DELT - MOLAL(4) = WAER(5) - DELT ! Cl- = Waer(4) minus any turned into (HNO3aq) - GASAQ(2) = DELT -C - GHNO3 = MOLAL(1)*MOLAL(7)/A4 - GHCL = MOLAL(1)*MOLAL(4)/A3 -C - RETURN -C -C *** END OF SUBROUTINE CALCNHP ***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCHCO3 -C *** CORRECTS FOR H+ WHEN CRUSTALS ARE IN EXCESS -C -C CARBONATES ARE IN EXCESS, HCO3- IS ASSUMED A MINOR SPECIES, -C THE H+ CONCENTRATION IS CALCULATED FROM THE -C CO2(aq) + H2O <-> (HCO3-) + (H+) -C HCO3- <-> (H+) + (CO3--) EQUILIBRIUM. -C THE CO3-- CONCENTRATION IS ASSUMED NEGLIGIBLE WITH RESPECT TO HCO3- -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C -C SUBROUTINE CALCHCO3 -C INCLUDE 'isrpia.inc' -C DOUBLE PRECISION KAPA -CCC CHARACTER ERRINF*40 -CC -CC *** SPECIAL CASE; WATER=ZERO ****************************************** -CC -C IF (WATER.LE.TINY) THEN -C GOTO 521 -C ENDIF -CC -CC *** CALCULATE CO2 DISSOLUTION ***************************************** -CC -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT = 0.0d0 -CC DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -C KAPA = MOLAL(1) -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS *********************************** -CC -C ALFA = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -CC ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -CC *** CALCULATE CUBIC EQUATION COEFFICIENTS ***************************** -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS HCO3- -CC -C BB =-(KAPA + X + ALFA) -C CC = KAPA*X -C DD = BB*BB - 4.D0*CC -CC -C IF (DD.GE.ZERO) THEN -C SQDD = SQRT(DD) -C DELT = 0.5*(-BB - SQDD) -C ELSE -C DELT = ZERO -C ENDIF -C -C ENDIF -CC -CC *** CALCULATE H+ ***************************************************** -CC -C MOLAL(1) = KAPA - DELT ! H+ -CC -C521 RETURN -CC -CC *** END OF SUBROUTINE CALCHCO3 *************************************** -CC -C END -CC -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCAMAQ -C *** THIS SUBROUTINE CALCULATES THE NH3(aq) GENERATED FROM (H,NH4+). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCAMAQ (NH4I, OHI, DELT) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NH4I -CC CHARACTER ERRINF*40 -C -C *** EQUILIBRIUM CONSTANTS -C - A22 = XK22/XKW/WATER*(GAMA(8)/GAMA(9))**2. ! GAMA(NH3) ASSUMED 1 - AKW = XKW *RH*WATER*WATER -C -C *** FIND ROOT -C - OM1 = NH4I - OM2 = OHI - BB =-(OM1+OM2+A22*AKW) - CC = OM1*OM2 - DD = SQRT(BB*BB-4.D0*CC) - - DEL1 = 0.5D0*(-BB - DD) - DEL2 = 0.5D0*(-BB + DD) -C -C *** GET APPROPRIATE ROOT. -C - IF (DEL1.LT.ZERO) THEN - IF (DEL2.GT.NH4I .OR. DEL2.GT.OHI) THEN - DELT = ZERO - ELSE - DELT = DEL2 - ENDIF - ELSE - DELT = DEL1 - ENDIF -CC -CC *** COMPARE DELTA TO TOTAL NH4+ ; ESTIMATE EFFECT ********************* -CC -CC IF (DELTA/HYD.GT.0.1d0) THEN -CC WRITE (ERRINF,'(1PE10.3)') DELTA/HYD*100.0 -CC CALL PUSHERR (0020, ERRINF) -CC ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCAMAQ **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCAMAQ2 -C -C THIS SUBROUTINE CALCULATES THE NH3(aq) GENERATED FROM (H,NH4+). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCAMAQ2 (GGNH3, NH4I, OHI, NH3AQ) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NH4I, NH3AQ -C -C *** EQUILIBRIUM CONSTANTS -C - A22 = XK22/XKW/WATER*(GAMA(8)/GAMA(9))**2. ! GAMA(NH3) ASSUMED 1 - AKW = XKW *RH*WATER*WATER -C -C *** FIND ROOT -C - ALF1 = NH4I - GGNH3 - ALF2 = GGNH3 - BB = ALF1 + A22*AKW - CC =-A22*AKW*ALF2 - DEL = 0.5D0*(-BB + SQRT(BB*BB-4.D0*CC)) -C -C *** ADJUST CONCENTRATIONS -C - NH4I = ALF1 + DEL - OHI = DEL - IF (OHI.LE.TINY) OHI = SQRT(AKW) ! If solution is neutral. - NH3AQ = ALF2 - DEL -C - RETURN -C -C *** END OF SUBROUTINE CALCAMAQ2 **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCCLAQ -C -C THIS SUBROUTINE CALCULATES THE HCL(aq) GENERATED FROM (H+,CL-). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCCLAQ (CLI, HI, DELT) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION CLI -C -C *** EQUILIBRIUM CONSTANTS -C - A32 = XK32*WATER/(GAMA(11))**2. ! GAMA(HCL) ASSUMED 1 -C -C *** FIND ROOT -C - OM1 = CLI - OM2 = HI - BB =-(OM1+OM2+A32) - CC = OM1*OM2 - DD = SQRT(BB*BB-4.D0*CC) - - DEL1 = 0.5D0*(-BB - DD) - DEL2 = 0.5D0*(-BB + DD) -C -C *** GET APPROPRIATE ROOT. -C - IF (DEL1.LT.ZERO) THEN - IF (DEL2.LT.ZERO .OR. DEL2.GT.CLI .OR. DEL2.GT.HI) THEN - DELT = ZERO - ELSE - DELT = DEL2 - ENDIF - ELSE - DELT = DEL1 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCCLAQ **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCCLAQ2 -C -C THIS SUBROUTINE CALCULATES THE HCL(aq) GENERATED FROM (H+,CL-). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCCLAQ2 (GGCL, CLI, HI, CLAQ) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION CLI -C -C *** EQUILIBRIUM CONSTANTS -C - A32 = XK32*WATER/(GAMA(11))**2. ! GAMA(HCL) ASSUMED 1 - AKW = XKW *RH*WATER*WATER -C -C *** FIND ROOT -C - ALF1 = CLI - GGCL - ALF2 = GGCL - COEF = (ALF1+A32) - DEL1 = 0.5*(-COEF + SQRT(COEF*COEF+4.D0*A32*ALF2)) -C -C *** CORRECT CONCENTRATIONS -C - CLI = ALF1 + DEL1 - HI = DEL1 - IF (HI.LE.TINY) HI = SQRT(AKW) ! If solution is neutral. - CLAQ = ALF2 - DEL1 -C - RETURN -C -C *** END OF SUBROUTINE CALCCLAQ2 **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNIAQ -C -C THIS SUBROUTINE CALCULATES THE HNO3(aq) GENERATED FROM (H,NO3-). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNIAQ (NO3I, HI, DELT) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NO3I, HI, DELT -C -C *** EQUILIBRIUM CONSTANTS -C - A42 = XK42*WATER/(GAMA(10))**2. ! GAMA(HNO3) ASSUMED 1 -C -C *** FIND ROOT -C - OM1 = NO3I - OM2 = HI - BB =-(OM1+OM2+A42) - CC = OM1*OM2 - DD = SQRT(BB*BB-4.D0*CC) - - DEL1 = 0.5D0*(-BB - DD) - DEL2 = 0.5D0*(-BB + DD) -C -C *** GET APPROPRIATE ROOT. -C - IF (DEL1.LT.ZERO .OR. DEL1.GT.HI .OR. DEL1.GT.NO3I) THEN - print *, DELT - DELT = ZERO - ELSE - DELT = DEL1 - RETURN - ENDIF -C - IF (DEL2.LT.ZERO .OR. DEL2.GT.NO3I .OR. DEL2.GT.HI) THEN - DELT = ZERO - ELSE - DELT = DEL2 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCNIAQ **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCNIAQ2 -C -C THIS SUBROUTINE CALCULATES THE UNDISSOCIATED HNO3(aq) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NO3I, NO3AQ -C -C *** EQUILIBRIUM CONSTANTS -C - A42 = XK42*WATER/(GAMA(10))**2. ! GAMA(HNO3) ASSUMED 1 - AKW = XKW *RH*WATER*WATER -C -C *** FIND ROOT -C - ALF1 = NO3I - GGNO3 - ALF2 = GGNO3 - ALF3 = HI -C - BB = ALF3 + ALF1 + A42 - CC = ALF3*ALF1 - A42*ALF2 - DEL1 = 0.5*(-BB + SQRT(BB*BB-4.D0*CC)) -C -C *** CORRECT CONCENTRATIONS -C - NO3I = ALF1 + DEL1 - HI = ALF3 + DEL1 - IF (HI.LE.TINY) HI = SQRT(AKW) ! If solution is neutral. - NO3AQ = ALF2 - DEL1 -C - RETURN -C -C *** END OF SUBROUTINE CALCNIAQ2 **************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCMR -C *** THIS SUBROUTINE CALCULATES: -C 1. ION PAIR CONCENTRATIONS (FROM [MOLAR] ARRAY) -C 2. WATER CONTENT OF LIQUID AEROSOL PHASE (FROM ZSR CORRELATION) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCMR - INCLUDE 'isrpia.inc' - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C - CHARACTER SC*1 -C -C *** CALCULATE ION PAIR CONCENTRATIONS ACCORDING TO SPECIFIC CASE **** -C - SC =SCASE(1:1) ! SULRAT & SODRAT case -C -C *** NH4-SO4 SYSTEM ; SULFATE POOR CASE -C - IF (SC.EQ.'A') THEN - MOLALR(4) = MOLAL(5)+MOLAL(6) ! (NH4)2SO4 - CORRECT FOR SO4 TO HSO4 -C -C *** NH4-SO4 SYSTEM ; SULFATE RICH CASE ; NO FREE ACID -C - ELSE IF (SC.EQ.'B') THEN - SO4I = MOLAL(5)-MOLAL(1) ! CORRECT FOR HSO4 DISSOCIATION - HSO4I = MOLAL(6)+MOLAL(1) - IF (SO4I.LT.HSO4I) THEN - MOLALR(13) = SO4I ! [LC] = [SO4] - MOLALR(9) = MAX(HSO4I-SO4I, ZERO) ! NH4HSO4 - ELSE - MOLALR(13) = HSO4I ! [LC] = [HSO4] - MOLALR(4) = MAX(SO4I-HSO4I, ZERO) ! (NH4)2SO4 - ENDIF -C -C *** NH4-SO4 SYSTEM ; SULFATE RICH CASE ; FREE ACID -C - ELSE IF (SC.EQ.'C') THEN - MOLALR(4) = MOLAL(3) ! NH4HSO4 - MOLALR(7) = MAX(W(2)-W(3), ZERO) ! H2SO4 -C -C *** NH4-SO4-NO3 SYSTEM ; SULFATE POOR CASE -C - ELSE IF (SC.EQ.'D') THEN - MOLALR(4) = MOLAL(5) + MOLAL(6) ! (NH4)2SO4 - AML5 = MOLAL(3)-2.D0*MOLALR(4) ! "free" NH4 - MOLALR(5) = MAX(MIN(AML5,MOLAL(7)), ZERO)! NH4NO3 = MIN("free", NO3) -C -C *** NH4-SO4-NO3 SYSTEM ; SULFATE RICH CASE ; NO FREE ACID -C - ELSE IF (SC.EQ.'E') THEN - SO4I = MAX(MOLAL(5)-MOLAL(1),ZERO) ! FROM HSO4 DISSOCIATION - HSO4I = MOLAL(6)+MOLAL(1) - IF (SO4I.LT.HSO4I) THEN - MOLALR(13) = SO4I ! [LC] = [SO4] - MOLALR(9) = MAX(HSO4I-SO4I, ZERO) ! NH4HSO4 - ELSE - MOLALR(13) = HSO4I ! [LC] = [HSO4] - MOLALR(4) = MAX(SO4I-HSO4I, ZERO) ! (NH4)2SO4 - ENDIF -C -C *** NH4-SO4-NO3 SYSTEM ; SULFATE RICH CASE ; FREE ACID -C - ELSE IF (SC.EQ.'F') THEN - MOLALR(4) = MOLAL(3) ! NH4HSO4 - MOLALR(7) = MAX(MOLAL(5)+MOLAL(6)-MOLAL(3),ZERO) ! H2SO4 -C -C *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE POOR ; SODIUM POOR CASE -C - ELSE IF (SC.EQ.'G') THEN - MOLALR(2) = 0.5D0*MOLAL(2) ! NA2SO4 - TOTS4 = MOLAL(5)+MOLAL(6) ! Total SO4 - MOLALR(4) = MAX(TOTS4 - MOLALR(2), ZERO) ! (NH4)2SO4 - FRNH4 = MAX(MOLAL(3) - 2.D0*MOLALR(4), ZERO) - MOLALR(5) = MIN(MOLAL(7),FRNH4) ! NH4NO3 - FRNH4 = MAX(FRNH4 - MOLALR(5), ZERO) - MOLALR(6) = MIN(MOLAL(4), FRNH4) ! NH4CL -C -C *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE POOR ; SODIUM RICH CASE -C *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/ -C - ELSE IF (SC.EQ.'H') THEN - MOLALR(1) = PSI7 ! NACL - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(3) = PSI8 ! NANO3 - MOLALR(4) = ZERO ! (NH4)2SO4 - FRNO3 = MAX(MOLAL(7) - MOLALR(3), ZERO) ! "FREE" NO3 - FRCL = MAX(MOLAL(4) - MOLALR(1), ZERO) ! "FREE" CL - MOLALR(5) = MIN(MOLAL(3),FRNO3) ! NH4NO3 - FRNH4 = MAX(MOLAL(3) - MOLALR(5), ZERO) ! "FREE" NH3 - MOLALR(6) = MIN(FRCL, FRNH4) ! NH4CL -C -C *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE RICH CASE ; NO FREE ACID -C *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/ -C - ELSE IF (SC.EQ.'I') THEN - MOLALR(04) = PSI5 ! (NH4)2SO4 - MOLALR(02) = PSI4 ! NA2SO4 - MOLALR(09) = PSI1 ! NH4HSO4 - MOLALR(12) = PSI3 ! NAHSO4 - MOLALR(13) = PSI2 ! LC -C -C *** NA-NH4-SO4-NO3-CL SYSTEM ; SULFATE RICH CASE ; FREE ACID -C - ELSE IF (SC.EQ.'J') THEN - MOLALR(09) = MOLAL(3) ! NH4HSO4 - MOLALR(12) = MOLAL(2) ! NAHSO4 - MOLALR(07) = MOLAL(5)+MOLAL(6)-MOLAL(3)-MOLAL(2) ! H2SO4 - MOLALR(07) = MAX(MOLALR(07),ZERO) -C -C *** NA-NH4-SO4-NO3-CL-CA-K-MG SYSTEM ; SULFATE POOR ; CR+NA POOR CASE -C - ELSE IF (SC.EQ.'O') THEN - MOLALR(2) = 0.5D0*MOLAL(2) ! NA2SO4 - TOTS4 = MOLAL(5)+MOLAL(6) ! Total SO4 - MOLALR(17)= 0.5*MOLAL(9) ! K2SO4 - MOLALR(21)= MOLAL(10) ! MGSO4 - MOLALR(4) = MAX(TOTS4 - MOLALR(2) - MOLALR(17) - & - MOLALR(21), ZERO) ! (NH4)2SO4 - FRNH4 = MAX(MOLAL(3) - 2.D0*MOLALR(4), ZERO) - MOLALR(5) = MIN(MOLAL(7),FRNH4) ! NH4NO3 - FRNH4 = MAX(FRNH4 - MOLALR(5), ZERO) - MOLALR(6) = MIN(MOLAL(4), FRNH4) ! NH4CL -C -C *** NA-NH4-SO4-NO3-CL-CA-K-MG SYSTEM ; SULFATE POOR ; CR+NA RICH; CR POOR CASE -C *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/ -C - ELSE IF (SC.EQ.'M') THEN - MOLALR(1) = PSI7 ! NACL - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(3) = PSI8 ! NANO3 - MOLALR(4) = ZERO ! (NH4)2SO4 - FRNO3 = MAX(MOLAL(7) - MOLALR(3), ZERO) ! "FREE" NO3 - FRCL = MAX(MOLAL(4) - MOLALR(1), ZERO) ! "FREE" CL - MOLALR(5) = MIN(MOLAL(3),FRNO3) ! NH4NO3 - FRNH4 = MAX(MOLAL(3) - MOLALR(5), ZERO) ! "FREE" NH3 - MOLALR(6) = MIN(FRCL, FRNH4) ! NH4CL - MOLALR(17)= PSI9 ! K2SO4 - MOLALR(21)= PSI10 ! MGSO4 -C -C *** NA-NH4-SO4-NO3-CL-CA-K-MG SYSTEM ; SULFATE POOR ; CR+NA RICH; CR RICH CASE -C *** RETREIVE DISSOLVED SALTS DIRECTLY FROM COMMON BLOCK /SOLUT/ -C - ELSE IF (SC.EQ.'P') THEN - MOLALR(1) = PSI7 ! NACL - MOLALR(3) = PSI8 ! NANO3 - MOLALR(15)= PSI12 ! CANO32 - MOLALR(16)= PSI17 ! CACL2 - MOLALR(19)= PSI13 ! KNO3 - MOLALR(20)= PSI14 ! KCL - MOLALR(22)= PSI15 ! MGNO32 - MOLALR(23)= PSI16 ! MGCL2 - FRNO3 = MAX(MOLAL(7)-MOLALR(3)-2.D0*MOLALR(15) - & -MOLALR(19)-2.D0*MOLALR(22), ZERO) ! "FREE" NO3 - FRCL = MAX(MOLAL(4)-MOLALR(1)-2.D0*MOLALR(16) - & -MOLALR(20)-2.D0*MOLALR(23), ZERO) ! "FREE" CL - MOLALR(5) = MIN(MOLAL(3),FRNO3) ! NH4NO3 - FRNH4 = MAX(MOLAL(3) - MOLALR(5), ZERO) ! "FREE" NH3 - MOLALR(6) = MIN(FRCL, FRNH4) ! NH4CL - MOLALR(17)= PSI9 ! K2SO4 - MOLALR(21)= PSI10 ! MGSO4 -C -C *** NA-NH4-SO4-NO3-CL-CA-K-MG SYSTEM ; SULFATE RICH CASE ; NO FREE ACID -C - ELSE IF (SC.EQ.'L') THEN - MOLALR(04) = PSI5 ! (NH4)2SO4 - MOLALR(02) = PSI4 ! NA2SO4 - MOLALR(09) = PSI1 ! NH4HSO4 - MOLALR(12) = PSI3 ! NAHSO4 - MOLALR(13) = PSI2 ! LC - MOLALR(17) = PSI6 ! K2SO4 - MOLALR(21) = PSI7 ! MGSO4 - MOLALR(18) = PSI8 ! KHSO4 -C -C *** NA-NH4-SO4-NO3-CL-CA-K-MG SYSTEM ; SULFATE SUPER RICH CASE ; FREE ACID -C - ELSE IF (SC.EQ.'K') THEN - MOLALR(09) = MOLAL(3) ! NH4HSO4 - MOLALR(12) = MOLAL(2) ! NAHSO4 - MOLALR(14) = MOLAL(8) ! CASO4 - MOLALR(18) = MOLAL(9) ! KHSO4 - MOLALR(21) = MOLAL(10) ! MGSO4 - MOLALR(07) = MOLAL(5)+MOLAL(6)-MOLAL(3) - & -MOLAL(2)-MOLAL(8)-MOLAL(9)-MOLAL(10) ! H2SO4 - MOLALR(07) = MAX(MOLALR(07),ZERO) -C -C ======= REVERSE PROBLEMS =========================================== -C -C *** NH4-SO4-NO3 SYSTEM ; SULFATE POOR CASE -C - ELSE IF (SC.EQ.'N') THEN - MOLALR(4) = MOLAL(5) + MOLAL(6) ! (NH4)2SO4 - AML5 = WAER(3)-2.D0*MOLALR(4) ! "free" NH4 - MOLALR(5) = MAX(MIN(AML5,WAER(4)), ZERO) ! NH4NO3 = MIN("free", NO3) -C -C *** NH4-SO4-NO3-NA-CL SYSTEM ; SULFATE POOR, SODIUM POOR CASE -C - ELSE IF (SC.EQ.'Q') THEN - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(4) = PSI6 ! (NH4)2SO4 - MOLALR(5) = PSI5 ! NH4NO3 - MOLALR(6) = PSI4 ! NH4CL -C -C *** NH4-SO4-NO3-NA-CL SYSTEM ; SULFATE POOR, SODIUM RICH CASE -C - ELSE IF (SC.EQ.'R') THEN - MOLALR(1) = PSI3 ! NACL - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(3) = PSI2 ! NANO3 - MOLALR(4) = ZERO ! (NH4)2SO4 - MOLALR(5) = PSI5 ! NH4NO3 - MOLALR(6) = PSI4 ! NH4CL -C -C *** NH4-SO4-NO3-NA-CL-CA-K-MG SYSTEM ; SULFATE POOR, CRUSTAL&SODIUM POOR CASE -C - ELSE IF (SC.EQ.'V') THEN - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(4) = PSI6 ! (NH4)2SO4 - MOLALR(5) = PSI5 ! NH4NO3 - MOLALR(6) = PSI4 ! NH4CL - MOLALR(17)= PSI7 ! K2SO4 - MOLALR(21)= PSI8 ! MGSO4 -C -C *** NH4-SO4-NO3-NA-CL-CA-K-MG SYSTEM ; SULFATE POOR, CRUSTAL&SODIUM RICH, CRUSTAL POOR CASE -C - ELSE IF (SC.EQ.'U') THEN - MOLALR(1) = PSI3 ! NACL - MOLALR(2) = PSI1 ! NA2SO4 - MOLALR(3) = PSI2 ! NANO3 - MOLALR(5) = PSI5 ! NH4NO3 - MOLALR(6) = PSI4 ! NH4CL - MOLALR(17)= PSI7 ! K2SO4 - MOLALR(21)= PSI8 ! MGSO4 -C -C *** NH4-SO4-NO3-NA-CL-CA-K-MG SYSTEM ; SULFATE POOR, CRUSTAL&SODIUM RICH, CRUSTAL RICH CASE -C - ELSE IF (SC.EQ.'W') THEN - MOLALR(1) = PSI7 ! NACL - MOLALR(3) = PSI8 ! NANO3 - MOLALR(5) = PSI6 ! NH4NO3 - MOLALR(6) = PSI5 ! NH4CL - MOLALR(15)= PSI12 ! CANO32 - MOLALR(16)= PSI17 ! CACL2 - MOLALR(17)= PSI9 ! K2SO4 - MOLALR(19)= PSI13 ! KNO3 - MOLALR(20)= PSI14 ! KCL - MOLALR(21)= PSI10 ! MGSO4 - MOLALR(22)= PSI15 ! MGNO32 - MOLALR(23)= PSI16 ! MGCL2 -C -C *** UNKNOWN CASE -C -C ELSE -C CALL PUSHERR (1001, ' ') ! FATAL ERROR: CASE NOT SUPPORTED - ENDIF -C -C *** CALCULATE WATER CONTENT ; ZSR CORRELATION *********************** -C - WATER = ZERO - DO 10 I=1,NPAIR - WATER = WATER + MOLALR(I)/M0(I) -10 CONTINUE - WATER = MAX(WATER, TINY) -C - RETURN -C -C *** END OF SUBROUTINE CALCMR ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCMDRH -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE -C 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCMDRH (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE) - INCLUDE 'isrpia.inc' - EXTERNAL DRYCASE, LIQCASE -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ONE - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (RHLIQ-RHI)/(RHLIQ-RHDRY) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CALL DRYCASE - IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL -C - CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION - CNH4HSO = CNH4HS4 - CLCO = CLC - CNH4N3O = CNH4NO3 - CNH4CLO = CNH4CL - CNA2SO = CNA2SO4 - CNAHSO = CNAHSO4 - CNANO = CNANO3 - CNACLO = CNACL - GNH3O = GNH3 - GHNO3O = GHNO3 - GHCLO = GHCL -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CNH42S4 = ZERO - CNH4HS4 = ZERO - CLC = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CNAHSO4 = ZERO - CNANO3 = ZERO - CNACL = ZERO - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO - CALL LIQCASE ! SECOND (LIQUID) SOLUTION -C -C *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL -C - IF (WATER.LE.TINY) THEN - DO 100 I=1,NIONS - MOLAL(I)= ZERO ! Aqueous phase - 100 CONTINUE - WATER = ZERO -C - CNH42S4 = CNH42SO ! Solid phase - CNA2SO4 = CNA2SO - CNAHSO4 = CNAHSO - CNH4HS4 = CNH4HSO - CLC = CLCO - CNH4NO3 = CNH4N3O - CNANO3 = CNANO - CNACL = CNACLO - CNH4CL = CNH4CLO -C - GNH3 = GNH3O ! Gas phase - GHNO3 = GHNO3O - GHCL = GHCLO -C - GOTO 200 - ENDIF -C -C *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMSUL = CNH42SO - CNH42S4 - DSOSUL = CNA2SO - CNA2SO4 - DAMBIS = CNH4HSO - CNH4HS4 - DSOBIS = CNAHSO - CNAHSO4 - DLC = CLCO - CLC - DAMNIT = CNH4N3O - CNH4NO3 - DAMCHL = CNH4CLO - CNH4CL - DSONIT = CNANO - CNANO3 - DSOCHL = CNACLO - CNACL -C -C *** FIND GAS DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMG = GNH3O - GNH3 - DHAG = GHCLO - GHCL - DNAG = GHNO3O - GHNO3 -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C -C LIQUID -C - MOLAL(1)= ONEMWF*MOLAL(1) ! H+ - MOLAL(2)= ONEMWF*(2.D0*DSOSUL + DSOBIS + DSONIT + DSOCHL) ! NA+ - MOLAL(3)= ONEMWF*(2.D0*DAMSUL + DAMG + DAMBIS + DAMCHL + - & 3.D0*DLC + DAMNIT ) ! NH4+ - MOLAL(4)= ONEMWF*( DAMCHL + DSOCHL + DHAG) ! CL- - MOLAL(5)= ONEMWF*( DAMSUL + DSOSUL + DLC - MOLAL(6)) ! SO4-- !VB 17 Sept 2001 - MOLAL(6)= ONEMWF*( MOLAL(6) + DSOBIS + DAMBIS + DLC) ! HSO4- - MOLAL(7)= ONEMWF*( DAMNIT + DSONIT + DNAG) ! NO3- - WATER = ONEMWF*WATER -C -C SOLID -C - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 - CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4 - CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4 - CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4 - CLC = WF*CLCO + ONEMWF*CLC - CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3 - CNANO3 = WF*CNANO + ONEMWF*CNANO3 - CNACL = WF*CNACLO + ONEMWF*CNACL - CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL -C -C GAS -C - GNH3 = WF*GNH3O + ONEMWF*GNH3 - GHNO3 = WF*GHNO3O + ONEMWF*GHNO3 - GHCL = WF*GHCLO + ONEMWF*GHCL -C -C *** RETURN POINT -C -200 RETURN -C -C *** END OF SUBROUTINE CALCMDRH **************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCMDRH2 -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE -C 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCMDRH2 (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE) - INCLUDE 'isrpia.inc' - EXTERNAL DRYCASE, LIQCASE -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ONE - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (RHLIQ-RHI)/(RHLIQ-RHDRY) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CALL DRYCASE - IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL -C - CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION - CNH4HSO = CNH4HS4 - CLCO = CLC - CNH4N3O = CNH4NO3 - CNH4CLO = CNH4CL - CNA2SO = CNA2SO4 - CNAHSO = CNAHSO4 - CNANO = CNANO3 - CNACLO = CNACL - GNH3O = GNH3 - GHNO3O = GHNO3 - GHCLO = GHCL -C - CCASO = CCASO4 - CK2SO = CK2SO4 - CMGSO = CMGSO4 - CKHSO = CKHSO4 - CCAN32O = CCANO32 - CCAC2L = CCACL2 - CKN3O = CKNO3 - CKCLO = CKCL - CMGN32O = CMGNO32 - CMGC2L = CMGCL2 -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CNH42S4 = ZERO - CNH4HS4 = ZERO - CLC = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CNAHSO4 = ZERO - CNANO3 = ZERO - CNACL = ZERO - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - CCASO4 = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CKHSO4 = ZERO - CCANO32 = ZERO - CCACL2 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO -C - CALL LIQCASE ! SECOND (LIQUID) SOLUTION -C -C *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL -C - IF (WATER.LE.TINY) THEN - DO 100 I=1,NIONS - MOLAL(I)= ZERO ! Aqueous phase - 100 CONTINUE - WATER = ZERO -C - CNH42S4 = CNH42SO ! Solid phase - CNA2SO4 = CNA2SO - CNAHSO4 = CNAHSO - CNH4HS4 = CNH4HSO - CLC = CLCO - CNH4NO3 = CNH4N3O - CNANO3 = CNANO - CNACL = CNACLO - CNH4CL = CNH4CLO -C - GNH3 = GNH3O ! Gas phase - GHNO3 = GHNO3O - GHCL = GHCLO -C - CCASO4 = CCASO - CK2SO4 = CK2SO - CMGSO4 = CMGSO - CKHSO4 = CKHSO - CCANO32 = CCAN32O - CCACL2 = CCAC2L - CKNO3 = CKN3O - CKCL = CKCLO - CMGNO32 = CMGN32O - CMGCL2 = CMGC2L -C - GOTO 200 - ENDIF -C -C *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMSUL = CNH42SO - CNH42S4 - DSOSUL = CNA2SO - CNA2SO4 - DAMBIS = CNH4HSO - CNH4HS4 - DSOBIS = CNAHSO - CNAHSO4 - DLC = CLCO - CLC - DAMNIT = CNH4N3O - CNH4NO3 - DAMCHL = CNH4CLO - CNH4CL - DSONIT = CNANO - CNANO3 - DSOCHL = CNACLO - CNACL -C - DCASUL = CCASO - CCASO4 - DPOSUL = CK2SO - CK2SO4 - DMGSUL = CMGSO - CMGSO4 - DPOBIS = CKHSO - CKHSO4 - DCANIT = CCAN32O - CCANO32 - DCACHL = CCAC2L - CCACL2 - DPONIT = CKN3O - CKNO3 - DPOCHL = CKCLO - CKCL - DMGNIT = CMGN32O - CMGNO32 - DMGCHL = CMGC2L - CMGCL2 -C -C *** FIND GAS DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMG = GNH3O - GNH3 - DHAG = GHCLO - GHCL - DNAG = GHNO3O - GHNO3 -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C -C LIQUID -C - MOLAL(1) = ONEMWF*MOLAL(1) ! H+ - MOLAL(2) = ONEMWF*(2.D0*DSOSUL + DSOBIS + DSONIT + DSOCHL) ! NA+ - MOLAL(3) = ONEMWF*(2.D0*DAMSUL + DAMG + DAMBIS + DAMCHL + - & 3.D0*DLC + DAMNIT ) ! NH4+ - MOLAL(4) = ONEMWF*(DAMCHL + DSOCHL + DHAG + 2.D0*DCACHL + - & 2.D0*DMGCHL + DPOCHL) ! CL- - MOLAL(5) = ONEMWF*(DAMSUL + DSOSUL + DLC - MOLAL(6) - & +DCASUL + DPOSUL + DMGSUL) ! SO4-- !VB 17 Sept 2001 - MOLAL(6) = ONEMWF*(MOLAL(6) + DSOBIS + DAMBIS + DLC + DPOBIS) ! HSO4- - MOLAL(7) = ONEMWF*(DAMNIT + DSONIT + DNAG + 2.D0*DCANIT - & + 2.D0*DMGNIT + DPONIT) ! NO3- - MOLAL(8) = ONEMWF*(DCASUL + DCANIT + DCACHL) ! CA2+ - MOLAL(9) = ONEMWF*(2.D0*DPOSUL + DPONIT + DPOCHL + DPOBIS) ! K+ - MOLAL(10)= ONEMWF*(DMGSUL + DMGNIT + DMGCHL) ! MG2+ - WATER = ONEMWF*WATER -C -C SOLID -C - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 - CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4 - CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4 - CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4 - CLC = WF*CLCO + ONEMWF*CLC - CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3 - CNANO3 = WF*CNANO + ONEMWF*CNANO3 - CNACL = WF*CNACLO + ONEMWF*CNACL - CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL -C - CCASO4 = WF*CCASO + ONEMWF*CCASO4 - CK2SO4 = WF*CK2SO + ONEMWF*CK2SO4 - CMGSO4 = WF*CMGSO + ONEMWF*CMGSO4 - CKHSO4 = WF*CKHSO + ONEMWF*CKHSO4 - CCANO32 = WF*CCAN32O + ONEMWF*CCANO32 - CCACL2 = WF*CCAC2L + ONEMWF*CCACL2 - CMGNO32 = WF*CMGN32O + ONEMWF*CMGNO32 - CMGCL2 = WF*CMGC2L + ONEMWF*CMGCL2 - CKCL = WF*CKCLO + ONEMWF*CKCL -C -C GAS -C - GNH3 = WF*GNH3O + ONEMWF*GNH3 - GHNO3 = WF*GHNO3O + ONEMWF*GHNO3 - GHCL = WF*GHCLO + ONEMWF*GHCL -C -C *** RETURN POINT -C -200 RETURN -C -C *** END OF SUBROUTINE CALCMDRH2 **************************************** -C - END -C - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCMDRP -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE -C 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE). (REVERSE PROBLEM) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCMDRP (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE) - INCLUDE 'isrpia.inc' - EXTERNAL DRYCASE, LIQCASE -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ONE - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (RHLIQ-RHI)/(RHLIQ-RHDRY) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CALL DRYCASE - IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL -C - CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION - CNH4HSO = CNH4HS4 - CLCO = CLC - CNH4N3O = CNH4NO3 - CNH4CLO = CNH4CL - CNA2SO = CNA2SO4 - CNAHSO = CNAHSO4 - CNANO = CNANO3 - CNACLO = CNACL -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CNH42S4 = ZERO - CNH4HS4 = ZERO - CLC = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CNAHSO4 = ZERO - CNANO3 = ZERO - CNACL = ZERO - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO - CALL LIQCASE ! SECOND (LIQUID) SOLUTION -C -C *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL -C - IF (WATER.LE.TINY) THEN - WATER = ZERO - DO 100 I=1,NIONS - MOLAL(I)= ZERO - 100 CONTINUE - CALL DRYCASE - GOTO 200 - ENDIF -C -C *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMBIS = CNH4HSO - CNH4HS4 - DSOBIS = CNAHSO - CNAHSO4 - DLC = CLCO - CLC -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C -C *** SOLID -C - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 - CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4 - CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4 - CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4 - CLC = WF*CLCO + ONEMWF*CLC - CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3 - CNANO3 = WF*CNANO + ONEMWF*CNANO3 - CNACL = WF*CNACLO + ONEMWF*CNACL - CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL -C -C *** LIQUID -C - WATER = ONEMWF*WATER -C - MOLAL(2)= WAER(1) - 2.D0*CNA2SO4 - CNAHSO4 - CNANO3 - - & CNACL ! NA+ - MOLAL(3)= WAER(3) - 2.D0*CNH42S4 - CNH4HS4 - CNH4CL - - & 3.D0*CLC - CNH4NO3 ! NH4+ - MOLAL(4)= WAER(5) - CNACL - CNH4CL ! CL- - MOLAL(7)= WAER(4) - CNANO3 - CNH4NO3 ! NO3- - MOLAL(6)= ONEMWF*(MOLAL(6) + DSOBIS + DAMBIS + DLC) ! HSO4- - MOLAL(5)= WAER(2) - MOLAL(6) - CLC - CNH42S4 - CNA2SO4 ! SO4-- -C - A8 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - IF (MOLAL(5).LE.TINY) THEN - HIEQ = SQRT(XKW *RH*WATER*WATER) ! Neutral solution - ELSE - HIEQ = A8*MOLAL(6)/MOLAL(5) - ENDIF - HIEN = MOLAL(4) + MOLAL(7) + MOLAL(6) + 2.D0*MOLAL(5) - - & MOLAL(2) - MOLAL(3) - MOLAL(1)= MAX (HIEQ, HIEN) ! H+ -C -C *** GAS (ACTIVITY COEFS FROM LIQUID SOLUTION) -C - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = MOLAL(3)/MAX(MOLAL(1),TINY)/A2 - GHNO3 = MOLAL(1)*MOLAL(7)/A3 - GHCL = MOLAL(1)*MOLAL(4)/A4 -C -200 RETURN -C -C *** END OF SUBROUTINE CALCMDRP **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCMDRPII -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE 'DRY' SOLUTION (SUBROUTINE DRYCASE) AND THE -C 'SATURATED LIQUID' SOLUTION (SUBROUTINE LIQCASE). (REVERSE PROBLEM) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCMDRPII (RHI, RHDRY, RHLIQ, DRYCASE, LIQCASE) - INCLUDE 'isrpia.inc' - EXTERNAL DRYCASE, LIQCASE -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ONE - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (RHLIQ-RHI)/(RHLIQ-RHDRY) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CALL DRYCASE - IF (ABS(ONEMWF).LE.1D-5) GOTO 200 ! DRY AEROSOL -C - CNH42SO = CNH42S4 ! FIRST (DRY) SOLUTION - CNH4HSO = CNH4HS4 - CLCO = CLC - CNH4N3O = CNH4NO3 - CNH4CLO = CNH4CL - CNA2SO = CNA2SO4 - CNAHSO = CNAHSO4 - CNANO = CNANO3 - CNACLO = CNACL -C - CCASO = CCASO4 - CK2SO = CK2SO4 - CMGSO = CMGSO4 - CKHSO = CKHSO4 - CCAN32O = CCANO32 - CCAC2L = CCACL2 - CKN3O = CKNO3 - CKCLO = CKCL - CMGN32O = CMGNO32 - CMGC2L = CMGCL2 -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CNH42S4 = ZERO - CNH4HS4 = ZERO - CLC = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CNAHSO4 = ZERO - CNANO3 = ZERO - CNACL = ZERO - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - CCASO4 = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CKHSO4 = ZERO - CCANO32 = ZERO - CCACL2 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO -C - CALL LIQCASE ! SECOND (LIQUID) SOLUTION -C -C *** ADJUST THINGS FOR THE CASE THAT THE LIQUID SUB PREDICTS DRY AEROSOL -C - IF (WATER.LE.TINY) THEN - WATER = ZERO - DO 100 I=1,NIONS - MOLAL(I)= ZERO - 100 CONTINUE - CALL DRYCASE - GOTO 200 - ENDIF -C -C *** FIND SALT DISSOLUTIONS BETWEEN DRY & LIQUID SOLUTIONS. -C - DAMBIS = CNH4HSO - CNH4HS4 - DSOBIS = CNAHSO - CNAHSO4 - DLC = CLCO - CLC - DPOBIS = CKHSO - CKHSO4 -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C -C *** SOLID -C - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 - CNA2SO4 = WF*CNA2SO + ONEMWF*CNA2SO4 - CNAHSO4 = WF*CNAHSO + ONEMWF*CNAHSO4 - CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4 - CLC = WF*CLCO + ONEMWF*CLC - CNH4NO3 = WF*CNH4N3O + ONEMWF*CNH4NO3 - CNANO3 = WF*CNANO + ONEMWF*CNANO3 - CNACL = WF*CNACLO + ONEMWF*CNACL - CNH4CL = WF*CNH4CLO + ONEMWF*CNH4CL -C - CCASO4 = WF*CCASO + ONEMWF*CCASO4 - CK2SO4 = WF*CK2SO + ONEMWF*CK2SO4 - CMGSO4 = WF*CMGSO + ONEMWF*CMGSO4 - CKHSO4 = WF*CKHSO + ONEMWF*CKHSO4 - CCANO32 = WF*CCAN32O + ONEMWF*CCANO32 - CCACL2 = WF*CCAC2L + ONEMWF*CCACL2 - CMGNO32 = WF*CMGN32O + ONEMWF*CMGNO32 - CMGCL2 = WF*CMGC2L + ONEMWF*CMGCL2 - CKCL = WF*CKCLO + ONEMWF*CKCL -C -C *** LIQUID -C - WATER = ONEMWF*WATER -C - MOLAL(2)= WAER(1) - 2.D0*CNA2SO4 - CNAHSO4 - CNANO3 - - & CNACL ! NA+ - MOLAL(3)= WAER(3) - 2.D0*CNH42S4 - CNH4HS4 - CNH4CL - - & 3.D0*CLC - CNH4NO3 ! NH4+ - MOLAL(4)= WAER(5) - CNACL - CNH4CL - 2.D0*CCACL2 - - & 2.D0*CMGCL2 - CKCL ! CL- - MOLAL(7)= WAER(4) - CNANO3 - CNH4NO3 - CKNO3 - & - 2.D0*CCANO32 - 2.D0*CMGNO32 ! NO3- - MOLAL(6)= ONEMWF*(MOLAL(6) + DSOBIS + DAMBIS + DLC + DPOBIS) ! HSO4- - MOLAL(5)= WAER(2) - MOLAL(6) - CLC - CNH42S4 - CNA2SO4 - & - CCASO4 - CK2SO4 - CMGSO4 ! SO4-- - MOLAL(8)= WAER(6) - CCASO4 - CCANO32 - CCACL2 ! CA++ - MOLAL(9)= WAER(7) - 2.D0*CK2SO4 - CKNO3 - CKCL - CKHSO4 ! K+ - MOLAL(10)=WAER(8) - CMGSO4 - CMGNO32 - CMGCL2 ! MG++ -C - A8 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - IF (MOLAL(5).LE.TINY) THEN - HIEQ = SQRT(XKW *RH*WATER*WATER) ! Neutral solution - ELSE - HIEQ = A8*MOLAL(6)/MOLAL(5) - ENDIF - HIEN = MOLAL(4) + MOLAL(7) + MOLAL(6) + 2.D0*MOLAL(5) - - & MOLAL(2) - MOLAL(3) - MOLAL(1)= MAX (HIEQ, HIEN) ! H+ -C -C *** GAS (ACTIVITY COEFS FROM LIQUID SOLUTION) -C - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = MOLAL(3)/MAX(MOLAL(1),TINY)/A2 - GHNO3 = MOLAL(1)*MOLAL(7)/A3 - GHCL = MOLAL(1)*MOLAL(4)/A4 -C -200 RETURN -C -C *** END OF SUBROUTINE CALCMDRPII ************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCHS4 -C *** THIS SUBROUTINE CALCULATES THE HSO4 GENERATED FROM (H,SO4). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCHS4 (HI, SO4I, HSO4I, DELTA) - INCLUDE 'isrpia.inc' -CC CHARACTER ERRINF*40 -C -C *** IF TOO LITTLE WATER, DONT SOLVE -C - IF (WATER.LE.1d1*TINY) THEN - DELTA = ZERO - RETURN - ENDIF -C -C *** CALCULATE HSO4 SPECIATION ***************************************** -C - A8 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C - BB =-(HI + SO4I + A8) - CC = HI*SO4I - HSO4I*A8 - DD = BB*BB - 4.D0*CC -C - IF (DD.GE.ZERO) THEN - SQDD = SQRT(DD) - DELTA1 = 0.5*(-BB + SQDD) - DELTA2 = 0.5*(-BB - SQDD) - IF (HSO4I.LE.TINY) THEN - DELTA = DELTA2 - ELSEIF( HI*SO4I .GE. A8*HSO4I ) THEN - DELTA = DELTA2 - ELSEIF( HI*SO4I .LT. A8*HSO4I ) THEN - DELTA = DELTA1 - ELSE - DELTA = ZERO - ENDIF - ELSE - DELTA = ZERO - ENDIF -CCC -CCC *** COMPARE DELTA TO TOTAL H+ ; ESTIMATE EFFECT OF HSO4 *************** -CCC -CC HYD = MAX(HI, MOLAL(1)) -CC IF (HYD.GT.TINY) THEN -CC IF (DELTA/HYD.GT.0.1d0) THEN -CC WRITE (ERRINF,'(1PE10.3)') DELTA/HYD*100.0 -CC CALL PUSHERR (0020, ERRINF) -CC ENDIF -CC ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCHS4 ***************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCPH -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCPH (GG, HI, OHI) - INCLUDE 'isrpia.inc' -C - AKW = XKW *RH*WATER*WATER - CN = SQRT(AKW) -C -C *** GG = (negative charge) - (positive charge) -C - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = MAX(0.5D0*(-BB + SQRT(DD)),CN) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= MAX(0.5D0*(-BB + SQRT(DD)),CN) - HI = AKW/OHI - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCPH ****************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCACT -C *** CALCULATES MULTI-COMPONENT ACTIVITY COEFFICIENTS FROM BROMLEYS -C METHOD. THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY -C KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCACT - INCLUDE 'isrpia.inc' -C - COMMON /DRVINP/ WI(8), RHI, TEMPI, IPROBI, METSTBLI, IACALCI, - & NADJI -C - IF (W(1)+W(4)+W(5)+W(6)+W(7)+W(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl,NO3=0 - CALL CALCACT1 - ELSE IF (W(1)+W(5)+W(6)+W(7)+W(8) .LE. TINY) THEN !Ca,K,Mg,Na,Cl=0 - CALL CALCACT2 - ELSE IF (W(6)+W(7)+W(8) .LE. TINY) THEN !Ca,K,Mg=0 - CALL CALCACT3 - ELSE - CALL CALCACT4 - ENDIF -C -C *** Return point ; End of subroutine -C - RETURN - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCACT4 -C *** CALCULATES MULTI-COMPONENT ACTIVITY COEFFICIENTS FROM BROMLEYS -C METHOD FOR AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM-CALCIUM-POTASSIUM-MAGNESIUM -C AEROSOL SYSTEM. THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY -C KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL4). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCACT4 - INCLUDE 'isrpia.inc' -C - REAL EX10 - REAL G0(6,4),ZPL,ZMI,AGAMA,SION,H,CH,F1(6),F2A(4),F2B(4) - DOUBLE PRECISION MPL, XIJ, YJI - DATA G0/24*0D0/ - -C - GA(I,J)= (F1(I)/Z(I) + F2A(J)/Z(J+3)) / (Z(I)+Z(J+3)) - H - GB(I,J)= (F1(I)/Z(I+4) + F2B(J)/Z(J+3)) / (Z(I+4)+Z(J+3)) - H -C -C *** SAVE ACTIVITIES IN OLD ARRAY ************************************* -C - IF (FRST) THEN ! Outer loop - DO 10 I=1,NPAIR - GAMOU(I) = GAMA(I) -10 CONTINUE - ENDIF -C - DO 20 I=1,NPAIR ! Inner loop - GAMIN(I) = GAMA(I) -20 CONTINUE -C -C *** CALCULATE IONIC ACTIVITY OF SOLUTION ***************************** -C - IONIC=0.0 - DO 30 I=1,NIONS - IONIC=IONIC + MOLAL(I)*Z(I)*Z(I) -30 CONTINUE - IONIC = MAX(MIN(0.5*IONIC/WATER,100.d0), TINY) -C -C *** CALCULATE BINARY ACTIVITY COEFFICIENTS *************************** -C -C G0(1,1)=G11;G0(1,2)=G07;G0(1,3)=G08;G0(1,4)=G10;G0(2,1)=G01;G0(2,2)=G02 -C G0(2,3)=G12;G0(2,4)=G03;G0(3,1)=G06;G0(3,2)=G04;G0(3,3)=G09;G0(3,4)=G05 -C - IF (IACALC.EQ.0) THEN ! K.M.; FULL - CALL KMFUL4 (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3),G0(4,4),G0(4,1),G0(5,2), - & G0(5,3),G0(5,4),G0(5,1),G0(6,2),G0(6,4),G0(6,1)) - ELSE ! K.M.; TABULATED - CALL KMTAB (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3),G0(4,4),G0(4,1),G0(5,2), - & G0(5,3),G0(5,4),G0(5,1),G0(6,2),G0(6,4),G0(6,1)) - ENDIF -C -C *** CALCULATE MULTICOMPONENT ACTIVITY COEFFICIENTS ******************* -C - AGAMA = 0.511*(298.0/TEMP)**1.5 ! Debye Huckel const. at T - SION = SQRT(IONIC) - H = AGAMA*SION/(1+SION) -C - DO 100 I=1,4 - F1(I)=0.0 - F2A(I)=0.0 - F2B(I)=0.0 -100 CONTINUE - F1(5)=0.0 - F1(6)=0.0 -C - DO 110 I=1,3 - ZPL = Z(I) - MPL = MOLAL(I)/WATER - DO 110 J=1,4 - ZMI = Z(J+3) - CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC - XIJ = CH*MPL - YJI = CH*MOLAL(J+3)/WATER - F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H)) - F2A(J) = F2A(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H)) -110 CONTINUE -C - DO 330 I=4,6 - ZPL = Z(I+4) - MPL = MOLAL(I+4)/WATER - DO 330 J=1,4 - ZMI = Z(J+3) - IF (J.EQ.3) THEN - IF (I.EQ.4 .OR. I.EQ.6) THEN - GO TO 330 - ENDIF - ENDIF - CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC - XIJ = CH*MPL - YJI = CH*MOLAL(J+3)/WATER - F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H)) - F2B(J) = F2B(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H)) -330 CONTINUE - -C -C *** LOG10 OF ACTIVITY COEFFICIENTS *********************************** -C - GAMA(01) = GA(2,1)*ZZ(01) ! NACL - GAMA(02) = GA(2,2)*ZZ(02) ! NA2SO4 - GAMA(03) = GA(2,4)*ZZ(03) ! NANO3 - GAMA(04) = GA(3,2)*ZZ(04) ! (NH4)2SO4 - GAMA(05) = GA(3,4)*ZZ(05) ! NH4NO3 - GAMA(06) = GA(3,1)*ZZ(06) ! NH4CL - GAMA(07) = GA(1,2)*ZZ(07) ! 2H-SO4 - GAMA(08) = GA(1,3)*ZZ(08) ! H-HSO4 - GAMA(09) = GA(3,3)*ZZ(09) ! NH4HSO4 - GAMA(10) = GA(1,4)*ZZ(10) ! HNO3 - GAMA(11) = GA(1,1)*ZZ(11) ! HCL - GAMA(12) = GA(2,3)*ZZ(12) ! NAHSO4 - GAMA(13) = 0.20*(3.0*GAMA(04)+2.0*GAMA(09)) ! LC ; SCAPE -CC GAMA(13) = 0.50*(GAMA(04)+GAMA(09)) ! LC ; SEQUILIB -CC GAMA(13) = 0.25*(3.0*GAMA(04)+GAMA(07)) ! LC ; AIM - GAMA(14) = 0.0d0 ! CASO4 - GAMA(15) = GB(4,4)*ZZ(15) ! CA(NO3)2 - GAMA(16) = GB(4,1)*ZZ(16) ! CACL2 - GAMA(17) = GB(5,2)*ZZ(17) ! K2SO4 - GAMA(18) = GB(5,3)*ZZ(18) ! KHSO4 - GAMA(19) = GB(5,4)*ZZ(19) ! KNO3 - GAMA(20) = GB(5,1)*ZZ(20) ! KCL - GAMA(21) = GB(6,2)*ZZ(21) ! MGSO4 - GAMA(22) = GB(6,4)*ZZ(22) ! MG(NO3)2 - GAMA(23) = GB(6,1)*ZZ(23) ! MGCL2 -C -C *** CONVERT LOG (GAMA) COEFFICIENTS TO GAMA ************************** -C - DO 200 I=1,NPAIR - GAMA(I)=MAX(-5.0d0, MIN(GAMA(I),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(I)=10.0**GAMA(I) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] - 200 CONTINUE -C -C *** SETUP ACTIVITY CALCULATION FLAGS ******************************** -C -C OUTER CALCULATION LOOP ; ONLY IF FRST=.TRUE. -C - IF (FRST) THEN - ERROU = ZERO ! CONVERGENCE CRITERION - DO 210 I=1,NPAIR - ERROU=MAX(ERROU, ABS((GAMOU(I)-GAMA(I))/GAMOU(I))) -210 CONTINUE - CALAOU = ERROU .GE. EPSACT ! SETUP FLAGS - FRST =.FALSE. - ENDIF -C -C INNER CALCULATION LOOP ; ALWAYS -C - ERRIN = ZERO ! CONVERGENCE CRITERION - DO 220 I=1,NPAIR - ERRIN = MAX (ERRIN, ABS((GAMIN(I)-GAMA(I))/GAMIN(I))) -220 CONTINUE - CALAIN = ERRIN .GE. EPSACT -C - ICLACT = ICLACT + 1 ! Increment ACTIVITY call counter -C -C *** END OF SUBROUTINE ACTIVITY **************************************** -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCACT3 -C *** CALCULATES MULTI-COMPONENT ACTIVITY COEFFICIENTS FROM BROMLEYS -C METHOD FOR AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM AEROSOL SYSTEM. -C THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY -C KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL3). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCACT3 - INCLUDE 'isrpia.inc' -C - REAL EX10, URF - REAL G0(6,4),ZPL,ZMI,AGAMA,SION,H,CH,F1(3),F2(4) - DOUBLE PRECISION MPL, XIJ, YJI - PARAMETER (URF=0.5) -C PARAMETER (LN10=2.30258509299404568402D0) -C - G(I,J)= (F1(I)/Z(I) + F2(J)/Z(J+3)) / (Z(I)+Z(J+3)) - H -C -C *** SAVE ACTIVITIES IN OLD ARRAY ************************************* -C - IF (FRST) THEN ! Outer loop - DO 10 I=1,13 - GAMOU(I) = GAMA(I) -10 CONTINUE - ENDIF -C - DO 20 I=1,13 ! Inner loop - GAMIN(I) = GAMA(I) -20 CONTINUE -C -C *** CALCULATE IONIC ACTIVITY OF SOLUTION ***************************** -C - IONIC=0.0 - DO 30 I=1,7 - IONIC=IONIC + MOLAL(I)*Z(I)*Z(I) -30 CONTINUE - IONIC = MAX(MIN(0.5*IONIC/WATER,100.d0), TINY) -C -C *** CALCULATE BINARY ACTIVITY COEFFICIENTS *************************** -C -C G0(1,1)=G11;G0(1,2)=G07;G0(1,3)=G08;G0(1,4)=G10;G0(2,1)=G01;G0(2,2)=G02 -C G0(2,3)=G12;G0(2,4)=G03;G0(3,1)=G06;G0(3,2)=G04;G0(3,3)=G09;G0(3,4)=G05 -C - IF (IACALC.EQ.0) THEN ! K.M.; FULL - CALL KMFUL3 (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3)) - ELSE ! K.M.; TABULATED - CALL KMTAB (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3),G0(4,4),G0(4,1),G0(5,2), - & G0(5,3),G0(5,4),G0(5,1),G0(6,2),G0(6,4),G0(6,1)) - ENDIF -C -C *** CALCULATE MULTICOMPONENT ACTIVITY COEFFICIENTS ******************* -C - AGAMA = 0.511*(298.0/TEMP)**1.5 ! Debye Huckel const. at T - SION = SQRT(IONIC) - H = AGAMA*SION/(1+SION) -C - DO 100 I=1,3 - F1(I)=0.0 - F2(I)=0.0 -100 CONTINUE - F2(4)=0.0 -C - DO 110 I=1,3 - ZPL = Z(I) - MPL = MOLAL(I)/WATER - DO 110 J=1,4 - ZMI = Z(J+3) - CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC - XIJ = CH*MPL - YJI = CH*MOLAL(J+3)/WATER - F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H)) - F2(J) = F2(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H)) -110 CONTINUE -C -C *** LOG10 OF ACTIVITY COEFFICIENTS *********************************** -C - GAMA(01) = G(2,1)*ZZ(01) ! NACL - GAMA(02) = G(2,2)*ZZ(02) ! NA2SO4 - GAMA(03) = G(2,4)*ZZ(03) ! NANO3 - GAMA(04) = G(3,2)*ZZ(04) ! (NH4)2SO4 - GAMA(05) = G(3,4)*ZZ(05) ! NH4NO3 - GAMA(06) = G(3,1)*ZZ(06) ! NH4CL - GAMA(07) = G(1,2)*ZZ(07) ! 2H-SO4 - GAMA(08) = G(1,3)*ZZ(08) ! H-HSO4 - GAMA(09) = G(3,3)*ZZ(09) ! NH4HSO4 - GAMA(10) = G(1,4)*ZZ(10) ! HNO3 - GAMA(11) = G(1,1)*ZZ(11) ! HCL - GAMA(12) = G(2,3)*ZZ(12) ! NAHSO4 - GAMA(13) = 0.20*(3.0*GAMA(04)+2.0*GAMA(09)) ! LC ; SCAPE -CC GAMA(13) = 0.50*(GAMA(04)+GAMA(09)) ! LC ; SEQUILIB -CC GAMA(13) = 0.25*(3.0*GAMA(04)+GAMA(07)) ! LC ; AIM -C -C *** CONVERT LOG (GAMA) COEFFICIENTS TO GAMA ************************** -C - DO 200 I=1,13 - GAMA(I)=MAX(-5.0d0, MIN(GAMA(I),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(I)=10.0**GAMA(I) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(I) = GAMIN(I)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's - 200 CONTINUE -C -C *** SETUP ACTIVITY CALCULATION FLAGS ********************************* -C -C OUTER CALCULATION LOOP ; ONLY IF FRST=.TRUE. -C - IF (FRST) THEN - ERROU = ZERO ! CONVERGENCE CRITERION - DO 210 I=1,13 - ERROU=MAX(ERROU, ABS((GAMOU(I)-GAMA(I))/GAMOU(I))) -210 CONTINUE - CALAOU = ERROU .GE. EPSACT ! SETUP FLAGS - FRST =.FALSE. - ENDIF -C -C INNER CALCULATION LOOP ; ALWAYS -C - ERRIN = ZERO ! CONVERGENCE CRITERION - DO 220 I=1,13 - ERRIN = MAX (ERRIN, ABS((GAMIN(I)-GAMA(I))/GAMIN(I))) -220 CONTINUE - CALAIN = ERRIN .GE. EPSACT -C - ICLACT = ICLACT + 1 ! Increment ACTIVITY call counter -C -C *** END OF SUBROUTINE ACTIVITY **************************************** -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCACT2 -C *** CALCULATES MULTI-COMPONENT ACTIVITY COEFFICIENTS FROM BROMLEYS -C METHOD FOR AN AMMONIUM-SULFATE-NITRATE AEROSOL SYSTEM. -C THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY -C KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL2). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCACT2 - INCLUDE 'isrpia.inc' -C - REAL EX10, URF - REAL G0(6,4),ZPL,ZMI,AGAMA,SION,H,CH,F1(3),F2(4) - DOUBLE PRECISION MPL, XIJ, YJI - PARAMETER (URF=0.5) -C PARAMETER (LN10=2.30258509299404568402D0) -C - G(I,J)= (F1(I)/Z(I) + F2(J)/Z(J+3)) / (Z(I)+Z(J+3)) - H -C -C *** SAVE ACTIVITIES IN OLD ARRAY ************************************* -C - IF (FRST) THEN ! Outer loop - DO 10 I=7,10 - GAMOU(I) = GAMA(I) -10 CONTINUE - GAMOU(4) = GAMA(4) - GAMOU(5) = GAMA(5) - GAMOU(13) = GAMA(13) - ENDIF -C - DO 20 I=7,10 ! Inner loop - GAMIN(I) = GAMA(I) -20 CONTINUE - GAMIN(4) = GAMA(4) - GAMIN(5) = GAMA(5) - GAMIN(13) = GAMA(13) -C -C *** CALCULATE IONIC ACTIVITY OF SOLUTION ***************************** -C - IONIC=0.0 - MOLAL(2) = ZERO - MOLAL(4) = ZERO - DO 30 I=1,7 - IONIC=IONIC + MOLAL(I)*Z(I)*Z(I) -30 CONTINUE - IONIC = MAX(MIN(0.5*IONIC/WATER,100.d0), TINY) -C -C *** CALCULATE BINARY ACTIVITY COEFFICIENTS *************************** -C -C G0(1,1)=G11;G0(1,2)=G07;G0(1,3)=G08;G0(1,4)=G10;G0(2,1)=G01;G0(2,2)=G02 -C G0(2,3)=G12;G0(2,4)=G03;G0(3,1)=G06;G0(3,2)=G04;G0(3,3)=G09;G0(3,4)=G05 -C - IF (IACALC.EQ.0) THEN ! K.M.; FULL - CALL KMFUL2 (IONIC, SNGL(TEMP),G0(3,2),G0(3,4),G0(1,2), - & G0(1,3),G0(3,3),G0(1,4)) - ELSE ! K.M.; TABULATED - CALL KMTAB (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3),G0(4,4),G0(4,1),G0(5,2), - & G0(5,3),G0(5,4),G0(5,1),G0(6,2),G0(6,4),G0(6,1)) - ENDIF -C -C *** CALCULATE MULTICOMPONENT ACTIVITY COEFFICIENTS ******************* -C - AGAMA = 0.511*(298.0/TEMP)**1.5 ! Debye Huckel const. at T - SION = SQRT(IONIC) - H = AGAMA*SION/(1+SION) -C - DO 100 I=1,3 - F1(I)=0.0 - F2(I)=0.0 -100 CONTINUE - F2(4)=0.0 -C - DO 110 I=1,3,2 - ZPL = Z(I) - MPL = MOLAL(I)/WATER - DO 110 J=2,4 - ZMI = Z(J+3) - CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC - XIJ = CH*MPL - YJI = CH*MOLAL(J+3)/WATER - F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H)) - F2(J) = F2(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H)) -110 CONTINUE -C -C *** LOG10 OF ACTIVITY COEFFICIENTS *********************************** -C -C GAMA(01) = G(2,1)*ZZ(01) ! NACL -C GAMA(02) = G(2,2)*ZZ(02) ! NA2SO4 -C GAMA(03) = G(2,4)*ZZ(03) ! NANO3 - GAMA(04) = G(3,2)*ZZ(04) ! (NH4)2SO4 - GAMA(05) = G(3,4)*ZZ(05) ! NH4NO3 -C GAMA(06) = G(3,1)*ZZ(06) ! NH4CL - GAMA(07) = G(1,2)*ZZ(07) ! 2H-SO4 - GAMA(08) = G(1,3)*ZZ(08) ! H-HSO4 - GAMA(09) = G(3,3)*ZZ(09) ! NH4HSO4 - GAMA(10) = G(1,4)*ZZ(10) ! HNO3 -C GAMA(11) = G(1,1)*ZZ(11) ! HCL -C GAMA(12) = G(2,3)*ZZ(12) ! NAHSO4 - GAMA(13) = 0.20*(3.0*GAMA(04)+2.0*GAMA(09)) ! LC ; SCAPE -CC GAMA(13) = 0.50*(GAMA(04)+GAMA(09)) ! LC ; SEQUILIB -CC GAMA(13) = 0.25*(3.0*GAMA(04)+GAMA(07)) ! LC ; AIM -C -C *** CONVERT LOG (GAMA) COEFFICIENTS TO GAMA ************************** -C - DO 200 I=7,10 - GAMA(I)=MAX(-5.0d0, MIN(GAMA(I),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(I)=10.0**GAMA(I) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(I) = GAMIN(I)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's - 200 CONTINUE -C - GAMA(4)=MAX(-5.0d0, MIN(GAMA(4),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(4)=10.0**GAMA(4) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(4) = GAMIN(4)*(1.0-URF) + URF*GAMA(4) ! Under-relax GAMA's -C - GAMA(5)=MAX(-5.0d0, MIN(GAMA(5),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(5)=10.0**GAMA(5) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(5) = GAMIN(5)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's -C - GAMA(13)=MAX(-5.0d0, MIN(GAMA(13),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(13)=10.0**GAMA(13) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(13) = GAMIN(13)*(1.0-URF) + URF*GAMA(13) ! Under-relax GAMA's -C -C *** SETUP ACTIVITY CALCULATION FLAGS ********************************* -C -C OUTER CALCULATION LOOP ; ONLY IF FRST=.TRUE. -C - IF (FRST) THEN - ERROU = ZERO ! CONVERGENCE CRITERION - DO 210 I=7,10 - ERROU=MAX(ERROU, ABS((GAMOU(I)-GAMA(I))/GAMOU(I))) -210 CONTINUE - ERROU=MAX(ERROU, ABS((GAMOU(4)-GAMA(4))/GAMOU(4))) - ERROU=MAX(ERROU, ABS((GAMOU(5)-GAMA(5))/GAMOU(5))) - ERROU=MAX(ERROU, ABS((GAMOU(13)-GAMA(13))/GAMOU(13))) -C - CALAOU = ERROU .GE. EPSACT ! SETUP FLAGS - FRST =.FALSE. - ENDIF -C -C INNER CALCULATION LOOP ; ALWAYS -C - ERRIN = ZERO ! CONVERGENCE CRITERION - DO 220 I=7,10 - ERRIN = MAX (ERRIN, ABS((GAMIN(I)-GAMA(I))/GAMIN(I))) -220 CONTINUE - ERRIN = MAX (ERRIN, ABS((GAMIN(4)-GAMA(4))/GAMIN(4))) - ERRIN = MAX (ERRIN, ABS((GAMIN(5)-GAMA(5))/GAMIN(5))) - ERRIN = MAX (ERRIN, ABS((GAMIN(13)-GAMA(13))/GAMIN(13))) - CALAIN = ERRIN .GE. EPSACT -C - ICLACT = ICLACT + 1 ! Increment ACTIVITY call counter -C -C *** END OF SUBROUTINE ACTIVITY **************************************** -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCACT1 -C *** CALCULATES MULTI-COMPONENT ACTIVITY COEFFICIENTS FROM BROMLEYS -C METHOD FOR AN AMMONIUM-SULFATE AEROSOL SYSTEM. -C THE BINARY ACTIVITY COEFFICIENTS ARE CALCULATED BY -C KUSIK-MEISNER RELATION (SUBROUTINE KMTAB or SUBROUTINE KMFUL1). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCACT1 - INCLUDE 'isrpia.inc' -C - REAL EX10, URF - REAL G0(6,4),ZPL,ZMI,AGAMA,SION,H,CH,F1(3),F2(4) - DOUBLE PRECISION MPL, XIJ, YJI - PARAMETER (URF=0.5) -C PARAMETER (LN10=2.30258509299404568402D0) -C - G(I,J)= (F1(I)/Z(I) + F2(J)/Z(J+3)) / (Z(I)+Z(J+3)) - H -C -C *** SAVE ACTIVITIES IN OLD ARRAY ************************************* -C - IF (FRST) THEN ! Outer loop - DO 10 I=7,9 - GAMOU(I) = GAMA(I) -10 CONTINUE - GAMOU(4) = GAMA(4) -C GAMOU(5) = GAMA(5) - GAMOU(13) = GAMA(13) - ENDIF -C - DO 20 I=7,9 ! Inner loop - GAMIN(I) = GAMA(I) -20 CONTINUE - GAMIN(4) = GAMA(4) -C GAMIN(5) = GAMA(5) - GAMIN(13) = GAMA(13) -C -C *** CALCULATE IONIC ACTIVITY OF SOLUTION ***************************** -C - IONIC=0.0 - MOLAL(2) = ZERO - MOLAL(4) = ZERO - MOLAL(7) = ZERO - DO 30 I=1,7 - IONIC=IONIC + MOLAL(I)*Z(I)*Z(I) -30 CONTINUE - IONIC = MAX(MIN(0.5*IONIC/WATER,100.d0), TINY) -C -C *** CALCULATE BINARY ACTIVITY COEFFICIENTS *************************** -C -C G0(1,1)=G11;G0(1,2)=G07;G0(1,3)=G08;G0(1,4)=G10;G0(2,1)=G01;G0(2,2)=G02 -C G0(2,3)=G12;G0(2,4)=G03;G0(3,1)=G06;G0(3,2)=G04;G0(3,3)=G09;G0(3,4)=G05 -C - IF (IACALC.EQ.0) THEN ! K.M.; FULL - CALL KMFUL1 (IONIC, SNGL(TEMP),G0(3,2),G0(1,2), - & G0(1,3),G0(3,3)) - ELSE ! K.M.; TABULATED - CALL KMTAB (IONIC, SNGL(TEMP),G0(2,1),G0(2,2),G0(2,4), - & G0(3,2),G0(3,4),G0(3,1),G0(1,2),G0(1,3),G0(3,3), - & G0(1,4),G0(1,1),G0(2,3),G0(4,4),G0(4,1),G0(5,2), - & G0(5,3),G0(5,4),G0(5,1),G0(6,2),G0(6,4),G0(6,1)) - ENDIF -C -C *** CALCULATE MULTICOMPONENT ACTIVITY COEFFICIENTS ******************* -C - AGAMA = 0.511*(298.0/TEMP)**1.5 ! Debye Huckel const. at T - SION = SQRT(IONIC) - H = AGAMA*SION/(1+SION) -C - DO 100 I=1,3 - F1(I)=0.0 - F2(I)=0.0 -100 CONTINUE - F2(4)=0.0 -C - DO 110 I=1,3,2 - ZPL = Z(I) - MPL = MOLAL(I)/WATER - DO 110 J=2,3 - ZMI = Z(J+3) - CH = 0.25*(ZPL+ZMI)*(ZPL+ZMI)/IONIC - XIJ = CH*MPL - YJI = CH*MOLAL(J+3)/WATER - F1(I) = F1(I) + SNGL(YJI*(G0(I,J) + ZPL*ZMI*H)) - F2(J) = F2(J) + SNGL(XIJ*(G0(I,J) + ZPL*ZMI*H)) -110 CONTINUE -C -C *** LOG10 OF ACTIVITY COEFFICIENTS *********************************** -C -C GAMA(01) = G(2,1)*ZZ(01) ! NACL -C GAMA(02) = G(2,2)*ZZ(02) ! NA2SO4 -C GAMA(03) = G(2,4)*ZZ(03) ! NANO3 - GAMA(04) = G(3,2)*ZZ(04) ! (NH4)2SO4 -C GAMA(05) = G(3,4)*ZZ(05) ! NH4NO3 -C GAMA(06) = G(3,1)*ZZ(06) ! NH4CL - GAMA(07) = G(1,2)*ZZ(07) ! 2H-SO4 - GAMA(08) = G(1,3)*ZZ(08) ! H-HSO4 - GAMA(09) = 0.5*(GAMA(04)+GAMA(07)) ! NH4HSO4 ; AIM (Wexler & Seinfeld, 1991) -C GAMA(10) = G(1,4)*ZZ(10) ! HNO3 -C GAMA(11) = G(1,1)*ZZ(11) ! HCL -C GAMA(12) = G(2,3)*ZZ(12) ! NAHSO4 - GAMA(13) = 0.20*(3.0*GAMA(04)+2.0*GAMA(09)) ! LC ; SCAPE -CC GAMA(13) = 0.50*(GAMA(04)+GAMA(09)) ! LC ; SEQUILIB -CC GAMA(13) = 0.25*(3.0*GAMA(04)+GAMA(07)) ! LC ; AIM -C -C *** CONVERT LOG (GAMA) COEFFICIENTS TO GAMA ************************** -C - DO 200 I=7,9 - GAMA(I)=MAX(-5.0d0, MIN(GAMA(I),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(I)=10.0**GAMA(I) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(I) = GAMIN(I)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's - 200 CONTINUE -C - GAMA(4)=MAX(-5.0d0, MIN(GAMA(4),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(4)=10.0**GAMA(4) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(4) = GAMIN(4)*(1.0-URF) + URF*GAMA(4) ! Under-relax GAMA's -C -C GAMA(5)=MAX(-5.0d0, MIN(GAMA(5),5.0d0) ) ! F77 LIBRARY ROUTINE -C GAMA(5)=10.0**GAMA(5) -CC GAMA(I)=EXP(LN10*GAMA(I)) -CCC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(5) = GAMIN(5)*(1.0-URF) + URF*GAMA(I) ! Under-relax GAMA's -C - GAMA(13)=MAX(-5.0d0, MIN(GAMA(13),5.0d0) ) ! F77 LIBRARY ROUTINE - GAMA(13)=10.0**GAMA(13) -C GAMA(I)=EXP(LN10*GAMA(I)) -CC GAMA(I)=EX10(SNGL(GAMA(I)), 5.0) ! CUTOFF SET TO [-5,5] -C GAMA(13) = GAMIN(13)*(1.0-URF) + URF*GAMA(13) ! Under-relax GAMA's -C -C *** SETUP ACTIVITY CALCULATION FLAGS ********************************* -C -C OUTER CALCULATION LOOP ; ONLY IF FRST=.TRUE. -C - IF (FRST) THEN - ERROU = ZERO ! CONVERGENCE CRITERION - DO 210 I=7,9 - ERROU=MAX(ERROU, ABS((GAMOU(I)-GAMA(I))/GAMOU(I))) -210 CONTINUE - ERROU=MAX(ERROU, ABS((GAMOU(4)-GAMA(4))/GAMOU(4))) -C ERROU=MAX(ERROU, ABS((GAMOU(5)-GAMA(5))/GAMOU(5))) - ERROU=MAX(ERROU, ABS((GAMOU(13)-GAMA(13))/GAMOU(13))) -C - CALAOU = ERROU .GE. EPSACT ! SETUP FLAGS - FRST =.FALSE. - ENDIF -C -C INNER CALCULATION LOOP ; ALWAYS -C - ERRIN = ZERO ! CONVERGENCE CRITERION - DO 220 I=7,9 - ERRIN = MAX (ERRIN, ABS((GAMIN(I)-GAMA(I))/GAMIN(I))) -220 CONTINUE - ERRIN = MAX (ERRIN, ABS((GAMIN(4)-GAMA(4))/GAMIN(4))) -C ERRIN = MAX (ERRIN, ABS((GAMIN(5)-GAMA(5))/GAMIN(5))) - ERRIN = MAX (ERRIN, ABS((GAMIN(13)-GAMA(13))/GAMIN(13))) - CALAIN = ERRIN .GE. EPSACT -C - ICLACT = ICLACT + 1 ! Increment ACTIVITY call counter -C -C *** END OF SUBROUTINE ACTIVITY **************************************** -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE RSTGAM -C *** RESETS ACTIVITY COEFFICIENT ARRAYS TO DEFAULT VALUE OF 0.1 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE RSTGAM - INCLUDE 'isrpia.inc' -C - DO 10 I=1, NPAIR - GAMA(I) = 0.1 -10 CONTINUE -C -C *** END OF SUBROUTINE RSTGAM ****************************************** -C - RETURN - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE KMFUL4 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD -C FOR AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM-CALCIUM-POTASSIUM-MAGNESIUM -C AEROSOL SYSTEM. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE KMFUL4 (IONIC,TEMP,G01,G02,G03,G04,G05,G06,G07,G08,G09, - & G10,G11,G12,G15,G16,G17,G18,G19,G20, - & G21,G22,G23) - REAL Ionic, TEMP - DATA Z01,Z02,Z03,Z04,Z05,Z06,Z07,Z08,Z10,Z11,Z15,Z16,Z17,Z19,Z20, - & Z21,Z22,Z23/1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 4, - & 2, 2/ -C - SION = SQRT(IONIC) -C -C *** Coefficients at 25 oC -C - CALL MKBI(2.230, IONIC, SION, Z01, G01) - CALL MKBI(-0.19, IONIC, SION, Z02, G02) - CALL MKBI(-0.39, IONIC, SION, Z03, G03) - CALL MKBI(-0.25, IONIC, SION, Z04, G04) - CALL MKBI(-1.15, IONIC, SION, Z05, G05) - CALL MKBI(0.820, IONIC, SION, Z06, G06) - CALL MKBI(-.100, IONIC, SION, Z07, G07) - CALL MKBI(8.000, IONIC, SION, Z08, G08) - CALL MKBI(2.600, IONIC, SION, Z10, G10) - CALL MKBI(6.000, IONIC, SION, Z11, G11) - CALL MKBI(0.930, IONIC, SION, Z15, G15) - CALL MKBI(2.400, IONIC, SION, Z16, G16) - CALL MKBI(-0.25, IONIC, SION, Z17, G17) - CALL MKBI(-2.33, IONIC, SION, Z19, G19) - CALL MKBI(0.920, IONIC, SION, Z20, G20) - CALL MKBI(0.150, IONIC, SION, Z21, G21) - CALL MKBI(2.320, IONIC, SION, Z22, G22) - CALL MKBI(2.900, IONIC, SION, Z23, G23) -C -C *** Correct for T other than 298 K -C - TI = TEMP-273.0 - TC = TI-25.0 - IF (ABS(TC) .GT. 1.0) THEN - CF1 = 1.125-0.005*TI - CF2 = (0.125-0.005*TI)*(0.039*IONIC**0.92-0.41*SION/(1.+SION)) - G01 = CF1*G01 - CF2*Z01 - G02 = CF1*G02 - CF2*Z02 - G03 = CF1*G03 - CF2*Z03 - G04 = CF1*G04 - CF2*Z04 - G05 = CF1*G05 - CF2*Z05 - G06 = CF1*G06 - CF2*Z06 - G07 = CF1*G07 - CF2*Z07 - G08 = CF1*G08 - CF2*Z08 - G10 = CF1*G10 - CF2*Z10 - G11 = CF1*G11 - CF2*Z11 - G15 = CF1*G15 - CF2*Z15 - G16 = CF1*G16 - CF2*Z16 - G17 = CF1*G17 - CF2*Z17 - G19 = CF1*G19 - CF2*Z19 - G20 = CF1*G20 - CF2*Z20 - G21 = CF1*G21 - CF2*Z21 - G22 = CF1*G22 - CF2*Z22 - G23 = CF1*G23 - CF2*Z23 - - ENDIF -C - G09 = G06 + G08 - G11 - G12 = G01 + G08 - G11 - G18 = G08 + G20 - G11 -C -C *** Return point ; End of subroutine -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KMFUL3 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD -C FOR AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM AEROSOL SYSTEM. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE KMFUL3 (IONIC,TEMP,G01,G02,G03,G04,G05,G06,G07,G08,G09, - & G10,G11,G12) - REAL Ionic, TEMP - DATA Z01,Z02,Z03,Z04,Z05,Z06,Z07,Z08,Z10,Z11 - & /1, 2, 1, 2, 1, 1, 2, 1, 1, 1/ -C - SION = SQRT(IONIC) -C -C *** Coefficients at 25 oC -C - CALL MKBI(2.230, IONIC, SION, Z01, G01) - CALL MKBI(-0.19, IONIC, SION, Z02, G02) - CALL MKBI(-0.39, IONIC, SION, Z03, G03) - CALL MKBI(-0.25, IONIC, SION, Z04, G04) - CALL MKBI(-1.15, IONIC, SION, Z05, G05) - CALL MKBI(0.820, IONIC, SION, Z06, G06) - CALL MKBI(-.100, IONIC, SION, Z07, G07) - CALL MKBI(8.000, IONIC, SION, Z08, G08) - CALL MKBI(2.600, IONIC, SION, Z10, G10) - CALL MKBI(6.000, IONIC, SION, Z11, G11) -C -C *** Correct for T other than 298 K -C - TI = TEMP-273.0 - TC = TI-25.0 - IF (ABS(TC) .GT. 1.0) THEN - CF1 = 1.125-0.005*TI - CF2 = (0.125-0.005*TI)*(0.039*IONIC**0.92-0.41*SION/(1.+SION)) - G01 = CF1*G01 - CF2*Z01 - G02 = CF1*G02 - CF2*Z02 - G03 = CF1*G03 - CF2*Z03 - G04 = CF1*G04 - CF2*Z04 - G05 = CF1*G05 - CF2*Z05 - G06 = CF1*G06 - CF2*Z06 - G07 = CF1*G07 - CF2*Z07 - G08 = CF1*G08 - CF2*Z08 - G10 = CF1*G10 - CF2*Z10 - G11 = CF1*G11 - CF2*Z11 - ENDIF -C - G09 = G06 + G08 - G11 - G12 = G01 + G08 - G11 -C -C *** Return point ; End of subroutine -C - RETURN - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KMFUL2 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD -C FOR AN AMMONIUM-SULFATE-NITRATE AEROSOL SYSTEM. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE KMFUL2 (IONIC,TEMP,G04,G05,G07,G08,G09,G10) - REAL Ionic, TEMP - DATA Z01,Z02,Z03,Z04,Z05,Z06,Z07,Z08,Z10,Z11 - & /1, 2, 1, 2, 1, 1, 2, 1, 1, 1/ -C - SION = SQRT(IONIC) -C -C *** Coefficients at 25 oC -C -C CALL MKBI(2.230, IONIC, SION, Z01, G01) -C CALL MKBI(-0.19, IONIC, SION, Z02, G02) -C CALL MKBI(-0.39, IONIC, SION, Z03, G03) - CALL MKBI(-0.25, IONIC, SION, Z04, G04) - CALL MKBI(-1.15, IONIC, SION, Z05, G05) -C CALL MKBI(0.820, IONIC, SION, Z06, G06) - CALL MKBI(-.100, IONIC, SION, Z07, G07) - CALL MKBI(8.000, IONIC, SION, Z08, G08) - CALL MKBI(2.600, IONIC, SION, Z10, G10) -C CALL MKBI(6.000, IONIC, SION, Z11, G11) -C -C *** Correct for T other than 298 K -C - TI = TEMP-273.0 - TC = TI-25.0 - IF (ABS(TC) .GT. 1.0) THEN - CF1 = 1.125-0.005*TI - CF2 = (0.125-0.005*TI)*(0.039*IONIC**0.92-0.41*SION/(1.+SION)) -C G01 = CF1*G01 - CF2*Z01 -C G02 = CF1*G02 - CF2*Z02 -C G03 = CF1*G03 - CF2*Z03 - G04 = CF1*G04 - CF2*Z04 - G05 = CF1*G05 - CF2*Z05 -C G06 = CF1*G06 - CF2*Z06 - G07 = CF1*G07 - CF2*Z07 - G08 = CF1*G08 - CF2*Z08 - G10 = CF1*G10 - CF2*Z10 -C G11 = CF1*G11 - CF2*Z11 - ENDIF -C - G09 = G05 + G08 - G10 -C G12 = G01 + G08 - G11 -C -C *** Return point ; End of subroutine -C - RETURN - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KMFUL1 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD -C FOR AN AMMONIUM-SULFATE AEROSOL SYSTEM. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE KMFUL1 (IONIC,TEMP,G04,G07,G08,G09) - REAL Ionic, TEMP - DATA Z01,Z02,Z03,Z04,Z05,Z06,Z07,Z08,Z10,Z11 - & /1, 2, 1, 2, 1, 1, 2, 1, 1, 1/ -C - SION = SQRT(IONIC) -C -C *** Coefficients at 25 oC -C -C CALL MKBI(2.230, IONIC, SION, Z01, G01) -C CALL MKBI(-0.19, IONIC, SION, Z02, G02) -C CALL MKBI(-0.39, IONIC, SION, Z03, G03) - CALL MKBI(-0.25, IONIC, SION, Z04, G04) -C CALL MKBI(-1.15, IONIC, SION, Z05, G05) -C CALL MKBI(0.820, IONIC, SION, Z06, G06) - CALL MKBI(-.100, IONIC, SION, Z07, G07) - CALL MKBI(8.000, IONIC, SION, Z08, G08) -C CALL MKBI(2.600, IONIC, SION, Z10, G10) -C CALL MKBI(6.000, IONIC, SION, Z11, G11) -C -C *** Correct for T other than 298 K -C - TI = TEMP-273.0 - TC = TI-25.0 - IF (ABS(TC) .GT. 1.0) THEN - CF1 = 1.125-0.005*TI - CF2 = (0.125-0.005*TI)*(0.039*IONIC**0.92-0.41*SION/(1.+SION)) -C G01 = CF1*G01 - CF2*Z01 -C G02 = CF1*G02 - CF2*Z02 -C G03 = CF1*G03 - CF2*Z03 - G04 = CF1*G04 - CF2*Z04 -C G05 = CF1*G05 - CF2*Z05 -C G06 = CF1*G06 - CF2*Z06 - G07 = CF1*G07 - CF2*Z07 - G08 = CF1*G08 - CF2*Z08 -C G10 = CF1*G10 - CF2*Z10 -C G11 = CF1*G11 - CF2*Z11 - ENDIF -C -C G09 = G05 + G08 - G10 ! CALCULATED IN CALCACT1 -C G12 = G01 + G08 - G11 -C -C *** Return point ; End of subroutine -C - RETURN - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE MKBI -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE MKBI(Q,IONIC,SION,ZIP,BI) -C - REAL IONIC -C - B=.75-.065*Q - C= 1.0 - IF (IONIC.LT.6.0) C=1.+.055*Q*EXP(-.023*IONIC*IONIC*IONIC) - XX=-0.5107*SION/(1.+C*SION) - BI=(1.+B*(1.+.1*IONIC)**Q-B) - BI=ZIP*ALOG10(BI) + ZIP*XX -C - RETURN - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KMTAB -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IONIC' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KMTAB (IN,TEMP,G01,G02,G03,G04,G05,G06,G07,G08,G09,G10, - & G11,G12,G15,G16,G17,G18,G19,G20,G21,G22,G23) - REAL IN, Temp, binarray (23) -C -C *** Find temperature range -C - IND = NINT((TEMP-198.0)/25.0) + 1 - IND = MIN(MAX(IND,1),6) -C -C *** Call appropriate routine -C - IF (IND.EQ.1) THEN - CALL KM198 (IN,binarray) - ELSEIF (IND.EQ.2) THEN - CALL KM223 (IN,binarray) - ELSEIF (IND.EQ.3) THEN - CALL KM248 (IN,binarray) - ELSEIF (IND.EQ.4) THEN - CALL KM273 (IN,binarray) - ELSEIF (IND.EQ.5) THEN - CALL KM298 (IN,binarray) - ELSE - CALL KM323 (IN,binarray) - ENDIF -C - G01 = binarray(01) - G02 = binarray(02) - G03 = binarray(03) - G04 = binarray(04) - G05 = binarray(05) - G06 = binarray(06) - G07 = binarray(07) - G08 = binarray(08) - G09 = binarray(09) - G10 = binarray(10) - G11 = binarray(11) - G12 = binarray(12) - G13 = binarray(13) - G14 = binarray(14) - G15 = binarray(15) - G16 = binarray(16) - G17 = binarray(17) - G18 = binarray(18) - G19 = binarray(19) - G20 = binarray(20) - G21 = binarray(21) - G22 = binarray(22) - G23 = binarray(23) -C -C *** Return point; End of subroutine -C - RETURN - END - - -C INTEGER FUNCTION IBACPOS(IN) -CC -CC Compute the index in the binary activity coefficient array -CC based on the input ionic strength. -CC -CC Chris Nolte, 6/16/05 -CC -C implicit none -C real IN -C IF (IN .LE. 0.300000E+02) THEN -C ibacpos = MIN(NINT( 0.200000E+02*IN) + 1, 600) -C ELSE -C ibacpos = 600+NINT( 0.200000E+01*IN- 0.600000E+02) -C ENDIF -C ibacpos = min(ibacpos, 741) -C return -C end - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM198 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 198K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM198 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC198/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF198 -C -C *** Common block definition -C - COMMON /KMC198/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.050,-0.103,-0.127,-0.142,-0.154,-0.162,-0.169,-0.174,-0.178, - &-0.181,-0.184,-0.186,-0.188,-0.189,-0.190,-0.191,-0.191,-0.192, - &-0.192,-0.191,-0.191,-0.191,-0.190,-0.189,-0.188,-0.188,-0.187, - &-0.185,-0.184,-0.183,-0.182,-0.181,-0.179,-0.178,-0.176,-0.175, - &-0.173,-0.172,-0.170,-0.169,-0.167,-0.166,-0.164,-0.162,-0.161, - &-0.159,-0.157,-0.156,-0.154,-0.152,-0.151,-0.149,-0.147,-0.146, - &-0.144,-0.142,-0.140,-0.139,-0.137,-0.135,-0.134,-0.132,-0.130, - &-0.128,-0.127,-0.125,-0.123,-0.121,-0.120,-0.118,-0.116,-0.114, - &-0.112,-0.111,-0.109,-0.107,-0.105,-0.103,-0.101,-0.099,-0.098, - &-0.096,-0.094,-0.092,-0.090,-0.088,-0.086,-0.084,-0.082,-0.080, - &-0.078,-0.075,-0.073,-0.071,-0.069,-0.067,-0.065,-0.063,-0.060, - &-0.058,-0.056,-0.054,-0.051,-0.049,-0.047,-0.045,-0.042,-0.040, - &-0.038,-0.035,-0.033,-0.031,-0.028,-0.026,-0.024,-0.021,-0.019, - &-0.016,-0.014,-0.012,-0.009,-0.007,-0.004,-0.002, 0.000, 0.003, - & 0.005, 0.008, 0.010, 0.012, 0.015, 0.017, 0.020, 0.022, 0.024, - & 0.027, 0.029, 0.032, 0.034, 0.036, 0.039, 0.041, 0.044, 0.046, - & 0.048, 0.051, 0.053, 0.055, 0.058, 0.060, 0.063, 0.065, 0.067, - & 0.070, 0.072, 0.074, 0.077, 0.079, 0.081, 0.084, 0.086, 0.088, - & 0.091, 0.093, 0.095, 0.098, 0.100, 0.102, 0.105, 0.107, 0.109, - & 0.112, 0.114, 0.116, 0.118, 0.121, 0.123, 0.125, 0.127, 0.130, - & 0.132, 0.134, 0.137, 0.139, 0.141, 0.143, 0.146, 0.148, 0.150, - & 0.152, 0.154, 0.157, 0.159, 0.161, 0.163, 0.166, 0.168, 0.170, - & 0.172, 0.174, 0.176, 0.179, 0.181, 0.183, 0.185, 0.187, 0.190, - & 0.192, 0.194, 0.196, 0.198, 0.200, 0.202, 0.205, 0.207, 0.209, - & 0.211, 0.213, 0.215, 0.217, 0.219, 0.222, 0.224, 0.226, 0.228, - & 0.230, 0.232, 0.234, 0.236, 0.238, 0.240, 0.242, 0.244, 0.246, - & 0.249, 0.251, 0.253, 0.255, 0.257, 0.259, 0.261, 0.263, 0.265, - & 0.267, 0.269, 0.271, 0.273, 0.275, 0.277, 0.279, 0.281, 0.283, - & 0.285, 0.287, 0.289, 0.291, 0.293, 0.295, 0.297, 0.299, 0.301, - & 0.303, 0.304, 0.306, 0.308, 0.310, 0.312, 0.314, 0.316, 0.318, - & 0.320, 0.322, 0.324, 0.326, 0.328, 0.329, 0.331, 0.333, 0.335, - & 0.337, 0.339, 0.341, 0.343, 0.344, 0.346, 0.348, 0.350, 0.352, - & 0.354, 0.356, 0.357, 0.359, 0.361, 0.363, 0.365, 0.367, 0.368, - & 0.370, 0.372, 0.374, 0.376, 0.377, 0.379, 0.381, 0.383, 0.385, - & 0.386, 0.388, 0.390, 0.392, 0.393, 0.395, 0.397, 0.399, 0.401, - & 0.402, 0.404, 0.406, 0.408, 0.409, 0.411, 0.413, 0.414, 0.416, - & 0.418, 0.420, 0.421, 0.423, 0.425, 0.426, 0.428, 0.430, 0.432, - & 0.433, 0.435, 0.437, 0.438, 0.440, 0.442, 0.443, 0.445, 0.447, - & 0.448, 0.450, 0.452, 0.453, 0.455, 0.457, 0.458, 0.460, 0.461, - & 0.463, 0.465, 0.466, 0.468, 0.470, 0.471, 0.473, 0.474, 0.476, - & 0.478, 0.479, 0.481, 0.482, 0.484, 0.486, 0.487, 0.489, 0.490, - & 0.492, 0.493, 0.495, 0.497, 0.498, 0.500, 0.501, 0.503, 0.504, - & 0.506, 0.508, 0.509, 0.511, 0.512, 0.514, 0.515, 0.517, 0.518, - & 0.520, 0.521, 0.523, 0.524, 0.526, 0.527, 0.529, 0.530, 0.532, - & 0.533, 0.535, 0.536, 0.538, 0.554, 0.568, 0.582, 0.596, 0.610, - & 0.623, 0.636, 0.649, 0.661, 0.674, 0.686, 0.698, 0.709, 0.721, - & 0.732, 0.743, 0.754, 0.765, 0.775, 0.786, 0.796, 0.806, 0.815, - & 0.825, 0.834, 0.844, 0.853, 0.862, 0.870, 0.879, 0.887, 0.896, - & 0.904, 0.912, 0.920, 0.928, 0.935, 0.943, 0.950, 0.957, 0.964, - & 0.971, 0.978, 0.985, 0.992, 0.998, 1.005, 1.011, 1.017, 1.023, - & 1.029, 1.035, 1.041, 1.047, 1.052, 1.058, 1.063, 1.068, 1.074, - & 1.079, 1.084, 1.089, 1.094, 1.099, 1.103, 1.108, 1.112, 1.117, - & 1.121, 1.126, 1.130, 1.134, 1.138, 1.142, 1.146, 1.150, 1.154, - & 1.158, 1.161, 1.165, 1.169, 1.172, 1.175, 1.179, 1.182, 1.185, - & 1.189, 1.192, 1.195, 1.198, 1.201, 1.204, 1.206, 1.209, 1.212, - & 1.215, 1.217, 1.220, 1.222, 1.225, 1.227, 1.230, 1.232, 1.234, - & 1.236, 1.239, 1.241, 1.243, 1.245, 1.247, 1.249, 1.251, 1.253, - & 1.254, 1.256, 1.258, 1.260, 1.261, 1.263, 1.264, 1.266, 1.267, - & 1.269, 1.270, 1.272, 1.273, 1.274, 1.276, 1.277, 1.278, 1.279, - & 1.280, 1.281, 1.283, 1.284, 1.285, 1.286, 1.286, 1.287, 1.288, - & 1.289, 1.290, 1.291, 1.291, 1.292, 1.293, 1.293, 1.294, 1.295, - & 1.295, 1.296, 1.296, 1.297, 1.297, 1.297, 1.298, 1.298, 1.298, - & 1.299, 1.299, 1.299 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.103,-0.225,-0.288,-0.332,-0.367,-0.397,-0.422,-0.445,-0.465, - &-0.484,-0.501,-0.516,-0.531,-0.545,-0.558,-0.570,-0.582,-0.593, - &-0.604,-0.614,-0.624,-0.633,-0.643,-0.651,-0.660,-0.668,-0.676, - &-0.684,-0.692,-0.699,-0.707,-0.714,-0.721,-0.727,-0.734,-0.741, - &-0.747,-0.753,-0.759,-0.765,-0.771,-0.777,-0.783,-0.788,-0.794, - &-0.799,-0.804,-0.810,-0.815,-0.820,-0.825,-0.830,-0.835,-0.840, - &-0.845,-0.849,-0.854,-0.859,-0.863,-0.868,-0.872,-0.877,-0.881, - &-0.885,-0.889,-0.894,-0.898,-0.902,-0.906,-0.910,-0.914,-0.918, - &-0.922,-0.926,-0.930,-0.934,-0.938,-0.942,-0.946,-0.949,-0.953, - &-0.957,-0.961,-0.964,-0.968,-0.971,-0.975,-0.979,-0.982,-0.986, - &-0.989,-0.993,-0.996,-1.000,-1.003,-1.007,-1.010,-1.014,-1.017, - &-1.020,-1.024,-1.027,-1.030,-1.034,-1.037,-1.040,-1.044,-1.047, - &-1.050,-1.053,-1.057,-1.060,-1.063,-1.066,-1.069,-1.072,-1.076, - &-1.079,-1.082,-1.085,-1.088,-1.091,-1.094,-1.097,-1.100,-1.103, - &-1.106,-1.109,-1.112,-1.115,-1.118,-1.121,-1.124,-1.127,-1.130, - &-1.133,-1.136,-1.139,-1.142,-1.145,-1.147,-1.150,-1.153,-1.156, - &-1.159,-1.162,-1.165,-1.167,-1.170,-1.173,-1.176,-1.179,-1.181, - &-1.184,-1.187,-1.190,-1.192,-1.195,-1.198,-1.200,-1.203,-1.206, - &-1.209,-1.211,-1.214,-1.217,-1.219,-1.222,-1.225,-1.227,-1.230, - &-1.232,-1.235,-1.238,-1.240,-1.243,-1.246,-1.248,-1.251,-1.253, - &-1.256,-1.258,-1.261,-1.264,-1.266,-1.269,-1.271,-1.274,-1.276, - &-1.279,-1.281,-1.284,-1.286,-1.289,-1.291,-1.294,-1.296,-1.299, - &-1.301,-1.304,-1.306,-1.309,-1.311,-1.313,-1.316,-1.318,-1.321, - &-1.323,-1.326,-1.328,-1.330,-1.333,-1.335,-1.338,-1.340,-1.342, - &-1.345,-1.347,-1.350,-1.352,-1.354,-1.357,-1.359,-1.361,-1.364, - &-1.366,-1.368,-1.371,-1.373,-1.375,-1.378,-1.380,-1.382,-1.385, - &-1.387,-1.389,-1.392,-1.394,-1.396,-1.399,-1.401,-1.403,-1.405, - &-1.408,-1.410,-1.412,-1.415,-1.417,-1.419,-1.421,-1.424,-1.426, - &-1.428,-1.430,-1.433,-1.435,-1.437,-1.439,-1.442,-1.444,-1.446, - &-1.448,-1.450,-1.453,-1.455,-1.457,-1.459,-1.461,-1.464,-1.466, - &-1.468,-1.470,-1.472,-1.475,-1.477,-1.479,-1.481,-1.483,-1.485, - &-1.488,-1.490,-1.492,-1.494,-1.496,-1.498,-1.501,-1.503,-1.505, - &-1.507,-1.509,-1.511,-1.513,-1.516,-1.518,-1.520,-1.522,-1.524, - &-1.526,-1.528,-1.530,-1.533,-1.535,-1.537,-1.539,-1.541,-1.543, - &-1.545,-1.547,-1.549,-1.551,-1.554,-1.556,-1.558,-1.560,-1.562, - &-1.564,-1.566,-1.568,-1.570,-1.572,-1.574,-1.576,-1.578,-1.580, - &-1.583,-1.585,-1.587,-1.589,-1.591,-1.593,-1.595,-1.597,-1.599, - &-1.601,-1.603,-1.605,-1.607,-1.609,-1.611,-1.613,-1.615,-1.617, - &-1.619,-1.621,-1.623,-1.625,-1.627,-1.629,-1.631,-1.633,-1.635, - &-1.637,-1.639,-1.641,-1.643,-1.645,-1.647,-1.649,-1.651,-1.653, - &-1.655,-1.657,-1.659,-1.661,-1.663,-1.665,-1.667,-1.669,-1.671, - &-1.673,-1.675,-1.677,-1.679,-1.681,-1.683,-1.685,-1.687,-1.689, - &-1.691,-1.693,-1.695,-1.696,-1.698,-1.700,-1.702,-1.704,-1.706, - &-1.708,-1.710,-1.712,-1.714,-1.716,-1.718,-1.720,-1.722,-1.724, - &-1.726,-1.727,-1.729,-1.731,-1.752,-1.771,-1.790,-1.808,-1.827, - &-1.845,-1.864,-1.882,-1.900,-1.918,-1.936,-1.954,-1.972,-1.989, - &-2.007,-2.024,-2.042,-2.059,-2.076,-2.093,-2.110,-2.127,-2.144, - &-2.161,-2.178,-2.194,-2.211,-2.228,-2.244,-2.261,-2.277,-2.293, - &-2.310,-2.326,-2.342,-2.358,-2.374,-2.390,-2.406,-2.422,-2.438, - &-2.454,-2.470,-2.486,-2.501,-2.517,-2.533,-2.548,-2.564,-2.579, - &-2.595,-2.610,-2.626,-2.641,-2.657,-2.672,-2.687,-2.702,-2.718, - &-2.733,-2.748,-2.763,-2.778,-2.793,-2.808,-2.823,-2.838,-2.853, - &-2.868,-2.883,-2.898,-2.913,-2.927,-2.942,-2.957,-2.972,-2.986, - &-3.001,-3.016,-3.030,-3.045,-3.059,-3.074,-3.089,-3.103,-3.118, - &-3.132,-3.147,-3.161,-3.175,-3.190,-3.204,-3.219,-3.233,-3.247, - &-3.261,-3.276,-3.290,-3.304,-3.318,-3.333,-3.347,-3.361,-3.375, - &-3.389,-3.403,-3.417,-3.432,-3.446,-3.460,-3.474,-3.488,-3.502, - &-3.516,-3.530,-3.544,-3.558,-3.571,-3.585,-3.599,-3.613,-3.627, - &-3.641,-3.655,-3.669,-3.682,-3.696,-3.710,-3.724,-3.737,-3.751, - &-3.765,-3.779,-3.792,-3.806,-3.820,-3.833,-3.847,-3.861,-3.874, - &-3.888,-3.901,-3.915,-3.929,-3.942,-3.956,-3.969,-3.983,-3.996, - &-4.010,-4.023,-4.037,-4.050,-4.064,-4.077,-4.091,-4.104,-4.118, - &-4.131,-4.144,-4.158 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.052,-0.114,-0.145,-0.168,-0.187,-0.202,-0.215,-0.227,-0.238, - &-0.248,-0.257,-0.265,-0.273,-0.281,-0.288,-0.294,-0.301,-0.307, - &-0.313,-0.318,-0.324,-0.329,-0.334,-0.339,-0.344,-0.349,-0.353, - &-0.357,-0.362,-0.366,-0.370,-0.374,-0.378,-0.382,-0.386,-0.389, - &-0.393,-0.396,-0.400,-0.403,-0.407,-0.410,-0.413,-0.416,-0.419, - &-0.423,-0.426,-0.429,-0.432,-0.435,-0.437,-0.440,-0.443,-0.446, - &-0.449,-0.451,-0.454,-0.457,-0.459,-0.462,-0.464,-0.467,-0.469, - &-0.472,-0.474,-0.477,-0.479,-0.482,-0.484,-0.486,-0.489,-0.491, - &-0.493,-0.496,-0.498,-0.500,-0.502,-0.505,-0.507,-0.509,-0.511, - &-0.513,-0.516,-0.518,-0.520,-0.522,-0.524,-0.526,-0.528,-0.530, - &-0.532,-0.534,-0.537,-0.539,-0.541,-0.543,-0.545,-0.547,-0.549, - &-0.551,-0.553,-0.555,-0.557,-0.559,-0.561,-0.562,-0.564,-0.566, - &-0.568,-0.570,-0.572,-0.574,-0.576,-0.578,-0.580,-0.582,-0.583, - &-0.585,-0.587,-0.589,-0.591,-0.593,-0.594,-0.596,-0.598,-0.600, - &-0.602,-0.604,-0.605,-0.607,-0.609,-0.611,-0.612,-0.614,-0.616, - &-0.618,-0.619,-0.621,-0.623,-0.625,-0.626,-0.628,-0.630,-0.631, - &-0.633,-0.635,-0.637,-0.638,-0.640,-0.642,-0.643,-0.645,-0.647, - &-0.648,-0.650,-0.651,-0.653,-0.655,-0.656,-0.658,-0.660,-0.661, - &-0.663,-0.664,-0.666,-0.668,-0.669,-0.671,-0.672,-0.674,-0.676, - &-0.677,-0.679,-0.680,-0.682,-0.683,-0.685,-0.686,-0.688,-0.689, - &-0.691,-0.693,-0.694,-0.696,-0.697,-0.699,-0.700,-0.702,-0.703, - &-0.705,-0.706,-0.708,-0.709,-0.711,-0.712,-0.714,-0.715,-0.717, - &-0.718,-0.719,-0.721,-0.722,-0.724,-0.725,-0.727,-0.728,-0.730, - &-0.731,-0.733,-0.734,-0.735,-0.737,-0.738,-0.740,-0.741,-0.743, - &-0.744,-0.745,-0.747,-0.748,-0.750,-0.751,-0.752,-0.754,-0.755, - &-0.757,-0.758,-0.759,-0.761,-0.762,-0.763,-0.765,-0.766,-0.768, - &-0.769,-0.770,-0.772,-0.773,-0.774,-0.776,-0.777,-0.778,-0.780, - &-0.781,-0.782,-0.784,-0.785,-0.787,-0.788,-0.789,-0.791,-0.792, - &-0.793,-0.794,-0.796,-0.797,-0.798,-0.800,-0.801,-0.802,-0.804, - &-0.805,-0.806,-0.808,-0.809,-0.810,-0.812,-0.813,-0.814,-0.815, - &-0.817,-0.818,-0.819,-0.821,-0.822,-0.823,-0.824,-0.826,-0.827, - &-0.828,-0.829,-0.831,-0.832,-0.833,-0.835,-0.836,-0.837,-0.838, - &-0.840,-0.841,-0.842,-0.843,-0.845,-0.846,-0.847,-0.848,-0.850, - &-0.851,-0.852,-0.853,-0.854,-0.856,-0.857,-0.858,-0.859,-0.861, - &-0.862,-0.863,-0.864,-0.866,-0.867,-0.868,-0.869,-0.870,-0.872, - &-0.873,-0.874,-0.875,-0.876,-0.878,-0.879,-0.880,-0.881,-0.882, - &-0.884,-0.885,-0.886,-0.887,-0.888,-0.890,-0.891,-0.892,-0.893, - &-0.894,-0.896,-0.897,-0.898,-0.899,-0.900,-0.901,-0.903,-0.904, - &-0.905,-0.906,-0.907,-0.908,-0.910,-0.911,-0.912,-0.913,-0.914, - &-0.915,-0.917,-0.918,-0.919,-0.920,-0.921,-0.922,-0.924,-0.925, - &-0.926,-0.927,-0.928,-0.929,-0.930,-0.932,-0.933,-0.934,-0.935, - &-0.936,-0.937,-0.938,-0.940,-0.941,-0.942,-0.943,-0.944,-0.945, - &-0.946,-0.947,-0.949,-0.950,-0.951,-0.952,-0.953,-0.954,-0.955, - &-0.956,-0.958,-0.959,-0.960,-0.961,-0.962,-0.963,-0.964,-0.965, - &-0.966,-0.968,-0.969,-0.970,-0.982,-0.992,-1.003,-1.014,-1.025, - &-1.035,-1.046,-1.056,-1.066,-1.076,-1.087,-1.097,-1.107,-1.117, - &-1.126,-1.136,-1.146,-1.156,-1.165,-1.175,-1.185,-1.194,-1.203, - &-1.213,-1.222,-1.231,-1.241,-1.250,-1.259,-1.268,-1.277,-1.286, - &-1.295,-1.304,-1.313,-1.322,-1.331,-1.340,-1.349,-1.357,-1.366, - &-1.375,-1.383,-1.392,-1.401,-1.409,-1.418,-1.426,-1.435,-1.443, - &-1.452,-1.460,-1.468,-1.477,-1.485,-1.493,-1.502,-1.510,-1.518, - &-1.526,-1.535,-1.543,-1.551,-1.559,-1.567,-1.575,-1.583,-1.591, - &-1.599,-1.607,-1.615,-1.623,-1.631,-1.639,-1.647,-1.655,-1.663, - &-1.671,-1.679,-1.686,-1.694,-1.702,-1.710,-1.718,-1.725,-1.733, - &-1.741,-1.749,-1.756,-1.764,-1.772,-1.779,-1.787,-1.794,-1.802, - &-1.810,-1.817,-1.825,-1.832,-1.840,-1.847,-1.855,-1.862,-1.870, - &-1.877,-1.885,-1.892,-1.900,-1.907,-1.915,-1.922,-1.929,-1.937, - &-1.944,-1.952,-1.959,-1.966,-1.974,-1.981,-1.988,-1.996,-2.003, - &-2.010,-2.018,-2.025,-2.032,-2.039,-2.047,-2.054,-2.061,-2.068, - &-2.075,-2.083,-2.090,-2.097,-2.104,-2.111,-2.118,-2.126,-2.133, - &-2.140,-2.147,-2.154,-2.161,-2.168,-2.175,-2.183,-2.190,-2.197, - &-2.204,-2.211,-2.218,-2.225,-2.232,-2.239,-2.246,-2.253,-2.260, - &-2.267,-2.274,-2.281 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.103,-0.226,-0.289,-0.334,-0.369,-0.399,-0.425,-0.448,-0.468, - &-0.487,-0.505,-0.521,-0.536,-0.550,-0.563,-0.576,-0.588,-0.599, - &-0.610,-0.621,-0.631,-0.641,-0.650,-0.659,-0.668,-0.677,-0.685, - &-0.693,-0.701,-0.709,-0.717,-0.724,-0.731,-0.738,-0.745,-0.752, - &-0.758,-0.765,-0.771,-0.777,-0.784,-0.790,-0.796,-0.801,-0.807, - &-0.813,-0.818,-0.824,-0.829,-0.835,-0.840,-0.845,-0.850,-0.855, - &-0.860,-0.865,-0.870,-0.875,-0.880,-0.884,-0.889,-0.894,-0.898, - &-0.903,-0.907,-0.912,-0.916,-0.920,-0.925,-0.929,-0.933,-0.937, - &-0.942,-0.946,-0.950,-0.954,-0.958,-0.962,-0.966,-0.970,-0.974, - &-0.978,-0.982,-0.985,-0.989,-0.993,-0.997,-1.001,-1.004,-1.008, - &-1.012,-1.016,-1.019,-1.023,-1.027,-1.030,-1.034,-1.037,-1.041, - &-1.045,-1.048,-1.052,-1.055,-1.059,-1.062,-1.066,-1.069,-1.072, - &-1.076,-1.079,-1.083,-1.086,-1.089,-1.093,-1.096,-1.099,-1.103, - &-1.106,-1.109,-1.113,-1.116,-1.119,-1.122,-1.126,-1.129,-1.132, - &-1.135,-1.138,-1.142,-1.145,-1.148,-1.151,-1.154,-1.157,-1.160, - &-1.164,-1.167,-1.170,-1.173,-1.176,-1.179,-1.182,-1.185,-1.188, - &-1.191,-1.194,-1.197,-1.200,-1.203,-1.206,-1.209,-1.212,-1.215, - &-1.218,-1.221,-1.223,-1.226,-1.229,-1.232,-1.235,-1.238,-1.241, - &-1.244,-1.246,-1.249,-1.252,-1.255,-1.258,-1.261,-1.263,-1.266, - &-1.269,-1.272,-1.274,-1.277,-1.280,-1.283,-1.285,-1.288,-1.291, - &-1.294,-1.296,-1.299,-1.302,-1.304,-1.307,-1.310,-1.313,-1.315, - &-1.318,-1.321,-1.323,-1.326,-1.328,-1.331,-1.334,-1.336,-1.339, - &-1.342,-1.344,-1.347,-1.349,-1.352,-1.355,-1.357,-1.360,-1.362, - &-1.365,-1.367,-1.370,-1.373,-1.375,-1.378,-1.380,-1.383,-1.385, - &-1.388,-1.390,-1.393,-1.395,-1.398,-1.400,-1.403,-1.405,-1.408, - &-1.410,-1.413,-1.415,-1.418,-1.420,-1.423,-1.425,-1.427,-1.430, - &-1.432,-1.435,-1.437,-1.440,-1.442,-1.445,-1.447,-1.449,-1.452, - &-1.454,-1.457,-1.459,-1.461,-1.464,-1.466,-1.469,-1.471,-1.473, - &-1.476,-1.478,-1.480,-1.483,-1.485,-1.487,-1.490,-1.492,-1.495, - &-1.497,-1.499,-1.502,-1.504,-1.506,-1.509,-1.511,-1.513,-1.515, - &-1.518,-1.520,-1.522,-1.525,-1.527,-1.529,-1.532,-1.534,-1.536, - &-1.538,-1.541,-1.543,-1.545,-1.548,-1.550,-1.552,-1.554,-1.557, - &-1.559,-1.561,-1.563,-1.566,-1.568,-1.570,-1.572,-1.575,-1.577, - &-1.579,-1.581,-1.583,-1.586,-1.588,-1.590,-1.592,-1.595,-1.597, - &-1.599,-1.601,-1.603,-1.606,-1.608,-1.610,-1.612,-1.614,-1.616, - &-1.619,-1.621,-1.623,-1.625,-1.627,-1.630,-1.632,-1.634,-1.636, - &-1.638,-1.640,-1.642,-1.645,-1.647,-1.649,-1.651,-1.653,-1.655, - &-1.658,-1.660,-1.662,-1.664,-1.666,-1.668,-1.670,-1.672,-1.675, - &-1.677,-1.679,-1.681,-1.683,-1.685,-1.687,-1.689,-1.691,-1.694, - &-1.696,-1.698,-1.700,-1.702,-1.704,-1.706,-1.708,-1.710,-1.712, - &-1.714,-1.717,-1.719,-1.721,-1.723,-1.725,-1.727,-1.729,-1.731, - &-1.733,-1.735,-1.737,-1.739,-1.741,-1.743,-1.745,-1.748,-1.750, - &-1.752,-1.754,-1.756,-1.758,-1.760,-1.762,-1.764,-1.766,-1.768, - &-1.770,-1.772,-1.774,-1.776,-1.778,-1.780,-1.782,-1.784,-1.786, - &-1.788,-1.790,-1.792,-1.794,-1.816,-1.836,-1.855,-1.875,-1.894, - &-1.914,-1.933,-1.952,-1.971,-1.989,-2.008,-2.027,-2.045,-2.063, - &-2.082,-2.100,-2.118,-2.136,-2.154,-2.171,-2.189,-2.207,-2.224, - &-2.242,-2.259,-2.276,-2.293,-2.311,-2.328,-2.345,-2.362,-2.379, - &-2.395,-2.412,-2.429,-2.446,-2.462,-2.479,-2.495,-2.512,-2.528, - &-2.544,-2.561,-2.577,-2.593,-2.609,-2.625,-2.642,-2.658,-2.674, - &-2.689,-2.705,-2.721,-2.737,-2.753,-2.768,-2.784,-2.800,-2.815, - &-2.831,-2.847,-2.862,-2.878,-2.893,-2.908,-2.924,-2.939,-2.954, - &-2.970,-2.985,-3.000,-3.015,-3.031,-3.046,-3.061,-3.076,-3.091, - &-3.106,-3.121,-3.136,-3.151,-3.166,-3.181,-3.196,-3.210,-3.225, - &-3.240,-3.255,-3.270,-3.284,-3.299,-3.314,-3.328,-3.343,-3.358, - &-3.372,-3.387,-3.401,-3.416,-3.430,-3.445,-3.459,-3.474,-3.488, - &-3.503,-3.517,-3.531,-3.546,-3.560,-3.574,-3.589,-3.603,-3.617, - &-3.631,-3.646,-3.660,-3.674,-3.688,-3.702,-3.717,-3.731,-3.745, - &-3.759,-3.773,-3.787,-3.801,-3.815,-3.829,-3.843,-3.857,-3.871, - &-3.885,-3.899,-3.913,-3.927,-3.941,-3.955,-3.969,-3.982,-3.996, - &-4.010,-4.024,-4.038,-4.051,-4.065,-4.079,-4.093,-4.107,-4.120, - &-4.134,-4.148,-4.161,-4.175,-4.189,-4.202,-4.216,-4.230,-4.243, - &-4.257,-4.271,-4.284 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.052,-0.117,-0.152,-0.178,-0.199,-0.217,-0.232,-0.247,-0.260, - &-0.272,-0.283,-0.294,-0.304,-0.314,-0.323,-0.332,-0.341,-0.349, - &-0.357,-0.365,-0.372,-0.379,-0.386,-0.393,-0.400,-0.407,-0.413, - &-0.419,-0.426,-0.432,-0.437,-0.443,-0.449,-0.455,-0.460,-0.466, - &-0.471,-0.476,-0.481,-0.486,-0.491,-0.496,-0.501,-0.506,-0.511, - &-0.515,-0.520,-0.524,-0.529,-0.533,-0.537,-0.542,-0.546,-0.550, - &-0.554,-0.558,-0.563,-0.567,-0.570,-0.574,-0.578,-0.582,-0.586, - &-0.590,-0.593,-0.597,-0.601,-0.604,-0.608,-0.612,-0.615,-0.619, - &-0.622,-0.626,-0.629,-0.633,-0.636,-0.640,-0.643,-0.646,-0.650, - &-0.653,-0.656,-0.660,-0.663,-0.666,-0.670,-0.673,-0.676,-0.679, - &-0.683,-0.686,-0.689,-0.692,-0.696,-0.699,-0.702,-0.705,-0.708, - &-0.711,-0.715,-0.718,-0.721,-0.724,-0.727,-0.730,-0.733,-0.736, - &-0.739,-0.742,-0.746,-0.749,-0.752,-0.755,-0.758,-0.761,-0.764, - &-0.767,-0.770,-0.773,-0.776,-0.778,-0.781,-0.784,-0.787,-0.790, - &-0.793,-0.796,-0.799,-0.802,-0.805,-0.807,-0.810,-0.813,-0.816, - &-0.819,-0.821,-0.824,-0.827,-0.830,-0.833,-0.835,-0.838,-0.841, - &-0.843,-0.846,-0.849,-0.852,-0.854,-0.857,-0.860,-0.862,-0.865, - &-0.867,-0.870,-0.873,-0.875,-0.878,-0.880,-0.883,-0.886,-0.888, - &-0.891,-0.893,-0.896,-0.898,-0.901,-0.903,-0.906,-0.908,-0.911, - &-0.913,-0.916,-0.918,-0.921,-0.923,-0.926,-0.928,-0.930,-0.933, - &-0.935,-0.938,-0.940,-0.942,-0.945,-0.947,-0.950,-0.952,-0.954, - &-0.957,-0.959,-0.961,-0.964,-0.966,-0.968,-0.971,-0.973,-0.975, - &-0.977,-0.980,-0.982,-0.984,-0.987,-0.989,-0.991,-0.993,-0.996, - &-0.998,-1.000,-1.002,-1.004,-1.007,-1.009,-1.011,-1.013,-1.015, - &-1.018,-1.020,-1.022,-1.024,-1.026,-1.028,-1.031,-1.033,-1.035, - &-1.037,-1.039,-1.041,-1.043,-1.046,-1.048,-1.050,-1.052,-1.054, - &-1.056,-1.058,-1.060,-1.062,-1.064,-1.066,-1.068,-1.070,-1.072, - &-1.075,-1.077,-1.079,-1.081,-1.083,-1.085,-1.087,-1.089,-1.091, - &-1.093,-1.095,-1.097,-1.099,-1.101,-1.103,-1.105,-1.107,-1.109, - &-1.110,-1.112,-1.114,-1.116,-1.118,-1.120,-1.122,-1.124,-1.126, - &-1.128,-1.130,-1.132,-1.134,-1.136,-1.137,-1.139,-1.141,-1.143, - &-1.145,-1.147,-1.149,-1.151,-1.153,-1.154,-1.156,-1.158,-1.160, - &-1.162,-1.164,-1.166,-1.167,-1.169,-1.171,-1.173,-1.175,-1.176, - &-1.178,-1.180,-1.182,-1.184,-1.186,-1.187,-1.189,-1.191,-1.193, - &-1.195,-1.196,-1.198,-1.200,-1.202,-1.203,-1.205,-1.207,-1.209, - &-1.210,-1.212,-1.214,-1.216,-1.217,-1.219,-1.221,-1.223,-1.224, - &-1.226,-1.228,-1.230,-1.231,-1.233,-1.235,-1.236,-1.238,-1.240, - &-1.241,-1.243,-1.245,-1.247,-1.248,-1.250,-1.252,-1.253,-1.255, - &-1.257,-1.258,-1.260,-1.262,-1.263,-1.265,-1.267,-1.268,-1.270, - &-1.272,-1.273,-1.275,-1.276,-1.278,-1.280,-1.281,-1.283,-1.285, - &-1.286,-1.288,-1.289,-1.291,-1.293,-1.294,-1.296,-1.298,-1.299, - &-1.301,-1.302,-1.304,-1.306,-1.307,-1.309,-1.310,-1.312,-1.313, - &-1.315,-1.317,-1.318,-1.320,-1.321,-1.323,-1.324,-1.326,-1.328, - &-1.329,-1.331,-1.332,-1.334,-1.335,-1.337,-1.338,-1.340,-1.341, - &-1.343,-1.345,-1.346,-1.348,-1.364,-1.379,-1.394,-1.408,-1.422, - &-1.436,-1.450,-1.464,-1.478,-1.491,-1.504,-1.518,-1.531,-1.543, - &-1.556,-1.569,-1.581,-1.593,-1.606,-1.618,-1.630,-1.641,-1.653, - &-1.665,-1.676,-1.688,-1.699,-1.710,-1.722,-1.733,-1.744,-1.755, - &-1.765,-1.776,-1.787,-1.797,-1.808,-1.818,-1.829,-1.839,-1.849, - &-1.859,-1.870,-1.880,-1.890,-1.900,-1.909,-1.919,-1.929,-1.939, - &-1.948,-1.958,-1.968,-1.977,-1.986,-1.996,-2.005,-2.015,-2.024, - &-2.033,-2.042,-2.051,-2.060,-2.070,-2.079,-2.088,-2.096,-2.105, - &-2.114,-2.123,-2.132,-2.141,-2.149,-2.158,-2.167,-2.175,-2.184, - &-2.193,-2.201,-2.210,-2.218,-2.226,-2.235,-2.243,-2.252,-2.260, - &-2.268,-2.277,-2.285,-2.293,-2.301,-2.309,-2.318,-2.326,-2.334, - &-2.342,-2.350,-2.358,-2.366,-2.374,-2.382,-2.390,-2.398,-2.406, - &-2.414,-2.422,-2.429,-2.437,-2.445,-2.453,-2.461,-2.468,-2.476, - &-2.484,-2.492,-2.499,-2.507,-2.515,-2.522,-2.530,-2.537,-2.545, - &-2.553,-2.560,-2.568,-2.575,-2.583,-2.590,-2.598,-2.605,-2.613, - &-2.620,-2.628,-2.635,-2.642,-2.650,-2.657,-2.664,-2.672,-2.679, - &-2.686,-2.694,-2.701,-2.708,-2.716,-2.723,-2.730,-2.737,-2.745, - &-2.752,-2.759,-2.766,-2.773,-2.781,-2.788,-2.795,-2.802,-2.809, - &-2.816,-2.823,-2.831 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.051,-0.108,-0.136,-0.155,-0.170,-0.182,-0.192,-0.200,-0.207, - &-0.214,-0.220,-0.225,-0.230,-0.234,-0.238,-0.242,-0.245,-0.248, - &-0.251,-0.254,-0.256,-0.259,-0.261,-0.263,-0.265,-0.267,-0.269, - &-0.270,-0.272,-0.274,-0.275,-0.276,-0.278,-0.279,-0.280,-0.281, - &-0.283,-0.284,-0.285,-0.286,-0.287,-0.288,-0.289,-0.289,-0.290, - &-0.291,-0.292,-0.293,-0.293,-0.294,-0.295,-0.296,-0.296,-0.297, - &-0.298,-0.298,-0.299,-0.300,-0.300,-0.301,-0.301,-0.302,-0.302, - &-0.303,-0.303,-0.304,-0.304,-0.305,-0.305,-0.306,-0.306,-0.307, - &-0.307,-0.308,-0.308,-0.308,-0.309,-0.309,-0.309,-0.310,-0.310, - &-0.310,-0.311,-0.311,-0.311,-0.312,-0.312,-0.312,-0.312,-0.313, - &-0.313,-0.313,-0.313,-0.313,-0.314,-0.314,-0.314,-0.314,-0.314, - &-0.314,-0.314,-0.314,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315, - &-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315, - &-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315, - &-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315,-0.315, - &-0.315,-0.314,-0.314,-0.314,-0.314,-0.314,-0.314,-0.314,-0.314, - &-0.314,-0.314,-0.314,-0.314,-0.314,-0.314,-0.314,-0.314,-0.313, - &-0.313,-0.313,-0.313,-0.313,-0.313,-0.313,-0.313,-0.313,-0.313, - &-0.313,-0.313,-0.313,-0.313,-0.312,-0.312,-0.312,-0.312,-0.312, - &-0.312,-0.312,-0.312,-0.312,-0.312,-0.312,-0.312,-0.312,-0.312, - &-0.311,-0.311,-0.311,-0.311,-0.311,-0.311,-0.311,-0.311,-0.311, - &-0.311,-0.311,-0.311,-0.311,-0.311,-0.310,-0.310,-0.310,-0.310, - &-0.310,-0.310,-0.310,-0.310,-0.310,-0.310,-0.310,-0.310,-0.310, - &-0.310,-0.309,-0.309,-0.309,-0.309,-0.309,-0.309,-0.309,-0.309, - &-0.309,-0.309,-0.309,-0.309,-0.309,-0.309,-0.309,-0.309,-0.308, - &-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.308, - &-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.308,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306, - &-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.306,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307,-0.307, - &-0.307,-0.307,-0.307,-0.307,-0.307,-0.308,-0.308,-0.308,-0.308, - &-0.308,-0.308,-0.308,-0.308,-0.308,-0.309,-0.310,-0.311,-0.311, - &-0.312,-0.313,-0.314,-0.315,-0.316,-0.317,-0.319,-0.320,-0.321, - &-0.322,-0.324,-0.325,-0.327,-0.328,-0.330,-0.331,-0.333,-0.335, - &-0.336,-0.338,-0.340,-0.342,-0.344,-0.346,-0.348,-0.350,-0.352, - &-0.354,-0.356,-0.358,-0.360,-0.362,-0.365,-0.367,-0.369,-0.371, - &-0.374,-0.376,-0.379,-0.381,-0.383,-0.386,-0.389,-0.391,-0.394, - &-0.396,-0.399,-0.401,-0.404,-0.407,-0.410,-0.412,-0.415,-0.418, - &-0.421,-0.423,-0.426,-0.429,-0.432,-0.435,-0.438,-0.441,-0.444, - &-0.447,-0.450,-0.453,-0.456,-0.459,-0.462,-0.465,-0.468,-0.471, - &-0.475,-0.478,-0.481,-0.484,-0.487,-0.491,-0.494,-0.497,-0.500, - &-0.504,-0.507,-0.510,-0.514,-0.517,-0.520,-0.524,-0.527,-0.531, - &-0.534,-0.537,-0.541,-0.544,-0.548,-0.551,-0.555,-0.558,-0.562, - &-0.565,-0.569,-0.573,-0.576,-0.580,-0.583,-0.587,-0.591,-0.594, - &-0.598,-0.601,-0.605,-0.609,-0.612,-0.616,-0.620,-0.624,-0.627, - &-0.631,-0.635,-0.639,-0.642,-0.646,-0.650,-0.654,-0.657,-0.661, - &-0.665,-0.669,-0.673,-0.677,-0.680,-0.684,-0.688,-0.692,-0.696, - &-0.700,-0.704,-0.708,-0.711,-0.715,-0.719,-0.723,-0.727,-0.731, - &-0.735,-0.739,-0.743,-0.747,-0.751,-0.755,-0.759,-0.763,-0.767, - &-0.771,-0.775,-0.779 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.103,-0.225,-0.286,-0.330,-0.365,-0.394,-0.419,-0.441,-0.460, - &-0.478,-0.495,-0.510,-0.524,-0.538,-0.550,-0.562,-0.573,-0.584, - &-0.594,-0.604,-0.613,-0.622,-0.631,-0.640,-0.648,-0.656,-0.663, - &-0.671,-0.678,-0.685,-0.692,-0.699,-0.705,-0.711,-0.718,-0.724, - &-0.730,-0.736,-0.741,-0.747,-0.753,-0.758,-0.763,-0.769,-0.774, - &-0.779,-0.784,-0.789,-0.794,-0.798,-0.803,-0.808,-0.812,-0.817, - &-0.821,-0.826,-0.830,-0.834,-0.839,-0.843,-0.847,-0.851,-0.855, - &-0.859,-0.863,-0.867,-0.871,-0.875,-0.879,-0.883,-0.886,-0.890, - &-0.894,-0.897,-0.901,-0.905,-0.908,-0.912,-0.915,-0.919,-0.922, - &-0.926,-0.929,-0.933,-0.936,-0.939,-0.943,-0.946,-0.949,-0.953, - &-0.956,-0.959,-0.962,-0.965,-0.969,-0.972,-0.975,-0.978,-0.981, - &-0.984,-0.987,-0.990,-0.994,-0.997,-1.000,-1.003,-1.006,-1.009, - &-1.012,-1.015,-1.017,-1.020,-1.023,-1.026,-1.029,-1.032,-1.035, - &-1.038,-1.041,-1.043,-1.046,-1.049,-1.052,-1.055,-1.057,-1.060, - &-1.063,-1.066,-1.068,-1.071,-1.074,-1.077,-1.079,-1.082,-1.085, - &-1.087,-1.090,-1.093,-1.095,-1.098,-1.100,-1.103,-1.106,-1.108, - &-1.111,-1.113,-1.116,-1.119,-1.121,-1.124,-1.126,-1.129,-1.131, - &-1.134,-1.136,-1.139,-1.141,-1.144,-1.146,-1.149,-1.151,-1.154, - &-1.156,-1.159,-1.161,-1.163,-1.166,-1.168,-1.171,-1.173,-1.176, - &-1.178,-1.180,-1.183,-1.185,-1.187,-1.190,-1.192,-1.195,-1.197, - &-1.199,-1.202,-1.204,-1.206,-1.209,-1.211,-1.213,-1.216,-1.218, - &-1.220,-1.222,-1.225,-1.227,-1.229,-1.232,-1.234,-1.236,-1.238, - &-1.241,-1.243,-1.245,-1.247,-1.250,-1.252,-1.254,-1.256,-1.258, - &-1.261,-1.263,-1.265,-1.267,-1.270,-1.272,-1.274,-1.276,-1.278, - &-1.280,-1.283,-1.285,-1.287,-1.289,-1.291,-1.293,-1.296,-1.298, - &-1.300,-1.302,-1.304,-1.306,-1.308,-1.311,-1.313,-1.315,-1.317, - &-1.319,-1.321,-1.323,-1.325,-1.328,-1.330,-1.332,-1.334,-1.336, - &-1.338,-1.340,-1.342,-1.344,-1.346,-1.348,-1.350,-1.353,-1.355, - &-1.357,-1.359,-1.361,-1.363,-1.365,-1.367,-1.369,-1.371,-1.373, - &-1.375,-1.377,-1.379,-1.381,-1.383,-1.385,-1.387,-1.389,-1.391, - &-1.393,-1.395,-1.397,-1.399,-1.401,-1.403,-1.405,-1.407,-1.409, - &-1.411,-1.413,-1.415,-1.417,-1.419,-1.421,-1.423,-1.425,-1.427, - &-1.429,-1.431,-1.433,-1.435,-1.437,-1.439,-1.441,-1.443,-1.445, - &-1.447,-1.449,-1.451,-1.453,-1.455,-1.456,-1.458,-1.460,-1.462, - &-1.464,-1.466,-1.468,-1.470,-1.472,-1.474,-1.476,-1.478,-1.480, - &-1.481,-1.483,-1.485,-1.487,-1.489,-1.491,-1.493,-1.495,-1.497, - &-1.499,-1.500,-1.502,-1.504,-1.506,-1.508,-1.510,-1.512,-1.514, - &-1.516,-1.517,-1.519,-1.521,-1.523,-1.525,-1.527,-1.529,-1.531, - &-1.532,-1.534,-1.536,-1.538,-1.540,-1.542,-1.544,-1.545,-1.547, - &-1.549,-1.551,-1.553,-1.555,-1.557,-1.558,-1.560,-1.562,-1.564, - &-1.566,-1.568,-1.569,-1.571,-1.573,-1.575,-1.577,-1.579,-1.580, - &-1.582,-1.584,-1.586,-1.588,-1.589,-1.591,-1.593,-1.595,-1.597, - &-1.598,-1.600,-1.602,-1.604,-1.606,-1.608,-1.609,-1.611,-1.613, - &-1.615,-1.617,-1.618,-1.620,-1.622,-1.624,-1.625,-1.627,-1.629, - &-1.631,-1.633,-1.634,-1.636,-1.655,-1.673,-1.691,-1.708,-1.725, - &-1.742,-1.760,-1.777,-1.793,-1.810,-1.827,-1.844,-1.860,-1.877, - &-1.893,-1.910,-1.926,-1.942,-1.958,-1.974,-1.990,-2.006,-2.022, - &-2.038,-2.054,-2.070,-2.086,-2.101,-2.117,-2.132,-2.148,-2.163, - &-2.179,-2.194,-2.210,-2.225,-2.240,-2.255,-2.271,-2.286,-2.301, - &-2.316,-2.331,-2.346,-2.361,-2.376,-2.391,-2.406,-2.420,-2.435, - &-2.450,-2.465,-2.479,-2.494,-2.509,-2.523,-2.538,-2.553,-2.567, - &-2.582,-2.596,-2.611,-2.625,-2.640,-2.654,-2.668,-2.683,-2.697, - &-2.711,-2.726,-2.740,-2.754,-2.768,-2.783,-2.797,-2.811,-2.825, - &-2.839,-2.853,-2.867,-2.881,-2.895,-2.909,-2.923,-2.937,-2.951, - &-2.965,-2.979,-2.993,-3.007,-3.021,-3.035,-3.049,-3.063,-3.076, - &-3.090,-3.104,-3.118,-3.132,-3.145,-3.159,-3.173,-3.186,-3.200, - &-3.214,-3.227,-3.241,-3.255,-3.268,-3.282,-3.295,-3.309,-3.323, - &-3.336,-3.350,-3.363,-3.377,-3.390,-3.404,-3.417,-3.431,-3.444, - &-3.458,-3.471,-3.484,-3.498,-3.511,-3.525,-3.538,-3.551,-3.565, - &-3.578,-3.591,-3.605,-3.618,-3.631,-3.645,-3.658,-3.671,-3.684, - &-3.698,-3.711,-3.724,-3.737,-3.750,-3.764,-3.777,-3.790,-3.803, - &-3.816,-3.829,-3.843,-3.856,-3.869,-3.882,-3.895,-3.908,-3.921, - &-3.934,-3.947,-3.960 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.047,-0.093,-0.110,-0.119,-0.125,-0.128,-0.130,-0.130,-0.129, - &-0.128,-0.126,-0.123,-0.119,-0.116,-0.111,-0.107,-0.102,-0.096, - &-0.091,-0.085,-0.079,-0.073,-0.066,-0.059,-0.052,-0.045,-0.037, - &-0.030,-0.022,-0.014,-0.006, 0.003, 0.011, 0.020, 0.028, 0.037, - & 0.046, 0.055, 0.065, 0.074, 0.083, 0.093, 0.103, 0.113, 0.122, - & 0.132, 0.142, 0.152, 0.163, 0.173, 0.183, 0.194, 0.204, 0.215, - & 0.225, 0.236, 0.247, 0.258, 0.268, 0.279, 0.290, 0.301, 0.312, - & 0.323, 0.334, 0.346, 0.357, 0.368, 0.380, 0.391, 0.402, 0.414, - & 0.425, 0.437, 0.449, 0.461, 0.472, 0.484, 0.496, 0.508, 0.520, - & 0.532, 0.544, 0.557, 0.569, 0.581, 0.594, 0.606, 0.619, 0.631, - & 0.644, 0.657, 0.669, 0.682, 0.695, 0.708, 0.721, 0.734, 0.747, - & 0.761, 0.774, 0.787, 0.800, 0.814, 0.827, 0.841, 0.854, 0.868, - & 0.881, 0.895, 0.908, 0.922, 0.936, 0.949, 0.963, 0.977, 0.990, - & 1.004, 1.018, 1.031, 1.045, 1.059, 1.072, 1.086, 1.100, 1.114, - & 1.127, 1.141, 1.155, 1.168, 1.182, 1.195, 1.209, 1.223, 1.236, - & 1.250, 1.263, 1.277, 1.290, 1.304, 1.317, 1.331, 1.344, 1.358, - & 1.371, 1.384, 1.398, 1.411, 1.424, 1.437, 1.451, 1.464, 1.477, - & 1.490, 1.503, 1.516, 1.529, 1.542, 1.555, 1.568, 1.581, 1.594, - & 1.607, 1.620, 1.633, 1.646, 1.659, 1.671, 1.684, 1.697, 1.709, - & 1.722, 1.735, 1.747, 1.760, 1.772, 1.785, 1.798, 1.810, 1.822, - & 1.835, 1.847, 1.860, 1.872, 1.884, 1.896, 1.909, 1.921, 1.933, - & 1.945, 1.957, 1.970, 1.982, 1.994, 2.006, 2.018, 2.030, 2.042, - & 2.054, 2.065, 2.077, 2.089, 2.101, 2.113, 2.125, 2.136, 2.148, - & 2.160, 2.171, 2.183, 2.195, 2.206, 2.218, 2.229, 2.241, 2.252, - & 2.264, 2.275, 2.286, 2.298, 2.309, 2.320, 2.332, 2.343, 2.354, - & 2.365, 2.377, 2.388, 2.399, 2.410, 2.421, 2.432, 2.443, 2.454, - & 2.465, 2.476, 2.487, 2.498, 2.509, 2.520, 2.531, 2.541, 2.552, - & 2.563, 2.574, 2.584, 2.595, 2.606, 2.616, 2.627, 2.638, 2.648, - & 2.659, 2.669, 2.680, 2.690, 2.701, 2.711, 2.722, 2.732, 2.742, - & 2.753, 2.763, 2.773, 2.784, 2.794, 2.804, 2.814, 2.825, 2.835, - & 2.845, 2.855, 2.865, 2.875, 2.885, 2.895, 2.905, 2.915, 2.925, - & 2.935, 2.945, 2.955, 2.965, 2.975, 2.985, 2.995, 3.005, 3.014, - & 3.024, 3.034, 3.044, 3.053, 3.063, 3.073, 3.082, 3.092, 3.102, - & 3.111, 3.121, 3.130, 3.140, 3.149, 3.159, 3.168, 3.178, 3.187, - & 3.197, 3.206, 3.215, 3.225, 3.234, 3.243, 3.253, 3.262, 3.271, - & 3.280, 3.290, 3.299, 3.308, 3.317, 3.326, 3.336, 3.345, 3.354, - & 3.363, 3.372, 3.381, 3.390, 3.399, 3.408, 3.417, 3.426, 3.435, - & 3.444, 3.453, 3.462, 3.470, 3.479, 3.488, 3.497, 3.506, 3.514, - & 3.523, 3.532, 3.541, 3.549, 3.558, 3.567, 3.575, 3.584, 3.593, - & 3.601, 3.610, 3.619, 3.627, 3.636, 3.644, 3.653, 3.661, 3.670, - & 3.678, 3.687, 3.695, 3.704, 3.712, 3.720, 3.729, 3.737, 3.745, - & 3.754, 3.762, 3.770, 3.779, 3.787, 3.795, 3.803, 3.812, 3.820, - & 3.828, 3.836, 3.844, 3.852, 3.861, 3.869, 3.877, 3.885, 3.893, - & 3.901, 3.909, 3.917, 3.925, 3.933, 3.941, 3.949, 3.957, 3.965, - & 3.973, 3.981, 3.989, 3.997, 4.081, 4.158, 4.233, 4.307, 4.380, - & 4.452, 4.522, 4.592, 4.660, 4.727, 4.793, 4.859, 4.923, 4.986, - & 5.048, 5.110, 5.171, 5.230, 5.289, 5.347, 5.405, 5.461, 5.517, - & 5.572, 5.626, 5.680, 5.733, 5.785, 5.837, 5.888, 5.938, 5.988, - & 6.037, 6.085, 6.133, 6.181, 6.228, 6.274, 6.320, 6.365, 6.410, - & 6.454, 6.498, 6.541, 6.584, 6.626, 6.668, 6.710, 6.751, 6.792, - & 6.832, 6.872, 6.911, 6.950, 6.989, 7.027, 7.065, 7.102, 7.139, - & 7.176, 7.212, 7.248, 7.284, 7.319, 7.354, 7.389, 7.424, 7.458, - & 7.491, 7.525, 7.558, 7.591, 7.623, 7.656, 7.688, 7.719, 7.751, - & 7.782, 7.813, 7.844, 7.874, 7.904, 7.934, 7.964, 7.993, 8.022, - & 8.051, 8.080, 8.108, 8.137, 8.165, 8.192, 8.220, 8.247, 8.274, - & 8.301, 8.328, 8.354, 8.381, 8.407, 8.433, 8.458, 8.484, 8.509, - & 8.534, 8.559, 8.584, 8.609, 8.633, 8.657, 8.681, 8.705, 8.729, - & 8.752, 8.776, 8.799, 8.822, 8.845, 8.868, 8.890, 8.913, 8.935, - & 8.957, 8.979, 9.001, 9.022, 9.044, 9.065, 9.086, 9.107, 9.128, - & 9.149, 9.170, 9.190, 9.211, 9.231, 9.251, 9.271, 9.291, 9.311, - & 9.330, 9.350, 9.369, 9.388, 9.407, 9.426, 9.445, 9.464, 9.483, - & 9.501, 9.520, 9.538, 9.556, 9.574, 9.592, 9.610, 9.628, 9.645, - & 9.663, 9.680, 9.698 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.050,-0.107,-0.134,-0.153,-0.167,-0.179,-0.189,-0.197,-0.204, - &-0.211,-0.216,-0.221,-0.226,-0.230,-0.234,-0.237,-0.240,-0.243, - &-0.245,-0.247,-0.249,-0.251,-0.252,-0.254,-0.255,-0.256,-0.256, - &-0.257,-0.257,-0.258,-0.258,-0.258,-0.258,-0.258,-0.257,-0.257, - &-0.256,-0.255,-0.255,-0.254,-0.253,-0.252,-0.250,-0.249,-0.248, - &-0.246,-0.245,-0.243,-0.242,-0.240,-0.238,-0.236,-0.234,-0.232, - &-0.230,-0.228,-0.226,-0.224,-0.221,-0.219,-0.217,-0.214,-0.212, - &-0.209,-0.207,-0.204,-0.201,-0.199,-0.196,-0.193,-0.190,-0.188, - &-0.185,-0.182,-0.179,-0.176,-0.173,-0.170,-0.167,-0.163,-0.160, - &-0.157,-0.154,-0.150,-0.147,-0.144,-0.140,-0.137,-0.133,-0.130, - &-0.126,-0.123,-0.119,-0.116,-0.112,-0.108,-0.104,-0.101,-0.097, - &-0.093,-0.089,-0.086,-0.082,-0.078,-0.074,-0.070,-0.066,-0.062, - &-0.058,-0.054,-0.050,-0.046,-0.042,-0.038,-0.034,-0.030,-0.026, - &-0.022,-0.018,-0.014,-0.010,-0.006,-0.002, 0.002, 0.006, 0.010, - & 0.014, 0.018, 0.022, 0.026, 0.030, 0.034, 0.038, 0.042, 0.046, - & 0.050, 0.054, 0.058, 0.062, 0.066, 0.070, 0.074, 0.078, 0.082, - & 0.086, 0.090, 0.094, 0.098, 0.102, 0.106, 0.110, 0.114, 0.117, - & 0.121, 0.125, 0.129, 0.133, 0.137, 0.140, 0.144, 0.148, 0.152, - & 0.156, 0.159, 0.163, 0.167, 0.171, 0.174, 0.178, 0.182, 0.186, - & 0.189, 0.193, 0.197, 0.200, 0.204, 0.208, 0.211, 0.215, 0.219, - & 0.222, 0.226, 0.229, 0.233, 0.237, 0.240, 0.244, 0.247, 0.251, - & 0.254, 0.258, 0.261, 0.265, 0.268, 0.272, 0.275, 0.279, 0.282, - & 0.286, 0.289, 0.293, 0.296, 0.299, 0.303, 0.306, 0.309, 0.313, - & 0.316, 0.320, 0.323, 0.326, 0.330, 0.333, 0.336, 0.339, 0.343, - & 0.346, 0.349, 0.353, 0.356, 0.359, 0.362, 0.366, 0.369, 0.372, - & 0.375, 0.378, 0.382, 0.385, 0.388, 0.391, 0.394, 0.397, 0.401, - & 0.404, 0.407, 0.410, 0.413, 0.416, 0.419, 0.422, 0.425, 0.428, - & 0.431, 0.434, 0.438, 0.441, 0.444, 0.447, 0.450, 0.453, 0.456, - & 0.459, 0.462, 0.465, 0.467, 0.470, 0.473, 0.476, 0.479, 0.482, - & 0.485, 0.488, 0.491, 0.494, 0.497, 0.500, 0.502, 0.505, 0.508, - & 0.511, 0.514, 0.517, 0.520, 0.522, 0.525, 0.528, 0.531, 0.534, - & 0.536, 0.539, 0.542, 0.545, 0.547, 0.550, 0.553, 0.556, 0.558, - & 0.561, 0.564, 0.567, 0.569, 0.572, 0.575, 0.577, 0.580, 0.583, - & 0.585, 0.588, 0.591, 0.593, 0.596, 0.599, 0.601, 0.604, 0.607, - & 0.609, 0.612, 0.614, 0.617, 0.620, 0.622, 0.625, 0.627, 0.630, - & 0.633, 0.635, 0.638, 0.640, 0.643, 0.645, 0.648, 0.650, 0.653, - & 0.655, 0.658, 0.660, 0.663, 0.665, 0.668, 0.670, 0.673, 0.675, - & 0.678, 0.680, 0.683, 0.685, 0.687, 0.690, 0.692, 0.695, 0.697, - & 0.700, 0.702, 0.704, 0.707, 0.709, 0.711, 0.714, 0.716, 0.719, - & 0.721, 0.723, 0.726, 0.728, 0.730, 0.733, 0.735, 0.737, 0.740, - & 0.742, 0.744, 0.747, 0.749, 0.751, 0.754, 0.756, 0.758, 0.760, - & 0.763, 0.765, 0.767, 0.769, 0.772, 0.774, 0.776, 0.778, 0.781, - & 0.783, 0.785, 0.787, 0.790, 0.792, 0.794, 0.796, 0.798, 0.801, - & 0.803, 0.805, 0.807, 0.809, 0.811, 0.814, 0.816, 0.818, 0.820, - & 0.822, 0.824, 0.827, 0.829, 0.851, 0.872, 0.892, 0.912, 0.932, - & 0.951, 0.969, 0.988, 1.006, 1.024, 1.041, 1.058, 1.075, 1.091, - & 1.107, 1.123, 1.139, 1.154, 1.169, 1.184, 1.199, 1.213, 1.227, - & 1.241, 1.255, 1.268, 1.282, 1.295, 1.307, 1.320, 1.332, 1.345, - & 1.357, 1.368, 1.380, 1.392, 1.403, 1.414, 1.425, 1.436, 1.446, - & 1.457, 1.467, 1.478, 1.488, 1.497, 1.507, 1.517, 1.526, 1.536, - & 1.545, 1.554, 1.563, 1.572, 1.580, 1.589, 1.597, 1.606, 1.614, - & 1.622, 1.630, 1.638, 1.646, 1.653, 1.661, 1.668, 1.676, 1.683, - & 1.690, 1.697, 1.704, 1.711, 1.718, 1.724, 1.731, 1.737, 1.744, - & 1.750, 1.756, 1.762, 1.769, 1.775, 1.780, 1.786, 1.792, 1.798, - & 1.803, 1.809, 1.814, 1.820, 1.825, 1.830, 1.835, 1.840, 1.845, - & 1.850, 1.855, 1.860, 1.865, 1.870, 1.874, 1.879, 1.883, 1.888, - & 1.892, 1.896, 1.901, 1.905, 1.909, 1.913, 1.917, 1.921, 1.925, - & 1.929, 1.933, 1.936, 1.940, 1.944, 1.947, 1.951, 1.955, 1.958, - & 1.961, 1.965, 1.968, 1.971, 1.975, 1.978, 1.981, 1.984, 1.987, - & 1.990, 1.993, 1.996, 1.999, 2.001, 2.004, 2.007, 2.010, 2.012, - & 2.015, 2.017, 2.020, 2.022, 2.025, 2.027, 2.030, 2.032, 2.034, - & 2.037, 2.039, 2.041, 2.043, 2.045, 2.047, 2.049, 2.051, 2.053, - & 2.055, 2.057, 2.059 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.049,-0.102,-0.125,-0.140,-0.150,-0.158,-0.163,-0.168,-0.171, - &-0.174,-0.176,-0.178,-0.179,-0.179,-0.179,-0.179,-0.179,-0.179, - &-0.178,-0.177,-0.176,-0.175,-0.174,-0.172,-0.171,-0.169,-0.168, - &-0.166,-0.164,-0.162,-0.160,-0.158,-0.156,-0.154,-0.152,-0.150, - &-0.148,-0.146,-0.144,-0.141,-0.139,-0.137,-0.135,-0.132,-0.130, - &-0.128,-0.126,-0.123,-0.121,-0.119,-0.116,-0.114,-0.112,-0.109, - &-0.107,-0.105,-0.102,-0.100,-0.098,-0.095,-0.093,-0.091,-0.088, - &-0.086,-0.084,-0.081,-0.079,-0.077,-0.074,-0.072,-0.070,-0.067, - &-0.065,-0.062,-0.060,-0.057,-0.055,-0.052,-0.050,-0.048,-0.045, - &-0.042,-0.040,-0.037,-0.035,-0.032,-0.030,-0.027,-0.024,-0.022, - &-0.019,-0.016,-0.013,-0.011,-0.008,-0.005,-0.002, 0.001, 0.003, - & 0.006, 0.009, 0.012, 0.015, 0.018, 0.021, 0.024, 0.027, 0.030, - & 0.033, 0.036, 0.039, 0.042, 0.045, 0.048, 0.051, 0.054, 0.057, - & 0.060, 0.063, 0.066, 0.069, 0.072, 0.075, 0.078, 0.081, 0.084, - & 0.087, 0.091, 0.094, 0.097, 0.100, 0.103, 0.106, 0.109, 0.112, - & 0.115, 0.118, 0.121, 0.124, 0.127, 0.130, 0.133, 0.136, 0.139, - & 0.142, 0.146, 0.149, 0.152, 0.155, 0.158, 0.161, 0.164, 0.167, - & 0.170, 0.173, 0.176, 0.179, 0.182, 0.185, 0.188, 0.191, 0.193, - & 0.196, 0.199, 0.202, 0.205, 0.208, 0.211, 0.214, 0.217, 0.220, - & 0.223, 0.226, 0.229, 0.232, 0.235, 0.237, 0.240, 0.243, 0.246, - & 0.249, 0.252, 0.255, 0.258, 0.260, 0.263, 0.266, 0.269, 0.272, - & 0.275, 0.278, 0.280, 0.283, 0.286, 0.289, 0.292, 0.294, 0.297, - & 0.300, 0.303, 0.306, 0.308, 0.311, 0.314, 0.317, 0.319, 0.322, - & 0.325, 0.328, 0.330, 0.333, 0.336, 0.339, 0.341, 0.344, 0.347, - & 0.349, 0.352, 0.355, 0.358, 0.360, 0.363, 0.366, 0.368, 0.371, - & 0.374, 0.376, 0.379, 0.382, 0.384, 0.387, 0.389, 0.392, 0.395, - & 0.397, 0.400, 0.403, 0.405, 0.408, 0.410, 0.413, 0.415, 0.418, - & 0.421, 0.423, 0.426, 0.428, 0.431, 0.433, 0.436, 0.438, 0.441, - & 0.444, 0.446, 0.449, 0.451, 0.454, 0.456, 0.459, 0.461, 0.464, - & 0.466, 0.469, 0.471, 0.473, 0.476, 0.478, 0.481, 0.483, 0.486, - & 0.488, 0.491, 0.493, 0.495, 0.498, 0.500, 0.503, 0.505, 0.508, - & 0.510, 0.512, 0.515, 0.517, 0.519, 0.522, 0.524, 0.527, 0.529, - & 0.531, 0.534, 0.536, 0.538, 0.541, 0.543, 0.545, 0.548, 0.550, - & 0.552, 0.555, 0.557, 0.559, 0.562, 0.564, 0.566, 0.568, 0.571, - & 0.573, 0.575, 0.578, 0.580, 0.582, 0.584, 0.587, 0.589, 0.591, - & 0.593, 0.595, 0.598, 0.600, 0.602, 0.604, 0.607, 0.609, 0.611, - & 0.613, 0.615, 0.618, 0.620, 0.622, 0.624, 0.626, 0.628, 0.631, - & 0.633, 0.635, 0.637, 0.639, 0.641, 0.644, 0.646, 0.648, 0.650, - & 0.652, 0.654, 0.656, 0.658, 0.660, 0.663, 0.665, 0.667, 0.669, - & 0.671, 0.673, 0.675, 0.677, 0.679, 0.681, 0.683, 0.685, 0.688, - & 0.690, 0.692, 0.694, 0.696, 0.698, 0.700, 0.702, 0.704, 0.706, - & 0.708, 0.710, 0.712, 0.714, 0.716, 0.718, 0.720, 0.722, 0.724, - & 0.726, 0.728, 0.730, 0.732, 0.734, 0.736, 0.738, 0.740, 0.742, - & 0.743, 0.745, 0.747, 0.749, 0.751, 0.753, 0.755, 0.757, 0.759, - & 0.761, 0.763, 0.765, 0.767, 0.787, 0.805, 0.824, 0.841, 0.859, - & 0.876, 0.893, 0.909, 0.926, 0.942, 0.957, 0.973, 0.988, 1.003, - & 1.017, 1.032, 1.046, 1.060, 1.073, 1.087, 1.100, 1.113, 1.126, - & 1.138, 1.151, 1.163, 1.175, 1.187, 1.198, 1.210, 1.221, 1.232, - & 1.243, 1.253, 1.264, 1.274, 1.285, 1.295, 1.305, 1.314, 1.324, - & 1.333, 1.343, 1.352, 1.361, 1.370, 1.378, 1.387, 1.395, 1.404, - & 1.412, 1.420, 1.428, 1.436, 1.444, 1.451, 1.459, 1.466, 1.474, - & 1.481, 1.488, 1.495, 1.502, 1.509, 1.515, 1.522, 1.529, 1.535, - & 1.541, 1.548, 1.554, 1.560, 1.566, 1.572, 1.577, 1.583, 1.589, - & 1.594, 1.600, 1.605, 1.610, 1.616, 1.621, 1.626, 1.631, 1.636, - & 1.641, 1.645, 1.650, 1.655, 1.659, 1.664, 1.668, 1.673, 1.677, - & 1.681, 1.685, 1.690, 1.694, 1.698, 1.702, 1.705, 1.709, 1.713, - & 1.717, 1.720, 1.724, 1.728, 1.731, 1.734, 1.738, 1.741, 1.744, - & 1.748, 1.751, 1.754, 1.757, 1.760, 1.763, 1.766, 1.769, 1.772, - & 1.775, 1.777, 1.780, 1.783, 1.785, 1.788, 1.790, 1.793, 1.795, - & 1.798, 1.800, 1.802, 1.805, 1.807, 1.809, 1.811, 1.813, 1.815, - & 1.817, 1.819, 1.821, 1.823, 1.825, 1.827, 1.829, 1.831, 1.832, - & 1.834, 1.836, 1.838, 1.839, 1.841, 1.842, 1.844, 1.845, 1.847, - & 1.848, 1.849, 1.851 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.048,-0.094,-0.112,-0.122,-0.128,-0.131,-0.133,-0.133,-0.133, - &-0.131,-0.129,-0.126,-0.123,-0.119,-0.116,-0.111,-0.107,-0.102, - &-0.097,-0.092,-0.086,-0.080,-0.075,-0.069,-0.062,-0.056,-0.050, - &-0.043,-0.037,-0.030,-0.023,-0.016,-0.009,-0.002, 0.005, 0.012, - & 0.020, 0.027, 0.035, 0.042, 0.050, 0.057, 0.065, 0.072, 0.080, - & 0.088, 0.095, 0.103, 0.111, 0.119, 0.126, 0.134, 0.142, 0.150, - & 0.158, 0.166, 0.174, 0.182, 0.190, 0.198, 0.206, 0.214, 0.222, - & 0.230, 0.238, 0.246, 0.254, 0.262, 0.270, 0.278, 0.287, 0.295, - & 0.303, 0.311, 0.320, 0.328, 0.336, 0.345, 0.353, 0.362, 0.370, - & 0.379, 0.387, 0.396, 0.405, 0.413, 0.422, 0.431, 0.440, 0.449, - & 0.457, 0.466, 0.475, 0.484, 0.494, 0.503, 0.512, 0.521, 0.530, - & 0.540, 0.549, 0.558, 0.568, 0.577, 0.587, 0.596, 0.606, 0.615, - & 0.625, 0.634, 0.644, 0.653, 0.663, 0.673, 0.682, 0.692, 0.702, - & 0.711, 0.721, 0.731, 0.740, 0.750, 0.760, 0.769, 0.779, 0.789, - & 0.798, 0.808, 0.818, 0.827, 0.837, 0.847, 0.856, 0.866, 0.875, - & 0.885, 0.895, 0.904, 0.914, 0.923, 0.933, 0.942, 0.952, 0.961, - & 0.971, 0.980, 0.990, 0.999, 1.009, 1.018, 1.027, 1.037, 1.046, - & 1.055, 1.065, 1.074, 1.083, 1.093, 1.102, 1.111, 1.120, 1.130, - & 1.139, 1.148, 1.157, 1.166, 1.175, 1.184, 1.194, 1.203, 1.212, - & 1.221, 1.230, 1.239, 1.248, 1.257, 1.266, 1.275, 1.283, 1.292, - & 1.301, 1.310, 1.319, 1.328, 1.336, 1.345, 1.354, 1.363, 1.372, - & 1.380, 1.389, 1.398, 1.406, 1.415, 1.423, 1.432, 1.441, 1.449, - & 1.458, 1.466, 1.475, 1.483, 1.492, 1.500, 1.509, 1.517, 1.526, - & 1.534, 1.542, 1.551, 1.559, 1.567, 1.576, 1.584, 1.592, 1.600, - & 1.609, 1.617, 1.625, 1.633, 1.641, 1.649, 1.658, 1.666, 1.674, - & 1.682, 1.690, 1.698, 1.706, 1.714, 1.722, 1.730, 1.738, 1.746, - & 1.754, 1.762, 1.769, 1.777, 1.785, 1.793, 1.801, 1.809, 1.816, - & 1.824, 1.832, 1.840, 1.847, 1.855, 1.863, 1.870, 1.878, 1.886, - & 1.893, 1.901, 1.908, 1.916, 1.924, 1.931, 1.939, 1.946, 1.954, - & 1.961, 1.969, 1.976, 1.983, 1.991, 1.998, 2.006, 2.013, 2.020, - & 2.028, 2.035, 2.042, 2.049, 2.057, 2.064, 2.071, 2.078, 2.086, - & 2.093, 2.100, 2.107, 2.114, 2.122, 2.129, 2.136, 2.143, 2.150, - & 2.157, 2.164, 2.171, 2.178, 2.185, 2.192, 2.199, 2.206, 2.213, - & 2.220, 2.227, 2.234, 2.241, 2.247, 2.254, 2.261, 2.268, 2.275, - & 2.282, 2.288, 2.295, 2.302, 2.309, 2.315, 2.322, 2.329, 2.336, - & 2.342, 2.349, 2.356, 2.362, 2.369, 2.376, 2.382, 2.389, 2.395, - & 2.402, 2.408, 2.415, 2.421, 2.428, 2.434, 2.441, 2.447, 2.454, - & 2.460, 2.467, 2.473, 2.480, 2.486, 2.492, 2.499, 2.505, 2.512, - & 2.518, 2.524, 2.531, 2.537, 2.543, 2.549, 2.556, 2.562, 2.568, - & 2.574, 2.581, 2.587, 2.593, 2.599, 2.605, 2.612, 2.618, 2.624, - & 2.630, 2.636, 2.642, 2.648, 2.654, 2.660, 2.666, 2.672, 2.679, - & 2.685, 2.691, 2.697, 2.703, 2.709, 2.714, 2.720, 2.726, 2.732, - & 2.738, 2.744, 2.750, 2.756, 2.762, 2.768, 2.774, 2.779, 2.785, - & 2.791, 2.797, 2.803, 2.808, 2.814, 2.820, 2.826, 2.832, 2.837, - & 2.843, 2.849, 2.854, 2.860, 2.921, 2.976, 3.031, 3.084, 3.137, - & 3.189, 3.240, 3.290, 3.339, 3.387, 3.435, 3.482, 3.528, 3.574, - & 3.619, 3.663, 3.706, 3.749, 3.792, 3.833, 3.874, 3.915, 3.955, - & 3.994, 4.033, 4.072, 4.109, 4.147, 4.184, 4.220, 4.256, 4.291, - & 4.327, 4.361, 4.395, 4.429, 4.462, 4.495, 4.528, 4.560, 4.592, - & 4.623, 4.654, 4.685, 4.716, 4.746, 4.775, 4.805, 4.834, 4.862, - & 4.891, 4.919, 4.947, 4.974, 5.001, 5.028, 5.055, 5.081, 5.107, - & 5.133, 5.159, 5.184, 5.209, 5.234, 5.259, 5.283, 5.307, 5.331, - & 5.355, 5.378, 5.401, 5.424, 5.447, 5.469, 5.492, 5.514, 5.536, - & 5.557, 5.579, 5.600, 5.621, 5.642, 5.663, 5.684, 5.704, 5.724, - & 5.744, 5.764, 5.784, 5.803, 5.823, 5.842, 5.861, 5.880, 5.898, - & 5.917, 5.935, 5.953, 5.972, 5.989, 6.007, 6.025, 6.042, 6.060, - & 6.077, 6.094, 6.111, 6.128, 6.144, 6.161, 6.177, 6.194, 6.210, - & 6.226, 6.242, 6.257, 6.273, 6.289, 6.304, 6.319, 6.334, 6.350, - & 6.365, 6.379, 6.394, 6.409, 6.423, 6.438, 6.452, 6.466, 6.480, - & 6.494, 6.508, 6.522, 6.536, 6.549, 6.563, 6.576, 6.589, 6.602, - & 6.616, 6.629, 6.641, 6.654, 6.667, 6.680, 6.692, 6.705, 6.717, - & 6.729, 6.742, 6.754, 6.766, 6.778, 6.790, 6.801, 6.813, 6.825, - & 6.836, 6.848, 6.859 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.049,-0.101,-0.125,-0.140,-0.151,-0.159,-0.166,-0.171,-0.175, - &-0.178,-0.181,-0.183,-0.184,-0.185,-0.186,-0.186,-0.186,-0.186, - &-0.186,-0.185,-0.184,-0.183,-0.181,-0.180,-0.178,-0.176,-0.174, - &-0.172,-0.170,-0.167,-0.165,-0.162,-0.159,-0.156,-0.153,-0.150, - &-0.147,-0.144,-0.140,-0.137,-0.133,-0.130,-0.126,-0.122,-0.118, - &-0.114,-0.110,-0.106,-0.102,-0.098,-0.094,-0.090,-0.085,-0.081, - &-0.076,-0.072,-0.068,-0.063,-0.058,-0.054,-0.049,-0.044,-0.040, - &-0.035,-0.030,-0.025,-0.020,-0.015,-0.010,-0.005, 0.000, 0.005, - & 0.010, 0.015, 0.020, 0.026, 0.031, 0.036, 0.042, 0.047, 0.052, - & 0.058, 0.063, 0.069, 0.075, 0.080, 0.086, 0.092, 0.097, 0.103, - & 0.109, 0.115, 0.121, 0.127, 0.133, 0.139, 0.145, 0.151, 0.157, - & 0.163, 0.169, 0.175, 0.181, 0.188, 0.194, 0.200, 0.206, 0.213, - & 0.219, 0.225, 0.232, 0.238, 0.244, 0.251, 0.257, 0.264, 0.270, - & 0.276, 0.283, 0.289, 0.296, 0.302, 0.308, 0.315, 0.321, 0.328, - & 0.334, 0.341, 0.347, 0.353, 0.360, 0.366, 0.373, 0.379, 0.385, - & 0.392, 0.398, 0.404, 0.411, 0.417, 0.423, 0.430, 0.436, 0.442, - & 0.448, 0.455, 0.461, 0.467, 0.473, 0.480, 0.486, 0.492, 0.498, - & 0.504, 0.510, 0.517, 0.523, 0.529, 0.535, 0.541, 0.547, 0.553, - & 0.559, 0.565, 0.571, 0.577, 0.583, 0.589, 0.595, 0.601, 0.607, - & 0.613, 0.619, 0.625, 0.631, 0.637, 0.642, 0.648, 0.654, 0.660, - & 0.666, 0.671, 0.677, 0.683, 0.689, 0.694, 0.700, 0.706, 0.712, - & 0.717, 0.723, 0.729, 0.734, 0.740, 0.746, 0.751, 0.757, 0.762, - & 0.768, 0.773, 0.779, 0.785, 0.790, 0.796, 0.801, 0.807, 0.812, - & 0.817, 0.823, 0.828, 0.834, 0.839, 0.845, 0.850, 0.855, 0.861, - & 0.866, 0.871, 0.877, 0.882, 0.887, 0.893, 0.898, 0.903, 0.908, - & 0.914, 0.919, 0.924, 0.929, 0.934, 0.939, 0.945, 0.950, 0.955, - & 0.960, 0.965, 0.970, 0.975, 0.980, 0.986, 0.991, 0.996, 1.001, - & 1.006, 1.011, 1.016, 1.021, 1.026, 1.031, 1.036, 1.041, 1.046, - & 1.050, 1.055, 1.060, 1.065, 1.070, 1.075, 1.080, 1.085, 1.089, - & 1.094, 1.099, 1.104, 1.109, 1.114, 1.118, 1.123, 1.128, 1.133, - & 1.137, 1.142, 1.147, 1.151, 1.156, 1.161, 1.165, 1.170, 1.175, - & 1.179, 1.184, 1.189, 1.193, 1.198, 1.203, 1.207, 1.212, 1.216, - & 1.221, 1.225, 1.230, 1.234, 1.239, 1.243, 1.248, 1.252, 1.257, - & 1.261, 1.266, 1.270, 1.275, 1.279, 1.284, 1.288, 1.293, 1.297, - & 1.301, 1.306, 1.310, 1.314, 1.319, 1.323, 1.327, 1.332, 1.336, - & 1.340, 1.345, 1.349, 1.353, 1.358, 1.362, 1.366, 1.370, 1.375, - & 1.379, 1.383, 1.387, 1.391, 1.396, 1.400, 1.404, 1.408, 1.412, - & 1.417, 1.421, 1.425, 1.429, 1.433, 1.437, 1.441, 1.445, 1.450, - & 1.454, 1.458, 1.462, 1.466, 1.470, 1.474, 1.478, 1.482, 1.486, - & 1.490, 1.494, 1.498, 1.502, 1.506, 1.510, 1.514, 1.518, 1.522, - & 1.526, 1.530, 1.534, 1.538, 1.542, 1.546, 1.549, 1.553, 1.557, - & 1.561, 1.565, 1.569, 1.573, 1.577, 1.580, 1.584, 1.588, 1.592, - & 1.596, 1.600, 1.603, 1.607, 1.611, 1.615, 1.618, 1.622, 1.626, - & 1.630, 1.633, 1.637, 1.641, 1.645, 1.648, 1.652, 1.656, 1.660, - & 1.663, 1.667, 1.671, 1.674, 1.714, 1.749, 1.784, 1.819, 1.853, - & 1.886, 1.919, 1.951, 1.982, 2.014, 2.044, 2.074, 2.104, 2.133, - & 2.162, 2.190, 2.218, 2.246, 2.273, 2.300, 2.326, 2.352, 2.377, - & 2.403, 2.427, 2.452, 2.476, 2.500, 2.523, 2.547, 2.569, 2.592, - & 2.614, 2.636, 2.658, 2.679, 2.700, 2.721, 2.742, 2.762, 2.782, - & 2.802, 2.822, 2.841, 2.860, 2.879, 2.898, 2.916, 2.934, 2.952, - & 2.970, 2.988, 3.005, 3.022, 3.039, 3.056, 3.073, 3.089, 3.105, - & 3.121, 3.137, 3.153, 3.168, 3.184, 3.199, 3.214, 3.229, 3.244, - & 3.258, 3.273, 3.287, 3.301, 3.315, 3.329, 3.342, 3.356, 3.369, - & 3.382, 3.395, 3.408, 3.421, 3.434, 3.446, 3.459, 3.471, 3.483, - & 3.496, 3.507, 3.519, 3.531, 3.543, 3.554, 3.566, 3.577, 3.588, - & 3.599, 3.610, 3.621, 3.632, 3.642, 3.653, 3.663, 3.674, 3.684, - & 3.694, 3.704, 3.714, 3.724, 3.734, 3.743, 3.753, 3.762, 3.772, - & 3.781, 3.790, 3.800, 3.809, 3.818, 3.826, 3.835, 3.844, 3.853, - & 3.861, 3.870, 3.878, 3.887, 3.895, 3.903, 3.911, 3.919, 3.927, - & 3.935, 3.943, 3.951, 3.959, 3.966, 3.974, 3.981, 3.989, 3.996, - & 4.004, 4.011, 4.018, 4.025, 4.032, 4.039, 4.046, 4.053, 4.060, - & 4.067, 4.073, 4.080, 4.087, 4.093, 4.100, 4.106, 4.113, 4.119, - & 4.125, 4.131, 4.138 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.082,-0.178,-0.227,-0.261,-0.288,-0.311,-0.330,-0.347,-0.363, - &-0.377,-0.389,-0.401,-0.412,-0.422,-0.431,-0.440,-0.449,-0.457, - &-0.464,-0.471,-0.478,-0.485,-0.491,-0.497,-0.503,-0.508,-0.514, - &-0.519,-0.524,-0.529,-0.533,-0.538,-0.542,-0.546,-0.550,-0.554, - &-0.557,-0.561,-0.565,-0.568,-0.571,-0.574,-0.578,-0.581,-0.583, - &-0.586,-0.589,-0.592,-0.594,-0.597,-0.599,-0.602,-0.604,-0.606, - &-0.608,-0.610,-0.612,-0.614,-0.616,-0.618,-0.620,-0.622,-0.624, - &-0.625,-0.627,-0.629,-0.630,-0.632,-0.633,-0.635,-0.636,-0.637, - &-0.639,-0.640,-0.641,-0.643,-0.644,-0.645,-0.646,-0.647,-0.648, - &-0.649,-0.650,-0.651,-0.652,-0.653,-0.654,-0.655,-0.656,-0.657, - &-0.658,-0.658,-0.659,-0.660,-0.661,-0.661,-0.662,-0.663,-0.663, - &-0.664,-0.665,-0.665,-0.666,-0.666,-0.667,-0.667,-0.668,-0.668, - &-0.669,-0.669,-0.670,-0.670,-0.671,-0.671,-0.671,-0.672,-0.672, - &-0.673,-0.673,-0.673,-0.674,-0.674,-0.674,-0.675,-0.675,-0.675, - &-0.676,-0.676,-0.676,-0.676,-0.677,-0.677,-0.677,-0.677,-0.678, - &-0.678,-0.678,-0.679,-0.679,-0.679,-0.679,-0.679,-0.680,-0.680, - &-0.680,-0.680,-0.681,-0.681,-0.681,-0.681,-0.681,-0.682,-0.682, - &-0.682,-0.682,-0.682,-0.683,-0.683,-0.683,-0.683,-0.683,-0.684, - &-0.684,-0.684,-0.684,-0.684,-0.685,-0.685,-0.685,-0.685,-0.685, - &-0.686,-0.686,-0.686,-0.686,-0.686,-0.687,-0.687,-0.687,-0.687, - &-0.687,-0.687,-0.688,-0.688,-0.688,-0.688,-0.688,-0.689,-0.689, - &-0.689,-0.689,-0.689,-0.690,-0.690,-0.690,-0.690,-0.690,-0.691, - &-0.691,-0.691,-0.691,-0.691,-0.691,-0.692,-0.692,-0.692,-0.692, - &-0.692,-0.693,-0.693,-0.693,-0.693,-0.693,-0.694,-0.694,-0.694, - &-0.694,-0.694,-0.695,-0.695,-0.695,-0.695,-0.695,-0.696,-0.696, - &-0.696,-0.696,-0.696,-0.697,-0.697,-0.697,-0.697,-0.698,-0.698, - &-0.698,-0.698,-0.698,-0.699,-0.699,-0.699,-0.699,-0.699,-0.700, - &-0.700,-0.700,-0.700,-0.701,-0.701,-0.701,-0.701,-0.702,-0.702, - &-0.702,-0.702,-0.702,-0.703,-0.703,-0.703,-0.703,-0.704,-0.704, - &-0.704,-0.704,-0.705,-0.705,-0.705,-0.705,-0.706,-0.706,-0.706, - &-0.706,-0.706,-0.707,-0.707,-0.707,-0.707,-0.708,-0.708,-0.708, - &-0.708,-0.709,-0.709,-0.709,-0.710,-0.710,-0.710,-0.710,-0.711, - &-0.711,-0.711,-0.711,-0.712,-0.712,-0.712,-0.712,-0.713,-0.713, - &-0.713,-0.713,-0.714,-0.714,-0.714,-0.715,-0.715,-0.715,-0.715, - &-0.716,-0.716,-0.716,-0.716,-0.717,-0.717,-0.717,-0.718,-0.718, - &-0.718,-0.718,-0.719,-0.719,-0.719,-0.720,-0.720,-0.720,-0.720, - &-0.721,-0.721,-0.721,-0.722,-0.722,-0.722,-0.723,-0.723,-0.723, - &-0.723,-0.724,-0.724,-0.724,-0.725,-0.725,-0.725,-0.726,-0.726, - &-0.726,-0.727,-0.727,-0.727,-0.727,-0.728,-0.728,-0.728,-0.729, - &-0.729,-0.729,-0.730,-0.730,-0.730,-0.731,-0.731,-0.731,-0.732, - &-0.732,-0.732,-0.733,-0.733,-0.733,-0.733,-0.734,-0.734,-0.734, - &-0.735,-0.735,-0.735,-0.736,-0.736,-0.736,-0.737,-0.737,-0.737, - &-0.738,-0.738,-0.738,-0.739,-0.739,-0.740,-0.740,-0.740,-0.741, - &-0.741,-0.741,-0.742,-0.742,-0.742,-0.743,-0.743,-0.743,-0.744, - &-0.744,-0.744,-0.745,-0.745,-0.749,-0.753,-0.756,-0.760,-0.764, - &-0.768,-0.772,-0.776,-0.780,-0.784,-0.788,-0.793,-0.797,-0.801, - &-0.806,-0.810,-0.815,-0.820,-0.824,-0.829,-0.834,-0.839,-0.844, - &-0.848,-0.853,-0.858,-0.863,-0.869,-0.874,-0.879,-0.884,-0.889, - &-0.895,-0.900,-0.905,-0.911,-0.916,-0.922,-0.927,-0.933,-0.938, - &-0.944,-0.950,-0.955,-0.961,-0.967,-0.972,-0.978,-0.984,-0.990, - &-0.996,-1.002,-1.008,-1.014,-1.020,-1.026,-1.032,-1.038,-1.044, - &-1.050,-1.056,-1.062,-1.068,-1.075,-1.081,-1.087,-1.093,-1.100, - &-1.106,-1.112,-1.119,-1.125,-1.131,-1.138,-1.144,-1.151,-1.157, - &-1.164,-1.170,-1.177,-1.183,-1.190,-1.196,-1.203,-1.209,-1.216, - &-1.223,-1.229,-1.236,-1.243,-1.249,-1.256,-1.263,-1.270,-1.276, - &-1.283,-1.290,-1.297,-1.304,-1.310,-1.317,-1.324,-1.331,-1.338, - &-1.345,-1.352,-1.359,-1.365,-1.372,-1.379,-1.386,-1.393,-1.400, - &-1.407,-1.414,-1.421,-1.428,-1.435,-1.442,-1.450,-1.457,-1.464, - &-1.471,-1.478,-1.485,-1.492,-1.499,-1.506,-1.514,-1.521,-1.528, - &-1.535,-1.542,-1.549,-1.557,-1.564,-1.571,-1.578,-1.586,-1.593, - &-1.600,-1.607,-1.615,-1.622,-1.629,-1.636,-1.644,-1.651,-1.658, - &-1.666,-1.673,-1.680,-1.688,-1.695,-1.702,-1.710,-1.717,-1.725, - &-1.732,-1.739,-1.747 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.101,-0.216,-0.271,-0.308,-0.337,-0.360,-0.379,-0.396,-0.410, - &-0.422,-0.433,-0.443,-0.452,-0.460,-0.468,-0.475,-0.481,-0.487, - &-0.492,-0.497,-0.502,-0.506,-0.510,-0.514,-0.517,-0.520,-0.524, - &-0.526,-0.529,-0.532,-0.534,-0.537,-0.539,-0.541,-0.543,-0.545, - &-0.547,-0.549,-0.550,-0.552,-0.553,-0.555,-0.556,-0.558,-0.559, - &-0.560,-0.561,-0.563,-0.564,-0.565,-0.566,-0.567,-0.568,-0.569, - &-0.570,-0.571,-0.572,-0.572,-0.573,-0.574,-0.575,-0.576,-0.576, - &-0.577,-0.578,-0.578,-0.579,-0.580,-0.580,-0.581,-0.581,-0.582, - &-0.582,-0.583,-0.583,-0.584,-0.584,-0.585,-0.585,-0.585,-0.586, - &-0.586,-0.586,-0.586,-0.587,-0.587,-0.587,-0.587,-0.587,-0.587, - &-0.587,-0.588,-0.588,-0.588,-0.588,-0.588,-0.587,-0.587,-0.587, - &-0.587,-0.587,-0.587,-0.587,-0.587,-0.586,-0.586,-0.586,-0.586, - &-0.585,-0.585,-0.585,-0.585,-0.584,-0.584,-0.584,-0.583,-0.583, - &-0.583,-0.582,-0.582,-0.581,-0.581,-0.581,-0.580,-0.580,-0.579, - &-0.579,-0.579,-0.578,-0.578,-0.577,-0.577,-0.576,-0.576,-0.576, - &-0.575,-0.575,-0.574,-0.574,-0.573,-0.573,-0.572,-0.572,-0.571, - &-0.571,-0.570,-0.570,-0.570,-0.569,-0.569,-0.568,-0.568,-0.567, - &-0.567,-0.566,-0.566,-0.565,-0.565,-0.564,-0.564,-0.563,-0.563, - &-0.562,-0.562,-0.562,-0.561,-0.561,-0.560,-0.560,-0.559,-0.559, - &-0.558,-0.558,-0.557,-0.557,-0.556,-0.556,-0.555,-0.555,-0.554, - &-0.554,-0.554,-0.553,-0.553,-0.552,-0.552,-0.551,-0.551,-0.550, - &-0.550,-0.549,-0.549,-0.548,-0.548,-0.548,-0.547,-0.547,-0.546, - &-0.546,-0.545,-0.545,-0.544,-0.544,-0.544,-0.543,-0.543,-0.542, - &-0.542,-0.541,-0.541,-0.540,-0.540,-0.540,-0.539,-0.539,-0.538, - &-0.538,-0.537,-0.537,-0.537,-0.536,-0.536,-0.535,-0.535,-0.535, - &-0.534,-0.534,-0.533,-0.533,-0.533,-0.532,-0.532,-0.531,-0.531, - &-0.531,-0.530,-0.530,-0.529,-0.529,-0.529,-0.528,-0.528,-0.527, - &-0.527,-0.527,-0.526,-0.526,-0.525,-0.525,-0.525,-0.524,-0.524, - &-0.524,-0.523,-0.523,-0.523,-0.522,-0.522,-0.521,-0.521,-0.521, - &-0.520,-0.520,-0.520,-0.519,-0.519,-0.519,-0.518,-0.518,-0.518, - &-0.517,-0.517,-0.517,-0.516,-0.516,-0.516,-0.515,-0.515,-0.515, - &-0.514,-0.514,-0.514,-0.513,-0.513,-0.513,-0.512,-0.512,-0.512, - &-0.512,-0.511,-0.511,-0.511,-0.510,-0.510,-0.510,-0.509,-0.509, - &-0.509,-0.509,-0.508,-0.508,-0.508,-0.507,-0.507,-0.507,-0.507, - &-0.506,-0.506,-0.506,-0.506,-0.505,-0.505,-0.505,-0.504,-0.504, - &-0.504,-0.504,-0.503,-0.503,-0.503,-0.503,-0.502,-0.502,-0.502, - &-0.502,-0.501,-0.501,-0.501,-0.501,-0.501,-0.500,-0.500,-0.500, - &-0.500,-0.499,-0.499,-0.499,-0.499,-0.499,-0.498,-0.498,-0.498, - &-0.498,-0.497,-0.497,-0.497,-0.497,-0.497,-0.496,-0.496,-0.496, - &-0.496,-0.496,-0.495,-0.495,-0.495,-0.495,-0.495,-0.495,-0.494, - &-0.494,-0.494,-0.494,-0.494,-0.493,-0.493,-0.493,-0.493,-0.493, - &-0.493,-0.492,-0.492,-0.492,-0.492,-0.492,-0.492,-0.491,-0.491, - &-0.491,-0.491,-0.491,-0.491,-0.491,-0.490,-0.490,-0.490,-0.490, - &-0.490,-0.490,-0.490,-0.489,-0.489,-0.489,-0.489,-0.489,-0.489, - &-0.489,-0.489,-0.488,-0.488,-0.487,-0.486,-0.485,-0.485,-0.484, - &-0.484,-0.484,-0.484,-0.484,-0.484,-0.484,-0.485,-0.485,-0.486, - &-0.487,-0.488,-0.489,-0.490,-0.491,-0.492,-0.494,-0.495,-0.497, - &-0.499,-0.501,-0.503,-0.505,-0.507,-0.509,-0.511,-0.514,-0.516, - &-0.519,-0.522,-0.524,-0.527,-0.530,-0.533,-0.536,-0.539,-0.543, - &-0.546,-0.549,-0.553,-0.556,-0.560,-0.563,-0.567,-0.571,-0.575, - &-0.578,-0.582,-0.586,-0.590,-0.595,-0.599,-0.603,-0.607,-0.612, - &-0.616,-0.620,-0.625,-0.629,-0.634,-0.639,-0.643,-0.648,-0.653, - &-0.658,-0.663,-0.668,-0.673,-0.678,-0.683,-0.688,-0.693,-0.698, - &-0.703,-0.709,-0.714,-0.719,-0.725,-0.730,-0.736,-0.741,-0.747, - &-0.752,-0.758,-0.764,-0.769,-0.775,-0.781,-0.787,-0.792,-0.798, - &-0.804,-0.810,-0.816,-0.822,-0.828,-0.834,-0.840,-0.846,-0.853, - &-0.859,-0.865,-0.871,-0.877,-0.884,-0.890,-0.896,-0.903,-0.909, - &-0.916,-0.922,-0.929,-0.935,-0.942,-0.948,-0.955,-0.961,-0.968, - &-0.975,-0.981,-0.988,-0.995,-1.001,-1.008,-1.015,-1.022,-1.029, - &-1.036,-1.042,-1.049,-1.056,-1.063,-1.070,-1.077,-1.084,-1.091, - &-1.098,-1.105,-1.112,-1.119,-1.127,-1.134,-1.141,-1.148,-1.155, - &-1.162,-1.170,-1.177,-1.184,-1.191,-1.199,-1.206,-1.213,-1.221, - &-1.228,-1.235,-1.243 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.099,-0.205,-0.252,-0.282,-0.304,-0.320,-0.332,-0.342,-0.350, - &-0.356,-0.361,-0.364,-0.367,-0.369,-0.370,-0.371,-0.371,-0.371, - &-0.370,-0.370,-0.368,-0.367,-0.365,-0.363,-0.361,-0.358,-0.356, - &-0.353,-0.350,-0.347,-0.344,-0.341,-0.337,-0.334,-0.330,-0.327, - &-0.323,-0.320,-0.316,-0.312,-0.308,-0.305,-0.301,-0.297,-0.293, - &-0.289,-0.285,-0.281,-0.277,-0.273,-0.269,-0.265,-0.262,-0.258, - &-0.254,-0.250,-0.246,-0.242,-0.238,-0.234,-0.230,-0.226,-0.222, - &-0.218,-0.213,-0.209,-0.205,-0.201,-0.197,-0.193,-0.189,-0.185, - &-0.181,-0.176,-0.172,-0.168,-0.164,-0.160,-0.155,-0.151,-0.146, - &-0.142,-0.138,-0.133,-0.129,-0.124,-0.120,-0.115,-0.110,-0.106, - &-0.101,-0.096,-0.091,-0.086,-0.082,-0.077,-0.072,-0.067,-0.062, - &-0.057,-0.052,-0.047,-0.042,-0.036,-0.031,-0.026,-0.021,-0.016, - &-0.010,-0.005, 0.000, 0.005, 0.011, 0.016, 0.021, 0.027, 0.032, - & 0.037, 0.043, 0.048, 0.054, 0.059, 0.064, 0.070, 0.075, 0.081, - & 0.086, 0.092, 0.097, 0.102, 0.108, 0.113, 0.119, 0.124, 0.129, - & 0.135, 0.140, 0.146, 0.151, 0.156, 0.162, 0.167, 0.173, 0.178, - & 0.183, 0.189, 0.194, 0.199, 0.205, 0.210, 0.215, 0.221, 0.226, - & 0.231, 0.237, 0.242, 0.247, 0.252, 0.258, 0.263, 0.268, 0.273, - & 0.279, 0.284, 0.289, 0.294, 0.299, 0.305, 0.310, 0.315, 0.320, - & 0.325, 0.331, 0.336, 0.341, 0.346, 0.351, 0.356, 0.361, 0.366, - & 0.371, 0.377, 0.382, 0.387, 0.392, 0.397, 0.402, 0.407, 0.412, - & 0.417, 0.422, 0.427, 0.432, 0.437, 0.442, 0.447, 0.452, 0.457, - & 0.462, 0.467, 0.472, 0.476, 0.481, 0.486, 0.491, 0.496, 0.501, - & 0.506, 0.511, 0.515, 0.520, 0.525, 0.530, 0.535, 0.539, 0.544, - & 0.549, 0.554, 0.559, 0.563, 0.568, 0.573, 0.578, 0.582, 0.587, - & 0.592, 0.596, 0.601, 0.606, 0.610, 0.615, 0.620, 0.624, 0.629, - & 0.634, 0.638, 0.643, 0.647, 0.652, 0.657, 0.661, 0.666, 0.670, - & 0.675, 0.679, 0.684, 0.688, 0.693, 0.697, 0.702, 0.706, 0.711, - & 0.715, 0.720, 0.724, 0.729, 0.733, 0.737, 0.742, 0.746, 0.751, - & 0.755, 0.759, 0.764, 0.768, 0.773, 0.777, 0.781, 0.786, 0.790, - & 0.794, 0.798, 0.803, 0.807, 0.811, 0.816, 0.820, 0.824, 0.828, - & 0.833, 0.837, 0.841, 0.845, 0.849, 0.854, 0.858, 0.862, 0.866, - & 0.870, 0.874, 0.879, 0.883, 0.887, 0.891, 0.895, 0.899, 0.903, - & 0.907, 0.912, 0.916, 0.920, 0.924, 0.928, 0.932, 0.936, 0.940, - & 0.944, 0.948, 0.952, 0.956, 0.960, 0.964, 0.968, 0.972, 0.976, - & 0.980, 0.984, 0.988, 0.992, 0.995, 0.999, 1.003, 1.007, 1.011, - & 1.015, 1.019, 1.023, 1.026, 1.030, 1.034, 1.038, 1.042, 1.046, - & 1.049, 1.053, 1.057, 1.061, 1.065, 1.068, 1.072, 1.076, 1.080, - & 1.083, 1.087, 1.091, 1.095, 1.098, 1.102, 1.106, 1.109, 1.113, - & 1.117, 1.120, 1.124, 1.128, 1.131, 1.135, 1.139, 1.142, 1.146, - & 1.150, 1.153, 1.157, 1.160, 1.164, 1.168, 1.171, 1.175, 1.178, - & 1.182, 1.185, 1.189, 1.192, 1.196, 1.200, 1.203, 1.207, 1.210, - & 1.214, 1.217, 1.221, 1.224, 1.227, 1.231, 1.234, 1.238, 1.241, - & 1.245, 1.248, 1.252, 1.255, 1.258, 1.262, 1.265, 1.269, 1.272, - & 1.275, 1.279, 1.282, 1.285, 1.321, 1.354, 1.386, 1.417, 1.448, - & 1.478, 1.508, 1.537, 1.565, 1.593, 1.621, 1.648, 1.674, 1.700, - & 1.726, 1.751, 1.776, 1.800, 1.824, 1.848, 1.871, 1.893, 1.916, - & 1.938, 1.959, 1.980, 2.001, 2.022, 2.042, 2.061, 2.081, 2.100, - & 2.119, 2.137, 2.156, 2.173, 2.191, 2.208, 2.225, 2.242, 2.259, - & 2.275, 2.291, 2.307, 2.322, 2.337, 2.352, 2.367, 2.382, 2.396, - & 2.410, 2.424, 2.438, 2.451, 2.464, 2.477, 2.490, 2.502, 2.515, - & 2.527, 2.539, 2.551, 2.562, 2.574, 2.585, 2.596, 2.607, 2.618, - & 2.628, 2.639, 2.649, 2.659, 2.669, 2.679, 2.688, 2.698, 2.707, - & 2.716, 2.725, 2.734, 2.743, 2.751, 2.760, 2.768, 2.776, 2.784, - & 2.792, 2.800, 2.808, 2.815, 2.823, 2.830, 2.837, 2.844, 2.851, - & 2.858, 2.865, 2.871, 2.878, 2.884, 2.890, 2.896, 2.902, 2.908, - & 2.914, 2.920, 2.925, 2.931, 2.936, 2.942, 2.947, 2.952, 2.957, - & 2.962, 2.967, 2.972, 2.976, 2.981, 2.985, 2.990, 2.994, 2.998, - & 3.003, 3.007, 3.011, 3.014, 3.018, 3.022, 3.026, 3.029, 3.033, - & 3.036, 3.040, 3.043, 3.046, 3.049, 3.052, 3.055, 3.058, 3.061, - & 3.064, 3.066, 3.069, 3.072, 3.074, 3.077, 3.079, 3.081, 3.083, - & 3.086, 3.088, 3.090, 3.092, 3.094, 3.096, 3.097, 3.099, 3.101, - & 3.102, 3.104, 3.105 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.103,-0.226,-0.289,-0.334,-0.369,-0.399,-0.425,-0.448,-0.468, - &-0.487,-0.505,-0.521,-0.536,-0.550,-0.563,-0.576,-0.588,-0.599, - &-0.610,-0.621,-0.631,-0.641,-0.650,-0.659,-0.668,-0.677,-0.685, - &-0.693,-0.701,-0.709,-0.717,-0.724,-0.731,-0.738,-0.745,-0.752, - &-0.758,-0.765,-0.771,-0.777,-0.784,-0.790,-0.796,-0.801,-0.807, - &-0.813,-0.818,-0.824,-0.829,-0.835,-0.840,-0.845,-0.850,-0.855, - &-0.860,-0.865,-0.870,-0.875,-0.880,-0.884,-0.889,-0.894,-0.898, - &-0.903,-0.907,-0.912,-0.916,-0.920,-0.925,-0.929,-0.933,-0.937, - &-0.942,-0.946,-0.950,-0.954,-0.958,-0.962,-0.966,-0.970,-0.974, - &-0.978,-0.982,-0.985,-0.989,-0.993,-0.997,-1.001,-1.004,-1.008, - &-1.012,-1.016,-1.019,-1.023,-1.027,-1.030,-1.034,-1.037,-1.041, - &-1.045,-1.048,-1.052,-1.055,-1.059,-1.062,-1.066,-1.069,-1.072, - &-1.076,-1.079,-1.083,-1.086,-1.089,-1.093,-1.096,-1.099,-1.103, - &-1.106,-1.109,-1.113,-1.116,-1.119,-1.122,-1.126,-1.129,-1.132, - &-1.135,-1.138,-1.142,-1.145,-1.148,-1.151,-1.154,-1.157,-1.160, - &-1.164,-1.167,-1.170,-1.173,-1.176,-1.179,-1.182,-1.185,-1.188, - &-1.191,-1.194,-1.197,-1.200,-1.203,-1.206,-1.209,-1.212,-1.215, - &-1.218,-1.221,-1.223,-1.226,-1.229,-1.232,-1.235,-1.238,-1.241, - &-1.244,-1.246,-1.249,-1.252,-1.255,-1.258,-1.261,-1.263,-1.266, - &-1.269,-1.272,-1.274,-1.277,-1.280,-1.283,-1.285,-1.288,-1.291, - &-1.294,-1.296,-1.299,-1.302,-1.304,-1.307,-1.310,-1.313,-1.315, - &-1.318,-1.321,-1.323,-1.326,-1.328,-1.331,-1.334,-1.336,-1.339, - &-1.342,-1.344,-1.347,-1.349,-1.352,-1.355,-1.357,-1.360,-1.362, - &-1.365,-1.367,-1.370,-1.373,-1.375,-1.378,-1.380,-1.383,-1.385, - &-1.388,-1.390,-1.393,-1.395,-1.398,-1.400,-1.403,-1.405,-1.408, - &-1.410,-1.413,-1.415,-1.418,-1.420,-1.423,-1.425,-1.427,-1.430, - &-1.432,-1.435,-1.437,-1.440,-1.442,-1.445,-1.447,-1.449,-1.452, - &-1.454,-1.457,-1.459,-1.461,-1.464,-1.466,-1.469,-1.471,-1.473, - &-1.476,-1.478,-1.480,-1.483,-1.485,-1.487,-1.490,-1.492,-1.495, - &-1.497,-1.499,-1.502,-1.504,-1.506,-1.509,-1.511,-1.513,-1.515, - &-1.518,-1.520,-1.522,-1.525,-1.527,-1.529,-1.532,-1.534,-1.536, - &-1.538,-1.541,-1.543,-1.545,-1.548,-1.550,-1.552,-1.554,-1.557, - &-1.559,-1.561,-1.563,-1.566,-1.568,-1.570,-1.572,-1.575,-1.577, - &-1.579,-1.581,-1.583,-1.586,-1.588,-1.590,-1.592,-1.595,-1.597, - &-1.599,-1.601,-1.603,-1.606,-1.608,-1.610,-1.612,-1.614,-1.616, - &-1.619,-1.621,-1.623,-1.625,-1.627,-1.630,-1.632,-1.634,-1.636, - &-1.638,-1.640,-1.642,-1.645,-1.647,-1.649,-1.651,-1.653,-1.655, - &-1.658,-1.660,-1.662,-1.664,-1.666,-1.668,-1.670,-1.672,-1.675, - &-1.677,-1.679,-1.681,-1.683,-1.685,-1.687,-1.689,-1.691,-1.694, - &-1.696,-1.698,-1.700,-1.702,-1.704,-1.706,-1.708,-1.710,-1.712, - &-1.714,-1.717,-1.719,-1.721,-1.723,-1.725,-1.727,-1.729,-1.731, - &-1.733,-1.735,-1.737,-1.739,-1.741,-1.743,-1.745,-1.748,-1.750, - &-1.752,-1.754,-1.756,-1.758,-1.760,-1.762,-1.764,-1.766,-1.768, - &-1.770,-1.772,-1.774,-1.776,-1.778,-1.780,-1.782,-1.784,-1.786, - &-1.788,-1.790,-1.792,-1.794,-1.816,-1.836,-1.855,-1.875,-1.894, - &-1.914,-1.933,-1.952,-1.971,-1.989,-2.008,-2.027,-2.045,-2.063, - &-2.082,-2.100,-2.118,-2.136,-2.154,-2.171,-2.189,-2.207,-2.224, - &-2.242,-2.259,-2.276,-2.293,-2.311,-2.328,-2.345,-2.362,-2.379, - &-2.395,-2.412,-2.429,-2.446,-2.462,-2.479,-2.495,-2.512,-2.528, - &-2.544,-2.561,-2.577,-2.593,-2.609,-2.625,-2.642,-2.658,-2.674, - &-2.689,-2.705,-2.721,-2.737,-2.753,-2.768,-2.784,-2.800,-2.815, - &-2.831,-2.847,-2.862,-2.878,-2.893,-2.908,-2.924,-2.939,-2.954, - &-2.970,-2.985,-3.000,-3.015,-3.031,-3.046,-3.061,-3.076,-3.091, - &-3.106,-3.121,-3.136,-3.151,-3.166,-3.181,-3.196,-3.210,-3.225, - &-3.240,-3.255,-3.270,-3.284,-3.299,-3.314,-3.328,-3.343,-3.358, - &-3.372,-3.387,-3.401,-3.416,-3.430,-3.445,-3.459,-3.474,-3.488, - &-3.503,-3.517,-3.531,-3.546,-3.560,-3.574,-3.589,-3.603,-3.617, - &-3.631,-3.646,-3.660,-3.674,-3.688,-3.702,-3.717,-3.731,-3.745, - &-3.759,-3.773,-3.787,-3.801,-3.815,-3.829,-3.843,-3.857,-3.871, - &-3.885,-3.899,-3.913,-3.927,-3.941,-3.955,-3.969,-3.982,-3.996, - &-4.010,-4.024,-4.038,-4.051,-4.065,-4.079,-4.093,-4.107,-4.120, - &-4.134,-4.148,-4.161,-4.175,-4.189,-4.202,-4.216,-4.230,-4.243, - &-4.257,-4.271,-4.284 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.050,-0.106,-0.133,-0.152,-0.166,-0.177,-0.187,-0.195,-0.202, - &-0.208,-0.214,-0.218,-0.223,-0.227,-0.230,-0.233,-0.236,-0.238, - &-0.240,-0.242,-0.244,-0.246,-0.247,-0.248,-0.249,-0.250,-0.250, - &-0.250,-0.251,-0.251,-0.251,-0.251,-0.250,-0.250,-0.249,-0.249, - &-0.248,-0.247,-0.246,-0.245,-0.244,-0.242,-0.241,-0.240,-0.238, - &-0.236,-0.235,-0.233,-0.231,-0.229,-0.227,-0.225,-0.223,-0.221, - &-0.219,-0.216,-0.214,-0.212,-0.209,-0.207,-0.204,-0.202,-0.199, - &-0.196,-0.193,-0.191,-0.188,-0.185,-0.182,-0.179,-0.176,-0.173, - &-0.170,-0.167,-0.164,-0.161,-0.158,-0.154,-0.151,-0.148,-0.144, - &-0.141,-0.138,-0.134,-0.131,-0.127,-0.124,-0.120,-0.116,-0.113, - &-0.109,-0.105,-0.102,-0.098,-0.094,-0.090,-0.086,-0.082,-0.078, - &-0.074,-0.071,-0.067,-0.063,-0.059,-0.054,-0.050,-0.046,-0.042, - &-0.038,-0.034,-0.030,-0.026,-0.022,-0.017,-0.013,-0.009,-0.005, - &-0.001, 0.004, 0.008, 0.012, 0.016, 0.020, 0.025, 0.029, 0.033, - & 0.037, 0.041, 0.046, 0.050, 0.054, 0.058, 0.062, 0.067, 0.071, - & 0.075, 0.079, 0.083, 0.087, 0.091, 0.096, 0.100, 0.104, 0.108, - & 0.112, 0.116, 0.120, 0.124, 0.128, 0.132, 0.136, 0.141, 0.145, - & 0.149, 0.153, 0.157, 0.161, 0.165, 0.169, 0.173, 0.176, 0.180, - & 0.184, 0.188, 0.192, 0.196, 0.200, 0.204, 0.208, 0.212, 0.215, - & 0.219, 0.223, 0.227, 0.231, 0.235, 0.238, 0.242, 0.246, 0.250, - & 0.254, 0.257, 0.261, 0.265, 0.268, 0.272, 0.276, 0.280, 0.283, - & 0.287, 0.291, 0.294, 0.298, 0.302, 0.305, 0.309, 0.312, 0.316, - & 0.320, 0.323, 0.327, 0.330, 0.334, 0.337, 0.341, 0.344, 0.348, - & 0.351, 0.355, 0.358, 0.362, 0.365, 0.369, 0.372, 0.376, 0.379, - & 0.382, 0.386, 0.389, 0.393, 0.396, 0.399, 0.403, 0.406, 0.409, - & 0.413, 0.416, 0.419, 0.423, 0.426, 0.429, 0.433, 0.436, 0.439, - & 0.442, 0.446, 0.449, 0.452, 0.455, 0.459, 0.462, 0.465, 0.468, - & 0.471, 0.475, 0.478, 0.481, 0.484, 0.487, 0.490, 0.493, 0.497, - & 0.500, 0.503, 0.506, 0.509, 0.512, 0.515, 0.518, 0.521, 0.524, - & 0.527, 0.530, 0.533, 0.536, 0.539, 0.542, 0.545, 0.548, 0.551, - & 0.554, 0.557, 0.560, 0.563, 0.566, 0.569, 0.572, 0.575, 0.578, - & 0.581, 0.584, 0.587, 0.590, 0.592, 0.595, 0.598, 0.601, 0.604, - & 0.607, 0.610, 0.612, 0.615, 0.618, 0.621, 0.624, 0.627, 0.629, - & 0.632, 0.635, 0.638, 0.640, 0.643, 0.646, 0.649, 0.651, 0.654, - & 0.657, 0.660, 0.662, 0.665, 0.668, 0.671, 0.673, 0.676, 0.679, - & 0.681, 0.684, 0.687, 0.689, 0.692, 0.695, 0.697, 0.700, 0.702, - & 0.705, 0.708, 0.710, 0.713, 0.716, 0.718, 0.721, 0.723, 0.726, - & 0.728, 0.731, 0.734, 0.736, 0.739, 0.741, 0.744, 0.746, 0.749, - & 0.751, 0.754, 0.756, 0.759, 0.761, 0.764, 0.766, 0.769, 0.771, - & 0.774, 0.776, 0.779, 0.781, 0.784, 0.786, 0.788, 0.791, 0.793, - & 0.796, 0.798, 0.801, 0.803, 0.805, 0.808, 0.810, 0.813, 0.815, - & 0.817, 0.820, 0.822, 0.824, 0.827, 0.829, 0.832, 0.834, 0.836, - & 0.839, 0.841, 0.843, 0.846, 0.848, 0.850, 0.852, 0.855, 0.857, - & 0.859, 0.862, 0.864, 0.866, 0.868, 0.871, 0.873, 0.875, 0.878, - & 0.880, 0.882, 0.884, 0.887, 0.910, 0.932, 0.953, 0.974, 0.995, - & 1.015, 1.034, 1.054, 1.072, 1.091, 1.109, 1.127, 1.145, 1.162, - & 1.179, 1.196, 1.213, 1.229, 1.245, 1.260, 1.276, 1.291, 1.306, - & 1.320, 1.335, 1.349, 1.363, 1.377, 1.390, 1.404, 1.417, 1.430, - & 1.442, 1.455, 1.467, 1.479, 1.491, 1.503, 1.515, 1.526, 1.538, - & 1.549, 1.560, 1.570, 1.581, 1.592, 1.602, 1.612, 1.622, 1.632, - & 1.642, 1.652, 1.661, 1.671, 1.680, 1.689, 1.698, 1.707, 1.716, - & 1.724, 1.733, 1.741, 1.750, 1.758, 1.766, 1.774, 1.782, 1.789, - & 1.797, 1.805, 1.812, 1.820, 1.827, 1.834, 1.841, 1.848, 1.855, - & 1.862, 1.868, 1.875, 1.882, 1.888, 1.894, 1.901, 1.907, 1.913, - & 1.919, 1.925, 1.931, 1.937, 1.943, 1.948, 1.954, 1.959, 1.965, - & 1.970, 1.976, 1.981, 1.986, 1.991, 1.996, 2.001, 2.006, 2.011, - & 2.016, 2.020, 2.025, 2.030, 2.034, 2.039, 2.043, 2.048, 2.052, - & 2.056, 2.060, 2.064, 2.069, 2.073, 2.077, 2.080, 2.084, 2.088, - & 2.092, 2.096, 2.099, 2.103, 2.107, 2.110, 2.114, 2.117, 2.120, - & 2.124, 2.127, 2.130, 2.133, 2.137, 2.140, 2.143, 2.146, 2.149, - & 2.152, 2.155, 2.158, 2.160, 2.163, 2.166, 2.169, 2.171, 2.174, - & 2.176, 2.179, 2.181, 2.184, 2.186, 2.189, 2.191, 2.193, 2.196, - & 2.198, 2.200, 2.202 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.053,-0.124,-0.164,-0.194,-0.219,-0.242,-0.262,-0.281,-0.298, - &-0.314,-0.330,-0.345,-0.359,-0.372,-0.385,-0.398,-0.411,-0.423, - &-0.434,-0.446,-0.457,-0.468,-0.478,-0.489,-0.499,-0.509,-0.519, - &-0.528,-0.538,-0.547,-0.556,-0.565,-0.574,-0.583,-0.592,-0.600, - &-0.608,-0.617,-0.625,-0.633,-0.641,-0.648,-0.656,-0.664,-0.671, - &-0.678,-0.686,-0.693,-0.700,-0.707,-0.714,-0.721,-0.727,-0.734, - &-0.741,-0.747,-0.754,-0.760,-0.766,-0.773,-0.779,-0.785,-0.791, - &-0.797,-0.803,-0.809,-0.815,-0.821,-0.827,-0.832,-0.838,-0.844, - &-0.849,-0.855,-0.861,-0.866,-0.872,-0.877,-0.883,-0.888,-0.894, - &-0.899,-0.904,-0.910,-0.915,-0.920,-0.926,-0.931,-0.936,-0.942, - &-0.947,-0.952,-0.957,-0.963,-0.968,-0.973,-0.978,-0.983,-0.988, - &-0.994,-0.999,-1.004,-1.009,-1.014,-1.019,-1.024,-1.029,-1.034, - &-1.039,-1.044,-1.049,-1.054,-1.059,-1.064,-1.069,-1.074,-1.079, - &-1.083,-1.088,-1.093,-1.098,-1.103,-1.107,-1.112,-1.117,-1.122, - &-1.126,-1.131,-1.136,-1.140,-1.145,-1.149,-1.154,-1.158,-1.163, - &-1.168,-1.172,-1.176,-1.181,-1.185,-1.190,-1.194,-1.199,-1.203, - &-1.207,-1.212,-1.216,-1.220,-1.224,-1.229,-1.233,-1.237,-1.241, - &-1.245,-1.250,-1.254,-1.258,-1.262,-1.266,-1.270,-1.274,-1.278, - &-1.282,-1.286,-1.290,-1.294,-1.298,-1.302,-1.306,-1.310,-1.314, - &-1.318,-1.321,-1.325,-1.329,-1.333,-1.337,-1.341,-1.344,-1.348, - &-1.352,-1.355,-1.359,-1.363,-1.367,-1.370,-1.374,-1.378,-1.381, - &-1.385,-1.388,-1.392,-1.395,-1.399,-1.403,-1.406,-1.410,-1.413, - &-1.417,-1.420,-1.423,-1.427,-1.430,-1.434,-1.437,-1.441,-1.444, - &-1.447,-1.451,-1.454,-1.457,-1.461,-1.464,-1.467,-1.470,-1.474, - &-1.477,-1.480,-1.483,-1.487,-1.490,-1.493,-1.496,-1.499,-1.503, - &-1.506,-1.509,-1.512,-1.515,-1.518,-1.521,-1.524,-1.528,-1.531, - &-1.534,-1.537,-1.540,-1.543,-1.546,-1.549,-1.552,-1.555,-1.558, - &-1.561,-1.564,-1.566,-1.569,-1.572,-1.575,-1.578,-1.581,-1.584, - &-1.587,-1.590,-1.592,-1.595,-1.598,-1.601,-1.604,-1.607,-1.609, - &-1.612,-1.615,-1.618,-1.620,-1.623,-1.626,-1.629,-1.631,-1.634, - &-1.637,-1.639,-1.642,-1.645,-1.647,-1.650,-1.653,-1.655,-1.658, - &-1.661,-1.663,-1.666,-1.668,-1.671,-1.674,-1.676,-1.679,-1.681, - &-1.684,-1.686,-1.689,-1.691,-1.694,-1.696,-1.699,-1.701,-1.704, - &-1.706,-1.709,-1.711,-1.714,-1.716,-1.719,-1.721,-1.724,-1.726, - &-1.728,-1.731,-1.733,-1.736,-1.738,-1.740,-1.743,-1.745,-1.747, - &-1.750,-1.752,-1.754,-1.757,-1.759,-1.761,-1.764,-1.766,-1.768, - &-1.771,-1.773,-1.775,-1.777,-1.780,-1.782,-1.784,-1.786,-1.789, - &-1.791,-1.793,-1.795,-1.797,-1.800,-1.802,-1.804,-1.806,-1.808, - &-1.811,-1.813,-1.815,-1.817,-1.819,-1.821,-1.823,-1.826,-1.828, - &-1.830,-1.832,-1.834,-1.836,-1.838,-1.840,-1.842,-1.844,-1.847, - &-1.849,-1.851,-1.853,-1.855,-1.857,-1.859,-1.861,-1.863,-1.865, - &-1.867,-1.869,-1.871,-1.873,-1.875,-1.877,-1.879,-1.881,-1.883, - &-1.885,-1.887,-1.889,-1.891,-1.893,-1.895,-1.897,-1.898,-1.900, - &-1.902,-1.904,-1.906,-1.908,-1.910,-1.912,-1.914,-1.916,-1.917, - &-1.919,-1.921,-1.923,-1.925,-1.945,-1.963,-1.980,-1.997,-2.014, - &-2.030,-2.046,-2.062,-2.077,-2.092,-2.107,-2.122,-2.136,-2.150, - &-2.163,-2.177,-2.190,-2.203,-2.216,-2.228,-2.241,-2.253,-2.265, - &-2.277,-2.289,-2.300,-2.311,-2.323,-2.334,-2.345,-2.356,-2.366, - &-2.377,-2.387,-2.398,-2.408,-2.418,-2.428,-2.438,-2.448,-2.457, - &-2.467,-2.477,-2.486,-2.496,-2.505,-2.514,-2.523,-2.532,-2.541, - &-2.550,-2.559,-2.568,-2.577,-2.586,-2.594,-2.603,-2.611,-2.620, - &-2.628,-2.637,-2.645,-2.653,-2.662,-2.670,-2.678,-2.686,-2.694, - &-2.702,-2.710,-2.718,-2.726,-2.734,-2.742,-2.750,-2.758,-2.765, - &-2.773,-2.781,-2.789,-2.796,-2.804,-2.811,-2.819,-2.827,-2.834, - &-2.842,-2.849,-2.857,-2.864,-2.871,-2.879,-2.886,-2.893,-2.901, - &-2.908,-2.915,-2.923,-2.930,-2.937,-2.944,-2.951,-2.959,-2.966, - &-2.973,-2.980,-2.987,-2.994,-3.001,-3.008,-3.015,-3.022,-3.029, - &-3.036,-3.043,-3.050,-3.057,-3.064,-3.071,-3.078,-3.085,-3.092, - &-3.099,-3.106,-3.113,-3.119,-3.126,-3.133,-3.140,-3.147,-3.154, - &-3.160,-3.167,-3.174,-3.181,-3.187,-3.194,-3.201,-3.208,-3.214, - &-3.221,-3.228,-3.234,-3.241,-3.248,-3.254,-3.261,-3.268,-3.274, - &-3.281,-3.287,-3.294,-3.301,-3.307,-3.314,-3.320,-3.327,-3.334, - &-3.340,-3.347,-3.353 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.051,-0.108,-0.135,-0.154,-0.169,-0.180,-0.190,-0.198,-0.205, - &-0.211,-0.217,-0.222,-0.226,-0.231,-0.234,-0.238,-0.241,-0.244, - &-0.246,-0.249,-0.251,-0.253,-0.255,-0.257,-0.259,-0.261,-0.262, - &-0.264,-0.265,-0.267,-0.268,-0.269,-0.270,-0.271,-0.272,-0.273, - &-0.274,-0.275,-0.276,-0.277,-0.278,-0.278,-0.279,-0.280,-0.280, - &-0.281,-0.282,-0.282,-0.283,-0.283,-0.284,-0.285,-0.285,-0.286, - &-0.286,-0.287,-0.287,-0.287,-0.288,-0.288,-0.289,-0.289,-0.289, - &-0.290,-0.290,-0.291,-0.291,-0.291,-0.292,-0.292,-0.292,-0.292, - &-0.293,-0.293,-0.293,-0.293,-0.294,-0.294,-0.294,-0.294,-0.294, - &-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295, - &-0.295,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296, - &-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295, - &-0.295,-0.295,-0.294,-0.294,-0.294,-0.294,-0.294,-0.294,-0.294, - &-0.293,-0.293,-0.293,-0.293,-0.293,-0.293,-0.292,-0.292,-0.292, - &-0.292,-0.292,-0.291,-0.291,-0.291,-0.291,-0.291,-0.290,-0.290, - &-0.290,-0.290,-0.290,-0.289,-0.289,-0.289,-0.289,-0.289,-0.288, - &-0.288,-0.288,-0.288,-0.287,-0.287,-0.287,-0.287,-0.287,-0.286, - &-0.286,-0.286,-0.286,-0.285,-0.285,-0.285,-0.285,-0.285,-0.284, - &-0.284,-0.284,-0.284,-0.283,-0.283,-0.283,-0.283,-0.283,-0.282, - &-0.282,-0.282,-0.282,-0.281,-0.281,-0.281,-0.281,-0.281,-0.280, - &-0.280,-0.280,-0.280,-0.279,-0.279,-0.279,-0.279,-0.279,-0.278, - &-0.278,-0.278,-0.278,-0.278,-0.277,-0.277,-0.277,-0.277,-0.276, - &-0.276,-0.276,-0.276,-0.276,-0.275,-0.275,-0.275,-0.275,-0.275, - &-0.274,-0.274,-0.274,-0.274,-0.274,-0.273,-0.273,-0.273,-0.273, - &-0.273,-0.272,-0.272,-0.272,-0.272,-0.272,-0.271,-0.271,-0.271, - &-0.271,-0.271,-0.270,-0.270,-0.270,-0.270,-0.270,-0.270,-0.269, - &-0.269,-0.269,-0.269,-0.269,-0.268,-0.268,-0.268,-0.268,-0.268, - &-0.268,-0.267,-0.267,-0.267,-0.267,-0.267,-0.266,-0.266,-0.266, - &-0.266,-0.266,-0.266,-0.265,-0.265,-0.265,-0.265,-0.265,-0.265, - &-0.264,-0.264,-0.264,-0.264,-0.264,-0.264,-0.263,-0.263,-0.263, - &-0.263,-0.263,-0.263,-0.263,-0.262,-0.262,-0.262,-0.262,-0.262, - &-0.262,-0.261,-0.261,-0.261,-0.261,-0.261,-0.261,-0.261,-0.260, - &-0.260,-0.260,-0.260,-0.260,-0.260,-0.260,-0.260,-0.259,-0.259, - &-0.259,-0.259,-0.259,-0.259,-0.259,-0.258,-0.258,-0.258,-0.258, - &-0.258,-0.258,-0.258,-0.258,-0.257,-0.257,-0.257,-0.257,-0.257, - &-0.257,-0.257,-0.257,-0.257,-0.256,-0.256,-0.256,-0.256,-0.256, - &-0.256,-0.256,-0.256,-0.256,-0.255,-0.255,-0.255,-0.255,-0.255, - &-0.255,-0.255,-0.255,-0.255,-0.255,-0.254,-0.254,-0.254,-0.254, - &-0.254,-0.254,-0.254,-0.254,-0.254,-0.254,-0.253,-0.253,-0.253, - &-0.253,-0.253,-0.253,-0.253,-0.253,-0.253,-0.253,-0.253,-0.253, - &-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252, - &-0.252,-0.252,-0.252,-0.252,-0.252,-0.251,-0.251,-0.251,-0.251, - &-0.251,-0.251,-0.251,-0.251,-0.251,-0.251,-0.251,-0.251,-0.251, - &-0.251,-0.251,-0.251,-0.250,-0.250,-0.250,-0.250,-0.250,-0.250, - &-0.250,-0.250,-0.250,-0.250,-0.250,-0.249,-0.249,-0.249,-0.248, - &-0.248,-0.248,-0.248,-0.249,-0.249,-0.249,-0.249,-0.250,-0.250, - &-0.251,-0.251,-0.252,-0.252,-0.253,-0.254,-0.255,-0.255,-0.256, - &-0.257,-0.258,-0.259,-0.261,-0.262,-0.263,-0.264,-0.265,-0.267, - &-0.268,-0.269,-0.271,-0.272,-0.274,-0.276,-0.277,-0.279,-0.280, - &-0.282,-0.284,-0.286,-0.287,-0.289,-0.291,-0.293,-0.295,-0.297, - &-0.299,-0.301,-0.303,-0.305,-0.307,-0.309,-0.312,-0.314,-0.316, - &-0.318,-0.321,-0.323,-0.325,-0.328,-0.330,-0.332,-0.335,-0.337, - &-0.340,-0.342,-0.345,-0.347,-0.350,-0.352,-0.355,-0.358,-0.360, - &-0.363,-0.366,-0.368,-0.371,-0.374,-0.377,-0.379,-0.382,-0.385, - &-0.388,-0.391,-0.394,-0.396,-0.399,-0.402,-0.405,-0.408,-0.411, - &-0.414,-0.417,-0.420,-0.423,-0.426,-0.429,-0.432,-0.436,-0.439, - &-0.442,-0.445,-0.448,-0.451,-0.454,-0.458,-0.461,-0.464,-0.467, - &-0.471,-0.474,-0.477,-0.480,-0.484,-0.487,-0.490,-0.494,-0.497, - &-0.500,-0.504,-0.507,-0.511,-0.514,-0.517,-0.521,-0.524,-0.528, - &-0.531,-0.535,-0.538,-0.542,-0.545,-0.549,-0.552,-0.556,-0.559, - &-0.563,-0.566,-0.570,-0.574,-0.577,-0.581,-0.584,-0.588,-0.592, - &-0.595,-0.599,-0.603,-0.606,-0.610,-0.614,-0.617,-0.621,-0.625, - &-0.628,-0.632,-0.636 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.205,-0.445,-0.564,-0.649,-0.715,-0.770,-0.817,-0.858,-0.895, - &-0.928,-0.958,-0.986,-1.012,-1.036,-1.058,-1.079,-1.099,-1.118, - &-1.136,-1.153,-1.170,-1.185,-1.200,-1.215,-1.229,-1.242,-1.255, - &-1.268,-1.280,-1.292,-1.303,-1.315,-1.325,-1.336,-1.346,-1.357, - &-1.366,-1.376,-1.386,-1.395,-1.404,-1.413,-1.421,-1.430,-1.438, - &-1.447,-1.455,-1.463,-1.471,-1.478,-1.486,-1.494,-1.501,-1.508, - &-1.515,-1.523,-1.530,-1.536,-1.543,-1.550,-1.557,-1.563,-1.570, - &-1.576,-1.583,-1.589,-1.595,-1.601,-1.607,-1.613,-1.619,-1.625, - &-1.631,-1.637,-1.643,-1.648,-1.654,-1.659,-1.665,-1.670,-1.676, - &-1.681,-1.687,-1.692,-1.697,-1.702,-1.707,-1.713,-1.718,-1.723, - &-1.728,-1.733,-1.738,-1.742,-1.747,-1.752,-1.757,-1.762,-1.766, - &-1.771,-1.776,-1.780,-1.785,-1.789,-1.794,-1.798,-1.803,-1.807, - &-1.812,-1.816,-1.820,-1.825,-1.829,-1.833,-1.838,-1.842,-1.846, - &-1.850,-1.854,-1.858,-1.863,-1.867,-1.871,-1.875,-1.879,-1.883, - &-1.887,-1.891,-1.895,-1.899,-1.903,-1.907,-1.911,-1.915,-1.919, - &-1.922,-1.926,-1.930,-1.934,-1.938,-1.942,-1.945,-1.949,-1.953, - &-1.957,-1.960,-1.964,-1.968,-1.972,-1.975,-1.979,-1.983,-1.986, - &-1.990,-1.994,-1.997,-2.001,-2.004,-2.008,-2.012,-2.015,-2.019, - &-2.022,-2.026,-2.029,-2.033,-2.036,-2.040,-2.043,-2.047,-2.050, - &-2.054,-2.057,-2.061,-2.064,-2.068,-2.071,-2.074,-2.078,-2.081, - &-2.085,-2.088,-2.091,-2.095,-2.098,-2.102,-2.105,-2.108,-2.112, - &-2.115,-2.118,-2.122,-2.125,-2.128,-2.132,-2.135,-2.138,-2.141, - &-2.145,-2.148,-2.151,-2.154,-2.158,-2.161,-2.164,-2.167,-2.171, - &-2.174,-2.177,-2.180,-2.184,-2.187,-2.190,-2.193,-2.196,-2.200, - &-2.203,-2.206,-2.209,-2.212,-2.215,-2.219,-2.222,-2.225,-2.228, - &-2.231,-2.234,-2.237,-2.241,-2.244,-2.247,-2.250,-2.253,-2.256, - &-2.259,-2.262,-2.265,-2.269,-2.272,-2.275,-2.278,-2.281,-2.284, - &-2.287,-2.290,-2.293,-2.296,-2.299,-2.302,-2.305,-2.308,-2.311, - &-2.314,-2.317,-2.320,-2.324,-2.327,-2.330,-2.333,-2.336,-2.339, - &-2.342,-2.345,-2.348,-2.351,-2.354,-2.357,-2.360,-2.363,-2.366, - &-2.369,-2.371,-2.374,-2.377,-2.380,-2.383,-2.386,-2.389,-2.392, - &-2.395,-2.398,-2.401,-2.404,-2.407,-2.410,-2.413,-2.416,-2.419, - &-2.422,-2.425,-2.427,-2.430,-2.433,-2.436,-2.439,-2.442,-2.445, - &-2.448,-2.451,-2.454,-2.457,-2.460,-2.462,-2.465,-2.468,-2.471, - &-2.474,-2.477,-2.480,-2.483,-2.485,-2.488,-2.491,-2.494,-2.497, - &-2.500,-2.503,-2.506,-2.508,-2.511,-2.514,-2.517,-2.520,-2.523, - &-2.526,-2.528,-2.531,-2.534,-2.537,-2.540,-2.543,-2.546,-2.548, - &-2.551,-2.554,-2.557,-2.560,-2.563,-2.565,-2.568,-2.571,-2.574, - &-2.577,-2.579,-2.582,-2.585,-2.588,-2.591,-2.594,-2.596,-2.599, - &-2.602,-2.605,-2.608,-2.610,-2.613,-2.616,-2.619,-2.622,-2.624, - &-2.627,-2.630,-2.633,-2.635,-2.638,-2.641,-2.644,-2.647,-2.649, - &-2.652,-2.655,-2.658,-2.661,-2.663,-2.666,-2.669,-2.672,-2.674, - &-2.677,-2.680,-2.683,-2.685,-2.688,-2.691,-2.694,-2.696,-2.699, - &-2.702,-2.705,-2.707,-2.710,-2.713,-2.716,-2.718,-2.721,-2.724, - &-2.727,-2.729,-2.732,-2.735,-2.765,-2.792,-2.819,-2.846,-2.873, - &-2.900,-2.927,-2.953,-2.980,-3.006,-3.033,-3.059,-3.086,-3.112, - &-3.138,-3.164,-3.191,-3.217,-3.243,-3.269,-3.295,-3.321,-3.346, - &-3.372,-3.398,-3.424,-3.449,-3.475,-3.501,-3.526,-3.552,-3.578, - &-3.603,-3.629,-3.654,-3.679,-3.705,-3.730,-3.755,-3.781,-3.806, - &-3.831,-3.857,-3.882,-3.907,-3.932,-3.957,-3.982,-4.008,-4.033, - &-4.058,-4.083,-4.108,-4.133,-4.158,-4.183,-4.208,-4.233,-4.258, - &-4.282,-4.307,-4.332,-4.357,-4.382,-4.407,-4.431,-4.456,-4.481, - &-4.506,-4.530,-4.555,-4.580,-4.605,-4.629,-4.654,-4.679,-4.703, - &-4.728,-4.752,-4.777,-4.802,-4.826,-4.851,-4.875,-4.900,-4.924, - &-4.949,-4.973,-4.998,-5.022,-5.047,-5.071,-5.096,-5.120,-5.145, - &-5.169,-5.193,-5.218,-5.242,-5.267,-5.291,-5.315,-5.340,-5.364, - &-5.388,-5.413,-5.437,-5.461,-5.485,-5.510,-5.534,-5.558,-5.582, - &-5.607,-5.631,-5.655,-5.679,-5.703,-5.728,-5.752,-5.776,-5.800, - &-5.824,-5.848,-5.873,-5.897,-5.921,-5.945,-5.969,-5.993,-6.017, - &-6.041,-6.065,-6.089,-6.113,-6.137,-6.161,-6.186,-6.210,-6.234, - &-6.258,-6.282,-6.306,-6.329,-6.353,-6.377,-6.401,-6.425,-6.449, - &-6.473,-6.497,-6.521,-6.545,-6.569,-6.593,-6.617,-6.641,-6.664, - &-6.688,-6.712,-6.736 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.099,-0.205,-0.253,-0.283,-0.305,-0.322,-0.335,-0.345,-0.353, - &-0.359,-0.364,-0.368,-0.371,-0.374,-0.375,-0.376,-0.377,-0.377, - &-0.376,-0.376,-0.375,-0.373,-0.372,-0.370,-0.368,-0.366,-0.364, - &-0.361,-0.359,-0.356,-0.353,-0.350,-0.347,-0.344,-0.341,-0.338, - &-0.334,-0.331,-0.328,-0.324,-0.321,-0.317,-0.314,-0.310,-0.306, - &-0.303,-0.299,-0.295,-0.292,-0.288,-0.284,-0.281,-0.277,-0.273, - &-0.270,-0.266,-0.262,-0.258,-0.255,-0.251,-0.247,-0.243,-0.240, - &-0.236,-0.232,-0.228,-0.225,-0.221,-0.217,-0.213,-0.209,-0.205, - &-0.201,-0.197,-0.194,-0.190,-0.186,-0.182,-0.177,-0.173,-0.169, - &-0.165,-0.161,-0.157,-0.153,-0.148,-0.144,-0.140,-0.135,-0.131, - &-0.126,-0.122,-0.117,-0.113,-0.108,-0.104,-0.099,-0.094,-0.090, - &-0.085,-0.080,-0.075,-0.070,-0.066,-0.061,-0.056,-0.051,-0.046, - &-0.041,-0.036,-0.031,-0.026,-0.021,-0.016,-0.011,-0.006,-0.001, - & 0.004, 0.010, 0.015, 0.020, 0.025, 0.030, 0.035, 0.040, 0.045, - & 0.050, 0.056, 0.061, 0.066, 0.071, 0.076, 0.081, 0.086, 0.092, - & 0.097, 0.102, 0.107, 0.112, 0.117, 0.122, 0.127, 0.132, 0.137, - & 0.143, 0.148, 0.153, 0.158, 0.163, 0.168, 0.173, 0.178, 0.183, - & 0.188, 0.193, 0.198, 0.203, 0.208, 0.213, 0.218, 0.223, 0.228, - & 0.233, 0.238, 0.243, 0.248, 0.253, 0.258, 0.262, 0.267, 0.272, - & 0.277, 0.282, 0.287, 0.292, 0.297, 0.302, 0.306, 0.311, 0.316, - & 0.321, 0.326, 0.331, 0.335, 0.340, 0.345, 0.350, 0.354, 0.359, - & 0.364, 0.369, 0.373, 0.378, 0.383, 0.388, 0.392, 0.397, 0.402, - & 0.406, 0.411, 0.416, 0.420, 0.425, 0.430, 0.434, 0.439, 0.444, - & 0.448, 0.453, 0.457, 0.462, 0.466, 0.471, 0.476, 0.480, 0.485, - & 0.489, 0.494, 0.498, 0.503, 0.507, 0.512, 0.516, 0.521, 0.525, - & 0.530, 0.534, 0.538, 0.543, 0.547, 0.552, 0.556, 0.561, 0.565, - & 0.569, 0.574, 0.578, 0.582, 0.587, 0.591, 0.595, 0.600, 0.604, - & 0.608, 0.613, 0.617, 0.621, 0.625, 0.630, 0.634, 0.638, 0.642, - & 0.647, 0.651, 0.655, 0.659, 0.664, 0.668, 0.672, 0.676, 0.680, - & 0.684, 0.689, 0.693, 0.697, 0.701, 0.705, 0.709, 0.713, 0.717, - & 0.721, 0.726, 0.730, 0.734, 0.738, 0.742, 0.746, 0.750, 0.754, - & 0.758, 0.762, 0.766, 0.770, 0.774, 0.778, 0.782, 0.786, 0.790, - & 0.794, 0.798, 0.801, 0.805, 0.809, 0.813, 0.817, 0.821, 0.825, - & 0.829, 0.833, 0.836, 0.840, 0.844, 0.848, 0.852, 0.856, 0.859, - & 0.863, 0.867, 0.871, 0.875, 0.878, 0.882, 0.886, 0.890, 0.893, - & 0.897, 0.901, 0.905, 0.908, 0.912, 0.916, 0.919, 0.923, 0.927, - & 0.931, 0.934, 0.938, 0.941, 0.945, 0.949, 0.952, 0.956, 0.960, - & 0.963, 0.967, 0.970, 0.974, 0.978, 0.981, 0.985, 0.988, 0.992, - & 0.995, 0.999, 1.002, 1.006, 1.010, 1.013, 1.017, 1.020, 1.024, - & 1.027, 1.031, 1.034, 1.037, 1.041, 1.044, 1.048, 1.051, 1.055, - & 1.058, 1.061, 1.065, 1.068, 1.072, 1.075, 1.078, 1.082, 1.085, - & 1.089, 1.092, 1.095, 1.099, 1.102, 1.105, 1.109, 1.112, 1.115, - & 1.119, 1.122, 1.125, 1.128, 1.132, 1.135, 1.138, 1.142, 1.145, - & 1.148, 1.151, 1.155, 1.158, 1.161, 1.164, 1.167, 1.171, 1.174, - & 1.177, 1.180, 1.183, 1.187, 1.220, 1.251, 1.281, 1.311, 1.340, - & 1.369, 1.397, 1.424, 1.451, 1.477, 1.503, 1.529, 1.554, 1.579, - & 1.603, 1.627, 1.650, 1.673, 1.695, 1.717, 1.739, 1.760, 1.781, - & 1.802, 1.822, 1.842, 1.862, 1.881, 1.900, 1.918, 1.937, 1.955, - & 1.972, 1.990, 2.007, 2.024, 2.040, 2.056, 2.072, 2.088, 2.103, - & 2.119, 2.134, 2.148, 2.163, 2.177, 2.191, 2.205, 2.218, 2.231, - & 2.245, 2.257, 2.270, 2.283, 2.295, 2.307, 2.319, 2.330, 2.342, - & 2.353, 2.364, 2.375, 2.386, 2.397, 2.407, 2.417, 2.427, 2.437, - & 2.447, 2.456, 2.466, 2.475, 2.484, 2.493, 2.502, 2.511, 2.519, - & 2.528, 2.536, 2.544, 2.552, 2.560, 2.567, 2.575, 2.582, 2.590, - & 2.597, 2.604, 2.611, 2.618, 2.624, 2.631, 2.637, 2.644, 2.650, - & 2.656, 2.662, 2.668, 2.674, 2.680, 2.685, 2.691, 2.696, 2.701, - & 2.706, 2.712, 2.717, 2.721, 2.726, 2.731, 2.735, 2.740, 2.744, - & 2.749, 2.753, 2.757, 2.761, 2.765, 2.769, 2.773, 2.777, 2.780, - & 2.784, 2.787, 2.791, 2.794, 2.797, 2.801, 2.804, 2.807, 2.810, - & 2.812, 2.815, 2.818, 2.821, 2.823, 2.826, 2.828, 2.831, 2.833, - & 2.835, 2.837, 2.839, 2.841, 2.843, 2.845, 2.847, 2.849, 2.851, - & 2.852, 2.854, 2.856, 2.857, 2.859, 2.860, 2.861, 2.862, 2.864, - & 2.865, 2.866, 2.867 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.098,-0.202,-0.247,-0.275,-0.294,-0.308,-0.319,-0.327,-0.333, - &-0.337,-0.340,-0.342,-0.343,-0.343,-0.343,-0.341,-0.340,-0.338, - &-0.336,-0.333,-0.330,-0.326,-0.323,-0.319,-0.315,-0.311,-0.306, - &-0.302,-0.297,-0.293,-0.288,-0.283,-0.278,-0.273,-0.267,-0.262, - &-0.257,-0.251,-0.246,-0.241,-0.235,-0.230,-0.224,-0.218,-0.213, - &-0.207,-0.202,-0.196,-0.190,-0.185,-0.179,-0.174,-0.168,-0.162, - &-0.157,-0.151,-0.145,-0.140,-0.134,-0.128,-0.123,-0.117,-0.111, - &-0.106,-0.100,-0.094,-0.089,-0.083,-0.077,-0.071,-0.066,-0.060, - &-0.054,-0.048,-0.042,-0.037,-0.031,-0.025,-0.019,-0.013,-0.007, - &-0.001, 0.006, 0.012, 0.018, 0.024, 0.030, 0.037, 0.043, 0.049, - & 0.056, 0.062, 0.069, 0.075, 0.082, 0.089, 0.095, 0.102, 0.109, - & 0.116, 0.122, 0.129, 0.136, 0.143, 0.150, 0.157, 0.164, 0.171, - & 0.178, 0.185, 0.192, 0.199, 0.207, 0.214, 0.221, 0.228, 0.235, - & 0.242, 0.250, 0.257, 0.264, 0.271, 0.278, 0.286, 0.293, 0.300, - & 0.307, 0.315, 0.322, 0.329, 0.336, 0.344, 0.351, 0.358, 0.365, - & 0.372, 0.380, 0.387, 0.394, 0.401, 0.408, 0.416, 0.423, 0.430, - & 0.437, 0.444, 0.451, 0.458, 0.466, 0.473, 0.480, 0.487, 0.494, - & 0.501, 0.508, 0.515, 0.522, 0.529, 0.536, 0.543, 0.550, 0.557, - & 0.564, 0.571, 0.578, 0.585, 0.592, 0.599, 0.606, 0.613, 0.620, - & 0.626, 0.633, 0.640, 0.647, 0.654, 0.661, 0.667, 0.674, 0.681, - & 0.688, 0.695, 0.701, 0.708, 0.715, 0.722, 0.728, 0.735, 0.742, - & 0.748, 0.755, 0.762, 0.768, 0.775, 0.782, 0.788, 0.795, 0.801, - & 0.808, 0.815, 0.821, 0.828, 0.834, 0.841, 0.847, 0.854, 0.860, - & 0.867, 0.873, 0.879, 0.886, 0.892, 0.899, 0.905, 0.912, 0.918, - & 0.924, 0.931, 0.937, 0.943, 0.950, 0.956, 0.962, 0.968, 0.975, - & 0.981, 0.987, 0.993, 1.000, 1.006, 1.012, 1.018, 1.024, 1.031, - & 1.037, 1.043, 1.049, 1.055, 1.061, 1.067, 1.073, 1.080, 1.086, - & 1.092, 1.098, 1.104, 1.110, 1.116, 1.122, 1.128, 1.134, 1.140, - & 1.146, 1.151, 1.157, 1.163, 1.169, 1.175, 1.181, 1.187, 1.193, - & 1.199, 1.204, 1.210, 1.216, 1.222, 1.228, 1.233, 1.239, 1.245, - & 1.251, 1.256, 1.262, 1.268, 1.273, 1.279, 1.285, 1.291, 1.296, - & 1.302, 1.307, 1.313, 1.319, 1.324, 1.330, 1.335, 1.341, 1.347, - & 1.352, 1.358, 1.363, 1.369, 1.374, 1.380, 1.385, 1.391, 1.396, - & 1.402, 1.407, 1.412, 1.418, 1.423, 1.429, 1.434, 1.439, 1.445, - & 1.450, 1.455, 1.461, 1.466, 1.471, 1.477, 1.482, 1.487, 1.493, - & 1.498, 1.503, 1.508, 1.514, 1.519, 1.524, 1.529, 1.534, 1.540, - & 1.545, 1.550, 1.555, 1.560, 1.565, 1.570, 1.576, 1.581, 1.586, - & 1.591, 1.596, 1.601, 1.606, 1.611, 1.616, 1.621, 1.626, 1.631, - & 1.636, 1.641, 1.646, 1.651, 1.656, 1.661, 1.666, 1.671, 1.676, - & 1.681, 1.686, 1.691, 1.695, 1.700, 1.705, 1.710, 1.715, 1.720, - & 1.725, 1.729, 1.734, 1.739, 1.744, 1.749, 1.753, 1.758, 1.763, - & 1.768, 1.772, 1.777, 1.782, 1.786, 1.791, 1.796, 1.801, 1.805, - & 1.810, 1.815, 1.819, 1.824, 1.829, 1.833, 1.838, 1.842, 1.847, - & 1.852, 1.856, 1.861, 1.865, 1.870, 1.874, 1.879, 1.883, 1.888, - & 1.892, 1.897, 1.902, 1.906, 1.954, 1.998, 2.040, 2.082, 2.124, - & 2.164, 2.204, 2.243, 2.282, 2.319, 2.356, 2.393, 2.429, 2.464, - & 2.499, 2.533, 2.567, 2.600, 2.632, 2.664, 2.695, 2.726, 2.757, - & 2.787, 2.816, 2.845, 2.874, 2.902, 2.930, 2.957, 2.984, 3.010, - & 3.036, 3.062, 3.087, 3.112, 3.137, 3.161, 3.185, 3.208, 3.232, - & 3.254, 3.277, 3.299, 3.321, 3.342, 3.364, 3.385, 3.405, 3.426, - & 3.446, 3.466, 3.485, 3.504, 3.523, 3.542, 3.561, 3.579, 3.597, - & 3.615, 3.632, 3.649, 3.666, 3.683, 3.700, 3.716, 3.732, 3.748, - & 3.764, 3.779, 3.795, 3.810, 3.825, 3.839, 3.854, 3.868, 3.882, - & 3.896, 3.910, 3.924, 3.937, 3.950, 3.964, 3.976, 3.989, 4.002, - & 4.014, 4.026, 4.039, 4.050, 4.062, 4.074, 4.085, 4.097, 4.108, - & 4.119, 4.130, 4.141, 4.151, 4.162, 4.172, 4.182, 4.192, 4.202, - & 4.212, 4.222, 4.231, 4.241, 4.250, 4.259, 4.268, 4.277, 4.286, - & 4.295, 4.304, 4.312, 4.321, 4.329, 4.337, 4.345, 4.353, 4.361, - & 4.369, 4.376, 4.384, 4.391, 4.399, 4.406, 4.413, 4.420, 4.427, - & 4.434, 4.441, 4.447, 4.454, 4.460, 4.467, 4.473, 4.479, 4.485, - & 4.491, 4.497, 4.503, 4.509, 4.515, 4.520, 4.526, 4.531, 4.537, - & 4.542, 4.547, 4.552, 4.557, 4.562, 4.567, 4.572, 4.577, 4.582, - & 4.586, 4.591, 4.595 - & / - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM223 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 223K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM223 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC223/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF223 -C -C *** Common block definition -C - COMMON /KMC223/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.049,-0.101,-0.124,-0.140,-0.151,-0.159,-0.166,-0.171,-0.175, - &-0.178,-0.181,-0.183,-0.185,-0.187,-0.188,-0.188,-0.189,-0.189, - &-0.189,-0.189,-0.189,-0.189,-0.188,-0.187,-0.187,-0.186,-0.185, - &-0.184,-0.183,-0.182,-0.181,-0.180,-0.178,-0.177,-0.176,-0.174, - &-0.173,-0.172,-0.170,-0.169,-0.167,-0.166,-0.164,-0.163,-0.161, - &-0.159,-0.158,-0.156,-0.155,-0.153,-0.151,-0.150,-0.148,-0.147, - &-0.145,-0.143,-0.142,-0.140,-0.138,-0.137,-0.135,-0.134,-0.132, - &-0.130,-0.128,-0.127,-0.125,-0.123,-0.122,-0.120,-0.118,-0.117, - &-0.115,-0.113,-0.111,-0.110,-0.108,-0.106,-0.104,-0.102,-0.101, - &-0.099,-0.097,-0.095,-0.093,-0.091,-0.089,-0.087,-0.085,-0.083, - &-0.081,-0.079,-0.077,-0.075,-0.073,-0.071,-0.069,-0.067,-0.065, - &-0.063,-0.061,-0.058,-0.056,-0.054,-0.052,-0.050,-0.048,-0.045, - &-0.043,-0.041,-0.039,-0.036,-0.034,-0.032,-0.030,-0.027,-0.025, - &-0.023,-0.020,-0.018,-0.016,-0.014,-0.011,-0.009,-0.007,-0.004, - &-0.002, 0.000, 0.003, 0.005, 0.007, 0.010, 0.012, 0.014, 0.016, - & 0.019, 0.021, 0.023, 0.026, 0.028, 0.030, 0.033, 0.035, 0.037, - & 0.039, 0.042, 0.044, 0.046, 0.049, 0.051, 0.053, 0.055, 0.058, - & 0.060, 0.062, 0.064, 0.067, 0.069, 0.071, 0.073, 0.076, 0.078, - & 0.080, 0.082, 0.085, 0.087, 0.089, 0.091, 0.094, 0.096, 0.098, - & 0.100, 0.102, 0.105, 0.107, 0.109, 0.111, 0.113, 0.116, 0.118, - & 0.120, 0.122, 0.124, 0.126, 0.129, 0.131, 0.133, 0.135, 0.137, - & 0.139, 0.142, 0.144, 0.146, 0.148, 0.150, 0.152, 0.154, 0.157, - & 0.159, 0.161, 0.163, 0.165, 0.167, 0.169, 0.171, 0.173, 0.175, - & 0.178, 0.180, 0.182, 0.184, 0.186, 0.188, 0.190, 0.192, 0.194, - & 0.196, 0.198, 0.200, 0.202, 0.204, 0.206, 0.208, 0.211, 0.213, - & 0.215, 0.217, 0.219, 0.221, 0.223, 0.225, 0.227, 0.229, 0.231, - & 0.233, 0.235, 0.237, 0.239, 0.241, 0.243, 0.245, 0.246, 0.248, - & 0.250, 0.252, 0.254, 0.256, 0.258, 0.260, 0.262, 0.264, 0.266, - & 0.268, 0.270, 0.272, 0.274, 0.276, 0.277, 0.279, 0.281, 0.283, - & 0.285, 0.287, 0.289, 0.291, 0.293, 0.295, 0.296, 0.298, 0.300, - & 0.302, 0.304, 0.306, 0.308, 0.309, 0.311, 0.313, 0.315, 0.317, - & 0.319, 0.320, 0.322, 0.324, 0.326, 0.328, 0.330, 0.331, 0.333, - & 0.335, 0.337, 0.339, 0.340, 0.342, 0.344, 0.346, 0.348, 0.349, - & 0.351, 0.353, 0.355, 0.356, 0.358, 0.360, 0.362, 0.363, 0.365, - & 0.367, 0.369, 0.370, 0.372, 0.374, 0.376, 0.377, 0.379, 0.381, - & 0.383, 0.384, 0.386, 0.388, 0.389, 0.391, 0.393, 0.394, 0.396, - & 0.398, 0.400, 0.401, 0.403, 0.405, 0.406, 0.408, 0.410, 0.411, - & 0.413, 0.415, 0.416, 0.418, 0.420, 0.421, 0.423, 0.424, 0.426, - & 0.428, 0.429, 0.431, 0.433, 0.434, 0.436, 0.437, 0.439, 0.441, - & 0.442, 0.444, 0.446, 0.447, 0.449, 0.450, 0.452, 0.453, 0.455, - & 0.457, 0.458, 0.460, 0.461, 0.463, 0.464, 0.466, 0.468, 0.469, - & 0.471, 0.472, 0.474, 0.475, 0.477, 0.478, 0.480, 0.482, 0.483, - & 0.485, 0.486, 0.488, 0.489, 0.491, 0.492, 0.494, 0.495, 0.497, - & 0.498, 0.500, 0.501, 0.503, 0.504, 0.506, 0.507, 0.509, 0.510, - & 0.512, 0.513, 0.515, 0.516, 0.532, 0.546, 0.560, 0.574, 0.588, - & 0.601, 0.614, 0.627, 0.639, 0.652, 0.664, 0.676, 0.688, 0.700, - & 0.711, 0.722, 0.733, 0.744, 0.755, 0.765, 0.776, 0.786, 0.796, - & 0.806, 0.816, 0.825, 0.835, 0.844, 0.853, 0.862, 0.871, 0.880, - & 0.888, 0.897, 0.905, 0.913, 0.921, 0.929, 0.937, 0.945, 0.952, - & 0.960, 0.967, 0.975, 0.982, 0.989, 0.996, 1.003, 1.009, 1.016, - & 1.023, 1.029, 1.036, 1.042, 1.048, 1.054, 1.060, 1.066, 1.072, - & 1.078, 1.084, 1.089, 1.095, 1.100, 1.106, 1.111, 1.116, 1.121, - & 1.126, 1.131, 1.136, 1.141, 1.146, 1.151, 1.156, 1.160, 1.165, - & 1.169, 1.174, 1.178, 1.182, 1.187, 1.191, 1.195, 1.199, 1.203, - & 1.207, 1.211, 1.215, 1.219, 1.223, 1.226, 1.230, 1.234, 1.237, - & 1.241, 1.244, 1.247, 1.251, 1.254, 1.257, 1.261, 1.264, 1.267, - & 1.270, 1.273, 1.276, 1.279, 1.282, 1.285, 1.288, 1.291, 1.293, - & 1.296, 1.299, 1.301, 1.304, 1.306, 1.309, 1.311, 1.314, 1.316, - & 1.319, 1.321, 1.323, 1.326, 1.328, 1.330, 1.332, 1.334, 1.336, - & 1.339, 1.341, 1.343, 1.345, 1.347, 1.348, 1.350, 1.352, 1.354, - & 1.356, 1.358, 1.359, 1.361, 1.363, 1.364, 1.366, 1.368, 1.369, - & 1.371, 1.372, 1.374, 1.375, 1.377, 1.378, 1.379, 1.381, 1.382, - & 1.383, 1.385, 1.386 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.100,-0.220,-0.280,-0.323,-0.357,-0.385,-0.409,-0.431,-0.450, - &-0.468,-0.484,-0.499,-0.513,-0.526,-0.538,-0.549,-0.560,-0.571, - &-0.581,-0.590,-0.600,-0.608,-0.617,-0.625,-0.633,-0.641,-0.648, - &-0.655,-0.662,-0.669,-0.676,-0.682,-0.689,-0.695,-0.701,-0.707, - &-0.713,-0.718,-0.724,-0.729,-0.735,-0.740,-0.745,-0.750,-0.755, - &-0.760,-0.765,-0.769,-0.774,-0.779,-0.783,-0.788,-0.792,-0.796, - &-0.800,-0.805,-0.809,-0.813,-0.817,-0.821,-0.825,-0.829,-0.833, - &-0.836,-0.840,-0.844,-0.848,-0.851,-0.855,-0.858,-0.862,-0.866, - &-0.869,-0.873,-0.876,-0.879,-0.883,-0.886,-0.889,-0.893,-0.896, - &-0.899,-0.902,-0.906,-0.909,-0.912,-0.915,-0.918,-0.921,-0.924, - &-0.927,-0.930,-0.933,-0.936,-0.939,-0.942,-0.945,-0.948,-0.951, - &-0.954,-0.957,-0.960,-0.963,-0.966,-0.968,-0.971,-0.974,-0.977, - &-0.980,-0.982,-0.985,-0.988,-0.991,-0.993,-0.996,-0.999,-1.001, - &-1.004,-1.007,-1.009,-1.012,-1.015,-1.017,-1.020,-1.022,-1.025, - &-1.028,-1.030,-1.033,-1.035,-1.038,-1.040,-1.043,-1.045,-1.048, - &-1.050,-1.053,-1.055,-1.058,-1.060,-1.062,-1.065,-1.067,-1.070, - &-1.072,-1.074,-1.077,-1.079,-1.082,-1.084,-1.086,-1.089,-1.091, - &-1.093,-1.096,-1.098,-1.100,-1.102,-1.105,-1.107,-1.109,-1.112, - &-1.114,-1.116,-1.118,-1.121,-1.123,-1.125,-1.127,-1.129,-1.132, - &-1.134,-1.136,-1.138,-1.140,-1.143,-1.145,-1.147,-1.149,-1.151, - &-1.153,-1.155,-1.158,-1.160,-1.162,-1.164,-1.166,-1.168,-1.170, - &-1.172,-1.174,-1.177,-1.179,-1.181,-1.183,-1.185,-1.187,-1.189, - &-1.191,-1.193,-1.195,-1.197,-1.199,-1.201,-1.203,-1.205,-1.207, - &-1.209,-1.211,-1.213,-1.215,-1.217,-1.219,-1.221,-1.223,-1.225, - &-1.227,-1.229,-1.231,-1.233,-1.235,-1.237,-1.239,-1.241,-1.243, - &-1.245,-1.247,-1.248,-1.250,-1.252,-1.254,-1.256,-1.258,-1.260, - &-1.262,-1.264,-1.266,-1.268,-1.269,-1.271,-1.273,-1.275,-1.277, - &-1.279,-1.281,-1.283,-1.284,-1.286,-1.288,-1.290,-1.292,-1.294, - &-1.296,-1.297,-1.299,-1.301,-1.303,-1.305,-1.306,-1.308,-1.310, - &-1.312,-1.314,-1.316,-1.317,-1.319,-1.321,-1.323,-1.325,-1.326, - &-1.328,-1.330,-1.332,-1.333,-1.335,-1.337,-1.339,-1.341,-1.342, - &-1.344,-1.346,-1.348,-1.349,-1.351,-1.353,-1.355,-1.356,-1.358, - &-1.360,-1.362,-1.363,-1.365,-1.367,-1.369,-1.370,-1.372,-1.374, - &-1.375,-1.377,-1.379,-1.381,-1.382,-1.384,-1.386,-1.387,-1.389, - &-1.391,-1.393,-1.394,-1.396,-1.398,-1.399,-1.401,-1.403,-1.404, - &-1.406,-1.408,-1.409,-1.411,-1.413,-1.414,-1.416,-1.418,-1.419, - &-1.421,-1.423,-1.424,-1.426,-1.428,-1.429,-1.431,-1.433,-1.434, - &-1.436,-1.438,-1.439,-1.441,-1.442,-1.444,-1.446,-1.447,-1.449, - &-1.451,-1.452,-1.454,-1.456,-1.457,-1.459,-1.460,-1.462,-1.464, - &-1.465,-1.467,-1.468,-1.470,-1.472,-1.473,-1.475,-1.476,-1.478, - &-1.480,-1.481,-1.483,-1.484,-1.486,-1.488,-1.489,-1.491,-1.492, - &-1.494,-1.496,-1.497,-1.499,-1.500,-1.502,-1.503,-1.505,-1.507, - &-1.508,-1.510,-1.511,-1.513,-1.514,-1.516,-1.518,-1.519,-1.521, - &-1.522,-1.524,-1.525,-1.527,-1.528,-1.530,-1.531,-1.533,-1.535, - &-1.536,-1.538,-1.539,-1.541,-1.557,-1.572,-1.587,-1.602,-1.617, - &-1.632,-1.647,-1.661,-1.675,-1.690,-1.704,-1.718,-1.732,-1.746, - &-1.760,-1.774,-1.787,-1.801,-1.815,-1.828,-1.841,-1.855,-1.868, - &-1.881,-1.895,-1.908,-1.921,-1.934,-1.947,-1.960,-1.972,-1.985, - &-1.998,-2.011,-2.023,-2.036,-2.048,-2.061,-2.074,-2.086,-2.098, - &-2.111,-2.123,-2.135,-2.148,-2.160,-2.172,-2.184,-2.196,-2.208, - &-2.220,-2.232,-2.244,-2.256,-2.268,-2.280,-2.292,-2.304,-2.315, - &-2.327,-2.339,-2.351,-2.362,-2.374,-2.386,-2.397,-2.409,-2.420, - &-2.432,-2.443,-2.455,-2.466,-2.478,-2.489,-2.501,-2.512,-2.523, - &-2.535,-2.546,-2.557,-2.568,-2.580,-2.591,-2.602,-2.613,-2.625, - &-2.636,-2.647,-2.658,-2.669,-2.680,-2.691,-2.702,-2.713,-2.724, - &-2.735,-2.746,-2.757,-2.768,-2.779,-2.790,-2.801,-2.812,-2.823, - &-2.833,-2.844,-2.855,-2.866,-2.877,-2.888,-2.898,-2.909,-2.920, - &-2.930,-2.941,-2.952,-2.963,-2.973,-2.984,-2.995,-3.005,-3.016, - &-3.026,-3.037,-3.048,-3.058,-3.069,-3.079,-3.090,-3.100,-3.111, - &-3.121,-3.132,-3.142,-3.153,-3.163,-3.174,-3.184,-3.195,-3.205, - &-3.215,-3.226,-3.236,-3.247,-3.257,-3.267,-3.278,-3.288,-3.298, - &-3.309,-3.319,-3.329,-3.340,-3.350,-3.360,-3.370,-3.381,-3.391, - &-3.401,-3.411,-3.422 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.050,-0.111,-0.141,-0.164,-0.181,-0.196,-0.209,-0.220,-0.230, - &-0.239,-0.248,-0.256,-0.263,-0.270,-0.277,-0.283,-0.289,-0.295, - &-0.300,-0.306,-0.311,-0.316,-0.320,-0.325,-0.329,-0.334,-0.338, - &-0.342,-0.346,-0.350,-0.353,-0.357,-0.360,-0.364,-0.367,-0.371, - &-0.374,-0.377,-0.380,-0.384,-0.387,-0.390,-0.392,-0.395,-0.398, - &-0.401,-0.404,-0.406,-0.409,-0.412,-0.414,-0.417,-0.419,-0.422, - &-0.424,-0.427,-0.429,-0.432,-0.434,-0.436,-0.438,-0.441,-0.443, - &-0.445,-0.447,-0.449,-0.452,-0.454,-0.456,-0.458,-0.460,-0.462, - &-0.464,-0.466,-0.468,-0.470,-0.472,-0.474,-0.476,-0.478,-0.480, - &-0.482,-0.484,-0.485,-0.487,-0.489,-0.491,-0.493,-0.495,-0.496, - &-0.498,-0.500,-0.502,-0.504,-0.505,-0.507,-0.509,-0.511,-0.512, - &-0.514,-0.516,-0.518,-0.519,-0.521,-0.523,-0.524,-0.526,-0.528, - &-0.529,-0.531,-0.533,-0.534,-0.536,-0.538,-0.539,-0.541,-0.543, - &-0.544,-0.546,-0.547,-0.549,-0.551,-0.552,-0.554,-0.555,-0.557, - &-0.558,-0.560,-0.561,-0.563,-0.564,-0.566,-0.568,-0.569,-0.571, - &-0.572,-0.574,-0.575,-0.576,-0.578,-0.579,-0.581,-0.582,-0.584, - &-0.585,-0.587,-0.588,-0.590,-0.591,-0.592,-0.594,-0.595,-0.597, - &-0.598,-0.600,-0.601,-0.602,-0.604,-0.605,-0.606,-0.608,-0.609, - &-0.611,-0.612,-0.613,-0.615,-0.616,-0.617,-0.619,-0.620,-0.621, - &-0.623,-0.624,-0.625,-0.627,-0.628,-0.629,-0.631,-0.632,-0.633, - &-0.635,-0.636,-0.637,-0.638,-0.640,-0.641,-0.642,-0.643,-0.645, - &-0.646,-0.647,-0.649,-0.650,-0.651,-0.652,-0.654,-0.655,-0.656, - &-0.657,-0.659,-0.660,-0.661,-0.662,-0.663,-0.665,-0.666,-0.667, - &-0.668,-0.670,-0.671,-0.672,-0.673,-0.674,-0.676,-0.677,-0.678, - &-0.679,-0.680,-0.681,-0.683,-0.684,-0.685,-0.686,-0.687,-0.689, - &-0.690,-0.691,-0.692,-0.693,-0.694,-0.695,-0.697,-0.698,-0.699, - &-0.700,-0.701,-0.702,-0.703,-0.705,-0.706,-0.707,-0.708,-0.709, - &-0.710,-0.711,-0.712,-0.714,-0.715,-0.716,-0.717,-0.718,-0.719, - &-0.720,-0.721,-0.722,-0.724,-0.725,-0.726,-0.727,-0.728,-0.729, - &-0.730,-0.731,-0.732,-0.733,-0.734,-0.736,-0.737,-0.738,-0.739, - &-0.740,-0.741,-0.742,-0.743,-0.744,-0.745,-0.746,-0.747,-0.748, - &-0.749,-0.750,-0.751,-0.753,-0.754,-0.755,-0.756,-0.757,-0.758, - &-0.759,-0.760,-0.761,-0.762,-0.763,-0.764,-0.765,-0.766,-0.767, - &-0.768,-0.769,-0.770,-0.771,-0.772,-0.773,-0.774,-0.775,-0.776, - &-0.777,-0.778,-0.779,-0.780,-0.781,-0.782,-0.783,-0.784,-0.785, - &-0.786,-0.787,-0.788,-0.789,-0.790,-0.791,-0.792,-0.793,-0.794, - &-0.795,-0.796,-0.797,-0.798,-0.799,-0.800,-0.801,-0.802,-0.803, - &-0.804,-0.805,-0.806,-0.807,-0.808,-0.809,-0.810,-0.811,-0.812, - &-0.813,-0.814,-0.815,-0.816,-0.817,-0.818,-0.818,-0.819,-0.820, - &-0.821,-0.822,-0.823,-0.824,-0.825,-0.826,-0.827,-0.828,-0.829, - &-0.830,-0.831,-0.832,-0.833,-0.834,-0.835,-0.835,-0.836,-0.837, - &-0.838,-0.839,-0.840,-0.841,-0.842,-0.843,-0.844,-0.845,-0.846, - &-0.847,-0.848,-0.848,-0.849,-0.850,-0.851,-0.852,-0.853,-0.854, - &-0.855,-0.856,-0.857,-0.858,-0.859,-0.859,-0.860,-0.861,-0.862, - &-0.863,-0.864,-0.865,-0.866,-0.875,-0.884,-0.893,-0.902,-0.910, - &-0.919,-0.927,-0.936,-0.944,-0.952,-0.961,-0.969,-0.977,-0.985, - &-0.993,-1.001,-1.008,-1.016,-1.024,-1.032,-1.039,-1.047,-1.054, - &-1.062,-1.069,-1.077,-1.084,-1.092,-1.099,-1.106,-1.113,-1.121, - &-1.128,-1.135,-1.142,-1.149,-1.156,-1.163,-1.170,-1.177,-1.184, - &-1.191,-1.198,-1.204,-1.211,-1.218,-1.225,-1.231,-1.238,-1.245, - &-1.251,-1.258,-1.265,-1.271,-1.278,-1.284,-1.291,-1.297,-1.304, - &-1.310,-1.317,-1.323,-1.330,-1.336,-1.342,-1.349,-1.355,-1.361, - &-1.368,-1.374,-1.380,-1.386,-1.393,-1.399,-1.405,-1.411,-1.417, - &-1.423,-1.430,-1.436,-1.442,-1.448,-1.454,-1.460,-1.466,-1.472, - &-1.478,-1.484,-1.490,-1.496,-1.502,-1.508,-1.514,-1.520,-1.526, - &-1.532,-1.538,-1.543,-1.549,-1.555,-1.561,-1.567,-1.573,-1.578, - &-1.584,-1.590,-1.596,-1.602,-1.607,-1.613,-1.619,-1.625,-1.630, - &-1.636,-1.642,-1.648,-1.653,-1.659,-1.665,-1.670,-1.676,-1.682, - &-1.687,-1.693,-1.698,-1.704,-1.710,-1.715,-1.721,-1.726,-1.732, - &-1.738,-1.743,-1.749,-1.754,-1.760,-1.765,-1.771,-1.776,-1.782, - &-1.787,-1.793,-1.798,-1.804,-1.809,-1.815,-1.820,-1.826,-1.831, - &-1.837,-1.842,-1.847,-1.853,-1.858,-1.864,-1.869,-1.875,-1.880, - &-1.885,-1.891,-1.896 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.101,-0.220,-0.281,-0.324,-0.358,-0.387,-0.412,-0.434,-0.453, - &-0.471,-0.487,-0.503,-0.517,-0.530,-0.543,-0.555,-0.566,-0.577, - &-0.587,-0.597,-0.606,-0.615,-0.624,-0.632,-0.641,-0.649,-0.656, - &-0.664,-0.671,-0.678,-0.685,-0.692,-0.698,-0.705,-0.711,-0.717, - &-0.723,-0.729,-0.735,-0.740,-0.746,-0.752,-0.757,-0.762,-0.767, - &-0.772,-0.777,-0.782,-0.787,-0.792,-0.797,-0.801,-0.806,-0.810, - &-0.815,-0.819,-0.824,-0.828,-0.832,-0.836,-0.840,-0.844,-0.848, - &-0.852,-0.856,-0.860,-0.864,-0.868,-0.872,-0.876,-0.879,-0.883, - &-0.887,-0.890,-0.894,-0.897,-0.901,-0.904,-0.908,-0.911,-0.915, - &-0.918,-0.922,-0.925,-0.928,-0.932,-0.935,-0.938,-0.942,-0.945, - &-0.948,-0.951,-0.954,-0.958,-0.961,-0.964,-0.967,-0.970,-0.973, - &-0.976,-0.979,-0.982,-0.985,-0.988,-0.991,-0.994,-0.997,-1.000, - &-1.003,-1.006,-1.009,-1.012,-1.015,-1.018,-1.021,-1.024,-1.026, - &-1.029,-1.032,-1.035,-1.038,-1.040,-1.043,-1.046,-1.049,-1.051, - &-1.054,-1.057,-1.060,-1.062,-1.065,-1.068,-1.070,-1.073,-1.076, - &-1.078,-1.081,-1.083,-1.086,-1.089,-1.091,-1.094,-1.096,-1.099, - &-1.102,-1.104,-1.107,-1.109,-1.112,-1.114,-1.117,-1.119,-1.122, - &-1.124,-1.127,-1.129,-1.131,-1.134,-1.136,-1.139,-1.141,-1.144, - &-1.146,-1.148,-1.151,-1.153,-1.155,-1.158,-1.160,-1.163,-1.165, - &-1.167,-1.170,-1.172,-1.174,-1.177,-1.179,-1.181,-1.183,-1.186, - &-1.188,-1.190,-1.193,-1.195,-1.197,-1.199,-1.202,-1.204,-1.206, - &-1.208,-1.210,-1.213,-1.215,-1.217,-1.219,-1.221,-1.224,-1.226, - &-1.228,-1.230,-1.232,-1.235,-1.237,-1.239,-1.241,-1.243,-1.245, - &-1.247,-1.250,-1.252,-1.254,-1.256,-1.258,-1.260,-1.262,-1.264, - &-1.266,-1.269,-1.271,-1.273,-1.275,-1.277,-1.279,-1.281,-1.283, - &-1.285,-1.287,-1.289,-1.291,-1.293,-1.295,-1.297,-1.299,-1.301, - &-1.303,-1.305,-1.307,-1.309,-1.311,-1.313,-1.315,-1.317,-1.319, - &-1.321,-1.323,-1.325,-1.327,-1.329,-1.331,-1.333,-1.335,-1.337, - &-1.339,-1.341,-1.343,-1.345,-1.347,-1.349,-1.351,-1.353,-1.355, - &-1.357,-1.358,-1.360,-1.362,-1.364,-1.366,-1.368,-1.370,-1.372, - &-1.374,-1.376,-1.377,-1.379,-1.381,-1.383,-1.385,-1.387,-1.389, - &-1.391,-1.392,-1.394,-1.396,-1.398,-1.400,-1.402,-1.404,-1.405, - &-1.407,-1.409,-1.411,-1.413,-1.415,-1.417,-1.418,-1.420,-1.422, - &-1.424,-1.426,-1.427,-1.429,-1.431,-1.433,-1.435,-1.437,-1.438, - &-1.440,-1.442,-1.444,-1.445,-1.447,-1.449,-1.451,-1.453,-1.454, - &-1.456,-1.458,-1.460,-1.462,-1.463,-1.465,-1.467,-1.469,-1.470, - &-1.472,-1.474,-1.476,-1.477,-1.479,-1.481,-1.483,-1.484,-1.486, - &-1.488,-1.490,-1.491,-1.493,-1.495,-1.496,-1.498,-1.500,-1.502, - &-1.503,-1.505,-1.507,-1.509,-1.510,-1.512,-1.514,-1.515,-1.517, - &-1.519,-1.520,-1.522,-1.524,-1.526,-1.527,-1.529,-1.531,-1.532, - &-1.534,-1.536,-1.537,-1.539,-1.541,-1.542,-1.544,-1.546,-1.547, - &-1.549,-1.551,-1.552,-1.554,-1.556,-1.557,-1.559,-1.561,-1.562, - &-1.564,-1.566,-1.567,-1.569,-1.571,-1.572,-1.574,-1.576,-1.577, - &-1.579,-1.580,-1.582,-1.584,-1.585,-1.587,-1.589,-1.590,-1.592, - &-1.594,-1.595,-1.597,-1.598,-1.616,-1.632,-1.648,-1.663,-1.679, - &-1.694,-1.710,-1.725,-1.740,-1.755,-1.770,-1.785,-1.799,-1.814, - &-1.828,-1.843,-1.857,-1.871,-1.885,-1.900,-1.914,-1.928,-1.941, - &-1.955,-1.969,-1.983,-1.996,-2.010,-2.023,-2.037,-2.050,-2.063, - &-2.077,-2.090,-2.103,-2.116,-2.129,-2.142,-2.155,-2.168,-2.181, - &-2.194,-2.206,-2.219,-2.232,-2.244,-2.257,-2.269,-2.282,-2.294, - &-2.307,-2.319,-2.332,-2.344,-2.356,-2.369,-2.381,-2.393,-2.405, - &-2.417,-2.429,-2.441,-2.454,-2.466,-2.478,-2.489,-2.501,-2.513, - &-2.525,-2.537,-2.549,-2.561,-2.572,-2.584,-2.596,-2.608,-2.619, - &-2.631,-2.642,-2.654,-2.666,-2.677,-2.689,-2.700,-2.712,-2.723, - &-2.735,-2.746,-2.757,-2.769,-2.780,-2.792,-2.803,-2.814,-2.825, - &-2.837,-2.848,-2.859,-2.870,-2.882,-2.893,-2.904,-2.915,-2.926, - &-2.937,-2.948,-2.959,-2.971,-2.982,-2.993,-3.004,-3.015,-3.026, - &-3.037,-3.048,-3.058,-3.069,-3.080,-3.091,-3.102,-3.113,-3.124, - &-3.135,-3.145,-3.156,-3.167,-3.178,-3.189,-3.199,-3.210,-3.221, - &-3.232,-3.242,-3.253,-3.264,-3.274,-3.285,-3.296,-3.306,-3.317, - &-3.327,-3.338,-3.349,-3.359,-3.370,-3.380,-3.391,-3.401,-3.412, - &-3.422,-3.433,-3.443,-3.454,-3.464,-3.475,-3.485,-3.496,-3.506, - &-3.517,-3.527,-3.537 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.051,-0.114,-0.148,-0.172,-0.192,-0.209,-0.224,-0.238,-0.250, - &-0.262,-0.272,-0.282,-0.292,-0.301,-0.310,-0.318,-0.326,-0.333, - &-0.341,-0.348,-0.355,-0.362,-0.368,-0.375,-0.381,-0.387,-0.393, - &-0.398,-0.404,-0.410,-0.415,-0.420,-0.426,-0.431,-0.436,-0.441, - &-0.446,-0.450,-0.455,-0.460,-0.464,-0.469,-0.473,-0.477,-0.482, - &-0.486,-0.490,-0.494,-0.498,-0.502,-0.506,-0.510,-0.514,-0.518, - &-0.521,-0.525,-0.529,-0.532,-0.536,-0.539,-0.543,-0.546,-0.550, - &-0.553,-0.556,-0.560,-0.563,-0.566,-0.570,-0.573,-0.576,-0.579, - &-0.582,-0.585,-0.588,-0.592,-0.595,-0.598,-0.601,-0.604,-0.607, - &-0.610,-0.613,-0.616,-0.619,-0.622,-0.624,-0.627,-0.630,-0.633, - &-0.636,-0.639,-0.642,-0.645,-0.647,-0.650,-0.653,-0.656,-0.659, - &-0.662,-0.664,-0.667,-0.670,-0.673,-0.675,-0.678,-0.681,-0.684, - &-0.686,-0.689,-0.692,-0.694,-0.697,-0.700,-0.702,-0.705,-0.708, - &-0.710,-0.713,-0.716,-0.718,-0.721,-0.723,-0.726,-0.729,-0.731, - &-0.734,-0.736,-0.739,-0.741,-0.744,-0.746,-0.749,-0.751,-0.754, - &-0.756,-0.759,-0.761,-0.764,-0.766,-0.768,-0.771,-0.773,-0.776, - &-0.778,-0.780,-0.783,-0.785,-0.787,-0.790,-0.792,-0.794,-0.797, - &-0.799,-0.801,-0.804,-0.806,-0.808,-0.810,-0.813,-0.815,-0.817, - &-0.819,-0.822,-0.824,-0.826,-0.828,-0.831,-0.833,-0.835,-0.837, - &-0.839,-0.841,-0.844,-0.846,-0.848,-0.850,-0.852,-0.854,-0.856, - &-0.858,-0.860,-0.863,-0.865,-0.867,-0.869,-0.871,-0.873,-0.875, - &-0.877,-0.879,-0.881,-0.883,-0.885,-0.887,-0.889,-0.891,-0.893, - &-0.895,-0.897,-0.899,-0.901,-0.903,-0.905,-0.907,-0.909,-0.911, - &-0.913,-0.915,-0.917,-0.919,-0.920,-0.922,-0.924,-0.926,-0.928, - &-0.930,-0.932,-0.934,-0.936,-0.938,-0.939,-0.941,-0.943,-0.945, - &-0.947,-0.949,-0.950,-0.952,-0.954,-0.956,-0.958,-0.960,-0.961, - &-0.963,-0.965,-0.967,-0.969,-0.970,-0.972,-0.974,-0.976,-0.977, - &-0.979,-0.981,-0.983,-0.984,-0.986,-0.988,-0.990,-0.991,-0.993, - &-0.995,-0.997,-0.998,-1.000,-1.002,-1.003,-1.005,-1.007,-1.008, - &-1.010,-1.012,-1.013,-1.015,-1.017,-1.019,-1.020,-1.022,-1.023, - &-1.025,-1.027,-1.028,-1.030,-1.032,-1.033,-1.035,-1.037,-1.038, - &-1.040,-1.041,-1.043,-1.045,-1.046,-1.048,-1.049,-1.051,-1.053, - &-1.054,-1.056,-1.057,-1.059,-1.061,-1.062,-1.064,-1.065,-1.067, - &-1.068,-1.070,-1.071,-1.073,-1.075,-1.076,-1.078,-1.079,-1.081, - &-1.082,-1.084,-1.085,-1.087,-1.088,-1.090,-1.091,-1.093,-1.094, - &-1.096,-1.097,-1.099,-1.100,-1.102,-1.103,-1.105,-1.106,-1.108, - &-1.109,-1.111,-1.112,-1.114,-1.115,-1.116,-1.118,-1.119,-1.121, - &-1.122,-1.124,-1.125,-1.127,-1.128,-1.129,-1.131,-1.132,-1.134, - &-1.135,-1.137,-1.138,-1.139,-1.141,-1.142,-1.144,-1.145,-1.146, - &-1.148,-1.149,-1.151,-1.152,-1.153,-1.155,-1.156,-1.158,-1.159, - &-1.160,-1.162,-1.163,-1.164,-1.166,-1.167,-1.168,-1.170,-1.171, - &-1.173,-1.174,-1.175,-1.177,-1.178,-1.179,-1.181,-1.182,-1.183, - &-1.185,-1.186,-1.187,-1.189,-1.190,-1.191,-1.193,-1.194,-1.195, - &-1.197,-1.198,-1.199,-1.200,-1.202,-1.203,-1.204,-1.206,-1.207, - &-1.208,-1.210,-1.211,-1.212,-1.226,-1.238,-1.251,-1.263,-1.275, - &-1.287,-1.298,-1.310,-1.321,-1.333,-1.344,-1.355,-1.365,-1.376, - &-1.387,-1.397,-1.407,-1.417,-1.427,-1.437,-1.447,-1.457,-1.467, - &-1.476,-1.486,-1.495,-1.505,-1.514,-1.523,-1.532,-1.541,-1.550, - &-1.559,-1.567,-1.576,-1.585,-1.593,-1.602,-1.610,-1.619,-1.627, - &-1.635,-1.643,-1.651,-1.659,-1.667,-1.675,-1.683,-1.691,-1.699, - &-1.707,-1.715,-1.722,-1.730,-1.737,-1.745,-1.752,-1.760,-1.767, - &-1.775,-1.782,-1.789,-1.797,-1.804,-1.811,-1.818,-1.825,-1.832, - &-1.840,-1.847,-1.854,-1.861,-1.867,-1.874,-1.881,-1.888,-1.895, - &-1.902,-1.908,-1.915,-1.922,-1.929,-1.935,-1.942,-1.948,-1.955, - &-1.962,-1.968,-1.975,-1.981,-1.988,-1.994,-2.000,-2.007,-2.013, - &-2.020,-2.026,-2.032,-2.039,-2.045,-2.051,-2.057,-2.064,-2.070, - &-2.076,-2.082,-2.088,-2.094,-2.100,-2.107,-2.113,-2.119,-2.125, - &-2.131,-2.137,-2.143,-2.149,-2.155,-2.161,-2.167,-2.173,-2.179, - &-2.184,-2.190,-2.196,-2.202,-2.208,-2.214,-2.220,-2.225,-2.231, - &-2.237,-2.243,-2.248,-2.254,-2.260,-2.266,-2.271,-2.277,-2.283, - &-2.288,-2.294,-2.300,-2.305,-2.311,-2.317,-2.322,-2.328,-2.333, - &-2.339,-2.345,-2.350,-2.356,-2.361,-2.367,-2.372,-2.378,-2.383, - &-2.389,-2.394,-2.400 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.049,-0.106,-0.133,-0.151,-0.166,-0.177,-0.187,-0.195,-0.202, - &-0.208,-0.214,-0.219,-0.224,-0.228,-0.231,-0.235,-0.238,-0.241, - &-0.244,-0.246,-0.249,-0.251,-0.253,-0.255,-0.257,-0.259,-0.260, - &-0.262,-0.264,-0.265,-0.266,-0.268,-0.269,-0.270,-0.271,-0.272, - &-0.273,-0.274,-0.275,-0.276,-0.277,-0.278,-0.278,-0.279,-0.280, - &-0.281,-0.281,-0.282,-0.283,-0.283,-0.284,-0.284,-0.285,-0.285, - &-0.286,-0.287,-0.287,-0.288,-0.288,-0.288,-0.289,-0.289,-0.290, - &-0.290,-0.291,-0.291,-0.291,-0.292,-0.292,-0.292,-0.293,-0.293, - &-0.293,-0.294,-0.294,-0.294,-0.294,-0.295,-0.295,-0.295,-0.295, - &-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.297,-0.297,-0.297, - &-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297, - &-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297, - &-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297,-0.297, - &-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296,-0.296, - &-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.295,-0.294,-0.294, - &-0.294,-0.294,-0.294,-0.294,-0.294,-0.293,-0.293,-0.293,-0.293, - &-0.293,-0.293,-0.292,-0.292,-0.292,-0.292,-0.292,-0.292,-0.291, - &-0.291,-0.291,-0.291,-0.291,-0.291,-0.290,-0.290,-0.290,-0.290, - &-0.290,-0.290,-0.289,-0.289,-0.289,-0.289,-0.289,-0.288,-0.288, - &-0.288,-0.288,-0.288,-0.288,-0.287,-0.287,-0.287,-0.287,-0.287, - &-0.287,-0.286,-0.286,-0.286,-0.286,-0.286,-0.286,-0.285,-0.285, - &-0.285,-0.285,-0.285,-0.284,-0.284,-0.284,-0.284,-0.284,-0.284, - &-0.283,-0.283,-0.283,-0.283,-0.283,-0.283,-0.282,-0.282,-0.282, - &-0.282,-0.282,-0.282,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281, - &-0.280,-0.280,-0.280,-0.280,-0.280,-0.280,-0.279,-0.279,-0.279, - &-0.279,-0.279,-0.279,-0.278,-0.278,-0.278,-0.278,-0.278,-0.278, - &-0.277,-0.277,-0.277,-0.277,-0.277,-0.277,-0.276,-0.276,-0.276, - &-0.276,-0.276,-0.276,-0.276,-0.275,-0.275,-0.275,-0.275,-0.275, - &-0.275,-0.275,-0.274,-0.274,-0.274,-0.274,-0.274,-0.274,-0.273, - &-0.273,-0.273,-0.273,-0.273,-0.273,-0.273,-0.272,-0.272,-0.272, - &-0.272,-0.272,-0.272,-0.272,-0.271,-0.271,-0.271,-0.271,-0.271, - &-0.271,-0.271,-0.271,-0.270,-0.270,-0.270,-0.270,-0.270,-0.270, - &-0.270,-0.270,-0.269,-0.269,-0.269,-0.269,-0.269,-0.269,-0.269, - &-0.268,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268, - &-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.266, - &-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.265, - &-0.265,-0.265,-0.265,-0.265,-0.265,-0.265,-0.265,-0.265,-0.265, - &-0.264,-0.264,-0.264,-0.264,-0.264,-0.264,-0.264,-0.264,-0.264, - &-0.264,-0.263,-0.263,-0.263,-0.263,-0.263,-0.263,-0.263,-0.263, - &-0.263,-0.263,-0.263,-0.262,-0.262,-0.262,-0.262,-0.262,-0.262, - &-0.262,-0.262,-0.262,-0.262,-0.262,-0.262,-0.261,-0.261,-0.261, - &-0.261,-0.261,-0.261,-0.261,-0.261,-0.261,-0.261,-0.261,-0.261, - &-0.261,-0.260,-0.260,-0.260,-0.260,-0.260,-0.260,-0.260,-0.260, - &-0.260,-0.260,-0.260,-0.260,-0.260,-0.260,-0.259,-0.259,-0.259, - &-0.259,-0.259,-0.259,-0.259,-0.258,-0.258,-0.257,-0.257,-0.257, - &-0.256,-0.256,-0.256,-0.256,-0.256,-0.255,-0.255,-0.256,-0.256, - &-0.256,-0.256,-0.256,-0.256,-0.257,-0.257,-0.257,-0.258,-0.258, - &-0.259,-0.259,-0.260,-0.260,-0.261,-0.262,-0.262,-0.263,-0.264, - &-0.265,-0.265,-0.266,-0.267,-0.268,-0.269,-0.270,-0.271,-0.272, - &-0.273,-0.274,-0.275,-0.277,-0.278,-0.279,-0.280,-0.281,-0.283, - &-0.284,-0.285,-0.287,-0.288,-0.289,-0.291,-0.292,-0.294,-0.295, - &-0.297,-0.298,-0.300,-0.301,-0.303,-0.304,-0.306,-0.308,-0.309, - &-0.311,-0.313,-0.314,-0.316,-0.318,-0.320,-0.321,-0.323,-0.325, - &-0.327,-0.329,-0.331,-0.332,-0.334,-0.336,-0.338,-0.340,-0.342, - &-0.344,-0.346,-0.348,-0.350,-0.352,-0.354,-0.356,-0.358,-0.360, - &-0.362,-0.364,-0.367,-0.369,-0.371,-0.373,-0.375,-0.377,-0.379, - &-0.382,-0.384,-0.386,-0.388,-0.391,-0.393,-0.395,-0.397,-0.400, - &-0.402,-0.404,-0.406,-0.409,-0.411,-0.413,-0.416,-0.418,-0.421, - &-0.423,-0.425,-0.428,-0.430,-0.433,-0.435,-0.437,-0.440,-0.442, - &-0.445,-0.447,-0.450,-0.452,-0.455,-0.457,-0.460,-0.462,-0.465, - &-0.467,-0.470,-0.472,-0.475,-0.477,-0.480,-0.483,-0.485,-0.488, - &-0.490,-0.493,-0.496,-0.498,-0.501,-0.503,-0.506,-0.509,-0.511, - &-0.514,-0.517,-0.519 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.100,-0.219,-0.279,-0.321,-0.354,-0.382,-0.406,-0.427,-0.446, - &-0.463,-0.479,-0.493,-0.506,-0.519,-0.531,-0.542,-0.552,-0.562, - &-0.572,-0.581,-0.590,-0.598,-0.606,-0.614,-0.622,-0.629,-0.636, - &-0.643,-0.650,-0.656,-0.662,-0.668,-0.674,-0.680,-0.686,-0.692, - &-0.697,-0.702,-0.707,-0.713,-0.718,-0.722,-0.727,-0.732,-0.737, - &-0.741,-0.746,-0.750,-0.754,-0.759,-0.763,-0.767,-0.771,-0.775, - &-0.779,-0.783,-0.787,-0.791,-0.794,-0.798,-0.802,-0.805,-0.809, - &-0.813,-0.816,-0.820,-0.823,-0.826,-0.830,-0.833,-0.836,-0.840, - &-0.843,-0.846,-0.849,-0.852,-0.855,-0.859,-0.862,-0.865,-0.868, - &-0.871,-0.874,-0.877,-0.879,-0.882,-0.885,-0.888,-0.891,-0.894, - &-0.897,-0.899,-0.902,-0.905,-0.908,-0.910,-0.913,-0.916,-0.918, - &-0.921,-0.924,-0.926,-0.929,-0.932,-0.934,-0.937,-0.939,-0.942, - &-0.944,-0.947,-0.949,-0.952,-0.954,-0.957,-0.959,-0.962,-0.964, - &-0.967,-0.969,-0.971,-0.974,-0.976,-0.978,-0.981,-0.983,-0.985, - &-0.988,-0.990,-0.992,-0.995,-0.997,-0.999,-1.002,-1.004,-1.006, - &-1.008,-1.011,-1.013,-1.015,-1.017,-1.019,-1.022,-1.024,-1.026, - &-1.028,-1.030,-1.032,-1.034,-1.037,-1.039,-1.041,-1.043,-1.045, - &-1.047,-1.049,-1.051,-1.053,-1.056,-1.058,-1.060,-1.062,-1.064, - &-1.066,-1.068,-1.070,-1.072,-1.074,-1.076,-1.078,-1.080,-1.082, - &-1.084,-1.086,-1.088,-1.090,-1.092,-1.094,-1.096,-1.098,-1.099, - &-1.101,-1.103,-1.105,-1.107,-1.109,-1.111,-1.113,-1.115,-1.117, - &-1.119,-1.121,-1.122,-1.124,-1.126,-1.128,-1.130,-1.132,-1.134, - &-1.135,-1.137,-1.139,-1.141,-1.143,-1.145,-1.146,-1.148,-1.150, - &-1.152,-1.154,-1.156,-1.157,-1.159,-1.161,-1.163,-1.165,-1.166, - &-1.168,-1.170,-1.172,-1.173,-1.175,-1.177,-1.179,-1.180,-1.182, - &-1.184,-1.186,-1.187,-1.189,-1.191,-1.193,-1.194,-1.196,-1.198, - &-1.200,-1.201,-1.203,-1.205,-1.206,-1.208,-1.210,-1.212,-1.213, - &-1.215,-1.217,-1.218,-1.220,-1.222,-1.223,-1.225,-1.227,-1.228, - &-1.230,-1.232,-1.233,-1.235,-1.237,-1.238,-1.240,-1.242,-1.243, - &-1.245,-1.247,-1.248,-1.250,-1.251,-1.253,-1.255,-1.256,-1.258, - &-1.260,-1.261,-1.263,-1.264,-1.266,-1.268,-1.269,-1.271,-1.273, - &-1.274,-1.276,-1.277,-1.279,-1.280,-1.282,-1.284,-1.285,-1.287, - &-1.288,-1.290,-1.292,-1.293,-1.295,-1.296,-1.298,-1.299,-1.301, - &-1.303,-1.304,-1.306,-1.307,-1.309,-1.310,-1.312,-1.313,-1.315, - &-1.317,-1.318,-1.320,-1.321,-1.323,-1.324,-1.326,-1.327,-1.329, - &-1.330,-1.332,-1.333,-1.335,-1.337,-1.338,-1.340,-1.341,-1.343, - &-1.344,-1.346,-1.347,-1.349,-1.350,-1.352,-1.353,-1.355,-1.356, - &-1.358,-1.359,-1.361,-1.362,-1.364,-1.365,-1.367,-1.368,-1.370, - &-1.371,-1.373,-1.374,-1.376,-1.377,-1.379,-1.380,-1.381,-1.383, - &-1.384,-1.386,-1.387,-1.389,-1.390,-1.392,-1.393,-1.395,-1.396, - &-1.398,-1.399,-1.401,-1.402,-1.403,-1.405,-1.406,-1.408,-1.409, - &-1.411,-1.412,-1.414,-1.415,-1.416,-1.418,-1.419,-1.421,-1.422, - &-1.424,-1.425,-1.427,-1.428,-1.429,-1.431,-1.432,-1.434,-1.435, - &-1.437,-1.438,-1.439,-1.441,-1.442,-1.444,-1.445,-1.447,-1.448, - &-1.449,-1.451,-1.452,-1.454,-1.469,-1.483,-1.497,-1.510,-1.524, - &-1.537,-1.551,-1.564,-1.578,-1.591,-1.604,-1.617,-1.630,-1.643, - &-1.656,-1.669,-1.681,-1.694,-1.707,-1.719,-1.732,-1.744,-1.756, - &-1.769,-1.781,-1.793,-1.806,-1.818,-1.830,-1.842,-1.854,-1.866, - &-1.878,-1.890,-1.902,-1.914,-1.925,-1.937,-1.949,-1.961,-1.972, - &-1.984,-1.996,-2.007,-2.019,-2.030,-2.042,-2.053,-2.065,-2.076, - &-2.087,-2.099,-2.110,-2.121,-2.133,-2.144,-2.155,-2.166,-2.178, - &-2.189,-2.200,-2.211,-2.222,-2.233,-2.244,-2.255,-2.266,-2.277, - &-2.288,-2.299,-2.310,-2.321,-2.332,-2.343,-2.354,-2.365,-2.375, - &-2.386,-2.397,-2.408,-2.419,-2.429,-2.440,-2.451,-2.461,-2.472, - &-2.483,-2.494,-2.504,-2.515,-2.525,-2.536,-2.547,-2.557,-2.568, - &-2.578,-2.589,-2.599,-2.610,-2.620,-2.631,-2.641,-2.652,-2.662, - &-2.673,-2.683,-2.693,-2.704,-2.714,-2.725,-2.735,-2.745,-2.756, - &-2.766,-2.776,-2.787,-2.797,-2.807,-2.817,-2.828,-2.838,-2.848, - &-2.858,-2.869,-2.879,-2.889,-2.899,-2.909,-2.920,-2.930,-2.940, - &-2.950,-2.960,-2.970,-2.980,-2.991,-3.001,-3.011,-3.021,-3.031, - &-3.041,-3.051,-3.061,-3.071,-3.081,-3.091,-3.101,-3.111,-3.121, - &-3.131,-3.141,-3.151,-3.161,-3.171,-3.181,-3.191,-3.201,-3.211, - &-3.221,-3.231,-3.241 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.047,-0.091,-0.109,-0.119,-0.125,-0.128,-0.130,-0.131,-0.130, - &-0.129,-0.128,-0.125,-0.122,-0.119,-0.115,-0.111,-0.107,-0.102, - &-0.097,-0.092,-0.086,-0.080,-0.074,-0.068,-0.062,-0.055,-0.048, - &-0.041,-0.034,-0.027,-0.019,-0.012,-0.004, 0.004, 0.012, 0.020, - & 0.028, 0.037, 0.045, 0.054, 0.063, 0.071, 0.080, 0.089, 0.098, - & 0.108, 0.117, 0.126, 0.136, 0.145, 0.155, 0.164, 0.174, 0.184, - & 0.193, 0.203, 0.213, 0.223, 0.233, 0.243, 0.253, 0.263, 0.274, - & 0.284, 0.294, 0.304, 0.315, 0.325, 0.336, 0.346, 0.357, 0.368, - & 0.378, 0.389, 0.400, 0.411, 0.421, 0.432, 0.443, 0.455, 0.466, - & 0.477, 0.488, 0.499, 0.511, 0.522, 0.534, 0.545, 0.557, 0.568, - & 0.580, 0.592, 0.604, 0.615, 0.627, 0.639, 0.651, 0.664, 0.676, - & 0.688, 0.700, 0.712, 0.725, 0.737, 0.749, 0.762, 0.774, 0.787, - & 0.799, 0.812, 0.824, 0.837, 0.849, 0.862, 0.875, 0.887, 0.900, - & 0.913, 0.925, 0.938, 0.951, 0.963, 0.976, 0.989, 1.001, 1.014, - & 1.027, 1.039, 1.052, 1.064, 1.077, 1.090, 1.102, 1.115, 1.127, - & 1.140, 1.152, 1.165, 1.177, 1.190, 1.202, 1.215, 1.227, 1.239, - & 1.252, 1.264, 1.276, 1.289, 1.301, 1.313, 1.325, 1.338, 1.350, - & 1.362, 1.374, 1.386, 1.398, 1.410, 1.422, 1.434, 1.446, 1.458, - & 1.470, 1.482, 1.494, 1.506, 1.518, 1.530, 1.541, 1.553, 1.565, - & 1.577, 1.588, 1.600, 1.612, 1.623, 1.635, 1.646, 1.658, 1.669, - & 1.681, 1.692, 1.704, 1.715, 1.727, 1.738, 1.749, 1.761, 1.772, - & 1.783, 1.794, 1.806, 1.817, 1.828, 1.839, 1.850, 1.861, 1.872, - & 1.883, 1.894, 1.905, 1.916, 1.927, 1.938, 1.949, 1.960, 1.971, - & 1.982, 1.992, 2.003, 2.014, 2.025, 2.035, 2.046, 2.057, 2.067, - & 2.078, 2.088, 2.099, 2.109, 2.120, 2.130, 2.141, 2.151, 2.162, - & 2.172, 2.182, 2.193, 2.203, 2.213, 2.224, 2.234, 2.244, 2.254, - & 2.265, 2.275, 2.285, 2.295, 2.305, 2.315, 2.325, 2.335, 2.345, - & 2.355, 2.365, 2.375, 2.385, 2.395, 2.405, 2.415, 2.424, 2.434, - & 2.444, 2.454, 2.464, 2.473, 2.483, 2.493, 2.502, 2.512, 2.522, - & 2.531, 2.541, 2.550, 2.560, 2.569, 2.579, 2.588, 2.598, 2.607, - & 2.617, 2.626, 2.635, 2.645, 2.654, 2.663, 2.673, 2.682, 2.691, - & 2.701, 2.710, 2.719, 2.728, 2.737, 2.746, 2.756, 2.765, 2.774, - & 2.783, 2.792, 2.801, 2.810, 2.819, 2.828, 2.837, 2.846, 2.855, - & 2.864, 2.873, 2.881, 2.890, 2.899, 2.908, 2.917, 2.925, 2.934, - & 2.943, 2.952, 2.960, 2.969, 2.978, 2.986, 2.995, 3.004, 3.012, - & 3.021, 3.029, 3.038, 3.047, 3.055, 3.064, 3.072, 3.080, 3.089, - & 3.097, 3.106, 3.114, 3.123, 3.131, 3.139, 3.148, 3.156, 3.164, - & 3.173, 3.181, 3.189, 3.197, 3.206, 3.214, 3.222, 3.230, 3.238, - & 3.246, 3.255, 3.263, 3.271, 3.279, 3.287, 3.295, 3.303, 3.311, - & 3.319, 3.327, 3.335, 3.343, 3.351, 3.359, 3.367, 3.375, 3.383, - & 3.390, 3.398, 3.406, 3.414, 3.422, 3.430, 3.437, 3.445, 3.453, - & 3.461, 3.468, 3.476, 3.484, 3.492, 3.499, 3.507, 3.515, 3.522, - & 3.530, 3.537, 3.545, 3.553, 3.560, 3.568, 3.575, 3.583, 3.590, - & 3.598, 3.605, 3.613, 3.620, 3.628, 3.635, 3.642, 3.650, 3.657, - & 3.665, 3.672, 3.679, 3.687, 3.765, 3.837, 3.907, 3.976, 4.044, - & 4.111, 4.176, 4.241, 4.305, 4.368, 4.429, 4.490, 4.550, 4.609, - & 4.668, 4.725, 4.782, 4.838, 4.893, 4.947, 5.001, 5.054, 5.106, - & 5.157, 5.208, 5.259, 5.308, 5.357, 5.406, 5.453, 5.501, 5.547, - & 5.593, 5.639, 5.684, 5.729, 5.773, 5.816, 5.859, 5.902, 5.944, - & 5.986, 6.027, 6.068, 6.108, 6.148, 6.188, 6.227, 6.265, 6.304, - & 6.342, 6.379, 6.416, 6.453, 6.490, 6.526, 6.562, 6.597, 6.632, - & 6.667, 6.701, 6.735, 6.769, 6.803, 6.836, 6.869, 6.901, 6.934, - & 6.966, 6.997, 7.029, 7.060, 7.091, 7.122, 7.152, 7.182, 7.212, - & 7.242, 7.271, 7.300, 7.329, 7.358, 7.386, 7.415, 7.443, 7.470, - & 7.498, 7.525, 7.552, 7.579, 7.606, 7.633, 7.659, 7.685, 7.711, - & 7.737, 7.762, 7.788, 7.813, 7.838, 7.862, 7.887, 7.912, 7.936, - & 7.960, 7.984, 8.008, 8.031, 8.055, 8.078, 8.101, 8.124, 8.147, - & 8.169, 8.192, 8.214, 8.236, 8.258, 8.280, 8.302, 8.323, 8.345, - & 8.366, 8.387, 8.408, 8.429, 8.450, 8.470, 8.491, 8.511, 8.531, - & 8.552, 8.572, 8.591, 8.611, 8.631, 8.650, 8.670, 8.689, 8.708, - & 8.727, 8.746, 8.765, 8.783, 8.802, 8.820, 8.839, 8.857, 8.875, - & 8.893, 8.911, 8.929, 8.946, 8.964, 8.981, 8.999, 9.016, 9.033, - & 9.050, 9.067, 9.084 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.049,-0.104,-0.131,-0.149,-0.163,-0.174,-0.184,-0.192,-0.199, - &-0.205,-0.211,-0.216,-0.220,-0.224,-0.228,-0.231,-0.234,-0.236, - &-0.238,-0.240,-0.242,-0.244,-0.245,-0.247,-0.248,-0.248,-0.249, - &-0.250,-0.250,-0.250,-0.251,-0.251,-0.250,-0.250,-0.250,-0.249, - &-0.249,-0.248,-0.247,-0.247,-0.246,-0.245,-0.243,-0.242,-0.241, - &-0.240,-0.238,-0.237,-0.235,-0.233,-0.232,-0.230,-0.228,-0.226, - &-0.224,-0.222,-0.220,-0.218,-0.216,-0.214,-0.211,-0.209,-0.207, - &-0.204,-0.202,-0.199,-0.197,-0.194,-0.192,-0.189,-0.187,-0.184, - &-0.181,-0.178,-0.176,-0.173,-0.170,-0.167,-0.164,-0.161,-0.158, - &-0.155,-0.152,-0.149,-0.146,-0.142,-0.139,-0.136,-0.133,-0.129, - &-0.126,-0.123,-0.119,-0.116,-0.112,-0.109,-0.105,-0.102,-0.098, - &-0.095,-0.091,-0.088,-0.084,-0.080,-0.077,-0.073,-0.069,-0.066, - &-0.062,-0.058,-0.055,-0.051,-0.047,-0.043,-0.039,-0.036,-0.032, - &-0.028,-0.024,-0.020,-0.017,-0.013,-0.009,-0.005,-0.001, 0.002, - & 0.006, 0.010, 0.014, 0.018, 0.021, 0.025, 0.029, 0.033, 0.037, - & 0.040, 0.044, 0.048, 0.052, 0.055, 0.059, 0.063, 0.067, 0.070, - & 0.074, 0.078, 0.081, 0.085, 0.089, 0.093, 0.096, 0.100, 0.104, - & 0.107, 0.111, 0.114, 0.118, 0.122, 0.125, 0.129, 0.133, 0.136, - & 0.140, 0.143, 0.147, 0.150, 0.154, 0.157, 0.161, 0.165, 0.168, - & 0.172, 0.175, 0.178, 0.182, 0.185, 0.189, 0.192, 0.196, 0.199, - & 0.203, 0.206, 0.209, 0.213, 0.216, 0.220, 0.223, 0.226, 0.230, - & 0.233, 0.236, 0.240, 0.243, 0.246, 0.250, 0.253, 0.256, 0.259, - & 0.263, 0.266, 0.269, 0.272, 0.276, 0.279, 0.282, 0.285, 0.289, - & 0.292, 0.295, 0.298, 0.301, 0.304, 0.308, 0.311, 0.314, 0.317, - & 0.320, 0.323, 0.326, 0.329, 0.332, 0.336, 0.339, 0.342, 0.345, - & 0.348, 0.351, 0.354, 0.357, 0.360, 0.363, 0.366, 0.369, 0.372, - & 0.375, 0.378, 0.381, 0.384, 0.387, 0.390, 0.393, 0.395, 0.398, - & 0.401, 0.404, 0.407, 0.410, 0.413, 0.416, 0.419, 0.421, 0.424, - & 0.427, 0.430, 0.433, 0.436, 0.438, 0.441, 0.444, 0.447, 0.450, - & 0.452, 0.455, 0.458, 0.461, 0.464, 0.466, 0.469, 0.472, 0.475, - & 0.477, 0.480, 0.483, 0.485, 0.488, 0.491, 0.493, 0.496, 0.499, - & 0.501, 0.504, 0.507, 0.509, 0.512, 0.515, 0.517, 0.520, 0.523, - & 0.525, 0.528, 0.530, 0.533, 0.536, 0.538, 0.541, 0.543, 0.546, - & 0.548, 0.551, 0.554, 0.556, 0.559, 0.561, 0.564, 0.566, 0.569, - & 0.571, 0.574, 0.576, 0.579, 0.581, 0.584, 0.586, 0.589, 0.591, - & 0.594, 0.596, 0.598, 0.601, 0.603, 0.606, 0.608, 0.611, 0.613, - & 0.615, 0.618, 0.620, 0.623, 0.625, 0.627, 0.630, 0.632, 0.635, - & 0.637, 0.639, 0.642, 0.644, 0.646, 0.649, 0.651, 0.653, 0.656, - & 0.658, 0.660, 0.663, 0.665, 0.667, 0.670, 0.672, 0.674, 0.676, - & 0.679, 0.681, 0.683, 0.685, 0.688, 0.690, 0.692, 0.694, 0.697, - & 0.699, 0.701, 0.703, 0.706, 0.708, 0.710, 0.712, 0.714, 0.717, - & 0.719, 0.721, 0.723, 0.725, 0.728, 0.730, 0.732, 0.734, 0.736, - & 0.738, 0.741, 0.743, 0.745, 0.747, 0.749, 0.751, 0.753, 0.756, - & 0.758, 0.760, 0.762, 0.764, 0.766, 0.768, 0.770, 0.772, 0.774, - & 0.777, 0.779, 0.781, 0.783, 0.805, 0.825, 0.845, 0.864, 0.883, - & 0.901, 0.920, 0.938, 0.955, 0.973, 0.990, 1.006, 1.023, 1.039, - & 1.055, 1.071, 1.086, 1.101, 1.116, 1.131, 1.145, 1.160, 1.174, - & 1.188, 1.201, 1.215, 1.228, 1.241, 1.254, 1.266, 1.279, 1.291, - & 1.303, 1.315, 1.327, 1.339, 1.350, 1.361, 1.372, 1.383, 1.394, - & 1.405, 1.416, 1.426, 1.436, 1.446, 1.456, 1.466, 1.476, 1.486, - & 1.495, 1.505, 1.514, 1.523, 1.532, 1.541, 1.550, 1.559, 1.567, - & 1.576, 1.584, 1.592, 1.601, 1.609, 1.617, 1.625, 1.632, 1.640, - & 1.648, 1.655, 1.663, 1.670, 1.677, 1.684, 1.692, 1.699, 1.706, - & 1.712, 1.719, 1.726, 1.732, 1.739, 1.746, 1.752, 1.758, 1.765, - & 1.771, 1.777, 1.783, 1.789, 1.795, 1.801, 1.806, 1.812, 1.818, - & 1.823, 1.829, 1.834, 1.840, 1.845, 1.850, 1.856, 1.861, 1.866, - & 1.871, 1.876, 1.881, 1.886, 1.891, 1.896, 1.900, 1.905, 1.910, - & 1.914, 1.919, 1.923, 1.928, 1.932, 1.937, 1.941, 1.945, 1.949, - & 1.953, 1.958, 1.962, 1.966, 1.970, 1.974, 1.978, 1.981, 1.985, - & 1.989, 1.993, 1.996, 2.000, 2.004, 2.007, 2.011, 2.014, 2.018, - & 2.021, 2.025, 2.028, 2.031, 2.035, 2.038, 2.041, 2.044, 2.047, - & 2.050, 2.053, 2.056, 2.059, 2.062, 2.065, 2.068, 2.071, 2.074, - & 2.077, 2.080, 2.082 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.048,-0.100,-0.123,-0.137,-0.147,-0.155,-0.161,-0.165,-0.169, - &-0.172,-0.174,-0.175,-0.177,-0.177,-0.178,-0.178,-0.178,-0.177, - &-0.177,-0.176,-0.175,-0.174,-0.173,-0.172,-0.171,-0.169,-0.168, - &-0.166,-0.165,-0.163,-0.161,-0.159,-0.157,-0.156,-0.154,-0.152, - &-0.150,-0.148,-0.146,-0.144,-0.141,-0.139,-0.137,-0.135,-0.133, - &-0.131,-0.129,-0.127,-0.124,-0.122,-0.120,-0.118,-0.116,-0.113, - &-0.111,-0.109,-0.107,-0.105,-0.102,-0.100,-0.098,-0.096,-0.094, - &-0.091,-0.089,-0.087,-0.085,-0.082,-0.080,-0.078,-0.076,-0.073, - &-0.071,-0.069,-0.067,-0.064,-0.062,-0.060,-0.057,-0.055,-0.052, - &-0.050,-0.048,-0.045,-0.043,-0.040,-0.038,-0.035,-0.033,-0.030, - &-0.027,-0.025,-0.022,-0.020,-0.017,-0.014,-0.012,-0.009,-0.006, - &-0.004,-0.001, 0.002, 0.005, 0.007, 0.010, 0.013, 0.016, 0.019, - & 0.021, 0.024, 0.027, 0.030, 0.033, 0.036, 0.039, 0.041, 0.044, - & 0.047, 0.050, 0.053, 0.056, 0.059, 0.062, 0.065, 0.068, 0.071, - & 0.073, 0.076, 0.079, 0.082, 0.085, 0.088, 0.091, 0.094, 0.097, - & 0.100, 0.103, 0.105, 0.108, 0.111, 0.114, 0.117, 0.120, 0.123, - & 0.126, 0.129, 0.131, 0.134, 0.137, 0.140, 0.143, 0.146, 0.149, - & 0.152, 0.154, 0.157, 0.160, 0.163, 0.166, 0.169, 0.171, 0.174, - & 0.177, 0.180, 0.183, 0.186, 0.188, 0.191, 0.194, 0.197, 0.200, - & 0.202, 0.205, 0.208, 0.211, 0.213, 0.216, 0.219, 0.222, 0.224, - & 0.227, 0.230, 0.233, 0.235, 0.238, 0.241, 0.244, 0.246, 0.249, - & 0.252, 0.254, 0.257, 0.260, 0.263, 0.265, 0.268, 0.271, 0.273, - & 0.276, 0.279, 0.281, 0.284, 0.287, 0.289, 0.292, 0.294, 0.297, - & 0.300, 0.302, 0.305, 0.308, 0.310, 0.313, 0.315, 0.318, 0.321, - & 0.323, 0.326, 0.328, 0.331, 0.333, 0.336, 0.339, 0.341, 0.344, - & 0.346, 0.349, 0.351, 0.354, 0.356, 0.359, 0.361, 0.364, 0.366, - & 0.369, 0.372, 0.374, 0.376, 0.379, 0.381, 0.384, 0.386, 0.389, - & 0.391, 0.394, 0.396, 0.399, 0.401, 0.404, 0.406, 0.409, 0.411, - & 0.413, 0.416, 0.418, 0.421, 0.423, 0.425, 0.428, 0.430, 0.433, - & 0.435, 0.437, 0.440, 0.442, 0.445, 0.447, 0.449, 0.452, 0.454, - & 0.456, 0.459, 0.461, 0.463, 0.466, 0.468, 0.470, 0.473, 0.475, - & 0.477, 0.480, 0.482, 0.484, 0.486, 0.489, 0.491, 0.493, 0.496, - & 0.498, 0.500, 0.502, 0.505, 0.507, 0.509, 0.511, 0.514, 0.516, - & 0.518, 0.520, 0.523, 0.525, 0.527, 0.529, 0.531, 0.534, 0.536, - & 0.538, 0.540, 0.542, 0.545, 0.547, 0.549, 0.551, 0.553, 0.555, - & 0.558, 0.560, 0.562, 0.564, 0.566, 0.568, 0.570, 0.573, 0.575, - & 0.577, 0.579, 0.581, 0.583, 0.585, 0.587, 0.590, 0.592, 0.594, - & 0.596, 0.598, 0.600, 0.602, 0.604, 0.606, 0.608, 0.610, 0.612, - & 0.614, 0.617, 0.619, 0.621, 0.623, 0.625, 0.627, 0.629, 0.631, - & 0.633, 0.635, 0.637, 0.639, 0.641, 0.643, 0.645, 0.647, 0.649, - & 0.651, 0.653, 0.655, 0.657, 0.659, 0.661, 0.663, 0.665, 0.667, - & 0.669, 0.671, 0.673, 0.674, 0.676, 0.678, 0.680, 0.682, 0.684, - & 0.686, 0.688, 0.690, 0.692, 0.694, 0.696, 0.698, 0.700, 0.701, - & 0.703, 0.705, 0.707, 0.709, 0.711, 0.713, 0.715, 0.716, 0.718, - & 0.720, 0.722, 0.724, 0.726, 0.746, 0.764, 0.781, 0.799, 0.816, - & 0.833, 0.849, 0.866, 0.882, 0.897, 0.913, 0.928, 0.943, 0.958, - & 0.972, 0.987, 1.001, 1.015, 1.028, 1.042, 1.055, 1.068, 1.081, - & 1.093, 1.106, 1.118, 1.130, 1.142, 1.154, 1.165, 1.177, 1.188, - & 1.199, 1.210, 1.221, 1.231, 1.242, 1.252, 1.262, 1.272, 1.282, - & 1.292, 1.301, 1.311, 1.320, 1.329, 1.338, 1.347, 1.356, 1.365, - & 1.374, 1.382, 1.391, 1.399, 1.407, 1.415, 1.423, 1.431, 1.439, - & 1.446, 1.454, 1.462, 1.469, 1.476, 1.483, 1.491, 1.498, 1.505, - & 1.511, 1.518, 1.525, 1.531, 1.538, 1.544, 1.551, 1.557, 1.563, - & 1.569, 1.576, 1.582, 1.587, 1.593, 1.599, 1.605, 1.610, 1.616, - & 1.622, 1.627, 1.632, 1.638, 1.643, 1.648, 1.653, 1.658, 1.663, - & 1.668, 1.673, 1.678, 1.683, 1.688, 1.692, 1.697, 1.701, 1.706, - & 1.710, 1.715, 1.719, 1.723, 1.728, 1.732, 1.736, 1.740, 1.744, - & 1.748, 1.752, 1.756, 1.760, 1.764, 1.768, 1.771, 1.775, 1.779, - & 1.782, 1.786, 1.789, 1.793, 1.796, 1.800, 1.803, 1.806, 1.810, - & 1.813, 1.816, 1.819, 1.822, 1.825, 1.828, 1.831, 1.834, 1.837, - & 1.840, 1.843, 1.846, 1.849, 1.852, 1.854, 1.857, 1.860, 1.862, - & 1.865, 1.867, 1.870, 1.872, 1.875, 1.877, 1.880, 1.882, 1.885, - & 1.887, 1.889, 1.891 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.047,-0.093,-0.111,-0.121,-0.127,-0.131,-0.133,-0.134,-0.133, - &-0.132,-0.131,-0.128,-0.126,-0.123,-0.119,-0.115,-0.111,-0.107, - &-0.102,-0.098,-0.093,-0.088,-0.082,-0.077,-0.071,-0.065,-0.060, - &-0.054,-0.048,-0.041,-0.035,-0.029,-0.022,-0.016,-0.009,-0.003, - & 0.004, 0.011, 0.018, 0.025, 0.032, 0.038, 0.045, 0.053, 0.060, - & 0.067, 0.074, 0.081, 0.088, 0.095, 0.103, 0.110, 0.117, 0.124, - & 0.132, 0.139, 0.146, 0.154, 0.161, 0.168, 0.176, 0.183, 0.191, - & 0.198, 0.206, 0.213, 0.221, 0.228, 0.236, 0.243, 0.251, 0.258, - & 0.266, 0.274, 0.281, 0.289, 0.297, 0.305, 0.312, 0.320, 0.328, - & 0.336, 0.344, 0.352, 0.360, 0.368, 0.376, 0.384, 0.393, 0.401, - & 0.409, 0.417, 0.426, 0.434, 0.443, 0.451, 0.460, 0.468, 0.477, - & 0.485, 0.494, 0.503, 0.511, 0.520, 0.529, 0.538, 0.546, 0.555, - & 0.564, 0.573, 0.582, 0.591, 0.600, 0.608, 0.617, 0.626, 0.635, - & 0.644, 0.653, 0.662, 0.671, 0.680, 0.689, 0.698, 0.707, 0.716, - & 0.725, 0.734, 0.743, 0.752, 0.761, 0.770, 0.779, 0.788, 0.796, - & 0.805, 0.814, 0.823, 0.832, 0.841, 0.850, 0.859, 0.867, 0.876, - & 0.885, 0.894, 0.903, 0.911, 0.920, 0.929, 0.937, 0.946, 0.955, - & 0.964, 0.972, 0.981, 0.989, 0.998, 1.007, 1.015, 1.024, 1.032, - & 1.041, 1.049, 1.058, 1.066, 1.075, 1.083, 1.092, 1.100, 1.109, - & 1.117, 1.125, 1.134, 1.142, 1.150, 1.159, 1.167, 1.175, 1.183, - & 1.192, 1.200, 1.208, 1.216, 1.224, 1.233, 1.241, 1.249, 1.257, - & 1.265, 1.273, 1.281, 1.289, 1.297, 1.305, 1.313, 1.321, 1.329, - & 1.337, 1.345, 1.353, 1.361, 1.369, 1.377, 1.384, 1.392, 1.400, - & 1.408, 1.416, 1.423, 1.431, 1.439, 1.447, 1.454, 1.462, 1.470, - & 1.477, 1.485, 1.493, 1.500, 1.508, 1.515, 1.523, 1.530, 1.538, - & 1.545, 1.553, 1.560, 1.568, 1.575, 1.583, 1.590, 1.598, 1.605, - & 1.612, 1.620, 1.627, 1.634, 1.642, 1.649, 1.656, 1.663, 1.671, - & 1.678, 1.685, 1.692, 1.699, 1.707, 1.714, 1.721, 1.728, 1.735, - & 1.742, 1.749, 1.756, 1.763, 1.770, 1.778, 1.785, 1.791, 1.798, - & 1.805, 1.812, 1.819, 1.826, 1.833, 1.840, 1.847, 1.854, 1.861, - & 1.867, 1.874, 1.881, 1.888, 1.895, 1.901, 1.908, 1.915, 1.922, - & 1.928, 1.935, 1.942, 1.948, 1.955, 1.962, 1.968, 1.975, 1.981, - & 1.988, 1.995, 2.001, 2.008, 2.014, 2.021, 2.027, 2.034, 2.040, - & 2.047, 2.053, 2.060, 2.066, 2.072, 2.079, 2.085, 2.092, 2.098, - & 2.104, 2.111, 2.117, 2.123, 2.130, 2.136, 2.142, 2.148, 2.155, - & 2.161, 2.167, 2.173, 2.180, 2.186, 2.192, 2.198, 2.204, 2.210, - & 2.216, 2.223, 2.229, 2.235, 2.241, 2.247, 2.253, 2.259, 2.265, - & 2.271, 2.277, 2.283, 2.289, 2.295, 2.301, 2.307, 2.313, 2.319, - & 2.325, 2.331, 2.337, 2.343, 2.348, 2.354, 2.360, 2.366, 2.372, - & 2.378, 2.383, 2.389, 2.395, 2.401, 2.407, 2.412, 2.418, 2.424, - & 2.430, 2.435, 2.441, 2.447, 2.452, 2.458, 2.464, 2.469, 2.475, - & 2.481, 2.486, 2.492, 2.497, 2.503, 2.509, 2.514, 2.520, 2.525, - & 2.531, 2.536, 2.542, 2.547, 2.553, 2.558, 2.564, 2.569, 2.575, - & 2.580, 2.586, 2.591, 2.597, 2.602, 2.607, 2.613, 2.618, 2.624, - & 2.629, 2.634, 2.640, 2.645, 2.702, 2.754, 2.805, 2.855, 2.904, - & 2.953, 3.001, 3.048, 3.094, 3.139, 3.184, 3.228, 3.272, 3.315, - & 3.357, 3.399, 3.440, 3.480, 3.520, 3.559, 3.598, 3.636, 3.674, - & 3.711, 3.748, 3.784, 3.820, 3.855, 3.890, 3.925, 3.959, 3.992, - & 4.026, 4.058, 4.091, 4.123, 4.155, 4.186, 4.217, 4.247, 4.278, - & 4.308, 4.337, 4.366, 4.395, 4.424, 4.452, 4.480, 4.508, 4.535, - & 4.562, 4.589, 4.616, 4.642, 4.668, 4.694, 4.719, 4.745, 4.770, - & 4.794, 4.819, 4.843, 4.867, 4.891, 4.915, 4.938, 4.961, 4.984, - & 5.007, 5.029, 5.052, 5.074, 5.096, 5.117, 5.139, 5.160, 5.181, - & 5.202, 5.223, 5.244, 5.264, 5.285, 5.305, 5.324, 5.344, 5.364, - & 5.383, 5.402, 5.422, 5.441, 5.459, 5.478, 5.496, 5.515, 5.533, - & 5.551, 5.569, 5.587, 5.604, 5.622, 5.639, 5.656, 5.673, 5.690, - & 5.707, 5.724, 5.740, 5.757, 5.773, 5.789, 5.806, 5.821, 5.837, - & 5.853, 5.869, 5.884, 5.900, 5.915, 5.930, 5.945, 5.960, 5.975, - & 5.990, 6.004, 6.019, 6.033, 6.048, 6.062, 6.076, 6.090, 6.104, - & 6.118, 6.132, 6.145, 6.159, 6.172, 6.186, 6.199, 6.212, 6.225, - & 6.238, 6.251, 6.264, 6.277, 6.290, 6.302, 6.315, 6.327, 6.340, - & 6.352, 6.364, 6.377, 6.389, 6.401, 6.413, 6.424, 6.436, 6.448, - & 6.459, 6.471, 6.482 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.048,-0.099,-0.122,-0.137,-0.148,-0.156,-0.163,-0.168,-0.172, - &-0.175,-0.178,-0.180,-0.182,-0.183,-0.184,-0.184,-0.184,-0.184, - &-0.184,-0.183,-0.182,-0.181,-0.180,-0.179,-0.177,-0.176,-0.174, - &-0.172,-0.170,-0.167,-0.165,-0.163,-0.160,-0.157,-0.155,-0.152, - &-0.149,-0.146,-0.143,-0.139,-0.136,-0.133,-0.129,-0.126,-0.122, - &-0.118,-0.115,-0.111,-0.107,-0.103,-0.099,-0.095,-0.091,-0.087, - &-0.083,-0.079,-0.075,-0.071,-0.066,-0.062,-0.058,-0.053,-0.049, - &-0.044,-0.040,-0.035,-0.031,-0.026,-0.022,-0.017,-0.012,-0.007, - &-0.003, 0.002, 0.007, 0.012, 0.017, 0.022, 0.027, 0.032, 0.037, - & 0.042, 0.047, 0.052, 0.058, 0.063, 0.068, 0.073, 0.079, 0.084, - & 0.090, 0.095, 0.101, 0.106, 0.112, 0.117, 0.123, 0.128, 0.134, - & 0.140, 0.146, 0.151, 0.157, 0.163, 0.169, 0.175, 0.180, 0.186, - & 0.192, 0.198, 0.204, 0.210, 0.216, 0.222, 0.228, 0.234, 0.240, - & 0.246, 0.252, 0.258, 0.264, 0.270, 0.276, 0.282, 0.288, 0.294, - & 0.300, 0.306, 0.312, 0.318, 0.323, 0.329, 0.335, 0.341, 0.347, - & 0.353, 0.359, 0.365, 0.371, 0.377, 0.383, 0.389, 0.394, 0.400, - & 0.406, 0.412, 0.418, 0.424, 0.429, 0.435, 0.441, 0.447, 0.453, - & 0.458, 0.464, 0.470, 0.476, 0.481, 0.487, 0.493, 0.498, 0.504, - & 0.510, 0.515, 0.521, 0.526, 0.532, 0.538, 0.543, 0.549, 0.554, - & 0.560, 0.565, 0.571, 0.576, 0.582, 0.587, 0.593, 0.598, 0.604, - & 0.609, 0.615, 0.620, 0.625, 0.631, 0.636, 0.641, 0.647, 0.652, - & 0.657, 0.663, 0.668, 0.673, 0.679, 0.684, 0.689, 0.694, 0.700, - & 0.705, 0.710, 0.715, 0.720, 0.726, 0.731, 0.736, 0.741, 0.746, - & 0.751, 0.756, 0.761, 0.766, 0.772, 0.777, 0.782, 0.787, 0.792, - & 0.797, 0.802, 0.807, 0.812, 0.817, 0.822, 0.826, 0.831, 0.836, - & 0.841, 0.846, 0.851, 0.856, 0.861, 0.866, 0.870, 0.875, 0.880, - & 0.885, 0.890, 0.894, 0.899, 0.904, 0.909, 0.914, 0.918, 0.923, - & 0.928, 0.932, 0.937, 0.942, 0.946, 0.951, 0.956, 0.960, 0.965, - & 0.970, 0.974, 0.979, 0.984, 0.988, 0.993, 0.997, 1.002, 1.006, - & 1.011, 1.015, 1.020, 1.024, 1.029, 1.033, 1.038, 1.042, 1.047, - & 1.051, 1.056, 1.060, 1.065, 1.069, 1.073, 1.078, 1.082, 1.087, - & 1.091, 1.095, 1.100, 1.104, 1.108, 1.113, 1.117, 1.121, 1.126, - & 1.130, 1.134, 1.138, 1.143, 1.147, 1.151, 1.155, 1.160, 1.164, - & 1.168, 1.172, 1.177, 1.181, 1.185, 1.189, 1.193, 1.197, 1.202, - & 1.206, 1.210, 1.214, 1.218, 1.222, 1.226, 1.230, 1.234, 1.238, - & 1.243, 1.247, 1.251, 1.255, 1.259, 1.263, 1.267, 1.271, 1.275, - & 1.279, 1.283, 1.287, 1.291, 1.295, 1.299, 1.303, 1.306, 1.310, - & 1.314, 1.318, 1.322, 1.326, 1.330, 1.334, 1.338, 1.342, 1.345, - & 1.349, 1.353, 1.357, 1.361, 1.365, 1.368, 1.372, 1.376, 1.380, - & 1.384, 1.387, 1.391, 1.395, 1.399, 1.403, 1.406, 1.410, 1.414, - & 1.418, 1.421, 1.425, 1.429, 1.432, 1.436, 1.440, 1.443, 1.447, - & 1.451, 1.454, 1.458, 1.462, 1.465, 1.469, 1.473, 1.476, 1.480, - & 1.484, 1.487, 1.491, 1.494, 1.498, 1.501, 1.505, 1.509, 1.512, - & 1.516, 1.519, 1.523, 1.526, 1.530, 1.533, 1.537, 1.540, 1.544, - & 1.547, 1.551, 1.554, 1.558, 1.595, 1.629, 1.662, 1.695, 1.727, - & 1.759, 1.790, 1.820, 1.850, 1.880, 1.909, 1.938, 1.966, 1.994, - & 2.022, 2.049, 2.076, 2.102, 2.128, 2.153, 2.179, 2.203, 2.228, - & 2.252, 2.276, 2.300, 2.323, 2.346, 2.368, 2.391, 2.413, 2.435, - & 2.456, 2.477, 2.498, 2.519, 2.539, 2.560, 2.580, 2.599, 2.619, - & 2.638, 2.657, 2.676, 2.695, 2.713, 2.731, 2.749, 2.767, 2.785, - & 2.802, 2.819, 2.836, 2.853, 2.870, 2.886, 2.902, 2.918, 2.934, - & 2.950, 2.966, 2.981, 2.997, 3.012, 3.027, 3.042, 3.056, 3.071, - & 3.085, 3.099, 3.114, 3.128, 3.141, 3.155, 3.169, 3.182, 3.195, - & 3.209, 3.222, 3.235, 3.247, 3.260, 3.273, 3.285, 3.298, 3.310, - & 3.322, 3.334, 3.346, 3.358, 3.369, 3.381, 3.392, 3.404, 3.415, - & 3.426, 3.437, 3.448, 3.459, 3.470, 3.481, 3.491, 3.502, 3.512, - & 3.523, 3.533, 3.543, 3.553, 3.563, 3.573, 3.583, 3.593, 3.603, - & 3.612, 3.622, 3.631, 3.640, 3.650, 3.659, 3.668, 3.677, 3.686, - & 3.695, 3.704, 3.713, 3.721, 3.730, 3.739, 3.747, 3.756, 3.764, - & 3.772, 3.781, 3.789, 3.797, 3.805, 3.813, 3.821, 3.829, 3.836, - & 3.844, 3.852, 3.860, 3.867, 3.875, 3.882, 3.889, 3.897, 3.904, - & 3.911, 3.919, 3.926, 3.933, 3.940, 3.947, 3.954, 3.961, 3.967, - & 3.974, 3.981, 3.988 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.080,-0.174,-0.221,-0.254,-0.280,-0.302,-0.321,-0.337,-0.352, - &-0.365,-0.377,-0.388,-0.398,-0.408,-0.417,-0.425,-0.433,-0.440, - &-0.447,-0.454,-0.461,-0.467,-0.472,-0.478,-0.483,-0.488,-0.493, - &-0.498,-0.503,-0.507,-0.511,-0.515,-0.519,-0.523,-0.527,-0.530, - &-0.533,-0.537,-0.540,-0.543,-0.546,-0.549,-0.551,-0.554,-0.557, - &-0.559,-0.562,-0.564,-0.566,-0.569,-0.571,-0.573,-0.575,-0.577, - &-0.579,-0.580,-0.582,-0.584,-0.586,-0.587,-0.589,-0.590,-0.592, - &-0.593,-0.595,-0.596,-0.597,-0.599,-0.600,-0.601,-0.602,-0.603, - &-0.604,-0.605,-0.607,-0.608,-0.609,-0.609,-0.610,-0.611,-0.612, - &-0.613,-0.614,-0.614,-0.615,-0.616,-0.617,-0.617,-0.618,-0.619, - &-0.619,-0.620,-0.620,-0.621,-0.621,-0.622,-0.622,-0.623,-0.623, - &-0.624,-0.624,-0.624,-0.625,-0.625,-0.626,-0.626,-0.626,-0.626, - &-0.627,-0.627,-0.627,-0.628,-0.628,-0.628,-0.628,-0.628,-0.629, - &-0.629,-0.629,-0.629,-0.629,-0.629,-0.630,-0.630,-0.630,-0.630, - &-0.630,-0.630,-0.630,-0.630,-0.630,-0.631,-0.631,-0.631,-0.631, - &-0.631,-0.631,-0.631,-0.631,-0.631,-0.631,-0.631,-0.631,-0.631, - &-0.631,-0.631,-0.631,-0.631,-0.631,-0.631,-0.631,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632, - &-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.632,-0.633,-0.633, - &-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633, - &-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633,-0.633, - &-0.633,-0.633,-0.633,-0.633,-0.634,-0.634,-0.634,-0.634,-0.634, - &-0.634,-0.634,-0.634,-0.634,-0.634,-0.634,-0.634,-0.634,-0.634, - &-0.634,-0.634,-0.634,-0.634,-0.635,-0.635,-0.635,-0.635,-0.635, - &-0.635,-0.635,-0.635,-0.635,-0.635,-0.635,-0.635,-0.635,-0.635, - &-0.636,-0.636,-0.636,-0.636,-0.636,-0.636,-0.636,-0.636,-0.636, - &-0.636,-0.636,-0.636,-0.637,-0.637,-0.637,-0.637,-0.637,-0.637, - &-0.637,-0.637,-0.637,-0.637,-0.637,-0.638,-0.638,-0.638,-0.638, - &-0.638,-0.638,-0.638,-0.638,-0.638,-0.638,-0.639,-0.639,-0.639, - &-0.639,-0.639,-0.639,-0.639,-0.639,-0.639,-0.639,-0.640,-0.640, - &-0.640,-0.640,-0.640,-0.640,-0.640,-0.640,-0.640,-0.641,-0.641, - &-0.641,-0.641,-0.641,-0.641,-0.641,-0.641,-0.642,-0.642,-0.642, - &-0.642,-0.642,-0.642,-0.642,-0.642,-0.643,-0.643,-0.643,-0.643, - &-0.643,-0.643,-0.643,-0.643,-0.644,-0.644,-0.644,-0.644,-0.644, - &-0.644,-0.644,-0.645,-0.645,-0.645,-0.645,-0.645,-0.645,-0.645, - &-0.646,-0.646,-0.646,-0.646,-0.648,-0.649,-0.651,-0.652,-0.654, - &-0.656,-0.658,-0.660,-0.662,-0.664,-0.666,-0.668,-0.670,-0.673, - &-0.675,-0.677,-0.680,-0.682,-0.685,-0.687,-0.690,-0.693,-0.695, - &-0.698,-0.701,-0.704,-0.707,-0.709,-0.712,-0.715,-0.718,-0.722, - &-0.725,-0.728,-0.731,-0.734,-0.737,-0.741,-0.744,-0.747,-0.751, - &-0.754,-0.758,-0.761,-0.764,-0.768,-0.772,-0.775,-0.779,-0.782, - &-0.786,-0.790,-0.793,-0.797,-0.801,-0.805,-0.809,-0.812,-0.816, - &-0.820,-0.824,-0.828,-0.832,-0.836,-0.840,-0.844,-0.848,-0.852, - &-0.856,-0.860,-0.864,-0.868,-0.873,-0.877,-0.881,-0.885,-0.889, - &-0.894,-0.898,-0.902,-0.906,-0.911,-0.915,-0.919,-0.924,-0.928, - &-0.932,-0.937,-0.941,-0.946,-0.950,-0.955,-0.959,-0.964,-0.968, - &-0.973,-0.977,-0.982,-0.986,-0.991,-0.995,-1.000,-1.005,-1.009, - &-1.014,-1.019,-1.023,-1.028,-1.033,-1.037,-1.042,-1.047,-1.051, - &-1.056,-1.061,-1.066,-1.071,-1.075,-1.080,-1.085,-1.090,-1.095, - &-1.099,-1.104,-1.109,-1.114,-1.119,-1.124,-1.129,-1.134,-1.138, - &-1.143,-1.148,-1.153,-1.158,-1.163,-1.168,-1.173,-1.178,-1.183, - &-1.188,-1.193,-1.198,-1.203,-1.208,-1.213,-1.218,-1.223,-1.228, - &-1.233,-1.238,-1.244,-1.249,-1.254,-1.259,-1.264,-1.269,-1.274, - &-1.279,-1.284,-1.290 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.099,-0.211,-0.264,-0.301,-0.329,-0.351,-0.370,-0.386,-0.399, - &-0.411,-0.422,-0.432,-0.440,-0.448,-0.455,-0.462,-0.468,-0.473, - &-0.478,-0.483,-0.487,-0.491,-0.495,-0.499,-0.502,-0.505,-0.508, - &-0.511,-0.513,-0.516,-0.518,-0.520,-0.522,-0.524,-0.526,-0.528, - &-0.529,-0.531,-0.532,-0.534,-0.535,-0.536,-0.537,-0.539,-0.540, - &-0.541,-0.542,-0.543,-0.544,-0.545,-0.545,-0.546,-0.547,-0.548, - &-0.549,-0.549,-0.550,-0.551,-0.551,-0.552,-0.552,-0.553,-0.553, - &-0.554,-0.554,-0.555,-0.555,-0.556,-0.556,-0.556,-0.557,-0.557, - &-0.557,-0.558,-0.558,-0.558,-0.558,-0.559,-0.559,-0.559,-0.559, - &-0.559,-0.559,-0.559,-0.559,-0.559,-0.559,-0.559,-0.559,-0.559, - &-0.559,-0.559,-0.559,-0.559,-0.558,-0.558,-0.558,-0.558,-0.557, - &-0.557,-0.557,-0.556,-0.556,-0.556,-0.555,-0.555,-0.555,-0.554, - &-0.554,-0.553,-0.553,-0.552,-0.552,-0.551,-0.551,-0.550,-0.550, - &-0.549,-0.549,-0.548,-0.548,-0.547,-0.547,-0.546,-0.545,-0.545, - &-0.544,-0.544,-0.543,-0.542,-0.542,-0.541,-0.541,-0.540,-0.539, - &-0.539,-0.538,-0.538,-0.537,-0.536,-0.536,-0.535,-0.534,-0.534, - &-0.533,-0.533,-0.532,-0.531,-0.531,-0.530,-0.529,-0.529,-0.528, - &-0.527,-0.527,-0.526,-0.525,-0.525,-0.524,-0.524,-0.523,-0.522, - &-0.522,-0.521,-0.520,-0.520,-0.519,-0.518,-0.518,-0.517,-0.516, - &-0.516,-0.515,-0.514,-0.514,-0.513,-0.513,-0.512,-0.511,-0.511, - &-0.510,-0.509,-0.509,-0.508,-0.507,-0.507,-0.506,-0.505,-0.505, - &-0.504,-0.504,-0.503,-0.502,-0.502,-0.501,-0.500,-0.500,-0.499, - &-0.499,-0.498,-0.497,-0.497,-0.496,-0.495,-0.495,-0.494,-0.494, - &-0.493,-0.492,-0.492,-0.491,-0.490,-0.490,-0.489,-0.489,-0.488, - &-0.487,-0.487,-0.486,-0.486,-0.485,-0.484,-0.484,-0.483,-0.483, - &-0.482,-0.481,-0.481,-0.480,-0.480,-0.479,-0.478,-0.478,-0.477, - &-0.477,-0.476,-0.475,-0.475,-0.474,-0.474,-0.473,-0.473,-0.472, - &-0.471,-0.471,-0.470,-0.470,-0.469,-0.469,-0.468,-0.468,-0.467, - &-0.466,-0.466,-0.465,-0.465,-0.464,-0.464,-0.463,-0.463,-0.462, - &-0.461,-0.461,-0.460,-0.460,-0.459,-0.459,-0.458,-0.458,-0.457, - &-0.457,-0.456,-0.456,-0.455,-0.455,-0.454,-0.453,-0.453,-0.452, - &-0.452,-0.451,-0.451,-0.450,-0.450,-0.449,-0.449,-0.448,-0.448, - &-0.447,-0.447,-0.446,-0.446,-0.445,-0.445,-0.444,-0.444,-0.443, - &-0.443,-0.442,-0.442,-0.441,-0.441,-0.440,-0.440,-0.440,-0.439, - &-0.439,-0.438,-0.438,-0.437,-0.437,-0.436,-0.436,-0.435,-0.435, - &-0.434,-0.434,-0.433,-0.433,-0.433,-0.432,-0.432,-0.431,-0.431, - &-0.430,-0.430,-0.429,-0.429,-0.429,-0.428,-0.428,-0.427,-0.427, - &-0.426,-0.426,-0.426,-0.425,-0.425,-0.424,-0.424,-0.423,-0.423, - &-0.423,-0.422,-0.422,-0.421,-0.421,-0.421,-0.420,-0.420,-0.419, - &-0.419,-0.419,-0.418,-0.418,-0.417,-0.417,-0.417,-0.416,-0.416, - &-0.415,-0.415,-0.415,-0.414,-0.414,-0.413,-0.413,-0.413,-0.412, - &-0.412,-0.412,-0.411,-0.411,-0.410,-0.410,-0.410,-0.409,-0.409, - &-0.409,-0.408,-0.408,-0.408,-0.407,-0.407,-0.407,-0.406,-0.406, - &-0.405,-0.405,-0.405,-0.404,-0.404,-0.404,-0.403,-0.403,-0.403, - &-0.402,-0.402,-0.402,-0.401,-0.398,-0.395,-0.392,-0.389,-0.386, - &-0.384,-0.381,-0.379,-0.377,-0.375,-0.373,-0.371,-0.369,-0.368, - &-0.366,-0.365,-0.364,-0.363,-0.362,-0.361,-0.360,-0.359,-0.358, - &-0.358,-0.357,-0.357,-0.357,-0.356,-0.356,-0.356,-0.356,-0.356, - &-0.356,-0.357,-0.357,-0.357,-0.358,-0.358,-0.359,-0.360,-0.361, - &-0.361,-0.362,-0.363,-0.364,-0.365,-0.367,-0.368,-0.369,-0.370, - &-0.372,-0.373,-0.375,-0.376,-0.378,-0.380,-0.381,-0.383,-0.385, - &-0.387,-0.389,-0.391,-0.393,-0.395,-0.397,-0.399,-0.401,-0.404, - &-0.406,-0.408,-0.411,-0.413,-0.416,-0.418,-0.421,-0.423,-0.426, - &-0.429,-0.431,-0.434,-0.437,-0.440,-0.442,-0.445,-0.448,-0.451, - &-0.454,-0.457,-0.460,-0.463,-0.467,-0.470,-0.473,-0.476,-0.480, - &-0.483,-0.486,-0.490,-0.493,-0.496,-0.500,-0.503,-0.507,-0.510, - &-0.514,-0.517,-0.521,-0.525,-0.528,-0.532,-0.536,-0.540,-0.543, - &-0.547,-0.551,-0.555,-0.559,-0.563,-0.566,-0.570,-0.574,-0.578, - &-0.582,-0.586,-0.590,-0.595,-0.599,-0.603,-0.607,-0.611,-0.615, - &-0.619,-0.624,-0.628,-0.632,-0.637,-0.641,-0.645,-0.650,-0.654, - &-0.658,-0.663,-0.667,-0.672,-0.676,-0.680,-0.685,-0.689,-0.694, - &-0.699,-0.703,-0.708,-0.712,-0.717,-0.722,-0.726,-0.731,-0.736, - &-0.740,-0.745,-0.750 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.097,-0.201,-0.247,-0.277,-0.298,-0.314,-0.327,-0.337,-0.345, - &-0.351,-0.356,-0.359,-0.362,-0.365,-0.366,-0.367,-0.367,-0.367, - &-0.367,-0.366,-0.365,-0.364,-0.362,-0.361,-0.359,-0.356,-0.354, - &-0.352,-0.349,-0.346,-0.343,-0.340,-0.337,-0.334,-0.331,-0.328, - &-0.324,-0.321,-0.317,-0.314,-0.310,-0.307,-0.303,-0.300,-0.296, - &-0.292,-0.289,-0.285,-0.281,-0.277,-0.274,-0.270,-0.266,-0.262, - &-0.259,-0.255,-0.251,-0.247,-0.244,-0.240,-0.236,-0.232,-0.228, - &-0.224,-0.221,-0.217,-0.213,-0.209,-0.205,-0.201,-0.197,-0.193, - &-0.189,-0.185,-0.181,-0.177,-0.173,-0.169,-0.165,-0.161,-0.157, - &-0.152,-0.148,-0.144,-0.139,-0.135,-0.131,-0.126,-0.122,-0.117, - &-0.113,-0.108,-0.104,-0.099,-0.095,-0.090,-0.085,-0.080,-0.076, - &-0.071,-0.066,-0.061,-0.056,-0.051,-0.047,-0.042,-0.037,-0.032, - &-0.027,-0.022,-0.017,-0.012,-0.006,-0.001, 0.004, 0.009, 0.014, - & 0.019, 0.024, 0.029, 0.034, 0.040, 0.045, 0.050, 0.055, 0.060, - & 0.065, 0.071, 0.076, 0.081, 0.086, 0.091, 0.096, 0.102, 0.107, - & 0.112, 0.117, 0.122, 0.127, 0.133, 0.138, 0.143, 0.148, 0.153, - & 0.158, 0.163, 0.168, 0.174, 0.179, 0.184, 0.189, 0.194, 0.199, - & 0.204, 0.209, 0.214, 0.219, 0.224, 0.229, 0.234, 0.239, 0.244, - & 0.249, 0.254, 0.259, 0.264, 0.269, 0.274, 0.279, 0.284, 0.289, - & 0.294, 0.299, 0.304, 0.309, 0.314, 0.319, 0.324, 0.329, 0.334, - & 0.338, 0.343, 0.348, 0.353, 0.358, 0.363, 0.368, 0.372, 0.377, - & 0.382, 0.387, 0.392, 0.396, 0.401, 0.406, 0.411, 0.415, 0.420, - & 0.425, 0.430, 0.434, 0.439, 0.444, 0.449, 0.453, 0.458, 0.463, - & 0.467, 0.472, 0.477, 0.481, 0.486, 0.491, 0.495, 0.500, 0.504, - & 0.509, 0.514, 0.518, 0.523, 0.527, 0.532, 0.536, 0.541, 0.545, - & 0.550, 0.555, 0.559, 0.564, 0.568, 0.573, 0.577, 0.581, 0.586, - & 0.590, 0.595, 0.599, 0.604, 0.608, 0.613, 0.617, 0.621, 0.626, - & 0.630, 0.635, 0.639, 0.643, 0.648, 0.652, 0.656, 0.661, 0.665, - & 0.669, 0.674, 0.678, 0.682, 0.686, 0.691, 0.695, 0.699, 0.703, - & 0.708, 0.712, 0.716, 0.720, 0.725, 0.729, 0.733, 0.737, 0.741, - & 0.746, 0.750, 0.754, 0.758, 0.762, 0.766, 0.770, 0.775, 0.779, - & 0.783, 0.787, 0.791, 0.795, 0.799, 0.803, 0.807, 0.811, 0.815, - & 0.819, 0.823, 0.827, 0.831, 0.835, 0.839, 0.843, 0.847, 0.851, - & 0.855, 0.859, 0.863, 0.867, 0.871, 0.875, 0.879, 0.883, 0.887, - & 0.891, 0.895, 0.899, 0.902, 0.906, 0.910, 0.914, 0.918, 0.922, - & 0.926, 0.929, 0.933, 0.937, 0.941, 0.945, 0.949, 0.952, 0.956, - & 0.960, 0.964, 0.967, 0.971, 0.975, 0.979, 0.982, 0.986, 0.990, - & 0.994, 0.997, 1.001, 1.005, 1.008, 1.012, 1.016, 1.019, 1.023, - & 1.027, 1.030, 1.034, 1.038, 1.041, 1.045, 1.049, 1.052, 1.056, - & 1.059, 1.063, 1.067, 1.070, 1.074, 1.077, 1.081, 1.084, 1.088, - & 1.091, 1.095, 1.098, 1.102, 1.106, 1.109, 1.113, 1.116, 1.119, - & 1.123, 1.126, 1.130, 1.133, 1.137, 1.140, 1.144, 1.147, 1.151, - & 1.154, 1.157, 1.161, 1.164, 1.168, 1.171, 1.174, 1.178, 1.181, - & 1.185, 1.188, 1.191, 1.195, 1.198, 1.201, 1.205, 1.208, 1.211, - & 1.215, 1.218, 1.221, 1.225, 1.260, 1.292, 1.323, 1.354, 1.385, - & 1.415, 1.444, 1.473, 1.501, 1.529, 1.557, 1.584, 1.610, 1.636, - & 1.662, 1.687, 1.712, 1.737, 1.761, 1.784, 1.808, 1.831, 1.853, - & 1.876, 1.898, 1.919, 1.940, 1.961, 1.982, 2.002, 2.022, 2.042, - & 2.062, 2.081, 2.100, 2.118, 2.137, 2.155, 2.172, 2.190, 2.207, - & 2.224, 2.241, 2.258, 2.274, 2.290, 2.306, 2.322, 2.337, 2.353, - & 2.368, 2.382, 2.397, 2.412, 2.426, 2.440, 2.454, 2.467, 2.481, - & 2.494, 2.507, 2.520, 2.533, 2.546, 2.558, 2.571, 2.583, 2.595, - & 2.606, 2.618, 2.630, 2.641, 2.652, 2.663, 2.674, 2.685, 2.696, - & 2.706, 2.717, 2.727, 2.737, 2.747, 2.757, 2.767, 2.776, 2.786, - & 2.795, 2.804, 2.813, 2.822, 2.831, 2.840, 2.849, 2.857, 2.866, - & 2.874, 2.882, 2.891, 2.899, 2.907, 2.914, 2.922, 2.930, 2.937, - & 2.945, 2.952, 2.959, 2.966, 2.973, 2.980, 2.987, 2.994, 3.001, - & 3.007, 3.014, 3.020, 3.027, 3.033, 3.039, 3.045, 3.051, 3.057, - & 3.063, 3.069, 3.075, 3.081, 3.086, 3.092, 3.097, 3.102, 3.108, - & 3.113, 3.118, 3.123, 3.128, 3.133, 3.138, 3.143, 3.147, 3.152, - & 3.157, 3.161, 3.166, 3.170, 3.175, 3.179, 3.183, 3.187, 3.191, - & 3.195, 3.199, 3.203, 3.207, 3.211, 3.215, 3.219, 3.222, 3.226, - & 3.229, 3.233, 3.236 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.101,-0.220,-0.281,-0.324,-0.358,-0.387,-0.412,-0.434,-0.453, - &-0.471,-0.487,-0.503,-0.517,-0.530,-0.543,-0.555,-0.566,-0.577, - &-0.587,-0.597,-0.606,-0.615,-0.624,-0.632,-0.641,-0.649,-0.656, - &-0.664,-0.671,-0.678,-0.685,-0.692,-0.698,-0.705,-0.711,-0.717, - &-0.723,-0.729,-0.735,-0.740,-0.746,-0.752,-0.757,-0.762,-0.767, - &-0.772,-0.777,-0.782,-0.787,-0.792,-0.797,-0.801,-0.806,-0.810, - &-0.815,-0.819,-0.824,-0.828,-0.832,-0.836,-0.840,-0.844,-0.848, - &-0.852,-0.856,-0.860,-0.864,-0.868,-0.872,-0.876,-0.879,-0.883, - &-0.887,-0.890,-0.894,-0.897,-0.901,-0.904,-0.908,-0.911,-0.915, - &-0.918,-0.922,-0.925,-0.928,-0.932,-0.935,-0.938,-0.942,-0.945, - &-0.948,-0.951,-0.954,-0.958,-0.961,-0.964,-0.967,-0.970,-0.973, - &-0.976,-0.979,-0.982,-0.985,-0.988,-0.991,-0.994,-0.997,-1.000, - &-1.003,-1.006,-1.009,-1.012,-1.015,-1.018,-1.021,-1.024,-1.026, - &-1.029,-1.032,-1.035,-1.038,-1.040,-1.043,-1.046,-1.049,-1.051, - &-1.054,-1.057,-1.060,-1.062,-1.065,-1.068,-1.070,-1.073,-1.076, - &-1.078,-1.081,-1.083,-1.086,-1.089,-1.091,-1.094,-1.096,-1.099, - &-1.102,-1.104,-1.107,-1.109,-1.112,-1.114,-1.117,-1.119,-1.122, - &-1.124,-1.127,-1.129,-1.131,-1.134,-1.136,-1.139,-1.141,-1.144, - &-1.146,-1.148,-1.151,-1.153,-1.155,-1.158,-1.160,-1.163,-1.165, - &-1.167,-1.170,-1.172,-1.174,-1.177,-1.179,-1.181,-1.183,-1.186, - &-1.188,-1.190,-1.193,-1.195,-1.197,-1.199,-1.202,-1.204,-1.206, - &-1.208,-1.210,-1.213,-1.215,-1.217,-1.219,-1.221,-1.224,-1.226, - &-1.228,-1.230,-1.232,-1.235,-1.237,-1.239,-1.241,-1.243,-1.245, - &-1.247,-1.250,-1.252,-1.254,-1.256,-1.258,-1.260,-1.262,-1.264, - &-1.266,-1.269,-1.271,-1.273,-1.275,-1.277,-1.279,-1.281,-1.283, - &-1.285,-1.287,-1.289,-1.291,-1.293,-1.295,-1.297,-1.299,-1.301, - &-1.303,-1.305,-1.307,-1.309,-1.311,-1.313,-1.315,-1.317,-1.319, - &-1.321,-1.323,-1.325,-1.327,-1.329,-1.331,-1.333,-1.335,-1.337, - &-1.339,-1.341,-1.343,-1.345,-1.347,-1.349,-1.351,-1.353,-1.355, - &-1.357,-1.358,-1.360,-1.362,-1.364,-1.366,-1.368,-1.370,-1.372, - &-1.374,-1.376,-1.377,-1.379,-1.381,-1.383,-1.385,-1.387,-1.389, - &-1.391,-1.392,-1.394,-1.396,-1.398,-1.400,-1.402,-1.404,-1.405, - &-1.407,-1.409,-1.411,-1.413,-1.415,-1.417,-1.418,-1.420,-1.422, - &-1.424,-1.426,-1.427,-1.429,-1.431,-1.433,-1.435,-1.437,-1.438, - &-1.440,-1.442,-1.444,-1.445,-1.447,-1.449,-1.451,-1.453,-1.454, - &-1.456,-1.458,-1.460,-1.462,-1.463,-1.465,-1.467,-1.469,-1.470, - &-1.472,-1.474,-1.476,-1.477,-1.479,-1.481,-1.483,-1.484,-1.486, - &-1.488,-1.490,-1.491,-1.493,-1.495,-1.496,-1.498,-1.500,-1.502, - &-1.503,-1.505,-1.507,-1.509,-1.510,-1.512,-1.514,-1.515,-1.517, - &-1.519,-1.520,-1.522,-1.524,-1.526,-1.527,-1.529,-1.531,-1.532, - &-1.534,-1.536,-1.537,-1.539,-1.541,-1.542,-1.544,-1.546,-1.547, - &-1.549,-1.551,-1.552,-1.554,-1.556,-1.557,-1.559,-1.561,-1.562, - &-1.564,-1.566,-1.567,-1.569,-1.571,-1.572,-1.574,-1.576,-1.577, - &-1.579,-1.580,-1.582,-1.584,-1.585,-1.587,-1.589,-1.590,-1.592, - &-1.594,-1.595,-1.597,-1.598,-1.616,-1.632,-1.648,-1.663,-1.679, - &-1.694,-1.710,-1.725,-1.740,-1.755,-1.770,-1.785,-1.799,-1.814, - &-1.828,-1.843,-1.857,-1.871,-1.885,-1.900,-1.914,-1.928,-1.941, - &-1.955,-1.969,-1.983,-1.996,-2.010,-2.023,-2.037,-2.050,-2.063, - &-2.077,-2.090,-2.103,-2.116,-2.129,-2.142,-2.155,-2.168,-2.181, - &-2.194,-2.206,-2.219,-2.232,-2.244,-2.257,-2.269,-2.282,-2.294, - &-2.307,-2.319,-2.332,-2.344,-2.356,-2.369,-2.381,-2.393,-2.405, - &-2.417,-2.429,-2.441,-2.454,-2.466,-2.478,-2.489,-2.501,-2.513, - &-2.525,-2.537,-2.549,-2.561,-2.572,-2.584,-2.596,-2.608,-2.619, - &-2.631,-2.642,-2.654,-2.666,-2.677,-2.689,-2.700,-2.712,-2.723, - &-2.735,-2.746,-2.757,-2.769,-2.780,-2.792,-2.803,-2.814,-2.825, - &-2.837,-2.848,-2.859,-2.870,-2.882,-2.893,-2.904,-2.915,-2.926, - &-2.937,-2.948,-2.959,-2.971,-2.982,-2.993,-3.004,-3.015,-3.026, - &-3.037,-3.048,-3.058,-3.069,-3.080,-3.091,-3.102,-3.113,-3.124, - &-3.135,-3.145,-3.156,-3.167,-3.178,-3.189,-3.199,-3.210,-3.221, - &-3.232,-3.242,-3.253,-3.264,-3.274,-3.285,-3.296,-3.306,-3.317, - &-3.327,-3.338,-3.349,-3.359,-3.370,-3.380,-3.391,-3.401,-3.412, - &-3.422,-3.433,-3.443,-3.454,-3.464,-3.475,-3.485,-3.496,-3.506, - &-3.517,-3.527,-3.537 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.049,-0.104,-0.130,-0.148,-0.162,-0.173,-0.182,-0.190,-0.197, - &-0.203,-0.208,-0.213,-0.217,-0.221,-0.224,-0.227,-0.230,-0.232, - &-0.234,-0.236,-0.238,-0.239,-0.240,-0.241,-0.242,-0.243,-0.243, - &-0.244,-0.244,-0.244,-0.244,-0.244,-0.243,-0.243,-0.242,-0.242, - &-0.241,-0.240,-0.239,-0.238,-0.237,-0.236,-0.235,-0.233,-0.232, - &-0.230,-0.229,-0.227,-0.225,-0.223,-0.222,-0.220,-0.218,-0.216, - &-0.214,-0.211,-0.209,-0.207,-0.205,-0.202,-0.200,-0.197,-0.195, - &-0.192,-0.190,-0.187,-0.185,-0.182,-0.179,-0.176,-0.174,-0.171, - &-0.168,-0.165,-0.162,-0.159,-0.156,-0.153,-0.150,-0.147,-0.143, - &-0.140,-0.137,-0.134,-0.131,-0.127,-0.124,-0.120,-0.117,-0.114, - &-0.110,-0.107,-0.103,-0.100,-0.096,-0.092,-0.089,-0.085,-0.081, - &-0.078,-0.074,-0.070,-0.066,-0.063,-0.059,-0.055,-0.051,-0.047, - &-0.043,-0.040,-0.036,-0.032,-0.028,-0.024,-0.020,-0.016,-0.012, - &-0.008,-0.004, 0.000, 0.004, 0.008, 0.012, 0.015, 0.019, 0.023, - & 0.027, 0.031, 0.035, 0.039, 0.043, 0.047, 0.051, 0.055, 0.059, - & 0.063, 0.067, 0.071, 0.075, 0.078, 0.082, 0.086, 0.090, 0.094, - & 0.098, 0.102, 0.106, 0.109, 0.113, 0.117, 0.121, 0.125, 0.128, - & 0.132, 0.136, 0.140, 0.144, 0.147, 0.151, 0.155, 0.159, 0.162, - & 0.166, 0.170, 0.173, 0.177, 0.181, 0.184, 0.188, 0.192, 0.195, - & 0.199, 0.203, 0.206, 0.210, 0.213, 0.217, 0.221, 0.224, 0.228, - & 0.231, 0.235, 0.238, 0.242, 0.245, 0.249, 0.252, 0.256, 0.259, - & 0.263, 0.266, 0.270, 0.273, 0.277, 0.280, 0.284, 0.287, 0.290, - & 0.294, 0.297, 0.301, 0.304, 0.307, 0.311, 0.314, 0.317, 0.321, - & 0.324, 0.327, 0.331, 0.334, 0.337, 0.340, 0.344, 0.347, 0.350, - & 0.353, 0.357, 0.360, 0.363, 0.366, 0.369, 0.373, 0.376, 0.379, - & 0.382, 0.385, 0.389, 0.392, 0.395, 0.398, 0.401, 0.404, 0.407, - & 0.410, 0.413, 0.417, 0.420, 0.423, 0.426, 0.429, 0.432, 0.435, - & 0.438, 0.441, 0.444, 0.447, 0.450, 0.453, 0.456, 0.459, 0.462, - & 0.465, 0.468, 0.471, 0.474, 0.477, 0.480, 0.482, 0.485, 0.488, - & 0.491, 0.494, 0.497, 0.500, 0.503, 0.506, 0.508, 0.511, 0.514, - & 0.517, 0.520, 0.523, 0.525, 0.528, 0.531, 0.534, 0.537, 0.539, - & 0.542, 0.545, 0.548, 0.551, 0.553, 0.556, 0.559, 0.562, 0.564, - & 0.567, 0.570, 0.572, 0.575, 0.578, 0.581, 0.583, 0.586, 0.589, - & 0.591, 0.594, 0.597, 0.599, 0.602, 0.604, 0.607, 0.610, 0.612, - & 0.615, 0.618, 0.620, 0.623, 0.625, 0.628, 0.631, 0.633, 0.636, - & 0.638, 0.641, 0.643, 0.646, 0.648, 0.651, 0.654, 0.656, 0.659, - & 0.661, 0.664, 0.666, 0.669, 0.671, 0.674, 0.676, 0.679, 0.681, - & 0.684, 0.686, 0.688, 0.691, 0.693, 0.696, 0.698, 0.701, 0.703, - & 0.706, 0.708, 0.710, 0.713, 0.715, 0.718, 0.720, 0.722, 0.725, - & 0.727, 0.729, 0.732, 0.734, 0.737, 0.739, 0.741, 0.744, 0.746, - & 0.748, 0.751, 0.753, 0.755, 0.758, 0.760, 0.762, 0.764, 0.767, - & 0.769, 0.771, 0.774, 0.776, 0.778, 0.780, 0.783, 0.785, 0.787, - & 0.789, 0.792, 0.794, 0.796, 0.798, 0.801, 0.803, 0.805, 0.807, - & 0.810, 0.812, 0.814, 0.816, 0.818, 0.821, 0.823, 0.825, 0.827, - & 0.829, 0.831, 0.834, 0.836, 0.859, 0.880, 0.900, 0.921, 0.940, - & 0.960, 0.979, 0.998, 1.016, 1.034, 1.052, 1.070, 1.087, 1.104, - & 1.121, 1.137, 1.154, 1.169, 1.185, 1.201, 1.216, 1.231, 1.246, - & 1.260, 1.274, 1.289, 1.302, 1.316, 1.330, 1.343, 1.356, 1.369, - & 1.382, 1.394, 1.407, 1.419, 1.431, 1.443, 1.455, 1.466, 1.478, - & 1.489, 1.500, 1.511, 1.522, 1.533, 1.543, 1.554, 1.564, 1.574, - & 1.584, 1.594, 1.604, 1.614, 1.623, 1.633, 1.642, 1.651, 1.660, - & 1.670, 1.678, 1.687, 1.696, 1.704, 1.713, 1.721, 1.730, 1.738, - & 1.746, 1.754, 1.762, 1.770, 1.777, 1.785, 1.793, 1.800, 1.807, - & 1.815, 1.822, 1.829, 1.836, 1.843, 1.850, 1.857, 1.864, 1.870, - & 1.877, 1.883, 1.890, 1.896, 1.903, 1.909, 1.915, 1.921, 1.927, - & 1.933, 1.939, 1.945, 1.951, 1.957, 1.962, 1.968, 1.973, 1.979, - & 1.984, 1.990, 1.995, 2.000, 2.006, 2.011, 2.016, 2.021, 2.026, - & 2.031, 2.036, 2.041, 2.045, 2.050, 2.055, 2.059, 2.064, 2.069, - & 2.073, 2.078, 2.082, 2.086, 2.091, 2.095, 2.099, 2.103, 2.108, - & 2.112, 2.116, 2.120, 2.124, 2.128, 2.132, 2.135, 2.139, 2.143, - & 2.147, 2.150, 2.154, 2.158, 2.161, 2.165, 2.168, 2.172, 2.175, - & 2.179, 2.182, 2.185, 2.189, 2.192, 2.195, 2.198, 2.201, 2.205, - & 2.208, 2.211, 2.214 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.052,-0.120,-0.158,-0.187,-0.211,-0.232,-0.251,-0.269,-0.285, - &-0.300,-0.315,-0.329,-0.342,-0.354,-0.367,-0.378,-0.390,-0.401, - &-0.412,-0.422,-0.432,-0.443,-0.452,-0.462,-0.471,-0.481,-0.490, - &-0.498,-0.507,-0.516,-0.524,-0.532,-0.540,-0.548,-0.556,-0.564, - &-0.572,-0.579,-0.587,-0.594,-0.601,-0.608,-0.615,-0.622,-0.629, - &-0.636,-0.642,-0.649,-0.655,-0.661,-0.668,-0.674,-0.680,-0.686, - &-0.692,-0.698,-0.704,-0.710,-0.715,-0.721,-0.727,-0.732,-0.738, - &-0.743,-0.749,-0.754,-0.759,-0.765,-0.770,-0.775,-0.780,-0.785, - &-0.790,-0.796,-0.801,-0.806,-0.811,-0.816,-0.820,-0.825,-0.830, - &-0.835,-0.840,-0.845,-0.850,-0.854,-0.859,-0.864,-0.869,-0.873, - &-0.878,-0.883,-0.888,-0.892,-0.897,-0.902,-0.906,-0.911,-0.916, - &-0.920,-0.925,-0.929,-0.934,-0.938,-0.943,-0.948,-0.952,-0.957, - &-0.961,-0.966,-0.970,-0.974,-0.979,-0.983,-0.988,-0.992,-0.996, - &-1.001,-1.005,-1.009,-1.014,-1.018,-1.022,-1.026,-1.031,-1.035, - &-1.039,-1.043,-1.047,-1.052,-1.056,-1.060,-1.064,-1.068,-1.072, - &-1.076,-1.080,-1.084,-1.088,-1.092,-1.096,-1.100,-1.104,-1.108, - &-1.112,-1.115,-1.119,-1.123,-1.127,-1.131,-1.134,-1.138,-1.142, - &-1.146,-1.149,-1.153,-1.157,-1.160,-1.164,-1.168,-1.171,-1.175, - &-1.178,-1.182,-1.185,-1.189,-1.192,-1.196,-1.199,-1.203,-1.206, - &-1.210,-1.213,-1.217,-1.220,-1.223,-1.227,-1.230,-1.234,-1.237, - &-1.240,-1.243,-1.247,-1.250,-1.253,-1.257,-1.260,-1.263,-1.266, - &-1.269,-1.273,-1.276,-1.279,-1.282,-1.285,-1.288,-1.291,-1.295, - &-1.298,-1.301,-1.304,-1.307,-1.310,-1.313,-1.316,-1.319,-1.322, - &-1.325,-1.328,-1.331,-1.334,-1.337,-1.340,-1.342,-1.345,-1.348, - &-1.351,-1.354,-1.357,-1.360,-1.362,-1.365,-1.368,-1.371,-1.374, - &-1.376,-1.379,-1.382,-1.385,-1.387,-1.390,-1.393,-1.396,-1.398, - &-1.401,-1.404,-1.406,-1.409,-1.412,-1.414,-1.417,-1.420,-1.422, - &-1.425,-1.427,-1.430,-1.432,-1.435,-1.438,-1.440,-1.443,-1.445, - &-1.448,-1.450,-1.453,-1.455,-1.458,-1.460,-1.463,-1.465,-1.468, - &-1.470,-1.472,-1.475,-1.477,-1.480,-1.482,-1.484,-1.487,-1.489, - &-1.492,-1.494,-1.496,-1.499,-1.501,-1.503,-1.506,-1.508,-1.510, - &-1.512,-1.515,-1.517,-1.519,-1.522,-1.524,-1.526,-1.528,-1.531, - &-1.533,-1.535,-1.537,-1.539,-1.542,-1.544,-1.546,-1.548,-1.550, - &-1.552,-1.555,-1.557,-1.559,-1.561,-1.563,-1.565,-1.567,-1.569, - &-1.572,-1.574,-1.576,-1.578,-1.580,-1.582,-1.584,-1.586,-1.588, - &-1.590,-1.592,-1.594,-1.596,-1.598,-1.600,-1.602,-1.604,-1.606, - &-1.608,-1.610,-1.612,-1.614,-1.616,-1.618,-1.620,-1.622,-1.624, - &-1.626,-1.628,-1.630,-1.632,-1.633,-1.635,-1.637,-1.639,-1.641, - &-1.643,-1.645,-1.647,-1.648,-1.650,-1.652,-1.654,-1.656,-1.658, - &-1.660,-1.661,-1.663,-1.665,-1.667,-1.669,-1.670,-1.672,-1.674, - &-1.676,-1.678,-1.679,-1.681,-1.683,-1.685,-1.686,-1.688,-1.690, - &-1.692,-1.693,-1.695,-1.697,-1.698,-1.700,-1.702,-1.704,-1.705, - &-1.707,-1.709,-1.710,-1.712,-1.714,-1.715,-1.717,-1.719,-1.720, - &-1.722,-1.724,-1.725,-1.727,-1.729,-1.730,-1.732,-1.733,-1.735, - &-1.737,-1.738,-1.740,-1.741,-1.758,-1.774,-1.789,-1.803,-1.817, - &-1.831,-1.845,-1.858,-1.871,-1.884,-1.896,-1.908,-1.920,-1.932, - &-1.943,-1.954,-1.965,-1.976,-1.987,-1.997,-2.008,-2.018,-2.028, - &-2.037,-2.047,-2.056,-2.066,-2.075,-2.084,-2.093,-2.102,-2.111, - &-2.119,-2.128,-2.136,-2.144,-2.152,-2.161,-2.169,-2.176,-2.184, - &-2.192,-2.200,-2.207,-2.215,-2.222,-2.230,-2.237,-2.244,-2.251, - &-2.259,-2.266,-2.273,-2.280,-2.287,-2.293,-2.300,-2.307,-2.314, - &-2.320,-2.327,-2.334,-2.340,-2.347,-2.353,-2.360,-2.366,-2.372, - &-2.379,-2.385,-2.391,-2.397,-2.403,-2.410,-2.416,-2.422,-2.428, - &-2.434,-2.440,-2.446,-2.452,-2.458,-2.464,-2.470,-2.475,-2.481, - &-2.487,-2.493,-2.499,-2.504,-2.510,-2.516,-2.522,-2.527,-2.533, - &-2.539,-2.544,-2.550,-2.555,-2.561,-2.566,-2.572,-2.578,-2.583, - &-2.588,-2.594,-2.599,-2.605,-2.610,-2.616,-2.621,-2.627,-2.632, - &-2.637,-2.643,-2.648,-2.653,-2.659,-2.664,-2.669,-2.675,-2.680, - &-2.685,-2.690,-2.696,-2.701,-2.706,-2.711,-2.716,-2.722,-2.727, - &-2.732,-2.737,-2.742,-2.748,-2.753,-2.758,-2.763,-2.768,-2.773, - &-2.778,-2.783,-2.788,-2.794,-2.799,-2.804,-2.809,-2.814,-2.819, - &-2.824,-2.829,-2.834,-2.839,-2.844,-2.849,-2.854,-2.859,-2.864, - &-2.869,-2.874,-2.879 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.049,-0.105,-0.132,-0.151,-0.164,-0.176,-0.185,-0.193,-0.200, - &-0.206,-0.211,-0.216,-0.221,-0.224,-0.228,-0.231,-0.234,-0.237, - &-0.240,-0.242,-0.244,-0.246,-0.248,-0.250,-0.252,-0.253,-0.255, - &-0.256,-0.257,-0.258,-0.260,-0.261,-0.262,-0.263,-0.264,-0.265, - &-0.265,-0.266,-0.267,-0.268,-0.268,-0.269,-0.270,-0.270,-0.271, - &-0.271,-0.272,-0.272,-0.273,-0.273,-0.274,-0.274,-0.275,-0.275, - &-0.275,-0.276,-0.276,-0.276,-0.277,-0.277,-0.277,-0.278,-0.278, - &-0.278,-0.278,-0.279,-0.279,-0.279,-0.279,-0.280,-0.280,-0.280, - &-0.280,-0.280,-0.280,-0.280,-0.281,-0.281,-0.281,-0.281,-0.281, - &-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281, - &-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.280,-0.280, - &-0.280,-0.280,-0.280,-0.280,-0.280,-0.279,-0.279,-0.279,-0.279, - &-0.279,-0.278,-0.278,-0.278,-0.278,-0.278,-0.277,-0.277,-0.277, - &-0.277,-0.276,-0.276,-0.276,-0.276,-0.275,-0.275,-0.275,-0.275, - &-0.274,-0.274,-0.274,-0.273,-0.273,-0.273,-0.273,-0.272,-0.272, - &-0.272,-0.271,-0.271,-0.271,-0.270,-0.270,-0.270,-0.270,-0.269, - &-0.269,-0.269,-0.268,-0.268,-0.268,-0.267,-0.267,-0.267,-0.267, - &-0.266,-0.266,-0.266,-0.265,-0.265,-0.265,-0.264,-0.264,-0.264, - &-0.263,-0.263,-0.263,-0.262,-0.262,-0.262,-0.262,-0.261,-0.261, - &-0.261,-0.260,-0.260,-0.260,-0.259,-0.259,-0.259,-0.258,-0.258, - &-0.258,-0.258,-0.257,-0.257,-0.257,-0.256,-0.256,-0.256,-0.255, - &-0.255,-0.255,-0.254,-0.254,-0.254,-0.254,-0.253,-0.253,-0.253, - &-0.252,-0.252,-0.252,-0.251,-0.251,-0.251,-0.251,-0.250,-0.250, - &-0.250,-0.249,-0.249,-0.249,-0.248,-0.248,-0.248,-0.248,-0.247, - &-0.247,-0.247,-0.246,-0.246,-0.246,-0.246,-0.245,-0.245,-0.245, - &-0.244,-0.244,-0.244,-0.244,-0.243,-0.243,-0.243,-0.242,-0.242, - &-0.242,-0.242,-0.241,-0.241,-0.241,-0.241,-0.240,-0.240,-0.240, - &-0.239,-0.239,-0.239,-0.239,-0.238,-0.238,-0.238,-0.238,-0.237, - &-0.237,-0.237,-0.236,-0.236,-0.236,-0.236,-0.235,-0.235,-0.235, - &-0.235,-0.234,-0.234,-0.234,-0.234,-0.233,-0.233,-0.233,-0.233, - &-0.232,-0.232,-0.232,-0.232,-0.231,-0.231,-0.231,-0.231,-0.230, - &-0.230,-0.230,-0.230,-0.229,-0.229,-0.229,-0.229,-0.228,-0.228, - &-0.228,-0.228,-0.227,-0.227,-0.227,-0.227,-0.226,-0.226,-0.226, - &-0.226,-0.226,-0.225,-0.225,-0.225,-0.225,-0.224,-0.224,-0.224, - &-0.224,-0.223,-0.223,-0.223,-0.223,-0.223,-0.222,-0.222,-0.222, - &-0.222,-0.221,-0.221,-0.221,-0.221,-0.221,-0.220,-0.220,-0.220, - &-0.220,-0.220,-0.219,-0.219,-0.219,-0.219,-0.218,-0.218,-0.218, - &-0.218,-0.218,-0.217,-0.217,-0.217,-0.217,-0.217,-0.216,-0.216, - &-0.216,-0.216,-0.216,-0.215,-0.215,-0.215,-0.215,-0.215,-0.215, - &-0.214,-0.214,-0.214,-0.214,-0.214,-0.213,-0.213,-0.213,-0.213, - &-0.213,-0.212,-0.212,-0.212,-0.212,-0.212,-0.212,-0.211,-0.211, - &-0.211,-0.211,-0.211,-0.210,-0.210,-0.210,-0.210,-0.210,-0.210, - &-0.209,-0.209,-0.209,-0.209,-0.209,-0.209,-0.208,-0.208,-0.208, - &-0.208,-0.208,-0.208,-0.207,-0.207,-0.207,-0.207,-0.207,-0.207, - &-0.206,-0.206,-0.206,-0.206,-0.204,-0.203,-0.202,-0.200,-0.199, - &-0.198,-0.197,-0.196,-0.195,-0.194,-0.193,-0.192,-0.191,-0.190, - &-0.190,-0.189,-0.189,-0.188,-0.188,-0.187,-0.187,-0.187,-0.186, - &-0.186,-0.186,-0.186,-0.186,-0.186,-0.186,-0.186,-0.186,-0.186, - &-0.186,-0.186,-0.187,-0.187,-0.187,-0.187,-0.188,-0.188,-0.189, - &-0.189,-0.190,-0.190,-0.191,-0.191,-0.192,-0.193,-0.193,-0.194, - &-0.195,-0.196,-0.196,-0.197,-0.198,-0.199,-0.200,-0.201,-0.202, - &-0.203,-0.204,-0.205,-0.206,-0.207,-0.208,-0.209,-0.210,-0.212, - &-0.213,-0.214,-0.215,-0.217,-0.218,-0.219,-0.220,-0.222,-0.223, - &-0.225,-0.226,-0.227,-0.229,-0.230,-0.232,-0.233,-0.235,-0.236, - &-0.238,-0.239,-0.241,-0.243,-0.244,-0.246,-0.247,-0.249,-0.251, - &-0.252,-0.254,-0.256,-0.258,-0.259,-0.261,-0.263,-0.265,-0.266, - &-0.268,-0.270,-0.272,-0.274,-0.276,-0.278,-0.280,-0.281,-0.283, - &-0.285,-0.287,-0.289,-0.291,-0.293,-0.295,-0.297,-0.299,-0.301, - &-0.303,-0.305,-0.307,-0.309,-0.311,-0.314,-0.316,-0.318,-0.320, - &-0.322,-0.324,-0.326,-0.329,-0.331,-0.333,-0.335,-0.337,-0.340, - &-0.342,-0.344,-0.346,-0.348,-0.351,-0.353,-0.355,-0.358,-0.360, - &-0.362,-0.364,-0.367,-0.369,-0.371,-0.374,-0.376,-0.379,-0.381, - &-0.383,-0.386,-0.388 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.200,-0.434,-0.550,-0.632,-0.696,-0.748,-0.793,-0.833,-0.868, - &-0.900,-0.928,-0.955,-0.979,-1.002,-1.023,-1.043,-1.062,-1.079, - &-1.096,-1.112,-1.127,-1.142,-1.156,-1.170,-1.182,-1.195,-1.207, - &-1.218,-1.230,-1.241,-1.251,-1.261,-1.271,-1.281,-1.290,-1.300, - &-1.309,-1.317,-1.326,-1.334,-1.342,-1.350,-1.358,-1.366,-1.373, - &-1.381,-1.388,-1.395,-1.402,-1.409,-1.416,-1.422,-1.429,-1.435, - &-1.442,-1.448,-1.454,-1.460,-1.466,-1.472,-1.478,-1.484,-1.489, - &-1.495,-1.500,-1.506,-1.511,-1.517,-1.522,-1.527,-1.532,-1.537, - &-1.542,-1.547,-1.552,-1.557,-1.562,-1.567,-1.571,-1.576,-1.581, - &-1.585,-1.590,-1.594,-1.599,-1.603,-1.608,-1.612,-1.616,-1.620, - &-1.625,-1.629,-1.633,-1.637,-1.641,-1.645,-1.649,-1.653,-1.657, - &-1.661,-1.665,-1.669,-1.672,-1.676,-1.680,-1.684,-1.687,-1.691, - &-1.695,-1.698,-1.702,-1.706,-1.709,-1.713,-1.716,-1.720,-1.723, - &-1.727,-1.730,-1.733,-1.737,-1.740,-1.744,-1.747,-1.750,-1.753, - &-1.757,-1.760,-1.763,-1.766,-1.770,-1.773,-1.776,-1.779,-1.782, - &-1.786,-1.789,-1.792,-1.795,-1.798,-1.801,-1.804,-1.807,-1.810, - &-1.813,-1.816,-1.819,-1.822,-1.825,-1.828,-1.831,-1.834,-1.837, - &-1.840,-1.843,-1.846,-1.849,-1.851,-1.854,-1.857,-1.860,-1.863, - &-1.866,-1.868,-1.871,-1.874,-1.877,-1.880,-1.882,-1.885,-1.888, - &-1.891,-1.894,-1.896,-1.899,-1.902,-1.904,-1.907,-1.910,-1.913, - &-1.915,-1.918,-1.921,-1.923,-1.926,-1.929,-1.931,-1.934,-1.936, - &-1.939,-1.942,-1.944,-1.947,-1.950,-1.952,-1.955,-1.957,-1.960, - &-1.962,-1.965,-1.968,-1.970,-1.973,-1.975,-1.978,-1.980,-1.983, - &-1.985,-1.988,-1.990,-1.993,-1.995,-1.998,-2.000,-2.003,-2.005, - &-2.008,-2.010,-2.013,-2.015,-2.018,-2.020,-2.023,-2.025,-2.028, - &-2.030,-2.032,-2.035,-2.037,-2.040,-2.042,-2.044,-2.047,-2.049, - &-2.052,-2.054,-2.057,-2.059,-2.061,-2.064,-2.066,-2.068,-2.071, - &-2.073,-2.076,-2.078,-2.080,-2.083,-2.085,-2.087,-2.090,-2.092, - &-2.094,-2.097,-2.099,-2.101,-2.104,-2.106,-2.108,-2.111,-2.113, - &-2.115,-2.118,-2.120,-2.122,-2.124,-2.127,-2.129,-2.131,-2.134, - &-2.136,-2.138,-2.141,-2.143,-2.145,-2.147,-2.150,-2.152,-2.154, - &-2.156,-2.159,-2.161,-2.163,-2.165,-2.168,-2.170,-2.172,-2.174, - &-2.177,-2.179,-2.181,-2.183,-2.186,-2.188,-2.190,-2.192,-2.195, - &-2.197,-2.199,-2.201,-2.203,-2.206,-2.208,-2.210,-2.212,-2.214, - &-2.217,-2.219,-2.221,-2.223,-2.225,-2.228,-2.230,-2.232,-2.234, - &-2.236,-2.239,-2.241,-2.243,-2.245,-2.247,-2.249,-2.252,-2.254, - &-2.256,-2.258,-2.260,-2.262,-2.265,-2.267,-2.269,-2.271,-2.273, - &-2.275,-2.278,-2.280,-2.282,-2.284,-2.286,-2.288,-2.290,-2.293, - &-2.295,-2.297,-2.299,-2.301,-2.303,-2.305,-2.308,-2.310,-2.312, - &-2.314,-2.316,-2.318,-2.320,-2.322,-2.325,-2.327,-2.329,-2.331, - &-2.333,-2.335,-2.337,-2.339,-2.341,-2.344,-2.346,-2.348,-2.350, - &-2.352,-2.354,-2.356,-2.358,-2.360,-2.362,-2.365,-2.367,-2.369, - &-2.371,-2.373,-2.375,-2.377,-2.379,-2.381,-2.383,-2.385,-2.388, - &-2.390,-2.392,-2.394,-2.396,-2.398,-2.400,-2.402,-2.404,-2.406, - &-2.408,-2.410,-2.412,-2.415,-2.437,-2.457,-2.478,-2.498,-2.518, - &-2.539,-2.559,-2.579,-2.599,-2.619,-2.638,-2.658,-2.678,-2.698, - &-2.717,-2.737,-2.756,-2.776,-2.795,-2.815,-2.834,-2.854,-2.873, - &-2.892,-2.911,-2.931,-2.950,-2.969,-2.988,-3.007,-3.026,-3.045, - &-3.064,-3.083,-3.102,-3.121,-3.140,-3.159,-3.178,-3.197,-3.215, - &-3.234,-3.253,-3.272,-3.291,-3.309,-3.328,-3.347,-3.365,-3.384, - &-3.403,-3.421,-3.440,-3.459,-3.477,-3.496,-3.514,-3.533,-3.551, - &-3.570,-3.588,-3.607,-3.625,-3.644,-3.662,-3.681,-3.699,-3.718, - &-3.736,-3.754,-3.773,-3.791,-3.810,-3.828,-3.846,-3.865,-3.883, - &-3.901,-3.920,-3.938,-3.956,-3.974,-3.993,-4.011,-4.029,-4.047, - &-4.066,-4.084,-4.102,-4.120,-4.139,-4.157,-4.175,-4.193,-4.211, - &-4.229,-4.248,-4.266,-4.284,-4.302,-4.320,-4.338,-4.356,-4.374, - &-4.392,-4.411,-4.429,-4.447,-4.465,-4.483,-4.501,-4.519,-4.537, - &-4.555,-4.573,-4.591,-4.609,-4.627,-4.645,-4.663,-4.681,-4.699, - &-4.717,-4.735,-4.753,-4.771,-4.789,-4.807,-4.825,-4.842,-4.860, - &-4.878,-4.896,-4.914,-4.932,-4.950,-4.968,-4.986,-5.004,-5.021, - &-5.039,-5.057,-5.075,-5.093,-5.111,-5.129,-5.146,-5.164,-5.182, - &-5.200,-5.218,-5.235,-5.253,-5.271,-5.289,-5.307,-5.324,-5.342, - &-5.360,-5.378,-5.395 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.097,-0.201,-0.248,-0.278,-0.300,-0.316,-0.329,-0.339,-0.347, - &-0.354,-0.359,-0.363,-0.366,-0.369,-0.370,-0.372,-0.372,-0.373, - &-0.372,-0.372,-0.371,-0.370,-0.369,-0.367,-0.366,-0.364,-0.362, - &-0.359,-0.357,-0.354,-0.352,-0.349,-0.346,-0.344,-0.341,-0.338, - &-0.334,-0.331,-0.328,-0.325,-0.322,-0.318,-0.315,-0.312,-0.308, - &-0.305,-0.301,-0.298,-0.294,-0.291,-0.287,-0.284,-0.280,-0.277, - &-0.273,-0.270,-0.266,-0.263,-0.259,-0.256,-0.252,-0.248,-0.245, - &-0.241,-0.238,-0.234,-0.230,-0.227,-0.223,-0.219,-0.216,-0.212, - &-0.208,-0.204,-0.201,-0.197,-0.193,-0.189,-0.185,-0.181,-0.177, - &-0.173,-0.169,-0.165,-0.161,-0.157,-0.153,-0.149,-0.145,-0.141, - &-0.136,-0.132,-0.128,-0.123,-0.119,-0.115,-0.110,-0.106,-0.101, - &-0.097,-0.092,-0.087,-0.083,-0.078,-0.073,-0.069,-0.064,-0.059, - &-0.055,-0.050,-0.045,-0.040,-0.035,-0.031,-0.026,-0.021,-0.016, - &-0.011,-0.006,-0.001, 0.003, 0.008, 0.013, 0.018, 0.023, 0.028, - & 0.033, 0.038, 0.043, 0.048, 0.052, 0.057, 0.062, 0.067, 0.072, - & 0.077, 0.082, 0.087, 0.092, 0.097, 0.101, 0.106, 0.111, 0.116, - & 0.121, 0.126, 0.131, 0.135, 0.140, 0.145, 0.150, 0.155, 0.160, - & 0.164, 0.169, 0.174, 0.179, 0.184, 0.188, 0.193, 0.198, 0.203, - & 0.207, 0.212, 0.217, 0.222, 0.226, 0.231, 0.236, 0.241, 0.245, - & 0.250, 0.255, 0.259, 0.264, 0.269, 0.273, 0.278, 0.283, 0.287, - & 0.292, 0.297, 0.301, 0.306, 0.311, 0.315, 0.320, 0.324, 0.329, - & 0.333, 0.338, 0.343, 0.347, 0.352, 0.356, 0.361, 0.365, 0.370, - & 0.374, 0.379, 0.383, 0.388, 0.392, 0.397, 0.401, 0.406, 0.410, - & 0.414, 0.419, 0.423, 0.428, 0.432, 0.437, 0.441, 0.445, 0.450, - & 0.454, 0.458, 0.463, 0.467, 0.472, 0.476, 0.480, 0.484, 0.489, - & 0.493, 0.497, 0.502, 0.506, 0.510, 0.514, 0.519, 0.523, 0.527, - & 0.531, 0.536, 0.540, 0.544, 0.548, 0.553, 0.557, 0.561, 0.565, - & 0.569, 0.573, 0.578, 0.582, 0.586, 0.590, 0.594, 0.598, 0.602, - & 0.606, 0.610, 0.615, 0.619, 0.623, 0.627, 0.631, 0.635, 0.639, - & 0.643, 0.647, 0.651, 0.655, 0.659, 0.663, 0.667, 0.671, 0.675, - & 0.679, 0.683, 0.687, 0.691, 0.695, 0.699, 0.703, 0.706, 0.710, - & 0.714, 0.718, 0.722, 0.726, 0.730, 0.734, 0.738, 0.741, 0.745, - & 0.749, 0.753, 0.757, 0.761, 0.764, 0.768, 0.772, 0.776, 0.779, - & 0.783, 0.787, 0.791, 0.795, 0.798, 0.802, 0.806, 0.809, 0.813, - & 0.817, 0.821, 0.824, 0.828, 0.832, 0.835, 0.839, 0.843, 0.846, - & 0.850, 0.854, 0.857, 0.861, 0.865, 0.868, 0.872, 0.875, 0.879, - & 0.883, 0.886, 0.890, 0.893, 0.897, 0.900, 0.904, 0.907, 0.911, - & 0.915, 0.918, 0.922, 0.925, 0.929, 0.932, 0.936, 0.939, 0.943, - & 0.946, 0.950, 0.953, 0.956, 0.960, 0.963, 0.967, 0.970, 0.974, - & 0.977, 0.980, 0.984, 0.987, 0.991, 0.994, 0.997, 1.001, 1.004, - & 1.007, 1.011, 1.014, 1.018, 1.021, 1.024, 1.028, 1.031, 1.034, - & 1.037, 1.041, 1.044, 1.047, 1.051, 1.054, 1.057, 1.060, 1.064, - & 1.067, 1.070, 1.073, 1.077, 1.080, 1.083, 1.086, 1.090, 1.093, - & 1.096, 1.099, 1.102, 1.106, 1.109, 1.112, 1.115, 1.118, 1.121, - & 1.125, 1.128, 1.131, 1.134, 1.167, 1.198, 1.228, 1.257, 1.286, - & 1.314, 1.342, 1.370, 1.397, 1.423, 1.449, 1.475, 1.500, 1.525, - & 1.549, 1.573, 1.597, 1.620, 1.643, 1.665, 1.687, 1.709, 1.730, - & 1.751, 1.772, 1.793, 1.813, 1.833, 1.852, 1.871, 1.890, 1.909, - & 1.927, 1.945, 1.963, 1.981, 1.998, 2.015, 2.032, 2.049, 2.065, - & 2.081, 2.097, 2.112, 2.128, 2.143, 2.158, 2.173, 2.187, 2.202, - & 2.216, 2.230, 2.244, 2.257, 2.271, 2.284, 2.297, 2.310, 2.322, - & 2.335, 2.347, 2.359, 2.371, 2.383, 2.395, 2.406, 2.418, 2.429, - & 2.440, 2.451, 2.462, 2.472, 2.483, 2.493, 2.503, 2.513, 2.523, - & 2.533, 2.543, 2.552, 2.562, 2.571, 2.580, 2.589, 2.598, 2.607, - & 2.616, 2.624, 2.633, 2.641, 2.650, 2.658, 2.666, 2.674, 2.681, - & 2.689, 2.697, 2.704, 2.712, 2.719, 2.726, 2.733, 2.740, 2.747, - & 2.754, 2.761, 2.768, 2.774, 2.781, 2.787, 2.793, 2.800, 2.806, - & 2.812, 2.818, 2.824, 2.830, 2.835, 2.841, 2.847, 2.852, 2.858, - & 2.863, 2.868, 2.873, 2.879, 2.884, 2.889, 2.893, 2.898, 2.903, - & 2.908, 2.912, 2.917, 2.922, 2.926, 2.930, 2.935, 2.939, 2.943, - & 2.947, 2.951, 2.955, 2.959, 2.963, 2.967, 2.971, 2.974, 2.978, - & 2.982, 2.985, 2.989, 2.992, 2.996, 2.999, 3.002, 3.005, 3.009, - & 3.012, 3.015, 3.018 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.096,-0.198,-0.242,-0.270,-0.290,-0.304,-0.315,-0.323,-0.329, - &-0.333,-0.337,-0.339,-0.340,-0.341,-0.340,-0.340,-0.339,-0.337, - &-0.335,-0.333,-0.330,-0.327,-0.324,-0.320,-0.317,-0.313,-0.309, - &-0.305,-0.301,-0.296,-0.292,-0.287,-0.283,-0.278,-0.273,-0.268, - &-0.263,-0.258,-0.253,-0.248,-0.243,-0.238,-0.233,-0.228,-0.222, - &-0.217,-0.212,-0.207,-0.202,-0.196,-0.191,-0.186,-0.180,-0.175, - &-0.170,-0.164,-0.159,-0.154,-0.149,-0.143,-0.138,-0.133,-0.127, - &-0.122,-0.117,-0.111,-0.106,-0.100,-0.095,-0.090,-0.084,-0.079, - &-0.073,-0.068,-0.062,-0.057,-0.051,-0.045,-0.040,-0.034,-0.028, - &-0.023,-0.017,-0.011,-0.005, 0.001, 0.007, 0.013, 0.019, 0.025, - & 0.031, 0.037, 0.043, 0.049, 0.055, 0.062, 0.068, 0.074, 0.081, - & 0.087, 0.094, 0.100, 0.107, 0.113, 0.120, 0.126, 0.133, 0.140, - & 0.146, 0.153, 0.160, 0.166, 0.173, 0.180, 0.187, 0.193, 0.200, - & 0.207, 0.214, 0.220, 0.227, 0.234, 0.241, 0.248, 0.255, 0.261, - & 0.268, 0.275, 0.282, 0.289, 0.296, 0.302, 0.309, 0.316, 0.323, - & 0.330, 0.337, 0.343, 0.350, 0.357, 0.364, 0.371, 0.377, 0.384, - & 0.391, 0.398, 0.404, 0.411, 0.418, 0.425, 0.431, 0.438, 0.445, - & 0.451, 0.458, 0.465, 0.471, 0.478, 0.485, 0.491, 0.498, 0.505, - & 0.511, 0.518, 0.524, 0.531, 0.537, 0.544, 0.551, 0.557, 0.564, - & 0.570, 0.577, 0.583, 0.590, 0.596, 0.603, 0.609, 0.616, 0.622, - & 0.628, 0.635, 0.641, 0.648, 0.654, 0.660, 0.667, 0.673, 0.679, - & 0.686, 0.692, 0.698, 0.705, 0.711, 0.717, 0.724, 0.730, 0.736, - & 0.742, 0.749, 0.755, 0.761, 0.767, 0.773, 0.780, 0.786, 0.792, - & 0.798, 0.804, 0.810, 0.816, 0.823, 0.829, 0.835, 0.841, 0.847, - & 0.853, 0.859, 0.865, 0.871, 0.877, 0.883, 0.889, 0.895, 0.901, - & 0.907, 0.913, 0.919, 0.925, 0.931, 0.937, 0.942, 0.948, 0.954, - & 0.960, 0.966, 0.972, 0.978, 0.983, 0.989, 0.995, 1.001, 1.007, - & 1.012, 1.018, 1.024, 1.030, 1.035, 1.041, 1.047, 1.052, 1.058, - & 1.064, 1.069, 1.075, 1.081, 1.086, 1.092, 1.098, 1.103, 1.109, - & 1.114, 1.120, 1.125, 1.131, 1.136, 1.142, 1.148, 1.153, 1.159, - & 1.164, 1.169, 1.175, 1.180, 1.186, 1.191, 1.197, 1.202, 1.208, - & 1.213, 1.218, 1.224, 1.229, 1.234, 1.240, 1.245, 1.250, 1.256, - & 1.261, 1.266, 1.272, 1.277, 1.282, 1.287, 1.293, 1.298, 1.303, - & 1.308, 1.314, 1.319, 1.324, 1.329, 1.334, 1.339, 1.345, 1.350, - & 1.355, 1.360, 1.365, 1.370, 1.375, 1.380, 1.385, 1.390, 1.396, - & 1.401, 1.406, 1.411, 1.416, 1.421, 1.426, 1.431, 1.436, 1.441, - & 1.446, 1.451, 1.456, 1.460, 1.465, 1.470, 1.475, 1.480, 1.485, - & 1.490, 1.495, 1.500, 1.504, 1.509, 1.514, 1.519, 1.524, 1.529, - & 1.533, 1.538, 1.543, 1.548, 1.553, 1.557, 1.562, 1.567, 1.572, - & 1.576, 1.581, 1.586, 1.590, 1.595, 1.600, 1.604, 1.609, 1.614, - & 1.618, 1.623, 1.628, 1.632, 1.637, 1.642, 1.646, 1.651, 1.655, - & 1.660, 1.664, 1.669, 1.674, 1.678, 1.683, 1.687, 1.692, 1.696, - & 1.701, 1.705, 1.710, 1.714, 1.719, 1.723, 1.728, 1.732, 1.736, - & 1.741, 1.745, 1.750, 1.754, 1.759, 1.763, 1.767, 1.772, 1.776, - & 1.780, 1.785, 1.789, 1.793, 1.840, 1.882, 1.923, 1.964, 2.004, - & 2.044, 2.082, 2.120, 2.158, 2.195, 2.231, 2.267, 2.302, 2.336, - & 2.370, 2.404, 2.437, 2.469, 2.501, 2.533, 2.564, 2.594, 2.624, - & 2.654, 2.683, 2.712, 2.741, 2.768, 2.796, 2.823, 2.850, 2.877, - & 2.903, 2.928, 2.954, 2.979, 3.003, 3.028, 3.052, 3.076, 3.099, - & 3.122, 3.145, 3.167, 3.190, 3.211, 3.233, 3.254, 3.276, 3.296, - & 3.317, 3.337, 3.357, 3.377, 3.397, 3.416, 3.435, 3.454, 3.473, - & 3.491, 3.509, 3.527, 3.545, 3.563, 3.580, 3.597, 3.614, 3.631, - & 3.647, 3.664, 3.680, 3.696, 3.712, 3.727, 3.743, 3.758, 3.773, - & 3.788, 3.803, 3.817, 3.832, 3.846, 3.860, 3.874, 3.888, 3.902, - & 3.915, 3.928, 3.942, 3.955, 3.968, 3.980, 3.993, 4.006, 4.018, - & 4.030, 4.042, 4.054, 4.066, 4.078, 4.089, 4.101, 4.112, 4.123, - & 4.134, 4.145, 4.156, 4.167, 4.178, 4.188, 4.199, 4.209, 4.219, - & 4.229, 4.239, 4.249, 4.259, 4.269, 4.278, 4.288, 4.297, 4.306, - & 4.316, 4.325, 4.334, 4.343, 4.351, 4.360, 4.369, 4.377, 4.386, - & 4.394, 4.402, 4.411, 4.419, 4.427, 4.435, 4.442, 4.450, 4.458, - & 4.466, 4.473, 4.480, 4.488, 4.495, 4.502, 4.510, 4.517, 4.524, - & 4.531, 4.537, 4.544, 4.551, 4.558, 4.564, 4.571, 4.577, 4.583, - & 4.590, 4.596, 4.602 - & / - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM248 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 248K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM248 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC248/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF248 -C -C *** Common block definition -C - COMMON /KMC248/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.047,-0.099,-0.122,-0.137,-0.148,-0.156,-0.163,-0.168,-0.172, - &-0.176,-0.178,-0.181,-0.182,-0.184,-0.185,-0.186,-0.186,-0.187, - &-0.187,-0.187,-0.187,-0.187,-0.186,-0.186,-0.185,-0.184,-0.184, - &-0.183,-0.182,-0.181,-0.180,-0.179,-0.178,-0.176,-0.175,-0.174, - &-0.173,-0.171,-0.170,-0.168,-0.167,-0.166,-0.164,-0.163,-0.161, - &-0.160,-0.158,-0.157,-0.155,-0.154,-0.152,-0.151,-0.149,-0.148, - &-0.146,-0.145,-0.143,-0.141,-0.140,-0.138,-0.137,-0.135,-0.134, - &-0.132,-0.130,-0.129,-0.127,-0.126,-0.124,-0.122,-0.121,-0.119, - &-0.117,-0.116,-0.114,-0.112,-0.111,-0.109,-0.107,-0.105,-0.104, - &-0.102,-0.100,-0.098,-0.096,-0.095,-0.093,-0.091,-0.089,-0.087, - &-0.085,-0.083,-0.081,-0.079,-0.077,-0.075,-0.073,-0.071,-0.069, - &-0.067,-0.065,-0.063,-0.061,-0.059,-0.057,-0.055,-0.053,-0.051, - &-0.048,-0.046,-0.044,-0.042,-0.040,-0.038,-0.036,-0.033,-0.031, - &-0.029,-0.027,-0.025,-0.022,-0.020,-0.018,-0.016,-0.014,-0.011, - &-0.009,-0.007,-0.005,-0.003, 0.000, 0.002, 0.004, 0.006, 0.008, - & 0.011, 0.013, 0.015, 0.017, 0.020, 0.022, 0.024, 0.026, 0.028, - & 0.030, 0.033, 0.035, 0.037, 0.039, 0.041, 0.044, 0.046, 0.048, - & 0.050, 0.052, 0.054, 0.057, 0.059, 0.061, 0.063, 0.065, 0.067, - & 0.070, 0.072, 0.074, 0.076, 0.078, 0.080, 0.082, 0.085, 0.087, - & 0.089, 0.091, 0.093, 0.095, 0.097, 0.099, 0.102, 0.104, 0.106, - & 0.108, 0.110, 0.112, 0.114, 0.116, 0.118, 0.120, 0.122, 0.125, - & 0.127, 0.129, 0.131, 0.133, 0.135, 0.137, 0.139, 0.141, 0.143, - & 0.145, 0.147, 0.149, 0.151, 0.153, 0.155, 0.157, 0.159, 0.161, - & 0.163, 0.165, 0.167, 0.169, 0.171, 0.173, 0.175, 0.177, 0.179, - & 0.181, 0.183, 0.185, 0.187, 0.189, 0.191, 0.193, 0.195, 0.197, - & 0.199, 0.201, 0.203, 0.205, 0.207, 0.209, 0.211, 0.213, 0.215, - & 0.217, 0.219, 0.221, 0.223, 0.224, 0.226, 0.228, 0.230, 0.232, - & 0.234, 0.236, 0.238, 0.240, 0.242, 0.243, 0.245, 0.247, 0.249, - & 0.251, 0.253, 0.255, 0.257, 0.258, 0.260, 0.262, 0.264, 0.266, - & 0.268, 0.270, 0.271, 0.273, 0.275, 0.277, 0.279, 0.281, 0.282, - & 0.284, 0.286, 0.288, 0.290, 0.291, 0.293, 0.295, 0.297, 0.299, - & 0.300, 0.302, 0.304, 0.306, 0.308, 0.309, 0.311, 0.313, 0.315, - & 0.316, 0.318, 0.320, 0.322, 0.323, 0.325, 0.327, 0.329, 0.330, - & 0.332, 0.334, 0.336, 0.337, 0.339, 0.341, 0.342, 0.344, 0.346, - & 0.348, 0.349, 0.351, 0.353, 0.354, 0.356, 0.358, 0.359, 0.361, - & 0.363, 0.364, 0.366, 0.368, 0.370, 0.371, 0.373, 0.374, 0.376, - & 0.378, 0.379, 0.381, 0.383, 0.384, 0.386, 0.388, 0.389, 0.391, - & 0.393, 0.394, 0.396, 0.397, 0.399, 0.401, 0.402, 0.404, 0.406, - & 0.407, 0.409, 0.410, 0.412, 0.414, 0.415, 0.417, 0.418, 0.420, - & 0.421, 0.423, 0.425, 0.426, 0.428, 0.429, 0.431, 0.433, 0.434, - & 0.436, 0.437, 0.439, 0.440, 0.442, 0.443, 0.445, 0.446, 0.448, - & 0.450, 0.451, 0.453, 0.454, 0.456, 0.457, 0.459, 0.460, 0.462, - & 0.463, 0.465, 0.466, 0.468, 0.469, 0.471, 0.472, 0.474, 0.475, - & 0.477, 0.478, 0.480, 0.481, 0.483, 0.484, 0.486, 0.487, 0.489, - & 0.490, 0.491, 0.493, 0.494, 0.510, 0.524, 0.538, 0.552, 0.566, - & 0.579, 0.592, 0.605, 0.618, 0.630, 0.642, 0.655, 0.667, 0.678, - & 0.690, 0.701, 0.713, 0.724, 0.735, 0.745, 0.756, 0.766, 0.777, - & 0.787, 0.797, 0.807, 0.817, 0.826, 0.836, 0.845, 0.854, 0.864, - & 0.873, 0.881, 0.890, 0.899, 0.907, 0.916, 0.924, 0.932, 0.940, - & 0.948, 0.956, 0.964, 0.972, 0.979, 0.987, 0.994, 1.002, 1.009, - & 1.016, 1.023, 1.030, 1.037, 1.044, 1.051, 1.057, 1.064, 1.070, - & 1.077, 1.083, 1.089, 1.096, 1.102, 1.108, 1.114, 1.120, 1.126, - & 1.132, 1.137, 1.143, 1.149, 1.154, 1.160, 1.165, 1.170, 1.176, - & 1.181, 1.186, 1.191, 1.196, 1.201, 1.206, 1.211, 1.216, 1.221, - & 1.226, 1.231, 1.235, 1.240, 1.244, 1.249, 1.253, 1.258, 1.262, - & 1.267, 1.271, 1.275, 1.279, 1.284, 1.288, 1.292, 1.296, 1.300, - & 1.304, 1.308, 1.312, 1.315, 1.319, 1.323, 1.327, 1.330, 1.334, - & 1.338, 1.341, 1.345, 1.348, 1.352, 1.355, 1.358, 1.362, 1.365, - & 1.368, 1.372, 1.375, 1.378, 1.381, 1.384, 1.388, 1.391, 1.394, - & 1.397, 1.400, 1.403, 1.406, 1.409, 1.411, 1.414, 1.417, 1.420, - & 1.423, 1.425, 1.428, 1.431, 1.433, 1.436, 1.439, 1.441, 1.444, - & 1.446, 1.449, 1.451, 1.454, 1.456, 1.458, 1.461, 1.463, 1.466, - & 1.468, 1.470, 1.472 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.098,-0.214,-0.272,-0.313,-0.346,-0.373,-0.396,-0.417,-0.435, - &-0.452,-0.467,-0.481,-0.494,-0.506,-0.518,-0.529,-0.539,-0.549, - &-0.558,-0.567,-0.575,-0.583,-0.591,-0.599,-0.606,-0.613,-0.620, - &-0.627,-0.633,-0.639,-0.645,-0.651,-0.657,-0.662,-0.668,-0.673, - &-0.678,-0.683,-0.688,-0.693,-0.698,-0.703,-0.707,-0.712,-0.716, - &-0.721,-0.725,-0.729,-0.733,-0.737,-0.741,-0.745,-0.749,-0.753, - &-0.756,-0.760,-0.764,-0.767,-0.771,-0.774,-0.778,-0.781,-0.784, - &-0.788,-0.791,-0.794,-0.797,-0.801,-0.804,-0.807,-0.810,-0.813, - &-0.816,-0.819,-0.822,-0.825,-0.827,-0.830,-0.833,-0.836,-0.839, - &-0.841,-0.844,-0.847,-0.850,-0.852,-0.855,-0.858,-0.860,-0.863, - &-0.865,-0.868,-0.871,-0.873,-0.876,-0.878,-0.881,-0.883,-0.885, - &-0.888,-0.890,-0.893,-0.895,-0.897,-0.900,-0.902,-0.905,-0.907, - &-0.909,-0.911,-0.914,-0.916,-0.918,-0.921,-0.923,-0.925,-0.927, - &-0.929,-0.932,-0.934,-0.936,-0.938,-0.940,-0.942,-0.945,-0.947, - &-0.949,-0.951,-0.953,-0.955,-0.957,-0.959,-0.961,-0.963,-0.965, - &-0.967,-0.969,-0.971,-0.973,-0.975,-0.977,-0.979,-0.981,-0.983, - &-0.985,-0.987,-0.989,-0.991,-0.993,-0.995,-0.997,-0.999,-1.001, - &-1.002,-1.004,-1.006,-1.008,-1.010,-1.012,-1.014,-1.015,-1.017, - &-1.019,-1.021,-1.023,-1.025,-1.026,-1.028,-1.030,-1.032,-1.033, - &-1.035,-1.037,-1.039,-1.040,-1.042,-1.044,-1.046,-1.047,-1.049, - &-1.051,-1.053,-1.054,-1.056,-1.058,-1.059,-1.061,-1.063,-1.064, - &-1.066,-1.068,-1.069,-1.071,-1.073,-1.074,-1.076,-1.078,-1.079, - &-1.081,-1.082,-1.084,-1.086,-1.087,-1.089,-1.090,-1.092,-1.094, - &-1.095,-1.097,-1.098,-1.100,-1.102,-1.103,-1.105,-1.106,-1.108, - &-1.109,-1.111,-1.112,-1.114,-1.116,-1.117,-1.119,-1.120,-1.122, - &-1.123,-1.125,-1.126,-1.128,-1.129,-1.131,-1.132,-1.134,-1.135, - &-1.137,-1.138,-1.140,-1.141,-1.143,-1.144,-1.146,-1.147,-1.148, - &-1.150,-1.151,-1.153,-1.154,-1.156,-1.157,-1.159,-1.160,-1.161, - &-1.163,-1.164,-1.166,-1.167,-1.169,-1.170,-1.171,-1.173,-1.174, - &-1.176,-1.177,-1.178,-1.180,-1.181,-1.183,-1.184,-1.185,-1.187, - &-1.188,-1.190,-1.191,-1.192,-1.194,-1.195,-1.196,-1.198,-1.199, - &-1.201,-1.202,-1.203,-1.205,-1.206,-1.207,-1.209,-1.210,-1.211, - &-1.213,-1.214,-1.215,-1.217,-1.218,-1.219,-1.221,-1.222,-1.223, - &-1.225,-1.226,-1.227,-1.229,-1.230,-1.231,-1.233,-1.234,-1.235, - &-1.236,-1.238,-1.239,-1.240,-1.242,-1.243,-1.244,-1.246,-1.247, - &-1.248,-1.249,-1.251,-1.252,-1.253,-1.255,-1.256,-1.257,-1.258, - &-1.260,-1.261,-1.262,-1.263,-1.265,-1.266,-1.267,-1.268,-1.270, - &-1.271,-1.272,-1.273,-1.275,-1.276,-1.277,-1.278,-1.280,-1.281, - &-1.282,-1.283,-1.285,-1.286,-1.287,-1.288,-1.290,-1.291,-1.292, - &-1.293,-1.294,-1.296,-1.297,-1.298,-1.299,-1.301,-1.302,-1.303, - &-1.304,-1.305,-1.307,-1.308,-1.309,-1.310,-1.311,-1.313,-1.314, - &-1.315,-1.316,-1.317,-1.319,-1.320,-1.321,-1.322,-1.323,-1.324, - &-1.326,-1.327,-1.328,-1.329,-1.330,-1.332,-1.333,-1.334,-1.335, - &-1.336,-1.337,-1.339,-1.340,-1.341,-1.342,-1.343,-1.344,-1.346, - &-1.347,-1.348,-1.349,-1.350,-1.363,-1.374,-1.385,-1.396,-1.407, - &-1.418,-1.429,-1.440,-1.451,-1.461,-1.472,-1.482,-1.492,-1.503, - &-1.513,-1.523,-1.533,-1.543,-1.553,-1.563,-1.573,-1.582,-1.592, - &-1.602,-1.611,-1.621,-1.630,-1.640,-1.649,-1.658,-1.668,-1.677, - &-1.686,-1.695,-1.704,-1.714,-1.723,-1.732,-1.741,-1.750,-1.758, - &-1.767,-1.776,-1.785,-1.794,-1.802,-1.811,-1.820,-1.828,-1.837, - &-1.846,-1.854,-1.863,-1.871,-1.880,-1.888,-1.897,-1.905,-1.913, - &-1.922,-1.930,-1.938,-1.947,-1.955,-1.963,-1.971,-1.979,-1.988, - &-1.996,-2.004,-2.012,-2.020,-2.028,-2.036,-2.044,-2.052,-2.060, - &-2.068,-2.076,-2.084,-2.092,-2.100,-2.108,-2.116,-2.124,-2.131, - &-2.139,-2.147,-2.155,-2.163,-2.170,-2.178,-2.186,-2.194,-2.201, - &-2.209,-2.217,-2.224,-2.232,-2.240,-2.247,-2.255,-2.262,-2.270, - &-2.278,-2.285,-2.293,-2.300,-2.308,-2.315,-2.323,-2.330,-2.338, - &-2.345,-2.353,-2.360,-2.368,-2.375,-2.382,-2.390,-2.397,-2.405, - &-2.412,-2.419,-2.427,-2.434,-2.441,-2.449,-2.456,-2.463,-2.471, - &-2.478,-2.485,-2.492,-2.500,-2.507,-2.514,-2.521,-2.529,-2.536, - &-2.543,-2.550,-2.557,-2.565,-2.572,-2.579,-2.586,-2.593,-2.600, - &-2.608,-2.615,-2.622,-2.629,-2.636,-2.643,-2.650,-2.657,-2.664, - &-2.671,-2.679,-2.686 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.049,-0.108,-0.137,-0.159,-0.175,-0.190,-0.202,-0.212,-0.222, - &-0.231,-0.239,-0.247,-0.254,-0.260,-0.266,-0.272,-0.278,-0.283, - &-0.288,-0.293,-0.298,-0.302,-0.306,-0.311,-0.315,-0.319,-0.322, - &-0.326,-0.330,-0.333,-0.337,-0.340,-0.343,-0.346,-0.349,-0.352, - &-0.355,-0.358,-0.361,-0.364,-0.367,-0.369,-0.372,-0.374,-0.377, - &-0.379,-0.382,-0.384,-0.387,-0.389,-0.391,-0.394,-0.396,-0.398, - &-0.400,-0.402,-0.404,-0.406,-0.408,-0.410,-0.412,-0.414,-0.416, - &-0.418,-0.420,-0.422,-0.424,-0.426,-0.428,-0.429,-0.431,-0.433, - &-0.435,-0.436,-0.438,-0.440,-0.442,-0.443,-0.445,-0.447,-0.448, - &-0.450,-0.452,-0.453,-0.455,-0.456,-0.458,-0.459,-0.461,-0.463, - &-0.464,-0.466,-0.467,-0.469,-0.470,-0.472,-0.473,-0.475,-0.476, - &-0.478,-0.479,-0.481,-0.482,-0.483,-0.485,-0.486,-0.488,-0.489, - &-0.491,-0.492,-0.493,-0.495,-0.496,-0.498,-0.499,-0.500,-0.502, - &-0.503,-0.504,-0.506,-0.507,-0.508,-0.510,-0.511,-0.512,-0.514, - &-0.515,-0.516,-0.518,-0.519,-0.520,-0.521,-0.523,-0.524,-0.525, - &-0.526,-0.528,-0.529,-0.530,-0.531,-0.533,-0.534,-0.535,-0.536, - &-0.537,-0.539,-0.540,-0.541,-0.542,-0.543,-0.545,-0.546,-0.547, - &-0.548,-0.549,-0.550,-0.552,-0.553,-0.554,-0.555,-0.556,-0.557, - &-0.558,-0.559,-0.561,-0.562,-0.563,-0.564,-0.565,-0.566,-0.567, - &-0.568,-0.569,-0.570,-0.572,-0.573,-0.574,-0.575,-0.576,-0.577, - &-0.578,-0.579,-0.580,-0.581,-0.582,-0.583,-0.584,-0.585,-0.586, - &-0.587,-0.588,-0.589,-0.590,-0.592,-0.593,-0.594,-0.595,-0.596, - &-0.597,-0.598,-0.599,-0.600,-0.601,-0.602,-0.603,-0.604,-0.605, - &-0.606,-0.607,-0.607,-0.608,-0.609,-0.610,-0.611,-0.612,-0.613, - &-0.614,-0.615,-0.616,-0.617,-0.618,-0.619,-0.620,-0.621,-0.622, - &-0.623,-0.624,-0.625,-0.626,-0.627,-0.627,-0.628,-0.629,-0.630, - &-0.631,-0.632,-0.633,-0.634,-0.635,-0.636,-0.637,-0.638,-0.638, - &-0.639,-0.640,-0.641,-0.642,-0.643,-0.644,-0.645,-0.646,-0.646, - &-0.647,-0.648,-0.649,-0.650,-0.651,-0.652,-0.653,-0.654,-0.654, - &-0.655,-0.656,-0.657,-0.658,-0.659,-0.660,-0.660,-0.661,-0.662, - &-0.663,-0.664,-0.665,-0.666,-0.666,-0.667,-0.668,-0.669,-0.670, - &-0.671,-0.671,-0.672,-0.673,-0.674,-0.675,-0.676,-0.676,-0.677, - &-0.678,-0.679,-0.680,-0.681,-0.681,-0.682,-0.683,-0.684,-0.685, - &-0.685,-0.686,-0.687,-0.688,-0.689,-0.689,-0.690,-0.691,-0.692, - &-0.693,-0.693,-0.694,-0.695,-0.696,-0.697,-0.697,-0.698,-0.699, - &-0.700,-0.701,-0.701,-0.702,-0.703,-0.704,-0.704,-0.705,-0.706, - &-0.707,-0.708,-0.708,-0.709,-0.710,-0.711,-0.711,-0.712,-0.713, - &-0.714,-0.714,-0.715,-0.716,-0.717,-0.718,-0.718,-0.719,-0.720, - &-0.721,-0.721,-0.722,-0.723,-0.724,-0.724,-0.725,-0.726,-0.727, - &-0.727,-0.728,-0.729,-0.729,-0.730,-0.731,-0.732,-0.732,-0.733, - &-0.734,-0.735,-0.735,-0.736,-0.737,-0.738,-0.738,-0.739,-0.740, - &-0.740,-0.741,-0.742,-0.743,-0.743,-0.744,-0.745,-0.746,-0.746, - &-0.747,-0.748,-0.748,-0.749,-0.750,-0.751,-0.751,-0.752,-0.753, - &-0.753,-0.754,-0.755,-0.756,-0.756,-0.757,-0.758,-0.758,-0.759, - &-0.760,-0.760,-0.761,-0.762,-0.769,-0.776,-0.783,-0.790,-0.796, - &-0.803,-0.809,-0.816,-0.822,-0.828,-0.835,-0.841,-0.847,-0.853, - &-0.859,-0.865,-0.871,-0.877,-0.883,-0.888,-0.894,-0.900,-0.905, - &-0.911,-0.917,-0.922,-0.928,-0.933,-0.939,-0.944,-0.949,-0.955, - &-0.960,-0.965,-0.971,-0.976,-0.981,-0.986,-0.991,-0.997,-1.002, - &-1.007,-1.012,-1.017,-1.022,-1.027,-1.032,-1.037,-1.042,-1.046, - &-1.051,-1.056,-1.061,-1.066,-1.071,-1.075,-1.080,-1.085,-1.089, - &-1.094,-1.099,-1.104,-1.108,-1.113,-1.117,-1.122,-1.127,-1.131, - &-1.136,-1.140,-1.145,-1.149,-1.154,-1.158,-1.163,-1.167,-1.172, - &-1.176,-1.180,-1.185,-1.189,-1.194,-1.198,-1.202,-1.207,-1.211, - &-1.215,-1.220,-1.224,-1.228,-1.232,-1.237,-1.241,-1.245,-1.249, - &-1.254,-1.258,-1.262,-1.266,-1.270,-1.275,-1.279,-1.283,-1.287, - &-1.291,-1.295,-1.299,-1.304,-1.308,-1.312,-1.316,-1.320,-1.324, - &-1.328,-1.332,-1.336,-1.340,-1.344,-1.348,-1.352,-1.356,-1.360, - &-1.364,-1.368,-1.372,-1.376,-1.380,-1.384,-1.388,-1.392,-1.396, - &-1.400,-1.404,-1.408,-1.412,-1.415,-1.419,-1.423,-1.427,-1.431, - &-1.435,-1.439,-1.443,-1.446,-1.450,-1.454,-1.458,-1.462,-1.466, - &-1.469,-1.473,-1.477,-1.481,-1.485,-1.488,-1.492,-1.496,-1.500, - &-1.504,-1.507,-1.511 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.098,-0.214,-0.273,-0.315,-0.347,-0.375,-0.399,-0.419,-0.438, - &-0.455,-0.470,-0.485,-0.498,-0.511,-0.522,-0.533,-0.544,-0.554, - &-0.563,-0.572,-0.581,-0.590,-0.598,-0.605,-0.613,-0.620,-0.627, - &-0.634,-0.641,-0.647,-0.653,-0.660,-0.666,-0.671,-0.677,-0.683, - &-0.688,-0.693,-0.698,-0.703,-0.708,-0.713,-0.718,-0.723,-0.727, - &-0.732,-0.736,-0.741,-0.745,-0.749,-0.753,-0.757,-0.762,-0.765, - &-0.769,-0.773,-0.777,-0.781,-0.784,-0.788,-0.792,-0.795,-0.799, - &-0.802,-0.806,-0.809,-0.812,-0.816,-0.819,-0.822,-0.825,-0.829, - &-0.832,-0.835,-0.838,-0.841,-0.844,-0.847,-0.850,-0.853,-0.856, - &-0.859,-0.862,-0.865,-0.867,-0.870,-0.873,-0.876,-0.879,-0.881, - &-0.884,-0.887,-0.890,-0.892,-0.895,-0.898,-0.900,-0.903,-0.905, - &-0.908,-0.911,-0.913,-0.916,-0.918,-0.921,-0.923,-0.926,-0.928, - &-0.931,-0.933,-0.936,-0.938,-0.940,-0.943,-0.945,-0.948,-0.950, - &-0.952,-0.955,-0.957,-0.959,-0.962,-0.964,-0.966,-0.969,-0.971, - &-0.973,-0.975,-0.978,-0.980,-0.982,-0.984,-0.986,-0.989,-0.991, - &-0.993,-0.995,-0.997,-0.999,-1.002,-1.004,-1.006,-1.008,-1.010, - &-1.012,-1.014,-1.016,-1.018,-1.020,-1.022,-1.024,-1.026,-1.028, - &-1.030,-1.032,-1.034,-1.036,-1.038,-1.040,-1.042,-1.044,-1.046, - &-1.048,-1.050,-1.052,-1.054,-1.056,-1.058,-1.060,-1.062,-1.064, - &-1.066,-1.067,-1.069,-1.071,-1.073,-1.075,-1.077,-1.079,-1.080, - &-1.082,-1.084,-1.086,-1.088,-1.090,-1.091,-1.093,-1.095,-1.097, - &-1.099,-1.100,-1.102,-1.104,-1.106,-1.107,-1.109,-1.111,-1.113, - &-1.114,-1.116,-1.118,-1.120,-1.121,-1.123,-1.125,-1.127,-1.128, - &-1.130,-1.132,-1.133,-1.135,-1.137,-1.138,-1.140,-1.142,-1.143, - &-1.145,-1.147,-1.148,-1.150,-1.152,-1.153,-1.155,-1.157,-1.158, - &-1.160,-1.162,-1.163,-1.165,-1.166,-1.168,-1.170,-1.171,-1.173, - &-1.174,-1.176,-1.178,-1.179,-1.181,-1.182,-1.184,-1.185,-1.187, - &-1.189,-1.190,-1.192,-1.193,-1.195,-1.196,-1.198,-1.199,-1.201, - &-1.203,-1.204,-1.206,-1.207,-1.209,-1.210,-1.212,-1.213,-1.215, - &-1.216,-1.218,-1.219,-1.221,-1.222,-1.224,-1.225,-1.227,-1.228, - &-1.230,-1.231,-1.233,-1.234,-1.236,-1.237,-1.238,-1.240,-1.241, - &-1.243,-1.244,-1.246,-1.247,-1.249,-1.250,-1.252,-1.253,-1.254, - &-1.256,-1.257,-1.259,-1.260,-1.262,-1.263,-1.264,-1.266,-1.267, - &-1.269,-1.270,-1.271,-1.273,-1.274,-1.276,-1.277,-1.278,-1.280, - &-1.281,-1.283,-1.284,-1.285,-1.287,-1.288,-1.290,-1.291,-1.292, - &-1.294,-1.295,-1.296,-1.298,-1.299,-1.301,-1.302,-1.303,-1.305, - &-1.306,-1.307,-1.309,-1.310,-1.311,-1.313,-1.314,-1.315,-1.317, - &-1.318,-1.319,-1.321,-1.322,-1.323,-1.325,-1.326,-1.327,-1.329, - &-1.330,-1.331,-1.333,-1.334,-1.335,-1.337,-1.338,-1.339,-1.341, - &-1.342,-1.343,-1.344,-1.346,-1.347,-1.348,-1.350,-1.351,-1.352, - &-1.354,-1.355,-1.356,-1.357,-1.359,-1.360,-1.361,-1.363,-1.364, - &-1.365,-1.366,-1.368,-1.369,-1.370,-1.371,-1.373,-1.374,-1.375, - &-1.376,-1.378,-1.379,-1.380,-1.381,-1.383,-1.384,-1.385,-1.387, - &-1.388,-1.389,-1.390,-1.391,-1.393,-1.394,-1.395,-1.396,-1.398, - &-1.399,-1.400,-1.401,-1.403,-1.416,-1.428,-1.440,-1.452,-1.463, - &-1.475,-1.487,-1.498,-1.509,-1.520,-1.532,-1.543,-1.554,-1.564, - &-1.575,-1.586,-1.596,-1.607,-1.617,-1.628,-1.638,-1.648,-1.659, - &-1.669,-1.679,-1.689,-1.699,-1.709,-1.719,-1.729,-1.738,-1.748, - &-1.758,-1.767,-1.777,-1.786,-1.796,-1.805,-1.815,-1.824,-1.833, - &-1.843,-1.852,-1.861,-1.870,-1.879,-1.888,-1.897,-1.906,-1.915, - &-1.924,-1.933,-1.942,-1.951,-1.960,-1.969,-1.977,-1.986,-1.995, - &-2.004,-2.012,-2.021,-2.029,-2.038,-2.047,-2.055,-2.064,-2.072, - &-2.081,-2.089,-2.097,-2.106,-2.114,-2.123,-2.131,-2.139,-2.147, - &-2.156,-2.164,-2.172,-2.180,-2.189,-2.197,-2.205,-2.213,-2.221, - &-2.229,-2.237,-2.245,-2.253,-2.261,-2.269,-2.277,-2.285,-2.293, - &-2.301,-2.309,-2.317,-2.325,-2.333,-2.341,-2.349,-2.356,-2.364, - &-2.372,-2.380,-2.388,-2.395,-2.403,-2.411,-2.419,-2.426,-2.434, - &-2.442,-2.449,-2.457,-2.465,-2.472,-2.480,-2.488,-2.495,-2.503, - &-2.510,-2.518,-2.525,-2.533,-2.541,-2.548,-2.556,-2.563,-2.571, - &-2.578,-2.586,-2.593,-2.600,-2.608,-2.615,-2.623,-2.630,-2.638, - &-2.645,-2.652,-2.660,-2.667,-2.674,-2.682,-2.689,-2.696,-2.704, - &-2.711,-2.718,-2.726,-2.733,-2.740,-2.747,-2.755,-2.762,-2.769, - &-2.776,-2.784,-2.791 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.050,-0.111,-0.143,-0.166,-0.185,-0.202,-0.216,-0.229,-0.240, - &-0.251,-0.261,-0.271,-0.279,-0.288,-0.296,-0.304,-0.311,-0.318, - &-0.325,-0.331,-0.338,-0.344,-0.350,-0.356,-0.361,-0.367,-0.372, - &-0.378,-0.383,-0.388,-0.393,-0.398,-0.402,-0.407,-0.412,-0.416, - &-0.420,-0.425,-0.429,-0.433,-0.437,-0.441,-0.445,-0.449,-0.453, - &-0.457,-0.460,-0.464,-0.468,-0.471,-0.475,-0.478,-0.482,-0.485, - &-0.488,-0.491,-0.495,-0.498,-0.501,-0.504,-0.507,-0.510,-0.513, - &-0.516,-0.519,-0.522,-0.525,-0.528,-0.531,-0.534,-0.537,-0.539, - &-0.542,-0.545,-0.548,-0.550,-0.553,-0.556,-0.558,-0.561,-0.564, - &-0.566,-0.569,-0.572,-0.574,-0.577,-0.579,-0.582,-0.584,-0.587, - &-0.589,-0.592,-0.594,-0.597,-0.599,-0.602,-0.604,-0.607,-0.609, - &-0.612,-0.614,-0.617,-0.619,-0.621,-0.624,-0.626,-0.629,-0.631, - &-0.633,-0.636,-0.638,-0.640,-0.643,-0.645,-0.647,-0.650,-0.652, - &-0.654,-0.656,-0.659,-0.661,-0.663,-0.665,-0.668,-0.670,-0.672, - &-0.674,-0.677,-0.679,-0.681,-0.683,-0.685,-0.687,-0.690,-0.692, - &-0.694,-0.696,-0.698,-0.700,-0.702,-0.704,-0.706,-0.709,-0.711, - &-0.713,-0.715,-0.717,-0.719,-0.721,-0.723,-0.725,-0.727,-0.729, - &-0.731,-0.733,-0.735,-0.737,-0.739,-0.741,-0.742,-0.744,-0.746, - &-0.748,-0.750,-0.752,-0.754,-0.756,-0.758,-0.760,-0.761,-0.763, - &-0.765,-0.767,-0.769,-0.771,-0.772,-0.774,-0.776,-0.778,-0.780, - &-0.782,-0.783,-0.785,-0.787,-0.789,-0.790,-0.792,-0.794,-0.796, - &-0.797,-0.799,-0.801,-0.803,-0.804,-0.806,-0.808,-0.809,-0.811, - &-0.813,-0.814,-0.816,-0.818,-0.820,-0.821,-0.823,-0.824,-0.826, - &-0.828,-0.829,-0.831,-0.833,-0.834,-0.836,-0.838,-0.839,-0.841, - &-0.842,-0.844,-0.846,-0.847,-0.849,-0.850,-0.852,-0.853,-0.855, - &-0.857,-0.858,-0.860,-0.861,-0.863,-0.864,-0.866,-0.867,-0.869, - &-0.870,-0.872,-0.873,-0.875,-0.876,-0.878,-0.879,-0.881,-0.882, - &-0.884,-0.885,-0.887,-0.888,-0.890,-0.891,-0.893,-0.894,-0.896, - &-0.897,-0.898,-0.900,-0.901,-0.903,-0.904,-0.906,-0.907,-0.908, - &-0.910,-0.911,-0.913,-0.914,-0.915,-0.917,-0.918,-0.920,-0.921, - &-0.922,-0.924,-0.925,-0.926,-0.928,-0.929,-0.931,-0.932,-0.933, - &-0.935,-0.936,-0.937,-0.939,-0.940,-0.941,-0.943,-0.944,-0.945, - &-0.947,-0.948,-0.949,-0.951,-0.952,-0.953,-0.954,-0.956,-0.957, - &-0.958,-0.960,-0.961,-0.962,-0.963,-0.965,-0.966,-0.967,-0.969, - &-0.970,-0.971,-0.972,-0.974,-0.975,-0.976,-0.977,-0.979,-0.980, - &-0.981,-0.982,-0.984,-0.985,-0.986,-0.987,-0.988,-0.990,-0.991, - &-0.992,-0.993,-0.995,-0.996,-0.997,-0.998,-0.999,-1.001,-1.002, - &-1.003,-1.004,-1.005,-1.007,-1.008,-1.009,-1.010,-1.011,-1.012, - &-1.014,-1.015,-1.016,-1.017,-1.018,-1.019,-1.021,-1.022,-1.023, - &-1.024,-1.025,-1.026,-1.027,-1.029,-1.030,-1.031,-1.032,-1.033, - &-1.034,-1.035,-1.037,-1.038,-1.039,-1.040,-1.041,-1.042,-1.043, - &-1.044,-1.045,-1.047,-1.048,-1.049,-1.050,-1.051,-1.052,-1.053, - &-1.054,-1.055,-1.056,-1.058,-1.059,-1.060,-1.061,-1.062,-1.063, - &-1.064,-1.065,-1.066,-1.067,-1.068,-1.069,-1.070,-1.071,-1.072, - &-1.074,-1.075,-1.076,-1.077,-1.088,-1.098,-1.108,-1.118,-1.128, - &-1.137,-1.147,-1.156,-1.165,-1.174,-1.183,-1.192,-1.200,-1.209, - &-1.217,-1.225,-1.233,-1.241,-1.249,-1.257,-1.265,-1.273,-1.280, - &-1.288,-1.295,-1.303,-1.310,-1.317,-1.324,-1.331,-1.338,-1.345, - &-1.352,-1.359,-1.365,-1.372,-1.379,-1.385,-1.392,-1.398,-1.404, - &-1.411,-1.417,-1.423,-1.429,-1.435,-1.441,-1.447,-1.453,-1.459, - &-1.465,-1.471,-1.477,-1.483,-1.488,-1.494,-1.500,-1.505,-1.511, - &-1.516,-1.522,-1.527,-1.533,-1.538,-1.544,-1.549,-1.554,-1.560, - &-1.565,-1.570,-1.575,-1.580,-1.586,-1.591,-1.596,-1.601,-1.606, - &-1.611,-1.616,-1.621,-1.626,-1.631,-1.635,-1.640,-1.645,-1.650, - &-1.655,-1.660,-1.664,-1.669,-1.674,-1.679,-1.683,-1.688,-1.693, - &-1.697,-1.702,-1.706,-1.711,-1.716,-1.720,-1.725,-1.729,-1.734, - &-1.738,-1.743,-1.747,-1.751,-1.756,-1.760,-1.765,-1.769,-1.773, - &-1.778,-1.782,-1.786,-1.791,-1.795,-1.799,-1.803,-1.808,-1.812, - &-1.816,-1.820,-1.825,-1.829,-1.833,-1.837,-1.841,-1.845,-1.850, - &-1.854,-1.858,-1.862,-1.866,-1.870,-1.874,-1.878,-1.882,-1.886, - &-1.890,-1.894,-1.898,-1.902,-1.906,-1.910,-1.914,-1.918,-1.922, - &-1.926,-1.930,-1.934,-1.938,-1.942,-1.946,-1.950,-1.954,-1.958, - &-1.961,-1.965,-1.969 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.048,-0.103,-0.130,-0.148,-0.161,-0.173,-0.182,-0.190,-0.197, - &-0.203,-0.208,-0.213,-0.217,-0.221,-0.225,-0.228,-0.231,-0.234, - &-0.237,-0.239,-0.241,-0.243,-0.245,-0.247,-0.249,-0.251,-0.252, - &-0.254,-0.255,-0.256,-0.257,-0.259,-0.260,-0.261,-0.262,-0.263, - &-0.263,-0.264,-0.265,-0.266,-0.267,-0.267,-0.268,-0.269,-0.269, - &-0.270,-0.270,-0.271,-0.272,-0.272,-0.273,-0.273,-0.273,-0.274, - &-0.274,-0.275,-0.275,-0.275,-0.276,-0.276,-0.277,-0.277,-0.277, - &-0.277,-0.278,-0.278,-0.278,-0.279,-0.279,-0.279,-0.279,-0.279, - &-0.280,-0.280,-0.280,-0.280,-0.280,-0.280,-0.280,-0.281,-0.281, - &-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281, - &-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281,-0.281, - &-0.281,-0.281,-0.280,-0.280,-0.280,-0.280,-0.280,-0.280,-0.280, - &-0.279,-0.279,-0.279,-0.279,-0.279,-0.279,-0.278,-0.278,-0.278, - &-0.278,-0.278,-0.277,-0.277,-0.277,-0.277,-0.277,-0.276,-0.276, - &-0.276,-0.276,-0.275,-0.275,-0.275,-0.275,-0.274,-0.274,-0.274, - &-0.274,-0.273,-0.273,-0.273,-0.273,-0.272,-0.272,-0.272,-0.272, - &-0.271,-0.271,-0.271,-0.271,-0.270,-0.270,-0.270,-0.270,-0.269, - &-0.269,-0.269,-0.269,-0.268,-0.268,-0.268,-0.267,-0.267,-0.267, - &-0.267,-0.266,-0.266,-0.266,-0.266,-0.265,-0.265,-0.265,-0.264, - &-0.264,-0.264,-0.264,-0.263,-0.263,-0.263,-0.263,-0.262,-0.262, - &-0.262,-0.261,-0.261,-0.261,-0.261,-0.260,-0.260,-0.260,-0.259, - &-0.259,-0.259,-0.259,-0.258,-0.258,-0.258,-0.258,-0.257,-0.257, - &-0.257,-0.256,-0.256,-0.256,-0.256,-0.255,-0.255,-0.255,-0.255, - &-0.254,-0.254,-0.254,-0.253,-0.253,-0.253,-0.253,-0.252,-0.252, - &-0.252,-0.252,-0.251,-0.251,-0.251,-0.250,-0.250,-0.250,-0.250, - &-0.249,-0.249,-0.249,-0.249,-0.248,-0.248,-0.248,-0.247,-0.247, - &-0.247,-0.247,-0.246,-0.246,-0.246,-0.246,-0.245,-0.245,-0.245, - &-0.245,-0.244,-0.244,-0.244,-0.244,-0.243,-0.243,-0.243,-0.243, - &-0.242,-0.242,-0.242,-0.241,-0.241,-0.241,-0.241,-0.240,-0.240, - &-0.240,-0.240,-0.239,-0.239,-0.239,-0.239,-0.238,-0.238,-0.238, - &-0.238,-0.237,-0.237,-0.237,-0.237,-0.236,-0.236,-0.236,-0.236, - &-0.236,-0.235,-0.235,-0.235,-0.235,-0.234,-0.234,-0.234,-0.234, - &-0.233,-0.233,-0.233,-0.233,-0.232,-0.232,-0.232,-0.232,-0.231, - &-0.231,-0.231,-0.231,-0.231,-0.230,-0.230,-0.230,-0.230,-0.229, - &-0.229,-0.229,-0.229,-0.228,-0.228,-0.228,-0.228,-0.228,-0.227, - &-0.227,-0.227,-0.227,-0.226,-0.226,-0.226,-0.226,-0.226,-0.225, - &-0.225,-0.225,-0.225,-0.224,-0.224,-0.224,-0.224,-0.224,-0.223, - &-0.223,-0.223,-0.223,-0.223,-0.222,-0.222,-0.222,-0.222,-0.221, - &-0.221,-0.221,-0.221,-0.221,-0.220,-0.220,-0.220,-0.220,-0.220, - &-0.219,-0.219,-0.219,-0.219,-0.219,-0.218,-0.218,-0.218,-0.218, - &-0.218,-0.217,-0.217,-0.217,-0.217,-0.217,-0.216,-0.216,-0.216, - &-0.216,-0.216,-0.215,-0.215,-0.215,-0.215,-0.215,-0.215,-0.214, - &-0.214,-0.214,-0.214,-0.214,-0.213,-0.213,-0.213,-0.213,-0.213, - &-0.212,-0.212,-0.212,-0.212,-0.212,-0.212,-0.211,-0.211,-0.211, - &-0.211,-0.211,-0.210,-0.210,-0.208,-0.207,-0.205,-0.203,-0.202, - &-0.200,-0.199,-0.198,-0.196,-0.195,-0.194,-0.192,-0.191,-0.190, - &-0.189,-0.188,-0.187,-0.186,-0.185,-0.184,-0.183,-0.182,-0.182, - &-0.181,-0.180,-0.179,-0.179,-0.178,-0.178,-0.177,-0.176,-0.176, - &-0.176,-0.175,-0.175,-0.174,-0.174,-0.174,-0.173,-0.173,-0.173, - &-0.173,-0.172,-0.172,-0.172,-0.172,-0.172,-0.172,-0.172,-0.172, - &-0.172,-0.172,-0.172,-0.172,-0.172,-0.172,-0.172,-0.172,-0.173, - &-0.173,-0.173,-0.173,-0.173,-0.174,-0.174,-0.174,-0.175,-0.175, - &-0.175,-0.176,-0.176,-0.176,-0.177,-0.177,-0.178,-0.178,-0.179, - &-0.179,-0.180,-0.180,-0.181,-0.181,-0.182,-0.183,-0.183,-0.184, - &-0.184,-0.185,-0.186,-0.186,-0.187,-0.188,-0.188,-0.189,-0.190, - &-0.191,-0.191,-0.192,-0.193,-0.194,-0.194,-0.195,-0.196,-0.197, - &-0.198,-0.199,-0.200,-0.200,-0.201,-0.202,-0.203,-0.204,-0.205, - &-0.206,-0.207,-0.208,-0.209,-0.210,-0.211,-0.212,-0.213,-0.214, - &-0.215,-0.216,-0.217,-0.218,-0.219,-0.220,-0.221,-0.222,-0.223, - &-0.224,-0.226,-0.227,-0.228,-0.229,-0.230,-0.231,-0.232,-0.234, - &-0.235,-0.236,-0.237,-0.238,-0.239,-0.241,-0.242,-0.243,-0.244, - &-0.246,-0.247,-0.248,-0.249,-0.251,-0.252,-0.253,-0.254,-0.256, - &-0.257,-0.258,-0.260 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.098,-0.213,-0.271,-0.312,-0.344,-0.370,-0.393,-0.413,-0.431, - &-0.448,-0.462,-0.476,-0.489,-0.500,-0.511,-0.522,-0.532,-0.541, - &-0.550,-0.558,-0.567,-0.574,-0.582,-0.589,-0.596,-0.603,-0.609, - &-0.615,-0.621,-0.627,-0.633,-0.638,-0.644,-0.649,-0.654,-0.659, - &-0.664,-0.669,-0.674,-0.678,-0.683,-0.687,-0.691,-0.695,-0.700, - &-0.704,-0.708,-0.711,-0.715,-0.719,-0.723,-0.726,-0.730,-0.733, - &-0.737,-0.740,-0.744,-0.747,-0.750,-0.753,-0.757,-0.760,-0.763, - &-0.766,-0.769,-0.772,-0.775,-0.778,-0.781,-0.784,-0.786,-0.789, - &-0.792,-0.795,-0.797,-0.800,-0.803,-0.805,-0.808,-0.811,-0.813, - &-0.816,-0.818,-0.821,-0.823,-0.825,-0.828,-0.830,-0.833,-0.835, - &-0.837,-0.840,-0.842,-0.844,-0.847,-0.849,-0.851,-0.853,-0.856, - &-0.858,-0.860,-0.862,-0.864,-0.867,-0.869,-0.871,-0.873,-0.875, - &-0.877,-0.879,-0.881,-0.883,-0.885,-0.887,-0.889,-0.891,-0.893, - &-0.895,-0.897,-0.899,-0.901,-0.903,-0.905,-0.907,-0.909,-0.911, - &-0.913,-0.915,-0.916,-0.918,-0.920,-0.922,-0.924,-0.926,-0.928, - &-0.929,-0.931,-0.933,-0.935,-0.936,-0.938,-0.940,-0.942,-0.944, - &-0.945,-0.947,-0.949,-0.950,-0.952,-0.954,-0.956,-0.957,-0.959, - &-0.961,-0.962,-0.964,-0.966,-0.967,-0.969,-0.971,-0.972,-0.974, - &-0.975,-0.977,-0.979,-0.980,-0.982,-0.983,-0.985,-0.987,-0.988, - &-0.990,-0.991,-0.993,-0.994,-0.996,-0.998,-0.999,-1.001,-1.002, - &-1.004,-1.005,-1.007,-1.008,-1.010,-1.011,-1.013,-1.014,-1.016, - &-1.017,-1.019,-1.020,-1.022,-1.023,-1.024,-1.026,-1.027,-1.029, - &-1.030,-1.032,-1.033,-1.035,-1.036,-1.037,-1.039,-1.040,-1.042, - &-1.043,-1.045,-1.046,-1.047,-1.049,-1.050,-1.052,-1.053,-1.054, - &-1.056,-1.057,-1.058,-1.060,-1.061,-1.063,-1.064,-1.065,-1.067, - &-1.068,-1.069,-1.071,-1.072,-1.073,-1.075,-1.076,-1.077,-1.079, - &-1.080,-1.081,-1.083,-1.084,-1.085,-1.087,-1.088,-1.089,-1.090, - &-1.092,-1.093,-1.094,-1.096,-1.097,-1.098,-1.100,-1.101,-1.102, - &-1.103,-1.105,-1.106,-1.107,-1.108,-1.110,-1.111,-1.112,-1.113, - &-1.115,-1.116,-1.117,-1.118,-1.120,-1.121,-1.122,-1.123,-1.125, - &-1.126,-1.127,-1.128,-1.130,-1.131,-1.132,-1.133,-1.134,-1.136, - &-1.137,-1.138,-1.139,-1.141,-1.142,-1.143,-1.144,-1.145,-1.147, - &-1.148,-1.149,-1.150,-1.151,-1.153,-1.154,-1.155,-1.156,-1.157, - &-1.158,-1.160,-1.161,-1.162,-1.163,-1.164,-1.165,-1.167,-1.168, - &-1.169,-1.170,-1.171,-1.172,-1.174,-1.175,-1.176,-1.177,-1.178, - &-1.179,-1.181,-1.182,-1.183,-1.184,-1.185,-1.186,-1.187,-1.189, - &-1.190,-1.191,-1.192,-1.193,-1.194,-1.195,-1.196,-1.198,-1.199, - &-1.200,-1.201,-1.202,-1.203,-1.204,-1.205,-1.207,-1.208,-1.209, - &-1.210,-1.211,-1.212,-1.213,-1.214,-1.215,-1.216,-1.218,-1.219, - &-1.220,-1.221,-1.222,-1.223,-1.224,-1.225,-1.226,-1.227,-1.228, - &-1.230,-1.231,-1.232,-1.233,-1.234,-1.235,-1.236,-1.237,-1.238, - &-1.239,-1.240,-1.241,-1.242,-1.244,-1.245,-1.246,-1.247,-1.248, - &-1.249,-1.250,-1.251,-1.252,-1.253,-1.254,-1.255,-1.256,-1.257, - &-1.258,-1.259,-1.261,-1.262,-1.263,-1.264,-1.265,-1.266,-1.267, - &-1.268,-1.269,-1.270,-1.271,-1.282,-1.292,-1.303,-1.313,-1.323, - &-1.332,-1.342,-1.352,-1.362,-1.371,-1.381,-1.390,-1.400,-1.409, - &-1.418,-1.427,-1.437,-1.446,-1.455,-1.464,-1.473,-1.482,-1.491, - &-1.499,-1.508,-1.517,-1.526,-1.534,-1.543,-1.552,-1.560,-1.569, - &-1.577,-1.586,-1.594,-1.602,-1.611,-1.619,-1.627,-1.636,-1.644, - &-1.652,-1.660,-1.668,-1.677,-1.685,-1.693,-1.701,-1.709,-1.717, - &-1.725,-1.733,-1.741,-1.749,-1.757,-1.764,-1.772,-1.780,-1.788, - &-1.796,-1.804,-1.811,-1.819,-1.827,-1.835,-1.842,-1.850,-1.858, - &-1.865,-1.873,-1.880,-1.888,-1.896,-1.903,-1.911,-1.918,-1.926, - &-1.933,-1.941,-1.948,-1.956,-1.963,-1.971,-1.978,-1.986,-1.993, - &-2.000,-2.008,-2.015,-2.022,-2.030,-2.037,-2.044,-2.052,-2.059, - &-2.066,-2.074,-2.081,-2.088,-2.095,-2.103,-2.110,-2.117,-2.124, - &-2.131,-2.139,-2.146,-2.153,-2.160,-2.167,-2.174,-2.181,-2.189, - &-2.196,-2.203,-2.210,-2.217,-2.224,-2.231,-2.238,-2.245,-2.252, - &-2.259,-2.266,-2.273,-2.280,-2.287,-2.294,-2.301,-2.308,-2.315, - &-2.322,-2.329,-2.336,-2.343,-2.350,-2.357,-2.364,-2.371,-2.378, - &-2.385,-2.391,-2.398,-2.405,-2.412,-2.419,-2.426,-2.433,-2.439, - &-2.446,-2.453,-2.460,-2.467,-2.474,-2.480,-2.487,-2.494,-2.501, - &-2.508,-2.514,-2.521 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.046,-0.090,-0.108,-0.118,-0.124,-0.128,-0.130,-0.132,-0.132, - &-0.131,-0.130,-0.128,-0.125,-0.122,-0.119,-0.116,-0.112,-0.108, - &-0.103,-0.098,-0.093,-0.088,-0.083,-0.077,-0.071,-0.065,-0.059, - &-0.053,-0.046,-0.040,-0.033,-0.026,-0.019,-0.012,-0.004, 0.003, - & 0.011, 0.018, 0.026, 0.034, 0.042, 0.050, 0.058, 0.066, 0.075, - & 0.083, 0.091, 0.100, 0.109, 0.117, 0.126, 0.135, 0.144, 0.153, - & 0.162, 0.171, 0.180, 0.189, 0.198, 0.207, 0.216, 0.226, 0.235, - & 0.244, 0.254, 0.263, 0.273, 0.282, 0.292, 0.302, 0.311, 0.321, - & 0.331, 0.341, 0.351, 0.361, 0.371, 0.381, 0.391, 0.401, 0.411, - & 0.421, 0.432, 0.442, 0.452, 0.463, 0.473, 0.484, 0.495, 0.505, - & 0.516, 0.527, 0.538, 0.549, 0.560, 0.571, 0.582, 0.593, 0.604, - & 0.615, 0.626, 0.638, 0.649, 0.660, 0.672, 0.683, 0.694, 0.706, - & 0.717, 0.729, 0.740, 0.752, 0.763, 0.775, 0.787, 0.798, 0.810, - & 0.821, 0.833, 0.845, 0.856, 0.868, 0.879, 0.891, 0.903, 0.914, - & 0.926, 0.937, 0.949, 0.961, 0.972, 0.984, 0.995, 1.007, 1.018, - & 1.030, 1.041, 1.053, 1.064, 1.076, 1.087, 1.099, 1.110, 1.121, - & 1.133, 1.144, 1.155, 1.167, 1.178, 1.189, 1.200, 1.212, 1.223, - & 1.234, 1.245, 1.256, 1.267, 1.278, 1.289, 1.300, 1.311, 1.322, - & 1.333, 1.344, 1.355, 1.366, 1.377, 1.388, 1.399, 1.409, 1.420, - & 1.431, 1.442, 1.452, 1.463, 1.474, 1.485, 1.495, 1.506, 1.516, - & 1.527, 1.537, 1.548, 1.558, 1.569, 1.579, 1.590, 1.600, 1.611, - & 1.621, 1.631, 1.642, 1.652, 1.662, 1.672, 1.683, 1.693, 1.703, - & 1.713, 1.723, 1.733, 1.743, 1.753, 1.763, 1.774, 1.784, 1.793, - & 1.803, 1.813, 1.823, 1.833, 1.843, 1.853, 1.863, 1.872, 1.882, - & 1.892, 1.902, 1.911, 1.921, 1.931, 1.940, 1.950, 1.960, 1.969, - & 1.979, 1.988, 1.998, 2.007, 2.017, 2.026, 2.036, 2.045, 2.055, - & 2.064, 2.073, 2.083, 2.092, 2.101, 2.111, 2.120, 2.129, 2.138, - & 2.147, 2.157, 2.166, 2.175, 2.184, 2.193, 2.202, 2.211, 2.220, - & 2.229, 2.238, 2.247, 2.256, 2.265, 2.274, 2.283, 2.292, 2.301, - & 2.310, 2.318, 2.327, 2.336, 2.345, 2.354, 2.362, 2.371, 2.380, - & 2.388, 2.397, 2.406, 2.414, 2.423, 2.432, 2.440, 2.449, 2.457, - & 2.466, 2.474, 2.483, 2.491, 2.500, 2.508, 2.517, 2.525, 2.533, - & 2.542, 2.550, 2.558, 2.567, 2.575, 2.583, 2.591, 2.600, 2.608, - & 2.616, 2.624, 2.633, 2.641, 2.649, 2.657, 2.665, 2.673, 2.681, - & 2.689, 2.697, 2.705, 2.713, 2.721, 2.729, 2.737, 2.745, 2.753, - & 2.761, 2.769, 2.777, 2.785, 2.793, 2.801, 2.809, 2.816, 2.824, - & 2.832, 2.840, 2.847, 2.855, 2.863, 2.871, 2.878, 2.886, 2.894, - & 2.901, 2.909, 2.917, 2.924, 2.932, 2.939, 2.947, 2.955, 2.962, - & 2.970, 2.977, 2.985, 2.992, 3.000, 3.007, 3.014, 3.022, 3.029, - & 3.037, 3.044, 3.051, 3.059, 3.066, 3.074, 3.081, 3.088, 3.095, - & 3.103, 3.110, 3.117, 3.125, 3.132, 3.139, 3.146, 3.153, 3.161, - & 3.168, 3.175, 3.182, 3.189, 3.196, 3.203, 3.210, 3.217, 3.225, - & 3.232, 3.239, 3.246, 3.253, 3.260, 3.267, 3.274, 3.281, 3.288, - & 3.294, 3.301, 3.308, 3.315, 3.322, 3.329, 3.336, 3.343, 3.350, - & 3.356, 3.363, 3.370, 3.377, 3.450, 3.516, 3.581, 3.645, 3.708, - & 3.770, 3.831, 3.891, 3.950, 4.008, 4.065, 4.122, 4.178, 4.233, - & 4.287, 4.340, 4.393, 4.445, 4.496, 4.547, 4.597, 4.646, 4.695, - & 4.743, 4.790, 4.837, 4.884, 4.929, 4.974, 5.019, 5.063, 5.107, - & 5.150, 5.193, 5.235, 5.277, 5.318, 5.359, 5.399, 5.439, 5.478, - & 5.517, 5.556, 5.594, 5.632, 5.670, 5.707, 5.743, 5.780, 5.816, - & 5.852, 5.887, 5.922, 5.956, 5.991, 6.025, 6.058, 6.092, 6.125, - & 6.158, 6.190, 6.222, 6.254, 6.286, 6.317, 6.348, 6.379, 6.410, - & 6.440, 6.470, 6.500, 6.529, 6.559, 6.588, 6.616, 6.645, 6.673, - & 6.701, 6.729, 6.757, 6.784, 6.812, 6.839, 6.865, 6.892, 6.919, - & 6.945, 6.971, 6.997, 7.022, 7.048, 7.073, 7.098, 7.123, 7.148, - & 7.172, 7.196, 7.221, 7.245, 7.269, 7.292, 7.316, 7.339, 7.362, - & 7.385, 7.408, 7.431, 7.454, 7.476, 7.498, 7.520, 7.542, 7.564, - & 7.586, 7.607, 7.629, 7.650, 7.671, 7.692, 7.713, 7.734, 7.755, - & 7.775, 7.795, 7.816, 7.836, 7.856, 7.876, 7.895, 7.915, 7.935, - & 7.954, 7.973, 7.992, 8.012, 8.030, 8.049, 8.068, 8.087, 8.105, - & 8.124, 8.142, 8.160, 8.178, 8.196, 8.214, 8.232, 8.250, 8.267, - & 8.285, 8.302, 8.319, 8.337, 8.354, 8.371, 8.388, 8.404, 8.421, - & 8.438, 8.454, 8.471 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.048,-0.102,-0.128,-0.146,-0.159,-0.170,-0.179,-0.187,-0.194, - &-0.200,-0.205,-0.210,-0.214,-0.218,-0.221,-0.224,-0.227,-0.230, - &-0.232,-0.234,-0.235,-0.237,-0.238,-0.239,-0.240,-0.241,-0.242, - &-0.242,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.242,-0.242, - &-0.241,-0.241,-0.240,-0.239,-0.238,-0.237,-0.236,-0.235,-0.234, - &-0.233,-0.231,-0.230,-0.228,-0.227,-0.225,-0.224,-0.222,-0.220, - &-0.218,-0.216,-0.214,-0.212,-0.210,-0.208,-0.206,-0.204,-0.202, - &-0.199,-0.197,-0.195,-0.192,-0.190,-0.188,-0.185,-0.183,-0.180, - &-0.178,-0.175,-0.172,-0.170,-0.167,-0.164,-0.161,-0.159,-0.156, - &-0.153,-0.150,-0.147,-0.144,-0.141,-0.138,-0.135,-0.132,-0.129, - &-0.126,-0.123,-0.119,-0.116,-0.113,-0.110,-0.106,-0.103,-0.100, - &-0.096,-0.093,-0.090,-0.086,-0.083,-0.080,-0.076,-0.073,-0.069, - &-0.066,-0.062,-0.059,-0.055,-0.052,-0.048,-0.045,-0.041,-0.037, - &-0.034,-0.030,-0.027,-0.023,-0.020,-0.016,-0.012,-0.009,-0.005, - &-0.002, 0.002, 0.005, 0.009, 0.013, 0.016, 0.020, 0.023, 0.027, - & 0.030, 0.034, 0.037, 0.041, 0.044, 0.048, 0.051, 0.055, 0.058, - & 0.062, 0.065, 0.069, 0.072, 0.076, 0.079, 0.083, 0.086, 0.090, - & 0.093, 0.097, 0.100, 0.103, 0.107, 0.110, 0.114, 0.117, 0.120, - & 0.124, 0.127, 0.130, 0.134, 0.137, 0.140, 0.144, 0.147, 0.150, - & 0.154, 0.157, 0.160, 0.164, 0.167, 0.170, 0.173, 0.177, 0.180, - & 0.183, 0.186, 0.189, 0.193, 0.196, 0.199, 0.202, 0.205, 0.209, - & 0.212, 0.215, 0.218, 0.221, 0.224, 0.227, 0.231, 0.234, 0.237, - & 0.240, 0.243, 0.246, 0.249, 0.252, 0.255, 0.258, 0.261, 0.264, - & 0.267, 0.270, 0.273, 0.276, 0.279, 0.282, 0.285, 0.288, 0.291, - & 0.294, 0.297, 0.300, 0.303, 0.306, 0.309, 0.312, 0.315, 0.317, - & 0.320, 0.323, 0.326, 0.329, 0.332, 0.335, 0.338, 0.340, 0.343, - & 0.346, 0.349, 0.352, 0.354, 0.357, 0.360, 0.363, 0.366, 0.368, - & 0.371, 0.374, 0.377, 0.379, 0.382, 0.385, 0.388, 0.390, 0.393, - & 0.396, 0.398, 0.401, 0.404, 0.407, 0.409, 0.412, 0.415, 0.417, - & 0.420, 0.422, 0.425, 0.428, 0.430, 0.433, 0.436, 0.438, 0.441, - & 0.443, 0.446, 0.449, 0.451, 0.454, 0.456, 0.459, 0.461, 0.464, - & 0.467, 0.469, 0.472, 0.474, 0.477, 0.479, 0.482, 0.484, 0.487, - & 0.489, 0.492, 0.494, 0.497, 0.499, 0.502, 0.504, 0.507, 0.509, - & 0.511, 0.514, 0.516, 0.519, 0.521, 0.524, 0.526, 0.528, 0.531, - & 0.533, 0.536, 0.538, 0.540, 0.543, 0.545, 0.548, 0.550, 0.552, - & 0.555, 0.557, 0.559, 0.562, 0.564, 0.566, 0.569, 0.571, 0.573, - & 0.576, 0.578, 0.580, 0.583, 0.585, 0.587, 0.589, 0.592, 0.594, - & 0.596, 0.599, 0.601, 0.603, 0.605, 0.608, 0.610, 0.612, 0.614, - & 0.617, 0.619, 0.621, 0.623, 0.625, 0.628, 0.630, 0.632, 0.634, - & 0.636, 0.639, 0.641, 0.643, 0.645, 0.647, 0.649, 0.652, 0.654, - & 0.656, 0.658, 0.660, 0.662, 0.665, 0.667, 0.669, 0.671, 0.673, - & 0.675, 0.677, 0.679, 0.681, 0.684, 0.686, 0.688, 0.690, 0.692, - & 0.694, 0.696, 0.698, 0.700, 0.702, 0.704, 0.706, 0.708, 0.710, - & 0.713, 0.715, 0.717, 0.719, 0.721, 0.723, 0.725, 0.727, 0.729, - & 0.731, 0.733, 0.735, 0.737, 0.758, 0.778, 0.797, 0.815, 0.834, - & 0.852, 0.870, 0.887, 0.905, 0.922, 0.938, 0.955, 0.971, 0.987, - & 1.003, 1.018, 1.033, 1.048, 1.063, 1.078, 1.092, 1.106, 1.120, - & 1.134, 1.148, 1.161, 1.174, 1.187, 1.200, 1.213, 1.225, 1.238, - & 1.250, 1.262, 1.274, 1.286, 1.297, 1.309, 1.320, 1.331, 1.342, - & 1.353, 1.364, 1.374, 1.385, 1.395, 1.406, 1.416, 1.426, 1.436, - & 1.446, 1.455, 1.465, 1.475, 1.484, 1.493, 1.502, 1.512, 1.521, - & 1.529, 1.538, 1.547, 1.556, 1.564, 1.572, 1.581, 1.589, 1.597, - & 1.605, 1.613, 1.621, 1.629, 1.637, 1.645, 1.652, 1.660, 1.667, - & 1.675, 1.682, 1.689, 1.696, 1.704, 1.711, 1.718, 1.725, 1.731, - & 1.738, 1.745, 1.752, 1.758, 1.765, 1.771, 1.778, 1.784, 1.790, - & 1.796, 1.803, 1.809, 1.815, 1.821, 1.827, 1.833, 1.839, 1.844, - & 1.850, 1.856, 1.861, 1.867, 1.873, 1.878, 1.884, 1.889, 1.894, - & 1.900, 1.905, 1.910, 1.915, 1.920, 1.926, 1.931, 1.936, 1.941, - & 1.946, 1.950, 1.955, 1.960, 1.965, 1.970, 1.974, 1.979, 1.983, - & 1.988, 1.993, 1.997, 2.001, 2.006, 2.010, 2.015, 2.019, 2.023, - & 2.027, 2.032, 2.036, 2.040, 2.044, 2.048, 2.052, 2.056, 2.060, - & 2.064, 2.068, 2.072, 2.076, 2.080, 2.083, 2.087, 2.091, 2.095, - & 2.098, 2.102, 2.106 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.047,-0.098,-0.120,-0.135,-0.145,-0.153,-0.158,-0.163,-0.167, - &-0.169,-0.172,-0.173,-0.175,-0.176,-0.176,-0.176,-0.176,-0.176, - &-0.176,-0.175,-0.175,-0.174,-0.173,-0.172,-0.170,-0.169,-0.168, - &-0.166,-0.165,-0.163,-0.162,-0.160,-0.159,-0.157,-0.155,-0.153, - &-0.151,-0.149,-0.148,-0.146,-0.144,-0.142,-0.140,-0.138,-0.136, - &-0.134,-0.132,-0.130,-0.128,-0.126,-0.124,-0.122,-0.120,-0.118, - &-0.115,-0.113,-0.111,-0.109,-0.107,-0.105,-0.103,-0.101,-0.099, - &-0.097,-0.095,-0.093,-0.090,-0.088,-0.086,-0.084,-0.082,-0.080, - &-0.078,-0.075,-0.073,-0.071,-0.069,-0.067,-0.064,-0.062,-0.060, - &-0.057,-0.055,-0.053,-0.051,-0.048,-0.046,-0.043,-0.041,-0.039, - &-0.036,-0.034,-0.031,-0.029,-0.026,-0.024,-0.021,-0.019,-0.016, - &-0.014,-0.011,-0.008,-0.006,-0.003, 0.000, 0.002, 0.005, 0.007, - & 0.010, 0.013, 0.016, 0.018, 0.021, 0.024, 0.026, 0.029, 0.032, - & 0.035, 0.037, 0.040, 0.043, 0.046, 0.048, 0.051, 0.054, 0.057, - & 0.059, 0.062, 0.065, 0.068, 0.070, 0.073, 0.076, 0.079, 0.081, - & 0.084, 0.087, 0.090, 0.092, 0.095, 0.098, 0.101, 0.103, 0.106, - & 0.109, 0.112, 0.114, 0.117, 0.120, 0.123, 0.125, 0.128, 0.131, - & 0.133, 0.136, 0.139, 0.142, 0.144, 0.147, 0.150, 0.152, 0.155, - & 0.158, 0.160, 0.163, 0.166, 0.168, 0.171, 0.174, 0.176, 0.179, - & 0.182, 0.184, 0.187, 0.190, 0.192, 0.195, 0.198, 0.200, 0.203, - & 0.205, 0.208, 0.211, 0.213, 0.216, 0.218, 0.221, 0.224, 0.226, - & 0.229, 0.231, 0.234, 0.236, 0.239, 0.242, 0.244, 0.247, 0.249, - & 0.252, 0.254, 0.257, 0.259, 0.262, 0.264, 0.267, 0.269, 0.272, - & 0.275, 0.277, 0.280, 0.282, 0.285, 0.287, 0.289, 0.292, 0.294, - & 0.297, 0.299, 0.302, 0.304, 0.307, 0.309, 0.312, 0.314, 0.317, - & 0.319, 0.321, 0.324, 0.326, 0.329, 0.331, 0.334, 0.336, 0.338, - & 0.341, 0.343, 0.346, 0.348, 0.350, 0.353, 0.355, 0.357, 0.360, - & 0.362, 0.364, 0.367, 0.369, 0.372, 0.374, 0.376, 0.379, 0.381, - & 0.383, 0.386, 0.388, 0.390, 0.392, 0.395, 0.397, 0.399, 0.402, - & 0.404, 0.406, 0.409, 0.411, 0.413, 0.415, 0.418, 0.420, 0.422, - & 0.424, 0.427, 0.429, 0.431, 0.433, 0.436, 0.438, 0.440, 0.442, - & 0.445, 0.447, 0.449, 0.451, 0.453, 0.456, 0.458, 0.460, 0.462, - & 0.464, 0.467, 0.469, 0.471, 0.473, 0.475, 0.477, 0.480, 0.482, - & 0.484, 0.486, 0.488, 0.490, 0.492, 0.495, 0.497, 0.499, 0.501, - & 0.503, 0.505, 0.507, 0.509, 0.511, 0.514, 0.516, 0.518, 0.520, - & 0.522, 0.524, 0.526, 0.528, 0.530, 0.532, 0.534, 0.536, 0.539, - & 0.541, 0.543, 0.545, 0.547, 0.549, 0.551, 0.553, 0.555, 0.557, - & 0.559, 0.561, 0.563, 0.565, 0.567, 0.569, 0.571, 0.573, 0.575, - & 0.577, 0.579, 0.581, 0.583, 0.585, 0.587, 0.589, 0.591, 0.593, - & 0.595, 0.597, 0.599, 0.601, 0.603, 0.604, 0.606, 0.608, 0.610, - & 0.612, 0.614, 0.616, 0.618, 0.620, 0.622, 0.624, 0.626, 0.628, - & 0.629, 0.631, 0.633, 0.635, 0.637, 0.639, 0.641, 0.643, 0.645, - & 0.646, 0.648, 0.650, 0.652, 0.654, 0.656, 0.658, 0.659, 0.661, - & 0.663, 0.665, 0.667, 0.669, 0.671, 0.672, 0.674, 0.676, 0.678, - & 0.680, 0.681, 0.683, 0.685, 0.704, 0.722, 0.739, 0.756, 0.773, - & 0.790, 0.806, 0.822, 0.838, 0.853, 0.869, 0.884, 0.899, 0.913, - & 0.928, 0.942, 0.956, 0.970, 0.983, 0.996, 1.010, 1.023, 1.036, - & 1.048, 1.061, 1.073, 1.085, 1.097, 1.109, 1.121, 1.132, 1.144, - & 1.155, 1.166, 1.177, 1.188, 1.198, 1.209, 1.219, 1.230, 1.240, - & 1.250, 1.260, 1.270, 1.279, 1.289, 1.298, 1.308, 1.317, 1.326, - & 1.335, 1.344, 1.353, 1.362, 1.370, 1.379, 1.387, 1.396, 1.404, - & 1.412, 1.420, 1.428, 1.436, 1.444, 1.451, 1.459, 1.467, 1.474, - & 1.481, 1.489, 1.496, 1.503, 1.510, 1.517, 1.524, 1.531, 1.538, - & 1.545, 1.551, 1.558, 1.565, 1.571, 1.578, 1.584, 1.590, 1.596, - & 1.603, 1.609, 1.615, 1.621, 1.627, 1.632, 1.638, 1.644, 1.650, - & 1.655, 1.661, 1.667, 1.672, 1.678, 1.683, 1.688, 1.694, 1.699, - & 1.704, 1.709, 1.714, 1.719, 1.724, 1.729, 1.734, 1.739, 1.744, - & 1.749, 1.753, 1.758, 1.763, 1.767, 1.772, 1.776, 1.781, 1.785, - & 1.790, 1.794, 1.799, 1.803, 1.807, 1.811, 1.815, 1.820, 1.824, - & 1.828, 1.832, 1.836, 1.840, 1.844, 1.848, 1.852, 1.855, 1.859, - & 1.863, 1.867, 1.870, 1.874, 1.878, 1.881, 1.885, 1.888, 1.892, - & 1.895, 1.899, 1.902, 1.906, 1.909, 1.913, 1.916, 1.919, 1.922, - & 1.926, 1.929, 1.932 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.046,-0.091,-0.110,-0.120,-0.127,-0.131,-0.133,-0.134,-0.134, - &-0.134,-0.132,-0.131,-0.128,-0.126,-0.123,-0.120,-0.116,-0.112, - &-0.108,-0.104,-0.099,-0.095,-0.090,-0.085,-0.080,-0.075,-0.070, - &-0.064,-0.059,-0.053,-0.047,-0.042,-0.036,-0.030,-0.024,-0.018, - &-0.011,-0.005, 0.001, 0.007, 0.014, 0.020, 0.026, 0.033, 0.039, - & 0.046, 0.052, 0.059, 0.065, 0.072, 0.079, 0.085, 0.092, 0.099, - & 0.105, 0.112, 0.119, 0.126, 0.132, 0.139, 0.146, 0.153, 0.160, - & 0.166, 0.173, 0.180, 0.187, 0.194, 0.201, 0.208, 0.215, 0.222, - & 0.229, 0.236, 0.243, 0.250, 0.257, 0.264, 0.272, 0.279, 0.286, - & 0.293, 0.301, 0.308, 0.316, 0.323, 0.330, 0.338, 0.346, 0.353, - & 0.361, 0.368, 0.376, 0.384, 0.392, 0.399, 0.407, 0.415, 0.423, - & 0.431, 0.439, 0.447, 0.455, 0.463, 0.471, 0.479, 0.487, 0.495, - & 0.503, 0.512, 0.520, 0.528, 0.536, 0.544, 0.553, 0.561, 0.569, - & 0.577, 0.586, 0.594, 0.602, 0.610, 0.619, 0.627, 0.635, 0.643, - & 0.652, 0.660, 0.668, 0.676, 0.685, 0.693, 0.701, 0.709, 0.718, - & 0.726, 0.734, 0.742, 0.750, 0.759, 0.767, 0.775, 0.783, 0.791, - & 0.799, 0.807, 0.815, 0.823, 0.832, 0.840, 0.848, 0.856, 0.864, - & 0.872, 0.880, 0.888, 0.896, 0.903, 0.911, 0.919, 0.927, 0.935, - & 0.943, 0.951, 0.959, 0.966, 0.974, 0.982, 0.990, 0.998, 1.005, - & 1.013, 1.021, 1.029, 1.036, 1.044, 1.052, 1.059, 1.067, 1.075, - & 1.082, 1.090, 1.097, 1.105, 1.112, 1.120, 1.128, 1.135, 1.143, - & 1.150, 1.157, 1.165, 1.172, 1.180, 1.187, 1.195, 1.202, 1.209, - & 1.217, 1.224, 1.231, 1.239, 1.246, 1.253, 1.260, 1.268, 1.275, - & 1.282, 1.289, 1.296, 1.303, 1.311, 1.318, 1.325, 1.332, 1.339, - & 1.346, 1.353, 1.360, 1.367, 1.374, 1.381, 1.388, 1.395, 1.402, - & 1.409, 1.416, 1.423, 1.430, 1.437, 1.444, 1.451, 1.457, 1.464, - & 1.471, 1.478, 1.485, 1.491, 1.498, 1.505, 1.512, 1.518, 1.525, - & 1.532, 1.538, 1.545, 1.552, 1.558, 1.565, 1.572, 1.578, 1.585, - & 1.591, 1.598, 1.604, 1.611, 1.617, 1.624, 1.630, 1.637, 1.643, - & 1.650, 1.656, 1.663, 1.669, 1.675, 1.682, 1.688, 1.695, 1.701, - & 1.707, 1.714, 1.720, 1.726, 1.732, 1.739, 1.745, 1.751, 1.757, - & 1.764, 1.770, 1.776, 1.782, 1.788, 1.795, 1.801, 1.807, 1.813, - & 1.819, 1.825, 1.831, 1.837, 1.843, 1.849, 1.855, 1.861, 1.867, - & 1.873, 1.879, 1.885, 1.891, 1.897, 1.903, 1.909, 1.915, 1.921, - & 1.927, 1.933, 1.939, 1.945, 1.950, 1.956, 1.962, 1.968, 1.974, - & 1.979, 1.985, 1.991, 1.997, 2.003, 2.008, 2.014, 2.020, 2.025, - & 2.031, 2.037, 2.042, 2.048, 2.054, 2.059, 2.065, 2.071, 2.076, - & 2.082, 2.087, 2.093, 2.099, 2.104, 2.110, 2.115, 2.121, 2.126, - & 2.132, 2.137, 2.143, 2.148, 2.154, 2.159, 2.165, 2.170, 2.175, - & 2.181, 2.186, 2.192, 2.197, 2.202, 2.208, 2.213, 2.219, 2.224, - & 2.229, 2.235, 2.240, 2.245, 2.250, 2.256, 2.261, 2.266, 2.271, - & 2.277, 2.282, 2.287, 2.292, 2.298, 2.303, 2.308, 2.313, 2.318, - & 2.323, 2.329, 2.334, 2.339, 2.344, 2.349, 2.354, 2.359, 2.364, - & 2.369, 2.375, 2.380, 2.385, 2.390, 2.395, 2.400, 2.405, 2.410, - & 2.415, 2.420, 2.425, 2.430, 2.483, 2.531, 2.579, 2.626, 2.672, - & 2.717, 2.762, 2.806, 2.849, 2.891, 2.933, 2.975, 3.015, 3.056, - & 3.095, 3.134, 3.173, 3.211, 3.248, 3.285, 3.322, 3.358, 3.393, - & 3.428, 3.463, 3.497, 3.531, 3.564, 3.597, 3.629, 3.662, 3.693, - & 3.725, 3.756, 3.786, 3.817, 3.847, 3.876, 3.906, 3.935, 3.963, - & 3.992, 4.020, 4.048, 4.075, 4.102, 4.129, 4.156, 4.182, 4.208, - & 4.234, 4.260, 4.285, 4.310, 4.335, 4.359, 4.384, 4.408, 4.432, - & 4.456, 4.479, 4.502, 4.525, 4.548, 4.571, 4.593, 4.615, 4.637, - & 4.659, 4.681, 4.702, 4.724, 4.745, 4.766, 4.786, 4.807, 4.827, - & 4.847, 4.868, 4.887, 4.907, 4.927, 4.946, 4.965, 4.984, 5.003, - & 5.022, 5.041, 5.059, 5.078, 5.096, 5.114, 5.132, 5.150, 5.168, - & 5.185, 5.203, 5.220, 5.237, 5.254, 5.271, 5.288, 5.304, 5.321, - & 5.337, 5.354, 5.370, 5.386, 5.402, 5.418, 5.434, 5.449, 5.465, - & 5.480, 5.496, 5.511, 5.526, 5.541, 5.556, 5.571, 5.586, 5.600, - & 5.615, 5.629, 5.644, 5.658, 5.672, 5.686, 5.700, 5.714, 5.728, - & 5.742, 5.755, 5.769, 5.782, 5.796, 5.809, 5.822, 5.835, 5.848, - & 5.861, 5.874, 5.887, 5.900, 5.913, 5.925, 5.938, 5.950, 5.963, - & 5.975, 5.987, 5.999, 6.011, 6.023, 6.035, 6.047, 6.059, 6.071, - & 6.083, 6.094, 6.106 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.047,-0.097,-0.120,-0.135,-0.146,-0.154,-0.160,-0.165,-0.170, - &-0.173,-0.176,-0.178,-0.179,-0.181,-0.181,-0.182,-0.182,-0.182, - &-0.182,-0.182,-0.181,-0.180,-0.179,-0.178,-0.176,-0.175,-0.173, - &-0.172,-0.170,-0.168,-0.165,-0.163,-0.161,-0.158,-0.156,-0.153, - &-0.150,-0.148,-0.145,-0.142,-0.139,-0.136,-0.132,-0.129,-0.126, - &-0.123,-0.119,-0.116,-0.112,-0.109,-0.105,-0.101,-0.098,-0.094, - &-0.090,-0.086,-0.082,-0.078,-0.074,-0.070,-0.066,-0.062,-0.058, - &-0.054,-0.050,-0.046,-0.041,-0.037,-0.033,-0.028,-0.024,-0.020, - &-0.015,-0.011,-0.006,-0.002, 0.003, 0.007, 0.012, 0.017, 0.021, - & 0.026, 0.031, 0.036, 0.041, 0.045, 0.050, 0.055, 0.060, 0.065, - & 0.070, 0.075, 0.080, 0.086, 0.091, 0.096, 0.101, 0.106, 0.112, - & 0.117, 0.122, 0.128, 0.133, 0.138, 0.144, 0.149, 0.154, 0.160, - & 0.165, 0.171, 0.176, 0.182, 0.187, 0.193, 0.198, 0.204, 0.209, - & 0.215, 0.221, 0.226, 0.232, 0.237, 0.243, 0.248, 0.254, 0.259, - & 0.265, 0.271, 0.276, 0.282, 0.287, 0.293, 0.298, 0.304, 0.309, - & 0.315, 0.320, 0.326, 0.331, 0.337, 0.342, 0.348, 0.353, 0.358, - & 0.364, 0.369, 0.375, 0.380, 0.386, 0.391, 0.396, 0.402, 0.407, - & 0.412, 0.418, 0.423, 0.428, 0.434, 0.439, 0.444, 0.449, 0.455, - & 0.460, 0.465, 0.470, 0.476, 0.481, 0.486, 0.491, 0.496, 0.502, - & 0.507, 0.512, 0.517, 0.522, 0.527, 0.532, 0.537, 0.542, 0.548, - & 0.553, 0.558, 0.563, 0.568, 0.573, 0.578, 0.583, 0.588, 0.593, - & 0.598, 0.603, 0.607, 0.612, 0.617, 0.622, 0.627, 0.632, 0.637, - & 0.642, 0.647, 0.651, 0.656, 0.661, 0.666, 0.671, 0.675, 0.680, - & 0.685, 0.690, 0.694, 0.699, 0.704, 0.709, 0.713, 0.718, 0.723, - & 0.727, 0.732, 0.737, 0.741, 0.746, 0.751, 0.755, 0.760, 0.764, - & 0.769, 0.773, 0.778, 0.783, 0.787, 0.792, 0.796, 0.801, 0.805, - & 0.810, 0.814, 0.819, 0.823, 0.828, 0.832, 0.836, 0.841, 0.845, - & 0.850, 0.854, 0.858, 0.863, 0.867, 0.872, 0.876, 0.880, 0.885, - & 0.889, 0.893, 0.898, 0.902, 0.906, 0.910, 0.915, 0.919, 0.923, - & 0.928, 0.932, 0.936, 0.940, 0.944, 0.949, 0.953, 0.957, 0.961, - & 0.965, 0.969, 0.974, 0.978, 0.982, 0.986, 0.990, 0.994, 0.998, - & 1.002, 1.007, 1.011, 1.015, 1.019, 1.023, 1.027, 1.031, 1.035, - & 1.039, 1.043, 1.047, 1.051, 1.055, 1.059, 1.063, 1.067, 1.071, - & 1.075, 1.079, 1.083, 1.087, 1.091, 1.094, 1.098, 1.102, 1.106, - & 1.110, 1.114, 1.118, 1.122, 1.125, 1.129, 1.133, 1.137, 1.141, - & 1.145, 1.148, 1.152, 1.156, 1.160, 1.164, 1.167, 1.171, 1.175, - & 1.179, 1.182, 1.186, 1.190, 1.194, 1.197, 1.201, 1.205, 1.208, - & 1.212, 1.216, 1.219, 1.223, 1.227, 1.230, 1.234, 1.238, 1.241, - & 1.245, 1.249, 1.252, 1.256, 1.259, 1.263, 1.267, 1.270, 1.274, - & 1.277, 1.281, 1.284, 1.288, 1.292, 1.295, 1.299, 1.302, 1.306, - & 1.309, 1.313, 1.316, 1.320, 1.323, 1.327, 1.330, 1.334, 1.337, - & 1.341, 1.344, 1.347, 1.351, 1.354, 1.358, 1.361, 1.365, 1.368, - & 1.371, 1.375, 1.378, 1.382, 1.385, 1.388, 1.392, 1.395, 1.398, - & 1.402, 1.405, 1.408, 1.412, 1.415, 1.418, 1.422, 1.425, 1.428, - & 1.432, 1.435, 1.438, 1.441, 1.477, 1.509, 1.540, 1.571, 1.601, - & 1.631, 1.661, 1.690, 1.718, 1.747, 1.774, 1.802, 1.829, 1.855, - & 1.881, 1.907, 1.933, 1.958, 1.983, 2.007, 2.031, 2.055, 2.079, - & 2.102, 2.125, 2.147, 2.170, 2.192, 2.213, 2.235, 2.256, 2.277, - & 2.298, 2.318, 2.339, 2.359, 2.378, 2.398, 2.417, 2.436, 2.455, - & 2.474, 2.493, 2.511, 2.529, 2.547, 2.565, 2.582, 2.599, 2.617, - & 2.634, 2.650, 2.667, 2.684, 2.700, 2.716, 2.732, 2.748, 2.763, - & 2.779, 2.794, 2.810, 2.825, 2.840, 2.854, 2.869, 2.884, 2.898, - & 2.912, 2.926, 2.940, 2.954, 2.968, 2.982, 2.995, 3.008, 3.022, - & 3.035, 3.048, 3.061, 3.074, 3.086, 3.099, 3.111, 3.124, 3.136, - & 3.148, 3.160, 3.172, 3.184, 3.196, 3.208, 3.219, 3.231, 3.242, - & 3.254, 3.265, 3.276, 3.287, 3.298, 3.309, 3.320, 3.330, 3.341, - & 3.352, 3.362, 3.373, 3.383, 3.393, 3.403, 3.413, 3.423, 3.433, - & 3.443, 3.453, 3.463, 3.472, 3.482, 3.491, 3.501, 3.510, 3.520, - & 3.529, 3.538, 3.547, 3.556, 3.565, 3.574, 3.583, 3.592, 3.601, - & 3.609, 3.618, 3.626, 3.635, 3.643, 3.652, 3.660, 3.668, 3.677, - & 3.685, 3.693, 3.701, 3.709, 3.717, 3.725, 3.733, 3.741, 3.748, - & 3.756, 3.764, 3.771, 3.779, 3.786, 3.794, 3.801, 3.809, 3.816, - & 3.823, 3.830, 3.838 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.078,-0.169,-0.215,-0.247,-0.272,-0.293,-0.311,-0.326,-0.340, - &-0.353,-0.364,-0.375,-0.384,-0.393,-0.402,-0.410,-0.417,-0.424, - &-0.431,-0.437,-0.443,-0.448,-0.454,-0.459,-0.464,-0.469,-0.473, - &-0.477,-0.482,-0.486,-0.489,-0.493,-0.497,-0.500,-0.503,-0.506, - &-0.509,-0.512,-0.515,-0.518,-0.520,-0.523,-0.525,-0.528,-0.530, - &-0.532,-0.534,-0.536,-0.538,-0.540,-0.542,-0.544,-0.546,-0.547, - &-0.549,-0.550,-0.552,-0.553,-0.555,-0.556,-0.557,-0.559,-0.560, - &-0.561,-0.562,-0.563,-0.564,-0.565,-0.566,-0.567,-0.568,-0.569, - &-0.570,-0.571,-0.572,-0.572,-0.573,-0.574,-0.575,-0.575,-0.576, - &-0.576,-0.577,-0.578,-0.578,-0.579,-0.579,-0.580,-0.580,-0.580, - &-0.581,-0.581,-0.582,-0.582,-0.582,-0.582,-0.583,-0.583,-0.583, - &-0.583,-0.584,-0.584,-0.584,-0.584,-0.584,-0.584,-0.584,-0.585, - &-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585, - &-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585,-0.585, - &-0.585,-0.584,-0.584,-0.584,-0.584,-0.584,-0.584,-0.584,-0.584, - &-0.584,-0.584,-0.583,-0.583,-0.583,-0.583,-0.583,-0.583,-0.583, - &-0.582,-0.582,-0.582,-0.582,-0.582,-0.582,-0.582,-0.581,-0.581, - &-0.581,-0.581,-0.581,-0.581,-0.580,-0.580,-0.580,-0.580,-0.580, - &-0.579,-0.579,-0.579,-0.579,-0.579,-0.579,-0.578,-0.578,-0.578, - &-0.578,-0.578,-0.577,-0.577,-0.577,-0.577,-0.577,-0.577,-0.576, - &-0.576,-0.576,-0.576,-0.576,-0.575,-0.575,-0.575,-0.575,-0.575, - &-0.574,-0.574,-0.574,-0.574,-0.574,-0.574,-0.573,-0.573,-0.573, - &-0.573,-0.573,-0.572,-0.572,-0.572,-0.572,-0.572,-0.571,-0.571, - &-0.571,-0.571,-0.571,-0.571,-0.570,-0.570,-0.570,-0.570,-0.570, - &-0.569,-0.569,-0.569,-0.569,-0.569,-0.569,-0.568,-0.568,-0.568, - &-0.568,-0.568,-0.567,-0.567,-0.567,-0.567,-0.567,-0.567,-0.566, - &-0.566,-0.566,-0.566,-0.566,-0.566,-0.565,-0.565,-0.565,-0.565, - &-0.565,-0.565,-0.564,-0.564,-0.564,-0.564,-0.564,-0.564,-0.563, - &-0.563,-0.563,-0.563,-0.563,-0.563,-0.562,-0.562,-0.562,-0.562, - &-0.562,-0.562,-0.561,-0.561,-0.561,-0.561,-0.561,-0.561,-0.561, - &-0.560,-0.560,-0.560,-0.560,-0.560,-0.560,-0.560,-0.559,-0.559, - &-0.559,-0.559,-0.559,-0.559,-0.559,-0.558,-0.558,-0.558,-0.558, - &-0.558,-0.558,-0.558,-0.557,-0.557,-0.557,-0.557,-0.557,-0.557, - &-0.557,-0.556,-0.556,-0.556,-0.556,-0.556,-0.556,-0.556,-0.556, - &-0.555,-0.555,-0.555,-0.555,-0.555,-0.555,-0.555,-0.555,-0.554, - &-0.554,-0.554,-0.554,-0.554,-0.554,-0.554,-0.554,-0.554,-0.553, - &-0.553,-0.553,-0.553,-0.553,-0.553,-0.553,-0.553,-0.553,-0.552, - &-0.552,-0.552,-0.552,-0.552,-0.552,-0.552,-0.552,-0.552,-0.552, - &-0.551,-0.551,-0.551,-0.551,-0.551,-0.551,-0.551,-0.551,-0.551, - &-0.551,-0.550,-0.550,-0.550,-0.550,-0.550,-0.550,-0.550,-0.550, - &-0.550,-0.550,-0.550,-0.549,-0.549,-0.549,-0.549,-0.549,-0.549, - &-0.549,-0.549,-0.549,-0.549,-0.549,-0.549,-0.549,-0.548,-0.548, - &-0.548,-0.548,-0.548,-0.548,-0.548,-0.548,-0.548,-0.548,-0.548, - &-0.548,-0.548,-0.547,-0.547,-0.547,-0.547,-0.547,-0.547,-0.547, - &-0.547,-0.547,-0.547,-0.547,-0.546,-0.546,-0.545,-0.545,-0.544, - &-0.544,-0.544,-0.544,-0.544,-0.544,-0.544,-0.544,-0.544,-0.544, - &-0.544,-0.544,-0.545,-0.545,-0.545,-0.546,-0.546,-0.547,-0.547, - &-0.548,-0.548,-0.549,-0.550,-0.550,-0.551,-0.552,-0.553,-0.554, - &-0.555,-0.556,-0.557,-0.558,-0.559,-0.560,-0.561,-0.562,-0.563, - &-0.564,-0.566,-0.567,-0.568,-0.569,-0.571,-0.572,-0.573,-0.575, - &-0.576,-0.578,-0.579,-0.581,-0.582,-0.584,-0.586,-0.587,-0.589, - &-0.590,-0.592,-0.594,-0.595,-0.597,-0.599,-0.601,-0.603,-0.604, - &-0.606,-0.608,-0.610,-0.612,-0.614,-0.616,-0.618,-0.620,-0.622, - &-0.624,-0.626,-0.628,-0.630,-0.632,-0.634,-0.636,-0.638,-0.640, - &-0.642,-0.644,-0.647,-0.649,-0.651,-0.653,-0.655,-0.658,-0.660, - &-0.662,-0.664,-0.667,-0.669,-0.671,-0.674,-0.676,-0.678,-0.681, - &-0.683,-0.686,-0.688,-0.690,-0.693,-0.695,-0.698,-0.700,-0.703, - &-0.705,-0.708,-0.710,-0.713,-0.715,-0.718,-0.720,-0.723,-0.725, - &-0.728,-0.731,-0.733,-0.736,-0.738,-0.741,-0.744,-0.746,-0.749, - &-0.752,-0.754,-0.757,-0.760,-0.762,-0.765,-0.768,-0.770,-0.773, - &-0.776,-0.779,-0.781,-0.784,-0.787,-0.790,-0.793,-0.795,-0.798, - &-0.801,-0.804,-0.807,-0.809,-0.812,-0.815,-0.818,-0.821,-0.824, - &-0.827,-0.829,-0.832 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.096,-0.206,-0.258,-0.293,-0.321,-0.342,-0.360,-0.376,-0.389, - &-0.401,-0.411,-0.420,-0.429,-0.436,-0.443,-0.449,-0.455,-0.460, - &-0.465,-0.469,-0.473,-0.477,-0.481,-0.484,-0.487,-0.490,-0.493, - &-0.495,-0.497,-0.500,-0.502,-0.504,-0.505,-0.507,-0.509,-0.510, - &-0.512,-0.513,-0.514,-0.515,-0.517,-0.518,-0.519,-0.520,-0.520, - &-0.521,-0.522,-0.523,-0.524,-0.524,-0.525,-0.526,-0.526,-0.527, - &-0.527,-0.528,-0.528,-0.529,-0.529,-0.530,-0.530,-0.530,-0.531, - &-0.531,-0.531,-0.531,-0.532,-0.532,-0.532,-0.532,-0.532,-0.532, - &-0.533,-0.533,-0.533,-0.533,-0.533,-0.533,-0.533,-0.533,-0.533, - &-0.532,-0.532,-0.532,-0.532,-0.532,-0.532,-0.531,-0.531,-0.531, - &-0.530,-0.530,-0.530,-0.529,-0.529,-0.529,-0.528,-0.528,-0.527, - &-0.527,-0.526,-0.526,-0.525,-0.525,-0.524,-0.524,-0.523,-0.523, - &-0.522,-0.521,-0.521,-0.520,-0.519,-0.519,-0.518,-0.517,-0.517, - &-0.516,-0.515,-0.515,-0.514,-0.513,-0.512,-0.512,-0.511,-0.510, - &-0.509,-0.509,-0.508,-0.507,-0.506,-0.506,-0.505,-0.504,-0.503, - &-0.503,-0.502,-0.501,-0.500,-0.499,-0.499,-0.498,-0.497,-0.496, - &-0.495,-0.495,-0.494,-0.493,-0.492,-0.491,-0.491,-0.490,-0.489, - &-0.488,-0.487,-0.486,-0.486,-0.485,-0.484,-0.483,-0.482,-0.482, - &-0.481,-0.480,-0.479,-0.478,-0.477,-0.477,-0.476,-0.475,-0.474, - &-0.473,-0.472,-0.472,-0.471,-0.470,-0.469,-0.468,-0.468,-0.467, - &-0.466,-0.465,-0.464,-0.463,-0.463,-0.462,-0.461,-0.460,-0.459, - &-0.459,-0.458,-0.457,-0.456,-0.455,-0.455,-0.454,-0.453,-0.452, - &-0.451,-0.450,-0.450,-0.449,-0.448,-0.447,-0.446,-0.446,-0.445, - &-0.444,-0.443,-0.442,-0.442,-0.441,-0.440,-0.439,-0.438,-0.438, - &-0.437,-0.436,-0.435,-0.435,-0.434,-0.433,-0.432,-0.431,-0.431, - &-0.430,-0.429,-0.428,-0.427,-0.427,-0.426,-0.425,-0.424,-0.424, - &-0.423,-0.422,-0.421,-0.421,-0.420,-0.419,-0.418,-0.417,-0.417, - &-0.416,-0.415,-0.414,-0.414,-0.413,-0.412,-0.411,-0.411,-0.410, - &-0.409,-0.408,-0.408,-0.407,-0.406,-0.405,-0.405,-0.404,-0.403, - &-0.402,-0.402,-0.401,-0.400,-0.400,-0.399,-0.398,-0.397,-0.397, - &-0.396,-0.395,-0.394,-0.394,-0.393,-0.392,-0.392,-0.391,-0.390, - &-0.389,-0.389,-0.388,-0.387,-0.387,-0.386,-0.385,-0.385,-0.384, - &-0.383,-0.382,-0.382,-0.381,-0.380,-0.380,-0.379,-0.378,-0.378, - &-0.377,-0.376,-0.376,-0.375,-0.374,-0.374,-0.373,-0.372,-0.371, - &-0.371,-0.370,-0.369,-0.369,-0.368,-0.367,-0.367,-0.366,-0.365, - &-0.365,-0.364,-0.364,-0.363,-0.362,-0.362,-0.361,-0.360,-0.360, - &-0.359,-0.358,-0.358,-0.357,-0.356,-0.356,-0.355,-0.354,-0.354, - &-0.353,-0.353,-0.352,-0.351,-0.351,-0.350,-0.349,-0.349,-0.348, - &-0.348,-0.347,-0.346,-0.346,-0.345,-0.344,-0.344,-0.343,-0.343, - &-0.342,-0.341,-0.341,-0.340,-0.340,-0.339,-0.338,-0.338,-0.337, - &-0.337,-0.336,-0.335,-0.335,-0.334,-0.334,-0.333,-0.332,-0.332, - &-0.331,-0.331,-0.330,-0.330,-0.329,-0.328,-0.328,-0.327,-0.327, - &-0.326,-0.326,-0.325,-0.324,-0.324,-0.323,-0.323,-0.322,-0.322, - &-0.321,-0.320,-0.320,-0.319,-0.319,-0.318,-0.318,-0.317,-0.317, - &-0.316,-0.316,-0.315,-0.314,-0.309,-0.303,-0.298,-0.293,-0.288, - &-0.284,-0.279,-0.275,-0.270,-0.266,-0.262,-0.258,-0.254,-0.250, - &-0.246,-0.242,-0.239,-0.235,-0.232,-0.229,-0.226,-0.223,-0.219, - &-0.217,-0.214,-0.211,-0.208,-0.206,-0.203,-0.201,-0.198,-0.196, - &-0.194,-0.192,-0.190,-0.188,-0.186,-0.184,-0.182,-0.180,-0.179, - &-0.177,-0.175,-0.174,-0.173,-0.171,-0.170,-0.169,-0.167,-0.166, - &-0.165,-0.164,-0.163,-0.162,-0.161,-0.161,-0.160,-0.159,-0.158, - &-0.158,-0.157,-0.157,-0.156,-0.156,-0.155,-0.155,-0.155,-0.154, - &-0.154,-0.154,-0.154,-0.154,-0.153,-0.153,-0.153,-0.153,-0.153, - &-0.154,-0.154,-0.154,-0.154,-0.154,-0.155,-0.155,-0.155,-0.156, - &-0.156,-0.157,-0.157,-0.158,-0.158,-0.159,-0.159,-0.160,-0.161, - &-0.161,-0.162,-0.163,-0.164,-0.164,-0.165,-0.166,-0.167,-0.168, - &-0.169,-0.170,-0.171,-0.172,-0.173,-0.174,-0.175,-0.176,-0.177, - &-0.179,-0.180,-0.181,-0.182,-0.183,-0.185,-0.186,-0.187,-0.189, - &-0.190,-0.192,-0.193,-0.194,-0.196,-0.197,-0.199,-0.200,-0.202, - &-0.203,-0.205,-0.207,-0.208,-0.210,-0.212,-0.213,-0.215,-0.217, - &-0.218,-0.220,-0.222,-0.224,-0.225,-0.227,-0.229,-0.231,-0.233, - &-0.235,-0.237,-0.239,-0.240,-0.242,-0.244,-0.246,-0.248,-0.250, - &-0.252,-0.254,-0.256 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.095,-0.197,-0.242,-0.272,-0.293,-0.309,-0.321,-0.331,-0.339, - &-0.345,-0.351,-0.355,-0.358,-0.360,-0.362,-0.363,-0.363,-0.364, - &-0.364,-0.363,-0.362,-0.361,-0.360,-0.358,-0.357,-0.355,-0.353, - &-0.350,-0.348,-0.345,-0.343,-0.340,-0.337,-0.334,-0.331,-0.328, - &-0.325,-0.322,-0.319,-0.316,-0.312,-0.309,-0.306,-0.302,-0.299, - &-0.295,-0.292,-0.289,-0.285,-0.282,-0.278,-0.274,-0.271,-0.267, - &-0.264,-0.260,-0.257,-0.253,-0.249,-0.246,-0.242,-0.239,-0.235, - &-0.231,-0.228,-0.224,-0.220,-0.217,-0.213,-0.209,-0.205,-0.202, - &-0.198,-0.194,-0.190,-0.186,-0.182,-0.178,-0.175,-0.171,-0.167, - &-0.163,-0.158,-0.154,-0.150,-0.146,-0.142,-0.138,-0.134,-0.129, - &-0.125,-0.121,-0.116,-0.112,-0.107,-0.103,-0.099,-0.094,-0.090, - &-0.085,-0.080,-0.076,-0.071,-0.066,-0.062,-0.057,-0.052,-0.048, - &-0.043,-0.038,-0.033,-0.028,-0.024,-0.019,-0.014,-0.009,-0.004, - & 0.001, 0.006, 0.010, 0.015, 0.020, 0.025, 0.030, 0.035, 0.040, - & 0.045, 0.050, 0.055, 0.060, 0.064, 0.069, 0.074, 0.079, 0.084, - & 0.089, 0.094, 0.099, 0.104, 0.109, 0.114, 0.119, 0.123, 0.128, - & 0.133, 0.138, 0.143, 0.148, 0.153, 0.158, 0.162, 0.167, 0.172, - & 0.177, 0.182, 0.187, 0.191, 0.196, 0.201, 0.206, 0.211, 0.215, - & 0.220, 0.225, 0.230, 0.235, 0.239, 0.244, 0.249, 0.254, 0.258, - & 0.263, 0.268, 0.272, 0.277, 0.282, 0.287, 0.291, 0.296, 0.301, - & 0.305, 0.310, 0.315, 0.319, 0.324, 0.329, 0.333, 0.338, 0.342, - & 0.347, 0.352, 0.356, 0.361, 0.365, 0.370, 0.375, 0.379, 0.384, - & 0.388, 0.393, 0.397, 0.402, 0.406, 0.411, 0.415, 0.420, 0.424, - & 0.429, 0.433, 0.438, 0.442, 0.447, 0.451, 0.456, 0.460, 0.464, - & 0.469, 0.473, 0.478, 0.482, 0.487, 0.491, 0.495, 0.500, 0.504, - & 0.508, 0.513, 0.517, 0.521, 0.526, 0.530, 0.534, 0.539, 0.543, - & 0.547, 0.552, 0.556, 0.560, 0.564, 0.569, 0.573, 0.577, 0.581, - & 0.586, 0.590, 0.594, 0.598, 0.602, 0.607, 0.611, 0.615, 0.619, - & 0.623, 0.627, 0.632, 0.636, 0.640, 0.644, 0.648, 0.652, 0.656, - & 0.660, 0.664, 0.669, 0.673, 0.677, 0.681, 0.685, 0.689, 0.693, - & 0.697, 0.701, 0.705, 0.709, 0.713, 0.717, 0.721, 0.725, 0.729, - & 0.733, 0.737, 0.741, 0.745, 0.749, 0.753, 0.757, 0.761, 0.765, - & 0.768, 0.772, 0.776, 0.780, 0.784, 0.788, 0.792, 0.796, 0.799, - & 0.803, 0.807, 0.811, 0.815, 0.819, 0.823, 0.826, 0.830, 0.834, - & 0.838, 0.842, 0.845, 0.849, 0.853, 0.857, 0.860, 0.864, 0.868, - & 0.872, 0.875, 0.879, 0.883, 0.886, 0.890, 0.894, 0.898, 0.901, - & 0.905, 0.909, 0.912, 0.916, 0.920, 0.923, 0.927, 0.930, 0.934, - & 0.938, 0.941, 0.945, 0.949, 0.952, 0.956, 0.959, 0.963, 0.966, - & 0.970, 0.974, 0.977, 0.981, 0.984, 0.988, 0.991, 0.995, 0.998, - & 1.002, 1.005, 1.009, 1.012, 1.016, 1.019, 1.023, 1.026, 1.030, - & 1.033, 1.037, 1.040, 1.044, 1.047, 1.050, 1.054, 1.057, 1.061, - & 1.064, 1.067, 1.071, 1.074, 1.078, 1.081, 1.084, 1.088, 1.091, - & 1.094, 1.098, 1.101, 1.105, 1.108, 1.111, 1.115, 1.118, 1.121, - & 1.124, 1.128, 1.131, 1.134, 1.138, 1.141, 1.144, 1.147, 1.151, - & 1.154, 1.157, 1.160, 1.164, 1.198, 1.230, 1.261, 1.292, 1.322, - & 1.351, 1.380, 1.409, 1.437, 1.465, 1.492, 1.519, 1.546, 1.572, - & 1.598, 1.623, 1.648, 1.673, 1.697, 1.721, 1.745, 1.768, 1.791, - & 1.814, 1.836, 1.858, 1.880, 1.901, 1.922, 1.943, 1.964, 1.984, - & 2.004, 2.024, 2.044, 2.063, 2.082, 2.101, 2.119, 2.138, 2.156, - & 2.174, 2.191, 2.209, 2.226, 2.243, 2.260, 2.276, 2.293, 2.309, - & 2.325, 2.341, 2.357, 2.372, 2.387, 2.403, 2.418, 2.432, 2.447, - & 2.461, 2.476, 2.490, 2.504, 2.518, 2.531, 2.545, 2.558, 2.571, - & 2.585, 2.597, 2.610, 2.623, 2.635, 2.648, 2.660, 2.672, 2.684, - & 2.696, 2.708, 2.720, 2.731, 2.742, 2.754, 2.765, 2.776, 2.787, - & 2.798, 2.808, 2.819, 2.830, 2.840, 2.850, 2.860, 2.871, 2.881, - & 2.890, 2.900, 2.910, 2.920, 2.929, 2.938, 2.948, 2.957, 2.966, - & 2.975, 2.984, 2.993, 3.002, 3.011, 3.019, 3.028, 3.036, 3.045, - & 3.053, 3.061, 3.069, 3.077, 3.085, 3.093, 3.101, 3.109, 3.117, - & 3.124, 3.132, 3.139, 3.147, 3.154, 3.161, 3.168, 3.176, 3.183, - & 3.190, 3.197, 3.203, 3.210, 3.217, 3.224, 3.230, 3.237, 3.243, - & 3.250, 3.256, 3.263, 3.269, 3.275, 3.281, 3.287, 3.293, 3.299, - & 3.305, 3.311, 3.317, 3.323, 3.329, 3.334, 3.340, 3.345, 3.351, - & 3.356, 3.362, 3.367 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.098,-0.214,-0.273,-0.315,-0.347,-0.375,-0.399,-0.419,-0.438, - &-0.455,-0.470,-0.485,-0.498,-0.511,-0.522,-0.533,-0.544,-0.554, - &-0.563,-0.572,-0.581,-0.590,-0.598,-0.605,-0.613,-0.620,-0.627, - &-0.634,-0.641,-0.647,-0.653,-0.660,-0.666,-0.671,-0.677,-0.683, - &-0.688,-0.693,-0.698,-0.703,-0.708,-0.713,-0.718,-0.723,-0.727, - &-0.732,-0.736,-0.741,-0.745,-0.749,-0.753,-0.757,-0.762,-0.765, - &-0.769,-0.773,-0.777,-0.781,-0.784,-0.788,-0.792,-0.795,-0.799, - &-0.802,-0.806,-0.809,-0.812,-0.816,-0.819,-0.822,-0.825,-0.829, - &-0.832,-0.835,-0.838,-0.841,-0.844,-0.847,-0.850,-0.853,-0.856, - &-0.859,-0.862,-0.865,-0.867,-0.870,-0.873,-0.876,-0.879,-0.881, - &-0.884,-0.887,-0.890,-0.892,-0.895,-0.898,-0.900,-0.903,-0.905, - &-0.908,-0.911,-0.913,-0.916,-0.918,-0.921,-0.923,-0.926,-0.928, - &-0.931,-0.933,-0.936,-0.938,-0.940,-0.943,-0.945,-0.948,-0.950, - &-0.952,-0.955,-0.957,-0.959,-0.962,-0.964,-0.966,-0.969,-0.971, - &-0.973,-0.975,-0.978,-0.980,-0.982,-0.984,-0.986,-0.989,-0.991, - &-0.993,-0.995,-0.997,-0.999,-1.002,-1.004,-1.006,-1.008,-1.010, - &-1.012,-1.014,-1.016,-1.018,-1.020,-1.022,-1.024,-1.026,-1.028, - &-1.030,-1.032,-1.034,-1.036,-1.038,-1.040,-1.042,-1.044,-1.046, - &-1.048,-1.050,-1.052,-1.054,-1.056,-1.058,-1.060,-1.062,-1.064, - &-1.066,-1.067,-1.069,-1.071,-1.073,-1.075,-1.077,-1.079,-1.080, - &-1.082,-1.084,-1.086,-1.088,-1.090,-1.091,-1.093,-1.095,-1.097, - &-1.099,-1.100,-1.102,-1.104,-1.106,-1.107,-1.109,-1.111,-1.113, - &-1.114,-1.116,-1.118,-1.120,-1.121,-1.123,-1.125,-1.127,-1.128, - &-1.130,-1.132,-1.133,-1.135,-1.137,-1.138,-1.140,-1.142,-1.143, - &-1.145,-1.147,-1.148,-1.150,-1.152,-1.153,-1.155,-1.157,-1.158, - &-1.160,-1.162,-1.163,-1.165,-1.166,-1.168,-1.170,-1.171,-1.173, - &-1.174,-1.176,-1.178,-1.179,-1.181,-1.182,-1.184,-1.185,-1.187, - &-1.189,-1.190,-1.192,-1.193,-1.195,-1.196,-1.198,-1.199,-1.201, - &-1.203,-1.204,-1.206,-1.207,-1.209,-1.210,-1.212,-1.213,-1.215, - &-1.216,-1.218,-1.219,-1.221,-1.222,-1.224,-1.225,-1.227,-1.228, - &-1.230,-1.231,-1.233,-1.234,-1.236,-1.237,-1.238,-1.240,-1.241, - &-1.243,-1.244,-1.246,-1.247,-1.249,-1.250,-1.252,-1.253,-1.254, - &-1.256,-1.257,-1.259,-1.260,-1.262,-1.263,-1.264,-1.266,-1.267, - &-1.269,-1.270,-1.271,-1.273,-1.274,-1.276,-1.277,-1.278,-1.280, - &-1.281,-1.283,-1.284,-1.285,-1.287,-1.288,-1.290,-1.291,-1.292, - &-1.294,-1.295,-1.296,-1.298,-1.299,-1.301,-1.302,-1.303,-1.305, - &-1.306,-1.307,-1.309,-1.310,-1.311,-1.313,-1.314,-1.315,-1.317, - &-1.318,-1.319,-1.321,-1.322,-1.323,-1.325,-1.326,-1.327,-1.329, - &-1.330,-1.331,-1.333,-1.334,-1.335,-1.337,-1.338,-1.339,-1.341, - &-1.342,-1.343,-1.344,-1.346,-1.347,-1.348,-1.350,-1.351,-1.352, - &-1.354,-1.355,-1.356,-1.357,-1.359,-1.360,-1.361,-1.363,-1.364, - &-1.365,-1.366,-1.368,-1.369,-1.370,-1.371,-1.373,-1.374,-1.375, - &-1.376,-1.378,-1.379,-1.380,-1.381,-1.383,-1.384,-1.385,-1.387, - &-1.388,-1.389,-1.390,-1.391,-1.393,-1.394,-1.395,-1.396,-1.398, - &-1.399,-1.400,-1.401,-1.403,-1.416,-1.428,-1.440,-1.452,-1.463, - &-1.475,-1.487,-1.498,-1.509,-1.520,-1.532,-1.543,-1.554,-1.564, - &-1.575,-1.586,-1.596,-1.607,-1.617,-1.628,-1.638,-1.648,-1.659, - &-1.669,-1.679,-1.689,-1.699,-1.709,-1.719,-1.729,-1.738,-1.748, - &-1.758,-1.767,-1.777,-1.786,-1.796,-1.805,-1.815,-1.824,-1.833, - &-1.843,-1.852,-1.861,-1.870,-1.879,-1.888,-1.897,-1.906,-1.915, - &-1.924,-1.933,-1.942,-1.951,-1.960,-1.969,-1.977,-1.986,-1.995, - &-2.004,-2.012,-2.021,-2.029,-2.038,-2.047,-2.055,-2.064,-2.072, - &-2.081,-2.089,-2.097,-2.106,-2.114,-2.123,-2.131,-2.139,-2.147, - &-2.156,-2.164,-2.172,-2.180,-2.189,-2.197,-2.205,-2.213,-2.221, - &-2.229,-2.237,-2.245,-2.253,-2.261,-2.269,-2.277,-2.285,-2.293, - &-2.301,-2.309,-2.317,-2.325,-2.333,-2.341,-2.349,-2.356,-2.364, - &-2.372,-2.380,-2.388,-2.395,-2.403,-2.411,-2.419,-2.426,-2.434, - &-2.442,-2.449,-2.457,-2.465,-2.472,-2.480,-2.488,-2.495,-2.503, - &-2.510,-2.518,-2.525,-2.533,-2.541,-2.548,-2.556,-2.563,-2.571, - &-2.578,-2.586,-2.593,-2.600,-2.608,-2.615,-2.623,-2.630,-2.638, - &-2.645,-2.652,-2.660,-2.667,-2.674,-2.682,-2.689,-2.696,-2.704, - &-2.711,-2.718,-2.726,-2.733,-2.740,-2.747,-2.755,-2.762,-2.769, - &-2.776,-2.784,-2.791 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.048,-0.102,-0.127,-0.145,-0.158,-0.169,-0.178,-0.185,-0.192, - &-0.198,-0.203,-0.207,-0.211,-0.215,-0.218,-0.221,-0.224,-0.226, - &-0.228,-0.230,-0.231,-0.232,-0.234,-0.235,-0.235,-0.236,-0.237, - &-0.237,-0.237,-0.237,-0.237,-0.237,-0.237,-0.236,-0.236,-0.235, - &-0.234,-0.234,-0.233,-0.232,-0.231,-0.230,-0.228,-0.227,-0.226, - &-0.224,-0.223,-0.221,-0.220,-0.218,-0.216,-0.214,-0.212,-0.210, - &-0.208,-0.206,-0.204,-0.202,-0.200,-0.198,-0.196,-0.193,-0.191, - &-0.189,-0.186,-0.184,-0.181,-0.179,-0.176,-0.173,-0.171,-0.168, - &-0.165,-0.163,-0.160,-0.157,-0.154,-0.151,-0.148,-0.146,-0.143, - &-0.140,-0.137,-0.133,-0.130,-0.127,-0.124,-0.121,-0.118,-0.115, - &-0.111,-0.108,-0.105,-0.101,-0.098,-0.095,-0.091,-0.088,-0.084, - &-0.081,-0.077,-0.074,-0.070,-0.067,-0.063,-0.060,-0.056,-0.052, - &-0.049,-0.045,-0.042,-0.038,-0.034,-0.031,-0.027,-0.023,-0.020, - &-0.016,-0.012,-0.008,-0.005,-0.001, 0.003, 0.006, 0.010, 0.014, - & 0.018, 0.021, 0.025, 0.029, 0.032, 0.036, 0.040, 0.043, 0.047, - & 0.051, 0.054, 0.058, 0.062, 0.065, 0.069, 0.073, 0.076, 0.080, - & 0.084, 0.087, 0.091, 0.094, 0.098, 0.102, 0.105, 0.109, 0.112, - & 0.116, 0.119, 0.123, 0.127, 0.130, 0.134, 0.137, 0.141, 0.144, - & 0.148, 0.151, 0.155, 0.158, 0.162, 0.165, 0.168, 0.172, 0.175, - & 0.179, 0.182, 0.186, 0.189, 0.192, 0.196, 0.199, 0.202, 0.206, - & 0.209, 0.212, 0.216, 0.219, 0.222, 0.226, 0.229, 0.232, 0.236, - & 0.239, 0.242, 0.245, 0.249, 0.252, 0.255, 0.258, 0.262, 0.265, - & 0.268, 0.271, 0.274, 0.278, 0.281, 0.284, 0.287, 0.290, 0.293, - & 0.297, 0.300, 0.303, 0.306, 0.309, 0.312, 0.315, 0.318, 0.321, - & 0.324, 0.327, 0.330, 0.334, 0.337, 0.340, 0.343, 0.346, 0.349, - & 0.352, 0.355, 0.358, 0.361, 0.364, 0.367, 0.369, 0.372, 0.375, - & 0.378, 0.381, 0.384, 0.387, 0.390, 0.393, 0.396, 0.399, 0.402, - & 0.404, 0.407, 0.410, 0.413, 0.416, 0.419, 0.422, 0.424, 0.427, - & 0.430, 0.433, 0.436, 0.438, 0.441, 0.444, 0.447, 0.450, 0.452, - & 0.455, 0.458, 0.461, 0.463, 0.466, 0.469, 0.471, 0.474, 0.477, - & 0.480, 0.482, 0.485, 0.488, 0.490, 0.493, 0.496, 0.498, 0.501, - & 0.504, 0.506, 0.509, 0.512, 0.514, 0.517, 0.519, 0.522, 0.525, - & 0.527, 0.530, 0.532, 0.535, 0.538, 0.540, 0.543, 0.545, 0.548, - & 0.550, 0.553, 0.555, 0.558, 0.560, 0.563, 0.566, 0.568, 0.571, - & 0.573, 0.576, 0.578, 0.581, 0.583, 0.585, 0.588, 0.590, 0.593, - & 0.595, 0.598, 0.600, 0.603, 0.605, 0.607, 0.610, 0.612, 0.615, - & 0.617, 0.620, 0.622, 0.624, 0.627, 0.629, 0.632, 0.634, 0.636, - & 0.639, 0.641, 0.643, 0.646, 0.648, 0.650, 0.653, 0.655, 0.657, - & 0.660, 0.662, 0.664, 0.667, 0.669, 0.671, 0.674, 0.676, 0.678, - & 0.680, 0.683, 0.685, 0.687, 0.689, 0.692, 0.694, 0.696, 0.699, - & 0.701, 0.703, 0.705, 0.707, 0.710, 0.712, 0.714, 0.716, 0.719, - & 0.721, 0.723, 0.725, 0.727, 0.730, 0.732, 0.734, 0.736, 0.738, - & 0.740, 0.743, 0.745, 0.747, 0.749, 0.751, 0.753, 0.755, 0.758, - & 0.760, 0.762, 0.764, 0.766, 0.768, 0.770, 0.772, 0.775, 0.777, - & 0.779, 0.781, 0.783, 0.785, 0.807, 0.828, 0.848, 0.867, 0.886, - & 0.905, 0.924, 0.942, 0.960, 0.978, 0.995, 1.013, 1.029, 1.046, - & 1.062, 1.079, 1.095, 1.110, 1.126, 1.141, 1.156, 1.171, 1.185, - & 1.200, 1.214, 1.228, 1.242, 1.256, 1.269, 1.282, 1.295, 1.308, - & 1.321, 1.334, 1.346, 1.359, 1.371, 1.383, 1.395, 1.406, 1.418, - & 1.429, 1.441, 1.452, 1.463, 1.474, 1.485, 1.495, 1.506, 1.516, - & 1.527, 1.537, 1.547, 1.557, 1.567, 1.577, 1.586, 1.596, 1.605, - & 1.615, 1.624, 1.633, 1.642, 1.651, 1.660, 1.669, 1.678, 1.686, - & 1.695, 1.703, 1.711, 1.720, 1.728, 1.736, 1.744, 1.752, 1.760, - & 1.768, 1.775, 1.783, 1.791, 1.798, 1.806, 1.813, 1.820, 1.828, - & 1.835, 1.842, 1.849, 1.856, 1.863, 1.870, 1.876, 1.883, 1.890, - & 1.896, 1.903, 1.909, 1.916, 1.922, 1.928, 1.935, 1.941, 1.947, - & 1.953, 1.959, 1.965, 1.971, 1.977, 1.983, 1.989, 1.994, 2.000, - & 2.006, 2.011, 2.017, 2.022, 2.028, 2.033, 2.039, 2.044, 2.049, - & 2.054, 2.060, 2.065, 2.070, 2.075, 2.080, 2.085, 2.090, 2.095, - & 2.100, 2.104, 2.109, 2.114, 2.119, 2.123, 2.128, 2.132, 2.137, - & 2.142, 2.146, 2.150, 2.155, 2.159, 2.164, 2.168, 2.172, 2.176, - & 2.181, 2.185, 2.189, 2.193, 2.197, 2.201, 2.205, 2.209, 2.213, - & 2.217, 2.221, 2.225 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.051,-0.116,-0.152,-0.180,-0.203,-0.223,-0.241,-0.257,-0.272, - &-0.286,-0.300,-0.313,-0.325,-0.336,-0.348,-0.359,-0.369,-0.379, - &-0.389,-0.399,-0.408,-0.417,-0.426,-0.435,-0.444,-0.452,-0.460, - &-0.468,-0.476,-0.484,-0.492,-0.499,-0.507,-0.514,-0.521,-0.528, - &-0.535,-0.542,-0.548,-0.555,-0.562,-0.568,-0.574,-0.580,-0.587, - &-0.593,-0.599,-0.604,-0.610,-0.616,-0.622,-0.627,-0.633,-0.638, - &-0.644,-0.649,-0.654,-0.659,-0.664,-0.670,-0.675,-0.680,-0.684, - &-0.689,-0.694,-0.699,-0.704,-0.708,-0.713,-0.718,-0.722,-0.727, - &-0.731,-0.736,-0.740,-0.745,-0.749,-0.754,-0.758,-0.763,-0.767, - &-0.771,-0.776,-0.780,-0.784,-0.788,-0.793,-0.797,-0.801,-0.805, - &-0.810,-0.814,-0.818,-0.822,-0.826,-0.830,-0.834,-0.839,-0.843, - &-0.847,-0.851,-0.855,-0.859,-0.863,-0.867,-0.871,-0.875,-0.879, - &-0.883,-0.887,-0.891,-0.895,-0.899,-0.903,-0.907,-0.910,-0.914, - &-0.918,-0.922,-0.926,-0.930,-0.933,-0.937,-0.941,-0.945,-0.948, - &-0.952,-0.956,-0.959,-0.963,-0.967,-0.970,-0.974,-0.977,-0.981, - &-0.985,-0.988,-0.992,-0.995,-0.999,-1.002,-1.006,-1.009,-1.012, - &-1.016,-1.019,-1.023,-1.026,-1.029,-1.033,-1.036,-1.039,-1.042, - &-1.046,-1.049,-1.052,-1.055,-1.059,-1.062,-1.065,-1.068,-1.071, - &-1.074,-1.078,-1.081,-1.084,-1.087,-1.090,-1.093,-1.096,-1.099, - &-1.102,-1.105,-1.108,-1.111,-1.114,-1.117,-1.120,-1.123,-1.126, - &-1.129,-1.131,-1.134,-1.137,-1.140,-1.143,-1.146,-1.149,-1.151, - &-1.154,-1.157,-1.160,-1.162,-1.165,-1.168,-1.171,-1.173,-1.176, - &-1.179,-1.181,-1.184,-1.187,-1.189,-1.192,-1.195,-1.197,-1.200, - &-1.202,-1.205,-1.207,-1.210,-1.213,-1.215,-1.218,-1.220,-1.223, - &-1.225,-1.228,-1.230,-1.233,-1.235,-1.237,-1.240,-1.242,-1.245, - &-1.247,-1.250,-1.252,-1.254,-1.257,-1.259,-1.261,-1.264,-1.266, - &-1.268,-1.271,-1.273,-1.275,-1.278,-1.280,-1.282,-1.284,-1.287, - &-1.289,-1.291,-1.293,-1.296,-1.298,-1.300,-1.302,-1.304,-1.307, - &-1.309,-1.311,-1.313,-1.315,-1.317,-1.319,-1.322,-1.324,-1.326, - &-1.328,-1.330,-1.332,-1.334,-1.336,-1.338,-1.340,-1.342,-1.344, - &-1.346,-1.348,-1.350,-1.352,-1.354,-1.356,-1.358,-1.360,-1.362, - &-1.364,-1.366,-1.368,-1.370,-1.372,-1.374,-1.376,-1.378,-1.380, - &-1.382,-1.384,-1.385,-1.387,-1.389,-1.391,-1.393,-1.395,-1.397, - &-1.398,-1.400,-1.402,-1.404,-1.406,-1.408,-1.409,-1.411,-1.413, - &-1.415,-1.417,-1.418,-1.420,-1.422,-1.424,-1.425,-1.427,-1.429, - &-1.431,-1.432,-1.434,-1.436,-1.437,-1.439,-1.441,-1.443,-1.444, - &-1.446,-1.448,-1.449,-1.451,-1.453,-1.454,-1.456,-1.458,-1.459, - &-1.461,-1.462,-1.464,-1.466,-1.467,-1.469,-1.470,-1.472,-1.474, - &-1.475,-1.477,-1.478,-1.480,-1.482,-1.483,-1.485,-1.486,-1.488, - &-1.489,-1.491,-1.492,-1.494,-1.495,-1.497,-1.498,-1.500,-1.501, - &-1.503,-1.504,-1.506,-1.507,-1.509,-1.510,-1.512,-1.513,-1.515, - &-1.516,-1.518,-1.519,-1.521,-1.522,-1.523,-1.525,-1.526,-1.528, - &-1.529,-1.530,-1.532,-1.533,-1.535,-1.536,-1.537,-1.539,-1.540, - &-1.542,-1.543,-1.544,-1.546,-1.547,-1.548,-1.550,-1.551,-1.553, - &-1.554,-1.555,-1.557,-1.558,-1.572,-1.585,-1.597,-1.609,-1.621, - &-1.632,-1.643,-1.654,-1.665,-1.675,-1.685,-1.695,-1.705,-1.714, - &-1.723,-1.732,-1.741,-1.750,-1.758,-1.766,-1.774,-1.782,-1.790, - &-1.798,-1.805,-1.813,-1.820,-1.827,-1.834,-1.841,-1.848,-1.855, - &-1.861,-1.868,-1.874,-1.881,-1.887,-1.893,-1.899,-1.905,-1.911, - &-1.917,-1.923,-1.929,-1.934,-1.940,-1.945,-1.951,-1.956,-1.962, - &-1.967,-1.972,-1.977,-1.982,-1.988,-1.993,-1.998,-2.003,-2.008, - &-2.012,-2.017,-2.022,-2.027,-2.032,-2.036,-2.041,-2.046,-2.050, - &-2.055,-2.059,-2.064,-2.068,-2.073,-2.077,-2.082,-2.086,-2.090, - &-2.095,-2.099,-2.103,-2.108,-2.112,-2.116,-2.120,-2.124,-2.128, - &-2.133,-2.137,-2.141,-2.145,-2.149,-2.153,-2.157,-2.161,-2.165, - &-2.169,-2.173,-2.177,-2.181,-2.185,-2.189,-2.192,-2.196,-2.200, - &-2.204,-2.208,-2.212,-2.216,-2.219,-2.223,-2.227,-2.231,-2.234, - &-2.238,-2.242,-2.246,-2.249,-2.253,-2.257,-2.260,-2.264,-2.268, - &-2.271,-2.275,-2.279,-2.282,-2.286,-2.289,-2.293,-2.297,-2.300, - &-2.304,-2.307,-2.311,-2.315,-2.318,-2.322,-2.325,-2.329,-2.332, - &-2.336,-2.339,-2.343,-2.346,-2.350,-2.353,-2.357,-2.360,-2.364, - &-2.367,-2.370,-2.374,-2.377,-2.381,-2.384,-2.388,-2.391,-2.395, - &-2.398,-2.401,-2.405 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.048,-0.103,-0.129,-0.147,-0.160,-0.171,-0.180,-0.188,-0.195, - &-0.201,-0.206,-0.210,-0.215,-0.218,-0.222,-0.225,-0.228,-0.230, - &-0.233,-0.235,-0.237,-0.239,-0.241,-0.242,-0.244,-0.245,-0.247, - &-0.248,-0.249,-0.250,-0.251,-0.252,-0.253,-0.254,-0.255,-0.256, - &-0.256,-0.257,-0.258,-0.258,-0.259,-0.260,-0.260,-0.261,-0.261, - &-0.261,-0.262,-0.262,-0.263,-0.263,-0.263,-0.264,-0.264,-0.264, - &-0.265,-0.265,-0.265,-0.265,-0.266,-0.266,-0.266,-0.266,-0.266, - &-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267, - &-0.267,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268,-0.268, - &-0.268,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267,-0.267, - &-0.267,-0.267,-0.266,-0.266,-0.266,-0.266,-0.266,-0.265,-0.265, - &-0.265,-0.265,-0.265,-0.264,-0.264,-0.264,-0.264,-0.263,-0.263, - &-0.263,-0.262,-0.262,-0.262,-0.261,-0.261,-0.261,-0.260,-0.260, - &-0.260,-0.259,-0.259,-0.259,-0.258,-0.258,-0.258,-0.257,-0.257, - &-0.257,-0.256,-0.256,-0.256,-0.255,-0.255,-0.254,-0.254,-0.254, - &-0.253,-0.253,-0.253,-0.252,-0.252,-0.251,-0.251,-0.251,-0.250, - &-0.250,-0.249,-0.249,-0.249,-0.248,-0.248,-0.247,-0.247,-0.247, - &-0.246,-0.246,-0.246,-0.245,-0.245,-0.244,-0.244,-0.244,-0.243, - &-0.243,-0.242,-0.242,-0.242,-0.241,-0.241,-0.240,-0.240,-0.240, - &-0.239,-0.239,-0.238,-0.238,-0.238,-0.237,-0.237,-0.236,-0.236, - &-0.236,-0.235,-0.235,-0.234,-0.234,-0.234,-0.233,-0.233,-0.232, - &-0.232,-0.232,-0.231,-0.231,-0.230,-0.230,-0.230,-0.229,-0.229, - &-0.228,-0.228,-0.228,-0.227,-0.227,-0.227,-0.226,-0.226,-0.225, - &-0.225,-0.225,-0.224,-0.224,-0.223,-0.223,-0.223,-0.222,-0.222, - &-0.221,-0.221,-0.221,-0.220,-0.220,-0.220,-0.219,-0.219,-0.218, - &-0.218,-0.218,-0.217,-0.217,-0.217,-0.216,-0.216,-0.215,-0.215, - &-0.215,-0.214,-0.214,-0.214,-0.213,-0.213,-0.212,-0.212,-0.212, - &-0.211,-0.211,-0.211,-0.210,-0.210,-0.209,-0.209,-0.209,-0.208, - &-0.208,-0.208,-0.207,-0.207,-0.207,-0.206,-0.206,-0.205,-0.205, - &-0.205,-0.204,-0.204,-0.204,-0.203,-0.203,-0.203,-0.202,-0.202, - &-0.202,-0.201,-0.201,-0.201,-0.200,-0.200,-0.199,-0.199,-0.199, - &-0.198,-0.198,-0.198,-0.197,-0.197,-0.197,-0.196,-0.196,-0.196, - &-0.195,-0.195,-0.195,-0.194,-0.194,-0.194,-0.193,-0.193,-0.193, - &-0.192,-0.192,-0.192,-0.191,-0.191,-0.191,-0.190,-0.190,-0.190, - &-0.189,-0.189,-0.189,-0.188,-0.188,-0.188,-0.187,-0.187,-0.187, - &-0.186,-0.186,-0.186,-0.186,-0.185,-0.185,-0.185,-0.184,-0.184, - &-0.184,-0.183,-0.183,-0.183,-0.182,-0.182,-0.182,-0.181,-0.181, - &-0.181,-0.181,-0.180,-0.180,-0.180,-0.179,-0.179,-0.179,-0.178, - &-0.178,-0.178,-0.178,-0.177,-0.177,-0.177,-0.176,-0.176,-0.176, - &-0.175,-0.175,-0.175,-0.175,-0.174,-0.174,-0.174,-0.173,-0.173, - &-0.173,-0.173,-0.172,-0.172,-0.172,-0.171,-0.171,-0.171,-0.171, - &-0.170,-0.170,-0.170,-0.169,-0.169,-0.169,-0.169,-0.168,-0.168, - &-0.168,-0.167,-0.167,-0.167,-0.167,-0.166,-0.166,-0.166,-0.166, - &-0.165,-0.165,-0.165,-0.164,-0.164,-0.164,-0.164,-0.163,-0.163, - &-0.163,-0.163,-0.162,-0.162,-0.159,-0.157,-0.154,-0.152,-0.149, - &-0.147,-0.145,-0.143,-0.141,-0.139,-0.137,-0.135,-0.133,-0.131, - &-0.129,-0.127,-0.126,-0.124,-0.122,-0.121,-0.119,-0.118,-0.116, - &-0.115,-0.114,-0.112,-0.111,-0.110,-0.109,-0.107,-0.106,-0.105, - &-0.104,-0.103,-0.102,-0.101,-0.100,-0.099,-0.099,-0.098,-0.097, - &-0.096,-0.095,-0.095,-0.094,-0.093,-0.093,-0.092,-0.092,-0.091, - &-0.091,-0.090,-0.090,-0.089,-0.089,-0.089,-0.088,-0.088,-0.088, - &-0.087,-0.087,-0.087,-0.087,-0.087,-0.086,-0.086,-0.086,-0.086, - &-0.086,-0.086,-0.086,-0.086,-0.086,-0.086,-0.086,-0.086,-0.086, - &-0.086,-0.086,-0.086,-0.087,-0.087,-0.087,-0.087,-0.087,-0.088, - &-0.088,-0.088,-0.088,-0.089,-0.089,-0.089,-0.090,-0.090,-0.090, - &-0.091,-0.091,-0.092,-0.092,-0.092,-0.093,-0.093,-0.094,-0.094, - &-0.095,-0.095,-0.096,-0.096,-0.097,-0.098,-0.098,-0.099,-0.099, - &-0.100,-0.101,-0.101,-0.102,-0.103,-0.103,-0.104,-0.105,-0.105, - &-0.106,-0.107,-0.107,-0.108,-0.109,-0.110,-0.111,-0.111,-0.112, - &-0.113,-0.114,-0.115,-0.115,-0.116,-0.117,-0.118,-0.119,-0.120, - &-0.121,-0.122,-0.122,-0.123,-0.124,-0.125,-0.126,-0.127,-0.128, - &-0.129,-0.130,-0.131,-0.132,-0.133,-0.134,-0.135,-0.136,-0.137, - &-0.138,-0.139,-0.140 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.195,-0.422,-0.535,-0.614,-0.676,-0.727,-0.770,-0.808,-0.841, - &-0.871,-0.898,-0.923,-0.946,-0.968,-0.988,-1.006,-1.024,-1.041, - &-1.056,-1.071,-1.085,-1.099,-1.112,-1.124,-1.136,-1.148,-1.159, - &-1.169,-1.179,-1.189,-1.199,-1.208,-1.217,-1.226,-1.234,-1.243, - &-1.251,-1.258,-1.266,-1.273,-1.281,-1.288,-1.295,-1.302,-1.308, - &-1.315,-1.321,-1.327,-1.333,-1.339,-1.345,-1.351,-1.357,-1.362, - &-1.368,-1.373,-1.379,-1.384,-1.389,-1.394,-1.399,-1.404,-1.409, - &-1.413,-1.418,-1.423,-1.427,-1.432,-1.436,-1.441,-1.445,-1.449, - &-1.454,-1.458,-1.462,-1.466,-1.470,-1.474,-1.478,-1.482,-1.486, - &-1.489,-1.493,-1.497,-1.500,-1.504,-1.508,-1.511,-1.515,-1.518, - &-1.522,-1.525,-1.528,-1.532,-1.535,-1.538,-1.541,-1.545,-1.548, - &-1.551,-1.554,-1.557,-1.560,-1.563,-1.566,-1.569,-1.572,-1.575, - &-1.578,-1.581,-1.584,-1.586,-1.589,-1.592,-1.595,-1.598,-1.600, - &-1.603,-1.606,-1.608,-1.611,-1.614,-1.616,-1.619,-1.621,-1.624, - &-1.626,-1.629,-1.631,-1.634,-1.636,-1.639,-1.641,-1.644,-1.646, - &-1.649,-1.651,-1.653,-1.656,-1.658,-1.660,-1.663,-1.665,-1.667, - &-1.670,-1.672,-1.674,-1.676,-1.679,-1.681,-1.683,-1.685,-1.688, - &-1.690,-1.692,-1.694,-1.696,-1.698,-1.701,-1.703,-1.705,-1.707, - &-1.709,-1.711,-1.713,-1.715,-1.717,-1.720,-1.722,-1.724,-1.726, - &-1.728,-1.730,-1.732,-1.734,-1.736,-1.738,-1.740,-1.742,-1.744, - &-1.746,-1.748,-1.750,-1.752,-1.754,-1.756,-1.757,-1.759,-1.761, - &-1.763,-1.765,-1.767,-1.769,-1.771,-1.773,-1.775,-1.776,-1.778, - &-1.780,-1.782,-1.784,-1.786,-1.788,-1.789,-1.791,-1.793,-1.795, - &-1.797,-1.799,-1.800,-1.802,-1.804,-1.806,-1.808,-1.809,-1.811, - &-1.813,-1.815,-1.816,-1.818,-1.820,-1.822,-1.823,-1.825,-1.827, - &-1.829,-1.830,-1.832,-1.834,-1.836,-1.837,-1.839,-1.841,-1.842, - &-1.844,-1.846,-1.848,-1.849,-1.851,-1.853,-1.854,-1.856,-1.858, - &-1.859,-1.861,-1.863,-1.864,-1.866,-1.868,-1.869,-1.871,-1.873, - &-1.874,-1.876,-1.878,-1.879,-1.881,-1.882,-1.884,-1.886,-1.887, - &-1.889,-1.891,-1.892,-1.894,-1.895,-1.897,-1.899,-1.900,-1.902, - &-1.903,-1.905,-1.907,-1.908,-1.910,-1.911,-1.913,-1.915,-1.916, - &-1.918,-1.919,-1.921,-1.922,-1.924,-1.925,-1.927,-1.929,-1.930, - &-1.932,-1.933,-1.935,-1.936,-1.938,-1.939,-1.941,-1.943,-1.944, - &-1.946,-1.947,-1.949,-1.950,-1.952,-1.953,-1.955,-1.956,-1.958, - &-1.959,-1.961,-1.962,-1.964,-1.965,-1.967,-1.968,-1.970,-1.971, - &-1.973,-1.974,-1.976,-1.977,-1.979,-1.980,-1.982,-1.983,-1.985, - &-1.986,-1.988,-1.989,-1.991,-1.992,-1.994,-1.995,-1.997,-1.998, - &-2.000,-2.001,-2.003,-2.004,-2.006,-2.007,-2.008,-2.010,-2.011, - &-2.013,-2.014,-2.016,-2.017,-2.019,-2.020,-2.022,-2.023,-2.024, - &-2.026,-2.027,-2.029,-2.030,-2.032,-2.033,-2.035,-2.036,-2.037, - &-2.039,-2.040,-2.042,-2.043,-2.045,-2.046,-2.047,-2.049,-2.050, - &-2.052,-2.053,-2.055,-2.056,-2.057,-2.059,-2.060,-2.062,-2.063, - &-2.065,-2.066,-2.067,-2.069,-2.070,-2.072,-2.073,-2.074,-2.076, - &-2.077,-2.079,-2.080,-2.081,-2.083,-2.084,-2.086,-2.087,-2.088, - &-2.090,-2.091,-2.093,-2.094,-2.109,-2.123,-2.137,-2.150,-2.164, - &-2.177,-2.191,-2.204,-2.217,-2.231,-2.244,-2.257,-2.270,-2.283, - &-2.296,-2.309,-2.322,-2.335,-2.348,-2.361,-2.374,-2.386,-2.399, - &-2.412,-2.425,-2.437,-2.450,-2.463,-2.475,-2.488,-2.500,-2.513, - &-2.525,-2.538,-2.550,-2.563,-2.575,-2.588,-2.600,-2.612,-2.625, - &-2.637,-2.650,-2.662,-2.674,-2.686,-2.699,-2.711,-2.723,-2.736, - &-2.748,-2.760,-2.772,-2.784,-2.797,-2.809,-2.821,-2.833,-2.845, - &-2.857,-2.870,-2.882,-2.894,-2.906,-2.918,-2.930,-2.942,-2.954, - &-2.966,-2.978,-2.991,-3.003,-3.015,-3.027,-3.039,-3.051,-3.063, - &-3.075,-3.087,-3.099,-3.111,-3.123,-3.135,-3.147,-3.159,-3.171, - &-3.182,-3.194,-3.206,-3.218,-3.230,-3.242,-3.254,-3.266,-3.278, - &-3.290,-3.302,-3.314,-3.325,-3.337,-3.349,-3.361,-3.373,-3.385, - &-3.397,-3.409,-3.420,-3.432,-3.444,-3.456,-3.468,-3.480,-3.491, - &-3.503,-3.515,-3.527,-3.539,-3.551,-3.562,-3.574,-3.586,-3.598, - &-3.609,-3.621,-3.633,-3.645,-3.657,-3.668,-3.680,-3.692,-3.704, - &-3.715,-3.727,-3.739,-3.751,-3.762,-3.774,-3.786,-3.798,-3.809, - &-3.821,-3.833,-3.844,-3.856,-3.868,-3.880,-3.891,-3.903,-3.915, - &-3.926,-3.938,-3.950,-3.961,-3.973,-3.985,-3.997,-4.008,-4.020, - &-4.032,-4.043,-4.055 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.095,-0.197,-0.243,-0.273,-0.294,-0.311,-0.323,-0.333,-0.342, - &-0.348,-0.353,-0.358,-0.361,-0.364,-0.366,-0.367,-0.368,-0.368, - &-0.368,-0.368,-0.368,-0.367,-0.366,-0.364,-0.363,-0.361,-0.359, - &-0.357,-0.355,-0.353,-0.351,-0.348,-0.346,-0.343,-0.340,-0.337, - &-0.335,-0.332,-0.329,-0.326,-0.323,-0.320,-0.316,-0.313,-0.310, - &-0.307,-0.304,-0.300,-0.297,-0.294,-0.290,-0.287,-0.284,-0.280, - &-0.277,-0.274,-0.270,-0.267,-0.264,-0.260,-0.257,-0.253,-0.250, - &-0.247,-0.243,-0.240,-0.236,-0.233,-0.229,-0.226,-0.222,-0.219, - &-0.215,-0.211,-0.208,-0.204,-0.200,-0.197,-0.193,-0.189,-0.186, - &-0.182,-0.178,-0.174,-0.170,-0.166,-0.162,-0.158,-0.154,-0.150, - &-0.146,-0.142,-0.138,-0.134,-0.130,-0.125,-0.121,-0.117,-0.113, - &-0.108,-0.104,-0.100,-0.095,-0.091,-0.086,-0.082,-0.077,-0.073, - &-0.068,-0.064,-0.059,-0.055,-0.050,-0.045,-0.041,-0.036,-0.032, - &-0.027,-0.022,-0.018,-0.013,-0.008,-0.004, 0.001, 0.006, 0.010, - & 0.015, 0.020, 0.024, 0.029, 0.034, 0.039, 0.043, 0.048, 0.053, - & 0.057, 0.062, 0.067, 0.071, 0.076, 0.081, 0.085, 0.090, 0.095, - & 0.099, 0.104, 0.109, 0.113, 0.118, 0.122, 0.127, 0.132, 0.136, - & 0.141, 0.145, 0.150, 0.155, 0.159, 0.164, 0.168, 0.173, 0.178, - & 0.182, 0.187, 0.191, 0.196, 0.200, 0.205, 0.209, 0.214, 0.218, - & 0.223, 0.227, 0.232, 0.236, 0.241, 0.245, 0.250, 0.254, 0.259, - & 0.263, 0.268, 0.272, 0.276, 0.281, 0.285, 0.290, 0.294, 0.299, - & 0.303, 0.307, 0.312, 0.316, 0.320, 0.325, 0.329, 0.333, 0.338, - & 0.342, 0.346, 0.351, 0.355, 0.359, 0.364, 0.368, 0.372, 0.377, - & 0.381, 0.385, 0.389, 0.394, 0.398, 0.402, 0.406, 0.411, 0.415, - & 0.419, 0.423, 0.427, 0.432, 0.436, 0.440, 0.444, 0.448, 0.452, - & 0.457, 0.461, 0.465, 0.469, 0.473, 0.477, 0.481, 0.485, 0.490, - & 0.494, 0.498, 0.502, 0.506, 0.510, 0.514, 0.518, 0.522, 0.526, - & 0.530, 0.534, 0.538, 0.542, 0.546, 0.550, 0.554, 0.558, 0.562, - & 0.566, 0.570, 0.574, 0.578, 0.582, 0.586, 0.590, 0.594, 0.598, - & 0.602, 0.605, 0.609, 0.613, 0.617, 0.621, 0.625, 0.629, 0.633, - & 0.636, 0.640, 0.644, 0.648, 0.652, 0.656, 0.659, 0.663, 0.667, - & 0.671, 0.674, 0.678, 0.682, 0.686, 0.690, 0.693, 0.697, 0.701, - & 0.704, 0.708, 0.712, 0.716, 0.719, 0.723, 0.727, 0.730, 0.734, - & 0.738, 0.741, 0.745, 0.749, 0.752, 0.756, 0.760, 0.763, 0.767, - & 0.771, 0.774, 0.778, 0.781, 0.785, 0.789, 0.792, 0.796, 0.799, - & 0.803, 0.806, 0.810, 0.813, 0.817, 0.821, 0.824, 0.828, 0.831, - & 0.835, 0.838, 0.842, 0.845, 0.849, 0.852, 0.856, 0.859, 0.862, - & 0.866, 0.869, 0.873, 0.876, 0.880, 0.883, 0.886, 0.890, 0.893, - & 0.897, 0.900, 0.903, 0.907, 0.910, 0.914, 0.917, 0.920, 0.924, - & 0.927, 0.930, 0.934, 0.937, 0.940, 0.944, 0.947, 0.950, 0.954, - & 0.957, 0.960, 0.963, 0.967, 0.970, 0.973, 0.977, 0.980, 0.983, - & 0.986, 0.990, 0.993, 0.996, 0.999, 1.003, 1.006, 1.009, 1.012, - & 1.015, 1.019, 1.022, 1.025, 1.028, 1.031, 1.034, 1.038, 1.041, - & 1.044, 1.047, 1.050, 1.053, 1.056, 1.060, 1.063, 1.066, 1.069, - & 1.072, 1.075, 1.078, 1.081, 1.114, 1.144, 1.174, 1.203, 1.232, - & 1.260, 1.288, 1.315, 1.342, 1.369, 1.395, 1.420, 1.446, 1.471, - & 1.495, 1.519, 1.543, 1.567, 1.590, 1.613, 1.635, 1.657, 1.679, - & 1.701, 1.722, 1.743, 1.764, 1.784, 1.804, 1.824, 1.844, 1.863, - & 1.882, 1.901, 1.920, 1.938, 1.956, 1.974, 1.992, 2.009, 2.026, - & 2.043, 2.060, 2.077, 2.093, 2.109, 2.125, 2.141, 2.157, 2.172, - & 2.187, 2.202, 2.217, 2.232, 2.246, 2.261, 2.275, 2.289, 2.303, - & 2.317, 2.330, 2.344, 2.357, 2.370, 2.383, 2.396, 2.408, 2.421, - & 2.433, 2.445, 2.458, 2.470, 2.481, 2.493, 2.505, 2.516, 2.528, - & 2.539, 2.550, 2.561, 2.572, 2.583, 2.593, 2.604, 2.614, 2.625, - & 2.635, 2.645, 2.655, 2.665, 2.675, 2.684, 2.694, 2.704, 2.713, - & 2.722, 2.732, 2.741, 2.750, 2.759, 2.768, 2.776, 2.785, 2.794, - & 2.802, 2.811, 2.819, 2.827, 2.835, 2.843, 2.851, 2.859, 2.867, - & 2.875, 2.883, 2.890, 2.898, 2.906, 2.913, 2.920, 2.928, 2.935, - & 2.942, 2.949, 2.956, 2.963, 2.970, 2.977, 2.983, 2.990, 2.997, - & 3.003, 3.010, 3.016, 3.022, 3.029, 3.035, 3.041, 3.047, 3.053, - & 3.059, 3.065, 3.071, 3.077, 3.083, 3.089, 3.094, 3.100, 3.105, - & 3.111, 3.116, 3.122, 3.127, 3.133, 3.138, 3.143, 3.148, 3.153, - & 3.158, 3.163, 3.168 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.094,-0.194,-0.238,-0.266,-0.285,-0.299,-0.310,-0.319,-0.325, - &-0.330,-0.333,-0.336,-0.337,-0.338,-0.338,-0.338,-0.337,-0.336, - &-0.334,-0.332,-0.330,-0.328,-0.325,-0.322,-0.319,-0.315,-0.312, - &-0.308,-0.304,-0.300,-0.296,-0.292,-0.288,-0.283,-0.279,-0.274, - &-0.270,-0.265,-0.261,-0.256,-0.251,-0.247,-0.242,-0.237,-0.232, - &-0.227,-0.222,-0.218,-0.213,-0.208,-0.203,-0.198,-0.193,-0.188, - &-0.183,-0.178,-0.173,-0.168,-0.163,-0.158,-0.153,-0.148,-0.143, - &-0.138,-0.133,-0.128,-0.123,-0.118,-0.113,-0.108,-0.103,-0.097, - &-0.092,-0.087,-0.082,-0.077,-0.071,-0.066,-0.061,-0.055,-0.050, - &-0.045,-0.039,-0.034,-0.028,-0.023,-0.017,-0.011,-0.006, 0.000, - & 0.006, 0.011, 0.017, 0.023, 0.029, 0.035, 0.041, 0.047, 0.053, - & 0.059, 0.065, 0.071, 0.077, 0.083, 0.089, 0.096, 0.102, 0.108, - & 0.114, 0.121, 0.127, 0.133, 0.140, 0.146, 0.152, 0.159, 0.165, - & 0.171, 0.178, 0.184, 0.191, 0.197, 0.203, 0.210, 0.216, 0.223, - & 0.229, 0.236, 0.242, 0.249, 0.255, 0.261, 0.268, 0.274, 0.281, - & 0.287, 0.293, 0.300, 0.306, 0.313, 0.319, 0.325, 0.332, 0.338, - & 0.345, 0.351, 0.357, 0.364, 0.370, 0.376, 0.383, 0.389, 0.395, - & 0.402, 0.408, 0.414, 0.421, 0.427, 0.433, 0.439, 0.446, 0.452, - & 0.458, 0.464, 0.471, 0.477, 0.483, 0.489, 0.495, 0.502, 0.508, - & 0.514, 0.520, 0.526, 0.532, 0.538, 0.545, 0.551, 0.557, 0.563, - & 0.569, 0.575, 0.581, 0.587, 0.593, 0.599, 0.605, 0.611, 0.617, - & 0.623, 0.629, 0.635, 0.641, 0.647, 0.653, 0.659, 0.665, 0.671, - & 0.677, 0.683, 0.689, 0.694, 0.700, 0.706, 0.712, 0.718, 0.724, - & 0.730, 0.735, 0.741, 0.747, 0.753, 0.759, 0.764, 0.770, 0.776, - & 0.782, 0.787, 0.793, 0.799, 0.804, 0.810, 0.816, 0.822, 0.827, - & 0.833, 0.838, 0.844, 0.850, 0.855, 0.861, 0.867, 0.872, 0.878, - & 0.883, 0.889, 0.894, 0.900, 0.905, 0.911, 0.916, 0.922, 0.927, - & 0.933, 0.938, 0.944, 0.949, 0.955, 0.960, 0.966, 0.971, 0.976, - & 0.982, 0.987, 0.993, 0.998, 1.003, 1.009, 1.014, 1.019, 1.025, - & 1.030, 1.035, 1.041, 1.046, 1.051, 1.056, 1.062, 1.067, 1.072, - & 1.077, 1.083, 1.088, 1.093, 1.098, 1.103, 1.109, 1.114, 1.119, - & 1.124, 1.129, 1.134, 1.139, 1.144, 1.150, 1.155, 1.160, 1.165, - & 1.170, 1.175, 1.180, 1.185, 1.190, 1.195, 1.200, 1.205, 1.210, - & 1.215, 1.220, 1.225, 1.230, 1.235, 1.240, 1.245, 1.250, 1.255, - & 1.260, 1.264, 1.269, 1.274, 1.279, 1.284, 1.289, 1.294, 1.299, - & 1.303, 1.308, 1.313, 1.318, 1.323, 1.327, 1.332, 1.337, 1.342, - & 1.346, 1.351, 1.356, 1.361, 1.365, 1.370, 1.375, 1.380, 1.384, - & 1.389, 1.394, 1.398, 1.403, 1.408, 1.412, 1.417, 1.421, 1.426, - & 1.431, 1.435, 1.440, 1.444, 1.449, 1.454, 1.458, 1.463, 1.467, - & 1.472, 1.476, 1.481, 1.485, 1.490, 1.494, 1.499, 1.503, 1.508, - & 1.512, 1.517, 1.521, 1.526, 1.530, 1.535, 1.539, 1.543, 1.548, - & 1.552, 1.557, 1.561, 1.565, 1.570, 1.574, 1.578, 1.583, 1.587, - & 1.591, 1.596, 1.600, 1.604, 1.609, 1.613, 1.617, 1.622, 1.626, - & 1.630, 1.634, 1.639, 1.643, 1.647, 1.651, 1.656, 1.660, 1.664, - & 1.668, 1.672, 1.677, 1.681, 1.726, 1.766, 1.807, 1.846, 1.885, - & 1.923, 1.961, 1.998, 2.034, 2.070, 2.105, 2.140, 2.175, 2.208, - & 2.242, 2.275, 2.307, 2.339, 2.370, 2.401, 2.432, 2.462, 2.492, - & 2.521, 2.550, 2.579, 2.607, 2.635, 2.662, 2.690, 2.716, 2.743, - & 2.769, 2.795, 2.820, 2.845, 2.870, 2.895, 2.919, 2.943, 2.966, - & 2.990, 3.013, 3.036, 3.058, 3.081, 3.103, 3.124, 3.146, 3.167, - & 3.188, 3.209, 3.230, 3.250, 3.270, 3.290, 3.310, 3.329, 3.349, - & 3.368, 3.387, 3.405, 3.424, 3.442, 3.460, 3.478, 3.496, 3.513, - & 3.531, 3.548, 3.565, 3.582, 3.599, 3.615, 3.631, 3.648, 3.664, - & 3.680, 3.695, 3.711, 3.726, 3.742, 3.757, 3.772, 3.787, 3.801, - & 3.816, 3.830, 3.845, 3.859, 3.873, 3.887, 3.901, 3.914, 3.928, - & 3.941, 3.955, 3.968, 3.981, 3.994, 4.007, 4.019, 4.032, 4.044, - & 4.057, 4.069, 4.081, 4.093, 4.105, 4.117, 4.129, 4.141, 4.152, - & 4.164, 4.175, 4.186, 4.197, 4.209, 4.220, 4.230, 4.241, 4.252, - & 4.263, 4.273, 4.284, 4.294, 4.304, 4.314, 4.324, 4.335, 4.344, - & 4.354, 4.364, 4.374, 4.383, 4.393, 4.402, 4.412, 4.421, 4.430, - & 4.440, 4.449, 4.458, 4.467, 4.476, 4.484, 4.493, 4.502, 4.510, - & 4.519, 4.527, 4.536, 4.544, 4.553, 4.561, 4.569, 4.577, 4.585, - & 4.593, 4.601, 4.609 - & / - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM273 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 273K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM273 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC273/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF273 -C -C *** Common block definition -C - COMMON /KMC273/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.046,-0.097,-0.119,-0.134,-0.145,-0.153,-0.160,-0.165,-0.169, - &-0.173,-0.176,-0.178,-0.180,-0.181,-0.182,-0.183,-0.184,-0.184, - &-0.185,-0.185,-0.185,-0.185,-0.184,-0.184,-0.183,-0.183,-0.182, - &-0.181,-0.181,-0.180,-0.179,-0.178,-0.177,-0.176,-0.174,-0.173, - &-0.172,-0.171,-0.170,-0.168,-0.167,-0.166,-0.164,-0.163,-0.162, - &-0.160,-0.159,-0.157,-0.156,-0.155,-0.153,-0.152,-0.150,-0.149, - &-0.147,-0.146,-0.144,-0.143,-0.141,-0.140,-0.138,-0.137,-0.135, - &-0.134,-0.132,-0.131,-0.129,-0.128,-0.126,-0.124,-0.123,-0.121, - &-0.120,-0.118,-0.116,-0.115,-0.113,-0.112,-0.110,-0.108,-0.107, - &-0.105,-0.103,-0.101,-0.100,-0.098,-0.096,-0.094,-0.093,-0.091, - &-0.089,-0.087,-0.085,-0.083,-0.081,-0.080,-0.078,-0.076,-0.074, - &-0.072,-0.070,-0.068,-0.066,-0.064,-0.062,-0.060,-0.058,-0.056, - &-0.054,-0.052,-0.050,-0.048,-0.046,-0.044,-0.042,-0.039,-0.037, - &-0.035,-0.033,-0.031,-0.029,-0.027,-0.025,-0.023,-0.021,-0.018, - &-0.016,-0.014,-0.012,-0.010,-0.008,-0.006,-0.004,-0.002, 0.001, - & 0.003, 0.005, 0.007, 0.009, 0.011, 0.013, 0.015, 0.017, 0.019, - & 0.022, 0.024, 0.026, 0.028, 0.030, 0.032, 0.034, 0.036, 0.038, - & 0.040, 0.042, 0.045, 0.047, 0.049, 0.051, 0.053, 0.055, 0.057, - & 0.059, 0.061, 0.063, 0.065, 0.067, 0.069, 0.071, 0.073, 0.075, - & 0.078, 0.080, 0.082, 0.084, 0.086, 0.088, 0.090, 0.092, 0.094, - & 0.096, 0.098, 0.100, 0.102, 0.104, 0.106, 0.108, 0.110, 0.112, - & 0.114, 0.116, 0.118, 0.120, 0.122, 0.124, 0.126, 0.128, 0.130, - & 0.132, 0.134, 0.136, 0.138, 0.140, 0.142, 0.143, 0.145, 0.147, - & 0.149, 0.151, 0.153, 0.155, 0.157, 0.159, 0.161, 0.163, 0.165, - & 0.167, 0.169, 0.171, 0.172, 0.174, 0.176, 0.178, 0.180, 0.182, - & 0.184, 0.186, 0.188, 0.190, 0.191, 0.193, 0.195, 0.197, 0.199, - & 0.201, 0.203, 0.205, 0.206, 0.208, 0.210, 0.212, 0.214, 0.216, - & 0.218, 0.219, 0.221, 0.223, 0.225, 0.227, 0.229, 0.230, 0.232, - & 0.234, 0.236, 0.238, 0.239, 0.241, 0.243, 0.245, 0.247, 0.248, - & 0.250, 0.252, 0.254, 0.256, 0.257, 0.259, 0.261, 0.263, 0.265, - & 0.266, 0.268, 0.270, 0.272, 0.273, 0.275, 0.277, 0.279, 0.280, - & 0.282, 0.284, 0.286, 0.287, 0.289, 0.291, 0.292, 0.294, 0.296, - & 0.298, 0.299, 0.301, 0.303, 0.305, 0.306, 0.308, 0.310, 0.311, - & 0.313, 0.315, 0.316, 0.318, 0.320, 0.321, 0.323, 0.325, 0.326, - & 0.328, 0.330, 0.331, 0.333, 0.335, 0.336, 0.338, 0.340, 0.341, - & 0.343, 0.345, 0.346, 0.348, 0.350, 0.351, 0.353, 0.355, 0.356, - & 0.358, 0.359, 0.361, 0.363, 0.364, 0.366, 0.367, 0.369, 0.371, - & 0.372, 0.374, 0.375, 0.377, 0.379, 0.380, 0.382, 0.383, 0.385, - & 0.387, 0.388, 0.390, 0.391, 0.393, 0.394, 0.396, 0.398, 0.399, - & 0.401, 0.402, 0.404, 0.405, 0.407, 0.408, 0.410, 0.412, 0.413, - & 0.415, 0.416, 0.418, 0.419, 0.421, 0.422, 0.424, 0.425, 0.427, - & 0.428, 0.430, 0.431, 0.433, 0.434, 0.436, 0.437, 0.439, 0.440, - & 0.442, 0.443, 0.445, 0.446, 0.448, 0.449, 0.451, 0.452, 0.454, - & 0.455, 0.457, 0.458, 0.460, 0.461, 0.463, 0.464, 0.465, 0.467, - & 0.468, 0.470, 0.471, 0.473, 0.488, 0.502, 0.516, 0.530, 0.544, - & 0.557, 0.570, 0.583, 0.596, 0.608, 0.621, 0.633, 0.645, 0.657, - & 0.669, 0.680, 0.692, 0.703, 0.714, 0.725, 0.736, 0.747, 0.758, - & 0.768, 0.778, 0.789, 0.799, 0.809, 0.819, 0.828, 0.838, 0.847, - & 0.857, 0.866, 0.875, 0.884, 0.893, 0.902, 0.911, 0.920, 0.928, - & 0.937, 0.945, 0.954, 0.962, 0.970, 0.978, 0.986, 0.994, 1.002, - & 1.010, 1.017, 1.025, 1.032, 1.040, 1.047, 1.054, 1.062, 1.069, - & 1.076, 1.083, 1.090, 1.097, 1.103, 1.110, 1.117, 1.124, 1.130, - & 1.137, 1.143, 1.149, 1.156, 1.162, 1.168, 1.174, 1.181, 1.187, - & 1.193, 1.199, 1.205, 1.210, 1.216, 1.222, 1.228, 1.233, 1.239, - & 1.245, 1.250, 1.255, 1.261, 1.266, 1.272, 1.277, 1.282, 1.287, - & 1.293, 1.298, 1.303, 1.308, 1.313, 1.318, 1.323, 1.328, 1.333, - & 1.337, 1.342, 1.347, 1.352, 1.356, 1.361, 1.366, 1.370, 1.375, - & 1.379, 1.384, 1.388, 1.392, 1.397, 1.401, 1.406, 1.410, 1.414, - & 1.418, 1.422, 1.427, 1.431, 1.435, 1.439, 1.443, 1.447, 1.451, - & 1.455, 1.459, 1.463, 1.467, 1.470, 1.474, 1.478, 1.482, 1.486, - & 1.489, 1.493, 1.497, 1.500, 1.504, 1.508, 1.511, 1.515, 1.518, - & 1.522, 1.525, 1.529, 1.532, 1.536, 1.539, 1.542, 1.546, 1.549, - & 1.552, 1.556, 1.559 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.096,-0.208,-0.264,-0.304,-0.335,-0.361,-0.383,-0.403,-0.420, - &-0.436,-0.450,-0.464,-0.476,-0.487,-0.498,-0.508,-0.517,-0.526, - &-0.535,-0.543,-0.551,-0.558,-0.566,-0.572,-0.579,-0.586,-0.592, - &-0.598,-0.603,-0.609,-0.614,-0.620,-0.625,-0.630,-0.635,-0.639, - &-0.644,-0.649,-0.653,-0.657,-0.661,-0.666,-0.670,-0.674,-0.677, - &-0.681,-0.685,-0.689,-0.692,-0.696,-0.699,-0.702,-0.706,-0.709, - &-0.712,-0.715,-0.718,-0.721,-0.725,-0.727,-0.730,-0.733,-0.736, - &-0.739,-0.742,-0.744,-0.747,-0.750,-0.752,-0.755,-0.757,-0.760, - &-0.763,-0.765,-0.767,-0.770,-0.772,-0.775,-0.777,-0.779,-0.782, - &-0.784,-0.786,-0.788,-0.791,-0.793,-0.795,-0.797,-0.799,-0.801, - &-0.803,-0.806,-0.808,-0.810,-0.812,-0.814,-0.816,-0.818,-0.820, - &-0.822,-0.824,-0.826,-0.827,-0.829,-0.831,-0.833,-0.835,-0.837, - &-0.839,-0.841,-0.842,-0.844,-0.846,-0.848,-0.850,-0.851,-0.853, - &-0.855,-0.857,-0.858,-0.860,-0.862,-0.863,-0.865,-0.867,-0.868, - &-0.870,-0.872,-0.873,-0.875,-0.877,-0.878,-0.880,-0.881,-0.883, - &-0.885,-0.886,-0.888,-0.889,-0.891,-0.892,-0.894,-0.895,-0.897, - &-0.898,-0.900,-0.901,-0.903,-0.904,-0.906,-0.907,-0.909,-0.910, - &-0.912,-0.913,-0.915,-0.916,-0.917,-0.919,-0.920,-0.922,-0.923, - &-0.924,-0.926,-0.927,-0.928,-0.930,-0.931,-0.933,-0.934,-0.935, - &-0.937,-0.938,-0.939,-0.941,-0.942,-0.943,-0.944,-0.946,-0.947, - &-0.948,-0.950,-0.951,-0.952,-0.953,-0.955,-0.956,-0.957,-0.958, - &-0.960,-0.961,-0.962,-0.963,-0.965,-0.966,-0.967,-0.968,-0.969, - &-0.971,-0.972,-0.973,-0.974,-0.975,-0.977,-0.978,-0.979,-0.980, - &-0.981,-0.982,-0.984,-0.985,-0.986,-0.987,-0.988,-0.989,-0.990, - &-0.992,-0.993,-0.994,-0.995,-0.996,-0.997,-0.998,-0.999,-1.001, - &-1.002,-1.003,-1.004,-1.005,-1.006,-1.007,-1.008,-1.009,-1.010, - &-1.011,-1.012,-1.014,-1.015,-1.016,-1.017,-1.018,-1.019,-1.020, - &-1.021,-1.022,-1.023,-1.024,-1.025,-1.026,-1.027,-1.028,-1.029, - &-1.030,-1.031,-1.032,-1.033,-1.034,-1.035,-1.036,-1.037,-1.038, - &-1.039,-1.040,-1.041,-1.042,-1.043,-1.044,-1.045,-1.046,-1.047, - &-1.048,-1.049,-1.050,-1.051,-1.052,-1.053,-1.054,-1.055,-1.056, - &-1.057,-1.058,-1.059,-1.060,-1.061,-1.062,-1.063,-1.064,-1.065, - &-1.066,-1.066,-1.067,-1.068,-1.069,-1.070,-1.071,-1.072,-1.073, - &-1.074,-1.075,-1.076,-1.077,-1.078,-1.079,-1.079,-1.080,-1.081, - &-1.082,-1.083,-1.084,-1.085,-1.086,-1.087,-1.088,-1.088,-1.089, - &-1.090,-1.091,-1.092,-1.093,-1.094,-1.095,-1.096,-1.096,-1.097, - &-1.098,-1.099,-1.100,-1.101,-1.102,-1.102,-1.103,-1.104,-1.105, - &-1.106,-1.107,-1.108,-1.109,-1.109,-1.110,-1.111,-1.112,-1.113, - &-1.114,-1.114,-1.115,-1.116,-1.117,-1.118,-1.119,-1.120,-1.120, - &-1.121,-1.122,-1.123,-1.124,-1.124,-1.125,-1.126,-1.127,-1.128, - &-1.129,-1.129,-1.130,-1.131,-1.132,-1.133,-1.134,-1.134,-1.135, - &-1.136,-1.137,-1.138,-1.138,-1.139,-1.140,-1.141,-1.142,-1.142, - &-1.143,-1.144,-1.145,-1.146,-1.146,-1.147,-1.148,-1.149,-1.150, - &-1.150,-1.151,-1.152,-1.153,-1.153,-1.154,-1.155,-1.156,-1.157, - &-1.157,-1.158,-1.159,-1.160,-1.168,-1.175,-1.183,-1.190,-1.198, - &-1.205,-1.212,-1.219,-1.226,-1.233,-1.239,-1.246,-1.253,-1.259, - &-1.266,-1.272,-1.279,-1.285,-1.291,-1.298,-1.304,-1.310,-1.316, - &-1.322,-1.328,-1.334,-1.340,-1.346,-1.352,-1.357,-1.363,-1.369, - &-1.374,-1.380,-1.386,-1.391,-1.397,-1.402,-1.408,-1.413,-1.419, - &-1.424,-1.429,-1.435,-1.440,-1.445,-1.450,-1.456,-1.461,-1.466, - &-1.471,-1.476,-1.481,-1.486,-1.491,-1.496,-1.501,-1.506,-1.511, - &-1.516,-1.521,-1.526,-1.531,-1.536,-1.541,-1.545,-1.550,-1.555, - &-1.560,-1.564,-1.569,-1.574,-1.579,-1.583,-1.588,-1.593,-1.597, - &-1.602,-1.606,-1.611,-1.616,-1.620,-1.625,-1.629,-1.634,-1.638, - &-1.643,-1.647,-1.652,-1.656,-1.661,-1.665,-1.670,-1.674,-1.678, - &-1.683,-1.687,-1.692,-1.696,-1.700,-1.705,-1.709,-1.713,-1.718, - &-1.722,-1.726,-1.730,-1.735,-1.739,-1.743,-1.747,-1.752,-1.756, - &-1.760,-1.764,-1.768,-1.773,-1.777,-1.781,-1.785,-1.789,-1.793, - &-1.798,-1.802,-1.806,-1.810,-1.814,-1.818,-1.822,-1.826,-1.830, - &-1.834,-1.838,-1.843,-1.847,-1.851,-1.855,-1.859,-1.863,-1.867, - &-1.871,-1.875,-1.879,-1.883,-1.887,-1.891,-1.895,-1.899,-1.902, - &-1.906,-1.910,-1.914,-1.918,-1.922,-1.926,-1.930,-1.934,-1.938, - &-1.942,-1.946,-1.949 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.048,-0.105,-0.133,-0.154,-0.170,-0.183,-0.195,-0.205,-0.214, - &-0.223,-0.230,-0.237,-0.244,-0.250,-0.256,-0.261,-0.266,-0.271, - &-0.276,-0.280,-0.284,-0.289,-0.292,-0.296,-0.300,-0.304,-0.307, - &-0.310,-0.314,-0.317,-0.320,-0.323,-0.326,-0.328,-0.331,-0.334, - &-0.337,-0.339,-0.342,-0.344,-0.347,-0.349,-0.351,-0.353,-0.356, - &-0.358,-0.360,-0.362,-0.364,-0.366,-0.368,-0.370,-0.372,-0.374, - &-0.376,-0.378,-0.379,-0.381,-0.383,-0.385,-0.386,-0.388,-0.390, - &-0.391,-0.393,-0.395,-0.396,-0.398,-0.399,-0.401,-0.402,-0.404, - &-0.405,-0.407,-0.408,-0.410,-0.411,-0.413,-0.414,-0.415,-0.417, - &-0.418,-0.420,-0.421,-0.422,-0.424,-0.425,-0.426,-0.427,-0.429, - &-0.430,-0.431,-0.433,-0.434,-0.435,-0.436,-0.438,-0.439,-0.440, - &-0.441,-0.442,-0.444,-0.445,-0.446,-0.447,-0.448,-0.449,-0.451, - &-0.452,-0.453,-0.454,-0.455,-0.456,-0.457,-0.459,-0.460,-0.461, - &-0.462,-0.463,-0.464,-0.465,-0.466,-0.467,-0.468,-0.469,-0.470, - &-0.472,-0.473,-0.474,-0.475,-0.476,-0.477,-0.478,-0.479,-0.480, - &-0.481,-0.482,-0.483,-0.484,-0.485,-0.486,-0.487,-0.488,-0.489, - &-0.490,-0.490,-0.491,-0.492,-0.493,-0.494,-0.495,-0.496,-0.497, - &-0.498,-0.499,-0.500,-0.501,-0.502,-0.503,-0.503,-0.504,-0.505, - &-0.506,-0.507,-0.508,-0.509,-0.510,-0.510,-0.511,-0.512,-0.513, - &-0.514,-0.515,-0.516,-0.516,-0.517,-0.518,-0.519,-0.520,-0.521, - &-0.521,-0.522,-0.523,-0.524,-0.525,-0.526,-0.526,-0.527,-0.528, - &-0.529,-0.530,-0.530,-0.531,-0.532,-0.533,-0.534,-0.534,-0.535, - &-0.536,-0.537,-0.537,-0.538,-0.539,-0.540,-0.540,-0.541,-0.542, - &-0.543,-0.543,-0.544,-0.545,-0.546,-0.546,-0.547,-0.548,-0.549, - &-0.549,-0.550,-0.551,-0.552,-0.552,-0.553,-0.554,-0.554,-0.555, - &-0.556,-0.557,-0.557,-0.558,-0.559,-0.559,-0.560,-0.561,-0.562, - &-0.562,-0.563,-0.564,-0.564,-0.565,-0.566,-0.566,-0.567,-0.568, - &-0.568,-0.569,-0.570,-0.570,-0.571,-0.572,-0.572,-0.573,-0.574, - &-0.574,-0.575,-0.576,-0.576,-0.577,-0.578,-0.578,-0.579,-0.580, - &-0.580,-0.581,-0.582,-0.582,-0.583,-0.584,-0.584,-0.585,-0.585, - &-0.586,-0.587,-0.587,-0.588,-0.589,-0.589,-0.590,-0.591,-0.591, - &-0.592,-0.592,-0.593,-0.594,-0.594,-0.595,-0.595,-0.596,-0.597, - &-0.597,-0.598,-0.599,-0.599,-0.600,-0.600,-0.601,-0.602,-0.602, - &-0.603,-0.603,-0.604,-0.604,-0.605,-0.606,-0.606,-0.607,-0.607, - &-0.608,-0.609,-0.609,-0.610,-0.610,-0.611,-0.612,-0.612,-0.613, - &-0.613,-0.614,-0.614,-0.615,-0.616,-0.616,-0.617,-0.617,-0.618, - &-0.618,-0.619,-0.619,-0.620,-0.621,-0.621,-0.622,-0.622,-0.623, - &-0.623,-0.624,-0.624,-0.625,-0.626,-0.626,-0.627,-0.627,-0.628, - &-0.628,-0.629,-0.629,-0.630,-0.630,-0.631,-0.632,-0.632,-0.633, - &-0.633,-0.634,-0.634,-0.635,-0.635,-0.636,-0.636,-0.637,-0.637, - &-0.638,-0.638,-0.639,-0.640,-0.640,-0.641,-0.641,-0.642,-0.642, - &-0.643,-0.643,-0.644,-0.644,-0.645,-0.645,-0.646,-0.646,-0.647, - &-0.647,-0.648,-0.648,-0.649,-0.649,-0.650,-0.650,-0.651,-0.651, - &-0.652,-0.652,-0.653,-0.653,-0.654,-0.654,-0.655,-0.655,-0.656, - &-0.656,-0.657,-0.657,-0.658,-0.663,-0.668,-0.673,-0.677,-0.682, - &-0.687,-0.691,-0.696,-0.700,-0.704,-0.709,-0.713,-0.717,-0.721, - &-0.725,-0.729,-0.733,-0.737,-0.741,-0.745,-0.749,-0.753,-0.757, - &-0.760,-0.764,-0.768,-0.771,-0.775,-0.779,-0.782,-0.786,-0.789, - &-0.793,-0.796,-0.799,-0.803,-0.806,-0.810,-0.813,-0.816,-0.819, - &-0.823,-0.826,-0.829,-0.832,-0.836,-0.839,-0.842,-0.845,-0.848, - &-0.851,-0.854,-0.857,-0.860,-0.863,-0.866,-0.869,-0.872,-0.875, - &-0.878,-0.881,-0.884,-0.887,-0.890,-0.893,-0.895,-0.898,-0.901, - &-0.904,-0.907,-0.909,-0.912,-0.915,-0.918,-0.920,-0.923,-0.926, - &-0.929,-0.931,-0.934,-0.937,-0.939,-0.942,-0.945,-0.947,-0.950, - &-0.952,-0.955,-0.958,-0.960,-0.963,-0.965,-0.968,-0.971,-0.973, - &-0.976,-0.978,-0.981,-0.983,-0.986,-0.988,-0.991,-0.993,-0.996, - &-0.998,-1.000,-1.003,-1.005,-1.008,-1.010,-1.013,-1.015,-1.017, - &-1.020,-1.022,-1.025,-1.027,-1.029,-1.032,-1.034,-1.036,-1.039, - &-1.041,-1.043,-1.046,-1.048,-1.050,-1.053,-1.055,-1.057,-1.060, - &-1.062,-1.064,-1.067,-1.069,-1.071,-1.073,-1.076,-1.078,-1.080, - &-1.082,-1.085,-1.087,-1.089,-1.091,-1.093,-1.096,-1.098,-1.100, - &-1.102,-1.105,-1.107,-1.109,-1.111,-1.113,-1.115,-1.118,-1.120, - &-1.122,-1.124,-1.126 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.096,-0.208,-0.265,-0.305,-0.337,-0.363,-0.385,-0.405,-0.423, - &-0.439,-0.453,-0.467,-0.479,-0.491,-0.502,-0.512,-0.522,-0.531, - &-0.540,-0.548,-0.556,-0.564,-0.571,-0.578,-0.585,-0.592,-0.598, - &-0.605,-0.610,-0.616,-0.622,-0.627,-0.633,-0.638,-0.643,-0.648, - &-0.653,-0.657,-0.662,-0.666,-0.671,-0.675,-0.679,-0.683,-0.688, - &-0.691,-0.695,-0.699,-0.703,-0.707,-0.710,-0.714,-0.717,-0.721, - &-0.724,-0.727,-0.731,-0.734,-0.737,-0.740,-0.743,-0.746,-0.749, - &-0.752,-0.755,-0.758,-0.761,-0.763,-0.766,-0.769,-0.772,-0.774, - &-0.777,-0.780,-0.782,-0.785,-0.787,-0.790,-0.792,-0.795,-0.797, - &-0.799,-0.802,-0.804,-0.807,-0.809,-0.811,-0.814,-0.816,-0.818, - &-0.820,-0.823,-0.825,-0.827,-0.829,-0.831,-0.833,-0.836,-0.838, - &-0.840,-0.842,-0.844,-0.846,-0.848,-0.850,-0.852,-0.854,-0.856, - &-0.858,-0.860,-0.862,-0.864,-0.866,-0.868,-0.870,-0.872,-0.874, - &-0.875,-0.877,-0.879,-0.881,-0.883,-0.885,-0.887,-0.888,-0.890, - &-0.892,-0.894,-0.895,-0.897,-0.899,-0.901,-0.902,-0.904,-0.906, - &-0.908,-0.909,-0.911,-0.913,-0.914,-0.916,-0.918,-0.919,-0.921, - &-0.923,-0.924,-0.926,-0.927,-0.929,-0.931,-0.932,-0.934,-0.935, - &-0.937,-0.938,-0.940,-0.942,-0.943,-0.945,-0.946,-0.948,-0.949, - &-0.951,-0.952,-0.954,-0.955,-0.957,-0.958,-0.960,-0.961,-0.962, - &-0.964,-0.965,-0.967,-0.968,-0.970,-0.971,-0.972,-0.974,-0.975, - &-0.977,-0.978,-0.979,-0.981,-0.982,-0.984,-0.985,-0.986,-0.988, - &-0.989,-0.990,-0.992,-0.993,-0.994,-0.996,-0.997,-0.998,-1.000, - &-1.001,-1.002,-1.004,-1.005,-1.006,-1.007,-1.009,-1.010,-1.011, - &-1.013,-1.014,-1.015,-1.016,-1.018,-1.019,-1.020,-1.021,-1.023, - &-1.024,-1.025,-1.026,-1.027,-1.029,-1.030,-1.031,-1.032,-1.034, - &-1.035,-1.036,-1.037,-1.038,-1.039,-1.041,-1.042,-1.043,-1.044, - &-1.045,-1.047,-1.048,-1.049,-1.050,-1.051,-1.052,-1.053,-1.055, - &-1.056,-1.057,-1.058,-1.059,-1.060,-1.061,-1.063,-1.064,-1.065, - &-1.066,-1.067,-1.068,-1.069,-1.070,-1.071,-1.073,-1.074,-1.075, - &-1.076,-1.077,-1.078,-1.079,-1.080,-1.081,-1.082,-1.083,-1.084, - &-1.086,-1.087,-1.088,-1.089,-1.090,-1.091,-1.092,-1.093,-1.094, - &-1.095,-1.096,-1.097,-1.098,-1.099,-1.100,-1.101,-1.102,-1.103, - &-1.104,-1.105,-1.106,-1.107,-1.108,-1.109,-1.110,-1.111,-1.112, - &-1.114,-1.115,-1.116,-1.117,-1.118,-1.119,-1.119,-1.120,-1.121, - &-1.122,-1.123,-1.124,-1.125,-1.126,-1.127,-1.128,-1.129,-1.130, - &-1.131,-1.132,-1.133,-1.134,-1.135,-1.136,-1.137,-1.138,-1.139, - &-1.140,-1.141,-1.142,-1.143,-1.144,-1.145,-1.146,-1.147,-1.147, - &-1.148,-1.149,-1.150,-1.151,-1.152,-1.153,-1.154,-1.155,-1.156, - &-1.157,-1.158,-1.159,-1.160,-1.160,-1.161,-1.162,-1.163,-1.164, - &-1.165,-1.166,-1.167,-1.168,-1.169,-1.169,-1.170,-1.171,-1.172, - &-1.173,-1.174,-1.175,-1.176,-1.177,-1.178,-1.178,-1.179,-1.180, - &-1.181,-1.182,-1.183,-1.184,-1.185,-1.185,-1.186,-1.187,-1.188, - &-1.189,-1.190,-1.191,-1.191,-1.192,-1.193,-1.194,-1.195,-1.196, - &-1.197,-1.198,-1.198,-1.199,-1.200,-1.201,-1.202,-1.203,-1.203, - &-1.204,-1.205,-1.206,-1.207,-1.216,-1.224,-1.232,-1.240,-1.248, - &-1.256,-1.263,-1.271,-1.279,-1.286,-1.293,-1.301,-1.308,-1.315, - &-1.322,-1.329,-1.336,-1.343,-1.349,-1.356,-1.363,-1.369,-1.376, - &-1.382,-1.389,-1.395,-1.402,-1.408,-1.414,-1.420,-1.427,-1.433, - &-1.439,-1.445,-1.451,-1.457,-1.463,-1.468,-1.474,-1.480,-1.486, - &-1.492,-1.497,-1.503,-1.509,-1.514,-1.520,-1.525,-1.531,-1.536, - &-1.542,-1.547,-1.553,-1.558,-1.563,-1.569,-1.574,-1.579,-1.585, - &-1.590,-1.595,-1.600,-1.605,-1.611,-1.616,-1.621,-1.626,-1.631, - &-1.636,-1.641,-1.646,-1.651,-1.656,-1.661,-1.666,-1.671,-1.676, - &-1.681,-1.685,-1.690,-1.695,-1.700,-1.705,-1.710,-1.714,-1.719, - &-1.724,-1.729,-1.733,-1.738,-1.743,-1.747,-1.752,-1.757,-1.761, - &-1.766,-1.770,-1.775,-1.780,-1.784,-1.789,-1.793,-1.798,-1.802, - &-1.807,-1.811,-1.816,-1.820,-1.825,-1.829,-1.834,-1.838,-1.842, - &-1.847,-1.851,-1.856,-1.860,-1.864,-1.869,-1.873,-1.877,-1.882, - &-1.886,-1.890,-1.895,-1.899,-1.903,-1.908,-1.912,-1.916,-1.920, - &-1.925,-1.929,-1.933,-1.937,-1.941,-1.946,-1.950,-1.954,-1.958, - &-1.962,-1.966,-1.971,-1.975,-1.979,-1.983,-1.987,-1.991,-1.995, - &-2.000,-2.004,-2.008,-2.012,-2.016,-2.020,-2.024,-2.028,-2.032, - &-2.036,-2.040,-2.044 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.048,-0.108,-0.138,-0.161,-0.179,-0.194,-0.208,-0.220,-0.231, - &-0.241,-0.250,-0.259,-0.267,-0.275,-0.282,-0.289,-0.296,-0.302, - &-0.309,-0.315,-0.321,-0.326,-0.332,-0.337,-0.342,-0.347,-0.352, - &-0.357,-0.361,-0.366,-0.370,-0.375,-0.379,-0.383,-0.387,-0.391, - &-0.395,-0.399,-0.403,-0.406,-0.410,-0.414,-0.417,-0.421,-0.424, - &-0.427,-0.431,-0.434,-0.437,-0.440,-0.443,-0.446,-0.449,-0.452, - &-0.455,-0.458,-0.461,-0.464,-0.466,-0.469,-0.472,-0.475,-0.477, - &-0.480,-0.482,-0.485,-0.487,-0.490,-0.492,-0.495,-0.497,-0.500, - &-0.502,-0.505,-0.507,-0.509,-0.512,-0.514,-0.516,-0.518,-0.521, - &-0.523,-0.525,-0.527,-0.530,-0.532,-0.534,-0.536,-0.538,-0.541, - &-0.543,-0.545,-0.547,-0.549,-0.551,-0.553,-0.555,-0.558,-0.560, - &-0.562,-0.564,-0.566,-0.568,-0.570,-0.572,-0.574,-0.576,-0.578, - &-0.580,-0.582,-0.584,-0.586,-0.588,-0.590,-0.592,-0.594,-0.596, - &-0.598,-0.600,-0.602,-0.604,-0.606,-0.608,-0.609,-0.611,-0.613, - &-0.615,-0.617,-0.619,-0.621,-0.622,-0.624,-0.626,-0.628,-0.630, - &-0.631,-0.633,-0.635,-0.637,-0.639,-0.640,-0.642,-0.644,-0.646, - &-0.647,-0.649,-0.651,-0.652,-0.654,-0.656,-0.657,-0.659,-0.661, - &-0.662,-0.664,-0.666,-0.667,-0.669,-0.671,-0.672,-0.674,-0.675, - &-0.677,-0.679,-0.680,-0.682,-0.683,-0.685,-0.686,-0.688,-0.690, - &-0.691,-0.693,-0.694,-0.696,-0.697,-0.699,-0.700,-0.702,-0.703, - &-0.705,-0.706,-0.708,-0.709,-0.711,-0.712,-0.713,-0.715,-0.716, - &-0.718,-0.719,-0.721,-0.722,-0.723,-0.725,-0.726,-0.728,-0.729, - &-0.730,-0.732,-0.733,-0.735,-0.736,-0.737,-0.739,-0.740,-0.741, - &-0.743,-0.744,-0.745,-0.747,-0.748,-0.749,-0.751,-0.752,-0.753, - &-0.755,-0.756,-0.757,-0.759,-0.760,-0.761,-0.762,-0.764,-0.765, - &-0.766,-0.768,-0.769,-0.770,-0.771,-0.773,-0.774,-0.775,-0.776, - &-0.778,-0.779,-0.780,-0.781,-0.782,-0.784,-0.785,-0.786,-0.787, - &-0.788,-0.790,-0.791,-0.792,-0.793,-0.794,-0.796,-0.797,-0.798, - &-0.799,-0.800,-0.801,-0.803,-0.804,-0.805,-0.806,-0.807,-0.808, - &-0.809,-0.811,-0.812,-0.813,-0.814,-0.815,-0.816,-0.817,-0.818, - &-0.820,-0.821,-0.822,-0.823,-0.824,-0.825,-0.826,-0.827,-0.828, - &-0.829,-0.830,-0.832,-0.833,-0.834,-0.835,-0.836,-0.837,-0.838, - &-0.839,-0.840,-0.841,-0.842,-0.843,-0.844,-0.845,-0.846,-0.847, - &-0.848,-0.849,-0.850,-0.851,-0.852,-0.853,-0.854,-0.855,-0.857, - &-0.858,-0.859,-0.860,-0.861,-0.862,-0.863,-0.863,-0.864,-0.865, - &-0.866,-0.867,-0.868,-0.869,-0.870,-0.871,-0.872,-0.873,-0.874, - &-0.875,-0.876,-0.877,-0.878,-0.879,-0.880,-0.881,-0.882,-0.883, - &-0.884,-0.885,-0.886,-0.887,-0.887,-0.888,-0.889,-0.890,-0.891, - &-0.892,-0.893,-0.894,-0.895,-0.896,-0.897,-0.898,-0.898,-0.899, - &-0.900,-0.901,-0.902,-0.903,-0.904,-0.905,-0.906,-0.907,-0.907, - &-0.908,-0.909,-0.910,-0.911,-0.912,-0.913,-0.914,-0.914,-0.915, - &-0.916,-0.917,-0.918,-0.919,-0.920,-0.920,-0.921,-0.922,-0.923, - &-0.924,-0.925,-0.926,-0.926,-0.927,-0.928,-0.929,-0.930,-0.931, - &-0.931,-0.932,-0.933,-0.934,-0.935,-0.936,-0.936,-0.937,-0.938, - &-0.939,-0.940,-0.940,-0.941,-0.950,-0.958,-0.965,-0.973,-0.980, - &-0.988,-0.995,-1.002,-1.009,-1.015,-1.022,-1.029,-1.035,-1.041, - &-1.047,-1.054,-1.060,-1.066,-1.071,-1.077,-1.083,-1.088,-1.094, - &-1.099,-1.105,-1.110,-1.115,-1.120,-1.125,-1.130,-1.135,-1.140, - &-1.145,-1.150,-1.155,-1.159,-1.164,-1.168,-1.173,-1.177,-1.182, - &-1.186,-1.191,-1.195,-1.199,-1.203,-1.207,-1.212,-1.216,-1.220, - &-1.224,-1.228,-1.232,-1.235,-1.239,-1.243,-1.247,-1.251,-1.254, - &-1.258,-1.262,-1.265,-1.269,-1.273,-1.276,-1.280,-1.283,-1.287, - &-1.290,-1.293,-1.297,-1.300,-1.304,-1.307,-1.310,-1.313,-1.317, - &-1.320,-1.323,-1.326,-1.330,-1.333,-1.336,-1.339,-1.342,-1.345, - &-1.348,-1.351,-1.354,-1.357,-1.360,-1.363,-1.366,-1.369,-1.372, - &-1.375,-1.378,-1.381,-1.383,-1.386,-1.389,-1.392,-1.395,-1.397, - &-1.400,-1.403,-1.406,-1.408,-1.411,-1.414,-1.417,-1.419,-1.422, - &-1.425,-1.427,-1.430,-1.432,-1.435,-1.438,-1.440,-1.443,-1.445, - &-1.448,-1.450,-1.453,-1.456,-1.458,-1.461,-1.463,-1.466,-1.468, - &-1.470,-1.473,-1.475,-1.478,-1.480,-1.483,-1.485,-1.487,-1.490, - &-1.492,-1.495,-1.497,-1.499,-1.502,-1.504,-1.506,-1.509,-1.511, - &-1.513,-1.516,-1.518,-1.520,-1.523,-1.525,-1.527,-1.529,-1.532, - &-1.534,-1.536,-1.538 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.047,-0.101,-0.126,-0.144,-0.157,-0.168,-0.177,-0.185,-0.191, - &-0.197,-0.202,-0.207,-0.211,-0.215,-0.218,-0.221,-0.224,-0.227, - &-0.229,-0.232,-0.234,-0.236,-0.238,-0.239,-0.241,-0.242,-0.244, - &-0.245,-0.246,-0.247,-0.249,-0.250,-0.251,-0.251,-0.252,-0.253, - &-0.254,-0.255,-0.255,-0.256,-0.257,-0.257,-0.258,-0.258,-0.259, - &-0.259,-0.260,-0.260,-0.261,-0.261,-0.261,-0.262,-0.262,-0.262, - &-0.263,-0.263,-0.263,-0.263,-0.264,-0.264,-0.264,-0.264,-0.265, - &-0.265,-0.265,-0.265,-0.265,-0.265,-0.265,-0.266,-0.266,-0.266, - &-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266, - &-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.266,-0.265, - &-0.265,-0.265,-0.265,-0.265,-0.265,-0.265,-0.264,-0.264,-0.264, - &-0.264,-0.264,-0.263,-0.263,-0.263,-0.263,-0.263,-0.262,-0.262, - &-0.262,-0.262,-0.261,-0.261,-0.261,-0.260,-0.260,-0.260,-0.260, - &-0.259,-0.259,-0.259,-0.258,-0.258,-0.258,-0.257,-0.257,-0.257, - &-0.256,-0.256,-0.256,-0.255,-0.255,-0.255,-0.254,-0.254,-0.254, - &-0.253,-0.253,-0.253,-0.252,-0.252,-0.252,-0.251,-0.251,-0.251, - &-0.250,-0.250,-0.249,-0.249,-0.249,-0.248,-0.248,-0.248,-0.247, - &-0.247,-0.247,-0.246,-0.246,-0.245,-0.245,-0.245,-0.244,-0.244, - &-0.244,-0.243,-0.243,-0.242,-0.242,-0.242,-0.241,-0.241,-0.241, - &-0.240,-0.240,-0.239,-0.239,-0.239,-0.238,-0.238,-0.238,-0.237, - &-0.237,-0.236,-0.236,-0.236,-0.235,-0.235,-0.235,-0.234,-0.234, - &-0.233,-0.233,-0.233,-0.232,-0.232,-0.231,-0.231,-0.231,-0.230, - &-0.230,-0.230,-0.229,-0.229,-0.228,-0.228,-0.228,-0.227,-0.227, - &-0.227,-0.226,-0.226,-0.225,-0.225,-0.225,-0.224,-0.224,-0.224, - &-0.223,-0.223,-0.222,-0.222,-0.222,-0.221,-0.221,-0.221,-0.220, - &-0.220,-0.219,-0.219,-0.219,-0.218,-0.218,-0.218,-0.217,-0.217, - &-0.216,-0.216,-0.216,-0.215,-0.215,-0.215,-0.214,-0.214,-0.214, - &-0.213,-0.213,-0.212,-0.212,-0.212,-0.211,-0.211,-0.211,-0.210, - &-0.210,-0.210,-0.209,-0.209,-0.208,-0.208,-0.208,-0.207,-0.207, - &-0.207,-0.206,-0.206,-0.206,-0.205,-0.205,-0.204,-0.204,-0.204, - &-0.203,-0.203,-0.203,-0.202,-0.202,-0.202,-0.201,-0.201,-0.201, - &-0.200,-0.200,-0.200,-0.199,-0.199,-0.198,-0.198,-0.198,-0.197, - &-0.197,-0.197,-0.196,-0.196,-0.196,-0.195,-0.195,-0.195,-0.194, - &-0.194,-0.194,-0.193,-0.193,-0.193,-0.192,-0.192,-0.192,-0.191, - &-0.191,-0.191,-0.190,-0.190,-0.190,-0.189,-0.189,-0.189,-0.188, - &-0.188,-0.188,-0.187,-0.187,-0.187,-0.186,-0.186,-0.186,-0.185, - &-0.185,-0.185,-0.184,-0.184,-0.184,-0.183,-0.183,-0.183,-0.182, - &-0.182,-0.182,-0.181,-0.181,-0.181,-0.180,-0.180,-0.180,-0.179, - &-0.179,-0.179,-0.178,-0.178,-0.178,-0.177,-0.177,-0.177,-0.176, - &-0.176,-0.176,-0.176,-0.175,-0.175,-0.175,-0.174,-0.174,-0.174, - &-0.173,-0.173,-0.173,-0.172,-0.172,-0.172,-0.171,-0.171,-0.171, - &-0.171,-0.170,-0.170,-0.170,-0.169,-0.169,-0.169,-0.168,-0.168, - &-0.168,-0.167,-0.167,-0.167,-0.167,-0.166,-0.166,-0.166,-0.165, - &-0.165,-0.165,-0.164,-0.164,-0.164,-0.164,-0.163,-0.163,-0.163, - &-0.162,-0.162,-0.162,-0.161,-0.158,-0.155,-0.153,-0.150,-0.147, - &-0.144,-0.142,-0.139,-0.137,-0.134,-0.132,-0.129,-0.127,-0.125, - &-0.122,-0.120,-0.118,-0.116,-0.113,-0.111,-0.109,-0.107,-0.105, - &-0.103,-0.101,-0.099,-0.097,-0.095,-0.093,-0.092,-0.090,-0.088, - &-0.086,-0.085,-0.083,-0.081,-0.080,-0.078,-0.077,-0.075,-0.073, - &-0.072,-0.071,-0.069,-0.068,-0.066,-0.065,-0.064,-0.062,-0.061, - &-0.060,-0.058,-0.057,-0.056,-0.055,-0.053,-0.052,-0.051,-0.050, - &-0.049,-0.048,-0.047,-0.046,-0.044,-0.043,-0.042,-0.041,-0.040, - &-0.039,-0.039,-0.038,-0.037,-0.036,-0.035,-0.034,-0.033,-0.032, - &-0.032,-0.031,-0.030,-0.029,-0.028,-0.028,-0.027,-0.026,-0.025, - &-0.025,-0.024,-0.023,-0.023,-0.022,-0.021,-0.021,-0.020,-0.019, - &-0.019,-0.018,-0.018,-0.017,-0.017,-0.016,-0.016,-0.015,-0.015, - &-0.014,-0.014,-0.013,-0.013,-0.012,-0.012,-0.011,-0.011,-0.010, - &-0.010,-0.010,-0.009,-0.009,-0.008,-0.008,-0.008,-0.007,-0.007, - &-0.007,-0.006,-0.006,-0.006,-0.005,-0.005,-0.005,-0.005,-0.004, - &-0.004,-0.004,-0.004,-0.003,-0.003,-0.003,-0.003,-0.003,-0.002, - &-0.002,-0.002,-0.002,-0.002,-0.002,-0.001,-0.001,-0.001,-0.001, - &-0.001,-0.001,-0.001,-0.001, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.095,-0.207,-0.263,-0.303,-0.333,-0.359,-0.381,-0.400,-0.417, - &-0.432,-0.446,-0.459,-0.471,-0.482,-0.492,-0.502,-0.511,-0.520, - &-0.528,-0.536,-0.543,-0.550,-0.557,-0.564,-0.570,-0.576,-0.582, - &-0.588,-0.593,-0.598,-0.603,-0.608,-0.613,-0.618,-0.622,-0.627, - &-0.631,-0.635,-0.640,-0.644,-0.648,-0.651,-0.655,-0.659,-0.662, - &-0.666,-0.669,-0.673,-0.676,-0.679,-0.682,-0.686,-0.689,-0.692, - &-0.695,-0.698,-0.700,-0.703,-0.706,-0.709,-0.712,-0.714,-0.717, - &-0.719,-0.722,-0.724,-0.727,-0.729,-0.732,-0.734,-0.736,-0.739, - &-0.741,-0.743,-0.746,-0.748,-0.750,-0.752,-0.754,-0.756,-0.758, - &-0.761,-0.763,-0.765,-0.767,-0.769,-0.771,-0.773,-0.774,-0.776, - &-0.778,-0.780,-0.782,-0.784,-0.786,-0.787,-0.789,-0.791,-0.793, - &-0.795,-0.796,-0.798,-0.800,-0.802,-0.803,-0.805,-0.807,-0.808, - &-0.810,-0.811,-0.813,-0.815,-0.816,-0.818,-0.819,-0.821,-0.823, - &-0.824,-0.826,-0.827,-0.829,-0.830,-0.832,-0.833,-0.835,-0.836, - &-0.838,-0.839,-0.841,-0.842,-0.843,-0.845,-0.846,-0.848,-0.849, - &-0.850,-0.852,-0.853,-0.854,-0.856,-0.857,-0.858,-0.860,-0.861, - &-0.862,-0.864,-0.865,-0.866,-0.868,-0.869,-0.870,-0.871,-0.873, - &-0.874,-0.875,-0.876,-0.878,-0.879,-0.880,-0.881,-0.883,-0.884, - &-0.885,-0.886,-0.887,-0.889,-0.890,-0.891,-0.892,-0.893,-0.894, - &-0.896,-0.897,-0.898,-0.899,-0.900,-0.901,-0.902,-0.904,-0.905, - &-0.906,-0.907,-0.908,-0.909,-0.910,-0.911,-0.912,-0.914,-0.915, - &-0.916,-0.917,-0.918,-0.919,-0.920,-0.921,-0.922,-0.923,-0.924, - &-0.925,-0.926,-0.927,-0.928,-0.929,-0.930,-0.931,-0.932,-0.933, - &-0.934,-0.935,-0.936,-0.937,-0.938,-0.939,-0.940,-0.941,-0.942, - &-0.943,-0.944,-0.945,-0.946,-0.947,-0.948,-0.949,-0.950,-0.951, - &-0.952,-0.953,-0.954,-0.955,-0.956,-0.957,-0.958,-0.959,-0.960, - &-0.960,-0.961,-0.962,-0.963,-0.964,-0.965,-0.966,-0.967,-0.968, - &-0.969,-0.970,-0.970,-0.971,-0.972,-0.973,-0.974,-0.975,-0.976, - &-0.977,-0.978,-0.978,-0.979,-0.980,-0.981,-0.982,-0.983,-0.984, - &-0.985,-0.985,-0.986,-0.987,-0.988,-0.989,-0.990,-0.991,-0.991, - &-0.992,-0.993,-0.994,-0.995,-0.996,-0.996,-0.997,-0.998,-0.999, - &-1.000,-1.001,-1.001,-1.002,-1.003,-1.004,-1.005,-1.005,-1.006, - &-1.007,-1.008,-1.009,-1.010,-1.010,-1.011,-1.012,-1.013,-1.014, - &-1.014,-1.015,-1.016,-1.017,-1.017,-1.018,-1.019,-1.020,-1.021, - &-1.021,-1.022,-1.023,-1.024,-1.025,-1.025,-1.026,-1.027,-1.028, - &-1.028,-1.029,-1.030,-1.031,-1.031,-1.032,-1.033,-1.034,-1.034, - &-1.035,-1.036,-1.037,-1.037,-1.038,-1.039,-1.040,-1.040,-1.041, - &-1.042,-1.043,-1.043,-1.044,-1.045,-1.046,-1.046,-1.047,-1.048, - &-1.049,-1.049,-1.050,-1.051,-1.051,-1.052,-1.053,-1.054,-1.054, - &-1.055,-1.056,-1.057,-1.057,-1.058,-1.059,-1.059,-1.060,-1.061, - &-1.061,-1.062,-1.063,-1.064,-1.064,-1.065,-1.066,-1.066,-1.067, - &-1.068,-1.069,-1.069,-1.070,-1.071,-1.071,-1.072,-1.073,-1.073, - &-1.074,-1.075,-1.075,-1.076,-1.077,-1.078,-1.078,-1.079,-1.080, - &-1.080,-1.081,-1.082,-1.082,-1.083,-1.084,-1.084,-1.085,-1.086, - &-1.086,-1.087,-1.088,-1.088,-1.096,-1.102,-1.109,-1.115,-1.121, - &-1.127,-1.134,-1.140,-1.146,-1.152,-1.158,-1.163,-1.169,-1.175, - &-1.181,-1.186,-1.192,-1.198,-1.203,-1.209,-1.214,-1.219,-1.225, - &-1.230,-1.235,-1.241,-1.246,-1.251,-1.256,-1.261,-1.266,-1.271, - &-1.276,-1.281,-1.286,-1.291,-1.296,-1.301,-1.306,-1.311,-1.315, - &-1.320,-1.325,-1.330,-1.334,-1.339,-1.344,-1.348,-1.353,-1.358, - &-1.362,-1.367,-1.371,-1.376,-1.380,-1.385,-1.389,-1.394,-1.398, - &-1.403,-1.407,-1.412,-1.416,-1.420,-1.425,-1.429,-1.434,-1.438, - &-1.442,-1.447,-1.451,-1.455,-1.459,-1.464,-1.468,-1.472,-1.476, - &-1.480,-1.485,-1.489,-1.493,-1.497,-1.501,-1.505,-1.510,-1.514, - &-1.518,-1.522,-1.526,-1.530,-1.534,-1.538,-1.542,-1.546,-1.550, - &-1.554,-1.558,-1.562,-1.566,-1.570,-1.574,-1.578,-1.582,-1.586, - &-1.590,-1.594,-1.598,-1.602,-1.606,-1.610,-1.614,-1.618,-1.622, - &-1.625,-1.629,-1.633,-1.637,-1.641,-1.645,-1.649,-1.652,-1.656, - &-1.660,-1.664,-1.668,-1.672,-1.675,-1.679,-1.683,-1.687,-1.690, - &-1.694,-1.698,-1.702,-1.706,-1.709,-1.713,-1.717,-1.721,-1.724, - &-1.728,-1.732,-1.735,-1.739,-1.743,-1.747,-1.750,-1.754,-1.758, - &-1.761,-1.765,-1.769,-1.772,-1.776,-1.780,-1.783,-1.787,-1.791, - &-1.794,-1.798,-1.801 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.045,-0.089,-0.107,-0.117,-0.124,-0.128,-0.131,-0.132,-0.133, - &-0.132,-0.132,-0.130,-0.128,-0.126,-0.123,-0.120,-0.117,-0.113, - &-0.109,-0.105,-0.101,-0.096,-0.091,-0.086,-0.081,-0.076,-0.070, - &-0.065,-0.059,-0.053,-0.047,-0.040,-0.034,-0.027,-0.021,-0.014, - &-0.007, 0.000, 0.007, 0.014, 0.021, 0.028, 0.036, 0.043, 0.051, - & 0.058, 0.066, 0.074, 0.082, 0.089, 0.097, 0.105, 0.113, 0.121, - & 0.130, 0.138, 0.146, 0.154, 0.163, 0.171, 0.179, 0.188, 0.196, - & 0.205, 0.214, 0.222, 0.231, 0.240, 0.248, 0.257, 0.266, 0.275, - & 0.284, 0.293, 0.302, 0.311, 0.320, 0.329, 0.338, 0.347, 0.357, - & 0.366, 0.375, 0.385, 0.394, 0.404, 0.413, 0.423, 0.433, 0.442, - & 0.452, 0.462, 0.472, 0.482, 0.492, 0.502, 0.512, 0.522, 0.532, - & 0.542, 0.552, 0.563, 0.573, 0.583, 0.594, 0.604, 0.614, 0.625, - & 0.635, 0.646, 0.656, 0.667, 0.677, 0.688, 0.698, 0.709, 0.719, - & 0.730, 0.741, 0.751, 0.762, 0.772, 0.783, 0.794, 0.804, 0.815, - & 0.825, 0.836, 0.846, 0.857, 0.867, 0.878, 0.888, 0.899, 0.909, - & 0.920, 0.930, 0.941, 0.951, 0.962, 0.972, 0.982, 0.993, 1.003, - & 1.014, 1.024, 1.034, 1.044, 1.055, 1.065, 1.075, 1.085, 1.096, - & 1.106, 1.116, 1.126, 1.136, 1.146, 1.156, 1.166, 1.176, 1.186, - & 1.196, 1.206, 1.216, 1.226, 1.236, 1.246, 1.256, 1.266, 1.276, - & 1.285, 1.295, 1.305, 1.315, 1.325, 1.334, 1.344, 1.354, 1.363, - & 1.373, 1.383, 1.392, 1.402, 1.411, 1.421, 1.430, 1.440, 1.449, - & 1.459, 1.468, 1.478, 1.487, 1.496, 1.506, 1.515, 1.524, 1.534, - & 1.543, 1.552, 1.561, 1.571, 1.580, 1.589, 1.598, 1.607, 1.616, - & 1.625, 1.634, 1.643, 1.652, 1.661, 1.670, 1.679, 1.688, 1.697, - & 1.706, 1.715, 1.724, 1.733, 1.742, 1.750, 1.759, 1.768, 1.777, - & 1.786, 1.794, 1.803, 1.812, 1.820, 1.829, 1.838, 1.846, 1.855, - & 1.863, 1.872, 1.880, 1.889, 1.897, 1.906, 1.914, 1.923, 1.931, - & 1.940, 1.948, 1.956, 1.965, 1.973, 1.981, 1.990, 1.998, 2.006, - & 2.015, 2.023, 2.031, 2.039, 2.047, 2.056, 2.064, 2.072, 2.080, - & 2.088, 2.096, 2.104, 2.112, 2.120, 2.128, 2.136, 2.144, 2.152, - & 2.160, 2.168, 2.176, 2.184, 2.192, 2.200, 2.207, 2.215, 2.223, - & 2.231, 2.239, 2.246, 2.254, 2.262, 2.270, 2.277, 2.285, 2.293, - & 2.300, 2.308, 2.316, 2.323, 2.331, 2.339, 2.346, 2.354, 2.361, - & 2.369, 2.376, 2.384, 2.391, 2.399, 2.406, 2.414, 2.421, 2.428, - & 2.436, 2.443, 2.451, 2.458, 2.465, 2.473, 2.480, 2.487, 2.494, - & 2.502, 2.509, 2.516, 2.523, 2.531, 2.538, 2.545, 2.552, 2.559, - & 2.566, 2.574, 2.581, 2.588, 2.595, 2.602, 2.609, 2.616, 2.623, - & 2.630, 2.637, 2.644, 2.651, 2.658, 2.665, 2.672, 2.679, 2.686, - & 2.693, 2.700, 2.707, 2.713, 2.720, 2.727, 2.734, 2.741, 2.748, - & 2.754, 2.761, 2.768, 2.775, 2.781, 2.788, 2.795, 2.802, 2.808, - & 2.815, 2.822, 2.828, 2.835, 2.842, 2.848, 2.855, 2.862, 2.868, - & 2.875, 2.881, 2.888, 2.894, 2.901, 2.907, 2.914, 2.920, 2.927, - & 2.933, 2.940, 2.946, 2.953, 2.959, 2.966, 2.972, 2.978, 2.985, - & 2.991, 2.998, 3.004, 3.010, 3.017, 3.023, 3.029, 3.036, 3.042, - & 3.048, 3.054, 3.061, 3.067, 3.134, 3.195, 3.254, 3.313, 3.371, - & 3.428, 3.485, 3.540, 3.595, 3.648, 3.701, 3.754, 3.805, 3.856, - & 3.906, 3.955, 4.004, 4.052, 4.100, 4.147, 4.193, 4.239, 4.284, - & 4.328, 4.372, 4.416, 4.459, 4.501, 4.543, 4.585, 4.626, 4.666, - & 4.707, 4.746, 4.786, 4.824, 4.863, 4.901, 4.938, 4.976, 5.013, - & 5.049, 5.085, 5.121, 5.156, 5.191, 5.226, 5.260, 5.294, 5.328, - & 5.361, 5.395, 5.427, 5.460, 5.492, 5.524, 5.555, 5.587, 5.618, - & 5.649, 5.679, 5.709, 5.739, 5.769, 5.799, 5.828, 5.857, 5.886, - & 5.914, 5.942, 5.971, 5.998, 6.026, 6.053, 6.081, 6.108, 6.134, - & 6.161, 6.187, 6.214, 6.240, 6.265, 6.291, 6.316, 6.342, 6.367, - & 6.392, 6.416, 6.441, 6.465, 6.489, 6.513, 6.537, 6.561, 6.584, - & 6.608, 6.631, 6.654, 6.677, 6.699, 6.722, 6.744, 6.767, 6.789, - & 6.811, 6.833, 6.854, 6.876, 6.897, 6.919, 6.940, 6.961, 6.982, - & 7.003, 7.023, 7.044, 7.064, 7.085, 7.105, 7.125, 7.145, 7.165, - & 7.184, 7.204, 7.223, 7.243, 7.262, 7.281, 7.300, 7.319, 7.338, - & 7.356, 7.375, 7.394, 7.412, 7.430, 7.448, 7.467, 7.485, 7.502, - & 7.520, 7.538, 7.556, 7.573, 7.591, 7.608, 7.625, 7.642, 7.659, - & 7.676, 7.693, 7.710, 7.727, 7.743, 7.760, 7.776, 7.793, 7.809, - & 7.825, 7.841, 7.858 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.047,-0.099,-0.125,-0.142,-0.155,-0.166,-0.175,-0.182,-0.189, - &-0.195,-0.200,-0.204,-0.208,-0.212,-0.215,-0.218,-0.221,-0.223, - &-0.225,-0.227,-0.228,-0.230,-0.231,-0.232,-0.233,-0.234,-0.235, - &-0.235,-0.235,-0.236,-0.236,-0.236,-0.236,-0.235,-0.235,-0.235, - &-0.234,-0.233,-0.233,-0.232,-0.231,-0.230,-0.229,-0.228,-0.227, - &-0.226,-0.224,-0.223,-0.222,-0.220,-0.219,-0.217,-0.215,-0.214, - &-0.212,-0.210,-0.208,-0.207,-0.205,-0.203,-0.201,-0.199,-0.197, - &-0.195,-0.192,-0.190,-0.188,-0.186,-0.183,-0.181,-0.179,-0.176, - &-0.174,-0.171,-0.169,-0.166,-0.164,-0.161,-0.159,-0.156,-0.153, - &-0.151,-0.148,-0.145,-0.143,-0.140,-0.137,-0.134,-0.131,-0.128, - &-0.125,-0.122,-0.120,-0.117,-0.114,-0.110,-0.107,-0.104,-0.101, - &-0.098,-0.095,-0.092,-0.089,-0.085,-0.082,-0.079,-0.076,-0.073, - &-0.069,-0.066,-0.063,-0.060,-0.056,-0.053,-0.050,-0.046,-0.043, - &-0.040,-0.036,-0.033,-0.030,-0.026,-0.023,-0.020,-0.016,-0.013, - &-0.010,-0.006,-0.003, 0.000, 0.004, 0.007, 0.010, 0.014, 0.017, - & 0.020, 0.024, 0.027, 0.030, 0.034, 0.037, 0.040, 0.043, 0.047, - & 0.050, 0.053, 0.056, 0.060, 0.063, 0.066, 0.069, 0.073, 0.076, - & 0.079, 0.082, 0.086, 0.089, 0.092, 0.095, 0.098, 0.101, 0.105, - & 0.108, 0.111, 0.114, 0.117, 0.120, 0.123, 0.127, 0.130, 0.133, - & 0.136, 0.139, 0.142, 0.145, 0.148, 0.151, 0.154, 0.157, 0.160, - & 0.163, 0.166, 0.170, 0.173, 0.176, 0.179, 0.182, 0.184, 0.187, - & 0.190, 0.193, 0.196, 0.199, 0.202, 0.205, 0.208, 0.211, 0.214, - & 0.217, 0.220, 0.223, 0.226, 0.228, 0.231, 0.234, 0.237, 0.240, - & 0.243, 0.246, 0.248, 0.251, 0.254, 0.257, 0.260, 0.262, 0.265, - & 0.268, 0.271, 0.274, 0.276, 0.279, 0.282, 0.285, 0.287, 0.290, - & 0.293, 0.296, 0.298, 0.301, 0.304, 0.306, 0.309, 0.312, 0.315, - & 0.317, 0.320, 0.323, 0.325, 0.328, 0.330, 0.333, 0.336, 0.338, - & 0.341, 0.344, 0.346, 0.349, 0.351, 0.354, 0.357, 0.359, 0.362, - & 0.364, 0.367, 0.369, 0.372, 0.375, 0.377, 0.380, 0.382, 0.385, - & 0.387, 0.390, 0.392, 0.395, 0.397, 0.400, 0.402, 0.405, 0.407, - & 0.410, 0.412, 0.415, 0.417, 0.419, 0.422, 0.424, 0.427, 0.429, - & 0.432, 0.434, 0.437, 0.439, 0.441, 0.444, 0.446, 0.449, 0.451, - & 0.453, 0.456, 0.458, 0.460, 0.463, 0.465, 0.467, 0.470, 0.472, - & 0.474, 0.477, 0.479, 0.481, 0.484, 0.486, 0.488, 0.491, 0.493, - & 0.495, 0.498, 0.500, 0.502, 0.504, 0.507, 0.509, 0.511, 0.513, - & 0.516, 0.518, 0.520, 0.522, 0.525, 0.527, 0.529, 0.531, 0.534, - & 0.536, 0.538, 0.540, 0.542, 0.545, 0.547, 0.549, 0.551, 0.553, - & 0.556, 0.558, 0.560, 0.562, 0.564, 0.566, 0.569, 0.571, 0.573, - & 0.575, 0.577, 0.579, 0.581, 0.584, 0.586, 0.588, 0.590, 0.592, - & 0.594, 0.596, 0.598, 0.600, 0.602, 0.605, 0.607, 0.609, 0.611, - & 0.613, 0.615, 0.617, 0.619, 0.621, 0.623, 0.625, 0.627, 0.629, - & 0.631, 0.633, 0.635, 0.637, 0.639, 0.642, 0.644, 0.646, 0.648, - & 0.650, 0.652, 0.654, 0.656, 0.658, 0.660, 0.662, 0.663, 0.665, - & 0.667, 0.669, 0.671, 0.673, 0.675, 0.677, 0.679, 0.681, 0.683, - & 0.685, 0.687, 0.689, 0.691, 0.712, 0.730, 0.749, 0.767, 0.785, - & 0.803, 0.820, 0.837, 0.854, 0.871, 0.887, 0.903, 0.919, 0.935, - & 0.950, 0.965, 0.980, 0.995, 1.010, 1.024, 1.039, 1.053, 1.067, - & 1.080, 1.094, 1.107, 1.120, 1.133, 1.146, 1.159, 1.172, 1.184, - & 1.196, 1.209, 1.221, 1.232, 1.244, 1.256, 1.267, 1.279, 1.290, - & 1.301, 1.312, 1.323, 1.334, 1.344, 1.355, 1.365, 1.376, 1.386, - & 1.396, 1.406, 1.416, 1.426, 1.436, 1.445, 1.455, 1.464, 1.474, - & 1.483, 1.492, 1.501, 1.511, 1.519, 1.528, 1.537, 1.546, 1.555, - & 1.563, 1.572, 1.580, 1.588, 1.597, 1.605, 1.613, 1.621, 1.629, - & 1.637, 1.645, 1.653, 1.660, 1.668, 1.676, 1.683, 1.691, 1.698, - & 1.706, 1.713, 1.720, 1.727, 1.734, 1.742, 1.749, 1.756, 1.763, - & 1.769, 1.776, 1.783, 1.790, 1.796, 1.803, 1.810, 1.816, 1.823, - & 1.829, 1.835, 1.842, 1.848, 1.854, 1.861, 1.867, 1.873, 1.879, - & 1.885, 1.891, 1.897, 1.903, 1.909, 1.915, 1.920, 1.926, 1.932, - & 1.938, 1.943, 1.949, 1.954, 1.960, 1.965, 1.971, 1.976, 1.982, - & 1.987, 1.992, 1.998, 2.003, 2.008, 2.013, 2.018, 2.024, 2.029, - & 2.034, 2.039, 2.044, 2.049, 2.054, 2.059, 2.063, 2.068, 2.073, - & 2.078, 2.083, 2.087, 2.092, 2.097, 2.101, 2.106, 2.111, 2.115, - & 2.120, 2.124, 2.129 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.046,-0.096,-0.118,-0.132,-0.142,-0.150,-0.156,-0.161,-0.164, - &-0.167,-0.170,-0.171,-0.173,-0.174,-0.174,-0.175,-0.175,-0.175, - &-0.175,-0.174,-0.174,-0.173,-0.172,-0.171,-0.170,-0.169,-0.168, - &-0.167,-0.165,-0.164,-0.163,-0.161,-0.160,-0.158,-0.156,-0.155, - &-0.153,-0.151,-0.150,-0.148,-0.146,-0.144,-0.142,-0.141,-0.139, - &-0.137,-0.135,-0.133,-0.131,-0.129,-0.127,-0.125,-0.124,-0.122, - &-0.120,-0.118,-0.116,-0.114,-0.112,-0.110,-0.108,-0.106,-0.104, - &-0.102,-0.100,-0.098,-0.096,-0.094,-0.092,-0.090,-0.088,-0.086, - &-0.084,-0.082,-0.080,-0.078,-0.076,-0.074,-0.071,-0.069,-0.067, - &-0.065,-0.063,-0.061,-0.058,-0.056,-0.054,-0.052,-0.049,-0.047, - &-0.045,-0.043,-0.040,-0.038,-0.035,-0.033,-0.031,-0.028,-0.026, - &-0.023,-0.021,-0.019,-0.016,-0.014,-0.011,-0.009,-0.006,-0.004, - &-0.001, 0.001, 0.004, 0.007, 0.009, 0.012, 0.014, 0.017, 0.019, - & 0.022, 0.025, 0.027, 0.030, 0.032, 0.035, 0.038, 0.040, 0.043, - & 0.045, 0.048, 0.051, 0.053, 0.056, 0.058, 0.061, 0.064, 0.066, - & 0.069, 0.071, 0.074, 0.077, 0.079, 0.082, 0.084, 0.087, 0.090, - & 0.092, 0.095, 0.097, 0.100, 0.103, 0.105, 0.108, 0.110, 0.113, - & 0.115, 0.118, 0.121, 0.123, 0.126, 0.128, 0.131, 0.133, 0.136, - & 0.138, 0.141, 0.143, 0.146, 0.148, 0.151, 0.154, 0.156, 0.159, - & 0.161, 0.164, 0.166, 0.169, 0.171, 0.174, 0.176, 0.179, 0.181, - & 0.184, 0.186, 0.189, 0.191, 0.193, 0.196, 0.198, 0.201, 0.203, - & 0.206, 0.208, 0.211, 0.213, 0.216, 0.218, 0.220, 0.223, 0.225, - & 0.228, 0.230, 0.232, 0.235, 0.237, 0.240, 0.242, 0.245, 0.247, - & 0.249, 0.252, 0.254, 0.256, 0.259, 0.261, 0.264, 0.266, 0.268, - & 0.271, 0.273, 0.275, 0.278, 0.280, 0.282, 0.285, 0.287, 0.289, - & 0.292, 0.294, 0.296, 0.299, 0.301, 0.303, 0.306, 0.308, 0.310, - & 0.312, 0.315, 0.317, 0.319, 0.322, 0.324, 0.326, 0.328, 0.331, - & 0.333, 0.335, 0.337, 0.340, 0.342, 0.344, 0.346, 0.349, 0.351, - & 0.353, 0.355, 0.357, 0.360, 0.362, 0.364, 0.366, 0.369, 0.371, - & 0.373, 0.375, 0.377, 0.379, 0.382, 0.384, 0.386, 0.388, 0.390, - & 0.393, 0.395, 0.397, 0.399, 0.401, 0.403, 0.405, 0.408, 0.410, - & 0.412, 0.414, 0.416, 0.418, 0.420, 0.422, 0.425, 0.427, 0.429, - & 0.431, 0.433, 0.435, 0.437, 0.439, 0.441, 0.443, 0.445, 0.448, - & 0.450, 0.452, 0.454, 0.456, 0.458, 0.460, 0.462, 0.464, 0.466, - & 0.468, 0.470, 0.472, 0.474, 0.476, 0.478, 0.480, 0.482, 0.484, - & 0.486, 0.488, 0.490, 0.492, 0.494, 0.496, 0.498, 0.500, 0.502, - & 0.504, 0.506, 0.508, 0.510, 0.512, 0.514, 0.516, 0.518, 0.520, - & 0.522, 0.524, 0.526, 0.528, 0.530, 0.532, 0.534, 0.536, 0.537, - & 0.539, 0.541, 0.543, 0.545, 0.547, 0.549, 0.551, 0.553, 0.555, - & 0.557, 0.558, 0.560, 0.562, 0.564, 0.566, 0.568, 0.570, 0.572, - & 0.574, 0.575, 0.577, 0.579, 0.581, 0.583, 0.585, 0.587, 0.588, - & 0.590, 0.592, 0.594, 0.596, 0.598, 0.599, 0.601, 0.603, 0.605, - & 0.607, 0.609, 0.610, 0.612, 0.614, 0.616, 0.618, 0.619, 0.621, - & 0.623, 0.625, 0.627, 0.628, 0.630, 0.632, 0.634, 0.635, 0.637, - & 0.639, 0.641, 0.643, 0.644, 0.663, 0.680, 0.697, 0.714, 0.730, - & 0.747, 0.763, 0.778, 0.794, 0.809, 0.824, 0.839, 0.854, 0.868, - & 0.883, 0.897, 0.911, 0.924, 0.938, 0.951, 0.965, 0.978, 0.990, - & 1.003, 1.016, 1.028, 1.040, 1.053, 1.065, 1.076, 1.088, 1.100, - & 1.111, 1.122, 1.133, 1.145, 1.155, 1.166, 1.177, 1.188, 1.198, - & 1.208, 1.219, 1.229, 1.239, 1.249, 1.258, 1.268, 1.278, 1.287, - & 1.297, 1.306, 1.315, 1.324, 1.333, 1.342, 1.351, 1.360, 1.369, - & 1.377, 1.386, 1.394, 1.403, 1.411, 1.419, 1.428, 1.436, 1.444, - & 1.452, 1.459, 1.467, 1.475, 1.483, 1.490, 1.498, 1.505, 1.513, - & 1.520, 1.527, 1.535, 1.542, 1.549, 1.556, 1.563, 1.570, 1.577, - & 1.584, 1.590, 1.597, 1.604, 1.610, 1.617, 1.623, 1.630, 1.636, - & 1.643, 1.649, 1.655, 1.661, 1.667, 1.674, 1.680, 1.686, 1.692, - & 1.698, 1.703, 1.709, 1.715, 1.721, 1.727, 1.732, 1.738, 1.744, - & 1.749, 1.755, 1.760, 1.766, 1.771, 1.776, 1.782, 1.787, 1.792, - & 1.797, 1.803, 1.808, 1.813, 1.818, 1.823, 1.828, 1.833, 1.838, - & 1.843, 1.848, 1.853, 1.857, 1.862, 1.867, 1.872, 1.876, 1.881, - & 1.886, 1.890, 1.895, 1.899, 1.904, 1.908, 1.913, 1.917, 1.922, - & 1.926, 1.930, 1.935, 1.939, 1.943, 1.948, 1.952, 1.956, 1.960, - & 1.964, 1.968, 1.973 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.045,-0.090,-0.108,-0.119,-0.126,-0.130,-0.133,-0.135,-0.135, - &-0.135,-0.134,-0.133,-0.131,-0.129,-0.126,-0.124,-0.121,-0.117, - &-0.114,-0.110,-0.106,-0.102,-0.098,-0.093,-0.089,-0.084,-0.079, - &-0.075,-0.070,-0.065,-0.059,-0.054,-0.049,-0.044,-0.038,-0.033, - &-0.027,-0.022,-0.016,-0.010,-0.004, 0.001, 0.007, 0.013, 0.019, - & 0.025, 0.031, 0.037, 0.043, 0.049, 0.055, 0.061, 0.067, 0.073, - & 0.079, 0.085, 0.091, 0.098, 0.104, 0.110, 0.116, 0.122, 0.129, - & 0.135, 0.141, 0.147, 0.154, 0.160, 0.166, 0.173, 0.179, 0.185, - & 0.192, 0.198, 0.205, 0.211, 0.218, 0.224, 0.231, 0.238, 0.244, - & 0.251, 0.258, 0.264, 0.271, 0.278, 0.285, 0.292, 0.298, 0.305, - & 0.312, 0.319, 0.326, 0.333, 0.341, 0.348, 0.355, 0.362, 0.369, - & 0.377, 0.384, 0.391, 0.398, 0.406, 0.413, 0.421, 0.428, 0.435, - & 0.443, 0.450, 0.458, 0.465, 0.473, 0.480, 0.488, 0.495, 0.503, - & 0.510, 0.518, 0.526, 0.533, 0.541, 0.548, 0.556, 0.563, 0.571, - & 0.578, 0.586, 0.594, 0.601, 0.609, 0.616, 0.624, 0.631, 0.639, - & 0.646, 0.654, 0.661, 0.669, 0.676, 0.684, 0.691, 0.699, 0.706, - & 0.713, 0.721, 0.728, 0.736, 0.743, 0.750, 0.758, 0.765, 0.772, - & 0.780, 0.787, 0.794, 0.802, 0.809, 0.816, 0.823, 0.831, 0.838, - & 0.845, 0.852, 0.859, 0.867, 0.874, 0.881, 0.888, 0.895, 0.902, - & 0.909, 0.916, 0.924, 0.931, 0.938, 0.945, 0.952, 0.959, 0.966, - & 0.973, 0.980, 0.987, 0.994, 1.000, 1.007, 1.014, 1.021, 1.028, - & 1.035, 1.042, 1.049, 1.055, 1.062, 1.069, 1.076, 1.082, 1.089, - & 1.096, 1.103, 1.109, 1.116, 1.123, 1.129, 1.136, 1.143, 1.149, - & 1.156, 1.163, 1.169, 1.176, 1.182, 1.189, 1.195, 1.202, 1.208, - & 1.215, 1.221, 1.228, 1.234, 1.241, 1.247, 1.254, 1.260, 1.266, - & 1.273, 1.279, 1.286, 1.292, 1.298, 1.305, 1.311, 1.317, 1.323, - & 1.330, 1.336, 1.342, 1.348, 1.355, 1.361, 1.367, 1.373, 1.379, - & 1.386, 1.392, 1.398, 1.404, 1.410, 1.416, 1.422, 1.428, 1.434, - & 1.440, 1.446, 1.452, 1.458, 1.464, 1.470, 1.476, 1.482, 1.488, - & 1.494, 1.500, 1.506, 1.512, 1.518, 1.524, 1.530, 1.535, 1.541, - & 1.547, 1.553, 1.559, 1.564, 1.570, 1.576, 1.582, 1.588, 1.593, - & 1.599, 1.605, 1.610, 1.616, 1.622, 1.628, 1.633, 1.639, 1.644, - & 1.650, 1.656, 1.661, 1.667, 1.672, 1.678, 1.684, 1.689, 1.695, - & 1.700, 1.706, 1.711, 1.717, 1.722, 1.728, 1.733, 1.739, 1.744, - & 1.750, 1.755, 1.760, 1.766, 1.771, 1.777, 1.782, 1.787, 1.793, - & 1.798, 1.803, 1.809, 1.814, 1.819, 1.825, 1.830, 1.835, 1.840, - & 1.846, 1.851, 1.856, 1.861, 1.867, 1.872, 1.877, 1.882, 1.887, - & 1.893, 1.898, 1.903, 1.908, 1.913, 1.918, 1.923, 1.929, 1.934, - & 1.939, 1.944, 1.949, 1.954, 1.959, 1.964, 1.969, 1.974, 1.979, - & 1.984, 1.989, 1.994, 1.999, 2.004, 2.009, 2.014, 2.019, 2.024, - & 2.029, 2.034, 2.039, 2.044, 2.048, 2.053, 2.058, 2.063, 2.068, - & 2.073, 2.078, 2.082, 2.087, 2.092, 2.097, 2.102, 2.107, 2.111, - & 2.116, 2.121, 2.126, 2.130, 2.135, 2.140, 2.145, 2.149, 2.154, - & 2.159, 2.163, 2.168, 2.173, 2.177, 2.182, 2.187, 2.191, 2.196, - & 2.201, 2.205, 2.210, 2.215, 2.264, 2.309, 2.353, 2.396, 2.439, - & 2.481, 2.523, 2.564, 2.604, 2.643, 2.683, 2.721, 2.759, 2.797, - & 2.834, 2.870, 2.906, 2.941, 2.976, 3.011, 3.045, 3.079, 3.112, - & 3.145, 3.177, 3.210, 3.241, 3.273, 3.304, 3.334, 3.364, 3.394, - & 3.424, 3.453, 3.482, 3.511, 3.539, 3.567, 3.595, 3.622, 3.649, - & 3.676, 3.702, 3.729, 3.755, 3.781, 3.806, 3.831, 3.856, 3.881, - & 3.906, 3.930, 3.954, 3.978, 4.002, 4.025, 4.048, 4.071, 4.094, - & 4.117, 4.139, 4.161, 4.183, 4.205, 4.227, 4.248, 4.270, 4.291, - & 4.312, 4.332, 4.353, 4.373, 4.394, 4.414, 4.434, 4.453, 4.473, - & 4.493, 4.512, 4.531, 4.550, 4.569, 4.588, 4.606, 4.625, 4.643, - & 4.661, 4.679, 4.697, 4.715, 4.733, 4.750, 4.768, 4.785, 4.802, - & 4.819, 4.836, 4.853, 4.870, 4.886, 4.903, 4.919, 4.936, 4.952, - & 4.968, 4.984, 5.000, 5.015, 5.031, 5.046, 5.062, 5.077, 5.093, - & 5.108, 5.123, 5.138, 5.153, 5.167, 5.182, 5.197, 5.211, 5.226, - & 5.240, 5.254, 5.268, 5.282, 5.296, 5.310, 5.324, 5.338, 5.352, - & 5.365, 5.379, 5.392, 5.406, 5.419, 5.432, 5.445, 5.458, 5.471, - & 5.484, 5.497, 5.510, 5.523, 5.535, 5.548, 5.560, 5.573, 5.585, - & 5.598, 5.610, 5.622, 5.634, 5.646, 5.658, 5.670, 5.682, 5.694, - & 5.706, 5.717, 5.729 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.046,-0.096,-0.118,-0.132,-0.143,-0.151,-0.158,-0.163,-0.167, - &-0.170,-0.173,-0.175,-0.177,-0.178,-0.179,-0.180,-0.180,-0.180, - &-0.180,-0.180,-0.179,-0.179,-0.178,-0.177,-0.176,-0.174,-0.173, - &-0.171,-0.170,-0.168,-0.166,-0.164,-0.162,-0.159,-0.157,-0.155, - &-0.152,-0.150,-0.147,-0.144,-0.142,-0.139,-0.136,-0.133,-0.130, - &-0.127,-0.124,-0.120,-0.117,-0.114,-0.110,-0.107,-0.104,-0.100, - &-0.097,-0.093,-0.090,-0.086,-0.082,-0.079,-0.075,-0.071,-0.067, - &-0.064,-0.060,-0.056,-0.052,-0.048,-0.044,-0.040,-0.036,-0.032, - &-0.028,-0.024,-0.020,-0.015,-0.011,-0.007,-0.003, 0.002, 0.006, - & 0.010, 0.015, 0.019, 0.024, 0.028, 0.033, 0.037, 0.042, 0.046, - & 0.051, 0.056, 0.060, 0.065, 0.070, 0.075, 0.079, 0.084, 0.089, - & 0.094, 0.099, 0.104, 0.109, 0.114, 0.119, 0.124, 0.129, 0.134, - & 0.139, 0.144, 0.149, 0.154, 0.159, 0.164, 0.169, 0.174, 0.179, - & 0.184, 0.189, 0.195, 0.200, 0.205, 0.210, 0.215, 0.220, 0.225, - & 0.230, 0.236, 0.241, 0.246, 0.251, 0.256, 0.261, 0.266, 0.271, - & 0.276, 0.281, 0.286, 0.291, 0.297, 0.302, 0.307, 0.312, 0.317, - & 0.322, 0.327, 0.332, 0.337, 0.342, 0.347, 0.352, 0.357, 0.361, - & 0.366, 0.371, 0.376, 0.381, 0.386, 0.391, 0.396, 0.401, 0.406, - & 0.410, 0.415, 0.420, 0.425, 0.430, 0.434, 0.439, 0.444, 0.449, - & 0.454, 0.458, 0.463, 0.468, 0.473, 0.477, 0.482, 0.487, 0.491, - & 0.496, 0.501, 0.505, 0.510, 0.515, 0.519, 0.524, 0.529, 0.533, - & 0.538, 0.542, 0.547, 0.551, 0.556, 0.560, 0.565, 0.570, 0.574, - & 0.579, 0.583, 0.588, 0.592, 0.596, 0.601, 0.605, 0.610, 0.614, - & 0.619, 0.623, 0.627, 0.632, 0.636, 0.641, 0.645, 0.649, 0.654, - & 0.658, 0.662, 0.667, 0.671, 0.675, 0.680, 0.684, 0.688, 0.692, - & 0.697, 0.701, 0.705, 0.709, 0.714, 0.718, 0.722, 0.726, 0.730, - & 0.735, 0.739, 0.743, 0.747, 0.751, 0.755, 0.759, 0.764, 0.768, - & 0.772, 0.776, 0.780, 0.784, 0.788, 0.792, 0.796, 0.800, 0.804, - & 0.808, 0.812, 0.816, 0.820, 0.824, 0.828, 0.832, 0.836, 0.840, - & 0.844, 0.848, 0.852, 0.856, 0.860, 0.864, 0.868, 0.872, 0.875, - & 0.879, 0.883, 0.887, 0.891, 0.895, 0.899, 0.902, 0.906, 0.910, - & 0.914, 0.918, 0.922, 0.925, 0.929, 0.933, 0.937, 0.940, 0.944, - & 0.948, 0.952, 0.955, 0.959, 0.963, 0.967, 0.970, 0.974, 0.978, - & 0.981, 0.985, 0.989, 0.992, 0.996, 1.000, 1.003, 1.007, 1.011, - & 1.014, 1.018, 1.022, 1.025, 1.029, 1.032, 1.036, 1.040, 1.043, - & 1.047, 1.050, 1.054, 1.057, 1.061, 1.064, 1.068, 1.071, 1.075, - & 1.079, 1.082, 1.086, 1.089, 1.092, 1.096, 1.099, 1.103, 1.106, - & 1.110, 1.113, 1.117, 1.120, 1.124, 1.127, 1.130, 1.134, 1.137, - & 1.141, 1.144, 1.147, 1.151, 1.154, 1.158, 1.161, 1.164, 1.168, - & 1.171, 1.174, 1.178, 1.181, 1.184, 1.188, 1.191, 1.194, 1.198, - & 1.201, 1.204, 1.207, 1.211, 1.214, 1.217, 1.220, 1.224, 1.227, - & 1.230, 1.233, 1.237, 1.240, 1.243, 1.246, 1.250, 1.253, 1.256, - & 1.259, 1.262, 1.266, 1.269, 1.272, 1.275, 1.278, 1.281, 1.285, - & 1.288, 1.291, 1.294, 1.297, 1.300, 1.303, 1.306, 1.310, 1.313, - & 1.316, 1.319, 1.322, 1.325, 1.358, 1.388, 1.418, 1.447, 1.476, - & 1.504, 1.532, 1.559, 1.586, 1.613, 1.639, 1.665, 1.691, 1.716, - & 1.741, 1.766, 1.790, 1.814, 1.838, 1.861, 1.884, 1.907, 1.929, - & 1.951, 1.973, 1.995, 2.016, 2.037, 2.058, 2.079, 2.099, 2.120, - & 2.140, 2.159, 2.179, 2.198, 2.217, 2.236, 2.255, 2.274, 2.292, - & 2.310, 2.328, 2.346, 2.363, 2.381, 2.398, 2.415, 2.432, 2.449, - & 2.465, 2.482, 2.498, 2.514, 2.530, 2.546, 2.562, 2.577, 2.592, - & 2.608, 2.623, 2.638, 2.653, 2.667, 2.682, 2.697, 2.711, 2.725, - & 2.739, 2.753, 2.767, 2.781, 2.795, 2.808, 2.822, 2.835, 2.848, - & 2.861, 2.874, 2.887, 2.900, 2.913, 2.925, 2.938, 2.950, 2.963, - & 2.975, 2.987, 2.999, 3.011, 3.023, 3.035, 3.046, 3.058, 3.069, - & 3.081, 3.092, 3.104, 3.115, 3.126, 3.137, 3.148, 3.159, 3.170, - & 3.180, 3.191, 3.202, 3.212, 3.223, 3.233, 3.244, 3.254, 3.264, - & 3.274, 3.284, 3.294, 3.304, 3.314, 3.324, 3.334, 3.343, 3.353, - & 3.363, 3.372, 3.382, 3.391, 3.400, 3.410, 3.419, 3.428, 3.437, - & 3.446, 3.455, 3.464, 3.473, 3.482, 3.491, 3.499, 3.508, 3.517, - & 3.525, 3.534, 3.542, 3.551, 3.559, 3.568, 3.576, 3.584, 3.592, - & 3.601, 3.609, 3.617, 3.625, 3.633, 3.641, 3.649, 3.657, 3.664, - & 3.672, 3.680, 3.688 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.076,-0.165,-0.209,-0.240,-0.264,-0.284,-0.301,-0.316,-0.329, - &-0.341,-0.352,-0.362,-0.371,-0.379,-0.387,-0.394,-0.401,-0.408, - &-0.414,-0.420,-0.425,-0.430,-0.435,-0.440,-0.444,-0.449,-0.453, - &-0.457,-0.460,-0.464,-0.467,-0.471,-0.474,-0.477,-0.480,-0.483, - &-0.485,-0.488,-0.490,-0.493,-0.495,-0.497,-0.499,-0.501,-0.503, - &-0.505,-0.507,-0.509,-0.510,-0.512,-0.514,-0.515,-0.516,-0.518, - &-0.519,-0.520,-0.522,-0.523,-0.524,-0.525,-0.526,-0.527,-0.528, - &-0.529,-0.530,-0.531,-0.532,-0.532,-0.533,-0.534,-0.534,-0.535, - &-0.536,-0.536,-0.537,-0.537,-0.538,-0.538,-0.539,-0.539,-0.540, - &-0.540,-0.540,-0.541,-0.541,-0.541,-0.542,-0.542,-0.542,-0.542, - &-0.542,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543, - &-0.543,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543,-0.543, - &-0.543,-0.542,-0.542,-0.542,-0.542,-0.542,-0.542,-0.542,-0.541, - &-0.541,-0.541,-0.541,-0.540,-0.540,-0.540,-0.540,-0.540,-0.539, - &-0.539,-0.539,-0.538,-0.538,-0.538,-0.538,-0.537,-0.537,-0.537, - &-0.536,-0.536,-0.536,-0.536,-0.535,-0.535,-0.535,-0.534,-0.534, - &-0.534,-0.533,-0.533,-0.533,-0.532,-0.532,-0.532,-0.531,-0.531, - &-0.530,-0.530,-0.530,-0.529,-0.529,-0.529,-0.528,-0.528,-0.528, - &-0.527,-0.527,-0.527,-0.526,-0.526,-0.525,-0.525,-0.525,-0.524, - &-0.524,-0.524,-0.523,-0.523,-0.522,-0.522,-0.522,-0.521,-0.521, - &-0.521,-0.520,-0.520,-0.519,-0.519,-0.519,-0.518,-0.518,-0.518, - &-0.517,-0.517,-0.516,-0.516,-0.516,-0.515,-0.515,-0.515,-0.514, - &-0.514,-0.513,-0.513,-0.513,-0.512,-0.512,-0.512,-0.511,-0.511, - &-0.510,-0.510,-0.510,-0.509,-0.509,-0.509,-0.508,-0.508,-0.507, - &-0.507,-0.507,-0.506,-0.506,-0.506,-0.505,-0.505,-0.504,-0.504, - &-0.504,-0.503,-0.503,-0.503,-0.502,-0.502,-0.501,-0.501,-0.501, - &-0.500,-0.500,-0.500,-0.499,-0.499,-0.499,-0.498,-0.498,-0.497, - &-0.497,-0.497,-0.496,-0.496,-0.496,-0.495,-0.495,-0.495,-0.494, - &-0.494,-0.493,-0.493,-0.493,-0.492,-0.492,-0.492,-0.491,-0.491, - &-0.491,-0.490,-0.490,-0.490,-0.489,-0.489,-0.489,-0.488,-0.488, - &-0.487,-0.487,-0.487,-0.486,-0.486,-0.486,-0.485,-0.485,-0.485, - &-0.484,-0.484,-0.484,-0.483,-0.483,-0.483,-0.482,-0.482,-0.482, - &-0.481,-0.481,-0.481,-0.480,-0.480,-0.480,-0.479,-0.479,-0.479, - &-0.478,-0.478,-0.478,-0.477,-0.477,-0.477,-0.476,-0.476,-0.476, - &-0.475,-0.475,-0.475,-0.474,-0.474,-0.474,-0.473,-0.473,-0.473, - &-0.472,-0.472,-0.472,-0.471,-0.471,-0.471,-0.471,-0.470,-0.470, - &-0.470,-0.469,-0.469,-0.469,-0.468,-0.468,-0.468,-0.467,-0.467, - &-0.467,-0.466,-0.466,-0.466,-0.466,-0.465,-0.465,-0.465,-0.464, - &-0.464,-0.464,-0.463,-0.463,-0.463,-0.463,-0.462,-0.462,-0.462, - &-0.461,-0.461,-0.461,-0.460,-0.460,-0.460,-0.460,-0.459,-0.459, - &-0.459,-0.458,-0.458,-0.458,-0.458,-0.457,-0.457,-0.457,-0.456, - &-0.456,-0.456,-0.456,-0.455,-0.455,-0.455,-0.454,-0.454,-0.454, - &-0.454,-0.453,-0.453,-0.453,-0.452,-0.452,-0.452,-0.452,-0.451, - &-0.451,-0.451,-0.450,-0.450,-0.450,-0.450,-0.449,-0.449,-0.449, - &-0.449,-0.448,-0.448,-0.448,-0.445,-0.442,-0.440,-0.437,-0.435, - &-0.432,-0.430,-0.428,-0.426,-0.423,-0.421,-0.419,-0.417,-0.415, - &-0.413,-0.411,-0.409,-0.407,-0.406,-0.404,-0.402,-0.401,-0.399, - &-0.397,-0.396,-0.394,-0.393,-0.391,-0.390,-0.389,-0.387,-0.386, - &-0.385,-0.383,-0.382,-0.381,-0.380,-0.379,-0.378,-0.377,-0.376, - &-0.375,-0.374,-0.373,-0.372,-0.371,-0.370,-0.369,-0.368,-0.367, - &-0.367,-0.366,-0.365,-0.364,-0.364,-0.363,-0.362,-0.362,-0.361, - &-0.361,-0.360,-0.360,-0.359,-0.359,-0.358,-0.358,-0.357,-0.357, - &-0.356,-0.356,-0.356,-0.355,-0.355,-0.355,-0.354,-0.354,-0.354, - &-0.354,-0.353,-0.353,-0.353,-0.353,-0.353,-0.352,-0.352,-0.352, - &-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352, - &-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352,-0.352, - &-0.352,-0.353,-0.353,-0.353,-0.353,-0.353,-0.353,-0.354,-0.354, - &-0.354,-0.354,-0.355,-0.355,-0.355,-0.355,-0.356,-0.356,-0.356, - &-0.357,-0.357,-0.357,-0.358,-0.358,-0.358,-0.359,-0.359,-0.359, - &-0.360,-0.360,-0.361,-0.361,-0.362,-0.362,-0.362,-0.363,-0.363, - &-0.364,-0.364,-0.365,-0.365,-0.366,-0.366,-0.367,-0.367,-0.368, - &-0.369,-0.369,-0.370,-0.370,-0.371,-0.371,-0.372,-0.373,-0.373, - &-0.374,-0.374,-0.375 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.094,-0.201,-0.251,-0.286,-0.312,-0.334,-0.351,-0.366,-0.379, - &-0.390,-0.400,-0.409,-0.417,-0.424,-0.430,-0.436,-0.442,-0.447, - &-0.451,-0.455,-0.459,-0.463,-0.466,-0.469,-0.472,-0.475,-0.477, - &-0.479,-0.481,-0.483,-0.485,-0.487,-0.489,-0.490,-0.491,-0.493, - &-0.494,-0.495,-0.496,-0.497,-0.498,-0.499,-0.500,-0.501,-0.501, - &-0.502,-0.503,-0.503,-0.504,-0.504,-0.505,-0.505,-0.505,-0.506, - &-0.506,-0.506,-0.507,-0.507,-0.507,-0.507,-0.507,-0.508,-0.508, - &-0.508,-0.508,-0.508,-0.508,-0.508,-0.508,-0.508,-0.508,-0.508, - &-0.508,-0.507,-0.507,-0.507,-0.507,-0.507,-0.506,-0.506,-0.506, - &-0.506,-0.505,-0.505,-0.505,-0.504,-0.504,-0.503,-0.503,-0.502, - &-0.502,-0.501,-0.501,-0.500,-0.500,-0.499,-0.499,-0.498,-0.497, - &-0.497,-0.496,-0.495,-0.495,-0.494,-0.493,-0.493,-0.492,-0.491, - &-0.490,-0.489,-0.489,-0.488,-0.487,-0.486,-0.485,-0.485,-0.484, - &-0.483,-0.482,-0.481,-0.480,-0.479,-0.478,-0.477,-0.477,-0.476, - &-0.475,-0.474,-0.473,-0.472,-0.471,-0.470,-0.469,-0.468,-0.467, - &-0.466,-0.465,-0.464,-0.463,-0.462,-0.461,-0.460,-0.459,-0.459, - &-0.458,-0.457,-0.456,-0.455,-0.454,-0.453,-0.452,-0.451,-0.450, - &-0.449,-0.448,-0.447,-0.446,-0.445,-0.444,-0.443,-0.442,-0.441, - &-0.440,-0.439,-0.438,-0.437,-0.436,-0.435,-0.434,-0.433,-0.432, - &-0.431,-0.430,-0.429,-0.428,-0.427,-0.426,-0.425,-0.424,-0.423, - &-0.422,-0.421,-0.420,-0.419,-0.418,-0.417,-0.416,-0.415,-0.414, - &-0.413,-0.412,-0.411,-0.410,-0.409,-0.408,-0.407,-0.406,-0.405, - &-0.404,-0.403,-0.402,-0.401,-0.400,-0.399,-0.398,-0.397,-0.396, - &-0.395,-0.394,-0.393,-0.392,-0.391,-0.390,-0.389,-0.388,-0.387, - &-0.386,-0.385,-0.384,-0.383,-0.382,-0.382,-0.381,-0.380,-0.379, - &-0.378,-0.377,-0.376,-0.375,-0.374,-0.373,-0.372,-0.371,-0.370, - &-0.369,-0.368,-0.367,-0.366,-0.365,-0.364,-0.363,-0.362,-0.361, - &-0.360,-0.359,-0.359,-0.358,-0.357,-0.356,-0.355,-0.354,-0.353, - &-0.352,-0.351,-0.350,-0.349,-0.348,-0.347,-0.346,-0.345,-0.344, - &-0.344,-0.343,-0.342,-0.341,-0.340,-0.339,-0.338,-0.337,-0.336, - &-0.335,-0.334,-0.333,-0.332,-0.332,-0.331,-0.330,-0.329,-0.328, - &-0.327,-0.326,-0.325,-0.324,-0.323,-0.323,-0.322,-0.321,-0.320, - &-0.319,-0.318,-0.317,-0.316,-0.315,-0.314,-0.314,-0.313,-0.312, - &-0.311,-0.310,-0.309,-0.308,-0.307,-0.307,-0.306,-0.305,-0.304, - &-0.303,-0.302,-0.301,-0.300,-0.300,-0.299,-0.298,-0.297,-0.296, - &-0.295,-0.294,-0.294,-0.293,-0.292,-0.291,-0.290,-0.289,-0.288, - &-0.288,-0.287,-0.286,-0.285,-0.284,-0.283,-0.282,-0.282,-0.281, - &-0.280,-0.279,-0.278,-0.277,-0.277,-0.276,-0.275,-0.274,-0.273, - &-0.273,-0.272,-0.271,-0.270,-0.269,-0.268,-0.268,-0.267,-0.266, - &-0.265,-0.264,-0.263,-0.263,-0.262,-0.261,-0.260,-0.259,-0.259, - &-0.258,-0.257,-0.256,-0.255,-0.255,-0.254,-0.253,-0.252,-0.251, - &-0.251,-0.250,-0.249,-0.248,-0.248,-0.247,-0.246,-0.245,-0.244, - &-0.244,-0.243,-0.242,-0.241,-0.240,-0.240,-0.239,-0.238,-0.237, - &-0.237,-0.236,-0.235,-0.234,-0.234,-0.233,-0.232,-0.231,-0.230, - &-0.230,-0.229,-0.228,-0.227,-0.219,-0.212,-0.205,-0.198,-0.191, - &-0.184,-0.177,-0.170,-0.163,-0.157,-0.151,-0.144,-0.138,-0.132, - &-0.126,-0.120,-0.114,-0.108,-0.103,-0.097,-0.091,-0.086,-0.081, - &-0.075,-0.070,-0.065,-0.060,-0.055,-0.050,-0.045,-0.041,-0.036, - &-0.031,-0.027,-0.022,-0.018,-0.014,-0.009,-0.005,-0.001, 0.003, - & 0.007, 0.011, 0.015, 0.019, 0.023, 0.027, 0.031, 0.034, 0.038, - & 0.041, 0.045, 0.048, 0.052, 0.055, 0.059, 0.062, 0.065, 0.068, - & 0.071, 0.075, 0.078, 0.081, 0.084, 0.087, 0.089, 0.092, 0.095, - & 0.098, 0.101, 0.103, 0.106, 0.109, 0.111, 0.114, 0.116, 0.119, - & 0.121, 0.124, 0.126, 0.128, 0.131, 0.133, 0.135, 0.138, 0.140, - & 0.142, 0.144, 0.146, 0.148, 0.150, 0.152, 0.154, 0.156, 0.158, - & 0.160, 0.162, 0.164, 0.166, 0.167, 0.169, 0.171, 0.173, 0.174, - & 0.176, 0.178, 0.179, 0.181, 0.182, 0.184, 0.186, 0.187, 0.189, - & 0.190, 0.191, 0.193, 0.194, 0.196, 0.197, 0.198, 0.200, 0.201, - & 0.202, 0.203, 0.205, 0.206, 0.207, 0.208, 0.209, 0.210, 0.212, - & 0.213, 0.214, 0.215, 0.216, 0.217, 0.218, 0.219, 0.220, 0.221, - & 0.222, 0.222, 0.223, 0.224, 0.225, 0.226, 0.227, 0.228, 0.228, - & 0.229, 0.230, 0.231, 0.231, 0.232, 0.233, 0.234, 0.234, 0.235, - & 0.235, 0.236, 0.237 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.093,-0.193,-0.238,-0.267,-0.288,-0.304,-0.316,-0.326,-0.334, - &-0.340,-0.345,-0.350,-0.353,-0.355,-0.357,-0.359,-0.360,-0.360, - &-0.360,-0.360,-0.359,-0.358,-0.357,-0.356,-0.355,-0.353,-0.351, - &-0.349,-0.347,-0.345,-0.342,-0.340,-0.337,-0.335,-0.332,-0.329, - &-0.326,-0.323,-0.321,-0.317,-0.314,-0.311,-0.308,-0.305,-0.302, - &-0.299,-0.295,-0.292,-0.289,-0.286,-0.282,-0.279,-0.276,-0.272, - &-0.269,-0.266,-0.262,-0.259,-0.255,-0.252,-0.249,-0.245,-0.242, - &-0.238,-0.235,-0.231,-0.228,-0.224,-0.221,-0.217,-0.213,-0.210, - &-0.206,-0.203,-0.199,-0.195,-0.192,-0.188,-0.184,-0.180,-0.177, - &-0.173,-0.169,-0.165,-0.161,-0.157,-0.153,-0.149,-0.145,-0.141, - &-0.137,-0.133,-0.129,-0.125,-0.120,-0.116,-0.112,-0.108,-0.103, - &-0.099,-0.095,-0.090,-0.086,-0.081,-0.077,-0.073,-0.068,-0.064, - &-0.059,-0.054,-0.050,-0.045,-0.041,-0.036,-0.032,-0.027,-0.022, - &-0.018,-0.013,-0.008,-0.004, 0.001, 0.005, 0.010, 0.015, 0.019, - & 0.024, 0.029, 0.033, 0.038, 0.043, 0.048, 0.052, 0.057, 0.062, - & 0.066, 0.071, 0.076, 0.080, 0.085, 0.090, 0.094, 0.099, 0.103, - & 0.108, 0.113, 0.117, 0.122, 0.127, 0.131, 0.136, 0.141, 0.145, - & 0.150, 0.154, 0.159, 0.164, 0.168, 0.173, 0.177, 0.182, 0.186, - & 0.191, 0.196, 0.200, 0.205, 0.209, 0.214, 0.218, 0.223, 0.227, - & 0.232, 0.236, 0.241, 0.245, 0.250, 0.254, 0.259, 0.263, 0.268, - & 0.272, 0.277, 0.281, 0.286, 0.290, 0.294, 0.299, 0.303, 0.308, - & 0.312, 0.317, 0.321, 0.325, 0.330, 0.334, 0.338, 0.343, 0.347, - & 0.352, 0.356, 0.360, 0.365, 0.369, 0.373, 0.378, 0.382, 0.386, - & 0.390, 0.395, 0.399, 0.403, 0.408, 0.412, 0.416, 0.420, 0.425, - & 0.429, 0.433, 0.437, 0.442, 0.446, 0.450, 0.454, 0.458, 0.463, - & 0.467, 0.471, 0.475, 0.479, 0.483, 0.488, 0.492, 0.496, 0.500, - & 0.504, 0.508, 0.512, 0.516, 0.521, 0.525, 0.529, 0.533, 0.537, - & 0.541, 0.545, 0.549, 0.553, 0.557, 0.561, 0.565, 0.569, 0.573, - & 0.577, 0.581, 0.585, 0.589, 0.593, 0.597, 0.601, 0.605, 0.609, - & 0.613, 0.617, 0.621, 0.625, 0.629, 0.633, 0.637, 0.641, 0.644, - & 0.648, 0.652, 0.656, 0.660, 0.664, 0.668, 0.672, 0.675, 0.679, - & 0.683, 0.687, 0.691, 0.695, 0.698, 0.702, 0.706, 0.710, 0.714, - & 0.717, 0.721, 0.725, 0.729, 0.733, 0.736, 0.740, 0.744, 0.748, - & 0.751, 0.755, 0.759, 0.762, 0.766, 0.770, 0.774, 0.777, 0.781, - & 0.785, 0.788, 0.792, 0.796, 0.799, 0.803, 0.807, 0.810, 0.814, - & 0.818, 0.821, 0.825, 0.828, 0.832, 0.836, 0.839, 0.843, 0.846, - & 0.850, 0.853, 0.857, 0.861, 0.864, 0.868, 0.871, 0.875, 0.878, - & 0.882, 0.885, 0.889, 0.892, 0.896, 0.899, 0.903, 0.906, 0.910, - & 0.913, 0.917, 0.920, 0.924, 0.927, 0.931, 0.934, 0.938, 0.941, - & 0.944, 0.948, 0.951, 0.955, 0.958, 0.961, 0.965, 0.968, 0.972, - & 0.975, 0.978, 0.982, 0.985, 0.988, 0.992, 0.995, 0.999, 1.002, - & 1.005, 1.009, 1.012, 1.015, 1.018, 1.022, 1.025, 1.028, 1.032, - & 1.035, 1.038, 1.042, 1.045, 1.048, 1.051, 1.055, 1.058, 1.061, - & 1.064, 1.068, 1.071, 1.074, 1.077, 1.080, 1.084, 1.087, 1.090, - & 1.093, 1.096, 1.100, 1.103, 1.137, 1.168, 1.199, 1.229, 1.259, - & 1.288, 1.317, 1.345, 1.373, 1.401, 1.428, 1.455, 1.482, 1.508, - & 1.534, 1.559, 1.584, 1.609, 1.634, 1.658, 1.682, 1.706, 1.729, - & 1.752, 1.775, 1.797, 1.819, 1.841, 1.863, 1.884, 1.905, 1.926, - & 1.947, 1.967, 1.988, 2.008, 2.027, 2.047, 2.066, 2.085, 2.104, - & 2.123, 2.141, 2.160, 2.178, 2.196, 2.214, 2.231, 2.249, 2.266, - & 2.283, 2.300, 2.316, 2.333, 2.349, 2.365, 2.381, 2.397, 2.413, - & 2.429, 2.444, 2.459, 2.475, 2.490, 2.504, 2.519, 2.534, 2.548, - & 2.563, 2.577, 2.591, 2.605, 2.619, 2.632, 2.646, 2.659, 2.673, - & 2.686, 2.699, 2.712, 2.725, 2.738, 2.751, 2.763, 2.776, 2.788, - & 2.800, 2.813, 2.825, 2.837, 2.849, 2.860, 2.872, 2.884, 2.895, - & 2.907, 2.918, 2.929, 2.940, 2.952, 2.963, 2.973, 2.984, 2.995, - & 3.006, 3.016, 3.027, 3.037, 3.048, 3.058, 3.068, 3.078, 3.088, - & 3.098, 3.108, 3.118, 3.128, 3.137, 3.147, 3.157, 3.166, 3.176, - & 3.185, 3.194, 3.203, 3.213, 3.222, 3.231, 3.240, 3.249, 3.258, - & 3.266, 3.275, 3.284, 3.292, 3.301, 3.309, 3.318, 3.326, 3.335, - & 3.343, 3.351, 3.359, 3.368, 3.376, 3.384, 3.392, 3.399, 3.407, - & 3.415, 3.423, 3.431, 3.438, 3.446, 3.454, 3.461, 3.469, 3.476, - & 3.483, 3.491, 3.498 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.096,-0.208,-0.265,-0.305,-0.337,-0.363,-0.385,-0.405,-0.423, - &-0.439,-0.453,-0.467,-0.479,-0.491,-0.502,-0.512,-0.522,-0.531, - &-0.540,-0.548,-0.556,-0.564,-0.571,-0.578,-0.585,-0.592,-0.598, - &-0.605,-0.610,-0.616,-0.622,-0.627,-0.633,-0.638,-0.643,-0.648, - &-0.653,-0.657,-0.662,-0.666,-0.671,-0.675,-0.679,-0.683,-0.688, - &-0.691,-0.695,-0.699,-0.703,-0.707,-0.710,-0.714,-0.717,-0.721, - &-0.724,-0.727,-0.731,-0.734,-0.737,-0.740,-0.743,-0.746,-0.749, - &-0.752,-0.755,-0.758,-0.761,-0.763,-0.766,-0.769,-0.772,-0.774, - &-0.777,-0.780,-0.782,-0.785,-0.787,-0.790,-0.792,-0.795,-0.797, - &-0.799,-0.802,-0.804,-0.807,-0.809,-0.811,-0.814,-0.816,-0.818, - &-0.820,-0.823,-0.825,-0.827,-0.829,-0.831,-0.833,-0.836,-0.838, - &-0.840,-0.842,-0.844,-0.846,-0.848,-0.850,-0.852,-0.854,-0.856, - &-0.858,-0.860,-0.862,-0.864,-0.866,-0.868,-0.870,-0.872,-0.874, - &-0.875,-0.877,-0.879,-0.881,-0.883,-0.885,-0.887,-0.888,-0.890, - &-0.892,-0.894,-0.895,-0.897,-0.899,-0.901,-0.902,-0.904,-0.906, - &-0.908,-0.909,-0.911,-0.913,-0.914,-0.916,-0.918,-0.919,-0.921, - &-0.923,-0.924,-0.926,-0.927,-0.929,-0.931,-0.932,-0.934,-0.935, - &-0.937,-0.938,-0.940,-0.942,-0.943,-0.945,-0.946,-0.948,-0.949, - &-0.951,-0.952,-0.954,-0.955,-0.957,-0.958,-0.960,-0.961,-0.962, - &-0.964,-0.965,-0.967,-0.968,-0.970,-0.971,-0.972,-0.974,-0.975, - &-0.977,-0.978,-0.979,-0.981,-0.982,-0.984,-0.985,-0.986,-0.988, - &-0.989,-0.990,-0.992,-0.993,-0.994,-0.996,-0.997,-0.998,-1.000, - &-1.001,-1.002,-1.004,-1.005,-1.006,-1.007,-1.009,-1.010,-1.011, - &-1.013,-1.014,-1.015,-1.016,-1.018,-1.019,-1.020,-1.021,-1.023, - &-1.024,-1.025,-1.026,-1.027,-1.029,-1.030,-1.031,-1.032,-1.034, - &-1.035,-1.036,-1.037,-1.038,-1.039,-1.041,-1.042,-1.043,-1.044, - &-1.045,-1.047,-1.048,-1.049,-1.050,-1.051,-1.052,-1.053,-1.055, - &-1.056,-1.057,-1.058,-1.059,-1.060,-1.061,-1.063,-1.064,-1.065, - &-1.066,-1.067,-1.068,-1.069,-1.070,-1.071,-1.073,-1.074,-1.075, - &-1.076,-1.077,-1.078,-1.079,-1.080,-1.081,-1.082,-1.083,-1.084, - &-1.086,-1.087,-1.088,-1.089,-1.090,-1.091,-1.092,-1.093,-1.094, - &-1.095,-1.096,-1.097,-1.098,-1.099,-1.100,-1.101,-1.102,-1.103, - &-1.104,-1.105,-1.106,-1.107,-1.108,-1.109,-1.110,-1.111,-1.112, - &-1.114,-1.115,-1.116,-1.117,-1.118,-1.119,-1.119,-1.120,-1.121, - &-1.122,-1.123,-1.124,-1.125,-1.126,-1.127,-1.128,-1.129,-1.130, - &-1.131,-1.132,-1.133,-1.134,-1.135,-1.136,-1.137,-1.138,-1.139, - &-1.140,-1.141,-1.142,-1.143,-1.144,-1.145,-1.146,-1.147,-1.147, - &-1.148,-1.149,-1.150,-1.151,-1.152,-1.153,-1.154,-1.155,-1.156, - &-1.157,-1.158,-1.159,-1.160,-1.160,-1.161,-1.162,-1.163,-1.164, - &-1.165,-1.166,-1.167,-1.168,-1.169,-1.169,-1.170,-1.171,-1.172, - &-1.173,-1.174,-1.175,-1.176,-1.177,-1.178,-1.178,-1.179,-1.180, - &-1.181,-1.182,-1.183,-1.184,-1.185,-1.185,-1.186,-1.187,-1.188, - &-1.189,-1.190,-1.191,-1.191,-1.192,-1.193,-1.194,-1.195,-1.196, - &-1.197,-1.198,-1.198,-1.199,-1.200,-1.201,-1.202,-1.203,-1.203, - &-1.204,-1.205,-1.206,-1.207,-1.216,-1.224,-1.232,-1.240,-1.248, - &-1.256,-1.263,-1.271,-1.279,-1.286,-1.293,-1.301,-1.308,-1.315, - &-1.322,-1.329,-1.336,-1.343,-1.349,-1.356,-1.363,-1.369,-1.376, - &-1.382,-1.389,-1.395,-1.402,-1.408,-1.414,-1.420,-1.427,-1.433, - &-1.439,-1.445,-1.451,-1.457,-1.463,-1.468,-1.474,-1.480,-1.486, - &-1.492,-1.497,-1.503,-1.509,-1.514,-1.520,-1.525,-1.531,-1.536, - &-1.542,-1.547,-1.553,-1.558,-1.563,-1.569,-1.574,-1.579,-1.585, - &-1.590,-1.595,-1.600,-1.605,-1.611,-1.616,-1.621,-1.626,-1.631, - &-1.636,-1.641,-1.646,-1.651,-1.656,-1.661,-1.666,-1.671,-1.676, - &-1.681,-1.685,-1.690,-1.695,-1.700,-1.705,-1.710,-1.714,-1.719, - &-1.724,-1.729,-1.733,-1.738,-1.743,-1.747,-1.752,-1.757,-1.761, - &-1.766,-1.770,-1.775,-1.780,-1.784,-1.789,-1.793,-1.798,-1.802, - &-1.807,-1.811,-1.816,-1.820,-1.825,-1.829,-1.834,-1.838,-1.842, - &-1.847,-1.851,-1.856,-1.860,-1.864,-1.869,-1.873,-1.877,-1.882, - &-1.886,-1.890,-1.895,-1.899,-1.903,-1.908,-1.912,-1.916,-1.920, - &-1.925,-1.929,-1.933,-1.937,-1.941,-1.946,-1.950,-1.954,-1.958, - &-1.962,-1.966,-1.971,-1.975,-1.979,-1.983,-1.987,-1.991,-1.995, - &-2.000,-2.004,-2.008,-2.012,-2.016,-2.020,-2.024,-2.028,-2.032, - &-2.036,-2.040,-2.044 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.047,-0.099,-0.124,-0.141,-0.154,-0.165,-0.173,-0.181,-0.187, - &-0.193,-0.198,-0.202,-0.206,-0.209,-0.212,-0.215,-0.217,-0.220, - &-0.221,-0.223,-0.225,-0.226,-0.227,-0.228,-0.229,-0.229,-0.230, - &-0.230,-0.230,-0.230,-0.230,-0.230,-0.230,-0.229,-0.229,-0.228, - &-0.228,-0.227,-0.226,-0.225,-0.224,-0.223,-0.222,-0.221,-0.220, - &-0.218,-0.217,-0.215,-0.214,-0.212,-0.210,-0.209,-0.207,-0.205, - &-0.203,-0.201,-0.199,-0.197,-0.195,-0.193,-0.191,-0.189,-0.187, - &-0.185,-0.182,-0.180,-0.178,-0.175,-0.173,-0.171,-0.168,-0.166, - &-0.163,-0.160,-0.158,-0.155,-0.153,-0.150,-0.147,-0.144,-0.142, - &-0.139,-0.136,-0.133,-0.130,-0.127,-0.124,-0.121,-0.118,-0.115, - &-0.112,-0.109,-0.106,-0.103,-0.100,-0.097,-0.094,-0.091,-0.087, - &-0.084,-0.081,-0.078,-0.074,-0.071,-0.068,-0.064,-0.061,-0.058, - &-0.054,-0.051,-0.047,-0.044,-0.041,-0.037,-0.034,-0.030,-0.027, - &-0.023,-0.020,-0.017,-0.013,-0.010,-0.006,-0.003, 0.001, 0.004, - & 0.008, 0.011, 0.015, 0.018, 0.021, 0.025, 0.028, 0.032, 0.035, - & 0.039, 0.042, 0.046, 0.049, 0.052, 0.056, 0.059, 0.063, 0.066, - & 0.069, 0.073, 0.076, 0.079, 0.083, 0.086, 0.090, 0.093, 0.096, - & 0.100, 0.103, 0.106, 0.110, 0.113, 0.116, 0.119, 0.123, 0.126, - & 0.129, 0.133, 0.136, 0.139, 0.142, 0.146, 0.149, 0.152, 0.155, - & 0.158, 0.162, 0.165, 0.168, 0.171, 0.174, 0.177, 0.181, 0.184, - & 0.187, 0.190, 0.193, 0.196, 0.199, 0.203, 0.206, 0.209, 0.212, - & 0.215, 0.218, 0.221, 0.224, 0.227, 0.230, 0.233, 0.236, 0.239, - & 0.242, 0.245, 0.248, 0.251, 0.254, 0.257, 0.260, 0.263, 0.266, - & 0.269, 0.272, 0.275, 0.278, 0.281, 0.284, 0.287, 0.290, 0.292, - & 0.295, 0.298, 0.301, 0.304, 0.307, 0.310, 0.313, 0.315, 0.318, - & 0.321, 0.324, 0.327, 0.330, 0.332, 0.335, 0.338, 0.341, 0.343, - & 0.346, 0.349, 0.352, 0.355, 0.357, 0.360, 0.363, 0.366, 0.368, - & 0.371, 0.374, 0.376, 0.379, 0.382, 0.384, 0.387, 0.390, 0.393, - & 0.395, 0.398, 0.400, 0.403, 0.406, 0.408, 0.411, 0.414, 0.416, - & 0.419, 0.422, 0.424, 0.427, 0.429, 0.432, 0.434, 0.437, 0.440, - & 0.442, 0.445, 0.447, 0.450, 0.452, 0.455, 0.457, 0.460, 0.463, - & 0.465, 0.468, 0.470, 0.473, 0.475, 0.478, 0.480, 0.483, 0.485, - & 0.487, 0.490, 0.492, 0.495, 0.497, 0.500, 0.502, 0.505, 0.507, - & 0.509, 0.512, 0.514, 0.517, 0.519, 0.522, 0.524, 0.526, 0.529, - & 0.531, 0.533, 0.536, 0.538, 0.541, 0.543, 0.545, 0.548, 0.550, - & 0.552, 0.555, 0.557, 0.559, 0.562, 0.564, 0.566, 0.569, 0.571, - & 0.573, 0.575, 0.578, 0.580, 0.582, 0.585, 0.587, 0.589, 0.591, - & 0.594, 0.596, 0.598, 0.600, 0.603, 0.605, 0.607, 0.609, 0.612, - & 0.614, 0.616, 0.618, 0.621, 0.623, 0.625, 0.627, 0.629, 0.632, - & 0.634, 0.636, 0.638, 0.640, 0.642, 0.645, 0.647, 0.649, 0.651, - & 0.653, 0.655, 0.658, 0.660, 0.662, 0.664, 0.666, 0.668, 0.670, - & 0.672, 0.675, 0.677, 0.679, 0.681, 0.683, 0.685, 0.687, 0.689, - & 0.691, 0.693, 0.695, 0.698, 0.700, 0.702, 0.704, 0.706, 0.708, - & 0.710, 0.712, 0.714, 0.716, 0.718, 0.720, 0.722, 0.724, 0.726, - & 0.728, 0.730, 0.732, 0.734, 0.756, 0.775, 0.795, 0.814, 0.832, - & 0.851, 0.869, 0.886, 0.904, 0.921, 0.938, 0.955, 0.972, 0.988, - & 1.004, 1.020, 1.036, 1.051, 1.066, 1.081, 1.096, 1.111, 1.125, - & 1.140, 1.154, 1.168, 1.181, 1.195, 1.208, 1.222, 1.235, 1.248, - & 1.261, 1.273, 1.286, 1.298, 1.311, 1.323, 1.335, 1.347, 1.358, - & 1.370, 1.381, 1.393, 1.404, 1.415, 1.426, 1.437, 1.448, 1.459, - & 1.469, 1.480, 1.490, 1.500, 1.510, 1.521, 1.531, 1.540, 1.550, - & 1.560, 1.570, 1.579, 1.589, 1.598, 1.607, 1.616, 1.625, 1.635, - & 1.643, 1.652, 1.661, 1.670, 1.679, 1.687, 1.696, 1.704, 1.712, - & 1.721, 1.729, 1.737, 1.745, 1.753, 1.761, 1.769, 1.777, 1.785, - & 1.792, 1.800, 1.808, 1.815, 1.823, 1.830, 1.838, 1.845, 1.852, - & 1.859, 1.866, 1.874, 1.881, 1.888, 1.895, 1.901, 1.908, 1.915, - & 1.922, 1.929, 1.935, 1.942, 1.948, 1.955, 1.961, 1.968, 1.974, - & 1.980, 1.987, 1.993, 1.999, 2.005, 2.011, 2.018, 2.024, 2.030, - & 2.036, 2.041, 2.047, 2.053, 2.059, 2.065, 2.070, 2.076, 2.082, - & 2.087, 2.093, 2.099, 2.104, 2.110, 2.115, 2.120, 2.126, 2.131, - & 2.136, 2.142, 2.147, 2.152, 2.157, 2.163, 2.168, 2.173, 2.178, - & 2.183, 2.188, 2.193, 2.198, 2.203, 2.208, 2.212, 2.217, 2.222, - & 2.227, 2.232, 2.236 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.049,-0.112,-0.147,-0.173,-0.194,-0.213,-0.230,-0.245,-0.259, - &-0.272,-0.285,-0.297,-0.308,-0.319,-0.329,-0.339,-0.348,-0.358, - &-0.367,-0.376,-0.384,-0.392,-0.401,-0.408,-0.416,-0.424,-0.431, - &-0.439,-0.446,-0.453,-0.460,-0.466,-0.473,-0.479,-0.486,-0.492, - &-0.498,-0.504,-0.510,-0.516,-0.522,-0.528,-0.533,-0.539,-0.544, - &-0.550,-0.555,-0.560,-0.565,-0.571,-0.576,-0.580,-0.585,-0.590, - &-0.595,-0.600,-0.604,-0.609,-0.613,-0.618,-0.622,-0.627,-0.631, - &-0.635,-0.640,-0.644,-0.648,-0.652,-0.656,-0.660,-0.664,-0.668, - &-0.672,-0.676,-0.680,-0.684,-0.688,-0.692,-0.696,-0.700,-0.704, - &-0.707,-0.711,-0.715,-0.719,-0.722,-0.726,-0.730,-0.734,-0.737, - &-0.741,-0.745,-0.748,-0.752,-0.755,-0.759,-0.763,-0.766,-0.770, - &-0.773,-0.777,-0.780,-0.784,-0.788,-0.791,-0.795,-0.798,-0.801, - &-0.805,-0.808,-0.812,-0.815,-0.819,-0.822,-0.825,-0.829,-0.832, - &-0.835,-0.839,-0.842,-0.845,-0.849,-0.852,-0.855,-0.858,-0.862, - &-0.865,-0.868,-0.871,-0.874,-0.878,-0.881,-0.884,-0.887,-0.890, - &-0.893,-0.896,-0.899,-0.902,-0.905,-0.908,-0.911,-0.914,-0.917, - &-0.920,-0.923,-0.926,-0.929,-0.932,-0.935,-0.937,-0.940,-0.943, - &-0.946,-0.949,-0.951,-0.954,-0.957,-0.960,-0.963,-0.965,-0.968, - &-0.971,-0.973,-0.976,-0.979,-0.981,-0.984,-0.987,-0.989,-0.992, - &-0.994,-0.997,-0.999,-1.002,-1.005,-1.007,-1.010,-1.012,-1.015, - &-1.017,-1.020,-1.022,-1.024,-1.027,-1.029,-1.032,-1.034,-1.036, - &-1.039,-1.041,-1.044,-1.046,-1.048,-1.051,-1.053,-1.055,-1.057, - &-1.060,-1.062,-1.064,-1.067,-1.069,-1.071,-1.073,-1.075,-1.078, - &-1.080,-1.082,-1.084,-1.086,-1.089,-1.091,-1.093,-1.095,-1.097, - &-1.099,-1.101,-1.103,-1.106,-1.108,-1.110,-1.112,-1.114,-1.116, - &-1.118,-1.120,-1.122,-1.124,-1.126,-1.128,-1.130,-1.132,-1.134, - &-1.136,-1.138,-1.140,-1.142,-1.144,-1.145,-1.147,-1.149,-1.151, - &-1.153,-1.155,-1.157,-1.159,-1.160,-1.162,-1.164,-1.166,-1.168, - &-1.170,-1.171,-1.173,-1.175,-1.177,-1.179,-1.180,-1.182,-1.184, - &-1.186,-1.187,-1.189,-1.191,-1.193,-1.194,-1.196,-1.198,-1.199, - &-1.201,-1.203,-1.205,-1.206,-1.208,-1.210,-1.211,-1.213,-1.214, - &-1.216,-1.218,-1.219,-1.221,-1.223,-1.224,-1.226,-1.227,-1.229, - &-1.231,-1.232,-1.234,-1.235,-1.237,-1.238,-1.240,-1.241,-1.243, - &-1.244,-1.246,-1.248,-1.249,-1.251,-1.252,-1.254,-1.255,-1.256, - &-1.258,-1.259,-1.261,-1.262,-1.264,-1.265,-1.267,-1.268,-1.270, - &-1.271,-1.272,-1.274,-1.275,-1.277,-1.278,-1.279,-1.281,-1.282, - &-1.284,-1.285,-1.286,-1.288,-1.289,-1.290,-1.292,-1.293,-1.294, - &-1.296,-1.297,-1.298,-1.300,-1.301,-1.302,-1.304,-1.305,-1.306, - &-1.308,-1.309,-1.310,-1.311,-1.313,-1.314,-1.315,-1.316,-1.318, - &-1.319,-1.320,-1.321,-1.323,-1.324,-1.325,-1.326,-1.328,-1.329, - &-1.330,-1.331,-1.332,-1.334,-1.335,-1.336,-1.337,-1.338,-1.340, - &-1.341,-1.342,-1.343,-1.344,-1.345,-1.347,-1.348,-1.349,-1.350, - &-1.351,-1.352,-1.353,-1.355,-1.356,-1.357,-1.358,-1.359,-1.360, - &-1.361,-1.362,-1.364,-1.365,-1.366,-1.367,-1.368,-1.369,-1.370, - &-1.371,-1.372,-1.373,-1.374,-1.386,-1.396,-1.405,-1.415,-1.424, - &-1.433,-1.442,-1.450,-1.458,-1.466,-1.474,-1.482,-1.489,-1.496, - &-1.503,-1.510,-1.516,-1.523,-1.529,-1.535,-1.541,-1.547,-1.553, - &-1.558,-1.564,-1.569,-1.574,-1.580,-1.585,-1.589,-1.594,-1.599, - &-1.604,-1.608,-1.613,-1.617,-1.621,-1.626,-1.630,-1.634,-1.638, - &-1.642,-1.646,-1.650,-1.654,-1.657,-1.661,-1.665,-1.668,-1.672, - &-1.675,-1.679,-1.682,-1.685,-1.689,-1.692,-1.695,-1.698,-1.701, - &-1.705,-1.708,-1.711,-1.714,-1.717,-1.720,-1.723,-1.725,-1.728, - &-1.731,-1.734,-1.737,-1.739,-1.742,-1.745,-1.748,-1.750,-1.753, - &-1.755,-1.758,-1.761,-1.763,-1.766,-1.768,-1.771,-1.773,-1.776, - &-1.778,-1.781,-1.783,-1.785,-1.788,-1.790,-1.792,-1.795,-1.797, - &-1.799,-1.802,-1.804,-1.806,-1.809,-1.811,-1.813,-1.815,-1.817, - &-1.820,-1.822,-1.824,-1.826,-1.828,-1.830,-1.833,-1.835,-1.837, - &-1.839,-1.841,-1.843,-1.845,-1.847,-1.849,-1.851,-1.854,-1.856, - &-1.858,-1.860,-1.862,-1.864,-1.866,-1.868,-1.870,-1.872,-1.874, - &-1.876,-1.878,-1.880,-1.881,-1.883,-1.885,-1.887,-1.889,-1.891, - &-1.893,-1.895,-1.897,-1.899,-1.901,-1.903,-1.905,-1.906,-1.908, - &-1.910,-1.912,-1.914,-1.916,-1.918,-1.919,-1.921,-1.923,-1.925, - &-1.927,-1.929,-1.930 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.047,-0.100,-0.126,-0.143,-0.156,-0.167,-0.176,-0.183,-0.190, - &-0.195,-0.200,-0.205,-0.209,-0.212,-0.215,-0.218,-0.221,-0.224, - &-0.226,-0.228,-0.230,-0.232,-0.233,-0.235,-0.236,-0.238,-0.239, - &-0.240,-0.241,-0.242,-0.243,-0.244,-0.245,-0.246,-0.246,-0.247, - &-0.248,-0.248,-0.249,-0.249,-0.250,-0.250,-0.251,-0.251,-0.251, - &-0.252,-0.252,-0.252,-0.253,-0.253,-0.253,-0.253,-0.254,-0.254, - &-0.254,-0.254,-0.254,-0.254,-0.254,-0.255,-0.255,-0.255,-0.255, - &-0.255,-0.255,-0.255,-0.255,-0.255,-0.255,-0.255,-0.255,-0.255, - &-0.255,-0.255,-0.255,-0.255,-0.255,-0.255,-0.254,-0.254,-0.254, - &-0.254,-0.254,-0.254,-0.254,-0.253,-0.253,-0.253,-0.253,-0.253, - &-0.252,-0.252,-0.252,-0.252,-0.251,-0.251,-0.251,-0.250,-0.250, - &-0.250,-0.249,-0.249,-0.249,-0.248,-0.248,-0.248,-0.247,-0.247, - &-0.247,-0.246,-0.246,-0.245,-0.245,-0.245,-0.244,-0.244,-0.243, - &-0.243,-0.243,-0.242,-0.242,-0.241,-0.241,-0.240,-0.240,-0.240, - &-0.239,-0.239,-0.238,-0.238,-0.237,-0.237,-0.236,-0.236,-0.235, - &-0.235,-0.234,-0.234,-0.234,-0.233,-0.233,-0.232,-0.232,-0.231, - &-0.231,-0.230,-0.230,-0.229,-0.229,-0.228,-0.228,-0.227,-0.227, - &-0.226,-0.226,-0.225,-0.225,-0.224,-0.224,-0.224,-0.223,-0.223, - &-0.222,-0.222,-0.221,-0.221,-0.220,-0.220,-0.219,-0.219,-0.218, - &-0.218,-0.217,-0.217,-0.216,-0.216,-0.215,-0.215,-0.214,-0.214, - &-0.213,-0.213,-0.212,-0.212,-0.211,-0.211,-0.210,-0.210,-0.209, - &-0.209,-0.208,-0.208,-0.207,-0.207,-0.207,-0.206,-0.206,-0.205, - &-0.205,-0.204,-0.204,-0.203,-0.203,-0.202,-0.202,-0.201,-0.201, - &-0.200,-0.200,-0.199,-0.199,-0.198,-0.198,-0.197,-0.197,-0.196, - &-0.196,-0.195,-0.195,-0.194,-0.194,-0.194,-0.193,-0.193,-0.192, - &-0.192,-0.191,-0.191,-0.190,-0.190,-0.189,-0.189,-0.188,-0.188, - &-0.187,-0.187,-0.186,-0.186,-0.186,-0.185,-0.185,-0.184,-0.184, - &-0.183,-0.183,-0.182,-0.182,-0.181,-0.181,-0.180,-0.180,-0.180, - &-0.179,-0.179,-0.178,-0.178,-0.177,-0.177,-0.176,-0.176,-0.175, - &-0.175,-0.174,-0.174,-0.174,-0.173,-0.173,-0.172,-0.172,-0.171, - &-0.171,-0.170,-0.170,-0.170,-0.169,-0.169,-0.168,-0.168,-0.167, - &-0.167,-0.166,-0.166,-0.166,-0.165,-0.165,-0.164,-0.164,-0.163, - &-0.163,-0.162,-0.162,-0.162,-0.161,-0.161,-0.160,-0.160,-0.159, - &-0.159,-0.159,-0.158,-0.158,-0.157,-0.157,-0.156,-0.156,-0.156, - &-0.155,-0.155,-0.154,-0.154,-0.153,-0.153,-0.153,-0.152,-0.152, - &-0.151,-0.151,-0.150,-0.150,-0.150,-0.149,-0.149,-0.148,-0.148, - &-0.148,-0.147,-0.147,-0.146,-0.146,-0.145,-0.145,-0.145,-0.144, - &-0.144,-0.143,-0.143,-0.143,-0.142,-0.142,-0.141,-0.141,-0.141, - &-0.140,-0.140,-0.139,-0.139,-0.139,-0.138,-0.138,-0.137,-0.137, - &-0.137,-0.136,-0.136,-0.135,-0.135,-0.135,-0.134,-0.134,-0.133, - &-0.133,-0.133,-0.132,-0.132,-0.131,-0.131,-0.131,-0.130,-0.130, - &-0.129,-0.129,-0.129,-0.128,-0.128,-0.128,-0.127,-0.127,-0.126, - &-0.126,-0.126,-0.125,-0.125,-0.124,-0.124,-0.124,-0.123,-0.123, - &-0.123,-0.122,-0.122,-0.121,-0.121,-0.121,-0.120,-0.120,-0.120, - &-0.119,-0.119,-0.118,-0.118,-0.114,-0.111,-0.107,-0.103,-0.100, - &-0.097,-0.093,-0.090,-0.087,-0.084,-0.080,-0.077,-0.074,-0.071, - &-0.068,-0.065,-0.063,-0.060,-0.057,-0.054,-0.052,-0.049,-0.046, - &-0.044,-0.041,-0.039,-0.036,-0.034,-0.031,-0.029,-0.027,-0.024, - &-0.022,-0.020,-0.018,-0.016,-0.013,-0.011,-0.009,-0.007,-0.005, - &-0.003,-0.001, 0.001, 0.003, 0.004, 0.006, 0.008, 0.010, 0.012, - & 0.013, 0.015, 0.017, 0.018, 0.020, 0.022, 0.023, 0.025, 0.026, - & 0.028, 0.030, 0.031, 0.032, 0.034, 0.035, 0.037, 0.038, 0.040, - & 0.041, 0.042, 0.044, 0.045, 0.046, 0.047, 0.049, 0.050, 0.051, - & 0.052, 0.053, 0.055, 0.056, 0.057, 0.058, 0.059, 0.060, 0.061, - & 0.062, 0.063, 0.064, 0.065, 0.066, 0.067, 0.068, 0.069, 0.070, - & 0.071, 0.072, 0.073, 0.074, 0.075, 0.075, 0.076, 0.077, 0.078, - & 0.079, 0.079, 0.080, 0.081, 0.082, 0.083, 0.083, 0.084, 0.085, - & 0.085, 0.086, 0.087, 0.087, 0.088, 0.089, 0.089, 0.090, 0.091, - & 0.091, 0.092, 0.092, 0.093, 0.094, 0.094, 0.095, 0.095, 0.096, - & 0.096, 0.097, 0.097, 0.098, 0.098, 0.099, 0.099, 0.100, 0.100, - & 0.100, 0.101, 0.101, 0.102, 0.102, 0.103, 0.103, 0.103, 0.104, - & 0.104, 0.104, 0.105, 0.105, 0.105, 0.106, 0.106, 0.106, 0.107, - & 0.107, 0.107, 0.108 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.190,-0.411,-0.520,-0.597,-0.656,-0.705,-0.746,-0.782,-0.814, - &-0.843,-0.868,-0.892,-0.914,-0.934,-0.953,-0.970,-0.986,-1.002, - &-1.016,-1.030,-1.043,-1.056,-1.068,-1.079,-1.090,-1.100,-1.110, - &-1.120,-1.129,-1.138,-1.147,-1.155,-1.163,-1.171,-1.178,-1.186, - &-1.193,-1.200,-1.206,-1.213,-1.219,-1.225,-1.231,-1.237,-1.243, - &-1.249,-1.254,-1.260,-1.265,-1.270,-1.275,-1.280,-1.285,-1.289, - &-1.294,-1.299,-1.303,-1.307,-1.312,-1.316,-1.320,-1.324,-1.328, - &-1.332,-1.336,-1.340,-1.344,-1.347,-1.351,-1.354,-1.358,-1.361, - &-1.365,-1.368,-1.372,-1.375,-1.378,-1.381,-1.384,-1.387,-1.390, - &-1.393,-1.396,-1.399,-1.402,-1.405,-1.408,-1.411,-1.413,-1.416, - &-1.419,-1.421,-1.424,-1.426,-1.429,-1.431,-1.434,-1.436,-1.439, - &-1.441,-1.443,-1.446,-1.448,-1.450,-1.452,-1.455,-1.457,-1.459, - &-1.461,-1.463,-1.465,-1.467,-1.469,-1.471,-1.473,-1.475,-1.477, - &-1.479,-1.481,-1.483,-1.485,-1.487,-1.489,-1.491,-1.493,-1.494, - &-1.496,-1.498,-1.500,-1.501,-1.503,-1.505,-1.507,-1.508,-1.510, - &-1.512,-1.513,-1.515,-1.517,-1.518,-1.520,-1.521,-1.523,-1.525, - &-1.526,-1.528,-1.529,-1.531,-1.532,-1.534,-1.535,-1.537,-1.538, - &-1.540,-1.541,-1.543,-1.544,-1.546,-1.547,-1.548,-1.550,-1.551, - &-1.553,-1.554,-1.555,-1.557,-1.558,-1.559,-1.561,-1.562,-1.563, - &-1.565,-1.566,-1.567,-1.569,-1.570,-1.571,-1.573,-1.574,-1.575, - &-1.576,-1.578,-1.579,-1.580,-1.581,-1.583,-1.584,-1.585,-1.586, - &-1.587,-1.589,-1.590,-1.591,-1.592,-1.593,-1.594,-1.596,-1.597, - &-1.598,-1.599,-1.600,-1.601,-1.603,-1.604,-1.605,-1.606,-1.607, - &-1.608,-1.609,-1.610,-1.611,-1.613,-1.614,-1.615,-1.616,-1.617, - &-1.618,-1.619,-1.620,-1.621,-1.622,-1.623,-1.624,-1.625,-1.626, - &-1.627,-1.628,-1.630,-1.631,-1.632,-1.633,-1.634,-1.635,-1.636, - &-1.637,-1.638,-1.639,-1.640,-1.641,-1.642,-1.643,-1.644,-1.645, - &-1.646,-1.647,-1.647,-1.648,-1.649,-1.650,-1.651,-1.652,-1.653, - &-1.654,-1.655,-1.656,-1.657,-1.658,-1.659,-1.660,-1.661,-1.662, - &-1.663,-1.664,-1.664,-1.665,-1.666,-1.667,-1.668,-1.669,-1.670, - &-1.671,-1.672,-1.673,-1.674,-1.674,-1.675,-1.676,-1.677,-1.678, - &-1.679,-1.680,-1.681,-1.682,-1.682,-1.683,-1.684,-1.685,-1.686, - &-1.687,-1.688,-1.688,-1.689,-1.690,-1.691,-1.692,-1.693,-1.694, - &-1.694,-1.695,-1.696,-1.697,-1.698,-1.699,-1.700,-1.700,-1.701, - &-1.702,-1.703,-1.704,-1.705,-1.705,-1.706,-1.707,-1.708,-1.709, - &-1.709,-1.710,-1.711,-1.712,-1.713,-1.713,-1.714,-1.715,-1.716, - &-1.717,-1.718,-1.718,-1.719,-1.720,-1.721,-1.722,-1.722,-1.723, - &-1.724,-1.725,-1.725,-1.726,-1.727,-1.728,-1.729,-1.729,-1.730, - &-1.731,-1.732,-1.733,-1.733,-1.734,-1.735,-1.736,-1.736,-1.737, - &-1.738,-1.739,-1.739,-1.740,-1.741,-1.742,-1.743,-1.743,-1.744, - &-1.745,-1.746,-1.746,-1.747,-1.748,-1.749,-1.749,-1.750,-1.751, - &-1.752,-1.752,-1.753,-1.754,-1.755,-1.755,-1.756,-1.757,-1.758, - &-1.758,-1.759,-1.760,-1.760,-1.761,-1.762,-1.763,-1.763,-1.764, - &-1.765,-1.766,-1.766,-1.767,-1.768,-1.769,-1.769,-1.770,-1.771, - &-1.771,-1.772,-1.773,-1.774,-1.781,-1.788,-1.795,-1.802,-1.809, - &-1.816,-1.823,-1.830,-1.836,-1.843,-1.849,-1.856,-1.862,-1.869, - &-1.875,-1.882,-1.888,-1.894,-1.901,-1.907,-1.913,-1.919,-1.926, - &-1.932,-1.938,-1.944,-1.950,-1.956,-1.962,-1.968,-1.974,-1.981, - &-1.987,-1.993,-1.999,-2.004,-2.010,-2.016,-2.022,-2.028,-2.034, - &-2.040,-2.046,-2.052,-2.058,-2.064,-2.069,-2.075,-2.081,-2.087, - &-2.093,-2.099,-2.104,-2.110,-2.116,-2.122,-2.128,-2.133,-2.139, - &-2.145,-2.151,-2.157,-2.162,-2.168,-2.174,-2.180,-2.185,-2.191, - &-2.197,-2.202,-2.208,-2.214,-2.220,-2.225,-2.231,-2.237,-2.242, - &-2.248,-2.254,-2.260,-2.265,-2.271,-2.277,-2.282,-2.288,-2.294, - &-2.299,-2.305,-2.311,-2.316,-2.322,-2.328,-2.333,-2.339,-2.345, - &-2.350,-2.356,-2.361,-2.367,-2.373,-2.378,-2.384,-2.390,-2.395, - &-2.401,-2.407,-2.412,-2.418,-2.423,-2.429,-2.435,-2.440,-2.446, - &-2.452,-2.457,-2.463,-2.468,-2.474,-2.480,-2.485,-2.491,-2.496, - &-2.502,-2.508,-2.513,-2.519,-2.524,-2.530,-2.536,-2.541,-2.547, - &-2.552,-2.558,-2.564,-2.569,-2.575,-2.580,-2.586,-2.592,-2.597, - &-2.603,-2.608,-2.614,-2.620,-2.625,-2.631,-2.636,-2.642,-2.647, - &-2.653,-2.659,-2.664,-2.670,-2.675,-2.681,-2.686,-2.692,-2.698, - &-2.703,-2.709,-2.714 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.093,-0.193,-0.238,-0.268,-0.289,-0.305,-0.318,-0.328,-0.336, - &-0.343,-0.348,-0.352,-0.356,-0.359,-0.361,-0.362,-0.364,-0.364, - &-0.364,-0.364,-0.364,-0.364,-0.363,-0.362,-0.360,-0.359,-0.357, - &-0.355,-0.354,-0.352,-0.349,-0.347,-0.345,-0.342,-0.340,-0.337, - &-0.335,-0.332,-0.329,-0.326,-0.324,-0.321,-0.318,-0.315,-0.312, - &-0.309,-0.306,-0.303,-0.300,-0.297,-0.294,-0.290,-0.287,-0.284, - &-0.281,-0.278,-0.275,-0.271,-0.268,-0.265,-0.262,-0.258,-0.255, - &-0.252,-0.249,-0.245,-0.242,-0.239,-0.235,-0.232,-0.229,-0.225, - &-0.222,-0.218,-0.215,-0.211,-0.208,-0.204,-0.201,-0.197,-0.194, - &-0.190,-0.186,-0.183,-0.179,-0.175,-0.172,-0.168,-0.164,-0.160, - &-0.156,-0.152,-0.148,-0.144,-0.140,-0.136,-0.132,-0.128,-0.124, - &-0.120,-0.116,-0.112,-0.107,-0.103,-0.099,-0.095,-0.090,-0.086, - &-0.082,-0.078,-0.073,-0.069,-0.065,-0.060,-0.056,-0.051,-0.047, - &-0.043,-0.038,-0.034,-0.029,-0.025,-0.020,-0.016,-0.011,-0.007, - &-0.003, 0.002, 0.006, 0.011, 0.015, 0.020, 0.024, 0.029, 0.033, - & 0.038, 0.042, 0.046, 0.051, 0.055, 0.060, 0.064, 0.069, 0.073, - & 0.078, 0.082, 0.086, 0.091, 0.095, 0.100, 0.104, 0.109, 0.113, - & 0.117, 0.122, 0.126, 0.130, 0.135, 0.139, 0.144, 0.148, 0.152, - & 0.157, 0.161, 0.165, 0.170, 0.174, 0.178, 0.183, 0.187, 0.191, - & 0.196, 0.200, 0.204, 0.209, 0.213, 0.217, 0.221, 0.226, 0.230, - & 0.234, 0.239, 0.243, 0.247, 0.251, 0.256, 0.260, 0.264, 0.268, - & 0.272, 0.277, 0.281, 0.285, 0.289, 0.293, 0.298, 0.302, 0.306, - & 0.310, 0.314, 0.318, 0.323, 0.327, 0.331, 0.335, 0.339, 0.343, - & 0.347, 0.351, 0.355, 0.360, 0.364, 0.368, 0.372, 0.376, 0.380, - & 0.384, 0.388, 0.392, 0.396, 0.400, 0.404, 0.408, 0.412, 0.416, - & 0.420, 0.424, 0.428, 0.432, 0.436, 0.440, 0.444, 0.448, 0.452, - & 0.456, 0.460, 0.464, 0.468, 0.472, 0.475, 0.479, 0.483, 0.487, - & 0.491, 0.495, 0.499, 0.503, 0.507, 0.510, 0.514, 0.518, 0.522, - & 0.526, 0.530, 0.533, 0.537, 0.541, 0.545, 0.549, 0.552, 0.556, - & 0.560, 0.564, 0.568, 0.571, 0.575, 0.579, 0.583, 0.586, 0.590, - & 0.594, 0.598, 0.601, 0.605, 0.609, 0.612, 0.616, 0.620, 0.623, - & 0.627, 0.631, 0.634, 0.638, 0.642, 0.645, 0.649, 0.653, 0.656, - & 0.660, 0.664, 0.667, 0.671, 0.674, 0.678, 0.682, 0.685, 0.689, - & 0.692, 0.696, 0.699, 0.703, 0.707, 0.710, 0.714, 0.717, 0.721, - & 0.724, 0.728, 0.731, 0.735, 0.738, 0.742, 0.745, 0.749, 0.752, - & 0.756, 0.759, 0.763, 0.766, 0.769, 0.773, 0.776, 0.780, 0.783, - & 0.787, 0.790, 0.793, 0.797, 0.800, 0.804, 0.807, 0.810, 0.814, - & 0.817, 0.821, 0.824, 0.827, 0.831, 0.834, 0.837, 0.841, 0.844, - & 0.847, 0.851, 0.854, 0.857, 0.861, 0.864, 0.867, 0.870, 0.874, - & 0.877, 0.880, 0.884, 0.887, 0.890, 0.893, 0.897, 0.900, 0.903, - & 0.906, 0.910, 0.913, 0.916, 0.919, 0.922, 0.926, 0.929, 0.932, - & 0.935, 0.938, 0.942, 0.945, 0.948, 0.951, 0.954, 0.957, 0.961, - & 0.964, 0.967, 0.970, 0.973, 0.976, 0.979, 0.983, 0.986, 0.989, - & 0.992, 0.995, 0.998, 1.001, 1.004, 1.007, 1.010, 1.013, 1.016, - & 1.020, 1.023, 1.026, 1.029, 1.061, 1.091, 1.120, 1.149, 1.178, - & 1.206, 1.233, 1.261, 1.288, 1.314, 1.340, 1.366, 1.391, 1.417, - & 1.441, 1.466, 1.490, 1.514, 1.537, 1.560, 1.583, 1.606, 1.628, - & 1.650, 1.672, 1.694, 1.715, 1.736, 1.757, 1.777, 1.797, 1.817, - & 1.837, 1.857, 1.876, 1.895, 1.914, 1.933, 1.951, 1.970, 1.988, - & 2.006, 2.023, 2.041, 2.058, 2.075, 2.092, 2.109, 2.126, 2.142, - & 2.159, 2.175, 2.191, 2.207, 2.222, 2.238, 2.253, 2.268, 2.283, - & 2.298, 2.313, 2.328, 2.342, 2.357, 2.371, 2.385, 2.399, 2.413, - & 2.426, 2.440, 2.453, 2.467, 2.480, 2.493, 2.506, 2.519, 2.532, - & 2.545, 2.557, 2.570, 2.582, 2.594, 2.606, 2.618, 2.630, 2.642, - & 2.654, 2.666, 2.677, 2.689, 2.700, 2.711, 2.722, 2.733, 2.744, - & 2.755, 2.766, 2.777, 2.788, 2.798, 2.809, 2.819, 2.829, 2.840, - & 2.850, 2.860, 2.870, 2.880, 2.890, 2.900, 2.909, 2.919, 2.929, - & 2.938, 2.948, 2.957, 2.966, 2.976, 2.985, 2.994, 3.003, 3.012, - & 3.021, 3.030, 3.039, 3.047, 3.056, 3.065, 3.073, 3.082, 3.090, - & 3.099, 3.107, 3.115, 3.123, 3.132, 3.140, 3.148, 3.156, 3.164, - & 3.172, 3.179, 3.187, 3.195, 3.203, 3.210, 3.218, 3.225, 3.233, - & 3.240, 3.248, 3.255, 3.262, 3.270, 3.277, 3.284, 3.291, 3.298, - & 3.305, 3.312, 3.319 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.092,-0.190,-0.233,-0.261,-0.280,-0.295,-0.306,-0.314,-0.321, - &-0.326,-0.330,-0.333,-0.335,-0.336,-0.336,-0.336,-0.336,-0.335, - &-0.334,-0.332,-0.330,-0.328,-0.326,-0.323,-0.320,-0.317,-0.314, - &-0.311,-0.308,-0.304,-0.300,-0.297,-0.293,-0.289,-0.285,-0.281, - &-0.277,-0.272,-0.268,-0.264,-0.259,-0.255,-0.251,-0.246,-0.242, - &-0.237,-0.233,-0.228,-0.224,-0.219,-0.215,-0.210,-0.205,-0.201, - &-0.196,-0.192,-0.187,-0.182,-0.178,-0.173,-0.168,-0.164,-0.159, - &-0.154,-0.150,-0.145,-0.140,-0.135,-0.131,-0.126,-0.121,-0.116, - &-0.111,-0.106,-0.102,-0.097,-0.092,-0.087,-0.082,-0.077,-0.072, - &-0.067,-0.062,-0.056,-0.051,-0.046,-0.041,-0.036,-0.030,-0.025, - &-0.019,-0.014,-0.009,-0.003, 0.002, 0.008, 0.013, 0.019, 0.025, - & 0.030, 0.036, 0.042, 0.047, 0.053, 0.059, 0.065, 0.071, 0.077, - & 0.082, 0.088, 0.094, 0.100, 0.106, 0.112, 0.118, 0.124, 0.130, - & 0.136, 0.142, 0.148, 0.154, 0.160, 0.166, 0.172, 0.178, 0.184, - & 0.190, 0.196, 0.202, 0.208, 0.214, 0.220, 0.226, 0.232, 0.238, - & 0.244, 0.250, 0.256, 0.262, 0.268, 0.274, 0.280, 0.286, 0.292, - & 0.298, 0.304, 0.310, 0.316, 0.322, 0.328, 0.334, 0.340, 0.346, - & 0.352, 0.358, 0.364, 0.370, 0.376, 0.382, 0.387, 0.393, 0.399, - & 0.405, 0.411, 0.417, 0.423, 0.429, 0.434, 0.440, 0.446, 0.452, - & 0.458, 0.463, 0.469, 0.475, 0.481, 0.487, 0.492, 0.498, 0.504, - & 0.509, 0.515, 0.521, 0.527, 0.532, 0.538, 0.544, 0.549, 0.555, - & 0.561, 0.566, 0.572, 0.578, 0.583, 0.589, 0.594, 0.600, 0.606, - & 0.611, 0.617, 0.622, 0.628, 0.633, 0.639, 0.645, 0.650, 0.656, - & 0.661, 0.667, 0.672, 0.678, 0.683, 0.688, 0.694, 0.699, 0.705, - & 0.710, 0.716, 0.721, 0.726, 0.732, 0.737, 0.743, 0.748, 0.753, - & 0.759, 0.764, 0.769, 0.775, 0.780, 0.785, 0.791, 0.796, 0.801, - & 0.807, 0.812, 0.817, 0.822, 0.828, 0.833, 0.838, 0.843, 0.848, - & 0.854, 0.859, 0.864, 0.869, 0.874, 0.879, 0.885, 0.890, 0.895, - & 0.900, 0.905, 0.910, 0.915, 0.920, 0.925, 0.931, 0.936, 0.941, - & 0.946, 0.951, 0.956, 0.961, 0.966, 0.971, 0.976, 0.981, 0.986, - & 0.991, 0.996, 1.001, 1.006, 1.011, 1.015, 1.020, 1.025, 1.030, - & 1.035, 1.040, 1.045, 1.050, 1.055, 1.059, 1.064, 1.069, 1.074, - & 1.079, 1.084, 1.088, 1.093, 1.098, 1.103, 1.108, 1.112, 1.117, - & 1.122, 1.127, 1.131, 1.136, 1.141, 1.146, 1.150, 1.155, 1.160, - & 1.164, 1.169, 1.174, 1.178, 1.183, 1.188, 1.192, 1.197, 1.201, - & 1.206, 1.211, 1.215, 1.220, 1.224, 1.229, 1.234, 1.238, 1.243, - & 1.247, 1.252, 1.256, 1.261, 1.265, 1.270, 1.274, 1.279, 1.283, - & 1.288, 1.292, 1.297, 1.301, 1.306, 1.310, 1.315, 1.319, 1.323, - & 1.328, 1.332, 1.337, 1.341, 1.345, 1.350, 1.354, 1.359, 1.363, - & 1.367, 1.372, 1.376, 1.380, 1.385, 1.389, 1.393, 1.398, 1.402, - & 1.406, 1.410, 1.415, 1.419, 1.423, 1.428, 1.432, 1.436, 1.440, - & 1.444, 1.449, 1.453, 1.457, 1.461, 1.466, 1.470, 1.474, 1.478, - & 1.482, 1.486, 1.491, 1.495, 1.499, 1.503, 1.507, 1.511, 1.515, - & 1.519, 1.524, 1.528, 1.532, 1.536, 1.540, 1.544, 1.548, 1.552, - & 1.556, 1.560, 1.564, 1.568, 1.611, 1.651, 1.690, 1.728, 1.765, - & 1.802, 1.839, 1.875, 1.911, 1.945, 1.980, 2.014, 2.048, 2.081, - & 2.113, 2.146, 2.177, 2.209, 2.240, 2.270, 2.300, 2.330, 2.360, - & 2.389, 2.417, 2.446, 2.474, 2.502, 2.529, 2.556, 2.583, 2.609, - & 2.635, 2.661, 2.686, 2.712, 2.737, 2.761, 2.786, 2.810, 2.834, - & 2.857, 2.881, 2.904, 2.927, 2.950, 2.972, 2.994, 3.016, 3.038, - & 3.060, 3.081, 3.102, 3.123, 3.144, 3.164, 3.184, 3.205, 3.225, - & 3.244, 3.264, 3.283, 3.302, 3.322, 3.340, 3.359, 3.378, 3.396, - & 3.414, 3.432, 3.450, 3.468, 3.485, 3.503, 3.520, 3.537, 3.554, - & 3.571, 3.588, 3.604, 3.621, 3.637, 3.653, 3.669, 3.685, 3.701, - & 3.717, 3.732, 3.748, 3.763, 3.778, 3.793, 3.808, 3.823, 3.838, - & 3.852, 3.867, 3.881, 3.896, 3.910, 3.924, 3.938, 3.952, 3.966, - & 3.979, 3.993, 4.006, 4.020, 4.033, 4.046, 4.059, 4.072, 4.085, - & 4.098, 4.111, 4.123, 4.136, 4.148, 4.161, 4.173, 4.185, 4.197, - & 4.210, 4.222, 4.233, 4.245, 4.257, 4.269, 4.280, 4.292, 4.303, - & 4.315, 4.326, 4.337, 4.348, 4.359, 4.370, 4.381, 4.392, 4.403, - & 4.414, 4.424, 4.435, 4.446, 4.456, 4.466, 4.477, 4.487, 4.497, - & 4.507, 4.518, 4.528, 4.538, 4.548, 4.557, 4.567, 4.577, 4.587, - & 4.596, 4.606, 4.615 - & / - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM298 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 298K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM298 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC298/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF298 -C -C *** Common block definition -C - COMMON /KMC298/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.045,-0.095,-0.117,-0.132,-0.142,-0.150,-0.157,-0.162,-0.166, - &-0.170,-0.173,-0.175,-0.177,-0.179,-0.180,-0.181,-0.182,-0.182, - &-0.183,-0.183,-0.183,-0.183,-0.182,-0.182,-0.182,-0.181,-0.181, - &-0.180,-0.179,-0.178,-0.178,-0.177,-0.176,-0.175,-0.174,-0.173, - &-0.172,-0.170,-0.169,-0.168,-0.167,-0.166,-0.164,-0.163,-0.162, - &-0.161,-0.159,-0.158,-0.157,-0.155,-0.154,-0.153,-0.151,-0.150, - &-0.148,-0.147,-0.146,-0.144,-0.143,-0.141,-0.140,-0.138,-0.137, - &-0.136,-0.134,-0.133,-0.131,-0.130,-0.128,-0.127,-0.125,-0.124, - &-0.122,-0.121,-0.119,-0.117,-0.116,-0.114,-0.113,-0.111,-0.110, - &-0.108,-0.106,-0.105,-0.103,-0.101,-0.100,-0.098,-0.096,-0.094, - &-0.093,-0.091,-0.089,-0.087,-0.086,-0.084,-0.082,-0.080,-0.078, - &-0.076,-0.075,-0.073,-0.071,-0.069,-0.067,-0.065,-0.063,-0.061, - &-0.059,-0.057,-0.055,-0.053,-0.051,-0.049,-0.047,-0.046,-0.044, - &-0.042,-0.040,-0.038,-0.036,-0.034,-0.032,-0.030,-0.028,-0.026, - &-0.024,-0.022,-0.019,-0.017,-0.015,-0.013,-0.011,-0.009,-0.007, - &-0.005,-0.003,-0.001, 0.001, 0.003, 0.005, 0.007, 0.009, 0.011, - & 0.013, 0.015, 0.017, 0.019, 0.021, 0.023, 0.025, 0.027, 0.029, - & 0.031, 0.033, 0.035, 0.037, 0.039, 0.041, 0.043, 0.045, 0.047, - & 0.049, 0.050, 0.052, 0.054, 0.056, 0.058, 0.060, 0.062, 0.064, - & 0.066, 0.068, 0.070, 0.072, 0.074, 0.076, 0.078, 0.080, 0.082, - & 0.084, 0.086, 0.088, 0.090, 0.091, 0.093, 0.095, 0.097, 0.099, - & 0.101, 0.103, 0.105, 0.107, 0.109, 0.111, 0.113, 0.114, 0.116, - & 0.118, 0.120, 0.122, 0.124, 0.126, 0.128, 0.130, 0.131, 0.133, - & 0.135, 0.137, 0.139, 0.141, 0.143, 0.145, 0.146, 0.148, 0.150, - & 0.152, 0.154, 0.156, 0.158, 0.159, 0.161, 0.163, 0.165, 0.167, - & 0.169, 0.170, 0.172, 0.174, 0.176, 0.178, 0.180, 0.181, 0.183, - & 0.185, 0.187, 0.189, 0.190, 0.192, 0.194, 0.196, 0.198, 0.199, - & 0.201, 0.203, 0.205, 0.206, 0.208, 0.210, 0.212, 0.214, 0.215, - & 0.217, 0.219, 0.221, 0.222, 0.224, 0.226, 0.228, 0.229, 0.231, - & 0.233, 0.235, 0.236, 0.238, 0.240, 0.242, 0.243, 0.245, 0.247, - & 0.248, 0.250, 0.252, 0.254, 0.255, 0.257, 0.259, 0.260, 0.262, - & 0.264, 0.265, 0.267, 0.269, 0.271, 0.272, 0.274, 0.276, 0.277, - & 0.279, 0.281, 0.282, 0.284, 0.286, 0.287, 0.289, 0.291, 0.292, - & 0.294, 0.296, 0.297, 0.299, 0.301, 0.302, 0.304, 0.305, 0.307, - & 0.309, 0.310, 0.312, 0.314, 0.315, 0.317, 0.318, 0.320, 0.322, - & 0.323, 0.325, 0.327, 0.328, 0.330, 0.331, 0.333, 0.335, 0.336, - & 0.338, 0.339, 0.341, 0.343, 0.344, 0.346, 0.347, 0.349, 0.350, - & 0.352, 0.354, 0.355, 0.357, 0.358, 0.360, 0.361, 0.363, 0.364, - & 0.366, 0.368, 0.369, 0.371, 0.372, 0.374, 0.375, 0.377, 0.378, - & 0.380, 0.381, 0.383, 0.384, 0.386, 0.388, 0.389, 0.391, 0.392, - & 0.394, 0.395, 0.397, 0.398, 0.400, 0.401, 0.403, 0.404, 0.406, - & 0.407, 0.409, 0.410, 0.412, 0.413, 0.415, 0.416, 0.418, 0.419, - & 0.421, 0.422, 0.423, 0.425, 0.426, 0.428, 0.429, 0.431, 0.432, - & 0.434, 0.435, 0.437, 0.438, 0.440, 0.441, 0.442, 0.444, 0.445, - & 0.447, 0.448, 0.450, 0.451, 0.466, 0.480, 0.494, 0.508, 0.522, - & 0.535, 0.548, 0.561, 0.574, 0.586, 0.599, 0.611, 0.624, 0.636, - & 0.648, 0.659, 0.671, 0.683, 0.694, 0.705, 0.716, 0.727, 0.738, - & 0.749, 0.760, 0.770, 0.781, 0.791, 0.801, 0.811, 0.821, 0.831, - & 0.841, 0.851, 0.861, 0.870, 0.879, 0.889, 0.898, 0.907, 0.916, - & 0.925, 0.934, 0.943, 0.952, 0.961, 0.969, 0.978, 0.986, 0.995, - & 1.003, 1.011, 1.019, 1.028, 1.036, 1.044, 1.051, 1.059, 1.067, - & 1.075, 1.082, 1.090, 1.098, 1.105, 1.113, 1.120, 1.127, 1.135, - & 1.142, 1.149, 1.156, 1.163, 1.170, 1.177, 1.184, 1.191, 1.198, - & 1.204, 1.211, 1.218, 1.224, 1.231, 1.237, 1.244, 1.250, 1.257, - & 1.263, 1.269, 1.276, 1.282, 1.288, 1.294, 1.300, 1.307, 1.313, - & 1.319, 1.325, 1.330, 1.336, 1.342, 1.348, 1.354, 1.360, 1.365, - & 1.371, 1.377, 1.382, 1.388, 1.393, 1.399, 1.404, 1.410, 1.415, - & 1.421, 1.426, 1.431, 1.437, 1.442, 1.447, 1.453, 1.458, 1.463, - & 1.468, 1.473, 1.478, 1.483, 1.488, 1.493, 1.498, 1.503, 1.508, - & 1.513, 1.518, 1.523, 1.528, 1.532, 1.537, 1.542, 1.547, 1.551, - & 1.556, 1.561, 1.565, 1.570, 1.575, 1.579, 1.584, 1.588, 1.593, - & 1.597, 1.602, 1.606, 1.611, 1.615, 1.620, 1.624, 1.628, 1.633, - & 1.637, 1.641, 1.645 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.093,-0.202,-0.256,-0.295,-0.325,-0.349,-0.371,-0.389,-0.405, - &-0.420,-0.434,-0.446,-0.457,-0.468,-0.478,-0.487,-0.496,-0.504, - &-0.512,-0.520,-0.527,-0.533,-0.540,-0.546,-0.552,-0.558,-0.563, - &-0.569,-0.574,-0.579,-0.584,-0.588,-0.593,-0.597,-0.602,-0.606, - &-0.610,-0.614,-0.618,-0.621,-0.625,-0.628,-0.632,-0.635,-0.639, - &-0.642,-0.645,-0.648,-0.651,-0.654,-0.657,-0.660,-0.663,-0.665, - &-0.668,-0.671,-0.673,-0.676,-0.678,-0.681,-0.683,-0.686,-0.688, - &-0.690,-0.692,-0.695,-0.697,-0.699,-0.701,-0.703,-0.705,-0.707, - &-0.709,-0.711,-0.713,-0.715,-0.717,-0.719,-0.721,-0.723,-0.724, - &-0.726,-0.728,-0.730,-0.731,-0.733,-0.735,-0.737,-0.738,-0.740, - &-0.741,-0.743,-0.745,-0.746,-0.748,-0.749,-0.751,-0.752,-0.754, - &-0.755,-0.757,-0.758,-0.760,-0.761,-0.763,-0.764,-0.766,-0.767, - &-0.768,-0.770,-0.771,-0.772,-0.774,-0.775,-0.776,-0.778,-0.779, - &-0.780,-0.782,-0.783,-0.784,-0.785,-0.787,-0.788,-0.789,-0.790, - &-0.791,-0.793,-0.794,-0.795,-0.796,-0.797,-0.798,-0.800,-0.801, - &-0.802,-0.803,-0.804,-0.805,-0.806,-0.807,-0.808,-0.810,-0.811, - &-0.812,-0.813,-0.814,-0.815,-0.816,-0.817,-0.818,-0.819,-0.820, - &-0.821,-0.822,-0.823,-0.824,-0.825,-0.826,-0.827,-0.828,-0.829, - &-0.830,-0.831,-0.832,-0.832,-0.833,-0.834,-0.835,-0.836,-0.837, - &-0.838,-0.839,-0.840,-0.841,-0.841,-0.842,-0.843,-0.844,-0.845, - &-0.846,-0.847,-0.847,-0.848,-0.849,-0.850,-0.851,-0.852,-0.852, - &-0.853,-0.854,-0.855,-0.856,-0.856,-0.857,-0.858,-0.859,-0.860, - &-0.860,-0.861,-0.862,-0.863,-0.864,-0.864,-0.865,-0.866,-0.867, - &-0.867,-0.868,-0.869,-0.869,-0.870,-0.871,-0.872,-0.872,-0.873, - &-0.874,-0.875,-0.875,-0.876,-0.877,-0.877,-0.878,-0.879,-0.879, - &-0.880,-0.881,-0.882,-0.882,-0.883,-0.884,-0.884,-0.885,-0.886, - &-0.886,-0.887,-0.888,-0.888,-0.889,-0.889,-0.890,-0.891,-0.891, - &-0.892,-0.893,-0.893,-0.894,-0.895,-0.895,-0.896,-0.896,-0.897, - &-0.898,-0.898,-0.899,-0.899,-0.900,-0.901,-0.901,-0.902,-0.903, - &-0.903,-0.904,-0.904,-0.905,-0.905,-0.906,-0.907,-0.907,-0.908, - &-0.908,-0.909,-0.910,-0.910,-0.911,-0.911,-0.912,-0.912,-0.913, - &-0.913,-0.914,-0.915,-0.915,-0.916,-0.916,-0.917,-0.917,-0.918, - &-0.918,-0.919,-0.919,-0.920,-0.921,-0.921,-0.922,-0.922,-0.923, - &-0.923,-0.924,-0.924,-0.925,-0.925,-0.926,-0.926,-0.927,-0.927, - &-0.928,-0.928,-0.929,-0.929,-0.930,-0.930,-0.931,-0.931,-0.932, - &-0.932,-0.933,-0.933,-0.934,-0.934,-0.935,-0.935,-0.936,-0.936, - &-0.937,-0.937,-0.938,-0.938,-0.939,-0.939,-0.940,-0.940,-0.940, - &-0.941,-0.941,-0.942,-0.942,-0.943,-0.943,-0.944,-0.944,-0.945, - &-0.945,-0.946,-0.946,-0.946,-0.947,-0.947,-0.948,-0.948,-0.949, - &-0.949,-0.950,-0.950,-0.950,-0.951,-0.951,-0.952,-0.952,-0.953, - &-0.953,-0.954,-0.954,-0.954,-0.955,-0.955,-0.956,-0.956,-0.957, - &-0.957,-0.957,-0.958,-0.958,-0.959,-0.959,-0.959,-0.960,-0.960, - &-0.961,-0.961,-0.962,-0.962,-0.962,-0.963,-0.963,-0.964,-0.964, - &-0.964,-0.965,-0.965,-0.966,-0.966,-0.966,-0.967,-0.967,-0.968, - &-0.968,-0.968,-0.969,-0.969,-0.973,-0.977,-0.981,-0.984,-0.988, - &-0.991,-0.995,-0.998,-1.001,-1.004,-1.007,-1.010,-1.013,-1.016, - &-1.019,-1.022,-1.024,-1.027,-1.030,-1.032,-1.035,-1.037,-1.040, - &-1.042,-1.045,-1.047,-1.049,-1.052,-1.054,-1.056,-1.058,-1.061, - &-1.063,-1.065,-1.067,-1.069,-1.071,-1.073,-1.075,-1.077,-1.079, - &-1.080,-1.082,-1.084,-1.086,-1.088,-1.089,-1.091,-1.093,-1.095, - &-1.096,-1.098,-1.100,-1.101,-1.103,-1.104,-1.106,-1.108,-1.109, - &-1.111,-1.112,-1.114,-1.115,-1.117,-1.118,-1.119,-1.121,-1.122, - &-1.124,-1.125,-1.126,-1.128,-1.129,-1.130,-1.132,-1.133,-1.134, - &-1.135,-1.137,-1.138,-1.139,-1.140,-1.142,-1.143,-1.144,-1.145, - &-1.146,-1.148,-1.149,-1.150,-1.151,-1.152,-1.153,-1.154,-1.155, - &-1.157,-1.158,-1.159,-1.160,-1.161,-1.162,-1.163,-1.164,-1.165, - &-1.166,-1.167,-1.168,-1.169,-1.170,-1.171,-1.172,-1.173,-1.174, - &-1.175,-1.176,-1.177,-1.178,-1.179,-1.180,-1.180,-1.181,-1.182, - &-1.183,-1.184,-1.185,-1.186,-1.187,-1.188,-1.188,-1.189,-1.190, - &-1.191,-1.192,-1.193,-1.193,-1.194,-1.195,-1.196,-1.197,-1.198, - &-1.198,-1.199,-1.200,-1.201,-1.201,-1.202,-1.203,-1.204,-1.205, - &-1.205,-1.206,-1.207,-1.208,-1.208,-1.209,-1.210,-1.210,-1.211, - &-1.212,-1.213,-1.213 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.047,-0.102,-0.129,-0.149,-0.164,-0.177,-0.188,-0.198,-0.206, - &-0.214,-0.221,-0.228,-0.234,-0.239,-0.245,-0.250,-0.255,-0.259, - &-0.263,-0.267,-0.271,-0.275,-0.279,-0.282,-0.285,-0.289,-0.292, - &-0.295,-0.298,-0.300,-0.303,-0.306,-0.308,-0.311,-0.313,-0.316, - &-0.318,-0.320,-0.322,-0.324,-0.326,-0.329,-0.331,-0.332,-0.334, - &-0.336,-0.338,-0.340,-0.342,-0.343,-0.345,-0.347,-0.348,-0.350, - &-0.352,-0.353,-0.355,-0.356,-0.358,-0.359,-0.360,-0.362,-0.363, - &-0.365,-0.366,-0.367,-0.369,-0.370,-0.371,-0.372,-0.374,-0.375, - &-0.376,-0.377,-0.378,-0.380,-0.381,-0.382,-0.383,-0.384,-0.385, - &-0.386,-0.388,-0.389,-0.390,-0.391,-0.392,-0.393,-0.394,-0.395, - &-0.396,-0.397,-0.398,-0.399,-0.400,-0.401,-0.402,-0.403,-0.404, - &-0.405,-0.406,-0.407,-0.408,-0.408,-0.409,-0.410,-0.411,-0.412, - &-0.413,-0.414,-0.415,-0.416,-0.416,-0.417,-0.418,-0.419,-0.420, - &-0.421,-0.422,-0.422,-0.423,-0.424,-0.425,-0.426,-0.427,-0.427, - &-0.428,-0.429,-0.430,-0.430,-0.431,-0.432,-0.433,-0.434,-0.434, - &-0.435,-0.436,-0.437,-0.437,-0.438,-0.439,-0.439,-0.440,-0.441, - &-0.442,-0.442,-0.443,-0.444,-0.444,-0.445,-0.446,-0.447,-0.447, - &-0.448,-0.449,-0.449,-0.450,-0.451,-0.451,-0.452,-0.453,-0.453, - &-0.454,-0.454,-0.455,-0.456,-0.456,-0.457,-0.458,-0.458,-0.459, - &-0.460,-0.460,-0.461,-0.461,-0.462,-0.463,-0.463,-0.464,-0.464, - &-0.465,-0.466,-0.466,-0.467,-0.467,-0.468,-0.468,-0.469,-0.470, - &-0.470,-0.471,-0.471,-0.472,-0.472,-0.473,-0.474,-0.474,-0.475, - &-0.475,-0.476,-0.476,-0.477,-0.477,-0.478,-0.478,-0.479,-0.479, - &-0.480,-0.480,-0.481,-0.482,-0.482,-0.483,-0.483,-0.484,-0.484, - &-0.485,-0.485,-0.486,-0.486,-0.487,-0.487,-0.488,-0.488,-0.489, - &-0.489,-0.490,-0.490,-0.491,-0.491,-0.491,-0.492,-0.492,-0.493, - &-0.493,-0.494,-0.494,-0.495,-0.495,-0.496,-0.496,-0.497,-0.497, - &-0.498,-0.498,-0.498,-0.499,-0.499,-0.500,-0.500,-0.501,-0.501, - &-0.502,-0.502,-0.502,-0.503,-0.503,-0.504,-0.504,-0.505,-0.505, - &-0.505,-0.506,-0.506,-0.507,-0.507,-0.508,-0.508,-0.508,-0.509, - &-0.509,-0.510,-0.510,-0.511,-0.511,-0.511,-0.512,-0.512,-0.513, - &-0.513,-0.513,-0.514,-0.514,-0.515,-0.515,-0.515,-0.516,-0.516, - &-0.517,-0.517,-0.517,-0.518,-0.518,-0.518,-0.519,-0.519,-0.520, - &-0.520,-0.520,-0.521,-0.521,-0.522,-0.522,-0.522,-0.523,-0.523, - &-0.523,-0.524,-0.524,-0.525,-0.525,-0.525,-0.526,-0.526,-0.526, - &-0.527,-0.527,-0.527,-0.528,-0.528,-0.529,-0.529,-0.529,-0.530, - &-0.530,-0.530,-0.531,-0.531,-0.531,-0.532,-0.532,-0.532,-0.533, - &-0.533,-0.533,-0.534,-0.534,-0.534,-0.535,-0.535,-0.535,-0.536, - &-0.536,-0.536,-0.537,-0.537,-0.537,-0.538,-0.538,-0.538,-0.539, - &-0.539,-0.539,-0.540,-0.540,-0.540,-0.541,-0.541,-0.541,-0.542, - &-0.542,-0.542,-0.543,-0.543,-0.543,-0.544,-0.544,-0.544,-0.545, - &-0.545,-0.545,-0.546,-0.546,-0.546,-0.546,-0.547,-0.547,-0.547, - &-0.548,-0.548,-0.548,-0.549,-0.549,-0.549,-0.549,-0.550,-0.550, - &-0.550,-0.551,-0.551,-0.551,-0.552,-0.552,-0.552,-0.552,-0.553, - &-0.553,-0.553,-0.554,-0.554,-0.557,-0.560,-0.563,-0.565,-0.568, - &-0.570,-0.573,-0.575,-0.578,-0.580,-0.583,-0.585,-0.587,-0.589, - &-0.592,-0.594,-0.596,-0.598,-0.600,-0.602,-0.604,-0.606,-0.608, - &-0.609,-0.611,-0.613,-0.615,-0.617,-0.618,-0.620,-0.622,-0.623, - &-0.625,-0.627,-0.628,-0.630,-0.631,-0.633,-0.634,-0.636,-0.637, - &-0.639,-0.640,-0.642,-0.643,-0.644,-0.646,-0.647,-0.648,-0.650, - &-0.651,-0.652,-0.653,-0.655,-0.656,-0.657,-0.658,-0.660,-0.661, - &-0.662,-0.663,-0.664,-0.665,-0.667,-0.668,-0.669,-0.670,-0.671, - &-0.672,-0.673,-0.674,-0.675,-0.676,-0.677,-0.678,-0.679,-0.680, - &-0.681,-0.682,-0.683,-0.684,-0.685,-0.686,-0.687,-0.688,-0.689, - &-0.690,-0.691,-0.692,-0.692,-0.693,-0.694,-0.695,-0.696,-0.697, - &-0.698,-0.698,-0.699,-0.700,-0.701,-0.702,-0.703,-0.703,-0.704, - &-0.705,-0.706,-0.706,-0.707,-0.708,-0.709,-0.709,-0.710,-0.711, - &-0.712,-0.712,-0.713,-0.714,-0.715,-0.715,-0.716,-0.717,-0.717, - &-0.718,-0.719,-0.719,-0.720,-0.721,-0.721,-0.722,-0.723,-0.723, - &-0.724,-0.725,-0.725,-0.726,-0.727,-0.727,-0.728,-0.729,-0.729, - &-0.730,-0.730,-0.731,-0.732,-0.732,-0.733,-0.733,-0.734,-0.735, - &-0.735,-0.736,-0.736,-0.737,-0.737,-0.738,-0.739,-0.739,-0.740, - &-0.740,-0.741,-0.741 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.093,-0.203,-0.257,-0.296,-0.326,-0.351,-0.372,-0.391,-0.408, - &-0.423,-0.436,-0.449,-0.460,-0.471,-0.481,-0.491,-0.500,-0.508, - &-0.516,-0.524,-0.531,-0.538,-0.545,-0.552,-0.558,-0.564,-0.569, - &-0.575,-0.580,-0.585,-0.590,-0.595,-0.600,-0.605,-0.609,-0.613, - &-0.618,-0.622,-0.626,-0.629,-0.633,-0.637,-0.641,-0.644,-0.648, - &-0.651,-0.654,-0.658,-0.661,-0.664,-0.667,-0.670,-0.673,-0.676, - &-0.678,-0.681,-0.684,-0.687,-0.689,-0.692,-0.694,-0.697,-0.699, - &-0.702,-0.704,-0.707,-0.709,-0.711,-0.713,-0.716,-0.718,-0.720, - &-0.722,-0.724,-0.726,-0.728,-0.730,-0.732,-0.734,-0.736,-0.738, - &-0.740,-0.742,-0.744,-0.746,-0.748,-0.749,-0.751,-0.753,-0.755, - &-0.756,-0.758,-0.760,-0.762,-0.763,-0.765,-0.767,-0.768,-0.770, - &-0.772,-0.773,-0.775,-0.776,-0.778,-0.779,-0.781,-0.782,-0.784, - &-0.786,-0.787,-0.788,-0.790,-0.791,-0.793,-0.794,-0.796,-0.797, - &-0.799,-0.800,-0.801,-0.803,-0.804,-0.805,-0.807,-0.808,-0.809, - &-0.811,-0.812,-0.813,-0.815,-0.816,-0.817,-0.819,-0.820,-0.821, - &-0.822,-0.824,-0.825,-0.826,-0.827,-0.828,-0.830,-0.831,-0.832, - &-0.833,-0.834,-0.835,-0.837,-0.838,-0.839,-0.840,-0.841,-0.842, - &-0.843,-0.844,-0.846,-0.847,-0.848,-0.849,-0.850,-0.851,-0.852, - &-0.853,-0.854,-0.855,-0.856,-0.857,-0.858,-0.859,-0.860,-0.861, - &-0.862,-0.863,-0.864,-0.865,-0.866,-0.867,-0.868,-0.869,-0.870, - &-0.871,-0.872,-0.873,-0.874,-0.875,-0.876,-0.877,-0.878,-0.878, - &-0.879,-0.880,-0.881,-0.882,-0.883,-0.884,-0.885,-0.886,-0.886, - &-0.887,-0.888,-0.889,-0.890,-0.891,-0.892,-0.893,-0.893,-0.894, - &-0.895,-0.896,-0.897,-0.898,-0.898,-0.899,-0.900,-0.901,-0.902, - &-0.902,-0.903,-0.904,-0.905,-0.906,-0.906,-0.907,-0.908,-0.909, - &-0.910,-0.910,-0.911,-0.912,-0.913,-0.913,-0.914,-0.915,-0.916, - &-0.916,-0.917,-0.918,-0.919,-0.919,-0.920,-0.921,-0.922,-0.922, - &-0.923,-0.924,-0.924,-0.925,-0.926,-0.927,-0.927,-0.928,-0.929, - &-0.929,-0.930,-0.931,-0.931,-0.932,-0.933,-0.933,-0.934,-0.935, - &-0.936,-0.936,-0.937,-0.938,-0.938,-0.939,-0.940,-0.940,-0.941, - &-0.941,-0.942,-0.943,-0.943,-0.944,-0.945,-0.945,-0.946,-0.947, - &-0.947,-0.948,-0.949,-0.949,-0.950,-0.950,-0.951,-0.952,-0.952, - &-0.953,-0.954,-0.954,-0.955,-0.955,-0.956,-0.957,-0.957,-0.958, - &-0.958,-0.959,-0.960,-0.960,-0.961,-0.961,-0.962,-0.962,-0.963, - &-0.964,-0.964,-0.965,-0.965,-0.966,-0.967,-0.967,-0.968,-0.968, - &-0.969,-0.969,-0.970,-0.970,-0.971,-0.972,-0.972,-0.973,-0.973, - &-0.974,-0.974,-0.975,-0.975,-0.976,-0.977,-0.977,-0.978,-0.978, - &-0.979,-0.979,-0.980,-0.980,-0.981,-0.981,-0.982,-0.982,-0.983, - &-0.983,-0.984,-0.984,-0.985,-0.986,-0.986,-0.987,-0.987,-0.988, - &-0.988,-0.989,-0.989,-0.990,-0.990,-0.991,-0.991,-0.992,-0.992, - &-0.993,-0.993,-0.994,-0.994,-0.995,-0.995,-0.996,-0.996,-0.997, - &-0.997,-0.998,-0.998,-0.998,-0.999,-0.999,-1.000,-1.000,-1.001, - &-1.001,-1.002,-1.002,-1.003,-1.003,-1.004,-1.004,-1.005,-1.005, - &-1.006,-1.006,-1.006,-1.007,-1.007,-1.008,-1.008,-1.009,-1.009, - &-1.010,-1.010,-1.011,-1.011,-1.016,-1.020,-1.024,-1.029,-1.033, - &-1.037,-1.040,-1.044,-1.048,-1.052,-1.055,-1.059,-1.062,-1.065, - &-1.069,-1.072,-1.075,-1.078,-1.081,-1.084,-1.087,-1.090,-1.093, - &-1.096,-1.099,-1.102,-1.104,-1.107,-1.110,-1.112,-1.115,-1.117, - &-1.120,-1.122,-1.125,-1.127,-1.129,-1.132,-1.134,-1.136,-1.139, - &-1.141,-1.143,-1.145,-1.147,-1.149,-1.151,-1.153,-1.155,-1.157, - &-1.159,-1.161,-1.163,-1.165,-1.167,-1.169,-1.171,-1.173,-1.174, - &-1.176,-1.178,-1.180,-1.181,-1.183,-1.185,-1.187,-1.188,-1.190, - &-1.191,-1.193,-1.195,-1.196,-1.198,-1.199,-1.201,-1.202,-1.204, - &-1.205,-1.207,-1.208,-1.210,-1.211,-1.213,-1.214,-1.216,-1.217, - &-1.218,-1.220,-1.221,-1.223,-1.224,-1.225,-1.226,-1.228,-1.229, - &-1.230,-1.232,-1.233,-1.234,-1.235,-1.237,-1.238,-1.239,-1.240, - &-1.242,-1.243,-1.244,-1.245,-1.246,-1.247,-1.249,-1.250,-1.251, - &-1.252,-1.253,-1.254,-1.255,-1.256,-1.258,-1.259,-1.260,-1.261, - &-1.262,-1.263,-1.264,-1.265,-1.266,-1.267,-1.268,-1.269,-1.270, - &-1.271,-1.272,-1.273,-1.274,-1.275,-1.276,-1.277,-1.278,-1.279, - &-1.280,-1.281,-1.282,-1.283,-1.283,-1.284,-1.285,-1.286,-1.287, - &-1.288,-1.289,-1.290,-1.291,-1.292,-1.292,-1.293,-1.294,-1.295, - &-1.296,-1.297,-1.298 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.047,-0.104,-0.134,-0.155,-0.172,-0.187,-0.199,-0.211,-0.221, - &-0.230,-0.239,-0.247,-0.255,-0.262,-0.268,-0.275,-0.281,-0.287, - &-0.293,-0.298,-0.303,-0.308,-0.313,-0.318,-0.323,-0.327,-0.332, - &-0.336,-0.340,-0.344,-0.348,-0.352,-0.356,-0.359,-0.363,-0.366, - &-0.370,-0.373,-0.377,-0.380,-0.383,-0.386,-0.389,-0.392,-0.395, - &-0.398,-0.401,-0.404,-0.406,-0.409,-0.412,-0.414,-0.417,-0.420, - &-0.422,-0.425,-0.427,-0.429,-0.432,-0.434,-0.436,-0.439,-0.441, - &-0.443,-0.445,-0.447,-0.450,-0.452,-0.454,-0.456,-0.458,-0.460, - &-0.462,-0.464,-0.466,-0.468,-0.470,-0.472,-0.474,-0.476,-0.478, - &-0.480,-0.481,-0.483,-0.485,-0.487,-0.489,-0.491,-0.492,-0.494, - &-0.496,-0.498,-0.500,-0.501,-0.503,-0.505,-0.507,-0.508,-0.510, - &-0.512,-0.514,-0.515,-0.517,-0.519,-0.520,-0.522,-0.524,-0.525, - &-0.527,-0.529,-0.530,-0.532,-0.534,-0.535,-0.537,-0.538,-0.540, - &-0.542,-0.543,-0.545,-0.546,-0.548,-0.550,-0.551,-0.553,-0.554, - &-0.556,-0.557,-0.559,-0.560,-0.562,-0.563,-0.565,-0.566,-0.568, - &-0.569,-0.571,-0.572,-0.573,-0.575,-0.576,-0.578,-0.579,-0.580, - &-0.582,-0.583,-0.585,-0.586,-0.587,-0.589,-0.590,-0.591,-0.593, - &-0.594,-0.595,-0.597,-0.598,-0.599,-0.601,-0.602,-0.603,-0.604, - &-0.606,-0.607,-0.608,-0.610,-0.611,-0.612,-0.613,-0.615,-0.616, - &-0.617,-0.618,-0.619,-0.621,-0.622,-0.623,-0.624,-0.625,-0.627, - &-0.628,-0.629,-0.630,-0.631,-0.632,-0.634,-0.635,-0.636,-0.637, - &-0.638,-0.639,-0.640,-0.642,-0.643,-0.644,-0.645,-0.646,-0.647, - &-0.648,-0.649,-0.650,-0.651,-0.652,-0.654,-0.655,-0.656,-0.657, - &-0.658,-0.659,-0.660,-0.661,-0.662,-0.663,-0.664,-0.665,-0.666, - &-0.667,-0.668,-0.669,-0.670,-0.671,-0.672,-0.673,-0.674,-0.675, - &-0.676,-0.677,-0.678,-0.679,-0.680,-0.681,-0.682,-0.683,-0.684, - &-0.685,-0.686,-0.687,-0.688,-0.688,-0.689,-0.690,-0.691,-0.692, - &-0.693,-0.694,-0.695,-0.696,-0.697,-0.698,-0.699,-0.699,-0.700, - &-0.701,-0.702,-0.703,-0.704,-0.705,-0.706,-0.707,-0.707,-0.708, - &-0.709,-0.710,-0.711,-0.712,-0.713,-0.713,-0.714,-0.715,-0.716, - &-0.717,-0.718,-0.718,-0.719,-0.720,-0.721,-0.722,-0.723,-0.723, - &-0.724,-0.725,-0.726,-0.727,-0.727,-0.728,-0.729,-0.730,-0.731, - &-0.731,-0.732,-0.733,-0.734,-0.735,-0.735,-0.736,-0.737,-0.738, - &-0.738,-0.739,-0.740,-0.741,-0.741,-0.742,-0.743,-0.744,-0.744, - &-0.745,-0.746,-0.747,-0.747,-0.748,-0.749,-0.750,-0.750,-0.751, - &-0.752,-0.753,-0.753,-0.754,-0.755,-0.755,-0.756,-0.757,-0.758, - &-0.758,-0.759,-0.760,-0.760,-0.761,-0.762,-0.762,-0.763,-0.764, - &-0.764,-0.765,-0.766,-0.767,-0.767,-0.768,-0.769,-0.769,-0.770, - &-0.771,-0.771,-0.772,-0.773,-0.773,-0.774,-0.775,-0.775,-0.776, - &-0.777,-0.777,-0.778,-0.778,-0.779,-0.780,-0.780,-0.781,-0.782, - &-0.782,-0.783,-0.784,-0.784,-0.785,-0.785,-0.786,-0.787,-0.787, - &-0.788,-0.789,-0.789,-0.790,-0.790,-0.791,-0.792,-0.792,-0.793, - &-0.793,-0.794,-0.795,-0.795,-0.796,-0.796,-0.797,-0.798,-0.798, - &-0.799,-0.799,-0.800,-0.801,-0.801,-0.802,-0.802,-0.803,-0.804, - &-0.804,-0.805,-0.805,-0.806,-0.812,-0.817,-0.823,-0.828,-0.833, - &-0.838,-0.843,-0.848,-0.852,-0.857,-0.861,-0.866,-0.870,-0.874, - &-0.878,-0.882,-0.886,-0.890,-0.893,-0.897,-0.900,-0.904,-0.907, - &-0.911,-0.914,-0.917,-0.920,-0.924,-0.927,-0.930,-0.933,-0.936, - &-0.938,-0.941,-0.944,-0.947,-0.949,-0.952,-0.954,-0.957,-0.959, - &-0.962,-0.964,-0.967,-0.969,-0.971,-0.973,-0.976,-0.978,-0.980, - &-0.982,-0.984,-0.986,-0.988,-0.990,-0.992,-0.994,-0.996,-0.998, - &-1.000,-1.002,-1.003,-1.005,-1.007,-1.009,-1.010,-1.012,-1.014, - &-1.015,-1.017,-1.019,-1.020,-1.022,-1.023,-1.025,-1.026,-1.028, - &-1.029,-1.031,-1.032,-1.033,-1.035,-1.036,-1.037,-1.039,-1.040, - &-1.041,-1.043,-1.044,-1.045,-1.046,-1.048,-1.049,-1.050,-1.051, - &-1.052,-1.054,-1.055,-1.056,-1.057,-1.058,-1.059,-1.060,-1.061, - &-1.062,-1.063,-1.064,-1.066,-1.067,-1.068,-1.069,-1.070,-1.070, - &-1.071,-1.072,-1.073,-1.074,-1.075,-1.076,-1.077,-1.078,-1.079, - &-1.080,-1.081,-1.081,-1.082,-1.083,-1.084,-1.085,-1.086,-1.086, - &-1.087,-1.088,-1.089,-1.090,-1.090,-1.091,-1.092,-1.093,-1.093, - &-1.094,-1.095,-1.096,-1.096,-1.097,-1.098,-1.099,-1.099,-1.100, - &-1.101,-1.101,-1.102,-1.103,-1.103,-1.104,-1.105,-1.105,-1.106, - &-1.107,-1.107,-1.108 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.046,-0.098,-0.123,-0.140,-0.153,-0.163,-0.172,-0.180,-0.186, - &-0.191,-0.196,-0.201,-0.205,-0.208,-0.212,-0.215,-0.217,-0.220, - &-0.222,-0.224,-0.226,-0.228,-0.230,-0.231,-0.233,-0.234,-0.235, - &-0.237,-0.238,-0.239,-0.240,-0.241,-0.241,-0.242,-0.243,-0.244, - &-0.244,-0.245,-0.246,-0.246,-0.247,-0.247,-0.247,-0.248,-0.248, - &-0.249,-0.249,-0.249,-0.250,-0.250,-0.250,-0.250,-0.251,-0.251, - &-0.251,-0.251,-0.251,-0.251,-0.252,-0.252,-0.252,-0.252,-0.252, - &-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252, - &-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.252,-0.251,-0.251, - &-0.251,-0.251,-0.251,-0.251,-0.250,-0.250,-0.250,-0.250,-0.250, - &-0.249,-0.249,-0.249,-0.249,-0.248,-0.248,-0.248,-0.248,-0.247, - &-0.247,-0.247,-0.246,-0.246,-0.246,-0.245,-0.245,-0.245,-0.244, - &-0.244,-0.244,-0.243,-0.243,-0.243,-0.242,-0.242,-0.241,-0.241, - &-0.241,-0.240,-0.240,-0.239,-0.239,-0.239,-0.238,-0.238,-0.237, - &-0.237,-0.236,-0.236,-0.236,-0.235,-0.235,-0.234,-0.234,-0.233, - &-0.233,-0.233,-0.232,-0.232,-0.231,-0.231,-0.230,-0.230,-0.229, - &-0.229,-0.228,-0.228,-0.228,-0.227,-0.227,-0.226,-0.226,-0.225, - &-0.225,-0.224,-0.224,-0.223,-0.223,-0.222,-0.222,-0.221,-0.221, - &-0.220,-0.220,-0.220,-0.219,-0.219,-0.218,-0.218,-0.217,-0.217, - &-0.216,-0.216,-0.215,-0.215,-0.214,-0.214,-0.213,-0.213,-0.212, - &-0.212,-0.211,-0.211,-0.210,-0.210,-0.210,-0.209,-0.209,-0.208, - &-0.208,-0.207,-0.207,-0.206,-0.206,-0.205,-0.205,-0.204,-0.204, - &-0.203,-0.203,-0.202,-0.202,-0.201,-0.201,-0.200,-0.200,-0.199, - &-0.199,-0.198,-0.198,-0.197,-0.197,-0.197,-0.196,-0.196,-0.195, - &-0.195,-0.194,-0.194,-0.193,-0.193,-0.192,-0.192,-0.191,-0.191, - &-0.190,-0.190,-0.189,-0.189,-0.188,-0.188,-0.187,-0.187,-0.186, - &-0.186,-0.186,-0.185,-0.185,-0.184,-0.184,-0.183,-0.183,-0.182, - &-0.182,-0.181,-0.181,-0.180,-0.180,-0.179,-0.179,-0.178,-0.178, - &-0.177,-0.177,-0.177,-0.176,-0.176,-0.175,-0.175,-0.174,-0.174, - &-0.173,-0.173,-0.172,-0.172,-0.171,-0.171,-0.170,-0.170,-0.170, - &-0.169,-0.169,-0.168,-0.168,-0.167,-0.167,-0.166,-0.166,-0.165, - &-0.165,-0.164,-0.164,-0.164,-0.163,-0.163,-0.162,-0.162,-0.161, - &-0.161,-0.160,-0.160,-0.159,-0.159,-0.159,-0.158,-0.158,-0.157, - &-0.157,-0.156,-0.156,-0.155,-0.155,-0.154,-0.154,-0.154,-0.153, - &-0.153,-0.152,-0.152,-0.151,-0.151,-0.150,-0.150,-0.149,-0.149, - &-0.149,-0.148,-0.148,-0.147,-0.147,-0.146,-0.146,-0.145,-0.145, - &-0.145,-0.144,-0.144,-0.143,-0.143,-0.142,-0.142,-0.142,-0.141, - &-0.141,-0.140,-0.140,-0.139,-0.139,-0.138,-0.138,-0.138,-0.137, - &-0.137,-0.136,-0.136,-0.135,-0.135,-0.135,-0.134,-0.134,-0.133, - &-0.133,-0.132,-0.132,-0.132,-0.131,-0.131,-0.130,-0.130,-0.129, - &-0.129,-0.129,-0.128,-0.128,-0.127,-0.127,-0.126,-0.126,-0.126, - &-0.125,-0.125,-0.124,-0.124,-0.123,-0.123,-0.123,-0.122,-0.122, - &-0.121,-0.121,-0.121,-0.120,-0.120,-0.119,-0.119,-0.118,-0.118, - &-0.118,-0.117,-0.117,-0.116,-0.116,-0.116,-0.115,-0.115,-0.114, - &-0.114,-0.114,-0.113,-0.113,-0.108,-0.104,-0.100,-0.096,-0.092, - &-0.089,-0.085,-0.081,-0.077,-0.074,-0.070,-0.066,-0.063,-0.059, - &-0.055,-0.052,-0.049,-0.045,-0.042,-0.038,-0.035,-0.032,-0.028, - &-0.025,-0.022,-0.019,-0.016,-0.012,-0.009,-0.006,-0.003, 0.000, - & 0.003, 0.006, 0.009, 0.012, 0.014, 0.017, 0.020, 0.023, 0.026, - & 0.029, 0.031, 0.034, 0.037, 0.040, 0.042, 0.045, 0.047, 0.050, - & 0.053, 0.055, 0.058, 0.060, 0.063, 0.065, 0.068, 0.070, 0.073, - & 0.075, 0.078, 0.080, 0.082, 0.085, 0.087, 0.089, 0.092, 0.094, - & 0.096, 0.099, 0.101, 0.103, 0.105, 0.107, 0.110, 0.112, 0.114, - & 0.116, 0.118, 0.120, 0.123, 0.125, 0.127, 0.129, 0.131, 0.133, - & 0.135, 0.137, 0.139, 0.141, 0.143, 0.145, 0.147, 0.149, 0.151, - & 0.153, 0.155, 0.157, 0.159, 0.160, 0.162, 0.164, 0.166, 0.168, - & 0.170, 0.172, 0.173, 0.175, 0.177, 0.179, 0.181, 0.182, 0.184, - & 0.186, 0.188, 0.189, 0.191, 0.193, 0.195, 0.196, 0.198, 0.200, - & 0.201, 0.203, 0.205, 0.206, 0.208, 0.210, 0.211, 0.213, 0.215, - & 0.216, 0.218, 0.219, 0.221, 0.223, 0.224, 0.226, 0.227, 0.229, - & 0.230, 0.232, 0.233, 0.235, 0.236, 0.238, 0.239, 0.241, 0.242, - & 0.244, 0.245, 0.247, 0.248, 0.250, 0.251, 0.253, 0.254, 0.256, - & 0.257, 0.258, 0.260 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.093,-0.202,-0.255,-0.293,-0.323,-0.347,-0.368,-0.386,-0.402, - &-0.417,-0.430,-0.442,-0.453,-0.463,-0.473,-0.482,-0.490,-0.498, - &-0.506,-0.513,-0.520,-0.526,-0.532,-0.538,-0.544,-0.549,-0.555, - &-0.560,-0.565,-0.569,-0.574,-0.578,-0.583,-0.587,-0.591,-0.595, - &-0.598,-0.602,-0.606,-0.609,-0.613,-0.616,-0.619,-0.622,-0.625, - &-0.628,-0.631,-0.634,-0.637,-0.640,-0.642,-0.645,-0.648,-0.650, - &-0.653,-0.655,-0.657,-0.660,-0.662,-0.664,-0.666,-0.669,-0.671, - &-0.673,-0.675,-0.677,-0.679,-0.681,-0.683,-0.685,-0.687,-0.688, - &-0.690,-0.692,-0.694,-0.695,-0.697,-0.699,-0.701,-0.702,-0.704, - &-0.705,-0.707,-0.709,-0.710,-0.712,-0.713,-0.715,-0.716,-0.718, - &-0.719,-0.721,-0.722,-0.723,-0.725,-0.726,-0.727,-0.729,-0.730, - &-0.731,-0.733,-0.734,-0.735,-0.737,-0.738,-0.739,-0.740,-0.741, - &-0.743,-0.744,-0.745,-0.746,-0.747,-0.748,-0.750,-0.751,-0.752, - &-0.753,-0.754,-0.755,-0.756,-0.757,-0.758,-0.759,-0.760,-0.762, - &-0.763,-0.764,-0.765,-0.766,-0.767,-0.768,-0.769,-0.769,-0.770, - &-0.771,-0.772,-0.773,-0.774,-0.775,-0.776,-0.777,-0.778,-0.779, - &-0.780,-0.781,-0.781,-0.782,-0.783,-0.784,-0.785,-0.786,-0.787, - &-0.787,-0.788,-0.789,-0.790,-0.791,-0.792,-0.792,-0.793,-0.794, - &-0.795,-0.795,-0.796,-0.797,-0.798,-0.799,-0.799,-0.800,-0.801, - &-0.802,-0.802,-0.803,-0.804,-0.804,-0.805,-0.806,-0.807,-0.807, - &-0.808,-0.809,-0.809,-0.810,-0.811,-0.811,-0.812,-0.813,-0.814, - &-0.814,-0.815,-0.816,-0.816,-0.817,-0.817,-0.818,-0.819,-0.819, - &-0.820,-0.821,-0.821,-0.822,-0.823,-0.823,-0.824,-0.824,-0.825, - &-0.826,-0.826,-0.827,-0.827,-0.828,-0.829,-0.829,-0.830,-0.830, - &-0.831,-0.831,-0.832,-0.833,-0.833,-0.834,-0.834,-0.835,-0.835, - &-0.836,-0.837,-0.837,-0.838,-0.838,-0.839,-0.839,-0.840,-0.840, - &-0.841,-0.841,-0.842,-0.842,-0.843,-0.843,-0.844,-0.845,-0.845, - &-0.846,-0.846,-0.847,-0.847,-0.848,-0.848,-0.849,-0.849,-0.850, - &-0.850,-0.851,-0.851,-0.851,-0.852,-0.852,-0.853,-0.853,-0.854, - &-0.854,-0.855,-0.855,-0.856,-0.856,-0.857,-0.857,-0.858,-0.858, - &-0.859,-0.859,-0.859,-0.860,-0.860,-0.861,-0.861,-0.862,-0.862, - &-0.863,-0.863,-0.863,-0.864,-0.864,-0.865,-0.865,-0.866,-0.866, - &-0.866,-0.867,-0.867,-0.868,-0.868,-0.869,-0.869,-0.869,-0.870, - &-0.870,-0.871,-0.871,-0.871,-0.872,-0.872,-0.873,-0.873,-0.873, - &-0.874,-0.874,-0.875,-0.875,-0.875,-0.876,-0.876,-0.877,-0.877, - &-0.877,-0.878,-0.878,-0.878,-0.879,-0.879,-0.880,-0.880,-0.880, - &-0.881,-0.881,-0.881,-0.882,-0.882,-0.883,-0.883,-0.883,-0.884, - &-0.884,-0.884,-0.885,-0.885,-0.885,-0.886,-0.886,-0.887,-0.887, - &-0.887,-0.888,-0.888,-0.888,-0.889,-0.889,-0.889,-0.890,-0.890, - &-0.890,-0.891,-0.891,-0.891,-0.892,-0.892,-0.892,-0.893,-0.893, - &-0.893,-0.894,-0.894,-0.894,-0.895,-0.895,-0.895,-0.896,-0.896, - &-0.896,-0.897,-0.897,-0.897,-0.898,-0.898,-0.898,-0.899,-0.899, - &-0.899,-0.900,-0.900,-0.900,-0.901,-0.901,-0.901,-0.901,-0.902, - &-0.902,-0.902,-0.903,-0.903,-0.903,-0.904,-0.904,-0.904,-0.905, - &-0.905,-0.905,-0.905,-0.906,-0.909,-0.912,-0.915,-0.917,-0.920, - &-0.922,-0.925,-0.927,-0.930,-0.932,-0.935,-0.937,-0.939,-0.941, - &-0.943,-0.945,-0.947,-0.949,-0.951,-0.953,-0.955,-0.957,-0.959, - &-0.961,-0.962,-0.964,-0.966,-0.967,-0.969,-0.971,-0.972,-0.974, - &-0.975,-0.977,-0.978,-0.980,-0.981,-0.983,-0.984,-0.986,-0.987, - &-0.988,-0.990,-0.991,-0.992,-0.994,-0.995,-0.996,-0.997,-0.999, - &-1.000,-1.001,-1.002,-1.003,-1.004,-1.006,-1.007,-1.008,-1.009, - &-1.010,-1.011,-1.012,-1.013,-1.014,-1.015,-1.016,-1.017,-1.018, - &-1.019,-1.020,-1.021,-1.022,-1.023,-1.024,-1.025,-1.026,-1.027, - &-1.028,-1.028,-1.029,-1.030,-1.031,-1.032,-1.033,-1.034,-1.034, - &-1.035,-1.036,-1.037,-1.038,-1.039,-1.039,-1.040,-1.041,-1.042, - &-1.042,-1.043,-1.044,-1.045,-1.045,-1.046,-1.047,-1.048,-1.048, - &-1.049,-1.050,-1.050,-1.051,-1.052,-1.052,-1.053,-1.054,-1.055, - &-1.055,-1.056,-1.056,-1.057,-1.058,-1.058,-1.059,-1.060,-1.060, - &-1.061,-1.062,-1.062,-1.063,-1.063,-1.064,-1.065,-1.065,-1.066, - &-1.066,-1.067,-1.068,-1.068,-1.069,-1.069,-1.070,-1.070,-1.071, - &-1.071,-1.072,-1.073,-1.073,-1.074,-1.074,-1.075,-1.075,-1.076, - &-1.076,-1.077,-1.077,-1.078,-1.078,-1.079,-1.079,-1.080,-1.080, - &-1.081,-1.081,-1.082 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.044,-0.088,-0.106,-0.116,-0.123,-0.128,-0.131,-0.133,-0.134, - &-0.134,-0.134,-0.133,-0.131,-0.129,-0.127,-0.125,-0.122,-0.119, - &-0.115,-0.112,-0.108,-0.104,-0.100,-0.095,-0.091,-0.086,-0.081, - &-0.076,-0.071,-0.066,-0.060,-0.055,-0.049,-0.043,-0.037,-0.031, - &-0.025,-0.019,-0.013,-0.006, 0.000, 0.007, 0.013, 0.020, 0.027, - & 0.034, 0.041, 0.048, 0.055, 0.062, 0.069, 0.076, 0.083, 0.090, - & 0.098, 0.105, 0.113, 0.120, 0.127, 0.135, 0.143, 0.150, 0.158, - & 0.166, 0.173, 0.181, 0.189, 0.197, 0.205, 0.212, 0.220, 0.228, - & 0.236, 0.245, 0.253, 0.261, 0.269, 0.277, 0.286, 0.294, 0.302, - & 0.311, 0.319, 0.328, 0.336, 0.345, 0.353, 0.362, 0.371, 0.380, - & 0.388, 0.397, 0.406, 0.415, 0.424, 0.433, 0.442, 0.451, 0.460, - & 0.469, 0.479, 0.488, 0.497, 0.506, 0.516, 0.525, 0.535, 0.544, - & 0.553, 0.563, 0.572, 0.582, 0.591, 0.601, 0.610, 0.620, 0.629, - & 0.639, 0.648, 0.658, 0.667, 0.677, 0.686, 0.696, 0.705, 0.715, - & 0.725, 0.734, 0.744, 0.753, 0.763, 0.772, 0.782, 0.791, 0.800, - & 0.810, 0.819, 0.829, 0.838, 0.848, 0.857, 0.866, 0.876, 0.885, - & 0.894, 0.904, 0.913, 0.922, 0.932, 0.941, 0.950, 0.959, 0.968, - & 0.978, 0.987, 0.996, 1.005, 1.014, 1.023, 1.032, 1.041, 1.050, - & 1.059, 1.069, 1.077, 1.086, 1.095, 1.104, 1.113, 1.122, 1.131, - & 1.140, 1.149, 1.158, 1.166, 1.175, 1.184, 1.193, 1.202, 1.210, - & 1.219, 1.228, 1.236, 1.245, 1.254, 1.262, 1.271, 1.279, 1.288, - & 1.296, 1.305, 1.314, 1.322, 1.330, 1.339, 1.347, 1.356, 1.364, - & 1.373, 1.381, 1.389, 1.398, 1.406, 1.414, 1.422, 1.431, 1.439, - & 1.447, 1.455, 1.464, 1.472, 1.480, 1.488, 1.496, 1.504, 1.512, - & 1.520, 1.528, 1.537, 1.545, 1.553, 1.561, 1.568, 1.576, 1.584, - & 1.592, 1.600, 1.608, 1.616, 1.624, 1.632, 1.639, 1.647, 1.655, - & 1.663, 1.670, 1.678, 1.686, 1.694, 1.701, 1.709, 1.717, 1.724, - & 1.732, 1.740, 1.747, 1.755, 1.762, 1.770, 1.777, 1.785, 1.792, - & 1.800, 1.807, 1.815, 1.822, 1.830, 1.837, 1.844, 1.852, 1.859, - & 1.866, 1.874, 1.881, 1.888, 1.896, 1.903, 1.910, 1.917, 1.925, - & 1.932, 1.939, 1.946, 1.953, 1.961, 1.968, 1.975, 1.982, 1.989, - & 1.996, 2.003, 2.010, 2.017, 2.024, 2.031, 2.038, 2.045, 2.052, - & 2.059, 2.066, 2.073, 2.080, 2.087, 2.094, 2.101, 2.108, 2.114, - & 2.121, 2.128, 2.135, 2.142, 2.148, 2.155, 2.162, 2.169, 2.175, - & 2.182, 2.189, 2.196, 2.202, 2.209, 2.216, 2.222, 2.229, 2.236, - & 2.242, 2.249, 2.255, 2.262, 2.268, 2.275, 2.281, 2.288, 2.295, - & 2.301, 2.308, 2.314, 2.320, 2.327, 2.333, 2.340, 2.346, 2.353, - & 2.359, 2.365, 2.372, 2.378, 2.384, 2.391, 2.397, 2.403, 2.410, - & 2.416, 2.422, 2.429, 2.435, 2.441, 2.447, 2.453, 2.460, 2.466, - & 2.472, 2.478, 2.484, 2.491, 2.497, 2.503, 2.509, 2.515, 2.521, - & 2.527, 2.533, 2.539, 2.546, 2.552, 2.558, 2.564, 2.570, 2.576, - & 2.582, 2.588, 2.594, 2.600, 2.606, 2.612, 2.617, 2.623, 2.629, - & 2.635, 2.641, 2.647, 2.653, 2.659, 2.665, 2.670, 2.676, 2.682, - & 2.688, 2.694, 2.700, 2.705, 2.711, 2.717, 2.723, 2.728, 2.734, - & 2.740, 2.746, 2.751, 2.757, 2.818, 2.874, 2.928, 2.982, 3.035, - & 3.087, 3.139, 3.190, 3.239, 3.289, 3.337, 3.385, 3.432, 3.479, - & 3.525, 3.571, 3.615, 3.660, 3.703, 3.746, 3.789, 3.831, 3.873, - & 3.914, 3.954, 3.995, 4.034, 4.073, 4.112, 4.151, 4.189, 4.226, - & 4.263, 4.300, 4.336, 4.372, 4.408, 4.443, 4.478, 4.513, 4.547, - & 4.581, 4.614, 4.647, 4.680, 4.713, 4.745, 4.777, 4.809, 4.840, - & 4.871, 4.902, 4.933, 4.963, 4.993, 5.023, 5.052, 5.082, 5.111, - & 5.140, 5.168, 5.196, 5.224, 5.252, 5.280, 5.307, 5.335, 5.362, - & 5.388, 5.415, 5.441, 5.468, 5.494, 5.519, 5.545, 5.570, 5.596, - & 5.621, 5.646, 5.670, 5.695, 5.719, 5.743, 5.767, 5.791, 5.815, - & 5.838, 5.862, 5.885, 5.908, 5.931, 5.954, 5.976, 5.999, 6.021, - & 6.043, 6.065, 6.087, 6.109, 6.130, 6.152, 6.173, 6.194, 6.215, - & 6.236, 6.257, 6.278, 6.298, 6.319, 6.339, 6.359, 6.380, 6.400, - & 6.419, 6.439, 6.459, 6.478, 6.498, 6.517, 6.536, 6.555, 6.574, - & 6.593, 6.612, 6.631, 6.649, 6.668, 6.686, 6.705, 6.723, 6.741, - & 6.759, 6.777, 6.795, 6.812, 6.830, 6.848, 6.865, 6.882, 6.900, - & 6.917, 6.934, 6.951, 6.968, 6.985, 7.002, 7.018, 7.035, 7.052, - & 7.068, 7.084, 7.101, 7.117, 7.133, 7.149, 7.165, 7.181, 7.197, - & 7.213, 7.229, 7.244 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.046,-0.097,-0.122,-0.138,-0.151,-0.162,-0.170,-0.177,-0.184, - &-0.189,-0.194,-0.198,-0.202,-0.206,-0.209,-0.212,-0.214,-0.216, - &-0.218,-0.220,-0.222,-0.223,-0.224,-0.225,-0.226,-0.227,-0.227, - &-0.228,-0.228,-0.228,-0.228,-0.228,-0.228,-0.228,-0.228,-0.227, - &-0.227,-0.226,-0.225,-0.225,-0.224,-0.223,-0.222,-0.221,-0.220, - &-0.219,-0.218,-0.216,-0.215,-0.214,-0.212,-0.211,-0.209,-0.208, - &-0.206,-0.204,-0.203,-0.201,-0.199,-0.197,-0.195,-0.193,-0.192, - &-0.190,-0.188,-0.185,-0.183,-0.181,-0.179,-0.177,-0.175,-0.173, - &-0.170,-0.168,-0.166,-0.163,-0.161,-0.159,-0.156,-0.154,-0.151, - &-0.149,-0.146,-0.144,-0.141,-0.139,-0.136,-0.133,-0.131,-0.128, - &-0.125,-0.122,-0.120,-0.117,-0.114,-0.111,-0.108,-0.106,-0.103, - &-0.100,-0.097,-0.094,-0.091,-0.088,-0.085,-0.082,-0.079,-0.076, - &-0.073,-0.070,-0.067,-0.064,-0.061,-0.058,-0.055,-0.052,-0.049, - &-0.045,-0.042,-0.039,-0.036,-0.033,-0.030,-0.027,-0.024,-0.021, - &-0.018,-0.014,-0.011,-0.008,-0.005,-0.002, 0.001, 0.004, 0.007, - & 0.010, 0.013, 0.016, 0.020, 0.023, 0.026, 0.029, 0.032, 0.035, - & 0.038, 0.041, 0.044, 0.047, 0.050, 0.053, 0.056, 0.059, 0.062, - & 0.065, 0.068, 0.071, 0.074, 0.077, 0.080, 0.083, 0.086, 0.089, - & 0.092, 0.095, 0.098, 0.101, 0.104, 0.106, 0.109, 0.112, 0.115, - & 0.118, 0.121, 0.124, 0.127, 0.130, 0.132, 0.135, 0.138, 0.141, - & 0.144, 0.147, 0.150, 0.152, 0.155, 0.158, 0.161, 0.164, 0.166, - & 0.169, 0.172, 0.175, 0.177, 0.180, 0.183, 0.186, 0.188, 0.191, - & 0.194, 0.197, 0.199, 0.202, 0.205, 0.208, 0.210, 0.213, 0.216, - & 0.218, 0.221, 0.224, 0.226, 0.229, 0.232, 0.234, 0.237, 0.239, - & 0.242, 0.245, 0.247, 0.250, 0.253, 0.255, 0.258, 0.260, 0.263, - & 0.265, 0.268, 0.271, 0.273, 0.276, 0.278, 0.281, 0.283, 0.286, - & 0.288, 0.291, 0.293, 0.296, 0.298, 0.301, 0.303, 0.306, 0.308, - & 0.311, 0.313, 0.316, 0.318, 0.321, 0.323, 0.326, 0.328, 0.330, - & 0.333, 0.335, 0.338, 0.340, 0.343, 0.345, 0.347, 0.350, 0.352, - & 0.355, 0.357, 0.359, 0.362, 0.364, 0.366, 0.369, 0.371, 0.374, - & 0.376, 0.378, 0.381, 0.383, 0.385, 0.388, 0.390, 0.392, 0.394, - & 0.397, 0.399, 0.401, 0.404, 0.406, 0.408, 0.410, 0.413, 0.415, - & 0.417, 0.420, 0.422, 0.424, 0.426, 0.429, 0.431, 0.433, 0.435, - & 0.437, 0.440, 0.442, 0.444, 0.446, 0.449, 0.451, 0.453, 0.455, - & 0.457, 0.460, 0.462, 0.464, 0.466, 0.468, 0.470, 0.473, 0.475, - & 0.477, 0.479, 0.481, 0.483, 0.485, 0.488, 0.490, 0.492, 0.494, - & 0.496, 0.498, 0.500, 0.502, 0.504, 0.507, 0.509, 0.511, 0.513, - & 0.515, 0.517, 0.519, 0.521, 0.523, 0.525, 0.527, 0.529, 0.531, - & 0.534, 0.536, 0.538, 0.540, 0.542, 0.544, 0.546, 0.548, 0.550, - & 0.552, 0.554, 0.556, 0.558, 0.560, 0.562, 0.564, 0.566, 0.568, - & 0.570, 0.572, 0.574, 0.576, 0.578, 0.580, 0.582, 0.584, 0.586, - & 0.588, 0.590, 0.592, 0.593, 0.595, 0.597, 0.599, 0.601, 0.603, - & 0.605, 0.607, 0.609, 0.611, 0.613, 0.615, 0.617, 0.619, 0.620, - & 0.622, 0.624, 0.626, 0.628, 0.630, 0.632, 0.634, 0.636, 0.637, - & 0.639, 0.641, 0.643, 0.645, 0.665, 0.683, 0.701, 0.719, 0.736, - & 0.753, 0.770, 0.787, 0.803, 0.820, 0.836, 0.852, 0.867, 0.883, - & 0.898, 0.913, 0.928, 0.942, 0.957, 0.971, 0.985, 0.999, 1.013, - & 1.027, 1.040, 1.053, 1.067, 1.080, 1.093, 1.105, 1.118, 1.131, - & 1.143, 1.155, 1.167, 1.179, 1.191, 1.203, 1.215, 1.226, 1.238, - & 1.249, 1.260, 1.271, 1.283, 1.293, 1.304, 1.315, 1.326, 1.336, - & 1.347, 1.357, 1.367, 1.377, 1.388, 1.398, 1.408, 1.417, 1.427, - & 1.437, 1.446, 1.456, 1.466, 1.475, 1.484, 1.493, 1.503, 1.512, - & 1.521, 1.530, 1.539, 1.548, 1.556, 1.565, 1.574, 1.582, 1.591, - & 1.599, 1.608, 1.616, 1.624, 1.633, 1.641, 1.649, 1.657, 1.665, - & 1.673, 1.681, 1.689, 1.697, 1.704, 1.712, 1.720, 1.727, 1.735, - & 1.742, 1.750, 1.757, 1.765, 1.772, 1.779, 1.787, 1.794, 1.801, - & 1.808, 1.815, 1.822, 1.829, 1.836, 1.843, 1.850, 1.857, 1.864, - & 1.870, 1.877, 1.884, 1.890, 1.897, 1.904, 1.910, 1.917, 1.923, - & 1.930, 1.936, 1.942, 1.949, 1.955, 1.961, 1.968, 1.974, 1.980, - & 1.986, 1.992, 1.998, 2.004, 2.010, 2.016, 2.022, 2.028, 2.034, - & 2.040, 2.046, 2.052, 2.058, 2.063, 2.069, 2.075, 2.080, 2.086, - & 2.092, 2.097, 2.103, 2.108, 2.114, 2.119, 2.125, 2.130, 2.136, - & 2.141, 2.147, 2.152 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.045,-0.094,-0.116,-0.130,-0.140,-0.147,-0.153,-0.158,-0.162, - &-0.165,-0.167,-0.169,-0.171,-0.172,-0.173,-0.173,-0.174,-0.174, - &-0.174,-0.173,-0.173,-0.172,-0.172,-0.171,-0.170,-0.169,-0.168, - &-0.167,-0.166,-0.165,-0.163,-0.162,-0.161,-0.159,-0.158,-0.156, - &-0.155,-0.153,-0.152,-0.150,-0.148,-0.147,-0.145,-0.143,-0.142, - &-0.140,-0.138,-0.136,-0.135,-0.133,-0.131,-0.129,-0.127,-0.126, - &-0.124,-0.122,-0.120,-0.118,-0.117,-0.115,-0.113,-0.111,-0.109, - &-0.107,-0.106,-0.104,-0.102,-0.100,-0.098,-0.096,-0.094,-0.092, - &-0.090,-0.088,-0.086,-0.084,-0.083,-0.081,-0.079,-0.077,-0.074, - &-0.072,-0.070,-0.068,-0.066,-0.064,-0.062,-0.060,-0.058,-0.056, - &-0.053,-0.051,-0.049,-0.047,-0.045,-0.042,-0.040,-0.038,-0.036, - &-0.033,-0.031,-0.029,-0.026,-0.024,-0.022,-0.019,-0.017,-0.015, - &-0.012,-0.010,-0.008,-0.005,-0.003, 0.000, 0.002, 0.004, 0.007, - & 0.009, 0.012, 0.014, 0.017, 0.019, 0.022, 0.024, 0.026, 0.029, - & 0.031, 0.034, 0.036, 0.039, 0.041, 0.044, 0.046, 0.049, 0.051, - & 0.053, 0.056, 0.058, 0.061, 0.063, 0.066, 0.068, 0.071, 0.073, - & 0.075, 0.078, 0.080, 0.083, 0.085, 0.088, 0.090, 0.092, 0.095, - & 0.097, 0.100, 0.102, 0.105, 0.107, 0.109, 0.112, 0.114, 0.117, - & 0.119, 0.121, 0.124, 0.126, 0.129, 0.131, 0.133, 0.136, 0.138, - & 0.140, 0.143, 0.145, 0.148, 0.150, 0.152, 0.155, 0.157, 0.159, - & 0.162, 0.164, 0.166, 0.169, 0.171, 0.173, 0.176, 0.178, 0.180, - & 0.183, 0.185, 0.187, 0.190, 0.192, 0.194, 0.197, 0.199, 0.201, - & 0.204, 0.206, 0.208, 0.210, 0.213, 0.215, 0.217, 0.220, 0.222, - & 0.224, 0.226, 0.229, 0.231, 0.233, 0.235, 0.238, 0.240, 0.242, - & 0.244, 0.247, 0.249, 0.251, 0.253, 0.256, 0.258, 0.260, 0.262, - & 0.264, 0.267, 0.269, 0.271, 0.273, 0.275, 0.278, 0.280, 0.282, - & 0.284, 0.286, 0.288, 0.291, 0.293, 0.295, 0.297, 0.299, 0.301, - & 0.304, 0.306, 0.308, 0.310, 0.312, 0.314, 0.317, 0.319, 0.321, - & 0.323, 0.325, 0.327, 0.329, 0.331, 0.333, 0.336, 0.338, 0.340, - & 0.342, 0.344, 0.346, 0.348, 0.350, 0.352, 0.354, 0.356, 0.359, - & 0.361, 0.363, 0.365, 0.367, 0.369, 0.371, 0.373, 0.375, 0.377, - & 0.379, 0.381, 0.383, 0.385, 0.387, 0.389, 0.391, 0.393, 0.395, - & 0.397, 0.399, 0.401, 0.403, 0.405, 0.407, 0.409, 0.411, 0.413, - & 0.415, 0.417, 0.419, 0.421, 0.423, 0.425, 0.427, 0.429, 0.431, - & 0.433, 0.435, 0.437, 0.439, 0.441, 0.443, 0.445, 0.447, 0.449, - & 0.451, 0.453, 0.455, 0.456, 0.458, 0.460, 0.462, 0.464, 0.466, - & 0.468, 0.470, 0.472, 0.474, 0.476, 0.477, 0.479, 0.481, 0.483, - & 0.485, 0.487, 0.489, 0.491, 0.493, 0.494, 0.496, 0.498, 0.500, - & 0.502, 0.504, 0.506, 0.507, 0.509, 0.511, 0.513, 0.515, 0.517, - & 0.518, 0.520, 0.522, 0.524, 0.526, 0.528, 0.529, 0.531, 0.533, - & 0.535, 0.537, 0.539, 0.540, 0.542, 0.544, 0.546, 0.547, 0.549, - & 0.551, 0.553, 0.555, 0.556, 0.558, 0.560, 0.562, 0.564, 0.565, - & 0.567, 0.569, 0.571, 0.572, 0.574, 0.576, 0.578, 0.579, 0.581, - & 0.583, 0.585, 0.586, 0.588, 0.590, 0.592, 0.593, 0.595, 0.597, - & 0.598, 0.600, 0.602, 0.604, 0.622, 0.639, 0.655, 0.672, 0.688, - & 0.704, 0.719, 0.735, 0.750, 0.765, 0.780, 0.795, 0.809, 0.824, - & 0.838, 0.852, 0.866, 0.879, 0.893, 0.906, 0.919, 0.932, 0.945, - & 0.958, 0.971, 0.983, 0.996, 1.008, 1.020, 1.032, 1.044, 1.055, - & 1.067, 1.079, 1.090, 1.101, 1.112, 1.123, 1.134, 1.145, 1.156, - & 1.167, 1.177, 1.188, 1.198, 1.208, 1.218, 1.228, 1.238, 1.248, - & 1.258, 1.268, 1.278, 1.287, 1.297, 1.306, 1.315, 1.325, 1.334, - & 1.343, 1.352, 1.361, 1.370, 1.379, 1.387, 1.396, 1.405, 1.413, - & 1.422, 1.430, 1.438, 1.447, 1.455, 1.463, 1.471, 1.479, 1.487, - & 1.495, 1.503, 1.511, 1.519, 1.527, 1.534, 1.542, 1.550, 1.557, - & 1.565, 1.572, 1.579, 1.587, 1.594, 1.601, 1.608, 1.616, 1.623, - & 1.630, 1.637, 1.644, 1.651, 1.657, 1.664, 1.671, 1.678, 1.685, - & 1.691, 1.698, 1.704, 1.711, 1.718, 1.724, 1.730, 1.737, 1.743, - & 1.750, 1.756, 1.762, 1.768, 1.775, 1.781, 1.787, 1.793, 1.799, - & 1.805, 1.811, 1.817, 1.823, 1.829, 1.835, 1.841, 1.846, 1.852, - & 1.858, 1.864, 1.869, 1.875, 1.881, 1.886, 1.892, 1.897, 1.903, - & 1.908, 1.914, 1.919, 1.925, 1.930, 1.936, 1.941, 1.946, 1.952, - & 1.957, 1.962, 1.967, 1.972, 1.978, 1.983, 1.988, 1.993, 1.998, - & 2.003, 2.008, 2.013 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.044,-0.089,-0.107,-0.118,-0.125,-0.130,-0.133,-0.135,-0.136, - &-0.136,-0.136,-0.135,-0.134,-0.132,-0.130,-0.128,-0.125,-0.122, - &-0.119,-0.116,-0.113,-0.109,-0.105,-0.102,-0.098,-0.094,-0.089, - &-0.085,-0.081,-0.076,-0.072,-0.067,-0.062,-0.057,-0.053,-0.048, - &-0.043,-0.038,-0.033,-0.028,-0.022,-0.017,-0.012,-0.007,-0.001, - & 0.004, 0.009, 0.015, 0.020, 0.025, 0.031, 0.036, 0.042, 0.047, - & 0.053, 0.058, 0.064, 0.069, 0.075, 0.081, 0.086, 0.092, 0.097, - & 0.103, 0.109, 0.114, 0.120, 0.126, 0.132, 0.137, 0.143, 0.149, - & 0.155, 0.161, 0.167, 0.172, 0.178, 0.184, 0.190, 0.196, 0.202, - & 0.208, 0.214, 0.220, 0.227, 0.233, 0.239, 0.245, 0.251, 0.258, - & 0.264, 0.270, 0.277, 0.283, 0.290, 0.296, 0.303, 0.309, 0.316, - & 0.322, 0.329, 0.335, 0.342, 0.349, 0.355, 0.362, 0.369, 0.376, - & 0.382, 0.389, 0.396, 0.403, 0.409, 0.416, 0.423, 0.430, 0.437, - & 0.444, 0.450, 0.457, 0.464, 0.471, 0.478, 0.485, 0.491, 0.498, - & 0.505, 0.512, 0.519, 0.526, 0.533, 0.539, 0.546, 0.553, 0.560, - & 0.567, 0.573, 0.580, 0.587, 0.594, 0.601, 0.607, 0.614, 0.621, - & 0.628, 0.634, 0.641, 0.648, 0.654, 0.661, 0.668, 0.675, 0.681, - & 0.688, 0.694, 0.701, 0.708, 0.714, 0.721, 0.728, 0.734, 0.741, - & 0.747, 0.754, 0.760, 0.767, 0.773, 0.780, 0.786, 0.793, 0.799, - & 0.806, 0.812, 0.819, 0.825, 0.831, 0.838, 0.844, 0.850, 0.857, - & 0.863, 0.870, 0.876, 0.882, 0.888, 0.895, 0.901, 0.907, 0.914, - & 0.920, 0.926, 0.932, 0.938, 0.945, 0.951, 0.957, 0.963, 0.969, - & 0.975, 0.981, 0.988, 0.994, 1.000, 1.006, 1.012, 1.018, 1.024, - & 1.030, 1.036, 1.042, 1.048, 1.054, 1.060, 1.066, 1.072, 1.078, - & 1.084, 1.090, 1.096, 1.101, 1.107, 1.113, 1.119, 1.125, 1.131, - & 1.137, 1.142, 1.148, 1.154, 1.160, 1.165, 1.171, 1.177, 1.183, - & 1.188, 1.194, 1.200, 1.205, 1.211, 1.217, 1.222, 1.228, 1.234, - & 1.239, 1.245, 1.251, 1.256, 1.262, 1.267, 1.273, 1.278, 1.284, - & 1.289, 1.295, 1.300, 1.306, 1.311, 1.317, 1.322, 1.328, 1.333, - & 1.339, 1.344, 1.349, 1.355, 1.360, 1.366, 1.371, 1.376, 1.382, - & 1.387, 1.392, 1.398, 1.403, 1.408, 1.413, 1.419, 1.424, 1.429, - & 1.434, 1.440, 1.445, 1.450, 1.455, 1.460, 1.466, 1.471, 1.476, - & 1.481, 1.486, 1.491, 1.497, 1.502, 1.507, 1.512, 1.517, 1.522, - & 1.527, 1.532, 1.537, 1.542, 1.547, 1.552, 1.557, 1.562, 1.567, - & 1.572, 1.577, 1.582, 1.587, 1.592, 1.597, 1.602, 1.607, 1.612, - & 1.617, 1.622, 1.626, 1.631, 1.636, 1.641, 1.646, 1.651, 1.656, - & 1.660, 1.665, 1.670, 1.675, 1.680, 1.684, 1.689, 1.694, 1.699, - & 1.703, 1.708, 1.713, 1.718, 1.722, 1.727, 1.732, 1.736, 1.741, - & 1.746, 1.750, 1.755, 1.760, 1.764, 1.769, 1.774, 1.778, 1.783, - & 1.787, 1.792, 1.797, 1.801, 1.806, 1.810, 1.815, 1.819, 1.824, - & 1.828, 1.833, 1.838, 1.842, 1.847, 1.851, 1.855, 1.860, 1.864, - & 1.869, 1.873, 1.878, 1.882, 1.887, 1.891, 1.895, 1.900, 1.904, - & 1.909, 1.913, 1.917, 1.922, 1.926, 1.931, 1.935, 1.939, 1.944, - & 1.948, 1.952, 1.957, 1.961, 1.965, 1.969, 1.974, 1.978, 1.982, - & 1.987, 1.991, 1.995, 1.999, 2.045, 2.086, 2.127, 2.167, 2.206, - & 2.245, 2.284, 2.322, 2.359, 2.396, 2.432, 2.468, 2.503, 2.538, - & 2.572, 2.606, 2.639, 2.672, 2.705, 2.737, 2.769, 2.800, 2.831, - & 2.862, 2.892, 2.922, 2.952, 2.981, 3.010, 3.039, 3.067, 3.095, - & 3.123, 3.150, 3.178, 3.204, 3.231, 3.257, 3.283, 3.309, 3.335, - & 3.360, 3.385, 3.410, 3.435, 3.459, 3.483, 3.507, 3.531, 3.554, - & 3.577, 3.600, 3.623, 3.646, 3.668, 3.691, 3.713, 3.735, 3.756, - & 3.778, 3.799, 3.820, 3.841, 3.862, 3.883, 3.903, 3.924, 3.944, - & 3.964, 3.984, 4.003, 4.023, 4.043, 4.062, 4.081, 4.100, 4.119, - & 4.138, 4.156, 4.175, 4.193, 4.211, 4.229, 4.247, 4.265, 4.283, - & 4.300, 4.318, 4.335, 4.352, 4.369, 4.386, 4.403, 4.420, 4.437, - & 4.453, 4.470, 4.486, 4.503, 4.519, 4.535, 4.551, 4.567, 4.582, - & 4.598, 4.614, 4.629, 4.644, 4.660, 4.675, 4.690, 4.705, 4.720, - & 4.735, 4.750, 4.764, 4.779, 4.794, 4.808, 4.822, 4.837, 4.851, - & 4.865, 4.879, 4.893, 4.907, 4.921, 4.935, 4.948, 4.962, 4.975, - & 4.989, 5.002, 5.016, 5.029, 5.042, 5.055, 5.068, 5.081, 5.094, - & 5.107, 5.120, 5.133, 5.145, 5.158, 5.171, 5.183, 5.196, 5.208, - & 5.220, 5.233, 5.245, 5.257, 5.269, 5.281, 5.293, 5.305, 5.317, - & 5.329, 5.340, 5.352 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.045,-0.094,-0.116,-0.130,-0.140,-0.148,-0.155,-0.160,-0.164, - &-0.168,-0.170,-0.173,-0.174,-0.176,-0.177,-0.178,-0.178,-0.179, - &-0.179,-0.178,-0.178,-0.177,-0.177,-0.176,-0.175,-0.174,-0.172, - &-0.171,-0.170,-0.168,-0.166,-0.164,-0.162,-0.160,-0.158,-0.156, - &-0.154,-0.152,-0.149,-0.147,-0.144,-0.142,-0.139,-0.136,-0.134, - &-0.131,-0.128,-0.125,-0.122,-0.119,-0.116,-0.113,-0.110,-0.107, - &-0.103,-0.100,-0.097,-0.094,-0.090,-0.087,-0.084,-0.080,-0.077, - &-0.073,-0.070,-0.066,-0.063,-0.059,-0.055,-0.052,-0.048,-0.044, - &-0.040,-0.037,-0.033,-0.029,-0.025,-0.021,-0.017,-0.013,-0.010, - &-0.006,-0.002, 0.003, 0.007, 0.011, 0.015, 0.019, 0.023, 0.027, - & 0.032, 0.036, 0.040, 0.045, 0.049, 0.053, 0.058, 0.062, 0.066, - & 0.071, 0.075, 0.080, 0.084, 0.089, 0.094, 0.098, 0.103, 0.107, - & 0.112, 0.116, 0.121, 0.126, 0.130, 0.135, 0.140, 0.144, 0.149, - & 0.154, 0.158, 0.163, 0.168, 0.172, 0.177, 0.182, 0.186, 0.191, - & 0.196, 0.200, 0.205, 0.210, 0.215, 0.219, 0.224, 0.229, 0.233, - & 0.238, 0.242, 0.247, 0.252, 0.256, 0.261, 0.266, 0.270, 0.275, - & 0.279, 0.284, 0.289, 0.293, 0.298, 0.302, 0.307, 0.311, 0.316, - & 0.320, 0.325, 0.329, 0.334, 0.338, 0.343, 0.347, 0.352, 0.356, - & 0.361, 0.365, 0.370, 0.374, 0.379, 0.383, 0.387, 0.392, 0.396, - & 0.400, 0.405, 0.409, 0.414, 0.418, 0.422, 0.427, 0.431, 0.435, - & 0.440, 0.444, 0.448, 0.452, 0.457, 0.461, 0.465, 0.469, 0.474, - & 0.478, 0.482, 0.486, 0.490, 0.495, 0.499, 0.503, 0.507, 0.511, - & 0.515, 0.520, 0.524, 0.528, 0.532, 0.536, 0.540, 0.544, 0.548, - & 0.552, 0.556, 0.561, 0.565, 0.569, 0.573, 0.577, 0.581, 0.585, - & 0.589, 0.593, 0.597, 0.601, 0.605, 0.609, 0.613, 0.616, 0.620, - & 0.624, 0.628, 0.632, 0.636, 0.640, 0.644, 0.648, 0.652, 0.655, - & 0.659, 0.663, 0.667, 0.671, 0.675, 0.679, 0.682, 0.686, 0.690, - & 0.694, 0.697, 0.701, 0.705, 0.709, 0.713, 0.716, 0.720, 0.724, - & 0.728, 0.731, 0.735, 0.739, 0.742, 0.746, 0.750, 0.753, 0.757, - & 0.761, 0.764, 0.768, 0.772, 0.775, 0.779, 0.783, 0.786, 0.790, - & 0.793, 0.797, 0.801, 0.804, 0.808, 0.811, 0.815, 0.818, 0.822, - & 0.825, 0.829, 0.833, 0.836, 0.840, 0.843, 0.847, 0.850, 0.854, - & 0.857, 0.861, 0.864, 0.867, 0.871, 0.874, 0.878, 0.881, 0.885, - & 0.888, 0.892, 0.895, 0.898, 0.902, 0.905, 0.909, 0.912, 0.915, - & 0.919, 0.922, 0.925, 0.929, 0.932, 0.935, 0.939, 0.942, 0.945, - & 0.949, 0.952, 0.955, 0.959, 0.962, 0.965, 0.969, 0.972, 0.975, - & 0.978, 0.982, 0.985, 0.988, 0.991, 0.995, 0.998, 1.001, 1.004, - & 1.008, 1.011, 1.014, 1.017, 1.020, 1.024, 1.027, 1.030, 1.033, - & 1.036, 1.039, 1.043, 1.046, 1.049, 1.052, 1.055, 1.058, 1.061, - & 1.065, 1.068, 1.071, 1.074, 1.077, 1.080, 1.083, 1.086, 1.089, - & 1.092, 1.096, 1.099, 1.102, 1.105, 1.108, 1.111, 1.114, 1.117, - & 1.120, 1.123, 1.126, 1.129, 1.132, 1.135, 1.138, 1.141, 1.144, - & 1.147, 1.150, 1.153, 1.156, 1.159, 1.162, 1.165, 1.168, 1.171, - & 1.174, 1.177, 1.180, 1.183, 1.185, 1.188, 1.191, 1.194, 1.197, - & 1.200, 1.203, 1.206, 1.209, 1.240, 1.268, 1.296, 1.323, 1.350, - & 1.377, 1.403, 1.429, 1.454, 1.480, 1.505, 1.529, 1.553, 1.577, - & 1.601, 1.624, 1.647, 1.670, 1.692, 1.715, 1.737, 1.758, 1.780, - & 1.801, 1.822, 1.843, 1.863, 1.883, 1.903, 1.923, 1.943, 1.962, - & 1.981, 2.000, 2.019, 2.038, 2.056, 2.075, 2.093, 2.111, 2.128, - & 2.146, 2.163, 2.181, 2.198, 2.215, 2.231, 2.248, 2.264, 2.281, - & 2.297, 2.313, 2.329, 2.345, 2.360, 2.376, 2.391, 2.406, 2.422, - & 2.437, 2.451, 2.466, 2.481, 2.495, 2.510, 2.524, 2.538, 2.552, - & 2.566, 2.580, 2.594, 2.608, 2.621, 2.635, 2.648, 2.661, 2.674, - & 2.687, 2.700, 2.713, 2.726, 2.739, 2.751, 2.764, 2.776, 2.789, - & 2.801, 2.813, 2.825, 2.838, 2.850, 2.861, 2.873, 2.885, 2.897, - & 2.908, 2.920, 2.931, 2.943, 2.954, 2.965, 2.976, 2.987, 2.998, - & 3.009, 3.020, 3.031, 3.042, 3.053, 3.063, 3.074, 3.084, 3.095, - & 3.105, 3.116, 3.126, 3.136, 3.146, 3.156, 3.166, 3.176, 3.186, - & 3.196, 3.206, 3.216, 3.226, 3.235, 3.245, 3.255, 3.264, 3.274, - & 3.283, 3.292, 3.302, 3.311, 3.320, 3.330, 3.339, 3.348, 3.357, - & 3.366, 3.375, 3.384, 3.393, 3.402, 3.410, 3.419, 3.428, 3.437, - & 3.445, 3.454, 3.462, 3.471, 3.479, 3.488, 3.496, 3.505, 3.513, - & 3.521, 3.529, 3.538 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.074,-0.160,-0.203,-0.233,-0.256,-0.275,-0.291,-0.306,-0.318, - &-0.329,-0.339,-0.349,-0.357,-0.365,-0.372,-0.379,-0.386,-0.392, - &-0.397,-0.402,-0.407,-0.412,-0.417,-0.421,-0.425,-0.429,-0.433, - &-0.436,-0.439,-0.443,-0.446,-0.448,-0.451,-0.454,-0.456,-0.459, - &-0.461,-0.463,-0.466,-0.468,-0.470,-0.471,-0.473,-0.475,-0.477, - &-0.478,-0.480,-0.481,-0.482,-0.484,-0.485,-0.486,-0.487,-0.488, - &-0.489,-0.490,-0.491,-0.492,-0.493,-0.494,-0.495,-0.496,-0.496, - &-0.497,-0.498,-0.498,-0.499,-0.499,-0.500,-0.500,-0.501,-0.501, - &-0.501,-0.502,-0.502,-0.502,-0.503,-0.503,-0.503,-0.503,-0.503, - &-0.504,-0.504,-0.504,-0.504,-0.504,-0.504,-0.504,-0.504,-0.504, - &-0.504,-0.504,-0.504,-0.504,-0.504,-0.503,-0.503,-0.503,-0.503, - &-0.503,-0.503,-0.502,-0.502,-0.502,-0.502,-0.501,-0.501,-0.501, - &-0.501,-0.500,-0.500,-0.500,-0.499,-0.499,-0.498,-0.498,-0.498, - &-0.497,-0.497,-0.497,-0.496,-0.496,-0.495,-0.495,-0.494,-0.494, - &-0.494,-0.493,-0.493,-0.492,-0.492,-0.491,-0.491,-0.490,-0.490, - &-0.489,-0.489,-0.488,-0.488,-0.487,-0.487,-0.486,-0.486,-0.485, - &-0.485,-0.484,-0.484,-0.483,-0.483,-0.482,-0.482,-0.481,-0.481, - &-0.480,-0.479,-0.479,-0.478,-0.478,-0.477,-0.477,-0.476,-0.476, - &-0.475,-0.475,-0.474,-0.473,-0.473,-0.472,-0.472,-0.471,-0.471, - &-0.470,-0.470,-0.469,-0.468,-0.468,-0.467,-0.467,-0.466,-0.466, - &-0.465,-0.464,-0.464,-0.463,-0.463,-0.462,-0.462,-0.461,-0.461, - &-0.460,-0.459,-0.459,-0.458,-0.458,-0.457,-0.457,-0.456,-0.455, - &-0.455,-0.454,-0.454,-0.453,-0.453,-0.452,-0.451,-0.451,-0.450, - &-0.450,-0.449,-0.449,-0.448,-0.447,-0.447,-0.446,-0.446,-0.445, - &-0.445,-0.444,-0.443,-0.443,-0.442,-0.442,-0.441,-0.441,-0.440, - &-0.440,-0.439,-0.438,-0.438,-0.437,-0.437,-0.436,-0.436,-0.435, - &-0.434,-0.434,-0.433,-0.433,-0.432,-0.432,-0.431,-0.431,-0.430, - &-0.429,-0.429,-0.428,-0.428,-0.427,-0.427,-0.426,-0.426,-0.425, - &-0.424,-0.424,-0.423,-0.423,-0.422,-0.422,-0.421,-0.421,-0.420, - &-0.419,-0.419,-0.418,-0.418,-0.417,-0.417,-0.416,-0.416,-0.415, - &-0.415,-0.414,-0.413,-0.413,-0.412,-0.412,-0.411,-0.411,-0.410, - &-0.410,-0.409,-0.409,-0.408,-0.408,-0.407,-0.406,-0.406,-0.405, - &-0.405,-0.404,-0.404,-0.403,-0.403,-0.402,-0.402,-0.401,-0.401, - &-0.400,-0.399,-0.399,-0.398,-0.398,-0.397,-0.397,-0.396,-0.396, - &-0.395,-0.395,-0.394,-0.394,-0.393,-0.393,-0.392,-0.392,-0.391, - &-0.391,-0.390,-0.390,-0.389,-0.388,-0.388,-0.387,-0.387,-0.386, - &-0.386,-0.385,-0.385,-0.384,-0.384,-0.383,-0.383,-0.382,-0.382, - &-0.381,-0.381,-0.380,-0.380,-0.379,-0.379,-0.378,-0.378,-0.377, - &-0.377,-0.376,-0.376,-0.375,-0.375,-0.374,-0.374,-0.373,-0.373, - &-0.372,-0.372,-0.371,-0.371,-0.370,-0.370,-0.369,-0.369,-0.368, - &-0.368,-0.367,-0.367,-0.366,-0.366,-0.365,-0.365,-0.364,-0.364, - &-0.363,-0.363,-0.362,-0.362,-0.361,-0.361,-0.360,-0.360,-0.359, - &-0.359,-0.358,-0.358,-0.357,-0.357,-0.356,-0.356,-0.355,-0.355, - &-0.354,-0.354,-0.353,-0.353,-0.352,-0.352,-0.352,-0.351,-0.351, - &-0.350,-0.350,-0.349,-0.349,-0.344,-0.339,-0.334,-0.330,-0.325, - &-0.321,-0.316,-0.312,-0.307,-0.303,-0.299,-0.295,-0.290,-0.286, - &-0.282,-0.278,-0.274,-0.270,-0.266,-0.262,-0.258,-0.255,-0.251, - &-0.247,-0.243,-0.240,-0.236,-0.232,-0.229,-0.225,-0.222,-0.218, - &-0.215,-0.211,-0.208,-0.204,-0.201,-0.198,-0.194,-0.191,-0.188, - &-0.185,-0.182,-0.178,-0.175,-0.172,-0.169,-0.166,-0.163,-0.160, - &-0.157,-0.154,-0.151,-0.148,-0.145,-0.142,-0.139,-0.137,-0.134, - &-0.131,-0.128,-0.125,-0.123,-0.120,-0.117,-0.115,-0.112,-0.109, - &-0.107,-0.104,-0.101,-0.099,-0.096,-0.094,-0.091,-0.089,-0.086, - &-0.084,-0.081,-0.079,-0.076,-0.074,-0.071,-0.069,-0.067,-0.064, - &-0.062,-0.060,-0.057,-0.055,-0.053,-0.050,-0.048,-0.046,-0.043, - &-0.041,-0.039,-0.037,-0.035,-0.032,-0.030,-0.028,-0.026,-0.024, - &-0.022,-0.020,-0.017,-0.015,-0.013,-0.011,-0.009,-0.007,-0.005, - &-0.003,-0.001, 0.001, 0.003, 0.005, 0.007, 0.009, 0.011, 0.013, - & 0.015, 0.017, 0.019, 0.021, 0.022, 0.024, 0.026, 0.028, 0.030, - & 0.032, 0.034, 0.036, 0.037, 0.039, 0.041, 0.043, 0.045, 0.046, - & 0.048, 0.050, 0.052, 0.053, 0.055, 0.057, 0.059, 0.060, 0.062, - & 0.064, 0.066, 0.067, 0.069, 0.071, 0.072, 0.074, 0.076, 0.077, - & 0.079, 0.081, 0.082 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.092,-0.196,-0.245,-0.279,-0.304,-0.325,-0.342,-0.356,-0.368, - &-0.379,-0.389,-0.397,-0.405,-0.412,-0.418,-0.424,-0.429,-0.433, - &-0.438,-0.442,-0.445,-0.448,-0.452,-0.454,-0.457,-0.459,-0.462, - &-0.464,-0.466,-0.467,-0.469,-0.470,-0.472,-0.473,-0.474,-0.475, - &-0.476,-0.477,-0.478,-0.479,-0.480,-0.480,-0.481,-0.482,-0.482, - &-0.483,-0.483,-0.483,-0.484,-0.484,-0.484,-0.484,-0.485,-0.485, - &-0.485,-0.485,-0.485,-0.485,-0.485,-0.485,-0.485,-0.485,-0.485, - &-0.485,-0.485,-0.484,-0.484,-0.484,-0.484,-0.484,-0.483,-0.483, - &-0.483,-0.482,-0.482,-0.482,-0.481,-0.481,-0.480,-0.480,-0.479, - &-0.479,-0.478,-0.478,-0.477,-0.477,-0.476,-0.475,-0.475,-0.474, - &-0.474,-0.473,-0.472,-0.471,-0.471,-0.470,-0.469,-0.468,-0.467, - &-0.467,-0.466,-0.465,-0.464,-0.463,-0.462,-0.461,-0.460,-0.459, - &-0.459,-0.458,-0.457,-0.456,-0.455,-0.454,-0.453,-0.452,-0.451, - &-0.450,-0.448,-0.447,-0.446,-0.445,-0.444,-0.443,-0.442,-0.441, - &-0.440,-0.439,-0.438,-0.437,-0.436,-0.434,-0.433,-0.432,-0.431, - &-0.430,-0.429,-0.428,-0.427,-0.425,-0.424,-0.423,-0.422,-0.421, - &-0.420,-0.419,-0.417,-0.416,-0.415,-0.414,-0.413,-0.412,-0.411, - &-0.409,-0.408,-0.407,-0.406,-0.405,-0.404,-0.402,-0.401,-0.400, - &-0.399,-0.398,-0.397,-0.395,-0.394,-0.393,-0.392,-0.391,-0.390, - &-0.388,-0.387,-0.386,-0.385,-0.384,-0.383,-0.381,-0.380,-0.379, - &-0.378,-0.377,-0.376,-0.374,-0.373,-0.372,-0.371,-0.370,-0.369, - &-0.367,-0.366,-0.365,-0.364,-0.363,-0.361,-0.360,-0.359,-0.358, - &-0.357,-0.356,-0.354,-0.353,-0.352,-0.351,-0.350,-0.349,-0.347, - &-0.346,-0.345,-0.344,-0.343,-0.342,-0.341,-0.339,-0.338,-0.337, - &-0.336,-0.335,-0.334,-0.332,-0.331,-0.330,-0.329,-0.328,-0.327, - &-0.325,-0.324,-0.323,-0.322,-0.321,-0.320,-0.319,-0.317,-0.316, - &-0.315,-0.314,-0.313,-0.312,-0.311,-0.309,-0.308,-0.307,-0.306, - &-0.305,-0.304,-0.303,-0.301,-0.300,-0.299,-0.298,-0.297,-0.296, - &-0.295,-0.294,-0.292,-0.291,-0.290,-0.289,-0.288,-0.287,-0.286, - &-0.285,-0.283,-0.282,-0.281,-0.280,-0.279,-0.278,-0.277,-0.276, - &-0.275,-0.273,-0.272,-0.271,-0.270,-0.269,-0.268,-0.267,-0.266, - &-0.265,-0.263,-0.262,-0.261,-0.260,-0.259,-0.258,-0.257,-0.256, - &-0.255,-0.254,-0.253,-0.251,-0.250,-0.249,-0.248,-0.247,-0.246, - &-0.245,-0.244,-0.243,-0.242,-0.241,-0.240,-0.238,-0.237,-0.236, - &-0.235,-0.234,-0.233,-0.232,-0.231,-0.230,-0.229,-0.228,-0.227, - &-0.226,-0.225,-0.224,-0.222,-0.221,-0.220,-0.219,-0.218,-0.217, - &-0.216,-0.215,-0.214,-0.213,-0.212,-0.211,-0.210,-0.209,-0.208, - &-0.207,-0.206,-0.205,-0.204,-0.203,-0.202,-0.201,-0.200,-0.198, - &-0.197,-0.196,-0.195,-0.194,-0.193,-0.192,-0.191,-0.190,-0.189, - &-0.188,-0.187,-0.186,-0.185,-0.184,-0.183,-0.182,-0.181,-0.180, - &-0.179,-0.178,-0.177,-0.176,-0.175,-0.174,-0.173,-0.172,-0.171, - &-0.170,-0.169,-0.168,-0.167,-0.166,-0.165,-0.164,-0.163,-0.162, - &-0.161,-0.160,-0.159,-0.158,-0.157,-0.156,-0.155,-0.154,-0.153, - &-0.152,-0.151,-0.150,-0.149,-0.148,-0.147,-0.146,-0.145,-0.144, - &-0.143,-0.142,-0.141,-0.140,-0.130,-0.121,-0.111,-0.102,-0.093, - &-0.083,-0.074,-0.066,-0.057,-0.048,-0.039,-0.031,-0.022,-0.014, - &-0.006, 0.003, 0.011, 0.019, 0.027, 0.035, 0.043, 0.050, 0.058, - & 0.066, 0.073, 0.081, 0.088, 0.095, 0.103, 0.110, 0.117, 0.124, - & 0.131, 0.138, 0.145, 0.152, 0.159, 0.165, 0.172, 0.179, 0.185, - & 0.192, 0.198, 0.205, 0.211, 0.217, 0.223, 0.230, 0.236, 0.242, - & 0.248, 0.254, 0.260, 0.266, 0.272, 0.278, 0.283, 0.289, 0.295, - & 0.301, 0.306, 0.312, 0.317, 0.323, 0.328, 0.334, 0.339, 0.345, - & 0.350, 0.355, 0.360, 0.366, 0.371, 0.376, 0.381, 0.386, 0.391, - & 0.396, 0.401, 0.406, 0.411, 0.416, 0.421, 0.426, 0.431, 0.435, - & 0.440, 0.445, 0.449, 0.454, 0.459, 0.463, 0.468, 0.472, 0.477, - & 0.482, 0.486, 0.490, 0.495, 0.499, 0.504, 0.508, 0.512, 0.517, - & 0.521, 0.525, 0.529, 0.534, 0.538, 0.542, 0.546, 0.550, 0.554, - & 0.559, 0.563, 0.567, 0.571, 0.575, 0.579, 0.583, 0.587, 0.590, - & 0.594, 0.598, 0.602, 0.606, 0.610, 0.614, 0.617, 0.621, 0.625, - & 0.629, 0.632, 0.636, 0.640, 0.643, 0.647, 0.651, 0.654, 0.658, - & 0.661, 0.665, 0.669, 0.672, 0.676, 0.679, 0.683, 0.686, 0.690, - & 0.693, 0.696, 0.700, 0.703, 0.707, 0.710, 0.713, 0.717, 0.720, - & 0.723, 0.727, 0.730 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.091,-0.188,-0.233,-0.261,-0.282,-0.298,-0.310,-0.320,-0.328, - &-0.335,-0.340,-0.345,-0.348,-0.351,-0.353,-0.355,-0.356,-0.356, - &-0.357,-0.357,-0.356,-0.356,-0.355,-0.354,-0.353,-0.351,-0.350, - &-0.348,-0.346,-0.344,-0.342,-0.340,-0.337,-0.335,-0.333,-0.330, - &-0.327,-0.325,-0.322,-0.319,-0.316,-0.314,-0.311,-0.308,-0.305, - &-0.302,-0.299,-0.296,-0.293,-0.290,-0.287,-0.283,-0.280,-0.277, - &-0.274,-0.271,-0.268,-0.264,-0.261,-0.258,-0.255,-0.252,-0.248, - &-0.245,-0.242,-0.238,-0.235,-0.232,-0.228,-0.225,-0.222,-0.218, - &-0.215,-0.211,-0.208,-0.204,-0.201,-0.197,-0.194,-0.190,-0.187, - &-0.183,-0.179,-0.176,-0.172,-0.168,-0.164,-0.161,-0.157,-0.153, - &-0.149,-0.145,-0.141,-0.137,-0.133,-0.129,-0.125,-0.121,-0.117, - &-0.113,-0.109,-0.105,-0.101,-0.096,-0.092,-0.088,-0.084,-0.080, - &-0.075,-0.071,-0.067,-0.062,-0.058,-0.054,-0.049,-0.045,-0.041, - &-0.036,-0.032,-0.027,-0.023,-0.019,-0.014,-0.010,-0.005,-0.001, - & 0.003, 0.008, 0.012, 0.017, 0.021, 0.026, 0.030, 0.034, 0.039, - & 0.043, 0.048, 0.052, 0.057, 0.061, 0.065, 0.070, 0.074, 0.079, - & 0.083, 0.087, 0.092, 0.096, 0.101, 0.105, 0.109, 0.114, 0.118, - & 0.123, 0.127, 0.131, 0.136, 0.140, 0.144, 0.149, 0.153, 0.157, - & 0.162, 0.166, 0.170, 0.175, 0.179, 0.183, 0.188, 0.192, 0.196, - & 0.201, 0.205, 0.209, 0.214, 0.218, 0.222, 0.226, 0.231, 0.235, - & 0.239, 0.243, 0.248, 0.252, 0.256, 0.260, 0.265, 0.269, 0.273, - & 0.277, 0.281, 0.286, 0.290, 0.294, 0.298, 0.302, 0.306, 0.311, - & 0.315, 0.319, 0.323, 0.327, 0.331, 0.336, 0.340, 0.344, 0.348, - & 0.352, 0.356, 0.360, 0.364, 0.368, 0.372, 0.377, 0.381, 0.385, - & 0.389, 0.393, 0.397, 0.401, 0.405, 0.409, 0.413, 0.417, 0.421, - & 0.425, 0.429, 0.433, 0.437, 0.441, 0.445, 0.449, 0.453, 0.457, - & 0.461, 0.465, 0.469, 0.473, 0.477, 0.481, 0.485, 0.488, 0.492, - & 0.496, 0.500, 0.504, 0.508, 0.512, 0.516, 0.520, 0.524, 0.527, - & 0.531, 0.535, 0.539, 0.543, 0.547, 0.550, 0.554, 0.558, 0.562, - & 0.566, 0.570, 0.573, 0.577, 0.581, 0.585, 0.588, 0.592, 0.596, - & 0.600, 0.604, 0.607, 0.611, 0.615, 0.618, 0.622, 0.626, 0.630, - & 0.633, 0.637, 0.641, 0.644, 0.648, 0.652, 0.656, 0.659, 0.663, - & 0.667, 0.670, 0.674, 0.677, 0.681, 0.685, 0.688, 0.692, 0.696, - & 0.699, 0.703, 0.706, 0.710, 0.714, 0.717, 0.721, 0.724, 0.728, - & 0.732, 0.735, 0.739, 0.742, 0.746, 0.749, 0.753, 0.756, 0.760, - & 0.763, 0.767, 0.770, 0.774, 0.777, 0.781, 0.784, 0.788, 0.791, - & 0.795, 0.798, 0.802, 0.805, 0.809, 0.812, 0.816, 0.819, 0.823, - & 0.826, 0.829, 0.833, 0.836, 0.840, 0.843, 0.846, 0.850, 0.853, - & 0.857, 0.860, 0.863, 0.867, 0.870, 0.873, 0.877, 0.880, 0.884, - & 0.887, 0.890, 0.894, 0.897, 0.900, 0.904, 0.907, 0.910, 0.913, - & 0.917, 0.920, 0.923, 0.927, 0.930, 0.933, 0.936, 0.940, 0.943, - & 0.946, 0.950, 0.953, 0.956, 0.959, 0.963, 0.966, 0.969, 0.972, - & 0.975, 0.979, 0.982, 0.985, 0.988, 0.991, 0.995, 0.998, 1.001, - & 1.004, 1.007, 1.011, 1.014, 1.017, 1.020, 1.023, 1.026, 1.029, - & 1.033, 1.036, 1.039, 1.042, 1.076, 1.106, 1.136, 1.166, 1.195, - & 1.224, 1.253, 1.281, 1.309, 1.337, 1.364, 1.391, 1.417, 1.444, - & 1.470, 1.495, 1.521, 1.546, 1.570, 1.595, 1.619, 1.643, 1.667, - & 1.690, 1.713, 1.736, 1.759, 1.781, 1.803, 1.825, 1.847, 1.868, - & 1.890, 1.911, 1.932, 1.952, 1.973, 1.993, 2.013, 2.033, 2.053, - & 2.072, 2.092, 2.111, 2.130, 2.149, 2.167, 2.186, 2.204, 2.222, - & 2.240, 2.258, 2.276, 2.293, 2.311, 2.328, 2.345, 2.362, 2.379, - & 2.396, 2.412, 2.429, 2.445, 2.461, 2.478, 2.493, 2.509, 2.525, - & 2.541, 2.556, 2.572, 2.587, 2.602, 2.617, 2.632, 2.647, 2.661, - & 2.676, 2.691, 2.705, 2.719, 2.734, 2.748, 2.762, 2.776, 2.789, - & 2.803, 2.817, 2.830, 2.844, 2.857, 2.871, 2.884, 2.897, 2.910, - & 2.923, 2.936, 2.949, 2.961, 2.974, 2.987, 2.999, 3.012, 3.024, - & 3.036, 3.048, 3.061, 3.073, 3.085, 3.097, 3.108, 3.120, 3.132, - & 3.144, 3.155, 3.167, 3.178, 3.190, 3.201, 3.212, 3.224, 3.235, - & 3.246, 3.257, 3.268, 3.279, 3.290, 3.300, 3.311, 3.322, 3.333, - & 3.343, 3.354, 3.364, 3.375, 3.385, 3.395, 3.406, 3.416, 3.426, - & 3.436, 3.446, 3.456, 3.466, 3.476, 3.486, 3.496, 3.506, 3.515, - & 3.525, 3.535, 3.544, 3.554, 3.563, 3.573, 3.582, 3.592, 3.601, - & 3.610, 3.620, 3.629 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.093,-0.203,-0.257,-0.296,-0.326,-0.351,-0.372,-0.391,-0.408, - &-0.423,-0.436,-0.449,-0.460,-0.471,-0.481,-0.491,-0.500,-0.508, - &-0.516,-0.524,-0.531,-0.538,-0.545,-0.552,-0.558,-0.564,-0.569, - &-0.575,-0.580,-0.585,-0.590,-0.595,-0.600,-0.605,-0.609,-0.613, - &-0.618,-0.622,-0.626,-0.629,-0.633,-0.637,-0.641,-0.644,-0.648, - &-0.651,-0.654,-0.658,-0.661,-0.664,-0.667,-0.670,-0.673,-0.676, - &-0.678,-0.681,-0.684,-0.687,-0.689,-0.692,-0.694,-0.697,-0.699, - &-0.702,-0.704,-0.707,-0.709,-0.711,-0.713,-0.716,-0.718,-0.720, - &-0.722,-0.724,-0.726,-0.728,-0.730,-0.732,-0.734,-0.736,-0.738, - &-0.740,-0.742,-0.744,-0.746,-0.748,-0.749,-0.751,-0.753,-0.755, - &-0.756,-0.758,-0.760,-0.762,-0.763,-0.765,-0.767,-0.768,-0.770, - &-0.772,-0.773,-0.775,-0.776,-0.778,-0.779,-0.781,-0.782,-0.784, - &-0.786,-0.787,-0.788,-0.790,-0.791,-0.793,-0.794,-0.796,-0.797, - &-0.799,-0.800,-0.801,-0.803,-0.804,-0.805,-0.807,-0.808,-0.809, - &-0.811,-0.812,-0.813,-0.815,-0.816,-0.817,-0.819,-0.820,-0.821, - &-0.822,-0.824,-0.825,-0.826,-0.827,-0.828,-0.830,-0.831,-0.832, - &-0.833,-0.834,-0.835,-0.837,-0.838,-0.839,-0.840,-0.841,-0.842, - &-0.843,-0.844,-0.846,-0.847,-0.848,-0.849,-0.850,-0.851,-0.852, - &-0.853,-0.854,-0.855,-0.856,-0.857,-0.858,-0.859,-0.860,-0.861, - &-0.862,-0.863,-0.864,-0.865,-0.866,-0.867,-0.868,-0.869,-0.870, - &-0.871,-0.872,-0.873,-0.874,-0.875,-0.876,-0.877,-0.878,-0.878, - &-0.879,-0.880,-0.881,-0.882,-0.883,-0.884,-0.885,-0.886,-0.886, - &-0.887,-0.888,-0.889,-0.890,-0.891,-0.892,-0.893,-0.893,-0.894, - &-0.895,-0.896,-0.897,-0.898,-0.898,-0.899,-0.900,-0.901,-0.902, - &-0.902,-0.903,-0.904,-0.905,-0.906,-0.906,-0.907,-0.908,-0.909, - &-0.910,-0.910,-0.911,-0.912,-0.913,-0.913,-0.914,-0.915,-0.916, - &-0.916,-0.917,-0.918,-0.919,-0.919,-0.920,-0.921,-0.922,-0.922, - &-0.923,-0.924,-0.924,-0.925,-0.926,-0.927,-0.927,-0.928,-0.929, - &-0.929,-0.930,-0.931,-0.931,-0.932,-0.933,-0.933,-0.934,-0.935, - &-0.936,-0.936,-0.937,-0.938,-0.938,-0.939,-0.940,-0.940,-0.941, - &-0.941,-0.942,-0.943,-0.943,-0.944,-0.945,-0.945,-0.946,-0.947, - &-0.947,-0.948,-0.949,-0.949,-0.950,-0.950,-0.951,-0.952,-0.952, - &-0.953,-0.954,-0.954,-0.955,-0.955,-0.956,-0.957,-0.957,-0.958, - &-0.958,-0.959,-0.960,-0.960,-0.961,-0.961,-0.962,-0.962,-0.963, - &-0.964,-0.964,-0.965,-0.965,-0.966,-0.967,-0.967,-0.968,-0.968, - &-0.969,-0.969,-0.970,-0.970,-0.971,-0.972,-0.972,-0.973,-0.973, - &-0.974,-0.974,-0.975,-0.975,-0.976,-0.977,-0.977,-0.978,-0.978, - &-0.979,-0.979,-0.980,-0.980,-0.981,-0.981,-0.982,-0.982,-0.983, - &-0.983,-0.984,-0.984,-0.985,-0.986,-0.986,-0.987,-0.987,-0.988, - &-0.988,-0.989,-0.989,-0.990,-0.990,-0.991,-0.991,-0.992,-0.992, - &-0.993,-0.993,-0.994,-0.994,-0.995,-0.995,-0.996,-0.996,-0.997, - &-0.997,-0.998,-0.998,-0.998,-0.999,-0.999,-1.000,-1.000,-1.001, - &-1.001,-1.002,-1.002,-1.003,-1.003,-1.004,-1.004,-1.005,-1.005, - &-1.006,-1.006,-1.006,-1.007,-1.007,-1.008,-1.008,-1.009,-1.009, - &-1.010,-1.010,-1.011,-1.011,-1.016,-1.020,-1.024,-1.029,-1.033, - &-1.037,-1.040,-1.044,-1.048,-1.052,-1.055,-1.059,-1.062,-1.065, - &-1.069,-1.072,-1.075,-1.078,-1.081,-1.084,-1.087,-1.090,-1.093, - &-1.096,-1.099,-1.102,-1.104,-1.107,-1.110,-1.112,-1.115,-1.117, - &-1.120,-1.122,-1.125,-1.127,-1.129,-1.132,-1.134,-1.136,-1.139, - &-1.141,-1.143,-1.145,-1.147,-1.149,-1.151,-1.153,-1.155,-1.157, - &-1.159,-1.161,-1.163,-1.165,-1.167,-1.169,-1.171,-1.173,-1.174, - &-1.176,-1.178,-1.180,-1.181,-1.183,-1.185,-1.187,-1.188,-1.190, - &-1.191,-1.193,-1.195,-1.196,-1.198,-1.199,-1.201,-1.202,-1.204, - &-1.205,-1.207,-1.208,-1.210,-1.211,-1.213,-1.214,-1.216,-1.217, - &-1.218,-1.220,-1.221,-1.223,-1.224,-1.225,-1.226,-1.228,-1.229, - &-1.230,-1.232,-1.233,-1.234,-1.235,-1.237,-1.238,-1.239,-1.240, - &-1.242,-1.243,-1.244,-1.245,-1.246,-1.247,-1.249,-1.250,-1.251, - &-1.252,-1.253,-1.254,-1.255,-1.256,-1.258,-1.259,-1.260,-1.261, - &-1.262,-1.263,-1.264,-1.265,-1.266,-1.267,-1.268,-1.269,-1.270, - &-1.271,-1.272,-1.273,-1.274,-1.275,-1.276,-1.277,-1.278,-1.279, - &-1.280,-1.281,-1.282,-1.283,-1.283,-1.284,-1.285,-1.286,-1.287, - &-1.288,-1.289,-1.290,-1.291,-1.292,-1.292,-1.293,-1.294,-1.295, - &-1.296,-1.297,-1.298 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.046,-0.097,-0.121,-0.138,-0.150,-0.161,-0.169,-0.176,-0.182, - &-0.188,-0.192,-0.196,-0.200,-0.203,-0.206,-0.209,-0.211,-0.213, - &-0.215,-0.217,-0.218,-0.219,-0.220,-0.221,-0.222,-0.223,-0.223, - &-0.223,-0.223,-0.224,-0.223,-0.223,-0.223,-0.223,-0.222,-0.222, - &-0.221,-0.220,-0.220,-0.219,-0.218,-0.217,-0.216,-0.215,-0.213, - &-0.212,-0.211,-0.209,-0.208,-0.206,-0.205,-0.203,-0.202,-0.200, - &-0.198,-0.196,-0.195,-0.193,-0.191,-0.189,-0.187,-0.185,-0.183, - &-0.181,-0.179,-0.177,-0.174,-0.172,-0.170,-0.168,-0.165,-0.163, - &-0.161,-0.158,-0.156,-0.153,-0.151,-0.148,-0.146,-0.143,-0.141, - &-0.138,-0.136,-0.133,-0.130,-0.127,-0.125,-0.122,-0.119,-0.116, - &-0.114,-0.111,-0.108,-0.105,-0.102,-0.099,-0.096,-0.093,-0.090, - &-0.087,-0.084,-0.081,-0.078,-0.075,-0.072,-0.069,-0.066,-0.063, - &-0.060,-0.056,-0.053,-0.050,-0.047,-0.044,-0.041,-0.037,-0.034, - &-0.031,-0.028,-0.025,-0.021,-0.018,-0.015,-0.012,-0.009,-0.005, - &-0.002, 0.001, 0.004, 0.007, 0.011, 0.014, 0.017, 0.020, 0.023, - & 0.027, 0.030, 0.033, 0.036, 0.039, 0.043, 0.046, 0.049, 0.052, - & 0.055, 0.058, 0.061, 0.065, 0.068, 0.071, 0.074, 0.077, 0.080, - & 0.083, 0.086, 0.089, 0.093, 0.096, 0.099, 0.102, 0.105, 0.108, - & 0.111, 0.114, 0.117, 0.120, 0.123, 0.126, 0.129, 0.132, 0.135, - & 0.138, 0.141, 0.144, 0.147, 0.150, 0.153, 0.156, 0.159, 0.162, - & 0.165, 0.168, 0.171, 0.174, 0.176, 0.179, 0.182, 0.185, 0.188, - & 0.191, 0.194, 0.197, 0.199, 0.202, 0.205, 0.208, 0.211, 0.214, - & 0.217, 0.219, 0.222, 0.225, 0.228, 0.231, 0.233, 0.236, 0.239, - & 0.242, 0.244, 0.247, 0.250, 0.253, 0.255, 0.258, 0.261, 0.264, - & 0.266, 0.269, 0.272, 0.274, 0.277, 0.280, 0.282, 0.285, 0.288, - & 0.290, 0.293, 0.296, 0.298, 0.301, 0.304, 0.306, 0.309, 0.312, - & 0.314, 0.317, 0.319, 0.322, 0.325, 0.327, 0.330, 0.332, 0.335, - & 0.337, 0.340, 0.343, 0.345, 0.348, 0.350, 0.353, 0.355, 0.358, - & 0.360, 0.363, 0.365, 0.368, 0.370, 0.373, 0.375, 0.378, 0.380, - & 0.383, 0.385, 0.388, 0.390, 0.393, 0.395, 0.397, 0.400, 0.402, - & 0.405, 0.407, 0.410, 0.412, 0.414, 0.417, 0.419, 0.422, 0.424, - & 0.426, 0.429, 0.431, 0.434, 0.436, 0.438, 0.441, 0.443, 0.445, - & 0.448, 0.450, 0.452, 0.455, 0.457, 0.459, 0.462, 0.464, 0.466, - & 0.469, 0.471, 0.473, 0.475, 0.478, 0.480, 0.482, 0.485, 0.487, - & 0.489, 0.491, 0.494, 0.496, 0.498, 0.500, 0.503, 0.505, 0.507, - & 0.509, 0.512, 0.514, 0.516, 0.518, 0.520, 0.523, 0.525, 0.527, - & 0.529, 0.531, 0.534, 0.536, 0.538, 0.540, 0.542, 0.544, 0.547, - & 0.549, 0.551, 0.553, 0.555, 0.557, 0.560, 0.562, 0.564, 0.566, - & 0.568, 0.570, 0.572, 0.574, 0.577, 0.579, 0.581, 0.583, 0.585, - & 0.587, 0.589, 0.591, 0.593, 0.595, 0.597, 0.600, 0.602, 0.604, - & 0.606, 0.608, 0.610, 0.612, 0.614, 0.616, 0.618, 0.620, 0.622, - & 0.624, 0.626, 0.628, 0.630, 0.632, 0.634, 0.636, 0.638, 0.640, - & 0.642, 0.644, 0.646, 0.648, 0.650, 0.652, 0.654, 0.656, 0.658, - & 0.660, 0.662, 0.664, 0.666, 0.668, 0.670, 0.672, 0.674, 0.676, - & 0.678, 0.680, 0.682, 0.684, 0.704, 0.723, 0.742, 0.760, 0.778, - & 0.796, 0.813, 0.831, 0.848, 0.865, 0.881, 0.898, 0.914, 0.930, - & 0.946, 0.961, 0.977, 0.992, 1.007, 1.022, 1.036, 1.051, 1.065, - & 1.079, 1.093, 1.107, 1.121, 1.134, 1.148, 1.161, 1.174, 1.187, - & 1.200, 1.213, 1.225, 1.238, 1.250, 1.262, 1.275, 1.287, 1.298, - & 1.310, 1.322, 1.333, 1.345, 1.356, 1.367, 1.379, 1.390, 1.401, - & 1.411, 1.422, 1.433, 1.443, 1.454, 1.464, 1.475, 1.485, 1.495, - & 1.505, 1.515, 1.525, 1.535, 1.545, 1.554, 1.564, 1.573, 1.583, - & 1.592, 1.602, 1.611, 1.620, 1.629, 1.638, 1.647, 1.656, 1.665, - & 1.674, 1.682, 1.691, 1.700, 1.708, 1.717, 1.725, 1.734, 1.742, - & 1.750, 1.758, 1.767, 1.775, 1.783, 1.791, 1.799, 1.807, 1.815, - & 1.822, 1.830, 1.838, 1.845, 1.853, 1.861, 1.868, 1.876, 1.883, - & 1.891, 1.898, 1.905, 1.912, 1.920, 1.927, 1.934, 1.941, 1.948, - & 1.955, 1.962, 1.969, 1.976, 1.983, 1.990, 1.997, 2.003, 2.010, - & 2.017, 2.023, 2.030, 2.037, 2.043, 2.050, 2.056, 2.063, 2.069, - & 2.075, 2.082, 2.088, 2.094, 2.101, 2.107, 2.113, 2.119, 2.125, - & 2.131, 2.137, 2.143, 2.149, 2.155, 2.161, 2.167, 2.173, 2.179, - & 2.185, 2.191, 2.197, 2.202, 2.208, 2.214, 2.219, 2.225, 2.231, - & 2.236, 2.242, 2.248 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.048,-0.109,-0.141,-0.166,-0.186,-0.204,-0.219,-0.233,-0.246, - &-0.258,-0.270,-0.281,-0.291,-0.301,-0.310,-0.319,-0.328,-0.336, - &-0.344,-0.352,-0.360,-0.367,-0.375,-0.382,-0.389,-0.395,-0.402, - &-0.409,-0.415,-0.421,-0.427,-0.433,-0.439,-0.445,-0.451,-0.456, - &-0.462,-0.467,-0.472,-0.477,-0.483,-0.488,-0.492,-0.497,-0.502, - &-0.507,-0.511,-0.516,-0.521,-0.525,-0.529,-0.534,-0.538,-0.542, - &-0.546,-0.550,-0.554,-0.558,-0.562,-0.566,-0.570,-0.574,-0.578, - &-0.581,-0.585,-0.589,-0.592,-0.596,-0.600,-0.603,-0.607,-0.610, - &-0.613,-0.617,-0.620,-0.624,-0.627,-0.630,-0.634,-0.637,-0.640, - &-0.643,-0.647,-0.650,-0.653,-0.656,-0.660,-0.663,-0.666,-0.669, - &-0.672,-0.675,-0.678,-0.682,-0.685,-0.688,-0.691,-0.694,-0.697, - &-0.700,-0.703,-0.706,-0.709,-0.712,-0.715,-0.718,-0.721,-0.724, - &-0.727,-0.730,-0.733,-0.736,-0.739,-0.741,-0.744,-0.747,-0.750, - &-0.753,-0.756,-0.758,-0.761,-0.764,-0.767,-0.770,-0.772,-0.775, - &-0.778,-0.780,-0.783,-0.786,-0.789,-0.791,-0.794,-0.796,-0.799, - &-0.802,-0.804,-0.807,-0.809,-0.812,-0.814,-0.817,-0.819,-0.822, - &-0.824,-0.827,-0.829,-0.832,-0.834,-0.837,-0.839,-0.841,-0.844, - &-0.846,-0.848,-0.851,-0.853,-0.855,-0.858,-0.860,-0.862,-0.865, - &-0.867,-0.869,-0.871,-0.873,-0.876,-0.878,-0.880,-0.882,-0.884, - &-0.887,-0.889,-0.891,-0.893,-0.895,-0.897,-0.899,-0.901,-0.903, - &-0.905,-0.908,-0.910,-0.912,-0.914,-0.916,-0.918,-0.920,-0.922, - &-0.924,-0.925,-0.927,-0.929,-0.931,-0.933,-0.935,-0.937,-0.939, - &-0.941,-0.943,-0.945,-0.946,-0.948,-0.950,-0.952,-0.954,-0.956, - &-0.957,-0.959,-0.961,-0.963,-0.965,-0.966,-0.968,-0.970,-0.972, - &-0.973,-0.975,-0.977,-0.978,-0.980,-0.982,-0.984,-0.985,-0.987, - &-0.989,-0.990,-0.992,-0.993,-0.995,-0.997,-0.998,-1.000,-1.002, - &-1.003,-1.005,-1.006,-1.008,-1.009,-1.011,-1.013,-1.014,-1.016, - &-1.017,-1.019,-1.020,-1.022,-1.023,-1.025,-1.026,-1.028,-1.029, - &-1.031,-1.032,-1.034,-1.035,-1.036,-1.038,-1.039,-1.041,-1.042, - &-1.044,-1.045,-1.046,-1.048,-1.049,-1.051,-1.052,-1.053,-1.055, - &-1.056,-1.057,-1.059,-1.060,-1.061,-1.063,-1.064,-1.065,-1.067, - &-1.068,-1.069,-1.071,-1.072,-1.073,-1.074,-1.076,-1.077,-1.078, - &-1.079,-1.081,-1.082,-1.083,-1.084,-1.086,-1.087,-1.088,-1.089, - &-1.090,-1.092,-1.093,-1.094,-1.095,-1.096,-1.098,-1.099,-1.100, - &-1.101,-1.102,-1.103,-1.105,-1.106,-1.107,-1.108,-1.109,-1.110, - &-1.111,-1.112,-1.114,-1.115,-1.116,-1.117,-1.118,-1.119,-1.120, - &-1.121,-1.122,-1.123,-1.124,-1.125,-1.127,-1.128,-1.129,-1.130, - &-1.131,-1.132,-1.133,-1.134,-1.135,-1.136,-1.137,-1.138,-1.139, - &-1.140,-1.141,-1.142,-1.143,-1.144,-1.145,-1.146,-1.147,-1.148, - &-1.149,-1.150,-1.151,-1.152,-1.153,-1.153,-1.154,-1.155,-1.156, - &-1.157,-1.158,-1.159,-1.160,-1.161,-1.162,-1.163,-1.164,-1.165, - &-1.165,-1.166,-1.167,-1.168,-1.169,-1.170,-1.171,-1.172,-1.172, - &-1.173,-1.174,-1.175,-1.176,-1.177,-1.178,-1.178,-1.179,-1.180, - &-1.181,-1.182,-1.183,-1.183,-1.184,-1.185,-1.186,-1.187,-1.188, - &-1.188,-1.189,-1.190,-1.191,-1.199,-1.207,-1.214,-1.221,-1.228, - &-1.234,-1.240,-1.246,-1.252,-1.258,-1.263,-1.268,-1.273,-1.278, - &-1.283,-1.287,-1.292,-1.296,-1.300,-1.304,-1.308,-1.312,-1.315, - &-1.319,-1.322,-1.325,-1.329,-1.332,-1.335,-1.338,-1.341,-1.343, - &-1.346,-1.349,-1.351,-1.354,-1.356,-1.358,-1.361,-1.363,-1.365, - &-1.367,-1.369,-1.371,-1.373,-1.375,-1.377,-1.378,-1.380,-1.382, - &-1.383,-1.385,-1.387,-1.388,-1.390,-1.391,-1.393,-1.394,-1.395, - &-1.397,-1.398,-1.399,-1.400,-1.402,-1.403,-1.404,-1.405,-1.406, - &-1.407,-1.408,-1.409,-1.410,-1.411,-1.412,-1.413,-1.414,-1.415, - &-1.416,-1.417,-1.418,-1.419,-1.420,-1.420,-1.421,-1.422,-1.423, - &-1.424,-1.424,-1.425,-1.426,-1.427,-1.427,-1.428,-1.429,-1.429, - &-1.430,-1.430,-1.431,-1.432,-1.432,-1.433,-1.434,-1.434,-1.435, - &-1.435,-1.436,-1.436,-1.437,-1.437,-1.438,-1.438,-1.439,-1.439, - &-1.440,-1.440,-1.441,-1.441,-1.442,-1.442,-1.443,-1.443,-1.443, - &-1.444,-1.444,-1.445,-1.445,-1.445,-1.446,-1.446,-1.447,-1.447, - &-1.447,-1.448,-1.448,-1.448,-1.449,-1.449,-1.449,-1.450,-1.450, - &-1.450,-1.451,-1.451,-1.451,-1.452,-1.452,-1.452,-1.453,-1.453, - &-1.453,-1.454,-1.454,-1.454,-1.454,-1.455,-1.455,-1.455,-1.455, - &-1.456,-1.456,-1.456 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.046,-0.098,-0.123,-0.139,-0.152,-0.162,-0.171,-0.178,-0.184, - &-0.190,-0.195,-0.199,-0.203,-0.206,-0.209,-0.212,-0.215,-0.217, - &-0.219,-0.221,-0.223,-0.225,-0.226,-0.228,-0.229,-0.230,-0.231, - &-0.232,-0.233,-0.234,-0.235,-0.236,-0.236,-0.237,-0.238,-0.238, - &-0.239,-0.239,-0.240,-0.240,-0.240,-0.241,-0.241,-0.241,-0.242, - &-0.242,-0.242,-0.242,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243, - &-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243, - &-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.243,-0.242, - &-0.242,-0.242,-0.242,-0.242,-0.242,-0.241,-0.241,-0.241,-0.241, - &-0.241,-0.240,-0.240,-0.240,-0.239,-0.239,-0.239,-0.239,-0.238, - &-0.238,-0.238,-0.237,-0.237,-0.237,-0.236,-0.236,-0.235,-0.235, - &-0.235,-0.234,-0.234,-0.233,-0.233,-0.232,-0.232,-0.232,-0.231, - &-0.231,-0.230,-0.230,-0.229,-0.229,-0.228,-0.228,-0.227,-0.227, - &-0.226,-0.226,-0.225,-0.225,-0.224,-0.224,-0.223,-0.223,-0.222, - &-0.222,-0.221,-0.220,-0.220,-0.219,-0.219,-0.218,-0.218,-0.217, - &-0.217,-0.216,-0.216,-0.215,-0.214,-0.214,-0.213,-0.213,-0.212, - &-0.212,-0.211,-0.210,-0.210,-0.209,-0.209,-0.208,-0.208,-0.207, - &-0.207,-0.206,-0.205,-0.205,-0.204,-0.204,-0.203,-0.203,-0.202, - &-0.201,-0.201,-0.200,-0.200,-0.199,-0.199,-0.198,-0.197,-0.197, - &-0.196,-0.196,-0.195,-0.194,-0.194,-0.193,-0.193,-0.192,-0.192, - &-0.191,-0.190,-0.190,-0.189,-0.189,-0.188,-0.188,-0.187,-0.186, - &-0.186,-0.185,-0.185,-0.184,-0.184,-0.183,-0.182,-0.182,-0.181, - &-0.181,-0.180,-0.180,-0.179,-0.178,-0.178,-0.177,-0.177,-0.176, - &-0.176,-0.175,-0.174,-0.174,-0.173,-0.173,-0.172,-0.172,-0.171, - &-0.170,-0.170,-0.169,-0.169,-0.168,-0.168,-0.167,-0.166,-0.166, - &-0.165,-0.165,-0.164,-0.164,-0.163,-0.162,-0.162,-0.161,-0.161, - &-0.160,-0.160,-0.159,-0.158,-0.158,-0.157,-0.157,-0.156,-0.156, - &-0.155,-0.155,-0.154,-0.153,-0.153,-0.152,-0.152,-0.151,-0.151, - &-0.150,-0.150,-0.149,-0.148,-0.148,-0.147,-0.147,-0.146,-0.146, - &-0.145,-0.145,-0.144,-0.143,-0.143,-0.142,-0.142,-0.141,-0.141, - &-0.140,-0.140,-0.139,-0.139,-0.138,-0.137,-0.137,-0.136,-0.136, - &-0.135,-0.135,-0.134,-0.134,-0.133,-0.133,-0.132,-0.131,-0.131, - &-0.130,-0.130,-0.129,-0.129,-0.128,-0.128,-0.127,-0.127,-0.126, - &-0.126,-0.125,-0.125,-0.124,-0.123,-0.123,-0.122,-0.122,-0.121, - &-0.121,-0.120,-0.120,-0.119,-0.119,-0.118,-0.118,-0.117,-0.117, - &-0.116,-0.116,-0.115,-0.115,-0.114,-0.113,-0.113,-0.112,-0.112, - &-0.111,-0.111,-0.110,-0.110,-0.109,-0.109,-0.108,-0.108,-0.107, - &-0.107,-0.106,-0.106,-0.105,-0.105,-0.104,-0.104,-0.103,-0.103, - &-0.102,-0.102,-0.101,-0.101,-0.100,-0.100,-0.099,-0.099,-0.098, - &-0.098,-0.097,-0.097,-0.096,-0.096,-0.095,-0.095,-0.094,-0.094, - &-0.093,-0.093,-0.092,-0.092,-0.091,-0.091,-0.090,-0.090,-0.089, - &-0.089,-0.088,-0.088,-0.087,-0.087,-0.086,-0.086,-0.085,-0.085, - &-0.084,-0.084,-0.083,-0.083,-0.082,-0.082,-0.081,-0.081,-0.080, - &-0.080,-0.079,-0.079,-0.078,-0.078,-0.077,-0.077,-0.077,-0.076, - &-0.076,-0.075,-0.075,-0.074,-0.069,-0.064,-0.060,-0.055,-0.051, - &-0.046,-0.042,-0.037,-0.033,-0.028,-0.024,-0.020,-0.016,-0.012, - &-0.008,-0.004, 0.000, 0.004, 0.008, 0.012, 0.016, 0.020, 0.024, - & 0.028, 0.031, 0.035, 0.039, 0.042, 0.046, 0.049, 0.053, 0.056, - & 0.060, 0.063, 0.067, 0.070, 0.073, 0.077, 0.080, 0.083, 0.087, - & 0.090, 0.093, 0.096, 0.099, 0.102, 0.105, 0.108, 0.111, 0.114, - & 0.117, 0.120, 0.123, 0.126, 0.129, 0.132, 0.135, 0.138, 0.141, - & 0.143, 0.146, 0.149, 0.152, 0.154, 0.157, 0.160, 0.162, 0.165, - & 0.168, 0.170, 0.173, 0.176, 0.178, 0.181, 0.183, 0.186, 0.188, - & 0.191, 0.193, 0.196, 0.198, 0.200, 0.203, 0.205, 0.208, 0.210, - & 0.212, 0.215, 0.217, 0.219, 0.221, 0.224, 0.226, 0.228, 0.231, - & 0.233, 0.235, 0.237, 0.239, 0.242, 0.244, 0.246, 0.248, 0.250, - & 0.252, 0.254, 0.256, 0.258, 0.261, 0.263, 0.265, 0.267, 0.269, - & 0.271, 0.273, 0.275, 0.277, 0.279, 0.281, 0.283, 0.285, 0.286, - & 0.288, 0.290, 0.292, 0.294, 0.296, 0.298, 0.300, 0.302, 0.304, - & 0.305, 0.307, 0.309, 0.311, 0.313, 0.314, 0.316, 0.318, 0.320, - & 0.322, 0.323, 0.325, 0.327, 0.329, 0.330, 0.332, 0.334, 0.335, - & 0.337, 0.339, 0.341, 0.342, 0.344, 0.346, 0.347, 0.349, 0.350, - & 0.352, 0.354, 0.355 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.185,-0.400,-0.506,-0.579,-0.636,-0.683,-0.723,-0.757,-0.787, - &-0.814,-0.839,-0.861,-0.881,-0.900,-0.917,-0.934,-0.949,-0.963, - &-0.977,-0.989,-1.001,-1.013,-1.023,-1.034,-1.044,-1.053,-1.062, - &-1.071,-1.079,-1.087,-1.094,-1.102,-1.109,-1.116,-1.122,-1.129, - &-1.135,-1.141,-1.147,-1.152,-1.158,-1.163,-1.168,-1.173,-1.178, - &-1.183,-1.187,-1.192,-1.196,-1.200,-1.205,-1.209,-1.213,-1.216, - &-1.220,-1.224,-1.228,-1.231,-1.235,-1.238,-1.241,-1.244,-1.248, - &-1.251,-1.254,-1.257,-1.260,-1.263,-1.265,-1.268,-1.271,-1.274, - &-1.276,-1.279,-1.281,-1.284,-1.286,-1.288,-1.291,-1.293,-1.295, - &-1.297,-1.300,-1.302,-1.304,-1.306,-1.308,-1.310,-1.312,-1.314, - &-1.316,-1.317,-1.319,-1.321,-1.323,-1.324,-1.326,-1.328,-1.329, - &-1.331,-1.333,-1.334,-1.336,-1.337,-1.339,-1.340,-1.341,-1.343, - &-1.344,-1.346,-1.347,-1.348,-1.350,-1.351,-1.352,-1.353,-1.355, - &-1.356,-1.357,-1.358,-1.359,-1.360,-1.362,-1.363,-1.364,-1.365, - &-1.366,-1.367,-1.368,-1.369,-1.370,-1.371,-1.372,-1.373,-1.374, - &-1.375,-1.376,-1.377,-1.377,-1.378,-1.379,-1.380,-1.381,-1.382, - &-1.383,-1.383,-1.384,-1.385,-1.386,-1.387,-1.387,-1.388,-1.389, - &-1.390,-1.390,-1.391,-1.392,-1.393,-1.393,-1.394,-1.395,-1.395, - &-1.396,-1.397,-1.397,-1.398,-1.399,-1.399,-1.400,-1.401,-1.401, - &-1.402,-1.402,-1.403,-1.404,-1.404,-1.405,-1.405,-1.406,-1.406, - &-1.407,-1.407,-1.408,-1.408,-1.409,-1.410,-1.410,-1.411,-1.411, - &-1.412,-1.412,-1.412,-1.413,-1.413,-1.414,-1.414,-1.415,-1.415, - &-1.416,-1.416,-1.417,-1.417,-1.417,-1.418,-1.418,-1.419,-1.419, - &-1.420,-1.420,-1.420,-1.421,-1.421,-1.422,-1.422,-1.422,-1.423, - &-1.423,-1.423,-1.424,-1.424,-1.424,-1.425,-1.425,-1.426,-1.426, - &-1.426,-1.427,-1.427,-1.427,-1.428,-1.428,-1.428,-1.428,-1.429, - &-1.429,-1.429,-1.430,-1.430,-1.430,-1.431,-1.431,-1.431,-1.431, - &-1.432,-1.432,-1.432,-1.433,-1.433,-1.433,-1.433,-1.434,-1.434, - &-1.434,-1.434,-1.435,-1.435,-1.435,-1.435,-1.436,-1.436,-1.436, - &-1.436,-1.437,-1.437,-1.437,-1.437,-1.437,-1.438,-1.438,-1.438, - &-1.438,-1.439,-1.439,-1.439,-1.439,-1.439,-1.440,-1.440,-1.440, - &-1.440,-1.440,-1.441,-1.441,-1.441,-1.441,-1.441,-1.441,-1.442, - &-1.442,-1.442,-1.442,-1.442,-1.442,-1.443,-1.443,-1.443,-1.443, - &-1.443,-1.443,-1.444,-1.444,-1.444,-1.444,-1.444,-1.444,-1.445, - &-1.445,-1.445,-1.445,-1.445,-1.445,-1.445,-1.446,-1.446,-1.446, - &-1.446,-1.446,-1.446,-1.446,-1.446,-1.447,-1.447,-1.447,-1.447, - &-1.447,-1.447,-1.447,-1.447,-1.448,-1.448,-1.448,-1.448,-1.448, - &-1.448,-1.448,-1.448,-1.448,-1.449,-1.449,-1.449,-1.449,-1.449, - &-1.449,-1.449,-1.449,-1.449,-1.449,-1.450,-1.450,-1.450,-1.450, - &-1.450,-1.450,-1.450,-1.450,-1.450,-1.450,-1.450,-1.451,-1.451, - &-1.451,-1.451,-1.451,-1.451,-1.451,-1.451,-1.451,-1.451,-1.451, - &-1.451,-1.451,-1.451,-1.452,-1.452,-1.452,-1.452,-1.452,-1.452, - &-1.452,-1.452,-1.452,-1.452,-1.452,-1.452,-1.452,-1.452,-1.452, - &-1.453,-1.453,-1.453,-1.453,-1.453,-1.453,-1.453,-1.453,-1.453, - &-1.453,-1.453,-1.453,-1.453,-1.454,-1.454,-1.454,-1.455,-1.455, - &-1.455,-1.455,-1.455,-1.455,-1.455,-1.455,-1.455,-1.455,-1.455, - &-1.454,-1.454,-1.454,-1.454,-1.453,-1.453,-1.453,-1.452,-1.452, - &-1.452,-1.451,-1.451,-1.450,-1.450,-1.450,-1.449,-1.449,-1.448, - &-1.448,-1.447,-1.447,-1.446,-1.446,-1.445,-1.445,-1.444,-1.444, - &-1.443,-1.442,-1.442,-1.441,-1.441,-1.440,-1.440,-1.439,-1.438, - &-1.438,-1.437,-1.437,-1.436,-1.436,-1.435,-1.434,-1.434,-1.433, - &-1.433,-1.432,-1.431,-1.431,-1.430,-1.430,-1.429,-1.428,-1.428, - &-1.427,-1.426,-1.426,-1.425,-1.425,-1.424,-1.423,-1.423,-1.422, - &-1.422,-1.421,-1.420,-1.420,-1.419,-1.418,-1.418,-1.417,-1.417, - &-1.416,-1.415,-1.415,-1.414,-1.414,-1.413,-1.412,-1.412,-1.411, - &-1.411,-1.410,-1.409,-1.409,-1.408,-1.408,-1.407,-1.406,-1.406, - &-1.405,-1.405,-1.404,-1.403,-1.403,-1.402,-1.402,-1.401,-1.400, - &-1.400,-1.399,-1.399,-1.398,-1.398,-1.397,-1.396,-1.396,-1.395, - &-1.395,-1.394,-1.394,-1.393,-1.392,-1.392,-1.391,-1.391,-1.390, - &-1.390,-1.389,-1.388,-1.388,-1.387,-1.387,-1.386,-1.386,-1.385, - &-1.385,-1.384,-1.383,-1.383,-1.382,-1.382,-1.381,-1.381,-1.380, - &-1.380,-1.379,-1.378,-1.378,-1.377,-1.377,-1.376,-1.376,-1.375, - &-1.375,-1.374,-1.374 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.091,-0.189,-0.233,-0.262,-0.283,-0.299,-0.312,-0.322,-0.330, - &-0.337,-0.343,-0.347,-0.351,-0.354,-0.356,-0.358,-0.359,-0.360, - &-0.361,-0.361,-0.361,-0.360,-0.360,-0.359,-0.358,-0.356,-0.355, - &-0.354,-0.352,-0.350,-0.348,-0.346,-0.344,-0.342,-0.340,-0.337, - &-0.335,-0.332,-0.330,-0.327,-0.325,-0.322,-0.319,-0.316,-0.314, - &-0.311,-0.308,-0.305,-0.302,-0.299,-0.297,-0.294,-0.291,-0.288, - &-0.285,-0.282,-0.279,-0.276,-0.273,-0.270,-0.267,-0.263,-0.260, - &-0.257,-0.254,-0.251,-0.248,-0.245,-0.242,-0.238,-0.235,-0.232, - &-0.229,-0.225,-0.222,-0.219,-0.215,-0.212,-0.209,-0.205,-0.202, - &-0.198,-0.195,-0.191,-0.188,-0.184,-0.181,-0.177,-0.173,-0.170, - &-0.166,-0.162,-0.159,-0.155,-0.151,-0.147,-0.143,-0.140,-0.136, - &-0.132,-0.128,-0.124,-0.120,-0.116,-0.112,-0.108,-0.104,-0.100, - &-0.096,-0.091,-0.087,-0.083,-0.079,-0.075,-0.071,-0.067,-0.062, - &-0.058,-0.054,-0.050,-0.046,-0.041,-0.037,-0.033,-0.029,-0.024, - &-0.020,-0.016,-0.012,-0.008,-0.003, 0.001, 0.005, 0.009, 0.014, - & 0.018, 0.022, 0.026, 0.031, 0.035, 0.039, 0.043, 0.047, 0.052, - & 0.056, 0.060, 0.064, 0.069, 0.073, 0.077, 0.081, 0.085, 0.090, - & 0.094, 0.098, 0.102, 0.106, 0.110, 0.115, 0.119, 0.123, 0.127, - & 0.131, 0.135, 0.140, 0.144, 0.148, 0.152, 0.156, 0.160, 0.164, - & 0.169, 0.173, 0.177, 0.181, 0.185, 0.189, 0.193, 0.197, 0.201, - & 0.205, 0.209, 0.214, 0.218, 0.222, 0.226, 0.230, 0.234, 0.238, - & 0.242, 0.246, 0.250, 0.254, 0.258, 0.262, 0.266, 0.270, 0.274, - & 0.278, 0.282, 0.286, 0.290, 0.294, 0.298, 0.302, 0.306, 0.310, - & 0.314, 0.318, 0.321, 0.325, 0.329, 0.333, 0.337, 0.341, 0.345, - & 0.349, 0.353, 0.357, 0.361, 0.364, 0.368, 0.372, 0.376, 0.380, - & 0.384, 0.388, 0.391, 0.395, 0.399, 0.403, 0.407, 0.410, 0.414, - & 0.418, 0.422, 0.426, 0.429, 0.433, 0.437, 0.441, 0.445, 0.448, - & 0.452, 0.456, 0.459, 0.463, 0.467, 0.471, 0.474, 0.478, 0.482, - & 0.486, 0.489, 0.493, 0.497, 0.500, 0.504, 0.508, 0.511, 0.515, - & 0.519, 0.522, 0.526, 0.530, 0.533, 0.537, 0.540, 0.544, 0.548, - & 0.551, 0.555, 0.559, 0.562, 0.566, 0.569, 0.573, 0.576, 0.580, - & 0.584, 0.587, 0.591, 0.594, 0.598, 0.601, 0.605, 0.608, 0.612, - & 0.615, 0.619, 0.622, 0.626, 0.629, 0.633, 0.636, 0.640, 0.643, - & 0.647, 0.650, 0.654, 0.657, 0.661, 0.664, 0.668, 0.671, 0.674, - & 0.678, 0.681, 0.685, 0.688, 0.691, 0.695, 0.698, 0.702, 0.705, - & 0.708, 0.712, 0.715, 0.719, 0.722, 0.725, 0.729, 0.732, 0.735, - & 0.739, 0.742, 0.745, 0.749, 0.752, 0.755, 0.759, 0.762, 0.765, - & 0.768, 0.772, 0.775, 0.778, 0.782, 0.785, 0.788, 0.791, 0.795, - & 0.798, 0.801, 0.804, 0.808, 0.811, 0.814, 0.817, 0.821, 0.824, - & 0.827, 0.830, 0.833, 0.837, 0.840, 0.843, 0.846, 0.849, 0.853, - & 0.856, 0.859, 0.862, 0.865, 0.868, 0.872, 0.875, 0.878, 0.881, - & 0.884, 0.887, 0.890, 0.893, 0.897, 0.900, 0.903, 0.906, 0.909, - & 0.912, 0.915, 0.918, 0.921, 0.924, 0.928, 0.931, 0.934, 0.937, - & 0.940, 0.943, 0.946, 0.949, 0.952, 0.955, 0.958, 0.961, 0.964, - & 0.967, 0.970, 0.973, 0.976, 1.008, 1.038, 1.067, 1.095, 1.124, - & 1.152, 1.179, 1.206, 1.233, 1.260, 1.286, 1.312, 1.337, 1.363, - & 1.387, 1.412, 1.437, 1.461, 1.484, 1.508, 1.531, 1.554, 1.577, - & 1.600, 1.622, 1.644, 1.666, 1.687, 1.709, 1.730, 1.751, 1.772, - & 1.792, 1.812, 1.832, 1.852, 1.872, 1.892, 1.911, 1.930, 1.949, - & 1.968, 1.987, 2.005, 2.023, 2.042, 2.060, 2.077, 2.095, 2.113, - & 2.130, 2.147, 2.164, 2.181, 2.198, 2.215, 2.231, 2.248, 2.264, - & 2.280, 2.296, 2.312, 2.328, 2.343, 2.359, 2.374, 2.389, 2.405, - & 2.420, 2.435, 2.449, 2.464, 2.479, 2.493, 2.508, 2.522, 2.536, - & 2.550, 2.564, 2.578, 2.592, 2.606, 2.619, 2.633, 2.646, 2.660, - & 2.673, 2.686, 2.699, 2.712, 2.725, 2.738, 2.751, 2.763, 2.776, - & 2.788, 2.801, 2.813, 2.826, 2.838, 2.850, 2.862, 2.874, 2.886, - & 2.898, 2.910, 2.921, 2.933, 2.945, 2.956, 2.967, 2.979, 2.990, - & 3.001, 3.013, 3.024, 3.035, 3.046, 3.057, 3.068, 3.079, 3.089, - & 3.100, 3.111, 3.121, 3.132, 3.142, 3.153, 3.163, 3.173, 3.184, - & 3.194, 3.204, 3.214, 3.224, 3.234, 3.244, 3.254, 3.264, 3.274, - & 3.284, 3.293, 3.303, 3.313, 3.322, 3.332, 3.341, 3.351, 3.360, - & 3.370, 3.379, 3.388, 3.397, 3.407, 3.416, 3.425, 3.434, 3.443, - & 3.452, 3.461, 3.470 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.090,-0.186,-0.229,-0.256,-0.276,-0.290,-0.302,-0.310,-0.317, - &-0.322,-0.327,-0.330,-0.332,-0.333,-0.334,-0.335,-0.335,-0.334, - &-0.333,-0.332,-0.331,-0.329,-0.327,-0.325,-0.322,-0.320,-0.317, - &-0.314,-0.311,-0.308,-0.305,-0.301,-0.298,-0.294,-0.291,-0.287, - &-0.283,-0.279,-0.275,-0.272,-0.268,-0.264,-0.260,-0.255,-0.251, - &-0.247,-0.243,-0.239,-0.235,-0.231,-0.226,-0.222,-0.218,-0.214, - &-0.209,-0.205,-0.201,-0.196,-0.192,-0.188,-0.184,-0.179,-0.175, - &-0.170,-0.166,-0.162,-0.157,-0.153,-0.148,-0.144,-0.139,-0.135, - &-0.130,-0.126,-0.121,-0.117,-0.112,-0.107,-0.103,-0.098,-0.093, - &-0.089,-0.084,-0.079,-0.074,-0.069,-0.065,-0.060,-0.055,-0.050, - &-0.045,-0.040,-0.034,-0.029,-0.024,-0.019,-0.014,-0.009,-0.003, - & 0.002, 0.007, 0.013, 0.018, 0.023, 0.029, 0.034, 0.040, 0.045, - & 0.050, 0.056, 0.061, 0.067, 0.073, 0.078, 0.084, 0.089, 0.095, - & 0.100, 0.106, 0.112, 0.117, 0.123, 0.128, 0.134, 0.140, 0.145, - & 0.151, 0.157, 0.162, 0.168, 0.174, 0.179, 0.185, 0.190, 0.196, - & 0.202, 0.207, 0.213, 0.219, 0.224, 0.230, 0.235, 0.241, 0.247, - & 0.252, 0.258, 0.263, 0.269, 0.275, 0.280, 0.286, 0.291, 0.297, - & 0.302, 0.308, 0.313, 0.319, 0.325, 0.330, 0.336, 0.341, 0.347, - & 0.352, 0.358, 0.363, 0.369, 0.374, 0.380, 0.385, 0.390, 0.396, - & 0.401, 0.407, 0.412, 0.418, 0.423, 0.428, 0.434, 0.439, 0.445, - & 0.450, 0.455, 0.461, 0.466, 0.471, 0.477, 0.482, 0.487, 0.493, - & 0.498, 0.503, 0.509, 0.514, 0.519, 0.525, 0.530, 0.535, 0.540, - & 0.546, 0.551, 0.556, 0.561, 0.567, 0.572, 0.577, 0.582, 0.587, - & 0.593, 0.598, 0.603, 0.608, 0.613, 0.618, 0.624, 0.629, 0.634, - & 0.639, 0.644, 0.649, 0.654, 0.659, 0.664, 0.669, 0.675, 0.680, - & 0.685, 0.690, 0.695, 0.700, 0.705, 0.710, 0.715, 0.720, 0.725, - & 0.730, 0.735, 0.740, 0.745, 0.750, 0.755, 0.759, 0.764, 0.769, - & 0.774, 0.779, 0.784, 0.789, 0.794, 0.799, 0.804, 0.808, 0.813, - & 0.818, 0.823, 0.828, 0.833, 0.837, 0.842, 0.847, 0.852, 0.857, - & 0.861, 0.866, 0.871, 0.876, 0.880, 0.885, 0.890, 0.895, 0.899, - & 0.904, 0.909, 0.914, 0.918, 0.923, 0.928, 0.932, 0.937, 0.942, - & 0.946, 0.951, 0.955, 0.960, 0.965, 0.969, 0.974, 0.979, 0.983, - & 0.988, 0.992, 0.997, 1.001, 1.006, 1.011, 1.015, 1.020, 1.024, - & 1.029, 1.033, 1.038, 1.042, 1.047, 1.051, 1.056, 1.060, 1.065, - & 1.069, 1.073, 1.078, 1.082, 1.087, 1.091, 1.096, 1.100, 1.104, - & 1.109, 1.113, 1.118, 1.122, 1.126, 1.131, 1.135, 1.139, 1.144, - & 1.148, 1.152, 1.157, 1.161, 1.165, 1.170, 1.174, 1.178, 1.183, - & 1.187, 1.191, 1.195, 1.200, 1.204, 1.208, 1.212, 1.217, 1.221, - & 1.225, 1.229, 1.234, 1.238, 1.242, 1.246, 1.250, 1.255, 1.259, - & 1.263, 1.267, 1.271, 1.275, 1.279, 1.284, 1.288, 1.292, 1.296, - & 1.300, 1.304, 1.308, 1.312, 1.316, 1.321, 1.325, 1.329, 1.333, - & 1.337, 1.341, 1.345, 1.349, 1.353, 1.357, 1.361, 1.365, 1.369, - & 1.373, 1.377, 1.381, 1.385, 1.389, 1.393, 1.397, 1.401, 1.405, - & 1.409, 1.413, 1.417, 1.421, 1.425, 1.428, 1.432, 1.436, 1.440, - & 1.444, 1.448, 1.452, 1.456, 1.497, 1.535, 1.573, 1.610, 1.646, - & 1.682, 1.717, 1.752, 1.787, 1.821, 1.854, 1.888, 1.920, 1.953, - & 1.985, 2.016, 2.048, 2.078, 2.109, 2.139, 2.169, 2.198, 2.227, - & 2.256, 2.285, 2.313, 2.341, 2.368, 2.395, 2.422, 2.449, 2.475, - & 2.501, 2.527, 2.553, 2.578, 2.603, 2.628, 2.653, 2.677, 2.701, - & 2.725, 2.749, 2.772, 2.796, 2.819, 2.841, 2.864, 2.887, 2.909, - & 2.931, 2.953, 2.974, 2.996, 3.017, 3.038, 3.059, 3.080, 3.100, - & 3.121, 3.141, 3.161, 3.181, 3.201, 3.221, 3.240, 3.259, 3.279, - & 3.298, 3.317, 3.335, 3.354, 3.372, 3.391, 3.409, 3.427, 3.445, - & 3.463, 3.480, 3.498, 3.516, 3.533, 3.550, 3.567, 3.584, 3.601, - & 3.618, 3.634, 3.651, 3.667, 3.684, 3.700, 3.716, 3.732, 3.748, - & 3.764, 3.779, 3.795, 3.810, 3.826, 3.841, 3.856, 3.872, 3.887, - & 3.902, 3.916, 3.931, 3.946, 3.961, 3.975, 3.989, 4.004, 4.018, - & 4.032, 4.046, 4.060, 4.074, 4.088, 4.102, 4.116, 4.129, 4.143, - & 4.157, 4.170, 4.183, 4.197, 4.210, 4.223, 4.236, 4.249, 4.262, - & 4.275, 4.288, 4.300, 4.313, 4.326, 4.338, 4.351, 4.363, 4.376, - & 4.388, 4.400, 4.412, 4.424, 4.436, 4.449, 4.460, 4.472, 4.484, - & 4.496, 4.508, 4.519, 4.531, 4.543, 4.554, 4.566, 4.577, 4.588, - & 4.600, 4.611, 4.622 - & / - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE KM323 -C *** CALCULATES BINARY ACTIVITY COEFFICIENTS BY KUSIK-MEISSNER METHOD. -C THE COMPUTATIONS HAVE BEEN PERFORMED AND THE RESULTS ARE STORED IN -C LOOKUP TABLES. THE IONIC ACTIVITY 'IN' IS INPUT, AND THE ARRAY -C 'BINARR' IS RETURNED WITH THE BINARY COEFFICIENTS. -C -C TEMPERATURE IS 323K -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE KM323 (IONIC, BINARR) -C -C *** Common block definition -C - COMMON /KMC323/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - REAL Binarr (23), Ionic -C -C *** Find position in arrays for bincoef -C - IF (Ionic.LE. 0.200000E+02) THEN - ipos = MIN(NINT( 0.200000E+02*Ionic) + 1, 400) - ELSE - ipos = 400+NINT( 0.200000E+01*Ionic- 0.400000E+02) - ENDIF - ipos = min(ipos, 561) -C -C *** Assign values to return array -C - Binarr(01) = BNC01M(ipos) - Binarr(02) = BNC02M(ipos) - Binarr(03) = BNC03M(ipos) - Binarr(04) = BNC04M(ipos) - Binarr(05) = BNC05M(ipos) - Binarr(06) = BNC06M(ipos) - Binarr(07) = BNC07M(ipos) - Binarr(08) = BNC08M(ipos) - Binarr(09) = BNC09M(ipos) - Binarr(10) = BNC10M(ipos) - Binarr(11) = BNC11M(ipos) - Binarr(12) = BNC12M(ipos) - Binarr(13) = BNC13M(ipos) - Binarr(14) = BNC14M(ipos) - Binarr(15) = BNC15M(ipos) - Binarr(16) = BNC16M(ipos) - Binarr(17) = BNC17M(ipos) - Binarr(18) = BNC18M(ipos) - Binarr(19) = BNC19M(ipos) - Binarr(20) = BNC20M(ipos) - Binarr(21) = BNC21M(ipos) - Binarr(22) = BNC22M(ipos) - Binarr(23) = BNC23M(ipos) -C -C *** Return point ; End of subroutine -C - RETURN - END - - - BLOCK DATA KMCF323 -C -C *** Common block definition -C - COMMON /KMC323/ - &BNC01M( 561),BNC02M( 561),BNC03M( 561),BNC04M( 561), - &BNC05M( 561),BNC06M( 561),BNC07M( 561),BNC08M( 561), - &BNC09M( 561),BNC10M( 561),BNC11M( 561),BNC12M( 561), - &BNC13M( 561),BNC14M( 561),BNC15M( 561),BNC16M( 561), - &BNC17M( 561),BNC18M( 561),BNC19M( 561),BNC20M( 561), - &BNC21M( 561),BNC22M( 561),BNC23M( 561) - -C -C *** NaCl -C - DATA BNC01M/ - &-0.044,-0.092,-0.114,-0.129,-0.139,-0.147,-0.154,-0.159,-0.163, - &-0.167,-0.170,-0.172,-0.174,-0.176,-0.177,-0.178,-0.179,-0.180, - &-0.180,-0.181,-0.181,-0.181,-0.181,-0.180,-0.180,-0.180,-0.179, - &-0.179,-0.178,-0.177,-0.177,-0.176,-0.175,-0.174,-0.173,-0.172, - &-0.171,-0.170,-0.169,-0.168,-0.167,-0.166,-0.165,-0.163,-0.162, - &-0.161,-0.160,-0.159,-0.157,-0.156,-0.155,-0.153,-0.152,-0.151, - &-0.150,-0.148,-0.147,-0.146,-0.144,-0.143,-0.142,-0.140,-0.139, - &-0.137,-0.136,-0.135,-0.133,-0.132,-0.130,-0.129,-0.127,-0.126, - &-0.125,-0.123,-0.122,-0.120,-0.119,-0.117,-0.116,-0.114,-0.113, - &-0.111,-0.109,-0.108,-0.106,-0.105,-0.103,-0.101,-0.100,-0.098, - &-0.096,-0.095,-0.093,-0.091,-0.090,-0.088,-0.086,-0.084,-0.083, - &-0.081,-0.079,-0.077,-0.076,-0.074,-0.072,-0.070,-0.068,-0.066, - &-0.065,-0.063,-0.061,-0.059,-0.057,-0.055,-0.053,-0.052,-0.050, - &-0.048,-0.046,-0.044,-0.042,-0.040,-0.038,-0.036,-0.035,-0.033, - &-0.031,-0.029,-0.027,-0.025,-0.023,-0.021,-0.019,-0.017,-0.015, - &-0.013,-0.012,-0.010,-0.008,-0.006,-0.004,-0.002, 0.000, 0.002, - & 0.004, 0.006, 0.008, 0.009, 0.011, 0.013, 0.015, 0.017, 0.019, - & 0.021, 0.023, 0.025, 0.027, 0.028, 0.030, 0.032, 0.034, 0.036, - & 0.038, 0.040, 0.042, 0.044, 0.045, 0.047, 0.049, 0.051, 0.053, - & 0.055, 0.057, 0.059, 0.060, 0.062, 0.064, 0.066, 0.068, 0.070, - & 0.072, 0.074, 0.075, 0.077, 0.079, 0.081, 0.083, 0.085, 0.086, - & 0.088, 0.090, 0.092, 0.094, 0.096, 0.097, 0.099, 0.101, 0.103, - & 0.105, 0.107, 0.108, 0.110, 0.112, 0.114, 0.116, 0.117, 0.119, - & 0.121, 0.123, 0.125, 0.127, 0.128, 0.130, 0.132, 0.134, 0.135, - & 0.137, 0.139, 0.141, 0.143, 0.144, 0.146, 0.148, 0.150, 0.151, - & 0.153, 0.155, 0.157, 0.159, 0.160, 0.162, 0.164, 0.166, 0.167, - & 0.169, 0.171, 0.173, 0.174, 0.176, 0.178, 0.180, 0.181, 0.183, - & 0.185, 0.186, 0.188, 0.190, 0.192, 0.193, 0.195, 0.197, 0.198, - & 0.200, 0.202, 0.204, 0.205, 0.207, 0.209, 0.210, 0.212, 0.214, - & 0.215, 0.217, 0.219, 0.221, 0.222, 0.224, 0.226, 0.227, 0.229, - & 0.231, 0.232, 0.234, 0.236, 0.237, 0.239, 0.241, 0.242, 0.244, - & 0.246, 0.247, 0.249, 0.250, 0.252, 0.254, 0.255, 0.257, 0.259, - & 0.260, 0.262, 0.264, 0.265, 0.267, 0.268, 0.270, 0.272, 0.273, - & 0.275, 0.276, 0.278, 0.280, 0.281, 0.283, 0.285, 0.286, 0.288, - & 0.289, 0.291, 0.293, 0.294, 0.296, 0.297, 0.299, 0.300, 0.302, - & 0.304, 0.305, 0.307, 0.308, 0.310, 0.311, 0.313, 0.315, 0.316, - & 0.318, 0.319, 0.321, 0.322, 0.324, 0.325, 0.327, 0.329, 0.330, - & 0.332, 0.333, 0.335, 0.336, 0.338, 0.339, 0.341, 0.342, 0.344, - & 0.345, 0.347, 0.349, 0.350, 0.352, 0.353, 0.355, 0.356, 0.358, - & 0.359, 0.361, 0.362, 0.364, 0.365, 0.367, 0.368, 0.370, 0.371, - & 0.373, 0.374, 0.376, 0.377, 0.379, 0.380, 0.382, 0.383, 0.384, - & 0.386, 0.387, 0.389, 0.390, 0.392, 0.393, 0.395, 0.396, 0.398, - & 0.399, 0.401, 0.402, 0.404, 0.405, 0.406, 0.408, 0.409, 0.411, - & 0.412, 0.414, 0.415, 0.417, 0.418, 0.419, 0.421, 0.422, 0.424, - & 0.425, 0.427, 0.428, 0.429, 0.445, 0.459, 0.472, 0.486, 0.499, - & 0.513, 0.526, 0.539, 0.552, 0.565, 0.577, 0.590, 0.602, 0.614, - & 0.626, 0.638, 0.650, 0.662, 0.674, 0.685, 0.697, 0.708, 0.719, - & 0.730, 0.741, 0.752, 0.763, 0.773, 0.784, 0.795, 0.805, 0.815, - & 0.825, 0.836, 0.846, 0.856, 0.866, 0.875, 0.885, 0.895, 0.904, - & 0.914, 0.923, 0.933, 0.942, 0.951, 0.960, 0.969, 0.979, 0.987, - & 0.996, 1.005, 1.014, 1.023, 1.031, 1.040, 1.049, 1.057, 1.065, - & 1.074, 1.082, 1.090, 1.099, 1.107, 1.115, 1.123, 1.131, 1.139, - & 1.147, 1.155, 1.163, 1.170, 1.178, 1.186, 1.193, 1.201, 1.209, - & 1.216, 1.224, 1.231, 1.238, 1.246, 1.253, 1.260, 1.267, 1.275, - & 1.282, 1.289, 1.296, 1.303, 1.310, 1.317, 1.324, 1.331, 1.338, - & 1.345, 1.351, 1.358, 1.365, 1.372, 1.378, 1.385, 1.392, 1.398, - & 1.405, 1.411, 1.418, 1.424, 1.431, 1.437, 1.443, 1.450, 1.456, - & 1.462, 1.469, 1.475, 1.481, 1.487, 1.493, 1.500, 1.506, 1.512, - & 1.518, 1.524, 1.530, 1.536, 1.542, 1.548, 1.554, 1.560, 1.565, - & 1.571, 1.577, 1.583, 1.589, 1.594, 1.600, 1.606, 1.612, 1.617, - & 1.623, 1.629, 1.634, 1.640, 1.645, 1.651, 1.656, 1.662, 1.667, - & 1.673, 1.678, 1.684, 1.689, 1.695, 1.700, 1.705, 1.711, 1.716, - & 1.721, 1.727, 1.732 - & / -C -C *** Na2SO4 -C - DATA BNC02M/ - &-0.091,-0.196,-0.249,-0.285,-0.314,-0.337,-0.358,-0.375,-0.390, - &-0.404,-0.417,-0.428,-0.439,-0.449,-0.458,-0.466,-0.475,-0.482, - &-0.489,-0.496,-0.502,-0.508,-0.514,-0.520,-0.525,-0.530,-0.535, - &-0.540,-0.544,-0.549,-0.553,-0.557,-0.561,-0.565,-0.569,-0.572, - &-0.576,-0.579,-0.582,-0.585,-0.588,-0.591,-0.594,-0.597,-0.600, - &-0.603,-0.605,-0.608,-0.610,-0.613,-0.615,-0.617,-0.620,-0.622, - &-0.624,-0.626,-0.628,-0.630,-0.632,-0.634,-0.636,-0.638,-0.640, - &-0.641,-0.643,-0.645,-0.647,-0.648,-0.650,-0.651,-0.653,-0.654, - &-0.656,-0.657,-0.659,-0.660,-0.662,-0.663,-0.665,-0.666,-0.667, - &-0.669,-0.670,-0.671,-0.672,-0.674,-0.675,-0.676,-0.677,-0.678, - &-0.679,-0.681,-0.682,-0.683,-0.684,-0.685,-0.686,-0.687,-0.688, - &-0.689,-0.690,-0.691,-0.692,-0.693,-0.694,-0.695,-0.696,-0.697, - &-0.698,-0.699,-0.700,-0.701,-0.701,-0.702,-0.703,-0.704,-0.705, - &-0.706,-0.706,-0.707,-0.708,-0.709,-0.710,-0.710,-0.711,-0.712, - &-0.713,-0.713,-0.714,-0.715,-0.716,-0.716,-0.717,-0.718,-0.718, - &-0.719,-0.720,-0.720,-0.721,-0.722,-0.722,-0.723,-0.724,-0.724, - &-0.725,-0.725,-0.726,-0.727,-0.727,-0.728,-0.728,-0.729,-0.730, - &-0.730,-0.731,-0.731,-0.732,-0.732,-0.733,-0.733,-0.734,-0.734, - &-0.735,-0.735,-0.736,-0.736,-0.737,-0.737,-0.738,-0.738,-0.739, - &-0.739,-0.740,-0.740,-0.741,-0.741,-0.742,-0.742,-0.742,-0.743, - &-0.743,-0.744,-0.744,-0.745,-0.745,-0.745,-0.746,-0.746,-0.747, - &-0.747,-0.747,-0.748,-0.748,-0.748,-0.749,-0.749,-0.750,-0.750, - &-0.750,-0.751,-0.751,-0.751,-0.752,-0.752,-0.752,-0.753,-0.753, - &-0.753,-0.754,-0.754,-0.754,-0.755,-0.755,-0.755,-0.755,-0.756, - &-0.756,-0.756,-0.757,-0.757,-0.757,-0.758,-0.758,-0.758,-0.758, - &-0.759,-0.759,-0.759,-0.759,-0.760,-0.760,-0.760,-0.760,-0.761, - &-0.761,-0.761,-0.761,-0.762,-0.762,-0.762,-0.762,-0.763,-0.763, - &-0.763,-0.763,-0.764,-0.764,-0.764,-0.764,-0.764,-0.765,-0.765, - &-0.765,-0.765,-0.765,-0.766,-0.766,-0.766,-0.766,-0.766,-0.767, - &-0.767,-0.767,-0.767,-0.767,-0.768,-0.768,-0.768,-0.768,-0.768, - &-0.768,-0.769,-0.769,-0.769,-0.769,-0.769,-0.769,-0.770,-0.770, - &-0.770,-0.770,-0.770,-0.770,-0.771,-0.771,-0.771,-0.771,-0.771, - &-0.771,-0.771,-0.771,-0.772,-0.772,-0.772,-0.772,-0.772,-0.772, - &-0.772,-0.773,-0.773,-0.773,-0.773,-0.773,-0.773,-0.773,-0.773, - &-0.773,-0.774,-0.774,-0.774,-0.774,-0.774,-0.774,-0.774,-0.774, - &-0.774,-0.775,-0.775,-0.775,-0.775,-0.775,-0.775,-0.775,-0.775, - &-0.775,-0.775,-0.775,-0.775,-0.776,-0.776,-0.776,-0.776,-0.776, - &-0.776,-0.776,-0.776,-0.776,-0.776,-0.776,-0.776,-0.776,-0.777, - &-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.777, - &-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.777,-0.778, - &-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778, - &-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778, - &-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778, - &-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.778,-0.779,-0.779, - &-0.779,-0.779,-0.779,-0.779,-0.779,-0.779,-0.778,-0.778,-0.778, - &-0.778,-0.777,-0.777,-0.776,-0.776,-0.775,-0.774,-0.774,-0.773, - &-0.772,-0.771,-0.770,-0.769,-0.768,-0.767,-0.766,-0.765,-0.764, - &-0.763,-0.762,-0.760,-0.759,-0.758,-0.756,-0.755,-0.754,-0.752, - &-0.751,-0.749,-0.748,-0.746,-0.745,-0.743,-0.742,-0.740,-0.739, - &-0.737,-0.735,-0.734,-0.732,-0.730,-0.729,-0.727,-0.725,-0.723, - &-0.722,-0.720,-0.718,-0.716,-0.714,-0.713,-0.711,-0.709,-0.707, - &-0.705,-0.703,-0.701,-0.699,-0.697,-0.695,-0.693,-0.691,-0.690, - &-0.688,-0.686,-0.683,-0.681,-0.679,-0.677,-0.675,-0.673,-0.671, - &-0.669,-0.667,-0.665,-0.663,-0.661,-0.659,-0.656,-0.654,-0.652, - &-0.650,-0.648,-0.646,-0.644,-0.641,-0.639,-0.637,-0.635,-0.633, - &-0.630,-0.628,-0.626,-0.624,-0.621,-0.619,-0.617,-0.615,-0.612, - &-0.610,-0.608,-0.606,-0.603,-0.601,-0.599,-0.597,-0.594,-0.592, - &-0.590,-0.587,-0.585,-0.583,-0.580,-0.578,-0.576,-0.573,-0.571, - &-0.569,-0.566,-0.564,-0.562,-0.559,-0.557,-0.555,-0.552,-0.550, - &-0.547,-0.545,-0.543,-0.540,-0.538,-0.536,-0.533,-0.531,-0.528, - &-0.526,-0.524,-0.521,-0.519,-0.516,-0.514,-0.511,-0.509,-0.507, - &-0.504,-0.502,-0.499,-0.497,-0.494,-0.492,-0.490,-0.487,-0.485, - &-0.482,-0.480,-0.477 - & / -C -C *** NaNO3 -C - DATA BNC03M/ - &-0.045,-0.099,-0.125,-0.144,-0.159,-0.171,-0.181,-0.190,-0.198, - &-0.206,-0.212,-0.218,-0.224,-0.229,-0.234,-0.239,-0.243,-0.247, - &-0.251,-0.255,-0.258,-0.261,-0.265,-0.268,-0.271,-0.274,-0.276, - &-0.279,-0.281,-0.284,-0.286,-0.289,-0.291,-0.293,-0.295,-0.297, - &-0.299,-0.301,-0.303,-0.305,-0.306,-0.308,-0.310,-0.312,-0.313, - &-0.315,-0.316,-0.318,-0.319,-0.321,-0.322,-0.323,-0.325,-0.326, - &-0.327,-0.329,-0.330,-0.331,-0.332,-0.333,-0.335,-0.336,-0.337, - &-0.338,-0.339,-0.340,-0.341,-0.342,-0.343,-0.344,-0.345,-0.346, - &-0.347,-0.348,-0.349,-0.350,-0.350,-0.351,-0.352,-0.353,-0.354, - &-0.355,-0.356,-0.356,-0.357,-0.358,-0.359,-0.359,-0.360,-0.361, - &-0.362,-0.363,-0.363,-0.364,-0.365,-0.365,-0.366,-0.367,-0.368, - &-0.368,-0.369,-0.370,-0.370,-0.371,-0.372,-0.372,-0.373,-0.374, - &-0.374,-0.375,-0.375,-0.376,-0.377,-0.377,-0.378,-0.378,-0.379, - &-0.380,-0.380,-0.381,-0.381,-0.382,-0.383,-0.383,-0.384,-0.384, - &-0.385,-0.385,-0.386,-0.386,-0.387,-0.387,-0.388,-0.388,-0.389, - &-0.389,-0.390,-0.390,-0.391,-0.391,-0.392,-0.392,-0.393,-0.393, - &-0.394,-0.394,-0.395,-0.395,-0.396,-0.396,-0.397,-0.397,-0.397, - &-0.398,-0.398,-0.399,-0.399,-0.400,-0.400,-0.400,-0.401,-0.401, - &-0.402,-0.402,-0.402,-0.403,-0.403,-0.404,-0.404,-0.404,-0.405, - &-0.405,-0.406,-0.406,-0.406,-0.407,-0.407,-0.407,-0.408,-0.408, - &-0.408,-0.409,-0.409,-0.409,-0.410,-0.410,-0.411,-0.411,-0.411, - &-0.412,-0.412,-0.412,-0.413,-0.413,-0.413,-0.413,-0.414,-0.414, - &-0.414,-0.415,-0.415,-0.415,-0.416,-0.416,-0.416,-0.417,-0.417, - &-0.417,-0.417,-0.418,-0.418,-0.418,-0.419,-0.419,-0.419,-0.419, - &-0.420,-0.420,-0.420,-0.421,-0.421,-0.421,-0.421,-0.422,-0.422, - &-0.422,-0.422,-0.423,-0.423,-0.423,-0.423,-0.424,-0.424,-0.424, - &-0.424,-0.425,-0.425,-0.425,-0.425,-0.426,-0.426,-0.426,-0.426, - &-0.427,-0.427,-0.427,-0.427,-0.428,-0.428,-0.428,-0.428,-0.428, - &-0.429,-0.429,-0.429,-0.429,-0.430,-0.430,-0.430,-0.430,-0.430, - &-0.431,-0.431,-0.431,-0.431,-0.431,-0.432,-0.432,-0.432,-0.432, - &-0.432,-0.433,-0.433,-0.433,-0.433,-0.433,-0.434,-0.434,-0.434, - &-0.434,-0.434,-0.435,-0.435,-0.435,-0.435,-0.435,-0.435,-0.436, - &-0.436,-0.436,-0.436,-0.436,-0.436,-0.437,-0.437,-0.437,-0.437, - &-0.437,-0.438,-0.438,-0.438,-0.438,-0.438,-0.438,-0.438,-0.439, - &-0.439,-0.439,-0.439,-0.439,-0.439,-0.440,-0.440,-0.440,-0.440, - &-0.440,-0.440,-0.440,-0.441,-0.441,-0.441,-0.441,-0.441,-0.441, - &-0.442,-0.442,-0.442,-0.442,-0.442,-0.442,-0.442,-0.442,-0.443, - &-0.443,-0.443,-0.443,-0.443,-0.443,-0.443,-0.444,-0.444,-0.444, - &-0.444,-0.444,-0.444,-0.444,-0.444,-0.445,-0.445,-0.445,-0.445, - &-0.445,-0.445,-0.445,-0.445,-0.446,-0.446,-0.446,-0.446,-0.446, - &-0.446,-0.446,-0.446,-0.446,-0.447,-0.447,-0.447,-0.447,-0.447, - &-0.447,-0.447,-0.447,-0.447,-0.447,-0.448,-0.448,-0.448,-0.448, - &-0.448,-0.448,-0.448,-0.448,-0.448,-0.449,-0.449,-0.449,-0.449, - &-0.449,-0.449,-0.449,-0.449,-0.449,-0.449,-0.449,-0.450,-0.450, - &-0.450,-0.450,-0.450,-0.450,-0.451,-0.452,-0.452,-0.453,-0.454, - &-0.454,-0.455,-0.455,-0.456,-0.456,-0.457,-0.457,-0.457,-0.458, - &-0.458,-0.458,-0.458,-0.458,-0.458,-0.458,-0.459,-0.459,-0.459, - &-0.459,-0.459,-0.458,-0.458,-0.458,-0.458,-0.458,-0.458,-0.458, - &-0.457,-0.457,-0.457,-0.457,-0.456,-0.456,-0.456,-0.455,-0.455, - &-0.455,-0.454,-0.454,-0.453,-0.453,-0.453,-0.452,-0.452,-0.451, - &-0.451,-0.450,-0.450,-0.449,-0.449,-0.448,-0.448,-0.447,-0.446, - &-0.446,-0.445,-0.445,-0.444,-0.443,-0.443,-0.442,-0.442,-0.441, - &-0.440,-0.440,-0.439,-0.438,-0.437,-0.437,-0.436,-0.435,-0.435, - &-0.434,-0.433,-0.432,-0.432,-0.431,-0.430,-0.429,-0.429,-0.428, - &-0.427,-0.426,-0.425,-0.425,-0.424,-0.423,-0.422,-0.421,-0.420, - &-0.420,-0.419,-0.418,-0.417,-0.416,-0.415,-0.414,-0.414,-0.413, - &-0.412,-0.411,-0.410,-0.409,-0.408,-0.407,-0.406,-0.405,-0.404, - &-0.404,-0.403,-0.402,-0.401,-0.400,-0.399,-0.398,-0.397,-0.396, - &-0.395,-0.394,-0.393,-0.392,-0.391,-0.390,-0.389,-0.388,-0.387, - &-0.386,-0.385,-0.384,-0.383,-0.382,-0.381,-0.380,-0.379,-0.378, - &-0.377,-0.376,-0.375,-0.374,-0.373,-0.372,-0.371,-0.370,-0.369, - &-0.368,-0.367,-0.366,-0.365,-0.364,-0.363,-0.362,-0.361,-0.360, - &-0.359,-0.358,-0.356 - & / -C -C *** (NH4)2SO4 -C - DATA BNC04M/ - &-0.091,-0.197,-0.249,-0.286,-0.315,-0.339,-0.359,-0.377,-0.392, - &-0.406,-0.419,-0.431,-0.442,-0.452,-0.461,-0.470,-0.478,-0.486, - &-0.493,-0.500,-0.507,-0.513,-0.519,-0.525,-0.530,-0.535,-0.540, - &-0.545,-0.550,-0.554,-0.559,-0.563,-0.567,-0.571,-0.575,-0.579, - &-0.582,-0.586,-0.589,-0.592,-0.596,-0.599,-0.602,-0.605,-0.608, - &-0.611,-0.613,-0.616,-0.619,-0.621,-0.624,-0.626,-0.628,-0.631, - &-0.633,-0.635,-0.637,-0.640,-0.642,-0.644,-0.646,-0.648,-0.650, - &-0.652,-0.653,-0.655,-0.657,-0.659,-0.661,-0.662,-0.664,-0.666, - &-0.667,-0.669,-0.670,-0.672,-0.673,-0.675,-0.676,-0.678,-0.679, - &-0.681,-0.682,-0.683,-0.685,-0.686,-0.687,-0.689,-0.690,-0.691, - &-0.693,-0.694,-0.695,-0.696,-0.697,-0.699,-0.700,-0.701,-0.702, - &-0.703,-0.704,-0.705,-0.707,-0.708,-0.709,-0.710,-0.711,-0.712, - &-0.713,-0.714,-0.715,-0.716,-0.717,-0.718,-0.719,-0.720,-0.721, - &-0.722,-0.723,-0.724,-0.724,-0.725,-0.726,-0.727,-0.728,-0.729, - &-0.730,-0.731,-0.731,-0.732,-0.733,-0.734,-0.735,-0.735,-0.736, - &-0.737,-0.738,-0.738,-0.739,-0.740,-0.741,-0.741,-0.742,-0.743, - &-0.744,-0.744,-0.745,-0.746,-0.746,-0.747,-0.748,-0.748,-0.749, - &-0.750,-0.750,-0.751,-0.752,-0.752,-0.753,-0.754,-0.754,-0.755, - &-0.755,-0.756,-0.757,-0.757,-0.758,-0.758,-0.759,-0.759,-0.760, - &-0.761,-0.761,-0.762,-0.762,-0.763,-0.763,-0.764,-0.764,-0.765, - &-0.765,-0.766,-0.766,-0.767,-0.767,-0.768,-0.768,-0.769,-0.769, - &-0.770,-0.770,-0.771,-0.771,-0.772,-0.772,-0.772,-0.773,-0.773, - &-0.774,-0.774,-0.775,-0.775,-0.776,-0.776,-0.776,-0.777,-0.777, - &-0.778,-0.778,-0.778,-0.779,-0.779,-0.780,-0.780,-0.780,-0.781, - &-0.781,-0.781,-0.782,-0.782,-0.783,-0.783,-0.783,-0.784,-0.784, - &-0.784,-0.785,-0.785,-0.785,-0.786,-0.786,-0.786,-0.787,-0.787, - &-0.787,-0.788,-0.788,-0.788,-0.789,-0.789,-0.789,-0.790,-0.790, - &-0.790,-0.790,-0.791,-0.791,-0.791,-0.792,-0.792,-0.792,-0.793, - &-0.793,-0.793,-0.793,-0.794,-0.794,-0.794,-0.794,-0.795,-0.795, - &-0.795,-0.795,-0.796,-0.796,-0.796,-0.796,-0.797,-0.797,-0.797, - &-0.797,-0.798,-0.798,-0.798,-0.798,-0.799,-0.799,-0.799,-0.799, - &-0.800,-0.800,-0.800,-0.800,-0.800,-0.801,-0.801,-0.801,-0.801, - &-0.801,-0.802,-0.802,-0.802,-0.802,-0.802,-0.803,-0.803,-0.803, - &-0.803,-0.803,-0.804,-0.804,-0.804,-0.804,-0.804,-0.804,-0.805, - &-0.805,-0.805,-0.805,-0.805,-0.806,-0.806,-0.806,-0.806,-0.806, - &-0.806,-0.806,-0.807,-0.807,-0.807,-0.807,-0.807,-0.807,-0.808, - &-0.808,-0.808,-0.808,-0.808,-0.808,-0.808,-0.809,-0.809,-0.809, - &-0.809,-0.809,-0.809,-0.809,-0.810,-0.810,-0.810,-0.810,-0.810, - &-0.810,-0.810,-0.810,-0.810,-0.811,-0.811,-0.811,-0.811,-0.811, - &-0.811,-0.811,-0.811,-0.812,-0.812,-0.812,-0.812,-0.812,-0.812, - &-0.812,-0.812,-0.812,-0.812,-0.813,-0.813,-0.813,-0.813,-0.813, - &-0.813,-0.813,-0.813,-0.813,-0.813,-0.813,-0.814,-0.814,-0.814, - &-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814, - &-0.814,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815, - &-0.815,-0.815,-0.815,-0.815,-0.816,-0.816,-0.817,-0.817,-0.817, - &-0.817,-0.817,-0.817,-0.817,-0.817,-0.817,-0.817,-0.816,-0.816, - &-0.816,-0.815,-0.815,-0.814,-0.813,-0.813,-0.812,-0.811,-0.811, - &-0.810,-0.809,-0.808,-0.807,-0.806,-0.805,-0.804,-0.803,-0.802, - &-0.801,-0.800,-0.799,-0.797,-0.796,-0.795,-0.794,-0.792,-0.791, - &-0.790,-0.788,-0.787,-0.786,-0.784,-0.783,-0.781,-0.780,-0.778, - &-0.777,-0.775,-0.774,-0.772,-0.771,-0.769,-0.767,-0.766,-0.764, - &-0.762,-0.761,-0.759,-0.757,-0.756,-0.754,-0.752,-0.750,-0.749, - &-0.747,-0.745,-0.743,-0.741,-0.740,-0.738,-0.736,-0.734,-0.732, - &-0.730,-0.728,-0.727,-0.725,-0.723,-0.721,-0.719,-0.717,-0.715, - &-0.713,-0.711,-0.709,-0.707,-0.705,-0.703,-0.701,-0.699,-0.697, - &-0.695,-0.693,-0.691,-0.689,-0.687,-0.685,-0.683,-0.681,-0.678, - &-0.676,-0.674,-0.672,-0.670,-0.668,-0.666,-0.664,-0.661,-0.659, - &-0.657,-0.655,-0.653,-0.651,-0.648,-0.646,-0.644,-0.642,-0.640, - &-0.638,-0.635,-0.633,-0.631,-0.629,-0.626,-0.624,-0.622,-0.620, - &-0.618,-0.615,-0.613,-0.611,-0.609,-0.606,-0.604,-0.602,-0.599, - &-0.597,-0.595,-0.593,-0.590,-0.588,-0.586,-0.583,-0.581,-0.579, - &-0.577,-0.574,-0.572,-0.570,-0.567,-0.565,-0.563,-0.560,-0.558, - &-0.556,-0.553,-0.551 - & / -C -C *** NH4NO3 -C - DATA BNC05M/ - &-0.046,-0.101,-0.129,-0.149,-0.166,-0.179,-0.191,-0.202,-0.211, - &-0.220,-0.228,-0.235,-0.242,-0.249,-0.255,-0.261,-0.266,-0.272, - &-0.277,-0.282,-0.286,-0.291,-0.295,-0.299,-0.303,-0.307,-0.311, - &-0.315,-0.319,-0.322,-0.326,-0.329,-0.332,-0.335,-0.339,-0.342, - &-0.345,-0.348,-0.350,-0.353,-0.356,-0.359,-0.361,-0.364,-0.366, - &-0.369,-0.371,-0.374,-0.376,-0.378,-0.380,-0.383,-0.385,-0.387, - &-0.389,-0.391,-0.393,-0.395,-0.397,-0.399,-0.401,-0.403,-0.405, - &-0.406,-0.408,-0.410,-0.412,-0.414,-0.415,-0.417,-0.419,-0.420, - &-0.422,-0.424,-0.425,-0.427,-0.428,-0.430,-0.432,-0.433,-0.435, - &-0.436,-0.438,-0.439,-0.441,-0.442,-0.444,-0.445,-0.447,-0.448, - &-0.449,-0.451,-0.452,-0.454,-0.455,-0.456,-0.458,-0.459,-0.461, - &-0.462,-0.463,-0.465,-0.466,-0.467,-0.469,-0.470,-0.471,-0.473, - &-0.474,-0.475,-0.477,-0.478,-0.479,-0.480,-0.482,-0.483,-0.484, - &-0.485,-0.487,-0.488,-0.489,-0.490,-0.492,-0.493,-0.494,-0.495, - &-0.496,-0.498,-0.499,-0.500,-0.501,-0.502,-0.503,-0.504,-0.506, - &-0.507,-0.508,-0.509,-0.510,-0.511,-0.512,-0.513,-0.514,-0.515, - &-0.516,-0.517,-0.519,-0.520,-0.521,-0.522,-0.523,-0.524,-0.525, - &-0.526,-0.527,-0.528,-0.529,-0.530,-0.531,-0.532,-0.533,-0.534, - &-0.535,-0.535,-0.536,-0.537,-0.538,-0.539,-0.540,-0.541,-0.542, - &-0.543,-0.544,-0.545,-0.546,-0.547,-0.547,-0.548,-0.549,-0.550, - &-0.551,-0.552,-0.553,-0.553,-0.554,-0.555,-0.556,-0.557,-0.558, - &-0.559,-0.559,-0.560,-0.561,-0.562,-0.563,-0.563,-0.564,-0.565, - &-0.566,-0.567,-0.567,-0.568,-0.569,-0.570,-0.570,-0.571,-0.572, - &-0.573,-0.574,-0.574,-0.575,-0.576,-0.576,-0.577,-0.578,-0.579, - &-0.579,-0.580,-0.581,-0.582,-0.582,-0.583,-0.584,-0.584,-0.585, - &-0.586,-0.586,-0.587,-0.588,-0.589,-0.589,-0.590,-0.591,-0.591, - &-0.592,-0.593,-0.593,-0.594,-0.595,-0.595,-0.596,-0.596,-0.597, - &-0.598,-0.598,-0.599,-0.600,-0.600,-0.601,-0.602,-0.602,-0.603, - &-0.603,-0.604,-0.605,-0.605,-0.606,-0.606,-0.607,-0.608,-0.608, - &-0.609,-0.609,-0.610,-0.611,-0.611,-0.612,-0.612,-0.613,-0.613, - &-0.614,-0.615,-0.615,-0.616,-0.616,-0.617,-0.617,-0.618,-0.618, - &-0.619,-0.620,-0.620,-0.621,-0.621,-0.622,-0.622,-0.623,-0.623, - &-0.624,-0.624,-0.625,-0.625,-0.626,-0.626,-0.627,-0.627,-0.628, - &-0.628,-0.629,-0.629,-0.630,-0.630,-0.631,-0.631,-0.632,-0.632, - &-0.633,-0.633,-0.634,-0.634,-0.635,-0.635,-0.636,-0.636,-0.637, - &-0.637,-0.638,-0.638,-0.639,-0.639,-0.639,-0.640,-0.640,-0.641, - &-0.641,-0.642,-0.642,-0.643,-0.643,-0.643,-0.644,-0.644,-0.645, - &-0.645,-0.646,-0.646,-0.647,-0.647,-0.647,-0.648,-0.648,-0.649, - &-0.649,-0.649,-0.650,-0.650,-0.651,-0.651,-0.652,-0.652,-0.652, - &-0.653,-0.653,-0.654,-0.654,-0.654,-0.655,-0.655,-0.656,-0.656, - &-0.656,-0.657,-0.657,-0.658,-0.658,-0.658,-0.659,-0.659,-0.659, - &-0.660,-0.660,-0.661,-0.661,-0.661,-0.662,-0.662,-0.662,-0.663, - &-0.663,-0.663,-0.664,-0.664,-0.665,-0.665,-0.665,-0.666,-0.666, - &-0.666,-0.667,-0.667,-0.667,-0.668,-0.668,-0.668,-0.669,-0.669, - &-0.669,-0.670,-0.670,-0.670,-0.674,-0.677,-0.680,-0.683,-0.686, - &-0.688,-0.691,-0.693,-0.696,-0.698,-0.700,-0.702,-0.705,-0.706, - &-0.708,-0.710,-0.712,-0.714,-0.715,-0.717,-0.718,-0.720,-0.721, - &-0.722,-0.723,-0.725,-0.726,-0.727,-0.728,-0.729,-0.730,-0.731, - &-0.732,-0.732,-0.733,-0.734,-0.735,-0.735,-0.736,-0.736,-0.737, - &-0.737,-0.738,-0.738,-0.739,-0.739,-0.739,-0.740,-0.740,-0.740, - &-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741, - &-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741,-0.741, - &-0.741,-0.740,-0.740,-0.740,-0.740,-0.739,-0.739,-0.739,-0.739, - &-0.738,-0.738,-0.738,-0.737,-0.737,-0.736,-0.736,-0.736,-0.735, - &-0.735,-0.734,-0.734,-0.733,-0.733,-0.732,-0.732,-0.731,-0.731, - &-0.730,-0.729,-0.729,-0.728,-0.728,-0.727,-0.726,-0.726,-0.725, - &-0.725,-0.724,-0.723,-0.723,-0.722,-0.721,-0.721,-0.720,-0.719, - &-0.718,-0.718,-0.717,-0.716,-0.715,-0.715,-0.714,-0.713,-0.712, - &-0.711,-0.711,-0.710,-0.709,-0.708,-0.707,-0.707,-0.706,-0.705, - &-0.704,-0.703,-0.702,-0.701,-0.701,-0.700,-0.699,-0.698,-0.697, - &-0.696,-0.695,-0.694,-0.693,-0.692,-0.692,-0.691,-0.690,-0.689, - &-0.688,-0.687,-0.686,-0.685,-0.684,-0.683,-0.682,-0.681,-0.680, - &-0.679,-0.678,-0.677 - & / -C -C *** NH4Cl -C - DATA BNC06M/ - &-0.045,-0.096,-0.120,-0.136,-0.149,-0.159,-0.167,-0.174,-0.181, - &-0.186,-0.191,-0.195,-0.199,-0.202,-0.205,-0.208,-0.210,-0.213, - &-0.215,-0.217,-0.219,-0.220,-0.222,-0.223,-0.225,-0.226,-0.227, - &-0.228,-0.229,-0.230,-0.231,-0.232,-0.232,-0.233,-0.234,-0.234, - &-0.235,-0.235,-0.236,-0.236,-0.237,-0.237,-0.237,-0.238,-0.238, - &-0.238,-0.238,-0.238,-0.239,-0.239,-0.239,-0.239,-0.239,-0.239, - &-0.239,-0.239,-0.239,-0.239,-0.239,-0.239,-0.239,-0.239,-0.239, - &-0.239,-0.239,-0.239,-0.239,-0.239,-0.239,-0.239,-0.238,-0.238, - &-0.238,-0.238,-0.238,-0.238,-0.237,-0.237,-0.237,-0.237,-0.237, - &-0.236,-0.236,-0.236,-0.235,-0.235,-0.235,-0.235,-0.234,-0.234, - &-0.234,-0.233,-0.233,-0.233,-0.232,-0.232,-0.231,-0.231,-0.231, - &-0.230,-0.230,-0.229,-0.229,-0.229,-0.228,-0.228,-0.227,-0.227, - &-0.226,-0.226,-0.225,-0.225,-0.224,-0.224,-0.224,-0.223,-0.223, - &-0.222,-0.222,-0.221,-0.221,-0.220,-0.219,-0.219,-0.218,-0.218, - &-0.217,-0.217,-0.216,-0.216,-0.215,-0.215,-0.214,-0.214,-0.213, - &-0.213,-0.212,-0.211,-0.211,-0.210,-0.210,-0.209,-0.209,-0.208, - &-0.208,-0.207,-0.206,-0.206,-0.205,-0.205,-0.204,-0.204,-0.203, - &-0.203,-0.202,-0.201,-0.201,-0.200,-0.200,-0.199,-0.199,-0.198, - &-0.197,-0.197,-0.196,-0.196,-0.195,-0.195,-0.194,-0.193,-0.193, - &-0.192,-0.192,-0.191,-0.191,-0.190,-0.189,-0.189,-0.188,-0.188, - &-0.187,-0.186,-0.186,-0.185,-0.185,-0.184,-0.184,-0.183,-0.182, - &-0.182,-0.181,-0.181,-0.180,-0.179,-0.179,-0.178,-0.178,-0.177, - &-0.177,-0.176,-0.175,-0.175,-0.174,-0.174,-0.173,-0.172,-0.172, - &-0.171,-0.171,-0.170,-0.170,-0.169,-0.168,-0.168,-0.167,-0.167, - &-0.166,-0.165,-0.165,-0.164,-0.164,-0.163,-0.163,-0.162,-0.161, - &-0.161,-0.160,-0.160,-0.159,-0.158,-0.158,-0.157,-0.157,-0.156, - &-0.156,-0.155,-0.154,-0.154,-0.153,-0.153,-0.152,-0.151,-0.151, - &-0.150,-0.150,-0.149,-0.149,-0.148,-0.147,-0.147,-0.146,-0.146, - &-0.145,-0.145,-0.144,-0.143,-0.143,-0.142,-0.142,-0.141,-0.140, - &-0.140,-0.139,-0.139,-0.138,-0.138,-0.137,-0.136,-0.136,-0.135, - &-0.135,-0.134,-0.134,-0.133,-0.132,-0.132,-0.131,-0.131,-0.130, - &-0.130,-0.129,-0.128,-0.128,-0.127,-0.127,-0.126,-0.126,-0.125, - &-0.125,-0.124,-0.123,-0.123,-0.122,-0.122,-0.121,-0.121,-0.120, - &-0.119,-0.119,-0.118,-0.118,-0.117,-0.117,-0.116,-0.115,-0.115, - &-0.114,-0.114,-0.113,-0.113,-0.112,-0.112,-0.111,-0.110,-0.110, - &-0.109,-0.109,-0.108,-0.108,-0.107,-0.107,-0.106,-0.105,-0.105, - &-0.104,-0.104,-0.103,-0.103,-0.102,-0.102,-0.101,-0.100,-0.100, - &-0.099,-0.099,-0.098,-0.098,-0.097,-0.097,-0.096,-0.096,-0.095, - &-0.094,-0.094,-0.093,-0.093,-0.092,-0.092,-0.091,-0.091,-0.090, - &-0.090,-0.089,-0.088,-0.088,-0.087,-0.087,-0.086,-0.086,-0.085, - &-0.085,-0.084,-0.084,-0.083,-0.083,-0.082,-0.081,-0.081,-0.080, - &-0.080,-0.079,-0.079,-0.078,-0.078,-0.077,-0.077,-0.076,-0.076, - &-0.075,-0.074,-0.074,-0.073,-0.073,-0.072,-0.072,-0.071,-0.071, - &-0.070,-0.070,-0.069,-0.069,-0.068,-0.068,-0.067,-0.067,-0.066, - &-0.065,-0.065,-0.064,-0.064,-0.058,-0.053,-0.048,-0.043,-0.038, - &-0.033,-0.028,-0.023,-0.018,-0.013,-0.008,-0.003, 0.002, 0.006, - & 0.011, 0.016, 0.021, 0.025, 0.030, 0.035, 0.039, 0.044, 0.048, - & 0.053, 0.057, 0.062, 0.066, 0.070, 0.075, 0.079, 0.083, 0.088, - & 0.092, 0.096, 0.100, 0.105, 0.109, 0.113, 0.117, 0.121, 0.125, - & 0.129, 0.133, 0.137, 0.141, 0.145, 0.149, 0.153, 0.157, 0.161, - & 0.165, 0.169, 0.173, 0.176, 0.180, 0.184, 0.188, 0.192, 0.195, - & 0.199, 0.203, 0.207, 0.210, 0.214, 0.218, 0.221, 0.225, 0.228, - & 0.232, 0.236, 0.239, 0.243, 0.246, 0.250, 0.253, 0.257, 0.260, - & 0.264, 0.267, 0.271, 0.274, 0.278, 0.281, 0.285, 0.288, 0.291, - & 0.295, 0.298, 0.301, 0.305, 0.308, 0.311, 0.315, 0.318, 0.321, - & 0.325, 0.328, 0.331, 0.334, 0.338, 0.341, 0.344, 0.347, 0.350, - & 0.354, 0.357, 0.360, 0.363, 0.366, 0.369, 0.373, 0.376, 0.379, - & 0.382, 0.385, 0.388, 0.391, 0.394, 0.397, 0.400, 0.403, 0.406, - & 0.409, 0.412, 0.416, 0.419, 0.422, 0.425, 0.428, 0.430, 0.433, - & 0.436, 0.439, 0.442, 0.445, 0.448, 0.451, 0.454, 0.457, 0.460, - & 0.463, 0.466, 0.469, 0.471, 0.474, 0.477, 0.480, 0.483, 0.486, - & 0.489, 0.491, 0.494, 0.497, 0.500, 0.503, 0.506, 0.508, 0.511, - & 0.514, 0.517, 0.520 - & / -C -C *** (2H,SO4) -C - DATA BNC07M/ - &-0.091,-0.196,-0.248,-0.284,-0.312,-0.336,-0.355,-0.372,-0.388, - &-0.401,-0.414,-0.425,-0.435,-0.445,-0.453,-0.462,-0.469,-0.477, - &-0.484,-0.490,-0.496,-0.502,-0.508,-0.513,-0.518,-0.523,-0.528, - &-0.532,-0.536,-0.540,-0.544,-0.548,-0.552,-0.556,-0.559,-0.562, - &-0.566,-0.569,-0.572,-0.575,-0.578,-0.580,-0.583,-0.586,-0.588, - &-0.591,-0.593,-0.595,-0.598,-0.600,-0.602,-0.604,-0.606,-0.608, - &-0.610,-0.612,-0.614,-0.616,-0.618,-0.620,-0.621,-0.623,-0.625, - &-0.626,-0.628,-0.629,-0.631,-0.632,-0.634,-0.635,-0.637,-0.638, - &-0.639,-0.641,-0.642,-0.643,-0.644,-0.646,-0.647,-0.648,-0.649, - &-0.650,-0.652,-0.653,-0.654,-0.655,-0.656,-0.657,-0.658,-0.659, - &-0.660,-0.661,-0.662,-0.663,-0.664,-0.665,-0.666,-0.666,-0.667, - &-0.668,-0.669,-0.670,-0.671,-0.671,-0.672,-0.673,-0.674,-0.675, - &-0.675,-0.676,-0.677,-0.678,-0.678,-0.679,-0.680,-0.680,-0.681, - &-0.682,-0.682,-0.683,-0.684,-0.684,-0.685,-0.686,-0.686,-0.687, - &-0.687,-0.688,-0.689,-0.689,-0.690,-0.690,-0.691,-0.691,-0.692, - &-0.692,-0.693,-0.693,-0.694,-0.694,-0.695,-0.695,-0.696,-0.696, - &-0.697,-0.697,-0.698,-0.698,-0.699,-0.699,-0.700,-0.700,-0.700, - &-0.701,-0.701,-0.702,-0.702,-0.702,-0.703,-0.703,-0.704,-0.704, - &-0.704,-0.705,-0.705,-0.705,-0.706,-0.706,-0.706,-0.707,-0.707, - &-0.707,-0.708,-0.708,-0.708,-0.709,-0.709,-0.709,-0.710,-0.710, - &-0.710,-0.711,-0.711,-0.711,-0.711,-0.712,-0.712,-0.712,-0.712, - &-0.713,-0.713,-0.713,-0.713,-0.714,-0.714,-0.714,-0.714,-0.715, - &-0.715,-0.715,-0.715,-0.716,-0.716,-0.716,-0.716,-0.716,-0.717, - &-0.717,-0.717,-0.717,-0.717,-0.718,-0.718,-0.718,-0.718,-0.718, - &-0.719,-0.719,-0.719,-0.719,-0.719,-0.719,-0.720,-0.720,-0.720, - &-0.720,-0.720,-0.720,-0.720,-0.721,-0.721,-0.721,-0.721,-0.721, - &-0.721,-0.721,-0.722,-0.722,-0.722,-0.722,-0.722,-0.722,-0.722, - &-0.722,-0.723,-0.723,-0.723,-0.723,-0.723,-0.723,-0.723,-0.723, - &-0.723,-0.723,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724, - &-0.724,-0.724,-0.724,-0.724,-0.724,-0.725,-0.725,-0.725,-0.725, - &-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725, - &-0.725,-0.725,-0.725,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.726, - &-0.726,-0.726,-0.726,-0.726,-0.726,-0.726,-0.725,-0.725,-0.725, - &-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725, - &-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725,-0.725, - &-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724, - &-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.724,-0.723,-0.723, - &-0.723,-0.723,-0.723,-0.723,-0.722,-0.721,-0.721,-0.720,-0.719, - &-0.717,-0.716,-0.715,-0.714,-0.713,-0.711,-0.710,-0.709,-0.707, - &-0.706,-0.704,-0.703,-0.701,-0.700,-0.698,-0.696,-0.695,-0.693, - &-0.691,-0.689,-0.688,-0.686,-0.684,-0.682,-0.680,-0.678,-0.676, - &-0.675,-0.673,-0.671,-0.669,-0.667,-0.665,-0.663,-0.661,-0.658, - &-0.656,-0.654,-0.652,-0.650,-0.648,-0.646,-0.644,-0.642,-0.639, - &-0.637,-0.635,-0.633,-0.631,-0.628,-0.626,-0.624,-0.622,-0.619, - &-0.617,-0.615,-0.612,-0.610,-0.608,-0.605,-0.603,-0.601,-0.598, - &-0.596,-0.594,-0.591,-0.589,-0.587,-0.584,-0.582,-0.579,-0.577, - &-0.575,-0.572,-0.570,-0.567,-0.565,-0.563,-0.560,-0.558,-0.555, - &-0.553,-0.550,-0.548,-0.545,-0.543,-0.540,-0.538,-0.535,-0.533, - &-0.530,-0.528,-0.525,-0.523,-0.520,-0.518,-0.515,-0.513,-0.510, - &-0.508,-0.505,-0.503,-0.500,-0.498,-0.495,-0.493,-0.490,-0.487, - &-0.485,-0.482,-0.480,-0.477,-0.475,-0.472,-0.470,-0.467,-0.464, - &-0.462,-0.459,-0.457,-0.454,-0.451,-0.449,-0.446,-0.444,-0.441, - &-0.438,-0.436,-0.433,-0.431,-0.428,-0.425,-0.423,-0.420,-0.418, - &-0.415,-0.412,-0.410,-0.407,-0.404,-0.402,-0.399,-0.397,-0.394, - &-0.391,-0.389,-0.386,-0.383,-0.381,-0.378,-0.375,-0.373,-0.370, - &-0.367,-0.365,-0.362 - & / -C -C *** (H,HSO4) -C - DATA BNC08M/ - &-0.043,-0.086,-0.105,-0.116,-0.123,-0.128,-0.131,-0.134,-0.135, - &-0.136,-0.136,-0.135,-0.134,-0.133,-0.131,-0.129,-0.127,-0.124, - &-0.122,-0.118,-0.115,-0.112,-0.108,-0.104,-0.100,-0.096,-0.092, - &-0.088,-0.083,-0.079,-0.074,-0.069,-0.064,-0.059,-0.054,-0.048, - &-0.043,-0.037,-0.032,-0.026,-0.021,-0.015,-0.009,-0.003, 0.003, - & 0.009, 0.015, 0.021, 0.027, 0.034, 0.040, 0.046, 0.053, 0.059, - & 0.066, 0.072, 0.079, 0.086, 0.092, 0.099, 0.106, 0.112, 0.119, - & 0.126, 0.133, 0.140, 0.147, 0.154, 0.161, 0.168, 0.175, 0.182, - & 0.189, 0.196, 0.204, 0.211, 0.218, 0.226, 0.233, 0.240, 0.248, - & 0.255, 0.263, 0.270, 0.278, 0.286, 0.293, 0.301, 0.309, 0.317, - & 0.324, 0.332, 0.340, 0.348, 0.356, 0.364, 0.372, 0.380, 0.389, - & 0.397, 0.405, 0.413, 0.421, 0.430, 0.438, 0.446, 0.455, 0.463, - & 0.471, 0.480, 0.488, 0.497, 0.505, 0.514, 0.522, 0.530, 0.539, - & 0.547, 0.556, 0.564, 0.573, 0.581, 0.590, 0.598, 0.607, 0.615, - & 0.624, 0.632, 0.641, 0.649, 0.658, 0.666, 0.675, 0.683, 0.692, - & 0.700, 0.708, 0.717, 0.725, 0.734, 0.742, 0.750, 0.759, 0.767, - & 0.775, 0.784, 0.792, 0.800, 0.808, 0.817, 0.825, 0.833, 0.841, - & 0.849, 0.858, 0.866, 0.874, 0.882, 0.890, 0.898, 0.906, 0.915, - & 0.923, 0.931, 0.939, 0.947, 0.955, 0.963, 0.971, 0.979, 0.986, - & 0.994, 1.002, 1.010, 1.018, 1.026, 1.034, 1.042, 1.049, 1.057, - & 1.065, 1.073, 1.080, 1.088, 1.096, 1.104, 1.111, 1.119, 1.127, - & 1.134, 1.142, 1.150, 1.157, 1.165, 1.172, 1.180, 1.187, 1.195, - & 1.202, 1.210, 1.217, 1.225, 1.232, 1.240, 1.247, 1.254, 1.262, - & 1.269, 1.276, 1.284, 1.291, 1.298, 1.306, 1.313, 1.320, 1.327, - & 1.335, 1.342, 1.349, 1.356, 1.363, 1.371, 1.378, 1.385, 1.392, - & 1.399, 1.406, 1.413, 1.420, 1.427, 1.434, 1.441, 1.448, 1.455, - & 1.462, 1.469, 1.476, 1.483, 1.490, 1.497, 1.504, 1.510, 1.517, - & 1.524, 1.531, 1.538, 1.545, 1.551, 1.558, 1.565, 1.572, 1.578, - & 1.585, 1.592, 1.598, 1.605, 1.612, 1.618, 1.625, 1.632, 1.638, - & 1.645, 1.651, 1.658, 1.664, 1.671, 1.678, 1.684, 1.691, 1.697, - & 1.704, 1.710, 1.716, 1.723, 1.729, 1.736, 1.742, 1.749, 1.755, - & 1.761, 1.768, 1.774, 1.780, 1.787, 1.793, 1.799, 1.805, 1.812, - & 1.818, 1.824, 1.830, 1.837, 1.843, 1.849, 1.855, 1.861, 1.868, - & 1.874, 1.880, 1.886, 1.892, 1.898, 1.904, 1.910, 1.916, 1.923, - & 1.929, 1.935, 1.941, 1.947, 1.953, 1.959, 1.965, 1.971, 1.977, - & 1.983, 1.988, 1.994, 2.000, 2.006, 2.012, 2.018, 2.024, 2.030, - & 2.036, 2.041, 2.047, 2.053, 2.059, 2.065, 2.070, 2.076, 2.082, - & 2.088, 2.094, 2.099, 2.105, 2.111, 2.116, 2.122, 2.128, 2.134, - & 2.139, 2.145, 2.150, 2.156, 2.162, 2.167, 2.173, 2.179, 2.184, - & 2.190, 2.195, 2.201, 2.206, 2.212, 2.218, 2.223, 2.229, 2.234, - & 2.240, 2.245, 2.251, 2.256, 2.261, 2.267, 2.272, 2.278, 2.283, - & 2.289, 2.294, 2.299, 2.305, 2.310, 2.316, 2.321, 2.326, 2.332, - & 2.337, 2.342, 2.348, 2.353, 2.358, 2.364, 2.369, 2.374, 2.379, - & 2.385, 2.390, 2.395, 2.400, 2.406, 2.411, 2.416, 2.421, 2.426, - & 2.432, 2.437, 2.442, 2.447, 2.502, 2.553, 2.602, 2.651, 2.699, - & 2.746, 2.793, 2.839, 2.884, 2.929, 2.973, 3.017, 3.060, 3.102, - & 3.144, 3.186, 3.227, 3.267, 3.307, 3.346, 3.385, 3.424, 3.462, - & 3.499, 3.536, 3.573, 3.610, 3.646, 3.681, 3.716, 3.751, 3.786, - & 3.820, 3.854, 3.887, 3.920, 3.953, 3.985, 4.018, 4.049, 4.081, - & 4.112, 4.143, 4.174, 4.204, 4.234, 4.264, 4.294, 4.323, 4.352, - & 4.381, 4.410, 4.438, 4.466, 4.494, 4.522, 4.549, 4.577, 4.604, - & 4.630, 4.657, 4.683, 4.710, 4.736, 4.761, 4.787, 4.812, 4.838, - & 4.863, 4.888, 4.912, 4.937, 4.961, 4.985, 5.009, 5.033, 5.057, - & 5.080, 5.104, 5.127, 5.150, 5.173, 5.196, 5.218, 5.241, 5.263, - & 5.285, 5.307, 5.329, 5.351, 5.372, 5.394, 5.415, 5.436, 5.457, - & 5.478, 5.499, 5.520, 5.541, 5.561, 5.581, 5.602, 5.622, 5.642, - & 5.662, 5.682, 5.701, 5.721, 5.740, 5.760, 5.779, 5.798, 5.817, - & 5.836, 5.855, 5.874, 5.892, 5.911, 5.929, 5.948, 5.966, 5.984, - & 6.002, 6.020, 6.038, 6.056, 6.074, 6.092, 6.109, 6.127, 6.144, - & 6.161, 6.179, 6.196, 6.213, 6.230, 6.247, 6.264, 6.280, 6.297, - & 6.314, 6.330, 6.347, 6.363, 6.379, 6.396, 6.412, 6.428, 6.444, - & 6.460, 6.476, 6.492, 6.507, 6.523, 6.539, 6.554, 6.570, 6.585, - & 6.600, 6.616, 6.631 - & / -C -C *** NH4HSO4 -C - DATA BNC09M/ - &-0.045,-0.095,-0.119,-0.135,-0.147,-0.157,-0.166,-0.173,-0.179, - &-0.184,-0.189,-0.193,-0.196,-0.200,-0.203,-0.205,-0.208,-0.210, - &-0.212,-0.213,-0.215,-0.216,-0.217,-0.218,-0.219,-0.219,-0.220, - &-0.220,-0.221,-0.221,-0.221,-0.221,-0.221,-0.221,-0.220,-0.220, - &-0.219,-0.219,-0.218,-0.217,-0.217,-0.216,-0.215,-0.214,-0.213, - &-0.212,-0.211,-0.210,-0.208,-0.207,-0.206,-0.204,-0.203,-0.201, - &-0.200,-0.198,-0.197,-0.195,-0.193,-0.192,-0.190,-0.188,-0.186, - &-0.185,-0.183,-0.181,-0.179,-0.177,-0.175,-0.173,-0.171,-0.169, - &-0.167,-0.165,-0.162,-0.160,-0.158,-0.156,-0.154,-0.151,-0.149, - &-0.147,-0.144,-0.142,-0.140,-0.137,-0.135,-0.132,-0.130,-0.127, - &-0.125,-0.122,-0.120,-0.117,-0.115,-0.112,-0.109,-0.107,-0.104, - &-0.101,-0.099,-0.096,-0.093,-0.091,-0.088,-0.085,-0.082,-0.079, - &-0.077,-0.074,-0.071,-0.068,-0.065,-0.063,-0.060,-0.057,-0.054, - &-0.051,-0.048,-0.046,-0.043,-0.040,-0.037,-0.034,-0.031,-0.028, - &-0.025,-0.023,-0.020,-0.017,-0.014,-0.011,-0.008,-0.005,-0.003, - & 0.000, 0.003, 0.006, 0.009, 0.012, 0.014, 0.017, 0.020, 0.023, - & 0.026, 0.029, 0.031, 0.034, 0.037, 0.040, 0.043, 0.045, 0.048, - & 0.051, 0.054, 0.057, 0.059, 0.062, 0.065, 0.068, 0.070, 0.073, - & 0.076, 0.079, 0.081, 0.084, 0.087, 0.089, 0.092, 0.095, 0.098, - & 0.100, 0.103, 0.106, 0.108, 0.111, 0.114, 0.116, 0.119, 0.122, - & 0.124, 0.127, 0.130, 0.132, 0.135, 0.137, 0.140, 0.143, 0.145, - & 0.148, 0.150, 0.153, 0.156, 0.158, 0.161, 0.163, 0.166, 0.168, - & 0.171, 0.174, 0.176, 0.179, 0.181, 0.184, 0.186, 0.189, 0.191, - & 0.194, 0.196, 0.199, 0.201, 0.204, 0.206, 0.209, 0.211, 0.214, - & 0.216, 0.219, 0.221, 0.223, 0.226, 0.228, 0.231, 0.233, 0.236, - & 0.238, 0.240, 0.243, 0.245, 0.248, 0.250, 0.252, 0.255, 0.257, - & 0.260, 0.262, 0.264, 0.267, 0.269, 0.271, 0.274, 0.276, 0.278, - & 0.281, 0.283, 0.285, 0.288, 0.290, 0.292, 0.295, 0.297, 0.299, - & 0.302, 0.304, 0.306, 0.308, 0.311, 0.313, 0.315, 0.317, 0.320, - & 0.322, 0.324, 0.326, 0.329, 0.331, 0.333, 0.335, 0.338, 0.340, - & 0.342, 0.344, 0.346, 0.349, 0.351, 0.353, 0.355, 0.357, 0.360, - & 0.362, 0.364, 0.366, 0.368, 0.371, 0.373, 0.375, 0.377, 0.379, - & 0.381, 0.383, 0.386, 0.388, 0.390, 0.392, 0.394, 0.396, 0.398, - & 0.400, 0.403, 0.405, 0.407, 0.409, 0.411, 0.413, 0.415, 0.417, - & 0.419, 0.421, 0.423, 0.426, 0.428, 0.430, 0.432, 0.434, 0.436, - & 0.438, 0.440, 0.442, 0.444, 0.446, 0.448, 0.450, 0.452, 0.454, - & 0.456, 0.458, 0.460, 0.462, 0.464, 0.466, 0.468, 0.470, 0.472, - & 0.474, 0.476, 0.478, 0.480, 0.482, 0.484, 0.486, 0.488, 0.490, - & 0.492, 0.494, 0.496, 0.498, 0.500, 0.502, 0.504, 0.506, 0.508, - & 0.510, 0.511, 0.513, 0.515, 0.517, 0.519, 0.521, 0.523, 0.525, - & 0.527, 0.529, 0.531, 0.533, 0.534, 0.536, 0.538, 0.540, 0.542, - & 0.544, 0.546, 0.548, 0.549, 0.551, 0.553, 0.555, 0.557, 0.559, - & 0.561, 0.563, 0.564, 0.566, 0.568, 0.570, 0.572, 0.574, 0.575, - & 0.577, 0.579, 0.581, 0.583, 0.585, 0.586, 0.588, 0.590, 0.592, - & 0.594, 0.595, 0.597, 0.599, 0.618, 0.636, 0.653, 0.670, 0.687, - & 0.704, 0.721, 0.737, 0.753, 0.769, 0.784, 0.800, 0.815, 0.830, - & 0.845, 0.860, 0.875, 0.889, 0.904, 0.918, 0.932, 0.946, 0.959, - & 0.973, 0.986, 1.000, 1.013, 1.026, 1.039, 1.052, 1.065, 1.077, - & 1.090, 1.102, 1.114, 1.126, 1.138, 1.150, 1.162, 1.174, 1.186, - & 1.197, 1.209, 1.220, 1.231, 1.242, 1.254, 1.265, 1.276, 1.286, - & 1.297, 1.308, 1.318, 1.329, 1.339, 1.350, 1.360, 1.370, 1.381, - & 1.391, 1.401, 1.411, 1.421, 1.430, 1.440, 1.450, 1.459, 1.469, - & 1.479, 1.488, 1.497, 1.507, 1.516, 1.525, 1.534, 1.544, 1.553, - & 1.562, 1.571, 1.579, 1.588, 1.597, 1.606, 1.615, 1.623, 1.632, - & 1.640, 1.649, 1.657, 1.666, 1.674, 1.683, 1.691, 1.699, 1.707, - & 1.715, 1.724, 1.732, 1.740, 1.748, 1.756, 1.764, 1.771, 1.779, - & 1.787, 1.795, 1.803, 1.810, 1.818, 1.826, 1.833, 1.841, 1.848, - & 1.856, 1.863, 1.871, 1.878, 1.885, 1.893, 1.900, 1.907, 1.915, - & 1.922, 1.929, 1.936, 1.943, 1.950, 1.957, 1.964, 1.971, 1.978, - & 1.985, 1.992, 1.999, 2.006, 2.013, 2.019, 2.026, 2.033, 2.040, - & 2.046, 2.053, 2.060, 2.066, 2.073, 2.079, 2.086, 2.093, 2.099, - & 2.105, 2.112, 2.118, 2.125, 2.131, 2.138, 2.144, 2.150, 2.156, - & 2.163, 2.169, 2.175 - & / -C -C *** (H,NO3) -C - DATA BNC10M/ - &-0.044,-0.092,-0.113,-0.127,-0.137,-0.145,-0.151,-0.156,-0.160, - &-0.163,-0.165,-0.167,-0.169,-0.170,-0.171,-0.172,-0.172,-0.172, - &-0.172,-0.172,-0.172,-0.172,-0.171,-0.171,-0.170,-0.169,-0.168, - &-0.167,-0.166,-0.165,-0.164,-0.163,-0.162,-0.160,-0.159,-0.158, - &-0.156,-0.155,-0.153,-0.152,-0.151,-0.149,-0.147,-0.146,-0.144, - &-0.143,-0.141,-0.140,-0.138,-0.136,-0.135,-0.133,-0.131,-0.130, - &-0.128,-0.126,-0.125,-0.123,-0.121,-0.120,-0.118,-0.116,-0.114, - &-0.113,-0.111,-0.109,-0.107,-0.106,-0.104,-0.102,-0.100,-0.099, - &-0.097,-0.095,-0.093,-0.091,-0.089,-0.088,-0.086,-0.084,-0.082, - &-0.080,-0.078,-0.076,-0.074,-0.072,-0.070,-0.068,-0.066,-0.064, - &-0.062,-0.060,-0.058,-0.056,-0.054,-0.052,-0.050,-0.048,-0.045, - &-0.043,-0.041,-0.039,-0.037,-0.035,-0.032,-0.030,-0.028,-0.026, - &-0.024,-0.021,-0.019,-0.017,-0.015,-0.012,-0.010,-0.008,-0.006, - &-0.003,-0.001, 0.001, 0.004, 0.006, 0.008, 0.010, 0.013, 0.015, - & 0.017, 0.020, 0.022, 0.024, 0.027, 0.029, 0.031, 0.033, 0.036, - & 0.038, 0.040, 0.043, 0.045, 0.047, 0.049, 0.052, 0.054, 0.056, - & 0.059, 0.061, 0.063, 0.066, 0.068, 0.070, 0.072, 0.075, 0.077, - & 0.079, 0.081, 0.084, 0.086, 0.088, 0.091, 0.093, 0.095, 0.097, - & 0.100, 0.102, 0.104, 0.106, 0.109, 0.111, 0.113, 0.115, 0.118, - & 0.120, 0.122, 0.124, 0.127, 0.129, 0.131, 0.133, 0.135, 0.138, - & 0.140, 0.142, 0.144, 0.147, 0.149, 0.151, 0.153, 0.155, 0.158, - & 0.160, 0.162, 0.164, 0.166, 0.169, 0.171, 0.173, 0.175, 0.177, - & 0.179, 0.182, 0.184, 0.186, 0.188, 0.190, 0.192, 0.195, 0.197, - & 0.199, 0.201, 0.203, 0.205, 0.207, 0.210, 0.212, 0.214, 0.216, - & 0.218, 0.220, 0.222, 0.224, 0.227, 0.229, 0.231, 0.233, 0.235, - & 0.237, 0.239, 0.241, 0.243, 0.245, 0.248, 0.250, 0.252, 0.254, - & 0.256, 0.258, 0.260, 0.262, 0.264, 0.266, 0.268, 0.270, 0.272, - & 0.274, 0.276, 0.278, 0.281, 0.283, 0.285, 0.287, 0.289, 0.291, - & 0.293, 0.295, 0.297, 0.299, 0.301, 0.303, 0.305, 0.307, 0.309, - & 0.311, 0.313, 0.315, 0.317, 0.319, 0.321, 0.323, 0.325, 0.327, - & 0.329, 0.331, 0.333, 0.335, 0.337, 0.339, 0.341, 0.343, 0.344, - & 0.346, 0.348, 0.350, 0.352, 0.354, 0.356, 0.358, 0.360, 0.362, - & 0.364, 0.366, 0.368, 0.370, 0.372, 0.373, 0.375, 0.377, 0.379, - & 0.381, 0.383, 0.385, 0.387, 0.389, 0.391, 0.393, 0.394, 0.396, - & 0.398, 0.400, 0.402, 0.404, 0.406, 0.408, 0.409, 0.411, 0.413, - & 0.415, 0.417, 0.419, 0.421, 0.422, 0.424, 0.426, 0.428, 0.430, - & 0.432, 0.433, 0.435, 0.437, 0.439, 0.441, 0.443, 0.444, 0.446, - & 0.448, 0.450, 0.452, 0.454, 0.455, 0.457, 0.459, 0.461, 0.463, - & 0.464, 0.466, 0.468, 0.470, 0.471, 0.473, 0.475, 0.477, 0.479, - & 0.480, 0.482, 0.484, 0.486, 0.487, 0.489, 0.491, 0.493, 0.494, - & 0.496, 0.498, 0.500, 0.501, 0.503, 0.505, 0.507, 0.508, 0.510, - & 0.512, 0.514, 0.515, 0.517, 0.519, 0.521, 0.522, 0.524, 0.526, - & 0.527, 0.529, 0.531, 0.533, 0.534, 0.536, 0.538, 0.539, 0.541, - & 0.543, 0.544, 0.546, 0.548, 0.549, 0.551, 0.553, 0.554, 0.556, - & 0.558, 0.560, 0.561, 0.563, 0.581, 0.597, 0.613, 0.629, 0.645, - & 0.660, 0.676, 0.691, 0.706, 0.721, 0.736, 0.750, 0.765, 0.779, - & 0.793, 0.807, 0.820, 0.834, 0.848, 0.861, 0.874, 0.887, 0.900, - & 0.913, 0.926, 0.938, 0.951, 0.963, 0.975, 0.987, 0.999, 1.011, - & 1.023, 1.035, 1.046, 1.058, 1.069, 1.081, 1.092, 1.103, 1.114, - & 1.125, 1.136, 1.147, 1.157, 1.168, 1.178, 1.189, 1.199, 1.210, - & 1.220, 1.230, 1.240, 1.250, 1.260, 1.270, 1.279, 1.289, 1.299, - & 1.308, 1.318, 1.327, 1.337, 1.346, 1.355, 1.365, 1.374, 1.383, - & 1.392, 1.401, 1.410, 1.419, 1.427, 1.436, 1.445, 1.454, 1.462, - & 1.471, 1.479, 1.488, 1.496, 1.504, 1.513, 1.521, 1.529, 1.537, - & 1.546, 1.554, 1.562, 1.570, 1.578, 1.586, 1.593, 1.601, 1.609, - & 1.617, 1.624, 1.632, 1.640, 1.647, 1.655, 1.662, 1.670, 1.677, - & 1.685, 1.692, 1.700, 1.707, 1.714, 1.721, 1.729, 1.736, 1.743, - & 1.750, 1.757, 1.764, 1.771, 1.778, 1.785, 1.792, 1.799, 1.806, - & 1.813, 1.820, 1.826, 1.833, 1.840, 1.847, 1.853, 1.860, 1.866, - & 1.873, 1.880, 1.886, 1.893, 1.899, 1.906, 1.912, 1.918, 1.925, - & 1.931, 1.938, 1.944, 1.950, 1.956, 1.963, 1.969, 1.975, 1.981, - & 1.987, 1.994, 2.000, 2.006, 2.012, 2.018, 2.024, 2.030, 2.036, - & 2.042, 2.048, 2.054 - & / -C -C *** (H,Cl) -C - DATA BNC11M/ - &-0.043,-0.087,-0.106,-0.117,-0.124,-0.130,-0.133,-0.135,-0.137, - &-0.138,-0.138,-0.137,-0.136,-0.135,-0.134,-0.132,-0.130,-0.127, - &-0.125,-0.122,-0.119,-0.116,-0.113,-0.110,-0.107,-0.103,-0.099, - &-0.096,-0.092,-0.088,-0.084,-0.080,-0.076,-0.071,-0.067,-0.063, - &-0.058,-0.054,-0.049,-0.045,-0.040,-0.036,-0.031,-0.027,-0.022, - &-0.017,-0.012,-0.008,-0.003, 0.002, 0.007, 0.012, 0.017, 0.022, - & 0.027, 0.031, 0.036, 0.041, 0.046, 0.051, 0.056, 0.061, 0.066, - & 0.071, 0.077, 0.082, 0.087, 0.092, 0.097, 0.102, 0.107, 0.113, - & 0.118, 0.123, 0.128, 0.134, 0.139, 0.144, 0.149, 0.155, 0.160, - & 0.166, 0.171, 0.177, 0.182, 0.188, 0.193, 0.199, 0.204, 0.210, - & 0.216, 0.221, 0.227, 0.233, 0.239, 0.244, 0.250, 0.256, 0.262, - & 0.268, 0.274, 0.280, 0.286, 0.292, 0.298, 0.304, 0.310, 0.316, - & 0.322, 0.328, 0.334, 0.340, 0.346, 0.352, 0.358, 0.364, 0.370, - & 0.377, 0.383, 0.389, 0.395, 0.401, 0.407, 0.413, 0.420, 0.426, - & 0.432, 0.438, 0.444, 0.450, 0.457, 0.463, 0.469, 0.475, 0.481, - & 0.487, 0.493, 0.499, 0.505, 0.512, 0.518, 0.524, 0.530, 0.536, - & 0.542, 0.548, 0.554, 0.560, 0.566, 0.572, 0.578, 0.584, 0.590, - & 0.596, 0.602, 0.608, 0.614, 0.620, 0.626, 0.632, 0.638, 0.643, - & 0.649, 0.655, 0.661, 0.667, 0.673, 0.679, 0.684, 0.690, 0.696, - & 0.702, 0.708, 0.713, 0.719, 0.725, 0.731, 0.737, 0.742, 0.748, - & 0.754, 0.759, 0.765, 0.771, 0.776, 0.782, 0.788, 0.793, 0.799, - & 0.805, 0.810, 0.816, 0.821, 0.827, 0.833, 0.838, 0.844, 0.849, - & 0.855, 0.860, 0.866, 0.871, 0.877, 0.882, 0.888, 0.893, 0.899, - & 0.904, 0.909, 0.915, 0.920, 0.926, 0.931, 0.936, 0.942, 0.947, - & 0.953, 0.958, 0.963, 0.969, 0.974, 0.979, 0.984, 0.990, 0.995, - & 1.000, 1.005, 1.011, 1.016, 1.021, 1.026, 1.032, 1.037, 1.042, - & 1.047, 1.052, 1.057, 1.062, 1.068, 1.073, 1.078, 1.083, 1.088, - & 1.093, 1.098, 1.103, 1.108, 1.113, 1.118, 1.123, 1.128, 1.133, - & 1.138, 1.143, 1.148, 1.153, 1.158, 1.163, 1.168, 1.173, 1.178, - & 1.183, 1.188, 1.193, 1.198, 1.202, 1.207, 1.212, 1.217, 1.222, - & 1.227, 1.232, 1.236, 1.241, 1.246, 1.251, 1.256, 1.260, 1.265, - & 1.270, 1.275, 1.279, 1.284, 1.289, 1.293, 1.298, 1.303, 1.307, - & 1.312, 1.317, 1.321, 1.326, 1.331, 1.335, 1.340, 1.345, 1.349, - & 1.354, 1.358, 1.363, 1.368, 1.372, 1.377, 1.381, 1.386, 1.390, - & 1.395, 1.399, 1.404, 1.408, 1.413, 1.417, 1.422, 1.426, 1.431, - & 1.435, 1.440, 1.444, 1.449, 1.453, 1.457, 1.462, 1.466, 1.471, - & 1.475, 1.479, 1.484, 1.488, 1.492, 1.497, 1.501, 1.506, 1.510, - & 1.514, 1.518, 1.523, 1.527, 1.531, 1.536, 1.540, 1.544, 1.548, - & 1.553, 1.557, 1.561, 1.565, 1.570, 1.574, 1.578, 1.582, 1.587, - & 1.591, 1.595, 1.599, 1.603, 1.607, 1.612, 1.616, 1.620, 1.624, - & 1.628, 1.632, 1.636, 1.640, 1.645, 1.649, 1.653, 1.657, 1.661, - & 1.665, 1.669, 1.673, 1.677, 1.681, 1.685, 1.689, 1.693, 1.697, - & 1.701, 1.705, 1.709, 1.713, 1.717, 1.721, 1.725, 1.729, 1.733, - & 1.737, 1.741, 1.745, 1.749, 1.753, 1.757, 1.761, 1.765, 1.769, - & 1.772, 1.776, 1.780, 1.784, 1.826, 1.864, 1.901, 1.938, 1.974, - & 2.010, 2.045, 2.080, 2.114, 2.148, 2.181, 2.214, 2.246, 2.278, - & 2.310, 2.341, 2.372, 2.403, 2.433, 2.463, 2.492, 2.522, 2.550, - & 2.579, 2.607, 2.635, 2.663, 2.690, 2.717, 2.744, 2.770, 2.796, - & 2.822, 2.848, 2.873, 2.898, 2.923, 2.948, 2.972, 2.996, 3.020, - & 3.044, 3.068, 3.091, 3.114, 3.137, 3.160, 3.182, 3.205, 3.227, - & 3.249, 3.271, 3.292, 3.314, 3.335, 3.356, 3.377, 3.398, 3.418, - & 3.439, 3.459, 3.479, 3.499, 3.519, 3.539, 3.558, 3.578, 3.597, - & 3.616, 3.635, 3.654, 3.673, 3.691, 3.710, 3.728, 3.746, 3.765, - & 3.783, 3.800, 3.818, 3.836, 3.853, 3.871, 3.888, 3.905, 3.922, - & 3.939, 3.956, 3.973, 3.990, 4.006, 4.023, 4.039, 4.055, 4.071, - & 4.088, 4.104, 4.119, 4.135, 4.151, 4.167, 4.182, 4.198, 4.213, - & 4.228, 4.243, 4.259, 4.274, 4.289, 4.304, 4.318, 4.333, 4.348, - & 4.362, 4.377, 4.391, 4.406, 4.420, 4.434, 4.448, 4.462, 4.476, - & 4.490, 4.504, 4.518, 4.532, 4.545, 4.559, 4.572, 4.586, 4.599, - & 4.613, 4.626, 4.639, 4.652, 4.665, 4.678, 4.691, 4.704, 4.717, - & 4.730, 4.743, 4.756, 4.768, 4.781, 4.793, 4.806, 4.818, 4.831, - & 4.843, 4.855, 4.867, 4.880, 4.892, 4.904, 4.916, 4.928, 4.940, - & 4.952, 4.964, 4.975 - & / -C -C *** NaHSO4 -C - DATA BNC12M/ - &-0.044,-0.092,-0.113,-0.127,-0.138,-0.146,-0.152,-0.157,-0.162, - &-0.165,-0.168,-0.170,-0.172,-0.174,-0.175,-0.176,-0.176,-0.177, - &-0.177,-0.177,-0.176,-0.176,-0.176,-0.175,-0.174,-0.173,-0.172, - &-0.171,-0.169,-0.168,-0.167,-0.165,-0.163,-0.161,-0.160,-0.158, - &-0.156,-0.154,-0.151,-0.149,-0.147,-0.145,-0.142,-0.140,-0.137, - &-0.135,-0.132,-0.130,-0.127,-0.124,-0.122,-0.119,-0.116,-0.113, - &-0.110,-0.107,-0.104,-0.101,-0.098,-0.095,-0.092,-0.089,-0.086, - &-0.083,-0.080,-0.076,-0.073,-0.070,-0.067,-0.063,-0.060,-0.057, - &-0.053,-0.050,-0.046,-0.043,-0.039,-0.036,-0.032,-0.029,-0.025, - &-0.021,-0.018,-0.014,-0.010,-0.007,-0.003, 0.001, 0.005, 0.009, - & 0.012, 0.016, 0.020, 0.024, 0.028, 0.032, 0.036, 0.040, 0.044, - & 0.048, 0.052, 0.056, 0.060, 0.064, 0.068, 0.073, 0.077, 0.081, - & 0.085, 0.089, 0.093, 0.098, 0.102, 0.106, 0.110, 0.115, 0.119, - & 0.123, 0.127, 0.131, 0.136, 0.140, 0.144, 0.148, 0.153, 0.157, - & 0.161, 0.165, 0.170, 0.174, 0.178, 0.182, 0.187, 0.191, 0.195, - & 0.199, 0.204, 0.208, 0.212, 0.216, 0.220, 0.225, 0.229, 0.233, - & 0.237, 0.241, 0.245, 0.250, 0.254, 0.258, 0.262, 0.266, 0.270, - & 0.274, 0.279, 0.283, 0.287, 0.291, 0.295, 0.299, 0.303, 0.307, - & 0.311, 0.315, 0.319, 0.323, 0.327, 0.331, 0.335, 0.339, 0.343, - & 0.347, 0.351, 0.355, 0.359, 0.363, 0.367, 0.371, 0.375, 0.379, - & 0.383, 0.387, 0.391, 0.395, 0.399, 0.402, 0.406, 0.410, 0.414, - & 0.418, 0.422, 0.426, 0.429, 0.433, 0.437, 0.441, 0.445, 0.449, - & 0.452, 0.456, 0.460, 0.464, 0.467, 0.471, 0.475, 0.479, 0.482, - & 0.486, 0.490, 0.494, 0.497, 0.501, 0.505, 0.508, 0.512, 0.516, - & 0.519, 0.523, 0.527, 0.530, 0.534, 0.538, 0.541, 0.545, 0.548, - & 0.552, 0.556, 0.559, 0.563, 0.566, 0.570, 0.573, 0.577, 0.581, - & 0.584, 0.588, 0.591, 0.595, 0.598, 0.602, 0.605, 0.609, 0.612, - & 0.616, 0.619, 0.623, 0.626, 0.630, 0.633, 0.636, 0.640, 0.643, - & 0.647, 0.650, 0.654, 0.657, 0.660, 0.664, 0.667, 0.671, 0.674, - & 0.677, 0.681, 0.684, 0.687, 0.691, 0.694, 0.697, 0.701, 0.704, - & 0.707, 0.711, 0.714, 0.717, 0.721, 0.724, 0.727, 0.730, 0.734, - & 0.737, 0.740, 0.743, 0.747, 0.750, 0.753, 0.756, 0.760, 0.763, - & 0.766, 0.769, 0.773, 0.776, 0.779, 0.782, 0.785, 0.788, 0.792, - & 0.795, 0.798, 0.801, 0.804, 0.807, 0.811, 0.814, 0.817, 0.820, - & 0.823, 0.826, 0.829, 0.832, 0.835, 0.839, 0.842, 0.845, 0.848, - & 0.851, 0.854, 0.857, 0.860, 0.863, 0.866, 0.869, 0.872, 0.875, - & 0.878, 0.881, 0.884, 0.887, 0.890, 0.893, 0.896, 0.899, 0.902, - & 0.905, 0.908, 0.911, 0.914, 0.917, 0.920, 0.923, 0.926, 0.929, - & 0.932, 0.935, 0.938, 0.941, 0.944, 0.947, 0.949, 0.952, 0.955, - & 0.958, 0.961, 0.964, 0.967, 0.970, 0.973, 0.975, 0.978, 0.981, - & 0.984, 0.987, 0.990, 0.993, 0.995, 0.998, 1.001, 1.004, 1.007, - & 1.010, 1.012, 1.015, 1.018, 1.021, 1.024, 1.026, 1.029, 1.032, - & 1.035, 1.038, 1.040, 1.043, 1.046, 1.049, 1.051, 1.054, 1.057, - & 1.060, 1.062, 1.065, 1.068, 1.071, 1.073, 1.076, 1.079, 1.082, - & 1.084, 1.087, 1.090, 1.092, 1.121, 1.148, 1.174, 1.199, 1.225, - & 1.250, 1.274, 1.299, 1.323, 1.346, 1.370, 1.393, 1.416, 1.438, - & 1.461, 1.483, 1.504, 1.526, 1.547, 1.568, 1.589, 1.610, 1.630, - & 1.650, 1.670, 1.690, 1.710, 1.729, 1.748, 1.767, 1.786, 1.805, - & 1.823, 1.841, 1.860, 1.878, 1.895, 1.913, 1.930, 1.948, 1.965, - & 1.982, 1.999, 2.015, 2.032, 2.048, 2.065, 2.081, 2.097, 2.113, - & 2.129, 2.144, 2.160, 2.175, 2.191, 2.206, 2.221, 2.236, 2.251, - & 2.265, 2.280, 2.294, 2.309, 2.323, 2.337, 2.352, 2.366, 2.379, - & 2.393, 2.407, 2.421, 2.434, 2.448, 2.461, 2.474, 2.488, 2.501, - & 2.514, 2.527, 2.540, 2.552, 2.565, 2.578, 2.590, 2.603, 2.615, - & 2.628, 2.640, 2.652, 2.664, 2.676, 2.688, 2.700, 2.712, 2.724, - & 2.735, 2.747, 2.759, 2.770, 2.782, 2.793, 2.805, 2.816, 2.827, - & 2.838, 2.849, 2.860, 2.871, 2.882, 2.893, 2.904, 2.915, 2.926, - & 2.936, 2.947, 2.957, 2.968, 2.978, 2.989, 2.999, 3.010, 3.020, - & 3.030, 3.040, 3.050, 3.060, 3.070, 3.080, 3.090, 3.100, 3.110, - & 3.120, 3.130, 3.139, 3.149, 3.159, 3.168, 3.178, 3.188, 3.197, - & 3.206, 3.216, 3.225, 3.235, 3.244, 3.253, 3.262, 3.272, 3.281, - & 3.290, 3.299, 3.308, 3.317, 3.326, 3.335, 3.344, 3.353, 3.361, - & 3.370, 3.379, 3.388 - & / -C -C *** (NH4)3H(SO4)2 -C - DATA BNC13M/ - &-0.072,-0.156,-0.197,-0.226,-0.248,-0.266,-0.282,-0.295,-0.307, - &-0.317,-0.327,-0.336,-0.344,-0.351,-0.358,-0.364,-0.370,-0.375, - &-0.380,-0.385,-0.390,-0.394,-0.398,-0.402,-0.406,-0.409,-0.412, - &-0.415,-0.418,-0.421,-0.424,-0.426,-0.429,-0.431,-0.433,-0.435, - &-0.437,-0.439,-0.441,-0.442,-0.444,-0.446,-0.447,-0.449,-0.450, - &-0.451,-0.452,-0.453,-0.454,-0.456,-0.456,-0.457,-0.458,-0.459, - &-0.460,-0.461,-0.461,-0.462,-0.462,-0.463,-0.463,-0.464,-0.464, - &-0.465,-0.465,-0.465,-0.466,-0.466,-0.466,-0.467,-0.467,-0.467, - &-0.467,-0.467,-0.467,-0.467,-0.467,-0.467,-0.467,-0.467,-0.467, - &-0.467,-0.467,-0.467,-0.467,-0.467,-0.466,-0.466,-0.466,-0.466, - &-0.466,-0.465,-0.465,-0.465,-0.464,-0.464,-0.464,-0.463,-0.463, - &-0.463,-0.462,-0.462,-0.461,-0.461,-0.460,-0.460,-0.459,-0.459, - &-0.458,-0.458,-0.457,-0.457,-0.456,-0.456,-0.455,-0.455,-0.454, - &-0.454,-0.453,-0.452,-0.452,-0.451,-0.451,-0.450,-0.449,-0.449, - &-0.448,-0.447,-0.447,-0.446,-0.445,-0.445,-0.444,-0.443,-0.443, - &-0.442,-0.441,-0.441,-0.440,-0.439,-0.439,-0.438,-0.437,-0.437, - &-0.436,-0.435,-0.434,-0.434,-0.433,-0.432,-0.432,-0.431,-0.430, - &-0.429,-0.429,-0.428,-0.427,-0.427,-0.426,-0.425,-0.424,-0.424, - &-0.423,-0.422,-0.421,-0.421,-0.420,-0.419,-0.418,-0.418,-0.417, - &-0.416,-0.415,-0.415,-0.414,-0.413,-0.412,-0.412,-0.411,-0.410, - &-0.409,-0.409,-0.408,-0.407,-0.406,-0.406,-0.405,-0.404,-0.403, - &-0.403,-0.402,-0.401,-0.400,-0.400,-0.399,-0.398,-0.397,-0.397, - &-0.396,-0.395,-0.394,-0.394,-0.393,-0.392,-0.391,-0.391,-0.390, - &-0.389,-0.388,-0.388,-0.387,-0.386,-0.385,-0.385,-0.384,-0.383, - &-0.382,-0.381,-0.381,-0.380,-0.379,-0.378,-0.378,-0.377,-0.376, - &-0.375,-0.375,-0.374,-0.373,-0.372,-0.372,-0.371,-0.370,-0.369, - &-0.369,-0.368,-0.367,-0.366,-0.366,-0.365,-0.364,-0.363,-0.363, - &-0.362,-0.361,-0.360,-0.360,-0.359,-0.358,-0.357,-0.357,-0.356, - &-0.355,-0.354,-0.354,-0.353,-0.352,-0.351,-0.351,-0.350,-0.349, - &-0.348,-0.348,-0.347,-0.346,-0.345,-0.345,-0.344,-0.343,-0.342, - &-0.342,-0.341,-0.340,-0.339,-0.339,-0.338,-0.337,-0.336,-0.336, - &-0.335,-0.334,-0.333,-0.333,-0.332,-0.331,-0.331,-0.330,-0.329, - &-0.328,-0.328,-0.327,-0.326,-0.325,-0.325,-0.324,-0.323,-0.322, - &-0.322,-0.321,-0.320,-0.320,-0.319,-0.318,-0.317,-0.317,-0.316, - &-0.315,-0.314,-0.314,-0.313,-0.312,-0.312,-0.311,-0.310,-0.309, - &-0.309,-0.308,-0.307,-0.306,-0.306,-0.305,-0.304,-0.304,-0.303, - &-0.302,-0.301,-0.301,-0.300,-0.299,-0.299,-0.298,-0.297,-0.296, - &-0.296,-0.295,-0.294,-0.294,-0.293,-0.292,-0.291,-0.291,-0.290, - &-0.289,-0.289,-0.288,-0.287,-0.286,-0.286,-0.285,-0.284,-0.284, - &-0.283,-0.282,-0.281,-0.281,-0.280,-0.279,-0.279,-0.278,-0.277, - &-0.277,-0.276,-0.275,-0.274,-0.274,-0.273,-0.272,-0.272,-0.271, - &-0.270,-0.270,-0.269,-0.268,-0.267,-0.267,-0.266,-0.265,-0.265, - &-0.264,-0.263,-0.263,-0.262,-0.261,-0.261,-0.260,-0.259,-0.258, - &-0.258,-0.257,-0.256,-0.256,-0.255,-0.254,-0.254,-0.253,-0.252, - &-0.252,-0.251,-0.250,-0.250,-0.242,-0.235,-0.229,-0.222,-0.215, - &-0.209,-0.202,-0.196,-0.189,-0.183,-0.176,-0.170,-0.164,-0.157, - &-0.151,-0.145,-0.139,-0.133,-0.127,-0.121,-0.115,-0.109,-0.103, - &-0.097,-0.091,-0.085,-0.079,-0.073,-0.067,-0.062,-0.056,-0.050, - &-0.045,-0.039,-0.033,-0.028,-0.022,-0.017,-0.011,-0.006, 0.000, - & 0.005, 0.010, 0.016, 0.021, 0.026, 0.032, 0.037, 0.042, 0.048, - & 0.053, 0.058, 0.063, 0.068, 0.073, 0.079, 0.084, 0.089, 0.094, - & 0.099, 0.104, 0.109, 0.114, 0.119, 0.124, 0.129, 0.134, 0.138, - & 0.143, 0.148, 0.153, 0.158, 0.163, 0.167, 0.172, 0.177, 0.182, - & 0.186, 0.191, 0.196, 0.201, 0.205, 0.210, 0.215, 0.219, 0.224, - & 0.228, 0.233, 0.238, 0.242, 0.247, 0.251, 0.256, 0.260, 0.265, - & 0.269, 0.274, 0.278, 0.283, 0.287, 0.291, 0.296, 0.300, 0.305, - & 0.309, 0.313, 0.318, 0.322, 0.326, 0.331, 0.335, 0.339, 0.344, - & 0.348, 0.352, 0.357, 0.361, 0.365, 0.369, 0.374, 0.378, 0.382, - & 0.386, 0.390, 0.395, 0.399, 0.403, 0.407, 0.411, 0.415, 0.419, - & 0.424, 0.428, 0.432, 0.436, 0.440, 0.444, 0.448, 0.452, 0.456, - & 0.460, 0.464, 0.468, 0.472, 0.476, 0.480, 0.484, 0.488, 0.492, - & 0.496, 0.500, 0.504, 0.508, 0.512, 0.516, 0.520, 0.524, 0.528, - & 0.532, 0.536, 0.540 - & / -C -C *** CASO4 -C - DATA BNC14M/ - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, - & 0.000, 0.000, 0.000 - & / -C -C *** CANO32 -C - DATA BNC15M/ - &-0.090,-0.191,-0.239,-0.271,-0.296,-0.316,-0.332,-0.346,-0.358, - &-0.368,-0.378,-0.386,-0.393,-0.400,-0.405,-0.411,-0.416,-0.420, - &-0.424,-0.428,-0.431,-0.434,-0.437,-0.440,-0.442,-0.444,-0.446, - &-0.448,-0.450,-0.451,-0.453,-0.454,-0.455,-0.456,-0.457,-0.458, - &-0.459,-0.460,-0.460,-0.461,-0.461,-0.462,-0.462,-0.463,-0.463, - &-0.463,-0.463,-0.463,-0.464,-0.464,-0.464,-0.464,-0.464,-0.464, - &-0.464,-0.463,-0.463,-0.463,-0.463,-0.463,-0.462,-0.462,-0.462, - &-0.462,-0.461,-0.461,-0.460,-0.460,-0.460,-0.459,-0.459,-0.458, - &-0.458,-0.457,-0.457,-0.456,-0.455,-0.455,-0.454,-0.454,-0.453, - &-0.452,-0.451,-0.451,-0.450,-0.449,-0.448,-0.448,-0.447,-0.446, - &-0.445,-0.444,-0.443,-0.442,-0.441,-0.440,-0.439,-0.439,-0.438, - &-0.437,-0.435,-0.434,-0.433,-0.432,-0.431,-0.430,-0.429,-0.428, - &-0.427,-0.426,-0.425,-0.423,-0.422,-0.421,-0.420,-0.419,-0.417, - &-0.416,-0.415,-0.414,-0.413,-0.411,-0.410,-0.409,-0.408,-0.406, - &-0.405,-0.404,-0.403,-0.401,-0.400,-0.399,-0.398,-0.396,-0.395, - &-0.394,-0.392,-0.391,-0.390,-0.388,-0.387,-0.386,-0.385,-0.383, - &-0.382,-0.381,-0.379,-0.378,-0.377,-0.375,-0.374,-0.373,-0.371, - &-0.370,-0.369,-0.367,-0.366,-0.365,-0.363,-0.362,-0.361,-0.359, - &-0.358,-0.357,-0.355,-0.354,-0.353,-0.351,-0.350,-0.349,-0.347, - &-0.346,-0.345,-0.343,-0.342,-0.341,-0.339,-0.338,-0.337,-0.335, - &-0.334,-0.333,-0.331,-0.330,-0.328,-0.327,-0.326,-0.324,-0.323, - &-0.322,-0.320,-0.319,-0.318,-0.316,-0.315,-0.314,-0.312,-0.311, - &-0.310,-0.308,-0.307,-0.306,-0.304,-0.303,-0.301,-0.300,-0.299, - &-0.297,-0.296,-0.295,-0.293,-0.292,-0.291,-0.289,-0.288,-0.287, - &-0.285,-0.284,-0.283,-0.281,-0.280,-0.279,-0.277,-0.276,-0.275, - &-0.273,-0.272,-0.271,-0.269,-0.268,-0.267,-0.265,-0.264,-0.263, - &-0.261,-0.260,-0.259,-0.257,-0.256,-0.255,-0.253,-0.252,-0.251, - &-0.249,-0.248,-0.247,-0.245,-0.244,-0.243,-0.241,-0.240,-0.239, - &-0.237,-0.236,-0.235,-0.233,-0.232,-0.231,-0.230,-0.228,-0.227, - &-0.226,-0.224,-0.223,-0.222,-0.220,-0.219,-0.218,-0.216,-0.215, - &-0.214,-0.213,-0.211,-0.210,-0.209,-0.207,-0.206,-0.205,-0.203, - &-0.202,-0.201,-0.200,-0.198,-0.197,-0.196,-0.194,-0.193,-0.192, - &-0.191,-0.189,-0.188,-0.187,-0.185,-0.184,-0.183,-0.182,-0.180, - &-0.179,-0.178,-0.176,-0.175,-0.174,-0.173,-0.171,-0.170,-0.169, - &-0.167,-0.166,-0.165,-0.164,-0.162,-0.161,-0.160,-0.159,-0.157, - &-0.156,-0.155,-0.154,-0.152,-0.151,-0.150,-0.149,-0.147,-0.146, - &-0.145,-0.144,-0.142,-0.141,-0.140,-0.139,-0.137,-0.136,-0.135, - &-0.134,-0.132,-0.131,-0.130,-0.129,-0.127,-0.126,-0.125,-0.124, - &-0.122,-0.121,-0.120,-0.119,-0.117,-0.116,-0.115,-0.114,-0.113, - &-0.111,-0.110,-0.109,-0.108,-0.106,-0.105,-0.104,-0.103,-0.102, - &-0.100,-0.099,-0.098,-0.097,-0.095,-0.094,-0.093,-0.092,-0.091, - &-0.089,-0.088,-0.087,-0.086,-0.085,-0.083,-0.082,-0.081,-0.080, - &-0.079,-0.077,-0.076,-0.075,-0.074,-0.073,-0.071,-0.070,-0.069, - &-0.068,-0.067,-0.065,-0.064,-0.063,-0.062,-0.061,-0.059,-0.058, - &-0.057,-0.056,-0.055,-0.054,-0.041,-0.029,-0.018,-0.006, 0.005, - & 0.017, 0.028, 0.039, 0.050, 0.061, 0.072, 0.083, 0.094, 0.104, - & 0.115, 0.125, 0.136, 0.146, 0.156, 0.167, 0.177, 0.187, 0.197, - & 0.207, 0.217, 0.227, 0.236, 0.246, 0.256, 0.265, 0.275, 0.284, - & 0.294, 0.303, 0.312, 0.322, 0.331, 0.340, 0.349, 0.358, 0.367, - & 0.376, 0.385, 0.394, 0.403, 0.411, 0.420, 0.429, 0.437, 0.446, - & 0.455, 0.463, 0.472, 0.480, 0.488, 0.497, 0.505, 0.513, 0.521, - & 0.530, 0.538, 0.546, 0.554, 0.562, 0.570, 0.578, 0.586, 0.594, - & 0.602, 0.610, 0.617, 0.625, 0.633, 0.641, 0.648, 0.656, 0.664, - & 0.671, 0.679, 0.686, 0.694, 0.701, 0.709, 0.716, 0.723, 0.731, - & 0.738, 0.745, 0.753, 0.760, 0.767, 0.774, 0.782, 0.789, 0.796, - & 0.803, 0.810, 0.817, 0.824, 0.831, 0.838, 0.845, 0.852, 0.859, - & 0.866, 0.873, 0.880, 0.886, 0.893, 0.900, 0.907, 0.914, 0.920, - & 0.927, 0.934, 0.940, 0.947, 0.954, 0.960, 0.967, 0.973, 0.980, - & 0.987, 0.993, 1.000, 1.006, 1.013, 1.019, 1.025, 1.032, 1.038, - & 1.045, 1.051, 1.057, 1.064, 1.070, 1.076, 1.083, 1.089, 1.095, - & 1.101, 1.108, 1.114, 1.120, 1.126, 1.132, 1.139, 1.145, 1.151, - & 1.157, 1.163, 1.169, 1.175, 1.181, 1.187, 1.193, 1.199, 1.205, - & 1.211, 1.217, 1.223 - & / -C -C *** CACL2 -C - DATA BNC16M/ - &-0.088,-0.184,-0.228,-0.256,-0.277,-0.293,-0.305,-0.315,-0.323, - &-0.330,-0.335,-0.340,-0.343,-0.346,-0.349,-0.350,-0.352,-0.353, - &-0.353,-0.353,-0.353,-0.353,-0.352,-0.352,-0.351,-0.349,-0.348, - &-0.347,-0.345,-0.343,-0.341,-0.339,-0.337,-0.335,-0.333,-0.331, - &-0.328,-0.326,-0.324,-0.321,-0.318,-0.316,-0.313,-0.311,-0.308, - &-0.305,-0.302,-0.299,-0.297,-0.294,-0.291,-0.288,-0.285,-0.282, - &-0.279,-0.276,-0.273,-0.270,-0.267,-0.264,-0.261,-0.258,-0.255, - &-0.252,-0.249,-0.246,-0.243,-0.239,-0.236,-0.233,-0.230,-0.227, - &-0.223,-0.220,-0.217,-0.214,-0.210,-0.207,-0.203,-0.200,-0.197, - &-0.193,-0.190,-0.186,-0.183,-0.179,-0.176,-0.172,-0.168,-0.165, - &-0.161,-0.158,-0.154,-0.150,-0.146,-0.143,-0.139,-0.135,-0.131, - &-0.127,-0.123,-0.119,-0.115,-0.111,-0.107,-0.103,-0.099,-0.095, - &-0.091,-0.087,-0.083,-0.079,-0.075,-0.071,-0.067,-0.063,-0.059, - &-0.055,-0.050,-0.046,-0.042,-0.038,-0.034,-0.030,-0.026,-0.021, - &-0.017,-0.013,-0.009,-0.005, 0.000, 0.004, 0.008, 0.012, 0.016, - & 0.020, 0.025, 0.029, 0.033, 0.037, 0.041, 0.046, 0.050, 0.054, - & 0.058, 0.062, 0.066, 0.071, 0.075, 0.079, 0.083, 0.087, 0.091, - & 0.095, 0.100, 0.104, 0.108, 0.112, 0.116, 0.120, 0.124, 0.128, - & 0.133, 0.137, 0.141, 0.145, 0.149, 0.153, 0.157, 0.161, 0.165, - & 0.169, 0.174, 0.178, 0.182, 0.186, 0.190, 0.194, 0.198, 0.202, - & 0.206, 0.210, 0.214, 0.218, 0.222, 0.226, 0.230, 0.234, 0.238, - & 0.242, 0.246, 0.250, 0.254, 0.258, 0.262, 0.266, 0.270, 0.274, - & 0.278, 0.282, 0.286, 0.290, 0.294, 0.298, 0.302, 0.306, 0.310, - & 0.314, 0.318, 0.321, 0.325, 0.329, 0.333, 0.337, 0.341, 0.345, - & 0.349, 0.353, 0.356, 0.360, 0.364, 0.368, 0.372, 0.376, 0.380, - & 0.383, 0.387, 0.391, 0.395, 0.399, 0.403, 0.406, 0.410, 0.414, - & 0.418, 0.422, 0.425, 0.429, 0.433, 0.437, 0.440, 0.444, 0.448, - & 0.452, 0.455, 0.459, 0.463, 0.467, 0.470, 0.474, 0.478, 0.482, - & 0.485, 0.489, 0.493, 0.496, 0.500, 0.504, 0.507, 0.511, 0.515, - & 0.518, 0.522, 0.526, 0.529, 0.533, 0.537, 0.540, 0.544, 0.548, - & 0.551, 0.555, 0.558, 0.562, 0.566, 0.569, 0.573, 0.576, 0.580, - & 0.584, 0.587, 0.591, 0.594, 0.598, 0.601, 0.605, 0.609, 0.612, - & 0.616, 0.619, 0.623, 0.626, 0.630, 0.633, 0.637, 0.640, 0.644, - & 0.647, 0.651, 0.654, 0.658, 0.661, 0.665, 0.668, 0.672, 0.675, - & 0.678, 0.682, 0.685, 0.689, 0.692, 0.696, 0.699, 0.703, 0.706, - & 0.709, 0.713, 0.716, 0.720, 0.723, 0.726, 0.730, 0.733, 0.737, - & 0.740, 0.743, 0.747, 0.750, 0.753, 0.757, 0.760, 0.763, 0.767, - & 0.770, 0.773, 0.777, 0.780, 0.783, 0.787, 0.790, 0.793, 0.797, - & 0.800, 0.803, 0.807, 0.810, 0.813, 0.816, 0.820, 0.823, 0.826, - & 0.829, 0.833, 0.836, 0.839, 0.842, 0.846, 0.849, 0.852, 0.855, - & 0.859, 0.862, 0.865, 0.868, 0.871, 0.875, 0.878, 0.881, 0.884, - & 0.887, 0.891, 0.894, 0.897, 0.900, 0.903, 0.906, 0.910, 0.913, - & 0.916, 0.919, 0.922, 0.925, 0.928, 0.932, 0.935, 0.938, 0.941, - & 0.944, 0.947, 0.950, 0.953, 0.957, 0.960, 0.963, 0.966, 0.969, - & 0.972, 0.975, 0.978, 0.981, 1.014, 1.044, 1.074, 1.103, 1.132, - & 1.161, 1.189, 1.218, 1.245, 1.273, 1.300, 1.327, 1.353, 1.380, - & 1.406, 1.431, 1.457, 1.482, 1.507, 1.532, 1.556, 1.580, 1.604, - & 1.628, 1.652, 1.675, 1.698, 1.721, 1.744, 1.766, 1.788, 1.811, - & 1.832, 1.854, 1.876, 1.897, 1.918, 1.939, 1.960, 1.981, 2.001, - & 2.022, 2.042, 2.062, 2.082, 2.101, 2.121, 2.140, 2.160, 2.179, - & 2.198, 2.217, 2.235, 2.254, 2.273, 2.291, 2.309, 2.327, 2.345, - & 2.363, 2.381, 2.398, 2.416, 2.433, 2.451, 2.468, 2.485, 2.502, - & 2.519, 2.535, 2.552, 2.569, 2.585, 2.601, 2.618, 2.634, 2.650, - & 2.666, 2.682, 2.698, 2.713, 2.729, 2.745, 2.760, 2.775, 2.791, - & 2.806, 2.821, 2.836, 2.851, 2.866, 2.881, 2.895, 2.910, 2.925, - & 2.939, 2.954, 2.968, 2.982, 2.997, 3.011, 3.025, 3.039, 3.053, - & 3.067, 3.081, 3.094, 3.108, 3.122, 3.135, 3.149, 3.162, 3.176, - & 3.189, 3.202, 3.216, 3.229, 3.242, 3.255, 3.268, 3.281, 3.294, - & 3.307, 3.319, 3.332, 3.345, 3.357, 3.370, 3.383, 3.395, 3.407, - & 3.420, 3.432, 3.444, 3.457, 3.469, 3.481, 3.493, 3.505, 3.517, - & 3.529, 3.541, 3.553, 3.565, 3.577, 3.588, 3.600, 3.612, 3.623, - & 3.635, 3.646, 3.658, 3.669, 3.681, 3.692, 3.704, 3.715, 3.726, - & 3.737, 3.748, 3.760 - & / -C -C *** K2SO4 -C - DATA BNC17M/ - &-0.091,-0.197,-0.249,-0.286,-0.315,-0.339,-0.359,-0.377,-0.392, - &-0.406,-0.419,-0.431,-0.442,-0.452,-0.461,-0.470,-0.478,-0.486, - &-0.493,-0.500,-0.507,-0.513,-0.519,-0.525,-0.530,-0.535,-0.540, - &-0.545,-0.550,-0.554,-0.559,-0.563,-0.567,-0.571,-0.575,-0.579, - &-0.582,-0.586,-0.589,-0.592,-0.596,-0.599,-0.602,-0.605,-0.608, - &-0.611,-0.613,-0.616,-0.619,-0.621,-0.624,-0.626,-0.628,-0.631, - &-0.633,-0.635,-0.637,-0.640,-0.642,-0.644,-0.646,-0.648,-0.650, - &-0.652,-0.653,-0.655,-0.657,-0.659,-0.661,-0.662,-0.664,-0.666, - &-0.667,-0.669,-0.670,-0.672,-0.673,-0.675,-0.676,-0.678,-0.679, - &-0.681,-0.682,-0.683,-0.685,-0.686,-0.687,-0.689,-0.690,-0.691, - &-0.693,-0.694,-0.695,-0.696,-0.697,-0.699,-0.700,-0.701,-0.702, - &-0.703,-0.704,-0.705,-0.707,-0.708,-0.709,-0.710,-0.711,-0.712, - &-0.713,-0.714,-0.715,-0.716,-0.717,-0.718,-0.719,-0.720,-0.721, - &-0.722,-0.723,-0.724,-0.724,-0.725,-0.726,-0.727,-0.728,-0.729, - &-0.730,-0.731,-0.731,-0.732,-0.733,-0.734,-0.735,-0.735,-0.736, - &-0.737,-0.738,-0.738,-0.739,-0.740,-0.741,-0.741,-0.742,-0.743, - &-0.744,-0.744,-0.745,-0.746,-0.746,-0.747,-0.748,-0.748,-0.749, - &-0.750,-0.750,-0.751,-0.752,-0.752,-0.753,-0.754,-0.754,-0.755, - &-0.755,-0.756,-0.757,-0.757,-0.758,-0.758,-0.759,-0.759,-0.760, - &-0.761,-0.761,-0.762,-0.762,-0.763,-0.763,-0.764,-0.764,-0.765, - &-0.765,-0.766,-0.766,-0.767,-0.767,-0.768,-0.768,-0.769,-0.769, - &-0.770,-0.770,-0.771,-0.771,-0.772,-0.772,-0.772,-0.773,-0.773, - &-0.774,-0.774,-0.775,-0.775,-0.776,-0.776,-0.776,-0.777,-0.777, - &-0.778,-0.778,-0.778,-0.779,-0.779,-0.780,-0.780,-0.780,-0.781, - &-0.781,-0.781,-0.782,-0.782,-0.783,-0.783,-0.783,-0.784,-0.784, - &-0.784,-0.785,-0.785,-0.785,-0.786,-0.786,-0.786,-0.787,-0.787, - &-0.787,-0.788,-0.788,-0.788,-0.789,-0.789,-0.789,-0.790,-0.790, - &-0.790,-0.790,-0.791,-0.791,-0.791,-0.792,-0.792,-0.792,-0.793, - &-0.793,-0.793,-0.793,-0.794,-0.794,-0.794,-0.794,-0.795,-0.795, - &-0.795,-0.795,-0.796,-0.796,-0.796,-0.796,-0.797,-0.797,-0.797, - &-0.797,-0.798,-0.798,-0.798,-0.798,-0.799,-0.799,-0.799,-0.799, - &-0.800,-0.800,-0.800,-0.800,-0.800,-0.801,-0.801,-0.801,-0.801, - &-0.801,-0.802,-0.802,-0.802,-0.802,-0.802,-0.803,-0.803,-0.803, - &-0.803,-0.803,-0.804,-0.804,-0.804,-0.804,-0.804,-0.804,-0.805, - &-0.805,-0.805,-0.805,-0.805,-0.806,-0.806,-0.806,-0.806,-0.806, - &-0.806,-0.806,-0.807,-0.807,-0.807,-0.807,-0.807,-0.807,-0.808, - &-0.808,-0.808,-0.808,-0.808,-0.808,-0.808,-0.809,-0.809,-0.809, - &-0.809,-0.809,-0.809,-0.809,-0.810,-0.810,-0.810,-0.810,-0.810, - &-0.810,-0.810,-0.810,-0.810,-0.811,-0.811,-0.811,-0.811,-0.811, - &-0.811,-0.811,-0.811,-0.812,-0.812,-0.812,-0.812,-0.812,-0.812, - &-0.812,-0.812,-0.812,-0.812,-0.813,-0.813,-0.813,-0.813,-0.813, - &-0.813,-0.813,-0.813,-0.813,-0.813,-0.813,-0.814,-0.814,-0.814, - &-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814,-0.814, - &-0.814,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815,-0.815, - &-0.815,-0.815,-0.815,-0.815,-0.816,-0.816,-0.817,-0.817,-0.817, - &-0.817,-0.817,-0.817,-0.817,-0.817,-0.817,-0.817,-0.816,-0.816, - &-0.816,-0.815,-0.815,-0.814,-0.813,-0.813,-0.812,-0.811,-0.811, - &-0.810,-0.809,-0.808,-0.807,-0.806,-0.805,-0.804,-0.803,-0.802, - &-0.801,-0.800,-0.799,-0.797,-0.796,-0.795,-0.794,-0.792,-0.791, - &-0.790,-0.788,-0.787,-0.786,-0.784,-0.783,-0.781,-0.780,-0.778, - &-0.777,-0.775,-0.774,-0.772,-0.771,-0.769,-0.767,-0.766,-0.764, - &-0.762,-0.761,-0.759,-0.757,-0.756,-0.754,-0.752,-0.750,-0.749, - &-0.747,-0.745,-0.743,-0.741,-0.740,-0.738,-0.736,-0.734,-0.732, - &-0.730,-0.728,-0.727,-0.725,-0.723,-0.721,-0.719,-0.717,-0.715, - &-0.713,-0.711,-0.709,-0.707,-0.705,-0.703,-0.701,-0.699,-0.697, - &-0.695,-0.693,-0.691,-0.689,-0.687,-0.685,-0.683,-0.681,-0.678, - &-0.676,-0.674,-0.672,-0.670,-0.668,-0.666,-0.664,-0.661,-0.659, - &-0.657,-0.655,-0.653,-0.651,-0.648,-0.646,-0.644,-0.642,-0.640, - &-0.638,-0.635,-0.633,-0.631,-0.629,-0.626,-0.624,-0.622,-0.620, - &-0.618,-0.615,-0.613,-0.611,-0.609,-0.606,-0.604,-0.602,-0.599, - &-0.597,-0.595,-0.593,-0.590,-0.588,-0.586,-0.583,-0.581,-0.579, - &-0.577,-0.574,-0.572,-0.570,-0.567,-0.565,-0.563,-0.560,-0.558, - &-0.556,-0.553,-0.551 - & / -C -C *** KHSO4 -C - DATA BNC18M/ - &-0.045,-0.094,-0.118,-0.134,-0.147,-0.156,-0.165,-0.171,-0.177, - &-0.182,-0.187,-0.191,-0.195,-0.198,-0.200,-0.203,-0.205,-0.207, - &-0.209,-0.210,-0.212,-0.213,-0.214,-0.215,-0.215,-0.216,-0.216, - &-0.216,-0.217,-0.217,-0.217,-0.217,-0.216,-0.216,-0.216,-0.215, - &-0.214,-0.214,-0.213,-0.212,-0.211,-0.210,-0.209,-0.208,-0.207, - &-0.206,-0.205,-0.204,-0.202,-0.201,-0.199,-0.198,-0.196,-0.195, - &-0.193,-0.191,-0.190,-0.188,-0.186,-0.184,-0.183,-0.181,-0.179, - &-0.177,-0.175,-0.173,-0.171,-0.169,-0.167,-0.165,-0.163,-0.160, - &-0.158,-0.156,-0.154,-0.152,-0.149,-0.147,-0.145,-0.142,-0.140, - &-0.137,-0.135,-0.133,-0.130,-0.128,-0.125,-0.123,-0.120,-0.117, - &-0.115,-0.112,-0.109,-0.107,-0.104,-0.101,-0.099,-0.096,-0.093, - &-0.090,-0.088,-0.085,-0.082,-0.079,-0.076,-0.074,-0.071,-0.068, - &-0.065,-0.062,-0.059,-0.056,-0.053,-0.050,-0.047,-0.044,-0.042, - &-0.039,-0.036,-0.033,-0.030,-0.027,-0.024,-0.021,-0.018,-0.015, - &-0.012,-0.009,-0.006,-0.003, 0.000, 0.003, 0.006, 0.009, 0.012, - & 0.015, 0.018, 0.020, 0.023, 0.026, 0.029, 0.032, 0.035, 0.038, - & 0.041, 0.044, 0.047, 0.050, 0.053, 0.055, 0.058, 0.061, 0.064, - & 0.067, 0.070, 0.073, 0.076, 0.078, 0.081, 0.084, 0.087, 0.090, - & 0.093, 0.095, 0.098, 0.101, 0.104, 0.107, 0.109, 0.112, 0.115, - & 0.118, 0.121, 0.123, 0.126, 0.129, 0.132, 0.134, 0.137, 0.140, - & 0.143, 0.145, 0.148, 0.151, 0.153, 0.156, 0.159, 0.162, 0.164, - & 0.167, 0.170, 0.172, 0.175, 0.178, 0.180, 0.183, 0.186, 0.188, - & 0.191, 0.193, 0.196, 0.199, 0.201, 0.204, 0.206, 0.209, 0.212, - & 0.214, 0.217, 0.219, 0.222, 0.225, 0.227, 0.230, 0.232, 0.235, - & 0.237, 0.240, 0.242, 0.245, 0.247, 0.250, 0.252, 0.255, 0.257, - & 0.260, 0.262, 0.265, 0.267, 0.270, 0.272, 0.275, 0.277, 0.280, - & 0.282, 0.285, 0.287, 0.289, 0.292, 0.294, 0.297, 0.299, 0.302, - & 0.304, 0.306, 0.309, 0.311, 0.314, 0.316, 0.318, 0.321, 0.323, - & 0.325, 0.328, 0.330, 0.333, 0.335, 0.337, 0.340, 0.342, 0.344, - & 0.347, 0.349, 0.351, 0.354, 0.356, 0.358, 0.360, 0.363, 0.365, - & 0.367, 0.370, 0.372, 0.374, 0.376, 0.379, 0.381, 0.383, 0.386, - & 0.388, 0.390, 0.392, 0.395, 0.397, 0.399, 0.401, 0.403, 0.406, - & 0.408, 0.410, 0.412, 0.415, 0.417, 0.419, 0.421, 0.423, 0.425, - & 0.428, 0.430, 0.432, 0.434, 0.436, 0.439, 0.441, 0.443, 0.445, - & 0.447, 0.449, 0.451, 0.454, 0.456, 0.458, 0.460, 0.462, 0.464, - & 0.466, 0.468, 0.471, 0.473, 0.475, 0.477, 0.479, 0.481, 0.483, - & 0.485, 0.487, 0.489, 0.491, 0.494, 0.496, 0.498, 0.500, 0.502, - & 0.504, 0.506, 0.508, 0.510, 0.512, 0.514, 0.516, 0.518, 0.520, - & 0.522, 0.524, 0.526, 0.528, 0.530, 0.532, 0.534, 0.536, 0.538, - & 0.540, 0.542, 0.544, 0.546, 0.548, 0.550, 0.552, 0.554, 0.556, - & 0.558, 0.560, 0.562, 0.564, 0.566, 0.568, 0.570, 0.572, 0.574, - & 0.576, 0.578, 0.580, 0.582, 0.584, 0.585, 0.587, 0.589, 0.591, - & 0.593, 0.595, 0.597, 0.599, 0.601, 0.603, 0.605, 0.607, 0.608, - & 0.610, 0.612, 0.614, 0.616, 0.618, 0.620, 0.622, 0.623, 0.625, - & 0.627, 0.629, 0.631, 0.633, 0.653, 0.671, 0.689, 0.707, 0.724, - & 0.741, 0.758, 0.775, 0.792, 0.808, 0.824, 0.840, 0.856, 0.872, - & 0.887, 0.903, 0.918, 0.933, 0.947, 0.962, 0.977, 0.991, 1.005, - & 1.019, 1.033, 1.047, 1.060, 1.074, 1.087, 1.101, 1.114, 1.127, - & 1.140, 1.152, 1.165, 1.178, 1.190, 1.202, 1.215, 1.227, 1.239, - & 1.251, 1.262, 1.274, 1.286, 1.297, 1.309, 1.320, 1.332, 1.343, - & 1.354, 1.365, 1.376, 1.387, 1.397, 1.408, 1.419, 1.429, 1.440, - & 1.450, 1.461, 1.471, 1.481, 1.491, 1.501, 1.511, 1.521, 1.531, - & 1.541, 1.551, 1.561, 1.570, 1.580, 1.589, 1.599, 1.608, 1.617, - & 1.627, 1.636, 1.645, 1.654, 1.663, 1.672, 1.681, 1.690, 1.699, - & 1.708, 1.717, 1.726, 1.734, 1.743, 1.751, 1.760, 1.768, 1.777, - & 1.785, 1.794, 1.802, 1.810, 1.819, 1.827, 1.835, 1.843, 1.851, - & 1.859, 1.867, 1.875, 1.883, 1.891, 1.899, 1.907, 1.915, 1.922, - & 1.930, 1.938, 1.945, 1.953, 1.960, 1.968, 1.976, 1.983, 1.990, - & 1.998, 2.005, 2.013, 2.020, 2.027, 2.034, 2.042, 2.049, 2.056, - & 2.063, 2.070, 2.077, 2.084, 2.091, 2.098, 2.105, 2.112, 2.119, - & 2.126, 2.133, 2.140, 2.147, 2.154, 2.160, 2.167, 2.174, 2.180, - & 2.187, 2.194, 2.200, 2.207, 2.213, 2.220, 2.227, 2.233, 2.240, - & 2.246, 2.252, 2.259 - & / -C -C *** KNO3 -C - DATA BNC19M/ - &-0.046,-0.105,-0.136,-0.159,-0.178,-0.194,-0.208,-0.221,-0.233, - &-0.244,-0.255,-0.265,-0.274,-0.283,-0.291,-0.299,-0.307,-0.315, - &-0.322,-0.329,-0.336,-0.342,-0.349,-0.355,-0.361,-0.367,-0.373, - &-0.379,-0.384,-0.390,-0.395,-0.400,-0.405,-0.410,-0.415,-0.420, - &-0.425,-0.430,-0.434,-0.439,-0.443,-0.447,-0.452,-0.456,-0.460, - &-0.464,-0.468,-0.472,-0.476,-0.480,-0.483,-0.487,-0.491,-0.494, - &-0.498,-0.501,-0.505,-0.508,-0.511,-0.515,-0.518,-0.521,-0.524, - &-0.528,-0.531,-0.534,-0.537,-0.540,-0.543,-0.546,-0.549,-0.552, - &-0.555,-0.557,-0.560,-0.563,-0.566,-0.569,-0.571,-0.574,-0.577, - &-0.580,-0.582,-0.585,-0.588,-0.590,-0.593,-0.596,-0.598,-0.601, - &-0.604,-0.606,-0.609,-0.611,-0.614,-0.616,-0.619,-0.622,-0.624, - &-0.627,-0.629,-0.632,-0.634,-0.637,-0.639,-0.641,-0.644,-0.646, - &-0.649,-0.651,-0.654,-0.656,-0.658,-0.661,-0.663,-0.666,-0.668, - &-0.670,-0.673,-0.675,-0.677,-0.679,-0.682,-0.684,-0.686,-0.688, - &-0.691,-0.693,-0.695,-0.697,-0.699,-0.702,-0.704,-0.706,-0.708, - &-0.710,-0.712,-0.714,-0.716,-0.718,-0.721,-0.723,-0.725,-0.727, - &-0.729,-0.731,-0.733,-0.735,-0.737,-0.739,-0.740,-0.742,-0.744, - &-0.746,-0.748,-0.750,-0.752,-0.754,-0.756,-0.757,-0.759,-0.761, - &-0.763,-0.765,-0.767,-0.768,-0.770,-0.772,-0.774,-0.775,-0.777, - &-0.779,-0.780,-0.782,-0.784,-0.786,-0.787,-0.789,-0.791,-0.792, - &-0.794,-0.796,-0.797,-0.799,-0.800,-0.802,-0.804,-0.805,-0.807, - &-0.808,-0.810,-0.811,-0.813,-0.814,-0.816,-0.817,-0.819,-0.820, - &-0.822,-0.823,-0.825,-0.826,-0.828,-0.829,-0.831,-0.832,-0.834, - &-0.835,-0.836,-0.838,-0.839,-0.841,-0.842,-0.843,-0.845,-0.846, - &-0.847,-0.849,-0.850,-0.851,-0.853,-0.854,-0.855,-0.857,-0.858, - &-0.859,-0.861,-0.862,-0.863,-0.864,-0.866,-0.867,-0.868,-0.869, - &-0.871,-0.872,-0.873,-0.874,-0.875,-0.877,-0.878,-0.879,-0.880, - &-0.881,-0.882,-0.884,-0.885,-0.886,-0.887,-0.888,-0.889,-0.890, - &-0.892,-0.893,-0.894,-0.895,-0.896,-0.897,-0.898,-0.899,-0.900, - &-0.901,-0.902,-0.904,-0.905,-0.906,-0.907,-0.908,-0.909,-0.910, - &-0.911,-0.912,-0.913,-0.914,-0.915,-0.916,-0.917,-0.918,-0.919, - &-0.920,-0.921,-0.922,-0.923,-0.924,-0.925,-0.926,-0.926,-0.927, - &-0.928,-0.929,-0.930,-0.931,-0.932,-0.933,-0.934,-0.935,-0.936, - &-0.936,-0.937,-0.938,-0.939,-0.940,-0.941,-0.942,-0.943,-0.943, - &-0.944,-0.945,-0.946,-0.947,-0.948,-0.948,-0.949,-0.950,-0.951, - &-0.952,-0.953,-0.953,-0.954,-0.955,-0.956,-0.957,-0.957,-0.958, - &-0.959,-0.960,-0.960,-0.961,-0.962,-0.963,-0.963,-0.964,-0.965, - &-0.966,-0.966,-0.967,-0.968,-0.969,-0.969,-0.970,-0.971,-0.971, - &-0.972,-0.973,-0.974,-0.974,-0.975,-0.976,-0.976,-0.977,-0.978, - &-0.978,-0.979,-0.980,-0.980,-0.981,-0.982,-0.982,-0.983,-0.984, - &-0.984,-0.985,-0.986,-0.986,-0.987,-0.988,-0.988,-0.989,-0.989, - &-0.990,-0.991,-0.991,-0.992,-0.992,-0.993,-0.994,-0.994,-0.995, - &-0.995,-0.996,-0.997,-0.997,-0.998,-0.998,-0.999,-1.000,-1.000, - &-1.001,-1.001,-1.002,-1.002,-1.003,-1.003,-1.004,-1.005,-1.005, - &-1.006,-1.006,-1.007,-1.007,-1.013,-1.018,-1.022,-1.027,-1.031, - &-1.035,-1.039,-1.042,-1.046,-1.049,-1.052,-1.055,-1.058,-1.060, - &-1.063,-1.065,-1.067,-1.069,-1.071,-1.073,-1.075,-1.076,-1.078, - &-1.079,-1.081,-1.082,-1.083,-1.084,-1.085,-1.086,-1.087,-1.088, - &-1.088,-1.089,-1.089,-1.090,-1.090,-1.091,-1.091,-1.091,-1.092, - &-1.092,-1.092,-1.092,-1.092,-1.092,-1.092,-1.092,-1.092,-1.092, - &-1.092,-1.091,-1.091,-1.091,-1.091,-1.090,-1.090,-1.090,-1.089, - &-1.089,-1.088,-1.088,-1.087,-1.087,-1.086,-1.085,-1.085,-1.084, - &-1.084,-1.083,-1.082,-1.082,-1.081,-1.080,-1.079,-1.079,-1.078, - &-1.077,-1.076,-1.075,-1.074,-1.074,-1.073,-1.072,-1.071,-1.070, - &-1.069,-1.068,-1.067,-1.066,-1.065,-1.064,-1.063,-1.062,-1.061, - &-1.060,-1.059,-1.058,-1.057,-1.056,-1.055,-1.054,-1.053,-1.052, - &-1.051,-1.050,-1.049,-1.047,-1.046,-1.045,-1.044,-1.043,-1.042, - &-1.041,-1.040,-1.038,-1.037,-1.036,-1.035,-1.034,-1.032,-1.031, - &-1.030,-1.029,-1.028,-1.026,-1.025,-1.024,-1.023,-1.022,-1.020, - &-1.019,-1.018,-1.017,-1.015,-1.014,-1.013,-1.012,-1.010,-1.009, - &-1.008,-1.007,-1.005,-1.004,-1.003,-1.001,-1.000,-0.999,-0.998, - &-0.996,-0.995,-0.994,-0.992,-0.991,-0.990,-0.989,-0.987,-0.986, - &-0.985,-0.983,-0.982 - & / -C -C *** KCL -C - DATA BNC20M/ - &-0.045,-0.095,-0.119,-0.136,-0.148,-0.158,-0.166,-0.173,-0.179, - &-0.184,-0.189,-0.193,-0.197,-0.200,-0.203,-0.206,-0.208,-0.210, - &-0.212,-0.214,-0.216,-0.217,-0.219,-0.220,-0.221,-0.222,-0.223, - &-0.224,-0.225,-0.226,-0.227,-0.227,-0.228,-0.229,-0.229,-0.229, - &-0.230,-0.230,-0.231,-0.231,-0.231,-0.231,-0.232,-0.232,-0.232, - &-0.232,-0.232,-0.232,-0.232,-0.232,-0.233,-0.233,-0.233,-0.232, - &-0.232,-0.232,-0.232,-0.232,-0.232,-0.232,-0.232,-0.232,-0.232, - &-0.232,-0.231,-0.231,-0.231,-0.231,-0.231,-0.230,-0.230,-0.230, - &-0.230,-0.229,-0.229,-0.229,-0.229,-0.228,-0.228,-0.228,-0.227, - &-0.227,-0.227,-0.226,-0.226,-0.226,-0.225,-0.225,-0.224,-0.224, - &-0.224,-0.223,-0.223,-0.222,-0.222,-0.221,-0.221,-0.220,-0.220, - &-0.219,-0.219,-0.218,-0.218,-0.217,-0.217,-0.216,-0.216,-0.215, - &-0.215,-0.214,-0.213,-0.213,-0.212,-0.212,-0.211,-0.211,-0.210, - &-0.209,-0.209,-0.208,-0.208,-0.207,-0.206,-0.206,-0.205,-0.205, - &-0.204,-0.203,-0.203,-0.202,-0.201,-0.201,-0.200,-0.200,-0.199, - &-0.198,-0.198,-0.197,-0.196,-0.196,-0.195,-0.194,-0.194,-0.193, - &-0.192,-0.192,-0.191,-0.191,-0.190,-0.189,-0.189,-0.188,-0.187, - &-0.187,-0.186,-0.185,-0.185,-0.184,-0.183,-0.183,-0.182,-0.181, - &-0.181,-0.180,-0.179,-0.179,-0.178,-0.177,-0.177,-0.176,-0.175, - &-0.175,-0.174,-0.173,-0.173,-0.172,-0.171,-0.171,-0.170,-0.169, - &-0.169,-0.168,-0.167,-0.167,-0.166,-0.165,-0.165,-0.164,-0.163, - &-0.163,-0.162,-0.161,-0.161,-0.160,-0.159,-0.159,-0.158,-0.157, - &-0.157,-0.156,-0.155,-0.155,-0.154,-0.153,-0.153,-0.152,-0.151, - &-0.151,-0.150,-0.149,-0.149,-0.148,-0.147,-0.147,-0.146,-0.145, - &-0.145,-0.144,-0.143,-0.143,-0.142,-0.141,-0.141,-0.140,-0.140, - &-0.139,-0.138,-0.138,-0.137,-0.136,-0.136,-0.135,-0.134,-0.134, - &-0.133,-0.132,-0.132,-0.131,-0.130,-0.130,-0.129,-0.128,-0.128, - &-0.127,-0.126,-0.126,-0.125,-0.124,-0.124,-0.123,-0.122,-0.122, - &-0.121,-0.120,-0.120,-0.119,-0.119,-0.118,-0.117,-0.117,-0.116, - &-0.115,-0.115,-0.114,-0.113,-0.113,-0.112,-0.111,-0.111,-0.110, - &-0.109,-0.109,-0.108,-0.108,-0.107,-0.106,-0.106,-0.105,-0.104, - &-0.104,-0.103,-0.102,-0.102,-0.101,-0.100,-0.100,-0.099,-0.099, - &-0.098,-0.097,-0.097,-0.096,-0.095,-0.095,-0.094,-0.093,-0.093, - &-0.092,-0.092,-0.091,-0.090,-0.090,-0.089,-0.088,-0.088,-0.087, - &-0.087,-0.086,-0.085,-0.085,-0.084,-0.083,-0.083,-0.082,-0.082, - &-0.081,-0.080,-0.080,-0.079,-0.078,-0.078,-0.077,-0.077,-0.076, - &-0.075,-0.075,-0.074,-0.073,-0.073,-0.072,-0.072,-0.071,-0.070, - &-0.070,-0.069,-0.069,-0.068,-0.067,-0.067,-0.066,-0.065,-0.065, - &-0.064,-0.064,-0.063,-0.062,-0.062,-0.061,-0.061,-0.060,-0.059, - &-0.059,-0.058,-0.058,-0.057,-0.056,-0.056,-0.055,-0.055,-0.054, - &-0.053,-0.053,-0.052,-0.051,-0.051,-0.050,-0.050,-0.049,-0.048, - &-0.048,-0.047,-0.047,-0.046,-0.046,-0.045,-0.044,-0.044,-0.043, - &-0.043,-0.042,-0.041,-0.041,-0.040,-0.040,-0.039,-0.038,-0.038, - &-0.037,-0.037,-0.036,-0.035,-0.035,-0.034,-0.034,-0.033,-0.032, - &-0.032,-0.031,-0.031,-0.030,-0.024,-0.018,-0.012,-0.007,-0.001, - & 0.005, 0.010, 0.016, 0.021, 0.027, 0.032, 0.037, 0.043, 0.048, - & 0.053, 0.058, 0.064, 0.069, 0.074, 0.079, 0.084, 0.089, 0.094, - & 0.099, 0.104, 0.109, 0.113, 0.118, 0.123, 0.128, 0.132, 0.137, - & 0.142, 0.146, 0.151, 0.156, 0.160, 0.165, 0.169, 0.174, 0.178, - & 0.183, 0.187, 0.191, 0.196, 0.200, 0.205, 0.209, 0.213, 0.217, - & 0.222, 0.226, 0.230, 0.234, 0.238, 0.242, 0.247, 0.251, 0.255, - & 0.259, 0.263, 0.267, 0.271, 0.275, 0.279, 0.283, 0.287, 0.291, - & 0.295, 0.298, 0.302, 0.306, 0.310, 0.314, 0.318, 0.321, 0.325, - & 0.329, 0.333, 0.337, 0.340, 0.344, 0.348, 0.351, 0.355, 0.359, - & 0.362, 0.366, 0.370, 0.373, 0.377, 0.380, 0.384, 0.387, 0.391, - & 0.394, 0.398, 0.401, 0.405, 0.408, 0.412, 0.415, 0.419, 0.422, - & 0.426, 0.429, 0.433, 0.436, 0.439, 0.443, 0.446, 0.449, 0.453, - & 0.456, 0.459, 0.463, 0.466, 0.469, 0.473, 0.476, 0.479, 0.482, - & 0.486, 0.489, 0.492, 0.495, 0.499, 0.502, 0.505, 0.508, 0.511, - & 0.514, 0.518, 0.521, 0.524, 0.527, 0.530, 0.533, 0.536, 0.540, - & 0.543, 0.546, 0.549, 0.552, 0.555, 0.558, 0.561, 0.564, 0.567, - & 0.570, 0.573, 0.576, 0.579, 0.582, 0.585, 0.588, 0.591, 0.594, - & 0.597, 0.600, 0.603 - & / -C -C *** MGSO4 -C - DATA BNC21M/ - &-0.181,-0.389,-0.491,-0.562,-0.617,-0.661,-0.699,-0.732,-0.760, - &-0.786,-0.809,-0.829,-0.849,-0.866,-0.882,-0.897,-0.911,-0.924, - &-0.937,-0.948,-0.959,-0.969,-0.979,-0.988,-0.997,-1.006,-1.014, - &-1.021,-1.028,-1.035,-1.042,-1.048,-1.055,-1.061,-1.066,-1.072, - &-1.077,-1.082,-1.087,-1.092,-1.096,-1.100,-1.105,-1.109,-1.113, - &-1.117,-1.120,-1.124,-1.128,-1.131,-1.134,-1.137,-1.141,-1.144, - &-1.146,-1.149,-1.152,-1.155,-1.157,-1.160,-1.162,-1.165,-1.167, - &-1.169,-1.172,-1.174,-1.176,-1.178,-1.180,-1.182,-1.184,-1.186, - &-1.187,-1.189,-1.191,-1.192,-1.194,-1.196,-1.197,-1.199,-1.200, - &-1.202,-1.203,-1.204,-1.206,-1.207,-1.208,-1.209,-1.210,-1.211, - &-1.213,-1.214,-1.215,-1.216,-1.217,-1.218,-1.218,-1.219,-1.220, - &-1.221,-1.222,-1.223,-1.223,-1.224,-1.225,-1.225,-1.226,-1.227, - &-1.227,-1.228,-1.229,-1.229,-1.230,-1.230,-1.231,-1.231,-1.232, - &-1.232,-1.233,-1.233,-1.233,-1.234,-1.234,-1.235,-1.235,-1.235, - &-1.236,-1.236,-1.236,-1.236,-1.237,-1.237,-1.237,-1.237,-1.238, - &-1.238,-1.238,-1.238,-1.238,-1.239,-1.239,-1.239,-1.239,-1.239, - &-1.239,-1.239,-1.239,-1.239,-1.239,-1.240,-1.240,-1.240,-1.240, - &-1.240,-1.240,-1.240,-1.240,-1.240,-1.240,-1.240,-1.240,-1.240, - &-1.239,-1.239,-1.239,-1.239,-1.239,-1.239,-1.239,-1.239,-1.239, - &-1.239,-1.239,-1.238,-1.238,-1.238,-1.238,-1.238,-1.238,-1.238, - &-1.237,-1.237,-1.237,-1.237,-1.237,-1.237,-1.236,-1.236,-1.236, - &-1.236,-1.235,-1.235,-1.235,-1.235,-1.235,-1.234,-1.234,-1.234, - &-1.233,-1.233,-1.233,-1.233,-1.232,-1.232,-1.232,-1.232,-1.231, - &-1.231,-1.231,-1.230,-1.230,-1.230,-1.229,-1.229,-1.229,-1.228, - &-1.228,-1.228,-1.227,-1.227,-1.227,-1.226,-1.226,-1.226,-1.225, - &-1.225,-1.225,-1.224,-1.224,-1.223,-1.223,-1.223,-1.222,-1.222, - &-1.222,-1.221,-1.221,-1.220,-1.220,-1.220,-1.219,-1.219,-1.218, - &-1.218,-1.217,-1.217,-1.217,-1.216,-1.216,-1.215,-1.215,-1.214, - &-1.214,-1.214,-1.213,-1.213,-1.212,-1.212,-1.211,-1.211,-1.210, - &-1.210,-1.210,-1.209,-1.209,-1.208,-1.208,-1.207,-1.207,-1.206, - &-1.206,-1.205,-1.205,-1.204,-1.204,-1.203,-1.203,-1.202,-1.202, - &-1.201,-1.201,-1.200,-1.200,-1.199,-1.199,-1.198,-1.198,-1.197, - &-1.197,-1.196,-1.196,-1.195,-1.195,-1.194,-1.194,-1.193,-1.193, - &-1.192,-1.192,-1.191,-1.191,-1.190,-1.190,-1.189,-1.188,-1.188, - &-1.187,-1.187,-1.186,-1.186,-1.185,-1.185,-1.184,-1.184,-1.183, - &-1.182,-1.182,-1.181,-1.181,-1.180,-1.180,-1.179,-1.179,-1.178, - &-1.177,-1.177,-1.176,-1.176,-1.175,-1.175,-1.174,-1.174,-1.173, - &-1.172,-1.172,-1.171,-1.171,-1.170,-1.169,-1.169,-1.168,-1.168, - &-1.167,-1.167,-1.166,-1.165,-1.165,-1.164,-1.164,-1.163,-1.163, - &-1.162,-1.161,-1.161,-1.160,-1.160,-1.159,-1.158,-1.158,-1.157, - &-1.157,-1.156,-1.155,-1.155,-1.154,-1.154,-1.153,-1.152,-1.152, - &-1.151,-1.151,-1.150,-1.149,-1.149,-1.148,-1.148,-1.147,-1.146, - &-1.146,-1.145,-1.144,-1.144,-1.143,-1.143,-1.142,-1.141,-1.141, - &-1.140,-1.140,-1.139,-1.138,-1.138,-1.137,-1.136,-1.136,-1.135, - &-1.135,-1.134,-1.133,-1.133,-1.126,-1.120,-1.113,-1.107,-1.100, - &-1.094,-1.087,-1.080,-1.074,-1.067,-1.060,-1.054,-1.047,-1.040, - &-1.033,-1.027,-1.020,-1.013,-1.006,-0.999,-0.992,-0.985,-0.978, - &-0.971,-0.965,-0.958,-0.951,-0.944,-0.937,-0.930,-0.923,-0.916, - &-0.909,-0.902,-0.895,-0.888,-0.881,-0.874,-0.867,-0.860,-0.853, - &-0.846,-0.839,-0.832,-0.825,-0.818,-0.811,-0.804,-0.797,-0.790, - &-0.783,-0.776,-0.769,-0.762,-0.755,-0.748,-0.741,-0.734,-0.727, - &-0.720,-0.713,-0.706,-0.699,-0.692,-0.685,-0.678,-0.671,-0.664, - &-0.657,-0.650,-0.644,-0.637,-0.630,-0.623,-0.616,-0.609,-0.602, - &-0.595,-0.588,-0.581,-0.574,-0.567,-0.560,-0.554,-0.547,-0.540, - &-0.533,-0.526,-0.519,-0.512,-0.505,-0.498,-0.492,-0.485,-0.478, - &-0.471,-0.464,-0.457,-0.450,-0.444,-0.437,-0.430,-0.423,-0.416, - &-0.409,-0.403,-0.396,-0.389,-0.382,-0.375,-0.369,-0.362,-0.355, - &-0.348,-0.341,-0.335,-0.328,-0.321,-0.314,-0.308,-0.301,-0.294, - &-0.287,-0.280,-0.274,-0.267,-0.260,-0.254,-0.247,-0.240,-0.233, - &-0.227,-0.220,-0.213,-0.206,-0.200,-0.193,-0.186,-0.180,-0.173, - &-0.166,-0.160,-0.153,-0.146,-0.140,-0.133,-0.126,-0.119,-0.113, - &-0.106,-0.100,-0.093,-0.086,-0.080,-0.073,-0.066,-0.060,-0.053, - &-0.046,-0.040,-0.033 - & / -C -C *** MGNO32 -C - DATA BNC22M/ - &-0.088,-0.185,-0.228,-0.257,-0.278,-0.294,-0.306,-0.317,-0.325, - &-0.332,-0.337,-0.342,-0.346,-0.349,-0.351,-0.353,-0.355,-0.356, - &-0.357,-0.357,-0.357,-0.357,-0.356,-0.356,-0.355,-0.354,-0.353, - &-0.352,-0.350,-0.349,-0.347,-0.345,-0.343,-0.341,-0.339,-0.337, - &-0.335,-0.333,-0.330,-0.328,-0.326,-0.323,-0.321,-0.318,-0.316, - &-0.313,-0.310,-0.308,-0.305,-0.302,-0.300,-0.297,-0.294,-0.291, - &-0.288,-0.286,-0.283,-0.280,-0.277,-0.274,-0.271,-0.268,-0.266, - &-0.263,-0.260,-0.257,-0.254,-0.251,-0.248,-0.245,-0.242,-0.239, - &-0.235,-0.232,-0.229,-0.226,-0.223,-0.220,-0.216,-0.213,-0.210, - &-0.207,-0.203,-0.200,-0.197,-0.193,-0.190,-0.186,-0.183,-0.180, - &-0.176,-0.173,-0.169,-0.165,-0.162,-0.158,-0.155,-0.151,-0.147, - &-0.143,-0.140,-0.136,-0.132,-0.128,-0.125,-0.121,-0.117,-0.113, - &-0.109,-0.105,-0.101,-0.098,-0.094,-0.090,-0.086,-0.082,-0.078, - &-0.074,-0.070,-0.066,-0.062,-0.058,-0.054,-0.050,-0.046,-0.042, - &-0.038,-0.034,-0.030,-0.026,-0.022,-0.018,-0.014,-0.010,-0.006, - &-0.002, 0.002, 0.006, 0.010, 0.014, 0.018, 0.022, 0.026, 0.030, - & 0.034, 0.038, 0.042, 0.046, 0.050, 0.054, 0.058, 0.062, 0.066, - & 0.070, 0.074, 0.078, 0.082, 0.086, 0.090, 0.094, 0.098, 0.102, - & 0.106, 0.110, 0.114, 0.118, 0.122, 0.126, 0.130, 0.134, 0.137, - & 0.141, 0.145, 0.149, 0.153, 0.157, 0.161, 0.165, 0.169, 0.173, - & 0.177, 0.180, 0.184, 0.188, 0.192, 0.196, 0.200, 0.204, 0.207, - & 0.211, 0.215, 0.219, 0.223, 0.227, 0.231, 0.234, 0.238, 0.242, - & 0.246, 0.250, 0.253, 0.257, 0.261, 0.265, 0.269, 0.272, 0.276, - & 0.280, 0.284, 0.288, 0.291, 0.295, 0.299, 0.303, 0.306, 0.310, - & 0.314, 0.318, 0.321, 0.325, 0.329, 0.332, 0.336, 0.340, 0.343, - & 0.347, 0.351, 0.355, 0.358, 0.362, 0.366, 0.369, 0.373, 0.377, - & 0.380, 0.384, 0.388, 0.391, 0.395, 0.398, 0.402, 0.406, 0.409, - & 0.413, 0.417, 0.420, 0.424, 0.427, 0.431, 0.435, 0.438, 0.442, - & 0.445, 0.449, 0.452, 0.456, 0.459, 0.463, 0.467, 0.470, 0.474, - & 0.477, 0.481, 0.484, 0.488, 0.491, 0.495, 0.498, 0.502, 0.505, - & 0.509, 0.512, 0.516, 0.519, 0.523, 0.526, 0.530, 0.533, 0.537, - & 0.540, 0.543, 0.547, 0.550, 0.554, 0.557, 0.561, 0.564, 0.567, - & 0.571, 0.574, 0.578, 0.581, 0.584, 0.588, 0.591, 0.595, 0.598, - & 0.601, 0.605, 0.608, 0.611, 0.615, 0.618, 0.621, 0.625, 0.628, - & 0.631, 0.635, 0.638, 0.641, 0.645, 0.648, 0.651, 0.655, 0.658, - & 0.661, 0.665, 0.668, 0.671, 0.674, 0.678, 0.681, 0.684, 0.687, - & 0.691, 0.694, 0.697, 0.700, 0.704, 0.707, 0.710, 0.713, 0.717, - & 0.720, 0.723, 0.726, 0.729, 0.733, 0.736, 0.739, 0.742, 0.745, - & 0.749, 0.752, 0.755, 0.758, 0.761, 0.764, 0.768, 0.771, 0.774, - & 0.777, 0.780, 0.783, 0.786, 0.790, 0.793, 0.796, 0.799, 0.802, - & 0.805, 0.808, 0.811, 0.814, 0.818, 0.821, 0.824, 0.827, 0.830, - & 0.833, 0.836, 0.839, 0.842, 0.845, 0.848, 0.851, 0.854, 0.857, - & 0.860, 0.864, 0.867, 0.870, 0.873, 0.876, 0.879, 0.882, 0.885, - & 0.888, 0.891, 0.894, 0.897, 0.900, 0.903, 0.906, 0.909, 0.912, - & 0.915, 0.918, 0.921, 0.924, 0.955, 0.984, 1.013, 1.041, 1.070, - & 1.097, 1.125, 1.152, 1.179, 1.205, 1.231, 1.257, 1.283, 1.308, - & 1.334, 1.359, 1.383, 1.408, 1.432, 1.456, 1.479, 1.503, 1.526, - & 1.549, 1.572, 1.594, 1.617, 1.639, 1.661, 1.683, 1.704, 1.726, - & 1.747, 1.768, 1.789, 1.810, 1.830, 1.851, 1.871, 1.891, 1.911, - & 1.930, 1.950, 1.969, 1.989, 2.008, 2.027, 2.046, 2.064, 2.083, - & 2.101, 2.120, 2.138, 2.156, 2.174, 2.192, 2.209, 2.227, 2.244, - & 2.262, 2.279, 2.296, 2.313, 2.330, 2.347, 2.363, 2.380, 2.396, - & 2.413, 2.429, 2.445, 2.461, 2.477, 2.493, 2.509, 2.525, 2.540, - & 2.556, 2.571, 2.587, 2.602, 2.617, 2.632, 2.647, 2.662, 2.677, - & 2.692, 2.707, 2.721, 2.736, 2.750, 2.765, 2.779, 2.793, 2.807, - & 2.822, 2.836, 2.850, 2.863, 2.877, 2.891, 2.905, 2.918, 2.932, - & 2.946, 2.959, 2.972, 2.986, 2.999, 3.012, 3.025, 3.039, 3.052, - & 3.065, 3.078, 3.090, 3.103, 3.116, 3.129, 3.141, 3.154, 3.167, - & 3.179, 3.191, 3.204, 3.216, 3.229, 3.241, 3.253, 3.265, 3.277, - & 3.289, 3.301, 3.313, 3.325, 3.337, 3.349, 3.361, 3.372, 3.384, - & 3.396, 3.407, 3.419, 3.431, 3.442, 3.453, 3.465, 3.476, 3.488, - & 3.499, 3.510, 3.521, 3.532, 3.544, 3.555, 3.566, 3.577, 3.588, - & 3.599, 3.610, 3.621 - & / -C -C *** MGCL2 -C - DATA BNC23M/ - &-0.088,-0.182,-0.225,-0.252,-0.271,-0.286,-0.297,-0.306,-0.313, - &-0.319,-0.323,-0.327,-0.329,-0.331,-0.332,-0.333,-0.333,-0.333, - &-0.333,-0.332,-0.331,-0.329,-0.328,-0.326,-0.324,-0.322,-0.319, - &-0.317,-0.314,-0.312,-0.309,-0.306,-0.303,-0.300,-0.296,-0.293, - &-0.290,-0.286,-0.283,-0.279,-0.276,-0.272,-0.268,-0.265,-0.261, - &-0.257,-0.253,-0.250,-0.246,-0.242,-0.238,-0.234,-0.230,-0.226, - &-0.223,-0.219,-0.215,-0.211,-0.207,-0.203,-0.199,-0.195,-0.191, - &-0.187,-0.183,-0.179,-0.174,-0.170,-0.166,-0.162,-0.158,-0.154, - &-0.150,-0.145,-0.141,-0.137,-0.133,-0.128,-0.124,-0.120,-0.115, - &-0.111,-0.106,-0.102,-0.097,-0.093,-0.088,-0.084,-0.079,-0.074, - &-0.070,-0.065,-0.060,-0.056,-0.051,-0.046,-0.041,-0.036,-0.031, - &-0.027,-0.022,-0.017,-0.012,-0.007,-0.002, 0.003, 0.008, 0.013, - & 0.019, 0.024, 0.029, 0.034, 0.039, 0.044, 0.049, 0.055, 0.060, - & 0.065, 0.070, 0.075, 0.081, 0.086, 0.091, 0.096, 0.101, 0.107, - & 0.112, 0.117, 0.122, 0.128, 0.133, 0.138, 0.143, 0.149, 0.154, - & 0.159, 0.164, 0.170, 0.175, 0.180, 0.185, 0.190, 0.196, 0.201, - & 0.206, 0.211, 0.216, 0.222, 0.227, 0.232, 0.237, 0.242, 0.248, - & 0.253, 0.258, 0.263, 0.268, 0.273, 0.279, 0.284, 0.289, 0.294, - & 0.299, 0.304, 0.309, 0.314, 0.320, 0.325, 0.330, 0.335, 0.340, - & 0.345, 0.350, 0.355, 0.360, 0.365, 0.370, 0.375, 0.380, 0.386, - & 0.391, 0.396, 0.401, 0.406, 0.411, 0.416, 0.421, 0.426, 0.431, - & 0.436, 0.441, 0.446, 0.450, 0.455, 0.460, 0.465, 0.470, 0.475, - & 0.480, 0.485, 0.490, 0.495, 0.500, 0.505, 0.509, 0.514, 0.519, - & 0.524, 0.529, 0.534, 0.539, 0.543, 0.548, 0.553, 0.558, 0.563, - & 0.568, 0.572, 0.577, 0.582, 0.587, 0.592, 0.596, 0.601, 0.606, - & 0.611, 0.615, 0.620, 0.625, 0.629, 0.634, 0.639, 0.644, 0.648, - & 0.653, 0.658, 0.662, 0.667, 0.672, 0.676, 0.681, 0.686, 0.690, - & 0.695, 0.700, 0.704, 0.709, 0.713, 0.718, 0.723, 0.727, 0.732, - & 0.736, 0.741, 0.745, 0.750, 0.754, 0.759, 0.764, 0.768, 0.773, - & 0.777, 0.782, 0.786, 0.791, 0.795, 0.800, 0.804, 0.809, 0.813, - & 0.817, 0.822, 0.826, 0.831, 0.835, 0.840, 0.844, 0.848, 0.853, - & 0.857, 0.862, 0.866, 0.870, 0.875, 0.879, 0.884, 0.888, 0.892, - & 0.897, 0.901, 0.905, 0.910, 0.914, 0.918, 0.923, 0.927, 0.931, - & 0.935, 0.940, 0.944, 0.948, 0.953, 0.957, 0.961, 0.965, 0.970, - & 0.974, 0.978, 0.982, 0.986, 0.991, 0.995, 0.999, 1.003, 1.007, - & 1.012, 1.016, 1.020, 1.024, 1.028, 1.032, 1.037, 1.041, 1.045, - & 1.049, 1.053, 1.057, 1.061, 1.065, 1.070, 1.074, 1.078, 1.082, - & 1.086, 1.090, 1.094, 1.098, 1.102, 1.106, 1.110, 1.114, 1.118, - & 1.122, 1.126, 1.130, 1.134, 1.138, 1.142, 1.146, 1.150, 1.154, - & 1.158, 1.162, 1.166, 1.170, 1.174, 1.178, 1.182, 1.186, 1.190, - & 1.194, 1.198, 1.202, 1.206, 1.210, 1.214, 1.217, 1.221, 1.225, - & 1.229, 1.233, 1.237, 1.241, 1.245, 1.248, 1.252, 1.256, 1.260, - & 1.264, 1.268, 1.271, 1.275, 1.279, 1.283, 1.287, 1.290, 1.294, - & 1.298, 1.302, 1.306, 1.309, 1.313, 1.317, 1.321, 1.324, 1.328, - & 1.332, 1.336, 1.339, 1.343, 1.383, 1.420, 1.456, 1.491, 1.527, - & 1.561, 1.596, 1.630, 1.663, 1.696, 1.729, 1.761, 1.793, 1.825, - & 1.856, 1.887, 1.918, 1.948, 1.978, 2.008, 2.037, 2.066, 2.095, - & 2.123, 2.152, 2.180, 2.207, 2.235, 2.262, 2.289, 2.315, 2.342, - & 2.368, 2.394, 2.419, 2.445, 2.470, 2.495, 2.520, 2.544, 2.569, - & 2.593, 2.617, 2.641, 2.664, 2.688, 2.711, 2.734, 2.757, 2.780, - & 2.802, 2.824, 2.847, 2.869, 2.890, 2.912, 2.934, 2.955, 2.976, - & 2.997, 3.018, 3.039, 3.060, 3.080, 3.101, 3.121, 3.141, 3.161, - & 3.181, 3.201, 3.220, 3.240, 3.259, 3.279, 3.298, 3.317, 3.336, - & 3.354, 3.373, 3.392, 3.410, 3.428, 3.447, 3.465, 3.483, 3.501, - & 3.519, 3.536, 3.554, 3.572, 3.589, 3.606, 3.624, 3.641, 3.658, - & 3.675, 3.692, 3.709, 3.725, 3.742, 3.759, 3.775, 3.791, 3.808, - & 3.824, 3.840, 3.856, 3.872, 3.888, 3.904, 3.920, 3.935, 3.951, - & 3.967, 3.982, 3.997, 4.013, 4.028, 4.043, 4.058, 4.074, 4.089, - & 4.103, 4.118, 4.133, 4.148, 4.163, 4.177, 4.192, 4.206, 4.221, - & 4.235, 4.249, 4.264, 4.278, 4.292, 4.306, 4.320, 4.334, 4.348, - & 4.362, 4.376, 4.390, 4.403, 4.417, 4.431, 4.444, 4.458, 4.471, - & 4.484, 4.498, 4.511, 4.524, 4.538, 4.551, 4.564, 4.577, 4.590, - & 4.603, 4.616, 4.629 - & / -C -C *** END OF BLOCK DATA EXPON ****************************************** -C - END - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE CHRBLN -CC Purpose : Position of last non-blank character in a string -CC Author : Athanasios Nenes -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC STR is the CHARACTER variable containing the string examined -CC IBLK is a INTEGER variable containing the position of last non -CC blank character. If string is all spaces (ie ' '), then -CC the value returned is 1. -CC -CC EXAMPLE: -CC STR = 'TEST1.DAT ' -CC CALL CHRBLN (STR, IBLK) -CC -CC after execution of this code segment, "IBLK" has the value "9", which -CC is the position of the last non-blank character of "STR". -CC -CC*********************************************************************** -CC - SUBROUTINE CHRBLN (STR, IBLK) -CC -CC*********************************************************************** - CHARACTER*(*) STR -C - IBLK = 1 ! Substring pointer (default=1) - ILEN = LEN(STR) ! Length of string - DO 10 i=ILEN,1,-1 - IF (STR(i:i).NE.' ' .AND. STR(i:i).NE.CHAR(0)) THEN - IBLK = i - RETURN - ENDIF -10 CONTINUE - RETURN -C - END - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE SHFTRGHT -CC Purpose : RIGHT-JUSTIFICATION FUNCTION ON A STRING -CC Author : Athanasios Nenes -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC STRING is the CHARACTER variable with the string to be justified -CC -CC EXAMPLE: -CC STRING = 'AAAA ' -CC CALL SHFTRGHT (STRING) -CC -CC after execution of this code segment, STRING contains the value -CC ' AAAA'. -CC -CC************************************************************************* -CC - SUBROUTINE SHFTRGHT (CHR) -CC -CC*********************************************************************** - CHARACTER CHR*(*) -C - I1 = LEN(CHR) ! Total length of string - CALL CHRBLN(CHR,I2) ! Position of last non-blank character - IF (I2.EQ.I1) RETURN -C - DO 10 I=I2,1,-1 ! Shift characters - CHR(I1+I-I2:I1+I-I2) = CHR(I:I) - CHR(I:I) = ' ' -10 CONTINUE - RETURN -C - END - - - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE RPLSTR -CC Purpose : REPLACE CHARACTERS OCCURING IN A STRING -CC Author : Athanasios Nenes -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC STRING is the CHARACTER variable with the string to be edited -CC OLD is the old character which is to be replaced -CC NEW is the new character which OLD is to be replaced with -CC IERR is 0 if everything went well, is 1 if 'NEW' contains 'OLD'. -CC In this case, this is invalid, and no change is done. -CC -CC EXAMPLE: -CC STRING = 'AAAA' -CC OLD = 'A' -CC NEW = 'B' -CC CALL RPLSTR (STRING, OLD, NEW) -CC -CC after execution of this code segment, STRING contains the value -CC 'BBBB'. -CC -CC************************************************************************* -CC - SUBROUTINE RPLSTR (STRING, OLD, NEW, IERR) -CC -CC*********************************************************************** - CHARACTER STRING*(*), OLD*(*), NEW*(*) -C -C *** INITIALIZE ******************************************************** -C - ILO = LEN(OLD) -C -C *** CHECK AND SEE IF 'NEW' CONTAINS 'OLD', WHICH CANNOT *************** -C - IP = INDEX(NEW,OLD) - IF (IP.NE.0) THEN - IERR = 1 - RETURN - ELSE - IERR = 0 - ENDIF -C -C *** PROCEED WITH REPLACING ******************************************* -C -10 IP = INDEX(STRING,OLD) ! SEE IF 'OLD' EXISTS IN 'STRING' - IF (IP.EQ.0) RETURN ! 'OLD' DOES NOT EXIST ; RETURN - STRING(IP:IP+ILO-1) = NEW ! REPLACE SUBSTRING 'OLD' WITH 'NEW' - GOTO 10 ! GO FOR NEW OCCURANCE OF 'OLD' -C - END - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE INPTD -CC Purpose : Prompts user for a value (DOUBLE). A default value -CC is provided, so if user presses , the default -CC is used. -CC Author : Athanasios Nenes -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC VAR is the DOUBLE PRECISION variable which value is to be saved -CC DEF is a DOUBLE PRECISION variable, with the default value of VAR. -CC PROMPT is a CHARACTER varible containing the prompt string. -CC PRFMT is a CHARACTER variable containing the FORMAT specifier -CC for the default value DEF. -CC IERR is an INTEGER error flag, and has the values: -CC 0 - No error detected. -CC 1 - Invalid FORMAT and/or Invalid default value. -CC 2 - Bad value specified by user -CC -CC EXAMPLE: -CC CALL INPTD (VAR, 1.0D0, 'Give value for A ', '*', Ierr) -CC -CC after execution of this code segment, the user is prompted for the -CC value of variable VAR. If is pressed (ie no value is specified) -CC then 1.0 is assigned to VAR. The default value is displayed in free- -CC format. The error status is specified by variable Ierr -CC -CC*********************************************************************** -CC - SUBROUTINE INPTD (VAR, DEF, PROMPT, PRFMT, IERR) -CC -CC*********************************************************************** - CHARACTER PROMPT*(*), PRFMT*(*), BUFFER*128 - DOUBLE PRECISION DEF, VAR - INTEGER IERR -C - IERR = 0 -C -C *** WRITE DEFAULT VALUE TO WORK BUFFER ******************************* -C - WRITE (BUFFER, FMT=PRFMT, ERR=10) DEF - CALL CHRBLN (BUFFER, IEND) -C -C *** PROMPT USER FOR INPUT AND READ IT ******************************** -C - WRITE (*,*) PROMPT,' [',BUFFER(1:IEND),']: ' - READ (*, '(A)', ERR=20, END=20) BUFFER - CALL CHRBLN (BUFFER,IEND) -C -C *** READ DATA OR SET DEFAULT ? **************************************** -C - IF (IEND.EQ.1 .AND. BUFFER(1:1).EQ.' ') THEN - VAR = DEF - ELSE - READ (BUFFER, *, ERR=20, END=20) VAR - ENDIF -C -C *** RETURN POINT ****************************************************** -C -30 RETURN -C -C *** ERROR HANDLER ***************************************************** -C -10 IERR = 1 ! Bad FORMAT and/or bad default value - GOTO 30 -C -20 IERR = 2 ! Bad number given by user - GOTO 30 -C - END - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE Pushend -CC Purpose : Positions the pointer of a sequential file at its end -CC Simulates the ACCESS='APPEND' clause of a F77L OPEN -CC statement with Standard Fortran commands. -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC Iunit is a INTEGER variable, the file unit which the file is -CC connected to. -CC -CC EXAMPLE: -CC CALL PUSHEND (10) -CC -CC after execution of this code segment, the pointer of unit 10 is -CC pushed to its end. -CC -CC*********************************************************************** -CC - SUBROUTINE Pushend (Iunit) -CC -CC*********************************************************************** -C - LOGICAL OPNED -C -C *** INQUIRE IF Iunit CONNECTED TO FILE ******************************** -C - INQUIRE (UNIT=Iunit, OPENED=OPNED) - IF (.NOT.OPNED) GOTO 25 -C -C *** Iunit CONNECTED, PUSH POINTER TO END ****************************** -C -10 READ (Iunit,'()', ERR=20, END=20) - GOTO 10 -C -C *** RETURN POINT ****************************************************** -C -20 BACKSPACE (Iunit) -25 RETURN - END - - - -CC************************************************************************* -CC -CC TOOLBOX LIBRARY v.1.0 (May 1995) -CC -CC Program unit : SUBROUTINE APPENDEXT -CC Purpose : Fix extension in file name string -CC -CC ======================= ARGUMENTS / USAGE ============================= -CC -CC Filename is the CHARACTER variable with the file name -CC Defext is the CHARACTER variable with extension (including '.', -CC ex. '.DAT') -CC Overwrite is a LOGICAL value, .TRUE. overwrites any existing extension -CC in "Filename" with "Defext", .FALSE. puts "Defext" only if -CC there is no extension in "Filename". -CC -CC EXAMPLE: -CC FILENAME1 = 'TEST.DAT' -CC FILENAME2 = 'TEST.DAT' -CC CALL APPENDEXT (FILENAME1, '.TXT', .FALSE.) -CC CALL APPENDEXT (FILENAME2, '.TXT', .TRUE. ) -CC -CC after execution of this code segment, "FILENAME1" has the value -CC 'TEST.DAT', while "FILENAME2" has the value 'TEST.TXT' -CC -CC*********************************************************************** -CC - SUBROUTINE Appendext (Filename, Defext, Overwrite) -CC -CC*********************************************************************** - CHARACTER*(*) Filename, Defext - LOGICAL Overwrite -C - CALL CHRBLN (Filename, Iend) - IF (Filename(1:1).EQ.' ' .AND. Iend.EQ.1) RETURN ! Filename empty - Idot = INDEX (Filename, '.') ! Append extension ? - IF (Idot.EQ.0) Filename = Filename(1:Iend)//Defext - IF (Overwrite .AND. Idot.NE.0) - & Filename = Filename(:Idot-1)//Defext - RETURN - END - - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE POLY3 -C *** FINDS THE REAL ROOTS OF THE THIRD ORDER ALGEBRAIC EQUATION: -C X**3 + A1*X**2 + A2*X + A3 = 0.0 -C THE EQUATION IS SOLVED ANALYTICALLY. -C -C PARAMETERS A1, A2, A3 ARE SPECIFIED BY THE USER. THE MINIMUM -C NONEGATIVE ROOT IS RETURNED IN VARIABLE 'ROOT'. IF NO ROOT IS -C FOUND (WHICH IS GREATER THAN ZERO), ROOT HAS THE VALUE 1D30. -C AND THE FLAG ISLV HAS A VALUE GREATER THAN ZERO. -C -C SOLUTION FORMULA IS FOUND IN PAGE 32 OF: -C MATHEMATICAL HANDBOOK OF FORMULAS AND TABLES -C SCHAUM'S OUTLINE SERIES -C MURRAY SPIEGER, McGRAW-HILL, NEW YORK, 1968 -C (GREEK TRANSLATION: BY SOTIRIOS PERSIDES, ESPI, ATHENS, 1976) -C -C A SPECIAL CASE IS CONSIDERED SEPERATELY ; WHEN A3 = 0, THEN -C ONE ROOT IS X=0.0, AND THE OTHER TWO FROM THE SOLUTION OF THE -C QUADRATIC EQUATION X**2 + A1*X + A2 = 0.0 -C THIS SPECIAL CASE IS CONSIDERED BECAUSE THE ANALYTICAL FORMULA -C DOES NOT YIELD ACCURATE RESULTS (DUE TO NUMERICAL ROUNDOFF ERRORS) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE POLY3 (A1, A2, A3, ROOT, ISLV) -C - IMPLICIT DOUBLE PRECISION (A-H, O-Z) - PARAMETER (EXPON=1.D0/3.D0, ZERO=0.D0, THET1=120.D0/180.D0, - & THET2=240.D0/180.D0, PI=3.14159265358932, EPS=1D-50) - DOUBLE PRECISION X(3) -C -C *** SPECIAL CASE : QUADRATIC*X EQUATION ***************************** -C - IF (ABS(A3).LE.EPS) THEN - ISLV = 1 - IX = 1 - X(1) = ZERO - D = A1*A1-4.D0*A2 - IF (D.GE.ZERO) THEN - IX = 3 - SQD = SQRT(D) - X(2) = 0.5*(-A1+SQD) - X(3) = 0.5*(-A1-SQD) - ENDIF - ELSE -C -C *** NORMAL CASE : CUBIC EQUATION ************************************ -C -C DEFINE PARAMETERS Q, R, S, T, D -C - ISLV= 1 - Q = (3.D0*A2 - A1*A1)/9.D0 - R = (9.D0*A1*A2 - 27.D0*A3 - 2.D0*A1*A1*A1)/54.D0 - D = Q*Q*Q + R*R -C -C *** CALCULATE ROOTS ************************************************* -C -C D < 0, THREE REAL ROOTS -C - IF (D.LT.-EPS) THEN ! D < -EPS : D < ZERO - IX = 3 - THET = EXPON*ACOS(R/SQRT(-Q*Q*Q)) - COEF = 2.D0*SQRT(-Q) - X(1) = COEF*COS(THET) - EXPON*A1 - X(2) = COEF*COS(THET + THET1*PI) - EXPON*A1 - X(3) = COEF*COS(THET + THET2*PI) - EXPON*A1 -C -C D = 0, THREE REAL (ONE DOUBLE) ROOTS -C - ELSE IF (D.LE.EPS) THEN ! -EPS <= D <= EPS : D = ZERO - IX = 2 - SSIG = SIGN (1.D0, R) - S = SSIG*(ABS(R))**EXPON - X(1) = 2.D0*S - EXPON*A1 - X(2) = -S - EXPON*A1 -C -C D > 0, ONE REAL ROOT -C - ELSE ! D > EPS : D > ZERO - IX = 1 - SQD = SQRT(D) - SSIG = SIGN (1.D0, R+SQD) ! TRANSFER SIGN TO SSIG - TSIG = SIGN (1.D0, R-SQD) - S = SSIG*(ABS(R+SQD))**EXPON ! EXPONENTIATE ABS() - T = TSIG*(ABS(R-SQD))**EXPON - X(1) = S + T - EXPON*A1 - ENDIF - ENDIF -C -C *** SELECT APPROPRIATE ROOT ***************************************** -C - ROOT = 1.D30 - DO 10 I=1,IX - IF (X(I).GT.ZERO) THEN - ROOT = MIN (ROOT, X(I)) - ISLV = 0 - ENDIF -10 CONTINUE -C -C *** END OF SUBROUTINE POLY3 ***************************************** -C - RETURN - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE POLY3B -C *** FINDS A REAL ROOT OF THE THIRD ORDER ALGEBRAIC EQUATION: -C X**3 + A1*X**2 + A2*X + A3 = 0.0 -C THE EQUATION IS SOLVED NUMERICALLY (BISECTION). -C -C PARAMETERS A1, A2, A3 ARE SPECIFIED BY THE USER. THE MINIMUM -C NONEGATIVE ROOT IS RETURNED IN VARIABLE 'ROOT'. IF NO ROOT IS -C FOUND (WHICH IS GREATER THAN ZERO), ROOT HAS THE VALUE 1D30. -C AND THE FLAG ISLV HAS A VALUE GREATER THAN ZERO. -C -C RTLW, RTHI DEFINE THE INTERVAL WHICH THE ROOT IS LOOKED FOR. -C -C======================================================================= -C - SUBROUTINE POLY3B (A1, A2, A3, RTLW, RTHI, ROOT, ISLV) -C - IMPLICIT DOUBLE PRECISION (A-H, O-Z) - PARAMETER (ZERO=0.D0, EPS=1D-15, MAXIT=100, NDIV=5) -C - FUNC(X) = X**3.d0 + A1*X**2.0 + A2*X + A3 -C -C *** INITIAL VALUES FOR BISECTION ************************************* -C - X1 = RTLW - Y1 = FUNC(X1) - IF (ABS(Y1).LE.EPS) THEN ! Is low a root? - ROOT = RTLW - GOTO 50 - ENDIF -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO *********************** -C - DX = (RTHI-RTLW)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNC (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2) .LT. ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - IF (ABS(Y2) .LT. EPS) THEN ! X2 is a root - ROOT = X2 - ELSE - ROOT = 1.d30 - ISLV = 1 - ENDIF - GOTO 50 -C -C *** BISECTION ******************************************************* -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNC (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE -C -C *** CONVERGED ; RETURN *********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNC (X3) - ROOT = X3 - ISLV = 0 -C -50 RETURN -C -C *** END OF SUBROUTINE POLY3B ***************************************** -C - END - - - -ccc PROGRAM DRIVER -ccc DOUBLE PRECISION ROOT -cccC -ccc CALL POLY3 (-1.d0, 1.d0, -1.d0, ROOT, ISLV) -ccc IF (ISLV.NE.0) STOP 'Error in POLY3' -ccc WRITE (*,*) 'Root=', ROOT -cccC -ccc CALL POLY3B (-1.d0, 1.d0, -1.d0, -10.d0, 10.d0, ROOT, ISLV) -ccc IF (ISLV.NE.0) STOP 'Error in POLY3B' -ccc WRITE (*,*) 'Root=', ROOT -cccC -ccc END -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION EX10 -C *** 10^X FUNCTION ; ALTERNATE OF LIBRARY ROUTINE ; USED BECAUSE IT IS -C MUCH FASTER BUT WITHOUT GREAT LOSS IN ACCURACY. , -C MAXIMUM ERROR IS 2%, EXECUTION TIME IS 42% OF THE LIBRARY ROUTINE -C (ON A 80286/80287 MACHINE, using Lahey FORTRAN 77 v.3.0). -C -C EXPONENT RANGE IS BETWEEN -K AND K (K IS THE REAL ARGUMENT 'K') -C MAX VALUE FOR K: 9.999 -C IF X < -K, X IS SET TO -K, IF X > K, X IS SET TO K -C -C THE EXPONENT IS CALCULATED BY THE PRODUCT ADEC*AINT, WHERE ADEC -C IS THE MANTISSA AND AINT IS THE MAGNITUDE (EXPONENT). BOTH -C MANTISSA AND MAGNITUDE ARE PRE-CALCULATED AND STORED IN LOOKUP -C TABLES ; THIS LEADS TO THE INCREASED SPEED. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - FUNCTION EX10(X,K) - REAL X, EX10, Y, AINT10, ADEC10, K - INTEGER K1, K2 - COMMON /EXPNC/ AINT10(20), ADEC10(200) -C -C *** LIMIT X TO [-K, K] RANGE ***************************************** -C - Y = MAX(-K, MIN(X,K)) ! MIN: -9.999, MAX: 9.999 -C -C *** GET INTEGER AND DECIMAL PART ************************************* -C - K1 = INT(Y) - K2 = INT(100*(Y-K1)) -C -C *** CALCULATE EXP FUNCTION ******************************************* -C - EX10 = AINT10(K1+10)*ADEC10(K2+100) -C -C *** END OF EXP FUNCTION ********************************************** -C - RETURN - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** BLOCK DATA EXPON -C *** CONTAINS DATA FOR EXPONENT ARRAYS NEEDED IN FUNCTION EXP10 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - BLOCK DATA EXPON -C -C *** Common block definition -C - REAL AINT10, ADEC10 - COMMON /EXPNC/ AINT10(20), ADEC10(200) -C -C *** Integer part -C - DATA AINT10/ - & 0.1000E-08, 0.1000E-07, 0.1000E-06, 0.1000E-05, 0.1000E-04, - & 0.1000E-03, 0.1000E-02, 0.1000E-01, 0.1000E+00, 0.1000E+01, - & 0.1000E+02, 0.1000E+03, 0.1000E+04, 0.1000E+05, 0.1000E+06, - & 0.1000E+07, 0.1000E+08, 0.1000E+09, 0.1000E+10, 0.1000E+11 - & / -C -C *** decimal part -C - DATA (ADEC10(I),I=1,100)/ - & 0.1023E+00, 0.1047E+00, 0.1072E+00, 0.1096E+00, 0.1122E+00, - & 0.1148E+00, 0.1175E+00, 0.1202E+00, 0.1230E+00, 0.1259E+00, - & 0.1288E+00, 0.1318E+00, 0.1349E+00, 0.1380E+00, 0.1413E+00, - & 0.1445E+00, 0.1479E+00, 0.1514E+00, 0.1549E+00, 0.1585E+00, - & 0.1622E+00, 0.1660E+00, 0.1698E+00, 0.1738E+00, 0.1778E+00, - & 0.1820E+00, 0.1862E+00, 0.1905E+00, 0.1950E+00, 0.1995E+00, - & 0.2042E+00, 0.2089E+00, 0.2138E+00, 0.2188E+00, 0.2239E+00, - & 0.2291E+00, 0.2344E+00, 0.2399E+00, 0.2455E+00, 0.2512E+00, - & 0.2570E+00, 0.2630E+00, 0.2692E+00, 0.2754E+00, 0.2818E+00, - & 0.2884E+00, 0.2951E+00, 0.3020E+00, 0.3090E+00, 0.3162E+00, - & 0.3236E+00, 0.3311E+00, 0.3388E+00, 0.3467E+00, 0.3548E+00, - & 0.3631E+00, 0.3715E+00, 0.3802E+00, 0.3890E+00, 0.3981E+00, - & 0.4074E+00, 0.4169E+00, 0.4266E+00, 0.4365E+00, 0.4467E+00, - & 0.4571E+00, 0.4677E+00, 0.4786E+00, 0.4898E+00, 0.5012E+00, - & 0.5129E+00, 0.5248E+00, 0.5370E+00, 0.5495E+00, 0.5623E+00, - & 0.5754E+00, 0.5888E+00, 0.6026E+00, 0.6166E+00, 0.6310E+00, - & 0.6457E+00, 0.6607E+00, 0.6761E+00, 0.6918E+00, 0.7079E+00, - & 0.7244E+00, 0.7413E+00, 0.7586E+00, 0.7762E+00, 0.7943E+00, - & 0.8128E+00, 0.8318E+00, 0.8511E+00, 0.8710E+00, 0.8913E+00, - & 0.9120E+00, 0.9333E+00, 0.9550E+00, 0.9772E+00, 0.1000E+01/ - - DATA (ADEC10(I),I=101,200)/ - & 0.1023E+01, 0.1047E+01, 0.1072E+01, 0.1096E+01, 0.1122E+01, - & 0.1148E+01, 0.1175E+01, 0.1202E+01, 0.1230E+01, 0.1259E+01, - & 0.1288E+01, 0.1318E+01, 0.1349E+01, 0.1380E+01, 0.1413E+01, - & 0.1445E+01, 0.1479E+01, 0.1514E+01, 0.1549E+01, 0.1585E+01, - & 0.1622E+01, 0.1660E+01, 0.1698E+01, 0.1738E+01, 0.1778E+01, - & 0.1820E+01, 0.1862E+01, 0.1905E+01, 0.1950E+01, 0.1995E+01, - & 0.2042E+01, 0.2089E+01, 0.2138E+01, 0.2188E+01, 0.2239E+01, - & 0.2291E+01, 0.2344E+01, 0.2399E+01, 0.2455E+01, 0.2512E+01, - & 0.2570E+01, 0.2630E+01, 0.2692E+01, 0.2754E+01, 0.2818E+01, - & 0.2884E+01, 0.2951E+01, 0.3020E+01, 0.3090E+01, 0.3162E+01, - & 0.3236E+01, 0.3311E+01, 0.3388E+01, 0.3467E+01, 0.3548E+01, - & 0.3631E+01, 0.3715E+01, 0.3802E+01, 0.3890E+01, 0.3981E+01, - & 0.4074E+01, 0.4169E+01, 0.4266E+01, 0.4365E+01, 0.4467E+01, - & 0.4571E+01, 0.4677E+01, 0.4786E+01, 0.4898E+01, 0.5012E+01, - & 0.5129E+01, 0.5248E+01, 0.5370E+01, 0.5495E+01, 0.5623E+01, - & 0.5754E+01, 0.5888E+01, 0.6026E+01, 0.6166E+01, 0.6310E+01, - & 0.6457E+01, 0.6607E+01, 0.6761E+01, 0.6918E+01, 0.7079E+01, - & 0.7244E+01, 0.7413E+01, 0.7586E+01, 0.7762E+01, 0.7943E+01, - & 0.8128E+01, 0.8318E+01, 0.8511E+01, 0.8710E+01, 0.8913E+01, - & 0.9120E+01, 0.9333E+01, 0.9550E+01, 0.9772E+01, 0.1000E+02 - & / -C -C *** END OF BLOCK DATA EXPON ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE PUSHERR -C *** THIS SUBROUTINE SAVES AN ERROR MESSAGE IN THE ERROR STACK -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE PUSHERR (IERR,ERRINF) - INCLUDE 'isrpia.inc' - CHARACTER ERRINF*(*) -C -C *** SAVE ERROR CODE IF THERE IS ANY SPACE *************************** -C - IF (NOFER.LT.NERRMX) THEN - NOFER = NOFER + 1 - ERRSTK(NOFER) = IERR - ERRMSG(NOFER) = ERRINF - STKOFL =.FALSE. - ELSE - STKOFL =.TRUE. ! STACK OVERFLOW - ENDIF -C -C *** END OF SUBROUTINE PUSHERR **************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISERRINF -C *** THIS SUBROUTINE OBTAINS A COPY OF THE ERROR STACK (& MESSAGES) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISERRINF (ERRSTKI, ERRMSGI, NOFERI, STKOFLI) - INCLUDE 'isrpia.inc' - CHARACTER ERRMSGI*40 - INTEGER ERRSTKI - LOGICAL STKOFLI - DIMENSION ERRMSGI(NERRMX), ERRSTKI(NERRMX) -C -C *** OBTAIN WHOLE ERROR STACK **************************************** -C - DO 10 I=1,NOFER ! Error messages & codes - ERRSTKI(I) = ERRSTK(I) - ERRMSGI(I) = ERRMSG(I) - 10 CONTINUE -C - STKOFLI = STKOFL - NOFERI = NOFER -C - RETURN -C -C *** END OF SUBROUTINE ISERRINF *************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ERRSTAT -C *** THIS SUBROUTINE REPORTS ERROR MESSAGES TO UNIT 'IO' -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ERRSTAT (IO,IERR,ERRINF) - INCLUDE 'isrpia.inc' - CHARACTER CER*4, NCIS*29, NCIF*27, NSIS*26, NSIF*24, ERRINF*(*) - DATA NCIS /'NO CONVERGENCE IN SUBROUTINE '/, - & NCIF /'NO CONVERGENCE IN FUNCTION ' /, - & NSIS /'NO SOLUTION IN SUBROUTINE ' /, - & NSIF /'NO SOLUTION IN FUNCTION ' / -C -C *** WRITE ERROR IN CHARACTER ***************************************** -C - WRITE (CER,'(I4)') IERR - CALL RPLSTR (CER, ' ', '0',IOK) ! REPLACE BLANKS WITH ZEROS - CALL CHRBLN (ERRINF, IEND) ! LAST POSITION OF ERRINF CHAR -C -C *** WRITE ERROR TYPE (FATAL, WARNING ) ******************************* -C - IF (IERR.EQ.0) THEN - WRITE (IO,1000) 'NO ERRORS DETECTED ' - GOTO 10 -C - ELSE IF (IERR.LT.0) THEN - WRITE (IO,1000) 'ERROR STACK EXHAUSTED ' - GOTO 10 -C - ELSE IF (IERR.GT.1000) THEN - WRITE (IO,1100) 'FATAL',CER -C - ELSE - WRITE (IO,1100) 'WARNING',CER - ENDIF -C -C *** WRITE ERROR MESSAGE ********************************************** -C -C FATAL MESSAGES -C - IF (IERR.EQ.1001) THEN - CALL CHRBLN (SCASE, IEND) - WRITE (IO,1000) 'CASE NOT SUPPORTED IN CALCMR ['//SCASE(1:IEND) - & //']' -C - ELSEIF (IERR.EQ.1002) THEN - CALL CHRBLN (SCASE, IEND) - WRITE (IO,1000) 'CASE NOT SUPPORTED ['//SCASE(1:IEND)//']' -C -C WARNING MESSAGES -C - ELSEIF (IERR.EQ.0001) THEN - WRITE (IO,1000) NSIS,ERRINF -C - ELSEIF (IERR.EQ.0002) THEN - WRITE (IO,1000) NCIS,ERRINF -C - ELSEIF (IERR.EQ.0003) THEN - WRITE (IO,1000) NSIF,ERRINF -C - ELSEIF (IERR.EQ.0004) THEN - WRITE (IO,1000) NCIF,ERRINF -C - ELSE IF (IERR.EQ.0019) THEN - WRITE (IO,1000) 'HNO3(aq) AFFECTS H+, WHICH '// - & 'MIGHT AFFECT SO4/HSO4 RATIO' - WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %' -C - ELSE IF (IERR.EQ.0020) THEN - IF (W(4).GT.TINY .AND. W(5).GT.TINY) THEN - WRITE (IO,1000) 'HSO4-SO4 EQUILIBRIUM MIGHT AFFECT HNO3,' - & //'HCL DISSOLUTION' - ELSE - WRITE (IO,1000) 'HSO4-SO4 EQUILIBRIUM MIGHT AFFECT NH3 ' - & //'DISSOLUTION' - ENDIF - WRITE (IO,1000) 'DIRECT DECREASE IN H+ [',ERRINF(1:IEND),'] %' -C - ELSE IF (IERR.EQ.0021) THEN - WRITE (IO,1000) 'HNO3(aq),HCL(aq) AFFECT H+, WHICH '// - & 'MIGHT AFFECT SO4/HSO4 RATIO' - WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %' -C - ELSE IF (IERR.EQ.0022) THEN - WRITE (IO,1000) 'HCL(g) EQUILIBRIUM YIELDS NONPHYSICAL '// - & 'DISSOLUTION' - WRITE (IO,1000) 'A TINY AMOUNT [',ERRINF(1:IEND),'] IS '// - & 'ASSUMED TO BE DISSOLVED' -C - ELSEIF (IERR.EQ.0033) THEN - WRITE (IO,1000) 'HCL(aq) AFFECTS H+, WHICH '// - & 'MIGHT AFFECT SO4/HSO4 RATIO' - WRITE (IO,1000) 'DIRECT INCREASE IN H+ [',ERRINF(1:IEND),'] %' -C - ELSEIF (IERR.EQ.0050) THEN - WRITE (IO,1000) 'TOO MUCH SODIUM GIVEN AS INPUT.' - WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.' - WRITE (IO,1000) 'EXCESS SODIUM IS IGNORED.' -C - ELSEIF (IERR.EQ.0051) THEN - WRITE (IO,1000) 'TOO MUCH CALCIUM GIVEN AS INPUT.' - WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.' - WRITE (IO,1000) 'EXCESS CALCIUM IS IGNORED.' -C - ELSEIF (IERR.EQ.0052) THEN - WRITE (IO,1000) 'TOO MUCH SODIUM (+Ca) GIVEN AS INPUT.' - WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.' - WRITE (IO,1000) 'EXCESS SODIUM IS IGNORED.' -C - ELSEIF (IERR.EQ.0053) THEN - WRITE (IO,1000) 'TOO MUCH MAGNESIUM (+Ca,Na) GIVEN AS INPUT.' - WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.' - WRITE (IO,1000) 'EXCESS MAGNESIUM IS IGNORED.' -C - ELSEIF (IERR.EQ.0054) THEN - WRITE (IO,1000) 'TOO MUCH POTASSIUM(+Ca,Na,Mg) GIVEN AS INPUT.' - WRITE (IO,1000) 'REDUCED TO COMPLETELY NEUTRALIZE SO4,Cl,NO3.' - WRITE (IO,1000) 'EXCESS POTASSIUM IS IGNORED.' -C - ELSE - WRITE (IO,1000) 'NO DIAGNOSTIC MESSAGE AVAILABLE' - ENDIF -C -10 RETURN -C -C *** FORMAT STATEMENTS ************************************* -C -1000 FORMAT (1X,A:A:A:A:A) -1100 FORMAT (1X,A,' ERROR [',A4,']:') -C -C *** END OF SUBROUTINE ERRSTAT ***************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISORINF -C *** THIS SUBROUTINE PROVIDES INFORMATION ABOUT ISORROPIA -C -C ======================== ARGUMENTS / USAGE =========================== -C -C OUTPUT: -C 1. [VERSI] -C CHARACTER*15 variable. -C Contains version-date information of ISORROPIA -C -C 2. [NCMP] -C INTEGER variable. -C The number of components needed in input array WI -C (or, the number of major species accounted for by ISORROPIA) -C -C 3. [NION] -C INTEGER variable -C The number of ions considered in the aqueous phase -C -C 4. [NAQGAS] -C INTEGER variable -C The number of undissociated species found in aqueous aerosol -C phase -C -C 5. [NSOL] -C INTEGER variable -C The number of solids considered in the solid aerosol phase -C -C 6. [NERR] -C INTEGER variable -C The size of the error stack (maximum number of errors that can -C be stored before the stack exhausts). -C -C 7. [TIN] -C DOUBLE PRECISION variable -C The value used for a very small number. -C -C 8. [GRT] -C DOUBLE PRECISION variable -C The value used for a very large number. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISORINF (VERSI, NCMP, NION, NAQGAS, NSOL, NERR, TIN, - & GRT) - INCLUDE 'isrpia.inc' - CHARACTER VERSI*(*) -C -C *** ASSIGN INFO ******************************************************* -C - VERSI = VERSION - NCMP = NCOMP - NION = NIONS - NAQGAS = NGASAQ - NSOL = NSLDS - NERR = NERRMX - TIN = TINY - GRT = GREAT -C - RETURN -C -C *** END OF SUBROUTINE ISORINF ******************************************* -C - END diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_isofwd2.F b/MATRIXchem_GridComp/microphysics/TRAMP_isofwd2.F deleted file mode 100644 index cfec6dba..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_isofwd2.F +++ /dev/null @@ -1,18710 +0,0 @@ -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP1F -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE FOREWARD PROBLEM OF -C AN AMMONIUM-SULFATE AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE RATIO AND BY -C THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISRP1F (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) -C -C *** INITIALIZE ALL VARIABLES IN COMMON BLOCK ************************** -C - CALL INIT1 (WI, RHI, TEMPI) -C -C *** CALCULATE SULFATE RATIO ******************************************* -C - SULRAT = W(3)/W(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR -C - IF (2.0.LE.SULRAT) THEN - DC = W(3) - 2.001D0*W(2) ! For numerical stability - W(3) = W(3) + MAX(-DC, ZERO) -C - IF(METSTBL.EQ.1) THEN - SCASE = 'A2' - CALL CALCA2 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH42S4) THEN - SCASE = 'A1' - CALL CALCA1 ! NH42SO4 ; case A1 -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'A2' - CALL CALCA2 ! Only liquid ; case A2 - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'B1' - CALL CALCB1 ! NH4HSO4,LC,NH42SO4 ; case B1 -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'B2' - CALL CALCB2 ! LC,NH42S4 ; case B2 -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'B3' - CALL CALCB3 ! NH42S4 ; case B3 -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid ; case B4 - ENDIF - ENDIF - CALL CALCNH3 -C -C *** SULFATE RICH (FREE ACID) -C - ELSEIF (SULRAT.LT.1.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'C1' - CALL CALCC1 ! NH4HSO4 ; case C1 -C - ELSEIF (DRNH4HS4.LE.RH) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid ; case C2 -C - ENDIF - ENDIF - CALL CALCNH3 - ENDIF -C -C *** RETURN POINT -C - RETURN -C -C *** END OF SUBROUTINE ISRP1F ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP2F -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE FOREWARD PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE RATIO AND BY -C THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISRP2F (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) -C -C *** INITIALIZE ALL VARIABLES IN COMMON BLOCK ************************** -C - CALL INIT2 (WI, RHI, TEMPI) -C -C *** CALCULATE SULFATE RATIO ******************************************* -C - SULRAT = W(3)/W(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR -C - IF (2.0.LE.SULRAT) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'D3' - CALL CALCD3 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'D1' - CALL CALCD1 ! NH42SO4,NH4NO3 ; case D1 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'D2' - CALL CALCD2 ! NH42S4 ; case D2 -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'D3' - CALL CALCD3 ! Only liquid ; case D3 - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C FOR SOLVING THIS CASE, NITRIC ACID IS ASSUMED A MINOR SPECIES, -C THAT DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM. -C SUBROUTINES CALCB? ARE CALLED, AND THEN THE NITRIC ACID IS DISSOLVED -C FROM THE HNO3(G) -> (H+) + (NO3-) EQUILIBRIUM. -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid (metastable) - SCASE = 'E4' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'B1' - CALL CALCB1 ! NH4HSO4,LC,NH42SO4 ; case E1 - SCASE = 'E1' -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'B2' - CALL CALCB2 ! LC,NH42S4 ; case E2 - SCASE = 'E2' -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'B3' - CALL CALCB3 ! NH42S4 ; case E3 - SCASE = 'E3' -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid ; case E4 - SCASE = 'E4' - ENDIF - ENDIF -C - CALL CALCNA ! HNO3(g) DISSOLUTION -C -C *** SULFATE RICH (FREE ACID) -C FOR SOLVING THIS CASE, NITRIC ACID IS ASSUMED A MINOR SPECIES, -C THAT DOES NOT SIGNIFICANTLY PERTURB THE HSO4-SO4 EQUILIBRIUM -C SUBROUTINE CALCC? IS CALLED, AND THEN THE NITRIC ACID IS DISSOLVED -C FROM THE HNO3(G) -> (H+) + (NO3-) EQUILIBRIUM. -C - ELSEIF (SULRAT.LT.1.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid (metastable) - SCASE = 'F2' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'C1' - CALL CALCC1 ! NH4HSO4 ; case F1 - SCASE = 'F1' -C - ELSEIF (DRNH4HS4.LE.RH) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid ; case F2 - SCASE = 'F2' - ENDIF - ENDIF -C - CALL CALCNA ! HNO3(g) DISSOLUTION - ENDIF -C -C *** RETURN POINT -C - RETURN -C -C *** END OF SUBROUTINE ISRP2F ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP3F -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE FORWARD PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE & SODIUM -C RATIOS AND BY THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE ISRP3F (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) -C -C *** ADJUST FOR TOO LITTLE AMMONIUM AND CHLORIDE *********************** -C - WI(3) = MAX (WI(3), 1.D-10) ! NH4+ : 1e-4 umoles/m3 - WI(5) = MAX (WI(5), 1.D-10) ! Cl- : 1e-4 umoles/m3 -C -C *** ADJUST FOR TOO LITTLE SODIUM, SULFATE AND NITRATE COMBINED ******** -C - IF (WI(1)+WI(2)+WI(4) .LE. 1d-10) THEN - WI(1) = 1.D-10 ! Na+ : 1e-4 umoles/m3 - WI(2) = 1.D-10 ! SO4- : 1e-4 umoles/m3 - ENDIF -C -C *** INITIALIZE ALL VARIABLES IN COMMON BLOCK ************************** -C - CALL ISOINIT3 (WI, RHI, TEMPI) -C -C *** CHECK IF TOO MUCH SODIUM ; ADJUST AND ISSUE ERROR MESSAGE ********* -C - REST = 2.D0*W(2) + W(4) + W(5) - IF (W(1).GT.REST) THEN ! NA > 2*SO4+CL+NO3 ? - W(1) = (ONE-1D-6)*REST ! Adjust Na amount - CALL PUSHERR (0050, 'ISRP3F') ! Warning error: Na adjusted - ENDIF -C -C *** CALCULATE SULFATE & SODIUM RATIOS ********************************* -C - SULRAT = (W(1)+W(3))/W(2) - SODRAT = W(1)/W(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** - -C *** SULFATE POOR ; SODIUM POOR -C - IF (2.0.LE.SULRAT .AND. SODRAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'G5' - CALL CALCG5 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'G1' - CALL CALCG1 ! NH42SO4,NH4NO3,NH4CL,NA2SO4 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'G2' - CALL CALCG2 ! NH42SO4,NH4CL,NA2SO4 -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'G3' - CALL CALCG3 ! NH42SO4,NA2SO4 -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'G4' - CALL CALCG4 ! NA2SO4 -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'G5' - CALL CALCG5 ! Only liquid - ENDIF - ENDIF -C -C *** SULFATE POOR ; SODIUM RICH -C - ELSE IF (SULRAT.GE.2.0 .AND. SODRAT.GE.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'H6' - CALL CALCH6 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'H1' - CALL CALCH1 ! NH4NO3,NH4CL,NA2SO4,NACL,NANO3 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'H2' - CALL CALCH2 ! NH4CL,NA2SO4,NACL,NANO3 -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'H3' - CALL CALCH3 ! NH4CL,NA2SO4,NACL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4Cl) THEN - SCASE = 'H4' - CALL CALCH4 ! NH4CL,NA2SO4 -C - ELSEIF (DRNH4Cl.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'H5' - CALL CALCH5 ! NA2SO4 -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'H6' - CALL CALCH6 ! NO SOLID - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'I6' - CALL CALCI6 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'I1' - CALL CALCI1 ! NA2SO4,(NH4)2SO4,NAHSO4,NH4HSO4,LC -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRNAHSO4) THEN - SCASE = 'I2' - CALL CALCI2 ! NA2SO4,(NH4)2SO4,NAHSO4,LC -C - ELSEIF (DRNAHSO4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'I3' - CALL CALCI3 ! NA2SO4,(NH4)2SO4,LC -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'I4' - CALL CALCI4 ! NA2SO4,(NH4)2SO4 -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'I5' - CALL CALCI5 ! NA2SO4 -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'I6' - CALL CALCI6 ! NO SOLIDS - ENDIF - ENDIF -C - CALL CALCNHA ! MINOR SPECIES: HNO3, HCl - CALL CALCNH3 ! NH3 -C -C *** SULFATE RICH (FREE ACID) -C - ELSEIF (SULRAT.LT.1.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'J3' - CALL CALCJ3 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'J1' - CALL CALCJ1 ! NH4HSO4,NAHSO4 -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRNAHSO4) THEN - SCASE = 'J2' - CALL CALCJ2 ! NAHSO4 -C - ELSEIF (DRNAHSO4.LE.RH) THEN - SCASE = 'J3' - CALL CALCJ3 - ENDIF - ENDIF -C - CALL CALCNHA ! MINOR SPECIES: HNO3, HCl - CALL CALCNH3 ! NH3 - ENDIF -C -C *** RETURN POINT -C - RETURN -C -C *** END OF SUBROUTINE ISRP3F ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE ISRP4F -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE FORWARD PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM-CALCIUM-POTASSIUM-MAGNESIUM -C AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE & SODIUM -C RATIOS AND BY THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE ISRP4F (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - DOUBLE PRECISION NAFRI, NO3FRI -C -C *** ADJUST FOR TOO LITTLE AMMONIUM AND CHLORIDE *********************** -C -C WI(3) = MAX (WI(3), 1.D-10) ! NH4+ : 1e-4 umoles/m3 -C WI(5) = MAX (WI(5), 1.D-10) ! Cl- : 1e-4 umoles/m3 -C -C *** ADJUST FOR TOO LITTLE SODIUM, SULFATE AND NITRATE COMBINED ******** -C -C IF (WI(1)+WI(2)+WI(4) .LE. 1d-10) THEN -C WI(1) = 1.D-10 ! Na+ : 1e-4 umoles/m3 -C WI(2) = 1.D-10 ! SO4- : 1e-4 umoles/m3 -C ENDIF -C -C *** INITIALIZE ALL VARIABLES IN COMMON BLOCK ************************** -C - CALL INIT4 (WI, RHI, TEMPI) -C -C *** CHECK IF TOO MUCH SODIUM+CRUSTALS ; ADJUST AND ISSUE ERROR MESSAGE -C - REST = 2.D0*W(2) + W(4) + W(5) -C - IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -C - CCASO4I = MIN (W(2),W(6)) - FRSO4I = MAX (W(2) - CCASO4I, ZERO) - CAFRI = MAX (W(6) - CCASO4I, ZERO) - CCANO32I = MIN (CAFRI, 0.5D0*W(4)) - CAFRI = MAX (CAFRI - CCANO32I, ZERO) - NO3FRI = MAX (W(4) - 2.D0*CCANO32I, ZERO) - CCACL2I = MIN (CAFRI, 0.5D0*W(5)) - CLFRI = MAX (W(5) - 2.D0*CCACL2I, ZERO) - REST1 = 2.D0*FRSO4I + NO3FRI + CLFRI -C - CNA2SO4I = MIN (FRSO4I, 0.5D0*W(1)) - FRSO4I = MAX (FRSO4I - CNA2SO4I, ZERO) - NAFRI = MAX (W(1) - 2.D0*CNA2SO4I, ZERO) - CNACLI = MIN (NAFRI, CLFRI) - NAFRI = MAX (NAFRI - CNACLI, ZERO) - CLFRI = MAX (CLFRI - CNACLI, ZERO) - CNANO3I = MIN (NAFRI, NO3FRI) - NO3FR = MAX (NO3FRI - CNANO3I, ZERO) - REST2 = 2.D0*FRSO4I + NO3FRI + CLFRI -C - CMGSO4I = MIN (FRSO4I, W(8)) - FRMGI = MAX (W(8) - CMGSO4I, ZERO) - FRSO4I = MAX (FRSO4I - CMGSO4I, ZERO) - CMGNO32I = MIN (FRMGI, 0.5D0*NO3FRI) - FRMGI = MAX (FRMGI - CMGNO32I, ZERO) - NO3FRI = MAX (NO3FRI - 2.D0*CMGNO32I, ZERO) - CMGCL2I = MIN (FRMGI, 0.5D0*CLFRI) - CLFRI = MAX (CLFRI - 2.D0*CMGCL2I, ZERO) - REST3 = 2.D0*FRSO4I + NO3FRI + CLFRI -C - IF (W(6).GT.REST) THEN ! Ca > 2*SO4+CL+NO3 ? - W(6) = (ONE-1D-6)*REST ! Adjust Ca amount - W(1)= ZERO ! Adjust Na amount - W(7)= ZERO ! Adjust K amount - W(8)= ZERO ! Adjust Mg amount - CALL PUSHERR (0051, 'ISRP4F') ! Warning error: Ca, Na, K, Mg in excess -C - ELSE IF (W(1).GT.REST1) THEN ! Na > 2*FRSO4+FRCL+FRNO3 ? - W(1) = (ONE-1D-6)*REST1 ! Adjust Na amount - W(7)= ZERO ! Adjust K amount - W(8)= ZERO ! Adjust Mg amount - CALL PUSHERR (0052, 'ISRP4F') ! Warning error: Na, K, Mg in excess -C - ELSE IF (W(8).GT.REST2) THEN ! Mg > 2*FRSO4+FRCL+FRNO3 ? - W(8) = (ONE-1D-6)*REST2 ! Adjust Mg amount - W(7)= ZERO ! Adjust K amount - CALL PUSHERR (0053, 'ISRP4F') ! Warning error: K, Mg in excess -C - ELSE IF (W(7).GT.REST3) THEN ! K > 2*FRSO4+FRCL+FRNO3 ? - W(7) = (ONE-1D-6)*REST3 ! Adjust K amount - CALL PUSHERR (0054, 'ISRP4F') ! Warning error: K in excess - ENDIF - ENDIF -C -C *** CALCULATE RATIOS ************************************************* -C - SO4RAT = (W(1)+W(3)+W(6)+W(7)+W(8))/W(2) - CRNARAT = (W(1)+W(6)+W(7)+W(8))/W(2) - CRRAT = (W(6)+W(7)+W(8))/W(2) -C -C *** FIND CALCULATION REGIME FROM (SO4RAT, CRNARAT, CRRAT, RRH) ******** -C -C *** SULFATE POOR: Rso4>2; (DUST + SODIUM) POOR: R(Cr+Na)<2 -C - IF (2.0.LE.SO4RAT .AND. CRNARAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'O7' - CALL CALCO7 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'O1' - CALL CALCO1 ! CaSO4, NH4NO3, NH4CL, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'O2' - CALL CALCO2 ! CaSO4, NH4CL, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'O3' - CALL CALCO3 ! CaSO4, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'O4' - CALL CALCO4 ! CaSO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'O5' - CALL CALCO5 ! CaSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNA2SO4.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'O6' - CALL CALCO6 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'O7' - CALL CALCO7 ! CaSO4 - ENDIF - ENDIF -C -C *** SULFATE POOR: Rso4>2; (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C - ELSEIF (SO4RAT.GE.2.0 .AND. CRNARAT.GE.2.0) THEN -C - IF (CRRAT.LE.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'M8' - CALL CALCM8 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'M1' - CALL CALCM1 ! CaSO4, NH4NO3, NH4CL, MGSO4, NA2SO4, K2SO4, NACL, NANO3 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'M2' - CALL CALCM2 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4, NACL, NANO3 -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'M3' - CALL CALCM3 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4, NACL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4Cl) THEN - SCASE = 'M4' - CALL CALCM4 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4Cl.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'M5' - CALL CALCM5 ! CaSO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'M6' - CALL CALCM6 ! CaSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNA2SO4.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'M7' - CALL CALCM7 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'M8' - CALL CALCM8 ! CaSO4 - ENDIF - ENDIF -C CALL CALCHCO3 -C -C *** SULFATE POOR: Rso4>2; (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C - ELSEIF (CRRAT.GT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'P13' - CALL CALCP13 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRCACL2) THEN - SCASE = 'P1' - CALL CALCP1 ! CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRCACL2.LE.RH .AND. RH.LT.DRMGCL2) THEN - SCASE = 'P2' - CALL CALCP2 ! CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRMGCL2.LE.RH .AND. RH.LT.DRCANO32) THEN - SCASE = 'P3' - CALL CALCP3 ! CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRCANO32.LE.RH .AND. RH.LT.DRMGNO32) THEN - SCASE = 'P4' - CALL CALCP4 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRMGNO32.LE.RH .AND. RH.LT.DRNH4NO3) THEN - SCASE = 'P5' - CALL CALCP5 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, -C ! NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'P6' - CALL CALCP6 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NANO3, NACL, NH4CL -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'P7' - CALL CALCP7 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NACL, NH4CL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'P8' - CALL CALCP8 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NH4CL -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRKCL) THEN - SCASE = 'P9' - CALL CALCP9 ! CaSO4, K2SO4, KNO3, KCL, MGSO4 -C - ELSEIF (DRKCL.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'P10' - CALL CALCP10 ! CaSO4, K2SO4, KNO3, MGSO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRKNO3) THEN - SCASE = 'P11' - CALL CALCP11 ! CaSO4, K2SO4, KNO3 -C - ELSEIF (DRKNO3.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'P12' - CALL CALCP12 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'P13' - CALL CALCP13 ! CaSO4 - ENDIF - ENDIF -C CALL CALCHCO3 - ENDIF -C -C *** SULFATE RICH (NO ACID): 1= 2.0) -C 2. LIQUID AEROSOL PHASE ONLY POSSIBLE -C -C FOR CALCULATIONS, A BISECTION IS PERFORMED TOWARDS X, THE -C AMOUNT OF HYDROGEN IONS (H+) FOUND IN THE LIQUID PHASE. -C FOR EACH ESTIMATION OF H+, FUNCTION FUNCB2A CALCULATES THE -C CONCENTRATION OF IONS FROM THE NH3(GAS) - NH4+(LIQ) EQUILIBRIUM. -C ELECTRONEUTRALITY IS USED AS THE OBJECTIVE FUNCTION. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCA2 - INCLUDE 'isrpia.inc' -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - OMELO = TINY ! Low limit: SOLUTION IS VERY BASIC - OMEHI = 2.0D0*W(2) ! High limit: FROM NH4+ -> NH3(g) + H+(aq) -C -C *** CALCULATE WATER CONTENT ***************************************** -C - MOLAL(5) = W(2) - MOLAL(6) = ZERO - CALL CALCMR -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = OMEHI - Y1 = FUNCA2 (X1) - IF (ABS(Y1).LE.EPS) RETURN -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (OMEHI-OMELO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, OMELO) - Y2 = FUNCA2 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE - IF (ABS(Y2).LE.EPS) THEN - RETURN - ELSE - CALL PUSHERR (0001, 'CALCA2') ! WARNING ERROR: NO SOLUTION - RETURN - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCA2 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCA2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCA2 (X3) - RETURN -C -C *** END OF SUBROUTINE CALCA2 **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCA2 -C *** CASE A2 -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE A2 ; -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCA2. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCA2 (OMEGI) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - PSI = W(2) ! INITIAL AMOUNT OF (NH4)2SO4 IN SOLUTION -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A1 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - A2 = XK2*R*TEMP/XKW*(GAMA(8)/GAMA(9))**2. - A3 = XKW*RH*WATER*WATER -C - LAMDA = PSI/(A1/OMEGI+ONE) - ZETA = A3/OMEGI -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = OMEGI ! HI - MOLAL (5) = MAX(PSI-LAMDA,TINY) ! SO4I - MOLAL (3) = MAX(W(3)/(ONE/A2/OMEGI + ONE), 2.*MOLAL(5)) ! NH4I - MOLAL (6) = LAMDA ! HSO4I - GNH3 = MAX (W(3)-MOLAL(3), TINY) ! NH3GI - COH = ZETA ! OHI -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 DENOM = (2.0*MOLAL(5)+MOLAL(6)) - FUNCA2= (MOLAL(3)/DENOM - ONE) + MOLAL(1)/DENOM - RETURN -C -C *** END OF FUNCTION FUNCA2 ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCA1 -C *** CASE A1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4 -C -C A SIMPLE MATERIAL BALANCE IS PERFORMED, AND THE SOLID (NH4)2SO4 -C IS CALCULATED FROM THE SULFATES. THE EXCESS AMMONIA REMAINS IN -C THE GAS PHASE. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCA1 - INCLUDE 'isrpia.inc' -C - CNH42S4 = W(2) - GNH3 = MAX (W(3)-2.0*CNH42S4, ZERO) - RETURN -C -C *** END OF SUBROUTINE CALCA1 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB4 -C *** CASE B4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. LIQUID AEROSOL PHASE ONLY POSSIBLE -C -C FOR CALCULATIONS, A BISECTION IS PERFORMED WITH RESPECT TO H+. -C THE OBJECTIVE FUNCTION IS THE DIFFERENCE BETWEEN THE ESTIMATED H+ -C AND THAT CALCULATED FROM ELECTRONEUTRALITY. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB4 - INCLUDE 'isrpia.inc' -C -C *** SOLVE EQUATIONS ************************************************** -C - FRST = .TRUE. - CALAIN = .TRUE. - CALAOU = .TRUE. -C -C *** CALCULATE WATER CONTENT ****************************************** -C - CALL CALCB1A ! GET DRY SALT CONTENT, AND USE FOR WATER. - MOLALR(13) = CLC - MOLALR(9) = CNH4HS4 - MOLALR(4) = CNH42S4 - CLC = ZERO - CNH4HS4 = ZERO - CNH42S4 = ZERO - WATER = MOLALR(13)/M0(13)+MOLALR(9)/M0(9)+MOLALR(4)/M0(4) -C - MOLAL(3) = W(3) ! NH4I -C - DO 20 I=1,NSWEEP - AK1 = XK1*((GAMA(8)/GAMA(7))**2.)*(WATER/GAMA(7)) - BET = W(2) - GAM = MOLAL(3) -C - BB = BET + AK1 - GAM - CC =-AK1*BET - DD = BB*BB - 4.D0*CC -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (5) = MAX(TINY,MIN(0.5*(-BB + SQRT(DD)), W(2))) ! SO4I - MOLAL (6) = MAX(TINY,MIN(W(2)-MOLAL(5),W(2))) ! HSO4I - MOLAL (1) = MAX(TINY,MIN(AK1*MOLAL(6)/MOLAL(5),W(2))) ! HI - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (.NOT.CALAIN) GOTO 30 - CALL CALCACT -20 CONTINUE -C -30 RETURN -C -C *** END OF SUBROUTINE CALCB4 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB3 -C *** CASE B3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. BOTH LIQUID & SOLID PHASE IS POSSIBLE -C 3. SOLIDS POSSIBLE: (NH4)2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB3 - INCLUDE 'isrpia.inc' -C -C *** CALCULATE EQUIVALENT AMOUNT OF HSO4 AND SO4 *********************** -C - X = MAX(2*W(2)-W(3), ZERO) ! Equivalent NH4HSO4 - Y = MAX(W(3) -W(2), ZERO) ! Equivalent NH42SO4 -C -C *** CALCULATE SPECIES ACCORDING TO RELATIVE ABUNDANCE OF HSO4 ********* -C - IF (X.LT.Y) THEN ! LC is the MIN (x,y) - SCASE = 'B3 ; SUBCASE 1' - TLC = X - TNH42S4 = Y-X - CALL CALCB3A (TLC,TNH42S4) ! LC + (NH4)2SO4 - ELSE - SCASE = 'B3 ; SUBCASE 2' - TLC = Y - TNH4HS4 = X-Y - CALL CALCB3B (TLC,TNH4HS4) ! LC + NH4HSO4 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCB3 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB3A -C *** CASE B3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH (1.0 < SULRAT < 2.0) -C 2. BOTH LIQUID & SOLID PHASE IS POSSIBLE -C 3. SOLIDS POSSIBLE: (NH4)2SO4 -C -C FOR CALCULATIONS, A BISECTION IS PERFORMED TOWARDS ZETA, THE -C AMOUNT OF SOLID (NH4)2SO4 DISSOLVED IN THE LIQUID PHASE. -C FOR EACH ESTIMATION OF ZETA, FUNCTION FUNCB3A CALCULATES THE -C AMOUNT OF H+ PRODUCED (BASED ON THE SO4 RELEASED INTO THE -C SOLUTION). THE SOLUBILITY PRODUCT OF (NH4)2SO4 IS USED AS THE -C OBJECTIVE FUNCTION. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB3A (TLC, TNH42S4) - INCLUDE 'isrpia.inc' -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - ZLO = ZERO ! MIN DISSOLVED (NH4)2SO4 - ZHI = TNH42S4 ! MAX DISSOLVED (NH4)2SO4 -C -C *** INITIAL VALUES FOR BISECTION (DISSOLVED (NH4)2SO4 **************** -C - Z1 = ZLO - Y1 = FUNCB3A (Z1, TLC, TNH42S4) - IF (ABS(Y1).LE.EPS) RETURN - YLO= Y1 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO *********************** -C - DZ = (ZHI-ZLO)/FLOAT(NDIV) - DO 10 I=1,NDIV - Z2 = Z1+DZ - Y2 = FUNCB3A (Z2, TLC, TNH42S4) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - Z1 = Z2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YHI= Y1 ! Save Y-value at HI position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - RETURN -C -C *** { YLO, YHI } < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - Z1 = ZHI - Z2 = ZHI - GOTO 40 -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Z1 = ZLO - Z2 = ZLO - GOTO 40 - ELSE - CALL PUSHERR (0001, 'CALCB3A') ! WARNING ERROR: NO SOLUTION - RETURN - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - Z3 = 0.5*(Z1+Z2) - Y3 = FUNCB3A (Z3, TLC, TNH42S4) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - Z2 = Z3 - ELSE - Y1 = Y3 - Z1 = Z3 - ENDIF - IF (ABS(Z2-Z1) .LE. EPS*Z1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCB3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ************************************************ -C -40 ZK = 0.5*(Z1+Z2) - Y3 = FUNCB3A (ZK, TLC, TNH42S4) -C - RETURN -C -C *** END OF SUBROUTINE CALCB3A ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCB3A -C *** CASE B3 ; SUBCASE 1 -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE B3 -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCA3. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCB3A (ZK, Y, X) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KK -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - FRST = .TRUE. - CALAIN = .TRUE. - DO 20 I=1,NSWEEP - GRAT1 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - DD = SQRT( (ZK+GRAT1+Y)**2. + 4.0*Y*GRAT1) - KK = 0.5*(-(ZK+GRAT1+Y) + DD ) -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = KK ! HI - MOLAL (5) = KK+ZK+Y ! SO4I - MOLAL (6) = MAX (Y-KK, TINY) ! HSO4I - MOLAL (3) = 3.0*Y+2*ZK ! NH4I - CNH42S4 = X-ZK ! Solid (NH4)2SO4 - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 30 - ENDIF -20 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -CCC30 FUNCB3A= ( SO4I*NH4I**2.0 )/( XK7*(WATER/GAMA(4))**3.0 ) -30 FUNCB3A= MOLAL(5)*MOLAL(3)**2.0 - FUNCB3A= FUNCB3A/(XK7*(WATER/GAMA(4))**3.0) - ONE - RETURN -C -C *** END OF FUNCTION FUNCB3A ******************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB3B -C *** CASE B3 ; SUBCASE 2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH (1.0 < SULRAT < 2.0) -C 2. LIQUID PHASE ONLY IS POSSIBLE -C -C SPECIATION CALCULATIONS IS BASED ON THE HSO4 <--> SO4 EQUILIBRIUM. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB3B (Y, X) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KK -C - CALAOU = .FALSE. ! Outer loop activity calculation flag - FRST = .FALSE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 20 I=1,NSWEEP - GRAT1 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - DD = SQRT( (GRAT1+Y)**2. + 4.0*(X+Y)*GRAT1) - KK = 0.5*(-(GRAT1+Y) + DD ) -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = KK ! HI - MOLAL (5) = Y+KK ! SO4I - MOLAL (6) = MAX (X+Y-KK, TINY) ! HSO4I - MOLAL (3) = 3.0*Y+X ! NH4I - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (.NOT.CALAIN) GOTO 30 - CALL CALCACT -20 CONTINUE -C -30 RETURN -C -C *** END OF SUBROUTINE CALCB3B ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB2 -C *** CASE B2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : LC, (NH4)2SO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON THE SULFATE RATIO: -C 1. WHEN BOTH LC AND (NH4)2SO4 ARE POSSIBLE (SUBROUTINE CALCB2A) -C 2. WHEN ONLY LC IS POSSIBLE (SUBROUTINE CALCB2B). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB2 - INCLUDE 'isrpia.inc' -C -C *** CALCULATE EQUIVALENT AMOUNT OF HSO4 AND SO4 *********************** -C - X = MAX(2*W(2)-W(3), TINY) ! Equivalent NH4HSO4 - Y = MAX(W(3) -W(2), TINY) ! Equivalent NH42SO4 -C -C *** CALCULATE SPECIES ACCORDING TO RELATIVE ABUNDANCE OF HSO4 ********* -C - IF (X.LE.Y) THEN ! LC is the MIN (x,y) - SCASE = 'B2 ; SUBCASE 1' - CALL CALCB2A (X,Y-X) ! LC + (NH4)2SO4 POSSIBLE - ELSE - SCASE = 'B2 ; SUBCASE 2' - CALL CALCB2B (Y,X-Y) ! LC ONLY POSSIBLE - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCB2 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB2 -C *** CASE B2 ; SUBCASE A. -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH (1.0 < SULRAT < 2.0) -C 2. SOLID PHASE ONLY POSSIBLE -C 3. SOLIDS POSSIBLE: LC, (NH4)2SO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE -C -C FOR SOLID CALCULATIONS, A MATERIAL BALANCE BASED ON THE STOICHIMETRIC -C PROPORTION OF AMMONIUM AND SULFATE IS DONE TO CALCULATE THE AMOUNT -C OF LC AND (NH4)2SO4 IN THE SOLID PHASE. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB2A (TLC, TNH42S4) - INCLUDE 'isrpia.inc' -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMLCAS) THEN - SCASE = 'B2 ; SUBCASE A1' ! SOLIDS POSSIBLE ONLY - CLC = TLC - CNH42S4 = TNH42S4 - SCASE = 'B2 ; SUBCASE A1' - ELSE - SCASE = 'B2 ; SUBCASE A2' - CALL CALCB2A2 (TLC, TNH42S4) ! LIQUID & SOLID PHASE POSSIBLE - SCASE = 'B2 ; SUBCASE A2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCB2A ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB2A2 -C *** CASE B2 ; SUBCASE A2. -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH (1.0 < SULRAT < 2.0) -C 2. SOLID PHASE ONLY POSSIBLE -C 3. SOLIDS POSSIBLE: LC, (NH4)2SO4 -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE SOLID PHASE ONLY (SUBROUTINE CALCB2A1) AND THE -C THE SOLID WITH LIQUID PHASE (SUBROUTINE CALCB3). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB2A2 (TLC, TNH42S4) - INCLUDE 'isrpia.inc' -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ZERO - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (DRLC-RH)/(DRLC-DRMLCAS) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CLCO = TLC ! FIRST (DRY) SOLUTION - CNH42SO = TNH42S4 -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CLC = ZERO - CNH42S4 = ZERO - CALL CALCB3 ! SECOND (LIQUID) SOLUTION -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C - MOLAL(1)= ONEMWF*MOLAL(1) ! H+ - MOLAL(3)= ONEMWF*(2.D0*(CNH42SO-CNH42S4) + 3.D0*(CLCO-CLC)) ! NH4+ - MOLAL(5)= ONEMWF*(CNH42SO-CNH42S4 + CLCO-CLC) ! SO4-- - MOLAL(6)= ONEMWF*(CLCO-CLC) ! HSO4- -C - WATER = ONEMWF*WATER -C - CLC = WF*CLCO + ONEMWF*CLC - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 -C - RETURN -C -C *** END OF SUBROUTINE CALCB2A2 **************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB2 -C *** CASE B2 ; SUBCASE B -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH (1.0 < SULRAT < 2.0) -C 2. BOTH LIQUID & SOLID PHASE IS POSSIBLE -C 3. SOLIDS POSSIBLE: LC -C -C FOR CALCULATIONS, A BISECTION IS PERFORMED TOWARDS ZETA, THE -C AMOUNT OF SOLID LC DISSOLVED IN THE LIQUID PHASE. -C FOR EACH ESTIMATION OF ZETA, FUNCTION FUNCB2A CALCULATES THE -C AMOUNT OF H+ PRODUCED (BASED ON THE HSO4, SO4 RELEASED INTO THE -C SOLUTION). THE SOLUBILITY PRODUCT OF LC IS USED AS THE OBJECTIVE -C FUNCTION. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB2B (TLC,TNH4HS4) - INCLUDE 'isrpia.inc' -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - ZLO = ZERO - ZHI = TLC ! High limit: all of it in liquid phase -C -C *** INITIAL VALUES FOR BISECTION ************************************** -C - X1 = ZHI - Y1 = FUNCB2B (X1,TNH4HS4,TLC) - IF (ABS(Y1).LE.EPS) RETURN - YHI= Y1 ! Save Y-value at Hi position -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ************************ -C - DX = (ZHI-ZLO)/NDIV - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCB2B (X2,TNH4HS4,TLC) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YLO= Y1 ! Save Y-value at LO position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - RETURN -C -C *** { YLO, YHI } < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - X1 = ZHI - X2 = ZHI - GOTO 40 -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - X1 = ZLO - X2 = ZLO - GOTO 40 - ELSE - CALL PUSHERR (0001, 'CALCB2B') ! WARNING ERROR: NO SOLUTION - RETURN - ENDIF -C -C *** PERFORM BISECTION ************************************************* -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCB2B (X3,TNH4HS4,TLC) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCB2B') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ************************************************ -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCB2B (X3,TNH4HS4,TLC) -C - RETURN -C -C *** END OF SUBROUTINE CALCB2B ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCB2B -C *** CASE B2 ; -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE B2 ; SUBCASE 2 -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCB2B. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCB2B (X,TNH4HS4,TLC) - INCLUDE 'isrpia.inc' -C -C *** SOLVE EQUATIONS ************************************************** -C - FRST = .TRUE. - CALAIN = .TRUE. - DO 20 I=1,NSWEEP - GRAT2 = XK1*WATER*(GAMA(8)/GAMA(7))**2./GAMA(7) - PARM = X+GRAT2 - DELTA = PARM*PARM + 4.0*(X+TNH4HS4)*GRAT2 ! Diakrinousa - OMEGA = 0.5*(-PARM + SQRT(DELTA)) ! Thetiki riza (ie:H+>0) -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = OMEGA ! HI - MOLAL (3) = 3.0*X+TNH4HS4 ! NH4I - MOLAL (5) = X+OMEGA ! SO4I - MOLAL (6) = MAX (X+TNH4HS4-OMEGA, TINY) ! HSO4I - CLC = MAX(TLC-X,ZERO) ! Solid LC - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ****************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 30 - ENDIF -20 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************** -C -CCC30 FUNCB2B= ( NH4I**3.*SO4I*HSO4I )/( XK13*(WATER/GAMA(13))**5. ) -30 FUNCB2B= (MOLAL(3)**3.)*MOLAL(5)*MOLAL(6) - FUNCB2B= FUNCB2B/(XK13*(WATER/GAMA(13))**5.) - ONE - RETURN -C -C *** END OF FUNCTION FUNCB2B ******************************************* -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB1 -C *** CASE B1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : LC, (NH4)2SO4, NH4HSO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCB1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB1 - INCLUDE 'isrpia.inc' -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMLCAB) THEN - SCASE = 'B1 ; SUBCASE 1' - CALL CALCB1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'B1 ; SUBCASE 1' - ELSE - SCASE = 'B1 ; SUBCASE 2' - CALL CALCB1B ! LIQUID & SOLID PHASE POSSIBLE - SCASE = 'B1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCB1 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB1A -C *** CASE B1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH -C 2. THERE IS NO LIQUID PHASE -C 3. SOLIDS POSSIBLE: LC, { (NH4)2SO4 XOR NH4HSO4 } (ONE OF TWO -C BUT NOT BOTH) -C -C A SIMPLE MATERIAL BALANCE IS PERFORMED, AND THE AMOUNT OF LC -C IS CALCULATED FROM THE (NH4)2SO4 AND NH4HSO4 WHICH IS LEAST -C ABUNDANT (STOICHIMETRICALLY). THE REMAINING EXCESS OF SALT -C IS MIXED WITH THE LC. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB1A - INCLUDE 'isrpia.inc' -C -C *** SETUP PARAMETERS ************************************************ -C - X = 2*W(2)-W(3) ! Equivalent NH4HSO4 - Y = W(3)-W(2) ! Equivalent (NH4)2SO4 -C -C *** CALCULATE COMPOSITION ******************************************* -C - IF (X.LE.Y) THEN ! LC is the MIN (x,y) - CLC = X ! NH4HSO4 >= (NH4)2S04 - CNH4HS4 = ZERO - CNH42S4 = Y-X - ELSE - CLC = Y ! NH4HSO4 < (NH4)2S04 - CNH4HS4 = X-Y - CNH42S4 = ZERO - ENDIF - RETURN -C -C *** END OF SUBROUTINE CALCB1 ****************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCB1B -C *** CASE B1 ; SUBCASE 2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE: LC, { (NH4)2SO4 XOR NH4HSO4 } (ONE OF TWO -C BUT NOT BOTH) -C -C THIS IS THE CASE WHERE THE RELATIVE HUMIDITY IS IN THE MUTUAL -C DRH REGION. THE SOLUTION IS ASSUMED TO BE THE SUM OF TWO WEIGHTED -C SOLUTIONS ; THE SOLID PHASE ONLY (SUBROUTINE CALCB1A) AND THE -C THE SOLID WITH LIQUID PHASE (SUBROUTINE CALCB2). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCB1B - INCLUDE 'isrpia.inc' -C -C *** FIND WEIGHT FACTOR ********************************************** -C - IF (WFTYP.EQ.0) THEN - WF = ZERO - ELSEIF (WFTYP.EQ.1) THEN - WF = 0.5D0 - ELSE - WF = (DRNH4HS4-RH)/(DRNH4HS4-DRMLCAB) - ENDIF - ONEMWF = ONE - WF -C -C *** FIND FIRST SECTION ; DRY ONE ************************************ -C - CALL CALCB1A - CLCO = CLC ! FIRST (DRY) SOLUTION - CNH42SO = CNH42S4 - CNH4HSO = CNH4HS4 -C -C *** FIND SECOND SECTION ; DRY & LIQUID ****************************** -C - CLC = ZERO - CNH42S4 = ZERO - CNH4HS4 = ZERO - CALL CALCB2 ! SECOND (LIQUID) SOLUTION -C -C *** FIND SOLUTION AT MDRH BY WEIGHTING DRY & LIQUID SOLUTIONS. -C - MOLAL(1)= ONEMWF*MOLAL(1) ! H+ - MOLAL(3)= ONEMWF*(2.D0*(CNH42SO-CNH42S4) + (CNH4HSO-CNH4HS4) - & + 3.D0*(CLCO-CLC)) ! NH4+ - MOLAL(5)= ONEMWF*(CNH42SO-CNH42S4 + CLCO-CLC) ! SO4-- - MOLAL(6)= ONEMWF*(CNH4HSO-CNH4HS4 + CLCO-CLC) ! HSO4- -C - WATER = ONEMWF*WATER -C - CLC = WF*CLCO + ONEMWF*CLC - CNH42S4 = WF*CNH42SO + ONEMWF*CNH42S4 - CNH4HS4 = WF*CNH4HSO + ONEMWF*CNH4HS4 -C - RETURN -C -C *** END OF SUBROUTINE CALCB1B ***************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCC2 -C *** CASE C2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS ONLY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCC2 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, KAPA -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - FRST =.TRUE. - CALAIN =.TRUE. -C -C *** SOLVE EQUATIONS ************************************************** -C - LAMDA = W(3) ! NH4HSO4 INITIALLY IN SOLUTION - PSI = W(2)-W(3) ! H2SO4 IN SOLUTION - DO 20 I=1,NSWEEP - PARM = WATER*XK1/GAMA(7)*(GAMA(8)/GAMA(7))**2. - BB = PSI+PARM - CC =-PARM*(LAMDA+PSI) - KAPA = 0.5*(-BB+SQRT(BB*BB-4.0*CC)) -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL(1) = PSI+KAPA ! HI - MOLAL(3) = LAMDA ! NH4I - MOLAL(5) = KAPA ! SO4I - MOLAL(6) = MAX(LAMDA+PSI-KAPA, TINY) ! HSO4I - CH2SO4 = MAX(MOLAL(5)+MOLAL(6)-MOLAL(3), ZERO) ! Free H2SO4 - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (.NOT.CALAIN) GOTO 30 - CALL CALCACT -20 CONTINUE -C -30 RETURN -C -C *** END OF SUBROUTINE CALCC2 ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCC1 -C *** CASE C1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE: NH4HSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCC1 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KLO, KHI -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - KLO = TINY - KHI = W(3) -C -C *** INITIAL VALUES FOR BISECTION ************************************* -C - X1 = KLO - Y1 = FUNCC1 (X1) - IF (ABS(Y1).LE.EPS) GOTO 50 - YLO= Y1 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO *********************** -C - DX = (KHI-KLO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCC1 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2) .LT. ZERO) GOTO 20 ! (Y1*Y2 .LT. ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YHI= Y2 ! Save Y-value at HI position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 -C -C *** { YLO, YHI } < 0.0 SOLUTION IS ALWAYS UNDERSATURATED WITH NH4HS04 -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - GOTO 50 -C -C *** { YLO, YHI } > 0.0 SOLUTION IS ALWAYS SUPERSATURATED WITH NH4HS04 -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - X1 = KLO - X2 = KLO - GOTO 40 - ELSE - CALL PUSHERR (0001, 'CALCC1') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION OF DISSOLVED NH4HSO4 ************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCC1 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCC1') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN *********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCC1 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCC1 ***************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCC1 -C *** CASE C1 ; -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE C1 -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCC1. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCC1 (KAPA) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION KAPA, LAMDA -C -C *** SOLVE EQUATIONS ************************************************** -C - FRST = .TRUE. - CALAIN = .TRUE. -C - PSI = W(2)-W(3) - DO 20 I=1,NSWEEP - PAR1 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 - PAR2 = XK12*(WATER/GAMA(9))**2.0 - BB = PSI + PAR1 - CC =-PAR1*(PSI+KAPA) - LAMDA = 0.5*(-BB+SQRT(BB*BB-4*CC)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ******************************* -C - MOLAL(1) = PSI+LAMDA ! HI - MOLAL(3) = KAPA ! NH4I - MOLAL(5) = LAMDA ! SO4I - MOLAL(6) = MAX (ZERO, PSI+KAPA-LAMDA) ! HSO4I - CNH4HS4 = MAX(W(3)-MOLAL(3), ZERO) ! Solid NH4HSO4 - CH2SO4 = MAX(PSI, ZERO) ! Free H2SO4 - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 30 - ENDIF -20 CONTINUE -C -C *** CALCULATE ZERO FUNCTION ******************************************* -C -CCC30 FUNCC1= (NH4I*HSO4I/PAR2) - ONE -30 FUNCC1= (MOLAL(3)*MOLAL(6)/PAR2) - ONE - RETURN -C -C *** END OF FUNCTION FUNCC1 ******************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCD3 -C *** CASE D3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. THERE IS OLNY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCD3 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCD1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4NO3 ! Save from CALCD1 run - CHI2 = CNH42S4 - CHI3 = GHNO3 - CHI4 = GNH3 -C - PSI1 = CNH4NO3 ! ASSIGN INITIAL PSI's - PSI2 = CHI2 - PSI3 = ZERO - PSI4 = ZERO -C - MOLAL(5) = ZERO - MOLAL(6) = ZERO - MOLAL(3) = PSI1 - MOLAL(7) = PSI1 - CALL CALCMR ! Initial water -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = TINY ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C -60 X1 = PSI4LO - Y1 = FUNCD3 (X1) - IF (ABS(Y1).LE.EPS) RETURN - YLO= Y1 ! Save Y-value at HI position -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCD3 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YHI= Y1 ! Save Y-value at Hi position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - RETURN -C -C *** { YLO, YHI } < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NH3 -C Physically I dont know when this might happen, but I have put this -C branch in for completeness. I assume there is no solution; all NO3 goes to the -C gas phase. -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - P4 = TINY ! PSI4LO ! CHI4 - YY = FUNCD3(P4) - GOTO 50 -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH3 -C This happens when Sul.Rat. = 2.0, so some NH4+ from sulfate evaporates -C and goes to the gas phase ; so I redefine the LO and HI limits of PSI4 -C and proceed again with root tracking. -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - PSI4HI = PSI4LO - PSI4LO = PSI4LO - 0.1*(PSI1+PSI2) ! No solution; some NH3 evaporates - IF (PSI4LO.LT.-(PSI1+PSI2)) THEN - CALL PUSHERR (0001, 'CALCD3') ! WARNING ERROR: NO SOLUTION - RETURN - ELSE - MOLAL(5) = ZERO - MOLAL(6) = ZERO - MOLAL(3) = PSI1 - MOLAL(7) = PSI1 - CALL CALCMR ! Initial water - GOTO 60 ! Redo root tracking - ENDIF - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCD3 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*ABS(X1)) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCD3') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCD3 (X3) -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* -C -50 CONTINUE - IF (MOLAL(1).GT.TINY) THEN - CALL CALCHS4 (MOLAL(1), MOLAL(5), ZERO, DELTA) - MOLAL(1) = MOLAL(1) - DELTA ! H+ EFFECT - MOLAL(5) = MOLAL(5) - DELTA ! SO4 EFFECT - MOLAL(6) = DELTA ! HSO4 EFFECT - ENDIF - RETURN -C -C *** END OF SUBROUTINE CALCD3 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCD3 -C *** CASE D3 -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE D3 ; -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCD3. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCD3 (P4) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - PSI4 = P4 -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A2 = XK7*(WATER/GAMA(4))**3.0 - A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A7 = XKW *RH*WATER*WATER -C - PSI3 = A3*A4*CHI3*(CHI4-PSI4) - PSI1*(2.D0*PSI2+PSI1+PSI4) - PSI3 = PSI3/(A3*A4*(CHI4-PSI4) + 2.D0*PSI2+PSI1+PSI4) - PSI3 = MIN(MAX(PSI3, ZERO), CHI3) -C - BB = PSI4 - PSI3 -CCCOLD AHI = 0.5*(-BB + SQRT(BB*BB + 4.d0*A7)) ! This is correct also -CCC AHI =2.0*A7/(BB+SQRT(BB*BB + 4.d0*A7)) ! Avoid overflow when HI->0 - DENM = BB+SQRT(BB*BB + 4.d0*A7) - IF (DENM.LE.TINY) THEN ! Avoid overflow when HI->0 - ABB = ABS(BB) - DENM = (BB+ABB) + 2.0*A7/ABB ! Taylor expansion of SQRT - ENDIF - AHI = 2.0*A7/DENM -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = AHI ! HI - MOLAL (3) = PSI1 + PSI4 + 2.D0*PSI2 ! NH4I - MOLAL (5) = PSI2 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI3 + PSI1 ! NO3I - CNH42S4 = CHI2 - PSI2 ! Solid (NH4)2SO4 - CNH4NO3 = ZERO ! Solid NH4NO3 - GHNO3 = CHI3 - PSI3 ! Gas HNO3 - GNH3 = CHI4 - PSI4 ! Gas NH3 - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 CONTINUE -CCC FUNCD3= NH4I/HI/MAX(GNH3,TINY)/A4 - ONE - FUNCD3= MOLAL(3)/MOLAL(1)/MAX(GNH3,TINY)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCD3 ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCD2 -C *** CASE D2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCD2 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCD1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4NO3 ! Save from CALCD1 run - CHI2 = CNH42S4 - CHI3 = GHNO3 - CHI4 = GNH3 -C - PSI1 = CNH4NO3 ! ASSIGN INITIAL PSI's - PSI2 = CNH42S4 - PSI3 = ZERO - PSI4 = ZERO -C - MOLAL(5) = ZERO - MOLAL(6) = ZERO - MOLAL(3) = PSI1 - MOLAL(7) = PSI1 - CALL CALCMR ! Initial water -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = TINY ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C -60 X1 = PSI4LO - Y1 = FUNCD2 (X1) - IF (ABS(Y1).LE.EPS) RETURN - YLO= Y1 ! Save Y-value at HI position -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCD2 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) THEN -C -C This is done, in case if Y(PSI4LO)>0, but Y(PSI4LO+DX) < 0 (i.e.undersat) -C - IF (Y1 .LE. Y2) GOTO 20 ! (Y1*Y2.LT.ZERO) - ENDIF - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YHI= Y1 ! Save Y-value at Hi position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - RETURN -C -C *** { YLO, YHI } < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NH3 -C Physically I dont know when this might happen, but I have put this -C branch in for completeness. I assume there is no solution; all NO3 goes to the -C gas phase. -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - P4 = TINY ! PSI4LO ! CHI4 - YY = FUNCD2(P4) - GOTO 50 -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH3 -C This happens when Sul.Rat. = 2.0, so some NH4+ from sulfate evaporates -C and goes to the gas phase ; so I redefine the LO and HI limits of PSI4 -C and proceed again with root tracking. -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - PSI4HI = PSI4LO - PSI4LO = PSI4LO - 0.1*(PSI1+PSI2) ! No solution; some NH3 evaporates - IF (PSI4LO.LT.-(PSI1+PSI2)) THEN - CALL PUSHERR (0001, 'CALCD2') ! WARNING ERROR: NO SOLUTION - RETURN - ELSE - MOLAL(5) = ZERO - MOLAL(6) = ZERO - MOLAL(3) = PSI1 - MOLAL(7) = PSI1 - CALL CALCMR ! Initial water - GOTO 60 ! Redo root tracking - ENDIF - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCD2 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*ABS(X1)) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCD2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = MIN(X1,X2) ! 0.5*(X1+X2) ! Get "low" side, it's acidic soln. - Y3 = FUNCD2 (X3) -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* -C -50 CONTINUE - IF (MOLAL(1).GT.TINY) THEN - CALL CALCHS4 (MOLAL(1), MOLAL(5), ZERO, DELTA) - MOLAL(1) = MOLAL(1) - DELTA ! H+ EFFECT - MOLAL(5) = MOLAL(5) - DELTA ! SO4 EFFECT - MOLAL(6) = DELTA ! HSO4 EFFECT - ENDIF - RETURN -C -C *** END OF SUBROUTINE CALCD2 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCD2 -C *** CASE D2 -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE D2 ; -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCD2. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCD2 (P4) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALL RSTGAM ! Reset activity coefficients to 0.1 - FRST = .TRUE. - CALAIN = .TRUE. - PSI4 = P4 - PSI2 = CHI2 -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A2 = XK7*(WATER/GAMA(4))**3.0 - A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A7 = XKW *RH*WATER*WATER -C - IF (CHI2.GT.TINY .AND. WATER.GT.TINY) THEN - PSI14 = PSI1+PSI4 - CALL POLY3 (PSI14,0.25*PSI14**2.,-A2/4.D0, PSI2, ISLV) ! PSI2 - IF (ISLV.EQ.0) THEN - PSI2 = MIN (PSI2, CHI2) - ELSE - PSI2 = TINY - ENDIF - ENDIF -C - PSI3 = A3*A4*CHI3*(CHI4-PSI4) - PSI1*(2.D0*PSI2+PSI1+PSI4) - PSI3 = PSI3/(A3*A4*(CHI4-PSI4) + 2.D0*PSI2+PSI1+PSI4) -ccc PSI3 = MIN(MAX(PSI3, ZERO), CHI3) -C - BB = PSI4-PSI3 ! (BB > 0, acidic solution, <0 alkaline) -C -C Do not change computation scheme for H+, all others did not work well. -C - DENM = BB+SQRT(BB*BB + 4.d0*A7) - IF (DENM.LE.TINY) THEN ! Avoid overflow when HI->0 - ABB = ABS(BB) - DENM = (BB+ABB) + 2.d0*A7/ABB ! Taylor expansion of SQRT - ENDIF - AHI = 2.d0*A7/DENM -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL (1) = AHI ! HI - MOLAL (3) = PSI1 + PSI4 + 2.D0*PSI2 ! NH4 - MOLAL (5) = PSI2 ! SO4 - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI3 + PSI1 ! NO3 - CNH42S4 = CHI2 - PSI2 ! Solid (NH4)2SO4 - CNH4NO3 = ZERO ! Solid NH4NO3 - GHNO3 = CHI3 - PSI3 ! Gas HNO3 - GNH3 = CHI4 - PSI4 ! Gas NH3 - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 CONTINUE -CCC FUNCD2= NH4I/HI/MAX(GNH3,TINY)/A4 - ONE - FUNCD2= MOLAL(3)/MOLAL(1)/MAX(GNH3,TINY)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCD2 ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCD1 -C *** CASE D1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3 -C -C THERE ARE TWO REGIMES DEFINED BY RELATIVE HUMIDITY: -C 1. RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCD1A) -C 2. RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCD1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCD1A, CALCD2 -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMASAN) THEN - SCASE = 'D1 ; SUBCASE 1' ! SOLID PHASE ONLY POSSIBLE - CALL CALCD1A - SCASE = 'D1 ; SUBCASE 1' - ELSE - SCASE = 'D1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH (RH, DRMASAN, DRNH4NO3, CALCD1A, CALCD2) - SCASE = 'D1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCD1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCD1A -C *** CASE D1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3 -C -C THE SOLID (NH4)2SO4 IS CALCULATED FROM THE SULFATES, WHILE NH4NO3 -C IS CALCULATED FROM NH3-HNO3 EQUILIBRIUM. 'ZE' IS THE AMOUNT OF -C NH4NO3 THAT VOLATIZES WHEN ALL POSSILBE NH4NO3 IS INITIALLY IN -C THE SOLID PHASE. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCD1A - INCLUDE 'isrpia.inc' -C -C *** SETUP PARAMETERS ************************************************ -C - PARM = XK10/(R*TEMP)/(R*TEMP) -C -C *** CALCULATE NH4NO3 THAT VOLATIZES ********************************* -C - CNH42S4 = W(2) - X = MAX(ZERO, MIN(W(3)-2.0*CNH42S4, W(4))) ! MAX NH4NO3 - PS = MAX(W(3) - X - 2.0*CNH42S4, ZERO) - OM = MAX(W(4) - X, ZERO) -C - OMPS = OM+PS - DIAK = SQRT(OMPS*OMPS + 4.0*PARM) ! DIAKRINOUSA - ZE = MIN(X, 0.5*(-OMPS + DIAK)) ! THETIKI RIZA -C -C *** SPECIATION ******************************************************* -C - CNH4NO3 = X - ZE ! Solid NH4NO3 - GNH3 = PS + ZE ! Gas NH3 - GHNO3 = OM + ZE ! Gas HNO3 -C - RETURN -C -C *** END OF SUBROUTINE CALCD1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG5 -C *** CASE G5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG5 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = 0.5*W(1) - CHI2 = MAX (W(2)-CHI1, ZERO) - CHI3 = ZERO - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) - CHI5 = W(4) - CHI6 = W(5) -C - PSI1 = CHI1 - PSI2 = CHI2 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCG5A (X1) - IF (CHI6.LE.TINY) GOTO 50 -ccc IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -ccc IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCG5A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCG5A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A2 = XK7 *(WATER/GAMA(4))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - AKK = A4*A6 -C -C CALCULATE DISSOCIATION QUANTITIES -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - ELSE - PSI4 = TINY - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = 2.0D0*PSI1 ! NAI - MOLAL (3) = 2.0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO - MOLAL (7) = PSI5 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) ! Gas NH3 - GHNO3 = MAX(CHI5 - PSI5, TINY) ! Gas HNO3 - GHCL = MAX(CHI6 - PSI6, TINY) ! Gas HCl -C - CNH42S4 = ZERO ! Solid (NH4)2SO4 - CNH4NO3 = ZERO ! Solid NH4NO3 - CNH4CL = ZERO ! Solid NH4Cl -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCG5A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG5A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCG5A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG4 -C *** CASE G4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG4 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = 0.5*W(1) - CHI2 = MAX (W(2)-CHI1, ZERO) - CHI3 = ZERO - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) - CHI5 = W(4) - CHI6 = W(5) -C - PSI2 = CHI2 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCG4A (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY .OR. WATER .LE. TINY) GOTO 50 -CCC IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCG4A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCG4A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, NAI, NH4I, NO3I - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A2 = XK7 *(WATER/GAMA(4))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma shankar, 19/11/2001 - PSI4 =0.5d0*(-BB - SQRT(DD)) - ELSE - PSI4 = TINY - ENDIF -C -C CALCULATE CONCENTRATIONS -C - NH4I = 2.0*PSI2 + PSI4 - CLI = PSI6 - SO4I = PSI2 + PSI1 - NO3I = PSI5 - NAI = 2.0D0*PSI1 -C - CALL CALCPH(2.d0*SO4I+NO3I+CLI-NAI-NH4I, HI, OHI) -C -C *** Na2SO4 DISSOLUTION -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI1 - CALL POLY3 (PSI2, ZERO, -A1/4.D0, PSI1, ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1, CHI1) - ELSE - PSI1 = ZERO - ENDIF - ELSE - PSI1 = ZERO - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = HI - MOLAL (2) = NAI - MOLAL (3) = NH4I - MOLAL (4) = CLI - MOLAL (5) = SO4I - MOLAL (6) = ZERO - MOLAL (7) = NO3I -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = MAX(CHI1-PSI1,ZERO) -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCG4A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG4A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCG4A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG3 -C *** CASE G3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID & SOLID PHASE ARE BOTH POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCG1A, CALCG4 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (W(4).GT.TINY .AND. W(5).GT.TINY) THEN ! NO3,CL EXIST, WATER POSSIBLE - SCASE = 'G3 ; SUBCASE 1' - CALL CALCG3A - SCASE = 'G3 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'G1 ; SUBCASE 1' - CALL CALCG1A - SCASE = 'G1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMG3) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCG1A - SCASE = 'G3 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'G3 ; SUBCASE 3' ! MDRH REGION (NA2SO4, NH42S4) - CALL CALCMDRH (RH, DRMG3, DRNH42S4, CALCG1A, CALCG4) - SCASE = 'G3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCG3 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG3A -C *** CASE G3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG3A - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = 0.5*W(1) - CHI2 = MAX (W(2)-CHI1, ZERO) - CHI3 = ZERO - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) - CHI5 = W(4) - CHI6 = W(5) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = TINY -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCG3A (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY .OR. WATER .LE. TINY) GOTO 50 -CCC IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCG3A (X2) -C - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCG3A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI2 = CHI2 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A2 = XK7 *(WATER/GAMA(4))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI2.GT.TINY .AND. WATER.GT.TINY) THEN - CALL POLY3 (PSI4, PSI4*PSI4/4.D0, -A2/4.D0, PSI20, ISLV) - IF (ISLV.EQ.0) PSI2 = MIN (PSI20, CHI2) - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - MOLAL (2) = ZERO ! Na - MOLAL (3) = 2.0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -c - GNH3 = MAX(CHI4 - PSI4, TINY) ! Gas NH3 - GHNO3 = MAX(CHI5 - PSI5, TINY) ! Gas HNO3 - GHCL = MAX(CHI6 - PSI6, TINY) ! Gas HCl -C - CNH42S4 = CHI2 - PSI2 ! Solid (NH4)2SO4 - CNH4NO3 = ZERO ! Solid NH4NO3 - CNH4CL = ZERO ! Solid NH4Cl -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCG3A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG3A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCG3A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG2 -C *** CASE G2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID & SOLID PHASE ARE BOTH POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCG1A, CALCG3A, CALCG4 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).GT.TINY) THEN ! NO3 EXISTS, WATER POSSIBLE - SCASE = 'G2 ; SUBCASE 1' - CALL CALCG2A - SCASE = 'G2 ; SUBCASE 1' - ELSE ! NO3 NON EXISTANT, WATER NOT POSSIBLE - SCASE = 'G1 ; SUBCASE 1' - CALL CALCG1A - SCASE = 'G1 ; SUBCASE 1' - ENDIF -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMG2) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCG1A - SCASE = 'G2 ; SUBCASE 2' - ELSE - IF (W(5).GT. TINY) THEN - SCASE = 'G2 ; SUBCASE 3' ! MDRH (NH4CL, NA2SO4, NH42S4) - CALL CALCMDRH (RH, DRMG2, DRNH4CL, CALCG1A, CALCG3A) - SCASE = 'G2 ; SUBCASE 3' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMG3) THEN - SCASE = 'G2 ; SUBCASE 4' ! MDRH (NA2SO4, NH42S4) - CALL CALCMDRH (RH, DRMG3, DRNH42S4, CALCG1A, CALCG4) - SCASE = 'G2 ; SUBCASE 4' - ELSE - WATER = TINY - DO 20 I=1,NIONS - MOLAL(I) = ZERO -20 CONTINUE - CALL CALCG1A - SCASE = 'G2 ; SUBCASE 2' - ENDIF - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCG2 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG2A -C *** CASE G2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG2A - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = 0.5*W(1) - CHI2 = MAX (W(2)-CHI1, ZERO) - CHI3 = ZERO - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) - CHI5 = W(4) - CHI6 = W(5) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY -C - WATER = TINY -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCG2A (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -CCC IF (WATER .LE. TINY) GOTO 50 ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCG2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCG2A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEG/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, LAMDA, - & PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, PSI7, - & A1, A2, A3, A4, A5, A6, A7 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI2 = CHI2 - PSI3 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A2 = XK7 *(WATER/GAMA(4))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C - DENO = MAX(CHI6-PSI6-PSI3, ZERO) - PSI5 = CHI5/((A6/A5)*(DENO/PSI6) + ONE) -C - PSI4 = MIN(PSI5+PSI6,CHI4) -C - IF (CHI2.GT.TINY .AND. WATER.GT.TINY) THEN - CALL POLY3 (PSI4, PSI4*PSI4/4.D0, -A2/4.D0, PSI20, ISLV) - IF (ISLV.EQ.0) PSI2 = MIN (PSI20, CHI2) - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = ZERO ! NA - MOLAL (3) = 2.0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = MAX(CHI2 - PSI2, ZERO) - CNH4NO3 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 IF (CHI4.LE.TINY) THEN - FUNCG2A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE - ELSE - FUNCG2A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE - ENDIF -C - RETURN -C -C *** END OF FUNCTION FUNCG2A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG1 -C *** CASE G1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4CL, NA2SO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCG1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCG1A, CALCG2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMG1) THEN - SCASE = 'G1 ; SUBCASE 1' - CALL CALCG1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'G1 ; SUBCASE 1' - ELSE - SCASE = 'G1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH (RH, DRMG1, DRNH4NO3, CALCG1A, CALCG2A) - SCASE = 'G1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCG1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCG1A -C *** CASE G1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3 -C -C SOLID (NH4)2SO4 IS CALCULATED FROM THE SULFATES, WHILE NH4NO3 -C IS CALCULATED FROM NH3-HNO3 EQUILIBRIUM. 'ZE' IS THE AMOUNT OF -C NH4NO3 THAT VOLATIZES WHEN ALL POSSILBE NH4NO3 IS INITIALLY IN -C THE SOLID PHASE. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCG1A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, LAMDA1, LAMDA2, KAPA, KAPA1, KAPA2 -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CNA2SO4 = MIN (0.5*W(1), W(2)) - FRNA = MAX(W(1) - 2.D0*CNA2SO4, ZERO) - SO4FR = MAX(W(2) - CNA2SO4, ZERO) -C CNH42S4 = W(2) - CNA2SO4 - CNH42S4 = MAX (SO4FR , ZERO) ! CNH42S4 -C -C *** CALCULATE VOLATILE SPECIES ************************************** -C - ALF = W(3) - 2.0*CNH42S4 - BET = W(5) - GAM = W(4) -C - RTSQ = R*TEMP*R*TEMP - A1 = XK6/RTSQ - A2 = XK10/RTSQ -C - THETA1 = GAM - BET*(A2/A1) - THETA2 = A2/A1 -C -C QUADRATIC EQUATION SOLUTION -C - BB = (THETA1-ALF-BET*(ONE+THETA2))/(ONE+THETA2) - CC = (ALF*BET-A1-BET*THETA1)/(ONE+THETA2) - DD = BB*BB - 4.0D0*CC - IF (DD.LT.ZERO) GOTO 100 ! Solve each reaction seperately -C -C TWO ROOTS FOR KAPA, CHECK AND SEE IF ANY VALID -C - SQDD = SQRT(DD) - KAPA1 = 0.5D0*(-BB+SQDD) - KAPA2 = 0.5D0*(-BB-SQDD) - LAMDA1 = THETA1 + THETA2*KAPA1 - LAMDA2 = THETA1 + THETA2*KAPA2 -C - IF (KAPA1.GE.ZERO .AND. LAMDA1.GE.ZERO) THEN - IF (ALF-KAPA1-LAMDA1.GE.ZERO .AND. - & BET-KAPA1.GE.ZERO .AND. GAM-LAMDA1.GE.ZERO) THEN - KAPA = KAPA1 - LAMDA= LAMDA1 - GOTO 200 - ENDIF - ENDIF -C - IF (KAPA2.GE.ZERO .AND. LAMDA2.GE.ZERO) THEN - IF (ALF-KAPA2-LAMDA2.GE.ZERO .AND. - & BET-KAPA2.GE.ZERO .AND. GAM-LAMDA2.GE.ZERO) THEN - KAPA = KAPA2 - LAMDA= LAMDA2 - GOTO 200 - ENDIF - ENDIF -C -C SEPERATE SOLUTION OF NH4CL & NH4NO3 EQUILIBRIA -C -100 KAPA = ZERO - LAMDA = ZERO - DD1 = (ALF+BET)*(ALF+BET) - 4.0D0*(ALF*BET-A1) - DD2 = (ALF+GAM)*(ALF+GAM) - 4.0D0*(ALF*GAM-A2) -C -C NH4CL EQUILIBRIUM -C - IF (DD1.GE.ZERO) THEN - SQDD1 = SQRT(DD1) - KAPA1 = 0.5D0*(ALF+BET + SQDD1) - KAPA2 = 0.5D0*(ALF+BET - SQDD1) -C - IF (KAPA1.GE.ZERO .AND. KAPA1.LE.MIN(ALF,BET)) THEN - KAPA = KAPA1 - ELSE IF (KAPA2.GE.ZERO .AND. KAPA2.LE.MIN(ALF,BET)) THEN - KAPA = KAPA2 - ELSE - KAPA = ZERO - ENDIF - ENDIF -C -C NH4NO3 EQUILIBRIUM -C - IF (DD2.GE.ZERO) THEN - SQDD2 = SQRT(DD2) - LAMDA1= 0.5D0*(ALF+GAM + SQDD2) - LAMDA2= 0.5D0*(ALF+GAM - SQDD2) -C - IF (LAMDA1.GE.ZERO .AND. LAMDA1.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA1 - ELSE IF (LAMDA2.GE.ZERO .AND. LAMDA2.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA2 - ELSE - LAMDA = ZERO - ENDIF - ENDIF -C -C IF BOTH KAPA, LAMDA ARE > 0, THEN APPLY EXISTANCE CRITERION -C - IF (KAPA.GT.ZERO .AND. LAMDA.GT.ZERO) THEN - IF (BET .LT. LAMDA/THETA1) THEN - KAPA = ZERO - ELSE - LAMDA= ZERO - ENDIF - ENDIF -C -C *** CALCULATE COMPOSITION OF VOLATILE SPECIES *********************** -C -200 CONTINUE - CNH4NO3 = LAMDA - CNH4CL = KAPA -C - GNH3 = MAX(ALF - KAPA - LAMDA, ZERO) - GHNO3 = MAX(GAM - LAMDA, ZERO) - GHCL = MAX(BET - KAPA, ZERO) -C - RETURN -C -C *** END OF SUBROUTINE CALCG1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH6 -C *** CASE H6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH6 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = W(2) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCH6A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCH6A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCH6A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A9 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MAX(PSI5, TINY) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = BB*BB-4.d0*CC - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(PSI4,CHI4) - ELSE - PSI4 = TINY - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCH6A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCH6A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH5 -C *** CASE H5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH5 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).LE.TINY .AND. W(5).LE.TINY) THEN - SCASE = 'H5' - CALL CALCH1A - SCASE = 'H5' - RETURN - ENDIF -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = W(2) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCH5A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCH5A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NONE -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCH5A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A9 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MAX(PSI5, TINY) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = BB*BB-4.d0*CC - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(PSI4,CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN ! NA2SO4 DISSOLUTION - AA = PSI7+PSI8 - BB = AA*AA - CC =-A1/4.D0 - CALL POLY3 (AA, BB, CC, PSI1, ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1, CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO - MOLAL (7) = PSI5 + PSI8 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCH5A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCH5A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH4 -C *** CASE H4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH4 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).LE.TINY .AND. W(5).LE.TINY) THEN - SCASE = 'H4' - CALL CALCH1A - SCASE = 'H4' - RETURN - ENDIF -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = W(2) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCH4A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCH4A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCH4A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A9 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MAX(PSI5, TINY) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = BB*BB-4.d0*CC - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(PSI4,CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN ! NA2SO4 DISSOLUTION - AA = PSI7+PSI8 - BB = AA*AA - CC =-A1/4.D0 - CALL POLY3 (AA, BB, CC, PSI1, ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1, CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO - MOLAL (7) = PSI5 + PSI8 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCH4A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCH4A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH3 -C *** CASE H3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH3 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).LE.TINY) THEN ! NO3 NOT EXIST, WATER NOT POSSIBLE - SCASE = 'H3' - CALL CALCH1A - SCASE = 'H3' - RETURN - ENDIF -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = W(2) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCH3A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCH3A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCH3A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A9 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MAX(PSI5, TINY) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = BB*BB-4.d0*CC - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(PSI4,CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - DIAK = (PSI8-PSI6)**2.D0 + 4.D0*A7 - PSI7 = 0.5D0*( -(PSI8+PSI6) + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN ! NA2SO4 DISSOLUTION - AA = PSI7+PSI8 - BB = AA*AA - CC =-A1/4.D0 - CALL POLY3 (AA, BB, CC, PSI1, ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1, CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO - MOLAL (7) = PSI5 + PSI8 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCH3A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCH3A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH2 -C *** CASE H2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : NH4Cl, NA2SO4, NANO3, NACL -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. NH4NO3(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCH2A) -C 2. NH4NO3(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. NH4NO3(s) NOT POSSIBLE, AND RH >= MDRH. (MDRH REGION) -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES H1A, H2B -C RESPECTIVELY (BECAUSE MDRH POINTS COINCIDE). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCH1A, CALCH3 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).GT.TINY) THEN ! NO3 EXISTS, WATER POSSIBLE - SCASE = 'H2 ; SUBCASE 1' - CALL CALCH2A - SCASE = 'H2 ; SUBCASE 1' - ELSE ! NO3 NON EXISTANT, WATER NOT POSSIBLE - SCASE = 'H2 ; SUBCASE 1' - CALL CALCH1A - SCASE = 'H2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY .AND. RH.LT.DRMH2) THEN ! DRY AEROSOL - SCASE = 'H2 ; SUBCASE 2' -C - ELSEIF (WATER.LE.TINY .AND. RH.GE.DRMH2) THEN ! MDRH OF H2 - SCASE = 'H2 ; SUBCASE 3' - CALL CALCMDRH (RH, DRMH2, DRNANO3, CALCH1A, CALCH3) - SCASE = 'H2 ; SUBCASE 3' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCH2 ****************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH2A -C *** CASE H2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH2A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI1 = W(2) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCH2A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCH2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCH2A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A64 = (XK3*XK2/XKW)*(GAMA(10)/GAMA(5)/GAMA(11))**2.0 - A64 = A64*(R*TEMP*WATER)**2.0 - A9 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MAX(PSI5, TINY) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = BB*BB-4.d0*CC - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(PSI4,CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - DIAK = (PSI8-PSI6)**2.D0 + 4.D0*A7 - PSI7 = 0.5D0*( -(PSI8+PSI6) + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION - DIAK = (PSI7-PSI5)**2.D0 + 4.D0*A8 - PSI8 = 0.5D0*( -(PSI7+PSI5) + SQRT(DIAK) ) - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN ! NA2SO4 DISSOLUTION - AA = PSI7+PSI8 - BB = AA*AA - CC =-A1/4.D0 - CALL POLY3 (AA, BB, CC, PSI1, ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1, CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCH2A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A64 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCH2A ******************************************* -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH1 -C *** CASE H1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCH1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCH1A, CALCH2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMH1) THEN - SCASE = 'H1 ; SUBCASE 1' - CALL CALCH1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'H1 ; SUBCASE 1' - ELSE - SCASE = 'H1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH (RH, DRMH1, DRNH4NO3, CALCH1A, CALCH2A) - SCASE = 'H1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCH1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCH1A -C *** CASE H1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NANO3, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCH1A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, LAMDA1, LAMDA2, KAPA, KAPA1, KAPA2, NAFR, - & NO3FR -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CNA2SO4 = W(2) - CNH42S4 = ZERO - NAFR = MAX (W(1)-2*CNA2SO4, ZERO) - CNANO3 = MIN (NAFR, W(4)) - NO3FR = MAX (W(4)-CNANO3, ZERO) - CNACL = MIN (MAX(NAFR-CNANO3, ZERO), W(5)) - CLFR = MAX (W(5)-CNACL, ZERO) -C -C *** CALCULATE VOLATILE SPECIES ************************************** -C - ALF = W(3) ! FREE NH3 - BET = CLFR ! FREE CL - GAM = NO3FR ! FREE NO3 -C - RTSQ = R*TEMP*R*TEMP - A1 = XK6/RTSQ - A2 = XK10/RTSQ -C - THETA1 = GAM - BET*(A2/A1) - THETA2 = A2/A1 -C -C QUADRATIC EQUATION SOLUTION -C - BB = (THETA1-ALF-BET*(ONE+THETA2))/(ONE+THETA2) - CC = (ALF*BET-A1-BET*THETA1)/(ONE+THETA2) - DD = BB*BB - 4.0D0*CC - IF (DD.LT.ZERO) GOTO 100 ! Solve each reaction seperately -C -C TWO ROOTS FOR KAPA, CHECK AND SEE IF ANY VALID -C - SQDD = SQRT(DD) - KAPA1 = 0.5D0*(-BB+SQDD) - KAPA2 = 0.5D0*(-BB-SQDD) - LAMDA1 = THETA1 + THETA2*KAPA1 - LAMDA2 = THETA1 + THETA2*KAPA2 -C - IF (KAPA1.GE.ZERO .AND. LAMDA1.GE.ZERO) THEN - IF (ALF-KAPA1-LAMDA1.GE.ZERO .AND. - & BET-KAPA1.GE.ZERO .AND. GAM-LAMDA1.GE.ZERO) THEN - KAPA = KAPA1 - LAMDA= LAMDA1 - GOTO 200 - ENDIF - ENDIF -C - IF (KAPA2.GE.ZERO .AND. LAMDA2.GE.ZERO) THEN - IF (ALF-KAPA2-LAMDA2.GE.ZERO .AND. - & BET-KAPA2.GE.ZERO .AND. GAM-LAMDA2.GE.ZERO) THEN - KAPA = KAPA2 - LAMDA= LAMDA2 - GOTO 200 - ENDIF - ENDIF -C -C SEPERATE SOLUTION OF NH4CL & NH4NO3 EQUILIBRIA -C -100 KAPA = ZERO - LAMDA = ZERO - DD1 = (ALF+BET)*(ALF+BET) - 4.0D0*(ALF*BET-A1) - DD2 = (ALF+GAM)*(ALF+GAM) - 4.0D0*(ALF*GAM-A2) -C -C NH4CL EQUILIBRIUM -C - IF (DD1.GE.ZERO) THEN - SQDD1 = SQRT(DD1) - KAPA1 = 0.5D0*(ALF+BET + SQDD1) - KAPA2 = 0.5D0*(ALF+BET - SQDD1) -C - IF (KAPA1.GE.ZERO .AND. KAPA1.LE.MIN(ALF,BET)) THEN - KAPA = KAPA1 - ELSE IF (KAPA2.GE.ZERO .AND. KAPA2.LE.MIN(ALF,BET)) THEN - KAPA = KAPA2 - ELSE - KAPA = ZERO - ENDIF - ENDIF -C -C NH4NO3 EQUILIBRIUM -C - IF (DD2.GE.ZERO) THEN - SQDD2 = SQRT(DD2) - LAMDA1= 0.5D0*(ALF+GAM + SQDD2) - LAMDA2= 0.5D0*(ALF+GAM - SQDD2) -C - IF (LAMDA1.GE.ZERO .AND. LAMDA1.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA1 - ELSE IF (LAMDA2.GE.ZERO .AND. LAMDA2.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA2 - ELSE - LAMDA = ZERO - ENDIF - ENDIF -C -C IF BOTH KAPA, LAMDA ARE > 0, THEN APPLY EXISTANCE CRITERION -C - IF (KAPA.GT.ZERO .AND. LAMDA.GT.ZERO) THEN - IF (BET .LT. LAMDA/THETA1) THEN - KAPA = ZERO - ELSE - LAMDA= ZERO - ENDIF - ENDIF -C -C *** CALCULATE COMPOSITION OF VOLATILE SPECIES *********************** -C -200 CONTINUE - CNH4NO3 = LAMDA - CNH4CL = KAPA -C - GNH3 = ALF - KAPA - LAMDA - GHNO3 = GAM - LAMDA - GHCL = BET - KAPA -C - RETURN -C -C *** END OF SUBROUTINE CALCH1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI6 -C *** CASE I6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI6 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCI1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = CNA2SO4 - PSI5 = CNH42S4 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A6 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI2 + PSI4 + PSI5 + A6 ! PSI6 - CC =-A6*(PSI2 + PSI3 + PSI1) - DD = BB*BB - 4.D0*CC - PSI6 = 0.5D0*(-BB + SQRT(DD)) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = PSI6 ! HI - MOLAL (2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL (3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL (5) = PSI2 + PSI4 + PSI5 + PSI6 ! SO4I - MOLAL (6) = PSI2 + PSI3 + PSI1 - PSI6 ! HSO4I - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = CHI4 - PSI4 - CNH42S4 = ZERO - CNH4HS4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -20 RETURN -C -C *** END OF SUBROUTINE CALCI6 ***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI5 -C *** CASE I5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI5 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCI1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = CNH42S4 -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** IF NA2SO4(S) =0, CALL FUNCI5B FOR Y4=0 *************************** -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCI5A (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI4HI - Y1 = FUNCI5A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCI5A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH4CL -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCI5A (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCI5') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCI5A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCI5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCI5A (X3) -C -50 RETURN - -C *** END OF SUBROUTINE CALCI5 ***************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCI5A -C *** CASE I5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCI5A (P4) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 ! PSI3 already assigned in FUNCI5A - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5 *(WATER/GAMA(2))**3.0 - A5 = XK7 *(WATER/GAMA(4))**3.0 - A6 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI2 + PSI4 + PSI5 + A6 ! PSI6 - CC =-A6*(PSI2 + PSI3 + PSI1) - DD = BB*BB - 4.D0*CC - PSI6 = 0.5D0*(-BB + SQRT(DD)) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = PSI6 ! HI - MOLAL (2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL (3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL (5) = PSI2 + PSI4 + PSI5 + PSI6 ! SO4I - MOLAL (6) = PSI2 + PSI3 + PSI1 - PSI6 ! HSO4I - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = CHI4 - PSI4 - CNH42S4 = ZERO - CNH4HS4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCI5A= MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCI5A ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI4 -C *** CASE I4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI4 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCI1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** IF NA2SO4(S) =0, CALL FUNCI4B FOR Y4=0 *************************** -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCI4A (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI4HI - Y1 = FUNCI4A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCI4A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH4CL -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCI4A (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCI4') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCI4A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCI4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCI4A (X3) -C -50 RETURN - -C *** END OF SUBROUTINE CALCI4 ***************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCI4A -C *** CASE I4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCI4A (P4) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 ! PSI3 already assigned in FUNCI4A - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5 *(WATER/GAMA(2))**3.0 - A5 = XK7 *(WATER/GAMA(4))**3.0 - A6 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - A7 = SQRT(A4/A5) -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI2 + PSI4 + PSI5 + A6 ! PSI6 - CC =-A6*(PSI2 + PSI3 + PSI1) - DD = BB*BB - 4.D0*CC - PSI6 = 0.5D0*(-BB + SQRT(DD)) -C - PSI5 = (PSI3 + 2.D0*PSI4 - A7*(3.D0*PSI2 + PSI1))/2.D0/A7 - PSI5 = MAX (MIN (PSI5, CHI5), ZERO) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = PSI6 ! HI - MOLAL (2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL (3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL (5) = PSI2 + PSI4 + PSI5 + PSI6 ! SO4I - MOLAL (6) = PSI2 + PSI3 + PSI1 - PSI6 ! HSO4I - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = CHI4 - PSI4 - CNH42S4 = CHI5 - PSI5 - CNH4HS4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCI4A= MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCI4A ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI3 -C *** CASE I3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, NAHSO4, LC -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1.(NA,NH4)HSO4(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCI3A) -C 2.(NA,NH4)HSO4(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3.(NA,NH4)HSO4(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES I1A, I2B -C RESPECTIVELY -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCI1A, CALCI4 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************** -C - IF (CNH4HS4.GT.TINY .OR. CNAHSO4.GT.TINY) THEN - SCASE = 'I3 ; SUBCASE 1' - CALL CALCI3A ! FULL SOLUTION - SCASE = 'I3 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMI3) THEN ! SOLID SOLUTION - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCI1A - SCASE = 'I3 ; SUBCASE 2' -C - ELSEIF (RH.GE.DRMI3) THEN ! MDRH OF I3 - SCASE = 'I3 ; SUBCASE 3' - CALL CALCMDRH (RH, DRMI3, DRLC, CALCI1A, CALCI4) - SCASE = 'I3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCI3 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI3A -C *** CASE I3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI3A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A ! Needed when called from CALCMDRH -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCI1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = ZERO - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI2LO = ZERO ! Low limit - PSI2HI = CHI2 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI2HI - Y1 = FUNCI3A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC ********* -C - IF (YHI.LT.EPS) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI2HI-PSI2LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI2LO) - Y2 = FUNCI3A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - IF (Y2.GT.EPS) Y2 = FUNCI3A (ZERO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCI3A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCI3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCI3A (X3) -C -50 RETURN - -C *** END OF SUBROUTINE CALCI3A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCI3A -C *** CASE I3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCI3A (P2) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI2 = P2 ! Save PSI2 in COMMON BLOCK - PSI4LO = ZERO ! Low limit for PSI4 - PSI4HI = CHI4 ! High limit for PSI4 -C -C *** IF NH3 =0, CALL FUNCI3B FOR Y4=0 ******************************** -C - IF (CHI4.LE.TINY) THEN - FUNCI3A = FUNCI3B (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI4HI - Y1 = FUNCI3B (X1) - IF (ABS(Y1).LE.EPS) GOTO 50 - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ***** -C - IF (YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI4LO) - Y2 = FUNCI3B (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NA2SO4 -C - IF (Y2.GT.EPS) Y2 = FUNCI3B (PSI4LO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCI3B (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0004, 'FUNCI3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** INNER LOOP CONVERGED ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCI3B (X3) -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -50 A2 = XK13*(WATER/GAMA(13))**5.0 - FUNCI3A = MOLAL(5)*MOLAL(6)*MOLAL(3)**3.D0/A2 - ONE - RETURN -C -C *** END OF FUNCTION FUNCI3A ******************************************* -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCI3B -C *** CASE I3 ; SUBCASE 2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, LC -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCI3B (P4) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5*(WATER/GAMA(2))**3.0 - A5 = XK7*(WATER/GAMA(4))**3.0 - A6 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - A7 = SQRT(A4/A5) -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI2 + PSI4 + PSI5 + A6 ! PSI6 - CC =-A6*(PSI2 + PSI3 + PSI1) - DD = BB*BB - 4.D0*CC - PSI6 = 0.5D0*(-BB + SQRT(DD)) -C - PSI5 = (PSI3 + 2.D0*PSI4 - A7*(3.D0*PSI2 + PSI1))/2.D0/A7 - PSI5 = MAX (MIN (PSI5, CHI5), ZERO) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = PSI6 ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 - PSI6, TINY) ! HSO4I - CLC = MAX(CHI2 - PSI2, ZERO) - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = MAX(CHI5 - PSI5, ZERO) - CNH4HS4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCI3B= MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCI3B ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI2 -C *** CASE I2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, NAHSO4, LC -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. NH4HSO4(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCI2A) -C 2. NH4HSO4(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. NH4HSO4(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES I1A, I2B -C RESPECTIVELY -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCI1A, CALCI3A -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************** -C - IF (CNH4HS4.GT.TINY) THEN - SCASE = 'I2 ; SUBCASE 1' - CALL CALCI2A - SCASE = 'I2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMI2) THEN ! SOLID SOLUTION ONLY - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCI1A - SCASE = 'I2 ; SUBCASE 2' -C - ELSEIF (RH.GE.DRMI2) THEN ! MDRH OF I2 - SCASE = 'I2 ; SUBCASE 3' - CALL CALCMDRH (RH, DRMI2, DRNAHSO4, CALCI1A, CALCI3A) - SCASE = 'I2 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCI2 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI2A -C *** CASE I2 ; SUBCASE A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, NAHSO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI2A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCI1A ! Needed when called from CALCMDRH -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCI1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = ZERO - PSI3 = ZERO - PSI4 = ZERO - PSI5 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI2LO = ZERO ! Low limit - PSI2HI = CHI2 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI2HI - Y1 = FUNCI2A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC ********* -C - IF (YHI.LT.EPS) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI2HI-PSI2LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI2LO) - Y2 = FUNCI2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - IF (Y2.GT.EPS) Y2 = FUNCI2A (ZERO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCI2A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCI2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCI2A (X3) -C -50 RETURN - -C *** END OF SUBROUTINE CALCI2A ***************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCI2A -C *** CASE I2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, NAHSO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCI2A (P2) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - PSI2 = P2 ! Save PSI2 in COMMON BLOCK - PSI3 = CHI3 - PSI4 = CHI4 - PSI5 = CHI5 - PSI6 = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A3 = XK11*(WATER/GAMA(12))**2.0 - A4 = XK5 *(WATER/GAMA(2))**3.0 - A5 = XK7 *(WATER/GAMA(4))**3.0 - A6 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. - A7 = SQRT(A4/A5) -C -C CALCULATE DISSOCIATION QUANTITIES -C - IF (CHI5.GT.TINY .AND. WATER.GT.TINY) THEN - PSI5 = (PSI3 + 2.D0*PSI4 - A7*(3.D0*PSI2 + PSI1))/2.D0/A7 - PSI5 = MAX(MIN (PSI5, CHI5), TINY) - ENDIF -C - IF (CHI4.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI2+PSI5+PSI6+PSI3 - BB = PSI3*AA - CC = 0.25D0*(PSI3*PSI3*(PSI2+PSI5+PSI6)-A4) - CALL POLY3 (AA, BB, CC, PSI4, ISLV) - IF (ISLV.EQ.0) THEN - PSI4 = MIN (PSI4, CHI4) - ELSE - PSI4 = ZERO - ENDIF - ENDIF -C - IF (CHI3.GT.TINY .AND. WATER.GT.TINY) THEN - AA = 2.D0*PSI4 + PSI2 + PSI1 - PSI6 - BB = 2.D0*PSI4*(PSI2 + PSI1 - PSI6) - A3 - CC = ZERO - CALL POLY3 (AA, BB, CC, PSI3, ISLV) - IF (ISLV.EQ.0) THEN - PSI3 = MIN (PSI3, CHI3) - ELSE - PSI3 = ZERO - ENDIF - ENDIF -C - BB = PSI2 + PSI4 + PSI5 + A6 ! PSI6 - CC =-A6*(PSI2 + PSI3 + PSI1) - DD = BB*BB - 4.D0*CC - PSI6 = 0.5D0*(-BB + SQRT(DD)) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = PSI6 ! HI - MOLAL (2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL (3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL (5) = PSI2 + PSI4 + PSI5 + PSI6 ! SO4I - MOLAL (6) = PSI2 + PSI3 + PSI1 - PSI6 ! HSO4I - CLC = CHI2 - PSI2 - CNAHSO4 = CHI3 - PSI3 - CNA2SO4 = CHI4 - PSI4 - CNH42S4 = CHI5 - PSI5 - CNH4HS4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 A2 = XK13*(WATER/GAMA(13))**5.0 - FUNCI2A = MOLAL(5)*MOLAL(6)*MOLAL(3)**3.D0/A2 - ONE - RETURN -C -C *** END OF FUNCTION FUNCI2A ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI1 -C *** CASE I1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCI1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCI1A, CALCI2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMI1) THEN - SCASE = 'I1 ; SUBCASE 1' - CALL CALCI1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'I1 ; SUBCASE 1' - ELSE - SCASE = 'I1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH (RH, DRMI1, DRNH4HS4, CALCI1A, CALCI2A) - SCASE = 'I1 ; SUBCASE 2' - ENDIF -C -C *** AMMONIA IN GAS PHASE ********************************************** -C -C CALL CALCNH3 -C - RETURN -C -C *** END OF SUBROUTINE CALCI1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCI1A -C *** CASE I1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCI1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CNA2SO4 = 0.5D0*W(1) - CNH4HS4 = ZERO - CNAHSO4 = ZERO - CNH42S4 = ZERO - FRSO4 = MAX(W(2)-CNA2SO4, ZERO) -C - CLC = MIN(W(3)/3.D0, FRSO4/2.D0) - FRSO4 = MAX(FRSO4-2.D0*CLC, ZERO) - FRNH4 = MAX(W(3)-3.D0*CLC, ZERO) -C - IF (FRSO4.LE.TINY) THEN - CLC = MAX(CLC - FRNH4, ZERO) - CNH42S4 = 2.D0*FRNH4 - - ELSEIF (FRNH4.LE.TINY) THEN - CNH4HS4 = 3.D0*MIN(FRSO4, CLC) - CLC = MAX(CLC-FRSO4, ZERO) - IF (CNA2SO4.GT.TINY) THEN - FRSO4 = MAX(FRSO4-CNH4HS4/3.D0, ZERO) - CNAHSO4 = 2.D0*FRSO4 - CNA2SO4 = MAX(CNA2SO4-FRSO4, ZERO) - ENDIF - ENDIF -C -C *** CALCULATE GAS SPECIES ********************************************* -C - GHNO3 = W(4) - GHCL = W(5) - GNH3 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCI1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCJ3 -C *** CASE J3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS ONLY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCJ3 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1), TINY) ! FREE H2SO4 - CHI1 = W(1) ! NA TOTAL as NaHSO4 - CHI2 = W(3) ! NH4 TOTAL as NH4HSO4 - PSI1 = CHI1 - PSI2 = CHI2 ! ALL NH4HSO4 DELIQUESCED -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A3 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = A3+LAMDA ! KAPA - CC =-A3*(LAMDA + PSI1 + PSI2) - DD = BB*BB-4.D0*CC - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = LAMDA + KAPA ! HI - MOLAL (2) = PSI1 ! NAI - MOLAL (3) = PSI2 ! NH4I - MOLAL (4) = ZERO ! CLI - MOLAL (5) = KAPA ! SO4I - MOLAL (6) = LAMDA + PSI1 + PSI2 - KAPA ! HSO4I - MOLAL (7) = ZERO ! NO3I -C - CNAHSO4 = ZERO - CNH4HS4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 50 - ENDIF -10 CONTINUE -C -50 RETURN -C -C *** END OF SUBROUTINE CALCJ3 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCJ2 -C *** CASE J2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NAHSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCJ2 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEJ/ CHI1, CHI2, CHI3, LAMDA, KAPA, PSI1, PSI2, PSI3, - & A1, A2, A3 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - CHI1 = W(1) ! NA TOTAL - CHI2 = W(3) ! NH4 TOTAL - PSI1LO = TINY ! Low limit - PSI1HI = CHI1 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI1HI - Y1 = FUNCJ2 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NH42SO4 **** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI1HI-PSI1LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCJ2 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH42SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCJ2 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCJ2') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCJ2 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCJ2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCJ2 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCJ2 ****************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCJ2 -C *** CASE J2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCJ2 (P1) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEJ/ CHI1, CHI2, CHI3, LAMDA, KAPA, PSI1, PSI2, PSI3, - & A1, A2, A3 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1), TINY) ! FREE H2SO4 - PSI1 = P1 - PSI2 = CHI2 ! ALL NH4HSO4 DELIQUESCED -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK11 *(WATER/GAMA(12))**2.0 - A3 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = A3+LAMDA ! KAPA - CC =-A3*(LAMDA + PSI1 + PSI2) - DD = BB*BB-4.D0*CC - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (1) = LAMDA + KAPA ! HI - MOLAL (2) = PSI1 ! NAI - MOLAL (3) = PSI2 ! NH4I - MOLAL (4) = ZERO ! CLI - MOLAL (5) = KAPA ! SO4I - MOLAL (6) = LAMDA + PSI1 + PSI2 - KAPA ! HSO4I - MOLAL (7) = ZERO ! NO3I -C - CNAHSO4 = MAX(CHI1-PSI1,ZERO) - CNH4HS4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCJ2 = MOLAL(2)*MOLAL(6)/A1 - ONE -C -C *** END OF FUNCTION FUNCJ2 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCJ1 -C *** CASE J1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NH4HSO4, NAHSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - SUBROUTINE CALCJ1 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEJ/ CHI1, CHI2, CHI3, LAMDA, KAPA, PSI1, PSI2, PSI3, - & A1, A2, A3 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - CHI1 = W(1) ! Total NA initially as NaHSO4 - CHI2 = W(3) ! Total NH4 initially as NH4HSO4 -C - PSI1LO = TINY ! Low limit - PSI1HI = CHI1 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI1HI - Y1 = FUNCJ1 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NH42SO4 **** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI1HI-PSI1LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCJ1 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH42SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCJ1 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCJ1') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCJ1 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCJ1') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCJ1 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCJ1 ****************************************** -C - END - - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCJ1 -C *** CASE J1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, FREE ACID (SULRAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCJ1 (P1) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEJ/ CHI1, CHI2, CHI3, LAMDA, KAPA, PSI1, PSI2, PSI3, - & A1, A2, A3 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1), TINY) ! FREE H2SO4 - PSI1 = P1 -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK11 *(WATER/GAMA(12))**2.0 - A2 = XK12 *(WATER/GAMA(09))**2.0 - A3 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C - PSI2 = 0.5*(-(LAMDA+PSI1) + SQRT((LAMDA+PSI1)**2.D0+4.D0*A2)) ! PSI2 - PSI2 = MIN (PSI2, CHI2) -C - BB = A3+LAMDA ! KAPA - CC =-A3*(LAMDA + PSI2 + PSI1) - DD = BB*BB-4.D0*CC - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = LAMDA + KAPA ! HI - MOLAL (2) = PSI1 ! NAI - MOLAL (3) = PSI2 ! NH4I - MOLAL (4) = ZERO - MOLAL (5) = KAPA ! SO4I - MOLAL (6) = LAMDA + PSI1 + PSI2 - KAPA ! HSO4I - MOLAL (7) = ZERO -C - CNAHSO4 = MAX(CHI1-PSI1,ZERO) - CNH4HS4 = MAX(CHI2-PSI2,ZERO) -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCJ1 = MOLAL(2)*MOLAL(6)/A1 - ONE -C -C *** END OF FUNCTION FUNCJ1 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO7 -C *** CASE O7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MgSO4, NA2SO4, K2SO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO7 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C - PSI1 = CHI1 - PSI2 = CHI2 - PSI3 = ZERO - PSI4 = ZERO - PSI5 = ZERO - PSI6 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) + CHI7/M0(17) + CHI8/M0(21) - WATER = MAX (WATER , TINY) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCO7 (X1) - IF (CHI6.LE.TINY) GOTO 50 -ccc IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -ccc IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO7 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MgSO4, NA2SO4, K2SO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO7 (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - PSI5 = MIN (PSI5,CHI5) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MAX (MIN (PSI4,CHI4), ZERO) - ELSE - PSI4 = TINY - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = 2.0D0*PSI1 ! Na+ - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI1+PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CaI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! Mg -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNA2SO4 = ZERO - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4Cl = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CCASO4 = CHI9 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCO7 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG5A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCO7 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO6 -C *** CASE O6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MGSO4, NA2SO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO6 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C -C - PSI1 = CHI1 - PSI2 = CHI2 - PSI3 = ZERO - PSI7 = ZERO - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) + CHI7/M0(17) + CHI8/M0(21) - WATER = MAX (WATER , TINY) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCO6 (X1) - IF (CHI6.LE.TINY) GOTO 50 -ccc IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -ccc IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO6 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 , K2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MgSO4, NA2SO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO6 (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK17 *(WATER/GAMA(17))**3.0 -C -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - PSI5 = MIN (PSI5,CHI5) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MAX (MIN (PSI4,CHI4), ZERO) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI7 - CALL POLY3 (PSI1+PSI2+PSI8, ZERO, -A7/4.D0, PSI7, ISLV) - IF (ISLV.EQ.0) THEN - PSI7 = MAX (MIN (PSI7, CHI7), ZERO) - ELSE - PSI7 = ZERO - ENDIF - ELSE - PSI7 = ZERO - ENDIF -C -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = 2.0D0*PSI1 ! Na+ - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI1+PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CaI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! Mg - -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* - -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNA2SO4 = ZERO - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4Cl = ZERO - CK2SO4 = MAX(CHI7 - PSI7, TINY) - CMGSO4 = ZERO - CCASO4 = CHI9 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCO6 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG5A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCO6 ******************************************* -C - END -C -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO5 -C *** CASE O5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MGSO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO5 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C - PSI1 = ZERO - PSI2 = CHI2 - PSI3 = ZERO - PSI7 = ZERO - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) + CHI7/M0(17) + CHI8/M0(21) - WATER = MAX (WATER , TINY) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCO5 (X1) - IF (CHI6.LE.TINY) GOTO 50 -ccc IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -ccc IF (WATER .LE. TINY) RETURN ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO5 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MGSO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO5 (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK17 *(WATER/GAMA(17))**3.0 -C -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - PSI5 = MIN (PSI5,CHI5) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MAX (MIN (PSI4,CHI4), ZERO) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI7 - CALL POLY3 ((PSI2+PSI8)/(SQRT(A1/A7)+1.D0), ZERO, - & -A7/4.D0/(SQRT(A1/A7)+1.D0), PSI7, ISLV) - IF (ISLV.EQ.0) THEN - PSI7 = MAX (MIN (PSI7, CHI7), ZERO) - ELSE - PSI7 = ZERO - ENDIF - ELSE - PSI7 = ZERO - ENDIF -C - IF (CHI1.GE.TINY) THEN ! PSI1 - PSI1 = SQRT(A1/A7)*PSI7 - PSI1 = MIN(PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF -C -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = 2.0D0*PSI1 ! NaI - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI1+PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CaI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! Mg - -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* - -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNA2SO4 = MAX(CHI1 - PSI1, TINY) - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4Cl = ZERO - CK2SO4 = MAX(CHI7 - PSI7, TINY) - CMGSO4 = ZERO - CCASO4 = CHI9 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCO5 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCG5A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCO5 ******************************************* -C - END -C -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO4 -C *** CASE O4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NA2SO4, K2SO4, MGSO4, CASO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO4 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C - PSI2 = CHI2 - PSI3 = ZERO - PSI7 = ZERO - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C - WATER = CHI2/M0(4) + CHI1/M0(2) + CHI7/M0(17) + CHI8/M0(21) - WATER = MAX (WATER , TINY) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCO4 (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -CCC IF (WATER .LE. TINY) GOTO 50 ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO4 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO4 (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI2 = CHI2 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK17 *(WATER/GAMA(17))**3.0 -C A8 = XK23 *(WATER/GAMA(21))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - IF (CHI5.GE.TINY) THEN - PSI5 = PSI6*CHI5/(A6/A5*(CHI6-PSI6) + PSI6) - PSI5 = MIN (PSI5,CHI5) - ELSE - PSI5 = TINY - ENDIF -C -CCC IF(CHI4.GT.TINY) THEN - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MAX (MIN (PSI4,CHI4), ZERO) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI7 - CALL POLY3 (PSI2+PSI8, ZERO, -A7/4.D0, PSI7, ISLV) - IF (ISLV.EQ.0) THEN - PSI7 = MAX (MIN (PSI7, CHI7), ZERO) - ELSE - PSI7 = ZERO - ENDIF - ELSE - PSI7 = ZERO - ENDIF -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - MOLAL (2) = ZERO ! NAI - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CAI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! MGI - -C -C *** CALCULATE HSO4 SPECIATION AND RETURN ******************************* - -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4Cl = ZERO - CK2SO4 = MAX(CHI7 - PSI7, TINY) - CMGSO4 = ZERO - CCASO4 = CHI9 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCO4 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -CCC FUNCO4 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCO4 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO3 -C *** CASE O3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCO1A, CALCO4 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (W(4).GT.TINY .AND. W(5).GT.TINY) THEN ! NO3,CL EXIST, WATER POSSIBLE - SCASE = 'O3 ; SUBCASE 1' - CALL CALCO3A - SCASE = 'O3 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'O1 ; SUBCASE 1' - CALL CALCO1A - SCASE = 'O1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMO3) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCO1A - SCASE = 'O3 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'O3 ; SUBCASE 3' ! MDRH REGION (NA2SO4, NH42S4, K2SO4, MGSO4, CASO4) - CALL CALCMDRH2 (RH, DRMO3, DRNH42S4, CALCO1A, CALCO4) - SCASE = 'O3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCO3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO3A -C *** CASE O3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, K2SO4, MGSO4, CASO4 -C 4. Completely dissolved: NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO3A - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY -C - WATER = TINY -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCO3A (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI7.LE.TINY) GOTO 50 -CCC IF (WATER .LE. TINY) GOTO 50 ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO3A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NA2SO4, K2SO4, MgSO4, CaSO4 -C 4. Completely dissolved: NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO3A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI2 = CHI2 - PSI8 = CHI8 - PSI3 = ZERO - PSI6 = X -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0D0 - A2 = XK7 *(WATER/GAMA(4))**3.0D0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0D0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0D0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0D0 - A7 = XK17 *(WATER/GAMA(17))**3.0D0 -C A8 = XK23 *(WATER/GAMA(21))**2.0D0 - A65 = A6/A5 -C -C CALCULATE DISSOCIATION QUANTITIES -C - DENO = MAX(CHI6-PSI6-PSI3, ZERO) - PSI5 = PSI6*CHI5/(A6/A5*DENO + PSI6) - PSI5 = MIN(MAX(PSI5,ZERO),CHI5) -C -CCC IF(CHI4.GT.TINY) THEN ! PSI4 - IF(W(2).GT.TINY) THEN ! Accounts for NH3 evaporation - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - 2.d0*PSI2/A4 - DD = MAX(BB*BB-4.d0*CC,ZERO) ! Patch proposed by Uma Shankar, 19/11/01 - PSI4 =0.5d0*(-BB - SQRT(DD)) - ELSE - PSI4 = TINY - ENDIF - PSI4 = MIN (MAX (PSI4,ZERO), CHI4) -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI7 - CALL POLY3 (PSI2+PSI8, ZERO, -A7/4.D0, PSI7, ISLV) - IF (ISLV.EQ.0) THEN - PSI7 = MAX (MIN (PSI7, CHI7), ZERO) - ELSE - PSI7 = ZERO - ENDIF - ELSE - PSI7 = ZERO - ENDIF -C - IF (CHI2.GT.TINY .AND. WATER.GT.TINY) THEN - CALL POLY3 (PSI7+PSI8+PSI4, PSI4*(PSI7+PSI8)+ - & PSI4*PSI4/4.D0, (PSI4*PSI4*(PSI7+PSI8)-A2) - & /4.D0,PSI20, ISLV) - IF (ISLV.EQ.0) PSI2 = MIN (MAX(PSI20,ZERO), CHI2) - ENDIF -C PSI2 = 0.5D0*(2.0D0*SQRT(A2/A7)*PSI7 - PSI4) -C PSI2 = MIN (MAX(PSI2, ZERO), CHI2) -C ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = ZERO ! NaI - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CAI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! MGI -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CNH42S4 = MAX(CHI2 - PSI2, ZERO) - CNH4NO3 = ZERO - CNH4Cl = ZERO - CK2SO4 = MAX(CHI7 - PSI7, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI9 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -20 FUNCO3A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C -C - RETURN -C -C *** END OF FUNCTION FUNCO3A ******************************************* -C - END - -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO2 -C *** CASE O2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCO1A, CALCO3A, CALCO4 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).GT.TINY) THEN ! NO3 EXISTS, WATER POSSIBLE - SCASE = 'O2 ; SUBCASE 1' - CALL CALCO2A - SCASE = 'O2 ; SUBCASE 1' - ELSE ! NO3 NON EXISTANT, WATER NOT POSSIBLE - SCASE = 'O1 ; SUBCASE 1' - CALL CALCO1A - SCASE = 'O1 ; SUBCASE 1' - ENDIF -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMO2) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCO1A - SCASE = 'O2 ; SUBCASE 2' - ELSE - IF (W(5).GT. TINY) THEN - SCASE = 'O2 ; SUBCASE 3' ! MDRH (NH4CL, NA2SO4, NH42S4, K2SO4, MGSO4, CASO4) - CALL CALCMDRH2 (RH, DRMO2, DRNH4CL, CALCO1A, CALCO3A) - SCASE = 'O2 ; SUBCASE 3' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMO3) THEN - SCASE = 'O2 ; SUBCASE 4' ! MDRH (NA2SO4, NH42S4, K2SO4, MGSO4, CASO4) - CALL CALCMDRH2 (RH, DRMO3, DRNH42S4, CALCO1A, CALCO4) - SCASE = 'O2 ; SUBCASE 4' - ELSE - WATER = TINY - DO 20 I=1,NIONS - MOLAL(I) = ZERO -20 CONTINUE - CALL CALCO1A - SCASE = 'O2 ; SUBCASE 2' - ENDIF - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCO2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO2A -C *** CASE O2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. (Rsulfate > 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4, K2SO4, MgSO4, CaSO4 -C 4. Completely dissolved: NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO2A - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************* -C - CALAOU = .TRUE. - CHI9 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX (W(2)-CHI9, ZERO) - CAFR = MAX (W(6)-CHI9, ZERO) - CHI7 = MIN (0.5D0*W(7), SO4FR) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI7, ZERO) - SO4FR = MAX (SO4FR - CHI7, ZERO) - CHI1 = MIN (0.5D0*W(1), SO4FR) ! NA2SO4 - NAFR = MAX (W(1) - 2.D0*CHI1, ZERO) - SO4FR = MAX (SO4FR - CHI1, ZERO) - CHI8 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CHI8, ZERO) - SO4FR = MAX(SO4FR - CHI8, ZERO) - CHI3 = ZERO - CHI5 = W(4) - CHI6 = W(5) - CHI2 = MAX (SO4FR, ZERO) - CHI4 = MAX (W(3)-2.D0*CHI2, ZERO) -C - PSI8 = CHI8 - PSI6LO = TINY - PSI6HI = CHI6-TINY -C - WATER = TINY -C -C *** INITIAL VALUES FOR BISECTION ************************************* -C - X1 = PSI6LO - Y1 = FUNCO2A (X1) - IF (CHI6.LE.TINY) GOTO 50 -CCC IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -CCC IF (WATER .LE. TINY) GOTO 50 ! No water -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO *********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCO2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0 ; R(Cr+Na) < 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4CL, NA2SO4, K2SO4, MgSO4, CaSO4 -C 4. Completely dissolved: NH4NO3 -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCO2A (X) - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA - COMMON /CASEO/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, LAMDA, PSI1, PSI2, PSI3, PSI4, PSI5, - & PSI6, PSI7, PSI8, PSI9, A1, A2, A3, A4, - & A5, A6, A7, A8, A9 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI2 = CHI2 - PSI3 = ZERO -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0D0 - A2 = XK7 *(WATER/GAMA(4))**3.0D0 - A3 = XK6 /(R*TEMP*R*TEMP) - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0D0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0D0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0D0 - A65 = A6/A5 - A7 = XK17 *(WATER/GAMA(17))**3.0D0 -C A8 = XK23 *(WATER/GAMA(21))**2.0D0 -C - DENO = MAX(CHI6-PSI6-PSI3, ZERO) - PSI5 = PSI6*CHI5/(A6/A5*DENO + PSI6) - PSI5 = MIN(PSI5,CHI5) -C - PSI4 = MIN(PSI5+PSI6,CHI4) -C -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! PSI7 - CALL POLY3 (PSI2+PSI8, ZERO, -A7/4.D0, PSI7, ISLV) - IF (ISLV.EQ.0) THEN - PSI7 = MAX (MIN (PSI7, CHI7), ZERO) - ELSE - PSI7 = ZERO - ENDIF - ELSE - PSI7 = ZERO - ENDIF -C - IF (CHI2.GT.TINY .AND. WATER.GT.TINY) THEN - CALL POLY3 (PSI7+PSI8+PSI4, PSI4*(PSI7+PSI8)+ - & PSI4*PSI4/4.D0, (PSI4*PSI4*(PSI7+PSI8)-A2) - & /4.D0,PSI20, ISLV) - IF (ISLV.EQ.0) PSI2 = MIN (MAX(PSI20,ZERO), CHI2) - ENDIF -C PSI2 = 0.5D0*(2.0D0*SQRT(A2/A7)*PSI7 - PSI4) -C PSI2 = MIN (PSI2, CHI2) -C ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (2) = ZERO ! NaI - MOLAL (3) = 2.0D0*PSI2 + PSI4 ! NH4I - MOLAL (4) = PSI6 ! CLI - MOLAL (5) = PSI2+PSI7+PSI8 ! SO4I - MOLAL (6) = ZERO ! HSO4 - MOLAL (7) = PSI5 ! NO3I - MOLAL (8) = ZERO ! CAI - MOLAL (9) = 2.0D0*PSI7 ! KI - MOLAL (10)= PSI8 ! MGI -C -CCC MOLAL (1) = MAX(CHI5 - PSI5, TINY)*A5/PSI5 ! HI - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & -MOLAL(9)-2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CNH42S4 = MAX(CHI2 - PSI2, ZERO) - CNH4NO3 = ZERO - CK2SO4 = MAX(CHI7 - PSI7, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI9 - -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************* -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP ************************** -C - -C20 IF (CHI4.LE.TINY) THEN -C FUNCO2A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C ELSE -20 FUNCO2A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -C ENDIF -C - RETURN -C -C *** END OF FUNCTION FUNCO2A **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO1 -C *** CASE O1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCO1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCO1A, CALCO2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMO1) THEN - SCASE = 'O1 ; SUBCASE 1' - CALL CALCO1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'O1 ; SUBCASE 1' - ELSE - SCASE = 'O1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH2 (RH, DRMO1, DRNH4NO3, CALCO1A, CALCO2A) - SCASE = 'O1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCO1 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCO1A -C *** CASE O1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C SOLID (NH4)2SO4 IS CALCULATED FROM THE SULFATES, WHILE NH4NO3 -C IS CALCULATED FROM NH3-HNO3 EQUILIBRIUM. 'ZE' IS THE AMOUNT OF -C NH4NO3 THAT VOLATIZES WHEN ALL POSSILBE NH4NO3 IS INITIALLY IN -C THE SOLID PHASE. -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCO1A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, LAMDA1, LAMDA2, KAPA, KAPA1, KAPA2 -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CCASO4 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2) - CCASO4, ZERO) - CAFR = MAX(W(6) - CCASO4, ZERO) - CK2SO4 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX(SO4FR - CK2SO4, ZERO) - CNA2SO4 = MIN (0.5D0*W(1), SO4FR) ! CNA2SO4 - FRNA = MAX(W(1) - 2.D0*CNA2SO4, ZERO) - SO4FR = MAX(SO4FR - CNA2SO4, ZERO) - CMGSO4 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CMGSO4, ZERO) - SO4FR = MAX(SO4FR - CMGSO4, ZERO) -C - CNH42S4 = MAX (SO4FR , ZERO) ! CNH42S4 -C -C *** CALCULATE VOLATILE SPECIES ************************************** -C - ALF = W(3) - 2.0D0*CNH42S4 - BET = W(5) - GAM = W(4) -C - RTSQ = R*TEMP*R*TEMP - A1 = XK6/RTSQ - A2 = XK10/RTSQ - print *, A2 -C - THETA1 = GAM - BET*(A2/A1) - THETA2 = A2/A1 -C -C QUADRATIC EQUATION SOLUTION -C - BB = (THETA1-ALF-BET*(ONE+THETA2))/(ONE+THETA2) - CC = (ALF*BET-A1-BET*THETA1)/(ONE+THETA2) - DD = BB*BB - 4.0D0*CC - IF (DD.LT.ZERO) GOTO 100 ! Solve each reaction seperately -C -C TWO ROOTS FOR KAPA, CHECK AND SEE IF ANY VALID -C - SQDD = SQRT(DD) - KAPA1 = 0.5D0*(-BB+SQDD) - KAPA2 = 0.5D0*(-BB-SQDD) - LAMDA1 = THETA1 + THETA2*KAPA1 - LAMDA2 = THETA1 + THETA2*KAPA2 -C - IF (KAPA1.GE.ZERO .AND. LAMDA1.GE.ZERO) THEN - IF (ALF-KAPA1-LAMDA1.GE.ZERO .AND. - & BET-KAPA1.GE.ZERO .AND. GAM-LAMDA1.GE.ZERO) THEN - KAPA = KAPA1 - LAMDA= LAMDA1 - GOTO 200 - ENDIF - ENDIF -C - IF (KAPA2.GE.ZERO .AND. LAMDA2.GE.ZERO) THEN - IF (ALF-KAPA2-LAMDA2.GE.ZERO .AND. - & BET-KAPA2.GE.ZERO .AND. GAM-LAMDA2.GE.ZERO) THEN - KAPA = KAPA2 - LAMDA= LAMDA2 - GOTO 200 - ENDIF - ENDIF -C -C SEPERATE SOLUTION OF NH4CL & NH4NO3 EQUILIBRIA -C -100 KAPA = ZERO - LAMDA = ZERO - DD1 = (ALF+BET)*(ALF+BET) - 4.0D0*(ALF*BET-A1) - DD2 = (ALF+GAM)*(ALF+GAM) - 4.0D0*(ALF*GAM-A2) -C -C NH4CL EQUILIBRIUM -C - IF (DD1.GE.ZERO) THEN - SQDD1 = SQRT(DD1) - KAPA1 = 0.5D0*(ALF+BET + SQDD1) - KAPA2 = 0.5D0*(ALF+BET - SQDD1) -C - IF (KAPA1.GE.ZERO .AND. KAPA1.LE.MIN(ALF,BET)) THEN - KAPA = KAPA1 - ELSE IF (KAPA2.GE.ZERO .AND. KAPA2.LE.MIN(ALF,BET)) THEN - KAPA = KAPA2 - ELSE - KAPA = ZERO - ENDIF - ENDIF -C -C NH4NO3 EQUILIBRIUM -C - IF (DD2.GE.ZERO) THEN - SQDD2 = SQRT(DD2) - LAMDA1= 0.5D0*(ALF+GAM + SQDD2) - LAMDA2= 0.5D0*(ALF+GAM - SQDD2) -C - IF (LAMDA1.GE.ZERO .AND. LAMDA1.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA1 - ELSE IF (LAMDA2.GE.ZERO .AND. LAMDA2.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA2 - ELSE - LAMDA = ZERO - ENDIF - ENDIF -C -C IF BOTH KAPA, LAMDA ARE > 0, THEN APPLY EXISTANCE CRITERION -C - IF (KAPA.GT.ZERO .AND. LAMDA.GT.ZERO) THEN - IF (BET .LT. LAMDA/THETA1) THEN - KAPA = ZERO - ELSE - LAMDA= ZERO - ENDIF - ENDIF -C -C *** CALCULATE COMPOSITION OF VOLATILE SPECIES ************************ -C -200 CONTINUE - CNH4NO3 = LAMDA - CNH4CL = KAPA -C - GNH3 = MAX(ALF - KAPA - LAMDA, ZERO) - GHNO3 = MAX(GAM - LAMDA, ZERO) - GHCL = MAX(BET - KAPA, ZERO) -C - RETURN -C -C *** END OF SUBROUTINE CALCO1A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM8 -C *** CASE M8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4, NA2SO4, K2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM8 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM8 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM8 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4, NA2SO4, K2SO4 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM8 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = CHI9 - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C -C A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C A7 = XK8 *(WATER/GAMA(1))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CCASO4 = CHI11 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM8 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM8 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM8 ******************************************* -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM7 -C *** CASE M7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4, NA2SO4 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM7 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM7 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM7 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4, NA2SO4 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM7 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C -C A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 -C A7 = XK8 *(WATER/GAMA(1))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MAX (MIN (PSI9,CHI9), ZERO) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM7 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM7 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM7 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM6 -C *** CASE M6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM6 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM6 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM6 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MgSO4 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM6 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 -C A7 = XK8 *(WATER/GAMA(1))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN !NA2SO4 - RIZ = SQRT(A9/A1) - AA = (0.5D0*RIZ*(PSI7+PSI8)+PSI10+(1.D0+RIZ)*(PSI7+PSI8)) - & /(1.D0+RIZ) - BB = ((PSI7+PSI8)*(0.5D0*RIZ*(PSI7+PSI8)+PSI10)+0.25D0* - & (PSI7+PSI8)**2.0*(1.D0+RIZ))/(1.D0+RIZ) - CC = (0.25D0*(PSI7+PSI8)**2.0*(0.5D0*RIZ*(PSI7+PSI8)+PSI10) - & -A1/4.D0)/(1.D0+RIZ) -C AA = PSI7+PSI8+PSI9+PSI10 -C BB = (PSI7+PSI8)*(PSI9+PSI10)+0.25D0*(PSI7+PSI8)**2. -C CC = ((PSI7+PSI8)**2.*(PSI9+PSI10)-A1)/4.0D0 -C - CALL POLY3 (AA,BB,CC,PSI1,ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C -C IF (CHI9.GE.TINY .AND. WATER.GT.TINY) THEN -C PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) -C PSI9 = MAX (MIN (PSI9,CHI9), ZERO) -C ELSE -C PSI9 = ZERO -C ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (PSI9,CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM6 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM6 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM6 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM5 -C *** CASE M5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM5 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM5 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM5 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM5 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 -C A7 = XK8 *(WATER/GAMA(1))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN !NA2SO4 - RIZ = SQRT(A9/A1) - AA = (0.5D0*RIZ*(PSI7+PSI8)+PSI10+(1.D0+RIZ)*(PSI7+PSI8)) - & /(1.D0+RIZ) - BB = ((PSI7+PSI8)*(0.5D0*RIZ*(PSI7+PSI8)+PSI10)+0.25D0* - & (PSI7+PSI8)**2.0*(1.D0+RIZ))/(1.D0+RIZ) - CC = (0.25D0*(PSI7+PSI8)**2.0*(0.5D0*RIZ*(PSI7+PSI8)+PSI10) - & -A1/4.D0)/(1.D0+RIZ) -C AA = PSI7+PSI8+PSI9+PSI10 -C BB = (PSI7+PSI8)*(PSI9+PSI10)+0.25D0*(PSI7+PSI8)**2. -C CC = ((PSI7+PSI8)**2.*(PSI9+PSI10)-A1)/4.0D0 -C - CALL POLY3 (AA,BB,CC,PSI1,ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C - IF (CHI9.GE.TINY .AND. WATER.GT.TINY) THEN - PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) - PSI9 = MAX (MIN (PSI9,CHI9), ZERO) - ELSE - PSI9 = ZERO - ENDIF -C -C IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 -C CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) -C IF (ISLV.EQ.0) THEN -C PSI9 = MIN (PSI9,CHI9) -C ELSE -C PSI9 = ZERO -C ENDIF -C ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM5 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM5 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM5 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM4 -C *** CASE M4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL -C 4. Completely dissolved: NH4NO3, NANO3, NACL -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM4 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).LE.TINY .AND. W(5).LE.TINY) THEN - SCASE = 'M4 ; SUBCASE 1' - CALL CALCM1A - SCASE = 'M4 ; SUBCASE 1' - RETURN - ENDIF -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM4 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM4 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL -C 4. Completely dissolved: NH4NO3, NANO3, NACL -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM4 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A3 = XK6 /(R*TEMP*R*TEMP) - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 -C A7 = XK8 *(WATER/GAMA(1))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,TINY),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN !NA2SO4 - RIZ = SQRT(A9/A1) - AA = (0.5D0*RIZ*(PSI7+PSI8)+PSI10+(1.D0+RIZ)*(PSI7+PSI8)) - & /(1.D0+RIZ) - BB = ((PSI7+PSI8)*(0.5D0*RIZ*(PSI7+PSI8)+PSI10)+0.25D0* - & (PSI7+PSI8)**2.0*(1.D0+RIZ))/(1.D0+RIZ) - CC = (0.25D0*(PSI7+PSI8)**2.0*(0.5D0*RIZ*(PSI7+PSI8)+PSI10) - & -A1/4.D0)/(1.D0+RIZ) -C AA = PSI7+PSI8+PSI9+PSI10 -C BB = (PSI7+PSI8)*(PSI9+PSI10)+0.25D0*(PSI7+PSI8)**2. -C CC = ((PSI7+PSI8)**2.*(PSI9+PSI10)-A1)/4.0D0 -C - CALL POLY3 (AA,BB,CC,PSI1,ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C - IF (CHI9.GE.TINY .AND. WATER.GT.TINY) THEN - PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) - PSI9 = MAX (MIN (PSI9,CHI9), ZERO) - ELSE - PSI9 = ZERO - ENDIF -C -C IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 -C CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) -C IF (ISLV.EQ.0) THEN -C PSI9 = MIN (PSI9,CHI9) -C ELSE -C PSI9 = ZERO -C ENDIF -C ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX (MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM4 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM4 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM4 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM3 -C *** CASE M3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL -C 4. Completely dissolved: NH4NO3, NANO3 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM3 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - IF (W(4).LE.TINY) THEN ! NO3 NOT EXIST, WATER NOT POSSIBLE - SCASE = 'M3 ; SUBCASE 1' - CALL CALCM1A - SCASE = 'M3 ; SUBCASE 1' - RETURN - ENDIF -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM3 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM3 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL -C 4. Completely dissolved: NH4NO3, NANO3 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM3 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A3 = XK6 /(R*TEMP*R*TEMP) - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A10 = XK23 *(WATER/GAMA(21))**2.0 -C A8 = XK9 *(WATER/GAMA(3))**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,TINY),CHI4) - ELSE - PSI4 = TINY - ENDIF -C -C IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION -C VITA = 2.D0*PSI1+PSI8+PSI6 ! AN DE DOULEPSEI KALA VGALE PSI1 APO DW -C GKAMA= PSI6*(2.D0*PSI1+PSI8)-A7 -C DIAK = MAX(VITA**2.0 - 4.0D0*GKAMA,ZERO) -C PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) -C PSI7 = MAX(MIN(PSI7, CHI7), ZERO) -C ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - DIAK = (PSI8-PSI6)**2.D0 + 4.D0*A7 - PSI7 = 0.5D0*( -(PSI8+PSI6) + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -CC -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN !NA2SO4 - RIZ = SQRT(A9/A1) - AA = (0.5D0*RIZ*(PSI7+PSI8)+PSI10+(1.D0+RIZ)*(PSI7+PSI8)) - & /(1.D0+RIZ) - BB = ((PSI7+PSI8)*(0.5D0*RIZ*(PSI7+PSI8)+PSI10)+0.25D0* - & (PSI7+PSI8)**2.0*(1.D0+RIZ))/(1.D0+RIZ) - CC = (0.25D0*(PSI7+PSI8)**2.0*(0.5D0*RIZ*(PSI7+PSI8)+PSI10) - & -A1/4.D0)/(1.D0+RIZ) -C AA = PSI7+PSI8+PSI9+PSI10 -C BB = (PSI7+PSI8)*(PSI9+PSI10)+0.25D0*(PSI7+PSI8)**2. -C CC = ((PSI7+PSI8)**2.*(PSI9+PSI10)-A1)/4.0D0 -C - CALL POLY3 (AA,BB,CC,PSI1,ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C - IF (CHI9.GE.TINY) THEN - PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) - PSI9 = MAX (MIN (PSI9,CHI9), ZERO) - ELSE - PSI9 = ZERO - ENDIF -C -C IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 -C CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) -C IF (ISLV.EQ.0) THEN -C PSI9 = MIN (PSI9,CHI9) -C ELSE -C PSI9 = ZERO -C ENDIF -C ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = ZERO - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX (MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM3 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCM3 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM3 ******************************************* -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM2 -C *** CASE M2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. NH4NO3(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCH2A) -C 2. NH4NO3(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. NH4NO3(s) NOT POSSIBLE, AND RH >= MDRH. (MDRH REGION) -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES M1A, M2B -C RESPECTIVELY (BECAUSE MDRH POINTS COINCIDE). -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCM1A, CALCM3 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF NITRATES *********************** -C - CALL CALCM1A -C - IF (CNH4NO3.GT.TINY) THEN ! NO3 EXISTS, WATER POSSIBLE - SCASE = 'M2 ; SUBCASE 1' - CALL CALCM2A - SCASE = 'M2 ; SUBCASE 1' - ELSE ! NO3 NON EXISTANT, WATER NOT POSSIBLE - SCASE = 'M2 ; SUBCASE 1' - CALL CALCM1A - SCASE = 'M2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY .AND. RH.LT.DRMM2) THEN ! DRY AEROSOL - SCASE = 'M2 ; SUBCASE 2' -C - ELSEIF (WATER.LE.TINY .AND. RH.GE.DRMM2) THEN ! MDRH OF M2 - SCASE = 'M2 ; SUBCASE 3' - CALL CALCMDRH2 (RH, DRMM2, DRNANO3, CALCM1A, CALCM3) - SCASE = 'M2 ; SUBCASE 3' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCM2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM2A -C *** CASE M2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 -C 4. Completely dissolved: NH4NO3 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM2A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2)-CHI11, ZERO) - CAFR = MAX(W(6)-CHI11, ZERO) - CHI9 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7)-2.D0*CHI9, ZERO) - SO4FR = MAX(SO4FR-CHI9, ZERO) - CHI10 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8)-CHI10, ZERO) - SO4FR = MAX(SO4FR-CHI10, ZERO) - CHI1 = MAX (SO4FR,ZERO) ! CNA2SO4 - CHI2 = ZERO ! CNH42S4 - CHI3 = ZERO ! CNH4CL - FRNA = MAX (W(1)-2.D0*CHI1, ZERO) - CHI8 = MIN (FRNA, W(4)) ! CNANO3 - CHI4 = W(3) ! NH3(g) - CHI5 = MAX (W(4)-CHI8, ZERO) ! HNO3(g) - CHI7 = MIN (MAX(FRNA-CHI8, ZERO), W(5)) ! CNACL - CHI6 = MAX (W(5)-CHI7, ZERO) ! HCL(g) -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCM2A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCM2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 -C 4. Completely dissolved: NH4NO3 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCM2A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = CHI1 - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK5 *(WATER/GAMA(2))**3.0 - A3 = XK6 /(R*TEMP*R*TEMP) - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A64 = (XK3*XK2/XKW)*(GAMA(10)/GAMA(5)/GAMA(11))**2.0 - A64 = A64*(R*TEMP*WATER)**2.0 -C A11 = XK1*WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6+PSI7) - A6/A5*PSI8*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,TINY),CHI4) - ELSE - PSI4 = TINY - ENDIF -C -C IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION -C VITA = 2.D0*PSI1+PSI8+PSI6 -C GKAMA= PSI6*(2.D0*PSI1+PSI8)-A7 -C DIAK = MAX(VITA**2.0 - 4.0D0*GKAMA,ZERO) -C PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) -C PSI7 = MAX(MIN(PSI7, CHI7), ZERO) -C ENDIF -CC -C IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C BIT = 2.D0*PSI1+PSI7+PSI5 -C GKAM = PSI5*(2.D0*PSI1+PSI8)-A8 -C DIA = BIT**2.0 - 4.0D0*GKAM -C PSI8 = 0.5D0*( -BIT + SQRT(DIA) ) -C PSI8 = MAX(MIN(PSI8, CHI8), ZERO) -C ENDIF -CC - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - DIAK = (PSI8-PSI6)**2.D0 + 4.D0*A7 - PSI7 = 0.5D0*( -(PSI8+PSI6) + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION - DIAK = (PSI7-PSI5)**2.D0 + 4.D0*A8 - PSI8 = 0.5D0*( -(PSI7+PSI5) + SQRT(DIAK) ) - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C - IF (CHI1.GT.TINY .AND. WATER.GT.TINY) THEN !NA2SO4 - RIZ = SQRT(A9/A1) - AA = (0.5D0*RIZ*(PSI7+PSI8)+PSI10+(1.D0+RIZ)*(PSI7+PSI8)) - & /(1.D0+RIZ) - BB = ((PSI7+PSI8)*(0.5D0*RIZ*(PSI7+PSI8)+PSI10)+0.25D0* - & (PSI7+PSI8)**2.0*(1.D0+RIZ))/(1.D0+RIZ) - CC = (0.25D0*(PSI7+PSI8)**2.0*(0.5D0*RIZ*(PSI7+PSI8)+PSI10) - & -A1/4.D0)/(1.D0+RIZ) -C -C AA = PSI7+PSI8+PSI9+PSI10 -C BB = (PSI7+PSI8)*(PSI9+PSI10)+0.25D0*(PSI7+PSI8)**2. -C CC = ((PSI7+PSI8)**2.*(PSI9+PSI10)-A1)/4.0D0 -CC - CALL POLY3 (AA,BB,CC,PSI1,ISLV) - IF (ISLV.EQ.0) THEN - PSI1 = MIN (PSI1,CHI1) - ELSE - PSI1 = ZERO - ENDIF - ENDIF -C - IF (CHI9.GE.TINY .AND. WATER.GT.TINY) THEN -C PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) - PSI9 = 0.5D0*SQRT(A9/A1)*(2.0D0*PSI1+PSI7+PSI8) - PSI9 = MAX (MIN (PSI9,CHI9), ZERO) - ELSE - PSI9 = ZERO - ENDIF -C -C IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 -C CALL POLY3 (PSI1+PSI10,ZERO,-A9/4.D0, PSI9, ISLV) -C IF (ISLV.EQ.0) THEN -C PSI9 = MAX (MIN (PSI9,CHI9), ZERO) -C ELSE -C PSI9 = ZERO -C ENDIF -C ENDIF -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 + 2.D0*PSI1 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 ! CLI - MOLAL (5) = PSI2 + PSI1 + PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 ! NO3I - MOLAL (8) = PSI11 ! CAI - MOLAL (9) = 2.D0*PSI9 ! KI - MOLAL (10)= PSI10 ! MGI -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNACL = MAX(CHI7 - PSI7, ZERO) - CNANO3 = MAX(CHI8 - PSI8, ZERO) - CNA2SO4 = MAX(CHI1 - PSI1, ZERO) - CK2SO4 = MAX(CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCM2A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A64 - ONE -20 FUNCM2A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCM2A ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM1 -C *** CASE M1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3, NH4NO3 -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCH1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCM1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCM1A, CALCM2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMM1) THEN - SCASE = 'M1 ; SUBCASE 1' - CALL CALCM1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'M1 ; SUBCASE 1' - ELSE - SCASE = 'M1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH2 (RH, DRMM1, DRNH4NO3, CALCM1A, CALCM2A) - SCASE = 'M1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCM1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCM1A -C *** CASE M1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr < 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3, NH4NO3 -C -C *** COPYRIGHT 1996-2000, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= - - SUBROUTINE CALCM1A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, LAMDA1, LAMDA2, KAPA, KAPA1, KAPA2, NAFR, - & NO3FR -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CCASO4 = MIN (W(6), W(2)) ! CCASO4 - SO4FR = MAX(W(2) - CCASO4, ZERO) - CAFR = MAX(W(6) - CCASO4, ZERO) - CK2SO4 = MIN (0.5D0*W(7), SO4FR) ! CK2S04 - FRK = MAX(W(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX(SO4FR - CK2SO4, ZERO) - CMGSO4 = MIN (W(8), SO4FR) ! CMGSO4 - FRMG = MAX(W(8) - CMGSO4, ZERO) - SO4FR = MAX(SO4FR - CMGSO4, ZERO) - CNA2SO4 = MAX (SO4FR,ZERO) ! CNA2SO4 - NAFR = MAX (W(1)-2.D0*CNA2SO4, ZERO) - CNANO3 = MIN (NAFR, W(4)) ! CNANO3 - NO3FR = MAX (W(4)-CNANO3, ZERO) - CNACL = MIN (MAX(NAFR-CNANO3, ZERO), W(5)) ! CNACL - CLFR = MAX (W(5)-CNACL, ZERO) -C -C *** CALCULATE VOLATILE SPECIES ************************************** -C - ALF = W(3) ! FREE NH3 - BET = CLFR ! FREE CL - GAM = NO3FR ! FREE NO3 -C - RTSQ = R*TEMP*R*TEMP - A1 = XK6/RTSQ - A2 = XK10/RTSQ -C - THETA1 = GAM - BET*(A2/A1) - THETA2 = A2/A1 -C -C QUADRATIC EQUATION SOLUTION -C - BB = (THETA1-ALF-BET*(ONE+THETA2))/(ONE+THETA2) - CC = (ALF*BET-A1-BET*THETA1)/(ONE+THETA2) - DD = BB*BB - 4.0D0*CC - IF (DD.LT.ZERO) GOTO 100 ! Solve each reaction seperately -C -C TWO ROOTS FOR KAPA, CHECK AND SEE IF ANY VALID -C - SQDD = SQRT(DD) - KAPA1 = 0.5D0*(-BB+SQDD) - KAPA2 = 0.5D0*(-BB-SQDD) - LAMDA1 = THETA1 + THETA2*KAPA1 - LAMDA2 = THETA1 + THETA2*KAPA2 -C - IF (KAPA1.GE.ZERO .AND. LAMDA1.GE.ZERO) THEN - IF (ALF-KAPA1-LAMDA1.GE.ZERO .AND. - & BET-KAPA1.GE.ZERO .AND. GAM-LAMDA1.GE.ZERO) THEN - KAPA = KAPA1 - LAMDA= LAMDA1 - GOTO 200 - ENDIF - ENDIF -C - IF (KAPA2.GE.ZERO .AND. LAMDA2.GE.ZERO) THEN - IF (ALF-KAPA2-LAMDA2.GE.ZERO .AND. - & BET-KAPA2.GE.ZERO .AND. GAM-LAMDA2.GE.ZERO) THEN - KAPA = KAPA2 - LAMDA= LAMDA2 - GOTO 200 - ENDIF - ENDIF -C -C SEPERATE SOLUTION OF NH4CL & NH4NO3 EQUILIBRIA -C -100 KAPA = ZERO - LAMDA = ZERO - DD1 = (ALF+BET)*(ALF+BET) - 4.0D0*(ALF*BET-A1) - DD2 = (ALF+GAM)*(ALF+GAM) - 4.0D0*(ALF*GAM-A2) -C -C NH4CL EQUILIBRIUM -C - IF (DD1.GE.ZERO) THEN - SQDD1 = SQRT(DD1) - KAPA1 = 0.5D0*(ALF+BET + SQDD1) - KAPA2 = 0.5D0*(ALF+BET - SQDD1) -C - IF (KAPA1.GE.ZERO .AND. KAPA1.LE.MIN(ALF,BET)) THEN - KAPA = KAPA1 - ELSE IF (KAPA2.GE.ZERO .AND. KAPA2.LE.MIN(ALF,BET)) THEN - KAPA = KAPA2 - ELSE - KAPA = ZERO - ENDIF - ENDIF -C -C NH4NO3 EQUILIBRIUM -C - IF (DD2.GE.ZERO) THEN - SQDD2 = SQRT(DD2) - LAMDA1= 0.5D0*(ALF+GAM + SQDD2) - LAMDA2= 0.5D0*(ALF+GAM - SQDD2) -C - IF (LAMDA1.GE.ZERO .AND. LAMDA1.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA1 - ELSE IF (LAMDA2.GE.ZERO .AND. LAMDA2.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA2 - ELSE - LAMDA = ZERO - ENDIF - ENDIF -C -C IF BOTH KAPA, LAMDA ARE > 0, THEN APPLY EXISTANCE CRITERION -C - IF (KAPA.GT.ZERO .AND. LAMDA.GT.ZERO) THEN - IF (BET .LT. LAMDA/THETA1) THEN - KAPA = ZERO - ELSE - LAMDA= ZERO - ENDIF - ENDIF -C -C *** CALCULATE COMPOSITION OF VOLATILE SPECIES *********************** -C -200 CONTINUE - CNH4NO3 = LAMDA - CNH4CL = KAPA -C - GNH3 = ALF - KAPA - LAMDA - GHNO3 = GAM - LAMDA - GHCL = BET - KAPA -C - RETURN -C -C *** END OF SUBROUTINE CALCM1A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP13 -C *** CASE P13 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP13 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP13 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP13 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP13 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI4 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = CHI9 - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = CHI13 - PSI14 = CHI14 - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C -C *** CALCULATE SPECIATION ********************************************* -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -C -C *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -C - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP13 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP13 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP13 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP12 -C *** CASE P12 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP12 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP12 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP12 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP12 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI4 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = CHI13 - PSI14 = CHI14 - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN(MAX(PSI5, TINY),CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = ZERO - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP12 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP12 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP12 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP11 -C *** CASE P11 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP11 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP11 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP11 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP11 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = CHI14 - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 =0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP11 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP11 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP11 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP10 -C *** CASE P10 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP10 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP10 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP10 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP10 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = CHI14 - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 =0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP10 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP10 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP10 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP9 -C *** CASE P9 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP9 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP9 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP9 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP9 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP9 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP9 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP9 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP8 -C *** CASE P8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP8 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP8 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP8 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP8 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = CHI7 - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -C -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO -C CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP8 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP8 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP8 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP7 -C *** CASE P7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP7 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP7 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP7 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP7 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = CHI8 - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO -C CNH4CL = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = ZERO - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP7 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP7 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP7 ******************************************* -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP6 -C *** CASE P6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP6 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP6 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP6 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NH4NO3 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP6 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = ZERO - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = CHI5*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - - & A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C VIT = PSI5+PSI13+PSI7+2.D0*PSI12+2.D0*PSI15 -C GKAM = PSI7*(2.D0*PSI12+PSI5+PSI13+2.D0*PSI15)-A8 -C DIA = MAX(VIT*VIT - 4.0D0*GKAM,ZERO) -C PSI8 = 0.5D0*( -VIT + SQRT(DIA) ) - PSI8 = A8/A7*(PSI6+PSI7+PSI14+2.D0*PSI16+2.D0*PSI17)- - & PSI5-2.D0*PSI12-PSI13-2.D0*PSI15 - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -C -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C - CNH4NO3 = ZERO -C CNH4CL = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = MAX (CHI8 - PSI8, ZERO) - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP6 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP6 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP6 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP5 -C *** CASE P5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, KCL, MGSO4, -C NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP5 - INCLUDE 'isrpia.inc' - EXTERNAL CALCP1A, CALCP6 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (W(4).GT.TINY) THEN ! NO3 EXIST, WATER POSSIBLE - SCASE = 'P5 ; SUBCASE 1' - CALL CALCP5A - SCASE = 'P5 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'P1 ; SUBCASE 1' - CALL CALCP1A - SCASE = 'P1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP5) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCP1A - SCASE = 'P5 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'P5 ; SUBCASE 3' ! MDRH REGION (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP5, DRNH4NO3, CALCP1A, CALCP6) - SCASE = 'P5 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCP5 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP5A -C *** CASE P5A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3, NH4NO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP5A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP5 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP5 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3, NH4NO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP5 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = ZERO - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (CHI5-PSI2)*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - & - A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C VIT = PSI5+PSI13+PSI7+2.D0*PSI12+2.D0*PSI15 -C GKAM = PSI7*(2.D0*PSI12+PSI5+PSI13+2.D0*PSI15)-A8 -C DIA = MAX(VIT*VIT - 4.0D0*GKAM,ZERO) -C PSI8 = 0.5D0*( -VIT + SQRT(DIA) ) - PSI8 = A8/A7*(PSI6+PSI7+PSI14+2.D0*PSI16+2.D0*PSI17)- - & PSI5-2.D0*PSI12-PSI13-2.D0*PSI15 - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -CC -CC *** CALCULATE H+ ***************************************************** -CC -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNH4NO3 = ZERO -C CNH4CL = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = MAX (CHI8 - PSI8, ZERO) - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** NH4NO3(s) calculations -C - A2 = XK10 /(R*TEMP*R*TEMP) - IF (GNH3*GHNO3.GT.A2) THEN - DELT = MIN(GNH3, GHNO3) - BB = -(GNH3+GHNO3) - CC = GNH3*GHNO3-A2 - DD = BB*BB - 4.D0*CC - PSI21 = 0.5D0*(-BB + SQRT(DD)) - PSI22 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI21.GT.ZERO .AND. PSI21.GT.ZERO) THEN - PSI2 = PSI21 - ELSEIF (DELT-PSI22.GT.ZERO .AND. PSI22.GT.ZERO) THEN - PSI2 = PSI22 - ELSE - PSI2 = ZERO - ENDIF - ELSE - PSI2 = ZERO - ENDIF - PSI2 = MAX(MIN(MIN(PSI2,CHI4-PSI4-PSI3),CHI5-PSI5), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI2, TINY) - GHCL = MAX(GHNO3 - PSI2, TINY) - CNH4NO3 = PSI2 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP5 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP5 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP5 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP4 -C *** CASE P4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP4 - INCLUDE 'isrpia.inc' - EXTERNAL CALCP1A, CALCP5A -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (W(4).GT.TINY) THEN ! NO3 EXIST, WATER POSSIBLE - SCASE = 'P4 ; SUBCASE 1' - CALL CALCP4A - SCASE = 'P4 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'P1 ; SUBCASE 1' - CALL CALCP1A - SCASE = 'P1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP4) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCP1A - SCASE = 'P4 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'P4 ; SUBCASE 3' ! MDRH REGION (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP4, DRMGNO32, CALCP1A, CALCP5A) - SCASE = 'P4 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCP4 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP4A -C *** CASE P4A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3, NH4NO3, MG(NO3)2 -C 4. Completely dissolved: CA(NO3)2, CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP4A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP4 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP4 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3, NH4NO3, MG(NO3)2 -C 4. Completely dissolved: CA(NO3)2, CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP4 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = ZERO - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (CHI5-PSI2)*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - & - A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C VIT = PSI5+PSI13+PSI7+2.D0*PSI12+2.D0*PSI15 -C GKAM = PSI7*(2.D0*PSI12+PSI5+PSI13+2.D0*PSI15)-A8 -C DIA = MAX(VIT*VIT - 4.0D0*GKAM,ZERO) -C PSI8 = 0.5D0*( -VIT + SQRT(DIA) ) - PSI8 = A8/A7*(PSI6+PSI7+PSI14+2.D0*PSI16+2.D0*PSI17)- - & PSI5-2.D0*PSI12-PSI13-2.D0*PSI15 - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNH4CL = ZERO -C CNH4NO3 = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = MAX (CHI8 - PSI8, ZERO) - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** NH4NO3(s) calculations -C - A2 = XK10 /(R*TEMP*R*TEMP) - IF (GNH3*GHNO3.GT.A2) THEN - DELT = MIN(GNH3, GHNO3) - BB = -(GNH3+GHNO3) - CC = GNH3*GHNO3-A2 - DD = BB*BB - 4.D0*CC - PSI21 = 0.5D0*(-BB + SQRT(DD)) - PSI22 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI21.GT.ZERO .AND. PSI21.GT.ZERO) THEN - PSI2 = PSI21 - ELSEIF (DELT-PSI22.GT.ZERO .AND. PSI22.GT.ZERO) THEN - PSI2 = PSI22 - ELSE - PSI2 = ZERO - ENDIF - ELSE - PSI2 = ZERO - ENDIF - PSI2 = MAX(MIN(MIN(PSI2,CHI4-PSI4-PSI3),CHI5-PSI5), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI2, TINY) - GHCL = MAX(GHNO3 - PSI2, TINY) - CNH4NO3 = PSI2 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP4 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP4 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP4 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP3 -C *** CASE P3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCP1A, CALCP4A -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (W(4).GT.TINY .AND. W(5).GT.TINY) THEN ! NO3,CL EXIST, WATER POSSIBLE - SCASE = 'P3 ; SUBCASE 1' - CALL CALCP3A - SCASE = 'P3 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'P1 ; SUBCASE 1' - CALL CALCP1A - SCASE = 'P1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP3) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCP1A - SCASE = 'P3 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'P3 ; SUBCASE 3' ! MDRH REGION (CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP3, DRCANO32, CALCP1A, CALCP4A) - SCASE = 'P3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCP3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP3A -C *** CASE P3A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, MG(NO3)2, CA(NO3)2 -C 4. Completely dissolved: CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP3A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP3 (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP3 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, MG(NO3)2, CA(NO3)2 -C 4. Completely dissolved: CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP3 (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = ZERO - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (CHI5-PSI2)*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - & - A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C VIT = PSI5+PSI13+PSI7+2.D0*PSI12+2.D0*PSI15 -C GKAM = PSI7*(2.D0*PSI12+PSI5+PSI13+2.D0*PSI15)-A8 -C DIA = MAX(VIT*VIT - 4.0D0*GKAM,ZERO) -C PSI8 = 0.5D0*( -VIT + SQRT(DIA) ) - PSI8 = A8/A7*(PSI6+PSI7+PSI14+2.D0*PSI16+2.D0*PSI17)- - & PSI5-2.D0*PSI12-PSI13-2.D0*PSI15 - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNH4CL = ZERO -C CNH4NO3 = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = MAX (CHI8 - PSI8, ZERO) - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6), ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** NH4NO3(s) calculations -C - A2 = XK10 /(R*TEMP*R*TEMP) - IF (GNH3*GHNO3.GT.A2) THEN - DELT = MIN(GNH3, GHNO3) - BB = -(GNH3+GHNO3) - CC = GNH3*GHNO3-A2 - DD = BB*BB - 4.D0*CC - PSI21 = 0.5D0*(-BB + SQRT(DD)) - PSI22 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI21.GT.ZERO .AND. PSI21.GT.ZERO) THEN - PSI2 = PSI21 - ELSEIF (DELT-PSI22.GT.ZERO .AND. PSI22.GT.ZERO) THEN - PSI2 = PSI22 - ELSE - PSI2 = ZERO - ENDIF - ELSE - PSI2 = ZERO - ENDIF - PSI2 = MAX(MIN(MIN(PSI2,CHI4-PSI4-PSI3),CHI5-PSI5),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI2, TINY) - GHCL = MAX(GHNO3 - PSI2, TINY) - CNH4NO3 = PSI2 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP3 = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP3 = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP3 ******************************************* -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP2 -C *** CASE P2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. CACL2(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCL2A) -C 2. CACL2(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. CACL2(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES P1A, P2B -C RESPECTIVELY -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C -C - SUBROUTINE CALCP2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCP1A, CALCP3A, CALCP4A, CALCP5A, CALCP6 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCP1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************** -C - IF (CCACL2.GT.TINY) THEN - SCASE = 'P2 ; SUBCASE 1' - CALL CALCP2A - SCASE = 'P2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP2) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCP1A - SCASE = 'P2 ; SUBCASE 2' - ELSE - IF (CMGCL2.GT. TINY) THEN - SCASE = 'P2 ; SUBCASE 3' ! MDRH (CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MGCL2, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP2, DRMGCL2, CALCP1A, CALCP3A) - SCASE = 'P2 ; SUBCASE 3' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP3 .AND. RH.LT.DRMP4) THEN - SCASE = 'P2 ; SUBCASE 4' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, CANO32, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP3, DRCANO32, CALCP1A, CALCP4A) - SCASE = 'P2 ; SUBCASE 4' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP4 .AND. RH.LT.DRMP5) THEN - SCASE = 'P2 ; SUBCASE 5' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MGNO32, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP4, DRMGNO32, CALCP1A, CALCP5A) - SCASE = 'P2 ; SUBCASE 5' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP5) THEN - SCASE = 'P2 ; SUBCASE 6' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRH2 (RH, DRMP5, DRNH4NO3, CALCP1A, CALCP6) - SCASE = 'P2 ; SUBCASE 6' - ELSE - WATER = TINY - DO 20 I=1,NIONS - MOLAL(I) = ZERO -20 CONTINUE - CALL CALCP1A - SCASE = 'P2 ; SUBCASE 2' - ENDIF - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCP2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP2A -C *** CASE P2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, MG(NO3)2, CA(NO3)2 -C 4. Completely dissolved: CACL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP2A - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU = .TRUE. - CHI11 = MIN (W(2), W(6)) ! CCASO4 - FRCA = MAX (W(6) - CHI11, ZERO) - FRSO4 = MAX (W(2) - CHI11, ZERO) - CHI9 = MIN (FRSO4, 0.5D0*W(7)) ! CK2SO4 - FRK = MAX (W(7) - 2.D0*CHI9, ZERO) - FRSO4 = MAX (FRSO4 - CHI9, ZERO) - CHI10 = FRSO4 ! CMGSO4 - FRMG = MAX (W(8) - CHI10, ZERO) - CHI7 = MIN (W(1), W(5)) ! CNACL - FRNA = MAX (W(1) - CHI7, ZERO) - FRCL = MAX (W(5) - CHI7, ZERO) - CHI12 = MIN (FRCA, 0.5D0*W(4)) ! CCANO32 - FRCA = MAX (FRCA - CHI12, ZERO) - FRNO3 = MAX (W(4) - 2.D0*CHI12, ZERO) - CHI17 = MIN (FRCA, 0.5D0*FRCL) ! CCACL2 - FRCA = MAX (FRCA - CHI17, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI17, ZERO) - CHI15 = MIN (FRMG, 0.5D0*FRNO3) ! CMGNO32 - FRMG = MAX (FRMG - CHI15, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CHI15, ZERO) - CHI16 = MIN (FRMG, 0.5D0*FRCL) ! CMGCL2 - FRMG = MAX (FRMG - CHI16, ZERO) - FRCL = MAX (FRCL - 2.D0*CHI16, ZERO) - CHI8 = MIN (FRNA, FRNO3) ! CNANO3 - FRNA = MAX (FRNA - CHI8, ZERO) - FRNO3 = MAX (FRNO3 - CHI8, ZERO) - CHI14 = MIN (FRK, FRCL) ! CKCL - FRK = MAX (FRK - CHI14, ZERO) - FRCL = MAX (FRCL - CHI14, ZERO) - CHI13 = MIN (FRK, FRNO3) ! CKNO3 - FRK = MAX (FRK - CHI13, ZERO) - FRNO3 = MAX (FRNO3 - CHI13, ZERO) -C - CHI5 = FRNO3 ! HNO3(g) - CHI6 = FRCL ! HCL(g) - CHI4 = W(3) ! NH3(g) -C - CHI3 = ZERO ! CNH4CL - CHI1 = ZERO - CHI2 = ZERO -C - PSI6LO = TINY - PSI6HI = CHI6-TINY ! MIN(CHI6-TINY, CHI4) -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI6LO - Y1 = FUNCP2A (X1) - IF (ABS(Y1).LE.EPS .OR. CHI6.LE.TINY) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1+DX - Y2 = FUNCP2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION; IF ABS(Y2) 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, MG(NO3)2, CA(NO3)2, MGCL2 -C 4. Completely dissolved: CACL2 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCP2A (X) - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = X - PSI1 = ZERO - PSI2 = ZERO - PSI3 = ZERO - PSI7 = ZERO - PSI8 = ZERO - PSI9 = ZERO - PSI10 = CHI10 - PSI11 = ZERO - PSI12 = CHI12 - PSI13 = ZERO - PSI14 = ZERO - PSI15 = CHI15 - PSI16 = CHI16 - PSI17 = CHI17 - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2.0 - A5 = XK4 *R*TEMP*(WATER/GAMA(10))**2.0 - A6 = XK3 *R*TEMP*(WATER/GAMA(11))**2.0 - A9 = XK17 *(WATER/GAMA(17))**3.0 - A13 = XK19 *(WATER/GAMA(19))**2.0 - A14 = XK20 *(WATER/GAMA(20))**2.0 - A7 = XK8 *(WATER/GAMA(1))**2.0 - A8 = XK9 *(WATER/GAMA(3))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (CHI5-PSI2)*(PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17) - & - A6/A5*(PSI8+2.D0*PSI12+PSI13+2.D0*PSI15)*(CHI6-PSI6-PSI3) - PSI5 = PSI5/(A6/A5*(CHI6-PSI6-PSI3) + PSI6 + PSI7 + PSI14 + - & 2.D0*PSI16 + 2.D0*PSI17) - PSI5 = MIN (MAX (PSI5, TINY) , CHI5) -C - IF (W(3).GT.TINY .AND. WATER.GT.TINY) THEN ! First try 3rd order soln - BB =-(CHI4 + PSI6 + PSI5 + 1.d0/A4) - CC = CHI4*(PSI5+PSI6) - DD = MAX(BB*BB-4.d0*CC,ZERO) - PSI4 =0.5d0*(-BB - SQRT(DD)) - PSI4 = MIN(MAX(PSI4,ZERO),CHI4) - ELSE - PSI4 = TINY - ENDIF -C - IF (CHI13.GT.TINY .AND. WATER.GT.TINY) THEN !KNO3 - VHTA = PSI5+PSI8+2.D0*PSI12+2.D0*PSI15+PSI14+2.D0*PSI9 - GKAMA = (PSI5+PSI8+2.D0*PSI12+2.D0*PSI15)*(2.D0*PSI9+PSI14)-A13 - DELTA = MAX(VHTA*VHTA-4.d0*GKAMA,ZERO) - PSI13 = 0.5d0*(-VHTA + SQRT(DELTA)) - PSI13 = MIN(MAX(PSI13,ZERO),CHI13) - ENDIF -C - IF (CHI14.GT.TINY .AND. WATER.GT.TINY) THEN !KCL - PSI14 = A14/A13*(PSI5+PSI8+2.D0*PSI12+PSI13+2.D0*PSI15) - - & PSI6-PSI7-2.D0*PSI16-2.D0*PSI17 - PSI14 = MIN (MAX (PSI14, ZERO), CHI14) - ENDIF -C - IF (CHI9.GT.TINY .AND. WATER.GT.TINY) THEN !K2SO4 - BBP = PSI10+PSI13+PSI14 - CCP = (PSI13+PSI14)*(0.25D0*(PSI13+PSI14)+PSI10) - DDP = 0.25D0*(PSI13+PSI14)**2.0*PSI10-A9/4.D0 - CALL POLY3 (BBP, CCP, DDP, PSI9, ISLV) - IF (ISLV.EQ.0) THEN - PSI9 = MIN (MAX(PSI9,ZERO) , CHI9) - ELSE - PSI9 = ZERO - ENDIF - ENDIF -C - IF (CHI7.GT.TINY .AND. WATER.GT.TINY) THEN ! NACL DISSOLUTION - VITA = PSI6+PSI14+PSI8+2.D0*PSI16+2.D0*PSI17 - GKAMA= PSI8*(2.D0*PSI16+PSI6+PSI14+2.D0*PSI17)-A7 - DIAK = MAX(VITA*VITA - 4.0D0*GKAMA,ZERO) - PSI7 = 0.5D0*( -VITA + SQRT(DIAK) ) - PSI7 = MAX(MIN(PSI7, CHI7), ZERO) - ENDIF -C - IF (CHI8.GT.TINY .AND. WATER.GT.TINY) THEN ! NANO3 DISSOLUTION -C VIT = PSI5+PSI13+PSI7+2.D0*PSI12+2.D0*PSI15 -C GKAM = PSI7*(2.D0*PSI12+PSI5+PSI13+2.D0*PSI15)-A8 -C DIA = MAX(VIT*VIT - 4.0D0*GKAM,ZERO) -C PSI8 = 0.5D0*( -VIT + SQRT(DIA) ) - PSI8 = A8/A7*(PSI6+PSI7+PSI14+2.D0*PSI16+2.D0*PSI17)- - & PSI5-2.D0*PSI12-PSI13-2.D0*PSI15 - PSI8 = MAX(MIN(PSI8, CHI8), ZERO) - ENDIF -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL (2) = PSI8 + PSI7 ! NAI - MOLAL (3) = PSI4 ! NH4I - MOLAL (4) = PSI6 + PSI7 + PSI14 + 2.D0*PSI16 + 2.D0*PSI17 ! CLI - MOLAL (5) = PSI9 + PSI10 ! SO4I - MOLAL (6) = ZERO ! HSO4I - MOLAL (7) = PSI5 + PSI8 + 2.D0*PSI12 + PSI13 + 2.D0*PSI15 ! NO3I - MOLAL (8) = PSI11 + PSI12 + PSI17 ! CAI - MOLAL (9) = 2.D0*PSI9 + PSI13 + PSI14 ! KI - MOLAL (10)= PSI10 + PSI15 + PSI16 ! MGI -C -C *** CALCULATE H+ ***************************************************** -C -C REST = 2.D0*W(2) + W(4) + W(5) -CC -C DELT1 = 0.0d0 -C DELT2 = 0.0d0 -C IF (W(1)+W(6)+W(7)+W(8).GT.REST) THEN -CC -CC *** CALCULATE EQUILIBRIUM CONSTANTS ********************************** -CC -C ALFA1 = XK26*RH*(WATER/1.0) ! CO2(aq) + H2O -C ALFA2 = XK27*(WATER/1.0) ! HCO3- -CC -C X = W(1)+W(6)+W(7)+W(8) - REST ! EXCESS OF CRUSTALS EQUALS CO2(aq) -CC -C DIAK = SQRT( (ALFA1)**2.0 + 4.0D0*ALFA1*X) -C DELT1 = 0.5*(-ALFA1 + DIAK) -C DELT1 = MIN ( MAX (DELT1, ZERO), X) -C DELT2 = ALFA2 -C DELT2 = MIN ( DELT2, DELT1) -C MOLAL(1) = DELT1 + DELT2 ! H+ -C ELSE -CC -CC *** NO EXCESS OF CRUSTALS CALCULATE H+ ******************************* -CC - SMIN = 2.d0*MOLAL(5)+MOLAL(7)+MOLAL(4)-MOLAL(2)-MOLAL(3) - & - MOLAL(9) - 2.D0*MOLAL(10) - 2.D0*MOLAL(8) - CALL CALCPH (SMIN, HI, OHI) - MOLAL (1) = HI -C ENDIF -C - GNH3 = MAX(CHI4 - PSI4, TINY) - GHNO3 = MAX(CHI5 - PSI5, TINY) - GHCL = MAX(CHI6 - PSI6, TINY) -C -C CNH4CL = ZERO -C CNH4NO3 = ZERO - CNACL = MAX (CHI7 - PSI7, ZERO) - CNANO3 = MAX (CHI8 - PSI8, ZERO) - CK2SO4 = MAX (CHI9 - PSI9, ZERO) - CMGSO4 = ZERO - CCASO4 = CHI11 - CCANO32 = ZERO - CKNO3 = MAX (CHI13 - PSI13, ZERO) - CKCL = MAX (CHI14 - PSI14, ZERO) - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C -C *** NH4Cl(s) calculations -C - A3 = XK6 /(R*TEMP*R*TEMP) - IF (GNH3*GHCL.GT.A3) THEN - DELT = MIN(GNH3, GHCL) - BB = -(GNH3+GHCL) - CC = GNH3*GHCL-A3 - DD = BB*BB - 4.D0*CC - PSI31 = 0.5D0*(-BB + SQRT(DD)) - PSI32 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI31.GT.ZERO .AND. PSI31.GT.ZERO) THEN - PSI3 = PSI31 - ELSEIF (DELT-PSI32.GT.ZERO .AND. PSI32.GT.ZERO) THEN - PSI3 = PSI32 - ELSE - PSI3 = ZERO - ENDIF - ELSE - PSI3 = ZERO - ENDIF - PSI3 = MAX(MIN(MIN(PSI3,CHI4-PSI4),CHI6-PSI6),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX(GNH3 - PSI3, TINY) - GHCL = MAX(GHCL - PSI3, TINY) - CNH4CL = PSI3 -C -C *** NH4NO3(s) calculations -C - A2 = XK10 /(R*TEMP*R*TEMP) - IF (GNH3*GHNO3.GT.A2) THEN - DELT = MIN(GNH3, GHNO3) - BB = -(GNH3+GHNO3) - CC = GNH3*GHNO3-A2 - DD = BB*BB - 4.D0*CC - PSI21 = 0.5D0*(-BB + SQRT(DD)) - PSI22 = 0.5D0*(-BB - SQRT(DD)) - IF (DELT-PSI21.GT.ZERO .AND. PSI21.GT.ZERO) THEN - PSI2 = PSI21 - ELSEIF (DELT-PSI22.GT.ZERO .AND. PSI22.GT.ZERO) THEN - PSI2 = PSI22 - ELSE - PSI2 = ZERO - ENDIF - ELSE - PSI2 = ZERO - ENDIF - PSI2 = MAX(MIN(MIN(PSI2,CHI4-PSI4-PSI3),CHI5-PSI5),ZERO) -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C - GNH3 = MAX (GNH3 - PSI2, TINY) - GHCL = MAX (GHNO3 - PSI2, TINY) - CNH4NO3 = PSI2 -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -C20 FUNCP2A = MOLAL(3)*MOLAL(4)/GHCL/GNH3/A6/A4 - ONE -20 FUNCP2A = MOLAL(1)*MOLAL(4)/GHCL/A6 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCP2A ******************************************* -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP1 -C *** CASE P1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCP1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCP1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCP1A, CALCP2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMP1) THEN - SCASE = 'P1 ; SUBCASE 1' - CALL CALCP1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'P1 ; SUBCASE 1' - ELSE - SCASE = 'P1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH2 (RH, DRMP1, DRCACL2, CALCP1A, CALCP2A) - SCASE = 'P1 ; SUBCASE 2' - ENDIF -C -C - RETURN -C -C *** END OF SUBROUTINE CALCP1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCP1A -C *** CASE P1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= - - SUBROUTINE CALCP1A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, LAMDA1, LAMDA2, KAPA, KAPA1, KAPA2, NAFR, - & NO3FR -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CCASO4 = MIN (W(2), W(6)) !SOLID CASO4 - CAFR = MAX (W(6) - CCASO4, ZERO) - SO4FR = MAX (W(2) - CCASO4, ZERO) - CK2SO4 = MIN (SO4FR, 0.5D0*W(7)) !SOLID K2SO4 - FRK = MAX (W(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX (SO4FR - CK2SO4, ZERO) - CMGSO4 = SO4FR !SOLID MGSO4 - FRMG = MAX (W(8) - CMGSO4, ZERO) - CNACL = MIN (W(1), W(5)) !SOLID NACL - NAFR = MAX (W(1) - CNACL, ZERO) - CLFR = MAX (W(5) - CNACL, ZERO) - CCANO32 = MIN (CAFR, 0.5D0*W(4)) !SOLID CA(NO3)2 - CAFR = MAX (CAFR - CCANO32, ZERO) - NO3FR = MAX (W(4) - 2.D0*CCANO32, ZERO) - CCACL2 = MIN (CAFR, 0.5D0*CLFR) !SOLID CACL2 - CAFR = MAX (CAFR - CCACL2, ZERO) - CLFR = MAX (CLFR - 2.D0*CCACL2, ZERO) - CMGNO32 = MIN (FRMG, 0.5D0*NO3FR) !SOLID MG(NO3)2 - FRMG = MAX (FRMG - CMGNO32, ZERO) - NO3FR = MAX (NO3FR - 2.D0*CMGNO32, ZERO) - CMGCL2 = MIN (FRMG, 0.5D0*CLFR) !SOLID MGCL2 - FRMG = MAX (FRMG - CMGCL2, ZERO) - CLFR = MAX (CLFR - 2.D0*CMGCL2, ZERO) - CNANO3 = MIN (NAFR, NO3FR) !SOLID NANO3 - NAFR = MAX (NAFR - CNANO3, ZERO) - NO3FR = MAX (NO3FR - CNANO3, ZERO) - CKCL = MIN (FRK, CLFR) !SOLID KCL - FRK = MAX (FRK - CKCL, ZERO) - CLFR = MAX (CLFR - CKCL, ZERO) - CKNO3 = MIN (FRK, NO3FR) !SOLID KNO3 - FRK = MAX (FRK - CKNO3, ZERO) - NO3FR = MAX (NO3FR - CKNO3, ZERO) -C -C *** CALCULATE VOLATILE SPECIES ************************************** -C - ALF = W(3) ! FREE NH3 - BET = CLFR ! FREE CL - GAM = NO3FR ! FREE NO3 -C - RTSQ = R*TEMP*R*TEMP - A1 = XK6/RTSQ - A2 = XK10/RTSQ -C - THETA1 = GAM - BET*(A2/A1) - THETA2 = A2/A1 -C -C QUADRATIC EQUATION SOLUTION -C - BB = (THETA1-ALF-BET*(ONE+THETA2))/(ONE+THETA2) - CC = (ALF*BET-A1-BET*THETA1)/(ONE+THETA2) - DD = BB*BB - 4.0D0*CC - IF (DD.LT.ZERO) GOTO 100 ! Solve each reaction seperately -C -C TWO ROOTS FOR KAPA, CHECK AND SEE IF ANY VALID -C - SQDD = SQRT(DD) - KAPA1 = 0.5D0*(-BB+SQDD) - KAPA2 = 0.5D0*(-BB-SQDD) - LAMDA1 = THETA1 + THETA2*KAPA1 - LAMDA2 = THETA1 + THETA2*KAPA2 -C - IF (KAPA1.GE.ZERO .AND. LAMDA1.GE.ZERO) THEN - IF (ALF-KAPA1-LAMDA1.GE.ZERO .AND. - & BET-KAPA1.GE.ZERO .AND. GAM-LAMDA1.GE.ZERO) THEN - KAPA = KAPA1 - LAMDA= LAMDA1 - GOTO 200 - ENDIF - ENDIF -C - IF (KAPA2.GE.ZERO .AND. LAMDA2.GE.ZERO) THEN - IF (ALF-KAPA2-LAMDA2.GE.ZERO .AND. - & BET-KAPA2.GE.ZERO .AND. GAM-LAMDA2.GE.ZERO) THEN - KAPA = KAPA2 - LAMDA= LAMDA2 - GOTO 200 - ENDIF - ENDIF -C -C SEPERATE SOLUTION OF NH4CL & NH4NO3 EQUILIBRIA -C -100 KAPA = ZERO - LAMDA = ZERO - DD1 = (ALF+BET)*(ALF+BET) - 4.0D0*(ALF*BET-A1) - DD2 = (ALF+GAM)*(ALF+GAM) - 4.0D0*(ALF*GAM-A2) -C -C NH4CL EQUILIBRIUM -C - IF (DD1.GE.ZERO) THEN - SQDD1 = SQRT(DD1) - KAPA1 = 0.5D0*(ALF+BET + SQDD1) - KAPA2 = 0.5D0*(ALF+BET - SQDD1) -C - IF (KAPA1.GE.ZERO .AND. KAPA1.LE.MIN(ALF,BET)) THEN - KAPA = KAPA1 - ELSE IF (KAPA2.GE.ZERO .AND. KAPA2.LE.MIN(ALF,BET)) THEN - KAPA = KAPA2 - ELSE - KAPA = ZERO - ENDIF - ENDIF -C -C NH4NO3 EQUILIBRIUM -C - IF (DD2.GE.ZERO) THEN - SQDD2 = SQRT(DD2) - LAMDA1= 0.5D0*(ALF+GAM + SQDD2) - LAMDA2= 0.5D0*(ALF+GAM - SQDD2) -C - IF (LAMDA1.GE.ZERO .AND. LAMDA1.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA1 - ELSE IF (LAMDA2.GE.ZERO .AND. LAMDA2.LE.MIN(ALF,GAM)) THEN - LAMDA = LAMDA2 - ELSE - LAMDA = ZERO - ENDIF - ENDIF -C -C IF BOTH KAPA, LAMDA ARE > 0, THEN APPLY EXISTANCE CRITERION -C - IF (KAPA.GT.ZERO .AND. LAMDA.GT.ZERO) THEN - IF (BET .LT. LAMDA/THETA1) THEN - KAPA = ZERO - ELSE - LAMDA= ZERO - ENDIF - ENDIF -C -C *** CALCULATE COMPOSITION OF VOLATILE SPECIES *********************** -C -200 CONTINUE - CNH4NO3 = LAMDA - CNH4CL = KAPA -C - GNH3 = ALF - KAPA - LAMDA - GHNO3 = GAM - LAMDA - GHCL = BET - KAPA -C - RETURN -C -C *** END OF SUBROUTINE CALCP1A ***************************************** -C - END -C -C====================================================================== -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCL9 -C *** CASE L9 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : CASO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4, MGSO4, NA2SO4, K2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL9 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = CNA2SO4 - PSI5 = CNH42S4 - PSI6 = CK2SO4 - PSI7 = CMGSO4 - PSI8 = CKHSO4 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2. -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = PSI2 + PSI3 + PSI1 + PSI8 - LAMDA ! HSO4I - MOLAL(9) = PSI8 + 2.0D0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = ZERO - CNH42S4 = ZERO - CNH4HS4 = ZERO - CK2SO4 = ZERO - CMGSO4 = ZERO - CKHSO4 = ZERO -C - CALL CALCMR ! Water content - -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -20 RETURN -C -C *** END OF SUBROUTINE CALCL9 ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCL8 -C *** CASE L8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4, MGSO4, NA2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL8 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = CNA2SO4 - PSI5 = CNH42S4 - PSI6 = ZERO - PSI7 = CMGSO4 - PSI8 = CKHSO4 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI6LO = ZERO ! Low limit - PSI6HI = CHI6 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - IF (CHI6.LE.TINY) THEN - Y1 = FUNCL8 (ZERO) - GOTO 50 - ENDIF -C - X1 = PSI6HI - Y1 = FUNCL8 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH K2SO4 ********* -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI6HI-PSI6LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCL8 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH K2SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCL8 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCL8') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL8 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL8') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL8 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL8 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL8 -C *** CASE L8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4, MGSO4, NA2SO4 -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL8 (P6) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI6 = P6 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = BB*BB - 4.D0*CC - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = ZERO - CNH42S4 = ZERO - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = ZERO - CKHSO4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A6 = XK17*(WATER/GAMA(17))**3.0 - FUNCL8 = MOLAL(9)*MOLAL(9)*MOLAL(5)/A6 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL8 **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL7 -C *** CASE L7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4, MGSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL7 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = CNH42S4 - PSI6 = ZERO - PSI7 = CMGSO4 - PSI8 = CKHSO4 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCL7 (ZERO) - GOTO 50 - ENDIF -C - X1 = PSI4HI - Y1 = FUNCL7 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH K2SO4 ********* -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCL7 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH K2SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCL7 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCL7') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL7 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL7') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL7 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL7 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL7 -C *** CASE L7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4, MGSO4 -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL7 (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5 *(WATER/GAMA(2))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = BB*BB - 4.D0*CC - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = ZERO - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = ZERO - CKHSO4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL7 = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL7 **************************************** -C - END -C -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL6 -C *** CASE L6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4, KHSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL6 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = CNH42S4 - PSI6 = ZERO - PSI7 = ZERO - PSI8 = CKHSO4 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCL6 (ZERO) - GOTO 50 - ENDIF -C - X1 = PSI4HI - Y1 = FUNCL6 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH K2SO4 ********* -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCL6 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH K2SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCL6 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCL6') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL6 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL6') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL6 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL6 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL6 -C *** CASE L6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, NA2SO4 -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL6 (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5*(WATER/GAMA(2))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - PSI7 = CHI7 -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = BB*BB - 4.D0*CC - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = ZERO - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = ZERO - CKHSO4 = ZERO - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL6 = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL6 **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL5 -C *** CASE L5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL5 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = CNH42S4 - PSI6 = ZERO - PSI7 = ZERO - PSI8 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit - -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCL5 (ZERO) - GOTO 50 - ENDIF -C - X1 = PSI4HI - Y1 = FUNCL5 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ********* -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI4LO) - Y2 = FUNCL5 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NA2SO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCL5 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCL5') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL5 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL5 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL5 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL5 -C *** CASE L5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC, (NH4)2SO4 -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL5 (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5*(WATER/GAMA(2))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A8 = XK18*(WATER/GAMA(18))**2.0 - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - PSI7 = CHI7 -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C - BITA = PSI3 + PSI2 + PSI1 + 2.D0*PSI6 - LAMDA - CAMA = 2.D0*PSI6*(PSI3 + PSI2 + PSI1 - LAMDA) - A8 - DELT = MAX(BITA*BITA - 4.D0*CAMA, ZERO) - PSI8 = 0.5D0*(-BITA + SQRT(DELT)) - PSI8 = MIN(MAX (PSI8, ZERO), CHI8) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0D0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = ZERO - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = ZERO - CKHSO4 = MAX(CHI8 - PSI8, ZERO) -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL5 = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE -C - RETURN -C -C *** END OF FUNCTION FUNCL5 **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL4 -C *** CASE L4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL4 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = CLC - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = ZERO - PSI6 = ZERO - PSI7 = ZERO - PSI8 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI4LO = ZERO ! Low limit - PSI4HI = CHI4 ! High limit -C - IF (CHI4.LE.TINY) THEN - Y1 = FUNCL4 (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI4HI - Y1 = FUNCL4 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ********* -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCL4 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NA2SO4 ** -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCL4 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCL4') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL4 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL4 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL4 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL4 -C *** CASE L4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4 -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4, LC -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL4 (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5*(WATER/GAMA(2))**3.0 - A5 = XK7*(WATER/GAMA(4))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A8 = XK18*(WATER/GAMA(18))**2.0 - A9 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (PSI3 + 2.D0*PSI4 - SQRT(A4/A5)*(3.D0*PSI2 + PSI1)) ! psi5 - & /2.D0/SQRT(A4/A5) - PSI5 = MAX (MIN (PSI5, CHI5), ZERO) -C - PSI7 = CHI7 -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - BITA = PSI3 + PSI2 + PSI1 + 2.D0*PSI6 - LAMDA - CAMA = 2.D0*PSI6*(PSI3 + PSI2 + PSI1 - LAMDA) - A8 - DELT = MAX(BITA*BITA - 4.D0*CAMA, ZERO) - PSI8 = 0.5D0*(-BITA + SQRT(DELT)) - PSI8 = MIN(MAX (PSI8, ZERO), CHI8) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0D0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = ZERO - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = MAX(CHI5 - PSI5, ZERO) - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = ZERO - CKHSO4 = MAX(CHI8 - PSI8, ZERO) - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL4 = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL4 **************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL3 -C *** CASE L3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1.(NA,NH4)HSO4(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCI3A) -C 2.(NA,NH4)HSO4(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3.(NA,NH4)HSO4(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES I1A, I2B -C RESPECTIVELY -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCL1A, CALCL4 -C -C *** FIND DRY COMPOSITION ********************************************* -C - CALL CALCL1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************* -C - IF (CNH4HS4.GT.TINY .OR. CNAHSO4.GT.TINY) THEN - SCASE = 'L3 ; SUBCASE 1' - CALL CALCL3A ! FULL SOLUTION - SCASE = 'L3 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRML3) THEN ! SOLID SOLUTION - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCL1A - SCASE = 'L3 ; SUBCASE 2' -C - ELSEIF (RH.GE.DRML3) THEN ! MDRH OF L3 - SCASE = 'L3 ; SUBCASE 3' - CALL CALCMDRH2 (RH, DRML3, DRLC, CALCL1A, CALCL4) - SCASE = 'L3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCL3 ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL3A -C *** CASE L3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL3A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = ZERO - PSI3 = CNAHSO4 - PSI4 = ZERO - PSI5 = ZERO - PSI6 = ZERO - PSI7 = ZERO - PSI8 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI2LO = ZERO ! Low limit - PSI2HI = CHI2 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI2HI - Y1 = FUNCL3A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC ********* -C - IF (YHI.LT.EPS) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI2HI-PSI2LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI2LO) - Y2 = FUNCL3A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - IF (Y2.GT.EPS) Y2 = FUNCL3A (ZERO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL3A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL3A (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL3A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE FUNCL3A -C *** CASE L3 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL3A (P2) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - - PSI2 = P2 ! Save PSI2 in COMMON BLOCK - PSI4LO = ZERO ! Low limit for PSI4 - PSI4HI = CHI4 ! High limit for PSI4 -C -C *** IF NH3 =0, CALL FUNCL3B FOR Y4=0 ******************************** -C - IF (CHI4.LE.TINY) THEN - FUNCL3A = FUNCL3B (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI4HI - Y1 = FUNCL3B (X1) - IF (ABS(Y1).LE.EPS) GOTO 50 - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ********* -C - IF (YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI4LO) - Y2 = FUNCL3B (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NA2SO4 -C - IF (Y2.GT.EPS) Y2 = FUNCL3B (PSI4LO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL3B (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0004, 'FUNCL3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** INNER LOOP CONVERGED ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL3B (X3) -C -C *** CALCULATE FUNCTION VALUE FOR INTERNAL LOOP *************************** -C -50 A2 = XK13*(WATER/GAMA(13))**5.0 - FUNCL3A = MOLAL(5)*MOLAL(6)*MOLAL(3)**3.0/A2 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL3A ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** FUNCTION FUNCL3B -C *** CASE L3 ; SUBCASE 2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SULRAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4, NAHSO4 -C -C SOLUTION IS SAVED IN COMMON BLOCK /CASE/ -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL3B (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 -C - FRST = .TRUE. - CALAIN = .TRUE. -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK5*(WATER/GAMA(2))**3.0 - A5 = XK7*(WATER/GAMA(4))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A8 = XK18*(WATER/GAMA(18))**2.0 - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (PSI3 + 2.D0*PSI4 - SQRT(A4/A5)*(3.D0*PSI2 + PSI1)) ! psi5 - & /2.D0/SQRT(A4/A5) - PSI5 = MAX (MIN (PSI5, CHI5), ZERO) -C - PSI7 = CHI7 -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - BITA = PSI3 + PSI2 + PSI1 + 2.D0*PSI6 - LAMDA - CAMA = 2.D0*PSI6*(PSI3 + PSI2 + PSI1 - LAMDA) - A8 - DELT = MAX(BITA*BITA - 4.D0*CAMA, ZERO) - PSI8 = 0.5D0*(-BITA + SQRT(DELT)) - PSI8 = MIN(MAX (PSI8, ZERO), CHI8) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0D0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = MAX(CHI2 - PSI2, ZERO) - CNAHSO4 = ZERO - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = MAX(CHI5 - PSI5, ZERO) - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = MAX(CHI7 - PSI7, ZERO) - CKHSO4 = MAX(CHI8 - PSI8, ZERO) - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL3B = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL3B **************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL2 -C *** CASE L2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. NH4HSO4(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCL2A) -C 2. NH4HSO4(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. NH4HSO4(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES L1A, L2B -C RESPECTIVELY -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCL1A, CALCL3A -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCL1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************** -C - IF (CNH4HS4.GT.TINY) THEN - SCASE = 'L2 ; SUBCASE 1' - CALL CALCL2A - SCASE = 'L2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRML2) THEN ! SOLID SOLUTION ONLY - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCL1A - SCASE = 'L2 ; SUBCASE 2' -C - ELSEIF (RH.GE.DRML2) THEN ! MDRH OF L2 - SCASE = 'L2 ; SUBCASE 3' - CALL CALCMDRH2 (RH, DRML2, DRNAHSO4, CALCL1A, CALCL3A) - SCASE = 'L2 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCL2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL2A -C *** CASE L2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL2A - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = CNH4HS4 ! Save from CALCL1 run - CHI2 = CLC - CHI3 = CNAHSO4 - CHI4 = CNA2SO4 - CHI5 = CNH42S4 - CHI6 = CK2SO4 - CHI7 = CMGSO4 - CHI8 = CKHSO4 -C - - PSI1 = CNH4HS4 ! ASSIGN INITIAL PSI's - PSI2 = ZERO - PSI3 = ZERO - PSI4 = ZERO - PSI5 = ZERO - PSI6 = ZERO - PSI7 = ZERO - PSI8 = ZERO -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI2LO = ZERO ! Low limit - PSI2HI = CHI2 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI2HI - Y1 = FUNCL2A (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NA2SO4 ********* -C - IF (YHI.LT.EPS) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI2HI-PSI2LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI2LO) - Y2 = FUNCL2A (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NA2SO4 -C - IF (Y2.GT.EPS) Y2 = FUNCL2A (ZERO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL2A (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCL2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL2A (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCL2A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE FUNCL2A -C *** CASE L2 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL2A (P2) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - - PSI2 = P2 ! Save PSI3 in COMMON BLOCK - PSI4LO = ZERO ! Low limit for PSI4 - PSI4HI = CHI4 ! High limit for PSI4 -C -C *** IF NH3 =0, CALL FUNCL3B FOR Y4=0 ******************************** -C - - IF (CHI4.LE.TINY) THEN - FUNCL2A = FUNCL2B (ZERO) - GOTO 50 - ENDIF -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - - X1 = PSI4HI - Y1 = FUNCL2B (X1) - - IF (ABS(Y1).LE.EPS) GOTO 50 - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH LC ********* -C - IF (YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI4HI-PSI4LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, PSI4LO) - Y2 = FUNCL2B (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH LC -C - IF (Y2.GT.EPS) Y2 = FUNCL2B (PSI4LO) - GOTO 50 -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCL2B (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0004, 'FUNCL2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** INNER LOOP CONVERGED ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCL2B (X3) -C -C *** CALCULATE FUNCTION VALUE FOR OUTER LOOP *************************** -C -50 A2 = XK13*(WATER/GAMA(13))**5.0 - FUNCL2A = MOLAL(5)*MOLAL(6)*MOLAL(3)**3.0/A2 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL2A ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE FUNCL2B -C *** CASE L2 ; SUBCASE 2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C 4. COMPLETELY DISSOLVED: NH4HSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCL2B (P4) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - PSI4 = P4 ! Save PSI4 in COMMON BLOCK -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - PSI3 = CHI3 - PSI5 = CHI5 - LAMDA = ZERO - PSI6 = CHI6 - PSI8 = CHI8 -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A3 = XK11*(WATER/GAMA(12))**2.0 - A4 = XK5*(WATER/GAMA(2))**3.0 - A5 = XK7*(WATER/GAMA(4))**3.0 - A6 = XK17*(WATER/GAMA(17))**3.0 - A8 = XK18*(WATER/GAMA(18))**2.0 - A9 = XK1*(WATER)*(GAMA(8)**2.0)/(GAMA(7)**3.0) -C -C CALCULATE DISSOCIATION QUANTITIES -C - PSI5 = (PSI3 + 2.D0*PSI4 - SQRT(A4/A5)*(3.D0*PSI2 + PSI1)) ! psi5 - & /2.D0/SQRT(A4/A5) - PSI5 = MAX (MIN (PSI5, CHI5), ZERO) -C - IF (CHI3.GT.TINY .AND. WATER.GT.TINY) THEN - AA = 2.D0*PSI4 + PSI2 + PSI1 + PSI8 - LAMDA - BB = 2.D0*PSI4*(PSI2 + PSI1 + PSI8 - LAMDA) - A3 - CC = ZERO - CALL POLY3 (AA, BB, CC, PSI3, ISLV) - IF (ISLV.EQ.0) THEN - PSI3 = MIN (PSI3, CHI3) - ELSE - PSI3 = ZERO - ENDIF - ENDIF -C - PSI7 = CHI7 -C - BB = PSI7 + PSI6 + PSI5 + PSI4 + PSI2 + A9 ! LAMDA - CC = -A9*(PSI8 + PSI1 + PSI2 + PSI3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - LAMDA= 0.5D0*(-BB + SQRT(DD)) - LAMDA= MIN(MAX (LAMDA, TINY), PSI8+PSI3+PSI2+PSI1) -C -C PSI6 = 0.5*(SQRT(A6/A4)*(2.D0*PSI4+PSI3)-PSI8) ! PSI6 -C PSI6 = MIN (MAX (PSI6, ZERO), CHI6) -C - IF (CHI6.GT.TINY .AND. WATER.GT.TINY) THEN - AA = PSI5+PSI4+PSI2+PSI7+PSI8+LAMDA - BB = PSI8*(PSI5+PSI4+PSI2+PSI7+0.25D0*PSI8+LAMDA) - CC = 0.25D0*(PSI8*PSI8*(PSI5+PSI4+PSI2+PSI7+LAMDA)-A6) - CALL POLY3 (AA, BB, CC, PSI6, ISLV) - IF (ISLV.EQ.0) THEN - PSI6 = MIN (PSI6, CHI6) - ELSE - PSI6 = ZERO - ENDIF - ENDIF -C - BITA = PSI3 + PSI2 + PSI1 + 2.D0*PSI6 - LAMDA ! PSI8 - CAMA = 2.D0*PSI6*(PSI3 + PSI2 + PSI1 - LAMDA) - A8 - DELT = MAX(BITA*BITA - 4.D0*CAMA, ZERO) - PSI8 = 0.5D0*(-BITA + SQRT(DELT)) - PSI8 = MIN(MAX (PSI8, ZERO), CHI8) -C -C *** CALCULATE SPECIATION ******************************************** -C - MOLAL(1) = LAMDA ! HI - MOLAL(2) = 2.D0*PSI4 + PSI3 ! NAI - MOLAL(3) = 3.D0*PSI2 + 2.D0*PSI5 + PSI1 ! NH4I - MOLAL(5) = PSI2 + PSI4 + PSI5 + PSI6 + PSI7 + LAMDA ! SO4I - MOLAL(6) = MAX(PSI2 + PSI3 + PSI1 + PSI8 - LAMDA, TINY) ! HSO4I - MOLAL(9) = PSI8 + 2.0D0*PSI6 ! KI - MOLAL(10)= PSI7 ! MGI -C - CLC = MAX(CHI2 - PSI2, ZERO) - CNAHSO4 = MAX(CHI3 - PSI3, ZERO) - CNA2SO4 = MAX(CHI4 - PSI4, ZERO) - CNH42S4 = MAX(CHI5 - PSI5, ZERO) - CNH4HS4 = ZERO - CK2SO4 = MAX(CHI6 - PSI6, ZERO) - CMGSO4 = MAX(CHI7 - PSI7, ZERO) - CKHSO4 = MAX(CHI8 - PSI8, ZERO) - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 A4 = XK5 *(WATER/GAMA(2))**3.0 - FUNCL2B = MOLAL(5)*MOLAL(2)*MOLAL(2)/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCL2B **************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL1 -C *** CASE L1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCI1A) -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCL1A, CALCL2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRML1) THEN - SCASE = 'L1 ; SUBCASE 1' - CALL CALCL1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'L1 ; SUBCASE 1' - ELSE - SCASE = 'L1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRH2 (RH, DRML1, DRNH4HS4, CALCL1A, CALCL2A) - SCASE = 'L1 ; SUBCASE 2' - ENDIF -C -C *** AMMONIA IN GAS PHASE ********************************************** -C -C CALL CALCNH3 -C - RETURN -C -C *** END OF SUBROUTINE CALCL1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCL1A -C *** CASE L1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE RICH, NO FREE ACID (1.0 <= SO4RAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, MGSO4, KHSO4, NH4HSO4, NAHSO4, (NH4)2SO4, NA2SO4, LC -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCL1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE NON VOLATILE SOLIDS *********************************** -C - CCASO4 = MIN (W(6), W(2)) ! CCASO4 - FRSO4 = MAX(W(2) - CCASO4, ZERO) - CAFR = MAX(W(6) - CCASO4, ZERO) - CK2SO4 = MIN (0.5D0*W(7), FRSO4) ! CK2SO4 - FRK = MAX(W(7) - 2.D0*CK2SO4, ZERO) - FRSO4 = MAX(FRSO4 - CK2SO4, ZERO) - CNA2SO4 = MIN (0.5D0*W(1), FRSO4) ! CNA2SO4 - FRNA = MAX(W(1) - 2.D0*CNA2SO4, ZERO) - FRSO4 = MAX(FRSO4 - CNA2SO4, ZERO) - CMGSO4 = MIN (W(8), FRSO4) ! CMGSO4 - FRMG = MAX(W(8) - CMGSO4, ZERO) - FRSO4 = MAX(FRSO4 - CMGSO4, ZERO) -C - CNH4HS4 = ZERO - CNAHSO4 = ZERO - CNH42S4 = ZERO - CKHSO4 = ZERO -C - CLC = MIN(W(3)/3.D0, FRSO4/2.D0) - FRSO4 = MAX(FRSO4-2.D0*CLC, ZERO) - FRNH4 = MAX(W(3)-3.D0*CLC, ZERO) -C - IF (FRSO4.LE.TINY) THEN - CLC = MAX(CLC - FRNH4, ZERO) - CNH42S4 = 2.D0*FRNH4 - - ELSEIF (FRNH4.LE.TINY) THEN - CNH4HS4 = 3.D0*MIN(FRSO4, CLC) - CLC = MAX(CLC-FRSO4, ZERO) -C IF (CK2SO4.GT.TINY) THEN -C FRSO4 = MAX(FRSO4-CNH4HS4/3.D0, ZERO) -C CKHSO4 = 2.D0*FRSO4 -C CK2SO4 = MAX(CK2SO4-FRSO4, ZERO) -C ENDIF -C IF (CNA2SO4.GT.TINY) THEN -C FRSO4 = MAX(FRSO4-CKHSO4/2.D0, ZERO) -C CNAHSO4 = 2.D0*FRSO4 -C CNA2SO4 = MAX(CNA2SO4-FRSO4, ZERO) -C ENDIF -C - IF (CNA2SO4.GT.TINY) THEN - FRSO4 = MAX(FRSO4-CNH4HS4/3.D0, ZERO) - CNAHSO4 = 2.D0*FRSO4 - CNA2SO4 = MAX(CNA2SO4-FRSO4, ZERO) - ENDIF - IF (CK2SO4.GT.TINY) THEN - FRSO4 = MAX(FRSO4-CNH4HS4/3.D0, ZERO) - CKHSO4 = 2.D0*FRSO4 - CK2SO4 = MAX(CK2SO4-FRSO4, ZERO) - ENDIF - ENDIF -C -C *** CALCULATE GAS SPECIES ******************************************** -C - GHNO3 = W(4) - GHCL = W(5) - GNH3 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCL1A ***************************************** -C - END -C -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCK4 -C *** CASE K4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCK4 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - FRST = .TRUE. - CALAIN = .TRUE. -C - CHI1 = W(3) ! Total NH4 initially as NH4HSO4 - CHI2 = W(1) ! Total NA initially as NaHSO4 - CHI3 = W(7) ! Total K initially as KHSO4 - CHI4 = W(8) ! Total Mg initially as MgSO4 -C - LAMDA = MAX(W(2) - W(3) - W(1) - W(6) - W(7) - W(8), TINY) ! FREE H2SO4 - PSI1 = CHI1 ! ALL NH4HSO4 DELIQUESCED - PSI2 = CHI2 ! ALL NaHSO4 DELIQUESCED - PSI3 = CHI3 ! ALL KHSO4 DELIQUESCED - PSI4 = CHI4 ! ALL MgSO4 DELIQUESCED -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A4 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C - BB = A4+LAMDA+PSI4 ! KAPA - CC =-A4*(LAMDA + PSI3 + PSI2 + PSI1) + LAMDA*PSI4 - DD = MAX(BB*BB-4.D0*CC, ZERO) - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = MAX(LAMDA + KAPA, TINY) ! HI - MOLAL (2) = PSI2 ! NAI - MOLAL (3) = PSI1 ! NH4I - MOLAL (5) = MAX(KAPA + PSI4, ZERO) ! SO4I - MOLAL (6) = MAX(LAMDA + PSI1 + PSI2 + PSI3 - KAPA, ZERO) ! HSO4I - MOLAL (9) = PSI3 ! KI - MOLAL (10)= PSI4 ! MGI -C - CNH4HS4 = ZERO - CNAHSO4 = ZERO - CKHSO4 = ZERO - CCASO4 = W(6) - CMGSO4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -20 RETURN -C -C *** END OF SUBROUTINE CALCK4 -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCK3 -C *** CASE K3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : KHSO4, CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCK3 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - CHI1 = W(3) ! Total NH4 initially as NH4HSO4 - CHI2 = W(1) ! Total NA initially as NaHSO4 - CHI3 = W(7) ! Total K initially as KHSO4 - CHI4 = W(8) ! Total Mg initially as MgSO4 -C - PSI3LO = TINY ! Low limit - PSI3HI = CHI3 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI3HI - Y1 = FUNCK3 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH KHSO4 **** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI3HI-PSI3LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCK3 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH KHSO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCK3 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCK3') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCK3 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCK3') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCK3 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCK3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE FUNCK3 -C *** CASE K3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : KHSO4, CaSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCK3 (P1) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1) - W(6) - W(7) - W(8), TINY) ! FREE H2SO4 - PSI3 = P1 - PSI1 = CHI1 ! ALL NH4HSO4 DELIQUESCED - PSI2 = CHI2 ! ALL NaHSO4 DELIQUESCED - PSI4 = CHI4 ! ALL MgSO4 DELIQUESCED - -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A3 = XK18 *(WATER/GAMA(18))**2.0 - A4 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C -C - BB = A4+LAMDA+PSI4 ! KAPA - CC =-A4*(LAMDA + PSI3 + PSI2 + PSI1) + LAMDA*PSI4 - DD = MAX(BB*BB-4.D0*CC, ZERO) - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = MAX(LAMDA + KAPA, ZERO) ! HI - MOLAL (2) = PSI2 ! NAI - MOLAL (3) = PSI1 ! NH4I - MOLAL (4) = ZERO - MOLAL (5) = MAX(KAPA + PSI4, ZERO) ! SO4I - MOLAL (6) = MAX(LAMDA+PSI1+PSI2+PSI3-KAPA,ZERO) ! HSO4I - MOLAL (7) = ZERO - MOLAL (8) = ZERO - MOLAL (9) = PSI3 ! KI - MOLAL (10)= PSI4 -C - CNH4HS4 = ZERO - CNAHSO4 = ZERO - CKHSO4 = CHI3-PSI3 - CCASO4 = W(6) - CMGSO4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCK3 = MOLAL(9)*MOLAL(6)/A3 - ONE -C -C *** END OF FUNCTION FUNCK3 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCK2 -C *** CASE K2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NAHSO4, KHSO4, CaSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCK2 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - CHI1 = W(3) ! Total NH4 initially as NH4HSO4 - CHI2 = W(1) ! Total NA initially as NaHSO4 - CHI3 = W(7) ! Total K initially as KHSO4 - CHI4 = W(8) ! Total Mg initially as MgSO4 -C - PSI3LO = TINY ! Low limit - PSI3HI = CHI3 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI3HI - Y1 = FUNCK2 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH KHSO4 **** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI3HI-PSI3LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCK2 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH KHSO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCK2 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCK2') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCK2 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCK2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCK2 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCK2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE FUNCK2 -C *** CASE K2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NAHSO4, KHSO4, CaSO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCK2 (P1) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1) - W(6) - W(7) - W(8), TINY) ! FREE H2SO4 - PSI3 = P1 - PSI1 = CHI1 ! ALL NH4HSO4 DELIQUESCED - PSI4 = CHI4 ! ALL MgSO4 DELIQUESCED -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A2 = XK11 *(WATER/GAMA(12))**2.0 - A3 = XK18 *(WATER/GAMA(18))**2.0 - A4 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C - PSI2 = A2/A3*PSI3 ! PSI2 - PSI2 = MIN(MAX(PSI2, ZERO),CHI2) -C - BB = A4+LAMDA+PSI4 ! KAPA - CC =-A4*(LAMDA + PSI3 + PSI2 + PSI1) + LAMDA*PSI4 - DD = MAX(BB*BB-4.D0*CC, ZERO) - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = MAX(LAMDA + KAPA, ZERO) ! HI - MOLAL (2) = PSI2 ! NAI - MOLAL (3) = PSI1 ! NH4I - MOLAL (4) = ZERO - MOLAL (5) = MAX(KAPA + PSI4, ZERO) ! SO4I - MOLAL (6) = MAX(LAMDA+PSI1+PSI2+PSI3-KAPA,ZERO) ! HSO4I - MOLAL (7) = ZERO - MOLAL (8) = ZERO - MOLAL (9) = PSI3 ! KI - MOLAL (10)= PSI4 -C - CNH4HS4 = ZERO - CNAHSO4 = CHI2-PSI2 - CKHSO4 = CHI3-PSI3 - CCASO4 = W(6) - CMGSO4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCK2 = MOLAL(9)*MOLAL(6)/A3 - ONE -C -C *** END OF FUNCTION FUNCK2 ******************************************* -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCK1 -C *** CASE K1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE SUPER RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NH4HSO4, NAHSO4, KHSO4, CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCK1 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - - CALAOU =.TRUE. ! Outer loop activity calculation flag - CHI1 = W(3) ! Total NH4 initially as NH4HSO4 - CHI2 = W(1) ! Total NA initially as NaHSO4 - CHI3 = W(7) ! Total K initially as KHSO4 - CHI4 = W(8) ! Total Mg initially as MGSO4 -C - PSI3LO = TINY ! Low limit - PSI3HI = CHI3 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI3HI - Y1 = FUNCK1 (X1) - YHI= Y1 ! Save Y-value at HI position -C -C *** YHI < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH KHSO4 **** -C - IF (ABS(Y1).LE.EPS .OR. YHI.LT.ZERO) GOTO 50 -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI3HI-PSI3LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = X1-DX - Y2 = FUNCK1 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH KHSO4 -C - YLO= Y1 ! Save Y-value at Hi position - IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - Y3 = FUNCK1 (ZERO) - GOTO 50 - ELSE IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCK1') ! WARNING ERROR: NO SOLUTION - GOTO 50 - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCK1 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCK1') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCK1 (X3) -C -50 RETURN -C -C *** END OF SUBROUTINE CALCK1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE FUNCK1 -C *** CASE K1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE super RICH, FREE ACID (SO4RAT < 1.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : NH4HSO4, NAHSO4, KHSO4, CASO4 -C -C *** COPYRIGHT 1996-2006, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCK1 (P1) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION LAMDA, KAPA - COMMON /CASEK/ CHI1,CHI2,CHI3,CHI4,LAMDA,KAPA,PSI1,PSI2,PSI3, - & A1, A2, A3, A4 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. -C - LAMDA = MAX(W(2) - W(3) - W(1) - W(6) - W(7) - W(8), TINY) ! FREE H2SO4 - PSI3 = P1 - PSI4 = CHI4 ! ALL MgSO4 DELIQUESCED -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A1 = XK12 *(WATER/GAMA(09))**2.0 - A2 = XK11 *(WATER/GAMA(12))**2.0 - A3 = XK18 *(WATER/GAMA(18))**2.0 - A4 = XK1 *WATER/GAMA(7)*(GAMA(8)/GAMA(7))**2.0 -C - PSI1 = A1/A3*PSI3 ! PSI1 - PSI1 = MIN(MAX(PSI1, ZERO),CHI1) -C - PSI2 = A2/A3*PSI3 ! PSI2 - PSI2 = MIN(MAX(PSI2, ZERO),CHI2) -C - BB = A4+LAMDA+PSI4 ! KAPA - CC =-A4*(LAMDA + PSI3 + PSI2 + PSI1) + LAMDA*PSI4 - DD = MAX(BB*BB-4.D0*CC, ZERO) - KAPA = 0.5D0*(-BB+SQRT(DD)) -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = MAX(LAMDA + KAPA, ZERO) ! HI - MOLAL (2) = PSI2 ! NAI - MOLAL (3) = PSI1 ! NH4I - MOLAL (4) = ZERO ! CLI - MOLAL (5) = MAX(KAPA + PSI4, ZERO) ! SO4I - MOLAL (6) = MAX(LAMDA+PSI1+PSI2+PSI3-KAPA,ZERO) ! HSO4I - MOLAL (7) = ZERO ! NO3I - MOLAL (8) = ZERO ! CAI - MOLAL (9) = PSI3 ! KI - MOLAL (10)= PSI4 ! MGI -C - CNH4HS4 = CHI1-PSI1 - CNAHSO4 = CHI2-PSI2 - CKHSO4 = CHI3-PSI3 - CCASO4 = W(6) - CMGSO4 = ZERO -C - CALL CALCMR ! Water content -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCK1 = MOLAL(9)*MOLAL(6)/A3 - ONE -C -C *** END OF FUNCTION FUNCK1 **************************************** -C - END - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_isorev2.F b/MATRIXchem_GridComp/microphysics/TRAMP_isorev2.F deleted file mode 100644 index c0ca7cac..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_isorev2.F +++ /dev/null @@ -1,11871 +0,0 @@ -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP1R -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE REVERSE PROBLEM OF -C AN AMMONIUM-SULFATE AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE RATIO AND BY -C THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE ISRP1R (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) -C -C *** INITIALIZE COMMON BLOCK VARIABLES ********************************* -C - CALL INIT1 (WI, RHI, TEMPI) -C -C *** CALCULATE SULFATE RATIO ******************************************* -C - IF (RH.GE.DRNH42S4) THEN ! WET AEROSOL, NEED NH4 AT SRATIO=2.0 - SULRATW = GETASR(WAER(2), RHI) ! AEROSOL SULFATE RATIO - ELSE - SULRATW = 2.0D0 ! DRY AEROSOL SULFATE RATIO - ENDIF - SULRAT = WAER(3)/WAER(2) ! SULFATE RATIO -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR -C - IF (SULRATW.LE.SULRAT) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'S2' - CALL CALCS2 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH42S4) THEN - SCASE = 'S1' - CALL CALCS1 ! NH42SO4 ; case K1 -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'S2' - CALL CALCS2 ! Only liquid ; case K2 - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.SULRATW) THEN - W(2) = WAER(2) - W(3) = WAER(3) -C - IF(METSTBL.EQ.1) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid (metastable) - SCASE = 'B4' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'B1' - CALL CALCB1 ! NH4HSO4,LC,NH42SO4 ; case B1 - SCASE = 'B1' -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'B2' - CALL CALCB2 ! LC,NH42S4 ; case B2 - SCASE = 'B2' -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'B3' - CALL CALCB3 ! NH42S4 ; case B3 - SCASE = 'B3' -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid ; case B4 - SCASE = 'B4' - ENDIF - ENDIF -C - CALL CALCNH3P ! Compute NH3(g) -C -C *** SULFATE RICH (FREE ACID) -C - ELSEIF (SULRAT.LT.1.0) THEN - W(2) = WAER(2) - W(3) = WAER(3) -C - IF(METSTBL.EQ.1) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid (metastable) - SCASE = 'C2' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'C1' - CALL CALCC1 ! NH4HSO4 ; case C1 - SCASE = 'C1' -C - ELSEIF (DRNH4HS4.LE.RH) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid ; case C2 - SCASE = 'C2' - ENDIF - ENDIF -C - CALL CALCNH3P -C - ENDIF - RETURN -C -C *** END OF SUBROUTINE ISRP1R ***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP2R -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE REVERSE PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE RATIO AND BY -C THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE ISRP2R (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - LOGICAL TRYLIQ -C -C *** INITIALIZE ALL VARIABLES IN COMMON BLOCK ************************** -C - TRYLIQ = .TRUE. ! Assume liquid phase, sulfate poor limit -C -10 CALL INIT2 (WI, RHI, TEMPI) -C -C *** CALCULATE SULFATE RATIO ******************************************* -C - IF (TRYLIQ .AND. RH.GE.DRNH4NO3) THEN ! *** WET AEROSOL - SULRATW = GETASR(WAER(2), RHI) ! LIMITING SULFATE RATIO - ELSE - SULRATW = 2.0D0 ! *** DRY AEROSOL - ENDIF - SULRAT = WAER(3)/WAER(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR -C - IF (SULRATW.LE.SULRAT) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'N3' - CALL CALCN3 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'N1' - CALL CALCN1 ! NH42SO4,NH4NO3 ; case N1 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'N2' - CALL CALCN2 ! NH42S4 ; case N2 -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'N3' - CALL CALCN3 ! Only liquid ; case N3 - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C -C FOR SOLVING THIS CASE, NITRIC ACID AND AMMONIA IN THE GAS PHASE ARE -C ASSUMED A MINOR SPECIES, THAT DO NOT SIGNIFICANTLY AFFECT THE -C AEROSOL EQUILIBRIUM. -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.SULRATW) THEN - W(2) = WAER(2) - W(3) = WAER(3) - W(4) = WAER(4) -C - IF(METSTBL.EQ.1) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid (metastable) - SCASE = 'B4' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'B1' - CALL CALCB1 ! NH4HSO4,LC,NH42SO4 ; case O1 - SCASE = 'B1' -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'B2' - CALL CALCB2 ! LC,NH42S4 ; case O2 - SCASE = 'B2' -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'B3' - CALL CALCB3 ! NH42S4 ; case O3 - SCASE = 'B3' -C - ELSEIF (DRNH42S4.LE.RH) THEN - SCASE = 'B4' - CALL CALCB4 ! Only liquid ; case O4 - SCASE = 'B4' - ENDIF - ENDIF -C -C *** Add the NO3 to the solution now and calculate partitioning. -C - MOLAL(7) = WAER(4) ! There is always water, so NO3(aer) is NO3- - MOLAL(1) = MOLAL(1) + WAER(4) ! Add H+ to balance out - CALL CALCNAP ! HNO3, NH3 dissolved - CALL CALCNH3P -C -C *** SULFATE RICH (FREE ACID) -C -C FOR SOLVING THIS CASE, NITRIC ACID AND AMMONIA IN THE GAS PHASE ARE -C ASSUMED A MINOR SPECIES, THAT DO NOT SIGNIFICANTLY AFFECT THE -C AEROSOL EQUILIBRIUM. -C - ELSEIF (SULRAT.LT.1.0) THEN - W(2) = WAER(2) - W(3) = WAER(3) - W(4) = WAER(4) -C - IF(METSTBL.EQ.1) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid (metastable) - SCASE = 'C2' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'C1' - CALL CALCC1 ! NH4HSO4 ; case P1 - SCASE = 'C1' -C - ELSEIF (DRNH4HS4.LE.RH) THEN - SCASE = 'C2' - CALL CALCC2 ! Only liquid ; case P2 - SCASE = 'C2' - ENDIF - ENDIF -C -C *** Add the NO3 to the solution now and calculate partitioning. -C - MOLAL(7) = WAER(4) ! There is always water, so NO3(aer) is NO3- - MOLAL(1) = MOLAL(1) + WAER(4) ! Add H+ to balance out -C - CALL CALCNAP ! HNO3, NH3 dissolved - CALL CALCNH3P - ENDIF -C -C *** IF SULRATW < SULRAT < 2.0 and WATER = 0 => SULFATE RICH CASE. -C - IF (SULRATW.LE.SULRAT .AND. SULRAT.LT.2.0 - & .AND. WATER.LE.TINY) THEN - TRYLIQ = .FALSE. - GOTO 10 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE ISRP2R ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE ISRP3R -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE REVERSE PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE & SODIUM -C RATIOS AND BY THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE ISRP3R (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - LOGICAL TRYLIQ -ccC -ccC *** ADJUST FOR TOO LITTLE AMMONIUM AND CHLORIDE *********************** -ccC -cc WI(3) = MAX (WI(3), 1.D-10) ! NH4+ : 1e-4 umoles/m3 -cc WI(5) = MAX (WI(5), 1.D-10) ! Cl- : 1e-4 umoles/m3 -C -C *** INITIALIZE ALL VARIABLES ****************************************** -C - TRYLIQ = .TRUE. ! Use liquid phase sulfate poor limit -C -10 CALL ISOINIT3 (WI, RHI, TEMPI) ! COMMON block variables -ccC -ccC *** CHECK IF TOO MUCH SODIUM ; ADJUST AND ISSUE ERROR MESSAGE ********* -ccC -cc REST = 2.D0*WAER(2) + WAER(4) + WAER(5) -cc IF (WAER(1).GT.REST) THEN ! NA > 2*SO4+CL+NO3 ? -cc WAER(1) = (ONE-1D-6)*REST ! Adjust Na amount -cc CALL PUSHERR (0050, 'ISRP3R') ! Warning error: Na adjusted -cc ENDIF -C -C *** CALCULATE SULFATE & SODIUM RATIOS ********************************* -C - IF (TRYLIQ .AND. RH.GE.DRNH4NO3) THEN ! ** WET AEROSOL - FRSO4 = WAER(2) - WAER(1)/2.0D0 ! SULFATE UNBOUND BY SODIUM - FRSO4 = MAX(FRSO4, TINY) - SRI = GETASR(FRSO4, RHI) ! SULFATE RATIO FOR NH4+ - SULRATW = (WAER(1)+FRSO4*SRI)/WAER(2) ! LIMITING SULFATE RATIO - SULRATW = MIN (SULRATW, 2.0D0) - ELSE - SULRATW = 2.0D0 ! ** DRY AEROSOL - ENDIF - SULRAT = (WAER(1)+WAER(3))/WAER(2) - SODRAT = WAER(1)/WAER(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR ; SODIUM POOR -C - IF (SULRATW.LE.SULRAT .AND. SODRAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'Q5' - CALL CALCQ5 ! Only liquid (metastable) - SCASE = 'Q5' - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'Q1' - CALL CALCQ1 ! NH42SO4,NH4NO3,NH4CL,NA2SO4 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'Q2' - CALL CALCQ2 ! NH42SO4,NH4CL,NA2SO4 -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'Q3' - CALL CALCQ3 ! NH42SO4,NA2SO4 -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'Q4' - CALL CALCQ4 ! NA2SO4 - SCASE = 'Q4' -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'Q5' - CALL CALCQ5 ! Only liquid - SCASE = 'Q5' - ENDIF - ENDIF -C -C *** SULFATE POOR ; SODIUM RICH -C - ELSE IF (SULRAT.GE.SULRATW .AND. SODRAT.GE.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'R6' - CALL CALCR6 ! Only liquid (metastable) - SCASE = 'R6' - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'R1' - CALL CALCR1 ! NH4NO3,NH4CL,NA2SO4,NACL,NANO3 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'R2' - CALL CALCR2 ! NH4CL,NA2SO4,NACL,NANO3 -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'R3' - CALL CALCR3 ! NH4CL,NA2SO4,NACL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'R4' - CALL CALCR4 ! NH4CL,NA2SO4 -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'R5' - CALL CALCR5 ! NA2SO4 - SCASE = 'R5' -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'R6' - CALL CALCR6 ! NO SOLID - SCASE = 'R6' - ENDIF - ENDIF -C -C *** SULFATE RICH (NO ACID) -C - ELSEIF (1.0.LE.SULRAT .AND. SULRAT.LT.SULRATW) THEN - DO 100 I=1,NCOMP - W(I) = WAER(I) -100 CONTINUE -C - IF(METSTBL.EQ.1) THEN - SCASE = 'I6' - CALL CALCI6 ! Only liquid (metastable) - SCASE = 'I6' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'I1' - CALL CALCI1 ! NA2SO4,(NH4)2SO4,NAHSO4,NH4HSO4,LC - SCASE = 'I1' -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRNAHSO4) THEN - SCASE = 'I2' - CALL CALCI2 ! NA2SO4,(NH4)2SO4,NAHSO4,LC - SCASE = 'I2' -C - ELSEIF (DRNAHSO4.LE.RH .AND. RH.LT.DRLC) THEN - SCASE = 'I3' - CALL CALCI3 ! NA2SO4,(NH4)2SO4,LC - SCASE = 'I3' -C - ELSEIF (DRLC.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'I4' - CALL CALCI4 ! NA2SO4,(NH4)2SO4 - SCASE = 'I4' -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'I5' - CALL CALCI5 ! NA2SO4 - SCASE = 'I5' -C - ELSEIF (DRNA2SO4.LE.RH) THEN - SCASE = 'I6' - CALL CALCI6 ! NO SOLIDS - SCASE = 'I6' - ENDIF - ENDIF -C - CALL CALCNHP ! HNO3, NH3, HCL in gas phase - CALL CALCNH3P -C -C *** SULFATE RICH (FREE ACID) -C - ELSEIF (SULRAT.LT.1.0) THEN - DO 200 I=1,NCOMP - W(I) = WAER(I) -200 CONTINUE -C - IF(METSTBL.EQ.1) THEN - SCASE = 'J3' - CALL CALCJ3 ! Only liquid (metastable) - SCASE = 'J3' - ELSE -C - IF (RH.LT.DRNH4HS4) THEN - SCASE = 'J1' - CALL CALCJ1 ! NH4HSO4,NAHSO4 - SCASE = 'J1' -C - ELSEIF (DRNH4HS4.LE.RH .AND. RH.LT.DRNAHSO4) THEN - SCASE = 'J2' - CALL CALCJ2 ! NAHSO4 - SCASE = 'J2' -C - ELSEIF (DRNAHSO4.LE.RH) THEN - SCASE = 'J3' - CALL CALCJ3 - SCASE = 'J3' - ENDIF - ENDIF -C - CALL CALCNHP ! HNO3, NH3, HCL in gas phase - CALL CALCNH3P -C - ENDIF -C -C *** IF AFTER CALCULATIONS, SULRATW < SULRAT < 2.0 -C and WATER = 0 => SULFATE RICH CASE. -C - IF (SULRATW.LE.SULRAT .AND. SULRAT.LT.2.0 - & .AND. WATER.LE.TINY) THEN - TRYLIQ = .FALSE. - GOTO 10 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE ISRP3R ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE ISRP4R -C *** THIS SUBROUTINE IS THE DRIVER ROUTINE FOR THE REVERSE PROBLEM OF -C AN AMMONIUM-SULFATE-NITRATE-CHLORIDE-SODIUM-CALCIUM-POTTASIUM-MAGNESIUM AEROSOL SYSTEM. -C THE COMPOSITION REGIME IS DETERMINED BY THE SULFATE & SODIUM -C RATIOS AND BY THE AMBIENT RELATIVE HUMIDITY. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE ISRP4R (WI, RHI, TEMPI) - INCLUDE 'isrpia.inc' - DIMENSION WI(NCOMP) - LOGICAL TRYLIQ -ccC -ccC *** ADJUST FOR TOO LITTLE AMMONIUM AND CHLORIDE *********************** -ccC -cc WI(3) = MAX (WI(3), 1.D-10) ! NH4+ : 1e-4 umoles/m3 -cc WI(5) = MAX (WI(5), 1.D-10) ! Cl- : 1e-4 umoles/m3 -C -C *** INITIALIZE ALL VARIABLES ****************************************** -C - TRYLIQ = .TRUE. ! Use liquid phase sulfate poor limit - IPROB = 1 ! SOLVE REVERSE PROBLEM -C METSTBL = 1 -C -10 CALL INIT4 (WI, RHI, TEMPI) ! COMMON block variables -ccC -ccC *** CHECK IF TOO MUCH SODIUM ; ADJUST AND ISSUE ERROR MESSAGE ********* -ccC -cc REST = 2.D0*WAER(2) + WAER(4) + WAER(5) -cc IF (WAER(1).GT.REST) THEN ! NA > 2*SO4+CL+NO3 ? -cc WAER(1) = (ONE-1D-6)*REST ! Adjust Na amount -cc CALL PUSHERR (0050, 'ISRP3R') ! Warning error: Na adjusted -cc ENDIF -C -C *** CALCULATE SULFATE, CRUSTAL & SODIUM RATIOS *********************** -C - IF (TRYLIQ) THEN ! ** WET AEROSOL - FRSO4 = WAER(2) - WAER(1)/2.0D0 - & - WAER(6) - WAER(7)/2.0D0 - WAER(8) ! SULFATE UNBOUND BY SODIUM,CALCIUM,POTTASIUM,MAGNESIUM - FRSO4 = MAX(FRSO4, TINY) - SRI = GETASR(FRSO4, RHI) ! SULFATE RATIO FOR NH4+ - SULRATW = (WAER(1)+FRSO4*SRI+WAER(6) - & +WAER(7)+WAER(8))/WAER(2) ! LIMITING SULFATE RATIO - SULRATW = MIN (SULRATW, 2.0D0) - ELSE - SULRATW = 2.0D0 ! ** DRY AEROSOL - ENDIF - SO4RAT = (WAER(1)+WAER(3)+WAER(6)+WAER(7)+WAER(8))/WAER(2) - CRNARAT = (WAER(1)+WAER(6)+WAER(7)+WAER(8))/WAER(2) - CRRAT = (WAER(6)+WAER(7)+WAER(8))/WAER(2) -C -C *** FIND CALCULATION REGIME FROM (SULRAT,RH) ************************** -C -C *** SULFATE POOR ; SODIUM+CRUSTALS POOR -C - IF (SULRATW.LE.SO4RAT .AND. CRNARAT.LT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'V7' - CALL CALCV7 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'V1' - CALL CALCV1 ! CaSO4, NH4NO3, NH4CL, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'V2' - CALL CALCV2 ! CaSO4, NH4CL, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRNH42S4) THEN - SCASE = 'V3' - CALL CALCV3 ! CaSO4, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH42S4.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'V4' - CALL CALCV4 ! CaSO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'V5' - CALL CALCV5 ! CaSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNA2SO4.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'V6' - CALL CALCV6 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'V7' - CALL CALCV7 ! CaSO4 - ENDIF - ENDIF -C -C *** SULFATE POOR: Rso4>2; (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C - ELSEIF (SO4RAT.GE.SULRATW .AND. CRNARAT.GE.2.0) THEN -C - IF (CRRAT.LE.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'U8' - CALL CALCU8 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRNH4NO3) THEN - SCASE = 'U1' - CALL CALCU1 ! CaSO4, NH4NO3, NH4CL, MGSO4, NA2SO4, K2SO4, NACL, NANO3 -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'U2' - CALL CALCU2 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4, NACL, NANO3 -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'U3' - CALL CALCU3 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4, NACL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4Cl) THEN - SCASE = 'U4' - CALL CALCU4 ! CaSO4, NH4CL, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNH4Cl.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'U5' - CALL CALCU5 ! CaSO4, MGSO4, NA2SO4, K2SO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRNA2SO4) THEN - SCASE = 'U6' - CALL CALCU6 ! CaSO4, NA2SO4, K2SO4 -C - ELSEIF (DRNA2SO4.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'U7' - CALL CALCU7 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'U8' - CALL CALCU8 ! CaSO4 - ENDIF - ENDIF -C -C *** SULFATE POOR: Rso4>2; (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C - ELSEIF (CRRAT.GT.2.0) THEN -C - IF(METSTBL.EQ.1) THEN - SCASE = 'W13' - CALL CALCW13 ! Only liquid (metastable) - ELSE -C - IF (RH.LT.DRCACL2) THEN - SCASE = 'W1' - CALL CALCW1 ! CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRCACL2.LE.RH .AND. RH.LT.DRMGCL2) THEN - SCASE = 'W2' - CALL CALCW2 ! CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRMGCL2.LE.RH .AND. RH.LT.DRCANO32) THEN - SCASE = 'W3' - CALL CALCW3 ! CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRCANO32.LE.RH .AND. RH.LT.DRMGNO32) THEN - SCASE = 'W4' - CALL CALCW4 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, -C ! MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRMGNO32.LE.RH .AND. RH.LT.DRNH4NO3) THEN - SCASE = 'W5' - CALL CALCW5 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, -C ! NANO3, NACL, NH4NO3, NH4CL -C - ELSEIF (DRNH4NO3.LE.RH .AND. RH.LT.DRNANO3) THEN - SCASE = 'W6' - CALL CALCW6 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NANO3, NACL, NH4CL -C - ELSEIF (DRNANO3.LE.RH .AND. RH.LT.DRNACL) THEN - SCASE = 'W7' - CALL CALCW7 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NACL, NH4CL -C - ELSEIF (DRNACL.LE.RH .AND. RH.LT.DRNH4CL) THEN - SCASE = 'W8' - CALL CALCW8 ! CaSO4, K2SO4, KNO3, KCL, MGSO4, NH4CL -C - ELSEIF (DRNH4CL.LE.RH .AND. RH.LT.DRKCL) THEN - SCASE = 'W9' - CALL CALCW9 ! CaSO4, K2SO4, KNO3, KCL, MGSO4 -C - ELSEIF (DRKCL.LE.RH .AND. RH.LT.DRMGSO4) THEN - SCASE = 'W10' - CALL CALCW10 ! CaSO4, K2SO4, KNO3, MGSO4 -C - ELSEIF (DRMGSO4.LE.RH .AND. RH.LT.DRKNO3) THEN - SCASE = 'W11' - CALL CALCW11 ! CaSO4, K2SO4, KNO3 -C - ELSEIF (DRKNO3.LE.RH .AND. RH.LT.DRK2SO4) THEN - SCASE = 'W12' - CALL CALCW12 ! CaSO4, K2SO4 -C - ELSEIF (DRK2SO4.LE.RH) THEN - SCASE = 'W13' - CALL CALCW13 ! CaSO4 - ENDIF - ENDIF -C CALL CALCNH3 - ENDIF -C -C *** SULFATE RICH (NO ACID): 1 SULFATE RICH CASE. -C - IF (SULRATW.LE.SO4RAT .AND. SO4RAT.LT.2.0 - & .AND. WATER.LE.TINY) THEN - TRYLIQ = .FALSE. - GOTO 10 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE ISRP4R ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCS2 -C *** CASE S2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. LIQUID AEROSOL PHASE ONLY POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCS2 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NH4I, NH3GI, NH3AQ -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - FRST =.TRUE. - CALAIN =.TRUE. -C -C *** CALCULATE WATER CONTENT ***************************************** -C - MOLALR(4)= MIN(WAER(2), 0.5d0*WAER(3)) - WATER = MOLALR(4)/M0(4) ! ZSR correlation -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -CC A21 = XK21*WATER*R*TEMP - A2 = XK2 *R*TEMP/XKW/RH*(GAMA(8)/GAMA(9))**2. - AKW = XKW *RH*WATER*WATER -C - NH4I = WAER(3) - SO4I = WAER(2) - HSO4I= ZERO -C - CALL CALCPH (2.D0*SO4I - NH4I, HI, OHI) ! Get pH -C - NH3AQ = ZERO ! AMMONIA EQUILIBRIUM - IF (HI.LT.OHI) THEN - CALL CALCAMAQ (NH4I, OHI, DEL) - NH4I = MAX (NH4I-DEL, ZERO) - OHI = MAX (OHI -DEL, TINY) - NH3AQ = DEL - HI = AKW/OHI - ENDIF -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) ! SULFATE EQUILIBRIUM - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C - NH3GI = NH4I/HI/A2 ! NH3AQ/A21 -C -C *** SPECIATION & WATER CONTENT *************************************** -C - MOLAL(1) = HI - MOLAL(3) = NH4I - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - COH = OHI - GASAQ(1) = NH3AQ - GNH3 = NH3GI -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -20 RETURN -C -C *** END OF SUBROUTINE CALCS2 **************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCS1 -C *** CASE S1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4 -C -C A SIMPLE MATERIAL BALANCE IS PERFORMED, AND THE SOLID (NH4)2SO4 -C IS CALCULATED FROM THE SULFATES. THE EXCESS AMMONIA REMAINS IN -C THE GAS PHASE. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCS1 - INCLUDE 'isrpia.inc' -C - CNH42S4 = MIN(WAER(2),0.5d0*WAER(3)) ! For bad input problems - GNH3 = ZERO -C - W(2) = CNH42S4 - W(3) = 2.D0*CNH42S4 + GNH3 -C - RETURN -C -C *** END OF SUBROUTINE CALCS1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCN3 -C *** CASE N3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. THERE IS ONLY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCN3 - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NH4I, NO3I, NH3AQ, NO3AQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALAOU =.TRUE. ! Outer loop activity calculation flag - FRST =.TRUE. - CALAIN =.TRUE. -C -C *** AEROSOL WATER CONTENT -C - MOLALR(4) = MIN(WAER(2),0.5d0*WAER(3)) ! (NH4)2SO4 - AML5 = MAX(WAER(3)-2.D0*MOLALR(4),ZERO) ! "free" NH4 - MOLALR(5) = MAX(MIN(AML5,WAER(4)), ZERO) ! NH4NO3=MIN("free",NO3) - WATER = MOLALR(4)/M0(4) + MOLALR(5)/M0(5) - WATER = MAX(WATER, TINY) -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A2 = XK2 *R*TEMP/XKW/RH*(GAMA(8)/GAMA(9))**2. -CC A21 = XK21*WATER*R*TEMP - A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - A4 = XK7*(WATER/GAMA(4))**3.0 - AKW = XKW *RH*WATER*WATER -C -C ION CONCENTRATIONS -C - NH4I = WAER(3) - NO3I = WAER(4) - SO4I = WAER(2) - HSO4I = ZERO -C - CALL CALCPH (2.D0*SO4I + NO3I - NH4I, HI, OHI) -C -C AMMONIA ASSOCIATION EQUILIBRIUM -C - NH3AQ = ZERO - NO3AQ = ZERO - GG = 2.D0*SO4I + NO3I - NH4I - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - HI = ZERO - CALL CALCNIAQ2 (GG, NO3I, HI, NO3AQ) ! HNO3 -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = HI - MOLAL (3) = NH4I - MOLAL (5) = SO4I - MOLAL (6) = HSO4I - MOLAL (7) = NO3I - COH = OHI -C - CNH42S4 = ZERO - CNH4NO3 = ZERO -C - GASAQ(1) = NH3AQ - GASAQ(3) = NO3AQ -C - GHNO3 = HI*NO3I/A3 - GNH3 = NH4I/HI/A2 ! NH3AQ/A21 -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ****************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** RETURN *********************************************************** -C -20 RETURN -C -C *** END OF SUBROUTINE CALCN3 ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCN2 -C *** CASE N2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : (NH4)2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCN2 - INCLUDE 'isrpia.inc' -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CHI1 = MIN(WAER(2),0.5d0*WAER(3)) ! (NH4)2SO4 - CHI2 = MAX(WAER(3) - 2.D0*CHI1, ZERO) ! "Free" NH4+ - CHI3 = MAX(WAER(4) - CHI2, ZERO) ! "Free" NO3 -C - PSI2 = CHI2 - PSI3 = CHI3 -C - CALAOU = .TRUE. ! Outer loop activity calculation flag - PSI1LO = TINY ! Low limit - PSI1HI = CHI1 ! High limit -C -C *** INITIAL VALUES FOR BISECTION ************************************ -C - X1 = PSI1HI - Y1 = FUNCN2 (X1) - IF (Y1.LE.EPS) RETURN ! IF (ABS(Y1).LE.EPS .OR. Y1.LE.ZERO) RETURN - YHI= Y1 ! Save Y-value at HI position -C -C *** ROOT TRACKING ; FOR THE RANGE OF HI AND LO ********************** -C - DX = (PSI1HI-PSI1LO)/FLOAT(NDIV) - DO 10 I=1,NDIV - X2 = MAX(X1-DX, ZERO) - Y2 = FUNCN2 (X2) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y2).LT.ZERO) GOTO 20 ! (Y1*Y2.LT.ZERO) - X1 = X2 - Y1 = Y2 -10 CONTINUE -C -C *** NO SUBDIVISION WITH SOLUTION FOUND -C - YLO= Y1 ! Save Y-value at Hi position - IF (ABS(Y2) .LT. EPS) THEN ! X2 IS A SOLUTION - RETURN -C -C *** { YLO, YHI } < 0.0 THE SOLUTION IS ALWAYS UNDERSATURATED WITH NH3 -C - ELSE IF (YLO.LT.ZERO .AND. YHI.LT.ZERO) THEN - P4 = CHI4 - YY = FUNCN2(P4) - GOTO 50 -C -C *** { YLO, YHI } > 0.0 THE SOLUTION IS ALWAYS SUPERSATURATED WITH NH3 -C - ELSE IF (YLO.GT.ZERO .AND. YHI.GT.ZERO) THEN - P4 = TINY - YY = FUNCN2(P4) - GOTO 50 - ELSE - CALL PUSHERR (0001, 'CALCN2') ! WARNING ERROR: NO SOLUTION - RETURN - ENDIF -C -C *** PERFORM BISECTION *********************************************** -C -20 DO 30 I=1,MAXIT - X3 = 0.5*(X1+X2) - Y3 = FUNCN2 (X3) - IF (SIGN(1.d0,Y1)*SIGN(1.d0,Y3) .LE. ZERO) THEN ! (Y1*Y3 .LE. ZERO) - Y2 = Y3 - X2 = X3 - ELSE - Y1 = Y3 - X1 = X3 - ENDIF - IF (ABS(X2-X1) .LE. EPS*X1) GOTO 40 -30 CONTINUE - CALL PUSHERR (0002, 'CALCN2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CONVERGED ; RETURN ********************************************** -C -40 X3 = 0.5*(X1+X2) - Y3 = FUNCN2 (X3) -50 CONTINUE - RETURN -C -C *** END OF SUBROUTINE CALCN2 ****************************************** -C - END - - - -C====================================================================== -C -C *** ISORROPIA CODE -C *** FUNCTION FUNCN2 -C *** CASE D2 -C FUNCTION THAT SOLVES THE SYSTEM OF EQUATIONS FOR CASE D2 ; -C AND RETURNS THE VALUE OF THE ZEROED FUNCTION IN FUNCN2. -C -C======================================================================= -C - DOUBLE PRECISION FUNCTION FUNCN2 (P1) - INCLUDE 'isrpia.inc' - DOUBLE PRECISION NH4I, NO3I, NH3AQ, NO3AQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - PSI1 = P1 -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A2 = XK2 *R*TEMP/XKW/RH*(GAMA(8)/GAMA(9))**2. -CC A21 = XK21*WATER*R*TEMP - A3 = XK4*R*TEMP*(WATER/GAMA(10))**2.0 - A4 = XK7*(WATER/GAMA(4))**3.0 - AKW = XKW *RH*WATER*WATER -C -C ION CONCENTRATIONS -C - NH4I = 2.D0*PSI1 + PSI2 - NO3I = PSI2 + PSI3 - SO4I = PSI1 - HSO4I = ZERO -C - CALL CALCPH (2.D0*SO4I + NO3I - NH4I, HI, OHI) -C -C AMMONIA ASSOCIATION EQUILIBRIUM -C - NH3AQ = ZERO - NO3AQ = ZERO - GG = 2.D0*SO4I + NO3I - NH4I - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - HI = ZERO - CALL CALCNIAQ2 (GG, NO3I, HI, NO3AQ) ! HNO3 -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL (1) = HI - MOLAL (3) = NH4I - MOLAL (5) = SO4I - MOLAL (6) = HSO4I - MOLAL (7) = NO3I - COH = OHI -C - CNH42S4 = CHI1 - PSI1 - CNH4NO3 = ZERO -C - GASAQ(1) = NH3AQ - GASAQ(3) = NO3AQ -C - GHNO3 = HI*NO3I/A3 - GNH3 = NH4I/HI/A2 ! NH3AQ/A21 -C -C *** CALCULATE MOLALR ARRAY, WATER AND ACTIVITIES ********************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -C -C *** CALCULATE OBJECTIVE FUNCTION ************************************ -C -20 FUNCN2= NH4I*NH4I*SO4I/A4 - ONE - RETURN -C -C *** END OF FUNCTION FUNCN2 ******************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCN1 -C *** CASE N1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3 -C -C THERE ARE TWO REGIMES DEFINED BY RELATIVE HUMIDITY: -C 1. RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCN1A) -C 2. RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCN1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCN1A, CALCN2 -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMASAN) THEN - SCASE = 'N1 ; SUBCASE 1' - CALL CALCN1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'N1 ; SUBCASE 1' - ELSE - SCASE = 'N1 ; SUBCASE 2' - CALL CALCMDRP (RH, DRMASAN, DRNH4NO3, CALCN1A, CALCN2) - SCASE = 'N1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCN1 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCN1A -C *** CASE N1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCN1A - INCLUDE 'isrpia.inc' -C -C *** SETUP PARAMETERS ************************************************* -C -CCC A1 = XK10/R/TEMP/R/TEMP -C -C *** CALCULATE AEROSOL COMPOSITION ************************************ -C -CCC CHI1 = 2.D0*WAER(4) ! Free parameter ; arbitrary value. - PSI1 = WAER(4) -C -C *** The following statment is here to avoid negative NH4+ values in -C CALCN? routines that call CALCN1A -C - PSI2 = MAX(MIN(WAER(2),0.5d0*(WAER(3)-PSI1)),TINY) -C - CNH4NO3 = PSI1 - CNH42S4 = PSI2 -C -CCC GNH3 = CHI1 + PSI1 + 2.0*PSI2 -CCC GHNO3 = A1/(CHI1-PSI1) + PSI1 - GNH3 = ZERO - GHNO3 = ZERO -C - W(2) = PSI2 - W(3) = GNH3 + PSI1 + 2.0*PSI2 - W(4) = GHNO3 + PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCN1A ***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ5 -C *** CASE Q5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ5 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCQ1A -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 -C - CALL CALCMR ! WATER -C - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - HSO4I = ZERO - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCQ5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCQ5 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ4 -C *** CASE Q4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ4 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV1 =.TRUE. - PSI1O =-GREAT - ROOT3 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCQ1A -C - CHI1 = CNA2SO4 ! SALTS -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-(WAER(2) + WAER(1)) - CC = WAER(1)*WAER(2) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*WAER(2) - A5) - CALL POLY3(BB, CC, DD, ROOT3, ISLV) - IF (ISLV.NE.0) ROOT3 = TINY - ROOT3 = MIN (ROOT3, WAER(1)/2.0, WAER(2), CHI1) - ROOT3 = MAX (ROOT3, ZERO) - PSI1 = CHI1-ROOT3 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - NAI = WAER(1) - 2.D0*ROOT3 - SO4I= WAER(2) - ROOT3 - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - HSO4I = ZERO - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCQ4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCQ4 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ3 -C *** CASE Q3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ3 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCQ1A, CALCQ4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO .OR. EXCL) THEN ! *** NITRATE OR CHLORIDE EXISTS - SCASE = 'Q3 ; SUBCASE 1' - CALL CALCQ3A - SCASE = 'Q3 ; SUBCASE 1' -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMG3) THEN - SCASE = 'Q3 ; SUBCASE 2' - CALL CALCQ1A ! SOLID - SCASE = 'Q3 ; SUBCASE 2' - ELSE - SCASE = 'Q3 ; SUBCASE 3' ! MDRH (NH4)2SO4, NA2SO4 - CALL CALCMDRP (RH, DRMG3, DRNH42S4, CALCQ1A, CALCQ4) - SCASE = 'Q3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCQ3 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ3A -C *** CASE Q3 ; SUBCASE A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ3A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1, PSCONV6 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV1 =.TRUE. - PSCONV6 =.TRUE. -C - PSI1O =-GREAT - PSI6O =-GREAT -C - ROOT1 = ZERO - ROOT3 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCQ1A -C - CHI1 = CNA2SO4 ! SALTS - CHI4 = CNH4CL - CHI6 = CNH42S4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - A7 = XK7 *(WATER/GAMA(4))**3. ! (NH4)2SO4 <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-(WAER(2) + WAER(1) - ROOT1) - CC = WAER(1)*(WAER(2) - ROOT1) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*(WAER(2) - ROOT1) - A5) - CALL POLY3(BB, CC, DD, ROOT3, ISLV) - IF (ISLV.NE.0) ROOT3 = TINY - ROOT3 = MIN (ROOT3, WAER(1)/2.0, WAER(2) - ROOT1, CHI1) - ROOT3 = MAX (ROOT3, ZERO) - PSI1 = CHI1-ROOT3 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM SULFATE -C - IF (NH4I*NH4I*SO4I .GT. A7) THEN - BB =-(WAER(2)+WAER(3)-ROOT3) - CC = WAER(3)*(WAER(2)-ROOT3+0.5D0*WAER(3)) - DD =-((WAER(2)-ROOT3)*WAER(3)**2.D0 + A7)/4.D0 - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN(ROOT1, WAER(3), WAER(2)-ROOT3, CHI6) - ROOT1 = MAX(ROOT1, ZERO) - PSI6 = CHI6-ROOT1 - ENDIF - PSCONV6 = ABS(PSI6-PSI6O) .LE. EPS*PSI6O - PSI6O = PSI6 -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - 2.D0*ROOT3 - SO4I= WAER(2) - ROOT1 - ROOT3 - NH4I= WAER(3) - 2.D0*ROOT1 - NO3I= WAER(4) - CLI = WAER(5) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - HSO4I = ZERO - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1 .AND. PSCONV6) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCQ3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = CHI6 - PSI6 - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCQ3A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ2 -C *** CASE Q2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID & LIQUID AEROSOL POSSIBLE -C 3. SOLIDS POSSIBLE : NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ2 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCQ1A, CALCQ3A, CALCQ4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO) THEN ! *** NITRATE EXISTS - SCASE = 'Q2 ; SUBCASE 1' - CALL CALCQ2A - SCASE = 'Q2 ; SUBCASE 1' -C - ELSEIF (.NOT.EXNO .AND. EXCL) THEN ! *** ONLY CHLORIDE EXISTS - IF (RH.LT.DRMG2) THEN - SCASE = 'Q2 ; SUBCASE 2' - CALL CALCQ1A ! SOLID - SCASE = 'Q2 ; SUBCASE 2' - ELSE - SCASE = 'Q2 ; SUBCASE 3' ! MDRH (NH4)2SO4, NA2SO4, NH4CL - CALL CALCMDRP (RH, DRMG2, DRNH4CL, CALCQ1A, CALCQ3A) - SCASE = 'Q2 ; SUBCASE 3' - ENDIF -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMG3) THEN - SCASE = 'Q2 ; SUBCASE 2' - CALL CALCQ1A ! SOLID - SCASE = 'Q2 ; SUBCASE 2' - ELSE - SCASE = 'Q2 ; SUBCASE 4' ! MDRH (NH4)2SO4, NA2SO4 - CALL CALCMDRP (RH, DRMG3, DRNH42S4, CALCQ1A, CALCQ4) - SCASE = 'Q2 ; SUBCASE 4' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCQ2 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ2A -C *** CASE Q2 ; SUBCASE A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM POOR (SODRAT < 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ2A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1, PSCONV4, PSCONV6 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV1 =.TRUE. - PSCONV4 =.TRUE. - PSCONV6 =.TRUE. -C - PSI1O =-GREAT - PSI4O =-GREAT - PSI6O =-GREAT -C - ROOT1 = ZERO - ROOT2 = ZERO - ROOT3 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCQ1A -C - CHI1 = CNA2SO4 ! SALTS - CHI4 = CNH4CL - CHI6 = CNH42S4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2. ! NH4Cl <==> NH4+ - A7 = XK7 *(WATER/GAMA(4))**3. ! (NH4)2SO4 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - 2.D0*ROOT1) - CC = WAER(5)*(WAER(3) - 2.D0*ROOT1) - A14 - DD = BB*BB - 4.D0*CC - IF (DD.LT.ZERO) THEN - ROOT2 = ZERO - ELSE - DD = SQRT(DD) - ROOT2A= 0.5D0*(-BB+DD) - ROOT2B= 0.5D0*(-BB-DD) - IF (ZERO.LE.ROOT2A) THEN - ROOT2 = ROOT2A - ELSE - ROOT2 = ROOT2B - ENDIF - ROOT2 = MIN(ROOT2, WAER(5), WAER(3) - 2.D0*ROOT1, CHI4) - ROOT2 = MAX(ROOT2, ZERO) - PSI4 = CHI4 - ROOT2 - ENDIF - ENDIF - PSCONV4 = ABS(PSI4-PSI4O) .LE. EPS*PSI4O - PSI4O = PSI4 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-(WAER(2) + WAER(1) - ROOT1) - CC = WAER(1)*(WAER(2) - ROOT1) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*(WAER(2) - ROOT1) - A5) - CALL POLY3(BB, CC, DD, ROOT3, ISLV) - IF (ISLV.NE.0) ROOT3 = TINY - ROOT3 = MIN (ROOT3, WAER(1)/2.0, WAER(2) - ROOT1, CHI1) - ROOT3 = MAX (ROOT3, ZERO) - PSI1 = CHI1-ROOT3 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM SULFATE -C - IF (NH4I*NH4I*SO4I .GT. A7) THEN - BB =-(WAER(2)+WAER(3)-ROOT2-ROOT3) - CC = (WAER(3)-ROOT2)*(WAER(2)-ROOT3+0.5D0*(WAER(3)-ROOT2)) - DD =-((WAER(2)-ROOT3)*(WAER(3)-ROOT2)**2.D0 + A7)/4.D0 - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN(ROOT1, WAER(3)-ROOT2, WAER(2)-ROOT3, CHI6) - ROOT1 = MAX(ROOT1, ZERO) - PSI6 = CHI6-ROOT1 - ENDIF - PSCONV6 = ABS(PSI6-PSI6O) .LE. EPS*PSI6O - PSI6O = PSI6 -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - 2.D0*ROOT3 - SO4I= WAER(2) - ROOT1 - ROOT3 - NH4I= WAER(3) - ROOT2 - 2.D0*ROOT1 - NO3I= WAER(4) - CLI = WAER(5) - ROOT2 -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - HSO4I = ZERO - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1 .AND. PSCONV4 .AND. PSCONV6) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCQ2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = CHI6 - PSI6 - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCQ2A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ1 -C *** CASE Q1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ1 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCQ1A, CALCQ2A, CALCQ3A, CALCQ4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO .AND. EXCL) THEN ! *** NITRATE & CHLORIDE EXIST - IF (RH.LT.DRMG1) THEN - SCASE = 'Q1 ; SUBCASE 1' - CALL CALCQ1A ! SOLID - SCASE = 'Q1 ; SUBCASE 1' - ELSE - SCASE = 'Q1 ; SUBCASE 2' ! MDRH (NH4)2SO4, NA2SO4, NH4CL, NH4NO3 - CALL CALCMDRP (RH, DRMG1, DRNH4NO3, CALCQ1A, CALCQ2A) - SCASE = 'Q1 ; SUBCASE 2' - ENDIF -C - ELSE IF (EXNO .AND. .NOT.EXCL) THEN ! *** ONLY NITRATE EXISTS - IF (RH.LT.DRMQ1) THEN - SCASE = 'Q1 ; SUBCASE 1' - CALL CALCQ1A ! SOLID - SCASE = 'Q1 ; SUBCASE 1' - ELSE - SCASE = 'Q1 ; SUBCASE 3' ! MDRH (NH4)2SO4, NA2SO4, NH4NO3 - CALL CALCMDRP (RH, DRMQ1, DRNH4NO3, CALCQ1A, CALCQ2A) - SCASE = 'Q1 ; SUBCASE 3' - ENDIF -C - ELSE IF (.NOT.EXNO .AND. EXCL) THEN ! *** ONLY CHLORIDE EXISTS - IF (RH.LT.DRMG2) THEN - SCASE = 'Q1 ; SUBCASE 1' - CALL CALCQ1A ! SOLID - SCASE = 'Q1 ; SUBCASE 1' - ELSE - SCASE = 'Q1 ; SUBCASE 4' ! MDRH (NH4)2SO4, NA2SO4, NH4CL - CALL CALCMDRP (RH, DRMG2, DRNH4CL, CALCQ1A, CALCQ3A) - SCASE = 'Q1 ; SUBCASE 4' - ENDIF -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMG3) THEN - SCASE = 'Q1 ; SUBCASE 1' - CALL CALCQ1A ! SOLID - SCASE = 'Q1 ; SUBCASE 1' - ELSE - SCASE = 'Q1 ; SUBCASE 5' ! MDRH (NH4)2SO4, NA2SO4 - CALL CALCMDRP (RH, DRMG3, DRNH42S4, CALCQ1A, CALCQ4) - SCASE = 'Q1 ; SUBCASE 5' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCQ1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCQ1A -C *** CASE Q1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM POOR (SODRAT < 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, (NH4)2SO4, NA2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCQ1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE SOLIDS ************************************************** -C - CNA2SO4 = 0.5d0*WAER(1) - FRSO4 = MAX (WAER(2)-CNA2SO4, ZERO) -C - CNH42S4 = MAX (MIN(FRSO4,0.5d0*WAER(3)), TINY) - FRNH3 = MAX (WAER(3)-2.D0*CNH42S4, ZERO) -C - CNH4NO3 = MIN (FRNH3, WAER(4)) -CCC FRNO3 = MAX (WAER(4)-CNH4NO3, ZERO) - FRNH3 = MAX (FRNH3-CNH4NO3, ZERO) -C - CNH4CL = MIN (FRNH3, WAER(5)) -CCC FRCL = MAX (WAER(5)-CNH4CL, ZERO) - FRNH3 = MAX (FRNH3-CNH4CL, ZERO) -C -C *** OTHER PHASES ****************************************************** -C - WATER = ZERO -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCQ1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR6 -C *** CASE R6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM RICH (SODRAT >= 2.0) -C 2. THERE IS ONLY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR6 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALL CALCR1A -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 -C - FRST = .TRUE. - CALAIN = .TRUE. - CALAOU = .TRUE. -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** SETUP LIQUID CONCENTRATIONS ************************************** -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C - NAI = WAER(1) - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*WAER(2) + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCR6') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1) = NH3AQ - GASAQ(2) = CLAQ - GASAQ(3) = NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCR6 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR5 -C *** CASE R5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM RICH (SODRAT >= 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR5 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C - LOGICAL NEAN, NEAC, NESN, NESC -C -C *** SETUP PARAMETERS ************************************************ -C - CALL CALCR1A ! DRY SOLUTION -C - NEAN = CNH4NO3.LE.TINY ! NH4NO3 ! Water exists? - NEAC = CNH4CL .LE.TINY ! NH4CL - NESN = CNANO3 .LE.TINY ! NANO3 - NESC = CNACL .LE.TINY ! NACL - IF (NEAN .AND. NEAC .AND. NESN .AND. NESC) RETURN -C - CHI1 = CNA2SO4 -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 -C - PSIO =-GREAT -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C - FRST = .TRUE. - CALAIN = .TRUE. - CALAOU = .TRUE. - PSCONV = .FALSE. -C -C *** SETUP LIQUID CONCENTRATIONS ************************************** -C - NAI = WAER(1) - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5*(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C SODIUM SULFATE -C - ROOT = ZERO - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-3.D0*CHI1 - CC = 3.D0*CHI1**2.0 - DD =-CHI1**3.0 + 0.25D0*A5 - CALL POLY3(BB, CC, DD, ROOT, ISLV) - IF (ISLV.NE.0) ROOT = TINY - ROOT = MIN (MAX(ROOT,ZERO), CHI1) - PSI1 = CHI1-ROOT - ENDIF - PSCONV = ABS(PSI1-PSIO) .LE. EPS*PSIO - PSIO = PSI1 -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - 2.D0*ROOT - SO4I = WAER(2) - ROOT - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCR5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ -CC A21 = XK21*WATER*R*TEMP - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 ! NH4I*OHI/A2/AKW - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1) = NH3AQ - GASAQ(2) = CLAQ - GASAQ(3) = NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCR5 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR4 -C *** CASE R4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR4 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCR1A, CALCR5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'R4 ; SUBCASE 2' - CALL CALCR1A ! SOLID - SCASE = 'R4 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN .OR. EXSN .OR. EXSC) THEN ! *** NH4NO3,NANO3 EXIST - IF (RH.GE.DRMH1) THEN - SCASE = 'R4 ; SUBCASE 1' - CALL CALCR4A - SCASE = 'R4 ; SUBCASE 1' - ENDIF -C - ELSE IF (EXAC) THEN ! *** NH4CL EXISTS ONLY - IF (RH.GE.DRMR5) THEN - SCASE = 'R4 ; SUBCASE 3' - CALL CALCMDRP (RH, DRMR5, DRNH4CL, CALCR1A, CALCR5) - SCASE = 'R4 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR4 ****************************************** -C - END - - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR4A -C *** CASE R4A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM RICH (SODRAT >= 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR4A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1, PSCONV4 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST = .TRUE. - CALAIN = .TRUE. - CALAOU = .TRUE. - PSCONV1 = .FALSE. - PSCONV4 = .FALSE. - PSIO1 =-GREAT - PSIO4 =-GREAT -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCR1A -C - CHI1 = CNA2SO4 ! SALTS - CHI4 = CNH4CL -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2. ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C SODIUM SULFATE -C - ROOT = ZERO - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-3.D0*CHI1 - CC = 3.D0*CHI1**2.0 - DD =-CHI1**3.0 + 0.25D0*A5 - CALL POLY3(BB, CC, DD, ROOT, ISLV) - IF (ISLV.NE.0) ROOT = TINY - ROOT = MIN (MAX(ROOT,ZERO), CHI1) - PSI1 = CHI1-ROOT - NAI = WAER(1) - 2.D0*ROOT - SO4I = WAER(2) - ROOT - ENDIF - PSCONV1 = ABS(PSI1-PSIO1) .LE. EPS*PSIO1 - PSIO1 = PSI1 -C -C AMMONIUM CHLORIDE -C - ROOT = ZERO - IF (NH4I*CLI .GT. A14) THEN - BB =-(NH4I + CLI) - CC =-A14 + NH4I*CLI - DD = BB*BB - 4.D0*CC - ROOT = 0.5D0*(-BB-SQRT(DD)) - IF (ROOT.GT.TINY) THEN - ROOT = MIN(ROOT, CHI4) - PSI4 = CHI4 - ROOT - NH4I = WAER(3) - ROOT - CLI = WAER(5) - ROOT - ENDIF - ENDIF - PSCONV4 = ABS(PSI4-PSIO4) .LE. EPS*PSIO4 - PSIO4 = PSI4 -C - NO3I = WAER(4) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1 .AND. PSCONV4) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCR4A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 -C - RETURN -C -C *** END OF SUBROUTINE CALCR4A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR3 -C *** CASE R3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR3 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCR1A, CALCR4A, CALCR5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'R3 ; SUBCASE 2' - CALL CALCR1A ! SOLID - SCASE = 'R3 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN .OR. EXSN) THEN ! *** NH4NO3,NANO3 EXIST - IF (RH.GE.DRMH1) THEN - SCASE = 'R3 ; SUBCASE 1' - CALL CALCR3A - SCASE = 'R3 ; SUBCASE 1' - ENDIF -C - ELSE IF (.NOT.EXAN .AND. .NOT.EXSN) THEN ! *** NH4NO3,NANO3 = 0 - IF ( EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'R3 ; SUBCASE 3' - CALL CALCMDRP (RH, DRMR4, DRNACL, CALCR1A, CALCR4A) - SCASE = 'R3 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'R3 ; SUBCASE 4' - CALL CALCMDRP (RH, DRMR2, DRNACL, CALCR1A, CALCR4A) - SCASE = 'R3 ; SUBCASE 4' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'R3 ; SUBCASE 5' - CALL CALCMDRP (RH, DRMR5, DRNACL, CALCR1A, CALCR5) - SCASE = 'R3 ; SUBCASE 5' - ENDIF - ENDIF -C - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR3 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR3A -C *** CASE R3A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM RICH (SODRAT >= 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR3A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1, PSCONV3, PSCONV4 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. - PSCONV1 =.TRUE. - PSCONV3 =.TRUE. - PSCONV4 =.TRUE. - PSI1O =-GREAT - PSI3O =-GREAT - PSI4O =-GREAT - ROOT1 = ZERO - ROOT2 = ZERO - ROOT3 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCR1A -C - CHI1 = CNA2SO4 ! SALTS - CHI4 = CNH4CL - CHI3 = CNACL -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - A8 = XK8 *(WATER/GAMA(1))**2. ! NaCl <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2. ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - ROOT3) - CC =-A14 + NH4I*(WAER(5) - ROOT3) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - ROOT2A= 0.5D0*(-BB+SQRT(DD)) - ROOT2B= 0.5D0*(-BB-SQRT(DD)) - IF (ZERO.LE.ROOT2A) THEN - ROOT2 = ROOT2A - ELSE - ROOT2 = ROOT2B - ENDIF - ROOT2 = MIN(MAX(ZERO, ROOT2), MAX(WAER(5)-ROOT3,ZERO), - & CHI4, WAER(3)) - PSI4 = CHI4 - ROOT2 - ENDIF - PSCONV4 = ABS(PSI4-PSI4O) .LE. EPS*PSI4O - PSI4O = PSI4 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-(CHI1 + WAER(1) - ROOT3) - CC = 0.25D0*(WAER(1) - ROOT3)*(4.D0*CHI1+WAER(1)-ROOT3) - DD =-0.25D0*(CHI1*(WAER(1)-ROOT3)**2.D0 - A5) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN (MAX(ROOT1,ZERO), MAX(WAER(1)-ROOT3,ZERO), - & CHI1, WAER(2)) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - (2.D0*ROOT1 + ROOT3) - SO4I= WAER(2) - ROOT1 - NH4I= WAER(3) - ROOT2 - CLI = WAER(5) - (ROOT3 + ROOT2) - NO3I= WAER(4) -C -C SODIUM CHLORIDE ; To obtain new value for ROOT3 -C - IF (NAI*CLI .GT. A8) THEN - BB =-((CHI1-2.D0*ROOT1) + (WAER(5) - ROOT2)) - CC = (CHI1-2.D0*ROOT1)*(WAER(5) - ROOT2) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT3A= 0.5D0*(-BB-SQRT(DD)) - ROOT3B= 0.5D0*(-BB+SQRT(DD)) - IF (ZERO.LE.ROOT3A) THEN - ROOT3 = ROOT3A - ELSE - ROOT3 = ROOT3B - ENDIF - ROOT3 = MIN(MAX(ROOT3, ZERO), CHI3) - PSI3 = CHI3-ROOT3 - ENDIF - PSCONV3 = ABS(PSI3-PSI3O) .LE. EPS*PSI3O - PSI3O = PSI3 -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1.AND.PSCONV3.AND.PSCONV4) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCR3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 IF (CLI.LE.TINY .AND. WAER(5).GT.TINY) THEN !No disslv Cl-;solid only - DO 30 I=1,NIONS - MOLAL(I) = ZERO -30 CONTINUE - DO 40 I=1,NGASAQ - GASAQ(I) = ZERO -40 CONTINUE - CALL CALCR1A - ELSE - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = CHI3 - PSI3 - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR3A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR2 -C *** CASE R2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR2 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCR1A, CALCR3A, CALCR4A, CALCR5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'R2 ; SUBCASE 2' - CALL CALCR1A ! SOLID - SCASE = 'R2 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN) THEN ! *** NH4NO3 EXISTS - IF (RH.GE.DRMH1) THEN - SCASE = 'R2 ; SUBCASE 1' - CALL CALCR2A - SCASE = 'R2 ; SUBCASE 1' - ENDIF -C - ELSE IF (.NOT.EXAN) THEN ! *** NH4NO3 = 0 - IF ( EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMH2) THEN - SCASE = 'R2 ; SUBCASE 3' - CALL CALCMDRP (RH, DRMH2, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R2 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR1) THEN - SCASE = 'R2 ; SUBCASE 4' - CALL CALCMDRP (RH, DRMR1, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R2 ; SUBCASE 4' - ENDIF - - ELSE IF (.NOT.EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'R2 ; SUBCASE 5' - CALL CALCMDRP (RH, DRMR2, DRNACL, CALCR1A, CALCR4A) - SCASE = 'R2 ; SUBCASE 5' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR3) THEN - SCASE = 'R2 ; SUBCASE 6' - CALL CALCMDRP (RH, DRMR3, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R2 ; SUBCASE 6' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'R2 ; SUBCASE 7' - CALL CALCMDRP (RH, DRMR4, DRNACL, CALCR1A, CALCR4A) - SCASE = 'R2 ; SUBCASE 7' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'R2 ; SUBCASE 8' - CALL CALCMDRP (RH, DRMR5, DRNH4CL, CALCR1A, CALCR5) - SCASE = 'R2 ; SUBCASE 8' - ENDIF - - ELSE IF ( EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR6) THEN - SCASE = 'R2 ; SUBCASE 9' - CALL CALCMDRP (RH, DRMR6, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R2 ; SUBCASE 9' - ENDIF - ENDIF -C - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR2 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR2A -C *** CASE R2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); SODIUM RICH (SODRAT >= 2.0) -C 2. LIQUID AND SOLID PHASES ARE POSSIBLE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR2A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV1, PSCONV2, PSCONV3, PSCONV4 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV1 =.TRUE. - PSCONV2 =.TRUE. - PSCONV3 =.TRUE. - PSCONV4 =.TRUE. -C - PSI1O =-GREAT - PSI2O =-GREAT - PSI3O =-GREAT - PSI4O =-GREAT -C - ROOT1 = ZERO - ROOT2 = ZERO - ROOT3 = ZERO - ROOT4 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCR1A -C - CHI1 = CNA2SO4 ! SALTS - CHI2 = CNANO3 - CHI3 = CNACL - CHI4 = CNH4CL -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A5 = XK5 *(WATER/GAMA(2))**3. ! Na2SO4 <==> Na+ - A8 = XK8 *(WATER/GAMA(1))**2. ! NaCl <==> Na+ - A9 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2. ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - ROOT3) - CC = NH4I*(WAER(5) - ROOT3) - A14 - DD = MAX(BB*BB - 4.D0*CC, ZERO) - DD = SQRT(DD) - ROOT2A= 0.5D0*(-BB+DD) - ROOT2B= 0.5D0*(-BB-DD) - IF (ZERO.LE.ROOT2A) THEN - ROOT2 = ROOT2A - ELSE - ROOT2 = ROOT2B - ENDIF - ROOT2 = MIN(MAX(ROOT2, ZERO), CHI4) - PSI4 = CHI4 - ROOT2 - ENDIF - PSCONV4 = ABS(PSI4-PSI4O) .LE. EPS*PSI4O - PSI4O = PSI4 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A5) THEN - BB =-(WAER(2) + WAER(1) - ROOT3 - ROOT4) - CC = WAER(1)*(2.D0*ROOT3 + 2.D0*ROOT4 - 4.D0*WAER(2) - ONE) - & -(ROOT3 + ROOT4)**2.0 + 4.D0*WAER(2)*(ROOT3 + ROOT4) - CC =-0.25*CC - DD = WAER(1)*WAER(2)*(ONE - 2.D0*ROOT3 - 2.D0*ROOT4) + - & WAER(2)*(ROOT3 + ROOT4)**2.0 - A5 - DD =-0.25*DD - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN (MAX(ROOT1,ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A9) THEN - BB =-(WAER(4) + WAER(1) - 2.D0*ROOT1 - ROOT3) - CC = WAER(4)*(WAER(1) - 2.D0*ROOT1 - ROOT3) - A9 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT4A= 0.5D0*(-BB-DD) - ROOT4B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT4A) THEN - ROOT4 = ROOT4A - ELSE - ROOT4 = ROOT4B - ENDIF - ROOT4 = MIN(MAX(ROOT4, ZERO), CHI2) - PSI2 = CHI2-ROOT4 - ENDIF - PSCONV2 = ABS(PSI2-PSI2O) .LE. EPS*PSI2O - PSI2O = PSI2 -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - (2.D0*ROOT1 + ROOT3 + ROOT4) - SO4I= WAER(2) - ROOT1 - NH4I= WAER(3) - ROOT2 - NO3I= WAER(4) - ROOT4 - CLI = WAER(5) - (ROOT3 + ROOT2) -C -C SODIUM CHLORIDE ; To obtain new value for ROOT3 -C - IF (NAI*CLI .GT. A8) THEN - BB =-(WAER(1) - 2.D0*ROOT1 + WAER(5) - ROOT2 - ROOT4) - CC = (WAER(5) + ROOT2)*(WAER(1) - 2.D0*ROOT1 - ROOT4) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT3A= 0.5D0*(-BB-DD) - ROOT3B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT3A) THEN - ROOT3 = ROOT3A - ELSE - ROOT3 = ROOT3B - ENDIF - ROOT3 = MIN(MAX(ROOT3, ZERO), CHI3) - PSI3 = CHI3-ROOT3 - ENDIF - PSCONV3 = ABS(PSI3-PSI3O) .LE. EPS*PSI3O - PSI3O = PSI3 -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.LT.OHI) THEN - CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) - HI = AKW/OHI - ELSE - GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I, ZERO) - GGCL = MAX(GG-GGNO3, ZERO) - IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl - IF (GGNO3.GT.TINY) THEN - IF (GGCL.LE.TINY) HI = ZERO - CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 - ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV1.AND.PSCONV2.AND.PSCONV3.AND.PSCONV4) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCR2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 IF (CLI.LE.TINY .AND. WAER(5).GT.TINY) THEN !No disslv Cl-;solid only - DO 30 I=1,NIONS - MOLAL(I) = ZERO -30 CONTINUE - DO 40 I=1,NGASAQ - GASAQ(I) = ZERO -40 CONTINUE - CALL CALCR1A - ELSE ! OK, aqueous phase present - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = CHI3 - PSI3 - CNANO3 = CHI2 - PSI2 - CNA2SO4 = CHI1 - PSI1 - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR2A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR1 -C *** CASE R1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR1 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCR1A, CALCR2A, CALCR3A, CALCR4A, CALCR5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'R1 ; SUBCASE 1' - CALL CALCR1A ! SOLID - SCASE = 'R1 ; SUBCASE 1' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN.AND.EXAC.AND.EXSC.AND.EXSN) THEN ! *** ALL EXIST - IF (RH.GE.DRMH1) THEN - SCASE = 'R1 ; SUBCASE 2' ! MDRH - CALL CALCMDRP (RH, DRMH1, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 2' - ENDIF -C - ELSE IF (.NOT.EXAN) THEN ! *** NH4NO3 = 0 - IF ( EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMH2) THEN - SCASE = 'R1 ; SUBCASE 3' - CALL CALCMDRP (RH, DRMH2, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R1 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR1) THEN - SCASE = 'R1 ; SUBCASE 4' - CALL CALCMDRP (RH, DRMR1, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R1 ; SUBCASE 4' - ENDIF - - ELSE IF (.NOT.EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'R1 ; SUBCASE 5' - CALL CALCMDRP (RH, DRMR2, DRNACL, CALCR1A, CALCR3A) !, CALCR4A) - SCASE = 'R1 ; SUBCASE 5' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR3) THEN - SCASE = 'R1 ; SUBCASE 6' - CALL CALCMDRP (RH, DRMR3, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R1 ; SUBCASE 6' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'R1 ; SUBCASE 7' - CALL CALCMDRP (RH, DRMR4, DRNACL, CALCR1A, CALCR3A) !, CALCR4A) - SCASE = 'R1 ; SUBCASE 7' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'R1 ; SUBCASE 8' - CALL CALCMDRP (RH, DRMR5, DRNH4CL, CALCR1A, CALCR3A) !, CALCR5) - SCASE = 'R1 ; SUBCASE 8' - ENDIF - - ELSE IF ( EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR6) THEN - SCASE = 'R1 ; SUBCASE 9' - CALL CALCMDRP (RH, DRMR6, DRNANO3, CALCR1A, CALCR3A) - SCASE = 'R1 ; SUBCASE 9' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXAC) THEN ! *** NH4CL = 0 - IF ( EXAN .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR7) THEN - SCASE = 'R1 ; SUBCASE 10' - CALL CALCMDRP (RH, DRMR7, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 10' - ENDIF - - ELSE IF ( EXAN .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR8) THEN - SCASE = 'R1 ; SUBCASE 11' - CALL CALCMDRP (RH, DRMR8, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 11' - ENDIF - - ELSE IF ( EXAN .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR9) THEN - SCASE = 'R1 ; SUBCASE 12' - CALL CALCMDRP (RH, DRMR9, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 12' - ENDIF - - ELSE IF ( EXAN .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR10) THEN - SCASE = 'R1 ; SUBCASE 13' - CALL CALCMDRP (RH, DRMR10, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 13' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXSN) THEN ! *** NANO3 = 0 - IF ( EXAN .AND. EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR11) THEN - SCASE = 'R1 ; SUBCASE 14' - CALL CALCMDRP (RH, DRMR11, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 14' - ENDIF - - ELSE IF ( EXAN .AND. EXAC .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR12) THEN - SCASE = 'R1 ; SUBCASE 15' - CALL CALCMDRP (RH, DRMR12, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 15' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXSC) THEN ! *** NACL = 0 - IF ( EXAN .AND. EXAC .AND. EXSN) THEN - IF (RH.GE.DRMR13) THEN - SCASE = 'R1 ; SUBCASE 16' - CALL CALCMDRP (RH, DRMR13, DRNH4NO3, CALCR1A, CALCR2A) - SCASE = 'R1 ; SUBCASE 16' - ENDIF - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCR1 ****************************************** -C - END - - -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCR1A -C *** CASE R1 ; SUBCASE 1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; SODIUM RICH (SODRAT >= 2.0) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : NH4NO3, NH4CL, NANO3, NA2SO4, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCR1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE SOLIDS ************************************************** -C - CNA2SO4 = WAER(2) - FRNA = MAX (WAER(1)-2*CNA2SO4, ZERO) -C - CNH42S4 = ZERO -C - CNANO3 = MIN (FRNA, WAER(4)) - FRNO3 = MAX (WAER(4)-CNANO3, ZERO) - FRNA = MAX (FRNA-CNANO3, ZERO) -C - CNACL = MIN (FRNA, WAER(5)) - FRCL = MAX (WAER(5)-CNACL, ZERO) - FRNA = MAX (FRNA-CNACL, ZERO) -C - CNH4NO3 = MIN (FRNO3, WAER(3)) - FRNO3 = MAX (FRNO3-CNH4NO3, ZERO) - FRNH3 = MAX (WAER(3)-CNH4NO3, ZERO) -C - CNH4CL = MIN (FRCL, FRNH3) - FRCL = MAX (FRCL-CNH4CL, ZERO) - FRNH3 = MAX (FRNH3-CNH4CL, ZERO) -C -C *** OTHER PHASES ****************************************************** -C - WATER = ZERO -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCR1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV7 -C *** CASE V7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV7 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - KI = WAER(7) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF - -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV7') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CMGSO4 = ZERO - CK2SO4 = ZERO - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV7 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV6 -C *** CASE V6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MGSO4, NA2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV6 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSI70 =-GREAT ! GREAT = 1.D10 - ROOT7 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 - CHI7 = CK2SO4 ! SALTS -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7)) - CC = WAER(7)*(WAER(2)-WAER(6)) + 0.25D0*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*WAER(2) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MIN (ROOT7,WAER(7)/2.0,MAX(WAER(2)-WAER(6),ZERO),CHI7) - ROOT7 = MAX (ROOT7, ZERO) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT7, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV6') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV6 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV5 -C *** CASE V5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4, MGSO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV5 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 - CHI7 = CK2SO4 ! SALTS - CHI1 = CNA2SO4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX(WAER(2)-WAER(6) - ROOT1, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6)) - ROOT7) - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX ((WAER(2)-WAER(6)) - ROOT7, ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX ((WAER(2)-WAER(6)) - ROOT7 - ROOT1, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV5****************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV4 -C *** CASE V4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, (NH4)2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV4 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 - CHI7 = CK2SO4 ! SALTS - CHI1 = CNA2SO4 - CHI8 = CMGSO4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX((WAER(2)-WAER(6)) - ROOT1, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6)) - ROOT7) - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX ((WAER(2)-WAER(6)) - ROOT7, ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX ((WAER(2)-WAER(6)) - ROOT7 - ROOT1, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV4****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV3 -C *** CASE V3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, (NH4)2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV3 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCV1A, CALCV4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO .OR. EXCL) THEN ! *** NITRATE OR CHLORIDE EXISTS - SCASE = 'V3 ; SUBCASE 1' - CALL CALCV3A - SCASE = 'V3 ; SUBCASE 1' -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMO3) THEN - SCASE = 'V3 ; SUBCASE 2' - CALL CALCV1A ! SOLID - SCASE = 'V3 ; SUBCASE 2' - ELSE - SCASE = 'V3 ; SUBCASE 3' ! MDRH (CaSO4, (NH4)2SO4, MGSO4, NA2SO4, K2SO4) - CALL CALCMDRPII (RH, DRMO3, DRNH42S4, CALCV1A, CALCV4) - SCASE = 'V3 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCV3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV3A -C *** CASE V3A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, (NH4)2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV3A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1, PSCONV6 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. - PSCONV6 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT - PSI60 =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO - ROOT6 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 - CHI7 = CK2SO4 ! SALTS - CHI1 = CNA2SO4 - CHI8 = CMGSO4 - CHI6 = CNH42S4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = WAER(2) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - A6 = XK7 *(WATER/GAMA(4))**3.0 !(NH4)2SO4 <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1 - ROOT6) - CC = WAER(7)*((WAER(2) - WAER(6)) - ROOT1 - ROOT6) + - & 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6))-ROOT1-ROOT6)-A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT1-ROOT6, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7 - ROOT6) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7 - ROOT6) + - & 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6))-ROOT7-ROOT6)-A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT7-ROOT6, ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM SULFATE -C - IF (NH4I*NH4I*SO4I .GT. A6) THEN - BB =-((WAER(2)-WAER(6)) + WAER(3) - ROOT7 - ROOT1) - CC = WAER(3)*((WAER(2)-WAER(6)) - ROOT7 - ROOT1) + - & 0.25*WAER(3)*WAER(3) - DD =-0.25*(WAER(3)*WAER(3)*((WAER(2)-WAER(6))-ROOT7-ROOT1)-A6) - CALL POLY3(BB, CC, DD, ROOT6, ISLV) - IF (ISLV.NE.0) ROOT6 = TINY - ROOT6 = MAX (ROOT6, ZERO) - ROOT6 = MIN (ROOT6, WAER(3)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT7-ROOT1, ZERO), CHI6) - PSI6 = CHI6-ROOT6 - ENDIF - PSCONV6 = ABS(PSI6-PSI60) .LE. EPS*PSI60 - PSI60 = PSI6 -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT7 - ROOT1 - ROOT6, ZERO) - NH4I = MAX (WAER(3) - 2.D0*ROOT6, ZERO) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1 .AND. PSCONV6) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV3') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = CHI6 - PSI6 - CNH4NO3 = ZERO - CNH4CL = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV3A****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCV2 -C *** CASE V2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, (NH4)2SO4, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV2 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCV1A, CALCV3A, CALCV4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO) THEN ! *** NITRATE EXISTS - SCASE = 'V2 ; SUBCASE 1' - CALL CALCV2A - SCASE = 'V2 ; SUBCASE 1' -C - ELSEIF (.NOT.EXNO .AND. EXCL) THEN ! *** ONLY CHLORIDE EXISTS - IF (RH.LT.DRMO2) THEN - SCASE = 'V2 ; SUBCASE 2' - CALL CALCV1A ! SOLID - SCASE = 'V2 ; SUBCASE 2' - ELSE - SCASE = 'V2 ; SUBCASE 3' ! MDRH CaSO4, NH4CL, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 - CALL CALCMDRPII (RH, DRMO2, DRNH4CL, CALCV1A, CALCV3A) - SCASE = 'V2 ; SUBCASE 3' - ENDIF -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMO3) THEN - SCASE = 'V2 ; SUBCASE 2' - CALL CALCV1A ! SOLID - SCASE = 'V2 ; SUBCASE 2' - ELSE - SCASE = 'V2 ; SUBCASE 4' ! MDRH CaSO4, (NH4)2SO4, MGSO4, NA2SO4, K2SO4 - CALL CALCMDRPII (RH, DRMO3, DRNH42S4, CALCV1A, CALCV4) - SCASE = 'V2 ; SUBCASE 4' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCV2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV2A -C *** CASE V2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, (NH4)2SO4, NH4CL -C 4. Completely dissolved: NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV2A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1, PSCONV6, PSCONV4 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. - PSCONV6 =.TRUE. - PSCONV4 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT - PSI60 =-GREAT - PSI40 =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO - ROOT6 = ZERO - ROOT4 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCV1A -C - CHI9 = CCASO4 - CHI7 = CK2SO4 ! SALTS - CHI1 = CNA2SO4 - CHI8 = CMGSO4 - CHI6 = CNH42S4 - CHI4 = CNH4CL -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI6 = CNH42S4 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - A6 = XK7 *(WATER/GAMA(4))**3.0 ! (NH4)2SO4 <==> NH4+ - A14 = XK14*(WATER/GAMA(6))**2. ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - 2.D0*ROOT6) - CC = WAER(5)*(WAER(3) - 2.D0*ROOT6) - A14 - DD = BB*BB - 4.D0*CC - IF (DD.LT.ZERO) THEN - ROOT4 = ZERO - ELSE - DD = SQRT(DD) - ROOT4A= 0.5D0*(-BB+DD) - ROOT4B= 0.5D0*(-BB-DD) - IF (ZERO.LE.ROOT4A) THEN - ROOT4 = ROOT4A - ELSE - ROOT4 = ROOT4B - ENDIF - ROOT4 = MAX(ROOT4, ZERO) - ROOT4 = MIN(ROOT4, WAER(5), - & MAX (WAER(3) - 2.D0*ROOT6, ZERO), CHI4) - PSI4 = CHI4 - ROOT4 - ENDIF - ENDIF - PSCONV4 = ABS(PSI4-PSI40) .LE. EPS*PSI40 - PSI40 = PSI4 -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2) - WAER(6)) + WAER(7) - ROOT1 - ROOT6) - CC = WAER(7)*((WAER(2) - WAER(6)) - ROOT1 - ROOT6) - & + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6))-ROOT1-ROOT6)-A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT1-ROOT6, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2) - WAER(6)) + WAER(1) - ROOT7 - ROOT6) - CC = WAER(1)*((WAER(2) - WAER(6)) - ROOT7 - ROOT6) + - & 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6))-ROOT7-ROOT6)-A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT7-ROOT6, ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM SULFATE -C - IF (NH4I*NH4I*SO4I .GT. A6) THEN - BB =-((WAER(2)-WAER(6)) + WAER(3) - ROOT7 - ROOT1 - ROOT4) - CC = WAER(3)*((WAER(2)-WAER(6)) - ROOT7 - ROOT1) + 0.25* - & (WAER(3)-ROOT4)**2.0 + ROOT4*(ROOT1+ROOT7-(WAER(2)-WAER(6))) - DD =-0.25*((WAER(3)-ROOT4)**2.0 * - & ((WAER(2)-WAER(6))-ROOT7-ROOT1) - A6) - CALL POLY3(BB, CC, DD, ROOT6, ISLV) - IF (ISLV.NE.0) ROOT6 = TINY - ROOT6 = MAX (ROOT6, ZERO) - ROOT6 = MIN (ROOT6, WAER(3)/2.0, - & MAX (WAER(2)-WAER(6) - ROOT7 - ROOT1, ZERO), CHI6) - PSI6 = CHI6-ROOT6 - ENDIF - PSCONV6 = ABS(PSI6-PSI60) .LE. EPS*PSI60 - PSI60 = PSI6 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT7 - ROOT1 - ROOT6, ZERO) - NH4I = MAX (WAER(3) - 2.D0*ROOT6, ZERO) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1 .AND. PSCONV6 .AND. PSCONV4) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCV2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = CHI6 - PSI6 - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCV2A****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV1 -C *** CASE V1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV1 - INCLUDE 'isrpia.inc' - LOGICAL EXNO, EXCL - EXTERNAL CALCV1A, CALCV2A, CALCV3A, CALCV4 -C -C *** REGIME DEPENDS ON AMBIENT RELATIVE HUMIDITY & POSSIBLE SPECIES *** -C - EXNO = WAER(4).GT.TINY - EXCL = WAER(5).GT.TINY -C - IF (EXNO .AND. EXCL) THEN ! *** NITRATE & CHLORIDE EXIST - IF (RH.LT.DRMO1) THEN - SCASE = 'V1 ; SUBCASE 1' - CALL CALCV1A ! SOLID - SCASE = 'V1 ; SUBCASE 1' - ELSE - SCASE = 'V1 ; SUBCASE 2' ! MDRH (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 - CALL CALCMDRPII (RH, DRMO1, DRNH4NO3, CALCV1A, CALCV2A) - SCASE = 'V1 ; SUBCASE 2' - ENDIF -C - ELSE IF (EXNO .AND. .NOT.EXCL) THEN ! *** ONLY NITRATE EXISTS - IF (RH.LT.DRMV1) THEN - SCASE = 'V1 ; SUBCASE 1' - CALL CALCV1A ! SOLID - SCASE = 'V1 ; SUBCASE 1' - ELSE - SCASE = 'V1 ; SUBCASE 3' ! MDRH (NH4)2SO4, NH4NO3, NA2SO4, K2SO4, MGSO4, CASO4 - CALL CALCMDRPII (RH, DRMV1, DRNH4NO3, CALCV1A, CALCV2A) - SCASE = 'V1 ; SUBCASE 3' - ENDIF -C - ELSE IF (.NOT.EXNO .AND. EXCL) THEN ! *** ONLY CHLORIDE EXISTS - IF (RH.LT.DRMO2) THEN - SCASE = 'V1 ; SUBCASE 1' - CALL CALCV1A ! SOLID - SCASE = 'V1 ; SUBCASE 1' - ELSE - SCASE = 'V1 ; SUBCASE 4' ! MDRH (NH4)2SO4, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 - CALL CALCMDRPII (RH, DRMO2, DRNH4CL, CALCV1A, CALCV3A) - SCASE = 'V1 ; SUBCASE 4' - ENDIF -C - ELSE ! *** NO CHLORIDE AND NITRATE - IF (RH.LT.DRMO3) THEN - SCASE = 'V1 ; SUBCASE 1' - CALL CALCV1A ! SOLID - SCASE = 'V1 ; SUBCASE 1' - ELSE - SCASE = 'V1 ; SUBCASE 5' ! MDRH (NH4)2SO4, NA2SO4, K2SO4, MGSO4, CASO4 - CALL CALCMDRPII (RH, DRMO3, DRNH42S4, CALCV1A, CALCV4) - SCASE = 'V1 ; SUBCASE 5' - ENDIF - ENDIF -C - RETURN -C -C IF (RH.LT.DRMO1) THEN -C SCASE = 'V1 ; SUBCASE 1' -C CALL CALCV1A ! SOLID PHASE ONLY POSSIBLE -C SCASE = 'V1 ; SUBCASE 1' -C ELSE -C SCASE = 'V1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE -C CALL CALCMDRPII (RH, DRMO1, DRNH4NO3, CALCV1A, CALCV2A) -C SCASE = 'V1 ; SUBCASE 2' -C ENDIF -C -C RETURN -C -C *** END OF SUBROUTINE CALCV1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCV1A -C *** CASE V1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : (NH4)2SO4, NH4NO3, NH4Cl, NA2SO4, K2SO4, MGSO4, CASO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCV1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE SOLIDS ************************************************** -C - CCASO4 = MIN (WAER(6), WAER(2)) ! CCASO4 - SO4FR = MAX (WAER(2) - CCASO4, ZERO) - CAFR = MAX (WAER(6) - CCASO4, ZERO) - CK2SO4 = MIN (0.5D0*WAER(7), SO4FR) ! CK2SO4 - FRK = MAX (WAER(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX (SO4FR - CK2SO4, ZERO) - CNA2SO4 = MIN (0.5D0*WAER(1), SO4FR) ! CNA2SO4 - NAFR = MAX (WAER(1) - 2.D0*CNA2SO4, ZERO) - SO4FR = MAX (SO4FR - CNA2SO4, ZERO) - CMGSO4 = MIN (WAER(8), SO4FR) ! CMGSO4 - FRMG = MAX(WAER(8) - CMGSO4, ZERO) - SO4FR = MAX(SO4FR - CMGSO4, ZERO) - CNH42S4 = MAX (MIN (SO4FR , 0.5d0*WAER(3)) , TINY) - FRNH3 = MAX (WAER(3) - 2.D0*CNH42S4, ZERO) -C - CNH4NO3 = MIN (FRNH3, WAER(4)) -CCC FRNO3 = MAX (WAER(4) - CNH4NO3, ZERO) - FRNH3 = MAX (FRNH3 - CNH4NO3, ZERO) -C - CNH4CL = MIN (FRNH3, WAER(5)) -CCC FRCL = MAX (WAER(5) - CNH4CL, ZERO) - FRNH3 = MAX (FRNH3 - CNH4CL, ZERO) -C -C *** OTHER PHASES ****************************************************** -C - WATER = ZERO -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCV1A ***************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCU8 -C *** CASE U8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); CRUSTAL+SODIUM RICH (CRNARAT >= 2.0); CRUSTAL POOR (CRRAT<2) -C 2. THERE IS ONLY A LIQUID PHASE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU8 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - CALL CALCU1A -C - CHI9 = CCASO4 ! SALTS -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - FRST = .TRUE. - CALAIN = .TRUE. - CALAOU = .TRUE. -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** SETUP LIQUID CONCENTRATIONS ************************************** -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C - NAI = WAER(1) - SO4I = MAX(WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - KI = WAER(7) - MGI = WAER(8) - -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF - IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU8') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1) = NH3AQ - GASAQ(2) = CLAQ - GASAQ(3) = NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO - CMGSO4 = ZERO - CK2SO4 = ZERO - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCU8 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU7 -C *** CASE U7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), CRUSTAL+SODIUM RICH (CRNARAT >= 2.0); CRUSTAL POOR (CRRAT<2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MGSO4, NA2SO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU7 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSI70 =-GREAT ! GREAT = 1.D10 - ROOT7 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI7 = CK2SO4 ! SALTS - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7)) - CC = WAER(7)*(WAER(2)-WAER(6)) + 0.25D0*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*(WAER(2)-WAER(6)) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7,WAER(7)/2.0,MAX(WAER(2)-WAER(6),ZERO),CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - SO4I = MAX (WAER(2) - WAER(6) - ROOT7, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU7') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCU7 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU6 -C *** CASE U6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL, MGSO4 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU6 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI1 = CNA2SO4 ! SALTS - CHI7 = CK2SO4 - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX((WAER(2)-WAER(6)) - ROOT1,ZERO), CHI7) - PSI7 = CHI7-ROOT7 - - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6)) - ROOT7) - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX((WAER(2)-WAER(6)) - ROOT7, ZERO) ,CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX (WAER(2) - WAER(6) - ROOT7 - ROOT1, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU6') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCU6****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU5 -C *** CASE U5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4 -C 4. Completely dissolved: NH4NO3, NH4CL, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU5 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.TRUE. - PSCONV1 =.TRUE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI1 = CNA2SO4 ! SALTS - CHI7 = CK2SO4 - CHI8 = CMGSO4 - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX(WAER(2)-WAER(6)-ROOT1, ZERO),CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6)) - ROOT7) - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX(WAER(2)-WAER(6)-ROOT7, ZERO),CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT7 - ROOT1, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCU5****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU4 -C *** CASE U4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU4 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCU1A, CALCU5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'U4 ; SUBCASE 2' - CALL CALCU1A ! SOLID - SCASE = 'U4 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN .OR. EXSN .OR. EXSC) THEN ! *** NH4NO3,NANO3 EXIST - IF (RH.GE.DRMM1) THEN - SCASE = 'U4 ; SUBCASE 1' - CALL CALCU4A - SCASE = 'U4 ; SUBCASE 1' - ENDIF -C - ELSE IF (EXAC) THEN ! *** NH4CL EXISTS ONLY - IF (RH.GE.DRMR5) THEN - SCASE = 'U4 ; SUBCASE 3' - CALL CALCMDRPII (RH, DRMR5, DRNH4CL, CALCU1A, CALCU5) - SCASE = 'U4 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCU4 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU4A -C *** CASE U4A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL -C 4. Completely dissolved: NH4NO3, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU4A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1, PSCONV4 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.FALSE. - PSCONV1 =.FALSE. - PSCONV4 =.FALSE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT - PSI40 =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO - ROOT4 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI1 = CNA2SO4 ! SALTS - CHI4 = CNH4CL - CHI7 = CK2SO4 - CHI8 = CMGSO4 - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX(WAER(2)-WAER(6)-ROOT1, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-((WAER(2)-WAER(6)) + WAER(1) - ROOT7) - CC = WAER(1)*((WAER(2)-WAER(6)) - ROOT7) + 0.25*WAER(1)*WAER(1) - DD =-0.25*(WAER(1)*WAER(1)*((WAER(2)-WAER(6)) - ROOT7) - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MAX (ROOT1, ZERO) - ROOT1 = MIN (ROOT1, WAER(1)/2.0, - & MAX (WAER(2)-WAER(6)-ROOT7, ZERO), CHI1) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(NH4I + CLI) - CC =-A14 + NH4I*CLI - DD = BB*BB - 4.D0*CC - ROOT4 = 0.5D0*(-BB-SQRT(DD)) - IF (ROOT4.GT.TINY) THEN - ROOT4 = MIN(MAX (ROOT4, ZERO), CHI4) - PSI4 = CHI4 - ROOT4 - ENDIF - ENDIF - PSCONV4 = ABS(PSI4-PSI40) .LE. EPS*PSI40 - PSI40 = PSI4 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1, ZERO) - SO4I = MAX (WAER(2) - WAER(6) - ROOT7 - ROOT1, ZERO) - NH4I = MAX (WAER(3) - ROOT4, ZERO) - NO3I = WAER(4) - CLI = MAX (WAER(5) - ROOT4, ZERO) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1 .AND. PSCONV4) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = ZERO - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) -C - RETURN -C -C *** END OF SUBROUTINE CALCU4A **************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU3 -C *** CASE U3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL, NANO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU3 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCU1A, CALCU4A, CALCU5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'U3 ; SUBCASE 2' - CALL CALCU1A ! SOLID - SCASE = 'U3 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN .OR. EXSN) THEN ! *** NH4NO3,NANO3 EXIST - IF (RH.GE.DRMM1) THEN - SCASE = 'U3 ; SUBCASE 1' - CALL CALCU3A - SCASE = 'U3 ; SUBCASE 1' - ENDIF -C - ELSE IF (.NOT.EXAN .AND. .NOT.EXSN) THEN ! *** NH4NO3,NANO3 = 0 - IF ( EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'U3 ; SUBCASE 3' - CALL CALCMDRPII (RH, DRMR4, DRNACL, CALCU1A, CALCU4A) - SCASE = 'U3 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'U3 ; SUBCASE 4' - CALL CALCMDRPII (RH, DRMR2, DRNACL, CALCU1A, CALCU4A) - SCASE = 'U3 ; SUBCASE 4' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'U3 ; SUBCASE 5' - CALL CALCMDRPII (RH, DRMR5, DRNACL, CALCU1A, CALCU5) - SCASE = 'U3 ; SUBCASE 5' - ENDIF - ENDIF -C - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCU3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU3A -C *** CASE U3A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL, NACL -C 4. Completely dissolved: NH4NO3, NANO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU3A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1, PSCONV4, PSCONV3 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.FALSE. - PSCONV1 =.FALSE. - PSCONV4 =.FALSE. - PSCONV3 =.FALSE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT - PSI40 =-GREAT - PSI30 =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO - ROOT4 = ZERO - ROOT3 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI1 = CNA2SO4 ! SALTS - CHI3 = CNACL - CHI4 = CNH4CL - CHI7 = CK2SO4 - CHI8 = CMGSO4 - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ - A8 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX(WAER(2)-WAER(6)-ROOT1, ZERO),CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-(((WAER(2)-WAER(6))-ROOT7)*(WAER(1) - ROOT3)) - CC = ((WAER(2) - WAER(6)) - ROOT7)*(WAER(1) - ROOT3) + - & 0.25D0*(WAER(1) - ROOT3)**2. - DD =-0.25D0*(((WAER(2) - WAER(6)) - ROOT7)* - & (WAER(1) - ROOT3)**2.D0 - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN (MAX(ROOT1, ZERO), MAX(WAER(1) - ROOT3, ZERO), - & CHI1, MAX(WAER(2)-WAER(6), ZERO)) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - ROOT4) - CC =-A14 + NH4I*(WAER(5) - ROOT4) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - ROOT4A= 0.5D0*(-BB+SQRT(DD)) - ROOT4B= 0.5D0*(-BB-SQRT(DD)) - IF (ZERO.LE.ROOT4A) THEN - ROOT4 = ROOT4A - ELSE - ROOT4 = ROOT4B - ENDIF - ROOT4 = MIN(MAX(ZERO, ROOT4), MAX(WAER(5)-ROOT3,ZERO), - & CHI4, WAER(3)) - PSI4 = CHI4 - ROOT4 - ENDIF - PSCONV4 = ABS(PSI4-PSI40) .LE. EPS*PSI40 - PSI40 = PSI4 -C -C SODIUM CHLORIDE ; To obtain new value for ROOT3 -C - IF (NAI*CLI .GT. A8) THEN - BB =-((CHI1-2.D0*ROOT1) + (WAER(5) - ROOT4)) - CC = (CHI1-2.D0*ROOT1)*(WAER(5) - ROOT4) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT3A= 0.5D0*(-BB-SQRT(DD)) - ROOT3B= 0.5D0*(-BB+SQRT(DD)) - IF (ZERO.LE.ROOT3A) THEN - ROOT3 = ROOT3A - ELSE - ROOT3 = ROOT3B - ENDIF - ROOT3 = MIN(MAX(ROOT3, ZERO), CHI3) - PSI3 = CHI3-ROOT3 - ENDIF - PSCONV3 = ABS(PSI3-PSI30) .LE. EPS*PSI30 - PSI30 = PSI3 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.D0*ROOT1 - ROOT3, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT7 - ROOT1, ZERO) - NH4I = MAX (WAER(3) - ROOT4, ZERO) - NO3I = WAER(4) - CLI = MAX (WAER(5) - ROOT4 - ROOT3, ZERO) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1 .AND. PSCONV4 .AND. PSCONV3) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU3A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 IF (CLI.LE.TINY .AND. WAER(5).GT.TINY) THEN !No disslv Cl-;solid only - DO 30 I=1,NIONS - MOLAL(I) = ZERO -30 CONTINUE - DO 40 I=1,NGASAQ - GASAQ(I) = ZERO -40 CONTINUE - CALL CALCU1A - ELSE - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = CHI3 - PSI3 - CNANO3 = ZERO - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCU3A***************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU2 -C *** CASE U2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL, NANO3, NACL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU2 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCU1A, CALCU3A, CALCU4A, CALCU5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'U2 ; SUBCASE 2' - CALL CALCU1A ! SOLID - SCASE = 'U2 ; SUBCASE 2' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN) THEN ! *** NH4NO3 EXISTS - IF (RH.GE.DRMM1) THEN - SCASE = 'U2 ; SUBCASE 1' - CALL CALCU2A - SCASE = 'U2 ; SUBCASE 1' - ENDIF -C - ELSE IF (.NOT.EXAN) THEN ! *** NH4NO3 = 0 - IF ( EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMM2) THEN - SCASE = 'U2 ; SUBCASE 3' - CALL CALCMDRPII (RH, DRMM2, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U2 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR1) THEN - SCASE = 'U2 ; SUBCASE 4' - CALL CALCMDRPII (RH, DRMR1, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U2 ; SUBCASE 4' - ENDIF - - ELSE IF (.NOT.EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'U2 ; SUBCASE 5' - CALL CALCMDRPII (RH, DRMR2, DRNACL, CALCU1A, CALCU4A) - SCASE = 'U2 ; SUBCASE 5' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR3) THEN - SCASE = 'U2 ; SUBCASE 6' - CALL CALCMDRPII (RH, DRMR3, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U2 ; SUBCASE 6' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'U2 ; SUBCASE 7' - CALL CALCMDRPII (RH, DRMR4, DRNACL, CALCU1A, CALCU4A) - SCASE = 'U2 ; SUBCASE 7' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'U2 ; SUBCASE 8' - CALL CALCMDRPII (RH, DRMR5, DRNH4CL, CALCU1A, CALCU5) - SCASE = 'U2 ; SUBCASE 8' - ENDIF - - ELSE IF ( EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR6) THEN - SCASE = 'U2 ; SUBCASE 9' - CALL CALCMDRPII (RH, DRMR6, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U2 ; SUBCASE 9' - ENDIF - ENDIF -C - ENDIF -C - RETURN - -C IF (W(4).GT.TINY) THEN ! NO3 EXISTS, WATER POSSIBLE -C SCASE = 'U2 ; SUBCASE 1' -C CALL CALCU2A -C SCASE = 'U2 ; SUBCASE 1' -C ELSE ! NO3 NON EXISTANT, WATER NOT POSSIBLE -C SCASE = 'U2 ; SUBCASE 1' -C CALL CALCU1A -C SCASE = 'U2 ; SUBCASE 1' -C ENDIF -CC -C IF (WATER.LE.TINY .AND. RH.LT.DRMM2) THEN ! DRY AEROSOL -C SCASE = 'U2 ; SUBCASE 2' -C CALL CALCU2A -C SCASE = 'U2 ; SUBCASE 1' -CC -C ELSEIF (WATER.LE.TINY .AND. RH.GE.DRMM2) THEN ! MDRH OF M2 -C SCASE = 'U2 ; SUBCASE 3' -C CALL CALCMDRPII (RH, DRMM2, DRNANO3, CALCU1A, CALCU3A) -C SCASE = 'U2 ; SUBCASE 3' -C ENDIF -CC -C RETURN -C -C *** END OF SUBROUTINE CALCU2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU2A -C *** CASE U2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), Cr+NA poor (CRNARAT < 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL, NACL, NANO3 -C 4. Completely dissolved: NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU2A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV7, PSCONV1, PSCONV4, PSCONV3, PSCONV5 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV7 =.FALSE. - PSCONV1 =.FALSE. - PSCONV4 =.FALSE. - PSCONV3 =.FALSE. - PSCONV5 =.FALSE. -C - PSI70 =-GREAT ! GREAT = 1.D10 - PSI1O =-GREAT - PSI40 =-GREAT - PSI30 =-GREAT - PSI50 =-GREAT -C - ROOT7 = ZERO - ROOT1 = ZERO - ROOT4 = ZERO - ROOT3 = ZERO - ROOT5 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCU1A -C - CHI1 = CNA2SO4 ! SALTS - CHI2 = CNANO3 - CHI3 = CNACL - CHI4 = CNH4CL - CHI7 = CK2SO4 - CHI8 = CMGSO4 - CHI9 = CCASO4 -C - PSI1 = CNA2SO4 ! AMOUNT DISSOLVED - PSI2 = CNANO3 - PSI3 = CNACL - PSI4 = CNH4CL - PSI5 = CNH4NO3 - PSI7 = CK2SO4 - PSI8 = CMGSO4 - PSI9 = CCASO4 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C - MOLAL(1) = ZERO - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C - CALL CALCACT ! CALCULATE ACTIVITY COEFFICIENTS -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A7 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A1 = XK5 *(WATER/GAMA(2))**3.0 ! NA2S04 <==> Na+ - A14 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A8 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A9 = XK9 *(WATER/GAMA(3))**2.0 ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A7) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT1) - CC = WAER(7)*((WAER(2)-WAER(6)) - ROOT1) + 0.25*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*((WAER(2)-WAER(6)) - ROOT1) - A7) - CALL POLY3(BB, CC, DD, ROOT7, ISLV) - IF (ISLV.NE.0) ROOT7 = TINY - ROOT7 = MAX (ROOT7, ZERO) - ROOT7 = MIN (ROOT7, WAER(7)/2.0, - & MAX(WAER(2)-WAER(6)-ROOT1, ZERO),CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI70) .LE. EPS*PSI70 - PSI70 = PSI7 -C -C SODIUM SULFATE -C - IF (NAI*NAI*SO4I .GT. A1) THEN - BB =-(((WAER(2)-WAER(6))-ROOT7)*(WAER(1) - ROOT3 - ROOT5)) - CC = ((WAER(2)-WAER(6)) - ROOT7)*(WAER(1) - ROOT3 - ROOT5) + - & 0.25D0*(WAER(1) - ROOT3 - ROOT5)**2.0 - DD =-0.25D0*(((WAER(2) - WAER(6)) - ROOT7)* - & (WAER(1) - ROOT3 - ROOT5)**2.D0 - A1) - CALL POLY3(BB, CC, DD, ROOT1, ISLV) - IF (ISLV.NE.0) ROOT1 = TINY - ROOT1 = MIN (MAX(ROOT1,ZERO), MAX(WAER(1)-ROOT3-ROOT5,ZERO), - & CHI1, MAX(WAER(2)-WAER(6),ZERO)) - PSI1 = CHI1-ROOT1 - ENDIF - PSCONV1 = ABS(PSI1-PSI1O) .LE. EPS*PSI1O - PSI1O = PSI1 -C -C AMMONIUM CHLORIDE -C - IF (NH4I*CLI .GT. A14) THEN - BB =-(WAER(3) + WAER(5) - ROOT4) - CC =-A14 + NH4I*(WAER(5) - ROOT4) - DD = MAX(BB*BB - 4.D0*CC, ZERO) - ROOT4A= 0.5D0*(-BB+SQRT(DD)) - ROOT4B= 0.5D0*(-BB-SQRT(DD)) - IF (ZERO.LE.ROOT4A) THEN - ROOT4 = ROOT4A - ELSE - ROOT4 = ROOT4B - ENDIF - ROOT4 = MIN(MAX(ZERO, ROOT4), MAX(WAER(5)-ROOT3,ZERO), - & CHI4, WAER(3)) - PSI4 = CHI4 - ROOT4 - ENDIF - PSCONV4 = ABS(PSI4-PSI40) .LE. EPS*PSI40 - PSI40 = PSI4 -C -C SODIUM CHLORIDE ; To obtain new value for ROOT3 -C - IF (NAI*CLI .GT. A8) THEN - BB =-((CHI1-2.D0*ROOT1-ROOT5) + (WAER(5) - ROOT4)) - CC = (CHI1-2.D0*ROOT1-ROOT5)*(WAER(5) - ROOT4) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT3A= 0.5D0*(-BB-SQRT(DD)) - ROOT3B= 0.5D0*(-BB+SQRT(DD)) - IF (ZERO.LE.ROOT3A) THEN - ROOT3 = ROOT3A - ELSE - ROOT3 = ROOT3B - ENDIF - ROOT3 = MIN(MAX(ROOT3, ZERO), CHI3) - PSI3 = CHI3-ROOT3 - ENDIF - PSCONV3 = ABS(PSI3-PSI30) .LE. EPS*PSI30 - PSI30 = PSI3 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A9) THEN - BB =-(WAER(4) + WAER(1) - 2.D0*ROOT1 - ROOT3) - CC = WAER(4)*(WAER(1) - 2.D0*ROOT1 - ROOT3) - A9 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A= 0.5D0*(-BB-DD) - ROOT5B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI2) - PSI2 = CHI2-ROOT5 - ENDIF -C - PSCONV5 = ABS(PSI2-PSI20) .LE. EPS*PSI20 - PSI20 = PSI2 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.0D0*ROOT7, ZERO) - NAI = MAX (WAER(1) - 2.0D0*ROOT1 - ROOT3 - ROOT5, ZERO) - SO4I = MAX (WAER(2) - WAER(6) - ROOT7 - ROOT1, ZERO) - NH4I = MAX (WAER(3) - ROOT4, ZERO) - NO3I = MAX (WAER(4) - ROOT5, ZERO) - CLI = MAX (WAER(5) - ROOT4 - ROOT3, ZERO) - CAI = ZERO - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C IF (HI.LE.TINY) HI = SQRT(AKW) -C OHI = AKW/HI -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV7 .AND. PSCONV1 .AND. PSCONV4 .AND. PSCONV3 - & .AND. PSCONV5) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCU2A') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 IF (CLI.LE.TINY .AND. WAER(5).GT.TINY) THEN !No disslv Cl-;solid only - DO 30 I=1,NIONS - MOLAL(I) = ZERO -30 CONTINUE - DO 40 I=1,NGASAQ - GASAQ(I) = ZERO -40 CONTINUE - CALL CALCU1A - ELSE ! OK, aqueous phase present - A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI4 - PSI4 - CNACL = CHI3 - PSI3 - CNANO3 = CHI2 - PSI2 - CNA2SO4 = CHI1 - PSI1 - CMGSO4 = ZERO - CK2SO4 = CHI7 - PSI7 - CCASO4 = MIN (WAER(6), WAER(2)) - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCU2A***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCU1 -C *** CASE U1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SO4RAT > 2.0), (DUST + SODIUM) RICH: R(Cr+Na)>2; DUST POOR: Rcr<2. -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : K2SO4, CASO4, NA2SO4, MGSO4, NH4CL, NANO3, NACL, NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU1 - INCLUDE 'isrpia.inc' - LOGICAL EXAN, EXAC, EXSN, EXSC - EXTERNAL CALCU1A, CALCU2A, CALCU3A, CALCU4A, CALCU5 -C -C *** SOLVE FOR DRY CASE AND SEE WHICH SOLIDS ARE POSSIBLE ************** -C - SCASE = 'U1 ; SUBCASE 1' - CALL CALCU1A ! SOLID - SCASE = 'U1 ; SUBCASE 1' -C - EXAN = CNH4NO3.GT.TINY ! NH4NO3 - EXAC = CNH4CL .GT.TINY ! NH4CL - EXSN = CNANO3 .GT.TINY ! NANO3 - EXSC = CNACL .GT.TINY ! NACL -C -C *** REGIME DEPENDS ON RELATIVE HUMIDITY AND POSSIBLE SPECIES ********** -C - IF (EXAN.OR.EXAC.OR.EXSC.OR.EXSN) THEN ! *** WATER POSSIBLE - IF (RH.GE.DRMM1) THEN - SCASE = 'U1 ; SUBCASE 2' ! MDRH - CALL CALCMDRPII (RH, DRMM1, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 2' - ENDIF -C - ELSE IF (.NOT.EXAN) THEN ! *** NH4NO3 = 0 - IF ( EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMM2) THEN - SCASE = 'U1 ; SUBCASE 3' - CALL CALCMDRPII (RH, DRMM2, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U1 ; SUBCASE 3' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR1) THEN - SCASE = 'U1 ; SUBCASE 4' - CALL CALCMDRPII (RH, DRMR1, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U1 ; SUBCASE 4' - ENDIF - - ELSE IF (.NOT.EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR2) THEN - SCASE = 'U1 ; SUBCASE 5' - CALL CALCMDRPII (RH, DRMR2, DRNACL, CALCU1A, CALCU3A) !, CALCR4A) - SCASE = 'U1 ; SUBCASE 5' - ENDIF - - ELSE IF (.NOT.EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR3) THEN - SCASE = 'U1 ; SUBCASE 6' - CALL CALCMDRPII (RH, DRMR3, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U1 ; SUBCASE 6' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR4) THEN - SCASE = 'U1 ; SUBCASE 7' - CALL CALCMDRPII (RH, DRMR4, DRNACL, CALCU1A, CALCU3A) !, CALCR4A) - SCASE = 'U1 ; SUBCASE 7' - ENDIF - - ELSE IF ( EXAC .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR5) THEN - SCASE = 'U1 ; SUBCASE 8' - CALL CALCMDRPII (RH, DRMR5, DRNH4CL, CALCU1A, CALCU3A) !, CALCR5) - SCASE = 'U1 ; SUBCASE 8' - ENDIF - - ELSE IF ( EXAC .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR6) THEN - SCASE = 'U1 ; SUBCASE 9' - CALL CALCMDRPII (RH, DRMR6, DRNANO3, CALCU1A, CALCU3A) - SCASE = 'U1 ; SUBCASE 9' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXAC) THEN ! *** NH4CL = 0 - IF ( EXAN .AND. EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR7) THEN - SCASE = 'U1 ; SUBCASE 10' - CALL CALCMDRPII (RH, DRMR7, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 10' - ENDIF - - ELSE IF ( EXAN .AND. .NOT.EXSN .AND. EXSC) THEN - IF (RH.GE.DRMR8) THEN - SCASE = 'U1 ; SUBCASE 11' - CALL CALCMDRPII (RH, DRMR8, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 11' - ENDIF - - ELSE IF ( EXAN .AND. .NOT.EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR9) THEN - SCASE = 'U1 ; SUBCASE 12' - CALL CALCMDRPII (RH, DRMR9, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 12' - ENDIF - - ELSE IF ( EXAN .AND. EXSN .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR10) THEN - SCASE = 'U1 ; SUBCASE 13' - CALL CALCMDRPII (RH, DRMR10, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 13' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXSN) THEN ! *** NANO3 = 0 - IF ( EXAN .AND. EXAC .AND. EXSC) THEN - IF (RH.GE.DRMR11) THEN - SCASE = 'U1 ; SUBCASE 14' - CALL CALCMDRPII (RH, DRMR11, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 14' - ENDIF - - ELSE IF ( EXAN .AND. EXAC .AND. .NOT.EXSC) THEN - IF (RH.GE.DRMR12) THEN - SCASE = 'U1 ; SUBCASE 15' - CALL CALCMDRPII (RH, DRMR12, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 15' - ENDIF - ENDIF -C - ELSE IF (.NOT.EXSC) THEN ! *** NACL = 0 - IF ( EXAN .AND. EXAC .AND. EXSN) THEN - IF (RH.GE.DRMR13) THEN - SCASE = 'U1 ; SUBCASE 16' - CALL CALCMDRPII (RH, DRMR13, DRNH4NO3, CALCU1A, CALCU2A) - SCASE = 'U1 ; SUBCASE 16' - ENDIF - ENDIF - ENDIF -C - RETURN - - -C IF (RH.LT.DRMM1) THEN -C SCASE = 'U1 ; SUBCASE 1' -C CALL CALCU1A ! SOLID PHASE ONLY POSSIBLE -C SCASE = 'U1 ; SUBCASE 1' -C ELSE -C SCASE = 'U1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE -C CALL CALCMDRPII (RH, DRMM1, DRNH4NO3, CALCU1A, CALCU2A) -C SCASE = 'U1 ; SUBCASE 2' -C ENDIF -CC -C RETURN -CC -C *** END OF SUBROUTINE CALCU1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE -C *** SUBROUTINE CALCU1A -C *** CASE U1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0); CRUSTAL+SODIUM RICH (CRNARAT >= 2.0); CRUSTAL POOR (CRRAT<2) -C 2. THERE IS ONLY A SOLID PHASE -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCU1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE SOLIDS ************************************************* -C - CCASO4 = MIN (WAER(6), WAER(2)) ! CCASO4 - SO4FR = MAX(WAER(2) - CCASO4, ZERO) - CAFR = MAX(WAER(6) - CCASO4, ZERO) - CK2SO4 = MIN (0.5D0*WAER(7), SO4FR) ! CK2SO4 - FRK = MAX(WAER(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX(SO4FR - CK2SO4, ZERO) - CMGSO4 = MIN (WAER(8), SO4FR) ! CMGSO4 - FRMG = MAX(WAER(8) - CMGSO4, ZERO) - SO4FR = MAX(SO4FR - CMGSO4, ZERO) - CNA2SO4 = MAX (SO4FR, ZERO) ! CNA2SO4 - FRNA = MAX (WAER(1) - 2.D0*CNA2SO4, ZERO) -C - CNH42S4 = ZERO -C - CNANO3 = MIN (FRNA, WAER(4)) - FRNO3 = MAX (WAER(4)-CNANO3, ZERO) - FRNA = MAX (FRNA-CNANO3, ZERO) -C - CNACL = MIN (FRNA, WAER(5)) - FRCL = MAX (WAER(5)-CNACL, ZERO) - FRNA = MAX (FRNA-CNACL, ZERO) -C - CNH4NO3 = MIN (FRNO3, WAER(3)) - FRNO3 = MAX (FRNO3-CNH4NO3, ZERO) - FRNH3 = MAX (WAER(3)-CNH4NO3, ZERO) -C - CNH4CL = MIN (FRCL, FRNH3) - FRCL = MAX (FRCL-CNH4CL, ZERO) - FRNH3 = MAX (FRNH3-CNH4CL, ZERO) -C -C *** OTHER PHASES ****************************************************** -C - WATER = ZERO -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCU1A ***************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW13 -C *** CASE W13 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW13 - INCLUDE 'isrpia.inc' -C - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP - - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C ION CONCENTRATIONS -C - NAI = WAER(1) - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - KI = WAER(7) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW13') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = ZERO - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = ZERO - KCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW13 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW12 -C *** CASE W12 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW12 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSI9O =-GREAT ! GREAT = 1.D10 - ROOT9 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7)) - CC = WAER(7)*(WAER(2)-WAER(6)) + 0.25D0*WAER(7)*WAER(7) - DD =-0.25*(WAER(7)*WAER(7)*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0, (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW12') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = ZERO - KCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW12 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW11 -C *** CASE W11 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW11 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13) - CC = (WAER(7)-ROOT13)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13)**2.0 - DD =-0.25*((WAER(7)-ROOT13)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9,WAER(7)/2.0-ROOT13,(WAER(2)-WAER(6)),CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) + WAER(7) - 2.D0*ROOT9) - CC = WAER(4)*(WAER(7) - 2.D0*ROOT9) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = WAER(3) - NO3I = MAX (WAER(4) - ROOT13, ZERO) - CLI = WAER(5) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW11') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW11 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW10 -C *** CASE W10 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4 -C 4. Completely dissolved: CA(NO3)2, CACL2, KCL, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW10 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A - -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13) - CC = (WAER(7)-ROOT13)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13)**2.0 - DD =-0.25*((WAER(7)-ROOT13)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9,WAER(7)/2.0-ROOT13,(WAER(2)-WAER(6)),CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) + WAER(7) - 2.D0*ROOT9) - CC = WAER(4)*(WAER(7) - 2.D0*ROOT9) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = WAER(3) - NO3I = MAX (WAER(4) - ROOT13, ZERO) - CLI = WAER(5) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW10') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = ZERO - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW10 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW9 -C *** CASE W9 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW9 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = WAER(4)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5) + WAER(7) - 2.D0*ROOT9 - ROOT13) - CC = WAER(5)*(WAER(7) - 2.D0*ROOT9 - ROOT13) - A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = WAER(3) - NO3I = MAX (WAER(4) - ROOT13, ZERO) - CLI = MAX (WAER(5) - ROOT14, ZERO) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW9') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = ZERO - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW9 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW8 -C *** CASE W8 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW8 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = WAER(4)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5) - ROOT5 + WAER(7) - 2.D0*ROOT9 - ROOT13) - CC = (WAER(5)-ROOT5)*(WAER(7) - 2.D0*ROOT9 - ROOT13) - A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14) - CC = (WAER(5)-ROOT14)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5, ZERO) - CAI = ZERO - NAI = WAER(1) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND.PSCONV5) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW8') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = ZERO - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW8 ****************************************** -C - END -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW7 -C *** CASE W7 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NANO3, NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW7 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = WAER(4)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*WAER(1) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW7') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = ZERO - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW7 ****************************************** -C - END - -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW6 -C *** CASE W6 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2, NH4NO3 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW6 - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7, PSCONV8 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. - PSCONV8 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT - PSI8O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO - ROOT8 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI8 = CNANO3 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A8 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) - ROOT8 + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = (WAER(4)-ROOT8)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT8 - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*(WAER(1)-ROOT8) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A8) THEN - BB =-(WAER(4) - ROOT13 + WAER(1) - ROOT7) - CC = (WAER(4) - ROOT13)*(WAER(1)-ROOT7) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT8A = 0.5D0*(-BB-DD) - ROOT8B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT8A) THEN - ROOT8 = ROOT8A - ELSE - ROOT8 = ROOT8B - ENDIF - ROOT8 = MIN(MAX(ROOT8, ZERO), CHI8) - PSI8 = CHI8-ROOT8 - ENDIF - PSCONV8 = ABS(PSI8-PSI8O) .LE. EPS*PSI8O - PSI8O = PSI8 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13 - ROOT8, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7 - ROOT8, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7 .AND. PSCONV8) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW6') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = CHI8 - PSI8 - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW6 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW5 -C *** CASE W5 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, NANO3, NH4NO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, -C MG(NO3)2, MGCL2 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW5 - INCLUDE 'isrpia.inc' -C - EXTERNAL CALCW1A, CALCW6 -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (WAER(4).GT.TINY) THEN ! NO3 EXIST, WATER POSSIBLE - SCASE = 'W5 ; SUBCASE 1' - CALL CALCW5A - SCASE = 'W5 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'W1 ; SUBCASE 1' - CALL CALCW1A - SCASE = 'W1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP5) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCW1A - SCASE = 'W5 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'W5 ; SUBCASE 3' ! MDRH REGION (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP5, DRNH4NO3, CALCW1A, CALCW6) - SCASE = 'W5 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCW5 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW5A -C *** CASE W5A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3 -C 4. Completely dissolved: CA(NO3)2, CACL2, MG(NO3)2, MGCL2 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW5A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7, PSCONV8 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. - PSCONV8 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT - PSI8O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO - ROOT8 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI8 = CNANO3 - CHI6 = CNH4NO3 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A8 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) - ROOT8 + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = (WAER(4)-ROOT8)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT8 - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*(WAER(1)-ROOT8) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A8) THEN - BB =-(WAER(4) - ROOT13 + WAER(1) - ROOT7) - CC = (WAER(4) - ROOT13)*(WAER(1)-ROOT7) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT8A = 0.5D0*(-BB-DD) - ROOT8B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT8A) THEN - ROOT8 = ROOT8A - ELSE - ROOT8 = ROOT8B - ENDIF - ROOT8 = MIN(MAX(ROOT8, ZERO), CHI8) - PSI8 = CHI8-ROOT8 - ENDIF - PSCONV8 = ABS(PSI8-PSI8O) .LE. EPS*PSI8O - PSI8O = PSI8 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13 - ROOT8, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7 - ROOT8, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7 .AND. PSCONV8) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW5') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = CHI8 - PSI8 - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW5 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW4 -C *** CASE W4 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW4 - INCLUDE 'isrpia.inc' - EXTERNAL CALCW1A, CALCW5A -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C - IF (WAER(4).GT.TINY) THEN ! NO3 EXIST, WATER POSSIBLE - SCASE = 'W4 ; SUBCASE 1' - CALL CALCW4A - SCASE = 'W4 ; SUBCASE 1' - ELSE ! NO3, CL NON EXISTANT - SCASE = 'W1 ; SUBCASE 1' - CALL CALCW1A - SCASE = 'W1 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP4) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCW1A - SCASE = 'W4 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'W4 ; SUBCASE 3' ! MDRH REGION (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP4, DRMGNO32, CALCW1A, CALCW5A) - SCASE = 'W4 ; SUBCASE 3' - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCW4 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW4A -C *** CASE W4A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, MG(NO3)2 -C 4. Completely dissolved: CA(NO3)2, CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW4A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7, PSCONV8 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. - PSCONV8 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT - PSI8O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO - ROOT8 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI8 = CNANO3 - CHI6 = CNH4NO3 - CHI15 = CMGNO32 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A8 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) - ROOT8 + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = (WAER(4)-ROOT8)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT8 - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*(WAER(1)-ROOT8) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A8) THEN - BB =-(WAER(4) - ROOT13 + WAER(1) - ROOT7) - CC = (WAER(4) - ROOT13)*(WAER(1)-ROOT7) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT8A = 0.5D0*(-BB-DD) - ROOT8B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT8A) THEN - ROOT8 = ROOT8A - ELSE - ROOT8 = ROOT8B - ENDIF - ROOT8 = MIN(MAX(ROOT8, ZERO), CHI8) - PSI8 = CHI8-ROOT8 - ENDIF - PSCONV8 = ABS(PSI8-PSI8O) .LE. EPS*PSI8O - PSI8O = PSI8 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13 - ROOT8, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7 - ROOT8, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7 .AND. PSCONV8) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW4') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = CHI8 - PSI8 - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW4A ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW3 -C *** CASE W3 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW3 - INCLUDE 'isrpia.inc' - EXTERNAL CALCW1A, CALCW4A -C -C *** REGIME DEPENDS ON THE EXISTANCE OF WATER AND OF THE RH ************ -C -C IF (WAER(4).GT.TINY .AND. WAER(5).GT.TINY) THEN ! NO3,CL EXIST, WATER POSSIBLE -C SCASE = 'W3 ; SUBCASE 1' -C CALL CALCW3A -C SCASE = 'W3 ; SUBCASE 1' -C ELSE ! NO3, CL NON EXISTANT -C SCASE = 'W1 ; SUBCASE 1' -C CALL CALCW1A -C SCASE = 'W1 ; SUBCASE 1' -C ENDIF -C - CALL CALCW1A - - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP3) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCW1A - SCASE = 'W3 ; SUBCASE 2' - RETURN - ELSE - SCASE = 'W3 ; SUBCASE 3' ! MDRH REGION (CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP3, DRCANO32, CALCW1A, CALCW4A) - SCASE = 'W3 ; SUBCASE 3' - ENDIF - ELSE ! NO3, CL NON EXISTANT - SCASE = 'W3 ; SUBCASE 1' - CALL CALCW3A - SCASE = 'W3 ; SUBCASE 1' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCW3 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW3A -C *** CASE W3A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, CA(NO3)2, MG(NO3)2 -C 4. Completely dissolved: CACL2, MGCL2 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW3A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7, PSCONV8 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. - PSCONV8 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT - PSI8O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO - ROOT8 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI8 = CNANO3 - CHI6 = CNH4NO3 - CHI15 = CMGNO32 - CHI12 = CCANO32 - CHI11 = CCASO4 -CC - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A8 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) - ROOT8 + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = (WAER(4)-ROOT8)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, ZERO)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT8 - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*(WAER(1)-ROOT8) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A8) THEN - BB =-(WAER(4) - ROOT13 + WAER(1) - ROOT7) - CC = (WAER(4) - ROOT13)*(WAER(1)-ROOT7) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT8A = 0.5D0*(-BB-DD) - ROOT8B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT8A) THEN - ROOT8 = ROOT8A - ELSE - ROOT8 = ROOT8B - ENDIF - ROOT8 = MIN(MAX(ROOT8, ZERO), CHI8) - PSI8 = CHI8-ROOT8 - ENDIF - PSCONV8 = ABS(PSI8-PSI8O) .LE. EPS*PSI8O - PSI8O = PSI8 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13 - ROOT8, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7 - ROOT8, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7 .AND. PSCONV8) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW3') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = CHI8 - PSI8 - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW3A ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW2 -C *** CASE W2 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C THERE ARE THREE REGIMES IN THIS CASE: -C 1. CACL2(s) POSSIBLE. LIQUID & SOLID AEROSOL (SUBROUTINE CALCL2A) -C 2. CACL2(s) NOT POSSIBLE, AND RH < MDRH. SOLID AEROSOL ONLY -C 3. CACL2(s) NOT POSSIBLE, AND RH >= MDRH. SOLID & LIQUID AEROSOL -C -C REGIMES 2. AND 3. ARE CONSIDERED TO BE THE SAME AS CASES W1A, W2B -C RESPECTIVELY -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C -C - SUBROUTINE CALCW2 - INCLUDE 'isrpia.inc' - EXTERNAL CALCW1A, CALCW3A, CALCW4A, CALCW5A, CALCW6 -C -C *** FIND DRY COMPOSITION ********************************************** -C - CALL CALCW1A -C -C *** REGIME DEPENDS UPON THE POSSIBLE SOLIDS & RH ********************** -C - IF (CCACL2.GT.TINY) THEN - SCASE = 'W2 ; SUBCASE 1' - CALL CALCW2A - SCASE = 'W2 ; SUBCASE 1' - ENDIF -C - IF (WATER.LE.TINY) THEN - IF (RH.LT.DRMP2) THEN ! ONLY SOLIDS - WATER = TINY - DO 10 I=1,NIONS - MOLAL(I) = ZERO -10 CONTINUE - CALL CALCW1A - SCASE = 'W2 ; SUBCASE 2' - ELSE - IF (CMGCL2.GT. TINY) THEN - SCASE = 'W2 ; SUBCASE 3' ! MDRH (CaSO4, CA(NO3)2, K2SO4, KNO3, KCL, MGSO4, MGCL2, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP2, DRMGCL2, CALCW1A, CALCW3A) - SCASE = 'W2 ; SUBCASE 3' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP3 .AND. RH.LT.DRMP4) THEN - SCASE = 'W2 ; SUBCASE 4' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, CANO32, -C MG(NO3)2, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP3, DRCANO32, CALCW1A, CALCW4A) - SCASE = 'W2 ; SUBCASE 4' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP4 .AND. RH.LT.DRMP5) THEN - SCASE = 'W2 ; SUBCASE 5' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C MGNO32, NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP4, DRMGNO32, CALCW1A, CALCW5A) - SCASE = 'W2 ; SUBCASE 5' - ENDIF - IF (WATER.LE.TINY .AND. RH.GE.DRMP5) THEN - SCASE = 'W2 ; SUBCASE 6' ! MDRH (CaSO4, K2SO4, KNO3, KCL, MGSO4, -C NANO3, NACL, NH4NO3, NH4CL) - CALL CALCMDRPII (RH, DRMP5, DRNH4NO3, CALCW1A, CALCW6) - SCASE = 'W2 ; SUBCASE 6' - ELSE - WATER = TINY - DO 20 I=1,NIONS - MOLAL(I) = ZERO -20 CONTINUE - CALL CALCW1A - SCASE = 'W2 ; SUBCASE 2' - ENDIF - ENDIF - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCW2 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW2A -C *** CASE W2A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. THERE IS BOTH A LIQUID & SOLID PHASE -C 3. SOLIDS POSSIBLE : CaSO4, K2SO4, KNO3, MGSO4, KCL, NH4CL, NACL, -C NANO3, NH4NO3, CA(NO3)2, MG(NO3)2, MGCL2 -C 4. Completely dissolved: CACL2 -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW2A - INCLUDE 'isrpia.inc' -C - LOGICAL PSCONV9, PSCONV13, PSCONV14, PSCONV5, PSCONV7, PSCONV8 - DOUBLE PRECISION NH4I, NAI, NO3I, NH3AQ, NO3AQ, CLAQ, CAI, KI, MGI -C - COMMON /SOLUT/ CHI1, CHI2, CHI3, CHI4, CHI5, CHI6, CHI7, CHI8, - & CHI9, CHI10, CHI11, CHI12, CHI13, CHI14, CHI15, - & CHI16, CHI17, PSI1, PSI2, PSI3, PSI4, PSI5, PSI6, - & PSI7, PSI8, PSI9, PSI10, PSI11, PSI12, PSI13, - & PSI14, PSI15, PSI16, PSI17, A1, A2, A3, A4, A5, A6, - & A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17 -C -C *** SETUP PARAMETERS ************************************************ -C - FRST =.TRUE. - CALAIN =.TRUE. - CALAOU =.TRUE. -C - PSCONV9 =.TRUE. - PSCONV13=.TRUE. - PSCONV14=.TRUE. - PSCONV5 =.TRUE. - PSCONV7 =.TRUE. - PSCONV8 =.TRUE. -C - PSI9O =-GREAT - PSI13O =-GREAT - PSI14O =-GREAT - PSI5O =-GREAT - PSI7O =-GREAT - PSI8O =-GREAT ! GREAT = 1.D10 -C - ROOT9 = ZERO - ROOT13 = ZERO - ROOT14 = ZERO - ROOT5 = ZERO - ROOT7 = ZERO - ROOT8 = ZERO -C -C *** CALCULATE INITIAL SOLUTION *************************************** -C - CALL CALCW1A -C - CHI9 = CK2SO4 ! SALTS - CHI13 = CKNO3 - CHI10 = CMGSO4 - CHI14 = CKCL - CHI5 = CNH4CL - CHI7 = CNACL - CHI8 = CNANO3 - CHI6 = CNH4NO3 - CHI15 = CMGNO32 - CHI12 = CCANO32 - CHI16 = CMGCL2 - CHI11 = CCASO4 -C - PSI1 = CNA2SO4 ! SALTS DISSOLVED - PSI5 = CNH4CL - PSI6 = CNH4NO3 - PSI7 = CNACL - PSI8 = CNANO3 - PSI9 = CK2SO4 - PSI10 = CMGSO4 - PSI11 = CCASO4 - PSI12 = CCANO32 - PSI13 = CKNO3 - PSI14 = CKCL - PSI15 = CMGNO32 - PSI16 = CMGCL2 - PSI17 = CCACL2 -C - CALL CALCMR ! WATER -C - NAI = WAER(1) ! LIQUID CONCENTRATIONS - SO4I = MAX (WAER(2) - WAER(6), ZERO) - NH4I = WAER(3) - NO3I = WAER(4) - CLI = WAER(5) - CAI = WAER(6) - KI = WAER(7) - MGI = WAER(8) -C - HSO4I = ZERO - NH3AQ = ZERO - NO3AQ = ZERO - CLAQ = ZERO -C -C *** SOLVE EQUATIONS ; WITH ITERATIONS FOR ACTIVITY COEF. ************ -C - DO 10 I=1,NSWEEP -C - A9 = XK17 *(WATER/GAMA(17))**3.0 ! K2SO4 <==> K+ - A13 = XK19 *(WATER/GAMA(19))**2.0 ! KNO3 <==> K+ - A14 = XK20 *(WATER/GAMA(20))**2.0 ! KCL <==> K+ - A5 = XK14*(WATER/GAMA(6))**2.0 ! NH4Cl <==> NH4+ - A7 = XK8 *(WATER/GAMA(1))**2.0 ! NaCl <==> Na+ - A8 = XK9 *(WATER/GAMA(3))**2. ! NaNO3 <==> Na+ - AKW = XKW*RH*WATER*WATER ! H2O <==> H+ -C -C POTASSIUM SULFATE -C - IF (KI*KI*SO4I .GT. A9) THEN - BB =-((WAER(2)-WAER(6)) + WAER(7) - ROOT13 - ROOT14) - CC = (WAER(7)-ROOT13-ROOT14)*(WAER(2)-WAER(6)) + - & 0.25D0*(WAER(7)-ROOT13-ROOT14)**2.0 - DD =-0.25*((WAER(7)-ROOT13-ROOT14)**2.0*(WAER(2)-WAER(6)) - A9) - CALL POLY3(BB, CC, DD, ROOT9, ISLV) - IF (ISLV.NE.0) ROOT9 = TINY - ROOT9 = MIN (ROOT9, WAER(7)/2.0-ROOT13-ROOT14, - & (WAER(2)-WAER(6)), CHI9) - ROOT9 = MAX (ROOT9, ZERO) - PSI9 = CHI9 - ROOT9 - ENDIF - PSCONV9 = ABS(PSI9-PSI9O) .LE. EPS*PSI9O - PSI9O = PSI9 -C -C POTASSIUM NITRATE -C - IF (KI*NO3I .GT. A13) THEN - BB =-(WAER(4) - ROOT8 + WAER(7) - 2.D0*ROOT9 - ROOT14) - CC = (WAER(4)-ROOT8)*(WAER(7) - 2.D0*ROOT9 - ROOT14) - A13 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT13A= 0.5D0*(-BB-DD) - ROOT13B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT13A) THEN - ROOT13 = ROOT13A - ELSE - ROOT13 = ROOT13B - ENDIF - ROOT13 = MIN(MAX(ROOT13, ZERO), CHI13) - PSI13 = CHI13-ROOT13 - ENDIF - PSCONV13 = ABS(PSI13-PSI13O) .LE. EPS*PSI13O - PSI13O = PSI13 -C -C POTASSIUM CLORIDE -C - IF (KI*CLI .GT. A14) THEN - BB =-(WAER(5)-ROOT5-ROOT7 + WAER(7)-2.D0*ROOT9-ROOT13) - CC = (WAER(5)-ROOT5-ROOT7)*(WAER(7)-2.D0*ROOT9-ROOT13)-A14 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT14A= 0.5D0*(-BB-DD) - ROOT14B= 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT14A) THEN - ROOT14 = ROOT14A - ELSE - ROOT14 = ROOT14B - ENDIF - ROOT14 = MIN(MAX(ROOT14, ZERO), CHI14) - PSI14 = CHI14-ROOT14 - ENDIF - PSCONV14 = ABS(PSI14-PSI14O) .LE. EPS*PSI14O - PSI14O = PSI14 -C -C AMMONIUM CLORIDE -C - IF (NH4I*CLI .GT. A5) THEN - BB =-(WAER(5) + WAER(3) - ROOT14 - ROOT7) - CC = (WAER(5) - ROOT14 - ROOT7)*WAER(3) - A5 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT5A = 0.5D0*(-BB-DD) - ROOT5B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT5A) THEN - ROOT5 = ROOT5A - ELSE - ROOT5 = ROOT5B - ENDIF - ROOT5 = MIN(MAX(ROOT5, ZERO), CHI5) - PSI5 = CHI5-ROOT5 - ENDIF - PSCONV5 = ABS(PSI5-PSI5O) .LE. EPS*PSI5O - PSI5O = PSI5 -C -C SODIUM CLORIDE -C - IF (NAI*CLI .GT. A7) THEN - BB =-(WAER(5) + WAER(1) - ROOT8 - ROOT14 - ROOT5) - CC = (WAER(5) - ROOT14 - ROOT5)*(WAER(1)-ROOT8) - A7 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT7A = 0.5D0*(-BB-DD) - ROOT7B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT7A) THEN - ROOT7 = ROOT7A - ELSE - ROOT7 = ROOT7B - ENDIF - ROOT7 = MIN(MAX(ROOT7, ZERO), CHI7) - PSI7 = CHI7-ROOT7 - ENDIF - PSCONV7 = ABS(PSI7-PSI7O) .LE. EPS*PSI7O - PSI7O = PSI7 -C -C SODIUM NITRATE -C - IF (NAI*NO3I .GT. A8) THEN - BB =-(WAER(4) - ROOT13 + WAER(1) - ROOT7) - CC = (WAER(4) - ROOT13)*(WAER(1)-ROOT7) - A8 - DD = SQRT(MAX(BB*BB - 4.D0*CC, TINY)) - ROOT8A = 0.5D0*(-BB-DD) - ROOT8B = 0.5D0*(-BB+DD) - IF (ZERO.LE.ROOT8A) THEN - ROOT8 = ROOT8A - ELSE - ROOT8 = ROOT8B - ENDIF - ROOT8 = MIN(MAX(ROOT8, ZERO), CHI8) - PSI8 = CHI8-ROOT8 - ENDIF - PSCONV8 = ABS(PSI8-PSI8O) .LE. EPS*PSI8O - PSI8O = PSI8 -C -C ION CONCENTRATIONS ; CORRECTIONS -C - KI = MAX (WAER(7) - 2.D0*ROOT9 - ROOT13 - ROOT14, ZERO) - SO4I = MAX (WAER(2)-WAER(6) - ROOT9, ZERO) - NH4I = MAX (WAER(3) - ROOT5, ZERO) - NO3I = MAX (WAER(4) - ROOT13 - ROOT8, ZERO) - CLI = MAX (WAER(5) - ROOT14 - ROOT5 - ROOT7, ZERO) - CAI = ZERO - NAI = MAX (WAER(1) - ROOT7 - ROOT8, ZERO) - MGI = WAER(8) -C -C SOLUTION ACIDIC OR BASIC? -C - GG = 2.D0*SO4I + NO3I + CLI - NAI - NH4I - & - 2.D0*CAI - KI - 2.D0*MGI - IF (GG.GT.TINY) THEN ! H+ in excess - BB =-GG - CC =-AKW - DD = BB*BB - 4.D0*CC - HI = 0.5D0*(-BB + SQRT(DD)) - OHI= AKW/HI - ELSE ! OH- in excess - BB = GG - CC =-AKW - DD = BB*BB - 4.D0*CC - OHI= 0.5D0*(-BB + SQRT(DD)) - HI = AKW/OHI - ENDIF -C -C UNDISSOCIATED SPECIES EQUILIBRIA -C - IF (HI.GT.OHI) THEN -C CALL CALCAMAQ2 (-GG, NH4I, OHI, NH3AQ) -C HI = AKW/OHI -C HSO4I = ZERO -C ELSE -C GGNO3 = MAX(2.D0*SO4I + NO3I - NAI - NH4I - 2.D0*CAI -C & - KI - 2.D0*MGI, ZERO) -C GGCL = MAX(GG-GGNO3, ZERO) -C IF (GGCL .GT.TINY) CALL CALCCLAQ2 (GGCL, CLI, HI, CLAQ) ! HCl -C IF (GGNO3.GT.TINY) THEN -C IF (GGCL.LE.TINY) HI = ZERO -C CALL CALCNIAQ2 (GGNO3, NO3I, HI, NO3AQ) ! HNO3 -C ENDIF -C -C CONCENTRATION ADJUSTMENTS ; HSO4 minor species. -C - CALL CALCHS4 (HI, SO4I, ZERO, DEL) - else - del= zero - ENDIF - SO4I = SO4I - DEL - HI = HI - DEL - HSO4I = DEL -C IF (HI.LE.TINY) HI = SQRT(AKW) - OHI = AKW/HI -C - IF (HI.LE.TINY) THEN - HI = SQRT(AKW) - OHI = AKW/HI - ENDIF -C -C *** SAVE CONCENTRATIONS IN MOLAL ARRAY ****************************** -C - MOLAL(1) = HI - MOLAL(2) = NAI - MOLAL(3) = NH4I - MOLAL(4) = CLI - MOLAL(5) = SO4I - MOLAL(6) = HSO4I - MOLAL(7) = NO3I - MOLAL(8) = CAI - MOLAL(9) = KI - MOLAL(10)= MGI -C -C *** CALCULATE WATER ************************************************** -C - CALL CALCMR -C -C *** CALCULATE ACTIVITIES OR TERMINATE INTERNAL LOOP ***************** -C - IF (FRST.AND.CALAOU .OR. .NOT.FRST.AND.CALAIN) THEN - CALL CALCACT - ELSE - IF (PSCONV9 .AND. PSCONV13 .AND. PSCONV14 .AND. PSCONV5 - & .AND. PSCONV7 .AND. PSCONV8) GOTO 20 - ENDIF -10 CONTINUE -ccc CALL PUSHERR (0002, 'CALCW2') ! WARNING ERROR: NO CONVERGENCE -C -C *** CALCULATE GAS / SOLID SPECIES (LIQUID IN MOLAL ALREADY) ********* -C -20 A2 = (XK2/XKW)*R*TEMP*(GAMA(10)/GAMA(5))**2. ! NH3 <==> NH4+ - A3 = XK4 *R*TEMP*(WATER/GAMA(10))**2. ! HNO3 <==> NO3- - A4 = XK3 *R*TEMP*(WATER/GAMA(11))**2. ! HCL <==> CL- -C - GNH3 = NH4I/HI/A2 - GHNO3 = HI*NO3I/A3 - GHCL = HI*CLI /A4 -C - GASAQ(1)= NH3AQ - GASAQ(2)= CLAQ - GASAQ(3)= NO3AQ -C - CNH42S4 = ZERO - CNH4NO3 = ZERO - CNH4CL = CHI5 - PSI5 - CNACL = CHI7 - PSI7 - CNANO3 = CHI8 - PSI8 - CMGSO4 = ZERO - CK2SO4 = CHI9 - PSI9 - CCASO4 = MIN (WAER(6), WAER(2)) - CCANO32 = ZERO - CKNO3 = CHI13 - PSI13 - KCL = CHI14 - PSI14 - CMGNO32 = ZERO - CMGCL2 = ZERO - CCACL2 = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW2A ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW1 -C *** CASE W1 -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C THERE ARE TWO POSSIBLE REGIMES HERE, DEPENDING ON RELATIVE HUMIDITY: -C 1. WHEN RH >= MDRH ; LIQUID PHASE POSSIBLE (MDRH REGION) -C 2. WHEN RH < MDRH ; ONLY SOLID PHASE POSSIBLE (SUBROUTINE CALCP1A) -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS & ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW1 - INCLUDE 'isrpia.inc' - EXTERNAL CALCW1A, CALCW2A -C -C *** REGIME DEPENDS UPON THE AMBIENT RELATIVE HUMIDITY ***************** -C - IF (RH.LT.DRMP1) THEN - SCASE = 'W1 ; SUBCASE 1' - CALL CALCW1A ! SOLID PHASE ONLY POSSIBLE - SCASE = 'W1 ; SUBCASE 1' - ELSE - SCASE = 'W1 ; SUBCASE 2' ! LIQUID & SOLID PHASE POSSIBLE - CALL CALCMDRPII (RH, DRMP1, DRCACL2, CALCW1A, CALCW2A) - SCASE = 'W1 ; SUBCASE 2' - ENDIF -C - RETURN -C -C *** END OF SUBROUTINE CALCW1 ****************************************** -C - END -C -C======================================================================= -C -C *** ISORROPIA CODE II -C *** SUBROUTINE CALCW1A -C *** CASE W1A -C -C THE MAIN CHARACTERISTICS OF THIS REGIME ARE: -C 1. SULFATE POOR (SULRAT > 2.0) ; Rcr+Na >= 2.0 ; Rcr > 2) -C 2. SOLID AEROSOL ONLY -C 3. SOLIDS POSSIBLE : CaSO4, CA(NO3)2, CACL2, K2SO4, KNO3, KCL, MGSO4, -C MG(NO3)2, MGCL2, NANO3, NACL, NH4NO3, NH4CL -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY CHRISTOS FOUNTOUKIS AND ATHANASIOS NENES -C -C======================================================================= -C - SUBROUTINE CALCW1A - INCLUDE 'isrpia.inc' -C -C *** CALCULATE SOLIDS ************************************************** -C - CCASO4 = MIN (WAER(2), WAER(6)) !SOLID CASO4 - CAFR = MAX (WAER(6) - CCASO4, ZERO) - SO4FR = MAX (WAER(2) - CCASO4, ZERO) - CK2SO4 = MIN (SO4FR, 0.5D0*WAER(7)) !SOLID K2SO4 - FRK = MAX (WAER(7) - 2.D0*CK2SO4, ZERO) - SO4FR = MAX (SO4FR - CK2SO4, ZERO) - CMGSO4 = SO4FR !SOLID MGSO4 - FRMG = MAX (WAER(8) - CMGSO4, ZERO) - CNACL = MIN (WAER(1), WAER(5)) !SOLID NACL - FRNA = MAX (WAER(1) - CNACL, ZERO) - CLFR = MAX (WAER(5) - CNACL, ZERO) - CCACL2 = MIN (CAFR, 0.5D0*CLFR) !SOLID CACL2 - CAFR = MAX (CAFR - CCACL2, ZERO) - CLFR = MAX (WAER(5) - 2.D0*CCACL2, ZERO) - CCANO32 = MIN (CAFR, 0.5D0*WAER(4)) !SOLID CA(NO3)2 - CAFR = MAX (CAFR - CCANO32, ZERO) - FRNO3 = MAX (WAER(4) - 2.D0*CCANO32, ZERO) - CMGCL2 = MIN (FRMG, 0.5D0*CLFR) !SOLID MGCL2 - FRMG = MAX (FRMG - CMGCL2, ZERO) - CLFR = MAX (CLFR - 2.D0*CMGCL2, ZERO) - CMGNO32 = MIN (FRMG, 0.5D0*FRNO3) !SOLID MG(NO3)2 - FRMG = MAX (FRMG - CMGNO32, ZERO) - FRNO3 = MAX (FRNO3 - 2.D0*CMGNO32, ZERO) - CNANO3 = MIN (FRNA, FRNO3) !SOLID NANO3 - FRNA = MAX (FRNA - CNANO3, ZERO) - FRNO3 = MAX (FRNO3 - CNANO3, ZERO) - CKCL = MIN (FRK, CLFR) !SOLID KCL - FRK = MAX (FRK - CKCL, ZERO) - CLFR = MAX (CLFR - CKCL, ZERO) - CKNO3 = MIN (FRK, FRNO3) !SOLID KNO3 - FRK = MAX (FRK - CKNO3, ZERO) - FRNO3 = MAX (FRNO3 - CKNO3, ZERO) -C -C *** OTHER PHASES ****************************************************** -C - WATER = ZERO -C - GNH3 = ZERO - GHNO3 = ZERO - GHCL = ZERO -C - RETURN -C -C *** END OF SUBROUTINE CALCW1A ***************************************** -C - END diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_matrix.F b/MATRIXchem_GridComp/microphysics/TRAMP_matrix.F deleted file mode 100644 index 84d4745b..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_matrix.F +++ /dev/null @@ -1,1330 +0,0 @@ - SUBROUTINE MATRIX(AERO,GAS,EMIS_MASS,TSTEP,TK,RH,PRES,AQSO4RATE,WUPDRAFT,DIAG) -!----------------------------------------------------------------------------------------------------------------------- -! -!@sum This is the top-level routine of the MATRIX aerosol microphysical module. -!@auth Susanne Bauer/Doug Wright -! -! Here are some items to be familiar with in setting up the call to MATRIX. -! -! 1. The GAS array: -! -! GAS(1) contains the current H2SO4(g) concentration expressed as -! ug SO4=/m^3, including the H2SO4(g) produced by gas-phase chemistry -! during the current time step. -! -! GAS(2) contains the current HNO3(g) concentration expressed as -! ug NO3-/m^3, including the HNO3(g) produced by gas-phase chemistry -! during the current time step. -! -! GAS(3) contains the current NH3(g) concentration expressed as -! ug NH4+/m^3. Any sources of NH3(g) during the time step should -! probably be added in before the call to MATRIX. -! -! 2. H2SO4 is always represented as SO4= (MW=96g/mol) rather than -! H2SO4 (MW=98g/mol) (except in the calculation of the mean thermal -! velocity of an H2SO4 molecule). Likewise, HNO3 is always -! represented as NO3- and NH3 as NH4+. -! -! 3. In this model, sea salt contains NaCl and potentially non-sea salt -! sulfate, nitrate, ammonium, and water, depending upon conditions. -! The model sea salt species MASS_SSA_SEAS (accumulation mode), -! MASS_SSC_SEAS (coarse mode), and MASS_MXX_SEAS (sea salt in -! a mixed mode) do not include the non-sea salt sulfate, nitrate, -! ammonium, and water, are treated as pure NaCl, and the density -! and MW of NaCl are used with these species. -! -! 4. EMIS_MASS(J) contains the mass emissions rates for species J. -! The species and units are: -! -! J SPECIES UNITS -! ----- ----------------------------- ------------------ -! 1 Aitken-mode sulfate [ug SO4 /m^3/s] -! 2 accumulation-mode sulfate [ug SO4 /m^3/s] -! 3 black carbon [ug BC /m^3/s] -! 4 organic carbon [ug OC /m^3/s] -! 5 mineral dust - size 1 [ug DUST/m^3/s] -! 6 accumulation-mode sea salt [ug NaCl/m^3/s] -! 7 coarse-mode sea salt [ug NaCl/m^3/s] -! 8 BC in the mixed BC-OC mode [ug BC /m^3/s] -! 9 OC in the mixed BC-OC mode [ug OC /m^3/s] -! 10 mineral dust - size 2 [ug DUST/m^3/s] -! -!----------------------------------------------------------------------------------------------------------------------- - USE AERO_CONFIG - USE AERO_SETUP ! Module AERO_SETUP uses module AERO_PARAM, so the statement USE AERO_PARAM is not needed here. - USE AERO_SUBS - USE AERO_COAG, ONLY: SETUP_KIJ_DIAMETERS, SETUP_KIJ_TABLES, GET_KBARNIJ - USE AERO_NPF, ONLY: DNU, NPFRATE, SETUP_NPFMASS, STEADY_STATE_H2SO4 - USE AERO_DIAM, ONLY: DIAM, DIAM_HISTOGRAM - USE AERO_ACTV, ONLY: GETACTFRAC - USE AMP_AEROSOL, ONLY: NACTV,CCNSS - USE AERO_DEPV, ONLY: GET_AERO_DEPV, VDDEP_AERO - IMPLICIT NONE - - ! Arguments. - - REAL(8), INTENT(INOUT) :: AERO(NAEROBOX) ! aerosol conc. [ug/m^3] or [#/m^3] - REAL(8), INTENT(INOUT) :: GAS(NGASES) ! gas-phase conc. [ug/m^3] - REAL(8), INTENT(INOUT) :: EMIS_MASS(NEMIS_SPCS) ! mass emission rates [ug/m^3/s] - REAL(8), INTENT(IN) :: TSTEP ! model physics time step [s] - REAL(8), INTENT(IN) :: TK ! absolute temperature [K] - REAL(8), INTENT(IN) :: RH ! relative humidity [0-1] - REAL(8), INTENT(IN) :: PRES ! ambient pressure [Pa] - REAL(8), INTENT(IN) :: AQSO4RATE ! in-cloud SO4 production rate [ug/m^3/s] - REAL(8), INTENT(IN) :: WUPDRAFT ! cloud updraft velocity [m/s] - REAL(8), INTENT(INOUT) :: DIAG(NDIAG_AERO,NAEROBOX) ! budget or tendency diagnostics [ug/m^3/s] or [#/m^3/s] - - ! Local variables. - - INTEGER :: I,J,K,L,Q,QQ ! indices - INTEGER :: INDEX_DP, INDEX_DP_DRY ! index for condensation factor lookup table - INTEGER :: IBRANCH ! scratch debugging variable [1] - REAL(8) :: BI(NWEIGHTS) ! number conc. coefficients [1/s] - REAL(8) :: CI(NWEIGHTS) ! number conc. coefficients [#/m^3/s] - REAL(8) :: RI(NWEIGHTS) ! number conc. coefficients [#/m^3/s] - REAL(8) :: NI(NWEIGHTS) ! number concentrations [#/m^3] - REAL(8) :: MJQ(NWEIGHTS,NMASS_SPCS) ! MJQ(J,Q) is the avg. mass/particle of species Q (=1-5) for mode J - REAL(8) :: PIQ(NWEIGHTS,NMASS_SPCS) ! production terms for mass conc. [ug/m^3/s] - REAL(8) :: FI(NWEIGHTS) ! loss coefficients for mass conc. [1/s] - REAL(8) :: TOT_SULF ! total sulfate conc. [ug/m^3] - REAL(8) :: TOT_DUST ! total dust conc. [ug/m^3] - REAL(8) :: TOT_SEAS ! total sea salt conc. [ug/m^3] - REAL(8) :: SSH2O ! total sea salt H2O [ug/m^3] - REAL(8) :: SSH2O_PER_SSMASS ! total sea salt H2O / total sea-salt dry mass - REAL(8) :: FTMP, VOLTMP, VOLTMP_DRY ! scratch variables for computing mode mean diameters - REAL(8) :: TOT_MASS (NMODES) ! total ambient mass conc. for each mode [ug/m^3] - REAL(8) :: TOT_MASS_DRY(NMODES) ! total dry mass conc. for each mode [ug/m^3] - REAL(8) :: H2O_MASS(NMODES) ! water mass mass conc. for each mode [ug/m^3] - REAL(8) :: MASS_COMP(NMODES,8) ! mass conc. of each component for each mode [ug/m^3] - REAL(8) :: DENS_MODE (NMODES) ! average mode density calculated from component concentrations [g/cm^3] - REAL(8) :: DENS_MODE_DRY(NMODES) ! average mode density calculated from component concentrations [g/cm^3] - REAL(8) :: OPTOT_NO3NH4H2O_TO_SULF ! 1 + ( total NO3+NH4+H2O / total SO4 ) - REAL(8) :: AERO_WATER_ACTUAL ! actual aerosol H2O conc. [ug/m^3] - REAL(8) :: AERO_WATER_WET ! wet aerosol H2O conc. [ug/m^3] - REAL(8) :: RHD ! deliquescence RH [0-1] - REAL(8) :: RHC ! crystallization RH [0-1] - REAL(8) :: DGN(NWEIGHTS) ! ambient geometric mean diameter of the number distribution for each mode [m] - REAL(8) :: DGN_DRY(NWEIGHTS) ! geometric mean dry diameter of the number distribution for each mode [m] - REAL(8) :: DP(NWEIGHTS) ! ambient diameter of average mass of the number distribution for each mode [m] - REAL(8) :: DP_DRY(NWEIGHTS) ! dry diameter of average mass of the number distribution for each mode [m] - REAL(8) :: P_EMIS_NUMB(NMODES) ! number emission rates [#/m^3/s] - REAL(8) :: SPCMASS1(NMASS_SPCS+2) ! initial total mass conc. of each model species [ug/m^3] - REAL(8) :: SPCMASS2(NMASS_SPCS+2) ! final total mass conc. of each model species [ug/m^3] - REAL(8) :: FSEASSULF ! fraction of sulfate assigned to sea salt in mode SSC (coarse mode) - REAL(8) :: FACTOR ! scratch variable in mass conc. equation solver - REAL(8) :: Y0,Y,A,B,C,DELTA,R1,R2 ! scratch variables in the number concentration analytic solution - REAL(8) :: GAMMA,GEXPDT,EXPDT ! scratch variables in the number concentration analytic solution - REAL(8), PARAMETER :: PIQ_THRESH = 1.0D-08 ! [1] threshold in number/mass conc. solver - - ! For the condensational sink, condensational growth, and cou. - - REAL(8) :: KC ! total condensational sink with arbitrary mass accommodation coef. [1/s] - REAL(8) :: KC_AEQ1 ! total condensational sink with unity mass accommodation coef. [1/s] - REAL(8) :: PQ_GROWTH ! avg. cond. rate of H2SO4 (as SO4) over the time step [ugSO4/m^3/s] - REAL(8) :: TOT_H2SO4_LOSS ! net loss of H2SO4 (as SO4) [ugSO4/m^3] - !---------------------------------------------------------------------------------------------------------------- - ! This minimum value for the condensational sink, 1.0D-08 [1/s], is calculated as - ! - ! KC = 2 * PI * D * Beta * Dpbar * N = 2 * 3.14 * (1.0D-05 m^2/s) * (1) * (1.0D-07 m) * (1.0D+04 #/m^3) - ! = 6.28D-08 1/s --> 1.0D-08 1/s - !---------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: KCMIN = 1.0D-08 ! [1/s] minimum condensational sink - see notes of 10-18-06 - - ! Mode-average coagulation coefficients. - - REAL(8), SAVE :: KBAR0IJ(NWEIGHTS,NWEIGHTS) ! mode-average coagulation coefficients [m^3/s] for number - REAL(8), SAVE :: KBAR3IJ(NWEIGHTS,NWEIGHTS) ! mode-average coagulation coefficients [m^3/s] for mass - - ! These variables are used in intermodal transfer. - - INTEGER, PARAMETER :: IMTR_EXP = 4 ! exponent for AKK --> ACC intermodal transfer - REAL(8) :: DPAKK ! diameter of average mass for mode AKK [m] - REAL(8) :: DPACC ! diameter of average mass for mode ACC [m] - REAL(8) :: FNUM ! fraction of AKK number transferred over the time step [1] - REAL(8) :: F3 ! fraction of AKK mass transferred over the time step [1] - REAL(8) :: XNUM, X3 ! error function complement arguments [1] - REAL(8) :: DGN_AKK_IMTR ! geo. mean diam. of the AKK mode number distribution [m] - REAL(8) :: DGN_ACC_IMTR ! geo. mean diam. of the ACC mode number distribution [m] - REAL(8) :: DEL_NUMB ! number conc. transferred from AKK to ACC [ #/m^3] - REAL(8) :: DEL_MASS ! mass conc. transferred from AKK to ACC [ug/m^3] - REAL(8), SAVE :: DPCUT_IMTR = 0.0D+00 ! fixed diameter for intermodal transfer [um] - REAL(8), SAVE :: XNUM_FACTOR = 0.0D+00 ! factor in XNUM expression [1] - REAL(8), SAVE :: X3_TERM = 0.0D+00 ! term in X3 expression [1] - REAL(8), SAVE :: LNSG_AKK = 0.0D+00 ! ln(SG_AKK) [1] - REAL(8), SAVE :: LNSG_ACC = 0.0D+00 ! ln(SG_ACC) [1] - REAL(8), PARAMETER :: DPAKK0 = DNU ! min. diameter of average mass for mode AKK [m] - REAL(8), PARAMETER :: FNUM_MAX = 0.5D+00 ! max. value of FNUM [1] - REAL(8), PARAMETER :: AKK_MINNUM_IMTR = 1.0D+06 ! min. AKK number conc. to enable IMTR [#/m^3] - - ! These variables and parameters are used in nucleation and new particle formation. - - integer :: klq - integer :: ikl - INTEGER :: IH2SO4_PATH ! index for branch in the [H2SO4] calc. for nucl and GR [1] - REAL(8) :: XH2SO4_SS ! steady-state H2SO4 (as SO4) conc. [ugSO4/m^3] - REAL(8) :: XH2SO4_SS_WNPF ! steady-state H2SO4 (as SO4) conc. including NPF [ugSO4/m^3] - REAL(8) :: XH2SO4_NUCL ! H2SO4 (as SO4) conc. used in nucleation and GR calculation [ugSO4/m^3] - REAL(8) :: XH2SO4_INIT ! H2SO4 at the top of the time step [ugSO4/m^3] - REAL(8) :: SO4RATE ! H2SO4(g) production rate in/as [ugSO4/m^3/s] - REAL(8) :: XNH3 ! ammonia concentration [ppmV] - REAL(8) :: DNDT ! number production rate [1/m^3/s] from npf - REAL(8) :: DMDT_SO4 ! SO4 mass product. rate [ugSO4/m^3/s] from npf - REAL(8), PARAMETER :: XH2SO4_NUCL_MIN_NCM3 = 1.00D+03 ! min. [H2SO4] to enter nucleation calculations [#/cm^3] - REAL(8), PARAMETER :: XH2SO4_NUCL_MIN = XH2SO4_NUCL_MIN_NCM3 * MW_SO4 * 1.0D+12 / AVO ! convert to [ugSO4/m^3] - REAL(8), PARAMETER :: XNTAU = 2.0D+00 ! number of time constants in the current time step - ! required to invoke the steady-state approx. [1] - ! These variables are used in aerosol activation. - - REAL(8) :: RSUM_ACTIV ! used in Pcloud_i,q terms - REAL(8) :: NSOL (NMODES) ! number concentration of soluble particles for each mode [#/m^3] - REAL(8) :: AC (NMODES) ! minimum dry radius to activate for each mode [um]. - REAL(8) :: FRACACTN(NMODES) ! activated fraction of number concentration for each mode [1] - REAL(8) :: FRACACTM(NMODES) ! activated fraction of mass concentration for each mode [1] - REAL(8) :: NACT (NMODES) ! activated number concentration for each mode [#/m^3] - REAL(8) :: CCN (NMODES,3) ! activated number concentration for each mode [#/m^3] - REAL(8) :: MACT (NMODES) ! activated mass concentration for each mode [ug/m^3] - REAL(8) :: MI5 (NMODES,NMASS_SPCS) ! mass conc. of each species for each mode [ug/m^3] - - ! These variables are used as default values in computing dry deposition velocities. - - REAL(8), PARAMETER :: TEMP_DDEP = 288.15D+00 ! temperature [ K ] - REAL(8), PARAMETER :: RHOA_DDEP = 1.225D+00 ! air density [ kg/m^3 ] - REAL(8), PARAMETER :: LAMB_DDEP = 6.6332D-08 ! mean free path of air [ m ] - REAL(8), PARAMETER :: DVIS_DDEP = 1.7894D-05 ! dynamic viscosity of air [ kg/(m s) ] - REAL(8), PARAMETER :: WSTR_DDEP = 1.0D+00 ! convective velocity scale [ m/s ] - REAL(8), PARAMETER :: USTR_DDEP = 0.5D+00 ! friction velocity [ m/s ] - REAL(8), PARAMETER :: RAER_DDEP = 5.0D+00 ! aerodynamic resistance [ s/m ] - LOGICAL, PARAMETER :: GET_DEP_VEL_ONLY = .FALSE. ! For early RETURN after getting dep. velocities - - ! These variables are used in computing the DIAG or DIAM_HISTOGRAM diagnostic arrays. - - REAL(8) :: DIAGTMP1(NDIAG_AERO,NAEROBOX) ! scratch work array [ug/m^3/s] or [#/m^3/s] - REAL(8) :: AEROTMP1(NAEROBOX) ! input aerosol concentrations [ug/m^3] or [#/m^3] - REAL(8) :: AEROTMP2(NAEROBOX) ! scratch aerosol concentrations [ug/m^3] or [#/m^3] - REAL(8) :: PIQTMP(NWEIGHTS,NMASS_SPCS) ! scratch work array for mass production terms [ug/m^3/s] - REAL(8), PARAMETER :: N_MIN_DIAM_HISTOGRAM = 1.0D+04 ! min. # conc. for count in DIAM_HISTOGRAM [#/m^3] - - LOGICAL, SAVE :: FIRSTIME = .TRUE. - - !---------------------------------------------------------------------------------------------------------------- - ! Error function statement function derived from code in CMAQ v4.4. - ! - ! The CMAQ source is Meng, Z., and J.H.Seinfeld (1994) On the source of the submicrometer droplet mode of - ! urban and regional aerosols. Aerosol Sci. and Technology, 20:253-265, who cite - ! Reasearch & Education Association (REA), (1991) Handbook of Mathematical, Scientific, - ! and Engineering Formulas, Tables, Functions, Graphs, Transforms: REA, Piscataway, NJ. p. 493. - !---------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: ERFCONST = -4.0D+00 / PI - REAL(8) :: XX, ERF, ERFC ! Error Function, Error Function Complement - ERF(XX) = SQRT(1.0D+00 - EXP( ERFCONST * XX * XX ) ) - ERFC(XX) = 1.0D+00 - ERF(XX) - -!---------------------------------------------------------------------------------------------------------------------- -! Begin execution. -!---------------------------------------------------------------------------------------------------------------------- - - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - CALL SETUP_CONFIG - CALL SETUP_SPECIES_MAPS - CALL SETUP_AERO_MASS_MAP - IF ( .NOT. NO_MICROPHYSICS ) THEN - CALL SETUP_COAG_TENSORS - CALL SETUP_DP0 - CALL SETUP_KIJ_DIAMETERS - CALL SETUP_KIJ_TABLES - IF( UPDATE_KIJ .EQ. 0 ) THEN - DGN(:) = DGN0(:) - DGN_DRY(:) = DGN0(:) - CALL GET_KBARNIJ(0,TK,PRES,DGN,KBAR0IJ,KBAR3IJ) - ENDIF - ENDIF - CALL SETUP_EMIS - CALL SETUP_KCI - CALL SETUP_NPFMASS - DP (:) = DP0(:) ! Set particle diameters to default values [m] - optionally overwritten below. - DP_DRY(:) = DP0(:) ! Set particle diameters to default values [m] - optionally overwritten below. - - ! These variables are used in intermodal transfer. - - IF( INTERMODAL_TRANSFER .AND. NUMB_AKK_1 .EQ. 0 ) THEN - WRITE(*,*)'INTERMODAL_TRANSFER must be set to .FALSE. for this mechanism.' - STOP - ENDIF - DPCUT_IMTR = SQRT( DG_AKK * DG_ACC ) ! This is the formula of Easter et al. 2004. (= 0.053 um) - LNSG_AKK = LOG( SG_AKK ) - LNSG_ACC = LOG( SG_ACC ) - XNUM_FACTOR = 1.0D+00 / ( SQRT( 2.0D+00 ) * LNSG_AKK ) - X3_TERM = 3.0D+00 * LNSG_AKK / SQRT( 2.0D+00 ) - IF( INTERMODAL_TRANSFER ) THEN - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A/)') 'INTERMODAL TRANSFER (AKK->ACC) IS TURNED ON.' - IF( WRITE_LOG ) WRITE(AUNIT1,'(A,5F12.6)')'DPCUT_IMTR, XNUM_FACTOR, X3_TERM, LNSG_AKK, LNSG_ACC = ', - & DPCUT_IMTR, XNUM_FACTOR, X3_TERM, LNSG_AKK, LNSG_ACC - ELSE - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A/)') 'INTERMODAL TRANSFER (AKK->ACC) IS TURNED OFF.' - ENDIF - - - ! Calculate and store dry deposition velocities for the entire X-Y grid. - - CALL GET_AERO_DEPV(NMODES,TEMP_DDEP,RHOA_DDEP,LAMB_DDEP,DVIS_DDEP, - & WSTR_DDEP,USTR_DDEP,RAER_DDEP,DGN0,LNSIG0,DENSPI) - DO I=1, NMODES ! Initialize entire X-Y grid. - VDDEP_AERO(:,:,I,1) = VDDEP_AERO(IXXX,IYYY,I,1) ! For deposition of number concentrations; [m/s]. - VDDEP_AERO(:,:,I,2) = VDDEP_AERO(IXXX,IYYY,I,2) ! For deposition of mass concentrations; [m/s]. - ENDDO - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! The mass-only, no-microphysics option. - ! Add in emissions, H2SO4(g), SO4(aq), and do gas-particle partitioning only. - !---------------------------------------------------------------------------------------------------------------- - IF( NO_MICROPHYSICS ) THEN - EMIS_MASS(:) = 0.0D+00 - CALL AERO_NOMICROPHYSICS(AERO,GAS,EMIS_MASS,TSTEP,TK,RH,PRES,AQSO4RATE) - RETURN - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Zero entire diagnostics array. - !---------------------------------------------------------------------------------------------------------------- - DIAGTMP1(:,:) = 0.0D+00 - AEROTMP1(:) = AERO(:) ! Input concentrations - - !---------------------------------------------------------------------------------------------------------------- - ! Get initial total mass conc. for each model species [ug/m^3]. - ! These are (optionally) used to enforce precise mass conservation. - !---------------------------------------------------------------------------------------------------------------- - IF( MASS_ADJ ) CALL SPCMASSES(AERO,GAS,SPCMASS1) - - !---------------------------------------------------------------------------------------------------------------- - ! Load the number concentrations [#/m^3] into the local work array. - !---------------------------------------------------------------------------------------------------------------- - NI(:) = AERO( NUMB_MAP(:) ) + TINYDENOM - - !---------------------------------------------------------------------------------------------------------------- - ! IF( WRITE_LOG ) THEN - ! WRITE(AUNIT1,'(/5A20/)') 'I','NI [#/m^3] - A' - ! DO I=1, NWEIGHTS - ! WRITE(AUNIT1,90004) I, NI(I) - ! ENDDO - ! ENDIF - !---------------------------------------------------------------------------------------------------------------- - - !---------------------------------------------------------------------------------------------------------------- - ! For the sea salt modes, use characteristic mean particle masses - ! to derive the number concentration from the mass concentration. - ! - ! There may be two sea salt modes, SSA and SSC, or just one, SSS. - ! - ! SEAS_MODE_MAP(I) is the mode number of sea salt mode I. - ! SEAS_MODE_MASS_MAP(I) is the location in AERO of the sea salt (NaCl) - ! mass concentration for sea salt mode I. - ! RECIP_SEAS_MPP(I) is the reciprocal of the mean NaCl mass - ! per sea salt particle for sea salt mode I. - !---------------------------------------------------------------------------------------------------------------- - NI(SEAS_MODE_MAP(:)) = AERO( SEAS_MODE_MASS_MAP(:) ) * RECIP_SEAS_MPP(:) - ! WRITE(*,*) NI(SEAS_MODE_MAP(:)) - - !---------------------------------------------------------------------------------------------------------------- - ! IF( WRITE_LOG ) THEN - ! WRITE(AUNIT1,'(/5A20/)') 'I','NI [#/m^3] - B' - ! DO I=1, NWEIGHTS - ! WRITE(AUNIT1,90004) I, NI(I) - ! ENDDO - ! ENDIF - !---------------------------------------------------------------------------------------------------------------- - - !---------------------------------------------------------------------------------------------------------------- - ! Partition the sea salt sulfate between the SSA and SSC modes, if both - ! of these modes are present. In this case, all sea salt sulfate is - ! passed to this routine in mass species MASS_SSA_SULF. - !---------------------------------------------------------------------------------------------------------------- - ! WRITE(*,*)'NUMBER_OF_SEASALT_MODES = ', NUMBER_OF_SEASALT_MODES - IF( NUMBER_OF_SEASALT_MODES .EQ. 2 ) THEN - FSEASSULF = AERO( MASS_SSC_SEAS ) / ( AERO( MASS_SSC_SEAS ) + AERO( MASS_SSA_SEAS ) + TINYDENOM ) - AERO( MASS_SSC_SULF ) = AERO( MASS_SSA_SULF ) * FSEASSULF - AERO( MASS_SSA_SULF ) = AERO( MASS_SSA_SULF ) * ( 1.0D+00 - FSEASSULF ) - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Get the total sulfate, total mineral dust, and total sea salt (NaCl) - ! mass concentrations summed over all quadrature points/modes. [ug/m^3] - !---------------------------------------------------------------------------------------------------------------- - TOT_SULF = SUM( AERO(SULF_MAP(:)) ) + TINYNUMER ! insure nonzero value - TOT_DUST = SUM( AERO(DUST_MAP(:)) ) - TOT_SEAS = SUM( AERO(SEAS_MAP(:)) ) + TINYNUMER ! insure nonzero value - - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A,F12.4/)') 'TOT_SULF = ', TOT_SULF - - - !---------------------------------------------------------------------------------------------------------------- - ! Call the aerosol thermodynamic module to determine the bulk gas-particle - ! partitioning of the inorganic species and the water content - ! associated with those species. Also determine the water content - ! associated with the NaCl of sea salt. - ! - ! Note that AERO(MASS_H2O) includes the sea-salt associated water - ! when it is passed to this routine and passed to AERO_THERMO. - ! Upon return from AERO_THERMO, AERO(MASS_H2O) contains only the - ! non-sea salt-associated water. The sea salt-associated water is in SSH2O. - !---------------------------------------------------------------------------------------------------------------- - AERO_WATER_ACTUAL = AERO(MASS_H2O) ! actual tracked aerosol water conc. - CALL AERO_THERMO(TOT_SULF,AERO(MASS_NO3),AERO(MASS_NH4),AERO(MASS_H2O),GAS(GAS_NH3), - & GAS(GAS_HNO3),TOT_DUST,TOT_SEAS,SSH2O,TK,RH,PRES,RHD,RHC) - AERO_WATER_WET = AERO(MASS_H2O) + SSH2O ! total metastable aerosol water conc. - - !---------------------------------------------------------------------------------------------------------------- - ! Adjust the aerosol water concentration for hysteresis. - ! - ! If the aerosol water concentration is less than half its metastable (wet) - ! concentration, treat the aerosol as dry. Otherwise, the values - ! in AERO(MASS_H2O) and SSH2O remain at their wet values. Since the water - ! associated with sea salt is not tracked separately, this treatment of - ! hysteresis is based on the total aerosol water including that of sea - ! salt, although the RHD governing this is that obtained (or set) for the - ! non-sea salt inorganics. - ! - ! This is done only for RH between the crystallization and deliquescence - ! RHs of the non-sea salt inorganics. - ! - ! Currently, RHC = 80%, as for ammonium sulfate (Ghan et al. 2001), and - ! RHD = 35%, as for ammonium sulfate (Ghan et al. 2001), both set in subr. AERO_THERMO. - !---------------------------------------------------------------------------------------------------------------- - IF ( RH .GT. RHC .AND. RH .LT. RHD ) THEN - IF ( AERO_WATER_WET .GT. 0.0D+00 ) THEN - IF ( AERO_WATER_ACTUAL/AERO_WATER_WET .LT. 0.5D+00 ) THEN ! dry aerosol - AERO(MASS_H2O) = 0.0D+00 ! Zero the non-sea salt-associated water. - SSH2O = 0.0D+00 ! Zero the sea salt-associated water. - ELSE ! wet (metastable) aerosol - ! Leave AERO(MASS_H2O) and SSH2O at their metastable (wet) values. - ENDIF - ENDIF - ELSEIF ( RH .LE. RHC ) THEN ! Insure that the aerosol is dry below the RHC. - AERO(MASS_H2O) = 0.0D+00 - SSH2O = 0.0D+00 ! Since the RHC of NaCl is set to 45%, and RHC - ENDIF ! is currently set to 35% (ammonium sulfate), - ! SSH2O should already be zero here. - - - !---------------------------------------------------------------------------------------------------------------- - ! Get the mass of species Q in mode (or quadrature point) I for the - ! principal aerosol-phase chemical species. - ! These species are sulfate, BC, OC, dust, and sea salt. - ! - ! MASS_MAP(I,Q) is the location in AERO(:) of the Qth mass in mode I. - ! Mode I has NM(I) mass species defined for it, and NM(I) varies between 1 and NMASS_SPCS (=5). - ! The second index of PROD_INDEX has NMASS_SPCS (=5) values: - ! 1=sulfate, 2=BC, 3=OC, 4=dust, 5=sea salt. - ! The second index of MJQ also has these same NMASS_SPCS (=5) values. - !---------------------------------------------------------------------------------------------------------------- - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A/)')'I,Q,MJQ(I,QQ),AERO(MASS_MAP(I,Q)),NI(I),MASS_MAP(I,Q)' - DO I=1, NWEIGHTS ! loop over modes (quadrature points) - IF ( NI(I) .GT. 1.0D-10 ) THEN - MJQ(I,:) = 1.0D-15 ! [ug/particle] - all species in mode I - DO Q=1, NM(I) ! loop over species defined for mode I - QQ = PROD_INDEX(I,Q) ! QQ is in the range 1 to 5. - MJQ(I,QQ) = AERO(MASS_MAP(I,Q)) / NI(I) ! [ug/particle] - MJQ(I,QQ) = MAX( MJQ(I,QQ), 1.0D-15) ! [ug/particle] - all species in mode I - ! WRITE(30,'(2I4,3D15.5,I4)') I,Q,MJQ(I,QQ),AERO(MASS_MAP(I,Q)),NI(I),MASS_MAP(I,Q) - IF( WRITE_LOG ) WRITE(AUNIT1,'(2I4,3D15.5,I4)') I,Q,MJQ(I,QQ),AERO(MASS_MAP(I,Q)),NI(I),MASS_MAP(I,Q) - ENDDO - ELSE - MJQ(I,:) = 1.0D-15 ! [ug/particle] - all species in mode I - ENDIF - ENDDO - - !---------------------------------------------------------------------------------------------------------------- - ! Get the ambient diameter of average mass for each mode. - !---------------------------------------------------------------------------------------------------------------- - - IF ( UPDATE_DP ) THEN - TOT_SULF = SUM( AERO(SULF_MAP(:)) ) + TINYNUMER ! insure nonzero value - MASS_COMP(:,:) = 0.0D+00 ! [ug/m^3] mass of each component in each mode - TOT_MASS (:) = 0.0D+00 ! [ug/m^3] total mass in each mode - TOT_MASS_DRY(:) = 0.0D+00 ! [ug/m^3] total mass in each mode - DO I=1, NWEIGHTS - DO Q=1, NM(I) - QQ = PROD_INDEX(I,Q) ! QQ is in the range 1 to 5. - !---------------------------------------------------------------------------------------------------------- - ! Sulfate, BC, OC, dust, and sea salt concentrations. - !---------------------------------------------------------------------------------------------------------- - MASS_COMP(I,QQ) = AERO(MASS_MAP(I,Q)) ! [ug/m^3] - ENDDO - !------------------------------------------------------------------------------------------------------------ - ! Nitrate, ammonium, and (non-sea salt) water concentrations. - !------------------------------------------------------------------------------------------------------------ - FTMP = AERO(SULF_MAP(I)) / TOT_SULF - MASS_COMP(I,6) = FTMP * AERO(1) ! [ug/m^3] nitrate - MASS_COMP(I,7) = FTMP * AERO(2) ! [ug/m^3] ammonium - MASS_COMP(I,8) = FTMP * AERO(3) ! [ug/m^3] water - ! WRITE(*,'(I5,6D15.5)')I,FTMP,AERO(1:3), TOT_SULF, AERO(SULF_MAP(I)) - ENDDO - !-------------------------------------------------------------------------------------------------------------- - ! Distribute the sea-salt associated water over modes in proportion to the sea salt mass present. - !-------------------------------------------------------------------------------------------------------------- - - SSH2O_PER_SSMASS = SSH2O / TOT_SEAS ! [ugH2O/ugNaCl] - DO J=1, NMODES_SEAS ! loop over all modes containing sea salt - MASS_COMP(MODE_NUMB_SEAS(J),8) = MASS_COMP(MODE_NUMB_SEAS(J),8) - & + SSH2O_PER_SSMASS * AERO(SEAS_MAP(J)) ! [ug/m^3] - ENDDO - DO I=1, NWEIGHTS - DO J=1, 7 ! all components except water - TOT_MASS_DRY(I) = TOT_MASS_DRY(I) + MASS_COMP(I,J) ! [ug/m^3] - ENDDO - TOT_MASS(I) = TOT_MASS_DRY(I) + MASS_COMP(I,8) ! add in water [ug/m^3] - !------------------------------------------------------------------------------------------------------------ - ! IF(I.EQ. 3) WRITE(*,'(I4,A6,9F12.6 )') I, MODE_NAME(I), TOT_MASS(I), MASS_COMP(I,:) - ! IF(I.EQ. 8) WRITE(*,'(I4,A6,9F12.6 )') I, MODE_NAME(I), TOT_MASS(I), MASS_COMP(I,:) - ! IF(I.EQ.16) WRITE(*,'(I4,A6,9F12.6/)') I, MODE_NAME(I), TOT_MASS(I), MASS_COMP(I,:) - !------------------------------------------------------------------------------------------------------------ - ENDDO - - DO I=1, NWEIGHTS - !------------------------------------------------------------------------------------------------------------ - ! Get the ambient and dry diameter of average mass for each mode (quadrature point). - !------------------------------------------------------------------------------------------------------------ - VOLTMP_DRY = 1.0D-30 - DO J=1, 7 ! all components except water - VOLTMP_DRY = VOLTMP_DRY + MASS_COMP(I,J) * RECIP_DENS_COMP(J) ! mode dry volume conc. [10^6 cm^3/m^3] - ENDDO - VOLTMP = VOLTMP_DRY + MASS_COMP(I,8) * RECIP_DENS_COMP(8) ! mode ambient volume conc. [10^6 cm^3/m^3] - DENS_MODE (I) = TOT_MASS (I) / VOLTMP ! mode ambient density [g/cm^3] - DENS_MODE_DRY(I) = TOT_MASS_DRY(I) / VOLTMP_DRY ! mode dry density [g/cm^3] - DP (I) = ( CONV_VOL_TO_DP_FAC * VOLTMP / NI(I) )**0.333333333333333 ! [m] - DP_DRY(I) = ( CONV_VOL_TO_DP_FAC * VOLTMP_DRY / NI(I) )**0.333333333333333 ! [m] - IF (NI(I) .LT. 1.) THEN - DP(I) = DP0(I) - DP_DRY(I) = DP0(I) - ENDIF - ! IF( DP(I) .GT. DPMAX_GLOBAL ) WRITE(*,'(I4,3D15.5)') I,DP(I),NI(I),TOT_MASS(I) - DP (I) = MIN( MAX( DP (I), DPMIN_GLOBAL ), DPMAX_GLOBAL ) - DP_DRY(I) = MIN( MAX( DP_DRY(I), DPMIN_GLOBAL ), DPMAX_GLOBAL ) - DIAM(IXXX,IYYY,ILAY,I) = DP(I) ! [m] - Store for use outside this routine. - !------------------------------------------------------------------------------------------------------------ - ! Update values of KCI_COEF_DP(I) for the current diameter of average mass for each mode. - ! THETA_POLY(I) prevents excessive condensation due to treating the mode as monodisperse. - ! See Okuyama et al., Studies in binary nucleation: The dibutylphthalate/dioctylphthalate system, - ! J. Chem. Phys. 89, p. 6442, 1988. - !------------------------------------------------------------------------------------------------------------ - INDEX_DP = NINT( LOG( DP(I) / DP_CONDTABLE_MIN ) / XLN_SCALE_DP ) + 1 - INDEX_DP = MAX( MIN( INDEX_DP, N_DP_CONDTABLE ), 1 ) - IF( NI(I) .GT. N_MIN_DIAM_HISTOGRAM ) THEN - INDEX_DP_DRY = NINT( LOG( DP_DRY(I) / DP_CONDTABLE_MIN ) / XLN_SCALE_DP ) + 1 - INDEX_DP_DRY = MAX( MIN( INDEX_DP_DRY, N_DP_CONDTABLE ), 1 ) - DIAM_HISTOGRAM(I,INDEX_DP, 1) = DIAM_HISTOGRAM(I,INDEX_DP, 1) + 1.0D+00 - DIAM_HISTOGRAM(I,INDEX_DP_DRY,2) = DIAM_HISTOGRAM(I,INDEX_DP_DRY,2) + 1.0D+00 - !---------------------------------------------------------------------------------------------------------- - ! IF (I.EQ.5.OR.I.EQ.6) WRITE(*,'(8F13.5)') 1D-6*NI(5),TOT_MASS(5),1D6*DP(5),1D6*DP_DRY(5), - ! & 1D-6*NI(6),TOT_MASS(6),1D6*DP(6),1D6*DP_DRY(6) - !---------------------------------------------------------------------------------------------------------- - ENDIF - KCI_COEF_DP (I,ILAY) = THETA_POLY(I) * KCI_DP_CONDTABLE (INDEX_DP,ILAY) - KCI_COEF_DP_AEQ1(I,ILAY) = THETA_POLY(I) * KCI_DP_CONDTABLE_AEQ1(INDEX_DP,ILAY) - !------------------------------------------------------------------------------------------------------------ - ! WRITE(*,90008)I,INDEX_DP,DP(I),DP_CONDTABLE(INDEX_DP-1),DP_CONDTABLE(INDEX_DP),DP_CONDTABLE(INDEX_DP+1) - ! WRITE(*,'(I4,D14.5,2F15.8)') I,VOLTMP,DENS_MODE(I),TOT_MASS(I) - ! WRITE(*,'(I4,8F12.6)') I,MASS_COMP(I,:) - !------------------------------------------------------------------------------------------------------------ - ENDDO - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A8,4A25/)') 'I','DP0(I) [um]','DP [um]','DENS_MODE [g/cm^3]','DENS_MODE_DRY [g/cm^3]' - DO I=1, NWEIGHTS - WRITE(AUNIT1,'(I8,4D25.6)') I, DP0(I)*1.0D+06, DP(I)*1.0D+06, DENS_MODE(I), DENS_MODE_DRY(I) - ENDDO - ENDIF - AVG_DP_OF_AVG_MASS_METERS = SUM( DP(:)*NI(:) ) / SUM( NI(:) ) ! [m] used in AERO_NPF, KK02 gamma expression - ELSE - DO I=1,NWEIGHTS - DIAM(IXXX,IYYY,ILAY,I) = DP(I) ! [m] - Store for use outside this routine. - ENDDO - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Update the ambient and dry geometric mean diameters. - !---------------------------------------------------------------------------------------------------------------- - DGN(:) = 1.0D+06 * DP (:) * CONV_DPAM_TO_DGN(:) ! [um] - DGN_DRY(:) = 1.0D+06 * DP_DRY(:) * CONV_DPAM_TO_DGN(:) ! [um] - !---------------------------------------------------------------------------------------------------------------- - ! DO I=1, NWEIGHTS - ! WRITE(*,'(I6,3F18.8)') I, 1.0D+06*DP_DRY(I), CONV_DPAM_TO_DGN(I), DGN_DRY(I) - ! ENDDO - ! WRITE(*,'(A)') - !---------------------------------------------------------------------------------------------------------------- - - !---------------------------------------------------------------------------------------------------------------- - ! Update the dry deposition velocities if desired. - !---------------------------------------------------------------------------------------------------------------- - IF( UPDATE_VDEP .AND. ILAY .EQ. 1 ) THEN - CALL GET_AERO_DEPV(NMODES,TEMP_DDEP,RHOA_DDEP,LAMB_DDEP,DVIS_DDEP, - & WSTR_DDEP,USTR_DDEP,RAER_DDEP,DGN,LNSIG0,DENSPI) - IF( GET_DEP_VEL_ONLY ) RETURN - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! Update the coagulation coefficients, if desired. [m^3/s] - !---------------------------------------------------------------------------------------------------------------- - SELECT CASE( UPDATE_KIJ ) - CASE ( 0 ) - CASE ( 1 ) - CALL GET_KBARNIJ(1,TK,PRES,DGN,KBAR0IJ,KBAR3IJ) - !-------------------------------------------------------------------------------------------------------------- - ! KBAR0IJ(:,:) = 1.0D-14 - ! KBAR3IJ(:,:) = 1.0D-14 - ! KBAR3IJ(:,:) = KBAR0IJ(:,:) - !-------------------------------------------------------------------------------------------------------------- - END SELECT - - - !---------------------------------------------------------------------------------------------------------------- - ! - ! GET THE PRODUCTION AND LOSS TERMS FOR THE NUMBER CONCENTRATIONS. - ! - !---------------------------------------------------------------------------------------------------------------- - ! Emissions terms. - ! - ! P_EMIS_NUMB is in [#/m^3/s]. - ! EMIS_MODE_MAP(J) is the mode number receiving the emissions species J. - ! EMIS_MASS is the mass emissions rate [ug/m^3/s]. - ! RECIP_PART_MASS is the reciprocal of the mean mass - ! of an emitted particle for this emissions species [1/ug]. - !---------------------------------------------------------------------------------------------------------------- - P_EMIS_NUMB(:) = 0.0D+00 - DO J=1, NEMIS_SPCS - P_EMIS_NUMB(EMIS_MODE_MAP(J)) = P_EMIS_NUMB(EMIS_MODE_MAP(J)) - & + EMIS_MASS(J)*RECIP_PART_MASS(J) - ENDDO - - DIAGTMP1(1,NUMB_MAP(:)) = P_EMIS_NUMB(:) -! Mass emissions are already treated before - EMIS_MASS(:) = 0.0D+00 - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A4,A30/)')'I','P_EMIS_NUMB(I) [ #/m^3/s]' - DO I=1, NMODES - ! WRITE(AUNIT1,'(I4,2D30.6)') I, P_EMIS_NUMB(I) - ENDDO - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Get the secondary-particle formation rate DNDT [#/m^3/s] and the - ! secondary-particle sulfate mass production rate DMDT_SO4 [ugSO4/m^3/s]. - ! The new particle formation rate DNDT is smaller than the nucleation - ! rate J and is (for most parameterizations) derived from the nucleation rate. - ! - ! For the calculation of DNDT and DMDT_SO4, it is assumed that all of the - ! current H2SO4 concentration was produced by gas-phase oxidation of - ! SO2 during the current time step. SO4RATE is the average production rate - ! of H2SO4 (represented as SO4, MW=96g/mol) over the time step based on this - ! assumption. DMDT_SO4 and DNDT are limited by the available H2SO4. - ! - ! When appropriate, the nucleation rate is calculated using a steady-state - ! H2SO4 concentration. This is done to avoid the spuriously high nucleation - ! rates that would result if the current H2SO4 concentration, which has - ! accumulated without loss over the time step, were used. When the - ! condensational sink (KC) is small enough such that steady-state will not - ! be reached during the time step, an estimate of the H2SO4 concentration - ! at the mid-point of the time step is used in nucleation and condensation - ! calculations. - ! - ! The condensational sink KC is the first-order rate constant for the - ! loss of H2SO4 due to condensation. This is summed over all modes. - ! For the Kerminen and Kulmala (2002) parameterization for the conversion - ! of the nucleation rate to the new particle formation rate, the - ! condensational sink KC_AEQ1 should obtained with the mass accommodation - ! coefficient set of unity. - !---------------------------------------------------------------------------------------------------------------- - XH2SO4_INIT = GAS( GAS_H2SO4 ) + TINYNUMER ! input H2SO4 concentration [ugSO4/m^3] - XH2SO4_NUCL = XH2SO4_NUCL_MIN !TINYNUMER ! XH2SO4_NUCL_MIN ! for the case XH2SO4_INIT .LT. XH2SO4_NUCL_MIN - KC = SUM( KCI_COEF_DP(:,ILAY)*NI(:) ) ! total condensational sink [1/s] for any value of the - KC = MAX( KC, KCMIN ) ! mass accommodation coefficient [1/s] - IF( DO_NPF .AND. XH2SO4_INIT .GT. XH2SO4_NUCL_MIN ) THEN - KC_AEQ1 = SUM( KCI_COEF_DP_AEQ1(:,ILAY)*NI(:) ) ! total condensational sink for the - KC_AEQ1 = MAX( KC_AEQ1, KCMIN ) ! mass accommodation coefficient set to unity [1/s] - XNH3 = CONVNH3 * GAS( GAS_NH3 ) * TK / PRES ! NH3 concentration; from [ug/m^3] to [ppmV] - SO4RATE = XH2SO4_INIT / TSTEP ! average H2SO4 production rate [ugSO4/m^3/s] - IF(KC*TSTEP .GE. XNTAU ) THEN ! invoke steady-state assumption - IH2SO4_PATH = 1 - XH2SO4_SS = MIN( SO4RATE/KC, XH2SO4_INIT ) ! steady-state H2SO4 [ugSO4/m^3] - CALL STEADY_STATE_H2SO4(PRES,RH,TK,XH2SO4_SS,SO4RATE,XNH3,KC,TSTEP,XH2SO4_SS_WNPF) - XH2SO4_NUCL = XH2SO4_SS_WNPF ! [H2SO4] for nucl., GR, and cond. calculation [ugSO4/m^3] - ELSE - IH2SO4_PATH = 2 - XH2SO4_NUCL = SO4RATE / ( (2.0D+00/TSTEP) + KC ) ! use [H2SO4] at mid-time step [ugSO4/m^3] - ENDIF - CALL NPFRATE(PRES,RH,TK,XH2SO4_NUCL,SO4RATE,XNH3,KC_AEQ1,DNDT,DMDT_SO4,0) - ! WRITE(34,90010) TK,RH,UGM3_NCM3*XH2SO4_INIT,UGM3_NCM3*XH2SO4_NUCL,KC,XNH3,1.0D-06*DNDT,IH2SO4_PATH - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A)')'NEW PARTICLE FORMATION' - WRITE(AUNIT1,'(/A)')'PRES,RH,TK,XH2SO4_INIT(ug/m3),XH2SO4_NUCL(#/cm3),SO4RATE,XNH3,KC,DNDT,DMDT_SO4' - WRITE(AUNIT1,90003) PRES,RH,TK,XH2SO4_INIT, XH2SO4_NUCL*UGM3_NCM3,SO4RATE,XNH3,KC,DNDT,DMDT_SO4 - WRITE(AUNIT1,'(/A)')'TK,RH,H2SO4(#.cm^3),H2SO4_NUCL(#/cm3),KC,NH3,DNDT(#/cm3/s),IH2SO4_PATH' - WRITE(AUNIT1,90010) TK,RH,UGM3_NCM3*XH2SO4_INIT,UGM3_NCM3*XH2SO4_NUCL,KC,XNH3,1.0D-06*DNDT,IH2SO4_PATH - ENDIF - ELSE - DNDT = 0.0D+00 - DMDT_SO4 = 0.0D+00 - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! Get the B_i loss terms due to intermodal coagulation. [1/s] - ! Get the R_i production terms due to intermodal coagulation. [#/m^3/s] - ! Get the C_i terms, which include all source terms. [#/m^3/s] - ! For the C_i terms, the secondary particle formation term DNDT must be - ! added in after coupling to condensation below. - ! The A_i terms for intramodal coagulation are directly computed - ! from the coagulation coefficients when the number equations - ! are integrated. - ! If DIKL(I,K,L) = 0, then modes K and L to not coagulate to form mode I. - ! DIJ(I,J) is unity if coagulation of mode I with mode J results - ! in the removal of particles from mode I, and zero otherwise. - !---------------------------------------------------------------------------------------------------------------- - BI(:) = 0.0D+00 - RI(:) = 0.0D+00 - do ikl = 1, nDIKL - i = dikl_control(ikl)%i - k = dikl_control(ikl)%k - l = dikl_control(ikl)%l - RI(i) = RI(i) + KBAR0IJ(k,l) * ni(k) * ni(l) - end do - do k=1, NWEIGHTS - do i = 1, NWEIGHTS - BI(i) = BI(i) + KBAR0IJ(i,k)*NI(k)*xDIJ(i,k) ! Coagulation of modes I and J removes - end do - end do - CI(:) = RI(:) + P_EMIS_NUMB(:) ! all source terms for number concentration - DIAGTMP1(3,NUMB_MAP(:)) = RI(:) - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/6A20/)') 'I','BI [1/s]','CI [#/m^3/s]','RI [#/m^3/s]','NI [#/m^3]','KII[m^3/s]' - DO I=1, NWEIGHTS - WRITE(AUNIT1,90004) I, BI(I), CI(I), RI(I), NI(I), KBAR0IJ(I,I) - ENDDO - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! - ! GET THE PRODUCTION AND LOSS TERMS FOR THE MASS CONCENTRATIONS. - ! - !---------------------------------------------------------------------------------------------------------------- - ! The production terms PIQ(NWEIGHTS,NMASS_SPCS) are in [ug/m^3/s]. - ! The first index runs over all modes or quadrature points. - ! The second index runs over the NMASS_SPCS (=5) principal mass - ! species: sulfate, BC, OC, dust, sea salt. - ! - ! Get the emissions production terms (Pemis_i,q in the manuscript) - ! in [ug/m^3/s] and put them in the total production rate array PIQ - ! (the P_i,q in the manuscript). - ! - ! EMIS_MODE_MAP and EMIS_SPCS_MAP have elements corresponding to - ! the aerosol types (in this order): AKK(=1), ACC(=2), BCC(=8), OCC(=7), - ! DD1(=3), SSA(=5), SSC(=6), BOC(BC=8), BOC(OC=9), DD2(=10). - ! EMIS_MODE_MAP(J) is mode number receiving the emissions held - ! in EMIS_MASS(J). - ! EMIS_SPCS_MAP(J) is the chemical species number (1-5) of the species - ! held in EMIS_MASS(J). - ! Currently, EMIS_SPCS_MAP = (/1,1,2,3,4,5,5,2,3,4/) - !---------------------------------------------------------------------------------------------------------------- - PIQ(:,:) = 0.0D+00 ! Zero all production terms for this time step. - DO J=1, NEMIS_SPCS ! Loop over the emitted species. - PIQ( EMIS_MODE_MAP(J), EMIS_SPCS_MAP(J) ) = - & PIQ( EMIS_MODE_MAP(J), EMIS_SPCS_MAP(J) ) + EMIS_MASS(J) - ENDDO - DO I=1, NMODES - DO Q=1, NM(I) - DIAGTMP1(8,MASS_MAP(I,Q)) = PIQ(I,PROD_INDEX(I,Q)) - ENDDO - ENDDO - - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)') 'EMISSIONS ONLY: I, PIQ(I,:)' - DO I=1, NMODES - ! WRITE(AUNIT1,'(I5,5D14.4)') I, PIQ(I,:) - ENDDO - ENDIF - - - !------------------------------------------------------------------------------------------------------------------- - ! Get the Pcoag_i,q terms for the production of mass species Q in mode or quadrature point I - ! due to coagulation between modes or quadrature points K and L. - ! These are at the same time mapped to the PIQ array. - ! - ! QQ = PROD_INDEX(I,Q) is the principal species index that is the second index of the PIQ and MJQ arrays. - ! It points to chemical species CHEM_SPC_NAME(Q) where - ! CHEM_SPC_NAME(NMASS_SPCS) = (/'SULF','BCAR','OCAR','DUST','SEAS'/) - !------------------------------------------------------------------------------------------------------------------- - ! WRITE(36,'(A)')'I,Q,K,L,PIQ(I,QQ),KBAR3IJ(K,L)*NI(K)*NI(L)*(MJQ(K,Q)+MJQ(L,Q))' - ! WRITE(36,'(A)')'I,Q,K,L,KBAR3IJ(K,L),NI(K),NI(L),MJQ(K,Q),MJQ(L,Q)' - !------------------------------------------------------------------------------------------------------------------- - - PIQTMP(:,:) = 0.0D+00 - - !----------------------------------------------------------------------------------------------------------------- - ! Sum over all K-L interactions and identify which interactions produce species Q in mode I. - ! - ! There are three cases where mass of Q is transferred to mode I, if the Q concentration - ! in the donor mode(s) K and/or L is non-zero. - ! - ! 1. Mode I is the same as mode K but different from mode L, and Q-mass from mode L is - ! transferred to mode I. - ! 2. Mode I is the same as mode L but different from mode K, and Q-mass from mode K is - ! transferred to mode I. - ! 3. Mode I is different from either mode K or mode L, and Q-mass from both mode K and mode L is - ! transferred to mode I. - ! - ! The K-L double sum are symmetric in K-L, so we can sum over either the - ! superdiagonal or subdiagonal part of the 'matrix', but not both. Note that - ! KBAR3IJ(K,L) is not symmetric in K-L, so KBAR3IJ(K,L) and KBAR3IJ(L,K) are not interchangeable. - !--------------------------------------------------------------------------------------------------------------- - - do I=1, NWEIGHTS ! loop over all modes or quadrature points receiving mass species Q - do klq = 1, giklq_control(i)%n - k = giklq_control(i)%k(klq) - l = giklq_control(i)%l(klq) - qq = giklq_control(i)%qq(klq) - - PIQTMP(i,qq) = PIQTMP(i,qq) + - & ni(k)*ni(l) *KBAR3IJ(l,k) * MJQ(l,qq) - end do - end do - - !------------------------------------------------------------------------------------------------------------- - ! IF( I.EQ.15 .AND. K.LE.2 .AND. L.EQ.10 ) THEN - ! WRITE(36,'(4I3,3D15.6,I6)') I,Q,K,L,PIQTMP(I,QQ),NI(K),NI(L),IBRANCH - ! WRITE(36,'(12X,5D15.6)') KBAR3IJ(K,L),KBAR3IJ(L,K),MJQ(K,QQ),MJQ(L,QQ) - ! WRITE(36,'(12X,5D15.6)') KBAR3IJ(K,L)*MJQ(K,QQ),KBAR3IJ(L,K)*MJQ(L,QQ) - ! WRITE(36,'(12X,5D15.6)') KBAR3IJ(K,L)*MJQ(K,QQ)+KBAR3IJ(L,K)*MJQ(L,QQ) - ! WRITE(36,'(12X,5D15.6)')NI(K)*NI(L)*(KBAR3IJ(K,L)*MJQ(K,QQ)+KBAR3IJ(L,K)*MJQ(L,QQ)) - ! ENDIF - !------------------------------------------------------------------------------------------------------------- - DO I=1, NMODES - DO Q=1, NM(I) - DIAGTMP1( 8,MASS_MAP(I,Q)) = PIQ (I,PROD_INDEX(I,Q)) ! Due to mass emissions - DIAGTMP1(10,MASS_MAP(I,Q)) = PIQTMP(I,PROD_INDEX(I,Q)) ! Due to coagulation - ENDDO - ENDDO - PIQ(:,:) = PIQ(:,:) + PIQTMP(:,:) - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)') 'I, Q, QQ, PIQ(I,QQ) [ug/m^3/s] - after coagulation mass terms' - DO I=1, NWEIGHTS - DO Q=1, NM(I) - QQ = PROD_INDEX(I,Q) - ! WRITE(AUNIT1,90000) I, Q, QQ, PIQ(I,QQ) - ENDDO - ENDDO - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Get the F_i terms for the loss of species Q in quadrature point I due - ! to intermodal coagulation of I with other quadrature points. - ! As all species in quadrature point I are lost through this coagulation, - ! the species index Q is not needed. - ! DIJ(I,J) is unity if coagulation of mode I with mode J results - ! in the removal of particles from mode I, and zero otherwise. - ! DIJ(I,J) is not symmetric in I-J. - ! KBAR3IJ(I,J) is not symmetric in I-J, and the first index I refers - ! to the 'donor' mode in the coagulation interaction. Since mode I - ! is here losing mass due to coagulation, mode I is the 'donor' mode. - !---------------------------------------------------------------------------------------------------------------- - ! WRITE(35,'(/A/)') 'DIJ(I,J), I, J, KBAR3IJ(I,J), NI(J), FI(I)' - !---------------------------------------------------------------------------------------------------------------- - FI(:) = 0.0D+00 - DO I=1, NWEIGHTS - DO J=1, NWEIGHTS ! For each mode I, we must sum over all modes J. - IF( DIJ(I,J).GT.0 ) FI(I) = FI(I) + KBAR3IJ(I,J)*NI(J) - !------------------------------------------------------------------------------------------------------------ - ! WRITE(35,'(3I4,3D15.7)') DIJ(I,J), I, J, KBAR3IJ(I,J), NI(J), FI(I) - !------------------------------------------------------------------------------------------------------------ - ENDDO - ENDDO - DO I=1, NMODES - DO Q=1, NM(I) - DIAGTMP1(13,MASS_MAP(I,Q)) = - FI(I) * AERO( MASS_MAP(I,Q) ) - ENDDO - ENDDO - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)') 'I, FI [1/s], NI [#/m^3]' - DO I=1, NWEIGHTS - ! WRITE(AUNIT1,90001) I, FI(I), NI(I) - ENDDO - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! Get the Pcloud_i,q terms due to the in-cloud production of sulfate - ! for each mode or quadrature point in [ugSO4/m^3/s]. - ! - ! AQSO4RATE is the in-cloud sulfate production rate [ug/m^3/s]. - ! - ! KAPPAI(I) is the soluble (or activating) fraction for mode I, as specified in aero_param.f. - ! - ! If all solule particles in mode I are assumed to activate, then - ! the product KAPPAI(I) * NI(I) * RSUM_ACTIV is the fraction of the - ! in-cloud sulfate going into mode I. - ! - ! If a droplet activation calculation is done for each mode, then - ! the product NACT(I) * RSUM_ACTIV is the fraction of the - ! in-cloud sulfate going into mode I. The geometric mean radii passed to - ! GETACTFRAC is for the dry aerosol. - !---------------------------------------------------------------------------------------------------------------- - PIQTMP(:,:) = 0.0D+00 - IF( AQSO4RATE .GT. AQSO4RATE_MIN ) THEN - IF( ACTIVATION_SCHEME .EQ. 1 ) THEN - NSOL(:) = KAPPAI(:)*NI(:) - RSUM_ACTIV = 1.0D+00 / SUM( NSOL(:) + TINYDENOM ) - PIQTMP(:,PROD_INDEX_SULF) = ( KAPPAI(:)*NI(:)*RSUM_ACTIV ) * AQSO4RATE - NACTV(IXXX,IYYY,ILAY,:) = NSOL(:) ! [#/m] - Store for use outside this routine. - !------------------------------------------------------------------------------------------------------------ - ! WRITE(40,'(/A,F15.6/)')'Total number soluble (#/cm^3) = ', 1.0D-06/RSUM_ACTIV - ! DO I=1, NMODES - ! WRITE(40,'(I3,F5.2,3F12.4,A5)')I,KAPPAI(I),1.0D-06*NI(I),1.0D-06*NSOL(I),NSOL(I)*RSUM_ACTIV,MODE_NAME(I) - ! ENDDO - !------------------------------------------------------------------------------------------------------------ - ELSEIF( ACTIVATION_SCHEME .EQ. 2 ) THEN - DO I=1, NMODES - MI5(I,:) = MJQ(I,:) * NI(I) ! mass conc. of each component in mode I [ug/m^3] - ENDDO - CALL GETACTFRAC(NMODES,NI,MI5,0.5D+00*DGN_DRY,SIG0,TK,PRES,WUPDRAFT,AC,FRACACTN,FRACACTM,NACT,CCN,MACT) - RSUM_ACTIV = 1.0D+00 / SUM ( NACT(:) + TINYDENOM ) - PIQTMP(:,PROD_INDEX_SULF) = ( NACT(:)*RSUM_ACTIV ) * AQSO4RATE - NACTV(IXXX,IYYY,ILAY,:) = NACT(:) ! [#/m] - Store for use outside this routine. - CCNSS(IXXX,IYYY,ILAY,:,:) = CCN(:,:) ! [#/m] - Store for use outside this routine. - - !------------------------------------------------------------------------------------------------------------ - ! WRITE(40,'(/A,F15.6/)')'Total number activated (#/cm^3) = ', 1.0D-06/RSUM_ACTIV - ! DO I=1, NMODES - ! WRITE(40,90009)I,FRACACTN(I),1.0D-06*NI(I),1.0D-06*NACT(I),1.0D-06*NACT(I),NACT(I)*RSUM_ACTIV, - !& MODE_NAME(I),DGN(I),DGN_DRY(I) - ! ENDDO - !------------------------------------------------------------------------------------------------------------ - ENDIF - ELSE ! Put all in-cloud sulfate into the accumulation mode. - IF( NUMB_AKK_1 .NE. 0 ) THEN ! Mode AKK exists and mode ACC has mode number = 2. - PIQTMP(2,PROD_INDEX_SULF) = AQSO4RATE ! [ugSO4/m^3/s] - ELSE ! Mode AKK does not exist and mode ACC has mode number = 1. - PIQTMP(1,PROD_INDEX_SULF) = AQSO4RATE ! [ugSO4/m^3/s] - ENDIF - ENDIF - PIQ(:,PROD_INDEX_SULF) = PIQ(:,PROD_INDEX_SULF) + PIQTMP(:,PROD_INDEX_SULF) - DIAGTMP1(12,MASS_MAP(:,PROD_INDEX_SULF)) = PIQTMP(:,PROD_INDEX_SULF) - - !---------------------------------------------------------------------------------------------------------------- - ! Get the Pgrowth_i,q terms due to condensation and gas-particle - ! mass transfer for each mode (or quadrature point) and add them to the PIQ array. - ! - ! The net loss of H2SO4 due to both secondary particle formation - ! and condensation should not exceed the current H2SO4 concentration. - ! This is enforced by rescaling the two H2SO4 consumption rates in a way - ! that preserves the relative magnitudes of these two loss processes. - ! The net condensation rate PQ_GROWTH is calculated from XH2SO4_NUCL, not - ! the total accumulated H2SO4 in XH2SO4_INIT, for balance with the - ! treatment of new particle formation above. - ! - ! The expression in parentheses on the rhs of PIQ is that for h_i, - ! - ! h_i = KCI_COEF_DP(i,ILAY) * NI(i) / KC - ! - ! the ratio of the condensational sink of mode or quadrature point I - ! to the total condensational sink. - ! - ! At this point, XH2SO4_INIT = GAS( GAS_H2SO4 ) + TINYNUMER. - ! - ! The H2SO4 concentration GAS( GAS_H2SO4 ) is updated here. - !---------------------------------------------------------------------------------------------------------------- - PQ_GROWTH = XH2SO4_NUCL * ( 1.0D+00 - EXP(-KC*TSTEP) ) / TSTEP ! [ugSO4/m^3/s] - TOT_H2SO4_LOSS = ( DMDT_SO4 + PQ_GROWTH ) * TSTEP ! [ugSO4/m^3] - IF ( TOT_H2SO4_LOSS .GT. XH2SO4_INIT ) THEN ! XH2SO4_INIT=GAS(GAS_H2SO4)+TINYNUMER - DMDT_SO4 = DMDT_SO4 * ( XH2SO4_INIT / ( TOT_H2SO4_LOSS + TINYDENOM ) )! [ugSO4/m^3/s] - DNDT = DNDT * ( XH2SO4_INIT / ( TOT_H2SO4_LOSS + TINYDENOM ) )! [ # /m^3/s] - PQ_GROWTH = PQ_GROWTH * ( XH2SO4_INIT / ( TOT_H2SO4_LOSS + TINYDENOM ) )! [ugSO4/m^3/s] - GAS( GAS_H2SO4 ) = TINYNUMER - ELSE - GAS( GAS_H2SO4 ) = GAS( GAS_H2SO4 ) - TOT_H2SO4_LOSS + TINYNUMER - ENDIF - DIAGTMP1(2,NUMB_MAP(1)) = DNDT - DIAGTMP1(9,SULF_MAP(PROD_INDEX_SULF)) = DMDT_SO4 - - ! WRITE(35,'(8D13.5)')PIQ(:,PROD_INDEX_SULF), KCI_COEF_DP(:,ILAY),NI(:),KC - - PIQTMP(:,PROD_INDEX_SULF) = ( KCI_COEF_DP(:,ILAY)*NI(:)/KC ) * PQ_GROWTH - PIQ (:,PROD_INDEX_SULF) = PIQ(:,PROD_INDEX_SULF) + PIQTMP(:,PROD_INDEX_SULF) - - DIAGTMP1(11,MASS_MAP(:,PROD_INDEX_SULF)) = PIQTMP(:,PROD_INDEX_SULF) - !----------------------------------------------------------------------------------------------------------------- - ! Add the secondary particle formation term DNDT [#/m^3/s] for the number concentration term. - ! Add the secondary particle formation term DMDT_SO4 [ug/m^3/s], calculated above, - ! to the total mass production rate array PIQ for the AKK mode. - ! If the AKK mode is absent, the secondary particle formation terms still go into mode 1. - !----------------------------------------------------------------------------------------------------------------- - CI(1) = CI(1) + DNDT ! add secondary particle formation number term - PIQ(1,PROD_INDEX_SULF) = PIQ(1,PROD_INDEX_SULF) + DMDT_SO4 ! add secondary particle formation mass term - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A,5X,3D15.8)')'XH2SO4_INIT, XH2SO4_NUCL, PQ_GROWTH = ', XH2SO4_INIT, XH2SO4_NUCL, PQ_GROWTH - WRITE(AUNIT1,*)'PIQ(1,PROD_INDEX_SULF) = ', PIQ(1,PROD_INDEX_SULF) - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! - ! SOLVE FOR THE UPDATED NUMBER CONCENTRATIONS (QUADRATURE WEIGHTS). - ! - !---------------------------------------------------------------------------------------------------------------- - DO I=1, NWEIGHTS - Y0 = NI(I) ! Initial number concentration [#/m^3/s]. - A = 0.5D+00*KBAR0IJ(I,I) - B = BI(I) - C = CI(I) - IF( C .GT. 1.0D-30 ) THEN - DELTA = SQRT( B * B + 4.0D+00 * A * C ) - R1 = 2.0D+00 * A * C / ( B + DELTA ) - R2 = - 0.5D0 * ( B + DELTA ) - GAMMA = - ( R1 - A * Y0 ) / ( R2 - A * Y0 ) - GEXPDT = GAMMA * EXP( - DELTA * TSTEP ) - Y = ( R1 + R2 * GEXPDT ) / ( A * ( 1.0D+00 + GEXPDT ) ) - ELSE ! When C = 0.0D+00, as we assume C is not negative. - EXPDT = EXP( - B * TSTEP ) - IF( 1.0D+00-EXPDT .GT. PIQ_THRESH ) THEN ! IF( EXPDT .LT. 1.0D+00 ) THEN - Y = B * Y0 * EXPDT / ( B + A * Y0 * ( 1.0D+00 - EXPDT ) ) - ELSE - Y = Y0 / ( 1.0D+00 + A * Y0 * TSTEP ) - ENDIF - ENDIF - AERO( NUMB_MAP(I) ) = MAX ( Y, MINCONC ) ! update the output array, not the work array NI(I) - DIAGTMP1(4,NUMB_MAP(I)) = -B*Y0 - DIAGTMP1(5,NUMB_MAP(I)) = -A*Y0*Y0 - ! WRITE(*,'(4D15.5)') A,B,C,Y0 - ENDDO - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A6,2A30/)') 'I','NI(I) [#/m^3]','AERO( NUMB_MAP(I) ) [#/m^3]' - DO I=1, NWEIGHTS - ! WRITE(AUNIT1,90006) I, NI(I), AERO ( NUMB_MAP(I) ) - ENDDO - ENDIF - - - !---------------------------------------------------------------------------------------------------------------- - ! - ! SOLVE FOR THE UPDATED MASS CONCENTRATIONS. - ! - !---------------------------------------------------------------------------------------------------------------- - ! Update the sulfate, BC, OC, dust, and sea salt concentrations. - ! - ! MASS_MAP(I,Q) is the location in AERO(:) of the Qth mass in mode I. - ! Mode I has NM(I) mass species defined for it, and NM(I) varies between - ! 1 and NMASS_SPCS (=5). - ! - ! The second index of PROD_INDEX has NMASS_SPCS (=5) values: - ! 1=sulfate, 2=BC, 3=OC, 4=dust, 5=sea salt. - ! PROD_INDEX(I,Q) is the location in array PIQ(I,Q) of chemical species - ! CHEM_SPC_NAME(Q) for mode (quadrature weight) I. - ! - ! IF ( 1.0D+00-EXPDT .GT. PIQ_THRESH ) --> The first (loss) term in AERO update may be significant. - !---------------------------------------------------------------------------------------------------------------- - DO I=1, NWEIGHTS - EXPDT = EXP( - FI(I) * TSTEP ) - IF ( 1.0D+00-EXPDT .GT. PIQ_THRESH ) THEN - FACTOR = ( 1.0D+00 - EXPDT ) / FI(I) - DO Q=1, NM(I) - AERO(MASS_MAP(I,Q)) = AERO(MASS_MAP(I,Q)) * EXPDT + PIQ(I,PROD_INDEX(I,Q)) * FACTOR - ENDDO - ELSE - DO Q=1, NM(I) - AERO(MASS_MAP(I,Q)) = AERO(MASS_MAP(I,Q)) + PIQ(I,PROD_INDEX(I,Q)) * TSTEP - ENDDO - ENDIF - ENDDO - - - !---------------------------------------------------------------------------------------------------------------- - ! Update the nitrate, ammonium and aerosol water concentrations. - ! - ! Call the thermodynamic module again to determine the bulk gas-particle - ! partitioning of the inorganic species and the water content - ! associated with those species. Also determine the water content - ! associated with the NaCl of sea salt. - ! - ! Note that AERO(MASS_H2O) must include the sea-salt associated water - ! upon exit from this routine. - ! Upon return from AERO_THERMO, AERO(MASS_H2O) contains only the - ! non-sea salt-associated water. The sea salt-associated water is in SSH2O. - !---------------------------------------------------------------------------------------------------------------- - TOT_SULF = SUM( AERO(SULF_MAP(:)) ) - TOT_DUST = SUM( AERO(DUST_MAP(:)) ) - TOT_SEAS = SUM( AERO(SEAS_MAP(:)) ) - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A,F12.4/)') 'TOT_SULF = ', TOT_SULF - AERO_WATER_ACTUAL = AERO(MASS_H2O) + SSH2O - CALL AERO_THERMO(TOT_SULF,AERO(MASS_NO3),AERO(MASS_NH4),AERO(MASS_H2O),GAS(GAS_NH3), - & GAS(GAS_HNO3),TOT_DUST,TOT_SEAS,SSH2O,TK,RH,PRES,RHD,RHC) - AERO_WATER_WET = AERO(MASS_H2O) + SSH2O - - !---------------------------------------------------------------------------------------------------------------- - ! Again, adjust the water concentration for hysteresis. - !---------------------------------------------------------------------------------------------------------------- - IF ( RH .GT. RHC .AND. RH .LT. RHD ) THEN - IF ( AERO_WATER_WET .GT. 0.0D+00 ) THEN - IF ( AERO_WATER_ACTUAL/AERO_WATER_WET .LT. 0.5D+00 ) THEN - AERO(MASS_H2O) = 0.0D+00 ! Zero the non-sea salt-associated water. - SSH2O = 0.0D+00 ! Zero the sea salt-associated water. - ENDIF - ENDIF - ELSEIF ( RH .LE. RHC ) THEN - AERO(MASS_H2O) = 0.0D+00 - SSH2O = 0.0D+00 - ENDIF - !---------------------------------------------------------------------------------------------------------------- - ! The total aerosol water must exit the routine in AERO(MASS_H2O). - !---------------------------------------------------------------------------------------------------------------- - AERO(MASS_H2O) = AERO(MASS_H2O) + SSH2O ! Total aerosol water now. - - - !---------------------------------------------------------------------------------------------------------------- - ! Transfer mass and number concentrations from DD1 to DS1, DD2 to DS2, - ! BC1 to BC2, and BC2 to BC3, if the appropriate modes are defined - ! in the present configuration. - ! - ! This transfer is based upon the volume fraction of inorganic constituents. - ! For computational efficiency, the maximum inorganic volume fraction (MIVF) - ! for a mode is transformed into the maximum inorganic mass ratio (MIMR), - ! and the MIMR are precomputed parameters. - ! - ! In the following IF statements, the first (and lengthy) quantity is the current - ! inorganic-to-dust or inorganic-to-BC mass ratio. For example, in the second IF statement below, - ! - ! AERO(MASS_DD1_SULF)*OPTOT_NO3NH4H2O_TO_SULF - ! - ! is the total mass concentration of inorganic coating - ! (sulfate + nitrate + ammonium + water) in mode DD1, and - ! - ! AERO(MASS_DD1_SULF)*OPTOT_NO3NH4H2O_TO_SULF/AERO(MASS_DD1_DUST) is the - ! - ! inorganic-to-dust mass ratio for mode DD1. - ! - ! There is no need to explicitly transfer nitrate, ammonium, or aerosol water. - ! - ! OPTOT_NO3NH4H2O_TO_SULF is the total NO3+NH4+H2O mass per unit mass SO4, plus 1. - !---------------------------------------------------------------------------------------------------------------- - AEROTMP2(:) = AERO(:) - AERO(MASS_DD1_DUST) = MAX( AERO(MASS_DD1_DUST), TINYNUMER ) - AERO(MASS_BC1_BCAR) = MAX( AERO(MASS_BC1_BCAR), TINYNUMER ) - AERO(MASS_BC2_BCAR) = MAX( AERO(MASS_BC2_BCAR), TINYNUMER ) - IF( MASS_DD2_DUST .GT. 0 ) AERO(MASS_DD2_DUST) = MAX( AERO(MASS_DD2_DUST), TINYNUMER ) ! If mode DD2 exists. - - TOT_SULF = SUM( AERO(SULF_MAP(:)) ) + TINYNUMER - OPTOT_NO3NH4H2O_TO_SULF = 1.0D+00 + SUM(AERO(1:3)) / TOT_SULF - - IF( AERO(MASS_DD1_SULF)*OPTOT_NO3NH4H2O_TO_SULF/AERO(MASS_DD1_DUST) .GT. MIMR_DDD ) THEN - !-------------------------------------------------------------------------------------------------------------- - ! Transfer mode DD1 to mode DS1. - !-------------------------------------------------------------------------------------------------------------- - AERO(MASS_DS1_SULF) = AERO(MASS_DS1_SULF) + AERO(MASS_DD1_SULF) - AERO(MASS_DS1_DUST) = AERO(MASS_DS1_DUST) + AERO(MASS_DD1_DUST) - AERO(NUMB_DS1_1 ) = AERO(NUMB_DS1_1 ) + AERO(NUMB_DD1_1 ) - AERO(MASS_DD1_SULF) = TINYNUMER - AERO(MASS_DD1_DUST) = TINYNUMER - AERO(NUMB_DD1_1 ) = TINYNUMER - ENDIF - - IF( MASS_DD2_DUST .GT. 0.0D+00 ) THEN - IF( AERO(MASS_DD2_SULF)*OPTOT_NO3NH4H2O_TO_SULF/AERO(MASS_DD2_DUST) .GT. MIMR_DDD ) THEN - !------------------------------------------------------------------------------------------------------------ - ! Transfer mode DD2 to mode DS2. - !------------------------------------------------------------------------------------------------------------ - AERO(MASS_DS2_SULF) = AERO(MASS_DS2_SULF) + AERO(MASS_DD2_SULF) - AERO(MASS_DS2_DUST) = AERO(MASS_DS2_DUST) + AERO(MASS_DD2_DUST) - AERO(NUMB_DS2_1 ) = AERO(NUMB_DS2_1 ) + AERO(NUMB_DD2_1 ) - AERO(MASS_DD2_SULF) = TINYNUMER - AERO(MASS_DD2_DUST) = TINYNUMER - AERO(NUMB_DD2_1 ) = TINYNUMER - ENDIF - ENDIF - - IF( AERO(MASS_BC1_SULF)*OPTOT_NO3NH4H2O_TO_SULF/AERO(MASS_BC1_BCAR) .GT. MIMR_BC1 ) THEN - !-------------------------------------------------------------------------------------------------------------- - ! Transfer mode BC1 to mode BC2. - !-------------------------------------------------------------------------------------------------------------- - AERO(MASS_BC2_SULF) = AERO(MASS_BC2_SULF) + AERO(MASS_BC1_SULF) - AERO(MASS_BC2_BCAR) = AERO(MASS_BC2_BCAR) + AERO(MASS_BC1_BCAR) - AERO(NUMB_BC2_1 ) = AERO(NUMB_BC2_1 ) + AERO(NUMB_BC1_1 ) - AERO(MASS_BC1_SULF) = TINYNUMER - AERO(MASS_BC1_BCAR) = TINYNUMER - AERO(NUMB_BC1_1 ) = TINYNUMER - ENDIF - - IF( AERO(MASS_BC2_SULF)*OPTOT_NO3NH4H2O_TO_SULF/AERO(MASS_BC2_BCAR) .GT. MIMR_BC2 ) THEN - !-------------------------------------------------------------------------------------------------------------- - ! Transfer mode BC2 to mode BC3. - !-------------------------------------------------------------------------------------------------------------- - IF( INCLUDE_BC3 ) THEN - AERO(MASS_BC3_SULF) = AERO(MASS_BC3_SULF) + AERO(MASS_BC2_SULF) - AERO(MASS_BC3_BCAR) = AERO(MASS_BC3_BCAR) + AERO(MASS_BC2_BCAR) - AERO(NUMB_BC3_1 ) = AERO(NUMB_BC3_1 ) + AERO(NUMB_BC2_1 ) - AERO(MASS_BC2_SULF) = TINYNUMER - AERO(MASS_BC2_BCAR) = TINYNUMER - AERO(NUMB_BC2_1 ) = TINYNUMER - ENDIF - ENDIF - - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A,2F15.6)')'MIVF_DDD, MIMR_DDD = ', MIVF_DDD, MIMR_DDD - WRITE(AUNIT1,'( A,2F15.6)')'MIVF_BC1, MIMR_BC1 = ', MIVF_BC1, MIMR_BC1 - WRITE(AUNIT1,'( A,2F15.6)')'MIVF_BC2, MIMR_BC2 = ', MIVF_BC2, MIMR_BC2 - WRITE(AUNIT1,'(/A,2D15.6)')'TOT_SULF, OPTOT_NO3NH4H2O_TO_SULF = ', TOT_SULF, OPTOT_NO3NH4H2O_TO_SULF - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Intermodal transfer from the Aitken (AKK) mode to the accumulation (ACC) mode. - ! - ! This is not a physical process, but a reclassification of particles. See Binkowski and Roselle (2003). - ! - ! AERO(MASS_AXX_SULF)*OPTOT_NO3NH4H2O_TO_SULF is the total mass in mode AXX (X=K, C) [ug/m^3]. - ! Division by AERO(NUMB_AXX_1) converts to mean mass per particle [ug]. - ! Multiplication by CONV_MASS_TO_DP converts to Dp^3 [m^3]. - ! Taking the cube root yields the diameter of average mass for the mode [m]. - ! - ! FNUM is the fraction of the AKK mode mass and number concentrations transferred to the ACC mode - ! during this time step. Binkowski and Roselle (2003) limit FNUM to a maximum of 0.5 for - ! numerical stability, and the same is done here. - !---------------------------------------------------------------------------------------------------------------- - IF( INTERMODAL_TRANSFER .AND. AERO( NUMB_MAP(1) ) .GT. AKK_MINNUM_IMTR ) THEN - DPAKK = ( CONV_MASS_TO_DP * AERO( MASS_AKK_SULF ) ! diameter of average mass for AKK [m] - & * OPTOT_NO3NH4H2O_TO_SULF / AERO( NUMB_AKK_1 ) )**0.33333333333 - DPACC = ( CONV_MASS_TO_DP * AERO( MASS_ACC_SULF ) ! diameter of average mass for ACC [m] - & * OPTOT_NO3NH4H2O_TO_SULF / AERO( NUMB_ACC_1 ) )**0.33333333333 - IF( IMTR_METHOD .EQ. 1 ) THEN - !------------------------------------------------------------------------------------------------------------ - ! Calculate the fraction transferred based on the relative difference - ! in mass mean diameters of the AKK and ACC modes. - !------------------------------------------------------------------------------------------------------------ - IF( DPAKK .GE. DPAKK0 ) THEN ! [m] - FNUM = ( ( DPAKK - DPAKK0 ) / ( DPACC - DPAKK0 ) )**IMTR_EXP ! fraction transferred from AKK to ACC - FNUM = MAX( MIN( FNUM, FNUM_MAX ), 0.0D+00 ) ! limit transfer in a single transfer - ELSE - FNUM = 0.0D+00 - ENDIF - F3 = FNUM - ! WRITE(34,'(7D12.4)')FNUM,F3 - ELSEIF( IMTR_METHOD .EQ. 2 ) THEN - !------------------------------------------------------------------------------------------------------------ - ! Calculate the fraction transferred based on a fixed - ! threshold diameter DPCUT_IMTR. - !------------------------------------------------------------------------------------------------------------ - DGN_AKK_IMTR = 1.0D+06 * DPAKK * CONV_DPAM_TO_DGN(1) ! [um] - XNUM = XNUM_FACTOR * LOG( DPCUT_IMTR / DGN_AKK_IMTR ) ! [1] - XNUM = MAX( XNUM, X3_TERM ) ! limit for stability as in BS2003 - X3 = XNUM - X3_TERM ! [1] - FNUM = 0.5D+00 * ERFC( XNUM ) ! number fraction transferred from AKK to ACC - F3 = 0.5D+00 * ERFC( X3 ) ! mass fraction transferred from AKK to ACC - ! WRITE(34,'(9D12.4)')DGN_AKK_IMTR,DPCUT_IMTR,DPAKK*1.0D+06,AERO(NUMB_AKK_1),AERO(MASS_AKK_SULF),FNUM,F3 - ELSEIF( IMTR_METHOD .EQ. 3 ) THEN - !------------------------------------------------------------------------------------------------------------ - ! Calculate the fraction transferred based on the - ! diameter of intersection of the AKK and ACC modes. - !------------------------------------------------------------------------------------------------------------ - DGN_AKK_IMTR = 1.0D+06 * DPAKK * CONV_DPAM_TO_DGN(1) ! [um] - DGN_ACC_IMTR = 1.0D+06 * DPACC * CONV_DPAM_TO_DGN(2) ! [um] - IF( AERO( NUMB_ACC_1 ) .GT. 1.0D+06 ) THEN ! mode ACC not essentially empty - XNUM = GETXNUM(AERO(NUMB_AKK_1),AERO(NUMB_ACC_1),DGN_AKK_IMTR,DGN_ACC_IMTR,LNSG_AKK,LNSG_ACC) ! [1] - ELSE ! mode ACC essentially empty - use Method 2 - XNUM = XNUM_FACTOR * LOG( DPCUT_IMTR / DGN_AKK_IMTR ) ! [1] - ENDIF - XNUM = MAX( XNUM, X3_TERM ) ! limit for stability as in BS2003 - X3 = XNUM - X3_TERM ! [1] - FNUM = 0.5D+00 * ERFC( XNUM ) ! number fraction transferred from AKK to ACC - F3 = 0.5D+00 * ERFC( X3 ) ! mass fraction transferred from AKK to ACC - ! WRITE(34,'(9D12.4)')DGN_AKK_IMTR,DGN_ACC_IMTR,AERO(NUMB_AKK_1),AERO(NUMB_ACC_1),FNUM,F3 - ENDIF - DEL_MASS = AERO( MASS_AKK_SULF ) * F3 ! mass concentration transferred [ug/m^3] - DEL_NUMB = AERO( NUMB_AKK_1 ) * FNUM ! number concentration transferred [# /m^3] - AERO( MASS_AKK_SULF ) = AERO( MASS_AKK_SULF ) - DEL_MASS ! update AKK mass concentration [ug/m^3] - AERO( NUMB_AKK_1 ) = AERO( NUMB_AKK_1 ) - DEL_NUMB ! update AKK number concentration [# /m^3] - AERO( MASS_ACC_SULF ) = AERO( MASS_ACC_SULF ) + DEL_MASS ! update ACC mass concentration [ug/m^3] - AERO( NUMB_ACC_1 ) = AERO( NUMB_ACC_1 ) + DEL_NUMB ! update ACC number concentration [# /m^3] - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A5,9D11.3)') 'IMTR:',DPAKK,DPACC,DPAKK0,FNUM,F3, - & DEL_MASS,DEL_NUMB,AERO( NUMB_AKK_1 ), AERO( NUMB_ACC_1 ) - ENDIF - ENDIF - - DIAGTMP1( 6,:) = ( AERO(:) - AEROTMP2(:) ) / TSTEP - DIAGTMP1(14,:) = ( AERO(:) - AEROTMP2(:) ) / TSTEP - - !---------------------------------------------------------------------------------------------------------------- - ! Put all sea salt sulfate back into the accumulation mode (SSA) if the - ! mechanism uses both the SSA and SSC modes. - !---------------------------------------------------------------------------------------------------------------- - IF ( NUMBER_OF_SEASALT_MODES .EQ. 2 ) THEN - AERO( MASS_SSA_SULF ) = AERO( MASS_SSA_SULF ) + AERO( MASS_SSC_SULF ) - AERO( MASS_SSC_SULF ) = TINYNUMER - ENDIF - - !---------------------------------------------------------------------------------------------------------------- - ! Get final total mass concentration for each model species [ug/m^3]. - ! Adjust final aerosol and gas-phase species by rescaling to enforce mass - ! conservation to machine precision. - ! Precise mass conservation to machine precision is not necessarily - ! conserved otherwise due to formulation of the model equations - ! in terms of production and loss terms that may not precisely - ! cancel on some occasions that they should due to their distinct - ! treatment. - !--------------------- ------------------------------------------------------------------------------------------- - ! WRITE(*,*)'TOT_SULF 1 = ',SUM( AERO( SULF_MAP(:)) ) - IF( MASS_ADJ ) THEN - CALL SPCMASSES(AERO,GAS,SPCMASS2) - CALL MASSADJ(AERO,GAS,SPCMASS1,SPCMASS2,EMIS_MASS,AQSO4RATE,TSTEP) - ENDIF - ! WRITE(*,*)'TOT_SULF 2 = ',SUM( AERO( SULF_MAP(:)) ) - - !---------------------------------------------------------------------------------------------------------------- - ! Limit low mass or number concentrations. - !---------------------------------------------------------------------------------------------------------------- - AERO(:) = MAX( AERO(:), MINCONC ) - - !---------------------------------------------------------------------------------------------------------------- - ! Budget diagnostics. - !---------------------------------------------------------------------------------------------------------------- - DIAGTMP1(7,:) = ( AERO(:) - AEROTMP1(:) ) / TSTEP ! Actual total differences for both mass and number. - DIAG(:,:) = 0.0D+00 - DIAG(1: 7,NUMB_MAP(:)) = DIAGTMP1(1: 7,NUMB_MAP(:)) ! Save diagnostics 1-7 for the number concentrations only. - DIAG(8:14,:) = DIAGTMP1(8:14,:) ! Save diagnostics 8-15 for the mass concentrations only. - DIAG(15,:) = DIAGTMP1(7,:) ! ... cont'd ... - DIAG(8:15,NUMB_MAP(:)) = 0.0D+00 ! Zero diagnostics 8-15 for the number concentrations. - !---------------------------------------------------------------------------------------------------------------- - ! Rescale each term of the budget for species I to get the correct sum. - !---------------------------------------------------------------------------------------------------------------- -c DO I=1, NAEROBOX -c AEROTMP2(I) = 0.0D+00 -c DO K=1, 6 -c AEROTMP2(I) = AEROTMP2(I) + DIAG(K,I) + DIAG(K+7,I) -c ENDDO -c AEROTMP2(I) = AEROTMP2(I) + DIAG(14,I) -c DO J=1, 6 -c DIAG(J,I) = DIAG(J,I) * ( DIAGTMP1(7,I) / ( AEROTMP2(I) + TINYDENOM ) ) -c ENDDO -c DO J=8, NDIAG_AERO-1 -c DIAG(J,I) = DIAG(J,I) * ( DIAGTMP1(7,I) / ( AEROTMP2(I) + TINYDENOM ) ) -c ENDDO -c ENDDO - - -90000 FORMAT(3I6,D15.5) -90001 FORMAT(1I6,2D15.5) -90002 FORMAT(1I6,D15.5) -90003 FORMAT(F9.1,F6.3,F7.2,7D13.3) -90004 FORMAT(I20,5D20.6) -90005 FORMAT(I6,3D30.6) -90006 FORMAT(I6,2D30.6) -90007 FORMAT(F7.2,F5.2,7D13.5,F8.5) -90008 FORMAT(2I5,4D15.5) -90009 FORMAT(I3,F11.7,2F13.3,D11.3,F8.3,A5,2F8.3) -90010 FORMAT(F7.2,F5.2,4D13.5,F16.8,I3) - END SUBROUTINE MATRIX - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_nomicrophysics.F b/MATRIXchem_GridComp/microphysics/TRAMP_nomicrophysics.F deleted file mode 100644 index 2b89ee37..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_nomicrophysics.F +++ /dev/null @@ -1,193 +0,0 @@ - SUBROUTINE AERO_NOMICROPHYSICS(AERO,GAS,EMIS_MASS,TSTEP,TK,RH,PRES,AQSO4RATE) -!------------------------------------------------------------------------------------------------------------- -! DLW, 092106: Routine for the no-microphysics option. -! -! When this option is chosen, mass emissions are added in, all gas-phase H2SO4 and sulfate from -! in-cloud oxidation is added to the sulfate accumulation mode, and the routine for gas-particle -! partitioning of NH3/NH4+, HNO3/NO3-, and aerosol H2O is called. All sulfate emissions are here -! put into the accumulation mode and none into the Aitken mode. -!------------------------------------------------------------------------------------------------------------- - USE AERO_CONFIG - USE AERO_SETUP - USE AERO_SUBS - IMPLICIT NONE - - ! Arguments. - - REAL(8), INTENT(INOUT) :: AERO(NAEROBOX) ! aerosol conc. [ug/m^3] or [#/m^3] - REAL(8), INTENT(INOUT) :: GAS(NGASES) ! gas-phase conc. [ug/m^3] - REAL(8), INTENT(IN) :: EMIS_MASS(NEMIS_SPCS) ! mass emission rates [ug/m^3/s] - REAL(8), INTENT(IN) :: TSTEP ! model physics time step [s] - REAL(8), INTENT(IN) :: TK ! absolute temperature [K] - REAL(8), INTENT(IN) :: RH ! relative humidity [0-1] - REAL(8), INTENT(IN) :: PRES ! ambient pressure [Pa] - REAL(8), INTENT(IN) :: AQSO4RATE ! in-cloud SO4 production rate [ug/m^3/s] - - ! Local variables. - - INTEGER :: I,J,Q ! indices - REAL(8) :: PIQ(NWEIGHTS,NMASS_SPCS) ! production terms for mass conc. [ug/m^3/s] - REAL(8) :: TOT_SULF ! total sulfate conc. [ug/m^3] - REAL(8) :: TOT_DUST ! total dust conc. [ug/m^3] - REAL(8) :: TOT_SEAS ! total sea salt conc. [ug/m^3] - REAL(8) :: SSH2O ! total sea salt H2O [ug/m^3] - REAL(8) :: AERO_WATER_ACTUAL ! actual aerosol H2O conc. [ug/m^3] - REAL(8) :: AERO_WATER_WET ! wet aerosol H2O conc. [ug/m^3] - REAL(8) :: RHD ! deliquescence RH [0-1] - REAL(8) :: RHC ! crystallization RH [0-1] - REAL(8) :: SPCMASS1(NMASS_SPCS+2) ! initial total mass conc. of each model species [ug/m^3] - REAL(8) :: SPCMASS2(NMASS_SPCS+2) ! final total mass conc. of each model species [ug/m^3] - INTEGER, SAVE :: INDEX_ACC ! index of sulfate accumulation mode - LOGICAL, SAVE :: FIRSTIME = .TRUE. - - IF( FIRSTIME ) THEN - FIRSTIME = .FALSE. - !----------------------------------------------------------------------------------------------------- - ! Get the mode number of the sulfate accumulation mode. - !----------------------------------------------------------------------------------------------------- - DO I=1, NMODES - IF( MODE_NAME(I) .EQ. 'ACC' ) THEN - INDEX_ACC = I - GOTO 100 - ENDIF - ENDDO - 100 CONTINUE - ENDIF - - !------------------------------------------------------------------------------------------------------- - ! Get the initial total mass concentration for each model species [ug/m^3]. - !------------------------------------------------------------------------------------------------------- - IF ( MASS_ADJ ) CALL SPCMASSES(AERO,GAS,SPCMASS1) - - !------------------------------------------------------------------------------------------------------- - ! Add the particle emissions. - !------------------------------------------------------------------------------------------------------- - ! The production terms PIQ(NWEIGHTS,NMASS_SPCS) are in [ug/m^3/s]. - ! The first index runs over all modes or quadrature points. - ! The second index runs over the NMASS_SPCS (=5) principal mass - ! species: sulfate, BC, OC, dust, sea salt. - ! - ! Get the emissions production terms (Pemis_i,q in the manuscript) in [ug/m^3/s] and put them - ! in the total production rate array PIQ (the P_i,q in the manuscript). - ! - ! EMIS_MODE_MAP and EMIS_SPCS_MAP have elements corresponding to - ! the aerosol types (in this order): AKK(=1), ACC(=2), BCC(=8), OCC(=7), - ! DD1(=3), SSA(=5), SSC(=6), BOC(BC=8), BOC(OC=9), DD2(=10). - ! EMIS_MODE_MAP(J) is mode number receiving the emissions held - ! in EMIS_MASS(J). - ! EMIS_SPCS_MAP(J) is the chemical species number (1-5) of the species - ! held in EMIS_MASS(J). - ! Currently, EMIS_SPCS_MAP = (/1,1,2,3,4,5,5,2,3,4/) - !------------------------------------------------------------------------------------------------------- - PIQ(:,:) = 0.0D+00 ! Zero all production terms for this time step. - DO J=1, NEMIS_SPCS ! Loop over the emitted species. - PIQ( EMIS_MODE_MAP(J), EMIS_SPCS_MAP(J) ) = - & PIQ( EMIS_MODE_MAP(J), EMIS_SPCS_MAP(J) ) + EMIS_MASS(J) - ENDDO - - !------------------------------------------------------------------------------------------------------- - ! Add all SO4(aq) and H2SO4(g) to mode ACC. Zero the H2SO4(g). - !------------------------------------------------------------------------------------------------------- - PIQ(INDEX_ACC,PROD_INDEX_SULF) = PIQ(INDEX_ACC,PROD_INDEX_SULF) + AQSO4RATE + GAS(GAS_H2SO4)/TSTEP - GAS(GAS_H2SO4) = 0.0D+00 - - !------------------------------------------------------------------------------------------------------- - ! Update the sulfate, BC, OC, dust, and sea salt concentrations. - !------------------------------------------------------------------------------------------------------- - ! MASS_MAP(I,Q) is the location in AERO(:) of the Qth mass in mode I. - ! Mode I has NM(I) mass species defined for it, and NM(I) varies between - ! 1 and NMASS_SPCS (=5). - ! - ! The second index of PROD_INDEX has NMASS_SPCS (=5) values: - ! 1=sulfate, 2=BC, 3=OC, 4=dust, 5=sea salt. - ! PROD_INDEX(I,Q) is the location in array PIQ(I,Q) of chemical species - ! CHEM_SPC_NAME(Q) for mode (quadrature weight) I. - !------------------------------------------------------------------------------------------------------- - DO I=1, NWEIGHTS - DO Q=1, NM(I) - AERO(MASS_MAP(I,Q)) = AERO(MASS_MAP(I,Q)) + PIQ(I,PROD_INDEX(I,Q)) * TSTEP - ENDDO - ENDDO - - IF( NO_MICROPHYSICS_W_THERMO ) THEN - - !------------------------------------------------------------------------------------------------------- - ! Get the total sulfate, total mineral dust, and total sea salt (NaCl) mass concentrations summed - ! over all modes [ug/m^3] for use in the subsequent gas-particle partitioning calculation. - !------------------------------------------------------------------------------------------------------- - TOT_SULF = SUM( AERO(SULF_MAP(:)) ) - TOT_DUST = SUM( AERO(DUST_MAP(:)) ) - TOT_SEAS = SUM( AERO(SEAS_MAP(:)) ) - - !------------------------------------------------------------------------------------------------------- - ! Do the gas-particle mass transfer after adding mass emissions, SO4(aq), and H2SO4(g). - !------------------------------------------------------------------------------------------------------- - ! Call the aerosol thermodynamic module to determine the bulk gas-particle partitioning of the - ! inorganic species and the water content associated with those species. - ! Also determine the water content associated with the NaCl of sea salt. - ! - ! Note that AERO(MASS_H2O) includes the sea-salt associated water when it is passed to this routine - ! and passed to AERO_THERMO. Upon return from AERO_THERMO, AERO(MASS_H2O) contains only the - ! non-sea salt-associated water. The sea salt-associated water is in SSH2O. - !------------------------------------------------------------------------------------------------------- - AERO_WATER_ACTUAL = AERO(MASS_H2O) ! actual tracked aerosol water conc. - CALL AERO_THERMO(TOT_SULF,AERO(MASS_NO3),AERO(MASS_NH4), - & AERO(MASS_H2O),GAS(GAS_NH3),GAS(GAS_HNO3), - & TOT_DUST,TOT_SEAS,SSH2O,TK,RH,PRES,RHD,RHC) - AERO_WATER_WET = AERO(MASS_H2O) + SSH2O ! total metastable aerosol water conc. - - !------------------------------------------------------------------------------------------------------- - ! Adjust the aerosol water concentration for hysteresis. - !------------------------------------------------------------------------------------------------------- - ! If the aerosol water concentration is less than half its metastable (wet) - ! concentration, treat the aerosol as dry. Otherwise, the values - ! in AERO(MASS_H2O) and SSH2O remain at their wet values. Since the water - ! associated with sea salt is not tracked separately, this treatment of - ! hysteresis is based on the total aerosol water including that of sea - ! salt, although the RHD governing this is that obtained (or set) for the - ! non-sea salt inorganics. - ! - ! This is done only for RH between the crystallization and deliquescence - ! RHs of the non-sea salt inorganics. - ! - ! On 8-7-06: RHC = 80% as for ammonium sulfate (Ghan et al. 2001) - ! RHD = 35% as for ammonium sulfate (Ghan et al. 2001) - !------------------------------------------------------------------------------------------------------- - IF ( RH .GT. RHC .AND. RH .LT. RHD ) THEN - IF ( AERO_WATER_WET .GT. 0.0D+00 ) THEN - IF ( AERO_WATER_ACTUAL/AERO_WATER_WET .LT. 0.5D+00 ) THEN ! dry aerosol - AERO(MASS_H2O) = 0.0D+00 ! Zero the non-sea salt-associated water. - SSH2O = 0.0D+00 ! Zero the sea salt-associated water. - ELSE ! wet (metastable) aerosol - ! Leave AERO(MASS_H2O) and SSH2O - ENDIF ! at their metastable (wet) values. - ENDIF - ELSEIF ( RH .LE. RHC ) THEN ! Insure that the aerosol is dry below the RHC. - AERO(MASS_H2O) = 0.0D+00 - SSH2O = 0.0D+00 ! Since the RHC of NaCl is set to 45%, and RHC - ENDIF ! is currently set to 35% (ammonium sulfate), - ! SSH2O should already be zero here. - !------------------------------------------------------------------------------------------------------- - ! The total aerosol water must exit the routine in AERO(MASS_H2O). - !------------------------------------------------------------------------------------------------------- - AERO(MASS_H2O) = AERO(MASS_H2O) + SSH2O ! Total aerosol water now. - - ENDIF - - !------------------------------------------------------------------------------------------------------- - ! Get final total mass concentration for each model species [ug/m^3]. - ! Rescale final aerosol and gas-phase species to enforce mass conservation to machine precision. - !------------------------------------------------------------------------------------------------------- - IF ( MASS_ADJ ) THEN - CALL SPCMASSES(AERO,GAS,SPCMASS2) - CALL MASSADJ(AERO,GAS,SPCMASS1,SPCMASS2,EMIS_MASS,AQSO4RATE,TSTEP) - ENDIF - - !------------------------------------------------------------------------------------------------------- - ! Limit low mass or number concentrations. - !------------------------------------------------------------------------------------------------------- - AERO(:) = MAX( AERO(:), MINCONC ) - - RETURN - END SUBROUTINE AERO_NOMICROPHYSICS - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_npf.F b/MATRIXchem_GridComp/microphysics/TRAMP_npf.F deleted file mode 100644 index ff3d1a74..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_npf.F +++ /dev/null @@ -1,1479 +0,0 @@ - MODULE AERO_NPF -!------------------------------------------------------------------------------------------------------------------- -! -!@sum This module contains all sub-programs to calculate nucleation and -!@+ new particle formation rates. -!@auth Susanne Bauer/Doug Wright -!------------------------------------------------------------------------------------------------------------------- - USE AERO_PARAM - USE AERO_SETUP, ONLY: DIFFCOEF_M2S, AVG_DP_OF_AVG_MASS_METERS - IMPLICIT NONE - !------------------------------------------------------------------------------------------------------------- - ! Select the nucleation scheme: INUC = 1, JVM - ! INUC = 2, VEHKAMAKI - ! INUC = 3, NAPARI - ! INUC = 4, EISELE AND MCMURRY, 1997 - !------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: INUC = 3 - LOGICAL, PARAMETER :: INCLUDE_ION_ION = .TRUE. ! include Turco scheme - - !------------------------------------------------------------------------------------------------------------- - ! Flag for use of the Kerminem and Kulmala (2002) parameterization for - ! conversion of a nucleation rate to a particle formation rate at a - ! larger user-selected size. - !------------------------------------------------------------------------------------------------------------- - LOGICAL, PARAMETER :: KK02 = .TRUE. - LOGICAL, PARAMETER :: WRITE_F_KK02 = .FALSE. - - !------------------------------------------------------------------------------------------------------------- - ! New particle parameters. - !------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DSTAR_NM = 1.0D+00 ! diameter of critical nucleus [nm] - REAL(8), PARAMETER :: DNPF_NM = 3.0D+00 ! diameter of E&M(1997) new particles [nm] - REAL(8), PARAMETER :: DNU_NM = 3.0D+00 ! diameter of a new particle [nm] - REAL(8), PARAMETER :: RNU_NM = DNU_NM*0.5D+00 ! radius of a new particle [m] - REAL(8), PARAMETER :: DNU = DNU_NM*1.0D-09 ! diameter of a new particle [m] - REAL(8), PARAMETER :: VNU = PI6*DNU*DNU*DNU ! volume of a new particle [m^3] - !------------------------------------------------------------------------------------------------------------- - ! For conversion from 1-nm particles to DNU_NM-nm particles. - !------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: CONV_NUCL_TO_NPF = 1.0D+06 ! [#/cm^3/s] to [#/m^3/s] - & * DSTAR_NM * DSTAR_NM * DSTAR_NM / ( DNU_NM * DNU_NM * DNU_NM ) - !------------------------------------------------------------------------------------------------------------- - ! For conversion from DNPF_NM-nm particles to DNU_NM-nm particles. - !------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: CONV_EMNPF_TO_NPF = 1.0D+06 ! [#/cm^3/s] to [#/m^3/s] - & * DNPF_NM * DNPF_NM * DNPF_NM / ( DNU_NM * DNU_NM * DNU_NM ) - - !------------------------------------------------------------------------------------------------------------- - ! Limits on the nucleation rate applied to all parameterizations, - ! except that the upper limit is not applied to the Vehkamaki et al. 2002 - ! parameterization for binary H2SO4-H2O nucleation. - !------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: J_LOWER = 1.0D-07 ! [#/cm^3/s] - REAL(8), PARAMETER :: J_UPPER = 1.0D+07 ! [#/cm^3/s] - - !------------------------------------------------------------------------------------------------------------- - ! NPFMASS(I,N) is the sulfate mass [ugSO4] per new particle of volume VNU for I=NINT[RH(%)]. - ! - ! Particle composition is presently divided into three regimes: - ! (1) ammonium sulfate - second index set to 2 - ! (2) ammonium bisulfate - second index set to 1 - ! (3) sulfuric acid - second index set to 0 - !------------------------------------------------------------------------------------------------------------- - REAL(8), SAVE :: NPFMASS(0:100,0:2) ! [ugSO4/particle] - INTEGER, SAVE :: NPFMASS_REGIME = 2 ! second index to NPFMASS - CONTAINS - - - SUBROUTINE NPFRATE(PRS,RH,TEMP,XH2SO4,SO4RATE,XNH3,KC,DNDT,DMDT_SO4,ICALL) -!------------------------------------------------------------------------------------------------------------------- -! DLW 2006. -! Routine to calculate the rate of production of new particles and the -! corresponding rate of production of particulate sulfate mass. -!------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8), INTENT(IN) :: PRS ! pressure [Pa] - REAL(8), INTENT(IN) :: RH ! fractional relative humidity [1] - REAL(8), INTENT(IN) :: TEMP ! ambient temperature [K] - REAL(8), INTENT(IN) :: XH2SO4 ! sulfuric acid (as SO4) concentration [ugSO4/m^3] - REAL(8), INTENT(IN) :: SO4RATE ! gas-phase H2SO4 (as SO4) production rate [ugSO4/m^3 s] - REAL(8), INTENT(IN) :: XNH3 ! ammonia mixing ratio [ppmV] - REAL(8), INTENT(IN) :: KC ! condensational sink [1/s] - INTEGER, INTENT(IN) :: ICALL ! flag signalling type of call - - ! Output arguments. - - REAL(8), INTENT(OUT) :: DNDT ! particle number production rate [m^-3 s^-1] - REAL(8), INTENT(OUT) :: DMDT_SO4 ! SO4 mass production rate [ugSO4/m^3 s] - - ! Scratch local variables. - - REAL(8) :: JTOT ! total nucleation rate [cm^-3 s^-1] - REAL(8) :: JGAS ! homogeneous nucleation rate [cm^-3 s^-1] - REAL(8) :: JION ! ion-ion recombination nucleation rate [cm^-3 s^-1] - REAL(8) :: SO4MASS ! mass of SO4 per new particle [ugSO4] - REAL(8) :: H2SO4_TMP ! [H2SO4] scratch variable [molecules/cm^3] - REAL(8) :: NH3_TMP ! [NH3] scratch variable [ppt] - REAL(8) :: JP_TO_J ! ratio of the particle formation rate to the nucleation rate [1] - - !------------------------------------------------------------------------------------------------------------- - ! In the call to NUCLEATION_RATE, RH is converted to [%], the sulfuric - ! acid (SO4) concentration is converted from ugSO4/m^3 to molecules/cm^3, - ! and ammonia is converted from ppm to ppt. - !------------------------------------------------------------------------------------------------------------- - H2SO4_TMP = UGM3_NCM3 * MAX ( XH2SO4, 1.0D-30 ) ! [molecule/cm^3] - NH3_TMP = 1.0D+06 * MAX ( XNH3 , 1.0D-30 ) ! [ppt] - - CALL NUCLEATION_RATE( TEMP, 1.0D+02*RH, H2SO4_TMP, NH3_TMP, - & ZHEIGHT(ILAY), JTOT, JGAS, JION ) - - ! WRITE(78,*)'TEMP, 100.0D+00*RH, H2SO4_TMP, NH3_TMP, ZHEIGHT(ILAY), JTOT, JGAS, JION' - ! WRITE(78,*) TEMP, 100.0D+00*RH, H2SO4_TMP, NH3_TMP, ZHEIGHT(ILAY), JTOT, JGAS, JION - - !------------------------------------------------------------------------------------------------------------- - ! Convert the nucleation rate in [#/cm^3/s] into a new particle formation rate for - ! particles of diameter DNU_NM in [#/m^3/s]. - ! - ! There are two options, either the Kerminen and Kulmala (2002) parameterization, - ! simply reduce the nucleation rate based upon mass conservation as - ! 1-nm diameter particles to converted to particles at the selected size. - ! - ! If the Eisele and McMurry (1997) curves are used, the conversion is - ! from 3.0 nm (rather than 1 nm) to the selected size. - !------------------------------------------------------------------------------------------------------------- - IF( INUC.EQ.1 .OR. INUC.EQ.2 .OR. INUC.EQ.3 ) THEN - IF( KK02 ) THEN - CALL F_KK02( PRS, TEMP, 1.0D+02*RH, H2SO4_TMP, NH3_TMP, KC, DNU_NM, DSTAR_NM, JP_TO_J ) - DNDT = ( 1.0D+06 * JTOT ) * JP_TO_J ! Convert [#/cm^3/s] to [#/m^3/s]. - ELSE - DNDT = CONV_NUCL_TO_NPF * JTOT ! CONV_NUCL_TO_NPF includes the [#/cm^3/s] to [#/m^3/s] conversion. - ENDIF - ELSEIF( INUC.EQ.4 ) THEN ! Eisele and McMurry (1997) curves are used. - IF( KK02 ) THEN - CALL F_KK02( PRS, TEMP, 1.0D+02*RH, H2SO4_TMP, NH3_TMP, KC, DNU_NM, DNPF_NM, JP_TO_J ) - DNDT = ( 1.0D+06 * JTOT ) * JP_TO_J ! Convert [#/cm^3/s] to [#/m^3/s]. - ELSE - DNDT = CONV_EMNPF_TO_NPF * JTOT ! CONV_EMNPF_TO_NPF includes the [#/cm^3/s] to [#/m^3/s] conversion. - ENDIF - ENDIF - ! WRITE(34,'(A,4D13.5)')'IN NPFRATE: JTOT, JP_TO_J, DNDT, H2SO4 = ', JTOT, JP_TO_J, DNDT, H2SO4_TMP - - !------------------------------------------------------------------------------------------------------------- - ! Calculate mass production rate [ugSO4/m^3/s)], limited by the - ! production rate by the production rate of H2SO4. - ! Adjust the number production rate if necessary. - ! - ! NPFMASS(I,N) is the sulfate mass [ugSO4] per new particle of volume VNU for I=NINT[RH(%)]. - ! - ! Particle composition is presently divided into three regimes:--> - ! (1) ammonium sulfate --> second index set to 2 --> NPFMASS_REGIME = 2 - ! (2) ammonium bisulfate --> second index set to 1 --> NPFMASS_REGIME = 1 - ! (3) sulfuric acid --> second index set to 0 --> NPFMASS_REGIME = 0 - !------------------------------------------------------------------------------------------------------------- - SO4MASS = NPFMASS( NINT( 100.0D+00*RH ), NPFMASS_REGIME ) ! [ugSO4] - DMDT_SO4 = SO4MASS * DNDT ! [ugSO4/m^3/s] - IF( ICALL .GT. 0 ) RETURN ! do not impose mass limitation for this call - IF ( DMDT_SO4 .GT. SO4RATE ) THEN ! [ugSO4/m^3/s] - ! IF ( DMDT_SO4 .GT. 1.0D-10 ) WRITE(34,*)'NPFRATE MASS-LIMIT IMPOSED: DMDT_SO4, SO4RATE=',DMDT_SO4,SO4RATE - DMDT_SO4 = SO4RATE ! [ugSO4/m^3/s] - DNDT = DMDT_SO4 / SO4MASS ! [ # /m^3/s] - ENDIF - - RETURN - END SUBROUTINE NPFRATE - - - SUBROUTINE SETUP_NPFMASS -!------------------------------------------------------------------------------------------------------------------- -! DLW 2006. -! Routine to pre-calculate the SO4 mass in a single new particle as -! a function of RH and new particle volume, the array NPFMASS(0:100,0:2). -!------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I - REAL(8) :: H, XI_KE_SULFATE, XI_KE_H2SO4 - !------------------------------------------------------------------------------------------------------------- - ! CONV_V_TO_SO4_XXX is the mass of sulfate (MW=96g/mol) in [ugSO4] for either XXX=SULFATE or XXX=H2SO4. - ! in a dry particle of volume VNU [m^3]. Checked on 7-27-06. - ! In CONV_V_TO_SO4, the 1.0D+12 converts [gSO4/cm^3] to [ugSO4/m^3]. - ! - ! RHC_NH42SO4_RNU_NM is the crystallization RH for a 5-nm (radius) dry particle (E. Lewis). - !------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: CONV_V_TO_SO4_SULFATE = RHO_NH42SO4 * 1.0D+12 * MW_SO4 / MW_NH42SO4 - REAL(8), PARAMETER :: CONV_V_TO_SO4_H2SO4 = RHO_H2SO4 * 1.0D+12 * MW_SO4 / MW_H2SO4 - REAL(8), PARAMETER :: RHC_NH42SO4_DNU_03NM = 0.00D+00 - REAL(8), PARAMETER :: RHC_NH42SO4_DNU_10NM = 0.50D+00 - REAL(8), PARAMETER :: RHC_NH42SO4_DNU_20NM = 0.50D+00 - REAL(8), PARAMETER :: RHC_H2SO4_DNU_03NM = 0.10D+00 - REAL(8), PARAMETER :: RHC_H2SO4_DNU_10NM = 0.05D+00 - REAL(8), PARAMETER :: RHC_H2SO4_DNU_20NM = 0.05D+00 - - !------------------------------------------------------------------------------------------------------------- - ! NPFMASS(I,J) is the sulfate mass [ugSO4] per new particle of volume VNU for I=NINT[RH(%)]. - ! - ! Particle composition is presently divided into three regimes: - ! (1) ammonium sulfate - second index J = 2 - ! (2) ammonium bisulfate - second index J = 1 - ! (3) sulfuric acid - second index J = 0 - ! - ! The Kelvin Effect is taken into account. - ! - ! XI_KE is the radius ratio r_ambient/r_dry, including the Kelvin effect, and is used to convert - ! ambient particle volume to dry particle volume. - ! - ! CONV_V_TO_SO4 converts dry volume ammonium sulfate [m^3] to dry mass sulfate (MW=96g/mol) [ugSO4]. - !------------------------------------------------------------------------------------------------------------- - IF( WRITE_LOG ) WRITE(AUNIT1,90) - DO I=0, 100 - H = MIN( 1.0D-02 * DBLE(I), 0.999D+00 ) - !----------------------------------------------------------------------------------------------------------- - ! Ammonium sulfate. - ! Ammonium bisulfate. The sulfate value is also used because of lack of data for bisulfate solutions. - !----------------------------------------------------------------------------------------------------------- - IF ( DNU_NM .EQ. 3.0D+00 ) THEN - IF ( H .GE. RHC_NH42SO4_DNU_03NM ) THEN ! The particle is wet. - XI_KE_SULFATE = 1.0D+00 + 0.2D+00*H ! Linear fit over the entire RH range. - ELSE - XI_KE_SULFATE = 1.0D+00 + 0.2D+00*H ! Linear fit over the entire RH range. - ENDIF - ELSEIF( DNU_NM .EQ. 10.0D+00 ) THEN - IF ( H .GE. RHC_NH42SO4_DNU_10NM ) THEN ! The particle is wet. - XI_KE_SULFATE = 0.677D+00 + H*(1.816D+00 + H*( -2.345D+00 + H*1.296D+00 ) ) - ELSE ! The particle is dry. - XI_KE_SULFATE = 1.0D+00 + 0.16075D+00*(H/RHC_NH42SO4_DNU_10NM) - ENDIF - ELSEIF( DNU_NM .EQ. 20.0D+00 ) THEN - IF ( H .GE. RHC_NH42SO4_DNU_20NM ) THEN ! The particle is wet. - XI_KE_SULFATE = 0.175D+00 + H*(4.532D+00 + H*( -6.894D+00 + H*3.856D+00 ) ) - ELSE ! The particle is dry. - XI_KE_SULFATE = 1.0D+00 + 0.1995D+00*(H/RHC_NH42SO4_DNU_20NM) - ENDIF - ELSE - WRITE(*,*)'Bad value of DNU_NM in subr. SETUP_NPFMASS: DNU_NM = ', DNU_NM - STOP - ENDIF - NPFMASS(I,2) = ( VNU / XI_KE_SULFATE**3 ) * CONV_V_TO_SO4_SULFATE - NPFMASS(I,1) = NPFMASS(I,2) - !----------------------------------------------------------------------------------------------------------- - ! Sulfuric acid. - !----------------------------------------------------------------------------------------------------------- - IF ( DNU_NM .EQ. 3.0D+00 ) THEN - IF ( H .GE. RHC_H2SO4_DNU_03NM ) THEN - XI_KE_H2SO4 = 1.14D+00 + H*(0.464D+00 + H*( -0.336D+00 + H*0.189D+00 ) ) - ELSE - XI_KE_H2SO4 = 1.0D+00 + 0.179D+00*(H/RHC_H2SO4_DNU_03NM) ! Linear fit over this range. - ENDIF - ELSEIF( DNU_NM .EQ. 10.0D+00 ) THEN - IF ( H .GE. RHC_H2SO4_DNU_10NM ) THEN - XI_KE_H2SO4 = 1.14D+00 + H*(0.765D+00 + H*( -0.850D+00 + H*0.745D+00 ) ) - ELSE - XI_KE_H2SO4 = 1.0D+00 + 0.211D+00*(H/RHC_H2SO4_DNU_10NM) ! Linear fit over this range. - ENDIF - ELSEIF( DNU_NM .EQ. 20.0D+00 ) THEN - IF ( H .GE. RHC_H2SO4_DNU_20NM ) THEN - XI_KE_H2SO4 = 1.113D+00 + H*(1.190D+00 + H*( -2.001D+00 + H*1.750D+00 ) ) - ELSE - XI_KE_H2SO4 = 1.0D+00 + 0.168D+00*(H/RHC_H2SO4_DNU_20NM) ! Linear fit over this range. - ENDIF - ELSE - WRITE(*,*)'Bad value of DNU_NM in subr. SETUP_NPFMASS: DNU_NM = ', DNU_NM - STOP - ENDIF - NPFMASS(I,0) = ( VNU / XI_KE_H2SO4**3 ) * CONV_V_TO_SO4_H2SO4 - ! IF( WRITE_LOG ) WRITE(AUNIT1,'(I6,2F25.6,3D15.6)') I, XI_KE_H2SO4, XI_KE_SULFATE, NPFMASS(I,0:2) - ENDDO - -90 FORMAT(/,' RH[%]',' R_ambient/R_dry[H2SO4]',' R_ambient/R_dry[SULFATE]', - & ' NPFMASS(I,0:2)[ugSO4]') - RETURN - END SUBROUTINE SETUP_NPFMASS - - - SUBROUTINE NUCLEATION_RATE (T,RH,NA,MB,Z,JTOT,JGAS,JION) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8), INTENT( IN ) :: T ! temperature [K] - REAL(8), INTENT( IN ) :: RH ! relative humidity [%] - REAL(8), INTENT( IN ) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8), INTENT( IN ) :: MB ! NH3 concentration [ppt] - REAL(8), INTENT( IN ) :: Z ! height above the Earth's surface [km] - - ! Output arguments. - - REAL(8) :: JGAS ! homogeneous nucleation rate [#/cm^3/s] - REAL(8) :: JION ! ion-ion nucleation rate [#/cm^3/s] - REAL(8) :: JTOT ! total nucleation rate [#/cm^3/s] - - - SELECT CASE (INUC) - - CASE (1) ! INUC=1: JVM BINARY NUCLEATION SCHEME - - CALL NUCL_JVM (NA,T,RH,JGAS) - - CASE (2) ! INUC=2: VEHKAMAKI BINARY NUCLEATION SCHEME - - CALL NUCL_VEHKAMAKI(NA,T,RH,JGAS) - - CASE (3) ! INUC=3: NAPARI TERNARY NUCLEATION SCHEME - - IF(MB.LT.0.1D+00) THEN - CALL NUCL_VEHKAMAKI(NA,T,RH,JGAS) - ELSE - CALL NUCL_NAPARI(NA,MB,T,RH,JGAS) - ENDIF - - CASE (4) ! INUC=4: Lines from plots in Eisele and McMurry, 1997. - - CALL NUCL_EISELE_MCMURRY(NA,JGAS) - - END SELECT - - IF ( INCLUDE_ION_ION ) THEN - CALL NUCL_TURCO (NA,Z,JION) ! ION-ION RECOMBINATION SCHEME - ELSE - JION = 0.0D+00 - ENDIF - - IF( INUC.EQ.1 .OR. INUC.EQ.3 .OR. INUC.EQ.4 ) THEN - JTOT = MIN( MAX( JGAS+JION, J_LOWER ), J_UPPER ) - ELSEIF( INUC.EQ.2 ) THEN ! Higher upper limit for Vehkamaki et al. 2002 - JTOT = MIN( MAX( JGAS+JION, J_LOWER ), 1.0D+10 ) - ENDIF - - RETURN - END SUBROUTINE NUCLEATION_RATE - - - SUBROUTINE NUCL_NAPARI(NA,MB,T,RH,J) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8) :: MB ! NH3 concentration [ppt] - REAL(8) :: T ! temperature [K] - REAL(8) :: RH ! relative humidity [%] - - ! Output arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Local variables. - - LOGICAL :: VALID_INPUT - - ! Parameters. - - REAL(8), PARAMETER :: PI = 3.141592653589793D+00 - REAL(8), PARAMETER :: AVO = 6.0221367D+23 - REAL(8), PARAMETER :: MWH2SO4 = 98.07948D+00 - REAL(8), PARAMETER :: MWNH3 = 17.03356D+00 - REAL(8), PARAMETER :: MWH2O = 18.01528D+00 - - MB = MIN ( MB, 1.00D+02 ) ! Cap at the maximum value for which the parameterization is valid. - NA = MIN ( NA, 1.00D+09 ) ! Cap at the maximum value for which the parameterization is valid. - - ! Check the conditions of validity for input parameters. - - VALID_INPUT = .TRUE. - IF ( T .LT. 240.00D+00 .OR. T .GT. 300.00D+00 ) THEN - VALID_INPUT = .FALSE. - ELSEIF ( RH .LT. 0.50D+00 .OR. RH .GT. 95.00D+00 ) THEN - VALID_INPUT = .FALSE. - ELSEIF ( NA .LT. 1.00D+04 .OR. NA .GT. 1.00D+09 ) THEN ! Upper limit should have no effect. - VALID_INPUT = .FALSE. - ELSEIF ( MB .LT. 1.00D-01 .OR. MB .GT. 1.00D+02 ) THEN ! Upper limit should have no effect. - VALID_INPUT = .FALSE. - ENDIF - - IF ( .NOT. VALID_INPUT ) THEN - J = J_LOWER - RETURN - ENDIF - - J = J_NAPARI(NA,MB,T,RH) - IF ( J .LT. 1.0D-05 ) THEN - J = J_LOWER - RETURN - ELSEIF ( J .GT. 1.0D+06 ) THEN - J = J_UPPER - RETURN - ENDIF - - RETURN - END SUBROUTINE NUCL_NAPARI - - - REAL(8) FUNCTION NH2SO4_NAPARI(J,T) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - REAL(8) :: T ! K - - ! Scratch local variables. - - REAL(8) :: LNJ - - LNJ = LOG ( J ) - - NH2SO4_NAPARI = 38.1645D+00 + 0.77410D+00*LNJ + - & 0.00298879D+00*LNJ*LNJ-0.357605D+00*T - - & 0.00366358D+00*T*LNJ + 0.0008553D+00*T*T - NH2SO4_NAPARI = MAX (NH2SO4_NAPARI, 1.0D-30) - - RETURN - END FUNCTION NH2SO4_NAPARI - - - REAL(8) FUNCTION NNH3_NAPARI(J,T) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - REAL(8) :: T ! K - - ! Scratch local variables. - - REAL(8) :: LNJ - - LNJ = LOG ( J ) - - NNH3_NAPARI = 26.8982D+00 + 0.682905D+00*LNJ + - & 0.0035752D+00*LNJ*LNJ -0.265748D+00*T - - & 0.00341895D+00*T*LNJ + 0.000673454D+00*T*T - NNH3_NAPARI = MAX (NNH3_NAPARI, 1.0D-30) - - RETURN - END FUNCTION NNH3_NAPARI - - - REAL(8) FUNCTION NTOT_NAPARI(J,T) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: T ! [K] - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Scratch local variables. - - REAL(8),PARAMETER :: A = 79.3484D+00 ! Coefficients - REAL(8),PARAMETER :: B = 1.7384D+00 ! Coefficients - REAL(8),PARAMETER :: C = 0.00711403D+00 ! Coefficients - REAL(8),PARAMETER :: D = -0.74493D+00 ! Coefficients - REAL(8),PARAMETER :: E = -0.008202608D+00 ! Coefficients - REAL(8),PARAMETER :: F = 0.0017855D+00 ! Coefficients - REAL(8) :: LNJ - - LNJ = LOG ( J ) - - NTOT_NAPARI = A + B*LNJ + C*LNJ*LNJ + D*T + E*T*LNJ + F*T*T - NTOT_NAPARI = MAX (NTOT_NAPARI, 1.0D-30) - - RETURN - END FUNCTION NTOT_NAPARI - - - REAL(8) FUNCTION RSTAR_NAPARI(J,T) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: T ! temperature [K] - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Scratch local variables. - REAL(8) :: LNJ - - LNJ = LOG(J) - RSTAR_NAPARI = 0.141027D+00 - 0.00122625D+00*LNJ - - & 7.82211D-06*LNJ*LNJ - 0.00156727D+00*T - - & 0.00003076D+00*T*LNJ + 0.0000108375D+00*T*T - - RETURN - END FUNCTION RSTAR_NAPARI - - - REAL(8) FUNCTION J_NAPARI(NA,MB,T,RH) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NA ! [molecules/cm^3] - REAL(8) :: T ! [K] - REAL(8) :: RH ! [%] - REAL(8) :: MB ! [ppt] - - ! Scratch local variables. - - REAL(8) :: X,Y,EX,RY,Z,W,LNJ - REAL(8), DIMENSION(20) :: F - INTEGER :: J - - ! Parameters. - - REAL(8), DIMENSION(20,0:3) :: A - - DATA A( 1,0:3)/ -0.355297000D+00, -0.338449000D+02, 0.345360000D+00, -0.824007000D-03/ - DATA A( 2,0:3)/ 0.313735000D+01, -0.772861000D+00, 0.561204000D-02, -0.974576000D-05/ - DATA A( 3,0:3)/ 0.190359000D+02, -0.170957000D+00, 0.479808000D-03, -0.414699000D-06/ - DATA A( 4,0:3)/ 0.107605000D+01, 0.148932000D+01, -0.796052000D-02, 0.761229000D-05/ - DATA A( 5,0:3)/ 0.609160000D+01, -0.125378000D+01, 0.939836000D-02, -0.174927000D-04/ - DATA A( 6,0:3)/ 0.311760000D+00, 0.164009000D+01, -0.343852000D-02, -0.109753000D-04/ - DATA A( 7,0:3)/ -0.200738000D-01, -0.752115000D+00, 0.525813000D-02, -0.898038000D-05/ - DATA A( 8,0:3)/ 0.165536000D+00, 0.326623000D+01, -0.489703000D-01, 0.146967000D-03/ - DATA A( 9,0:3)/ 0.652645000D+01, -0.258002000D+00, 0.143456000D-02, -0.202036000D-05/ - DATA A(10,0:3)/ 0.368024000D+01, -0.204098000D+00, 0.106259000D-02, -0.126560000D-05/ - DATA A(11,0:3)/ -0.665140000D-01, -0.782382000D+01, 0.122938000D-01, 0.618554000D-04/ - DATA A(12,0:3)/ 0.658740000D+00, 0.190542000D+00, -0.165718000D-02, 0.341744000D-05/ - DATA A(13,0:3)/ 0.599321000D-01, 0.596475000D+01, -0.362432000D-01, 0.493370000D-04/ - DATA A(14,0:3)/ -0.732731000D+00, -0.184179000D-01, 0.147186000D-03, -0.237711000D-06/ - DATA A(15,0:3)/ 0.728429000D+00, 0.364736000D+01, -0.274220000D-01, 0.493478000D-04/ - DATA A(16,0:3)/ 0.413016000D+02, -0.357520000D+00, 0.904383000D-03, -0.573788000D-06/ - DATA A(17,0:3)/ -0.160336000D+00, 0.889881000D-02, -0.539514000D-04, 0.839522000D-07/ - DATA A(18,0:3)/ 0.857868000D+01, -0.112358000D+00, 0.472626000D-03, -0.648365000D-06/ - DATA A(19,0:3)/ 0.530167000D-01, -0.198815000D+01, 0.157827000D-01, -0.293564000D-04/ - DATA A(20,0:3)/ -0.232736000D+01, 0.234646000D-01, -0.765190000D-04, 0.804590000D-07/ - - ! Statement function. - - REAL(8) :: Z0,Z1,Z2,Z3,ZT - Z(Z0,Z1,Z2,Z3,ZT) = Z0 + Z1*ZT + Z2*ZT*ZT + Z3*ZT*ZT*ZT - - X = LOG ( RH * 0.01D+00 ) - EX = RH * 0.01D+00 - Y = LOG ( NA ) - RY = 1.00D+00/Y - W = LOG ( MB ) - - DO J=1,20 - F(J) = Z(A(J,0),A(J,1),A(J,2),A(J,3),T) - ENDDO - - LNJ= -84.7551D+00 + F(1)*RY + F(2)*Y + F(3)*Y*Y + F(4)*W - & + F(5)*W*W + F(6)*EX + F(7)*X + F(8)*W*RY - & + F(9)*W*Y + F(10)*EX*Y + F(11)*EX*RY - & + F(12)*EX*W + F(13)*X*RY + F(14)*X*W - & + F(15)*W*W*RY + F(16)*Y*W*W + F(17)*Y*Y*W - & + F(18)*EX*W*W + F(19)*EX*W*RY + F(20)*Y*Y*W*W - - J_NAPARI = EXP ( LNJ ) - - RETURN - END FUNCTION J_NAPARI - - - SUBROUTINE NUCL_VEHKAMAKI(NA,T,RH,J) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -! DLW:062005: Created and checked for J value for 82 points in -! Vehkamaki et al. 2002. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8) :: T ! temperature [K] - REAL(8) :: RH ! relative humidity [%] - - ! Output arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Local variables. - - REAL(8) :: X ! mole fraction H2SO4 - REAL(8) :: N ! number of molecules in the critical nucleus - LOGICAL :: VALID_INPUT - - ! Parameters. - - REAL(8), PARAMETER :: PI = 3.141592653589793D+00 - REAL(8), PARAMETER :: AVO = 6.0221367D+23 - REAL(8), PARAMETER :: MWH2SO4 = 98.07948D+00 - REAL(8), PARAMETER :: MWH2O = 18.01528D+00 - - - ! Check for conditions of validity for input parameters. - - NA = MIN ( NA, 1.00D+11 ) ! Cap at the maximum value valid for the parameterization. - - VALID_INPUT = .TRUE. - IF ( T .LT. 190.00D+00 .OR. T .GT. 305.15D+00 ) THEN - VALID_INPUT = .FALSE. - ELSEIF ( RH .LT. 0.01D+00 .OR. RH .GT. 100.000001D+00 ) THEN - VALID_INPUT = .FALSE. - ELSEIF ( NA .LT. 1.00D+04 .OR. NA .GT. 1.00D+11 ) THEN ! Upper limit should have no effect. - VALID_INPUT = .FALSE. - ENDIF - IF ( .NOT. VALID_INPUT ) THEN - J = J_LOWER - RETURN - ENDIF - - X = XSTAR_VEHKAMAKI(NA,T,RH) - - J = J_VEHKAMAKI(NA,T,RH,X) - IF ( J .LT. 1.0D-07 ) THEN - J = J_LOWER - RETURN - ELSEIF ( J .GT. 1.0D+10 ) THEN - J = 1.0D+10 ! Maximum value valid for this parameterization. - RETURN - ENDIF - - ! Properties of the critical nucleus. - - N = NTOT_VEHKAMAKI(NA,T,RH,X) - IF ( N .LT. 4.0D+00 ) THEN ! Check for condition on NTOT. - J = J_LOWER - RETURN - ENDIF - - RETURN - END SUBROUTINE NUCL_VEHKAMAKI - - - REAL(8) FUNCTION XSTAR_VEHKAMAKI(NA,T,RH) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NA ! molecules/cm^3 - REAL(8) :: T ! K - REAL(8) :: RH ! % - - ! Scratch local variables. - - REAL(8) :: X - - X = LOG ( RH * 0.01D+00 ) - - XSTAR_VEHKAMAKI = 0.740997D+00 - 0.00266379D+00 *T - & + ( 0.0000504022D+00*T - 0.00349998D+00 ) * LOG ( NA ) - & + ( 0.00201048D+00 - 0.000183289D+00 *T ) * X - & + ( 0.00157407D+00 - 0.0000179059D+00 *T ) * X*X - & + ( 0.000184403D+00 - 1.50345D-06 *T ) * X**3 - - RETURN - END FUNCTION XSTAR_VEHKAMAKI - - - REAL(8) FUNCTION NTOT_VEHKAMAKI(NA,T,RH,XS) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NA ! [molecules/cm^3] - REAL(8) :: T ! [K] - REAL(8) :: RH ! [%] - REAL(8) :: XS ! mole fraction H2SO4 in the critical nucleus - - ! Scratch local variables. - - REAL(8) :: A,B,C,D,E,F,G,H,I,J ! Coefficients - REAL(8) :: X,Y,RX - - ! Parameters. - - REAL(8), PARAMETER :: A1 = - 0.00295413D+00 - REAL(8), PARAMETER :: A2 = - 0.0976834D+00 - REAL(8), PARAMETER :: A3 = + 0.00102485D+00 - REAL(8), PARAMETER :: A4 = - 2.18646D-06 - REAL(8), PARAMETER :: A5 = - 0.101717D+00 - - REAL(8), PARAMETER :: B1 = - 0.00205064D+00 - REAL(8), PARAMETER :: B2 = - 0.00758504D+00 - REAL(8), PARAMETER :: B3 = + 0.000192654D+00 - REAL(8), PARAMETER :: B4 = - 6.7043D-07 - REAL(8), PARAMETER :: B5 = - 0.255774D+00 - - REAL(8), PARAMETER :: C1 = + 0.00322308D+00 - REAL(8), PARAMETER :: C2 = + 0.000852637D+00 - REAL(8), PARAMETER :: C3 = - 0.0000154757D+00 - REAL(8), PARAMETER :: C4 = + 5.66661D-08 - REAL(8), PARAMETER :: C5 = + 0.0338444D+00 - - REAL(8), PARAMETER :: D1 = + 0.0474323D+00 - REAL(8), PARAMETER :: D2 = - 0.000625104D+00 - REAL(8), PARAMETER :: D3 = + 2.65066D-06 - REAL(8), PARAMETER :: D4 = - 3.67471D-09 - REAL(8), PARAMETER :: D5 = - 0.000267251D+00 - - REAL(8), PARAMETER :: E1 = - 0.0125211D+00 - REAL(8), PARAMETER :: E2 = + 0.00580655D+00 - REAL(8), PARAMETER :: E3 = - 0.000101674D+00 - REAL(8), PARAMETER :: E4 = + 2.88195D-07 - REAL(8), PARAMETER :: E5 = + 0.0942243D+00 - - REAL(8), PARAMETER :: F1 = - 0.038546D+00 - REAL(8), PARAMETER :: F2 = - 0.000672316D+00 - REAL(8), PARAMETER :: F3 = + 2.60288D-06 - REAL(8), PARAMETER :: F4 = + 1.19416D-08 - REAL(8), PARAMETER :: F5 = - 0.00851515D+00 - - REAL(8), PARAMETER :: G1 = - 0.0183749D+00 - REAL(8), PARAMETER :: G2 = + 0.000172072D+00 - REAL(8), PARAMETER :: G3 = - 3.71766D-07 - REAL(8), PARAMETER :: G4 = - 5.14875D-10 - REAL(8), PARAMETER :: G5 = + 0.00026866D+00 - - REAL(8), PARAMETER :: H1 = - 0.0619974D+00 - REAL(8), PARAMETER :: H2 = + 0.000906958D+00 - REAL(8), PARAMETER :: H3 = - 9.11728D-07 - REAL(8), PARAMETER :: H4 = - 5.36796D-09 - REAL(8), PARAMETER :: H5 = - 0.00774234D+00 - - REAL(8), PARAMETER :: I1 = + 0.0121827D+00 - REAL(8), PARAMETER :: I2 = - 0.00010655D+00 - REAL(8), PARAMETER :: I3 = + 2.5346D-07 - REAL(8), PARAMETER :: I4 = - 3.63519D-10 - REAL(8), PARAMETER :: I5 = + 0.000610065D+00 - - REAL(8), PARAMETER :: J1 = + 0.000320184D+00 - REAL(8), PARAMETER :: J2 = - 0.0000174762D+00 - REAL(8), PARAMETER :: J3 = + 6.06504D-08 - REAL(8), PARAMETER :: J4 = - 1.42177D-11 - REAL(8), PARAMETER :: J5 = + 0.000135751D+00 - - ! Statement function. - - REAL(8) :: Z - REAL(8) :: Z1,Z2,Z3,Z4,Z5,ZT,ZX - Z(Z1,Z2,Z3,Z4,Z5,ZT,ZX) = Z1 + Z2*ZT + Z3*ZT*ZT + Z4*ZT**3 + Z5*ZX - - RX = 1.0D+00/XS - X = LOG ( RH * 0.01D+00 ) - Y = LOG ( NA ) - - A = Z(A1,A2,A3,A4,A5,T,RX) - B = Z(B1,B2,B3,B4,B5,T,RX) - C = Z(C1,C2,C3,C4,C5,T,RX) - D = Z(D1,D2,D3,D4,D5,T,RX) - E = Z(E1,E2,E3,E4,E5,T,RX) - F = Z(F1,F2,F3,F4,F5,T,RX) - G = Z(G1,G2,G3,G4,G5,T,RX) - H = Z(H1,H2,H3,H4,H5,T,RX) - I = Z(I1,I2,I3,I4,I5,T,RX) - J = Z(J1,J2,J3,J4,J5,T,RX) - - NTOT_VEHKAMAKI = EXP ( A + B*X + C*X*X + D*X**3 + E*Y + F*X*Y + - & G*X*X*Y + H*Y*Y + I*X*Y*Y + J*Y**3 ) - - RETURN - END FUNCTION NTOT_VEHKAMAKI - - - REAL(8) FUNCTION RSTAR_VEHKAMAKI(XS,NTOT) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NTOT ! # molecules in the critical nucleus - REAL(8) :: XS ! mole fraction H2SO4 - - RSTAR_VEHKAMAKI = EXP( -1.6524245D+00 + 0.42316402D+00*XS - & + 0.3346648D+00*LOG( NTOT ) ) - - RETURN - END FUNCTION RSTAR_VEHKAMAKI - - - REAL(8) FUNCTION J_VEHKAMAKI(NA,T,RH,XS) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NA ! [molecules/cm^3] - REAL(8) :: T ! [K] - REAL(8) :: RH ! [%] - REAL(8) :: XS ! mole fraction H2SO4 in the critical nucleus - - ! Scratch local variables. - - REAL(8) :: A,B,C,D,E,F,G,H,I,J ! Coefficients - REAL(8) :: X,Y,RX - - ! Parameters. - - REAL(8), PARAMETER :: A1 = + 0.14309D+00 - REAL(8), PARAMETER :: A2 = + 2.21956D+00 - REAL(8), PARAMETER :: A3 = - 0.0273911D+00 - REAL(8), PARAMETER :: A4 = + 0.0000722811D+00 - REAL(8), PARAMETER :: A5 = + 5.91822D+00 - - REAL(8), PARAMETER :: B1 = + 0.117489D+00 - REAL(8), PARAMETER :: B2 = + 0.462532D+00 - REAL(8), PARAMETER :: B3 = - 0.0118059D+00 - REAL(8), PARAMETER :: B4 = + 0.0000404196D+00 - REAL(8), PARAMETER :: B5 = + 15.7963D+00 - - REAL(8), PARAMETER :: C1 = - 0.215554D+00 - REAL(8), PARAMETER :: C2 = - 0.0810269D+00 - REAL(8), PARAMETER :: C3 = + 0.00143581D+00 - REAL(8), PARAMETER :: C4 = - 4.7758D-06 - REAL(8), PARAMETER :: C5 = - 2.91297D+00 - - REAL(8), PARAMETER :: D1 = - 3.58856D+00 - REAL(8), PARAMETER :: D2 = + 0.049508D+00 - REAL(8), PARAMETER :: D3 = - 0.00021382D+00 - REAL(8), PARAMETER :: D4 = + 3.10801D-07 - REAL(8), PARAMETER :: D5 = - 0.0293333D+00 - - REAL(8), PARAMETER :: E1 = + 1.14598D+00 - REAL(8), PARAMETER :: E2 = - 0.600796D+00 - REAL(8), PARAMETER :: E3 = + 0.00864245D+00 - REAL(8), PARAMETER :: E4 = - 0.0000228947D+00 - REAL(8), PARAMETER :: E5 = - 8.44985D+00 - - REAL(8), PARAMETER :: F1 = + 2.15855D+00 - REAL(8), PARAMETER :: F2 = + 0.0808121D+00 - REAL(8), PARAMETER :: F3 = - 0.000407382D+00 - REAL(8), PARAMETER :: F4 = - 4.01957D-07 - REAL(8), PARAMETER :: F5 = + 0.721326D+00 - - REAL(8), PARAMETER :: G1 = + 1.6241D+00 - REAL(8), PARAMETER :: G2 = - 0.0160106D+00 - REAL(8), PARAMETER :: G3 = + 0.0000377124D+00 - REAL(8), PARAMETER :: G4 = + 3.21794D-08 - REAL(8), PARAMETER :: G5 = - 0.0113255D+00 - - REAL(8), PARAMETER :: H1 = + 9.71682D+00 - REAL(8), PARAMETER :: H2 = - 0.115048D+00 - REAL(8), PARAMETER :: H3 = + 0.000157098D+00 - REAL(8), PARAMETER :: H4 = + 4.00914D-07 - REAL(8), PARAMETER :: H5 = + 0.71186D+00 - - REAL(8), PARAMETER :: I1 = - 1.05611D+00 - REAL(8), PARAMETER :: I2 = + 0.00903378D+00 - REAL(8), PARAMETER :: I3 = - 0.0000198417D+00 - REAL(8), PARAMETER :: I4 = + 2.46048D-08 - REAL(8), PARAMETER :: I5 = - 0.0579087D+00 - - REAL(8), PARAMETER :: J1 = - 0.148712D+00 - REAL(8), PARAMETER :: J2 = + 0.00283508D+00 - REAL(8), PARAMETER :: J3 = - 9.24619D-06 - REAL(8), PARAMETER :: J4 = + 5.00427D-09 - REAL(8), PARAMETER :: J5 = - 0.0127081D+00 - - ! Statement function. - - REAL(8) :: Z - REAL(8) :: Z1,Z2,Z3,Z4,Z5,ZT,ZX - Z(Z1,Z2,Z3,Z4,Z5,ZT,ZX) = Z1 + Z2*ZT + Z3*ZT*ZT + Z4*ZT**3 + Z5*ZX - - RX = 1.0D+00/XS - X = LOG ( RH * 0.01D+00 ) - Y = LOG ( NA ) - - A = Z(A1,A2,A3,A4,A5,T,RX) - B = Z(B1,B2,B3,B4,B5,T,RX) - C = Z(C1,C2,C3,C4,C5,T,RX) - D = Z(D1,D2,D3,D4,D5,T,RX) - E = Z(E1,E2,E3,E4,E5,T,RX) - F = Z(F1,F2,F3,F4,F5,T,RX) - G = Z(G1,G2,G3,G4,G5,T,RX) - H = Z(H1,H2,H3,H4,H5,T,RX) - I = Z(I1,I2,I3,I4,I5,T,RX) - J = Z(J1,J2,J3,J4,J5,T,RX) - - J_VEHKAMAKI = EXP ( A + B*X + C*X*X + D*X**3 + E*Y + F*X*Y + - & G*X*X*Y + H*Y*Y + I*X*Y*Y + J*Y**3 ) - - RETURN - END FUNCTION J_VEHKAMAKI - - - SUBROUTINE NUCL_JVM(NA,T,RH,J) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8) :: T ! temperature [K] - REAL(8) :: RH ! relative humidity [%] - - ! Output arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Local variables. - - REAL(8), DIMENSION(0:2) :: B ! coefficient of fitted curve function - LOGICAL :: VALID_INPUT - REAL(8) :: LOG10J, XX, XLOG10NA - - NA = MIN ( NA, 1.00D+14 ) - - ! Check for conditions of validity for input parameters. - - CALL JVM_COEF (T,RH,B) - - XX = -B(1) / (2.0D+00 * B(2)) - XLOG10NA = LOG10(NA) - - VALID_INPUT = .TRUE. - IF(XLOG10NA .GT. XX) THEN - VALID_INPUT = .FALSE. - ELSEIF ( NA .LT. 1.00D+04 .OR. NA .GT. 1.00D+14 ) THEN ! Upper limit should have no effect. - VALID_INPUT = .FALSE. - ENDIF - - IF ( .NOT. VALID_INPUT ) THEN - J = J_LOWER - RETURN - ENDIF - - ! Calculate the nucleation rate. - - LOG10J = B(0) + B(1)*XLOG10NA + B(2)*XLOG10NA*XLOG10NA - - J = 10.0**( LOG10J ) - - IF ( J .LT. 1.0D-03 ) THEN - J = J_LOWER - RETURN - ELSEIF ( J .GT. 1.0D+05 ) THEN - J = J_UPPER - RETURN - ENDIF - - RETURN - END SUBROUTINE NUCL_JVM - - - SUBROUTINE JVM_COEF(T,RH,B) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input Arguments. - - REAL(8) :: T ! [K] - REAL(8) :: RH ! [%] - - ! Output Arguments. - - REAL(8), DIMENSION(0:2) :: B - - ! Scratch local variables. - - REAL(8) :: X,Y,Z - REAL(8), DIMENSION(0:4) :: BB0,BB1,BB2 - - ! Parameters. - - REAL(8), DIMENSION(0:4,0:4) :: C0,C1,C2 - INTEGER :: J - - DATA C0(0,0:4)/ -0.493166930D+03, -0.746060630D+03, 0.427001110D+04, 0.403205190D+04, -0.103305460D+05/ - DATA C0(1,0:4)/ 0.227147650D+04, 0.296173760D+04, -0.345957800D+05, -0.435346380D+05, 0.583845900D+05/ - DATA C0(2,0:4)/ -0.596070430D+04, -0.921088590D+04, 0.919397290D+05, 0.131516870D+06, -0.130410870D+06/ - DATA C0(3,0:4)/ 0.673050820D+04, 0.112160080D+05, -0.101584900D+06, -0.151340760D+06, 0.133574610D+06/ - DATA C0(4,0:4)/ -0.261458200D+04, -0.444305610D+04, 0.394068830D+05, 0.594771880D+05, -0.496408160D+05/ - DATA C1(0,0:4)/ 0.100665720D+03, 0.108313420D+03, -0.113683880D+04, -0.888430520D+03, 0.302914500D+04/ - DATA C1(1,0:4)/ -0.504046310D+03, -0.474794750D+03, 0.904264540D+04, 0.909745930D+04, -0.201185820D+05/ - DATA C1(2,0:4)/ 0.137492990D+04, 0.161927870D+04, -0.243558850D+05, -0.269705410D+05, 0.498079760D+05/ - DATA C1(3,0:4)/ -0.156449310D+04, -0.200427440D+04, 0.270531380D+05, 0.307133920D+05, -0.531638600D+05/ - DATA C1(4,0:4)/ 0.604879820D+03, 0.788620250D+03, -0.104754690D+05, -0.119805370D+05, 0.200426110D+05/ - DATA C2(0,0:4)/ -0.516074080D+01, -0.398706400D+01, 0.720177880D+02, 0.509391250D+02, -0.211700440D+03/ - DATA C2(1,0:4)/ 0.284462970D+02, 0.212336580D+02, -0.573120500D+03, -0.497927540D+03, 0.152757040D+04/ - DATA C2(2,0:4)/ -0.795352710D+02, -0.764306230D+02, 0.155886490D+04, 0.143625300D+04, -0.392583270D+04/ - DATA C2(3,0:4)/ 0.904137910D+02, 0.939499970D+02, -0.173349330D+04, -0.160777790D+04, 0.422689150D+04/ - DATA C2(4,0:4)/ -0.345602640D+02, -0.362758330D+02, 0.667993290D+03, 0.619425480D+03, -0.159032770D+04/ - - ! Statement function. - - REAL(8) :: Z0,Z1,Z2,Z3,Z4,V - Z(Z0,Z1,Z2,Z3,Z4,V) = Z0+Z1*V+Z2*V*V+Z3*V*V*V+Z4*V*V*V*V - - X = ( T - 273.15D+00 ) * 0.01D+00 - Y = RH * 0.01D+00 - - DO J = 0, 4 - BB0(J) = Z(C0(J,0),C0(J,1),C0(J,2),C0(J,3),C0(J,4),X) - ENDDO - DO J = 0, 4 - BB1(J) = Z(C1(J,0),C1(J,1),C1(J,2),C1(J,3),C1(J,4),X) - ENDDO - DO J = 0, 4 - BB2(J) = Z(C2(J,0),C2(J,1),C2(J,2),C2(J,3),C2(J,4),X) - ENDDO - - B(0) = Z(BB0(0),BB0(1),BB0(2),BB0(3),BB0(4),Y) - B(1) = Z(BB1(0),BB1(1),BB1(2),BB1(3),BB1(4),Y) - B(2) = Z(BB2(0),BB2(1),BB2(2),BB2(3),BB2(4),Y) - - RETURN - END SUBROUTINE JVM_COEF - - - SUBROUTINE NUCL_TURCO(NA,Z,J) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8) :: Z ! geographical height [km] - - ! Output arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - J = J_TURCO(NA,Z) - - RETURN - END SUBROUTINE NUCL_TURCO - - - REAL(8) FUNCTION J_TURCO(NA,Z) -!----------------------------------------------------------------------------------------------------------------------- -! LSC/DLW 2005-2006: -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - REAL(8) :: Z ! geographical height [Km] - - ! Local variable - REAL(8) :: Q ! local ionization rate [/cm^3/s] - - ! Parameters. - - REAL(8), PARAMETER :: NA0 = 5.00D+06 - REAL(8), PARAMETER :: F0 = 1.00D-03 - INTEGER, PARAMETER :: NSTAR = 3 - - - IF(Z .LT. 2.25) THEN - Q = 2.00D+00 - ELSEIF(Z .GE. 2.25D+00 .AND. Z .LT. 11.00D+00) THEN - Q = 3.10D+00 * (Z - 2.25D+00) + 2.00D+00 - ELSEIF ( Z .GE. 11.00D+00) THEN - Q = 29.00D+00 + (Z - 11.00D+00) - ENDIF - - J_TURCO = Q * F0 * ( NA / NA0 )**NSTAR - J_TURCO = MIN( Q, J_TURCO ) - - RETURN - END FUNCTION J_TURCO - - - SUBROUTINE NUCL_EISELE_MCMURRY(NA,J) -!----------------------------------------------------------------------------------------------------------------------- -! DLW: 7-27-06: These expressions were derived from Figure 7 of -! Eisele, F. L., and McMurry, P. H. (1997). -! Recent progress in understanding particle nucleation and growth, -! Phil. Trans. R. Soc. Lond. B, 352, 191-201. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: NA ! H2SO4 concentration [molecules/cm^3] - - ! Output arguments. - - REAL(8) :: J ! nucleation rate [#/cm^3/s] - - ! Parameters. - - REAL(8), PARAMETER :: K1 = 5.8D-13 - REAL(8), PARAMETER :: K2 = 3.5D-15 - REAL(8), PARAMETER :: K3 = 3.7D-14 - LOGICAL, PARAMETER :: LOWER_CURVE = .FALSE. - LOGICAL, PARAMETER :: UPPER_CURVE = .FALSE. - LOGICAL, PARAMETER :: AVGUL_CURVE = .TRUE. - - ! Local variables. - - ! INTEGER :: I - ! REAL(8) :: S - - IF(LOWER_CURVE) J = K1*NA - IF(UPPER_CURVE) J = K2*NA*NA - IF(AVGUL_CURVE) J = K3*NA**1.5 - -!----------------------------------------------------------------------------------------------------------------------- -! Plot the expressions. -!----------------------------------------------------------------------------------------------------------------------- -! DO I=1,5 -! S = 10.0**(4+I-1) -! WRITE(78,91 )S, K1*S, K3*S**1.5, K2*S*S -! ENDDO -!----------------------------------------------------------------------------------------------------------------------- - -91 FORMAT(4D15.5) - RETURN - END SUBROUTINE NUCL_EISELE_MCMURRY - - - SUBROUTINE F_KK02(PRS,TK,RHPERCENT,NAPERCM3,NH3PPT,KC,DNPF_NM,DNUC_NM,JP_TO_J) -!----------------------------------------------------------------------------------------------------------------------- -! DLW, 8-1-06. -! Routine to calculate the ratio of the new particle formation rate at -! a user-specified diameter to the nucleation rate. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: PRS ! ambient pressure [Pa] - REAL(8) :: TK ! ambient temperature [K] - REAL(8) :: RHPERCENT ! relative humidity [%] - REAL(8) :: NAPERCM3 ! sulfuric acid concentration [#/cm^3] - REAL(8) :: NH3PPT ! ammonia concentration [ppt] - REAL(8) :: KC ! condensational sink [1/s] - REAL(8) :: DNPF_NM ! user-selected diameter for new particles [nm] - REAL(8) :: DNUC_NM ! initial diameter before growth to size DNPF [nm] - - ! Output arguments. - - REAL(8) :: JP_TO_J ! ratio of new particle formation rate at diameter DNP - ! to the nucleation rate. [1] - - ! Local scratch variables. - - REAL(8) :: M_EFFECTIVE ! effective molar mass of H2SO4 including the water - ! and ammonia that instantaneously equilibrate with - ! the particle [g/mol] - REAL(8) :: GR_INORG ! growth rate in the free-molecular regime due to - ! inorganic species [nm/h] - REAL(8) :: X_NH3 ! # of NH3 molecules condensing per H2SO4 molecule - ! - lies in the range 0-2 [1] - REAL(8) :: X_H2O ! # of H2O molecules condensing per H2SO4 molecule [1] - REAL(8) :: GAMMA ! Eq.(22) of KK2002. [nm^2 m^2 h^-1] - REAL(8) :: DMEAN_NM ! number mean diameter over all modes [nm] - REAL(8) :: CS_PRIME ! condensational sink espressed as s [m^-2] - REAL(8) :: ETA ! ETA parameter of the KK2002 model [nm] - - !----------------------------------------------------------------------------------------------------------------- - ! The growth rate due to H2SO4+H2O+NH3 condensation can be expressed as - ! - ! GR(nm/h) = GR_CONST * T^0.5 * Meff(g/mol) * C(#/cm^3) - ! - ! where Meff is the effective molar mass of H2SO4 with water and ammonia - ! instantaneously equilibrating to the particle. See notes of 7-19-05. - ! Free-molecular growth is assumed. - ! - ! ALPHA is the mass accommodation coefficient[1]. See Eq.(20) of KK02: - ! ALPHA should be unity here, even if less than that elsewhere. - ! - ! DSTAR_DENSITY is the density of a critical nucleus [g/cm^3]. - ! - ! The mean thermal speed of a H2SO4 molecule [m/s] is CMEAN_H2SO4 * T^0.5, - ! with T the absolute temperature [K]. - ! - ! AVO is Avogadro's number [#/mol]. - ! - ! The factor 3.6D+12 converts [m/s] to [nm/h]. - !----------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: ALPHA = 1.0D+00 ! [1] - REAL(8), PARAMETER :: DSTAR_DENSITY = 1.6D+00 ! [g/cm^3] - REAL(8), PARAMETER :: CMEAN_H2SO4 = 14.692171525317413D+00 ! [m/s/K^0.5] - REAL(8), PARAMETER :: GR_CONST = 0.5D+00 * ALPHA * CMEAN_H2SO4 * 3.6D+12 - & / ( AVO * DSTAR_DENSITY ) - REAL(8), PARAMETER :: FOURPI = 4.0D+00 * PI - - !----------------------------------------------------------------------------------------------------------------- - ! The proportionality factor GAMMA for eq.22 of KK2002 have this - ! constant extracted. - !----------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: GAMMA_PRIME = 11.79348270D+00 - - - !----------------------------------------------------------------------------------------------------------------- - ! Get the number mean diameter over all modes [nm]. - !----------------------------------------------------------------------------------------------------------------- - DMEAN_NM = 1.0D+09 * AVG_DP_OF_AVG_MASS_METERS ! Stored in aero_param.f. - - !----------------------------------------------------------------------------------------------------------------- - ! Get GAMMA from Eq.(22) in KK2002 [nm^2 m^2 /h]. - ! - ! DSTAR_DENSITY is in [g/cm^3], with the conversion from [kg/m^3] in - ! KK02 Eq.(22) folded into the parameter GAMMA_PRIME. - !----------------------------------------------------------------------------------------------------------------- - GAMMA = GAMMA_PRIME * DNUC_NM**0.2 * DNPF_NM**0.075 * DMEAN_NM**0.048 - & * DSTAR_DENSITY**(-0.33) * TK**(-0.75) - - !----------------------------------------------------------------------------------------------------------------- - ! Get the effective molecular weight of condensing H2SO4 [g/mol]. - !----------------------------------------------------------------------------------------------------------------- - CALL EFFECTIVE_MW(PRS,TK,RHPERCENT,NAPERCM3,NH3PPT,X_NH3,X_H2O) - M_EFFECTIVE = MW_H2SO4 + X_NH3*MW_NH3 + X_H2O*MW_H2O - - !----------------------------------------------------------------------------------------------------------------- - ! Get the growth rate due to condensation of inorganics [nm/h]. - !----------------------------------------------------------------------------------------------------------------- - GR_INORG = GR_CONST * SQRT(TK) * M_EFFECTIVE * NAPERCM3 - - !----------------------------------------------------------------------------------------------------------------- - ! Get the condensational sink (CS') in [m^-2]. - !----------------------------------------------------------------------------------------------------------------- - CS_PRIME = KC / ( FOURPI * DIFFCOEF_M2S(ILAY) ) - - !----------------------------------------------------------------------------------------------------------------- - ! Get ETA of the KK2002 formulation [nm]. - !----------------------------------------------------------------------------------------------------------------- - ETA = GAMMA * CS_PRIME / MAX( GR_INORG, 1.0D-30 ) - ! WRITE(34,*)'ETA,CS_PRIME,GR_INORG,NAPERCM3 = ',ETA,CS_PRIME,GR_INORG,NAPERCM3 - - IF(ETA .LT. 56.0D+00) THEN - JP_TO_J = EXP( ETA * ( (1.0D+00/DNPF_NM) - (1.0D+00/DNUC_NM) ) ) - ELSE - JP_TO_J = 1.0D-17 - ENDIF - ! WRITE(34,*)'JP_TO_J = ', JP_TO_J - - !----------------------------------------------------------------------------------------------------------------- - ! DLW, 8-1-06: All of these variables were fine. - !----------------------------------------------------------------------------------------------------------------- - IF( WRITE_F_KK02 ) THEN - WRITE(AUNIT1,'(/A/)') 'IN SUBROUTINE F_KK02' - WRITE(AUNIT1,*) 'DSTAR_DENSITY,TK,DMEAN_NM,GAMMA,DIFFCOEF_M2S(ILAY)' - WRITE(AUNIT1,'(5D15.5)') DSTAR_DENSITY,TK,DMEAN_NM,GAMMA,DIFFCOEF_M2S(ILAY) - WRITE(AUNIT1,*) 'X_H2O,X_NH3,M_EFFECTIVE,DNUC_NM,DNPF_NM' - WRITE(AUNIT1,'(5D15.5)') X_H2O,X_NH3,M_EFFECTIVE,DNUC_NM,DNPF_NM - WRITE(AUNIT1,*) 'CS_PRIME,GR_INORG,ETA,JP_TO_J' - WRITE(AUNIT1,'(5D15.5)') CS_PRIME,GR_INORG,ETA,JP_TO_J - WRITE(AUNIT1,'(A)') ' ' - ENDIF - !----------------------------------------------------------------------------------------------------------------- - - RETURN - END SUBROUTINE F_KK02 - - - SUBROUTINE EFFECTIVE_MW(AIRPRS,TK,RHPERCENT,NAPERCM3,NH3PPT,X_NH3,X_H2O) -!----------------------------------------------------------------------------------------------------------------------- -! Routine to calculate X_NH3 and X_H2O as defined below. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Input arguments. - - REAL(8) :: AIRPRS ! ambient pressure [Pa] - REAL(8) :: TK ! ambient temperature [K] - REAL(8) :: RHPERCENT ! relative humidity [%] - REAL(8) :: NAPERCM3 ! sulfuric acid concentration [#/cm^3] - REAL(8) :: NH3PPT ! ammonia mixing ratio [ppt] - - ! Output arguments. - - REAL(8) :: X_NH3 ! # of NH3 molecules condensing per H2SO4 [#] - REAL(8) :: X_H2O ! # of H2O molecules condensing per H2SO4 [#] - - ! Parameters. - -! REAL(8), PARAMETER :: DNU_NM = 10.0D+00 ! diameter of new particles [nm] - REAL(8), PARAMETER :: RRNU_NM = 2.0D+00/DNU_NM ! recipocal radius ... [nm^-1] - REAL(8), PARAMETER :: SQRT_MWH2SO4_OVER_MWNH3 = 2.400D+00 - REAL(8), PARAMETER :: A0_H2SO4 = 0.300D+00 - REAL(8), PARAMETER :: A1_H2SO4 = -0.608D+00 - REAL(8), PARAMETER :: A2_H2SO4 = 0.701D+00 - REAL(8), PARAMETER :: A3_H2SO4 = -0.392D+00 - REAL(8), PARAMETER :: A0_BISO4 = 0.866D+00 - REAL(8), PARAMETER :: A1_BISO4 = -1.965D+00 - REAL(8), PARAMETER :: A2_BISO4 = 1.897D+00 - REAL(8), PARAMETER :: A3_BISO4 = -0.800D+00 - REAL(8), PARAMETER :: A0_AMSO4 = 0.951D+00 - REAL(8), PARAMETER :: A1_AMSO4 = -2.459D+00 - REAL(8), PARAMETER :: A2_AMSO4 = 2.650D+00 - REAL(8), PARAMETER :: A3_AMSO4 = -1.142D+00 -! LOGICAL, PARAMETER :: INCLUDE_KELVIN_EFFECT = .TRUE. - LOGICAL, PARAMETER :: INCLUDE_KELVIN_EFFECT = .FALSE. - - ! Local scratch variables. - - REAL(8) :: NH3PERCM3 ! ammonia number concentration [# cm^-3] - REAL(8) :: MFS ! mole fraction sulfur in the particle: - ! ( mol S ) / ( mol S + mol H2O ) - REAL(8) :: RHF ! (fractional RH) * EXP factor for Kelvin effect - REAL(8) :: A ! scratch variable for Kelvin effect - - NAPERCM3 = MAX ( NAPERCM3, 1.0D-30 ) - NH3PPT = MAX ( NH3PPT, 1.0D-30 ) - - !----------------------------------------------------------------------------------------------------------------- - ! Convert NH3 from ppt to molecules cm^-3. - !----------------------------------------------------------------------------------------------------------------- - NH3PERCM3 = 7.25D+04 * NH3PPT * AIRPRS / TK - - !----------------------------------------------------------------------------------------------------------------- - ! See notes of 7-08-05 for the X_NH3 calculation. - ! The square root arises from a ratio of the thermal velocities for - ! the two molecules. - !----------------------------------------------------------------------------------------------------------------- - X_NH3 = MIN ( SQRT_MWH2SO4_OVER_MWNH3 * NH3PERCM3 / NAPERCM3, 2.0D+00 ) - - !----------------------------------------------------------------------------------------------------------------- - ! Now use the X_NH3 value to classify the new particles as either - ! - ! (1) acidic - treat as pure sulfuric acid - ! (2) half-neutralized - treat as pure ammonium bisulfate - ! (3) fully-neutralized - treat as pure ammonium sulfate - ! - ! Then compute the water uptake for the selected composition. - !----------------------------------------------------------------------------------------------------------------- - IF ( X_NH3 .LT. 0.5D+00 ) THEN - - ! Acidic case. - - NPFMASS_REGIME = 0 ! second index to NPFMASS(:,:) - IF ( INCLUDE_KELVIN_EFFECT ) THEN - A = 1.2D+00 - 0.0072D+00*(TK-273.15D+00) - RHF = 0.01D+00 * RHPERCENT * EXP ( -A * RRNU_NM ) - ELSE - RHF = 0.01D+00 * RHPERCENT - ENDIF - MFS = A0_H2SO4 + A1_H2SO4*RHF + A2_H2SO4*RHF*RHF + A3_H2SO4*RHF**3 - - ELSEIF ( X_NH3 .GE. 0.5D+00 .AND. X_NH3 .LE. 1.5D+00 ) THEN - - ! Half-neutralized case. - - NPFMASS_REGIME = 1 ! second index to NPFMASS(:,:) - IF ( INCLUDE_KELVIN_EFFECT ) THEN - RHF = 0.01D+00 * RHPERCENT - A = ( 1.2D+00 - 0.0072D+00*(TK-273.15D+00) ) - & * ( 1.0D+00 - 0.17D+00*(1.0D+00-RHF)) - & * ( 1.0D+00 + 0.95D+00*(1.0D+00-RHF)) - RHF = RHF * EXP ( -A * RRNU_NM ) - ELSE - RHF = 0.01D+00 * RHPERCENT - ENDIF - MFS = A0_BISO4 + A1_BISO4*RHF + A2_BISO4*RHF*RHF + A3_BISO4*RHF**3 - - ELSE - - ! Fully-neutralized case. - - NPFMASS_REGIME = 2 ! second index to NPFMASS(:,:) - IF ( INCLUDE_KELVIN_EFFECT ) THEN - RHF = 0.01D+00 * RHPERCENT - A = ( 1.2D+00 - 0.0072D+00*(TK-273.15D+00) ) - & * ( 1.0D+00 - 0.17D+00*(1.0D+00-RHF)) - & * ( 1.0D+00 + 0.95D+00*(1.0D+00-RHF)) - RHF = RHF * EXP ( -A * RRNU_NM ) - ELSE - RHF = 0.01D+00 * RHPERCENT - ENDIF - MFS = A0_AMSO4 + A1_AMSO4*RHF + A2_AMSO4*RHF*RHF + A3_AMSO4*RHF**3 - - ENDIF - - IF ( MFS .GT. 0.0D+00 ) THEN ! The mole fraction S in the particle should exceed zero. - X_H2O = (1.0D+00 - MFS ) / MFS - ELSE ! This case should not occur. - X_H2O = 10.0D+00 - ENDIF - - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A,F6.2,I6/)') 'X_NH3, NPFMASS_REGIME = ', X_NH3, NPFMASS_REGIME - RETURN - END SUBROUTINE EFFECTIVE_MW - - - SUBROUTINE STEADY_STATE_H2SO4(PRS,RH,TEMP,XH2SO4_SS,SO4RATE,XNH3,KC,DT,XH2SO4_SS_WNPF) -!------------------------------------------------------------------------------------------------------------------ -! 101706, DLW: Routine to estimate the steady-state concentration of sulfuric acid -! including the consumption of H2SO4 by new particle formation during the current time step. -!------------------------------------------------------------------------------------------------------------------ - IMPLICIT NONE - - ! Input arguments. - - REAL(8), INTENT(IN) :: PRS ! pressure [Pa] - REAL(8), INTENT(IN) :: RH ! fractional relative humidity [1] - REAL(8), INTENT(IN) :: TEMP ! ambient temperature [K] - REAL(8), INTENT(IN) :: XH2SO4_SS ! initial steady-state [H2SO4] (as SO4) - ! neglecting new particle formation [ugSO4/m^3] - REAL(8), INTENT(IN) :: SO4RATE ! gas-phase H2SO4 (as SO4) production rate [ugSO4/m^3 s] - REAL(8), INTENT(IN) :: XNH3 ! ammonia mixing ratio [ppmV] - REAL(8), INTENT(IN) :: KC ! condensational sink due to pre-existing aerosol [1/s] - REAL(8), INTENT(IN) :: DT ! model physics time step [s] - - ! Output arguments. - - REAL(8), INTENT(OUT) :: XH2SO4_SS_WNPF ! steady-state [H2SO4] including new particle formation [ugSO4/m^3] - - ! Scratch local variables. - - INTEGER :: I ! loop counter - REAL(8) :: DNDT ! new particle formation rate [particles/m^3/s] - REAL(8) :: DMDT_SO4 ! npf mass production rates [ugSO4/m^3/s] - REAL(8) :: FX ! steady-state equation is FX = 0. [ugSO4/m^3/s] - INTEGER, PARAMETER :: ITMAX = 100 ! loop limit for development code - INTEGER, PARAMETER :: ICALLNPFRATE = 1 ! =0 impose mass limitation, >0 do not impose mass limitation - REAL(8), PARAMETER :: XH2SO4_THRES_NCM3 = 1.001D+04 ! If [H2SO4] is below this NPF can be neglected.[#/cm^3] - REAL(8), PARAMETER :: XH2SO4_THRES = XH2SO4_THRES_NCM3 * MW_SO4 * 1.0D+12 / AVO ! converted to [ugSO4/m^3] - REAL(8), PARAMETER :: EPS_XH2SO4_NCM3 = 1.00D+00 ! tiny [H2SO4] [#/cm^3] - REAL(8), PARAMETER :: EPS_XH2SO4 = EPS_XH2SO4_NCM3 * MW_SO4 * 1.0D+12 / AVO ! convert to [ugSO4/m^3] - REAL(8), PARAMETER :: REDUCTION_FACTOR = 1.2D+00 ! factor by which [H2SO4]ss is reduced each iteration [1] - LOGICAL, PARAMETER :: EARLYRETURN_ = .FALSE. ! flag for no-operation early exit - - IF( XH2SO4_SS.LT.XH2SO4_THRES .OR. INUC.NE.3 .OR. EARLYRETURN_ ) THEN ! INUC=3 is the Napari et al. - XH2SO4_SS_WNPF = XH2SO4_SS ! [ugSO4/m^3] - RETURN - ENDIF - XH2SO4_SS_WNPF = XH2SO4_SS + EPS_XH2SO4 ! [ugSO4/m^3] - CALL NPFRATE(PRS,RH,TEMP,XH2SO4_SS_WNPF,SO4RATE,XNH3,KC,DNDT,DMDT_SO4,ICALLNPFRATE) - FX = SO4RATE - KC*XH2SO4_SS_WNPF - DMDT_SO4 ! evaluate function [ugSO4/m^3/s] - IF( FX .GT. 0.0D+00 ) THEN - ! WRITE(34,*)'FX(XMAX) .GT. 0.0D+00 in STEADY_STATE_H2SO4: FX = ', FX - RETURN - ENDIF - ! WRITE(34,'(A,I5,5D13.4)')'I,X_SS,X_SS_WNPF,P,DMDT_SO4,FX=',0,XH2SO4_SS,XH2SO4_SS_WNPF,SO4RATE,DMDT_SO4,FX -!------------------------------------------------------------------------------------------------------------------ -! Reduce the steady-state H2SO4 until FX changes sign from negative to positive. -! Then the current value of XH2SO4_SS_WNPF is within a factor of REDUCTION_FACTOR -! of the actual steady-state value. -!------------------------------------------------------------------------------------------------------------------ - DO I=1, ITMAX - XH2SO4_SS_WNPF = XH2SO4_SS_WNPF / REDUCTION_FACTOR ! [ugSO4/m^3] - CALL NPFRATE(PRS,RH,TEMP,XH2SO4_SS_WNPF,SO4RATE,XNH3,KC,DNDT,DMDT_SO4,ICALLNPFRATE) - FX = SO4RATE - KC*XH2SO4_SS_WNPF - DMDT_SO4 ! evaluate function [ugSO4/m^3/s] - ! WRITE(34,'(A,I5,5D13.4)')'I,X_SS,X_SS_WNPF,P,DMDT_SO4,FX=',I,XH2SO4_SS,XH2SO4_SS_WNPF,SO4RATE,DMDT_SO4,FX - IF( FX .GE. 0.0D+00 ) EXIT - IF( XH2SO4_SS_WNPF .LT. EPS_XH2SO4 ) RETURN ! [ugSO4/m^3] - ENDDO - RETURN - END SUBROUTINE STEADY_STATE_H2SO4 - - - END MODULE AERO_NPF - - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_param.F b/MATRIXchem_GridComp/microphysics/TRAMP_param.F deleted file mode 100644 index b6282723..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_param.F +++ /dev/null @@ -1,420 +0,0 @@ - MODULE AERO_PARAM -!------------------------------------------------------------------------------------------------------------------------- -!@sum AEROSOL PARAMETERS AND VARIABLES THAT ARE INDEPENDENT OF CONFIGURATION. -!@auth Susanne Bauer/Doug Wright -!------------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE -!------------------------------------------------------------------------------------------------------------------------- -! -! GEOMETRIC AND SCIENTIFIC CONSTANTS; DERIVED CONVERSION FACTORS. -! -!------------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: PI = 3.141592653589793D+00 - REAL(8), PARAMETER :: PI6 = PI/6.0D+00 - REAL(8), PARAMETER :: AVO = 6.0221367D+23 ! Avogadro's number [#/mole] - REAL(8), PARAMETER :: RGAS_SI = 8.3145D+00 ! univers. gas constant [J/mol/K] - REAL(8), PARAMETER :: MW_H2SO4 = 98.07948D+00 ! molar mass of H2SO4 [g/mole] - REAL(8), PARAMETER :: MW_SO4 = 96.06360D+00 ! molar mass of SO4= [g/mole] - REAL(8), PARAMETER :: MW_NH3 = 17.03056D+00 ! molar mass of NH3 [g/mole] - REAL(8), PARAMETER :: MW_H2O = 18.01528D+00 ! molar mass of H2O [g/mole] - REAL(8), PARAMETER :: MW_NH42SO4 = 132.1406D+00 ! molar mass of NH42SO4 [g/mole] - REAL(8), PARAMETER :: UGM3_NCM3 = 1.0D-12 * AVO / MW_SO4 ! [ugSO4/m^3] to [#/cm^3] - REAL(8), PARAMETER :: CONVNH3 = RGAS_SI / MW_NH3 ! used in [ug NH3/m^3] to [ppmV] - REAL(8), PARAMETER :: RHO_NH42SO4 = 1.77D+00 ! density of dry (NH4)2SO4 [g/cm^3] - REAL(8), PARAMETER :: RHO_H2SO4 = 1.84D+00 ! density of pure H2SO4 [g/cm^3] - CRC - REAL(8), PARAMETER :: RHO_H2O = 1.00D+00 ! density of pure H2SO4 [g/cm^3] - CRC - REAL(8), PARAMETER :: DENSP = 1.40D+00 ! default ambient particle density [g/cm^3] - !------------------------------------------------------------------------------------------------------------------- - - ! CONV_DP_TO_MASS converts Dp^3 [m^3] to particle mass [ug]. - ! CONV_MASS_TO_DP converts particle mass [ug] to Dp^3 [m^3]. - ! CONV_VOL_TO_DP_FAC converts particle volume [ug] to Dp^3 [m^3]. - ! The factor 1.0D+12 converts [m^3] to [cm^3] and [g] to [ug]. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: CONV_DP_TO_MASS = 1.0D+12 * PI6 * DENSP - REAL(8), PARAMETER :: CONV_MASS_TO_DP = 1.0D+00 / CONV_DP_TO_MASS - REAL(8), PARAMETER :: CONV_VOL_TO_DP_FAC = 1.0D-12 / PI6 - !------------------------------------------------------------------------------------------------------------------- - ! Miniumum and maximum values of average mode diameters. [m] - ! These are needed when number and/or mass concentrations are very small. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DPMIN_GLOBAL = 0.001D-06 ! [m] - 1 nm - REAL(8), PARAMETER :: DPMAX_GLOBAL = 20.000D-06 ! [m] - 20 um -!------------------------------------------------------------------------------------------------------------------------- -! -! MODEL PARAMETERS AND VARIABLES THAT MAY NEED TO BE SET BY THE USER. -! -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: AUNIT1 = 6 ! logical unit # - log file of module - INTEGER, PARAMETER :: AUNIT2 = 6 ! logical unit # - test of coag. coef. - INTEGER, PARAMETER :: NEMIS_SPCS = 10 ! number of emissions variables - INTEGER, PARAMETER :: NDIAG_AERO = 15 ! number of aerosol diagnostics collected - INTEGER, PARAMETER :: KIJ_NDGS_SET = 31 ! default value=81; if NO_MICROPHYSICS=.TRUE., set to 3 to save storage - INTEGER, PARAMETER :: IMTR_METHOD = 1 ! =1 no cut of pdf, =2 fixed-Dp cut, =3 variable-Dp cut as in CMAQ - INTEGER, PARAMETER :: ACTIVATION_SCHEME = 2 ! =1 uses typical solubility only, =2 detailed multimodal activation - INTEGER, PARAMETER :: UPDATE_KIJ = 1 ! =0 use time-independent coagulation coefficients from lookup tables - ! =1 use time- dependent coagulation coefficients from lookup tables - LOGICAL, PARAMETER :: WRITE_LOG = .FALSE. ! WRITE MATRIX log to unit AUNIT1: default setting is .FALSE. - LOGICAL, PARAMETER :: MASS_ADJ = .TRUE. ! enforce precise mass conservation: default setting is .TRUE. - LOGICAL, PARAMETER :: CPU_STATS = .FALSE. ! timer for sections of the MATRIX code - LOGICAL, PARAMETER :: UPDATE_DP = .TRUE. ! update particle diameters at each time step: default is .TRUE. -#ifndef GEOS5_PORT - LOGICAL, PARAMETER :: UPDATE_DIAM = .TRUE. ! update particle diameters at each time step in global DIAM array -#endif - LOGICAL, PARAMETER :: UPDATE_VDEP = .FALSE. ! update particle diameters at each time step in global array - LOGICAL, PARAMETER :: SET_INTERMODAL_TRANSFER = .TRUE. ! do AKK -> ACC transfer if mode AKK is defined - LOGICAL, PARAMETER :: NO_MICROPHYSICS = .FALSE. ! no-microphysics option - LOGICAL, PARAMETER :: NO_MICROPHYSICS_W_THERMO = .TRUE. ! do gas-particle partitioning when NO_MICROPHYSICS=.TRUE. - LOGICAL, PARAMETER :: DO_NPF = .TRUE. ! include secondary particle formation - LOGICAL, PARAMETER :: DISCRETE_EVAL_OPTION = .FALSE. ! for evaluation with results from the discrete pdf model - LOGICAL, PARAMETER :: ACTIVATION_COMPARISON = .FALSE. ! for comparison of aerosol activation w/ all 8 mechanisms - !------------------------------------------------------------------------------------------------------------------- - ! AQSO4RATE_MIN is the min, aqueous SO4 production rate for call of the activation routine. - ! The default value is 4.43D-11 [ug/m^3/s], equivalent to 1000 [molecules/cm3/h] = 1.6D-07 [ugSO4/m^3/h]. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: AQSO4RATE_MIN = 4.43D-11 - !------------------------------------------------------------------------------------------------------------------- - ! The Maximum Inorganic Volume Fraction (MIVF) in modes DD1, DD2, BC1, and BC2. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: MIVF_DDD = 0.05D+00 ! - REAL(8), PARAMETER :: MIVF_BC1 = 0.05D+00 !- These two are from MZJ 2002, "Analysis ..." - REAL(8), PARAMETER :: MIVF_BC2 = 0.20D+00 !/ - !------------------------------------------------------------------------------------------------------------------- - ! Scale factor for the geometric mean diameters of the emissions lognormals. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: SCALE_EMIS_DIAM = 1.0D+00 - !------------------------------------------------------------------------------------------------------------------- - ! The minimum value of a number concentration or mass concentration leaving MATRIX. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: MINCONC = 1.0D-15 ! [ug/m^3] and [#/m^3] - REAL(8), PARAMETER :: TINYNUMER = 1.0D-30 ! - REAL(8), PARAMETER :: TINYDENOM = 1.0D-30 ! - !------------------------------------------------------------------------------------------------------------------- - ! ZHEIGHT(I) is the mid-level height of model vertical layer I in [km]. - ! It is used in the calculation of ionization rates in the ion-ion - ! recombination nucleation scheme, and in computing the pre-calculated - ! factor in the condensational sink. - ! - ! Set ZHEIGHT to global-average values typical of the vertical structure of the host GCM. - !------------------------------------------------------------------------------------------------------------------- -#ifndef GEOS5_PORT - INTEGER, PARAMETER :: NLAYS = 42 ! number of model vertical layers -#else - INTEGER, PARAMETER :: NLAYS = 72 -#endif - REAL(8) :: ZHEIGHT(NLAYS) ! typical (CMAQ) mid-layer heights [km] -c M 20 model -c DATA ZHEIGHT/ 0.007D+00, 0.024D+00, 0.052D+00, 0.100D+00, 0.210D+00, -c & 0.390D+00, 0.640D+00, 0.950D+00, 1.300D+00, 1.740D+00, -c & 2.260D+00, 2.810D+00, 3.390D+00, 4.000D+00, 4.700D+00, -c & 5.400D+00, 6.200D+00, 7.200D+00, 8.400D+00, 10.00D+00, -c & 12.40D+00 / -c F 40 model -#ifndef GEOS5_PORT - DATA ZHEIGHT/0.01D+00,0.02D+00,0.04D+00,0.06D+00,0.09D+00,1.2D+00,1.5D+00,2.D+00,2.4D+00,3.D+00 - & ,3.5D+00,4.D+00,6.7D+00,7.4D+00,8.1D+00,8.5D+00,9.D+00,10.D+00,11.D+00,12.D+00 - & ,13.D+00,14.D+00,15.D+00,16.D+00,18.D+00,19.D+00,21.D+00,24.D+00,28.D+00,32.D+00 - & ,36.D+00,40.D+00,44.D+00,48.D+00,53.D+00,58.D+00,62.D+00,66.D+00,72.D+00,80.D+00 - & ,85.D+00,90.D+00/ -#else - DATA ZHEIGHT/0.01D+00,0.02D+00,0.04D+00,0.06D+00,0.09D+00,1.2D+00,1.5D+00,2.D+00,2.4D+00,3.D+00 - & ,3.5D+00,4.D+00,6.7D+00,7.4D+00,8.1D+00,8.5D+00,9.D+00,10.D+00,11.D+00,12.D+00 - & ,13.D+00,14.D+00,15.D+00,16.D+00,18.D+00,19.D+00,21.D+00,24.D+00,28.D+00,32.D+00 - & ,36.D+00,40.D+00,44.D+00,48.D+00,53.D+00,58.D+00,62.D+00,66.D+00,72.D+00,80.D+00 - & ,85.D+00,90.D+00 - & ,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00 - & ,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00 - & ,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00,90.D+00/ -#endif -!------------------------------------------------------------------------------------------------------------------------- -! Default values for the box model - do not change these. -!------------------------------------------------------------------------------------------------------------------------- -! INTEGER, PARAMETER :: NLAYS = 21 ! number of model vertical layers -! REAL(8) :: ZHEIGHT(NLAYS) ! typical (CMAQ) mid-layer heights [km] -! DATA ZHEIGHT/ 0.007D+00, 0.024D+00, 0.052D+00, 0.100D+00, 0.210D+00, -! & 0.390D+00, 0.640D+00, 0.950D+00, 1.300D+00, 1.740D+00, -! & 2.260D+00, 2.810D+00, 3.390D+00, 4.000D+00, 4.700D+00, -! & 5.400D+00, 6.200D+00, 7.200D+00, 8.400D+00, 10.00D+00, -! & 12.40D+00 / -!------------------------------------------------------------------------------------------------------------------------- - ! Characteristic lognormal parameters for each mode: DG_XXX[um],SG_XXX[1]. - ! - ! The Dg values from Easter et al., 2004 (E04) are the "diagnosed number" values, not the "emitted" values. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_AKK = 0.026D+00 ! E04, Table 2, Aitken mode - REAL(8), PARAMETER :: DG_ACC = 0.110D+00 ! E04, Table 2, accumulation mode - !------------------------------------------------------------------------------------------------------------------- - ! DLW: 021507: These dust and sea salt Dg values were calculated approximate emissions sizes used at GISS. - ! - ! The number mean diameters for the four GISS dust size classes were 0.46, 2.94, 5.88, and 11.77 micrometers. - ! Size classes 1 and 2 were averaged with a 10:1 ratio, and the average converted to a lognormal geometric - ! mean diameter for an assumed geometric standard deviation of 1.8. - ! Likewise, size classes 3 and 4 were averaged with a 10:1 ratio, and the average converted to a lognormal - ! geometric mean diameter for an assumed geometric standard deviation of 1.8. - ! - ! The number mean diameters for the two GISS sea salt size classes were 0.44 and 5.0 micrometers, and were - ! converted to lognormal geometric mean diameters for an assumed geometric standard deviation of 1.8 for the - ! smaller (accumulation) size class and a standard deviation of 2.0 for the larger (coarse) size class. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_DD1 = 0.580D+00 *2. ! set to match GISS dust emissions for average of sizes 1 & 2 - REAL(8), PARAMETER :: DG_DD2 = 1.000D+00 *2. ! set to match GISS dust emissions for average of sizes 3 & 4 - REAL(8), PARAMETER :: DG_DS1 = 0.580D+00 *2. ! set to match GISS dust emissions for average of sizes 1 & 2 - REAL(8), PARAMETER :: DG_DS2 = 1.00D+00 *2. ! set to match GISS dust emissions for average of sizes 3 & 4 - REAL(8), PARAMETER :: DG_SSA = 0.06D+00 *2. ! set to match GISS sea salt emissions -! REAL(8), PARAMETER :: DG_SSA = 0.370D+00 *2. ! set to match GISS sea salt emissions - REAL(8), PARAMETER :: DG_SSC = 1.D+00 *2. ! set to match GISS sea salt emissions - REAL(8), PARAMETER :: DG_SSS = 0.690D+00 *2. ! 10:1 average of modes SSA and SSC - !------------------------------------------------------------------------------------------------------------------- - ! DLW: 021507: End of emissions sizes used at GISS. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_OCC = 0.050D+00 ! geo. avg. of E04, Table 2, Aitken and accumulation modes - REAL(8), PARAMETER :: DG_BC1 = 0.050D+00 ! geo. avg. of E04, Table 2, Aitken and accumulation modes - REAL(8), PARAMETER :: DG_BC2 = 0.100D+00 ! 1.0164 * geo. avg. of E04, Table 2, AKK and ACC modes, w/ 5% shell - REAL(8), PARAMETER :: DG_BC3 = 0.100D+00 ! 1.0627 * geo. avg. of E04, Table 2, AKK and ACC modes, w/ 20% shell - REAL(8), PARAMETER :: DG_DBC = 0.330D+00 ! geo. avg. of E04, Table 2, accumulation and coarse dust modes - REAL(8), PARAMETER :: DG_BOC = 0.100D+00 ! assuming additive volumes for BC1 and OCC - REAL(8), PARAMETER :: DG_BCS = 0.070D+00 ! assuming add. vol. for BC1 and AKK (ACC) and greater weight for AKK - REAL(8), PARAMETER :: DG_OCS = 0.070D+00 ! assuming add. vol. for BC1 and AKK (ACC) and greater weight for AKK - REAL(8), PARAMETER :: DG_MXX = 0.300D+00 ! value is midrange considering all modes - REAL(8), PARAMETER :: SG_AKK = 1.600D+00 ! E04, Table 2, Aitken mode - REAL(8), PARAMETER :: SG_ACC = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DD1 = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DD2 = 1.800D+00 ! E04, Table 2, coarse mode - REAL(8), PARAMETER :: SG_DS1 = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DS2 = 1.800D+00 ! E04, Table 2, coarse mode - REAL(8), PARAMETER :: SG_SSA = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_SSC = 2.000D+00 ! E04, Table 2, coarse mode - REAL(8), PARAMETER :: SG_SSS = 2.000D+00 ! same as SSC - REAL(8), PARAMETER :: SG_OCC = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_BC1 = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_BC2 = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_BC3 = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DBC = 1.800D+00 ! same as parent modes - REAL(8), PARAMETER :: SG_BOC = 1.800D+00 ! same as parent modes - REAL(8), PARAMETER :: SG_BCS = 1.800D+00 ! same as parent modes - REAL(8), PARAMETER :: SG_OCS = 1.800D+00 ! same as parent modes - REAL(8), PARAMETER :: SG_MXX = 2.000D+00 ! likely a broad mode - !------------------------------------------------------------------------------------------------------------------- - ! Lognormal parameters for emissions into each mode: DG_XXX_EMIS[um],SG_XXX_EMIS[1]. - ! - ! These are used to convert mass emission rates to number emission rates. - ! The Dg values from Easter et al., 2004 (E04) are the "emitted" values, not the "diagnosed number" values. - ! All modes are assigned a value, even if they do not receive primary particles. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_AKK_EMIS = 0.013D+00 ! E04, Table 2, Aitken mode - REAL(8), PARAMETER :: DG_ACC_EMIS = 0.068D+00 ! E04, Table 2, accumulation mode - !------------------------------------------------------------------------------------------------------------------- - ! DLW: 021507: These dust and sea salt Dg values were calculated approximate emissions sizes used at GISS. - ! - ! The number mean diameters for the four GISS dust size classes were 0.46, 2.94, 5.88, and 11.77 micrometers. - ! Size classes 1 and 2 were averaged with a 10:1 ratio, and the average converted to a lognormal geometric - ! mean diameter for an assumed geometric standard deviation of 1.8. - ! Likewise, size classes 3 and 4 were averaged with a 10:1 ratio, and the average converted to a lognormal - ! geometric mean diameter for an assumed geometric standard deviation of 1.8. - ! - ! The number mean diameters for the two GISS sea salt size classes were 0.44 and 5.0 micrometers, and were - ! converted to lognormal geometric mean diameters for an assumed geometric standard deviation of 1.8 for the - ! smaller (accumulation) size class and a standard deviation of 2.0 for the larger (coarse) size class. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_DD1_EMIS = 0.580D+00 *2. ! set to match GISS dust emissions for average of sizes 1 & 2 - REAL(8), PARAMETER :: DG_DD2_EMIS = 1.000D+00 *2. ! set to match GISS dust emissions for average of sizes 3 & 4 - REAL(8), PARAMETER :: DG_DS1_EMIS = 0.580D+00 *2. ! set to match GISS dust emissions for average of sizes 1 & 2 - REAL(8), PARAMETER :: DG_DS2_EMIS = 1.00D+00 *2. ! set to match GISS dust emissions for average of sizes 3 & 4 - REAL(8), PARAMETER :: DG_SSA_EMIS = 0.1D+00 *2 ! set to match GISS sea salt emissions -! REAL(8), PARAMETER :: DG_SSA_EMIS = 0.370D+00 *2 ! set to match GISS sea salt emissions - REAL(8), PARAMETER :: DG_SSC_EMIS = 1.000D+00 *2. ! set to match GISS sea salt emissions - REAL(8), PARAMETER :: DG_SSS_EMIS = 0.690D+00 *2. ! 10:1 average of modes SSA and SSC - !------------------------------------------------------------------------------------------------------------------- - ! DLW: 021507: End of emissions sizes used at GISS. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: DG_OCC_EMIS = 0.050D+00 ! geometric average of the AKK and ACC values in E04 - REAL(8), PARAMETER :: DG_BC1_EMIS = 0.050D+00 ! geometric average of the AKK and ACC values in E04 - REAL(8), PARAMETER :: DG_BC2_EMIS = 0.100D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: DG_BC3_EMIS = 0.100D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: DG_DBC_EMIS = 0.300D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: DG_BOC_EMIS = 0.100D+00 ! assuming additive volumes for BC1 and OCC - REAL(8), PARAMETER :: DG_BCS_EMIS = 0.140D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: DG_OCS_EMIS = 0.140D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: DG_MXX_EMIS = 0.500D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_AKK_EMIS = 1.600D+00 ! E04, Table 2, Aitken mode - REAL(8), PARAMETER :: SG_ACC_EMIS = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DD1_EMIS = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_DD2_EMIS = 1.800D+00 ! E04, Table 2, coarse mode - REAL(8), PARAMETER :: SG_DS1_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_DS2_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_SSA_EMIS = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_SSC_EMIS = 2.000D+00 ! E04, Table 2, coarse mode - REAL(8), PARAMETER :: SG_SSS_EMIS = 2.000D+00 ! same as SSC - REAL(8), PARAMETER :: SG_OCC_EMIS = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_BC1_EMIS = 1.800D+00 ! E04, Table 2, accumulation mode - REAL(8), PARAMETER :: SG_BC2_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_BC3_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_DBC_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_BOC_EMIS = 1.800D+00 ! same as BC1 and OCC modes - REAL(8), PARAMETER :: SG_BCS_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_OCS_EMIS = 1.800D+00 ! currently no emissions into this mode - REAL(8), PARAMETER :: SG_MXX_EMIS = 2.000D+00 ! currently no emissions into this mode - !------------------------------------------------------------------------------------------------------------------- - ! KAPPAI_XXX is the activating fraction for mode XXX. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: KAPPAI_AKK = 0.0D+00 - REAL(8), PARAMETER :: KAPPAI_ACC = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_DD1 = 0.0D+00 - REAL(8), PARAMETER :: KAPPAI_DD2 = 0.0D+00 - REAL(8), PARAMETER :: KAPPAI_DS1 = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_DS2 = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_SSA = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_SSC = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_SSS = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_OCC = 0.7D+00 - REAL(8), PARAMETER :: KAPPAI_BC1 = 0.0D+00 - REAL(8), PARAMETER :: KAPPAI_BC2 = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_BC3 = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_DBC = 0.0D+00 - REAL(8), PARAMETER :: KAPPAI_BOC = 0.5D+00 - REAL(8), PARAMETER :: KAPPAI_BCS = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_OCS = 1.0D+00 - REAL(8), PARAMETER :: KAPPAI_MXX = 1.0D+00 -!------------------------------------------------------------------------------------------------------------------- -! Solubility per mode -!------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: SOLU_AKK = 1.0D+00 - REAL(8), PARAMETER :: SOLU_ACC = 1.0D+00 - REAL(8), PARAMETER :: SOLU_DD1 = 0.5D+00 - REAL(8), PARAMETER :: SOLU_DD2 = 0.5D+00 - REAL(8), PARAMETER :: SOLU_DS1 = 1.0D+00 - REAL(8), PARAMETER :: SOLU_DS2 = 1.0D+00 - REAL(8), PARAMETER :: SOLU_SSA = 1.0D+00 - REAL(8), PARAMETER :: SOLU_SSC = 1.0D+00 - REAL(8), PARAMETER :: SOLU_SSS = 1.0D+00 - REAL(8), PARAMETER :: SOLU_OCC = 0.4D+00 - REAL(8), PARAMETER :: SOLU_BC1 = 0.4D+00 - REAL(8), PARAMETER :: SOLU_BC2 = 0.8D+00 - REAL(8), PARAMETER :: SOLU_BC3 = 1.0D+00 - REAL(8), PARAMETER :: SOLU_DBC = 0.0D+00 - REAL(8), PARAMETER :: SOLU_BOC = 0.6D+00 - REAL(8), PARAMETER :: SOLU_BCS = 1.0D+00 - REAL(8), PARAMETER :: SOLU_OCS = 1.0D+00 - REAL(8), PARAMETER :: SOLU_MXX = 1.0D+00 -!------------------------------------------------------------------------------------------------------------------------- -! -! MODEL PARAMETERS AND VARIABLES THAT PROBABLY DO NOT NEED TO BE CHANGED. -! -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: NGASES = 3 ! number of gas-phase species - INTEGER, PARAMETER :: NMASS_SPCS = 5 ! total number of mass species - INTEGER, PARAMETER :: GAS_H2SO4 = 1 ! - INTEGER, PARAMETER :: GAS_HNO3 = 2 !-indices in the GAS array - INTEGER, PARAMETER :: GAS_NH3 = 3 ! - INTEGER, PARAMETER :: PROD_INDEX_SULF = 1 ! SULF index in PROD_INDEX(:,:) - INTEGER, PARAMETER :: PROD_INDEX_BCAR = 2 ! BCAR index in PROD_INDEX(:,:) - INTEGER, PARAMETER :: PROD_INDEX_OCAR = 3 ! OCAR index in PROD_INDEX(:,:) - INTEGER, PARAMETER :: PROD_INDEX_DUST = 4 ! DUST index in PROD_INDEX(:,:) - INTEGER, PARAMETER :: PROD_INDEX_SEAS = 5 ! SEAS index in PROD_INDEX(:,:) - !------------------------------------------------------------------------------------------------------------------- - ! EMIS_DENS_XXXX is the dry particle density of emitted species XXXX. - ! - ! These are used only for deriving number emission rates from mass emission rates. - ! - ! For sulfate, the emissions are treated as pure dry ammonium sulfate. - ! For sea salt, the emissions are treated as pure dry sodium chloride. - ! - ! For the sulfate density, volume is converted to ammonium sulfate mass using - ! the density of ammonium sulfate, which is then converted to sulfate (only) mass. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: EMIS_DENS_SULF = 1.77D+00 ! [gSO4/cm^3] - NH42SO4 - & * MW_SO4 / MW_NH42SO4 - REAL(8), PARAMETER :: EMIS_DENS_BCAR = 1.70D+00 ! [g/cm^3] - Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: EMIS_DENS_OCAR = 1.00D+00 ! [g/cm^3] - Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: EMIS_DENS_DUST = 2.60D+00 ! [g/cm^3] - Ghan et al. (2001) - MIRAGE - REAL(8), PARAMETER :: EMIS_DENS_SEAS = 2.165D+00 ! [g/cm^3] - NaCl - REAL(8), PARAMETER :: EMIS_DENS_BOCC = 0.50D+00 ! [g/cm^3] - average - & * ( EMIS_DENS_BCAR + EMIS_DENS_OCAR ) - REAL, DIMENSION(NEMIS_SPCS) :: EMIS_DENS = (/ EMIS_DENS_SULF, - & EMIS_DENS_SULF, EMIS_DENS_BCAR, EMIS_DENS_OCAR, - & EMIS_DENS_DUST, EMIS_DENS_SEAS, EMIS_DENS_SEAS, - & EMIS_DENS_BOCC, EMIS_DENS_BOCC, EMIS_DENS_DUST /) - !------------------------------------------------------------------------------------------------------------------- - ! The aerosol chemical species are SO4, BC, OC, mineral dust, and sea salt. - ! Nitrate, ammonium and water are not included here. - !------------------------------------------------------------------------------------------------------------------- - CHARACTER(LEN=4) :: CHEM_SPC_NAME(NMASS_SPCS) - & = (/'SULF','BCAR','OCAR','DUST','SEAS'/) - !------------------------------------------------------------------------------------------------------------------- - ! The Maximum Inorganic Mass Ratio (MIMR) in modes DD1, DD2, BC1, and BC2. - ! - ! The above MIVF values are converted to MIMR values for computational efficiency. - ! The volume of inorganic coating is converted to mass using the default ambient aerosol density. - !------------------------------------------------------------------------------------------------------------------- - REAL(8), PARAMETER :: MIMR_DDD = ( DENSP / EMIS_DENS_DUST ) - & * MIVF_DDD / ( 1.0D+00 - MIVF_DDD ) - REAL(8), PARAMETER :: MIMR_BC1 = ( DENSP / EMIS_DENS_BCAR ) - & * MIVF_BC1 / ( 1.0D+00 - MIVF_BC1 ) - REAL(8), PARAMETER :: MIMR_BC2 = ( DENSP / EMIS_DENS_BCAR ) - & * MIVF_BC2 / ( 1.0D+00 - MIVF_BC2 ) -!------------------------------------------------------------------------------------------------------------------------- -! -! VARIABLES HELD IN THE MANNER OF A COMMON BLOCK. -! -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, SAVE :: IXXX, IYYY, ILAY ! current grid cell indices - LOGICAL, SAVE :: INCLUDE_BC3 ! true if mechanism includes mode BC3; false otherwise -!------------------------------------------------------------------------------------------------------------------------- -! Aerosol mode names (and numbers) that might appear in one or more mechanisms. -! These mode number only pertain to this set of all possible modes, and are not the mode numbers -! used for any specific mechanism. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: NMODES_MAX=18 - CHARACTER(LEN=3) :: MNAME(NMODES_MAX) - ! Mode # 1 2 3 4 5 6 7 8 9 ! # to identify the mode in MODES1, etc. below. - DATA MNAME/'AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','SSS', - & 'OCC','BC1','BC2','BC3','OCS','DBC','BOC','BCS','MXX'/ - ! Mode # 10 11 12 13 14 15 16 17 18 ! # to identify the mode in MODES1, etc. below. -!------------------------------------------------------------------------------------------------------------------------- -! Aerosol species defined for each mode in each mechanism. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, SAVE :: MSPCS(NMASS_SPCS,NMODES_MAX) - DATA MSPCS(1,1:NMODES_MAX)/1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/ ! SULF: =0 no sulfate, =1 has sulfate - DATA MSPCS(2,1:NMODES_MAX)/0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,1/ ! BCAR: =0 no BC , =1 has BC - DATA MSPCS(3,1:NMODES_MAX)/0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1/ ! OCAR: =0 no OC , =1 has OC - DATA MSPCS(4,1:NMODES_MAX)/0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1/ ! DUST: =0 no dust , =1 has dust - DATA MSPCS(5,1:NMODES_MAX)/0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1/ ! SEAS: =0 no seasalt, =1 has seasalt -!------------------------------------------------------------------------------------------------------------------------- -! Aerosol modes used for each mechanism. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: NM1=16,NM2=16,NM3=13,NM4=10 - INTEGER, PARAMETER :: NM5=14,NM6=14,NM7=11,NM8=8 - INTEGER :: MODES1(NM1),MODES2(NM2),MODES3(NM3),MODES4(NM4) - INTEGER :: MODES5(NM5),MODES6(NM6),MODES7(NM7),MODES8(NM8) - DATA MODES1/ 1, 2, 3, 4, 5, 6, 7, 8,10,11,12,13,15,16,17,18/ - DATA MODES2/ 1, 2, 3, 4, 5, 6, 7, 8,10,11,12,14,15,16,17,18/ - DATA MODES3/ 1, 2, 3, 4, 5, 6, 7, 8,10,11,12,16,18/ - DATA MODES4/ 2, 3, 4, 5, 6, 9,10,11,12,18/ - DATA MODES5/ 1, 2, 3, 4, 7, 8,10,11,12,13,15,16,17,18/ - DATA MODES6/ 1, 2, 3, 4, 7, 8,10,11,12,14,15,16,17,18/ - DATA MODES7/ 1, 2, 3, 4, 7, 8,10,11,12,16,18/ - DATA MODES8/ 2, 3, 4, 9,10,11,12,18/ -!------------------------------------------------------------------------------------------------------------------------- -! Indices of the AERO array. There are 78 possible indices. -!------------------------------------------------------------------------------------------------------------------------- - INTEGER :: MASS_NO3=1, MASS_NH4=2, MASS_H2O=3 - INTEGER, SAVE :: NUMB_AKK_1, NUMB_AKK_2, MASS_AKK_SULF, - & NUMB_ACC_1, NUMB_ACC_2, MASS_ACC_SULF, - & NUMB_DD1_1, NUMB_DD1_2, MASS_DD1_SULF, MASS_DD1_DUST, - & NUMB_DS1_1, NUMB_DS1_2, MASS_DS1_SULF, MASS_DS1_DUST, - & NUMB_DD2_1, NUMB_DD2_2, MASS_DD2_SULF, MASS_DD2_DUST, - & NUMB_DS2_1, NUMB_DS2_2, MASS_DS2_SULF, MASS_DS2_DUST, - & NUMB_SSA_1, NUMB_SSA_2, MASS_SSA_SULF, MASS_SSA_SEAS, - & NUMB_SSC_1, NUMB_SSC_2, MASS_SSC_SULF, MASS_SSC_SEAS, - & NUMB_SSS_1, NUMB_SSS_2, MASS_SSS_SULF, MASS_SSS_SEAS, - & NUMB_OCC_1, NUMB_OCC_2, MASS_OCC_SULF, MASS_OCC_OCAR, - & NUMB_BC1_1, NUMB_BC1_2, MASS_BC1_SULF, MASS_BC1_BCAR, - & NUMB_BC2_1, NUMB_BC2_2, MASS_BC2_SULF, MASS_BC2_BCAR, - & NUMB_BC3_1, NUMB_BC3_2, MASS_BC3_SULF, MASS_BC3_BCAR, - & NUMB_OCS_1, NUMB_OCS_2, MASS_OCS_SULF, MASS_OCS_OCAR, - & NUMB_DBC_1, NUMB_DBC_2, MASS_DBC_SULF, MASS_DBC_BCAR, MASS_DBC_DUST, - & NUMB_BOC_1, NUMB_BOC_2, MASS_BOC_SULF, MASS_BOC_BCAR, MASS_BOC_OCAR, - & NUMB_BCS_1, NUMB_BCS_2, MASS_BCS_SULF, MASS_BCS_BCAR, - & NUMB_MXX_1, NUMB_MXX_2, MASS_MXX_SULF, MASS_MXX_BCAR, MASS_MXX_OCAR, MASS_MXX_DUST, MASS_MXX_SEAS - - END MODULE AERO_PARAM diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_quad.F b/MATRIXchem_GridComp/microphysics/TRAMP_quad.F deleted file mode 100644 index c157ca56..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_quad.F +++ /dev/null @@ -1,283 +0,0 @@ - SUBROUTINE GAUSS(N,X,R,W,ZF) -!---------------------------------------------------------------------------------------------------------------------- -!@sum Perform an n-point quadrature from 2n moments to yield n abscissas and n weights. -!@auth Susanne Bauer/Doug Wright -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - INTEGER, INTENT(IN ) :: N ! number of quadrature points - REAL(8), INTENT(INOUT) :: X(2*N) ! moments - REAL(8), INTENT( OUT) :: R(N) ! abscissas - REAL(8), INTENT( OUT) :: W(N) ! weights - REAL(8), INTENT( OUT) :: ZF ! =0.0 successful quadrature, =1.0 failed quadrature - - ! Local variables. - - INTEGER :: IFAILTQL - REAL(8) :: A(N),B(N),ANU(2*N),AMU0 - - ZF = 0.0D+00 ! successful quadrature - AMU0 = X(1) ! normalizing moment - ANU(:) = X(:)/AMU0 ! normalize the moments - CALL ORTHOG(N,ANU,A,B) - CALL GAUCOF(N,A,B,AMU0,R,W,IFAILTQL) - IF( MINVAL(R(:)) .LT. 0.0D+00 ) THEN ! failed quadrature - ZF = 1.0D+00 - ELSEIF( MINVAL(W(:)) .LT. 0.0D+00 ) THEN ! failed quadrature - ZF = 1.0D+00 - ELSEIF( IFAILTQL .GT. 0 ) THEN ! failed quadrature - ZF = 1.0D+00 - ENDIF - RETURN - END - - - SUBROUTINE ORTHOG(N,ANU,A,B) - - IMPLICIT NONE -!---------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!---------------------------------------------------------------------------------------------------------------------- - INTEGER :: L,N,K,NMAX - PARAMETER (NMAX=30) - REAL(8) :: A(N),ANU(2*N),B(N),SIG(2*NMAX+1,2*NMAX+1) - - DO 11 L=3,2*N - SIG(1,L)=0.D+00 -11 CONTINUE - DO 12 L=2,2*N+1 - SIG(2,L)=ANU(L-1) -12 CONTINUE - A(1)=ANU(2)/ANU(1) - B(1)=0.D+00 - DO 14 K=3,N+1 - DO 13 L=K,2*N-K+3 - SIG(K,L)=SIG(K-1,L+1)-A(K-2)*SIG(K-1,L)-B(K-2)*SIG(K-2,L) - IF(SIG(K,K).LE.0.D+00) SIG(K,K) = 1.D-20 -13 CONTINUE - A(K-1)=SIG(K,K+1)/SIG(K,K)-SIG(K-1,K)/SIG(K-1,K-1) - B(K-1)=SIG(K,K)/SIG(K-1,K-1) -14 CONTINUE - RETURN - END SUBROUTINE ORTHOG - - - SUBROUTINE GAUCOF(N,A,B,AMU0,X,W,IFAILTQL) - - IMPLICIT NONE -!---------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!---------------------------------------------------------------------------------------------------------------------- - INTEGER :: I,J,N,NMAX, IFAILTQL - PARAMETER (NMAX=30) - REAL(8) :: A(N),B(N),W(N),X(N),Z(NMAX,NMAX),AMU0 - IFAILTQL = 0 - DO 12 I=1,N - IF(I.NE.1)B(I)=SQRT(B(I)) - DO 11 J=1,N - IF(I.EQ.J)THEN - Z(I,J)=1.D+00 - ELSE - Z(I,J)=0.D+00 - ENDIF -11 CONTINUE -12 CONTINUE - CALL TQLI(A,B,N,NMAX,Z,IFAILTQL) - IF(IFAILTQL.GT.0) RETURN -!---------------------------------------------------------------------------------------------------------------------- -! Ordering of the abscissas is usually not needed. -!---------------------------------------------------------------------------------------------------------------------- -! CALL EIGSRT(A,Z,N,NMAX) -!---------------------------------------------------------------------------------------------------------------------- - DO 13 I=1,N - X(I)=A(I) - W(I)=AMU0*Z(1,I)**2 - !-------------------------------------------------------------------------------------------------------------- - ! AVOID ZERO WEIGHTS. - !-------------------------------------------------------------------------------------------------------------- - ! IF(W(I).EQ.0.D+00) W(I) = 1.D-30 - !-------------------------------------------------------------------------------------------------------------- -13 CONTINUE - RETURN - END SUBROUTINE GAUCOF - - - SUBROUTINE TQLI(D,E,N,NP,Z,IFAILTQL) - IMPLICIT NONE -!---------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!---------------------------------------------------------------------------------------------------------------------- - INTEGER :: I,N,NP,M,L,K,ITER,IFAILTQL - REAL(8) :: D(NP),E(NP),Z(NP,NP),DD,G,R,S,C,P,F,B,PYTHAG - DO 11 I=2,N - E(I-1)=E(I) -11 CONTINUE - E(N)=0.D+00 - DO 15 L=1,N - ITER=0 -1 DO 12 M=L,N-1 - DD=ABS(D(M))+ABS(D(M+1)) - IF (ABS(E(M))+DD.EQ.DD) GOTO 2 -12 CONTINUE - M=N -2 IF(M.NE.L)THEN - IF(ITER.EQ.300) THEN - IFAILTQL = 1 - RETURN - ENDIF - ITER=ITER+1 - G=(D(L+1)-D(L))/(2.D+00*E(L)) - R=PYTHAG(G,1.0D0) - G=D(M)-D(L)+E(L)/(G+SIGN(R,G)) - S=1.D+00 - C=1.D+00 - P=0.D+00 - DO 14 I=M-1,L,-1 - F=S*E(I) - B=C*E(I) - R=PYTHAG(F,G) - E(I+1)=R - IF(R.EQ.0.D0)THEN - D(I+1)=D(I+1)-P - E(M)=0.D+00 - GOTO 1 - ENDIF - S=F/R - C=G/R - G=D(I+1)-P - R=(D(I)-G)*S+2.D0*C*B - P=S*R - D(I+1)=G+P - G=C*R-B -C OMIT LINES FROM HERE ... - DO 13 K=1,N - F=Z(K,I+1) - Z(K,I+1)=S*Z(K,I)+C*F - Z(K,I)=C*Z(K,I)-S*F -13 CONTINUE -C ... TO HERE WHEN FINDING ONLY EIGENVALUES. -14 CONTINUE - D(L)=D(L)-P - E(L)=G - E(M)=0.D+00 - GOTO 1 - ENDIF -15 CONTINUE - RETURN - END SUBROUTINE TQLI - - - DOUBLE PRECISION FUNCTION PYTHAG(A,B) - - IMPLICIT NONE -!---------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!---------------------------------------------------------------------------------------------------------------------- - REAL(8) :: ABSA,ABSB, A,B,PHYTAG - ABSA=ABS(A) - ABSB=ABS(B) - IF(ABSA.GT.ABSB)THEN - PYTHAG=ABSA*SQRT(1.D+00+(ABSB/ABSA)**2) - ELSE - IF(ABSB.EQ.0.D+00)THEN - PYTHAG=0.D+00 - ELSE - PYTHAG=ABSB*SQRT(1.D+00+(ABSA/ABSB)**2) - ENDIF - ENDIF - RETURN - END - - - SUBROUTINE EIGSRT(D,V,N,NP) - - IMPLICIT NONE -!---------------------------------------------------------------------------------------------------------------------- -! SEE NUMERICAL RECIPES, W. PRESS ET AL., 2ND EDITION. -!---------------------------------------------------------------------------------------------------------------------- - INTEGER :: N,NP,K,J,I - REAL(8) :: D(NP),V(NP,NP),P - DO 13 I=1,N-1 - K=I - P=D(I) - DO 11 J=I+1,N - IF(D(J).GE.P)THEN - K=J - P=D(J) - ENDIF -11 CONTINUE - IF(K.NE.I)THEN - D(K)=D(I) - D(I)=P - DO 12 J=1,N - P=V(J,I) - V(J,I)=V(J,K) - V(J,K)=P -12 CONTINUE - ENDIF -13 CONTINUE - RETURN - END SUBROUTINE EIGSRT - - - SUBROUTINE GAUSSINV(N,X,W,U) -!---------------------------------------------------------------------------------------------------------------------- -! DLW: 091206: Computes the moments from the abscissas and weights. -! This routine is independent of the units used. -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - INTEGER :: N ! number of quadrature points - REAL(8) :: U(2*N) ! moments - REAL(8) :: X(N) ! abscissas - REAL(8) :: W(N) ! weights - - ! Local variables. - - INTEGER :: I - - DO I=1, 2*N - U(I) = SUM( W(:) * ( X(:)**(I-1) ) ) - ENDDO - - RETURN - END SUBROUTINE GAUSSINV - - - SUBROUTINE TEST_QUAD -!---------------------------------------------------------------------------------------------------------------------- -! DLW, 091306: Check quadrature routines. -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER, PARAMETER :: N = 6 ! number of quadrature points - REAL(8) :: X(2*N) ! moments - REAL(8) :: R(N) ! abscissas - REAL(8) :: W(N) ! weights - REAL(8) :: ZF ! =0.0 successful quadrature, =1.0 failed quadrature - INTEGER :: I,K - REAL(8) :: N0,DG,SIGMAG,SG - - ZF = 0.0D+00 - N0 = 1.0D+03 - DG = 0.1D+00 - SIGMAG = 1.6D+00 - SG = EXP( 0.5D+00 * ( LOG(SIGMAG) )**2 ) - DO I=1, 2*N - K = I-1 - X(I) = N0 * DG**K * SG**(K*K) - ENDDO - WRITE(*,90) X(:) - CALL GAUSS(N,X,R,W,ZF) - WRITE(*,90) R(:),W(:) - CALL GAUSSINV(N,R,W,X) - WRITE(*,90) X(:) - -90 FORMAT(50D18.10) - RETURN - END SUBROUTINE TEST_QUAD - - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_rad.F b/MATRIXchem_GridComp/microphysics/TRAMP_rad.F deleted file mode 100644 index 79e3b47f..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_rad.F +++ /dev/null @@ -1,665 +0,0 @@ -#include "rundeck_opts.h" - -c ----------------------------------------------------------------- - - - SUBROUTINE SETAMP(EXT,SCT,GCB,TAB) -!@sum Calculation of extinction, asymmetry and scattering for AMP Aerosols -!@sum Calculation of absorption in the longwave -!@sum Called in SETAER / RCOMPX -!@auth Susanne Bauer - USE domain_decomp_atm,ONLY: am_i_root - - USE AMP_AEROSOL, only: AMP_EXT, AMP_ASY, AMP_SCA, - + AMP_EXT_CS, AMP_ASY_CS, AMP_SCA_CS, AMP_Q55_CS, - + Reff_LEV, NUMB_LEV, RindexAMP, AMP_Q55, dry_Vf_LEV, - + MIX_OC, MIX_SU, MIX_AQ, AMP_RAD_KEY - USE AERO_CONFIG, only: NMODES - - USE MODEL_COM, only: lm,itime,itimeI - USE TRACER_COM, only: TRM - USE RADPAR, only: TTAUSV,aesqex,aesqsc,aesqcb,FSTOPX,FTTOPX !Diagnostics - - IMPLICIT NONE - - ! Arguments: Optical Parameters dimension(lm,wavelength) - REAL(8), INTENT(OUT) :: EXT(LM,6) ! Extinction, SW - REAL(8), INTENT(OUT) :: SCT(LM,6) ! Single Scattering Albedo, SW - REAL(8), INTENT(OUT) :: GCB(LM,6) ! Asymmetry Factor, SW - REAL(8), INTENT(OUT) :: TAB(LM,33) ! Thermal absorption Cross section, LW - - ! Local - - INTEGER l,n,w,MA,MB,MC,MD,NA,NS - REAL*8 Size(23), Mie_IM(17), Mie_RE(15), HELP, AMP_TAB(33), CORE_CLASS(nmodes), SHELL_CLASS(nmodes),Vf(6),CS_Mix(26) - REAL*8 a,b,AMPEXT,AMPSCA,AMPASY - DATA Size/0.002, 0.005,0.01,0.05,0.08,0.1,0.13,0.17,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.8,1.0,1.2,1.5,2.,3.,5.,10./ - DATA CS_Mix/0.,0.04,0.08,0.12,0.16,0.2,0.24,0.28 - + ,0.32,0.36,0.4,0.44,0.48,0.52,0.56,0.6 - + ,0.64,0.68,0.72,0.76,0.8,0.84,0.88,0.92,0.96,1.0/ - DATA Mie_RE/1.25,1.3,1.35,1.4,1.45,1.5,1.55,1.6,1.65,1.7,1.75,1.8,1.85,1.9,1.9/ - DATA Mie_IM/0.0,0.00001,0.00002,0.00005,0.0001,0.0002,0.0005,0.001,0.002,0.005,0.01,0.02,0.05,0.1,0.2,0.5,1.0/ -c AKK ACC DD1 DS1 DD2 DS2 SSA SSC OCC BC1 BC2 BC3 DBC BOC BCS MXX -c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 - DATA CORE_CLASS /1, 1, 6, 6, 6, 6, 2, 2, 4, 5, 5, 5, 6, 4, 5, 6/ - DATA SHELL_CLASS /0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2/ - CHARACTER*3 :: MODE_NAME(nmodes)=(/'AKK','ACC','DD1','DS1','DD2', - + 'DS2','SSA','SSC','OCC','BC1','BC2', - + 'BC3','DBC','BOC','BCS','MXX'/) -c NA1= SO4 NA2=SS NA3=NO3 NA4=OC NA5=BC NA6=DU - - EXT(:,:) = 0.d0 - SCT(:,:) = 0.d0 - GCB(:,:) = 0.d0 - TAB(:,:) = 0.d0 - TTAUSV(:,:) = 0.d0 - - if (itime.ne.itimeI) then - IF (AMP_RAD_KEY == 1 .or. AMP_RAD_KEY ==3) THEN - -c Shortwave: --------------------------------------------------------------------------------------------- - - DO l = 1,lm - DO n = 1,nmodes - - w = 6 ! aot at 550 - do MD = 1,23 - if (Reff_LEV(l,n) .le. Size(md)) goto 100 - enddo - 100 continue - if (MD.gt.1) then - b = Size(md) - Reff_LEV(l,n) - a = Reff_LEV(l,n) - Size(md-1) - endif - MD = min(23,MD) -c---- INTERNAL MIXTURE --------------------------------------------- - do MA = 1,15 - if ( real (RindexAMP(l,n,w)) .le. Mie_RE(MA)) goto 200 - enddo - 200 continue - do MB = 1,17 - if ( aimag (RindexAMP(l,n,w)) .le. Mie_IM(MB)) goto 201 - enddo - 201 continue - MA = min(15,MA) - MB = min(17,MB) - if (MD.gt.1) then - TTAUSV(l,n) = NUMB_LEV(l,n) * (a/(b+a)* AMP_Q55(MA,MB,MD) + b/(a+b) * AMP_Q55(MA,MB,MD-1)) - else - TTAUSV(l,n) = NUMB_LEV(l,n) * AMP_Q55(MA,MB,MD) - endif -C---------------------------------------------------------------------- - DO w = 1,6 !wavelength -c---- INTERNAL MIXTURE --------------------------------------------- - do MA = 1,15 - if ( real (RindexAMP(l,n,w)) .le. Mie_RE(MA)) goto 401 - enddo - 401 continue - do MB = 1,17 - if ( aimag (RindexAMP(l,n,w)) .le. Mie_IM(MB)) goto 402 - enddo - 402 continue - MA = min(15,MA) - MB = min(17,MB) - - if (MD.gt.1) then - AMPEXT = (a/(b+a)* AMP_EXT(MA,MB,MD,w) + b/(a+b) * AMP_EXT(MA,MB,MD-1,w)) - AMPSCA = (a/(b+a)* AMP_SCA(MA,MB,MD,w) + b/(a+b) * AMP_SCA(MA,MB,MD-1,w)) - AMPASY = (a/(b+a)* AMP_ASY(MA,MB,MD,w) + b/(a+b) * AMP_ASY(MA,MB,MD-1,w)) - else - AMPEXT = AMP_EXT(MA,MB,MD,w) - AMPSCA = AMP_SCA(MA,MB,MD,w) - AMPASY = AMP_ASY(MA,MB,MD,w) - endif -c-------------------------------------------------------------------- - EXT(l,w) = EXT(l,w) + ( AMPEXT * TTAUSV(l,n) * FSTOPX(n)) - HELP = ((GCB(l,w) * SCT(l,w) ) + (AMPASY * AMPSCA * TTAUSV(l,n)* FSTOPX(n))) - SCT(l,w) = SCT(l,w) + (AMPSCA * TTAUSV(l,n) * FSTOPX(n)) - GCB(l,w) = HELP / (SCT(l,w)+ 1.D-10) - - aesqex(l,w,n)= AMPEXT * TTAUSV(l,n) - aesqsc(l,w,n)= AMPSCA * TTAUSV(l,n) - aesqcb(l,w,n)= AMPASY * aesqsc(l,w,n) - - ENDDO ! wave - -C Longwave: --------------------------------------------------------------------------------------------- - NA = CORE_CLASS(n) - NS = SHELL_CLASS(n) - Vf(:)=dry_Vf_LEV(l,n,1:6) - CALL GET_LW(NA,NS,Reff_LEV(l,n),AMP_TAB,Vf) - TAB(l,:) = TAB(l,:) + (AMP_TAB(:) * TTAUSV(l,n) * FTTOPX(n)) - ENDDO ! modes - ENDDO ! level - -c write ss diagnostic on ds1 and ds2 - TTAUSV(:,4) = TTAUSV(:,7) - TTAUSV(:,6) = TTAUSV(:,8) - aesqex(:,:,4)= aesqex(:,:,7) - aesqex(:,:,6)= aesqex(:,:,8) - aesqsc(:,:,4)= aesqsc(:,:,7) - aesqsc(:,:,6)= aesqsc(:,:,8) - aesqcb(:,:,4)= aesqcb(:,:,7) - aesqcb(:,:,6)= aesqcb(:,:,8) - - ENDIF ! AMP_RAD_KEY=1or3 - -c -------------------------------------------------------------------------------------------------------- -c -------------------------------------------------------------------------------------------------------- - - IF (AMP_RAD_KEY == 2) THEN -c Shortwave: --------------------------------------------------------------------------------------------- - - DO l = 1,lm - DO n = 1,nmodes - - w = 6 ! aot at 550 - do MD = 1,23 - if (Reff_LEV(l,n) .le. Size(md)) goto 500 - enddo - 500 continue - if (MD.gt.1) then - b = Size(md) - Reff_LEV(l,n) - a = Reff_LEV(l,n) - Size(md-1) - endif - MD = min(23,MD) - - select case (MODE_NAME(n)) -c---- INTERNAL MIXTURE --------------------------------------------- - case ('AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','DBC','MXX') - - do MA = 1,15 - if ( real (RindexAMP(l,n,w)) .le. Mie_RE(MA)) goto 600 - enddo - 600 continue - do MB = 1,17 - if ( aimag (RindexAMP(l,n,w)) .le. Mie_IM(MB)) goto 601 - enddo - 601 continue - MA = min(15,MA) - MB = min(17,MB) - if (MD.gt.1) then - TTAUSV(l,n) = NUMB_LEV(l,n) * (a/(b+a)* AMP_Q55(MA,MB,MD) + b/(a+b) * AMP_Q55(MA,MB,MD-1)) - else - TTAUSV(l,n) = NUMB_LEV(l,n) * AMP_Q55(MA,MB,MD) - endif - -C------ CORE SHELL ------------------------------------------------- - case ('BC1','BC2','BC3','BOC','BCS') - - do MA = 1,26 - if (MIX_OC(l,n) .le. CS_MIX(MA)) goto 701 - enddo - 701 continue - do MB = 1,26 - if (MIX_SU(l,n) .le. CS_MIX(MB)) goto 702 - enddo - 702 continue - do MC = 1,26 - if (MIX_AQ(l,n) .le. CS_MIX(MC)) goto 703 - enddo - 703 continue - - MA = min(26,MA-1) - MB = min(26,MB-1) - MC = min(26,MC-1) - MA = max(1,MA-1) - MB = max(1,MB-1) - MC = max(1,MC-1) - - if (MD.gt.1) then - TTAUSV(l,n) = NUMB_LEV(l,n) * (a/(b+a)* AMP_Q55_CS(MD,MA,MB,MC) + b/(a+b) * AMP_Q55_CS(MD-1,MA,MB,MC)) - else - TTAUSV(l,n) = NUMB_LEV(l,n) * AMP_Q55_CS(MD,MA,MB,MC) - endif - end select -C---------------------------------------------------------------------- - DO w = 1,6 !wavelength -c---- INTERNAL MIXTURE --------------------------------------------- - - select case (MODE_NAME(n)) - - case ('AKK','ACC','DD1','DS1','DD2','DS2','SSA','SSC','OCC','DBC','MXX') - - do MA = 1,15 - if ( real (RindexAMP(l,n,w)) .le. Mie_RE(MA)) goto 801 - enddo - 801 continue - do MB = 1,17 - if ( aimag (RindexAMP(l,n,w)) .le. Mie_IM(MB)) goto 802 - enddo - 802 continue - MA = min(15,MA) - MB = min(17,MB) - - if (MD.gt.1) then - AMPEXT = (a/(b+a)* AMP_EXT(MA,MB,MD,w) + b/(a+b) * AMP_EXT(MA,MB,MD-1,w)) - AMPSCA = (a/(b+a)* AMP_SCA(MA,MB,MD,w) + b/(a+b) * AMP_SCA(MA,MB,MD-1,w)) - AMPASY = (a/(b+a)* AMP_ASY(MA,MB,MD,w) + b/(a+b) * AMP_ASY(MA,MB,MD-1,w)) - else - AMPEXT = AMP_EXT(MA,MB,MD,w) - AMPSCA = AMP_SCA(MA,MB,MD,w) - AMPASY = AMP_ASY(MA,MB,MD,w) - endif -C------ CORE SHELL ------------------------------------------------- - case ('BC1','BC2','BC3','BOC','BCS') - - do MA = 1,26 - if (MIX_OC(l,n) .le. CS_MIX(MA)) goto 805 - enddo - 805 continue - do MB = 1,26 - if (MIX_SU(l,n) .le. CS_MIX(MB)) goto 806 - enddo - 806 continue - do MC = 1,26 - if (MIX_AQ(l,n) .le. CS_MIX(MC)) goto 807 - enddo - 807 continue - - MA = min(26,MA-1) - MB = min(26,MB-1) - MC = min(26,MC-1) - MA = max(1,MA-1) - MB = max(1,MB-1) - MC = max(1,MC-1) - - if (MD.gt.1) then - AMPEXT = (a/(b+a)* AMP_EXT_CS(MD,MA,MB,MC,w) + b/(a+b) * AMP_EXT_CS(MD-1,MA,MB,MC,w)) - AMPSCA = (a/(b+a)* AMP_SCA_CS(MD,MA,MB,MC,w) + b/(a+b) * AMP_SCA_CS(MD-1,MA,MB,MC,w)) - AMPASY = (a/(b+a)* AMP_ASY_CS(MD,MA,MB,MC,w) + b/(a+b) * AMP_ASY_CS(MD-1,MA,MB,MC,w)) - else - AMPEXT = AMP_EXT_CS(MD,MA,MB,MC,w) - AMPSCA = AMP_SCA_CS(MD,MA,MB,MC,w) - AMPASY = AMP_ASY_CS(MD,MA,MB,MC,w) - endif - end select -c-------------------------------------------------------------------- - EXT(l,w) = EXT(l,w) + ( AMPEXT * TTAUSV(l,n) * FSTOPX(n)) - HELP = ((GCB(l,w) * SCT(l,w) ) + (AMPASY * AMPSCA * TTAUSV(l,n)* FSTOPX(n))) - SCT(l,w) = SCT(l,w) + (AMPSCA * TTAUSV(l,n) * FSTOPX(n)) - GCB(l,w) = HELP / (SCT(l,w)+ 1.D-10) - - aesqex(l,w,n)= AMPEXT * TTAUSV(l,n) - aesqsc(l,w,n)= AMPSCA * TTAUSV(l,n) - aesqcb(l,w,n)= AMPASY * aesqsc(l,w,n) - - ENDDO ! wave - -C Longwave: --------------------------------------------------------------------------------------------- - NA = CORE_CLASS(n) - NS = SHELL_CLASS(n) - Vf(:)=dry_Vf_LEV(l,n,1:6) - CALL GET_LW(NA,NS,Reff_LEV(l,n),AMP_TAB,Vf) - TAB(l,:) = TAB(l,:) + (AMP_TAB(:) * TTAUSV(l,n) * FTTOPX(n)) - ENDDO ! modes - ENDDO ! level - -c write ss diagnostic on ds1 and ds2 - TTAUSV(:,4) = TTAUSV(:,7) - TTAUSV(:,6) = TTAUSV(:,8) - aesqex(:,:,4)= aesqex(:,:,7) - aesqex(:,:,6)= aesqex(:,:,8) - aesqsc(:,:,4)= aesqsc(:,:,7) - aesqsc(:,:,6)= aesqsc(:,:,8) - aesqcb(:,:,4)= aesqcb(:,:,7) - aesqcb(:,:,6)= aesqcb(:,:,8) - - ENDIF ! AMP_RAD_KEY = 2 - endif - - RETURN - END SUBROUTINE SETAMP -c ----------------------------------------------------------------- - -c ----------------------------------------------------------------- - SUBROUTINE SETAMP_LEV(i,j,l) -!@sum Calulates effective Radius and Refractive Index for Mixed Aerosols -!@sum Puts AMP Aerosols in 1 dimension CALLED in RADIA -!@auth Susanne Bauer - - USE AMP_AEROSOL, only: DIAM, Reff_LEV, NUMB_LEV, RindexAMP,NUMB_SS, - + dry_Vf_LEV,MIX_OC,MIX_SU,MIX_AQ,AMP_dens, AMP_RAD_KEY - USE TRACER_COM, only: TRM, ntmAMPi,ntmAMPe, AMP_AERO_MAP,AMP_NUMB_MAP,AMP_MODES_MAP,trname - USE AERO_CONFIG, only: NMODES - USE AERO_SETUP, only: SIG0, CONV_DPAM_TO_DGN !(nmodes * npoints) lognormal parameters for each mode - USE GEOM, only: BYDXYP ! inverse area of gridbox [m-2] - - USE AERO_ACTV, only: DENS_SULF, DENS_DUST,DENS_SEAS, DENS_BCAR, DENS_OCAR - IMPLICIT NONE - - ! Arguments: - INTEGER, INTENT(IN) :: i,j,l - - ! Local - INTEGER n,w,s,nAMP - REAL*8, DIMENSION(nmodes,7) :: VolFrac, VMass - REAL*8 :: H2O, NO3 - REAL(8), PARAMETER :: TINYNUMER = 1.0D-30 - COMPLEX*8, DIMENSION(6,7) :: Ri -c Variables for Maxwell Garnett: - REAL*8 :: V_bc, V_host - COMPLEX*8 :: M_mg, M_bc, M_host - CHARACTER*3 :: MODE_NAME(nmodes)=(/'AKK','ACC','DD1','DS1','DD2', - + 'DS2','SSA','SSC','OCC','BC1','BC2', - + 'BC3','DBC','BOC','BCS','MXX'/) -c Andies data incl Solar weighting - integral over 6 radiation band - DATA Ri/(1.46099, 0.0764233) ,(1.48313, 0.000516502), !Su - & (1.49719, 1.98240e-05) ,(1.50793, 1.64469e-06), - & (1.52000, 1.00000e-07) ,(1.52815, 1.00000e-07), - -c & (1.80056, 0.605467) ,(1.68622, 0.583112), !Bc -c & (1.63586, 0.551897) ,(1.59646, 0.515333), -c & (1.57466, 0.484662) ,(1.56485, 0.487992), -c only 550nm values -c & (1.85, 0.71) ,(1.85, 0.71), !Bc -c & (1.85, 0.71) ,(1.85, 0.71), -c & (1.85, 0.71) ,(1.85, 0.71), -cBond + Berstroem, all wavelength - & (2.15, 1.05) ,(1.98, 0.79), !Bc - & (1.92, 0.75) ,(1.86, 0.73), - & (1.85, 0.71) ,(1.85, 0.71), - - & (1.46099, 0.0761930) ,(1.48313, 0.00470000), !Oc - & (1.49719, 0.00470000) ,(1.50805, 0.00480693), - & (1.52000, 0.00540000) ,(1.52775, 0.0144927), - - & (1.47978, 0.0211233) ,(1.50719, 0.00584169), !Du - & (1.51608, 0.00378434) ,(1.52998, 0.00178703), - & (1.54000, 0.000800000) ,(1.56448, 0.00221463), - - & (1.46390, 0.00571719) ,(1.45000, 0.00000), !Ss - & (1.45000, 0.00000) ,(1.45000, 0.00000), - & (1.45000, 0.00000) ,(1.45000, 0.00000), - - & (1.46099, 0.0764233) ,(1.48313, 0.000516502), !No3 - & (1.49719, 1.98240e-05) ,(1.50793, 1.64469e-06), - & (1.52000, 1.00000e-07) ,(1.52815, 1.00000e-07), - - & (1.26304, 0.0774872) ,(1.31148, 0.000347758), !H2O - & (1.32283, 0.000115835) ,(1.32774, 3.67435e-06), - & (1.33059, 1.58222e-07) ,(1.33447, 3.91074e-08)/ - - - ! + Effective Radius [um] per Mode = geometric mass mean radius - DO n=1,nmodes - Reff_LEV(l,n) = DIAM(i,j,l,n) * 0.5e6 - ENDDO - - ! + Mass and Number Concentration - DO n=ntmAMPi,ntmAMPe - nAMP=n-ntmAMPi+1 - if(trname(n) .eq.'M_NO3') NO3 =trm(i,j,l,n) - if(trname(n) .eq.'M_H2O') H2O =trm(i,j,l,n) - if(AMP_NUMB_MAP(nAMP).eq. 0) then ! Volume fraction - if(trname(n)(6:8).eq.'_SU') VMass(AMP_MODES_MAP(nAMP),1) =trm(i,j,l,n)/DENS_SULF - if(trname(n)(6:8).eq.'_BC') VMass(AMP_MODES_MAP(nAMP),2) =trm(i,j,l,n)/DENS_BCAR - if(trname(n)(6:8).eq.'_OC') VMass(AMP_MODES_MAP(nAMP),3) =trm(i,j,l,n)/DENS_OCAR - if(trname(n)(6:8).eq.'_DU') VMass(AMP_MODES_MAP(nAMP),4) =trm(i,j,l,n)/DENS_DUST - if(trname(n)(6:8).eq.'_SS') VMass(AMP_MODES_MAP(nAMP),5) =trm(i,j,l,n)/DENS_SEAS - else ! Number -! [ - ] [#/gb] [m-2] - NUMB_LEV(l,AMP_NUMB_MAP(nAMP)) =trm(i,j,l,n) * bydxyp(j) - endif - ENDDO - - NUMB_LEV(l,7) = NUMB_SS(i,j,l,1) * bydxyp(j) - NUMB_LEV(l,8) = NUMB_SS(i,j,l,2) * bydxyp(j) - - ! + Volume Fraction - DO n=1,nmodes ![#/m2] pi/4 [m2] - NUMB_LEV(l,n) = NUMB_LEV(l,n)* 0.7853 * DIAM(i,j,l,n)**2 - ! NO3 - VMass(n,6) = VMass(n,1) / Sum(VMass(:,1)) * NO3/ 1720. - ! H2O - VMass(n,7) = VMass(n,1) /(Sum(VMass(:,1)) + TINYNUMER) * H2O /1000. - ENDDO - - DO s=1,7 ! loop over species - DO n=1,nmodes ! loop over modes - Volfrac(n,s) = VMass(n,s) / (Sum(VMass(n,:)) + TINYNUMER) - dry_Vf_LEV(l,n,s) = VMass(n,s) / (Sum(VMass(n,1:6)) + TINYNUMER) - ! Core Shell Composition - if (n.eq.14) then ! BOC - MIX_OC(l,n) = VMass(n,3) / (VMass(n,1) + VMass(n,2) + VMass(n,3) + VMass(n,7) + TINYNUMER) - MIX_SU(l,n) = VMass(n,1) / (VMass(n,1) + VMass(n,2) + VMass(n,3) + VMass(n,7) + TINYNUMER) - MIX_AQ(l,n) = VMass(n,7) / (VMass(n,1) + VMass(n,2) + VMass(n,3) + VMass(n,7) + TINYNUMER) - endif - if (n.eq.15) then ! BCS - MIX_OC(l,n) = 0.d0 - MIX_SU(l,n) = VMass(n,1) / (VMass(n,1) + VMass(n,2) + VMass(n,7) + TINYNUMER) - MIX_AQ(l,n) = VMass(n,7) / (VMass(n,1) + VMass(n,2) + VMass(n,7) + TINYNUMER) - endif - if (n.ge.10.and.n.le.12) then ! BC123 - MIX_OC(l,n) = 0.d0 - MIX_SU(l,n) = VMass(n,1) / (VMass(n,1) + VMass(n,2) + VMass(n,7) + TINYNUMER) - MIX_AQ(l,n) = VMass(n,7) / (VMass(n,1) + VMass(n,2) + VMass(n,7) + TINYNUMER) - endif - ENDDO - ENDDO - - ! + Refractive Index of Aerosol mix per mode and wavelength - - RindexAMP(l,:,:) = 0.d0 - DO s=1,7 ! loop over species - DO w=1,6 ! loop over wavelength - DO n=1,nmodes ! loop over modes - RindexAMP(l,n,w) = RindexAMP(l,n,w) + ( Volfrac(n,s) * Ri(w,s)) - ENDDO - ENDDO - ENDDO - - if (AMP_RAD_KEY == 3) then ! - - - Maxwell Garnett Mixing Rule - DO w=1,6 ! loop over wavelength - DO n=1,nmodes ! loop over modes - select case (MODE_NAME(n)) - case ('BC1','BC2','BC3','BOC','BCS') - M_bc = Ri(w,2) - M_host = ( Volfrac(n,1) * Ri(w,1)) - DO s=3,7 ! loop over species other that BC - M_host = M_host + ( Volfrac(n,s) * Ri(w,s)) - ENDDO - V_bc = Volfrac(n,2) - V_host = Volfrac(n,1)+Volfrac(n,3)+Volfrac(n,4)+Volfrac(n,5)+Volfrac(n,6)+Volfrac(n,7) - M_mg = M_host**2 * (M_bc**2 + 2.d0 * M_host**2 + 2.d0 * V_bc * (M_bc - M_host ) ) - + / (M_bc**2 + 2.d0 * M_host**2 - V_host*(M_bc**2 - M_host**2) ) - - RindexAMP(l,n,w) = SQRT( M_mg) - end select - ENDDO - ENDDO - endif - - RETURN - END SUBROUTINE SETAMP_LEV -c ----------------------------------------------------------------- - -c ----------------------------------------------------------------- - SUBROUTINE SETUP_RAD -!@sum Initialization for Radiation incl. Aerosol Microphysics -!@auth Susanne Bauer - - USE AMP_AEROSOL, only: AMP_EXT, AMP_ASY, AMP_SCA, AMP_Q55, - + AMP_EXT_CS, AMP_ASY_CS, AMP_SCA_CS, AMP_Q55_CS - - IMPLICIT NONE - include 'netcdf.inc' - integer start(4),count(4),count3(3),status - integer start2(5),count2(5),count32(4) - integer ncid, id1, id2, id3, id4,ncid2 - - real*4, DIMENSION(15,17,23,6) :: ASY,SCA,EXT - real*4, DIMENSION(15,17,23) :: QEX - real*4, DIMENSION(23,26,26,26,6) :: CS_ASY,CS_SCA,CS_EXT - real*4, DIMENSION(23,26,26,26) :: CS_QEX -c ----------------------------------------------------------------- -c Opening of the files to be read: MIE TABLES -c ----------------------------------------------------------------- - status=NF_OPEN('AMP_MIE_TABLES',NCNOWRIT,ncid) - status=NF_INQ_VARID(ncid,'ASYM',id1) - status=NF_INQ_VARID(ncid,'QEXT',id2) - status=NF_INQ_VARID(ncid,'QSCT',id3) - status=NF_INQ_VARID(ncid,'Q55E',id4) -c ----------------------------------------------------------------- -c read -c ----------------------------------------------------------------- - start(1)=1 - start(2)=1 - start(3)=1 - start(4)=1 - - count(1)=15 - count(2)=17 - count(3)=23 - count(4)=6 - count3(1)=15 - count3(2)=17 - count3(3)=23 - - - status=NF_GET_VARA_REAL(ncid,id1,start,count,ASY) - status=NF_GET_VARA_REAL(ncid,id2,start,count,EXT) - status=NF_GET_VARA_REAL(ncid,id3,start,count,SCA) - status=NF_GET_VARA_REAL(ncid,id4,start,count3,QEX) - - status=NF_CLOSE('AMP_MIE_TABLES',NCNOWRIT,ncid) - - AMP_ASY = ASY - AMP_EXT = EXT - AMP_SCA = SCA - AMP_Q55 = QEX -c ----------------------------------------------------------------- -c Opening of the files to be read: Core Shell Mie Tables -c Core is BC, Shell Material is OC, SO4 and H2O -c ----------------------------------------------------------------- - status=NF_OPEN('AMP_CORESHELL_TABLES',NCNOWRIT,ncid2) - status=NF_INQ_VARID(ncid2,'CS_ASYM',id1) - status=NF_INQ_VARID(ncid2,'CS_QEXT',id2) - status=NF_INQ_VARID(ncid2,'CS_QSCT',id3) - status=NF_INQ_VARID(ncid2,'CS_Q55E',id4) -c ----------------------------------------------------------------- -c read -c ----------------------------------------------------------------- - start2(1)=1 - start2(2)=1 - start2(3)=1 - start2(4)=1 - start2(5)=1 - - count2(1)=23 - count2(2)=26 - count2(3)=26 - count2(4)=26 - count2(5)=6 - count32(1)=23 - count32(2)=26 - count32(3)=26 - count32(4)=26 - - - status=NF_GET_VARA_REAL(ncid2,id1,start2,count2,CS_ASY) - status=NF_GET_VARA_REAL(ncid2,id2,start2,count2,CS_EXT) - status=NF_GET_VARA_REAL(ncid2,id3,start2,count2,CS_SCA) - status=NF_GET_VARA_REAL(ncid2,id4,start2,count32,CS_QEX) - - status=NF_CLOSE('AMP_CORESHELL_TABLES',NCNOWRIT,ncid2) - - AMP_ASY_CS = CS_ASY - AMP_EXT_CS = CS_EXT - AMP_SCA_CS = CS_SCA - AMP_Q55_CS = CS_QEX - RETURN - END SUBROUTINE SETUP_RAD -c ----------------------------------------------------------------- - -c ----------------------------------------------------------------- - SUBROUTINE GET_LW(NA,NS,AREFF,TQAB,Vf) -!@sum Calculation of LW absorption for AMP aerosols -!@sum Called in SETAER / RCOMPX -!@auth Susanne Bauer - - USE RADPAR, only: TRUQEX, TRSQEX, TRDQEX, TRUQSC, TRSQSC, TRDQSC - * , REFU22, REFS25, REFD25 - INTEGER, intent(IN) :: NA,NS - REAL*8, intent(in) :: areff,Vf(6) - REAL*8 TQEX(33),TQSC(33),TQAB(33),TQEX_S(33),TQSC_S(33) - REAL*8 QXAERN(25),QSAERN(25) - REAL*8 wts,wta - INTEGER n0,k,n,nn - -c CORE - IF(NA==0) THEN - TQAB(:)= 0d0 - ENDIF - ! 1 2 3 4 - IF(NA > 0 .and. NA < 5) THEN ! NA : Aerosol compositions SO4,SEA,NO3,OC - N0=0 - IF(NA==2) N0=22 - IF(NA==3) N0=44 - IF(NA==4) N0=88 - - DO 114 K=1,33 - DO 113 N=1,22 - NN=N0+N - QXAERN(N)=TRUQEX(K,NN) - QSAERN(N)=TRUQSC(K,NN) - 113 CONTINUE - CALL SPLINE(REFU22,QXAERN,22,AREFF,TQEX(K),1.D0,1.D0,1) - CALL SPLINE(REFU22,QSAERN,22,AREFF,TQSC(K),1.D0,1.D0,1) - TQAB(K)=TQEX(K)-TQSC(K) - 114 CONTINUE - - ENDIF - - ! 5 - IF(NA==5) THEN ! NA : Aerosol compositions BC - DO 124 K=1,33 - QXAERN(:)=TRSQEX(K,:) ! 1:25 - QSAERN(:)=TRSQSC(K,:) ! 1:25 - CALL SPLINE(REFS25,QXAERN,25,AREFF,TQEX(K),1.D0,1.D0,1) - CALL SPLINE(REFS25,QSAERN,25,AREFF,TQSC(K),1.D0,1.D0,1) - TQAB(K)=TQEX(K)-TQSC(K) - 124 CONTINUE - - ENDIF - - ! 6 - IF(NA==6) THEN ! NA : Aerosol composition DST - DO 134 K=1,33 - QXAERN(:)=TRDQEX(K,:) ! 1:25 - QSAERN(:)=TRDQSC(K,:) ! 1:25 - CALL SPLINE(REFD25,QXAERN,25,AREFF,TQEX(K),1.D0,1.D0,1) - CALL SPLINE(REFD25,QSAERN,25,AREFF,TQSC(K),1.D0,1.D0,1) - TQAB(K)=TQEX(K)-TQSC(K) - 134 CONTINUE - - ENDIF - -c SHELL - IF(NS > 0 .and. NS < 5) THEN ! NS : Aerosol compositions SO4,SEA,NO3,OC - N0=0 - IF(NS==2) N0=22 - IF(NS==3) N0=44 - IF(NS==4) N0=88 - - - DO K=1,33 - DO N=1,22 - NN=N0+N - IF (NS==1) WTS=Vf(1) ! <- shell fraction of aerosol composition - IF (NS==2) WTS=Vf(5) ! <- shell fraction of aerosol composition - WTA=1.D0-WTS - QXAERN(N)=TRUQEX(K,NN) - QSAERN(N)=TRUQSC(K,NN) - ENDDO - CALL SPLINE(REFU22,QXAERN,22,AREFF,TQEX_S(K),1.D0,1.D0,1) - CALL SPLINE(REFU22,QSAERN,22,AREFF,TQSC_S(K),1.D0,1.D0,1) - TQAB(K)=(TQEX(K)*WTA + TQEX_S(K)*WTS)-(TQSC(K)*WTA + TQSC_S(K)*WTS) - ENDDO - - ENDIF - - RETURN - END SUBROUTINE GET_LW -c ----------------------------------------------------------------- - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_setup.F b/MATRIXchem_GridComp/microphysics/TRAMP_setup.F deleted file mode 100644 index c7e2fdb9..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_setup.F +++ /dev/null @@ -1,1613 +0,0 @@ - MODULE AERO_SETUP -!------------------------------------------------------------------------------- -! -!@sum This module contains various aerosol microphysical variables and routines. -!@auth Susanne Bauer/Doug Wright -!------------------------------------------------------------------------------- - USE AERO_PARAM - USE AERO_CONFIG - IMPLICIT NONE - - INTEGER, SAVE :: MODE_NUMB_AKK, MODE_NUMB_ACC, MODE_NUMB_DD1, MODE_NUMB_DD2 - INTEGER, SAVE :: MODE_NUMB_DS1, MODE_NUMB_DS2, MODE_NUMB_SSA, MODE_NUMB_SSC - INTEGER, SAVE :: MODE_NUMB_SSS, MODE_NUMB_OCC, MODE_NUMB_BC1, MODE_NUMB_BC2 - INTEGER, SAVE :: MODE_NUMB_BC3, MODE_NUMB_DBC, MODE_NUMB_BOC, MODE_NUMB_BCS - INTEGER, SAVE :: MODE_NUMB_OCS, MODE_NUMB_MXX - !------------------------------------------------------------------------- - ! NMODES_XXXX is the number of modes containing species XXXX. - ! NMODES_SEAS is the number of modes containing sea salt, not the - ! number of sea salt modes. - ! NUMBER_OF_SEASALT_MODES is the number of sea salt modes, either 1 (SSS) - ! or 2 (SSA and SSC). - !------------------------------------------------------------------------- - INTEGER, SAVE :: NMODES_SULF, NMODES_BCAR, NMODES_OCAR, NMODES_DUST, NMODES_SEAS - INTEGER, SAVE :: NUMBER_OF_SEASALT_MODES - INTEGER, SAVE :: NUMB_MAP(NWEIGHTS) ! [1] - INTEGER, SAVE :: MASS_MAP(NWEIGHTS,NMASS_SPCS) ! [1] - INTEGER, SAVE :: PROD_INDEX(NWEIGHTS,NMASS_SPCS) ! [1] - INTEGER, SAVE, ALLOCATABLE :: SULF_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: BCAR_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: OCAR_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: DUST_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: SEAS_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: SEAS_MODE_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: SEAS_MODE_MASS_MAP(:) ! [1] - INTEGER, SAVE, ALLOCATABLE :: MODE_NUMB_SEAS(:) ! [1] - INTEGER, SAVE :: NM(NWEIGHTS) ! [1] - CHARACTER(LEN=4), SAVE :: NM_SPC_NAME(NWEIGHTS,NMASS_SPCS) - - type GIKLQ_type - integer :: n - integer, allocatable :: l(:), k(:) - integer, allocatable :: qq(:) - end type GIKLQ_type - - type DIKL_type - integer :: i - integer :: k - integer :: l - end type DIKL_type - - type (GIKLQ_type), allocatable, save :: GIKLQ_control(:) - type (DIKL_type), allocatable, save :: DIKL_control(:) - integer, save :: nDIKL - - INTEGER, SAVE :: GIKLQ(NWEIGHTS,NWEIGHTS,NWEIGHTS,NMASS_SPCS) ! [1] - INTEGER, SAVE :: DIKL (NWEIGHTS,NWEIGHTS,NWEIGHTS) ! [1] - INTEGER, SAVE :: DIJ (NWEIGHTS,NWEIGHTS) ! [1] - REAL(8), SAVE :: xDIJ (NWEIGHTS,NWEIGHTS) ! [1] - REAL(8), SAVE :: RECIP_PART_MASS(NEMIS_SPCS) ! [1/ug] - REAL(8), SAVE :: KCI_COEF_DP (NWEIGHTS,NLAYS) ! [m^3/s] - REAL(8), SAVE :: KCI_COEF_DP_AEQ1(NWEIGHTS,NLAYS) ! [m^3/s] - REAL(8), SAVE :: THETA_POLY (NWEIGHTS) ! [1] - REAL(8), SAVE :: DP0(NWEIGHTS) ! default mode diameters of average mass [m] - ! calculated from the DGN0 and SIG0 values - REAL(8), SAVE :: DP0_EMIS(NWEIGHTS) ! mode diameters of average mass [m] for emissions, - ! calculated from the DGN0_EMIS and SIG0_EMIS values - !------------------------------------------------------------------------- - ! DIFFCOEF_M2S(I) is the diffusivity of H2SO4 in air [m^2/s] for layer L. - !------------------------------------------------------------------------- - REAL(8), SAVE :: DIFFCOEF_M2S(NLAYS) - !------------------------------------------------------------------------- - ! KAPPAI(I) is the activating fraction for mode I. - !------------------------------------------------------------------------- - REAL(8), SAVE :: KAPPAI(NWEIGHTS) - !------------------------------------------------------------------------- - ! DENSPI(I) is the default particle density for mode I. - ! DENS_COMP(I) is the density of chemical component I. - ! RECIP_DENS_COMP(I) is the reciprocal density of chemical component I. - !------------------------------------------------------------------------- - REAL(8), SAVE :: DENSPI(NWEIGHTS) ! [g/cm^3] - REAL(8), SAVE :: DENS_COMP(NWEIGHTS) ! [g/cm^3] - REAL(8), SAVE :: RECIP_DENS_COMP(NWEIGHTS) ! [cm^3/g] - !------------------------------------------------------------------------- - ! Characteristic lognormal parameters for each mode: DGN0 [um], SIG0 [1]. - !------------------------------------------------------------------------- - REAL(8), SAVE :: DGN0(NWEIGHTS) - REAL(8), SAVE :: SIG0(NWEIGHTS) - REAL(8), SAVE :: LNSIG0(NWEIGHTS) ! ln( SIG0 ) - !------------------------------------------------------------------------- - ! Lognormal parameters for emissions into each mode: - ! DGN0_EMIS [um], SIG0_EMIS [1]. - ! These are used to convert mass emission rates to number emission rates. - !------------------------------------------------------------------------- - REAL(8), SAVE :: DGN0_EMIS(NWEIGHTS) - REAL(8), SAVE :: SIG0_EMIS(NWEIGHTS) - !------------------------------------------------------------------------- - ! CONV_DPAM_TO_DGN(I) converts the diameter of average mass to the - ! geometric mean diameter of the number size distribution for mode I, - ! based on an assumed standard deviation for each mode. - !------------------------------------------------------------------------- - REAL(8), SAVE :: CONV_DPAM_TO_DGN(NWEIGHTS) - !------------------------------------------------------------------------- - ! EMIS_MODE_MAP and EMIS_SPCS_MAP have elements corresponding to - ! the aerosol types (in this order): AKK(=1), ACC(=2), BCC(=8), OCC(=7), - ! DD1(=3), SSA(=5), SSC(=6), BOC(BC=8), BOC(OC=9), DD2(=10). - ! EMIS_MODE_MAP(J) is mode number receiving the emissions held - ! in EMIS_MASS(J). - ! EMIS_SPCS_MAP(J) is the chemical species number (1-5) of the chemical - ! species held in EMIS_MASS(J). - !------------------------------------------------------------------------- - INTEGER, SAVE :: EMIS_MODE_MAP(NEMIS_SPCS) - INTEGER, DIMENSION(NEMIS_SPCS) :: EMIS_SPCS_MAP = (/1,1,2,3,4,5,5,2,3,4/) - !------------------------------------------------------------------------- - ! The dimensions of these arrays depends upon mechanism. - ! SEAS_MAP(I) is the mean mass per particle for sea salt mode I. - !------------------------------------------------------------------------- - CHARACTER(LEN= 3), SAVE, ALLOCATABLE :: MODE_NAME(:) - INTEGER, SAVE, ALLOCATABLE :: MODE_SPCS(:,:) - CHARACTER(LEN=16), SAVE, ALLOCATABLE :: AERO_SPCS(:) - INTEGER, SAVE, ALLOCATABLE :: ICOND(:) - REAL, SAVE, ALLOCATABLE :: RECIP_SEAS_MPP(:) ! [1/ug] - CHARACTER(LEN=3), SAVE, ALLOCATABLE :: CITABLE(:,:) - LOGICAL, SAVE :: INTERMODAL_TRANSFER - !------------------------------------------------------------------------------------------------------------------- - ! Diameter of average mass, averaged over all modes, used in the KK02 parameterization in subr. NPFRATE. - !------------------------------------------------------------------------------------------------------------------- - REAL(8) :: AVG_DP_OF_AVG_MASS_METERS = 150.0D-09 ! [m] initial value; updated in subr. MATRIX. - !------------------------------------------------------------------------------------------------------------------- - ! Variables for the lookup table for condensational growth. - !------------------------------------------------------------------------------------------------------------------- - INTEGER, PARAMETER :: N_DP_CONDTABLE = 1000 ! [1] number of tabulated particle diameters - REAL(8), PARAMETER :: DP_CONDTABLE_MIN = DPMIN_GLOBAL ! [m] minimum ambient particle diameter - REAL(8), PARAMETER :: DP_CONDTABLE_MAX = DPMAX_GLOBAL ! [m] maximum ambient particle diameter - REAL(8) :: DP_CONDTABLE(N_DP_CONDTABLE) ! [m] tabulated particle ambient diameters. - REAL(8), SAVE :: XLN_SCALE_DP ! [1] ln of table diameter ratio. - REAL(8), SAVE :: KCI_DP_CONDTABLE (N_DP_CONDTABLE,NLAYS) ! [m^3/s] tabulated condensational growth factors. - REAL(8), SAVE :: KCI_DP_CONDTABLE_AEQ1(N_DP_CONDTABLE,NLAYS) ! [m^3/s] tabulated condensational growth factors - ! for the mass accommodation coefficient - ! set to unity. - - CONTAINS - - - SUBROUTINE SETUP_CONFIG -!------------------------------------------------------------------------------- -! Routine to initialize variables that depend upon choice of mechanism. -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I,J,K,INDEX,IDIM - LOGICAL :: FOUND - LOGICAL, SAVE :: FIRSTIME = .TRUE. - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - !----------------------------------------------------------------------- - ! Get the number of modes in the selected mechanism. - !----------------------------------------------------------------------- - IDIM = 0 - IF ( MECH .EQ. 1 ) IDIM = NM1 - IF ( MECH .EQ. 2 ) IDIM = NM2 - IF ( MECH .EQ. 3 ) IDIM = NM3 - IF ( MECH .EQ. 4 ) IDIM = NM4 - IF ( MECH .EQ. 5 ) IDIM = NM5 - IF ( MECH .EQ. 6 ) IDIM = NM6 - IF ( MECH .EQ. 7 ) IDIM = NM7 - IF ( MECH .EQ. 8 ) IDIM = NM8 - IF ( IDIM .NE. NMODES ) THEN - WRITE(*,*)'ERROR in mechanism number MECH: MECH = ', MECH - STOP - ENDIF - ALLOCATE( MODE_NAME(IDIM) ) - ALLOCATE( MODE_SPCS(NMASS_SPCS,IDIM) ) - ALLOCATE( AERO_SPCS(NAEROBOX) ) - ALLOCATE( ICOND(IDIM) ) - ALLOCATE( CITABLE(IDIM,IDIM) ) - MODE_NAME(:) = ' ' - MODE_SPCS(:,:) = 0 - AERO_SPCS(:) = ' ' - ICOND(:) = 0 - CITABLE(:,:) = ' ' - ENDIF - !------------------------------------------------------------------------- - ! Initialize arrays for coagulation interactions, mode names, mode - ! species, condensation flags, and whether mode BC3 is present in the - ! selected mechanism. - !------------------------------------------------------------------------- - IF ( MECH .EQ. 1 ) THEN - CITABLE(:,:) = CITABLE1(:,:) - MODE_NAME(:) = MNAME(MODES1(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES1(:)) - ICOND(:) = ICOND1(:) - INCLUDE_BC3 = .TRUE. - ELSEIF ( MECH .EQ. 2 ) THEN - CITABLE(:,:) = CITABLE2(:,:) - MODE_NAME(:) = MNAME(MODES2(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES2(:)) - ICOND(:) = ICOND2(:) - INCLUDE_BC3 = .FALSE. - ELSEIF ( MECH .EQ. 3 ) THEN - CITABLE(:,:) = CITABLE3(:,:) - MODE_NAME(:) = MNAME(MODES3(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES3(:)) - ICOND(:) = ICOND3(:) - INCLUDE_BC3 = .FALSE. - ELSEIF ( MECH .EQ. 4 ) THEN - CITABLE(:,:) = CITABLE4(:,:) - MODE_NAME(:) = MNAME(MODES4(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES4(:)) - ICOND(:) = ICOND4(:) - INCLUDE_BC3 = .FALSE. - ELSEIF ( MECH .EQ. 5 ) THEN - CITABLE(:,:) = CITABLE5(:,:) - MODE_NAME(:) = MNAME(MODES5(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES5(:)) - ICOND(:) = ICOND5(:) - INCLUDE_BC3 = .TRUE. - ELSEIF ( MECH .EQ. 6 ) THEN - CITABLE(:,:) = CITABLE6(:,:) - MODE_NAME(:) = MNAME(MODES6(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES6(:)) - ICOND(:) = ICOND6(:) - INCLUDE_BC3 = .FALSE. - ELSEIF ( MECH .EQ. 7 ) THEN - CITABLE(:,:) = CITABLE7(:,:) - MODE_NAME(:) = MNAME(MODES7(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES7(:)) - ICOND(:) = ICOND7(:) - INCLUDE_BC3 = .FALSE. - ELSEIF ( MECH .EQ. 8 ) THEN - CITABLE(:,:) = CITABLE8(:,:) - MODE_NAME(:) = MNAME(MODES8(:)) - MODE_SPCS(:,:) = MSPCS(:,MODES8(:)) - ICOND(:) = ICOND8(:) - INCLUDE_BC3 = .FALSE. - ENDIF - !------------------------------------------------------------------------- - ! Set INTERMODAL_TRANSFER according to setting in aero_param.f. - ! If mode AKK is not present in the current mechanism, set to .FALSE. - !------------------------------------------------------------------------- - INTERMODAL_TRANSFER = SET_INTERMODAL_TRANSFER - FOUND = .FALSE. - DO I=1, NMODES - IF ( MODE_NAME(I) .EQ. 'AKK' ) FOUND = .TRUE. - ENDDO - IF ( .NOT. FOUND ) THEN - IF ( WRITE_LOG ) WRITE(AUNIT1,'(/A/)') - & 'INTERMODAL TRANSFER (AKK->ACC) TURNED OFF SINCE MODE AKK IS ABSENT.' - INTERMODAL_TRANSFER = .FALSE. - ENDIF - !------------------------------------------------------------------------- - ! Check that all receptor modes in the CITABLE array are defined modes - ! in the present mechanism. - ! Also check that CITABLE is a symmetric matrix. - !------------------------------------------------------------------------- - DO I=1, NMODES - DO J=1, NMODES - IF( CITABLE(I,J) .NE. CITABLE(J,I) ) THEN - WRITE(*,*) 'CITABLE(I,J) must be a symmetric matrix.' - WRITE(*,*) 'The CITABLE(I,J) set in aero_config.f is asymmetric for I, J = ', I, J - STOP - ENDIF - FOUND = .FALSE. - DO K=1, NMODES - IF( CITABLE(I,J) .EQ. MODE_NAME(K) ) FOUND = .TRUE. - ENDDO - IF( CITABLE(I,J) .EQ. 'OFF' ) THEN - FOUND = .TRUE. ! I-J interaction has been turned off - ! WRITE(36,'(A,2I5,A5)')'I,J,CITABLE(I,J) = ', I,J,CITABLE(I,J) - ENDIF - IF( .NOT. FOUND ) THEN - WRITE(*,*)'INVALID RECEPTOR MODE NAME: I, J, CITABLE(I,J) = ', - & I, J, CITABLE(I,J) - STOP - ENDIF - ENDDO - ENDDO - !------------------------------------------------------------------------- - ! Setup the indices to the AERO array. - !------------------------------------------------------------------------- - AERO_SPCS(1) = 'MASS_NITRATE' - AERO_SPCS(2) = 'MASS_AMMONIUM' - AERO_SPCS(3) = 'MASS_WATER' - INDEX = 3 ! The first three values of INDEX (1, 2, 3) are already - ! assigned to NO3, NH4, and H2O. - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/2A/)') 'MODE # MODE_NAME CHEM_SPC # CHEM_SPC_NAME location in AERO', - & ' AERO_SPCS' - WRITE(AUNIT1,90) 0,'NO3',0,'ANO3',1,'MASS_NO3 ' - WRITE(AUNIT1,90) 0,'NH4',0,'ANH4',2,'MASS_NH4 ' - WRITE(AUNIT1,90) 0,'H2O',0,'AH2O',3,'MASS_H2O ' - ENDIF - DO I=1, NMODES - DO J=1, NMASS_SPCS - IF ( MODE_SPCS(J,I) .GT. 0 ) THEN ! This mode contains species J. - INDEX = INDEX + 1 - CALL SETUP_INDICES(I,J,INDEX,0) - AERO_SPCS(INDEX) = 'MASS_'//MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,90) I,MODE_NAME(I),J,CHEM_SPC_NAME(J),INDEX,AERO_SPCS(INDEX) - ! WRITE(31,'(8X,A23)') AERO_SPCS(INDEX)//' = OMIT' - ENDIF - ENDIF - ENDDO - DO J=1, NPOINTS - INDEX = INDEX + 1 - CALL SETUP_INDICES(I,J,INDEX,1) ! Set number conc. indices. - IF ( J .EQ. 1 ) AERO_SPCS(INDEX) = 'NUMB_'//MODE_NAME(I)//'_1' ! first quadrature point - IF ( J .EQ. 2 ) AERO_SPCS(INDEX) = 'NUMB_'//MODE_NAME(I)//'_2' ! second quadrature point - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,90) I,MODE_NAME(I),J,'NUMB',INDEX,AERO_SPCS(INDEX) - ! WRITE(31,'(8X,A23)') AERO_SPCS(INDEX)//' = OMIT' - ENDIF - ENDDO - ENDDO - IF ( INDEX .NE. NAEROBOX ) THEN - WRITE(*,*)'INDEX .NE. NAEROBOX', INDEX, NAEROBOX ! size of the AERO and AERO_SPCS arrays - STOP - ENDIF - !------------------------------------------------------------------------------------------------------------------- - ! Setup maps etc. needed to convert sea salt mass concentrations to number concentrations - ! using mean particle masses for the sea salt modes. - !------------------------------------------------------------------------------------------------------------------- - CALL SETUP_SEASALT_MAPS -!------------------------------------------------------------------------------------------------------------------------- -! Indices of the AERO array. -!------------------------------------------------------------------------------------------------------------------------- -! WRITE(*,*) MASS_NO3, MASS_NH4, MASS_H2O -! WRITE(*,*) NUMB_AKK_1, NUMB_AKK_2, MASS_AKK_SULF, -! & NUMB_ACC_1, NUMB_ACC_2, MASS_ACC_SULF, -! & NUMB_DD1_1, NUMB_DD1_2, MASS_DD1_SULF, MASS_DD1_DUST, -! & NUMB_DS1_1, NUMB_DS1_2, MASS_DS1_SULF, MASS_DS1_DUST, -! & NUMB_DD2_1, NUMB_DD2_2, MASS_DD2_SULF, MASS_DD2_DUST, -! & NUMB_DS2_1, NUMB_DS2_2, MASS_DS2_SULF, MASS_DS2_DUST, -! & NUMB_SSA_1, NUMB_SSA_2, MASS_SSA_SULF, MASS_SSA_SEAS, -! & NUMB_SSC_1, NUMB_SSC_2, MASS_SSC_SULF, MASS_SSC_SEAS, -! & NUMB_SSS_1, NUMB_SSS_2, MASS_SSS_SULF, MASS_SSS_SEAS, -! & NUMB_OCC_1, NUMB_OCC_2, MASS_OCC_SULF, MASS_OCC_OCAR, -! & NUMB_BC1_1, NUMB_BC1_2, MASS_BC1_SULF, MASS_BC1_BCAR, -! & NUMB_BC2_1, NUMB_BC2_2, MASS_BC2_SULF, MASS_BC2_BCAR, -! & NUMB_BC3_1, NUMB_BC3_2, MASS_BC3_SULF, MASS_BC3_BCAR, -! & NUMB_OCS_1, NUMB_OCS_2, MASS_OCS_SULF, MASS_OCS_OCAR, -! & NUMB_DBC_1, NUMB_DBC_2, MASS_DBC_SULF, MASS_DBC_BCAR, MASS_DBC_DUST, -! & NUMB_BOC_1, NUMB_BOC_2, MASS_BOC_SULF, MASS_BOC_BCAR, MASS_BOC_OCAR, -! & NUMB_BCS_1, NUMB_BCS_2, MASS_BCS_SULF, MASS_BCS_BCAR, -! & NUMB_MXX_1, NUMB_MXX_2, MASS_MXX_SULF, MASS_MXX_BCAR, MASS_MXX_OCAR, MASS_MXX_DUST, MASS_MXX_SEAS -!------------------------------------------------------------------------------------------------------------------------- - 90 FORMAT(I6,9X,A3,9X,I4,12X,A4,I19,5X,A16) - RETURN - END SUBROUTINE SETUP_CONFIG - - - SUBROUTINE SETUP_INDICES(I,J,INDEX,IN) -!------------------------------------------------------------------------------- -! Routine to initialize indices of the AERO array. -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I, J, INDEX, IN - INTEGER, PARAMETER :: OMIT = 0 - LOGICAL, SAVE :: FIRSTIME = .TRUE. - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - !----------------------------------------------------------------------- - ! Set all AERO indices to default values indicating that the species - ! is not defined in the current mechanism. - !----------------------------------------------------------------------- - MASS_AKK_SULF = OMIT - NUMB_AKK_1 = OMIT - MASS_ACC_SULF = OMIT - NUMB_ACC_1 = OMIT - MASS_DD1_SULF = OMIT - MASS_DD1_DUST = OMIT - NUMB_DD1_1 = OMIT - MASS_DS1_SULF = OMIT - MASS_DS1_DUST = OMIT - NUMB_DS1_1 = OMIT - MASS_DD2_SULF = OMIT - MASS_DD2_DUST = OMIT - NUMB_DD2_1 = OMIT - MASS_DS2_SULF = OMIT - MASS_DS2_DUST = OMIT - NUMB_DS2_1 = OMIT - MASS_SSA_SULF = OMIT - MASS_SSA_SEAS = OMIT - NUMB_SSA_1 = OMIT - MASS_SSC_SULF = OMIT - MASS_SSC_SEAS = OMIT - NUMB_SSC_1 = OMIT - MASS_SSS_SULF = OMIT - MASS_SSS_SEAS = OMIT - NUMB_SSS_1 = OMIT - MASS_OCC_SULF = OMIT - MASS_OCC_OCAR = OMIT - NUMB_OCC_1 = OMIT - MASS_BC1_SULF = OMIT - MASS_BC1_BCAR = OMIT - NUMB_BC1_1 = OMIT - MASS_BC2_SULF = OMIT - MASS_BC2_BCAR = OMIT - NUMB_BC2_1 = OMIT - MASS_BC3_SULF = OMIT - MASS_BC3_BCAR = OMIT - NUMB_BC3_1 = OMIT - MASS_DBC_SULF = OMIT - MASS_DBC_BCAR = OMIT - MASS_DBC_DUST = OMIT - NUMB_DBC_1 = OMIT - MASS_BOC_SULF = OMIT - MASS_BOC_BCAR = OMIT - MASS_BOC_OCAR = OMIT - NUMB_BOC_1 = OMIT - MASS_BCS_SULF = OMIT - MASS_BCS_BCAR = OMIT - NUMB_BCS_1 = OMIT - MASS_OCS_SULF = OMIT - MASS_OCS_OCAR = OMIT - NUMB_OCS_1 = OMIT - MASS_MXX_SULF = OMIT - MASS_MXX_BCAR = OMIT - MASS_MXX_OCAR = OMIT - MASS_MXX_DUST = OMIT - MASS_MXX_SEAS = OMIT - NUMB_MXX_1 = OMIT - ENDIF - IF ( IN .EQ. 0 ) THEN ! This is a mass concentration. - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'AKK_SULF' ) MASS_AKK_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'ACC_SULF' ) MASS_ACC_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DD1_SULF' ) MASS_DD1_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DD1_DUST' ) MASS_DD1_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DS1_SULF' ) MASS_DS1_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DS1_DUST' ) MASS_DS1_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DD2_SULF' ) MASS_DD2_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DD2_DUST' ) MASS_DD2_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DS2_SULF' ) MASS_DS2_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DS2_DUST' ) MASS_DS2_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSA_SULF' ) MASS_SSA_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSA_SEAS' ) MASS_SSA_SEAS = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSC_SULF' ) MASS_SSC_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSC_SEAS' ) MASS_SSC_SEAS = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSS_SULF' ) MASS_SSS_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'SSS_SEAS' ) MASS_SSS_SEAS = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'OCC_SULF' ) MASS_OCC_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'OCC_OCAR' ) MASS_OCC_OCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC1_SULF' ) MASS_BC1_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC1_BCAR' ) MASS_BC1_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC2_SULF' ) MASS_BC2_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC2_BCAR' ) MASS_BC2_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC3_SULF' ) MASS_BC3_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BC3_BCAR' ) MASS_BC3_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'OCS_SULF' ) MASS_OCS_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'OCS_OCAR' ) MASS_OCS_OCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DBC_SULF' ) MASS_DBC_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DBC_BCAR' ) MASS_DBC_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'DBC_DUST' ) MASS_DBC_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BOC_SULF' ) MASS_BOC_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BOC_BCAR' ) MASS_BOC_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BOC_OCAR' ) MASS_BOC_OCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BCS_SULF' ) MASS_BCS_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'BCS_BCAR' ) MASS_BCS_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'MXX_SULF' ) MASS_MXX_SULF = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'MXX_BCAR' ) MASS_MXX_BCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'MXX_OCAR' ) MASS_MXX_OCAR = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'MXX_DUST' ) MASS_MXX_DUST = INDEX - IF ( MODE_NAME(I)//'_'//CHEM_SPC_NAME(J) .EQ. 'MXX_SEAS' ) MASS_MXX_SEAS = INDEX - ELSEIF ( IN .EQ. 1 ) THEN ! This is a number concentration. - IF ( MODE_NAME(I).EQ.'AKK' .AND. J.EQ.1 ) NUMB_AKK_1 = INDEX - IF ( MODE_NAME(I).EQ.'AKK' .AND. J.EQ.2 ) NUMB_AKK_2 = INDEX - IF ( MODE_NAME(I).EQ.'ACC' .AND. J.EQ.1 ) NUMB_ACC_1 = INDEX - IF ( MODE_NAME(I).EQ.'ACC' .AND. J.EQ.2 ) NUMB_ACC_2 = INDEX - IF ( MODE_NAME(I).EQ.'DD1' .AND. J.EQ.1 ) NUMB_DD1_1 = INDEX - IF ( MODE_NAME(I).EQ.'DD1' .AND. J.EQ.2 ) NUMB_DD1_2 = INDEX - IF ( MODE_NAME(I).EQ.'DS1' .AND. J.EQ.1 ) NUMB_DS1_1 = INDEX - IF ( MODE_NAME(I).EQ.'DS1' .AND. J.EQ.2 ) NUMB_DS1_2 = INDEX - IF ( MODE_NAME(I).EQ.'DD2' .AND. J.EQ.1 ) NUMB_DD2_1 = INDEX - IF ( MODE_NAME(I).EQ.'DD2' .AND. J.EQ.2 ) NUMB_DD2_2 = INDEX - IF ( MODE_NAME(I).EQ.'DS2' .AND. J.EQ.1 ) NUMB_DS2_1 = INDEX - IF ( MODE_NAME(I).EQ.'DS2' .AND. J.EQ.2 ) NUMB_DS2_2 = INDEX - IF ( MODE_NAME(I).EQ.'SSA' .AND. J.EQ.1 ) NUMB_SSA_1 = INDEX - IF ( MODE_NAME(I).EQ.'SSA' .AND. J.EQ.2 ) NUMB_SSA_2 = INDEX - IF ( MODE_NAME(I).EQ.'SSC' .AND. J.EQ.1 ) NUMB_SSC_1 = INDEX - IF ( MODE_NAME(I).EQ.'SSC' .AND. J.EQ.2 ) NUMB_SSC_2 = INDEX - IF ( MODE_NAME(I).EQ.'SSS' .AND. J.EQ.1 ) NUMB_SSS_1 = INDEX - IF ( MODE_NAME(I).EQ.'SSS' .AND. J.EQ.2 ) NUMB_SSS_2 = INDEX - IF ( MODE_NAME(I).EQ.'OCC' .AND. J.EQ.1 ) NUMB_OCC_1 = INDEX - IF ( MODE_NAME(I).EQ.'OCC' .AND. J.EQ.2 ) NUMB_OCC_2 = INDEX - IF ( MODE_NAME(I).EQ.'BC1' .AND. J.EQ.1 ) NUMB_BC1_1 = INDEX - IF ( MODE_NAME(I).EQ.'BC1' .AND. J.EQ.2 ) NUMB_BC1_2 = INDEX - IF ( MODE_NAME(I).EQ.'BC2' .AND. J.EQ.1 ) NUMB_BC2_1 = INDEX - IF ( MODE_NAME(I).EQ.'BC2' .AND. J.EQ.2 ) NUMB_BC2_2 = INDEX - IF ( MODE_NAME(I).EQ.'BC3' .AND. J.EQ.1 ) NUMB_BC3_1 = INDEX - IF ( MODE_NAME(I).EQ.'BC3' .AND. J.EQ.2 ) NUMB_BC3_2 = INDEX - IF ( MODE_NAME(I).EQ.'OCS' .AND. J.EQ.1 ) NUMB_OCS_1 = INDEX - IF ( MODE_NAME(I).EQ.'OCS' .AND. J.EQ.2 ) NUMB_OCS_2 = INDEX - IF ( MODE_NAME(I).EQ.'DBC' .AND. J.EQ.1 ) NUMB_DBC_1 = INDEX - IF ( MODE_NAME(I).EQ.'DBC' .AND. J.EQ.2 ) NUMB_DBC_2 = INDEX - IF ( MODE_NAME(I).EQ.'BOC' .AND. J.EQ.1 ) NUMB_BOC_1 = INDEX - IF ( MODE_NAME(I).EQ.'BOC' .AND. J.EQ.2 ) NUMB_BOC_2 = INDEX - IF ( MODE_NAME(I).EQ.'BCS' .AND. J.EQ.1 ) NUMB_BCS_1 = INDEX - IF ( MODE_NAME(I).EQ.'BCS' .AND. J.EQ.2 ) NUMB_BCS_2 = INDEX - IF ( MODE_NAME(I).EQ.'MXX' .AND. J.EQ.1 ) NUMB_MXX_1 = INDEX - IF ( MODE_NAME(I).EQ.'MXX' .AND. J.EQ.2 ) NUMB_MXX_2 = INDEX - ENDIF - RETURN - END SUBROUTINE SETUP_INDICES - - - SUBROUTINE SETUP_SPECIES_MAPS -!------------------------------------------------------------------------------- -! Routine to ... assign a mode number to each mode. -! ... setup mass maps for species SULF, BCAR, OCAR, DUST, SEAS. -! ... setup the number of mass species for mode I, NM(I). -! ... setup the mass species names for mode I, NM_SPC_NAME(I). -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I,J - INTEGER :: ISULF,IBCAR,IOCAR,IDUST,ISEAS,INM - INTEGER, PARAMETER :: INACTIVE = 0 - LOGICAL, SAVE :: FIRSTIME = .TRUE. - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - !----------------------------------------------------------------------- - ! Get the number of modes containing each species: SULF, BCAR, OCAR, - ! DUST, SEAS. - !----------------------------------------------------------------------- - ISULF = 0 - IBCAR = 0 - IOCAR = 0 - IDUST = 0 - ISEAS = 0 - DO I=1, NMODES - DO J=1, NAEROBOX - IF ( AERO_SPCS(J)(1:13).EQ.'MASS_'//MODE_NAME(I)//'_SULF' ) ISULF=ISULF+1 - IF ( AERO_SPCS(J)(1:13).EQ.'MASS_'//MODE_NAME(I)//'_BCAR' ) IBCAR=IBCAR+1 - IF ( AERO_SPCS(J)(1:13).EQ.'MASS_'//MODE_NAME(I)//'_OCAR' ) IOCAR=IOCAR+1 - IF ( AERO_SPCS(J)(1:13).EQ.'MASS_'//MODE_NAME(I)//'_DUST' ) IDUST=IDUST+1 - IF ( AERO_SPCS(J)(1:13).EQ.'MASS_'//MODE_NAME(I)//'_SEAS' ) ISEAS=ISEAS+1 - ENDDO - ENDDO - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A,5I4,/)')'Number of modes containing each species: ISULF,IBCAR,IOCAR,IDUST,ISEAS=', - & ISULF,IBCAR,IOCAR,IDUST,ISEAS - ENDIF - NMODES_SULF = ISULF - NMODES_BCAR = IBCAR - NMODES_OCAR = IOCAR - NMODES_DUST = IDUST - NMODES_SEAS = ISEAS - ALLOCATE ( SULF_MAP(NMODES_SULF) ) - ALLOCATE ( BCAR_MAP(NMODES_BCAR) ) - ALLOCATE ( OCAR_MAP(NMODES_OCAR) ) - ALLOCATE ( DUST_MAP(NMODES_DUST) ) - ALLOCATE ( SEAS_MAP(NMODES_SEAS) ) - ALLOCATE ( MODE_NUMB_SEAS(NMODES_SEAS) ) - SULF_MAP(:) = 0 - BCAR_MAP(:) = 0 - OCAR_MAP(:) = 0 - DUST_MAP(:) = 0 - SEAS_MAP(:) = 0 - MODE_NUMB_SEAS(:) = 0 - ENDIF - !------------------------------------------------------------------------- - ! Assign a mode number to each mode. - !------------------------------------------------------------------------- - MODE_NUMB_AKK = INACTIVE - MODE_NUMB_ACC = INACTIVE - MODE_NUMB_DD1 = INACTIVE - MODE_NUMB_DD2 = INACTIVE - MODE_NUMB_DS1 = INACTIVE - MODE_NUMB_DS2 = INACTIVE - MODE_NUMB_SSA = INACTIVE - MODE_NUMB_SSC = INACTIVE - MODE_NUMB_SSS = INACTIVE - MODE_NUMB_OCC = INACTIVE - MODE_NUMB_BC1 = INACTIVE - MODE_NUMB_BC2 = INACTIVE - MODE_NUMB_BC3 = INACTIVE - MODE_NUMB_DBC = INACTIVE - MODE_NUMB_BOC = INACTIVE - MODE_NUMB_BCS = INACTIVE - MODE_NUMB_OCS = INACTIVE - MODE_NUMB_MXX = INACTIVE - DO I=1, NMODES - IF ( MODE_NAME(I) .EQ. 'AKK' ) MODE_NUMB_AKK = I - IF ( MODE_NAME(I) .EQ. 'ACC' ) MODE_NUMB_ACC = I - IF ( MODE_NAME(I) .EQ. 'DD1' ) MODE_NUMB_DD1 = I - IF ( MODE_NAME(I) .EQ. 'DD2' ) MODE_NUMB_DD2 = I - IF ( MODE_NAME(I) .EQ. 'DS1' ) MODE_NUMB_DS1 = I - IF ( MODE_NAME(I) .EQ. 'DS2' ) MODE_NUMB_DS2 = I - IF ( MODE_NAME(I) .EQ. 'SSA' ) MODE_NUMB_SSA = I - IF ( MODE_NAME(I) .EQ. 'SSC' ) MODE_NUMB_SSC = I - IF ( MODE_NAME(I) .EQ. 'SSS' ) MODE_NUMB_SSS = I - IF ( MODE_NAME(I) .EQ. 'OCC' ) MODE_NUMB_OCC = I - IF ( MODE_NAME(I) .EQ. 'BC1' ) MODE_NUMB_BC1 = I - IF ( MODE_NAME(I) .EQ. 'BC2' ) MODE_NUMB_BC2 = I - IF ( MODE_NAME(I) .EQ. 'BC3' ) MODE_NUMB_BC3 = I - IF ( MODE_NAME(I) .EQ. 'DBC' ) MODE_NUMB_DBC = I - IF ( MODE_NAME(I) .EQ. 'BOC' ) MODE_NUMB_BOC = I - IF ( MODE_NAME(I) .EQ. 'BCS' ) MODE_NUMB_BCS = I - IF ( MODE_NAME(I) .EQ. 'OCS' ) MODE_NUMB_OCS = I - IF ( MODE_NAME(I) .EQ. 'MXX' ) MODE_NUMB_MXX = I - ENDDO - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)') 'MODE_NAME( MODE_NUMB_XXX ), MODE_NUMB_XXX' - IF ( MODE_NUMB_AKK .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_AKK ), MODE_NUMB_AKK - ENDIF - IF ( MODE_NUMB_ACC .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_ACC ), MODE_NUMB_ACC - ENDIF - IF ( MODE_NUMB_DD1 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_DD1 ), MODE_NUMB_DD1 - ENDIF - IF ( MODE_NUMB_DS1 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_DS1 ), MODE_NUMB_DS1 - ENDIF - IF ( MODE_NUMB_DD2 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_DD2 ), MODE_NUMB_DD2 - ENDIF - IF ( MODE_NUMB_DS2 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_DS2 ), MODE_NUMB_DS2 - ENDIF - IF ( MODE_NUMB_SSA .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_SSA ), MODE_NUMB_SSA - ENDIF - IF ( MODE_NUMB_SSC .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_SSC ), MODE_NUMB_SSC - ENDIF - IF ( MODE_NUMB_SSS .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_SSS ), MODE_NUMB_SSS - ENDIF - IF ( MODE_NUMB_OCC .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_OCC ), MODE_NUMB_OCC - ENDIF - IF ( MODE_NUMB_BC1 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_BC1 ), MODE_NUMB_BC1 - ENDIF - IF ( MODE_NUMB_BC2 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_BC2 ), MODE_NUMB_BC2 - ENDIF - IF ( MODE_NUMB_BC3 .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_BC3 ), MODE_NUMB_BC3 - ENDIF - IF ( MODE_NUMB_DBC .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_DBC ), MODE_NUMB_DBC - ENDIF - IF ( MODE_NUMB_BOC .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_BOC ), MODE_NUMB_BOC - ENDIF - IF ( MODE_NUMB_BCS .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_BCS ), MODE_NUMB_BCS - ENDIF - IF ( MODE_NUMB_OCS .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_OCS ), MODE_NUMB_OCS - ENDIF - IF ( MODE_NUMB_MXX .GT. 0 ) THEN - WRITE(AUNIT1,'(3X,A3,3X,I4)') MODE_NAME( MODE_NUMB_MXX ), MODE_NUMB_MXX - ENDIF - ENDIF - !------------------------------------------------------------------------- - ! Setup NUMB_MAP(I): location of the Ith number conc. in the AERO array - ! Setup SULF_MAP(I): location of the Ith sulfate conc. in the AERO array - ! Setup BCAR_MAP(I): location of the Ith BC conc. in the AERO array - ! Setup OCAR_MAP(I): location of the Ith OC conc. in the AERO array - ! Setup DUST_MAP(I): location of the Ith dust conc. in the AERO array - ! Setup SEAS_MAP(I): location of the Ith sea salt conc. in the AERO array - ! Setup NM(I): number of mass concs. defined for mode I - ! Setup NM_SPC_NAME(I,J): name of the Jth mass conc. in mode I - !------------------------------------------------------------------------- - IBCAR = 1 - IOCAR = 1 - IDUST = 1 - ISEAS = 1 - NM(:) = 0 - NM_SPC_NAME(:,:) = ' ' ! LEN=4 character variable. - DO I=1, NMODES - INM = 0 - DO J=1, NAEROBOX - IF ( AERO_SPCS(J)(1:8) .EQ. 'NUMB_'//MODE_NAME(I) ) NUMB_MAP(I) = J - IF ( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_SULF' ) SULF_MAP(I) = J - IF ( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_BCAR' ) THEN - BCAR_MAP(IBCAR) = J ! location of this mass conc. in the AERO array - IBCAR = IBCAR + 1 - ENDIF - IF ( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_OCAR' ) THEN - OCAR_MAP(IOCAR) = J ! location of this mass conc. in the AERO array - IOCAR = IOCAR + 1 - ENDIF - IF ( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_DUST' ) THEN - DUST_MAP(IDUST) = J ! location of this mass conc. in the AERO array - IDUST = IDUST + 1 - ENDIF - IF ( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_SEAS' ) THEN - SEAS_MAP(ISEAS) = J ! location of this mass conc. in the AERO array - MODE_NUMB_SEAS(ISEAS) = I ! mode number for this sea salt-containing mode - ISEAS = ISEAS + 1 - ENDIF - IF ( AERO_SPCS(J)(1:8) .EQ. 'MASS_'//MODE_NAME(I) ) THEN - INM = INM + 1 - NM_SPC_NAME(I,INM) = AERO_SPCS(J)(10:13) - ENDIF - ENDDO - NM(I) = INM - ENDDO - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A11,16I4)') 'NUMB_MAP = ', NUMB_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'SULF_MAP = ', SULF_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'BCAR_MAP = ', BCAR_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'OCAR_MAP = ', OCAR_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'DUST_MAP = ', DUST_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'SEAS_MAP = ', SEAS_MAP(:) - WRITE(AUNIT1,'(/A11,16I4)') 'NM(I) = ', NM(:) - DO I=1, NMODES - WRITE(AUNIT1,'(/A40,A5,I4,5A5)') 'MODE_NAME(I), NM(I), NM_SPC_NAME(I,:) = ', MODE_NAME(I), NM(I), NM_SPC_NAME(I,:) - ENDDO - ENDIF - !---------------------------------------------------------------------------------------------------- - ! Setup EMIS_MODE_MAP. There are presently 10 emitted species. - ! - ! EMIS_MODE_MAP and EMIS_SPCS_MAP have elements corresponding to the aerosol types (in this order): - ! AKK(=1), ACC(=2), BCC(=8), OCC(=7), DD1(=3), SSA(=5), SSC(=6), BOC(BC=8), BOC(OC=9), DD2(=10). - ! - ! EMIS_MODE_MAP(J) is mode number receiving the emissions held in EMIS_MASS(J). - ! EMIS_SPCS_MAP(J) is the chemical species number (1-5) of the chemical species held in EMIS_MASS(J). - ! EMIS_SPCS_MAP = (/1,1,2,3,4,5,5,2,3,4/) is set at the top of the module. - !---------------------------------------------------------------------------------------------------- - EMIS_MODE_MAP(:) = 0 - EMIS_MODE_MAP(1) = 1 ! Aitken mode sulfate always goes in the first mode, whether it is AKK or ACC. - DO I=1, NMODES ! If no Aitken mode, then the accumulation mode is the first mode. - IF( MODE_NAME(I) .EQ. 'ACC' ) EMIS_MODE_MAP(2) = I - IF( MODE_NAME(I) .EQ. 'BC1' ) EMIS_MODE_MAP(3) = I - IF( MODE_NAME(I) .EQ. 'OCC' ) EMIS_MODE_MAP(4) = I - IF( MODE_NAME(I) .EQ. 'DD1' ) THEN - EMIS_MODE_MAP(5) = I - IF( MECH .GE. 5 .AND. MECH .LE. 8 ) EMIS_MODE_MAP(10) = I ! emissions for both dust modes go into mode DD1 - ENDIF - IF( MODE_NAME(I) .EQ. 'SSA' ) EMIS_MODE_MAP(6) = I - IF( MODE_NAME(I) .EQ. 'SSC' ) EMIS_MODE_MAP(7) = I - IF( MODE_NAME(I) .EQ. 'SSS' ) EMIS_MODE_MAP(6) = I ! emissions for both sea salt modes go into mode SSS - IF( MODE_NAME(I) .EQ. 'SSS' ) EMIS_MODE_MAP(7) = I ! emissions for both sea salt modes go into mode SSS - IF( MODE_NAME(I) .EQ. 'BOC' ) EMIS_MODE_MAP(8) = I - IF( MODE_NAME(I) .EQ. 'BOC' ) EMIS_MODE_MAP(9) = I - IF( MODE_NAME(I) .EQ. 'DD2' ) EMIS_MODE_MAP(10) = I - ENDDO - !------------------------------------------------------------------------- - ! If the mechanism does not have the mode BOC to receive the - ! mixed BC-OC emissions, put these directly into the BC1 and OCC modes. - !------------------------------------------------------------------------- - IF ( EMIS_MODE_MAP(8) .EQ. 0 ) THEN ! the BC in BC-OC emissions - DO I=1, NMODES - IF( MODE_NAME(I) .EQ. 'BC1' ) THEN - EMIS_MODE_MAP(8) = I - IF ( WRITE_LOG ) WRITE(AUNIT1,'(/2A/)')'BC of BO-OC put into mode ',MODE_NAME(I) - ENDIF - ENDDO - ENDIF - IF ( EMIS_MODE_MAP(9) .EQ. 0 ) THEN ! the OC in BC-OC emissions - DO I=1, NMODES - IF( MODE_NAME(I) .EQ. 'OCC' ) THEN - EMIS_MODE_MAP(9) = I - IF ( WRITE_LOG ) WRITE(AUNIT1,'(/2A/)')'OC of BO-OC put into mode ',MODE_NAME(I) - ENDIF - ENDDO - ENDIF - RETURN - END SUBROUTINE SETUP_SPECIES_MAPS - - - SUBROUTINE SETUP_SEASALT_MAPS -!--------------------------------------------------------------------------------------------------------- -! Routine to setup maps and variables needed to derive sea salt -! number concentrations from sea salt mass concentrations and -! characteristic mean masses per particle. -! -! Three arrays are set up: -! -! SEAS_MODE_MAP(II) ! mode number of the IIth SS mode -! SEAS_MODE_MASS_MAP(II) ! location in the AERO array of the SS mass for the IIth SS mode -! RECIP_SEAS_MPP(II) ! reciprocal of the mean mass per particle for the IIth SS mode -! -! There are either two sea salt modes, SSA and SSC, or only one, SSS. -!--------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I,IDIM,II,J - REAL(8) :: DPS - LOGICAL, SAVE :: FIRSTIME = .TRUE. - IF ( FIRSTIME ) THEN - FIRSTIME = .FALSE. - IDIM = 0 - DO I=1, NMODES - IF ( MODE_NAME(I)(1:2) .EQ. 'SS' ) IDIM = IDIM + 1 - ENDDO - IF ( IDIM .LT. 1 .OR. IDIM .GT. 2 ) THEN - WRITE(*,*)'SUBROUTIINE SETUP_SEASALT_MAPS:' - WRITE(*,*)'NUMBER OF SEAS SALT MODES IS ZERO OR GREATER THAN TWO - INCORRECT' - STOP - ENDIF - NUMBER_OF_SEASALT_MODES = IDIM - ALLOCATE( SEAS_MODE_MAP( IDIM ) ) - ALLOCATE( SEAS_MODE_MASS_MAP( IDIM ) ) - ALLOCATE( RECIP_SEAS_MPP( IDIM ) ) - SEAS_MODE_MAP(:) = 0 - SEAS_MODE_MASS_MAP(:) = 0 - RECIP_SEAS_MPP(:) = 0.0D+00 - II = 0 - DO I=1, NMODES - IF ( MODE_NAME(I)(1:2) .EQ. 'SS' ) THEN ! This is a sea salt mode, either SSA, SSC, or SSS. - II = II + 1 - SEAS_MODE_MAP(II) = I - DO J=1, NAEROBOX - IF( AERO_SPCS(J)(1:13) .EQ. 'MASS_'//MODE_NAME(I)//'_SEAS' ) THEN ! This is the sea salt mass in the mode. - SEAS_MODE_MASS_MAP(II) = J - ! WRITE(*,*) AERO_SPCS(J)(1:13) ! Checked: the correct species are identified. - ENDIF - ENDDO - !------------------------------------------------------------------------------------------------- - ! Calculate the diameter of average mass for each sea salt mode for the emissions lognormals. - ! - ! The emissions lognormals are used since it is the dry sea salt concentration that - ! is divided by the average dry mass per particle (in subr. matrix) to obtain the current - ! number concentration from the dry sea salt mass concentration for each sea salt mode. - ! The dry NaCl mass per particle changes little over time for sea salt, given low coagulation rates. - ! Accreted water, sulfate, nitrate, and ammonium are irrelevant here. The dry NaCl per emitted - ! sea salt particle is the appropriate dry mass to divide into the current dry NaCl concentration - ! to obtain the particle number concentration. - ! - ! Dam [um] = ( diameter moment 3 / diameter moment 0 )**(1/3) - ! = ( dg**3 * sg**9 )**(1/3) - ! = ( dg**3 * [ exp( 0.5*(log(sigmag))**2 ) ]**9 )**(1/3) - ! = dg * [ exp( 0.5*(log(sigmag))**2 ) ]**3 - ! = dg * [ exp( 1.5*(log(sigmag))**2 ) ] - !------------------------------------------------------------------------------------------------- - IF( MODE_NAME(I).EQ.'SSA') DPS = 1.0D-06 * DG_SSA_EMIS * EXP( 1.5D+00 * ( LOG(SG_SSA_EMIS) )**2 ) - IF( MODE_NAME(I).EQ.'SSC') DPS = 1.0D-06 * DG_SSC_EMIS * EXP( 1.5D+00 * ( LOG(SG_SSC_EMIS) )**2 ) - IF( MODE_NAME(I).EQ.'SSS') DPS = 1.0D-06 * DG_SSS_EMIS * EXP( 1.5D+00 * ( LOG(SG_SSS_EMIS) )**2 ) - IF( ACTIVATION_COMPARISON .AND. ( MECH.EQ.4 .OR. MECH.EQ.8 ) ) THEN ! Activation test. - DPS = 1.0D-06 * 0.3308445477D+00 * EXP( 1.5D+00 * ( LOG( SG_SSS_EMIS) )**2 ) - WRITE(*,*)'Special value set for DPS and RECIP_SEAS_MPP for mode SSS in aero_setup.f.' - ENDIF - !------------------------------------------------------------------------------------------------- - ! DPS is the diameter of average mass for mode J for the dry emitted sea salt, and when cubed - ! and multiplied by pi/6 it yields the average dry sea salt particle volume in emissions mode J. - ! Multiplication by the emitted dry particle sea salt density then yields the average - ! dry sea salt mass per particle emitted into the mode. - !------------------------------------------------------------------------------------------------- - IF( DISCRETE_EVAL_OPTION ) THEN - RECIP_SEAS_MPP(II) = 1.0D+00 / ( 1.0D+12 * DENSP * PI6 * DPS**3 ) - ELSE - RECIP_SEAS_MPP(II) = 1.0D+00 / ( 1.0D+12 * EMIS_DENS_SEAS * PI6 * DPS**3 ) - ENDIF - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)')'II,I,MODE_NAME(I),AERO_SPCS(SEAS_MODE_MASS_MAP(II)),RECIP_SEAS_MPP(II)' - WRITE(AUNIT1,90000) II,I,MODE_NAME(I),AERO_SPCS(SEAS_MODE_MASS_MAP(II)),RECIP_SEAS_MPP(II) - ENDIF - ENDIF - ENDDO - ENDIF -90000 FORMAT(2I4,4X,A6,4X,A16,4X,D15.5) - RETURN - END SUBROUTINE SETUP_SEASALT_MAPS - - - SUBROUTINE SETUP_KCI -!----------------------------------------------------------------------------------------------------------------------- -! Routine to calculate the coefficients that multiply the number -! concentrations, or the number concentrations times the particle diameters, -! to obtain the condensational sink for each mode or quadrature point. -!----------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I, L ! indices - REAL :: SIGMA ! See subr. ATMOSPHERE below. - REAL :: DELTA ! See subr. ATMOSPHERE below. - REAL :: THETA ! See subr. ATMOSPHERE below. - REAL(8) :: P ! ambient pressure [Pa] - REAL(8) :: T ! ambient temperature [K] - REAL(8) :: D ! molecular diffusivity of H2SO4 in air [m^2/s] - REAL(8) :: C ! mean molecular speed of H2SO4 [m/s] - REAL(8) :: LA ! mean free path in air [m] - ! 6.6328D-08 is the sea level value given in Table I.2.8 - ! on p.10 of U.S. Standard Atmosphere 1962 - REAL(8) :: LH ! mean free path of H2SO4 in air [m] - REAL(8) :: BETA ! transition regime correction to the condensational flux [1] - REAL(8) :: KN ! Knudsen number for H2SO4 in air [1] - REAL(8) :: THETAI ! monodispersity correction factor [1] (Okuyama et al. 1988) - REAL(8) :: SCALE_DP ! scale factor for defined table of ambient particle diameters [1] - - REAL(8), PARAMETER :: ALPHA = 0.86D+00 ! mass accommodation coefficient [1] (Hansen, 2005) - REAL(8), PARAMETER :: D_STDATM = 1.2250D+00 ! sea-level std. density [kg/m^3] - REAL(8), PARAMETER :: P_STDATM = 101325.0D+00 ! sea-level std. pressure [Pa] - REAL(8), PARAMETER :: T_STDATM = 288.15D+00 ! sea-level std. temperature [K] - REAL(8), PARAMETER :: P0 = 101325.0D+00 ! reference pressure [Pa] for D - REAL(8), PARAMETER :: T0 = 273.16D+00 ! reference temperature [K] for D - REAL(8), PARAMETER :: D0 = 9.36D-06 ! diffusivity of H2SO4 in air [m^2/s] - ! calculated using Eqn 11-4.4 of Reid - ! et al.(1987) at 273.16 K and 101325 Pa - - IF( WRITE_LOG ) WRITE(AUNIT1,90002)'I','L','ZHEIGHT','P','T','D','C','LA','LH', - & 'DP0','KN','THETAI','BETA' - KCI_COEF_DP (:,:) = 0.0D+00 ! mass accommodation coefficient is arbitrary - KCI_COEF_DP_AEQ1 (:,:) = 0.0D+00 ! mass accommodation coefficient is unity - KCI_DP_CONDTABLE (:,:) = 0.0D+00 ! mass accommodation coefficient is arbitrary - KCI_DP_CONDTABLE_AEQ1(:,:) = 0.0D+00 ! mass accommodation coefficient is unity - !---------------------------------------------------------------------------------------------------------------- - ! Setup table of ambient particle diameters. - !---------------------------------------------------------------------------------------------------------------- - SCALE_DP = ( DP_CONDTABLE_MAX / DP_CONDTABLE_MIN )**(1.0D+00/REAL(N_DP_CONDTABLE-1)) - XLN_SCALE_DP = LOG( SCALE_DP ) - DO I=1, N_DP_CONDTABLE - DP_CONDTABLE(I) = DP_CONDTABLE_MIN * SCALE_DP**(I-1) ! [m] - ENDDO - - DO L=1, NLAYS - CALL ATMOSPHERE( REAL( ZHEIGHT(L) ), SIGMA, DELTA, THETA ) - P = DELTA * P_STDATM ! [Pa} - T = THETA * T_STDATM ! [K] - D = D0 * ( P0 / P ) * ( T / T0 )**1.75 ! [m^2/s] - DIFFCOEF_M2S(L) = D ! [m^2/s] - C = SQRT( 8.0D+00 * RGAS_SI * T / ( PI * MW_H2SO4*1.0D-03 ) ) ! [m/s] - LA = 6.6332D-08 * ( P_STDATM / P ) * ( T / T_STDATM ) ! [m] - LH = 3.0D+00 * D / C ! [m] - DO I=1, NWEIGHTS - THETAI = EXP( - ( LOG(SIG0(I)) )**2 ) ! [1] - THETA_POLY(I) = THETAI ! [1] polydispersity adjustment factor - !------------------------------------------------------------------------------------------------------------ - ! For the condensation sink for general use, the mean free path is - ! that for the condensing vapor (H2SO4), and the mass accommodation coefficient is adjustable. - !------------------------------------------------------------------------------------------------------------ - KN = 2.0D+00 * LH / DP0(I) ! LH and DP0 in [m] - BETA = ( 1.0D+00 + KN ) ! [1] - & / ( 1.0D+00 + 0.377D+00*KN + 1.33D+00*KN*(1.0D+00 + KN)/ALPHA ) - KCI_COEF_DP(I,L) = 2.0D+00 * PI * THETAI * D * BETA * DP0(I) ! [m^3/s] may be updated in subr. matrix - !------------------------------------------------------------------------------------------------------------ - ! For the condensation sink for use in Kerminen and Kulmala (2002), the mean free path is - ! that for air, and the mass accommodation coefficient is set to unity. - !------------------------------------------------------------------------------------------------------------ - KN = 2.0D+00 * LA / DP0(I) ! LA and DP0 in [m] - BETA = ( 1.0D+00 + KN ) ! [1] - & / ( 1.0D+00 + 0.377D+00*KN + 1.33D+00*KN*(1.0D+00 + KN)/1.0D+00 ) - KCI_COEF_DP_AEQ1(I,L) = 2.0D+00 * PI * THETAI * D * BETA * DP0(I) ! [m^3/s] may be updated in subr. matrix - ! IF( WRITE_LOG ) WRITE(AUNIT1,90000)I,L,ZHEIGHT(L),P,T,D,C,LA,LH,DP0(I)*1.0D+06,KN,THETAI,BETA - ENDDO - DO I=1, N_DP_CONDTABLE - !------------------------------------------------------------------------------------------------------------ - ! For the condensation sink for general use, the mean free path is - ! that for the condensing vapor (H2SO4), and the mass accommodation coefficient is adjustable. - ! The THETAI factor is included later in aero_matrix.f. - !------------------------------------------------------------------------------------------------------------ - KN = 2.0D+00 * LH / DP_CONDTABLE(I) ! LH and DP in [m] - BETA = ( 1.0D+00 + KN ) ! [1] - & / ( 1.0D+00 + 0.377D+00*KN + 1.33D+00*KN*(1.0D+00 + KN)/ALPHA ) - KCI_DP_CONDTABLE(I,L) = 2.0D+00 * PI * D * BETA * DP_CONDTABLE(I) ! [m^3/s] - !------------------------------------------------------------------------------------------------------------ - ! For the condensation sink for use in Kerminen and Kulmala (2002), the mean free path is - ! that for air, and the mass accommodation coefficient is set to unity. - ! The THETAI factor is included later in aero_matrix.f. - !------------------------------------------------------------------------------------------------------------ - KN = 2.0D+00 * LA / DP_CONDTABLE(I) ! LA and DP in [m] - BETA = ( 1.0D+00 + KN ) ! [1] - & / ( 1.0D+00 + 0.377D+00*KN + 1.33D+00*KN*(1.0D+00 + KN)/1.0D+00 ) - KCI_DP_CONDTABLE_AEQ1(I,L) = 2.0D+00 * PI * D * BETA * DP_CONDTABLE(I) ! [m^3/s] - ! WRITE(AUNIT1,90000) I, L, ZHEIGHT(L), P, T, D, C, LA, LH, DP_CONDTABLE(I)*1.0D+06, KN, THETAI, BETA - ENDDO - ENDDO - IF( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/A/)')' I L KCI_COEF_DP[m^3/s] KCI_COEF_DP_AEQ1[m^3/s]' - DO L=1, NLAYS - DO I=1, NWEIGHTS - WRITE(AUNIT1,90001) I, L, KCI_COEF_DP(I,L), KCI_COEF_DP_AEQ1(I,L) - ENDDO - ENDDO - ENDIF - DO I=1, NMODES - IF ( ICOND(I) .EQ. 0 ) THEN - KCI_COEF_DP (I,:) = 0.0D+00 - KCI_COEF_DP_AEQ1(I,:) = 0.0D+00 - THETA_POLY(I) = 0.0D+00 - IF( WRITE_LOG ) WRITE(AUNIT1,'(/2A/)') 'Condensational growth turned off for mode ', MODE_NAME(I) - ENDIF - ENDDO - -90000 FORMAT( 2I3,F8.4,F9.1,F7.2,D10.3,F6.1,2D10.3,4F8.4) -90002 FORMAT(/2A3,A8, A9, A7, A10, A6, 2A10, 4A8 /) -90001 FORMAT(2I3,4D20.4) - RETURN - END SUBROUTINE SETUP_KCI - - - SUBROUTINE SETUP_EMIS -!------------------------------------------------------------------------------- -! Routine to calculate the reciprocal of the average particle mass [ug] -! for each mode for conversion of mode mass emission rates [ug/m^3/s] -! to mode number emission rates [#/m^3/s]. -! -! The factor 1.0D+12 converts [m^3] to [cm^3] and [g] to [ug]. -! DP0_EMIS(:) is in [m]. -! -! EMIS_MODE_MAP has elements corresponding to the aerosol types (in this order): -! AKK(=1), ACC(=2), BCC(=8), OCC(=7), -! DD1(=3), SSA(=5), SSC(=6), BOC(BC=8), BOC(OC=9), DD2(=10). -! EMIS_MODE_MAP(J) is mode number receiving the emissions held in EMIS_MASS(J). -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I, J - - RECIP_PART_MASS(:) = 0.0D+00 ! [1/ug] - - IF ( WRITE_LOG ) THEN - WRITE(AUNIT1,'(/2A5,A17,A32,A32/)') 'I','J',' DP0_EMIS(J)[um]', - & 'RECIP_PART_MASS(I)[1/ug]','EMIS_DENS(I)[g/cm^3]' - ENDIF - DO I=1, NEMIS_SPCS ! currently, NEMIS_SPCS = 10 emitted species - J = EMIS_MODE_MAP(I) ! J ranges over the number of modes. - !----------------------------------------------------------------------- - ! DP0_EMIS(J) is the diameter of average mass for mode J, and when cubed - ! and multiplied by pi/6 it yields the average particle volume in mode J. - ! Multiplication by the emitted particle density then yields the average - ! mass per particle emitted into the mode. - ! - ! EMIS_DENS(:) ranges over the emission species only. - ! RECIP_PART_MASS(:) ranges over the emission species only. - ! DP0_EMIS(:) ranges over all modes in the mechanism. - !----------------------------------------------------------------------- - RECIP_PART_MASS(I) = 1.0D+00 / ( 1.0D+12 * EMIS_DENS(I) * PI6 * DP0_EMIS(J)**3 ) - IF( WRITE_LOG) WRITE(AUNIT1,90000) I, J, DP0_EMIS(J)*1.0D+06, RECIP_PART_MASS(I), EMIS_DENS(I) - ENDDO - -90000 FORMAT(2I5,F17.6,D32.6,F32.4) - RETURN - END SUBROUTINE SETUP_EMIS - - - SUBROUTINE SETUP_DP0 -!------------------------------------------------------------------------------- -! Routine to calculate the diameter of average mass [m] for each mode. -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I - - !------------------------------------------------------------------------- - ! Set lognormal parameters and activating fraction for each mode. - !------------------------------------------------------------------------- - DGN0(:) = 0.0D+00 - SIG0(:) = 0.0D+00 - LNSIG0(:) = 0.0D+00 - DGN0_EMIS(:) = 0.0D+00 - SIG0_EMIS(:) = 0.0D+00 - KAPPAI(:) = 0.0D+00 - DP0(:) = 0.0D+00 - DP0_EMIS(:) = 0.0D+00 - DO I=1, NMODES - IF ( MODE_NAME(I) .EQ. 'AKK') DGN0(I) = DG_AKK ! DGN0 for characteristic lognormal - IF ( MODE_NAME(I) .EQ. 'ACC') THEN - IF( NUMB_AKK_1 .EQ. 0 ) THEN - IF ( ACTIVATION_COMPARISON .AND. ( MECH .EQ. 4 .OR. MECH .EQ. 8 ) ) THEN ! No mode AKK - DGN0(I) = 0.0506736714D+00 ! For droplet activation test. - WRITE(*,*)'DGN0 for mode ACC set to special value of activation test.' - ELSE - DGN0(I) = SQRT( DG_AKK * DG_ACC ) ! No mode AKK; reduce DG_AKK - WRITE(*,*)'DGN0 for mode ACC reduced in this mechanism.' - ENDIF - ELSE - DGN0(I) = DG_ACC - ENDIF - ENDIF - IF ( MODE_NAME(I) .EQ. 'DD1') THEN - IF ( ACTIVATION_COMPARISON .AND. ( MECH .GE. 5 .AND. MECH .LE. 8 ) ) THEN ! No mode DD2 or DS2 - DGN0(I) = 0.4516304494D+00 ! For droplet activation test. - WRITE(*,*)'DGN0 for mode DD1 set to special value of activation test.' - ELSE - DGN0(I) = DG_DD1 - ENDIF - ENDIF - IF ( MODE_NAME(I) .EQ. 'DD2') DGN0(I) = DG_DD2 - IF ( MODE_NAME(I) .EQ. 'DS1') DGN0(I) = DG_DS1 - IF ( MODE_NAME(I) .EQ. 'DS2') DGN0(I) = DG_DS2 - IF ( MODE_NAME(I) .EQ. 'SSA') DGN0(I) = DG_SSA - IF ( MODE_NAME(I) .EQ. 'SSC') DGN0(I) = DG_SSC - IF ( MODE_NAME(I) .EQ. 'SSS') THEN - IF ( ACTIVATION_COMPARISON .AND. ( MECH .EQ. 4 .OR. MECH .EQ. 8 ) ) THEN ! No mode SSA or SSC - DGN0(I) = 0.3308445477D+00 ! For droplet activation test. - WRITE(*,*)'DGN0 for mode SSS set to special value for activation test.' - ELSE - DGN0(I) = DG_SSS - ENDIF - ENDIF - IF ( MODE_NAME(I) .EQ. 'OCC') DGN0(I) = DG_OCC - IF ( MODE_NAME(I) .EQ. 'BC1') DGN0(I) = DG_BC1 - IF ( MODE_NAME(I) .EQ. 'BC2') DGN0(I) = DG_BC2 - IF ( MODE_NAME(I) .EQ. 'BC3') DGN0(I) = DG_BC3 - IF ( MODE_NAME(I) .EQ. 'DBC') DGN0(I) = DG_DBC - IF ( MODE_NAME(I) .EQ. 'BOC') DGN0(I) = DG_BOC - IF ( MODE_NAME(I) .EQ. 'BCS') DGN0(I) = DG_BCS - IF ( MODE_NAME(I) .EQ. 'OCS') DGN0(I) = DG_OCS - IF ( MODE_NAME(I) .EQ. 'MXX') DGN0(I) = DG_MXX - IF ( MODE_NAME(I) .EQ. 'AKK') SIG0(I) = SG_AKK ! SIG0 for characteristic lognormal - IF ( MODE_NAME(I) .EQ. 'ACC') SIG0(I) = SG_ACC - IF ( MODE_NAME(I) .EQ. 'DD1') SIG0(I) = SG_DD1 - IF ( MODE_NAME(I) .EQ. 'DD2') SIG0(I) = SG_DD2 - IF ( MODE_NAME(I) .EQ. 'DS1') SIG0(I) = SG_DS1 - IF ( MODE_NAME(I) .EQ. 'DS2') SIG0(I) = SG_DS2 - IF ( MODE_NAME(I) .EQ. 'SSA') SIG0(I) = SG_SSA - IF ( MODE_NAME(I) .EQ. 'SSC') SIG0(I) = SG_SSC - IF ( MODE_NAME(I) .EQ. 'SSS') SIG0(I) = SG_SSS - IF ( MODE_NAME(I) .EQ. 'OCC') SIG0(I) = SG_OCC - IF ( MODE_NAME(I) .EQ. 'BC1') SIG0(I) = SG_BC1 - IF ( MODE_NAME(I) .EQ. 'BC2') SIG0(I) = SG_BC2 - IF ( MODE_NAME(I) .EQ. 'BC3') SIG0(I) = SG_BC3 - IF ( MODE_NAME(I) .EQ. 'DBC') SIG0(I) = SG_DBC - IF ( MODE_NAME(I) .EQ. 'BOC') SIG0(I) = SG_BOC - IF ( MODE_NAME(I) .EQ. 'BCS') SIG0(I) = SG_BCS - IF ( MODE_NAME(I) .EQ. 'OCS') SIG0(I) = SG_OCS - IF ( MODE_NAME(I) .EQ. 'MXX') SIG0(I) = SG_MXX - IF ( MODE_NAME(I) .EQ. 'AKK') DGN0_EMIS(I) = DG_AKK_EMIS ! DGN0_EMIS for emissions lognormal - IF ( MODE_NAME(I) .EQ. 'ACC') THEN - DGN0_EMIS(I) = DG_ACC_EMIS - IF( NUMB_AKK_1 .EQ. 0 ) THEN - DGN0_EMIS(I) = SQRT( DG_AKK_EMIS * DG_ACC_EMIS ) ! No mode AKK; reduce DG_AKK_EMIS - WRITE(*,*)'DGN0_EMIS for mode ACC reduced in this mechanism.' - ENDIF - ENDIF - IF ( MODE_NAME(I) .EQ. 'DD1') DGN0_EMIS(I) = DG_DD1_EMIS - IF ( MODE_NAME(I) .EQ. 'DD2') DGN0_EMIS(I) = DG_DD2_EMIS - IF ( MODE_NAME(I) .EQ. 'DS1') DGN0_EMIS(I) = DG_DS1_EMIS - IF ( MODE_NAME(I) .EQ. 'DS2') DGN0_EMIS(I) = DG_DS2_EMIS - IF ( MODE_NAME(I) .EQ. 'SSA') DGN0_EMIS(I) = DG_SSA_EMIS - IF ( MODE_NAME(I) .EQ. 'SSC') DGN0_EMIS(I) = DG_SSC_EMIS - IF ( MODE_NAME(I) .EQ. 'SSS') THEN - IF ( ACTIVATION_COMPARISON .AND. ( MECH .EQ. 4 .OR. MECH .EQ. 8 ) ) THEN ! No mode SSA or SSC - DGN0_EMIS(I) = 0.3308445477D+00 ! For droplet activation test. - WRITE(*,*)'DGN0_EMIS for mode SSS set to special value for activation test.' - ELSE - DGN0_EMIS(I) = DG_SSS_EMIS - ENDIF - ENDIF - IF ( MODE_NAME(I) .EQ. 'OCC') DGN0_EMIS(I) = DG_OCC_EMIS - IF ( MODE_NAME(I) .EQ. 'BC1') DGN0_EMIS(I) = DG_BC1_EMIS - IF ( MODE_NAME(I) .EQ. 'BC2') DGN0_EMIS(I) = DG_BC2_EMIS - IF ( MODE_NAME(I) .EQ. 'BC3') DGN0_EMIS(I) = DG_BC3_EMIS - IF ( MODE_NAME(I) .EQ. 'DBC') DGN0_EMIS(I) = DG_DBC_EMIS - IF ( MODE_NAME(I) .EQ. 'BOC') DGN0_EMIS(I) = DG_BOC_EMIS - IF ( MODE_NAME(I) .EQ. 'BCS') DGN0_EMIS(I) = DG_BCS_EMIS - IF ( MODE_NAME(I) .EQ. 'OCS') DGN0_EMIS(I) = DG_OCS_EMIS - IF ( MODE_NAME(I) .EQ. 'MXX') DGN0_EMIS(I) = DG_MXX_EMIS - IF ( MODE_NAME(I) .EQ. 'AKK') SIG0_EMIS(I) = SG_AKK_EMIS ! SIG0_EMIS for emissions lognormal - IF ( MODE_NAME(I) .EQ. 'ACC') SIG0_EMIS(I) = SG_ACC_EMIS - IF ( MODE_NAME(I) .EQ. 'DD1') SIG0_EMIS(I) = SG_DD1_EMIS - IF ( MODE_NAME(I) .EQ. 'DD2') SIG0_EMIS(I) = SG_DD2_EMIS - IF ( MODE_NAME(I) .EQ. 'DS1') SIG0_EMIS(I) = SG_DS1_EMIS - IF ( MODE_NAME(I) .EQ. 'DS2') SIG0_EMIS(I) = SG_DS2_EMIS - IF ( MODE_NAME(I) .EQ. 'SSA') SIG0_EMIS(I) = SG_SSA_EMIS - IF ( MODE_NAME(I) .EQ. 'SSC') SIG0_EMIS(I) = SG_SSC_EMIS - IF ( MODE_NAME(I) .EQ. 'SSS') SIG0_EMIS(I) = SG_SSS_EMIS - IF ( MODE_NAME(I) .EQ. 'OCC') SIG0_EMIS(I) = SG_OCC_EMIS - IF ( MODE_NAME(I) .EQ. 'BC1') SIG0_EMIS(I) = SG_BC1_EMIS - IF ( MODE_NAME(I) .EQ. 'BC2') SIG0_EMIS(I) = SG_BC2_EMIS - IF ( MODE_NAME(I) .EQ. 'BC3') SIG0_EMIS(I) = SG_BC3_EMIS - IF ( MODE_NAME(I) .EQ. 'DBC') SIG0_EMIS(I) = SG_DBC_EMIS - IF ( MODE_NAME(I) .EQ. 'BOC') SIG0_EMIS(I) = SG_BOC_EMIS - IF ( MODE_NAME(I) .EQ. 'BCS') SIG0_EMIS(I) = SG_BCS_EMIS - IF ( MODE_NAME(I) .EQ. 'OCS') SIG0_EMIS(I) = SG_OCS_EMIS - IF ( MODE_NAME(I) .EQ. 'MXX') SIG0_EMIS(I) = SG_MXX_EMIS - IF ( MODE_NAME(I) .EQ. 'AKK') KAPPAI(I) = KAPPAI_AKK ! KAPPAI - activating fraction - IF ( MODE_NAME(I) .EQ. 'ACC') KAPPAI(I) = KAPPAI_ACC - IF ( MODE_NAME(I) .EQ. 'DD1') KAPPAI(I) = KAPPAI_DD1 - IF ( MODE_NAME(I) .EQ. 'DD2') KAPPAI(I) = KAPPAI_DD2 - IF ( MODE_NAME(I) .EQ. 'DS1') KAPPAI(I) = KAPPAI_DS1 - IF ( MODE_NAME(I) .EQ. 'DS2') KAPPAI(I) = KAPPAI_DS2 - IF ( MODE_NAME(I) .EQ. 'SSA') KAPPAI(I) = KAPPAI_SSA - IF ( MODE_NAME(I) .EQ. 'SSC') KAPPAI(I) = KAPPAI_SSC - IF ( MODE_NAME(I) .EQ. 'SSS') KAPPAI(I) = KAPPAI_SSS - IF ( MODE_NAME(I) .EQ. 'OCC') KAPPAI(I) = KAPPAI_OCC - IF ( MODE_NAME(I) .EQ. 'BC1') KAPPAI(I) = KAPPAI_BC1 - IF ( MODE_NAME(I) .EQ. 'BC2') KAPPAI(I) = KAPPAI_BC2 - IF ( MODE_NAME(I) .EQ. 'BC3') KAPPAI(I) = KAPPAI_BC3 - IF ( MODE_NAME(I) .EQ. 'DBC') KAPPAI(I) = KAPPAI_DBC - IF ( MODE_NAME(I) .EQ. 'BOC') KAPPAI(I) = KAPPAI_BOC - IF ( MODE_NAME(I) .EQ. 'BCS') KAPPAI(I) = KAPPAI_BCS - IF ( MODE_NAME(I) .EQ. 'OCS') KAPPAI(I) = KAPPAI_OCS - IF ( MODE_NAME(I) .EQ. 'MXX') KAPPAI(I) = KAPPAI_MXX - IF ( MODE_NAME(I) .EQ. 'AKK') DENSPI(I) = EMIS_DENS_SULF ! DENSPI - default density for mode I - IF ( MODE_NAME(I) .EQ. 'ACC') DENSPI(I) = EMIS_DENS_SULF - IF ( MODE_NAME(I) .EQ. 'DD1') DENSPI(I) = EMIS_DENS_DUST - IF ( MODE_NAME(I) .EQ. 'DD2') DENSPI(I) = EMIS_DENS_DUST - IF ( MODE_NAME(I) .EQ. 'DS1') DENSPI(I) = EMIS_DENS_DUST - IF ( MODE_NAME(I) .EQ. 'DS2') DENSPI(I) = EMIS_DENS_DUST - IF ( MODE_NAME(I) .EQ. 'SSA') DENSPI(I) = EMIS_DENS_SEAS - IF ( MODE_NAME(I) .EQ. 'SSC') DENSPI(I) = EMIS_DENS_SEAS - IF ( MODE_NAME(I) .EQ. 'SSS') DENSPI(I) = EMIS_DENS_SEAS - IF ( MODE_NAME(I) .EQ. 'OCC') DENSPI(I) = EMIS_DENS_OCAR - IF ( MODE_NAME(I) .EQ. 'BC1') DENSPI(I) = EMIS_DENS_BCAR - IF ( MODE_NAME(I) .EQ. 'BC2') DENSPI(I) = EMIS_DENS_BCAR - IF ( MODE_NAME(I) .EQ. 'BC3') DENSPI(I) = EMIS_DENS_BCAR - IF ( MODE_NAME(I) .EQ. 'DBC') DENSPI(I) = 0.5D+00 * ( EMIS_DENS_DUST + EMIS_DENS_BCAR ) - IF ( MODE_NAME(I) .EQ. 'BOC') DENSPI(I) = EMIS_DENS_BOCC - IF ( MODE_NAME(I) .EQ. 'BCS') DENSPI(I) = 0.5D+00 * ( EMIS_DENS_BCAR + EMIS_DENS_SULF ) - IF ( MODE_NAME(I) .EQ. 'OCS') DENSPI(I) = 0.5D+00 * ( EMIS_DENS_OCAR + EMIS_DENS_SULF ) - IF ( MODE_NAME(I) .EQ. 'MXX') DENSPI(I) = 0.2D+00 * ( EMIS_DENS_SULF + EMIS_DENS_DUST - & + EMIS_DENS_BCAR + EMIS_DENS_OCAR + EMIS_DENS_SEAS ) - ENDDO - - !--------------------------------------------------------------------------------------------------------------------- - ! Calculate the diameter of average mass for both the (default) - ! characteristic lognormal and the emissions lognormal for each mode. - ! - ! Dam [um] = ( diameter moment 3 / diameter moment 0 )**(1/3) - ! = ( dg**3 * sg**9 )**(1/3) - ! = ( dg**3 * [ exp( 0.5*(log(sigmag))**2 ) ]**9 )**(1/3) - ! = dg * [ exp( 0.5*(log(sigmag))**2 ) ]**3 - ! = dg * [ exp( 1.5*(log(sigmag))**2 ) ] - ! - ! Also store the natural logarithms of the geo. std. deviations. - !--------------------------------------------------------------------------------------------------------------------- - IF( WRITE_LOG ) WRITE(AUNIT1,'(/8A12/)') 'I',' MODE','DGN0 [um]','SIG0 [1]','DP0 [um]', - & 'DGN0_E [um]','SIG0_E [1]','DP0_E [um]' - DO I=1, NWEIGHTS - DP0(I) = 1.0D-06 * DGN0(I) * EXP( 1.5D+00 * ( LOG(SIG0(I)) )**2 ) ! convert from [um] to [m] - DP0_EMIS(I) = 1.0D-06 * DGN0_EMIS(I) * EXP( 1.5D+00 * ( LOG(SIG0_EMIS(I)) )**2 ) ! convert from [um] to [m] - CONV_DPAM_TO_DGN(I) = 1.0D+00 / EXP( 1.5D+00 * ( LOG(SIG0_EMIS(I)) )**2 ) - LNSIG0(I) = LOG( SIG0(I) ) - IF( WRITE_LOG ) WRITE(AUNIT1,90000)I,MODE_NAME(I),DGN0(I),SIG0(I),DP0(I)*1.0D+06, - & DGN0_EMIS(I),SIG0_EMIS(I),DP0_EMIS(I)*1.0D+06 - ENDDO - - !--------------------------------------------------------------------------------------------------------------------- - ! Set densities and their reciprocals for each chemical component of any mode. - !--------------------------------------------------------------------------------------------------------------------- - DENS_COMP(1) = RHO_NH42SO4 ! [g/cm^3] sulfate - DENS_COMP(2) = EMIS_DENS_BCAR ! [g/cm^3] BC - DENS_COMP(3) = EMIS_DENS_OCAR ! [g/cm^3] OC - DENS_COMP(4) = EMIS_DENS_DUST ! [g/cm^3] dust - DENS_COMP(5) = EMIS_DENS_SEAS ! [g/cm^3] sea salt - DENS_COMP(6) = RHO_NH42SO4 ! [g/cm^3] nitrate - DENS_COMP(7) = RHO_NH42SO4 ! [g/cm^3] ammonium - DENS_COMP(8) = RHO_H2O ! [g/cm^3] water - DO I=1, 8 - RECIP_DENS_COMP(I) = 1.0D+00 / DENS_COMP(I) ! [cm^3/g] sulfate - ! WRITE(*,'(I4,2F10.4)') I, DENS_COMP(I), RECIP_DENS_COMP(I) - ENDDO - - !--------------------------------------------------------------------------------------------------------------------- - ! If doing comparison with the discrete pdf model, set all mode particle densities to the same value. - !--------------------------------------------------------------------------------------------------------------------- - IF( DISCRETE_EVAL_OPTION ) THEN - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A,F7.3/)') 'Setting particle densities for all modes to (g/cm^3) ', DENSP - DENSPI(:) = DENSP - DENS_COMP(:) = DENSP - RECIP_DENS_COMP(:) = 1.0D+00 / DENSP - ENDIF - -90000 FORMAT(I12,A12,6F12.6) - RETURN - END SUBROUTINE SETUP_DP0 - - - SUBROUTINE SETUP_COAG_TENSORS -!------------------------------------------------------------------------------------------------------------------- -! Routine to define the g_ikl,q, the d_ikl, and the d_ij. -! -! All elements GIKLQ(I,K,L,Q), DIKL(I,K,L), and DIJ(I,J) were checked through printouts available below. -! -! NM_SPC_NAME(I,:) contains the names of the mass species defined for mode I. -!------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I,J,K,L,Q,QQ, ntot, n - LOGICAL, PARAMETER :: WRITE_TENSORS = .FALSE. - - IF ( WRITE_TENSORS ) THEN - WRITE(AUNIT1,'(/A/)') 'CITABLE' - DO I=1, NMODES - WRITE(AUNIT1,90000) CITABLE(1:NMODES,I) - ENDDO - WRITE(AUNIT1,'(A)') ' ' - ENDIF - - GIKLQ(:,:,:,:) = 0 - DIKL(:,:,:) = 0 - DIJ(:,:) = 0 - - !------------------------------------------------------------------------------------------------------------- - ! The tensors g_ikl,q and d_ikl are symmetric in K and L. - ! - ! GIKLQ is unity if coagulation of modes K and L produce mass of species Q - ! in mode I, and zero otherwise. - ! - ! DIKL is unity if coagulation of modes K and L produce particles - ! in mode I, and zero otherwise. - ! Neither mode K nor mode L can be mode I for a nonzero DIKL: - ! all three modes I, K, L must be different modes. - !------------------------------------------------------------------------------------------------------------- - DO I=1, NMODES - DO K=1, NMODES - DO L=K+1, NMODES ! Mode L is the same as mode K. - IF ( CITABLE(K,L) .EQ. MODE_NAME(I) ) THEN ! modes K and L produce mode I - ! WRITE(36,*)'MODE_NAME(I) = ', MODE_NAME(I) - IF ( I .NE. K .AND. I .NE. L ) THEN ! omit intramodal coagulation - DIKL(I,K,L) = 1 - DIKL(I,L,K) = 1 - ENDIF - DO Q=1, NM(I) ! loop over all mass species in mode I - DO QQ=1, NMASS_SPCS ! loop over all principal mass species - !----------------------------------------------------------------------------------------------------- - ! Compare the name of mass species Q in mode I with that of mass species QQ in mode K (or L). - ! The inner loop is over all principal mass species since all species must be checked for - ! mode K (or L) for a potential match with species Q in mode I. - !----------------------------------------------------------------------------------------------------- - IF( NM_SPC_NAME(K,QQ) .EQ. NM_SPC_NAME(I,Q) ) THEN ! mode K contains Q - IF( I .NE. K ) GIKLQ(I,K,L,Q) = 1 ! I and K must be different modes - IF( I .NE. K ) GIKLQ(I,L,K,Q) = 1 ! I and K must be different modes - ENDIF - IF( NM_SPC_NAME(L,QQ) .EQ. NM_SPC_NAME(I,Q) ) THEN ! mode L contains Q - IF( I .NE. L ) GIKLQ(I,K,L,Q) = 1 ! I and L must be different modes - IF( I .NE. L ) GIKLQ(I,L,K,Q) = 1 ! I and L must be different modes - ENDIF - ENDDO - ENDDO - ENDIF - ENDDO - ENDDO - ENDDO - - if (allocated(dikl_control)) then - deallocate(dikl_control) - end if - allocate(dikl_control(count(dikl /= 0))) - - call initializeDiklControl(dikl_control, DIKL) - - if (allocated(giklq_control)) then - do i = 1, nweights - deallocate(giklq_control(i)%k) - deallocate(giklq_control(i)%l) - deallocate(giklq_control(i)%qq) - end do - else - allocate(GIKLQ_control(NWEIGHTS)) - end if - - call initializeGiklqControl(GIKLQ_control, GIKLQ) - - !------------------------------------------------------------------------------------------------------------- - ! The tensor d_ij is not symmetric in I,J. - ! - ! DIJ(I,J) is unity if coagulation of mode I with mode J results - ! in the removal of particles from mode I, and zero otherwise. - !------------------------------------------------------------------------------------------------------------- - DO I=1, NMODES - DO J=1, NMODES - DO K=1, NMODES ! Find the product mode of the I-J coagulation. - IF( I .EQ. J ) CYCLE ! Omit intramodal interactions: --> I .NE. J . - IF( CITABLE(I,J) .EQ. MODE_NAME(K) ) THEN ! I-particles and J-particles are lost; K-particles are formed. - IF( I .NE. K ) DIJ(I,J) = 1 ! The K-particles are not I-particles (but may be J-particles), - ENDIF ! so I-particles are lost by this I-J interaction. - ENDDO - ENDDO - ENDDO - xDIJ = DIJ - - IF( .NOT. WRITE_TENSORS ) RETURN - - !------------------------------------------------------------------------- - ! Write the g_ikl,q. - !------------------------------------------------------------------------- - DO I=1, NMODES - WRITE(AUNIT1,'(/2A)') 'g_iklq for MODE ', MODE_NAME(I) - DO Q=1, NM(I) - WRITE(AUNIT1,'(/A,I3,3X,3A5/)') 'Q, NM_SPC_NAME(I,Q), MODE', - & Q, NM_SPC_NAME(I,Q), '-->', MODE_NAME(I) - IF ( SUM( GIKLQ(I,1:NMODES,1:NMODES,Q) ) .EQ. 0 ) CYCLE - WRITE(AUNIT1,'(5X,16A5)') MODE_NAME(1:NMODES) - DO K=1, NMODES - WRITE(AUNIT1,'(A5,16I5)') MODE_NAME(K),GIKLQ(I,K,1:NMODES,Q) - ENDDO - ENDDO - ENDDO - - !------------------------------------------------------------------------- - ! Write the d_ikl. - !------------------------------------------------------------------------- - DO I=1, NMODES - WRITE(AUNIT1,'(/2A)') 'd_ikl for MODE ', MODE_NAME(I) - IF ( SUM( DIKL(I,1:NMODES,1:NMODES) ) .EQ. 0 ) CYCLE - WRITE(AUNIT1,'(5X,16A5)') MODE_NAME(1:NMODES) - DO K=1, NMODES - WRITE(AUNIT1,'(A5,16I5)') MODE_NAME(K),DIKL(I,K,1:NMODES) - ENDDO - ENDDO - - !------------------------------------------------------------------------- - ! Write the d_ij. - !------------------------------------------------------------------------- - WRITE(AUNIT1,'(/2A)') 'd_ij' - WRITE(AUNIT1,'(5X,16A5)') MODE_NAME(1:NMODES) - DO I=1, NMODES - WRITE(AUNIT1,'(A5,16I5)') MODE_NAME(I),DIJ(I,1:NMODES) - ENDDO - -90000 FORMAT(14A4) - RETURN - - contains - - subroutine initializeDiklControl(control, mask) - type (dikl_type) :: control(:) - integer, intent(in) :: mask(:,:,:) - integer :: i, k, l, n - - n = 0 - do k = 1, NWEIGHTS - do l = k+1, NWEIGHTS - do i = 1, NWEIGHTS - if (mask(i,k,l) /= 0) then - n = n + 1 - control(n)%i = i - control(n)%k = k - control(n)%l = l - end if - end do - end do - end do - NDIKL = n - end subroutine initializeDiklControl - - subroutine initializeGiklqControl(control, mask) - type (GIKLQ_type) :: control(:) - integer, intent(in) :: mask(:,:,:,:) - - integer :: i, q, k, l, n, nTotal - - do i = 1, NWEIGHTS - ! 1) count contributing cases for mode i - n = 0 - do q = 1, nm(i) - do k = 1, nmodes - do l = k+1, nmodes - if (mask(i,k,l,q) /= 0) then - if (i /= l) then - n = n + 1 - end if - if (i /= k) then - n = n + 1 - end if - end if - end do - end do - end do - nTotal = n - ! 2) allocate nTotal entries - control(i)%n = nTotal - allocate(control(i)%k(nTotal)) - allocate(control(i)%l(nTotal)) - allocate(control(i)%qq(nTotal)) - - ! 3) repeat sweep, but now assign k,l,qq - n = 0 - do q = 1, nm(i) - do k = 1, nmodes - do l = k+1, nmodes - if (mask(i,k,l,q) /= 0) then - if (i /= l) then - n = n + 1 - control(i)%k(n) = k - control(i)%l(n) = l - qq = prod_index(i,q) - control(i)%qq(n) = qq - end if - if (i /= k) then - n = n + 1 - control(i)%k(n) = l - control(i)%l(n) = k - qq = prod_index(i,q) - control(i)%qq(n) = qq - end if - end if - end do - end do - end do - control(i)%n = n - end do - - end subroutine initializeGiklqControl - - - END SUBROUTINE SETUP_COAG_TENSORS - - - SUBROUTINE SETUP_AERO_MASS_MAP -!------------------------------------------------------------------------------- -! Defines a map giving the AERO locations of the NM(I) masses for each mode. -! -! MASS_MAP(I,Q) is the location in AERO(:) of the Qth mass in mode I. -! -! PROD_INDEX(I,Q) is the location in array PIQ(I,Q) of chemical species -! CHEM_SPC_NAME(Q) for mode (quadrature weight) I. -!------------------------------------------------------------------------------- - IMPLICIT NONE - INTEGER :: I,Q,J - - MASS_MAP(:,:) = 0 - PROD_INDEX(:,:) = 0 - - IF( WRITE_LOG ) WRITE(AUNIT1,'(/A/)')'I,J,Q,MODE_NAME(I),AERO_SPCS(J),PROD_INDEX(I,Q),MASS_MAP(I,Q)' - - DO I=1, NWEIGHTS ! loop over modes (quadrature points) - Q = 1 - DO J=1, NAEROBOX ! loop over AERO species - IF ( AERO_SPCS(J)(6:8) .NE. MODE_NAME(I) ) CYCLE ! This AERO species is not for mode I. - IF ( AERO_SPCS(J)(1:4) .EQ. 'MASS' ) THEN ! This is a mass species for mode I. - IF ( AERO_SPCS(J)(10:13) .EQ. NM_SPC_NAME(I,Q) ) MASS_MAP(I,Q) = J ! location of this species in AERO - IF ( AERO_SPCS(J)(10:13) .EQ. 'SULF' ) THEN ! This mass species is sulfate. - PROD_INDEX(I,Q) = PROD_INDEX_SULF - ENDIF - IF ( AERO_SPCS(J)(10:13) .EQ. 'BCAR' ) THEN ! This mass species is BC. - PROD_INDEX(I,Q) = PROD_INDEX_BCAR - ENDIF - IF ( AERO_SPCS(J)(10:13) .EQ. 'OCAR' ) THEN ! This mass species is OC. - PROD_INDEX(I,Q) = PROD_INDEX_OCAR - ENDIF - IF ( AERO_SPCS(J)(10:13) .EQ. 'DUST' ) THEN ! This mass species is dust. - PROD_INDEX(I,Q) = PROD_INDEX_DUST - ENDIF - IF ( AERO_SPCS(J)(10:13) .EQ. 'SEAS' ) THEN ! This mass species is sea salt. - PROD_INDEX(I,Q) = PROD_INDEX_SEAS - ENDIF - IF( WRITE_LOG ) WRITE(AUNIT1,90000)I,J,Q,MODE_NAME(I),AERO_SPCS(J),PROD_INDEX(I,Q),MASS_MAP(I,Q) - Q = Q + 1 - IF (Q .GT. NM(I) ) GOTO 10 - ENDIF - ENDDO -10 CONTINUE - ENDDO - -90000 FORMAT(3I4,A8,4X,A16,5X,2I4) - RETURN - END SUBROUTINE SETUP_AERO_MASS_MAP - - - SUBROUTINE ATMOSPHERE( ALT, SIGMA, DELTA, THETA ) -!---------------------------------------------------------------------------- -! PURPOSE - Compute the properties of the 1976 standard atmosphere to 86 km. -! AUTHOR - Ralph Carmichael, Public Domain Aeronautical Software -! Reformatted for fixed-form Fortran 90 by D. Wright, 1-9-06. -! NOTE - If ALT > 86, the values returned will not be correct, but they will -! not be too far removed from the correct values for density. -! The reference document does not use the terms pressure and temperature -! above 86 km. -!---------------------------------------------------------------------------- - USE CONSTANT, only : radius - IMPLICIT NONE -!============================================================================ -! A R G U M E N T S | -!============================================================================ - REAL,INTENT(IN):: ALT ! geometric ALTitude, km. - REAL,INTENT(OUT):: SIGMA ! density/sea-level standard density - REAL,INTENT(OUT):: DELTA ! pressure/sea-level standard pressure - REAL,INTENT(OUT):: THETA ! temperature/sea-level standard temperature -!============================================================================ -! L O C A L C O N S T A N T S | -!============================================================================ - REAL,PARAMETER:: REARTH = radius/1000. ! radius of the Earth (km) - REAL,PARAMETER:: GMR = 34.163195 ! hydrostatic constant - INTEGER,PARAMETER:: NTAB=8 ! number of entries in the defining tables -!============================================================================ -! L O C A L V A R I A B L E S | -!============================================================================ - INTEGER:: I,J,K ! counters - REAL:: H ! geopotential ALTitude (km) - REAL:: TGRAD, TBASE ! temperature gradient and base temp of this layer - REAL:: TLOCAL ! local temperature - REAL:: DELTAH ! height above base of this layer -!============================================================================ -! L O C A L A R R A Y S ( 1 9 7 6 S T D. A T M O S P H E R E ) | -!============================================================================ - REAL,DIMENSION(NTAB),PARAMETER:: HTAB= - & (/0.0, 11.0, 20.0, 32.0, 47.0, 51.0, 71.0, 84.852/) - REAL,DIMENSION(NTAB),PARAMETER:: TTAB= - & (/288.15, 216.65, 216.65, 228.65, 270.65, 270.65, 214.65, 186.946/) - REAL,DIMENSION(NTAB),PARAMETER:: PTAB= - & (/1.0, 2.233611E-1, 5.403295E-2, 8.5666784E-3, 1.0945601E-3, - & 6.6063531E-4, 3.9046834E-5, 3.68501E-6/) - REAL,DIMENSION(NTAB),PARAMETER:: GTAB= - & (/-6.5, 0.0, 1.0, 2.8, 0.0, -2.8, -2.0, 0.0/) - - H=ALT*REARTH/(ALT+REARTH) ! convert geometric to geopotential altitude - - I=1 - J=NTAB ! setting up for binary search - DO - K=(I+J)/2 ! integer division - IF (H < HTAB(K)) THEN - J=K - ELSE - I=K - END IF - IF (J <= I+1) EXIT - END DO - - TGRAD=GTAB(I) ! I will be in 1...NTAB-1 - TBASE=TTAB(I) - DELTAH=H-HTAB(I) - TLOCAL=TBASE+TGRAD*DELTAH - THETA=TLOCAL/TTAB(1) ! temperature ratio - - IF (TGRAD == 0.0) THEN ! pressure ratio - DELTA=PTAB(I)*EXP(-GMR*DELTAH/TBASE) - ELSE - DELTA=PTAB(I)*(TBASE/TLOCAL)**(GMR/TGRAD) - END IF - - SIGMA=DELTA/THETA ! density ratio - - RETURN - END SUBROUTINE ATMOSPHERE - - - END MODULE AERO_SETUP - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_subs.F b/MATRIXchem_GridComp/microphysics/TRAMP_subs.F deleted file mode 100644 index 6c0a9178..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_subs.F +++ /dev/null @@ -1,247 +0,0 @@ - MODULE AERO_SUBS - - -!@sum This module contains various aerosol microphysical routines. -!@auth Susanne Bauer/Doug Wright -!---------------------------------------------------------------------------------------------------------------------- - USE AERO_PARAM - USE AERO_CONFIG - IMPLICIT NONE - - CONTAINS - - - SUBROUTINE MASSADJ(AERO,GAS,SPCMASS1,SPCMASS2,EMIS_MASS,AQSO4RATE,TSTEP) -!---------------------------------------------------------------------------------------------------------------------- -! This routine rescales all aerosol and gas-phase species to enforce -! mass conservation to machine precision. -!---------------------------------------------------------------------------------------------------------------------- - USE AERO_SETUP, ONLY: SULF_MAP, BCAR_MAP, OCAR_MAP, DUST_MAP, SEAS_MAP - IMPLICIT NONE - - ! Arguments. - - REAL(8), INTENT(INOUT) :: AERO(NAEROBOX) ! aerosol conc. [ug/m^3] or [#/m^3] - REAL(8), INTENT(INOUT) :: GAS(NGASES) ! gas-phase conc. [ug/m^3] - REAL(8), INTENT(IN) :: SPCMASS1(NMASS_SPCS+2) ! initial total mass spc. conc. [ug/m^3] - REAL(8), INTENT(INOUT) :: SPCMASS2(NMASS_SPCS+2) ! final total mass spc. conc. [ug/m^3] - REAL(8), INTENT(IN) :: EMIS_MASS(NEMIS_SPCS) ! mass emission rates [ug/m^3/s] - REAL(8), INTENT(IN) :: AQSO4RATE ! in-cloud SO4 production rate [ug/m^3/s] - REAL(8), INTENT(IN) :: TSTEP ! model physics time step [s] - - ! Local variables. - - INTEGER :: I - REAL(8) :: SCALE(NMASS_SPCS+2) ! scale factor for mass adjustment - REAL(8), SAVE :: SCALEMAX = 1.0D-80 - REAL(8), SAVE :: SCALEMIN = 1.0D+80 - - !---------------------------------------------------------------------------------------------------------------- - ! Get the precise mass conc. that should exist at the end of the time - ! step, divided by the actual mass conc. at the end of the time step. - !---------------------------------------------------------------------------------------------------------------- - SPCMASS2(:) = SPCMASS2(:) + TINYDENOM - SCALE(1) = ( SPCMASS1(1) + ( AQSO4RATE + EMIS_MASS(1) + EMIS_MASS(2) ) * TSTEP ) / SPCMASS2(1) - SCALE(2) = ( SPCMASS1(2) + ( EMIS_MASS(3) + EMIS_MASS(8) ) * TSTEP ) / SPCMASS2(2) - SCALE(3) = ( SPCMASS1(3) + ( EMIS_MASS(4) + EMIS_MASS(9) ) * TSTEP ) / SPCMASS2(3) - SCALE(4) = ( SPCMASS1(4) + ( EMIS_MASS(5) + EMIS_MASS(10) ) * TSTEP ) / SPCMASS2(4) - SCALE(5) = ( SPCMASS1(5) + ( EMIS_MASS(6) + EMIS_MASS(7) ) * TSTEP ) / SPCMASS2(5) - SCALE(6) = ( SPCMASS1(6) ) / SPCMASS2(6) - SCALE(7) = ( SPCMASS1(7) ) / SPCMASS2(7) - - ! WRITE(*,'(7F14.9)') SCALE(:) - ! WRITE(*,'(7E14.6)') SPCMASS1(6), SPCMASS2(6), SPCMASS1(7), SPCMASS2(7) - !---------------------------------------------------------------------------------------------------------------- - - AERO( SULF_MAP(:) ) = AERO( SULF_MAP(:) ) * SCALE(1) - AERO( BCAR_MAP(:) ) = AERO( BCAR_MAP(:) ) * SCALE(2) - AERO( OCAR_MAP(:) ) = AERO( OCAR_MAP(:) ) * SCALE(3) - AERO( DUST_MAP(:) ) = AERO( DUST_MAP(:) ) * SCALE(4) - AERO( SEAS_MAP(:) ) = AERO( SEAS_MAP(:) ) * SCALE(5) - AERO( MASS_NO3 ) = AERO( MASS_NO3 ) * SCALE(6) - AERO( MASS_NH4 ) = AERO( MASS_NH4 ) * SCALE(7) - GAS ( GAS_H2SO4 ) = GAS ( GAS_H2SO4 ) * SCALE(1) - GAS ( GAS_HNO3 ) = GAS ( GAS_HNO3 ) * SCALE(6) - GAS ( GAS_NH3 ) = GAS ( GAS_NH3 ) * SCALE(7) - - -!---------------------------------------------------------------------------------------------------------------------- -! Track the maximum and minimum scale factors required. -!---------------------------------------------------------------------------------------------------------------------- - IF( WRITE_LOG ) THEN - WRITE(31,90000) SPCMASS1(:) - WRITE(31,90000) SPCMASS2(:) - WRITE(31,90000) SCALE(:) - WRITE(31,*) ' ' - WRITE(32,90000) SCALE(:) - DO I=1, NMASS_SPCS+2 - IF( SCALE(I) .GT. SCALEMAX ) THEN - SCALEMAX = SCALE(I) - WRITE(33,90001) SCALE(I), SCALEMAX, SCALEMIN, I, SPCMASS1(I), SPCMASS2(I) - ELSEIF( SCALE(I) .LT. SCALEMIN ) THEN - SCALEMIN = SCALE(I) - WRITE(33,90001) SCALE(I), SCALEMAX, SCALEMIN, I, SPCMASS1(I), SPCMASS2(I) - ENDIF - ENDDO - ENDIF - -90000 FORMAT(7D15.6) -90001 FORMAT(3D15.6,I6,2D15.6) - RETURN - END SUBROUTINE MASSADJ - - - - - SUBROUTINE SIZE_PDFS(AERO,PDF1,PDF2) - USE AERO_PARAM, ONLY: PI6, DENSP, IXXX, IYYY, ILAY - USE AERO_CONFIG, ONLY: NMODES, NAEROBOX,NBINS - USE AERO_SETUP, ONLY: SIG0, CONV_DPAM_TO_DGN, NUMB_MAP, MODE_NAME - USE AERO_DIAM - IMPLICIT NONE - - ! Arguments. - REAL(8), INTENT(IN) :: AERO(NAEROBOX)! aerosol conc. [ug/m^3] or [#/m^3] - - ! Local variables. - - INTEGER :: I, N -! INTEGER, PARAMETER :: NBINS = 30! 200 ! number of bins [1] defined in config - REAL(8) :: DGRID(NBINS) ! fixed diameter grid [um] - REAL(8) :: MGRID(NBINS) ! fixed mass/particle grid [ug/particle] - REAL(8) :: DLOWER(NBINS) ! lower boundary fixed diameter grid [um] - REAL(8) :: DUPPER(NBINS) ! upper boundary fixed diameter grid [um] - REAL(8) :: NTOT(NMODES) ! number concentration for each mode [#/m^3] - REAL(8) :: PDF(NBINS,2,NMODES) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: PDF1(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: PDF2(NBINS) ! number or mass conc. at each grid point [#/m^3] or [ug/m^3] - REAL(8) :: DNDLOGD(NMODES) ! dN/dlog10(Dp) [ #/m^3] - REAL(8) :: DMDLOGD(NMODES) ! dM/dlog10(Dp) [ug/m^3] - REAL(8) :: RDMIN ! reciprocal of DMIN to optimize coagulation [1/um] - REAL(8) :: RDLOGDSC ! reciprocal of log10 of the grid spacing [1] - REAL(8) :: SCALE, F, SUM1, SUM2 ! scratch variables - REAL(8) :: DMINL, DMAXL, DG ! diameters [um] - REAL(8) :: FLN ! function for lognormal distribution [1] - REAL(8), PARAMETER :: DMIN = 0.001D+00 ! smallest particle diameter of the discrete grid [um] - REAL(8), PARAMETER :: DMAX = 20.000D+00 ! largest particle diameter of the discrete grid [um] - - - DMAXL = DMAX - DMINL = DMIN - - SCALE = ( DMAXL / DMINL )**(1.0D+00/REAL(NBINS-1)) - RDLOGDSC = 1.0D+00 / LOG10( SCALE ) - RDMIN = 1.0D+00 / DMINL - DO I=1, NBINS - DGRID(I) = DMINL * SCALE**(I-1) ! [um] - DLOWER(I) = DGRID(I) / SCALE**0.5D+00 ! [um] - DUPPER(I) = DGRID(I) * SCALE**0.5D+00 ! [um] - MGRID(I) = 1.0D-06 * DENSP * PI6 * DGRID(I)**3 ! [ug/particle] - DO N=1, NMODES - DG = 1.0D+06 * DIAM(IXXX,IYYY,ILAY,N) * CONV_DPAM_TO_DGN(N) ! convert [m] to [um] and Dbar to Dg - NTOT(N) = AERO( NUMB_MAP(N) ) - F = NTOT(N) * FLN( DGRID(I), DG, SIG0(N) ) - PDF(I,1,N) = F * ( DUPPER(I) - DLOWER(I) ) - PDF(I,2,N) = PDF(I,1,N) * MGRID(I) - DNDLOGD(N) = PDF(I,1,N) * RDLOGDSC * 1.0D-06 ! convert from [#/m^3] to [#/cm^3] - DNDLOGD(N) = MAX( DNDLOGD(N), 1.0D-30 ) - DMDLOGD(N) = PDF(I,2,N) * RDLOGDSC ! [ug/m^3] - DMDLOGD(N) = MAX( DMDLOGD(N), 1.0D-30 ) - ENDDO -c WRITE(IUNIT,91) I, DGRID(I), DNDLOGD(:) -c WRITE(JUNIT,91) I, DGRID(I), DMDLOGD(:) - ENDDO - - PDF1(:) = 0.0D+00 - PDF2(:) = 0.0D+00 - DO N=1, NMODES - DO I=1, NBINS - PDF1(I) = PDF1(I) + PDF(I,1,N) - PDF2(I) = PDF2(I) + PDF(I,2,N) - SUM1 = SUM1 + PDF(I,1,N) - SUM2 = SUM2 + PDF(I,2,N) - ENDDO - ENDDO - - RETURN - END SUBROUTINE SIZE_PDFS - - - REAL(8) FUNCTION FLN(X,XG,SIGMAG) - REAL(8) :: X ! particle radius or diameter [any units] - REAL(8) :: XG ! geometric mean radius or diameter [any units] - REAL(8) :: SIGMAG ! geometric standard deviation [monodisperse = 1.0] - REAL(8), PARAMETER :: SQRTTWOPI = 2.506628275D+00 - FLN = EXP(-0.5D+00*(LOG(X/XG)/LOG(SIGMAG))**2) / (X*LOG(SIGMAG)*SQRTTWOPI) - RETURN - END FUNCTION FLN - - - REAL(8) FUNCTION GETXNUM(NI,NJ,DGNI,DGNJ,XLSGI,XLSGJ) -!--------------------------------------------------------------------------------------------------------------------- -! -! GETXNUM = ln( Dij / Dgi ) / ( sqrt(2) * ln(Sgi) ), where -! -! Dij is the diameter of intersection, -! Dgi is the median diameter of the smaller size mode, and -! Sgi is the geometric standard deviation of smaller mode. -! -! A quadratic equation is solved to obtain GETXNUM, following the method of Press et al. 1992. -! -! REFERENCES: -! -! 1. Binkowski, F.S. and S.J. Roselle, Models-3 Community Multiscale Air Quality (CMAQ) -! model aerosol component 1: Model Description. J. Geophys. Res., Vol 108, No D6, 4183 -! doi:10.1029/2001JD001409, 2003. -! 2. Press, W.H., S.A. Teukolsky, W.T. Vetterling, and B.P. Flannery, Numerical Recipes in -! Fortran 77 - 2nd Edition. Cambridge University Press, 1992. -!---------------------------------------------------------------------------------------------------------------------- - IMPLICIT NONE - - ! Arguments. - - REAL(8) :: NI ! Aitken mode number concentration [#/m^3] - REAL(8) :: NJ ! accumulation mode number concentration [#/m^3] - REAL(8) :: DGNI ! Aitken mode geo. mean diameter [um] - REAL(8) :: DGNJ ! accumulation mode geo. mean diameter [um] - REAL(8) :: XLSGI ! Aitken mode ln(geo. std. dev.) [1] - REAL(8) :: XLSGJ ! accumulation mode ln(geo. std. dev.) [1] - - ! Local variables. - - REAL(8) :: AA, BB, CC, DISC, QQ, ALFA, L, YJI - REAL(8), PARAMETER :: SQRT2 = 1.414213562D+00 - - ALFA = XLSGI / XLSGJ - YJI = LOG( DGNJ / DGNI ) / ( SQRT2 * XLSGI ) - L = LOG( ALFA * NJ / NI) - - ! Calculate quadratic equation coefficients & discriminant. - - AA = 1.0D+00 - ALFA * ALFA - BB = 2.0D+00 * YJI * ALFA * ALFA - CC = L - YJI * YJI * ALFA * ALFA - DISC = BB * BB - 4.0D+00 * AA * CC - - ! If roots are imaginary, return a negative GETAF value so that no IMTR takes place. - - IF( DISC .LT. 0.0D+00 ) THEN - GETXNUM = - 5.0D+00 ! ERROR IN INTERSECTION - RETURN - ENDIF - - ! Equation 5.6.4 of Press et al. 1992. - - QQ = -0.5D+00 * ( BB + SIGN( 1.0D+00, BB ) * SQRT(DISC) ) - - ! Return solution of the quadratic equation that corresponds to a - ! diameter of intersection lying between the median diameters of the 2 modes. - - GETXNUM = CC / QQ ! See Equation 5.6.5 of Press et al. - - ! WRITE(*,*)'GETXNUM = ', GETXNUM - RETURN - END FUNCTION GETXNUM - - END MODULE AERO_SUBS - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_thermo_eqsam.F b/MATRIXchem_GridComp/microphysics/TRAMP_thermo_eqsam.F deleted file mode 100644 index a2129bce..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_thermo_eqsam.F +++ /dev/null @@ -1,162 +0,0 @@ - SUBROUTINE AERO_THERMO(ASO4,ANO3,ANH4,AH2O,GNH3,GHNO3,TOT_DUST, - & SEAS,SSH2O,TK,RH,PRES,RHD,RHC) -!@sum -!@+ This routine sets up for and calls the thermodynamic module for aerosol -!@+ gas-particle partitioning. -!@+ -!@+ A version of EQSAM (eqsam_v03d) is the current thermodynamic model. -!@auth Susanne Bauer/Doug Wright - - -!---------------------------------------------------------------------------------------------------------------------- -! This routine sets up for and calls the thermodynamic module for aerosol -! gas-particle partitioning. -! -! A version of EQSAM (eqsam_v03d) is the current thermodynamic model. -! -! EQSAM is called with control variable IOPT=1. -! -! Although EQSAM takes as input the total S(VI) (H2SO4+SO4=), since the -! aerosol model does not necessarily transfer all H2SO4 to the aerosol -! phase (depending on configuration), we pass only the particulate SO4 -! as the total sulfate to EQSAM. -! -! Also, this version of EQSAM takes as input the mineral cation -! concentrations K+, Ca++, Mg++, Na+. Given the 'well-mixed' treatment -! of inorganic aerosol constituents in MATRIX, these cations are included. -!---------------------------------------------------------------------------------------------------------------------- - USE AERO_PARAM, ONLY: WRITE_LOG, TINYNUMER, AUNIT1 - USE AERO_PARAM, only: IXXX, IYYY, ILAY - IMPLICIT NONE - - ! Arguments. - - REAL(8), INTENT(INOUT) :: ASO4 ! aerosol sulfate [ug/m^3] - REAL(8), INTENT(INOUT) :: ANO3 ! aerosol nitrate [ug/m^3] - REAL(8), INTENT(INOUT) :: ANH4 ! aerosol ammonium [ug/m^3] - REAL(8), INTENT(INOUT) :: AH2O ! aerosol water [ug/m^3] - REAL(8), INTENT(INOUT) :: GNH3 ! gas-phase ammonia [ugNH4/m^3] as ammonium (MW) - REAL(8), INTENT(INOUT) :: GHNO3 ! gas-phase nitric acid [ugNO3/m^3] as nitrate (MW) - REAL(8), INTENT(IN) :: TOT_DUST ! total dust(sol+insol) [ug/m^3] - REAL(8), INTENT(IN) :: SEAS ! sea salt (NaCl) [ug/m^3] - REAL(8), INTENT(OUT) :: SSH2O ! sea salt assoc. H2O [ug/m^3] - REAL(8), INTENT(IN) :: TK ! absolute temperature [K] - REAL(8), INTENT(IN) :: RH ! relative humidity [0-1] - REAL(8), INTENT(IN) :: PRES ! ambient pressure [Pa] - REAL(8), INTENT(OUT) :: RHD ! RH of deliquescence [0-1] - REAL(8), INTENT(OUT) :: RHC ! RH of crystallization [0-1] - - ! Call parameters for the EQSAM thermodynamic model. - - INTEGER, PARAMETER :: NCA = 11 ! fixed number of input variables - INTEGER, PARAMETER :: NCO = 37 ! fixed number of output variables - INTEGER, PARAMETER :: IOPT = 1 ! =1 selects the metastable (wet) state and history -! INTEGER, PARAMETER :: IOPT = 2 ! =2 selects the solid (dry) state and history - INTEGER, PARAMETER :: LOOP = 1 ! only a single time step done - INTEGER, PARAMETER :: IMAX = 1 ! only a single time step done - - REAL(4) :: YI(IMAX,NCA) ! [umol/m^3] for chemical species - input - REAL(4) :: YO(IMAX,NCO) ! [umol/m^3] for chemical species - output - - ! Parameters. - - REAL(4), PARAMETER :: MW_ANH4 = 18.03850 ! [g/mol] - REAL(4), PARAMETER :: MW_GNH3 = MW_ANH4 ! [g/mol] NH3 is passed as equivalent conc. of NH4+ - REAL(4), PARAMETER :: MW_ANO3 = 62.00494 ! [g/mol] - REAL(4), PARAMETER :: MW_GHNO3 = MW_ANO3 ! [g/mol] HNO3 is passed as equivalent conc. of NO3- - REAL(4), PARAMETER :: MW_ASO4 = 96.0636 ! [g/mol] - REAL(4), PARAMETER :: MW_K = 39.0983 ! [g/mol] - REAL(4), PARAMETER :: MW_CA = 40.078 ! [g/mol] - REAL(4), PARAMETER :: MW_MG = 24.3050 ! [g/mol] - REAL(4), PARAMETER :: MW_NA = 22.989768 ! [g/mol] - REAL(4), PARAMETER :: MW_NACL = 58.442468 ! [g/mol] - REAL(8), PARAMETER :: MW_CL = 35.4527D+00 ! [g/mol] - - REAL(4), PARAMETER :: MASS_FRAC_K = 0.0028 ! From Ghan et al. (2001). - REAL(4), PARAMETER :: MASS_FRAC_CA = 0.024 ! JGR, Vol. 106, p. 5295-5316. - REAL(4), PARAMETER :: MASS_FRAC_MG = 0.0038 ! on p. 5296 - REAL(4), PARAMETER :: MASS_FRAC_NA = 0.014 ! "water sol. mass frac. in soil dust" - - REAL(4), PARAMETER :: FRAC_DUST = 0.1 ! [1] fraction of dust conc. passed to EQSAM - REAL(4), PARAMETER :: FRAC_SALT = 0.001 ! [1] fraction of salt conc. passed to EQSAM - REAL(4), PARAMETER :: CONV_KION = FRAC_DUST * MASS_FRAC_K / MW_K ! [mol/g] - REAL(4), PARAMETER :: CONV_CAION = FRAC_DUST * MASS_FRAC_CA / MW_CA ! [mol/g] - REAL(4), PARAMETER :: CONV_MGION = FRAC_DUST * MASS_FRAC_MG / MW_MG ! [mol/g] - REAL(4), PARAMETER :: CONV_NAION = FRAC_DUST * MASS_FRAC_NA / MW_NA ! [mol/g] - !------------------------------------------------------------------------------------------------------ - ! Fraction of sea salt (NaCl) mass that is Na, and is Cl. - !------------------------------------------------------------------------------------------------------ - REAL(8), PARAMETER :: RAT_NA = MW_NA / ( MW_NA + MW_CL ) ! [1] - REAL(8), PARAMETER :: RAT_CL = MW_CL / ( MW_NA + MW_CL ) ! [1] - REAL(4), PARAMETER :: RMW_GNH3 = 1.d0 / MW_GNH3 ! [mol/g] - REAL(4), PARAMETER :: RMW_ANH4 = 1.d0 / MW_ANH4 ! [mol/g] - REAL(4), PARAMETER :: RMW_GHNO3 = 1.d0 / MW_GHNO3 ! [mol/g] - REAL(4), PARAMETER :: RMW_ANO3 = 1.d0 / MW_ANO3 ! [mol/g] - REAL(4), PARAMETER :: RMW_ASO4 = 1.d0 / MW_ASO4 ! [mol/g] - REAL(4), PARAMETER :: RMW_NACL = 1.d0 / MW_NACL ! [mol/g] - REAL(4), PARAMETER :: RMW_CL = 1.d0 / MW_CL ! [mol/g] - REAL(4), PARAMETER :: RMW_NA = 1.d0 / MW_NA ! [mol/g] - - REAL(8), PARAMETER :: DH2O = 1.00D+00 ! density of water [g/cm^3] - REAL(8), PARAMETER :: DNACL = 2.165D+00 ! density of NaCl [g/cm^3] - REAL(8), PARAMETER :: CSS = 1.08D+00 ! for sea salt ... - REAL(8), PARAMETER :: BSS = 1.2D+00 ! for sea salt ... - REAL(8), PARAMETER :: SSH2OA = (CSS*CSS*CSS*BSS-1.0D+00)*DH2O/DNACL - REAL(8), PARAMETER :: SSH2OB = (CSS*CSS*CSS )*DH2O/DNACL - REAL(8), PARAMETER :: RHMAX = 0.995D+00 ! [0-1] - REAL(8), PARAMETER :: RHMIN = 0.010D+00 ! [0-1] - REAL(8), PARAMETER :: SMALL_SO4 = 1.0D-05 ! [umol SO4/m^3] EQSAM has crashed at low RH and low sulfate conc. - - REAL(8) :: H ! local RH, with RHMIN < H < RHMAX - - !---------------------------------------------------------------------------------------------------------------- - ! Call for the bulk non-sea salt inorganic aerosol. - !---------------------------------------------------------------------------------------------------------------- - - H = MAX( MIN( RH, RHMAX ), RHMIN ) - - YI(1,1) = TK ! [K] - YI(1,2) = H ! [0-1] - YI(1,3) = GNH3*RMW_GNH3 + ANH4*RMW_ANH4 ! from [ug/m^3] to [umol/m^3] - YI(1,4) = ASO4*RMW_ASO4 ! from [ug/m^3] to [umol/m^3] - YI(1,5) = GHNO3*RMW_GHNO3 + ANO3*RMW_ANO3 ! from [ug/m^3] to [umol/m^3] - YI(1,6) = RAT_NA*SEAS*RMW_NA *FRAC_SALT ! Sodium from [ug dust/m^3] to [umol Na+/m^3] - YI(1,7) = RAT_CL*SEAS*RMW_CL *FRAC_SALT ! (HCl + Cl-) - YI(1,8) = TOT_DUST*CONV_KION ! Potassium from [ug dust/m^3] to [umol K+ /m^3] - YI(1,9) = TOT_DUST*CONV_CAION ! Calcium from [ug dust/m^3] to [umol Ca+/m^3] - YI(1,10) = TOT_DUST*CONV_MGION ! Magnesium from [ug dust/m^3] to [umol Mg+/m^3] - YI(1,11) = PRES*0.01 ! from [Pa] to [hPa] - YI(1, :) = MAX( YI(1,:), 0.0E-10 ) ! Lower limit was 1.0E-10 before 102406. - YI(1,4) = YI(1,4) + SMALL_SO4 ! EQSAM has crashed at low RH and low sulfate conc. - - - CALL EQSAM_V03D(YI,YO,NCA,NCO,IOPT,LOOP,IMAX,AUNIT1) - - - GHNO3 = MAX(YO(1, 9) * MW_GHNO3,0.d0) ! from [umol/m^3] to [ug/m^3] - GNH3 = MAX(YO(1,10) * MW_GNH3 ,0.d0) ! from [umol/m^3] to [ug/m^3] - AH2O = MAX(YO(1,12) ,0.d0) ! already in [ugH2O/m^3] - ANH4 = MAX(YO(1,19) * MW_ANH4 ,0.d0) ! from [umol/m^3] to [ug/m^3] - ANO3 = MAX(YO(1,20) * MW_ANO3 ,0.d0) ! from [umol/m^3] to [ug/m^3] - ASO4 = ( YO(1,21) - SMALL_SO4 ) * MW_ASO4 ! from [umol/m^3] to [ug/m^3] - ASO4 = MAX( ASO4, 0.d0 ) ! - - RHD = 0.80D+00 ! RHD = 0.80 for ammonium sulfate (Ghan et al., 2001). - RHC = 0.35D+00 ! RHC = 0.35 for ammonium sulfate (Ghan et al., 2001). - - !---------------------------------------------------------------------------------------------------------------- - ! Get the sea salt-associated water (only). - ! - ! A simple parameterization provided by E. Lewis is used. - !---------------------------------------------------------------------------------------------------------------- - - IF ( H .GT. 0.45D+00 ) THEN ! ... then we are above the crystallization RH of NaCl - SSH2O = SEAS * ( SSH2OA + SSH2OB / ( 1.0D+00 - H ) ) - ELSE - SSH2O = 0.0D+00 - ENDIF - - RETURN - END SUBROUTINE AERO_THERMO - - diff --git a/MATRIXchem_GridComp/microphysics/TRAMP_thermo_isorr2.F b/MATRIXchem_GridComp/microphysics/TRAMP_thermo_isorr2.F deleted file mode 100644 index 3d97425b..00000000 --- a/MATRIXchem_GridComp/microphysics/TRAMP_thermo_isorr2.F +++ /dev/null @@ -1,168 +0,0 @@ - SUBROUTINE AERO_THERMO(ASO4,ANO3,ANH4,AH2O,GNH3,GHNO3,TOT_DUST, - & SEAS,SSH2O,TK,RH,PRES,RHD,RHC) -!@sum -!@+ This routine sets up for and calls the thermodynamic module for aerosol -!@+ gas-particle partitioning. -!@+ -!@+ This version of AERO_THERMO is for use with the ISORROPIA thermodynamic module. -!@auth Susanne Bauer/Doug Wright - - USE AERO_PARAM, ONLY: WRITE_LOG, AUNIT1 - USE AERO_PARAM, only: IXXX, IYYY, ILAY - IMPLICIT NONE - - !------------------------------------------------------------------------------------------------------ - ! Arguments. - !------------------------------------------------------------------------------------------------------ - REAL(8), INTENT(INOUT) :: ASO4 ! aerosol sulfate [ug/m^3] - REAL(8), INTENT(INOUT) :: ANO3 ! aerosol nitrate [ug/m^3] - REAL(8), INTENT(INOUT) :: ANH4 ! aerosol ammonium [ug/m^3] - REAL(8), INTENT(INOUT) :: AH2O ! aerosol water [ug/m^3] - REAL(8), INTENT(INOUT) :: GNH3 ! gas-phase ammonia [ugNH4/m^3] as ammonium (MW) - REAL(8), INTENT(INOUT) :: GHNO3 ! gas-phase nitric acid [ugNO3/m^3] as nitrate (MW) - REAL(8), INTENT(IN) :: TOT_DUST ! total dust(sol+insol) [ug/m^3] - REAL(8), INTENT(IN) :: SEAS ! sea salt (NaCl) [ug/m^3] - REAL(8), INTENT(OUT) :: SSH2O ! sea salt assoc. H2O [ug/m^3] - REAL(8), INTENT(IN) :: TK ! absolute temperature [K] - REAL(8), INTENT(IN) :: RH ! relative humidity [0-1] - REAL(8), INTENT(IN) :: PRES ! ambient pressure [Pa] - REAL(8), INTENT(OUT) :: RHD ! RH of deliquescence [0-1] - REAL(8), INTENT(OUT) :: RHC ! RH of crystallization [0-1] - - !------------------------------------------------------------------------------------------------------ - ! Input to ISOROPIA. - !------------------------------------------------------------------------------------------------------ - REAL(8) :: WI(8) ! [moles/m^3] - REAL(8) :: RHI ! [0.0-1.0] - REAL(8) :: TEMPI ! [K] - REAL(8) :: CNTRL(2) ! [1] control variables - - !------------------------------------------------------------------------------------------------------ - ! Output from ISOROPIA. - !------------------------------------------------------------------------------------------------------ - REAL(8) :: WT(8) ! [moles/m^3] - REAL(8) :: GAS(3) ! [moles/m^3] - REAL(8) :: AERLIQ(15) ! [moles/m^3] - REAL(8) :: AERSLD(19) ! [moles/m^3] - REAL(8) :: OTHER(6) ! - CHARACTER(LEN=15) :: SCASI = ' ' - - !------------------------------------------------------------------------------------------------------ - ! Parameters. Double-precision molecular weights [g/mol] and their reciprocals. - !------------------------------------------------------------------------------------------------------ - REAL(8), PARAMETER :: MW_ANH4 = 18.03850D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_GNH3 = MW_ANH4 ! [g/mol] NH3 is passed as equivalent conc. of NH4+ - REAL(8), PARAMETER :: MW_ANO3 = 62.00494D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_GHNO3 = MW_ANO3 ! [g/mol] HNO3 is passed as equivalent conc. of NO3- - REAL(8), PARAMETER :: MW_ASO4 = 96.0636D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_NA = 22.989768D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_CL = 35.4527D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_NACL = 58.442468D+00 ! [g/mol] - REAL(8), PARAMETER :: MW_H2O = 18.01528D+00 ! [g/mol] - REAL(4), PARAMETER :: MW_K = 39.0983 ! [g/mol] - REAL(4), PARAMETER :: MW_CA = 40.078 ! [g/mol] - REAL(4), PARAMETER :: MW_MG = 24.3050 ! [g/mol] - REAL(8), PARAMETER :: RMW_NA = 1.0D-06 / MW_NA ! [mol/g] - REAL(8), PARAMETER :: RMW_ASO4 = 1.0D-06 / MW_ASO4 ! [mol/g] - REAL(8), PARAMETER :: RMW_ANH4 = 1.0D-06 / MW_ANH4 ! [mol/g] - REAL(8), PARAMETER :: RMW_GNH3 = 1.0D-06 / MW_GNH3 ! [mol/g] - REAL(8), PARAMETER :: RMW_ANO3 = 1.0D-06 / MW_ANO3 ! [mol/g] - REAL(8), PARAMETER :: RMW_GHNO3 = 1.0D-06 / MW_GHNO3 ! [mol/g] - REAL(8), PARAMETER :: RMW_CL = 1.0D-06 / MW_CL ! [mol/g] - REAL(8), PARAMETER :: CMW_NA = 1.0D+06 * MW_NA ! [ug/mol] - REAL(8), PARAMETER :: CMW_ASO4 = 1.0D+06 * MW_ASO4 ! [ug/mol] - REAL(8), PARAMETER :: CMW_ANH4 = 1.0D+06 * MW_ANH4 ! [ug/mol] - REAL(8), PARAMETER :: CMW_GNH3 = 1.0D+06 * MW_GNH3 ! [ug/mol] - REAL(8), PARAMETER :: CMW_ANO3 = 1.0D+06 * MW_ANO3 ! [ug/mol] - REAL(8), PARAMETER :: CMW_GHNO3 = 1.0D+06 * MW_GHNO3 ! [ug/mol] - REAL(8), PARAMETER :: CMW_CL = 1.0D+06 * MW_CL ! [ug/mol] - REAL(8), PARAMETER :: CMW_H2O = 1.0D+06 * MW_H2O ! [g/mol] - - !------------------------------------------------------------------------------------------------------ - ! Fraction of sea salt (NaCl) mass that is Na, and is Cl. - !------------------------------------------------------------------------------------------------------ - REAL(8), PARAMETER :: RAT_NA = MW_NA / ( MW_NA + MW_CL ) ! [1] - REAL(8), PARAMETER :: RAT_CL = MW_CL / ( MW_NA + MW_CL ) ! [1] - !------------------------------------------------------------------------------------------------------ - ! Fraction of dust mass that is K, Mg, Cl-, and Ca - !------------------------------------------------------------------------------------------------------ - REAL(4), PARAMETER :: MASS_FRAC_K = 0.0028 ! From Ghan et al. (2001). - REAL(4), PARAMETER :: MASS_FRAC_CA = 0.024 ! JGR, Vol. 106, p. 5295-5316. - REAL(4), PARAMETER :: MASS_FRAC_MG = 0.0038 ! on p. 5296 - REAL(4), PARAMETER :: MASS_FRAC_NA = 0.014 ! "water sol. mass frac. in soil dust" - REAL(4), PARAMETER :: FRAC_DUST = 0.d0 ! [1] fraction of dust conc. passed to Thermodynamics - REAL(4), PARAMETER :: FRAC_SALT = 0.d0 ! [1] fraction of salt conc. passed to Thermodynamics - REAL(4), PARAMETER :: CONV_KION = FRAC_DUST * MASS_FRAC_K / MW_K ! [mol/g] - REAL(4), PARAMETER :: CONV_CAION = FRAC_DUST * MASS_FRAC_CA / MW_CA ! [mol/g] - REAL(4), PARAMETER :: CONV_MGION = FRAC_DUST * MASS_FRAC_MG / MW_MG ! [mol/g] - REAL(4), PARAMETER :: CONV_NAION = FRAC_DUST * MASS_FRAC_NA / MW_NA ! [mol/g] - - !------------------------------------------------------------------------------------------------------ - ! Other parameters. - !------------------------------------------------------------------------------------------------------ - REAL(8), PARAMETER :: DH2O = 1.000D+00 ! density of water [g/cm^3] - REAL(8), PARAMETER :: DNACL = 2.165D+00 ! density of NaCl [g/cm^3] - REAL(8), PARAMETER :: CSS = 1.08D+00 ! for sea salt ... - REAL(8), PARAMETER :: BSS = 1.2D+00 ! for sea salt ... - REAL(8), PARAMETER :: SSH2OA = (CSS*CSS*CSS*BSS-1.0D+00)*DH2O/DNACL - REAL(8), PARAMETER :: SSH2OB = (CSS*CSS*CSS )*DH2O/DNACL - REAL(8), PARAMETER :: RHMAX = 0.995D+00 ! [0-1] - REAL(8), PARAMETER :: RHMIN = 0.010D+00 ! [0-1] - REAL(8) :: H ! local RH, with RHMIN < H < RHMAX - - !------------------------------------------------------------------------------------------------------ - ! Call for the bulk non-sea salt inorganic aerosol. - !------------------------------------------------------------------------------------------------------ - - H = MAX( MIN( RH, RHMAX ), RHMIN ) - WI(1) = RAT_NA*SEAS*RMW_NA*FRAC_SALT ! sodium from [ug/m^3] to [mol/m^3] - WI(2) = ASO4*RMW_ASO4 ! sulfate from [ug/m^3] to [mol/m^3] - WI(3) = ANH4*RMW_ANH4 + GNH3*RMW_GNH3 ! ammonium from [ug/m^3] to [mol/m^3] - WI(4) = ANO3*RMW_ANO3 + GHNO3*RMW_GHNO3 ! nitrate from [ug/m^3] to [mol/m^3] - WI(5) = RAT_CL*SEAS*RMW_CL*FRAC_SALT ! chloride from [ug/m^3] to [mol/m^3] - WI(6) = TOT_DUST*CONV_CAION*1.0D-06 ! calcium - WI(7) = TOT_DUST*CONV_KION *1.0D-06 ! potassium - WI(8) = TOT_DUST*CONV_MGION*1.0D-06 ! magnesium - - CNTRL(1) = 0.0D+00 ! Forward problem: WI contains the gas+aerosol concentrations - CNTRL(2) = 0.0D+00 ! 0 (solid & liquid phases), 1 (liquid only, metastable) - - WT(:) = 0.0D+00 - GAS(:) = 0.0D+00 - AERLIQ(:) = 0.0D+00 - AERSLD(:) = 0.0D+00 - OTHER(:) = 0.0D+00 - - - CALL ISOROPIA ( WI, H, TK, CNTRL, WT, GAS, AERLIQ, AERSLD, SCASI, OTHER ) - - - GNH3 = MAX( GAS(1)*CMW_GNH3, 0.0D+00 ) ! from [mol/m^3] to [ug/m^3] - GHNO3 = MAX( GAS(2)*CMW_GHNO3, 0.0D+00 ) ! from [mol/m^3] to [ug/m^3] - ASO4 = WT(2)*CMW_ASO4 ! from [mol/m^3] to [ug/m^3] - ANH4 = WT(3)*CMW_ANH4 - GNH3 ! from [mol/m^3] to [ug/m^3] - ANO3 = WT(4)*CMW_ANO3 - GHNO3 ! from [mol/m^3] to [ug/m^3] - AH2O = AERLIQ(8)*CMW_H2O ! from [mol/m^3] to [ug/m^3] - ANH4 = MAX( ANH4, 0.0D+00 ) ! [ug/m^3] - ANO3 = MAX( ANO3, 0.0D+00 ) ! [ug/m^3] - - RHD = 0.80D+00 ! RHD = 0.80 for ammonium sulfate (Ghan et al., 2001). - RHC = 0.35D+00 ! RHC = 0.35 for ammonium sulfate (Ghan et al., 2001). - - - !------------------------------------------------------------------------- - ! Get the sea salt-associated water (only). - ! - ! A simple parameterization provided by E. Lewis is used. - !------------------------------------------------------------------------- - - IF ( H .GT. 0.45D+00 ) THEN ! ... then we are above the crystallization RH of NaCl - SSH2O = SEAS * ( SSH2OA + SSH2OB / ( 1.0D+00 - H ) ) - ELSE - SSH2O = 0.0D+00 - ENDIF - - RETURN - END SUBROUTINE AERO_THERMO - - diff --git a/MATRIXchem_GridComp/microphysics/isrpia.inc b/MATRIXchem_GridComp/microphysics/isrpia.inc deleted file mode 100644 index 4c09ded5..00000000 --- a/MATRIXchem_GridComp/microphysics/isrpia.inc +++ /dev/null @@ -1,109 +0,0 @@ -C======================================================================= -C *** ISORROPIA CODE II -C *** INCLUDE FILE 'ISRPIA.INC' -C *** THIS FILE CONTAINS THE DECLARATIONS OF THE GLOBAL CONSTANTS -C AND VARIABLES. -C -C *** COPYRIGHT 1996-2008, UNIVERSITY OF MIAMI, CARNEGIE MELLON UNIVERSITY, -C *** GEORGIA INSTITUTE OF TECHNOLOGY -C *** WRITTEN BY ATHANASIOS NENES -C *** UPDATED BY CHRISTOS FOUNTOUKIS -C -C======================================================================= -C - IMPLICIT DOUBLE PRECISION (A-H,O-Z) - PARAMETER (NCOMP=8,NIONS=10,NGASAQ=3,NSLDS=19,NPAIR=23,NZSR=100, - & NERRMX=25) -C -C *** INPUT VARIABLES ************************************************** -C - INTEGER METSTBL - COMMON /INPT/ W(NCOMP), WAER(NCOMP), TEMP, RH, IPROB, METSTBL, - & NADJ -C -C *** WATER ACTIVITIES OF PURE SALT SOLUTIONS ************************** -C - COMMON /ZSR / AWAS(NZSR), AWSS(NZSR), AWAC(NZSR), AWSC(NZSR), - & AWAN(NZSR), AWSN(NZSR), AWSB(NZSR), AWAB(NZSR), - & AWSA(NZSR), AWLC(NZSR), AWCS(NZSR), AWCN(NZSR), - & AWCC(NZSR), AWPS(NZSR), AWPB(NZSR), AWPN(NZSR), - & AWPC(NZSR), AWMS(NZSR), AWMN(NZSR), AWMC(NZSR) -C -C *** DELIQUESCENCE RELATIVE HUMIDITIES ******************************** -C - INTEGER WFTYP - COMMON /DRH / DRH2SO4, DRNH42S4, DRNAHSO4, DRNACL, DRNANO3, - & DRNA2SO4, DRNH4HS4, DRLC, DRNH4NO3, DRNH4CL, - & DRCASO4, DRCANO32, DRCACL2, DRK2SO4, DRKHSO4, - & DRKNO3, DRKCL, DRMGSO4, DRMGNO32, DRMGCL2 -C - COMMON /MDRH/ DRMLCAB, DRMLCAS, DRMASAN, DRMG1, DRMG2, - & DRMG3, DRMH1, DRMH2, DRMI1, DRMI2, - & DRMI3, DRMQ1, DRMR1, DRMR2, DRMR3, - & DRMR4, DRMR5, DRMR6, DRMR7, DRMR8, - & DRMR9, DRMR10, DRMR11, DRMR12, DRMR13, - & WFTYP -C - COMMON /MDRH2/ DRMO1, DRMO2, DRMO3, DRML1, DRML2, - & DRML3, DRMM1, DRMM2, DRMP1, DRMP2, - & DRMP3, DRMP4, DRMP5, DRMV1 - -C -C *** VARIABLES FOR LIQUID AEROSOL PHASE ******************************* -C - DOUBLE PRECISION MOLAL, MOLALR, M0 - REAL IONIC - LOGICAL CALAOU, CALAIN, FRST, DRYF - COMMON /IONS/ MOLAL(NIONS), MOLALR(NPAIR), GAMA(NPAIR), ZZ(NPAIR), - & Z(NIONS), GAMOU(NPAIR), GAMIN(NPAIR),M0(NPAIR), - & GASAQ(NGASAQ), - & EPSACT, COH, CHNO3, CHCL, - & WATER, IONIC, IACALC, - & FRST, CALAIN, CALAOU, DRYF -C -C *** VARIABLES FOR SOLID AEROSOL PHASE ******************************** -C - COMMON /SALT/ CH2SO4, CNH42S4, CNH4HS4, CNACL, CNA2SO4, - & CNANO3, CNH4NO3, CNH4CL, CNAHSO4, CLC, CCASO4, - & CCANO32, CCACL2, CK2SO4, CKHSO4, CKNO3, CKCL, - & CMGSO4, CMGNO32, CMGCL2 -C -C *** VARIABLES FOR GAS PHASE ****************************************** -C - COMMON /GAS / GNH3, GHNO3, GHCL -C -C *** EQUILIBRIUM CONSTANTS ******************************************** -C - COMMON /EQUK/ XK1, XK2, XK3, XK4, XK5, XK6, XK7, XK8, XK9, XK10, - & XK11,XK12,XK13,XK14,XKW, XK21,XK22,XK31,XK32,XK41, - & XK42, XK15, XK16, XK17, XK18, XK19, XK20, XK23, - & XK24, XK25 -C & , XK26, XK27 -C -C *** MOLECULAR WEIGHTS ************************************************ -C - DOUBLE PRECISION IMW - COMMON /OTHR/ R, IMW(NIONS), WMW(NCOMP), SMW(NPAIR) -C -C *** SOLUTION/INFO VARIABLES ****************************************** -C - CHARACTER SCASE*15 - COMMON /CASE/ SULRATW, SULRAT, SODRAT, SO4RAT, CRNARAT, CRRAT, - & SCASE -C - COMMON /SOLN/ EPS, MAXIT, NSWEEP, NDIV, ICLACT -C -C *** ERROR SYSTEM ***************************************************** -C - CHARACTER ERRMSG*40 - INTEGER ERRSTK, NOFER - LOGICAL STKOFL - COMMON /EROR/ STKOFL, NOFER, ERRSTK(NERRMX), ERRMSG(NERRMX) -C -C *** GENERIC VARIABLES ************************************************ -C - CHARACTER VERSION*15 - COMMON /CGEN/ GREAT, TINY, TINY2, ZERO, ONE, VERSION -C -C *** END OF INCLUDE FILE ********************************************** -C diff --git a/MATRIXchem_GridComp/microphysics/rundeck_opts.h b/MATRIXchem_GridComp/microphysics/rundeck_opts.h deleted file mode 100644 index 5a58e960..00000000 --- a/MATRIXchem_GridComp/microphysics/rundeck_opts.h +++ /dev/null @@ -1,21 +0,0 @@ - -#define NEW_IO -#define RAD_O3_GCM_HRES -#define RAD_O3_DECADAL_INPUT -#define TRAC_ADV_CPU -#define USE_ENT -#define TRACERS_ON -#define TRACERS_WATER -#define TRACERS_DRYDEP -#define TRDIAG_WETDEPO -#define NO_HDIURN -#define TRACERS_SPECIAL_Shindell -#define SHINDELL_STRAT_CHEM -#define TRACERS_TERP -#define BIOGENIC_EMISSIONS -#define BC_ALB -#define TRACERS_AMP -#define TRACERS_AMP_M1 -#define TRACERS_VOLCEXP -#define CLD_AER_CDNC -#define BLK_2MOM