diff --git a/components/scream/data/p3_universal_constants.inp b/components/scream/data/p3_universal_constants.inp deleted file mode 100644 index 6f95b1f2dcf..00000000000 --- a/components/scream/data/p3_universal_constants.inp +++ /dev/null @@ -1,76 +0,0 @@ - Universal constants for p3-stand-alone test case - 1 72 - 0.10046400E+04 0.28704231E+03 0.46150464E+03 0.10000000E+04 0.18016000E+02 0.28966000E+02 0.98061600E+01 0.25010000E+07 0.33370000E+06 0.41880000E+04 0.27315000E+03 0.31415927E+01 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.12382541E+02 0.62281373E+05 0.23579997E+03 0.10000000E-07 0.00000000E+00 0.79126502E-24 0.10000000E-11 0.10000000E-11 0.57023796E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.47650820E+01 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.18282924E+02 0.59625231E+05 0.23579997E+03 0.10000000E-07 0.00000000E+00 0.12365811E-23 0.10000000E-11 0.10000000E-11 0.61375598E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.70356825E+01 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.26994886E+02 0.56969089E+05 0.23579996E+03 0.10000000E-07 0.00000000E+00 0.14700899E-23 0.10000000E-11 0.10000533E-11 0.57301008E-25 0.10000533E-11 0.00000000E+00 0.00000000E+00 0.10388243E+02 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.39858170E+02 0.54312947E+05 0.23579996E+03 0.10000000E-07 0.00000000E+00 0.17925717E-23 0.10000000E-11 0.10000008E-11 0.50451511E-25 0.10000008E-11 0.00000000E+00 0.00000000E+00 0.15338325E+02 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.58850915E+02 0.51656806E+05 0.23579996E+03 0.10000000E-07 0.00000000E+00 0.26593238E-23 0.10000000E-11 0.10000000E-11 0.40171733E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.22647163E+02 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.86893857E+02 0.49000664E+05 0.23579995E+03 0.10000000E-07 0.00000000E+00 0.32731659E-23 0.10000000E-11 0.10000000E-11 0.40108657E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.33438722E+02 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.12829949E+03 0.46344522E+05 0.23579995E+03 0.10000000E-07 0.00000000E+00 0.38027549E-23 0.10000000E-11 0.10000000E-11 0.21119237E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.49372546E+02 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.18943525E+03 0.43688380E+05 0.23579994E+03 0.10000000E-07 0.00000000E+00 0.38994722E-23 0.10000000E-11 0.10000000E-11 0.21587319E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.72898968E+02 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.27970269E+03 0.41032239E+05 0.23579993E+03 0.10000000E-07 0.00000000E+00 0.32392643E-23 0.10000000E-11 0.10000000E-11 0.30988101E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.10763592E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.41298332E+03 0.38376097E+05 0.23579992E+03 0.10000000E-07 0.00000000E+00 0.31335390E-23 0.10000000E-11 0.10000000E-11 0.17845550E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.15892532E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.59684494E+03 0.35719956E+05 0.23579992E+03 0.10000000E-07 0.00000000E+00 0.37708324E-23 0.10000000E-11 0.10000000E-11 0.10001487E-26 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.20879792E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.83774044E+03 0.33305300E+05 0.23579990E+03 0.10000000E-07 0.00000000E+00 0.38224687E-23 0.10000000E-11 0.10000000E-11 0.49193512E-29 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.27299308E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.11473787E+04 0.31056076E+05 0.22950849E+03 0.10000000E-07 0.00000000E+00 0.35292429E-23 0.10000000E-11 0.10000000E-11 0.95932075E-32 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.34628349E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.15333938E+04 0.29028530E+05 0.22475939E+03 0.10000000E-07 0.00000000E+00 0.31278058E-23 0.10000000E-11 0.10000000E-11 0.87843493E-35 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.42574671E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.19996338E+04 0.27201850E+05 0.21967851E+03 0.10000000E-07 0.00000000E+00 0.38752499E-23 0.10000000E-11 0.10000000E-11 0.22940663E-38 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.50673324E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.25444697E+04 0.25572316E+05 0.21670825E+03 0.10000000E-07 0.00000000E+00 0.79188162E-23 0.10000000E-11 0.10000000E-11 0.29370030E-44 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.58293846E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.31593251E+04 0.24119041E+05 0.21335626E+03 0.10000000E-07 0.00000000E+00 0.26481869E-22 0.10000000E-11 0.10000000E-11 0.23568089E-50 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.64677249E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.38366283E+04 0.22840515E+05 0.21096865E+03 0.10000000E-07 0.00000000E+00 0.46670205E-22 0.10000000E-11 0.10000000E-11 0.23410673E-56 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.70783387E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.45671198E+04 0.21701193E+05 0.20849985E+03 0.10000000E-07 0.00000000E+00 0.49067497E-22 0.10000000E-11 0.10003002E-11 0.28904494E-62 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.75314910E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.53309561E+04 0.20694745E+05 0.20630435E+03 0.10000000E-07 0.00000000E+00 0.30646138E-22 0.10000000E-11 0.10004371E-11 0.10036998E-59 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.77452360E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.61015182E+04 0.19817371E+05 0.20337028E+03 0.10000000E-07 0.00000000E+00 0.73896324E-21 0.10000000E-11 0.11494500E-09 0.51087216E-54 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.76660045E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.68476390E+04 0.19069433E+05 0.19998210E+03 0.10000000E-07 0.00000000E+00 0.26092693E-17 0.10000000E-11 0.10636441E-05 0.20076859E-48 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.72564126E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.75355336E+04 0.18449108E+05 0.19738941E+03 0.10000000E-07 0.00000000E+00 0.79229636E-19 0.10000000E-11 0.32297594E-07 0.56170355E-43 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.65014787E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.81946275E+04 0.17950604E+05 0.19516458E+03 0.10000000E-07 0.00000000E+00 0.83907852E-24 0.10000000E-11 0.13429897E-11 0.52578397E-38 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.66803998E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.88910543E+04 0.17484888E+05 0.19568335E+03 0.10000000E-07 0.00000000E+00 0.11602186E-20 0.10000000E-11 0.54603037E-09 0.83799770E-37 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.72481363E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.96466673E+04 0.17017934E+05 0.19659673E+03 0.10000000E-07 0.00000000E+00 0.79743604E-22 0.10000000E-11 0.14205765E-10 0.64769840E-38 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.78641243E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.10466497E+05 0.16548801E+05 0.19829725E+03 0.10000000E-07 0.00000000E+00 0.54457740E-22 0.10000001E-11 0.10001892E-11 0.67857640E-39 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.85324634E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.11356000E+05 0.16075609E+05 0.20000007E+03 0.10000000E-07 0.00000000E+00 0.72765698E-22 0.10000000E-11 0.10000000E-11 0.13042193E-40 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.92576049E+03 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.12321099E+05 0.15598355E+05 0.20177966E+03 0.10000000E-07 0.00000000E+00 0.27829649E-22 0.10000000E-11 0.10000000E-11 0.12372942E-35 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.10044375E+04 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.13368218E+05 0.15116853E+05 0.20391623E+03 0.10000000E-07 0.00000000E+00 0.11954057E-21 0.10000000E-11 0.10000000E-11 0.14102302E-30 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.10898002E+04 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.14504327E+05 0.14630253E+05 0.20728185E+03 0.10000000E-07 0.00000000E+00 0.37980163E-21 0.10000000E-11 0.10000506E-11 0.69928213E-26 0.10007326E-11 0.00000000E+00 0.00000000E+00 0.11824169E+04 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.15736988E+05 0.14135622E+05 0.21067627E+03 0.10000000E-07 0.00000000E+00 0.76867979E-21 0.10000000E-11 0.58041360E-11 0.75615746E-27 0.10004294E-11 0.00000000E+00 0.00000000E+00 0.12829055E+04 - 0.00000000E+00 0.00000000E+00 0.33333300E-08 0.17074408E+05 0.13632891E+05 0.21411679E+03 0.10000000E-07 0.00000000E+00 0.16655077E-17 0.10020984E-11 0.46595715E-06 0.41161112E-29 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.13919348E+04 - 0.00000000E+00 0.00000000E+00 0.33329801E-08 0.18535824E+05 0.13121950E+05 0.21766168E+03 0.10000000E-07 0.00000000E+00 0.16658840E-12 0.10595720E-09 0.46424271E-01 0.33669862E-26 0.10001552E-11 0.00000000E+00 0.00000000E+00 0.15308969E+04 - 0.10000000E-03 0.00000000E+00 0.33333092E-08 0.20136035E+05 0.12595735E+05 0.22128118E+03 0.10000000E-07 0.91835496E-40 0.87086389E-08 0.72356041E-11 0.24268925E+04 0.17601468E-21 0.91116071E-11 0.00000000E+00 0.00000000E+00 0.16695251E+04 - 0.10000000E-03 0.00000000E+00 0.33271924E-08 0.21876503E+05 0.12058690E+05 0.22495626E+03 0.10000000E-07 0.00000000E+00 0.62150364E-09 0.18422904E-08 0.12542992E+03 0.10093561E-21 0.69277213E-11 0.00000000E+00 0.00000000E+00 0.18114111E+04 - 0.21390303E-04 0.00000000E+00 -0.33385823E-06 0.23764886E+05 0.11513455E+05 0.22869237E+03 0.10000000E-07 0.00000000E+00 0.21390303E-11 0.10115747E-03 0.54842774E+00 0.38278778E-23 0.10000995E-11 0.00000000E+00 0.00000000E+00 0.19653553E+04 - 0.00000000E+00 0.00000000E+00 -0.30215544E-05 0.25813755E+05 0.10959845E+05 0.23249383E+03 0.10000000E-07 0.00000000E+00 0.39687094E-14 0.90746632E-03 0.27172101E-02 0.10874170E-25 0.10000000E-11 0.00000000E+00 0.00000000E+00 0.21323828E+04 - 0.00000000E+00 0.00000000E+00 -0.33925274E-06 0.28036749E+05 0.10397669E+05 0.23636446E+03 0.10000003E-07 0.00000000E+00 0.54871216E-18 0.10277582E-03 0.31721279E-05 0.45832066E-28 0.10000018E-11 0.00000000E+00 0.00000000E+00 0.23136053E+04 - 0.00000000E+00 0.00000000E+00 -0.15503086E-01 0.30448666E+05 0.98267284E+04 0.24027833E+03 0.10324732E-07 0.00000000E+00 0.17038345E-18 0.46509269E+01 0.34896819E-07 0.53256782E-23 0.12107536E-11 0.00000000E+00 0.00000000E+00 0.25102286E+04 - 0.00000000E+00 0.00000000E+00 -0.62931897E-01 0.33065561E+05 0.92468905E+04 0.24427056E+03 0.19317477E-04 0.16155871E-26 0.20211590E-13 0.18879570E+02 0.41426668E-02 0.63324134E-18 0.25060321E-07 0.00000000E+00 0.00000000E+00 0.27235613E+04 - 0.10000000E-03 0.00000000E+00 -0.10768829E-01 0.35904854E+05 0.86579324E+04 0.24830082E+03 0.23238611E-03 0.00000000E+00 0.12229239E-08 0.32306496E+01 0.25060830E+03 0.38365212E-13 0.15182525E-02 0.00000000E+00 0.00000000E+00 0.29550251E+04 - 0.10000000E-03 0.00000000E+00 -0.33198462E-04 0.38985448E+05 0.80596662E+04 0.25241712E+03 0.45062848E-03 0.00000000E+00 0.65097131E-08 0.99605387E-02 0.20790907E+03 0.63984355E-11 0.25595038E+00 0.00000000E+00 0.00000000E+00 0.32061613E+04 - 0.10000000E-03 0.00000000E+00 -0.43404841E-08 0.42327848E+05 0.74518567E+04 0.25659509E+03 0.66901821E-03 0.00000000E+00 0.10356875E-09 0.23021452E-05 0.18511444E+01 0.24012263E-09 0.99665869E+01 0.00000000E+00 0.00000000E+00 0.34786400E+04 - 0.00000000E+00 0.00000000E+00 -0.92367040E-03 0.45954306E+05 0.68343308E+04 0.26084581E+03 0.89408222E-03 0.00000000E+00 0.79145094E-14 0.27710212E+00 0.53135137E-04 0.50779788E-09 0.18458928E+02 0.00000000E+00 0.00000000E+00 0.37742746E+04 - 0.00000000E+00 0.00000000E+00 -0.60063094E+02 0.49833488E+05 0.62068882E+04 0.26508722E+03 0.11238626E-02 0.00000000E+00 0.41517569E-18 0.18018928E+05 0.13605544E+01 0.73674929E-09 0.21082379E+02 0.00000000E+00 0.00000000E+00 0.39840912E+04 - 0.00000000E+00 0.00000000E+00 -0.97010840E-03 0.53824565E+05 0.55861045E+04 0.26919038E+03 0.13390340E-02 0.00000000E+00 0.34456206E-16 0.29103352E+00 0.20703534E+03 0.75889862E-09 0.15720894E+02 0.00000000E+00 0.00000000E+00 0.39980624E+04 - 0.00000000E+00 0.00000000E+00 -0.28300444E+00 0.57796733E+05 0.50003322E+04 0.27303860E+03 0.15381548E-02 0.00000000E+00 0.27384541E-19 0.84901332E+02 0.38141561E-02 0.14339951E-08 0.40565530E+02 0.00000000E+00 0.00000000E+00 0.39462731E+04 - 0.00000000E+00 0.00000000E+00 -0.21745915E+00 0.61670425E+05 0.44541209E+04 0.27659847E+03 0.17299406E-02 0.00000000E+00 0.26577943E-14 0.65237745E+02 0.58463095E-05 0.10659042E-07 0.36078661E+03 0.00000000E+00 0.00000000E+00 0.38011115E+04 - 0.10000000E-03 0.00000000E+00 -0.35937488E+01 0.65407314E+05 0.39545619E+04 0.27926609E+03 0.20225217E-02 0.00000000E+00 0.12401001E-09 0.10781246E+04 0.27091739E+00 0.14488742E-07 0.39175590E+03 0.00000000E+00 0.00000000E+00 0.36726657E+04 - 0.10000000E-03 0.00000000E+00 -0.63656248E+02 0.68991561E+05 0.34949897E+04 0.28130126E+03 0.24643585E-02 0.00000000E+00 0.50896177E-08 0.19096874E+05 0.10608994E+02 0.26712964E-06 0.10934173E+04 0.00000000E+00 0.00000000E+00 0.34958292E+04 - 0.00000000E+00 0.00000000E+00 -0.15768382E+04 0.72374937E+05 0.30771374E+04 0.28298584E+03 0.40950267E-02 0.00000000E+00 0.15083991E-12 0.47305147E+06 0.31433563E-03 0.17557145E-06 0.92810826E+03 0.00000000E+00 0.00000000E+00 0.32709223E+04 - 0.26979633E-04 0.00000000E+00 -0.20429390E+04 0.75510071E+05 0.27018420E+04 0.28448187E+03 0.57333842E-02 0.40529769E-06 0.26979633E-11 0.61288171E+06 0.32865209E-02 0.12724975E-06 0.95617989E+03 0.00000000E+00 0.00000000E+00 0.29993455E+04 - 0.13677090E-04 0.00000000E+00 -0.29930786E+03 0.78351543E+05 0.23699216E+04 0.28580655E+03 0.70907584E-02 0.18955198E-06 0.13677090E-11 0.89792359E+05 0.16660728E-02 0.13016330E-06 0.23699433E+04 0.00000000E+00 0.00000000E+00 0.26835988E+04 - 0.00000000E+00 0.00000000E+00 -0.12128335E+01 0.80856976E+05 0.20821441E+04 0.28692363E+03 0.82716690E-02 0.00000000E+00 0.18374052E-14 0.36385004E+03 0.14907850E-04 0.44221480E-06 0.51602802E+04 0.00000000E+00 0.00000000E+00 0.23272681E+04 - 0.10000000E-03 0.00000000E+00 -0.11427456E+01 0.82988087E+05 0.18391923E+04 0.28784116E+03 0.92652492E-02 0.00000000E+00 0.16341612E-10 0.34282368E+03 0.25380438E-03 0.11971600E-05 0.15690573E+05 0.00000000E+00 0.00000000E+00 0.19349539E+04 - 0.10000000E-03 0.00000000E+00 -0.11157877E-02 0.84743257E+05 0.16416348E+04 0.28859351E+03 0.10071930E-01 0.12325952E-31 0.20689657E-08 0.33473732E+00 0.37330510E-01 0.19110367E-05 0.41227063E+05 0.00000000E+00 0.00000000E+00 0.15753854E+04 - 0.10000000E-03 0.00000000E+00 -0.39742360E+00 0.86227375E+05 0.14836317E+04 0.28921744E+03 0.10735569E-01 0.00000000E+00 0.11057522E-07 0.11922708E+03 0.33589709E+01 0.20609624E-05 0.50447395E+05 0.00000000E+00 0.00000000E+00 0.13928513E+04 - 0.10000000E-03 0.00000000E+00 -0.15660468E+03 0.87604419E+05 0.13459882E+04 0.28977939E+03 0.11347931E-01 0.00000000E+00 0.77357088E-08 0.46981403E+05 0.13244389E+02 0.15415542E-05 0.42592928E+05 0.00000000E+00 0.00000000E+00 0.13612355E+04 - 0.10000000E-03 0.00000000E+00 -0.69377549E+04 0.88948761E+05 0.12132773E+04 0.29030856E+03 0.11950339E-01 0.00000000E+00 0.34458668E-08 0.20813265E+07 0.65540784E+01 0.10796188E-05 0.42096374E+05 0.00000000E+00 0.00000000E+00 0.13274481E+04 - 0.10000000E-03 0.00000000E+00 -0.16055066E+05 0.90258243E+05 0.10855371E+04 0.29082866E+03 0.12520570E-01 0.00000000E+00 0.27511022E-08 0.48165199E+07 0.30671108E+01 0.14280659E-05 0.45463903E+05 0.00000000E+00 0.00000000E+00 0.12915161E+04 - 0.10000000E-03 0.00000000E+00 -0.14927609E+05 0.91530740E+05 0.96279613E+03 0.29135156E+03 0.13056164E-01 0.00000000E+00 0.15627744E-10 0.44782827E+07 0.24004668E+01 0.59767375E-07 0.39241135E+05 0.00000000E+00 0.00000000E+00 0.12534789E+04 - 0.10000000E-03 0.00000000E+00 -0.81483209E+04 0.92764171E+05 0.84507699E+03 0.29182909E+03 0.13594355E-01 0.00000000E+00 0.31953981E-10 0.24444963E+07 0.37291565E+01 0.38719202E-06 0.31629538E+05 0.00000000E+00 0.00000000E+00 0.12133826E+04 - 0.10000000E-03 0.00000000E+00 -0.52783500E+04 0.93956497E+05 0.73241779E+03 0.29265330E+03 0.13992360E-01 0.00000000E+00 0.19373022E-10 0.15835050E+07 0.25929702E+01 0.15901460E-05 0.32612352E+05 0.00000000E+00 0.00000000E+00 0.11712695E+04 - 0.19936424E-04 0.00000000E+00 -0.34585067E+04 0.95105725E+05 0.62471965E+03 0.29365899E+03 0.14290338E-01 0.00000000E+00 0.19936424E-11 0.10375520E+07 0.13948058E+01 0.22620508E-05 0.27716687E+05 0.00000000E+00 0.00000000E+00 0.11271854E+04 - 0.00000000E+00 0.00000000E+00 -0.62760024E+03 0.96209909E+05 0.52195713E+03 0.29462821E+03 0.14584321E-01 0.00000000E+00 0.10395880E-12 0.18828007E+06 0.14613173E+00 0.29829235E-05 0.16719463E+05 0.00000000E+00 0.00000000E+00 0.10811831E+04 - 0.00000000E+00 0.00000000E+00 -0.51400718E+02 0.97267168E+05 0.42418086E+03 0.29554652E+03 0.14868049E-01 0.00000000E+00 0.56090620E-14 0.15420215E+05 0.78844729E-02 0.34213301E-05 0.15868706E+05 0.00000000E+00 0.00000000E+00 0.10333344E+04 - 0.00000000E+00 0.00000000E+00 -0.28224746E+01 0.98275694E+05 0.33144358E+03 0.29641980E+03 0.15132679E-01 0.00000000E+00 0.30817790E-15 0.84674239E+03 0.43290065E-03 0.29281589E-05 0.12179368E+05 0.00000000E+00 0.00000000E+00 0.98371772E+03 - 0.00000000E+00 0.00000000E+00 -0.17187042E+00 0.99233751E+05 0.24379301E+03 0.29724136E+03 0.15389242E-01 0.00000000E+00 0.22662633E-16 0.51561127E+02 0.26623768E-04 0.23685076E-05 0.91776843E+04 0.00000000E+00 0.00000000E+00 0.93239725E+03 - 0.00000000E+00 0.00000000E+00 -0.39357986E+00 0.10013873E+06 0.16127647E+03 0.29801458E+03 0.15621551E-01 0.00000000E+00 0.95783816E-16 0.11807396E+03 0.65882259E-04 0.17986974E-05 0.73671862E+04 0.00000000E+00 0.00000000E+00 0.87755606E+03 - 0.00000000E+00 0.00000000E+00 -0.90741104E+01 0.10090608E+06 0.84104196E+02 0.29866362E+03 0.15819030E-01 0.00000000E+00 0.17961984E-14 0.27222331E+04 0.15215233E-02 0.13550905E-05 0.65151437E+04 0.00000000E+00 0.00000000E+00 0.65715118E+03 - 0.00000000E+00 0.00000000E+00 -0.10746033E+03 0.10138733E+06 0.26622063E+02 0.29908686E+03 0.15962008E-01 0.00000000E+00 0.21243818E-13 0.32238099E+05 0.18018743E-01 0.11634454E-05 0.65106014E+04 0.00000000E+00 0.00000000E+00 0.30534307E+03 - 0.00000000E+00 diff --git a/components/scream/data/scream-128i.ascii b/components/scream/data/scream-128i.ascii deleted file mode 100644 index 99b5a9f7343..00000000000 --- a/components/scream/data/scream-128i.ascii +++ /dev/null @@ -1,260 +0,0 @@ - 129 - 0.002255239486694 - 0.002905282020569 - 0.003555324316025 - 0.004205366611481 - 0.004989062309265 - 0.005956141471863 - 0.007106605052948 - 0.008306799888611 - 0.009623820304871 - 0.011196125984192 - 0.013023716926575 - 0.014989767074585 - 0.017009893417358 - 0.019320058822632 - 0.021920263290405 - 0.024756431579590 - 0.027592599868774 - 0.030649093627930 - 0.033946311950684 - 0.037484256744385 - 0.041042602539063 - 0.044714427947998 - 0.048562446594238 - 0.052586654663086 - 0.056673576354980 - 0.060758224487305 - 0.064836784362793 - 0.068909248352051 - 0.072977890014648 - 0.077021629333496 - 0.080820442199707 - 0.084374336242676 - 0.087708213806152 - 0.091042098999023 - 0.094538825988770 - 0.098231643676758 - 0.102120544433594 - 0.106042678833008 - 0.110093841552734 - 0.114375694274902 - 0.118888221740723 - 0.123502410888672 - 0.128194793701172 - 0.133158569335937 - 0.138393737792969 - 0.143822097778320 - 0.149255859375000 - 0.154951710769551 - 0.160201147914267 - 0.165721924587489 - 0.171242688069679 - 0.177005612517563 - 0.177533255279309 - 0.176708263861161 - 0.175872653615568 - 0.175013718267785 - 0.173595720064807 - 0.171647125503456 - 0.169645963610565 - 0.167620863820707 - 0.165478061090925 - 0.163217559010589 - 0.160863298738976 - 0.158509038467363 - 0.156025695287062 - 0.153403883330077 - 0.150643605658733 - 0.147873944928210 - 0.144996600120138 - 0.141956354827247 - 0.138753203701417 - 0.135494838936220 - 0.132161761984505 - 0.128637038054949 - 0.124920674429629 - 0.121087367975982 - 0.117227321862327 - 0.113141804926023 - 0.108830834392519 - 0.104321140264980 - 0.099811459956403 - 0.095301268346204 - 0.090790470721501 - 0.086279079244864 - 0.081767591035540 - 0.077327339541632 - 0.073010686931546 - 0.068817660406825 - 0.064677007675150 - 0.060602091654166 - 0.056742680613301 - 0.053098744083370 - 0.049604549851198 - 0.046120512557828 - 0.042935545291044 - 0.040049675620821 - 0.037452760497504 - 0.034855831555223 - 0.032536912544887 - 0.030582485641402 - 0.028992563115733 - 0.027489119418837 - 0.026000904176609 - 0.024543669853280 - 0.023117430151254 - 0.021706930229872 - 0.020304099824082 - 0.018936064994545 - 0.017602824083236 - 0.016296696001331 - 0.014990567919425 - 0.013720866656228 - 0.012489556802475 - 0.011296608555169 - 0.010105622598352 - 0.008942924026273 - 0.007821943549566 - 0.006742695611565 - 0.005676893533866 - 0.004629291043029 - 0.003666928176010 - 0.002818917586310 - 0.001994414941649 - 0.001175611934027 - 0.000448262676924 - 0.000335652956369 - 0.000218868895423 - 0.000092350954975 - 0 - 129 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0.000057200363262 - 0.000880074619913 - 0.001745482639074 - 0.002610888590477 - 0.003514254425796 - 0.010028512298816 - 0.018271029962081 - 0.026619640695956 - 0.035201293328895 - 0.044783903348279 - 0.055338988998497 - 0.066178819714630 - 0.077148316477145 - 0.088755383122942 - 0.101000000803864 - 0.113752484952431 - 0.126504969100997 - 0.139956665552782 - 0.154158433564454 - 0.169110239556111 - 0.184112871478040 - 0.199698803932596 - 0.216167119293847 - 0.233517853427490 - 0.251167667167296 - 0.269222179665886 - 0.288314805206770 - 0.308445505990293 - 0.329209659611909 - 0.350118655920876 - 0.372248972661868 - 0.395600501056700 - 0.420028469110020 - 0.444456362309222 - 0.468887025110827 - 0.493320979473812 - 0.517758152200448 - 0.542195848905867 - 0.566247672665399 - 0.589629999103610 - 0.612342678948643 - 0.634771661758444 - 0.656844563619272 - 0.677750117238262 - 0.697488475154911 - 0.716415713820677 - 0.735287934707798 - 0.752540162716768 - 0.768172248207304 - 0.782239134033746 - 0.796306094714308 - 0.808867140189487 - 0.819453830276567 - 0.828066091669423 - 0.836209916225694 - 0.844271251585110 - 0.852164765205314 - 0.859890382348746 - 0.867530740668565 - 0.875129554961074 - 0.882539887153892 - 0.889761738905045 - 0.896836726850232 - 0.903911714795419 - 0.910789387250022 - 0.917459112631119 - 0.923921042812019 - 0.930372343710242 - 0.936670418258884 - 0.942742509575434 - 0.948588542181404 - 0.954361741720040 - 0.960036358371034 - 0.965428103562272 - 0.970507864640253 - 0.975446808202882 - 0.980351609745661 - 0.984955362811357 - 0.988734781613944 - 0.992654300049890 - 0.996900507931744 - 1.000000000000000 diff --git a/components/scream/data/scream-128m.ascii b/components/scream/data/scream-128m.ascii deleted file mode 100644 index c5eb578ad76..00000000000 --- a/components/scream/data/scream-128m.ascii +++ /dev/null @@ -1,258 +0,0 @@ - 128 - 0.002580260753632 - 0.003230303168297 - 0.003880345463753 - 0.004597214460373 - 0.005472601890564 - 0.006531373262405 - 0.007706702470779 - 0.008965310096741 - 0.010409973144531 - 0.012109921455383 - 0.014006742000580 - 0.015999830245972 - 0.018164976119995 - 0.020620161056519 - 0.023338347434998 - 0.026174515724182 - 0.029120846748352 - 0.032297702789307 - 0.035715284347534 - 0.039263429641724 - 0.042878515243530 - 0.046638437271118 - 0.050574550628662 - 0.054630115509033 - 0.058715900421143 - 0.062797504425049 - 0.066873016357422 - 0.070943569183350 - 0.074999759674072 - 0.078921035766602 - 0.082597389221191 - 0.086041275024414 - 0.089375156402588 - 0.092790462493896 - 0.096385234832764 - 0.100176094055176 - 0.104081611633301 - 0.108068260192871 - 0.112234767913818 - 0.116631958007812 - 0.121195316314697 - 0.125848602294922 - 0.130676681518555 - 0.135776153564453 - 0.141107917785645 - 0.146538978576660 - 0.152103785072275 - 0.157576429341909 - 0.162961536250878 - 0.168482306328584 - 0.174124150293621 - 0.177269433898436 - 0.177120759570235 - 0.176290458738364 - 0.175443185941676 - 0.174304719166296 - 0.172621422784131 - 0.170646544557010 - 0.168633413715636 - 0.166549462455816 - 0.164347810050757 - 0.162040428874782 - 0.159686168603169 - 0.157267366877212 - 0.154714789308570 - 0.152023744494405 - 0.149258775293472 - 0.146435272524174 - 0.143476477473693 - 0.140354779264332 - 0.137124021318818 - 0.133828300460362 - 0.130399400019727 - 0.126778856242289 - 0.123004021202805 - 0.119157344919154 - 0.115184563394175 - 0.110986319659271 - 0.106575987328749 - 0.102066300110691 - 0.097556364151304 - 0.093045869533853 - 0.088534774983183 - 0.084023335140202 - 0.079547465288586 - 0.075169013236589 - 0.070914173669186 - 0.066747334040988 - 0.062639549664658 - 0.058672386133733 - 0.054920712348335 - 0.051351646967284 - 0.047862531204513 - 0.044528028924436 - 0.041492610455932 - 0.038751218059163 - 0.036154296026364 - 0.033696372050055 - 0.031559699093145 - 0.029787524378567 - 0.028240841267285 - 0.026745011797723 - 0.025272287014944 - 0.023830550002267 - 0.022412180190563 - 0.021005515026977 - 0.019620082409314 - 0.018269444538891 - 0.016949760042283 - 0.015643631960378 - 0.014355717287826 - 0.013105211729351 - 0.011893082678822 - 0.010701115576760 - 0.009524273312312 - 0.008382433787919 - 0.007282319580566 - 0.006209794572716 - 0.005153092288448 - 0.004148109609519 - 0.003242922881160 - 0.002406666263979 - 0.001585013437838 - 0.000811937305475 - 0.000391957816646 - 0.000277260925896 - 0.000155609925199 - 0.000046175477487 - 128 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0.000028600181631 - 0.000468637491587 - 0.001312778629493 - 0.002178185614775 - 0.003062571508137 - 0.006771383362306 - 0.014149771130449 - 0.022445335329019 - 0.030910467012425 - 0.039992598338587 - 0.050061446173388 - 0.060758904356564 - 0.071663568095888 - 0.082951849800044 - 0.094877691963403 - 0.107376242878148 - 0.120128727026714 - 0.133230817326889 - 0.147057549558618 - 0.161634336560282 - 0.176611555517075 - 0.191905837705318 - 0.207932961613221 - 0.224842486360668 - 0.242342760297393 - 0.260194923416591 - 0.278768492436328 - 0.298380155598531 - 0.318827582801101 - 0.339664157766393 - 0.361183814291372 - 0.383924736859284 - 0.407814485083360 - 0.432242415709621 - 0.456671693710024 - 0.481104002292319 - 0.505539565837130 - 0.529977000553157 - 0.554221760785633 - 0.577938835884504 - 0.600986339026127 - 0.623557170353543 - 0.645808112688858 - 0.667297340428767 - 0.687619296196587 - 0.706952094487794 - 0.725851824264237 - 0.743914048712283 - 0.760356205462036 - 0.775205691120525 - 0.789272614374027 - 0.802586617451898 - 0.814160485233027 - 0.823759960972995 - 0.832138003947559 - 0.840240583905402 - 0.848218008395212 - 0.856027573777030 - 0.863710561508656 - 0.871330147814820 - 0.878834721057483 - 0.886150813029469 - 0.893299232877639 - 0.900374220822826 - 0.907350551022721 - 0.914124249940571 - 0.920690077721569 - 0.927146693261130 - 0.933521380984563 - 0.939706463917159 - 0.945665525878419 - 0.951475141950722 - 0.957199050045537 - 0.962732230966653 - 0.967967984101262 - 0.972977336421568 - 0.977899208974272 - 0.982653486278509 - 0.986845072212650 - 0.990694540831917 - 0.994777403990817 - 0.998450253965872 diff --git a/components/scream/data/scream-72i.ascii b/components/scream/data/scream-72i.ascii deleted file mode 100644 index 089dd0882df..00000000000 --- a/components/scream/data/scream-72i.ascii +++ /dev/null @@ -1,148 +0,0 @@ - 73 ! hyai -0.000100000003197544 -0.000147650822913689 -0.000218007648100008 -0.000321890076141867 -0.000475273331103897 -0.000701744962025609 -0.00103613217805539 -0.00152985763845446 -0.00225884732035832 -0.0033352065502282 -0.00492445975982147 -0.00701243897441468 -0.00974236978346886 -0.0132052046776003 -0.0174626717668335 -0.0225300041895007 -0.0283593888304225 -0.034827113752148 -0.041905452436706 -0.0494369434421476 -0.0571821794266375 -0.0648481839141014 -0.0721045965453237 -0.0786060752491983 -0.0852864750002711 -0.0925346112988507 -0.100398735591023 -0.108931198982486 -0.118188803860441 -0.128233178994491 -0.139131180869721 -0.15095535019568 -0.163784405484479 -0.177703753558685 -0.179385822249023 -0.175675927102577 -0.17165073759334 -0.1672834617223 -0.162545029418381 -0.15740389711747 -0.15182585143654 -0.145773756845278 -0.139207310820371 -0.13208280432797 -0.124352822700141 -0.115965905997 -0.107112738553965 -0.0982285216614102 -0.0894593912425344 -0.0810128312221591 -0.0728516968335758 -0.0650835216407907 -0.0578151181011672 -0.0511501816401456 -0.0451868752058862 -0.0400153815809578 -0.0357156609860045 -0.0322149484438234 -0.029119859625476 -0.026095026982349 -0.0231452699030555 -0.0202753565973884 -0.0174899618767363 -0.0147936633105226 -0.0121909509564104 -0.00968620349992126 -0.00728367415589031 -0.0049874666538631 -0.00280151930245531 -0.000729616903308118 -0 -0 -0 - 73 ! hybi -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0.0134202286505943 -0.0335159017400141 -0.0553194276300706 -0.07897594622927 -0.104642934440567 -0.132491255643252 -0.162706276046504 -0.195489127850018 -0.231058063361093 -0.269649869330388 -0.311521429400028 -0.356951469881188 -0.404907033612902 -0.453030768886649 -0.500531124416072 -0.546284201962403 -0.590491205905005 -0.632569664497108 -0.671940972401801 -0.708043386503276 -0.740345232537401 -0.768358010113227 -0.791648594274282 -0.810611138069112 -0.827376552082779 -0.843761412608077 -0.859739587174728 -0.87528525851737 -0.890373089588945 -0.90497829406461 -0.919076587963127 -0.932644247225949 -0.945658192826992 -0.958096199105933 -0.9699369757393 -0.981160015793907 -0.99052103362492 -0.996992878983524 -1 diff --git a/components/scream/data/scream-72m.ascii b/components/scream/data/scream-72m.ascii deleted file mode 100644 index eb6d957a324..00000000000 --- a/components/scream/data/scream-72m.ascii +++ /dev/null @@ -1,147 +0,0 @@ - 72 ! hyam -0.000123825413055617 -0.000182829235506849 -0.000269948862120937 -0.000398581703622882 -0.000588509146564753 -0.0008689385700405 -0.00128299490825493 -0.00189435247940639 -0.00279702693529326 -0.00412983315502484 -0.00596844936711808 -0.00837740437894177 -0.0114737872305346 -0.0153339382222169 -0.0199963379781671 -0.0254446965099616 -0.0315932512912852 -0.038366283094427 -0.0456711979394268 -0.0533095614343925 -0.0610151816703695 -0.0684763902297126 -0.075355335897261 -0.0819462751247347 -0.0889105431495609 -0.096466673444937 -0.104664967286755 -0.113560001421463 -0.123210991427466 -0.133682179932106 -0.1450432655327 -0.157369877840079 -0.170744079521582 -0.178544787903854 -0.1775308746758 -0.173663333437495 -0.16946709965782 -0.164914245512286 -0.159974463267925 -0.154614872717868 -0.148799804140909 -0.142490535438863 -0.13564505757417 -0.128217812275819 -0.12015936434857 -0.111539324098064 -0.102670630107687 -0.0938439551103799 -0.0852361112323467 -0.0769322627201163 -0.0689676092371833 -0.0614493198709789 -0.05448265000188 -0.0481685284230159 -0.0426011286344556 -0.0378655212834811 -0.0339653047149139 -0.0306674030235009 -0.0276074433039125 -0.0246201492984213 -0.0217103132502219 -0.0188826608259991 -0.0161418125936294 -0.0134923049370923 -0.0109385772281658 -0.00848494101951357 -0.0061355704048767 -0.00389449072883921 -0.0017655681028817 -0.000364808451654059 -0 -0 - 72 ! hybm -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0.00671011432529715 -0.0234680651953042 -0.0444176635955054 -0.0671476869296703 -0.0918094403929732 -0.118567095041909 -0.147598767404014 -0.179097701948261 -0.213273593999517 -0.250353966345741 -0.290585650603444 -0.334236449640608 -0.380929249924463 -0.428968901249776 -0.476780947992953 -0.523407663189237 -0.568387705241455 -0.611530435201057 -0.652255318449455 -0.689992179321315 -0.724194309520338 -0.75435162108428 -0.780003302193755 -0.801129866171697 -0.818993846087094 -0.835568982345428 -0.851750499035683 -0.867512422846049 -0.882829172464221 -0.897675691826778 -0.912027443210243 -0.925860417594538 -0.939151217834863 -0.951877195966462 -0.964016589671936 -0.975548495766603 -0.9858405247094135 -0.993756956304222 -0.998496439491762 - diff --git a/components/scream/data/scream_input.yaml b/components/scream/data/scream_input.yaml index dfee01a9b2b..5482a060354 100644 --- a/components/scream/data/scream_input.yaml +++ b/components/scream/data/scream_input.yaml @@ -102,6 +102,7 @@ SCREAM: - "${DIN_LOC_ROOT}/atm/scream/init/rrtmgp-cloud-optics-coeffs-sw.nc" - "${DIN_LOC_ROOT}/atm/scream/init/rrtmgp-cloud-optics-coeffs-lw.nc" - "${DIN_LOC_ROOT}/atm/scream/tables/p3_lookup_table_1.dat-v4.1.1" + - "${DIN_LOC_ROOT}/atm/scream/init/spa_file_unified_and_complete_ne4_scream.nc" # Note: HOMME settings will be translated into data/namelist.nl HOMME: diff --git a/components/scream/src/control/atmosphere_driver.cpp b/components/scream/src/control/atmosphere_driver.cpp index 661690b7996..acb6638413a 100644 --- a/components/scream/src/control/atmosphere_driver.cpp +++ b/components/scream/src/control/atmosphere_driver.cpp @@ -111,6 +111,8 @@ set_params(const ekat::ParameterList& atm_params) m_atm_params = atm_params; + create_logger (); + m_ad_status |= s_params_set; } @@ -122,7 +124,9 @@ void AtmosphereDriver::create_atm_processes() // Create the group of processes. This will recursively create the processes // tree, storing also the information regarding parallel execution (if needed). // See AtmosphereProcessGroup class documentation for more details. - m_atm_process_group = std::make_shared(m_atm_comm,m_atm_params.sublist("Atmosphere Processes")); + auto& atm_proc_params = m_atm_params.sublist("Atmosphere Processes"); + atm_proc_params.set("Logger",m_atm_logger); + m_atm_process_group = std::make_shared(m_atm_comm,atm_proc_params); m_ad_status |= s_procs_created; } @@ -191,7 +195,8 @@ void AtmosphereDriver::create_fields() " group to import: " + req.src_name + "\n" " grid name: " + req.grid + "\n"); // Given request for group A on grid g1 to be an Import of - // group B on grid g2, register each field in group B in the + // group B on grid g2, register each field in group B in the + // field manager on grid g1. const auto& fm = m_field_mgrs.at(req.grid); const auto& rel_fm = m_field_mgrs.at(req.src_grid); @@ -495,12 +500,46 @@ void AtmosphereDriver::restart_model () model_restart.finalize(); } +void AtmosphereDriver::create_logger () { + using namespace ekat::logger; + using ci_string = ekat::CaseInsensitiveString; + + ci_string log_fname = m_atm_params.get("Atm Log File","atm.log"); + ci_string log_level_str = m_atm_params.get("Atm Log Level","info"); + EKAT_REQUIRE_MSG (log_fname!="", + "Invalid string for 'Atm Log File': '" + log_fname + "'.\n"); + + LogLevel log_level; + if (log_level_str=="trace") { + log_level = LogLevel::trace; + } else if (log_level_str=="debug") { + log_level = LogLevel::debug; + } else if (log_level_str=="info") { + log_level = LogLevel::info; + } else if (log_level_str=="warn") { + log_level = LogLevel::warn; + } else if (log_level_str=="err") { + log_level = LogLevel::err; + } else if (log_level_str=="off") { + log_level = LogLevel::off; + } else { + EKAT_ERROR_MSG ("Invalid choice for 'Atm Log Level': " + log_level_str + "\n"); + } + + using logger_t = Logger; + auto logger = std::make_shared(log_fname,log_level,m_atm_comm,""); + logger->set_no_format(); + logger->set_console_level(LogLevel::off); + m_atm_logger = logger; +} + void AtmosphereDriver::set_initial_conditions () { auto& ic_pl = m_atm_params.sublist("Initial Conditions"); // When processing groups and fields separately, we might end up processing the same - // field twice. E.g., say we have the required field group G=(f1,f2). If f1 is also + // field twice. E.g., say we have the required field group G=(f1,f2). If f1 is also + // listed as a required field on itself, we might process it twice. To prevent that, // we store the processed fields // std::set inited_fields; @@ -789,11 +828,11 @@ void AtmosphereDriver::run (const int dt) { // Make sure the end of the time step is after the current start_time EKAT_REQUIRE_MSG (dt>0, "Error! Input time step must be positive.\n"); - // Print current timestamp information - if (m_atm_comm.am_i_root()) { - std::cout << "Atmosphere step = " << m_current_ts.get_num_steps() << "; model time = " << m_current_ts.get_date_string() << " " << m_current_ts.get_time_string() << std::endl; - } - + // Print current timestamp information + m_atm_logger->log(ekat::logger::LogLevel::info, + "Atmosphere step = " + std::to_string(m_current_ts.get_num_steps()) + "\n" + + " model time = " + m_current_ts.get_date_string() + " " + m_current_ts.get_time_string() + "\n"); + if (m_surface_coupling) { // Import fluxes from the component coupler (if any) m_surface_coupling->do_import(); @@ -815,6 +854,12 @@ void AtmosphereDriver::run (const int dt) { // Export fluxes from the component coupler (if any) m_surface_coupling->do_export(); } + + // Flush the logger at least once per time step. + // Without this flush, depending on how much output we are loggin, + // it might be several time steps before the file is updated. + // This way, we give the user a chance to follow the log more real-time. + m_atm_logger->flush(); } void AtmosphereDriver::finalize ( /* inputs? */ ) { diff --git a/components/scream/src/control/atmosphere_driver.hpp b/components/scream/src/control/atmosphere_driver.hpp index cff899a1d95..0e0d73ac336 100644 --- a/components/scream/src/control/atmosphere_driver.hpp +++ b/components/scream/src/control/atmosphere_driver.hpp @@ -11,6 +11,7 @@ #include "share/io/scorpio_input.hpp" #include "share/atm_process/ATMBufferManager.hpp" +#include "ekat/logging/ekat_logger.hpp" #include "ekat/mpi/ekat_comm.hpp" #include "ekat/ekat_parameter_list.hpp" @@ -118,6 +119,7 @@ class AtmosphereDriver protected: + void create_logger (); void set_initial_conditions (); void restart_model (); void initialize_constant_field(const FieldIdentifier& fid, const ekat::ParameterList& ic_pl); @@ -148,6 +150,9 @@ class AtmosphereDriver // This is the comm containing all (and only) the processes assigned to the atmosphere ekat::Comm m_atm_comm; + // The logger to be used throughout the ATM to log message + std::shared_ptr m_atm_logger; + // Some status flags, used to make sure we call the init functions in the right order static constexpr int s_comm_set = 1; static constexpr int s_params_set = 2; @@ -166,7 +171,6 @@ class AtmosphereDriver // Utility function to check the ad status void check_ad_status (const int flag, const bool must_be_set = true); - // Current ad initialization status int m_ad_status = 0; }; diff --git a/components/scream/src/diagnostics/potential_temperature.cpp b/components/scream/src/diagnostics/potential_temperature.cpp index d16ff401027..f6e7636b520 100644 --- a/components/scream/src/diagnostics/potential_temperature.cpp +++ b/components/scream/src/diagnostics/potential_temperature.cpp @@ -50,7 +50,7 @@ void PotentialTemperatureDiagnostic::initialize_impl(const RunType /* run_type * run_diagnostic.set_variables(m_num_cols,nk_pack,p_mid,T_mid,output); } // ========================================================================================= -void PotentialTemperatureDiagnostic::run_impl(const int dt) +void PotentialTemperatureDiagnostic::run_impl(const int /* dt */) { const auto nk_pack = ekat::npack(m_num_levs); diff --git a/components/scream/src/dynamics/homme/atmosphere_dynamics.cpp b/components/scream/src/dynamics/homme/atmosphere_dynamics.cpp index 3a296c07788..11b8c28f07f 100644 --- a/components/scream/src/dynamics/homme/atmosphere_dynamics.cpp +++ b/components/scream/src/dynamics/homme/atmosphere_dynamics.cpp @@ -713,6 +713,7 @@ create_helper_field (const std::string& name, void HommeDynamics::init_homme_views () { const auto& c = Homme::Context::singleton(); + auto& params = c.get(); auto& state = c.get(); auto& tracers = c.get(); auto& forcing = c.get(); @@ -728,7 +729,41 @@ void HommeDynamics::init_homme_views () { const int qsize = tracers.num_tracers(); // Print homme's parameters, so user can see whether something wasn't set right. - if (get_comm().am_i_root()) c.get().print(); + // TODO: make Homme::SimulationParams::print accept an ostream. + std::stringstream msg; + msg << "\n************** CXX SimulationParams **********************\n\n"; + msg << " time_step_type: " << Homme::etoi(params.time_step_type) << "\n"; + msg << " moisture: " << (params.moisture==Homme::MoistDry::DRY ? "dry" : "moist") << "\n"; + msg << " remap_alg: " << Homme::etoi(params.remap_alg) << "\n"; + msg << " test case: " << Homme::etoi(params.test_case) << "\n"; + msg << " ftype: " << Homme::etoi(params.ftype) << "\n"; + msg << " theta_adv_form: " << Homme::etoi(params.theta_adv_form) << "\n"; + msg << " rsplit: " << params.rsplit << "\n"; + msg << " qsplit: " << params.qsplit << "\n"; + msg << " qsize: " << qsize << "\n"; + msg << " limiter_option: " << params.limiter_option << "\n"; + msg << " state_frequency: " << params.state_frequency << "\n"; + msg << " dcmip16_mu: " << params.dcmip16_mu << "\n"; + msg << " nu: " << params.nu << "\n"; + msg << " nu_p: " << params.nu_p << "\n"; + msg << " nu_q: " << params.nu_q << "\n"; + msg << " nu_s: " << params.nu_s << "\n"; + msg << " nu_top: " << params.nu_top << "\n"; + msg << " nu_div: " << params.nu_div << "\n"; + msg << " hypervis_order: " << params.hypervis_order << "\n"; + msg << " hypervis_subcycle: " << params.hypervis_subcycle << "\n"; + msg << " hypervis_subcycle_tom: " << params.hypervis_subcycle_tom << "\n"; + msg << " hypervis_scaling: " << params.hypervis_scaling << "\n"; + msg << " nu_ratio1: " << params.nu_ratio1 << "\n"; + msg << " nu_ratio2: " << params.nu_ratio2 << "\n"; + msg << " use_cpstar: " << (params.use_cpstar ? "yes" : "no") << "\n"; + msg << " transport_alg: " << params.transport_alg << "\n"; + msg << " disable_diagnostics: " << (params.disable_diagnostics ? "yes" : "no") << "\n"; + msg << " theta_hydrostatic_mode: " << (params.theta_hydrostatic_mode ? "yes" : "no") << "\n"; + msg << " prescribed_wind: " << (params.prescribed_wind ? "yes" : "no") << "\n"; + msg << " rearth: " << params.rearth << "\n"; + msg << "\n**********************************************************\n" << "\n"; + this->log(LogLevel::info,msg.str()); // ------------ Set views in Homme ------------- // // Velocity diff --git a/components/scream/src/dynamics/homme/interface/homme_params_mod.F90 b/components/scream/src/dynamics/homme/interface/homme_params_mod.F90 index 099d45b8625..feed625084a 100644 --- a/components/scream/src/dynamics/homme/interface/homme_params_mod.F90 +++ b/components/scream/src/dynamics/homme/interface/homme_params_mod.F90 @@ -207,7 +207,7 @@ end function get_homme_nsplit_f90 subroutine set_homme_int_param_f90 (param_name_c, param_value) bind(c) - use dimensions_mod, only: qsize, nlev + use dimensions_mod, only: qsize use control_mod, only: ftype, use_moisture use homme_context_mod, only: tl ! diff --git a/components/scream/src/mct_coupling/atm_comp_mct.F90 b/components/scream/src/mct_coupling/atm_comp_mct.F90 index 4e9d0ee560d..94f356fc585 100644 --- a/components/scream/src/mct_coupling/atm_comp_mct.F90 +++ b/components/scream/src/mct_coupling/atm_comp_mct.F90 @@ -3,22 +3,20 @@ module atm_comp_mct ! Modules used acros atm_xyz_mct routines ! shr mods - use shr_kind_mod, only: IN=>SHR_KIND_IN, R8=>SHR_KIND_R8!, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL + use shr_kind_mod, only: IN=>SHR_KIND_IN, R8=>SHR_KIND_R8, CL=>SHR_KIND_CL!, CS=>SHR_KIND_CS ! seq mods use seq_cdata_mod, only: seq_cdata, seq_cdata_setptrs use seq_infodata_mod, only: seq_infodata_type, seq_infodata_getdata, seq_infodata_putdata use seq_timemgr_mod, only: seq_timemgr_EClockGetData - ! shr mods - use shr_file_mod, only: shr_file_getlogunit, shr_file_setlogunit, shr_file_setio, & - shr_file_getloglevel, shr_file_setloglevel - use shr_sys_mod, only: shr_sys_flush - ! toolkits mods use esmf, only: ESMF_Clock use mct_mod, only: mct_aVect, mct_gsMap, mct_gGrid + ! MPI + use mpi + implicit none save private @@ -39,7 +37,6 @@ module atm_comp_mct integer :: inst_index ! number of current instance (ie. 1) character(len=16) :: inst_name ! fullname of current instance (ie. "lnd_0001") character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "") - integer(IN) :: logunit ! logging unit number integer(IN) :: ATM_ID ! mct comp id real(r8) , pointer :: gbuf(:,:) ! model grid integer(IN),parameter :: master_task=0 ! task number of master task @@ -58,11 +55,13 @@ subroutine atm_init_mct( EClock, cdata, x2a, a2x, NLFilename ) scr_names_x2a, scr_names_a2x, index_x2a, index_a2x, vec_comp_x2a, vec_comp_a2x, & can_be_exported_during_init use ekat_string_utils, only: string_f2c + use kinds, only: homme_iulog=>iulog use mct_mod, only: mct_aVect_init, mct_gsMap_lsize use seq_flds_mod, only: seq_flds_a2x_fields, seq_flds_x2a_fields use seq_comm_mct, only: seq_comm_inst, seq_comm_name, seq_comm_suffix - use shr_file_mod, only: shr_file_getunit + use shr_file_mod, only: shr_file_getunit, shr_file_setIO + use shr_sys_mod, only: shr_sys_abort ! !INPUT/OUTPUT PARAMETERS: type(ESMF_Clock) , intent(inout) :: EClock @@ -74,21 +73,32 @@ subroutine atm_init_mct( EClock, cdata, x2a, a2x, NLFilename ) type(seq_infodata_type), pointer :: infodata type(mct_gsMap) , pointer :: gsMap_atm type(mct_gGrid) , pointer :: dom_atm - integer(IN) :: shrlogunit ! original log unit - integer(IN) :: shrloglev ! original log level integer(IN) :: nxg ! global dim i-direction integer(IN) :: nyg ! global dim j-direction integer(IN) :: phase ! initialization phase integer(IN) :: ierr ! error code - integer (IN) :: start_tod, start_ymd + integer(IN) :: modelio_fid ! file descriptor for atm_modelio.nml + integer(IN) :: start_tod, start_ymd integer :: lsize + character(CL) :: diri ! Unused + character(CL) :: diro ! directory where ATM log file is + character(CL) :: logfile ! name of ATM log file type(c_ptr) :: x2a_ptr, a2x_ptr ! TODO: read this from the namelist? character(len=256) :: yaml_fname = "./data/scream_input.yaml" - character(kind=c_char,len=256), target :: yaml_fname_c + character(kind=c_char,len=256), target :: yaml_fname_c, atm_log_fname_c, dyn_log_fname + + ! Note: diri is unused, but *is* in the nml file, and the nml read woud return + ! a nonzero err code if we don't add diri to the modelio nml + namelist / modelio / diri,diro,logfile + !------------------------------------------------------------------------------- + diri = "." + diro = "." + logfile = "" + ! Grab some data from the cdata structure (coming from the coupler) call seq_cdata_setptrs(cdata, & id=ATM_ID, & @@ -107,35 +117,37 @@ subroutine atm_init_mct( EClock, cdata, x2a, a2x, NLFilename ) inst_index = seq_comm_inst(ATM_ID) inst_suffix = seq_comm_suffix(ATM_ID) - if (phase == 1) then - ! Determine communicator group - call mpi_comm_rank(mpicom_atm, my_task, ierr) - - !--- open log file --- - if (my_task == master_task) then - logUnit = shr_file_getUnit() - call shr_file_setIO('atm_modelio.nml'//trim(inst_suffix),logUnit) - else - logUnit = 6 - endif + ! Determine communicator group + call mpi_comm_rank(mpicom_atm, my_task, ierr) + + !--- Retrieve the name of the atm log file + if (my_task == master_task) then + modelio_fid = shr_file_getUnit() + open (modelio_fid,file='atm_modelio.nml'//trim(inst_suffix),action="READ") + read (modelio_fid,nml=modelio,iostat=ierr) + close(modelio_fid) + if (ierr /= 0) then + print *,'[eamxx] ERROR reading ','atm_modelio.nml'//trim(inst_suffix),': iostat=',ierr + call shr_sys_abort("[eamxx] ERROR reading 'atm_modelio.nml'"//trim(inst_suffix) ) + end if endif - - !---------------------------------------------------------------------------- - ! Reset shr logging to my log file - !---------------------------------------------------------------------------- - - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (logUnit) + call mpi_bcast(diro,CL,MPI_CHARACTER,master_task,mpicom_atm,ierr) + call mpi_bcast(logfile,CL,MPI_CHARACTER,master_task,mpicom_atm,ierr) !---------------------------------------------------------------------------- ! Initialize atm !---------------------------------------------------------------------------- + ! Set Homme Output to ${diro}/${logfile}.dyn + dyn_log_fname = trim(diro)//"/homme_"//trim(logfile) + open (unit=homme_iulog,file=trim(dyn_log_fname),status='REPLACE', & + action='WRITE', access='SEQUENTIAL') + ! Init the AD call seq_timemgr_EClockGetData(EClock, start_ymd=start_ymd, start_tod=start_tod) call string_f2c(yaml_fname,yaml_fname_c) - call scream_create_atm_instance (mpicom_atm, yaml_fname_c) + call string_f2c(trim(diro)//"/"//trim(logfile),atm_log_fname_c) + call scream_create_atm_instance (mpicom_atm, yaml_fname_c, atm_log_fname_c) ! Init MCT gsMap call atm_Set_gsMap_mct (mpicom_atm, ATM_ID, gsMap_atm) @@ -162,9 +174,9 @@ subroutine atm_init_mct( EClock, cdata, x2a, a2x, NLFilename ) ! Reset shr logging to my log file !---------------------------------------------------------------------------- - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (logunit) + ! call shr_file_getLogUnit (shrlogunit) + ! call shr_file_getLogLevel(shrloglev) + ! call shr_file_setLogUnit (logunit) end subroutine atm_init_mct @@ -189,12 +201,8 @@ subroutine atm_run_mct(EClock, cdata, x2a, a2x) real(R8) :: nextsw_cday ! calendar of next atm sw integer :: dt_scream real(kind=c_double) :: dt_scream_r - !------------------------------------------------------------------------------- - ! Reset shr logging to my log file - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (logUnit) + !------------------------------------------------------------------------------- call seq_cdata_setptrs(cdata, & gsMap=gsmap, & @@ -211,15 +219,12 @@ subroutine atm_run_mct(EClock, cdata, x2a, a2x) ! Set time of next radiadtion computation call seq_infodata_PutData(infodata, nextsw_cday=nextsw_cday) - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - call shr_sys_flush(logunit) - end subroutine atm_run_mct !=============================================================================== subroutine atm_final_mct(EClock, cdata, x2a, a2x) use scream_f2c_mod, only: scream_finalize + use kinds, only: homme_iulog=>iulog ! !INPUT/OUTPUT PARAMETERS: type(ESMF_Clock) ,intent(inout) :: EClock ! clock @@ -235,6 +240,9 @@ subroutine atm_final_mct(EClock, cdata, x2a, a2x) call scream_finalize() + ! Close homme's log file + close (homme_iulog) + end subroutine atm_final_mct !=============================================================================== diff --git a/components/scream/src/mct_coupling/scream_cxx_f90_interface.cpp b/components/scream/src/mct_coupling/scream_cxx_f90_interface.cpp index 64d70ac0c5a..80e548a6663 100644 --- a/components/scream/src/mct_coupling/scream_cxx_f90_interface.cpp +++ b/components/scream/src/mct_coupling/scream_cxx_f90_interface.cpp @@ -14,6 +14,7 @@ #include "share/scream_types.hpp" #include "ekat/ekat_parse_yaml_file.hpp" +#include "ekat/logging/ekat_logger.hpp" #include "ekat/mpi/ekat_comm.hpp" #include "ekat/ekat_pack.hpp" #include "ekat/ekat_assert.hpp" @@ -72,7 +73,8 @@ extern "C" /*===============================================================================================*/ // WARNING: make sure input_yaml_file is a null-terminated string! void scream_create_atm_instance (const MPI_Fint& f_comm, - const char* input_yaml_file) { + const char* input_yaml_file, + const char* atm_log_file) { // const int& compid) { using namespace scream; using namespace scream::control; @@ -90,21 +92,15 @@ void scream_create_atm_instance (const MPI_Fint& f_comm, scream::initialize_scream_session(atm_comm.am_i_root()); // Create a parameter list for inputs - if (atm_comm.am_i_root()) { - printf("[scream] reading parameterr from yaml file: %s\n",input_yaml_file); - } ekat::ParameterList scream_params("Scream Parameters"); parse_yaml_file (input_yaml_file, scream_params); - if (atm_comm.am_i_root()) { - scream_params.print(); - } - ekat::error::runtime_check(scream_params.isSublist("Atmosphere Driver"), "Error! Sublist 'Atmosphere Driver' not found inside '" + std::string(input_yaml_file) + "'.\n"); auto& ad_params = scream_params.sublist("Atmosphere Driver"); + ad_params.set("Atm Log File",atm_log_file); // Need to register products in the factories *before* we attempt to create any. // In particular, register all atm processes, and all grids managers. diff --git a/components/scream/src/mct_coupling/scream_f2c_mod.F90 b/components/scream/src/mct_coupling/scream_f2c_mod.F90 index eccab590eca..29e17a5251c 100644 --- a/components/scream/src/mct_coupling/scream_f2c_mod.F90 +++ b/components/scream/src/mct_coupling/scream_f2c_mod.F90 @@ -13,13 +13,13 @@ module scream_f2c_mod ! It does *NOT* initialize the fields and the atm processes, nor it initializes ! any structure related to the component coupler. Other subroutines ! will have to be called *after* this one, to achieve that. - subroutine scream_create_atm_instance (f_comm,yaml_fname) bind(c) + subroutine scream_create_atm_instance (f_comm,yaml_fname,atm_log_fname) bind(c) use iso_c_binding, only: c_int, c_char ! ! Input(s) ! integer (kind=c_int), intent(in) :: f_comm - character(kind=c_char), target, intent(in) :: yaml_fname(*) + character(kind=c_char), target, intent(in) :: yaml_fname(*), atm_log_fname(*) end subroutine scream_create_atm_instance subroutine scream_get_cols_latlon (lat, lon) bind(c) diff --git a/components/scream/src/physics/p3/atmosphere_microphysics.cpp b/components/scream/src/physics/p3/atmosphere_microphysics.cpp index 7a629b5c103..14acc35db15 100644 --- a/components/scream/src/physics/p3/atmosphere_microphysics.cpp +++ b/components/scream/src/physics/p3/atmosphere_microphysics.cpp @@ -167,7 +167,7 @@ void P3Microphysics::init_buffers(const ATMBufferManager &buffer_manager) const int wsm_size = WSM::get_total_bytes_needed(nk_pack, 52, policy)/sizeof(Spack); s_mem += wsm_size; - int used_mem = (reinterpret_cast(s_mem) - buffer_manager.get_memory())*sizeof(Real); + size_t used_mem = (reinterpret_cast(s_mem) - buffer_manager.get_memory())*sizeof(Real); EKAT_REQUIRE_MSG(used_mem==requested_buffer_size_in_bytes(), "Error! Used memory != requested memory for P3Microphysics."); } diff --git a/components/scream/src/physics/rrtmgp/atmosphere_radiation.cpp b/components/scream/src/physics/rrtmgp/atmosphere_radiation.cpp index 4cc86a1b861..b9f19449c9a 100644 --- a/components/scream/src/physics/rrtmgp/atmosphere_radiation.cpp +++ b/components/scream/src/physics/rrtmgp/atmosphere_radiation.cpp @@ -14,7 +14,8 @@ namespace scream { using ExeSpace = KT::ExeSpace; using MemberType = KT::MemberType; -RRTMGPRadiation::RRTMGPRadiation (const ekat::Comm& comm, const ekat::ParameterList& params) +RRTMGPRadiation:: +RRTMGPRadiation (const ekat::Comm& comm, const ekat::ParameterList& params) : AtmosphereProcess(comm, params) { // Nothing to do here @@ -266,11 +267,12 @@ void RRTMGPRadiation::initialize_impl(const RunType /* run_type */) { gas_mol_w_host[igas] = PC::get_gas_mol_weight(m_gas_names[igas]); } Kokkos::deep_copy(m_gas_mol_weights,gas_mol_w_host); + // Initialize GasConcs object to pass to RRTMGP initializer; gas_concs.init(gas_names_yakl_offset,m_ncol,m_nlay); - rrtmgp::rrtmgp_initialize(gas_concs); - + rrtmgp::rrtmgp_initialize(gas_concs, m_atm_logger); } + // ========================================================================================= void RRTMGPRadiation::run_impl (const int dt) { @@ -546,7 +548,7 @@ void RRTMGPRadiation::run_impl (const int dt) { lw_flux_up, lw_flux_dn, sw_bnd_flux_up, sw_bnd_flux_dn, sw_bnd_flux_dir, lw_bnd_flux_up, lw_bnd_flux_dn, - eccf, get_comm().am_i_root() + eccf, m_atm_logger ); // Compute and apply heating rates diff --git a/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.cpp b/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.cpp index 24103e8ce46..2cd75456fe8 100644 --- a/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.cpp +++ b/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.cpp @@ -1,4 +1,5 @@ #include "scream_rrtmgp_interface.hpp" + #include "mo_load_coefficients.h" #include "mo_load_cloud_coefficients.h" #include "cpp/rrtmgp/mo_gas_concentrations.h" @@ -10,8 +11,8 @@ namespace scream { namespace rrtmgp { - OpticalProps2str get_cloud_optics_sw(const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, real2d &p_lay, real2d &t_lay, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei); - OpticalProps1scl get_cloud_optics_lw(const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, real2d &p_lay, real2d &t_lay, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei); + OpticalProps2str get_cloud_optics_sw(const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei); + OpticalProps1scl get_cloud_optics_lw(const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei); /* * Names of input files we will need. @@ -52,11 +53,13 @@ namespace scream { * can be used as-is, but are intended to be wrapped by the SCREAM AD * interface to radiation. */ - void rrtmgp_initialize(GasConcs &gas_concs) { + void rrtmgp_initialize(GasConcs &gas_concs, + const std::shared_ptr& logger) { // If we've already initialized, just exit - if (initialized) { - std::cout << "RRTMGP is already initialized; skipping\n"; + if (initialized) { + if (logger) + logger->info("RRTMGP is already initialized; skipping\n"); return; } @@ -201,7 +204,8 @@ namespace scream { real2d &lw_flux_up, real2d &lw_flux_dn, real3d &sw_bnd_flux_up, real3d &sw_bnd_flux_dn, real3d &sw_bnd_flux_dn_dir, real3d &lw_bnd_flux_up, real3d &lw_bnd_flux_dn, - const Real tsi_scaling, const bool i_am_root) { + const Real tsi_scaling, + const std::shared_ptr& logger) { // Setup pointers to RRTMGP SW fluxes FluxesByband fluxes_sw; @@ -239,15 +243,15 @@ namespace scream { }); // Convert cloud physical properties to optical properties for input to RRTMGP - OpticalProps2str clouds_sw = get_cloud_optics_sw(ncol, nlay, cloud_optics_sw, k_dist_sw, p_lay, t_lay, lwp, iwp, rel, rei); - OpticalProps1scl clouds_lw = get_cloud_optics_lw(ncol, nlay, cloud_optics_lw, k_dist_lw, p_lay, t_lay, lwp, iwp, rel, rei); + OpticalProps2str clouds_sw = get_cloud_optics_sw(ncol, nlay, cloud_optics_sw, k_dist_sw, lwp, iwp, rel, rei); + OpticalProps1scl clouds_lw = get_cloud_optics_lw(ncol, nlay, cloud_optics_lw, k_dist_lw, lwp, iwp, rel, rei); // Do shortwave rrtmgp_sw( ncol, nlay, k_dist_sw, p_lay, t_lay, p_lev, t_lev, gas_concs, sfc_alb_dir, sfc_alb_dif, mu0, aerosol_sw, clouds_sw, fluxes_sw, - tsi_scaling, i_am_root + tsi_scaling, logger ); // Do longwave @@ -263,7 +267,7 @@ namespace scream { OpticalProps2str get_cloud_optics_sw( const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, - real2d &p_lay, real2d &t_lay, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei) { + real2d &lwp, real2d &iwp, real2d &rel, real2d &rei) { // Initialize optics OpticalProps2str clouds; @@ -290,7 +294,7 @@ namespace scream { OpticalProps1scl get_cloud_optics_lw( const int ncol, const int nlay, CloudOptics &cloud_optics, GasOpticsRRTMGP &kdist, - real2d &p_lay, real2d &t_lay, real2d &lwp, real2d &iwp, real2d &rel, real2d &rei) { + real2d &lwp, real2d &iwp, real2d &rel, real2d &rei) { // Initialize optics OpticalProps1scl clouds; @@ -322,7 +326,8 @@ namespace scream { real2d &sfc_alb_dir, real2d &sfc_alb_dif, real1d &mu0, OpticalProps2str &aerosol, OpticalProps2str &clouds, FluxesByband &fluxes, - const Real tsi_scaling, const bool i_am_root) { + const Real tsi_scaling, + const std::shared_ptr& logger) { // Get problem sizes int nbnd = k_dist.get_nband(); @@ -366,7 +371,8 @@ namespace scream { // Copy data back to the device dayIndices_h.deep_copy_to(dayIndices); if (nday == 0) { - if (i_am_root) std::cout << "WARNING: no daytime columns found for this chunk!\n"; + if (logger) + logger->warn("WARNING: no daytime columns found for this chunk!\n"); return; } diff --git a/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.hpp b/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.hpp index 82606b6bb2c..74b66399a4b 100644 --- a/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.hpp +++ b/components/scream/src/physics/rrtmgp/scream_rrtmgp_interface.hpp @@ -5,8 +5,11 @@ #include "cpp/extensions/cloud_optics/mo_cloud_optics.h" #include "cpp/extensions/fluxes_byband/mo_fluxes_byband.h" #include "cpp/rrtmgp_const.h" + #include "physics/share/physics_constants.hpp" + #include "ekat/mpi/ekat_comm.hpp" +#include "ekat/logging/ekat_logger.hpp" namespace scream { namespace rrtmgp { @@ -31,7 +34,8 @@ namespace scream { /* * Initialize data for RRTMGP driver */ - extern void rrtmgp_initialize(GasConcs &gas_concs); + extern void rrtmgp_initialize(GasConcs &gas_concs, + const std::shared_ptr& logger); /* * Compute band-by-band surface albedos from broadband albedos. */ @@ -49,10 +53,9 @@ namespace scream { real1d &sfc_flux_dir_vis, real1d &sfc_flux_dir_nir, real1d &sfc_flux_dif_vis, real1d &sfc_flux_dif_nir); /* - * Main driver code to run RRTMGP. Optional input - * i_am_root is defaulted to true, and is used to - * determine whether or not info should be printed - * to the screen. + * Main driver code to run RRTMGP. + * The input logger is in charge of outputing info to + * screen and/or to file (or neither), depending on how it was set up. */ extern void rrtmgp_main( const int ncol, const int nlay, @@ -66,7 +69,8 @@ namespace scream { real2d &lw_flux_up, real2d &lw_flux_dn, real3d &sw_bnd_flux_up, real3d &sw_bnd_flux_dn, real3d &sw_bnd_flux_dn_dir, real3d &lw_bnd_flux_up, real3d &lw_bnd_flux_dn, - const Real tsi_scaling, const bool i_am_root = true); + const Real tsi_scaling, + const std::shared_ptr& logger); /* * Perform any clean-up tasks */ @@ -80,7 +84,8 @@ namespace scream { GasConcs &gas_concs, real2d &sfc_alb_dir, real2d &sfc_alb_dif, real1d &mu0, OpticalProps2str &aerosol, OpticalProps2str &clouds, - FluxesByband &fluxes, const Real tsi_scaling, const bool i_am_root); + FluxesByband &fluxes, const Real tsi_scaling, + const std::shared_ptr& logger); /* * Longwave driver (called by rrtmgp_main) */ diff --git a/components/scream/src/physics/rrtmgp/tests/generate_baseline.cpp b/components/scream/src/physics/rrtmgp/tests/generate_baseline.cpp index 9198eb5141c..811cc055e38 100644 --- a/components/scream/src/physics/rrtmgp/tests/generate_baseline.cpp +++ b/components/scream/src/physics/rrtmgp/tests/generate_baseline.cpp @@ -8,20 +8,29 @@ #include "YAKL.h" +#include + #include #include using namespace scream; int main (int argc, char** argv) { + MPI_Init(&argc,&argv); + + using namespace ekat::logger; + using logger_t = Logger; + + ekat::Comm comm(MPI_COMM_WORLD); + auto logger = std::make_shared("",LogLevel::info,comm); // Get filenames from command line if (argc != 3) { - std::cout << - argv[0] << " [options] inputfile baseline\n" - "Options:\n" - " (there are no options)\n"; - return 1; + std::string msg = "Missing required inputs. Usage:\n"; + msg += argv[0]; + msg += " inputfile baseline\n"; + logger->error(msg); + return 1; } std::string inputfile(argv[argc-2]); std::string baseline(argv[argc-1]); @@ -35,7 +44,7 @@ int main (int argc, char** argv) { real2d sw_flux_dn_dir_ref; real2d lw_flux_up_ref; real2d lw_flux_dn_ref; - std::cout << "read_fluxes..." << std::endl; + logger->info("read_fluxes..."); rrtmgpTest::read_fluxes(inputfile, sw_flux_up_ref, sw_flux_dn_ref, sw_flux_dn_dir_ref, lw_flux_up_ref, lw_flux_dn_ref ); // Get dimension sizes @@ -59,8 +68,8 @@ int main (int argc, char** argv) { // Initialize the RRTMGP interface; this will read in the k-distribution // data that contains information about absorption coefficients for gases - std::cout << "rrtmgp_initialize..." << std::endl; - rrtmgp::rrtmgp_initialize(gas_concs); + logger->info("rrtmgp_initialize..."); + rrtmgp::rrtmgp_initialize(gas_concs,logger); // Setup dummy all-sky problem real1d sfc_alb_dir_vis ("sfc_alb_dir_vis", ncol); @@ -124,7 +133,7 @@ int main (int argc, char** argv) { // Run RRTMGP standalone codes and compare with AD run // Do something interesting here... // NOTE: these will get replaced with AD stuff that handles these - std::cout << "rrtmgp_main..." << std::endl; + logger->info("rrtmgp_main..."); const Real tsi_scaling = 1; rrtmgp::rrtmgp_main( ncol, nlay, @@ -136,17 +145,19 @@ int main (int argc, char** argv) { sw_flux_up, sw_flux_dn, sw_flux_dn_dir, lw_flux_up, lw_flux_dn, sw_bnd_flux_up, sw_bnd_flux_dn, sw_bnd_flux_dir, - lw_bnd_flux_up, lw_bnd_flux_dn, tsi_scaling + lw_bnd_flux_up, lw_bnd_flux_dn, tsi_scaling, + logger ); // Write fluxes - std::cout << "write_fluxes..." << std::endl; + logger->info("write_fluxes..."); rrtmgpTest::write_fluxes( baseline, sw_flux_up, sw_flux_dn, sw_flux_dn_dir, lw_flux_up, lw_flux_dn ); + logger->info("cleaning up..."); // Clean up from test; this is probably not necessary, these things // should be deallocated when they fall out of scope, but we should be // good citizens and clean up our mess. @@ -190,5 +201,7 @@ int main (int argc, char** argv) { rrtmgp::rrtmgp_finalize(); yakl::finalize(); + MPI_Finalize(); + return 0; } diff --git a/components/scream/src/physics/rrtmgp/tests/rrtmgp_tests.cpp b/components/scream/src/physics/rrtmgp/tests/rrtmgp_tests.cpp index f45c513c480..80c18084d9c 100644 --- a/components/scream/src/physics/rrtmgp/tests/rrtmgp_tests.cpp +++ b/components/scream/src/physics/rrtmgp/tests/rrtmgp_tests.cpp @@ -10,8 +10,8 @@ #include "YAKL.h" #include "ekat/util/ekat_test_utils.hpp" -#include #include +#include using namespace scream; @@ -19,11 +19,20 @@ void expect_another_arg (int i, int argc) { EKAT_REQUIRE_MSG(i != argc-1, "Expected another cmd-line arg."); } -int main(int argc, char** argv) { +int run(int argc, char** argv) { + using namespace ekat::logger; + using logger_t = Logger; + + + ekat::Comm comm(MPI_COMM_WORLD); + auto logger = std::make_shared("",LogLevel::info,comm); + // Parse command line arguments if (argc < 3) { - std::cout << "argc: " << argc << std::endl; - std::cout << argv[0] << " -i -b [options]\n"; + std::string msg = "Missing required inputs. Usage:\n"; + msg += argv[0]; + msg += " -i -b [options]\n"; + logger->error(msg); return 1; } std::string inputfile, baseline, device; @@ -49,20 +58,20 @@ int main(int argc, char** argv) { // Check to see that inputfiles exist if (!rrtmgpTest::file_exists(inputfile.c_str())) { - std::cout << "Inputfile " << inputfile << " does not exist." << std::endl; + logger->error("Inputfile " + inputfile + " does not exist.\n"); return -1; } if (!rrtmgpTest::file_exists(baseline.c_str())) { - std::cout << "Baseline " << baseline << " does not exist." << std::endl; + logger->error("Baseline " + baseline + " does not exist.\n"); return -1; } // Initialize yakl - std::cout << "Initialize yakl...\n"; + logger->info("Initialize yakl...\n"); yakl::init(); // Get reference fluxes from input file; do this here so we can get ncol dimension - std::cout << "Read fluxes...\n"; + logger->info("Read fluxes...\n"); real2d sw_flux_up_ref; real2d sw_flux_dn_ref; real2d sw_flux_dir_ref; @@ -82,7 +91,7 @@ int main(int argc, char** argv) { // this will copy the first column of the input data (the first profile) ncol // times. We will then fill some fraction of these columns with clouds for // the test problem. - std::cout << "Read dummy atmos...\n"; + logger->info("Read dummy atmos...\n"); real2d p_lay("p_lay", ncol, nlay); real2d t_lay("t_lay", ncol, nlay); real2d p_lev("p_lev", ncol, nlay+1); @@ -91,11 +100,11 @@ int main(int argc, char** argv) { read_atmos(inputfile, p_lay, t_lay, p_lev, t_lev, gas_concs, ncol); // Initialize absorption coefficients - std::cout << "Initialize RRTMGP...\n"; - scream::rrtmgp::rrtmgp_initialize(gas_concs); + logger->info("Initialize RRTMGP...\n"); + scream::rrtmgp::rrtmgp_initialize(gas_concs,logger); // Setup our dummy atmosphere based on the input data we read in - std::cout << "Setup dummy atmos...\n"; + logger->info("Setup dummy atmos...\n"); real1d sfc_alb_dir_vis("sfc_alb_dir_vis", ncol); real1d sfc_alb_dir_nir("sfc_alb_dir_nir", ncol); real1d sfc_alb_dif_vis("sfc_alb_dif_vis", ncol); @@ -118,7 +127,7 @@ int main(int argc, char** argv) { // input/outputs into the driver (persisting between calls), and // we would just have to setup the pointers to them in the // FluxesBroadband object - std::cout << "Setup fluxes...\n"; + logger->info("Setup fluxes...\n"); const auto nswbands = scream::rrtmgp::k_dist_sw.get_nband(); const auto nlwbands = scream::rrtmgp::k_dist_lw.get_nband(); real2d sw_flux_up ("sw_flux_up" , ncol, nlay+1); @@ -156,7 +165,7 @@ int main(int argc, char** argv) { }); // Run RRTMGP code on dummy atmosphere - std::cout << "Run RRTMGP...\n"; + logger->info("Run RRTMGP...\n"); const Real tsi_scaling = 1; scream::rrtmgp::rrtmgp_main( ncol, nlay, @@ -168,10 +177,10 @@ int main(int argc, char** argv) { sw_flux_up, sw_flux_dn, sw_flux_dir, lw_flux_up, lw_flux_dn, sw_bnd_flux_up, sw_bnd_flux_dn, sw_bnd_flux_dir, - lw_bnd_flux_up, lw_bnd_flux_dn, tsi_scaling); + lw_bnd_flux_up, lw_bnd_flux_dn, tsi_scaling, logger); // Check values against baseline - std::cout << "Check values...\n"; + logger->info("Check values...\n"); rrtmgpTest::read_fluxes( baseline, sw_flux_up_ref, sw_flux_dn_ref, sw_flux_dir_ref, @@ -184,6 +193,7 @@ int main(int argc, char** argv) { if (!rrtmgpTest::all_close(lw_flux_up_ref , lw_flux_up , 0.001)) nerr++; if (!rrtmgpTest::all_close(lw_flux_dn_ref , lw_flux_dn , 0.001)) nerr++; + logger->info("Cleaning up...\n"); // Clean up or else YAKL will throw errors scream::rrtmgp::rrtmgp_finalize(); sw_flux_up_ref.deallocate(); @@ -228,3 +238,12 @@ int main(int argc, char** argv) { } // end of main driver code +int main(int argc, char** argv) { + + MPI_Init(&argc,&argv); + int ret = run(argc,argv); + MPI_Finalize(); + + return ret; +} + diff --git a/components/scream/src/physics/rrtmgp/tests/rrtmgp_unit_tests.cpp b/components/scream/src/physics/rrtmgp/tests/rrtmgp_unit_tests.cpp index 203cb97e22d..874450f1045 100644 --- a/components/scream/src/physics/rrtmgp/tests/rrtmgp_unit_tests.cpp +++ b/components/scream/src/physics/rrtmgp/tests/rrtmgp_unit_tests.cpp @@ -4,6 +4,7 @@ #include "YAKL.h" #include "physics/share/physics_constants.hpp" #include "physics/rrtmgp/share/shr_orb_mod_c2f.hpp" + TEST_CASE("rrtmgp_test_heating") { // Initialize YAKL if (!yakl::isInitialized()) { yakl::init(); } @@ -219,6 +220,11 @@ TEST_CASE("rrtmgp_test_zenith") { } TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { + using namespace ekat::logger; + using logger_t = Logger; + + ekat::Comm comm(MPI_COMM_WORLD); + auto logger = std::make_shared("",LogLevel::info,comm); // Initialize YAKL if (!yakl::isInitialized()) { yakl::init(); } @@ -234,7 +240,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { auto sfc_flux_dif_vis = real1d("sfc_flux_dif_vis", ncol); // Need to initialize RRTMGP with dummy gases - std::cout << "Init gases...\n"; + logger->info("Init gases...\n"); GasConcs gas_concs; int ngas = 8; string1d gas_names("gas_names",ngas); @@ -247,8 +253,8 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { gas_names(7) = std::string("o2" ); gas_names(8) = std::string("n2" ); gas_concs.init(gas_names,ncol,nlay); - std::cout << "Init RRTMGP...\n"; - scream::rrtmgp::rrtmgp_initialize(gas_concs); + logger->info("Init RRTMGP...\n"); + scream::rrtmgp::rrtmgp_initialize(gas_concs,logger); // Create simple test cases; We expect, given the input data, that band 10 // will straddle the NIR and VIS, bands 1-9 will be purely NIR, and bands 11-14 @@ -261,7 +267,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { // Test case: flux only in straddled band auto sw_bnd_flux_dir = real3d("sw_bnd_flux_dir", ncol, nlay+1, nbnd); auto sw_bnd_flux_dif = real3d("sw_bnd_flux_dif", ncol, nlay+1, nbnd); - std::cout << "Populate band-resolved 3d fluxes for test case with only transition band flux...\n"; + logger->info("Populate band-resolved 3d fluxes for test case with only transition band flux...\n"); parallel_for(Bounds<3>(nbnd,nlay+1,ncol), YAKL_LAMBDA(int ibnd, int ilay, int icol) { if (ibnd < 10) { sw_bnd_flux_dir(icol,ilay,ibnd) = 0; @@ -275,7 +281,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { } }); // Compute surface fluxes - std::cout << "Compute broadband surface fluxes...\n"; + logger->info("Compute broadband surface fluxes...\n"); scream::rrtmgp::compute_broadband_surface_fluxes( ncol, kbot, nbnd, sw_bnd_flux_dir, sw_bnd_flux_dif, @@ -283,7 +289,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { sfc_flux_dif_vis, sfc_flux_dif_nir ); // Check computed surface fluxes - std::cout << "Check computed fluxes...\n"; + logger->info("Check computed fluxes...\n"); const double tol = 1e-10; // tolerance on floating point inequality for assertions REQUIRE(std::abs(sfc_flux_dir_nir.createHostCopy()(1) - 0.5) < tol); REQUIRE(std::abs(sfc_flux_dir_vis.createHostCopy()(1) - 0.5) < tol); @@ -293,7 +299,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { // --------------------------------- // Test case, only flux in NIR bands - std::cout << "Populate band-resolved 3d fluxes for test case with only NIR flux...\n"; + logger->info("Populate band-resolved 3d fluxes for test case with only NIR flux...\n"); parallel_for(Bounds<3>(nbnd,nlay+1,ncol), YAKL_LAMBDA(int ibnd, int ilay, int icol) { if (ibnd < 10) { sw_bnd_flux_dir(icol,ilay,ibnd) = 1; @@ -307,7 +313,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { } }); // Compute surface fluxes - std::cout << "Compute broadband surface fluxes...\n"; + logger->info("Compute broadband surface fluxes...\n"); scream::rrtmgp::compute_broadband_surface_fluxes( ncol, kbot, nbnd, sw_bnd_flux_dir, sw_bnd_flux_dif, @@ -315,7 +321,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { sfc_flux_dif_vis, sfc_flux_dif_nir ); // Check computed surface fluxes - std::cout << "Check computed fluxes...\n"; + logger->info("Check computed fluxes...\n"); REQUIRE(std::abs(sfc_flux_dir_nir.createHostCopy()(1) - 9.0) < tol); REQUIRE(std::abs(sfc_flux_dir_vis.createHostCopy()(1) - 0.0) < tol); REQUIRE(std::abs(sfc_flux_dif_nir.createHostCopy()(1) - 9.0) < tol); @@ -324,7 +330,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { // --------------------------------- // Test case, only flux in VIS bands - std::cout << "Populate band-resolved 3d fluxes for test case with only VIS/UV flux...\n"; + logger->info("Populate band-resolved 3d fluxes for test case with only VIS/UV flux...\n"); parallel_for(Bounds<3>(nbnd,nlay+1,ncol), YAKL_LAMBDA(int ibnd, int ilay, int icol) { if (ibnd < 10) { sw_bnd_flux_dir(icol,ilay,ibnd) = 0; @@ -338,7 +344,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { } }); // Compute surface fluxes - std::cout << "Compute broadband surface fluxes...\n"; + logger->info("Compute broadband surface fluxes...\n"); scream::rrtmgp::compute_broadband_surface_fluxes( ncol, kbot, nbnd, sw_bnd_flux_dir, sw_bnd_flux_dif, @@ -346,7 +352,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { sfc_flux_dif_vis, sfc_flux_dif_nir ); // Check computed surface fluxes - std::cout << "Check computed fluxes...\n"; + logger->info("Check computed fluxes...\n"); REQUIRE(std::abs(sfc_flux_dir_nir.createHostCopy()(1) - 0.0) < tol); REQUIRE(std::abs(sfc_flux_dir_vis.createHostCopy()(1) - 4.0) < tol); REQUIRE(std::abs(sfc_flux_dif_nir.createHostCopy()(1) - 0.0) < tol); @@ -355,7 +361,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { // --------------------------------- // Test case, only flux in all bands - std::cout << "Populate band-resolved 3d fluxes for test with non-zero flux in all bands...\n"; + logger->info("Populate band-resolved 3d fluxes for test with non-zero flux in all bands...\n"); parallel_for(Bounds<3>(nbnd,nlay+1,ncol), YAKL_LAMBDA(int ibnd, int ilay, int icol) { if (ibnd < 10) { sw_bnd_flux_dir(icol,ilay,ibnd) = 1.0; @@ -369,7 +375,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { } }); // Compute surface fluxes - std::cout << "Compute broadband surface fluxes...\n"; + logger->info("Compute broadband surface fluxes...\n"); scream::rrtmgp::compute_broadband_surface_fluxes( ncol, kbot, nbnd, sw_bnd_flux_dir, sw_bnd_flux_dif, @@ -377,7 +383,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { sfc_flux_dif_vis, sfc_flux_dif_nir ); // Check computed surface fluxes - std::cout << "Check computed fluxes...\n"; + logger->info("Check computed fluxes...\n"); REQUIRE(std::abs(sfc_flux_dir_nir.createHostCopy()(1) - 10.5) < tol); REQUIRE(std::abs(sfc_flux_dir_vis.createHostCopy()(1) - 21.5) < tol); REQUIRE(std::abs(sfc_flux_dif_nir.createHostCopy()(1) - 20.0) < tol); @@ -385,7 +391,7 @@ TEST_CASE("rrtmgp_test_compute_broadband_surface_flux") { // --------------------------------- // Finalize YAKL - std::cout << "Free memory...\n"; + logger->info("Free memory...\n"); scream::rrtmgp::rrtmgp_finalize(); gas_concs.reset(); gas_names.deallocate(); diff --git a/components/scream/src/scream_config.h.in b/components/scream/src/scream_config.h.in index c67476f4c1d..dfe4c6fa626 100644 --- a/components/scream/src/scream_config.h.in +++ b/components/scream/src/scream_config.h.in @@ -10,9 +10,6 @@ // If defined, enable floating point exceptions. #cmakedefine SCREAM_FPE -// If defined, scream::pack objects check indices against bounds. -#cmakedefine SCREAM_PACK_CHECK_BOUNDS - // The number of scalars in a scream::pack::Pack and Mask. #define SCREAM_PACK_SIZE ${SCREAM_PACK_SIZE} @@ -25,21 +22,9 @@ // How many levels to use for the vertical grid #define SCREAM_NUM_VERTICAL_LEV ${SCREAM_NUM_VERTICAL_LEV} -// Whether MPI errors should abort -#cmakedefine SCREAM_MPI_ERRORS_ARE_FATAL - -// Whether we allow use of CONSTEXPR_ASSERT macro -#cmakedefine SCREAM_CONSTEXPR_ASSERT - -// Mimic GPU to correctness-test inter-column parallelism on non-GPU platform -#cmakedefine SCREAM_MIMIC_GPU - // Whether this is a CUDA build #cmakedefine CUDA_BUILD -// Whether fp model is strict -#cmakedefine SCREAM_STRICT_FP - // Whether SCREAM has Homme enabled as dynamics dycore #cmakedefine SCREAM_HAS_HOMME diff --git a/components/scream/src/share/atm_process/atmosphere_diagnostic.hpp b/components/scream/src/share/atm_process/atmosphere_diagnostic.hpp index 3bc734a509f..07f30e80c38 100644 --- a/components/scream/src/share/atm_process/atmosphere_diagnostic.hpp +++ b/components/scream/src/share/atm_process/atmosphere_diagnostic.hpp @@ -30,7 +30,7 @@ class AtmosphereDiagnostic : public AtmosphereProcess public: // Constructor(s) - explicit AtmosphereDiagnostic (const ekat::Comm& comm, const ekat::ParameterList& params); + AtmosphereDiagnostic (const ekat::Comm& comm, const ekat::ParameterList& params); virtual ~AtmosphereDiagnostic () = default; diff --git a/components/scream/src/share/atm_process/atmosphere_process.cpp b/components/scream/src/share/atm_process/atmosphere_process.cpp index 35f7702ee1a..73ffea3ec37 100644 --- a/components/scream/src/share/atm_process/atmosphere_process.cpp +++ b/components/scream/src/share/atm_process/atmosphere_process.cpp @@ -9,10 +9,20 @@ namespace scream { -AtmosphereProcess::AtmosphereProcess (const ekat::Comm& comm, const ekat::ParameterList& params) - : m_comm (comm) - , m_params(params) +AtmosphereProcess:: +AtmosphereProcess (const ekat::Comm& comm, const ekat::ParameterList& params) + : m_comm (comm) + , m_params (params) { + if (m_params.isParameter("Logger")) { + m_atm_logger = m_params.get>("Logger"); + } else { + // Create a console-only logger, that logs all ranks + using namespace ekat::logger; + using logger_impl_t = Logger; + m_atm_logger = std::make_shared("",LogLevel::trace,m_comm); + } + if (m_params.isParameter("Number of Subcycles")) { m_num_subcycles = m_params.get("Number of Subcycles"); } @@ -175,10 +185,11 @@ void AtmosphereProcess::run_precondition_checks () const { pc->repair(); } else if (it.first==CheckFailHandling::Warning) { // Still ok, but warn the user - std::cout << "WARNING: Pre-condition property check failed.\n" + log (LogLevel::warn, + "WARNING: Pre-condition property check failed.\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process name: " + name() + "\n" - " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n"; + " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n"); } else { // No hope. Crash. EKAT_ERROR_MSG( @@ -206,10 +217,11 @@ void AtmosphereProcess::run_postcondition_checks () const { pc->repair(); } else if (it.first==CheckFailHandling::Warning) { // Still ok, but warn the user - std::cout << "WARNING: Post-condition property check failed.\n" + log (LogLevel::warn, + "WARNING: Post-condition property check failed.\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process name: " + name() + "\n" - " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n"; + " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n"); } else { // No hope. Crash. EKAT_ERROR_MSG( @@ -257,6 +269,10 @@ bool AtmosphereProcess::has_computed_group (const std::string& name, const std:: return false; } +void AtmosphereProcess::log (const LogLevel lev, const std::string& msg) const { + m_atm_logger->log(lev,msg); +} + void AtmosphereProcess::set_update_time_stamps (const bool do_update) { m_update_time_stamps = do_update; } diff --git a/components/scream/src/share/atm_process/atmosphere_process.hpp b/components/scream/src/share/atm_process/atmosphere_process.hpp index a1057e9c1be..0ddb9bb6437 100644 --- a/components/scream/src/share/atm_process/atmosphere_process.hpp +++ b/components/scream/src/share/atm_process/atmosphere_process.hpp @@ -16,6 +16,7 @@ #include "ekat/util/ekat_factory.hpp" #include "ekat/util/ekat_string_utils.hpp" #include "ekat/std_meta/ekat_std_enable_shared_from_this.hpp" +#include "ekat/logging/ekat_logger.hpp" #include #include @@ -72,6 +73,8 @@ class AtmosphereProcess : public ekat::enable_shared_from_this using str_map = std::map; @@ -230,6 +233,9 @@ class AtmosphereProcess : public ekat::enable_shared_from_this m_atm_logger; + private: // Called from initialize, this method creates the m_[fields|groups]_[in|out]_pointers // maps, which are used inside the get_[field|group]_[in|out] methods. diff --git a/components/scream/src/share/atm_process/atmosphere_process_group.cpp b/components/scream/src/share/atm_process/atmosphere_process_group.cpp index a6db7239f9d..dc31a3c4eb1 100644 --- a/components/scream/src/share/atm_process/atmosphere_process_group.cpp +++ b/components/scream/src/share/atm_process/atmosphere_process_group.cpp @@ -34,6 +34,7 @@ AtmosphereProcessGroup (const ekat::Comm& comm, const ekat::ParameterList& param m_group_name = "Group ["; m_group_name += m_group_schedule_type==ScheduleType::Sequential ? "Sequential]:" : "Parallel]:"; + auto& apf = AtmosphereProcessFactory::instance(); apf.register_product("group",&create_atmosphere_process); for (int i=0; im_atm_logger); const std::string& process_name = params_i.get("Process Name"); + m_atm_processes.emplace_back(apf.create(process_name,proc_comm,params_i)); // NOTE: the shared_ptr of the new atmosphere process *MUST* have been created correctly. diff --git a/components/scream/src/share/atm_process/atmosphere_process_group.hpp b/components/scream/src/share/atm_process/atmosphere_process_group.hpp index adfc62d33ea..a99957117cb 100644 --- a/components/scream/src/share/atm_process/atmosphere_process_group.hpp +++ b/components/scream/src/share/atm_process/atmosphere_process_group.hpp @@ -30,7 +30,7 @@ class AtmosphereProcessGroup : public AtmosphereProcess using atm_proc_type = AtmosphereProcess; // Constructor(s) - explicit AtmosphereProcessGroup (const ekat::Comm& comm, const ekat::ParameterList& params); + AtmosphereProcessGroup (const ekat::Comm& comm, const ekat::ParameterList& params); virtual ~AtmosphereProcessGroup () = default; diff --git a/components/scream/src/share/tests/atm_process_tests.cpp b/components/scream/src/share/tests/atm_process_tests.cpp index 6e98a869cc8..562f1facf47 100644 --- a/components/scream/src/share/tests/atm_process_tests.cpp +++ b/components/scream/src/share/tests/atm_process_tests.cpp @@ -358,14 +358,20 @@ class AddOne : public DummyProcess TEST_CASE("process_factory", "") { using namespace scream; + using namespace ekat::logger; + using logger_t = spdlog::logger; + using logger_impl_t = Logger; // A world comm ekat::Comm comm(MPI_COMM_WORLD); + std::shared_ptr logger; + logger = std::make_shared("",LogLevel::info,comm); // Load ad parameter list std::string fname = "atm_process_tests.yaml"; ekat::ParameterList params ("Atmosphere Processes"); REQUIRE_NOTHROW ( parse_yaml_file(fname,params) ); + params.set("Logger",logger); // Create then factory, and register constructors auto& factory = AtmosphereProcessFactory::instance(); diff --git a/components/scream/tests/uncoupled/p3/CMakeLists.txt b/components/scream/tests/uncoupled/p3/CMakeLists.txt index fe036543dfd..7a43f8a0031 100644 --- a/components/scream/tests/uncoupled/p3/CMakeLists.txt +++ b/components/scream/tests/uncoupled/p3/CMakeLists.txt @@ -24,8 +24,6 @@ GetInputFile(tables/p3_lookup_table_1.dat-v4.1.1 GetInputFile(tables/p3_lookup_table_2.dat-v4.1.1 ${CMAKE_CURRENT_BINARY_DIR}/data) GetInputFile(init/p3_init_ne2np4.nc p3_init_ne2np4.nc) -configure_file(${SCREAM_DATA_DIR}/p3_universal_constants.inp - ${CMAKE_CURRENT_BINARY_DIR}/data COPYONLY) ## Finally compare all MPI rank output files against the single rank output as a baseline, using CPRNC ## Only if max mpi ranks is >1 diff --git a/externals/ekat b/externals/ekat index 76942ac732d..e36acbbb758 160000 --- a/externals/ekat +++ b/externals/ekat @@ -1 +1 @@ -Subproject commit 76942ac732d2bc45563d276b82f8ab4bb570fa78 +Subproject commit e36acbbb758f05a4804fe3d1c07afe65f9f1d146