puma_8f90_source.html 449 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <title>PUMA: /Users/home/WC/puma/src/puma.f90 Source File</title>
  6. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  7. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  8. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="resize.js"></script>
  11. <script type="text/javascript" src="navtree.js"></script>
  12. <script type="text/javascript">
  13. $(document).ready(initResizable);
  14. </script>
  15. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  16. <script type="text/javascript" src="search/search.js"></script>
  17. <script type="text/javascript">
  18. $(document).ready(function() { searchBox.OnSelectItem(0); });
  19. </script>
  20. </head>
  21. <body>
  22. <div id="top"><!-- do not remove this div! -->
  23. <div id="titlearea">
  24. <table cellspacing="0" cellpadding="0">
  25. <tbody>
  26. <tr style="height: 56px;">
  27. <td id="projectlogo"><img alt="Logo" src="puma103.jpg"/></td>
  28. <td style="padding-left: 0.5em;">
  29. <div id="projectname">PUMA
  30. &#160;<span id="projectnumber">219</span>
  31. </div>
  32. <div id="projectbrief">Portable University Model of the Atmosphere</div>
  33. </td>
  34. </tr>
  35. </tbody>
  36. </table>
  37. </div>
  38. <!-- Generated by Doxygen 1.7.5.1 -->
  39. <script type="text/javascript">
  40. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  41. </script>
  42. <div id="navrow1" class="tabs">
  43. <ul class="tablist">
  44. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  45. <li><a href="annotated.html"><span>Data&#160;Types&#160;List</span></a></li>
  46. <li class="current"><a href="files.html"><span>Files</span></a></li>
  47. <li>
  48. <div id="MSearchBox" class="MSearchBoxInactive">
  49. <span class="left">
  50. <img id="MSearchSelect" src="search/mag_sel.png"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. alt=""/>
  54. <input type="text" id="MSearchField" value="Search" accesskey="S"
  55. onfocus="searchBox.OnSearchFieldFocus(true)"
  56. onblur="searchBox.OnSearchFieldFocus(false)"
  57. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  58. </span><span class="right">
  59. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  60. </span>
  61. </div>
  62. </li>
  63. </ul>
  64. </div>
  65. <div id="navrow2" class="tabs2">
  66. <ul class="tablist">
  67. <li><a href="files.html"><span>File&#160;List</span></a></li>
  68. <li><a href="globals.html"><span>File&#160;Members</span></a></li>
  69. </ul>
  70. </div>
  71. </div>
  72. <div id="side-nav" class="ui-resizable side-nav-resizable">
  73. <div id="nav-tree">
  74. <div id="nav-tree-contents">
  75. </div>
  76. </div>
  77. <div id="splitbar" style="-moz-user-select:none;"
  78. class="ui-resizable-handle">
  79. </div>
  80. </div>
  81. <script type="text/javascript">
  82. initNavTree('puma_8f90.html','');
  83. </script>
  84. <div id="doc-content">
  85. <div class="header">
  86. <div class="headertitle">
  87. <div class="title">/Users/home/WC/puma/src/puma.f90</div> </div>
  88. </div>
  89. <div class="contents">
  90. <a href="puma_8f90.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">module</span> <a class="code" href="classpumamod.html">pumamod</a>
  91. <a name="l00002"></a>00002
  92. <a name="l00003"></a>00003 <span class="comment">!*********************************************!</span>
  93. <a name="l00004"></a>00004 <span class="comment">! Portable University Model of the Atmosphere !</span>
  94. <a name="l00005"></a>00005 <span class="comment">!*********************************************!</span>
  95. <a name="l00006"></a>00006 <span class="comment">! Version: 17.0 16-Feb-2011 !</span>
  96. <a name="l00007"></a>00007 <span class="comment">!*********************************************!</span>
  97. <a name="l00008"></a>00008 <span class="comment">! Klaus Fraedrich !</span>
  98. <a name="l00009"></a>00009 <span class="comment">! Frank Lunkeit - Edilbert Kirk !</span>
  99. <a name="l00010"></a>00010 <span class="comment">! Frank Sielmann - Torben Kunz !</span>
  100. <a name="l00011"></a>00011 <span class="comment">! Hartmut Borth !</span>
  101. <a name="l00012"></a>00012 <span class="comment">!*********************************************!</span>
  102. <a name="l00013"></a>00013 <span class="comment">! Meteorologisches Institut !</span>
  103. <a name="l00014"></a>00014 <span class="comment">! KlimaCampus - Universitaet Hamburg !</span>
  104. <a name="l00015"></a>00015 <span class="comment">!*********************************************!</span>
  105. <a name="l00016"></a>00016 <span class="comment">! http://www.mi.uni-hamburg.de/puma !</span>
  106. <a name="l00017"></a>00017 <span class="comment">!*********************************************!</span>
  107. <a name="l00018"></a>00018
  108. <a name="l00019"></a>00019 <span class="comment">!**************************************************************!</span>
  109. <a name="l00020"></a>00020 <span class="comment">! The number of processes for processing on parallel machines !</span>
  110. <a name="l00021"></a>00021 <span class="comment">! NLAT/2 must be dividable by &lt;npro&gt;. npro can be set by the !</span>
  111. <a name="l00022"></a>00022 <span class="comment">! option -n &lt;npro&gt; when calling the puma executable !</span>
  112. <a name="l00023"></a>00023 <span class="comment">! This option is only available if the code is compiled with !</span>
  113. <a name="l00024"></a>00024 <span class="comment">! an mpi compiler. !</span>
  114. <a name="l00025"></a>00025 <span class="comment">!**************************************************************!</span>
  115. <a name="l00026"></a><a class="code" href="classpumamod.html#ae915be5ffac65dd8af555f2d75153398">00026</a> <span class="keywordtype">integer</span> :: npro = 1
  116. <a name="l00027"></a>00027
  117. <a name="l00028"></a>00028 <span class="comment">!**************************************************************!</span>
  118. <a name="l00029"></a>00029 <span class="comment">! The horizontal resolution of PUMA is set by defining the !</span>
  119. <a name="l00030"></a>00030 <span class="comment">! number of latitudes &lt;nlev&gt; with the 1st. command line !</span>
  120. <a name="l00031"></a>00031 <span class="comment">! parameter and the number of levels with the 2nd. command !</span>
  121. <a name="l00032"></a>00032 <span class="comment">! parameter. A typical call for T42 is: !</span>
  122. <a name="l00033"></a>00033 <span class="comment">! puma.x 64 10 !</span>
  123. <a name="l00034"></a>00034 <span class="comment">! which sets nlat=64 and nlev=10 !</span>
  124. <a name="l00035"></a>00035 <span class="comment">!**************************************************************!</span>
  125. <a name="l00036"></a>00036 <span class="keywordtype">integer</span> :: nlat = 32
  126. <a name="l00037"></a>00037
  127. <a name="l00038"></a>00038 <span class="comment">!example values: 32, 48, 64, 128, 192, 256, 512, 1024</span>
  128. <a name="l00039"></a>00039 <span class="comment">!truncation: T21, T31, T42, T85, T127, T170, T341, T682</span>
  129. <a name="l00040"></a>00040
  130. <a name="l00041"></a>00041 <span class="keywordtype">integer</span> :: nlev = 10
  131. <a name="l00042"></a>00042
  132. <a name="l00043"></a>00043 <span class="comment">!*****************************************************!</span>
  133. <a name="l00044"></a>00044 <span class="comment">! Grid related paramters, which are computed from the !</span>
  134. <a name="l00045"></a>00045 <span class="comment">! command line arguments &lt;nlat&gt; and &lt;nlev&gt; !</span>
  135. <a name="l00046"></a>00046 <span class="comment">! Preset values are for T21 (nlat=32) and nlev=10 !</span>
  136. <a name="l00047"></a>00047 <span class="comment">! ****************************************************!</span>
  137. <a name="l00048"></a>00048
  138. <a name="l00049"></a>00049 <span class="keywordtype">integer</span> :: nlem = 9 <span class="comment">! Levels - 1</span>
  139. <a name="l00050"></a>00050 <span class="keywordtype">integer</span> :: nlep = 11 <span class="comment">! Levels + 1</span>
  140. <a name="l00051"></a>00051 <span class="keywordtype">integer</span> :: nlsq = 100 <span class="comment">! Levels squared</span>
  141. <a name="l00052"></a>00052
  142. <a name="l00053"></a>00053 <span class="keywordtype">integer</span> :: nlon = 64 <span class="comment">! Longitudes = 2 * latitudes</span>
  143. <a name="l00054"></a>00054 <span class="keywordtype">integer</span> :: nlah = 16 <span class="comment">! Half of latitudes</span>
  144. <a name="l00055"></a>00055 <span class="keywordtype">integer</span> :: ntru = 21 <span class="comment">! (nlon-1) / 3</span>
  145. <a name="l00056"></a>00056 <span class="keywordtype">integer</span> :: ntp1 = 22 <span class="comment">! ntru + 1</span>
  146. <a name="l00057"></a>00057 <span class="keywordtype">integer</span> :: nzom = 44 <span class="comment">! Number of zonal modes</span>
  147. <a name="l00058"></a>00058 <span class="keywordtype">integer</span> :: nrsp = 506 <span class="comment">! (ntru+1) * (ntru+2)</span>
  148. <a name="l00059"></a>00059 <span class="keywordtype">integer</span> :: ncsp = 253 <span class="comment">! nrsp / 2</span>
  149. <a name="l00060"></a>00060 <span class="keywordtype">integer</span> :: nspp = 506 <span class="comment">! nodes per process</span>
  150. <a name="l00061"></a>00061 <span class="keywordtype">integer</span> :: nesp = 506 <span class="comment">! number of extended modes</span>
  151. <a name="l00062"></a>00062
  152. <a name="l00063"></a>00063 <span class="keywordtype">integer</span> :: nlpp = 32 <span class="comment">! Latitudes per process</span>
  153. <a name="l00064"></a>00064 <span class="keywordtype">integer</span> :: nhpp = 16 <span class="comment">! Half latitudes per process</span>
  154. <a name="l00065"></a>00065 <span class="keywordtype">integer</span> :: nhor = 2048 <span class="comment">! Horizontal part</span>
  155. <a name="l00066"></a><a class="code" href="classpumamod.html#aa9e811d28ba93c3dadb44bc26ae09600">00066</a> <span class="keywordtype">integer</span> :: nugp = 2048 <span class="comment">! Horizontal total</span>
  156. <a name="l00067"></a><a class="code" href="classpumamod.html#ac20b6aa2c443341280ab5e4ddc9bebd7">00067</a> <span class="keywordtype">integer</span> :: npgp = 1024 <span class="comment">! Horizontal total packed words</span>
  157. <a name="l00068"></a>00068
  158. <a name="l00069"></a><a class="code" href="classpumamod.html#ab963b44aa3f4546a551dd941e4e322c8">00069</a> <span class="keywordtype">integer</span> :: nud = 6 <span class="comment">! I/O unit for diagnostic output</span>
  159. <a name="l00070"></a>00070
  160. <a name="l00071"></a>00071 <span class="comment">!***********!</span>
  161. <a name="l00072"></a>00072 <span class="comment">! filenames !</span>
  162. <a name="l00073"></a>00073 <span class="comment">!***********!</span>
  163. <a name="l00074"></a><a class="code" href="classpumamod.html#a71c27dcf11504a05aa050a3ee4d436d1">00074</a> <span class="keywordtype">character (256)</span> :: puma_namelist = <span class="stringliteral">&quot;puma_namelist&quot;</span>
  164. <a name="l00075"></a><a class="code" href="classpumamod.html#a047f25dcb732cdf09b1f74fd3115126a">00075</a> <span class="keywordtype">character (256)</span> :: puma_output = <span class="stringliteral">&quot;puma_output&quot;</span>
  165. <a name="l00076"></a><a class="code" href="classpumamod.html#ad11e2fd3e6aa83543bbc8acd0c59b7a0">00076</a> <span class="keywordtype">character (256)</span> :: puma_diag = <span class="stringliteral">&quot;puma_diag&quot;</span>
  166. <a name="l00077"></a><a class="code" href="classpumamod.html#a98f71e6dad074de1b2cb0fd1c5e531c3">00077</a> <span class="keywordtype">character (256)</span> :: puma_restart = <span class="stringliteral">&quot;puma_restart&quot;</span>
  167. <a name="l00078"></a><a class="code" href="classpumamod.html#ab188caa1d64091345227ae3bf0e83edd">00078</a> <span class="keywordtype">character (256)</span> :: puma_status = <span class="stringliteral">&quot;puma_status&quot;</span>
  168. <a name="l00079"></a><a class="code" href="classpumamod.html#a5f70e9c47b9e4690322963b92bb809de">00079</a> <span class="keywordtype">character (256)</span> :: efficiency_dat = <span class="stringliteral">&quot;efficiency.dat&quot;</span>
  169. <a name="l00080"></a><a class="code" href="classpumamod.html#ae6491cb06d104f50f9803d15f195f951">00080</a> <span class="keywordtype">character (256)</span> :: ppp_puma_txt = <span class="stringliteral">&quot;ppp-puma.txt&quot;</span>
  170. <a name="l00081"></a><a class="code" href="classpumamod.html#a97179af6f9ebee802a4333f951b0f436">00081</a> <span class="keywordtype">character (256)</span> :: puma_sp_init = <span class="stringliteral">&quot;puma_sp_init&quot;</span>
  171. <a name="l00082"></a>00082
  172. <a name="l00083"></a>00083 <span class="comment">! *****************************************************************</span>
  173. <a name="l00084"></a>00084 <span class="comment">! * For multiruns the instance number is appended to the filename *</span>
  174. <a name="l00085"></a>00085 <span class="comment">! * e.g.: puma_namelist_1 puma_diag_1 etc. for instance # 1 *</span>
  175. <a name="l00086"></a>00086 <span class="comment">! *****************************************************************</span>
  176. <a name="l00087"></a>00087
  177. <a name="l00088"></a>00088 <span class="comment">! ****************************************************************</span>
  178. <a name="l00089"></a>00089 <span class="comment">! * Don&#39;t touch the following parameter definitions ! *</span>
  179. <a name="l00090"></a>00090 <span class="comment">! ****************************************************************</span>
  180. <a name="l00091"></a><a class="code" href="classpumamod.html#a6cfe02b5d7dfcb7850792dcc03ae3a45">00091</a> <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: PUMA = 0 <span class="comment">! Model ID</span>
  181. <a name="l00092"></a><a class="code" href="classpumamod.html#a6014a04a0c8a568ae850cff922ec8c36">00092</a> <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: PLASIM = 1 <span class="comment">! Model ID</span>
  182. <a name="l00093"></a>00093
  183. <a name="l00094"></a>00094 parameter(NROOT = 0) <span class="comment">! Master node</span>
  184. <a name="l00095"></a>00095
  185. <a name="l00096"></a>00096 parameter(PI = 3.141592653589793D0) <span class="comment">! Pi</span>
  186. <a name="l00097"></a>00097 parameter(TWOPI = PI + PI) <span class="comment">! 2 Pi</span>
  187. <a name="l00098"></a>00098
  188. <a name="l00099"></a>00099 parameter(AKAP_EARTH = 0.286 ) <span class="comment">! Kappa Earth</span>
  189. <a name="l00100"></a>00100 parameter(AKAP_MARS = 0.2273) <span class="comment">! Kappa Mars</span>
  190. <a name="l00101"></a>00101 parameter(ALR_EARTH = 0.0065) <span class="comment">! Lapse rate Earth</span>
  191. <a name="l00102"></a>00102 parameter(ALR_MARS = 0.0025) <span class="comment">! Lapse rate Mars</span>
  192. <a name="l00103"></a>00103 parameter(GA_EARTH = 9.81) <span class="comment">! Gravity Earth</span>
  193. <a name="l00104"></a>00104 parameter(GA_MARS = 3.74) <span class="comment">! Gravity Mars</span>
  194. <a name="l00105"></a>00105 parameter(GASCON_EARTH = 287.0) <span class="comment">! Gas constant for dry air on Earth</span>
  195. <a name="l00106"></a>00106 parameter(GASCON_MARS = 188.9) <span class="comment">! Gas constant for dry air on Mars </span>
  196. <a name="l00107"></a>00107 parameter(PSURF_EARTH = 101100.0) <span class="comment">! Mean Surface pressure [Pa] on Earth</span>
  197. <a name="l00108"></a>00108 <span class="comment">! Trenberth 1981, J. Geoph. Res., Vol.86, 5238-5246</span>
  198. <a name="l00109"></a>00109 parameter(PLARAD_EARTH = 6371000.0) <span class="comment">! Earth radius</span>
  199. <a name="l00110"></a>00110 parameter(PLARAD_MARS = 3397000.0) <span class="comment">! Mars radius</span>
  200. <a name="l00111"></a>00111 parameter(SID_DAY_EARTH= 86164.) <span class="comment">! Siderial day Earth 23h 56m 04s</span>
  201. <a name="l00112"></a>00112 parameter(SID_DAY_MARS = 88642.) <span class="comment">! Siderial day Mars 24h 37m 22s</span>
  202. <a name="l00113"></a>00113
  203. <a name="l00114"></a>00114 parameter(WW_EARTH = TWOPI/SID_DAY_EARTH) <span class="comment">! reciprocal of time scale </span>
  204. <a name="l00115"></a>00115 <span class="comment">! on Earth [1/sec]</span>
  205. <a name="l00116"></a>00116 parameter(WW_MARS = TWOPI/SID_DAY_MARS) <span class="comment">! reciprocal of time scale</span>
  206. <a name="l00117"></a>00117 <span class="comment">! on Mars [1/sec]</span>
  207. <a name="l00118"></a>00118
  208. <a name="l00119"></a>00119 parameter(CV_EARTH = PLARAD_EARTH * WW_EARTH) <span class="comment">! Velocity scale on Earth [m/s]</span>
  209. <a name="l00120"></a>00120 parameter(CV_MARS = PLARAD_MARS * WW_MARS) <span class="comment">! Velocity scale on Mars [m/s]</span>
  210. <a name="l00121"></a>00121
  211. <a name="l00122"></a>00122 parameter(CT_EARTH = CV_EARTH*CV_EARTH/GASCON_EARTH) <span class="comment">!Temperature scale [K] </span>
  212. <a name="l00123"></a>00123 <span class="comment">! on Earth </span>
  213. <a name="l00124"></a>00124 parameter(CT_MARS = CV_MARS*CV_MARS/GASCON_MARS) <span class="comment">!Temperature scale [K] </span>
  214. <a name="l00125"></a>00125 <span class="comment">! on Mars </span>
  215. <a name="l00126"></a>00126
  216. <a name="l00127"></a>00127 parameter(PNU = 0.02) <span class="comment">! Time filter</span>
  217. <a name="l00128"></a>00128 parameter(PNU21 = 1.0 - 2.0*PNU) <span class="comment">! Time filter 2</span>
  218. <a name="l00129"></a>00129
  219. <a name="l00130"></a>00130 <span class="comment">! *****************************************************************</span>
  220. <a name="l00131"></a>00131 <span class="comment">! * EZ: Factor to multiply the spherical harmonic Y_(1,0) to get *</span>
  221. <a name="l00132"></a>00132 <span class="comment">! * the non-dimensional planetary vorticity 2 sin(phi). In PUMA *</span>
  222. <a name="l00133"></a>00133 <span class="comment">! * Y_(1,0) = sqrt(3/2)*sin(phi) (normalization factor 1/sqrt(2)).*</span>
  223. <a name="l00134"></a>00134 <span class="comment">! * The time scale must be given by Tscale = 1/Omega * </span>
  224. <a name="l00135"></a>00135 <span class="comment">! *****************************************************************</span>
  225. <a name="l00136"></a>00136 parameter(EZ = 1.632993161855452D0) <span class="comment">! ez = 1 / sqrt(3/8)</span>
  226. <a name="l00137"></a>00137
  227. <a name="l00138"></a>00138
  228. <a name="l00139"></a>00139 <span class="comment">! **************************************************************</span>
  229. <a name="l00140"></a>00140 <span class="comment">! * Planetary parameters &amp; Scales *</span>
  230. <a name="l00141"></a>00141 <span class="comment">! * ----------------------------- *</span>
  231. <a name="l00142"></a>00142 <span class="comment">! * The Puma model is formulated in non-dimensional form with * </span>
  232. <a name="l00143"></a>00143 <span class="comment">! * the planetary radius as length scale and the reciprocal of * </span>
  233. <a name="l00144"></a>00144 <span class="comment">! * the planetary rotation rate as time scale. The temperature * </span>
  234. <a name="l00145"></a>00145 <span class="comment">! * scale is given by the geopotential scale divided by the * </span>
  235. <a name="l00146"></a>00146 <span class="comment">! * gas constant. * </span>
  236. <a name="l00147"></a>00147 <span class="comment">! * For the time scale the length of the siderial day is used *</span>
  237. <a name="l00148"></a>00148 <span class="comment">! * as basic unit *</span>
  238. <a name="l00149"></a>00149 <span class="comment">! * The parameters are initialized for Earth settings. They *</span>
  239. <a name="l00150"></a>00150 <span class="comment">! * may be modified by the namelist file &lt;puma_namelist&gt; *</span>
  240. <a name="l00151"></a>00151 <span class="comment">! * *</span>
  241. <a name="l00152"></a>00152 <span class="comment">! * The scales are derived internal quantities *</span>
  242. <a name="l00153"></a>00153 <span class="comment">! **************************************************************</span>
  243. <a name="l00154"></a>00154 <span class="keywordtype">real</span> :: sid_day = SID_DAY_EARTH <span class="comment">! Length of sideral day [sec] on Earth</span>
  244. <a name="l00155"></a><a class="code" href="classpumamod.html#a0c307462fbf87e3081b2a385e18d2aed">00155</a> <span class="keywordtype">real</span> :: plarad = PLARAD_EARTH <span class="comment">! Planetary radius [m] on Earth</span>
  245. <a name="l00156"></a><a class="code" href="classpumamod.html#ae3f731196cc45fe58378593cedcbb674">00156</a> <span class="keywordtype">real</span> :: gascon = GASCON_EARTH <span class="comment">! Dry air gas consant [J/K kg] on Earth </span>
  246. <a name="l00157"></a><a class="code" href="classpumamod.html#a3d53197ec6d14527904d37910baf20ba">00157</a> <span class="keywordtype">real</span> :: akap = AKAP_EARTH <span class="comment">! Kappa [] on Earth</span>
  247. <a name="l00158"></a><a class="code" href="classpumamod.html#a16fd3c35a535517745304e4e978dad36">00158</a> <span class="keywordtype">real</span> :: alr = ALR_EARTH <span class="comment">! average lapse rate [K/km] on Earth</span>
  248. <a name="l00159"></a><a class="code" href="classpumamod.html#afab1546c76a48d45df0296c921674b29">00159</a> <span class="keywordtype">real</span> :: ga = GA_EARTH <span class="comment">! Gravity [m/sec*sec] on Earth</span>
  249. <a name="l00160"></a><a class="code" href="classpumamod.html#aecc1e882fcb2823bd6f2bc1448c1953d">00160</a> <span class="keywordtype">real</span> :: psurf = PSURF_EARTH <span class="comment">! Mean surface pressure for EARTH [Pa] </span>
  250. <a name="l00161"></a>00161
  251. <a name="l00162"></a><a class="code" href="classpumamod.html#ac1247b3015d439d0c9f1b6b7ff94722b">00162</a> <span class="keywordtype">real</span> :: ww = WW_EARTH <span class="comment">! reciprocal of time scale [1/sec] (Omega)</span>
  252. <a name="l00163"></a><a class="code" href="classpumamod.html#a565ac5e5bafeaa6e81c64ce72e63ccf1">00163</a> <span class="keywordtype">real</span> :: cv = CV_EARTH <span class="comment">! velocity scale [m/sec] on Earth</span>
  253. <a name="l00164"></a><a class="code" href="classpumamod.html#a7a6d067e0dfb359595d82114a0362ff2">00164</a> <span class="keywordtype">real</span> :: ct = CT_EARTH <span class="comment">! temperature scale [K] on Earth </span>
  254. <a name="l00165"></a>00165
  255. <a name="l00166"></a>00166 <span class="comment">! **************************</span>
  256. <a name="l00167"></a>00167 <span class="comment">! * Global Integer Scalars *</span>
  257. <a name="l00168"></a>00168 <span class="comment">! **************************</span>
  258. <a name="l00169"></a>00169
  259. <a name="l00170"></a><a class="code" href="classpumamod.html#ac3cfb3fcdded6ec157594b899e3ea6f8">00170</a> <span class="keywordtype">logical</span> :: lrestart = .false. <span class="comment">! Existing &quot;puma_restart&quot; sets to .true.</span>
  260. <a name="l00171"></a><a class="code" href="classpumamod.html#aea52fae2a0b29f7669124cb727b07a5f">00171</a> <span class="keywordtype">logical</span> :: lselect = .false. <span class="comment">! true: disable some zonal waves</span>
  261. <a name="l00172"></a><a class="code" href="classpumamod.html#ae1611527d39b509b932ec189dd6885c3">00172</a> <span class="keywordtype">logical</span> :: lspecsel = .false. <span class="comment">! true: disable some spectral modes</span>
  262. <a name="l00173"></a>00173
  263. <a name="l00174"></a><a class="code" href="classpumamod.html#a7b22b37e933bb9e2b91022f17891b322">00174</a> <span class="keywordtype">integer</span> :: model = PUMA
  264. <a name="l00175"></a>00175
  265. <a name="l00176"></a>00176 <span class="keywordtype">integer</span> :: kick = 1 <span class="comment">! kick &gt; 0 initializes eddy generation</span>
  266. <a name="l00177"></a>00177 <span class="keywordtype">integer</span> :: nafter = 0 <span class="comment">! write data interval 0: controlled by nwpd</span>
  267. <a name="l00178"></a>00178 <span class="keywordtype">integer</span> :: nwpd = 1 <span class="comment">! number of writes per day</span>
  268. <a name="l00179"></a>00179 <span class="keywordtype">integer</span> :: ncoeff = 0 <span class="comment">! number of modes to print</span>
  269. <a name="l00180"></a>00180 <span class="keywordtype">integer</span> :: ndel = 6 <span class="comment">! ndel</span>
  270. <a name="l00181"></a>00181 <span class="keywordtype">integer</span> :: ndiag = 12 <span class="comment">! write diagnostics interval</span>
  271. <a name="l00182"></a>00182 <span class="keywordtype">integer</span> :: ngui = 0 <span class="comment">! activate Graphical User Interface</span>
  272. <a name="l00183"></a>00183 <span class="keywordtype">integer</span> :: nkits = 3 <span class="comment">! number of initial timesteps</span>
  273. <a name="l00184"></a>00184 <span class="keywordtype">integer</span> :: nlevt = 9 <span class="comment">! tropospheric levels (set_vertical_grid)</span>
  274. <a name="l00185"></a>00185 <span class="keywordtype">integer</span> :: noutput = 1 <span class="comment">! global switch for output on (1) or off (0)</span>
  275. <a name="l00186"></a><a class="code" href="classpumamod.html#ae565fd4c9d0d1e8f563b457690df60e1">00186</a> <span class="keywordtype">integer</span> :: nwspini = 1 <span class="comment">! write sp_init after initialization</span>
  276. <a name="l00187"></a>00187 <span class="keywordtype">integer</span> :: nrun = 0 <span class="comment">! if (nstop == 0) nstop = nstep + nrun</span>
  277. <a name="l00188"></a><a class="code" href="classpumamod.html#a44f4e89edb1112fb56a0acd8fe2de68c">00188</a> <span class="keywordtype">integer</span> :: nstep1 = 0 <span class="comment">! start step (for cpu statistics)</span>
  278. <a name="l00189"></a>00189 <span class="keywordtype">integer</span> :: nstep = -1 <span class="comment">! current timestep step 0: 01-Jan-0001 00:00</span>
  279. <a name="l00190"></a>00190 <span class="keywordtype">integer</span> :: nstop = 0 <span class="comment">! finishing timestep</span>
  280. <a name="l00191"></a>00191 <span class="keywordtype">integer</span> :: ntspd = 0 <span class="comment">! number of timesteps per day 0 = auto</span>
  281. <a name="l00192"></a>00192 <span class="keywordtype">integer</span> :: mpstep = 0 <span class="comment">! minutes per step 0 = automatic</span>
  282. <a name="l00193"></a>00193 <span class="keywordtype">integer</span> :: ncu = 0 <span class="comment">! check unit (debug output)</span>
  283. <a name="l00194"></a><a class="code" href="classpumamod.html#aeed68a00c7949544bc4fef6fb12750e7">00194</a> <span class="keywordtype">integer</span> :: nwrioro = 1 <span class="comment">! controls output of orography</span>
  284. <a name="l00195"></a><a class="code" href="classpumamod.html#ac8490b47e54184cb4a1cea076d0a30a3">00195</a> <span class="keywordtype">integer</span> :: nextout = 0 <span class="comment">! 1: extended output (entropy production)</span>
  285. <a name="l00196"></a><a class="code" href="classpumamod.html#a8f8ac2af640bb3457498cf2ca2cf382a">00196</a> <span class="keywordtype">integer</span> :: nruido = 0 <span class="comment">! 1: global constant, temporal noise</span>
  286. <a name="l00197"></a>00197 <span class="comment">! 2: spatio-temporal noise</span>
  287. <a name="l00198"></a>00198 <span class="comment">! 3: spatio-temporal equator symmetric</span>
  288. <a name="l00199"></a><a class="code" href="classpumamod.html#af9d1e5f558a9b0151f81e27c4ea6c361">00199</a> <span class="keywordtype">integer</span> :: nseedlen = 0 <span class="comment">! length of random seed (set by lib call)</span>
  289. <a name="l00200"></a><a class="code" href="classpumamod.html#a5deccef8dbe1e1e9bfb869f67d8a16f1">00200</a> <span class="keywordtype">integer</span> :: nmonths = 0 <span class="comment">! Simulation time (1 month = 30 days)</span>
  290. <a name="l00201"></a><a class="code" href="classpumamod.html#a6bebc837456862a7db9c50bcd686e1e6">00201</a> <span class="keywordtype">integer</span> :: nyears = 1 <span class="comment">! simulation time (1 year = 360 days)</span>
  291. <a name="l00202"></a>00202 <span class="keywordtype">integer</span> :: nsponge = 0 <span class="comment">! 1: Create sponge layer</span>
  292. <a name="l00203"></a>00203 <span class="keywordtype">integer</span> :: nhelsua = 0 <span class="comment">! 1: Set up Held &amp; Suarez T_R field</span>
  293. <a name="l00204"></a>00204 <span class="comment">! instead of original PUMA T_R field</span>
  294. <a name="l00205"></a>00205 <span class="comment">! 2: Set up Held &amp; Suarez T_R field</span>
  295. <a name="l00206"></a>00206 <span class="comment">! instead of original PUMA T_R field</span>
  296. <a name="l00207"></a>00207 <span class="comment">! AND use latitudinally varying</span>
  297. <a name="l00208"></a>00208 <span class="comment">! heating timescale in PUMA (H&amp;Z(94)),</span>
  298. <a name="l00209"></a>00209 <span class="comment">! irrelevant for PumaPreProcessor (ppp)</span>
  299. <a name="l00210"></a>00210 <span class="comment">! 3: Use latitudinally varying</span>
  300. <a name="l00211"></a>00211 <span class="comment">! heating timescale in PUMA (H&amp;Z(94)),</span>
  301. <a name="l00212"></a>00212 <span class="comment">! irrelevant for PumaPreProcessor (ppp)</span>
  302. <a name="l00213"></a><a class="code" href="classpumamod.html#a996f9145950ee7b3955819b122de4957">00213</a> <span class="keywordtype">integer</span> :: ndiagp = 0 <span class="comment">! 0/1 switch for grid point diabatic heating </span>
  303. <a name="l00214"></a><a class="code" href="classpumamod.html#a4ad70fab2e818be277ec41afde36c5d2">00214</a> <span class="keywordtype">integer</span> :: nconv = 0 <span class="comment">! 0/1 switch for convecive heating</span>
  304. <a name="l00215"></a>00215 <span class="keywordtype">integer</span> :: nvg = 0 <span class="comment">! type of vertical grid</span>
  305. <a name="l00216"></a>00216 <span class="comment">! 0 = linear</span>
  306. <a name="l00217"></a>00217 <span class="comment">! 1 = Scinocca &amp; Haynes</span>
  307. <a name="l00218"></a>00218 <span class="comment">! 2 = Polvani &amp; Kushner</span>
  308. <a name="l00219"></a><a class="code" href="classpumamod.html#a0423d8412d0d82630764dd724fbe763a">00219</a> <span class="keywordtype">integer</span> :: nenergy = 0 <span class="comment">! energy diagnostics (on/off 1/0)</span>
  309. <a name="l00220"></a><a class="code" href="classpumamod.html#a6ebc03f03149556f450c2c2c927189f2">00220</a> <span class="keywordtype">integer</span> :: nentropy= 0 <span class="comment">! entropy diagnostics (on/off 1/0)</span>
  310. <a name="l00221"></a><a class="code" href="classpumamod.html#a8e7c1d42543d35f7caba5ebd36dcfd54">00221</a> <span class="keywordtype">integer</span> :: ndheat = 0 <span class="comment">! energy recycling (on/off 1/0)</span>
  311. <a name="l00222"></a>00222
  312. <a name="l00223"></a><a class="code" href="classpumamod.html#a5e7e19a6f3a971a303fc7efc2676e5f1">00223</a> <span class="keywordtype">integer</span> :: nradcv = 0 <span class="comment">! use two restoration fields</span>
  313. <a name="l00224"></a>00224
  314. <a name="l00225"></a>00225
  315. <a name="l00226"></a>00226
  316. <a name="l00227"></a>00227 <span class="comment">! ***********************</span>
  317. <a name="l00228"></a>00228 <span class="comment">! * Global Real Scalars *</span>
  318. <a name="l00229"></a>00229 <span class="comment">! ***********************</span>
  319. <a name="l00230"></a>00230
  320. <a name="l00231"></a><a class="code" href="classpumamod.html#a976863e22669d1d80cb62a3af35e3d4d">00231</a> <span class="keywordtype">real</span> :: alpha = 1.0 <span class="comment">! Williams filter factor</span>
  321. <a name="l00232"></a>00232 <span class="keywordtype">real</span> :: alrs = 0.0 <span class="comment">! stratospheric lapse rate [K/m]</span>
  322. <a name="l00233"></a>00233 <span class="keywordtype">real</span> :: delt <span class="comment">! 2 pi / ntspd timestep interval</span>
  323. <a name="l00234"></a>00234 <span class="keywordtype">real</span> :: delt2 <span class="comment">! 2 * delt</span>
  324. <a name="l00235"></a>00235 <span class="keywordtype">real</span> :: dtep = 60.0 <span class="comment">! delta T equator &lt;-&gt; pole [K]</span>
  325. <a name="l00236"></a>00236 <span class="keywordtype">real</span> :: dtns = -70.0 <span class="comment">! delta T north &lt;-&gt; south [K]</span>
  326. <a name="l00237"></a>00237 <span class="keywordtype">real</span> :: dtrop = 12000.0 <span class="comment">! Tropopause height [m]</span>
  327. <a name="l00238"></a>00238 <span class="keywordtype">real</span> :: dttrp = 2.0 <span class="comment">! Tropopause smoothing [K]</span>
  328. <a name="l00239"></a>00239 <span class="keywordtype">real</span> :: dtzz = 10.0 <span class="comment">! delta(Theta)/H additional lapserate in</span>
  329. <a name="l00240"></a>00240 <span class="comment">! Held &amp; Suarez T_R field</span>
  330. <a name="l00241"></a>00241 <span class="keywordtype">real</span> :: orofac = 1.0 <span class="comment">! factor to scale the orograpy</span>
  331. <a name="l00242"></a>00242 <span class="keywordtype">real</span> :: plavor = EZ <span class="comment">! planetary vorticity</span>
  332. <a name="l00243"></a><a class="code" href="classpumamod.html#ac68939034981424cca40dd948549d1a0">00243</a> <span class="keywordtype">real</span> :: psmean = PSURF_EARTH <span class="comment">! Mean of Ps on Earth</span>
  333. <a name="l00244"></a>00244 <span class="keywordtype">real</span> :: rotspd = 1.0 <span class="comment">! rotation speed 1.0 = normal Earth rotation</span>
  334. <a name="l00245"></a>00245 <span class="keywordtype">real</span> :: sigmax = 6.0e-7 <span class="comment">! sigma for top half level</span>
  335. <a name="l00246"></a>00246 <span class="keywordtype">real</span> :: tdiss = 0.25 <span class="comment">! diffusion time scale [days]</span>
  336. <a name="l00247"></a>00247 <span class="keywordtype">real</span> :: tac = 360.0 <span class="comment">! length of annual cycle [days] (0 = no cycle)</span>
  337. <a name="l00248"></a>00248 <span class="keywordtype">real</span> :: pac = 0.0 <span class="comment">! phase of the annual cycle [days]</span>
  338. <a name="l00249"></a>00249 <span class="keywordtype">real</span> :: tgr = 288.0 <span class="comment">! Ground Temperature in mean profile [K]</span>
  339. <a name="l00250"></a><a class="code" href="classpumamod.html#a529184e9404faf138c07e7f28afee2e1">00250</a> <span class="keywordtype">real</span> :: dvdiff = 0.0 <span class="comment">! vertical diffusion coefficient [m2/s]</span>
  340. <a name="l00251"></a>00251 <span class="comment">! ! dvdiff =0. means no vertical diffusion</span>
  341. <a name="l00252"></a><a class="code" href="classpumamod.html#a4fc16343d9407e3714e301309177a08a">00252</a> <span class="keywordtype">real</span> :: disp = 0.0 <span class="comment">! noise dispersion</span>
  342. <a name="l00253"></a>00253 <span class="keywordtype">real</span> :: tauta = 40.0 <span class="comment">! heating timescale far from surface</span>
  343. <a name="l00254"></a>00254 <span class="keywordtype">real</span> :: tauts = 4.0 <span class="comment">! heating timescale close to surface</span>
  344. <a name="l00255"></a><a class="code" href="classpumamod.html#a594702993f401d2641f71890a8f9f6f5">00255</a> <span class="keywordtype">real</span> :: pspon = 50. <span class="comment">! apply sponge layer where p &lt; pspon</span>
  345. <a name="l00256"></a>00256 <span class="comment">! ! pressure [Pa]</span>
  346. <a name="l00257"></a><a class="code" href="classpumamod.html#ad1a6236311cdfb3949ec1b1c262b59ac">00257</a> <span class="keywordtype">real</span> :: sponk = 0.5 <span class="comment">! max. damping coefficient for sponge layer,</span>
  347. <a name="l00258"></a>00258 <span class="comment">! ! unit: [1/day]</span>
  348. <a name="l00259"></a>00259
  349. <a name="l00260"></a>00260 <span class="comment">! **************************</span>
  350. <a name="l00261"></a>00261 <span class="comment">! * Global Spectral Arrays *</span>
  351. <a name="l00262"></a>00262 <span class="comment">! **************************</span>
  352. <a name="l00263"></a>00263
  353. <a name="l00264"></a><a class="code" href="classpumamod.html#a607c73cd3e6556d8dfa4337bb71bad61">00264</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sd(:,:) <span class="comment">! Spectral Divergence</span>
  354. <a name="l00265"></a><a class="code" href="classpumamod.html#a4ec415d0ab8671b481436b79bc708c4d">00265</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sdd(:,:) <span class="comment">! Difference between instances</span>
  355. <a name="l00266"></a><a class="code" href="classpumamod.html#a9e5f2e6b01b35c141b673be058d6ba52">00266</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: st(:,:) <span class="comment">! Spectral Temperature</span>
  356. <a name="l00267"></a><a class="code" href="classpumamod.html#ac4bf8bb0f46d1d2f91f95e10be02a738">00267</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: std(:,:) <span class="comment">! Difference between instances</span>
  357. <a name="l00268"></a><a class="code" href="classpumamod.html#aad136f237f5ca5d94b6f0e0e742864df">00268</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: st1(:,:) <span class="comment">! Spectral Temperature at t-1 (for NEXTOUT == 1)</span>
  358. <a name="l00269"></a><a class="code" href="classpumamod.html#a69fc3701590281746d17dcb2f80c1c03">00269</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: st2(:,:) <span class="comment">! Spectral Temperature at t-2 (for NEXTOUT == 1)</span>
  359. <a name="l00270"></a><a class="code" href="classpumamod.html#a6da929d3d47a0b47afc30657bf43cb74">00270</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sz(:,:) <span class="comment">! Spectral Vorticity</span>
  360. <a name="l00271"></a><a class="code" href="classpumamod.html#a2de620590b09238085f6a8c4810c4392">00271</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: szd(:,:) <span class="comment">! Difference between instances</span>
  361. <a name="l00272"></a><a class="code" href="classpumamod.html#a62dbb101d0fe728fa2231fa3482ee7b1">00272</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sp(:) <span class="comment">! Spectral Pressure (ln Ps)</span>
  362. <a name="l00273"></a><a class="code" href="classpumamod.html#a99ec3c13cdd619b700160372a330f531">00273</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: spd(:) <span class="comment">! Difference between instances</span>
  363. <a name="l00274"></a><a class="code" href="classpumamod.html#a02a75a47225d636193b203a0d7ccc4ee">00274</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sq(:,:) <span class="comment">! For compatibility with PlaSim</span>
  364. <a name="l00275"></a><a class="code" href="classpumamod.html#a8509c5063893002e614541f3f546db2f">00275</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sp1(:) <span class="comment">! Spectral Pressure at t-1 (for NEXTOUT == 1)</span>
  365. <a name="l00276"></a><a class="code" href="classpumamod.html#ac0a89b4b892f00ce4069b1adc76ac1ad">00276</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sp2(:) <span class="comment">! Spectral Pressure at t-2 (for NEXTOUT == 1)</span>
  366. <a name="l00277"></a><a class="code" href="classpumamod.html#ab0c826a52384cc9195a2244e7003cab8">00277</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: so(:) <span class="comment">! Spectral Orography</span>
  367. <a name="l00278"></a>00278 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sr1(:,:) <span class="comment">! Spectral Restoration Temperature</span>
  368. <a name="l00279"></a>00279 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sr2(:,:) <span class="comment">! Spectral Restoration Temperature</span>
  369. <a name="l00280"></a>00280
  370. <a name="l00281"></a><a class="code" href="classpumamod.html#aa56f906a0a8233f5a59a2dd2375d7bfe">00281</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sdp(:,:) <span class="comment">! Spectral Divergence Partial</span>
  371. <a name="l00282"></a><a class="code" href="classpumamod.html#aad8ec9e8e440a8a077624b05430d1d65">00282</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: stp(:,:) <span class="comment">! Spectral Temperature Partial</span>
  372. <a name="l00283"></a><a class="code" href="classpumamod.html#a1d691f7ffd430d06377c953ac7b1615a">00283</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: szp(:,:) <span class="comment">! Spectral Vorticity Partial</span>
  373. <a name="l00284"></a><a class="code" href="classpumamod.html#a8c0d3d0d8eaeee34966b2ed8cdab6880">00284</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: spp(:) <span class="comment">! Spectral Pressure Partial</span>
  374. <a name="l00285"></a><a class="code" href="classpumamod.html#ad94d9ab7dd97c7f24ccfca4e9c1dcadd">00285</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sop(:) <span class="comment">! Spectral Orography Partial</span>
  375. <a name="l00286"></a><a class="code" href="classpumamod.html#a610ade488da8477514d377f4d3113078">00286</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: srp1(:,:)<span class="comment">! Spectral Restoration Partial</span>
  376. <a name="l00287"></a><a class="code" href="classpumamod.html#aedc7ade1364d2e510fe5a9e17d2ee551">00287</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: srp2(:,:)<span class="comment">! Spectral Restoration Partial</span>
  377. <a name="l00288"></a>00288
  378. <a name="l00289"></a><a class="code" href="classpumamod.html#a6469b0773780c7e85cc8fe80dab7360c">00289</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sdt(:,:) <span class="comment">! Spectral Divergence Tendency</span>
  379. <a name="l00290"></a><a class="code" href="classpumamod.html#a38a8cfb3cd3b1ccf0fd5b7283e0949be">00290</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: stt(:,:) <span class="comment">! Spectral Temperature Tendency</span>
  380. <a name="l00291"></a><a class="code" href="classpumamod.html#a9414c9820ee505006ea2ef90a1e4786c">00291</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: szt(:,:) <span class="comment">! Spectral Vorticity Tendency</span>
  381. <a name="l00292"></a><a class="code" href="classpumamod.html#a86dd88d1dc1d0d21eeb13c11905d7b66">00292</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: spt(:) <span class="comment">! Spectral Pressure Tendency</span>
  382. <a name="l00293"></a>00293
  383. <a name="l00294"></a><a class="code" href="classpumamod.html#a4285b7b3267876729285e16aca07035e">00294</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sdm(:,:) <span class="comment">! Spectral Divergence Minus</span>
  384. <a name="l00295"></a><a class="code" href="classpumamod.html#a636c3a27cc6a7aa8f63fd4d322406517">00295</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: stm(:,:) <span class="comment">! Spectral Temperature Minus</span>
  385. <a name="l00296"></a><a class="code" href="classpumamod.html#a7961c979cb0a5cb3cfb7cce5a9d16d6b">00296</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: szm(:,:) <span class="comment">! Spectral Vorticity Minus</span>
  386. <a name="l00297"></a><a class="code" href="classpumamod.html#a2bc3d91e2e9c16048446dbd12448ed2d">00297</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: spm(:) <span class="comment">! Spectral Pressure Minus</span>
  387. <a name="l00298"></a>00298
  388. <a name="l00299"></a><a class="code" href="classpumamod.html#ae752a8854b0014c33704f7390b78687d">00299</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sak(:) <span class="comment">! Hyper diffusion</span>
  389. <a name="l00300"></a><a class="code" href="classpumamod.html#a98103b850b9c24c95bac646961ae0209">00300</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: srcn(:) <span class="comment">! 1.0 / (n * (n+1))</span>
  390. <a name="l00301"></a><a class="code" href="classpumamod.html#aaf3b11d526905c319b065f60804ba566">00301</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: span(:) <span class="comment">! Pressure for diagnostics</span>
  391. <a name="l00302"></a>00302 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: spnorm(:)<span class="comment">! Factors for output normalization</span>
  392. <a name="l00303"></a>00303
  393. <a name="l00304"></a><a class="code" href="classpumamod.html#a7902698a1673a4c65dd8e7443a7fcc6f">00304</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: nindex(:) <span class="comment">! Holds wavenumber</span>
  394. <a name="l00305"></a><a class="code" href="classpumamod.html#a8a778542c0d1ac00f0d4ccffe08f7190">00305</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: nscatsp(:) <span class="comment">! Used for reduce_scatter op</span>
  395. <a name="l00306"></a><a class="code" href="classpumamod.html#a14bc87e591fb027289ef3d9eb40b8a70">00306</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: nselzw(:) <span class="comment">! Enable/disable selected zonal waves</span>
  396. <a name="l00307"></a><a class="code" href="classpumamod.html#a4f4aaa4c774bb1500caa0de7ca16bbe8">00307</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: nselsp(:) <span class="comment">! Enable/disable slected spectral modes</span>
  397. <a name="l00308"></a>00308
  398. <a name="l00309"></a>00309 <span class="comment">! ***************************</span>
  399. <a name="l00310"></a>00310 <span class="comment">! * Global Gridpoint Arrays *</span>
  400. <a name="l00311"></a>00311 <span class="comment">! ***************************</span>
  401. <a name="l00312"></a>00312
  402. <a name="l00313"></a><a class="code" href="classpumamod.html#a50103ebf2d2ba2366f2eca07abaabeb4">00313</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gd(:,:) <span class="comment">! Divergence</span>
  403. <a name="l00314"></a><a class="code" href="classpumamod.html#a3001f3699640a16cd7f91c6aa528af16">00314</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gt(:,:) <span class="comment">! Temperature</span>
  404. <a name="l00315"></a><a class="code" href="classpumamod.html#af24b389b45d2a20b68ea5bfc7cc48d17">00315</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gz(:,:) <span class="comment">! Vorticity</span>
  405. <a name="l00316"></a><a class="code" href="classpumamod.html#aaed48b35d778e5c3095fcd1083bbe804">00316</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gu(:,:) <span class="comment">! u * cos(phi)</span>
  406. <a name="l00317"></a><a class="code" href="classpumamod.html#a88b0140b2435578aa69cb4ac9781b91c">00317</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gv(:,:) <span class="comment">! v * sin(phi)</span>
  407. <a name="l00318"></a><a class="code" href="classpumamod.html#a6626db807402c61328ae36fddbeec5f1">00318</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gp(:) <span class="comment">! Ln(Ps)</span>
  408. <a name="l00319"></a><a class="code" href="classpumamod.html#a562c8285b90afd93ee2add1099a55e0f">00319</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gq(:,:) <span class="comment">! For compatibilty with PlaSim</span>
  409. <a name="l00320"></a><a class="code" href="classpumamod.html#aee702bf92e2a4578e4ff0adbdafcaadb">00320</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gfu(:,:) <span class="comment">! Term Fu in Primitive Equations</span>
  410. <a name="l00321"></a><a class="code" href="classpumamod.html#a3398d85c059c2cbe3948907b12a9058e">00321</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gfv(:,:) <span class="comment">! Term Fv in Primitive Equations</span>
  411. <a name="l00322"></a><a class="code" href="classpumamod.html#a54c30e8bd1e5b308c4111eaac995f578">00322</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gut(:,:) <span class="comment">! Term u * T</span>
  412. <a name="l00323"></a><a class="code" href="classpumamod.html#a1b9d24404ad1e089ee401e7c00ec79f0">00323</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gvt(:,:) <span class="comment">! Term v * T</span>
  413. <a name="l00324"></a><a class="code" href="classpumamod.html#a9c3f9d77d6c9acc5e900cb8fce8f8ac3">00324</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gke(:,:) <span class="comment">! Kinetic energy u * u + v * v</span>
  414. <a name="l00325"></a><a class="code" href="classpumamod.html#add5a9e2d129fa1c8bfe199f84263c9f7">00325</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gpj(:) <span class="comment">! d(Ln(Ps)) / d(mu)</span>
  415. <a name="l00326"></a><a class="code" href="classpumamod.html#a1102b7714ee109056cd4b64bb9ba96e4">00326</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: rcsq(:) <span class="comment">! 1 / cos2(phi)</span>
  416. <a name="l00327"></a><a class="code" href="classpumamod.html#a631f8bc1450b1c083f26a35cab8d87cc">00327</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: ruido(:,:,:)<span class="comment">! noise (nlon,nlat,nlev)</span>
  417. <a name="l00328"></a><a class="code" href="classpumamod.html#a839f7aa31c37072113405a43e334292e">00328</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: ruidop(:,:) <span class="comment">! noise partial (nhor,nlev)</span>
  418. <a name="l00329"></a><a class="code" href="classpumamod.html#a697a2f43424ec02c33ad0e069f60edd2">00329</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gtdamp(:,:) <span class="comment">! 3D reciprocal damping times [1/sec] </span>
  419. <a name="l00330"></a>00330 <span class="comment">! for relaxation in grid point space </span>
  420. <a name="l00331"></a>00331 <span class="comment">! for radiative restoration temperature </span>
  421. <a name="l00332"></a>00332 <span class="comment">! (e.g. for Held&amp;Suarez)</span>
  422. <a name="l00333"></a><a class="code" href="classpumamod.html#a550fb7dbedcb399eeee029f09e0261c7">00333</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gr1(:,:) <span class="comment">! constant radiative restoration time scale</span>
  423. <a name="l00334"></a><a class="code" href="classpumamod.html#acb504294dc512bdee020e63fcc43c51c">00334</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gr2(:,:) <span class="comment">! variable radiative restoration time scale</span>
  424. <a name="l00335"></a><a class="code" href="classpumamod.html#ab154b81faaea8224202d205d5377ecb5">00335</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gtdampc(:,:)<span class="comment">! the same as gtdamp, but for convective </span>
  425. <a name="l00336"></a>00336 <span class="comment">! restoration temperature</span>
  426. <a name="l00337"></a><a class="code" href="classpumamod.html#a3ad097353e5e4017c75dd08d77f374f3">00337</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gr1c(:,:) <span class="comment">! constant convective restoration time scale</span>
  427. <a name="l00338"></a><a class="code" href="classpumamod.html#a0063c8f28d68f19195b2154874bb4605">00338</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: gr2c(:,:) <span class="comment">! variable convective restoration time scale</span>
  428. <a name="l00339"></a>00339
  429. <a name="l00340"></a>00340 <span class="comment">! *********************</span>
  430. <a name="l00341"></a>00341 <span class="comment">! * Diagnostic Arrays *</span>
  431. <a name="l00342"></a>00342 <span class="comment">! *********************</span>
  432. <a name="l00343"></a>00343
  433. <a name="l00344"></a><a class="code" href="classpumamod.html#a8cd6f320c3166f241ade820dc3eadb39">00344</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: ndil(:) <span class="comment">! Set diagnostics level</span>
  434. <a name="l00345"></a>00345
  435. <a name="l00346"></a><a class="code" href="classpumamod.html#a9dbdc63a5f305db50a26a47cc34d00c7">00346</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: csu(:,:) <span class="comment">! Cross section u [m/s]</span>
  436. <a name="l00347"></a><a class="code" href="classpumamod.html#a3ab8cd6714b1bbb4233200b9acba2904">00347</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: csv(:,:) <span class="comment">! Cross section v [m/s]</span>
  437. <a name="l00348"></a><a class="code" href="classpumamod.html#aec021878423837a34bb3de710083412f">00348</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: cst(:,:) <span class="comment">! Cross section T [Celsius]</span>
  438. <a name="l00349"></a>00349
  439. <a name="l00350"></a><a class="code" href="classpumamod.html#aeea321b5684fff3240d0367b970bde23">00350</a> <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: denergy(:,:) <span class="comment">! energy diagnostics</span>
  440. <a name="l00351"></a><a class="code" href="classpumamod.html#a22d2a10d8b9f03d90130b1ccef2ec7c9">00351</a> <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: dentropy(:,:) <span class="comment">! entropy diagnostics</span>
  441. <a name="l00352"></a>00352
  442. <a name="l00353"></a>00353 <span class="comment">! *******************</span>
  443. <a name="l00354"></a>00354 <span class="comment">! * Latitude Arrays *</span>
  444. <a name="l00355"></a>00355 <span class="comment">! *******************</span>
  445. <a name="l00356"></a>00356
  446. <a name="l00357"></a>00357 <span class="keywordtype">character (3)</span>,<span class="keywordtype">allocatable</span> :: chlat(:) <span class="comment">! label for latitudes</span>
  447. <a name="l00358"></a>00358 <span class="keywordtype">real (kind=8)</span>,<span class="keywordtype">allocatable</span> :: sid(:) <span class="comment">! sin(phi)</span>
  448. <a name="l00359"></a>00359 <span class="keywordtype">real (kind=8)</span>,<span class="keywordtype">allocatable</span> :: gwd(:) <span class="comment">! Gaussian weight (phi)</span>
  449. <a name="l00360"></a><a class="code" href="classpumamod.html#a4577fee5af720d3d5cee446b6bd36d0c">00360</a> <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: csq(:) <span class="comment">! cos2(phi)</span>
  450. <a name="l00361"></a><a class="code" href="classpumamod.html#a121f56c4792fab7bbc57da6a356ba13f">00361</a> <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: rcs(:) <span class="comment">! 1/cos(phi)</span>
  451. <a name="l00362"></a>00362
  452. <a name="l00363"></a>00363 <span class="comment">! ****************</span>
  453. <a name="l00364"></a>00364 <span class="comment">! * Level Arrays *</span>
  454. <a name="l00365"></a>00365 <span class="comment">! ****************</span>
  455. <a name="l00366"></a>00366
  456. <a name="l00367"></a><a class="code" href="classpumamod.html#aa0e5d4127d9cbc662e69de401ab0878f">00367</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: t0(:) <span class="comment">! reference temperature</span>
  457. <a name="l00368"></a>00368 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: t0d(:) <span class="comment">! vertical t0 gradient</span>
  458. <a name="l00369"></a><a class="code" href="classpumamod.html#aa37496e277d03000616cdb2e5b22d7c0">00369</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: taur(:) <span class="comment">! tau R [days]</span>
  459. <a name="l00370"></a><a class="code" href="classpumamod.html#aaddf02e0bb890f2c703effae4cf26a68">00370</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: tauf(:) <span class="comment">! tau F [days]</span>
  460. <a name="l00371"></a><a class="code" href="classpumamod.html#a4c165b031088a68ae36d654a5763aef8">00371</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: damp(:) <span class="comment">! 1.0 / (2 Pi * taur)</span>
  461. <a name="l00372"></a><a class="code" href="classpumamod.html#a859085f4ee94ade9cc560157a833370e">00372</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: fric(:) <span class="comment">! 1.0 / (2 Pi * tauf )</span>
  462. <a name="l00373"></a>00373
  463. <a name="l00374"></a><a class="code" href="classpumamod.html#abc2d5c00d5e5856e8cbc8ed5bee74d11">00374</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: bm1(:,:,:)
  464. <a name="l00375"></a>00375 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: dsigma(:)
  465. <a name="l00376"></a>00376 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: rdsig(:)
  466. <a name="l00377"></a>00377 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sigma(:) <span class="comment">! full level sigma</span>
  467. <a name="l00378"></a><a class="code" href="classpumamod.html#aef4b93fe13f4ff77ca4ad9b9b5245918">00378</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: sigmh(:) <span class="comment">! half level sigma</span>
  468. <a name="l00379"></a>00379 <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: tkp(:)
  469. <a name="l00380"></a><a class="code" href="classpumamod.html#a273a105c71e26860f1f83ca28020bbda">00380</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: c(:,:)
  470. <a name="l00381"></a><a class="code" href="classpumamod.html#a0d93d94e3ecf78ee4c82020b9e1ee95f">00381</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: xlphi(:,:) <span class="comment">! matrix Lphi (g)</span>
  471. <a name="l00382"></a><a class="code" href="classpumamod.html#a2f42df0a3ac789b2cb6e996a00f16fb4">00382</a> <span class="keywordtype">real</span>, <span class="keywordtype">allocatable</span> :: xlt(:,:) <span class="comment">! matrix LT (tau)</span>
  472. <a name="l00383"></a>00383
  473. <a name="l00384"></a>00384 <span class="comment">! ******************</span>
  474. <a name="l00385"></a>00385 <span class="comment">! * Parallel Stuff *</span>
  475. <a name="l00386"></a>00386 <span class="comment">! ******************</span>
  476. <a name="l00387"></a>00387
  477. <a name="l00388"></a><a class="code" href="classpumamod.html#af617e09ab068329347fe45e390e46923">00388</a> <span class="keywordtype">integer</span> :: myworld = 0 <span class="comment">! MPI variable</span>
  478. <a name="l00389"></a><a class="code" href="classpumamod.html#a34212fc920287542d5b665298e229090">00389</a> <span class="keywordtype">integer</span> :: mpinfo = 0 <span class="comment">! MPI variable</span>
  479. <a name="l00390"></a><a class="code" href="classpumamod.html#abe37e4023fe000a8d7a8f39be8dd8354">00390</a> <span class="keywordtype">integer</span> :: mypid = 0 <span class="comment">! My Process Id</span>
  480. <a name="l00391"></a><a class="code" href="classpumamod.html#ab552a94bc8d5d3e4a56303ac4249b894">00391</a> <span class="keywordtype">real</span> :: tmstart = 0.0 <span class="comment">! CPU time at start</span>
  481. <a name="l00392"></a><a class="code" href="classpumamod.html#a6b2cc93bbb820f9aa438282188e75eef">00392</a> <span class="keywordtype">real</span> :: tmstop = 0.0 <span class="comment">! CPU time at stop</span>
  482. <a name="l00393"></a><a class="code" href="classpumamod.html#a0961a19034b2c5becab0fe77c8e767b6">00393</a> <span class="keywordtype">character(80)</span>, <span class="keywordtype">allocatable</span> :: ympname(:) <span class="comment">! Processor name</span>
  483. <a name="l00394"></a>00394
  484. <a name="l00395"></a>00395
  485. <a name="l00396"></a>00396 <span class="comment">! **********************</span>
  486. <a name="l00397"></a>00397 <span class="comment">! * Multirun variables *</span>
  487. <a name="l00398"></a>00398 <span class="comment">! **********************</span>
  488. <a name="l00399"></a>00399
  489. <a name="l00400"></a><a class="code" href="classpumamod.html#afdffea792867b992f5d1d117bea912e9">00400</a> <span class="keywordtype">integer</span> :: mrworld = 0 <span class="comment">! MPI communication</span>
  490. <a name="l00401"></a><a class="code" href="classpumamod.html#a52d0e34b3a5be19fc3b8d0f11cae3cd2">00401</a> <span class="keywordtype">integer</span> :: mrinfo = 0 <span class="comment">! MPI info</span>
  491. <a name="l00402"></a><a class="code" href="classpumamod.html#a7243d78ff49021834f74c4f372747e25">00402</a> <span class="keywordtype">integer</span> :: mrpid = -1 <span class="comment">! MPI instance id</span>
  492. <a name="l00403"></a><a class="code" href="classpumamod.html#aca86db6e1c10c1b9517477ce5edbe883">00403</a> <span class="keywordtype">integer</span> :: mrnum = 0 <span class="comment">! MPI number of instances</span>
  493. <a name="l00404"></a><a class="code" href="classpumamod.html#af045ac8932ed34ae0d921a49d9696202">00404</a> <span class="keywordtype">integer</span> :: mintru = 0 <span class="comment">! Lowest resolution of all instances</span>
  494. <a name="l00405"></a><a class="code" href="classpumamod.html#adefb6afc38014b7c141a67f0036bb9fd">00405</a> <span class="keywordtype">integer</span> :: mrdim = 0 <span class="comment">! Exchange dimension (min. NRSP)</span>
  495. <a name="l00406"></a>00406 <span class="keywordtype">integer</span> :: nsync = 0 <span class="comment">! Synchronization on or off</span>
  496. <a name="l00407"></a><a class="code" href="classpumamod.html#a6f3661b2cfef35aad460858a54bac179">00407</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: mrtru(:) <span class="comment">! Truncations of members</span>
  497. <a name="l00408"></a>00408
  498. <a name="l00409"></a>00409 <span class="keywordtype">real</span> :: syncstr = 0.0 <span class="comment">! Coupling strength (0 .. 1)</span>
  499. <a name="l00410"></a><a class="code" href="classpumamod.html#a24c3f399235c4ea5f2d8e1f867f8776d">00410</a> <span class="keywordtype">real</span> :: synctime = 0.0 <span class="comment">! Coupling time [days]</span>
  500. <a name="l00411"></a>00411
  501. <a name="l00412"></a>00412 <span class="comment">! ******************************************</span>
  502. <a name="l00413"></a>00413 <span class="comment">! * GUI (Graphical User Interface for X11) *</span>
  503. <a name="l00414"></a>00414 <span class="comment">! ******************************************</span>
  504. <a name="l00415"></a>00415
  505. <a name="l00416"></a>00416 parameter (NPARCS = 10) <span class="comment">! Number of GUI parameters</span>
  506. <a name="l00417"></a>00417 <span class="keywordtype">integer</span> :: nguidbg = 0 <span class="comment">! Flag for GUI debug output</span>
  507. <a name="l00418"></a><a class="code" href="classpumamod.html#a55d8354fd0488524eb882076f145db4c">00418</a> <span class="keywordtype">integer</span> :: nshutdown = 0 <span class="comment">! Flag for shutdown request</span>
  508. <a name="l00419"></a><a class="code" href="classpumamod.html#ae562873ebeeb138df379c847e7e01ee4">00419</a> <span class="keywordtype">integer</span> :: ndatim(6) = -1 <span class="comment">! Date &amp; time array</span>
  509. <a name="l00420"></a><a class="code" href="classpumamod.html#ae2c4727393fa343e9b1bc8a3c74aaadc">00420</a> <span class="keywordtype">real(kind=4)</span> :: parc(NPARCS) <span class="comment">! Values of GUI parameters</span>
  510. <a name="l00421"></a><a class="code" href="classpumamod.html#ade587d2c84caf94c7f54e8d358d42455">00421</a> <span class="keywordtype">real(kind=4)</span> :: crap(NPARCS) <span class="comment">! Backup of parc(NPARCS)</span>
  511. <a name="l00422"></a><a class="code" href="classpumamod.html#ad6ef8c9bbafbe30d455ecbedd0091142">00422</a> <span class="keywordtype">logical</span> :: ldtep = .FALSE. <span class="comment">! DTEP changed by GUI</span>
  512. <a name="l00423"></a><a class="code" href="classpumamod.html#ad987421134978995be7290187c82fda2">00423</a> <span class="keywordtype">logical</span> :: ldtns = .FALSE. <span class="comment">! DTNS changed by GUI</span>
  513. <a name="l00424"></a><a class="code" href="classpumamod.html#a903a55d5d849abb77aa4ccb8534add13">00424</a> <span class="keywordtype">character(len=32)</span> :: yplanet = <span class="stringliteral">&quot;Earth&quot;</span>
  514. <a name="l00425"></a>00425
  515. <a name="l00426"></a>00426 <span class="comment">! ***************</span>
  516. <a name="l00427"></a>00427 <span class="comment">! * Random seed *</span>
  517. <a name="l00428"></a>00428 <span class="comment">! ***************</span>
  518. <a name="l00429"></a>00429
  519. <a name="l00430"></a><a class="code" href="classpumamod.html#a79c75848ef94fd2ff5e362ea59c98cbe">00430</a> <span class="keywordtype">integer</span> :: seed(8) = 0 <span class="comment">! settable in namelist</span>
  520. <a name="l00431"></a><a class="code" href="classpumamod.html#a1909f4521ecd22aa8e00db6e17c10ad9">00431</a> <span class="keywordtype">integer</span>, <span class="keywordtype">allocatable</span> :: meed(:) <span class="comment">! machine dependent seed</span>
  521. <a name="l00432"></a><a class="code" href="classpumamod.html#a936da81a07a9bfa83bea326d29f5a5d9">00432</a> <span class="keywordtype">real</span> :: ganext = 0.0<span class="comment">! y part of gaussian noise</span>
  522. <a name="l00433"></a>00433
  523. <a name="l00434"></a>00434 <span class="keyword">end module pumamod</span>
  524. <a name="l00435"></a>00435
  525. <a name="l00436"></a>00436 <span class="comment">!***************!</span>
  526. <a name="l00437"></a>00437 <span class="comment">! MODULE RADMOD !</span>
  527. <a name="l00438"></a>00438 <span class="comment">!***************!</span>
  528. <a name="l00439"></a>00439
  529. <a name="l00440"></a><a class="code" href="classradmod.html">00440</a> <span class="keyword">module</span> <a class="code" href="classradmod.html">radmod</a> <span class="comment">! Dummy declaration for compatibility</span>
  530. <a name="l00441"></a>00441 use <span class="keywordflow">pumamod</span> <span class="comment">! with PLASIM (needed in guimod)</span>
  531. <a name="l00442"></a>00442 <span class="keyword">end module radmod</span>
  532. <a name="l00443"></a>00443
  533. <a name="l00444"></a>00444
  534. <a name="l00445"></a>00445 <span class="comment">! ***************** !</span>
  535. <a name="l00446"></a>00446 <span class="comment">! * MODULE PPPMOD * !</span>
  536. <a name="l00447"></a>00447 <span class="comment">! ***************** !</span>
  537. <a name="l00448"></a>00448
  538. <a name="l00449"></a><a class="code" href="classprepmod.html">00449</a> <span class="keyword">module</span> <a class="code" href="classprepmod.html">prepmod</a>
  539. <a name="l00450"></a><a class="code" href="classprepmod.html#af7c26e3eb6ac74ce7f869f994f3f9096">00450</a> <span class="keywordtype">integer</span> :: num_ppp = 0
  540. <a name="l00451"></a><a class="code" href="classprepmod.html#ab9f52241ed0e8b24728713f99adbef26">00451</a> <span class="keywordtype">integer</span> :: nlat_ppp = 0
  541. <a name="l00452"></a><a class="code" href="classprepmod.html#ab4424b6e9966133154f2c7521b4f20c7">00452</a> <span class="keywordtype">integer</span> :: nlev_ppp = 0
  542. <a name="l00453"></a>00453
  543. <a name="l00454"></a><a class="code" href="structprepmod_1_1ppp__type.html">00454</a> <span class="keyword">type</span> <a class="code" href="structprepmod_1_1ppp__type.html">ppp_type</a>
  544. <a name="l00455"></a><a class="code" href="structprepmod_1_1ppp__type.html#ab9ad26f6cbb64570cc4171b5bb1ad15e">00455</a> <span class="keywordtype">character (80)</span> :: name <span class="comment">! name of variable or array</span>
  545. <a name="l00456"></a><a class="code" href="structprepmod_1_1ppp__type.html#a50ade2f5ae307f4416d1c41fc74ea2f0">00456</a> <span class="keywordtype">logical</span> :: isint <span class="comment">! .true. for integer</span>
  546. <a name="l00457"></a><a class="code" href="structprepmod_1_1ppp__type.html#ad89d33651c91bc5a6594a9522916f4c7">00457</a> <span class="keywordtype">integer</span> :: n <span class="comment">! length of vector (1 for scalar)</span>
  547. <a name="l00458"></a><a class="code" href="structprepmod_1_1ppp__type.html#a4e5bc8c49dff8e4b1dff9722c55e3b43">00458</a> <span class="keywordtype">integer</span>, <span class="keywordtype">pointer</span> :: pint <span class="comment">! pointer to integer value or array</span>
  548. <a name="l00459"></a><a class="code" href="structprepmod_1_1ppp__type.html#a98966af6cabcf5a13a3ef4fab52de965">00459</a> <span class="keywordtype">real</span> , <span class="keywordtype">pointer</span> :: preal <span class="comment">! pointer to real value or array</span>
  549. <a name="l00460"></a>00460 <span class="keyword">end type ppp_type</span>
  550. <a name="l00461"></a>00461
  551. <a name="l00462"></a><a class="code" href="classprepmod.html#afa7847e6f1a2a1e05e5318e9ec47ad51">00462</a> <span class="keywordtype">type(ppp_type)</span> :: ppp_tab(30)
  552. <a name="l00463"></a>00463
  553. <a name="l00464"></a>00464 <span class="keyword">interface</span>
  554. <a name="l00465"></a><a class="code" href="interfaceprepmod_1_1ppp__def__int.html#af7c4b83a645bb166b51a24e0844c8c0e">00465</a> <span class="keyword">subroutine </span><a class="code" href="interfaceprepmod_1_1ppp__def__int.html">ppp_def_int</a>(pname,nvar,ndim)
  555. <a name="l00466"></a>00466 <span class="keywordtype">character (*)</span> :: pname
  556. <a name="l00467"></a>00467 <span class="keywordtype">integer</span>, <span class="keywordtype">target</span> :: nvar
  557. <a name="l00468"></a>00468 <span class="keywordtype">integer</span> :: ndim
  558. <a name="l00469"></a>00469 <span class="keyword"> end subroutine ppp_def_int</span>
  559. <a name="l00470"></a><a class="code" href="interfaceprepmod_1_1ppp__def__real.html#a9a526e7c4c29459fbd3f636f64f85b1f">00470</a> <span class="keyword">subroutine </span><a class="code" href="interfaceprepmod_1_1ppp__def__real.html">ppp_def_real</a>(pname,rvar,ndim)
  560. <a name="l00471"></a>00471 <span class="keywordtype">character (*)</span> :: pname
  561. <a name="l00472"></a>00472 <span class="keywordtype">real</span> , <span class="keywordtype">target</span> :: rvar(*)
  562. <a name="l00473"></a>00473 <span class="keywordtype">integer</span> :: ndim
  563. <a name="l00474"></a>00474 <span class="keyword"> end subroutine ppp_def_real</span>
  564. <a name="l00475"></a>00475 <span class="keyword">end interface</span>
  565. <a name="l00476"></a>00476
  566. <a name="l00477"></a>00477 <span class="keyword">end module prepmod</span>
  567. <a name="l00478"></a>00478
  568. <a name="l00479"></a>00479
  569. <a name="l00480"></a>00480 <span class="comment">! *********************</span>
  570. <a name="l00481"></a>00481 <span class="comment">! * PROGRAM PUMA_MAIN *</span>
  571. <a name="l00482"></a>00482 <span class="comment">! *********************</span>
  572. <a name="l00483"></a>00483
  573. <a name="l00484"></a><a class="code" href="puma_8f90.html#ab9b07e4288c177e089731e7560c18ac1">00484</a> <span class="keyword">program</span> <a class="code" href="puma_8f90.html#ab9b07e4288c177e089731e7560c18ac1">puma_main</a>
  574. <a name="l00485"></a>00485 use <span class="keywordflow">pumamod</span>
  575. <a name="l00486"></a>00486
  576. <a name="l00487"></a>00487 <span class="comment">! ***********</span>
  577. <a name="l00488"></a>00488 <span class="comment">! * History *</span>
  578. <a name="l00489"></a>00489 <span class="comment">! ***********</span>
  579. <a name="l00490"></a>00490
  580. <a name="l00491"></a>00491 <span class="comment">! 1972 - W. Bourke:</span>
  581. <a name="l00492"></a>00492 <span class="comment">! An efficient one-level primitive equation spectral model</span>
  582. <a name="l00493"></a>00493 <span class="comment">! Mon. Weath. Rev., 100, pp. 683-689</span>
  583. <a name="l00494"></a>00494
  584. <a name="l00495"></a>00495 <span class="comment">! 1975 - B.J. Hoskins and A.J. Simmons: </span>
  585. <a name="l00496"></a>00496 <span class="comment">! A multi-layer spectral model and the semi-implicit method</span>
  586. <a name="l00497"></a>00497 <span class="comment">! Qart. J. R. Met. Soc., 101, pp. 637-655</span>
  587. <a name="l00498"></a>00498
  588. <a name="l00499"></a>00499 <span class="comment">! 1993 - I.N. James and J.P. Dodd:</span>
  589. <a name="l00500"></a>00500 <span class="comment">! A Simplified Global Circulation Model</span>
  590. <a name="l00501"></a>00501 <span class="comment">! Users&#39; Manual, Dept. of Meteorology, University of Reading</span>
  591. <a name="l00502"></a>00502
  592. <a name="l00503"></a>00503 <span class="comment">! 1998 - Klaus Fraedrich, Edilbert Kirk, Frank Lunkeit</span>
  593. <a name="l00504"></a>00504 <span class="comment">! Portable University Model of the Atmosphere</span>
  594. <a name="l00505"></a>00505 <span class="comment">! DKRZ Technical Report No. 16</span>
  595. <a name="l00506"></a>00506
  596. <a name="l00507"></a>00507 <span class="comment">! 2009 - PUMA Version 16.0</span>
  597. <a name="l00508"></a>00508 <span class="comment">! http://www.mi.uni-hamburg.de/puma</span>
  598. <a name="l00509"></a>00509
  599. <a name="l00510"></a>00510 <span class="comment">! ******************</span>
  600. <a name="l00511"></a>00511 <span class="comment">! * Recent Changes *</span>
  601. <a name="l00512"></a>00512 <span class="comment">! ******************</span>
  602. <a name="l00513"></a>00513
  603. <a name="l00514"></a>00514 <span class="comment">! 10-Jun-2002 - Puma Workshop - Documentation of subroutine SPECTRAL</span>
  604. <a name="l00515"></a>00515 <span class="comment">! 04-Jul-2002 - Frank Lunkeit - Annual cycle</span>
  605. <a name="l00516"></a>00516 <span class="comment">! 08-Jul-2002 - Edilbert Kirk - Factor for rotation speed</span>
  606. <a name="l00517"></a>00517 <span class="comment">! 25-Sep-2002 - Puma Workshop - Documentation of subroutine CALCGP</span>
  607. <a name="l00518"></a>00518 <span class="comment">! 11-Nov-2002 - Edilbert Kirk - Add Orography to output file</span>
  608. <a name="l00519"></a>00519 <span class="comment">! 26-Feb-2003 - Edilbert Kirk - Read preprocessed initial file</span>
  609. <a name="l00520"></a>00520 <span class="comment">! 07-Sep-2004 - Edilbert Kirk - Graphical User Interface</span>
  610. <a name="l00521"></a>00521 <span class="comment">! 23-Aug-2006 - Torben Kunz - Held &amp; Suarez forcing</span>
  611. <a name="l00522"></a>00522 <span class="comment">! 23-Aug-2006 - Torben Kunz - new spacing schemes of sigma levels</span>
  612. <a name="l00523"></a>00523 <span class="comment">! 23-Aug-2006 - Edilbert Kirk - individual selection of zonal waves</span>
  613. <a name="l00524"></a>00524 <span class="comment">! 23-Aug-2006 - Edilbert Kirk - optimized Legendre trasnformation module</span>
  614. <a name="l00525"></a>00525 <span class="comment">! 19-Feb-2007 - Edilbert Kirk - new flexible restart I/O</span>
  615. <a name="l00526"></a>00526 <span class="comment">! 15-Sep-2009 - Edilbert Kirk - static arrays replaced by allocatable</span>
  616. <a name="l00527"></a>00527 <span class="comment">! 15-Sep-2009 - Frank Lunkeit - diagnostics for entropy production</span>
  617. <a name="l00528"></a>00528 <span class="comment">! 27-Sep-2010 - Edilbert Kirk - cleaned up ruido routines</span>
  618. <a name="l00529"></a>00529
  619. <a name="l00530"></a>00530 call <a class="code" href="mpimod_8f90.html#a41bbd9334a3d0412c73399d699bbb237">mpstart</a>
  620. <a name="l00531"></a>00531 call <a class="code" href="puma_8f90.html#a37eac16619683a2be841fc68b9281299">setfilenames</a>
  621. <a name="l00532"></a>00532 call <a class="code" href="puma_8f90.html#ab7757291a70ca39d0c7a7e8db515c058">opendiag</a>
  622. <a name="l00533"></a>00533 call <a class="code" href="puma_8f90.html#a811c67568d6f12806d6b6f86813d2bc4">read_resolution</a>
  623. <a name="l00534"></a>00534 call <a class="code" href="ppp_8f90.html#a0952e51b37b6196b4f5d85a5cb93c75b">resolution</a>
  624. <a name="l00535"></a>00535 <span class="keyword">if</span> (mrnum == 2) <span class="keyword">then</span>
  625. <a name="l00536"></a>00536 call <a class="code" href="mpimod_8f90.html#acb4a2403b5f65a70e7e5ff01ea4577f7">mrdimensions</a>
  626. <a name="l00537"></a>00537 <span class="keyword">endif</span>
  627. <a name="l00538"></a>00538 call <a class="code" href="ppp_8f90.html#a486bae2289e6e28e652b41555030d3e6">allocate_arrays</a>
  628. <a name="l00539"></a>00539 call <a class="code" href="ppp_8f90.html#afde378004f20ed8741a7e9bcd82cbfe4">prolog</a>
  629. <a name="l00540"></a>00540 call <a class="code" href="puma_8f90.html#af02944c9cc5103c31e4ed9b779e7cc79">master</a>
  630. <a name="l00541"></a>00541 call <a class="code" href="puma_8f90.html#a35d7c22447dc50ab86832b4615994d32">epilog</a>
  631. <a name="l00542"></a>00542 call <a class="code" href="guimod_8f90.html#ad58ecd458338fd5891f0838eda94bb0c">guistop</a>
  632. <a name="l00543"></a>00543 call <a class="code" href="mpimod_8f90.html#ac80e83b9bc0a4b459fed5f3b79cfafa0">mpstop</a>
  633. <a name="l00544"></a>00544 stop
  634. <a name="l00545"></a>00545 <span class="keyword">end program puma_main</span>
  635. <a name="l00546"></a>00546
  636. <a name="l00547"></a>00547
  637. <a name="l00548"></a>00548 <span class="comment">! ***************************</span>
  638. <a name="l00549"></a>00549 <span class="comment">! * SUBROUTINE SETFILENAMES *</span>
  639. <a name="l00550"></a>00550 <span class="comment">! ***************************</span>
  640. <a name="l00551"></a>00551
  641. <a name="l00552"></a><a class="code" href="puma_8f90.html#a37eac16619683a2be841fc68b9281299">00552</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a37eac16619683a2be841fc68b9281299">setfilenames</a>
  642. <a name="l00553"></a>00553 use <span class="keywordflow">pumamod</span>
  643. <a name="l00554"></a>00554
  644. <a name="l00555"></a>00555 <span class="keywordtype">character (3)</span> :: mrext
  645. <a name="l00556"></a>00556
  646. <a name="l00557"></a>00557 <span class="keyword">if</span> (mrpid &lt; 0) return <span class="comment">! no multirun</span>
  647. <a name="l00558"></a>00558
  648. <a name="l00559"></a>00559 <span class="keyword">write</span>(mrext,<span class="stringliteral">&#39;(&quot;_&quot;,i2.2)&#39;</span>) mrpid
  649. <a name="l00560"></a>00560
  650. <a name="l00561"></a>00561 puma_namelist = trim(puma_namelist ) // mrext
  651. <a name="l00562"></a>00562 puma_output = trim(puma_output ) // mrext
  652. <a name="l00563"></a>00563 puma_diag = trim(puma_diag ) // mrext
  653. <a name="l00564"></a>00564 puma_restart = trim(puma_restart ) // mrext
  654. <a name="l00565"></a>00565 puma_status = trim(puma_status ) // mrext
  655. <a name="l00566"></a>00566 efficiency_dat = trim(efficiency_dat ) // mrext
  656. <a name="l00567"></a>00567 ppp_puma_txt = trim(ppp_puma_txt ) // mrext
  657. <a name="l00568"></a>00568 puma_sp_init = trim(puma_sp_init ) // mrext
  658. <a name="l00569"></a>00569
  659. <a name="l00570"></a>00570 return
  660. <a name="l00571"></a>00571 <span class="keyword">end</span>
  661. <a name="l00572"></a>00572
  662. <a name="l00573"></a>00573
  663. <a name="l00574"></a>00574 <span class="comment">! ***********************</span>
  664. <a name="l00575"></a>00575 <span class="comment">! * SUBROUTINE OPENDIAG *</span>
  665. <a name="l00576"></a>00576 <span class="comment">! ***********************</span>
  666. <a name="l00577"></a>00577
  667. <a name="l00578"></a><a class="code" href="puma_8f90.html#ab7757291a70ca39d0c7a7e8db515c058">00578</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ab7757291a70ca39d0c7a7e8db515c058">opendiag</a>
  668. <a name="l00579"></a>00579 use <span class="keywordflow">pumamod</span>
  669. <a name="l00580"></a>00580
  670. <a name="l00581"></a>00581 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  671. <a name="l00582"></a>00582 <span class="keyword">open</span>(nud,file=puma_diag)
  672. <a name="l00583"></a>00583 <span class="keyword">endif</span>
  673. <a name="l00584"></a>00584
  674. <a name="l00585"></a>00585 return
  675. <a name="l00586"></a>00586 <span class="keyword">end</span>
  676. <a name="l00587"></a>00587
  677. <a name="l00588"></a>00588
  678. <a name="l00589"></a>00589 <span class="comment">! ******************************</span>
  679. <a name="l00590"></a>00590 <span class="comment">! * SUBROUTINE ALLOCATE_ARRAYS *</span>
  680. <a name="l00591"></a>00591 <span class="comment">! ******************************</span>
  681. <a name="l00592"></a>00592
  682. <a name="l00593"></a><a class="code" href="puma_8f90.html#a486bae2289e6e28e652b41555030d3e6">00593</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a486bae2289e6e28e652b41555030d3e6">allocate_arrays</a>
  683. <a name="l00594"></a>00594 use <span class="keywordflow">pumamod</span>
  684. <a name="l00595"></a>00595
  685. <a name="l00596"></a>00596 <span class="keyword">allocate</span>(sd(nesp,nlev)) ; sd(:,:) = 0.0 <span class="comment">! Spectral Divergence</span>
  686. <a name="l00597"></a>00597 <span class="keyword">allocate</span>(st(nesp,nlev)) ; st(:,:) = 0.0 <span class="comment">! Spectral Temperature</span>
  687. <a name="l00598"></a>00598 <span class="keyword">allocate</span>(sz(nesp,nlev)) ; sz(:,:) = 0.0 <span class="comment">! Spectral Vorticity</span>
  688. <a name="l00599"></a>00599 <span class="keyword">allocate</span>(sp(nesp)) ; sp(:) = 0.0 <span class="comment">! Spectral Pressure (ln Ps)</span>
  689. <a name="l00600"></a>00600 <span class="keyword">allocate</span>(so(nesp)) ; so(:) = 0.0 <span class="comment">! Spectral Orography</span>
  690. <a name="l00601"></a>00601 <span class="keyword">allocate</span>(sr1(nesp,nlev)) ; sr1(:,:) = 0.0 <span class="comment">! Spectral Restoration Temperature</span>
  691. <a name="l00602"></a>00602 <span class="keyword">allocate</span>(sr2(nesp,nlev)) ; sr2(:,:) = 0.0 <span class="comment">! Spectral Restoration Temperature</span>
  692. <a name="l00603"></a>00603 <span class="keyword">allocate</span>(sdp(nspp,nlev)) ; sdp(:,:) = 0.0 <span class="comment">! Spectral Divergence Partial</span>
  693. <a name="l00604"></a>00604 <span class="keyword">allocate</span>(stp(nspp,nlev)) ; stp(:,:) = 0.0 <span class="comment">! Spectral Temperature Partial</span>
  694. <a name="l00605"></a>00605 <span class="keyword">allocate</span>(szp(nspp,nlev)) ; szp(:,:) = 0.0 <span class="comment">! Spectral Vorticity Partial</span>
  695. <a name="l00606"></a>00606 <span class="keyword">allocate</span>(spp(nspp)) ; spp(:) = 0.0 <span class="comment">! Spectral Pressure Partial</span>
  696. <a name="l00607"></a>00607 <span class="keyword">allocate</span>(sop(nspp)) ; sop(:) = 0.0 <span class="comment">! Spectral Orography Partial</span>
  697. <a name="l00608"></a>00608 <span class="keyword">allocate</span>(srp1(nspp,nlev)) ; srp1(:,:)= 0.0 <span class="comment">! Spectral Restoration Partial</span>
  698. <a name="l00609"></a>00609 <span class="keyword">allocate</span>(srp2(nspp,nlev)) ; srp2(:,:)= 0.0 <span class="comment">! Spectral Restoration Partial</span>
  699. <a name="l00610"></a>00610 <span class="keyword">allocate</span>(sdt(nspp,nlev)) ; sdt(:,:) = 0.0 <span class="comment">! Spectral Divergence Tendency</span>
  700. <a name="l00611"></a>00611 <span class="keyword">allocate</span>(stt(nspp,nlev)) ; stt(:,:) = 0.0 <span class="comment">! Spectral Temperature Tendency</span>
  701. <a name="l00612"></a>00612 <span class="keyword">allocate</span>(szt(nspp,nlev)) ; szt(:,:) = 0.0 <span class="comment">! Spectral Vorticity Tendency</span>
  702. <a name="l00613"></a>00613 <span class="keyword">allocate</span>(spt(nspp)) ; spt(:) = 0.0 <span class="comment">! Spectral Pressure Tendency</span>
  703. <a name="l00614"></a>00614 <span class="keyword">allocate</span>(sdm(nspp,nlev)) ; sdm(:,:) = 0.0 <span class="comment">! Spectral Divergence Minus</span>
  704. <a name="l00615"></a>00615 <span class="keyword">allocate</span>(stm(nspp,nlev)) ; stm(:,:) = 0.0 <span class="comment">! Spectral Temperature Minus</span>
  705. <a name="l00616"></a>00616 <span class="keyword">allocate</span>(szm(nspp,nlev)) ; szm(:,:) = 0.0 <span class="comment">! Spectral Vorticity Minus</span>
  706. <a name="l00617"></a>00617 <span class="keyword">allocate</span>(spm(nspp)) ; spm(:) = 0.0 <span class="comment">! Spectral Pressure Minus</span>
  707. <a name="l00618"></a>00618 <span class="keyword">allocate</span>(sak(nesp)) ; sak(:) = 0.0 <span class="comment">! Hyper diffusion</span>
  708. <a name="l00619"></a>00619 <span class="keyword">allocate</span>(srcn(nesp)) ; srcn(:) = 0.0 <span class="comment">! 1.0 / (n * (n+1))</span>
  709. <a name="l00620"></a>00620 <span class="keyword">allocate</span>(span(nesp)) ; span(:) = 0.0 <span class="comment">! Pressure for diagnostics</span>
  710. <a name="l00621"></a>00621 <span class="keyword">allocate</span>(spnorm(nesp)) ; spnorm(:)= 0.0 <span class="comment">! Factors for output normalization</span>
  711. <a name="l00622"></a>00622
  712. <a name="l00623"></a>00623 <span class="keyword">allocate</span>(nindex(nesp)) ; nindex(:) = ntru <span class="comment">! Holds wavenumber</span>
  713. <a name="l00624"></a>00624 <span class="keyword">allocate</span>(nscatsp(npro)) ; nscatsp(:) = nspp <span class="comment">! Used for reduce_scatter op</span>
  714. <a name="l00625"></a>00625 <span class="keyword">allocate</span>(nselzw(0:ntru)) ; nselzw(:) = 1 <span class="comment">! Enable selected zonal waves</span>
  715. <a name="l00626"></a>00626 <span class="keyword">allocate</span>(nselsp(ncsp)) ; nselsp(:) = 1 <span class="comment">! Enable slected spectral modes</span>
  716. <a name="l00627"></a>00627
  717. <a name="l00628"></a>00628 <span class="keyword">allocate</span>(gd(nhor,nlev)) ; gd(:,:) = 0.0 <span class="comment">! Divergence</span>
  718. <a name="l00629"></a>00629 <span class="keyword">allocate</span>(gt(nhor,nlev)) ; gt(:,:) = 0.0 <span class="comment">! Temperature</span>
  719. <a name="l00630"></a>00630 <span class="keyword">allocate</span>(gz(nhor,nlev)) ; gz(:,:) = 0.0 <span class="comment">! Vorticity</span>
  720. <a name="l00631"></a>00631 <span class="keyword">allocate</span>(gu(nhor,nlev)) ; gu(:,:) = 0.0 <span class="comment">! u * cos(phi)</span>
  721. <a name="l00632"></a>00632 <span class="keyword">allocate</span>(gv(nhor,nlev)) ; gv(:,:) = 0.0 <span class="comment">! v * sin(phi)</span>
  722. <a name="l00633"></a>00633 <span class="keyword">allocate</span>(gp(nhor)) ; gp(:) = 0.0 <span class="comment">! Ln(Ps)</span>
  723. <a name="l00634"></a>00634 <span class="keyword">allocate</span>(gfu(nhor,nlev)) ; gfu(:,:) = 0.0 <span class="comment">! Term Fu in Primitive Equations</span>
  724. <a name="l00635"></a>00635 <span class="keyword">allocate</span>(gfv(nhor,nlev)) ; gfv(:,:) = 0.0 <span class="comment">! Term Fv in Primitive Equations</span>
  725. <a name="l00636"></a>00636 <span class="keyword">allocate</span>(gut(nhor,nlev)) ; gut(:,:) = 0.0 <span class="comment">! Term u * T</span>
  726. <a name="l00637"></a>00637 <span class="keyword">allocate</span>(gvt(nhor,nlev)) ; gvt(:,:) = 0.0 <span class="comment">! Term v * T</span>
  727. <a name="l00638"></a>00638 <span class="keyword">allocate</span>(gke(nhor,nlev)) ; gke(:,:) = 0.0 <span class="comment">! Kinetic energy u * u + v * v</span>
  728. <a name="l00639"></a>00639 <span class="keyword">allocate</span>(gpj(nhor)) ; gpj(:) = 0.0 <span class="comment">! d(Ln(Ps)) / d(mu)</span>
  729. <a name="l00640"></a>00640
  730. <a name="l00641"></a>00641
  731. <a name="l00642"></a>00642 <span class="keyword">allocate</span>(rcsq(nhor)) ; rcsq(:) = 0.0 <span class="comment">! 1 / cos2(phi)</span>
  732. <a name="l00643"></a>00643
  733. <a name="l00644"></a>00644 <span class="keyword">allocate</span>(ndil(nlev)) ; ndil(:) = 0
  734. <a name="l00645"></a>00645 <span class="keyword">allocate</span>(csu(nlat,nlev)) ; csu(:,:) = 0.0
  735. <a name="l00646"></a>00646 <span class="keyword">allocate</span>(csv(nlat,nlev)) ; csv(:,:) = 0.0
  736. <a name="l00647"></a>00647 <span class="keyword">allocate</span>(cst(nlat,nlev)) ; cst(:,:) = 0.0
  737. <a name="l00648"></a>00648
  738. <a name="l00649"></a>00649 <span class="keyword">allocate</span>(chlat(nlat)) ; chlat(:) = <span class="stringliteral">&#39; &#39;</span>
  739. <a name="l00650"></a>00650 <span class="keyword">allocate</span>(sid(nlat)) ; sid(:) = 0.0 <span class="comment">! sin(phi)</span>
  740. <a name="l00651"></a>00651 <span class="keyword">allocate</span>(gwd(nlat)) ; gwd(:) = 0.0 <span class="comment">! Gaussian weight (phi)</span>
  741. <a name="l00652"></a>00652 <span class="keyword">allocate</span>(csq(nlat)) ; csq(:) = 0.0 <span class="comment">! cos2(phi)</span>
  742. <a name="l00653"></a>00653 <span class="keyword">allocate</span>(rcs(nlat)) ; rcs(:) = 0.0 <span class="comment">! 1/cos(phi)</span>
  743. <a name="l00654"></a>00654
  744. <a name="l00655"></a>00655 <span class="keyword">allocate</span>(t0(nlev)) ; t0(:) = 250.0 <span class="comment">! reference temperature</span>
  745. <a name="l00656"></a>00656 <span class="keyword">allocate</span>(t0d(nlev)) ; t0d(:) = 0.0 <span class="comment">! vertical t0 gradient</span>
  746. <a name="l00657"></a>00657 <span class="keyword">allocate</span>(taur(nlev)) ; taur(:) = 0.0 <span class="comment">! tau R [days]</span>
  747. <a name="l00658"></a>00658 <span class="keyword">allocate</span>(tauf(nlev)) ; tauf(:) = 0.0 <span class="comment">! tau F [days]</span>
  748. <a name="l00659"></a>00659 <span class="keyword">allocate</span>(damp(nlev)) ; damp(:) = 0.0 <span class="comment">! 1.0 / (2 Pi * taur)</span>
  749. <a name="l00660"></a>00660 <span class="keyword">allocate</span>(fric(nlev)) ; fric(:) = 0.0 <span class="comment">! 1.0 / (2 Pi * tauf )</span>
  750. <a name="l00661"></a>00661 <span class="keyword">allocate</span>(dsigma(nlev)) ; dsigma(:) = 0.0
  751. <a name="l00662"></a>00662 <span class="keyword">allocate</span>(rdsig(nlev)) ; rdsig(:) = 0.0
  752. <a name="l00663"></a>00663 <span class="keyword">allocate</span>(sigma(nlev)) ; sigma(:) = 0.0
  753. <a name="l00664"></a>00664 <span class="keyword">allocate</span>(sigmh(nlev)) ; sigmh(:) = 0.0
  754. <a name="l00665"></a>00665 <span class="keyword">allocate</span>(tkp(nlev)) ; tkp(:) = 0.0
  755. <a name="l00666"></a>00666 <span class="keyword">allocate</span>(c(nlev,nlev)) ; c(:,:) = 0.0
  756. <a name="l00667"></a>00667 <span class="keyword">allocate</span>(xlphi(nlev,nlev)) ; xlphi(:,:) = 0.0 <span class="comment">! matrix Lphi (g)</span>
  757. <a name="l00668"></a>00668 <span class="keyword">allocate</span>(xlt(nlev,nlev)) ; xlt(:,:) = 0.0 <span class="comment">! matrix LT (tau)</span>
  758. <a name="l00669"></a>00669 <span class="keyword">allocate</span>(bm1(nlev,nlev,0:NTRU)) ; bm1(:,:,:) = 0.0
  759. <a name="l00670"></a>00670
  760. <a name="l00671"></a>00671 <span class="keyword">if</span> (mrnum == 2) <span class="keyword">then</span>
  761. <a name="l00672"></a>00672 <span class="keyword">allocate</span>(sdd(nesp,nlev)) ; sdd(:,:) = 0.0
  762. <a name="l00673"></a>00673 <span class="keyword">allocate</span>(std(nesp,nlev)) ; std(:,:) = 0.0
  763. <a name="l00674"></a>00674 <span class="keyword">allocate</span>(szd(nesp,nlev)) ; szd(:,:) = 0.0
  764. <a name="l00675"></a>00675 <span class="keyword">allocate</span>(spd(nesp )) ; spd(: ) = 0.0
  765. <a name="l00676"></a>00676 <span class="keyword">endif</span>
  766. <a name="l00677"></a>00677
  767. <a name="l00678"></a>00678 return
  768. <a name="l00679"></a>00679 <span class="keyword">end subroutine allocate_arrays</span>
  769. <a name="l00680"></a>00680
  770. <a name="l00681"></a>00681
  771. <a name="l00682"></a>00682 <span class="comment">! =================</span>
  772. <a name="l00683"></a>00683 <span class="comment">! SUBROUTINE PROLOG</span>
  773. <a name="l00684"></a>00684 <span class="comment">! =================</span>
  774. <a name="l00685"></a>00685
  775. <a name="l00686"></a><a class="code" href="puma_8f90.html#afde378004f20ed8741a7e9bcd82cbfe4">00686</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#afde378004f20ed8741a7e9bcd82cbfe4">prolog</a>
  776. <a name="l00687"></a>00687 use <span class="keywordflow">pumamod</span>
  777. <a name="l00688"></a>00688
  778. <a name="l00689"></a>00689 <span class="keywordtype">character( 8)</span> :: cpuma = <span class="stringliteral">&#39;PUMA-II &#39;</span>
  779. <a name="l00690"></a>00690 <span class="keywordtype">character(80)</span> :: pumaversion = <span class="stringliteral">&#39;16.0 (27-Sep-2010)&#39;</span>
  780. <a name="l00691"></a>00691 <span class="keywordtype">real</span> :: zsig(nlon*nlat)
  781. <a name="l00692"></a>00692
  782. <a name="l00693"></a>00693 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  783. <a name="l00694"></a>00694 call cpu_time(tmstart)
  784. <a name="l00695"></a>00695 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(/,&quot; ****************************************************&quot;)&#39;</span>)
  785. <a name="l00696"></a>00696 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; * PUMA &quot;,a43,&quot; *&quot;)&#39;</span>) trim(pumaversion)
  786. <a name="l00697"></a>00697 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; ****************************************************&quot;)&#39;</span>)
  787. <a name="l00698"></a>00698 <span class="keyword">if</span> (mrnum == 0) <span class="keyword">then</span>
  788. <a name="l00699"></a>00699 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; * NTRU =&quot;,i4,&quot; NLEV =&quot;,i4,&quot; NLON = &quot;,i4,&quot; NLAT =&quot;,i4,&quot; *&quot;)&#39;</span>) &amp;
  789. <a name="l00700"></a>00700 NTRU,NLEV,NLON,NLAT
  790. <a name="l00701"></a>00701 <span class="keyword">else</span>
  791. <a name="l00702"></a>00702 <span class="keyword">do</span> jpid = 1 , mrnum
  792. <a name="l00703"></a>00703 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; * PID =&quot;,i4,&quot; NTRU =&quot;,i4,&quot; NLEV = &quot;,i4,&quot; *&quot;)&#39;</span>) &amp;
  793. <a name="l00704"></a>00704 jpid-1,mrtru(jpid),NLEV
  794. <a name="l00705"></a>00705 <span class="keyword">enddo</span>
  795. <a name="l00706"></a>00706 <span class="keyword">endif</span>
  796. <a name="l00707"></a>00707 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; ****************************************************&quot;)&#39;</span>)
  797. <a name="l00708"></a>00708 <span class="keyword">if</span> (NPRO &gt; 1) <span class="keyword">then</span>
  798. <a name="l00709"></a>00709 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(/,&quot; ****************************************************&quot;)&#39;</span>)
  799. <a name="l00710"></a>00710 <span class="keyword">do</span> jpro = 1 , NPRO
  800. <a name="l00711"></a>00711 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; * CPU&quot;,i4,1x,a40,&quot; *&quot;)&#39;</span>) jpro-1,ympname(jpro)
  801. <a name="l00712"></a>00712 <span class="keyword">enddo</span>
  802. <a name="l00713"></a>00713 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot; ****************************************************&quot;)&#39;</span>)
  803. <a name="l00714"></a>00714 <span class="keyword">endif</span>
  804. <a name="l00715"></a>00715 call <a class="code" href="restartmod_8f90.html#a1afb89bd2af13e06ddcbeeb393eeb191">restart_ini</a>(lrestart,puma_restart)
  805. <a name="l00716"></a>00716 call <a class="code" href="gaussmod_8f90.html#a841a2f8e9025371eddc985235e1831ab">inigau</a>(NLAT,sid,gwd)
  806. <a name="l00717"></a>00717 call <a class="code" href="ppp_8f90.html#a7780f6c3a813605c014f7da964ff83d2">inilat</a>
  807. <a name="l00718"></a>00718 call <a class="code" href="ppp_8f90.html#a03d027a1b5f735efb9bce2396d5fc2b6">legpri</a>
  808. <a name="l00719"></a>00719 call <a class="code" href="ppp_8f90.html#a8a75958ca9ba25aeec49db140b483871">readnl</a>
  809. <a name="l00720"></a>00720 call <a class="code" href="puma_8f90.html#a859f80933ca252bcc87f27d3996fea05">ppp_interface</a>
  810. <a name="l00721"></a>00721 call <a class="code" href="ppp_8f90.html#a5087a1dafe7b39d03c6547fde711b55a">initpm</a>
  811. <a name="l00722"></a>00722 call <a class="code" href="puma_8f90.html#a96b9223819624937b18b4e5b29e95a91">initsi</a>
  812. <a name="l00723"></a>00723 call <a class="code" href="legsym_8f90.html#ae810767bcafdac840ab48c420efcb49a">altlat</a>(csq,NLAT) <span class="comment">! csq -&gt; alternating grid</span>
  813. <a name="l00724"></a>00724 <span class="keyword">if</span> (ngui &gt; 0) call <a class="code" href="guimod_8f90.html#a77235ccfbc718d5f8b1edc4be08aed03">guistart</a>
  814. <a name="l00725"></a>00725 <span class="keyword">if</span> (nrun == 0 .and. nstop &gt; 0) nrun = nstop-<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>
  815. <a name="l00726"></a>00726 <span class="keyword">if</span> (nrun == 0) nrun = ntspd * (nyears * 360 + nmonths * 30)
  816. <a name="l00727"></a>00727 call <a class="code" href="puma_8f90.html#acbd8e7fdd2e1f60dbca741a700fb292a">initrandom</a> <span class="comment">! set random seed</span>
  817. <a name="l00728"></a>00728 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  818. <a name="l00729"></a>00729
  819. <a name="l00730"></a>00730 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nruido)
  820. <a name="l00731"></a>00731 call <a class="code" href="puma_8f90.html#aea6c13c68157972ea21768a5ea43e154">initruido</a> <span class="comment">! allocate ruido arrays</span>
  821. <a name="l00732"></a>00732
  822. <a name="l00733"></a>00733
  823. <a name="l00734"></a>00734 <span class="keyword">if</span> (nshutdown &gt; 0) return <span class="comment">! If something went wrong in the init routines</span>
  824. <a name="l00735"></a>00735
  825. <a name="l00736"></a>00736 <span class="comment">! ***********************</span>
  826. <a name="l00737"></a>00737 <span class="comment">! * broadcast &amp; scatter *</span>
  827. <a name="l00738"></a>00738 <span class="comment">! ***********************</span>
  828. <a name="l00739"></a>00739
  829. <a name="l00740"></a>00740 call <a class="code" href="mpimod_8f90.html#a3d2a5d231fd9527bcbc1fde327326922">mpscdn</a>(sid,NHPP) <span class="comment">! real (kind=8)</span>
  830. <a name="l00741"></a>00741 call <a class="code" href="mpimod_8f90.html#a3d2a5d231fd9527bcbc1fde327326922">mpscdn</a>(gwd,NHPP) <span class="comment">! real (kind=8)</span>
  831. <a name="l00742"></a>00742 call <a class="code" href="mpimod_8f90.html#a1504cf64a1ffc198a8a1fe54ba00d775">mpscrn</a>(csq,NLPP)
  832. <a name="l00743"></a>00743
  833. <a name="l00744"></a>00744 <span class="keyword">do</span> jlat = 1 , NLPP
  834. <a name="l00745"></a>00745 rcsq(1+(jlat-1)*NLON:jlat*NLON) = 1.0 / csq(jlat)
  835. <a name="l00746"></a>00746 <span class="keyword">enddo</span>
  836. <a name="l00747"></a>00747
  837. <a name="l00748"></a>00748 <span class="comment">! broadcast integer</span>
  838. <a name="l00749"></a>00749
  839. <a name="l00750"></a>00750 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(kick ) <span class="comment">! add noise for kick &gt; 0</span>
  840. <a name="l00751"></a>00751 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nafter ) <span class="comment">! write data interval [steps]</span>
  841. <a name="l00752"></a>00752 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nwpd ) <span class="comment">! write data interval [writes per day]</span>
  842. <a name="l00753"></a>00753 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ncoeff ) <span class="comment">! number of modes to print</span>
  843. <a name="l00754"></a>00754 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ndel ) <span class="comment">! ndel</span>
  844. <a name="l00755"></a>00755 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(noutput ) <span class="comment">! global output switch</span>
  845. <a name="l00756"></a>00756 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ndiag ) <span class="comment">! write diagnostics interval</span>
  846. <a name="l00757"></a>00757 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ngui ) <span class="comment">! GUI on (1) or off (0)</span>
  847. <a name="l00758"></a>00758 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nkits ) <span class="comment">! number of initial timesteps</span>
  848. <a name="l00759"></a>00759 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nlevt ) <span class="comment">! tropospheric levels</span>
  849. <a name="l00760"></a>00760 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nrun ) <span class="comment">! if (nstop == 0) nstop = nstep + nrun</span>
  850. <a name="l00761"></a>00761 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> ) <span class="comment">! current timestep</span>
  851. <a name="l00762"></a>00762 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nstop ) <span class="comment">! finishing timestep</span>
  852. <a name="l00763"></a>00763 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ntspd ) <span class="comment">! number of timesteps per day</span>
  853. <a name="l00764"></a>00764 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(mpstep ) <span class="comment">! minutes per step</span>
  854. <a name="l00765"></a>00765 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nyears ) <span class="comment">! simulation time</span>
  855. <a name="l00766"></a>00766 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nmonths ) <span class="comment">! simulation time</span>
  856. <a name="l00767"></a>00767 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nextout ) <span class="comment">! write extended output</span>
  857. <a name="l00768"></a>00768 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nsponge) <span class="comment">! Switch for sponge layer</span>
  858. <a name="l00769"></a>00769 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nhelsua) <span class="comment">! Held &amp; Suarez forcing</span>
  859. <a name="l00770"></a>00770 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ndiagp) <span class="comment">! 0/1 switch for new grid point diabatic heating</span>
  860. <a name="l00771"></a>00771 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nconv) <span class="comment">! 0/1 switch for convective heating</span>
  861. <a name="l00772"></a>00772 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nvg ) <span class="comment">! Type of vertical grid</span>
  862. <a name="l00773"></a>00773 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nenergy) <span class="comment">! energy diagnostics</span>
  863. <a name="l00774"></a>00774 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nentropy) <span class="comment">! entropy diagnostics</span>
  864. <a name="l00775"></a>00775 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ndheat) <span class="comment">! energy recycling</span>
  865. <a name="l00776"></a>00776 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nradcv) <span class="comment">! use two restoration fields</span>
  866. <a name="l00777"></a>00777
  867. <a name="l00778"></a>00778 <span class="comment">! broadcast logical</span>
  868. <a name="l00779"></a>00779
  869. <a name="l00780"></a>00780 call <a class="code" href="mpimod_8f90.html#a40b910e38273e7f3c9dc4ed36d3e67a0">mpbcl</a>(lrestart) <span class="comment">! true: read restart file, false: initial run</span>
  870. <a name="l00781"></a>00781 call <a class="code" href="mpimod_8f90.html#a40b910e38273e7f3c9dc4ed36d3e67a0">mpbcl</a>(lselect ) <span class="comment">! true: disable some zonal waves</span>
  871. <a name="l00782"></a>00782 call <a class="code" href="mpimod_8f90.html#a40b910e38273e7f3c9dc4ed36d3e67a0">mpbcl</a>(lspecsel) <span class="comment">! true: disable some spectral modes</span>
  872. <a name="l00783"></a>00783
  873. <a name="l00784"></a>00784 <span class="comment">! broadcast real</span>
  874. <a name="l00785"></a>00785
  875. <a name="l00786"></a>00786 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(ww )
  876. <a name="l00787"></a>00787 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(v_scl )
  877. <a name="l00788"></a>00788 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(ct )
  878. <a name="l00789"></a>00789
  879. <a name="l00790"></a>00790 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(sid_day )
  880. <a name="l00791"></a>00791 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(plarad )
  881. <a name="l00792"></a>00792 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(gascon )
  882. <a name="l00793"></a>00793 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(akap )
  883. <a name="l00794"></a>00794 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(alr )
  884. <a name="l00795"></a>00795 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(ga )
  885. <a name="l00796"></a>00796 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(psurf )
  886. <a name="l00797"></a>00797 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(alpha ) <span class="comment">! Williams factor for time filter</span>
  887. <a name="l00798"></a>00798 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(dtep ) <span class="comment">! equator-pole temperature difference</span>
  888. <a name="l00799"></a>00799 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(dtns )
  889. <a name="l00800"></a>00800 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(dtrop )
  890. <a name="l00801"></a>00801 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(dttrp )
  891. <a name="l00802"></a>00802 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(tdiss )
  892. <a name="l00803"></a>00803 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(tac )
  893. <a name="l00804"></a>00804 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(pac )
  894. <a name="l00805"></a>00805 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(plavor )
  895. <a name="l00806"></a>00806 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(rotspd )
  896. <a name="l00807"></a>00807 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(sigmax ) <span class="comment">! sigma of top half level</span>
  897. <a name="l00808"></a>00808 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(tgr )
  898. <a name="l00809"></a>00809 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(dvdiff )
  899. <a name="l00810"></a>00810 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(disp )
  900. <a name="l00811"></a>00811 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(tauta )
  901. <a name="l00812"></a>00812 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(tauts )
  902. <a name="l00813"></a>00813 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(pspon )
  903. <a name="l00814"></a>00814 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(sponk )
  904. <a name="l00815"></a>00815
  905. <a name="l00816"></a>00816 <span class="comment">! broadcast integer arrays</span>
  906. <a name="l00817"></a>00817
  907. <a name="l00818"></a>00818 call <a class="code" href="mpimod_8f90.html#a85cfae5acde5c37604edf690e9c2f7cf">mpbcin</a>(ndil ,NLEV)
  908. <a name="l00819"></a>00819 call <a class="code" href="mpimod_8f90.html#a85cfae5acde5c37604edf690e9c2f7cf">mpbcin</a>(nselzw,NTP1)
  909. <a name="l00820"></a>00820
  910. <a name="l00821"></a>00821 <span class="comment">! broadcast real arrays</span>
  911. <a name="l00822"></a>00822
  912. <a name="l00823"></a>00823 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(damp ,NLEV)
  913. <a name="l00824"></a>00824 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(dsigma,NLEV)
  914. <a name="l00825"></a>00825 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(fric ,NLEV)
  915. <a name="l00826"></a>00826 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(rdsig ,NLEV)
  916. <a name="l00827"></a>00827 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(taur ,NLEV)
  917. <a name="l00828"></a>00828 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(sigma ,NLEV)
  918. <a name="l00829"></a>00829 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(sigmh ,NLEV)
  919. <a name="l00830"></a>00830 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(t0 ,NLEV)
  920. <a name="l00831"></a>00831 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(t0d ,NLEV)
  921. <a name="l00832"></a>00832 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(tauf ,NLEV)
  922. <a name="l00833"></a>00833 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(tkp ,NLEV)
  923. <a name="l00834"></a>00834
  924. <a name="l00835"></a>00835 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(c ,NLSQ)
  925. <a name="l00836"></a>00836 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(xlphi ,NLSQ)
  926. <a name="l00837"></a>00837 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(xlt ,NLSQ)
  927. <a name="l00838"></a>00838
  928. <a name="l00839"></a>00839 <span class="comment">! scatter integer arrays</span>
  929. <a name="l00840"></a>00840
  930. <a name="l00841"></a>00841 call <a class="code" href="mpimod_8f90.html#a8338d8609afcefbb1faa41f353c10ef9">mpscin</a>(nindex,NSPP)
  931. <a name="l00842"></a>00842 call <a class="code" href="mpimod_8f90.html#a1504cf64a1ffc198a8a1fe54ba00d775">mpscrn</a>(srcn ,NSPP)
  932. <a name="l00843"></a>00843 call <a class="code" href="mpimod_8f90.html#a1504cf64a1ffc198a8a1fe54ba00d775">mpscrn</a>(sak ,NSPP)
  933. <a name="l00844"></a>00844
  934. <a name="l00845"></a>00845 call <a class="code" href="legsym_8f90.html#a86bc436e65d6c4ddde72bb3cce7dc8c8">legini</a>(nlat,nlpp,nesp,nlev,plavor,sid,gwd)
  935. <a name="l00846"></a>00846
  936. <a name="l00847"></a>00847 <span class="keyword">if</span> (lrestart) <span class="keyword">then</span>
  937. <a name="l00848"></a>00848 call <a class="code" href="puma_8f90.html#aa07fedd638dbdd8e1799b83d34eb35e3">read_atmos_restart</a>
  938. <a name="l00849"></a>00849 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  939. <a name="l00850"></a>00850 <span class="keyword">if</span> (kick &gt; 10) call <a class="code" href="puma_8f90.html#abdcee9a4a4d07fc6e5b7a7f5768026ac">noise</a>(kick-10)
  940. <a name="l00851"></a>00851 <span class="keyword">endif</span>
  941. <a name="l00852"></a>00852 <span class="keyword">else</span>
  942. <a name="l00853"></a>00853 call <a class="code" href="ppp_8f90.html#a51f5938296dd343ce807dbb6d1a16e49">initfd</a>
  943. <a name="l00854"></a>00854 <span class="keyword">endif</span>
  944. <a name="l00855"></a>00855
  945. <a name="l00856"></a>00856 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  946. <a name="l00857"></a>00857 call <a class="code" href="puma_8f90.html#a9a888c599145a63cdd108dffa553b509">printseed</a> <span class="comment">! either namelist, clock initialized or from restart file</span>
  947. <a name="l00858"></a>00858 <span class="keyword">endif</span>
  948. <a name="l00859"></a>00859
  949. <a name="l00860"></a>00860 <span class="comment">! broadcast spectral arrays</span>
  950. <a name="l00861"></a>00861
  951. <a name="l00862"></a>00862 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(sp,NESP)
  952. <a name="l00863"></a>00863 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(sd,NESP*NLEV)
  953. <a name="l00864"></a>00864 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(st,NESP*NLEV)
  954. <a name="l00865"></a>00865 call <a class="code" href="mpimod_8f90.html#af2a0a009162180d4abb1daa1bad60cf2">mpbcrn</a>(sz,NESP*NLEV)
  955. <a name="l00866"></a>00866
  956. <a name="l00867"></a>00867 <span class="comment">! scatter spectral arrays</span>
  957. <a name="l00868"></a>00868
  958. <a name="l00869"></a>00869 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sd,sdp,NLEV)
  959. <a name="l00870"></a>00870 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(st,stp,NLEV)
  960. <a name="l00871"></a>00871 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sz,szp,NLEV)
  961. <a name="l00872"></a>00872 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sr1,srp1,NLEV)
  962. <a name="l00873"></a>00873 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sr2,srp2,NLEV)
  963. <a name="l00874"></a>00874 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sp,spp,1)
  964. <a name="l00875"></a>00875 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(so,sop,1)
  965. <a name="l00876"></a>00876
  966. <a name="l00877"></a>00877 <span class="comment">! scatter gridpoint arrays</span>
  967. <a name="l00878"></a>00878
  968. <a name="l00879"></a>00879 <span class="keyword">if</span> (nruido &gt; 0) call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(ruido,ruidop,NLEV)
  969. <a name="l00880"></a>00880
  970. <a name="l00881"></a>00881 <span class="comment">!</span>
  971. <a name="l00882"></a>00882 <span class="comment">! initialize energy and entropy diagnostics</span>
  972. <a name="l00883"></a>00883 <span class="comment">!</span>
  973. <a name="l00884"></a>00884 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  974. <a name="l00885"></a>00885 <span class="keyword">allocate</span>(denergy(NHOR,9))
  975. <a name="l00886"></a>00886 denergy(:,:)=0.
  976. <a name="l00887"></a>00887 <span class="keyword">endif</span>
  977. <a name="l00888"></a>00888 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  978. <a name="l00889"></a>00889 <span class="keyword">allocate</span>(dentropy(NHOR,9))
  979. <a name="l00890"></a>00890 dentropy(:,:)=0.
  980. <a name="l00891"></a>00891 <span class="keyword">endif</span>
  981. <a name="l00892"></a>00892 <span class="keyword">if</span>(ndheat &gt; 1 .and. mypid == NROOT) <span class="keyword">then</span>
  982. <a name="l00893"></a>00893 <span class="keyword">open</span>(9,file=efficiency_dat,form=<span class="stringliteral">&#39;formatted&#39;</span>)
  983. <a name="l00894"></a>00894 <span class="keyword">endif</span>
  984. <a name="l00895"></a>00895 <span class="comment">!</span>
  985. <a name="l00896"></a>00896 <span class="comment">! write first service record containing sigma coordinates</span>
  986. <a name="l00897"></a>00897 <span class="comment">!</span>
  987. <a name="l00898"></a>00898 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  988. <a name="l00899"></a>00899 <span class="keyword">if</span> (noutput &gt; 0) <span class="keyword">then</span>
  989. <a name="l00900"></a>00900 istep = <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>
  990. <a name="l00901"></a>00901 <span class="keyword">if</span> (istep &gt; 0) istep = istep + nafter <span class="comment">! next write after restart</span>
  991. <a name="l00902"></a>00902 <span class="keyword">open</span>(40,file=puma_output,form=<span class="stringliteral">&#39;unformatted&#39;</span>)
  992. <a name="l00903"></a>00903 call <a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(istep,imin,ihour,iday,imonth,iyear)
  993. <a name="l00904"></a>00904 zsig(1:nlev) = sigmh(:)
  994. <a name="l00905"></a>00905 zsig(nlev+1:) = 0.0
  995. <a name="l00906"></a>00906 <span class="keyword">write</span>(40) 333,0,iyear*10000+imonth*100+iday,0,nlon,nlat,nlev,ntru
  996. <a name="l00907"></a>00907 <span class="keyword">write</span>(40) zsig
  997. <a name="l00908"></a>00908 <span class="keyword">endif</span> <span class="comment">! (noutput &gt; 0)</span>
  998. <a name="l00909"></a>00909 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  999. <a name="l00910"></a>00910 return
  1000. <a name="l00911"></a>00911 <span class="keyword">end subroutine prolog</span>
  1001. <a name="l00912"></a>00912
  1002. <a name="l00913"></a>00913
  1003. <a name="l00914"></a>00914 <span class="comment">!===================!</span>
  1004. <a name="l00915"></a>00915 <span class="comment">! SUBROUTINE MASTER !</span>
  1005. <a name="l00916"></a>00916 <span class="comment">!================== !</span>
  1006. <a name="l00917"></a>00917
  1007. <a name="l00918"></a><a class="code" href="puma_8f90.html#af02944c9cc5103c31e4ed9b779e7cc79">00918</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#af02944c9cc5103c31e4ed9b779e7cc79">master</a>
  1008. <a name="l00919"></a>00919 use <span class="keywordflow">pumamod</span>
  1009. <a name="l00920"></a>00920
  1010. <a name="l00921"></a>00921 <span class="keyword">if</span> (nshutdown &gt; 0) return <span class="comment">! if something went wrong in prolog already</span>
  1011. <a name="l00922"></a>00922
  1012. <a name="l00923"></a>00923 <span class="comment">! ***************************</span>
  1013. <a name="l00924"></a>00924 <span class="comment">! * short initial timesteps *</span>
  1014. <a name="l00925"></a>00925 <span class="comment">! ***************************</span>
  1015. <a name="l00926"></a>00926
  1016. <a name="l00927"></a>00927 ikits = nkits
  1017. <a name="l00928"></a>00928 <span class="keyword">do</span> jkits = 1 , ikits
  1018. <a name="l00929"></a>00929 delt = (TWOPI/ntspd) / (2**nkits)
  1019. <a name="l00930"></a>00930 delt2 = delt + delt
  1020. <a name="l00931"></a>00931 call <a class="code" href="ppp_8f90.html#aefdbfd36b330ce29d344d428431119c9">gridpoint</a>
  1021. <a name="l00932"></a>00932 call <a class="code" href="puma_8f90.html#aa2b3f98ff1c27bb557c695c15708ad1f">makebm</a>
  1022. <a name="l00933"></a>00933 call <a class="code" href="puma_8f90.html#a218b1f5483f314ea3a7eeba949933773">spectral</a>
  1023. <a name="l00934"></a>00934 nkits = nkits - 1
  1024. <a name="l00935"></a>00935 <span class="keyword">enddo</span>
  1025. <a name="l00936"></a>00936
  1026. <a name="l00937"></a>00937 delt = TWOPI/ntspd
  1027. <a name="l00938"></a>00938 delt2 = delt + delt
  1028. <a name="l00939"></a>00939 call <a class="code" href="puma_8f90.html#aa2b3f98ff1c27bb557c695c15708ad1f">makebm</a>
  1029. <a name="l00940"></a>00940
  1030. <a name="l00941"></a>00941 nstep1 = <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> <span class="comment">! remember 1.st timestep</span>
  1031. <a name="l00942"></a>00942
  1032. <a name="l00943"></a>00943 <span class="keyword">do</span> jstep = 1 , nrun
  1033. <a name="l00944"></a>00944 <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> = <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> + 1
  1034. <a name="l00945"></a>00945 call <a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<a class="code" href="pumax_8c.html#a5d9c6d601c3a2a89c6397da97ae235ff">ndatim</a>(5),<a class="code" href="pumax_8c.html#a5d9c6d601c3a2a89c6397da97ae235ff">ndatim</a>(4),<a class="code" href="pumax_8c.html#a5d9c6d601c3a2a89c6397da97ae235ff">ndatim</a>(3),<a class="code" href="pumax_8c.html#a5d9c6d601c3a2a89c6397da97ae235ff">ndatim</a>(2),<a class="code" href="pumax_8c.html#a5d9c6d601c3a2a89c6397da97ae235ff">ndatim</a>(1))
  1035. <a name="l00946"></a>00946
  1036. <a name="l00947"></a>00947 <span class="comment">! ************************************************************</span>
  1037. <a name="l00948"></a>00948 <span class="comment">! * calculation of non-linear quantities in grid point space *</span>
  1038. <a name="l00949"></a>00949 <span class="comment">! ************************************************************</span>
  1039. <a name="l00950"></a>00950
  1040. <a name="l00951"></a>00951 call <a class="code" href="ppp_8f90.html#aefdbfd36b330ce29d344d428431119c9">gridpoint</a>
  1041. <a name="l00952"></a>00952
  1042. <a name="l00953"></a>00953 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1043. <a name="l00954"></a>00954 <span class="keyword">if</span> (mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,nafter) == 0 .and. noutput &gt; 0) call <a class="code" href="puma_8f90.html#a0352cc6bbeedace31c54d9afba847ad6">outsp</a>
  1044. <a name="l00955"></a>00955 <span class="keyword">if</span> (mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,ndiag ) == 0 .or. ngui &gt; 0) call <a class="code" href="puma_8f90.html#ad0981694b4fc7644f20d9ad785deba27">diag</a>
  1045. <a name="l00956"></a>00956 <span class="keyword">if</span> (ncu &gt; 0) call <a class="code" href="puma_8f90.html#ab608e12bdff55ab600a9d975673c5a53">checkunit</a>
  1046. <a name="l00957"></a>00957 <span class="keyword">endif</span>
  1047. <a name="l00958"></a>00958 <span class="keyword">if</span> (ngui &gt; 0) call <a class="code" href="guimod_8f90.html#a71eb8e326967dca8aad8bc84d9f8ad72">guistep_puma</a>
  1048. <a name="l00959"></a>00959
  1049. <a name="l00960"></a>00960 <span class="comment">! ******************************</span>
  1050. <a name="l00961"></a>00961 <span class="comment">! * adiabatic part of timestep *</span>
  1051. <a name="l00962"></a>00962 <span class="comment">! ******************************</span>
  1052. <a name="l00963"></a>00963
  1053. <a name="l00964"></a>00964 call <a class="code" href="puma_8f90.html#a218b1f5483f314ea3a7eeba949933773">spectral</a>
  1054. <a name="l00965"></a>00965 <span class="keyword">if</span> (mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,nafter) == 0 .and. noutput &gt; 0) call <a class="code" href="puma_8f90.html#a1f5ebb3d7ab8cc007a6ed2d81b858f03">outgp</a>
  1055. <a name="l00966"></a>00966 <span class="keyword">if</span> (nshutdown &gt; 0) return
  1056. <a name="l00967"></a>00967 <span class="keyword">enddo</span>
  1057. <a name="l00968"></a>00968 return
  1058. <a name="l00969"></a>00969 <span class="keyword">end subroutine master</span>
  1059. <a name="l00970"></a>00970
  1060. <a name="l00971"></a>00971
  1061. <a name="l00972"></a>00972 <span class="comment">! =================</span>
  1062. <a name="l00973"></a>00973 <span class="comment">! SUBROUTINE EPILOG</span>
  1063. <a name="l00974"></a>00974 <span class="comment">! =================</span>
  1064. <a name="l00975"></a>00975
  1065. <a name="l00976"></a><a class="code" href="puma_8f90.html#a35d7c22447dc50ab86832b4615994d32">00976</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a35d7c22447dc50ab86832b4615994d32">epilog</a>
  1066. <a name="l00977"></a>00977 use <span class="keywordflow">pumamod</span>
  1067. <a name="l00978"></a>00978 <span class="keywordtype">real (kind=8)</span> :: zut,zst
  1068. <a name="l00979"></a>00979 <span class="keywordtype">integer (kind=8)</span> :: imem,ipr,ipf,isw,idr,idw
  1069. <a name="l00980"></a>00980
  1070. <a name="l00981"></a>00981 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">close</span>(40) <span class="comment">! close output file</span>
  1071. <a name="l00982"></a>00982
  1072. <a name="l00983"></a>00983 <span class="comment">! write restart file</span>
  1073. <a name="l00984"></a>00984
  1074. <a name="l00985"></a>00985 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1075. <a name="l00986"></a>00986 call <a class="code" href="restartmod_8f90.html#affb1e8d0fa727d359e1292ada8ba0f2b">restart_prepare</a>(puma_status)
  1076. <a name="l00987"></a>00987 sp(1) = psmean <span class="comment">! save psmean</span>
  1077. <a name="l00988"></a>00988 call <a class="code" href="restartmod_8f90.html#a16bdaf2753fbc691f99b0837e5de11db">put_restart_integer</a>(<span class="stringliteral">&#39;nstep&#39;</span> ,<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> )
  1078. <a name="l00989"></a>00989 call <a class="code" href="restartmod_8f90.html#a16bdaf2753fbc691f99b0837e5de11db">put_restart_integer</a>(<span class="stringliteral">&#39;nlat&#39;</span> ,NLAT )
  1079. <a name="l00990"></a>00990 call <a class="code" href="restartmod_8f90.html#a16bdaf2753fbc691f99b0837e5de11db">put_restart_integer</a>(<span class="stringliteral">&#39;nlon&#39;</span> ,NLON )
  1080. <a name="l00991"></a>00991 call <a class="code" href="restartmod_8f90.html#a16bdaf2753fbc691f99b0837e5de11db">put_restart_integer</a>(<span class="stringliteral">&#39;nlev&#39;</span> ,NLEV )
  1081. <a name="l00992"></a>00992 call <a class="code" href="restartmod_8f90.html#a16bdaf2753fbc691f99b0837e5de11db">put_restart_integer</a>(<span class="stringliteral">&#39;nrsp&#39;</span> ,NRSP )
  1082. <a name="l00993"></a>00993
  1083. <a name="l00994"></a>00994 <span class="comment">! Save current random number generator seed</span>
  1084. <a name="l00995"></a>00995
  1085. <a name="l00996"></a>00996 call random_seed(get=meed)
  1086. <a name="l00997"></a>00997 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;seed&#39;</span>,meed,nseedlen,1,1)
  1087. <a name="l00998"></a>00998 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;ganext&#39;</span>,ganext,1,1,1)
  1088. <a name="l00999"></a>00999
  1089. <a name="l01000"></a>01000 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;sz&#39;</span> ,sz ,NRSP,NESP,NLEV)
  1090. <a name="l01001"></a>01001 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;sd&#39;</span> ,sd ,NRSP,NESP,NLEV)
  1091. <a name="l01002"></a>01002 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;st&#39;</span> ,st ,NRSP,NESP,NLEV)
  1092. <a name="l01003"></a>01003 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;sr1&#39;</span>,sr1,NRSP,NESP,NLEV)
  1093. <a name="l01004"></a>01004 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;sr2&#39;</span>,sr2,NRSP,NESP,NLEV)
  1094. <a name="l01005"></a>01005 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;sp&#39;</span> ,sp ,NRSP,NESP, 1)
  1095. <a name="l01006"></a>01006 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;so&#39;</span> ,so ,NRSP,NESP, 1)
  1096. <a name="l01007"></a>01007 <span class="keyword">if</span> (nruido &gt; 0) <span class="keyword">then</span>
  1097. <a name="l01008"></a>01008 call <a class="code" href="restartmod_8f90.html#a52485001dbbaed032e48d894e6302c22">put_restart_array</a>(<span class="stringliteral">&#39;ruido&#39;</span>,ruido,nugp,nugp,nlev)
  1098. <a name="l01009"></a>01009 <span class="keyword">endif</span>
  1099. <a name="l01010"></a>01010 <span class="keyword">endif</span>
  1100. <a name="l01011"></a>01011
  1101. <a name="l01012"></a>01012 call <a class="code" href="mpimod_8f90.html#a79c341b7b52bf44470898581072660b8">mpputsp</a>(<span class="stringliteral">&#39;szm&#39;</span>,szm,NSPP,NLEV)
  1102. <a name="l01013"></a>01013 call <a class="code" href="mpimod_8f90.html#a79c341b7b52bf44470898581072660b8">mpputsp</a>(<span class="stringliteral">&#39;sdm&#39;</span>,sdm,NSPP,NLEV)
  1103. <a name="l01014"></a>01014 call <a class="code" href="mpimod_8f90.html#a79c341b7b52bf44470898581072660b8">mpputsp</a>(<span class="stringliteral">&#39;stm&#39;</span>,stm,NSPP,NLEV)
  1104. <a name="l01015"></a>01015 call <a class="code" href="mpimod_8f90.html#a79c341b7b52bf44470898581072660b8">mpputsp</a>(<span class="stringliteral">&#39;spm&#39;</span>,spm,NSPP, 1)
  1105. <a name="l01016"></a>01016
  1106. <a name="l01017"></a>01017 <span class="comment">! write gridpoint arrays</span>
  1107. <a name="l01018"></a>01018
  1108. <a name="l01019"></a>01019 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gr1)) <span class="keyword">then</span>
  1109. <a name="l01020"></a>01020 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gr1&#39;</span>,gr1,nhor,nlev)
  1110. <a name="l01021"></a>01021 <span class="keyword">endif</span>
  1111. <a name="l01022"></a>01022 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gr2)) <span class="keyword">then</span>
  1112. <a name="l01023"></a>01023 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gr2&#39;</span>,gr2,nhor,nlev)
  1113. <a name="l01024"></a>01024 <span class="keyword">endif</span>
  1114. <a name="l01025"></a>01025 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gtdamp)) <span class="keyword">then</span>
  1115. <a name="l01026"></a>01026 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gtdamp&#39;</span>,gtdamp,nhor,nlev)
  1116. <a name="l01027"></a>01027 <span class="keyword">endif</span>
  1117. <a name="l01028"></a>01028
  1118. <a name="l01029"></a>01029 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gr1c)) <span class="keyword">then</span>
  1119. <a name="l01030"></a>01030 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gr1c&#39;</span>,gr1c,nhor,nlev)
  1120. <a name="l01031"></a>01031 <span class="keyword">endif</span>
  1121. <a name="l01032"></a>01032 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gr2c)) <span class="keyword">then</span>
  1122. <a name="l01033"></a>01033 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gr2c&#39;</span>,gr2c,nhor,nlev)
  1123. <a name="l01034"></a>01034 <span class="keyword">endif</span>
  1124. <a name="l01035"></a>01035 <span class="keyword">if</span> (<span class="keyword">allocated</span>(gtdampc)) <span class="keyword">then</span>
  1125. <a name="l01036"></a>01036 call <a class="code" href="mpimod_8f90.html#a7e675330db7b46cf0bf0cc8edd2d413c">mpputgp</a>(<span class="stringliteral">&#39;gtdampc&#39;</span>,gtdampc,nhor,nlev)
  1126. <a name="l01037"></a>01037 <span class="keyword">endif</span>
  1127. <a name="l01038"></a>01038
  1128. <a name="l01039"></a>01039 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1129. <a name="l01040"></a>01040 <span class="comment">! Get resource stats from function resources in file pumax.c</span>
  1130. <a name="l01041"></a>01041 ires = <a class="code" href="pumax_8c.html#a7e885dd959a1c4e56017782911c1f796">nresources</a>(zut,zst,imem,ipr,ipf,isw,idr,idw)
  1131. <a name="l01042"></a>01042 call cpu_time(tmstop)
  1132. <a name="l01043"></a>01043 tmrun = tmstop - tmstart
  1133. <a name="l01044"></a>01044 <span class="keyword">if</span> (<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> &gt; nstep1) <span class="keyword">then</span>
  1134. <a name="l01045"></a>01045 zspy = tmrun * 360.0 * <span class="keywordtype">real(ntspd)</span> / (nstep - nstep1) <span class="comment">! sec / siy</span>
  1135. <a name="l01046"></a>01046 zypd = (24.0 * 3600.0 / zspy) <span class="comment">! siy / day</span>
  1136. <a name="l01047"></a>01047 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(/,&quot;****************************************&quot;)&#39;</span>)
  1137. <a name="l01048"></a>01048 <span class="keyword">if</span> (zut &gt; 0.0) &amp;
  1138. <a name="l01049"></a>01049 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* User time : &quot;, f10.3,&quot; sec *&quot;)&#39;</span>) zut
  1139. <a name="l01050"></a>01050 <span class="keyword">if</span> (zst &gt; 0.0) &amp;
  1140. <a name="l01051"></a>01051 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* System time : &quot;, f10.3,&quot; sec *&quot;)&#39;</span>) zst
  1141. <a name="l01052"></a>01052 <span class="keyword">if</span> (zut + zst &gt; 0.0) tmrun = zut + zst
  1142. <a name="l01053"></a>01053 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Total CPU time : &quot;, f10.3,&quot; sec *&quot;)&#39;</span>) tmrun
  1143. <a name="l01054"></a>01054 <span class="keyword">if</span> (imem &gt; 0) &amp;
  1144. <a name="l01055"></a>01055 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Memory usage : &quot;, f10.3,&quot; MB *&quot;)&#39;</span>) imem * 0.000001
  1145. <a name="l01056"></a>01056 <span class="keyword">if</span> (ipr &gt; 0) &amp;
  1146. <a name="l01057"></a>01057 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Page reclaims : &quot;, i6,&quot; pages *&quot;)&#39;</span>) ipr
  1147. <a name="l01058"></a>01058 <span class="keyword">if</span> (ipf &gt; 0) &amp;
  1148. <a name="l01059"></a>01059 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Page faults : &quot;, i6,&quot; pages *&quot;)&#39;</span>) ipf
  1149. <a name="l01060"></a>01060 <span class="keyword">if</span> (isw &gt; 0) &amp;
  1150. <a name="l01061"></a>01061 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Page swaps : &quot;, i6,&quot; pages *&quot;)&#39;</span>) isw
  1151. <a name="l01062"></a>01062 <span class="keyword">if</span> (idr &gt; 0) &amp;
  1152. <a name="l01063"></a>01063 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Disk read : &quot;, i6,&quot; blocks *&quot;)&#39;</span>) idr
  1153. <a name="l01064"></a>01064 <span class="keyword">if</span> (idw &gt; 0) &amp;
  1154. <a name="l01065"></a>01065 <span class="keyword">write</span>(nud, <span class="stringliteral">&#39;(&quot;* Disk write : &quot;, i6,&quot; blocks *&quot;)&#39;</span>) idw
  1155. <a name="l01066"></a>01066 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;****************************************&quot;)&#39;</span>)
  1156. <a name="l01067"></a>01067 <span class="keyword">if</span> (zspy &lt; 600.0) <span class="keyword">then</span>
  1157. <a name="l01068"></a>01068 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* Seconds per sim year: &quot;,i6,9x,&quot;*&quot;)&#39;</span>) nint(zspy)
  1158. <a name="l01069"></a>01069 <span class="keyword">else</span> <span class="keyword">if</span> (zspy &lt; 900000.0) <span class="keyword">then</span>
  1159. <a name="l01070"></a>01070 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* Minutes per sim year &quot;,i6,9x,&quot;*&quot;)&#39;</span>) nint(zspy/60.0)
  1160. <a name="l01071"></a>01071 <span class="keyword">else</span>
  1161. <a name="l01072"></a>01072 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* Days per sim year: &quot;,i6,5x,&quot;*&quot;)&#39;</span>) nint(zspy/86400.0)
  1162. <a name="l01073"></a>01073 <span class="keyword">endif</span>
  1163. <a name="l01074"></a>01074 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* Sim years per day :&quot;,i7,9x,&quot;*&quot;)&#39;</span>) nint(zypd)
  1164. <a name="l01075"></a>01075 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;****************************************&quot;)&#39;</span>)
  1165. <a name="l01076"></a>01076 <span class="keyword">endif</span>
  1166. <a name="l01077"></a>01077 <span class="keyword">endif</span>
  1167. <a name="l01078"></a>01078
  1168. <a name="l01079"></a>01079 return
  1169. <a name="l01080"></a>01080 <span class="keyword"> end subroutine epilog</span>
  1170. <a name="l01081"></a>01081
  1171. <a name="l01082"></a>01082 <span class="comment">! =============================</span>
  1172. <a name="l01083"></a>01083 <span class="comment">! SUBROUTINE READ_ATMOS_RESTART</span>
  1173. <a name="l01084"></a>01084 <span class="comment">! =============================</span>
  1174. <a name="l01085"></a>01085
  1175. <a name="l01086"></a><a class="code" href="puma_8f90.html#aa07fedd638dbdd8e1799b83d34eb35e3">01086</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#aa07fedd638dbdd8e1799b83d34eb35e3">read_atmos_restart</a>
  1176. <a name="l01087"></a>01087 use <span class="keywordflow">pumamod</span>
  1177. <a name="l01088"></a>01088
  1178. <a name="l01089"></a>01089 <span class="keywordtype">integer</span> :: k = 0
  1179. <a name="l01090"></a>01090
  1180. <a name="l01091"></a>01091 <span class="comment">! read scalars and full spectral arrays</span>
  1181. <a name="l01092"></a>01092
  1182. <a name="l01093"></a>01093 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1183. <a name="l01094"></a>01094 call <a class="code" href="restartmod_8f90.html#a31b0dacd7c45db47ddaedb4d402b44ba">get_restart_integer</a>(<span class="stringliteral">&#39;nstep&#39;</span>,<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>)
  1184. <a name="l01095"></a>01095 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;seed&#39;</span>,meed,nseedlen,1,1)
  1185. <a name="l01096"></a>01096 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;ganext&#39;</span>,ganext,1,1,1)
  1186. <a name="l01097"></a>01097 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;sz&#39;</span> ,sz ,NRSP,NESP,NLEV)
  1187. <a name="l01098"></a>01098 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;sd&#39;</span> ,sd ,NRSP,NESP,NLEV)
  1188. <a name="l01099"></a>01099 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;st&#39;</span> ,st ,NRSP,NESP,NLEV)
  1189. <a name="l01100"></a>01100 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;sr1&#39;</span>,sr1,NRSP,NESP,NLEV)
  1190. <a name="l01101"></a>01101 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;sr2&#39;</span>,sr2,NRSP,NESP,NLEV)
  1191. <a name="l01102"></a>01102 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;sp&#39;</span> ,sp ,NRSP,NESP, 1)
  1192. <a name="l01103"></a>01103 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;so&#39;</span> ,so ,NRSP,NESP, 1)
  1193. <a name="l01104"></a>01104 <span class="keyword">if</span> (nruido &gt; 0) <span class="keyword">then</span>
  1194. <a name="l01105"></a>01105 call <a class="code" href="restartmod_8f90.html#af0f1ce9b6762aa2537cc22d5fc319b7c">get_restart_array</a>(<span class="stringliteral">&#39;ruido&#39;</span>,ruido,nugp,nugp,nlev)
  1195. <a name="l01106"></a>01106 <span class="keyword">endif</span>
  1196. <a name="l01107"></a>01107 psmean = sp(1)
  1197. <a name="l01108"></a>01108 sp(1) = 0.0
  1198. <a name="l01109"></a>01109 call random_seed(put=meed)
  1199. <a name="l01110"></a>01110 <span class="keyword">endif</span>
  1200. <a name="l01111"></a>01111
  1201. <a name="l01112"></a>01112 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>) <span class="comment">! broadcast current timestep</span>
  1202. <a name="l01113"></a>01113 call <a class="code" href="mpimod_8f90.html#aded092db7f8071a727e2e96887702ca7">mpbcr</a>(psmean) <span class="comment">! broadcast mean surface pressure</span>
  1203. <a name="l01114"></a>01114
  1204. <a name="l01115"></a>01115 <span class="comment">! read and scatter spectral arrays</span>
  1205. <a name="l01116"></a>01116
  1206. <a name="l01117"></a>01117 call <a class="code" href="mpimod_8f90.html#acf82ae878fff75151cab59cdd0925ae0">mpgetsp</a>(<span class="stringliteral">&#39;szm&#39;</span>,szm,NSPP,NLEV)
  1207. <a name="l01118"></a>01118 call <a class="code" href="mpimod_8f90.html#acf82ae878fff75151cab59cdd0925ae0">mpgetsp</a>(<span class="stringliteral">&#39;sdm&#39;</span>,sdm,NSPP,NLEV)
  1208. <a name="l01119"></a>01119 call <a class="code" href="mpimod_8f90.html#acf82ae878fff75151cab59cdd0925ae0">mpgetsp</a>(<span class="stringliteral">&#39;stm&#39;</span>,stm,NSPP,NLEV)
  1209. <a name="l01120"></a>01120 call <a class="code" href="mpimod_8f90.html#acf82ae878fff75151cab59cdd0925ae0">mpgetsp</a>(<span class="stringliteral">&#39;spm&#39;</span>,spm,NSPP, 1)
  1210. <a name="l01121"></a>01121
  1211. <a name="l01122"></a>01122 <span class="comment">! allocate, read and scatter gridpoint arrays</span>
  1212. <a name="l01123"></a>01123
  1213. <a name="l01124"></a>01124 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gr1&#39;</span>,ktmp)
  1214. <a name="l01125"></a>01125 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1215. <a name="l01126"></a>01126 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1216. <a name="l01127"></a>01127 <span class="keyword">allocate</span>(gr1(nhor,nlev))
  1217. <a name="l01128"></a>01128 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gr1&#39;</span>,gr1,nhor,nlev)
  1218. <a name="l01129"></a>01129 <span class="keyword">endif</span>
  1219. <a name="l01130"></a>01130 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gr2&#39;</span>,ktmp)
  1220. <a name="l01131"></a>01131 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1221. <a name="l01132"></a>01132 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1222. <a name="l01133"></a>01133 <span class="keyword">allocate</span>(gr2(nhor,nlev))
  1223. <a name="l01134"></a>01134 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gr2&#39;</span>,gr2,nhor,nlev)
  1224. <a name="l01135"></a>01135 <span class="keyword">endif</span>
  1225. <a name="l01136"></a>01136 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gtdamp&#39;</span>,ktmp)
  1226. <a name="l01137"></a>01137 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1227. <a name="l01138"></a>01138 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1228. <a name="l01139"></a>01139 <span class="keyword">allocate</span>(gtdamp(nhor,nlev))
  1229. <a name="l01140"></a>01140 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gtdamp&#39;</span>,gtdamp,nhor,nlev)
  1230. <a name="l01141"></a>01141 <span class="keyword">endif</span>
  1231. <a name="l01142"></a>01142 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gr1c&#39;</span>,ktmp)
  1232. <a name="l01143"></a>01143 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1233. <a name="l01144"></a>01144 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1234. <a name="l01145"></a>01145 <span class="keyword">allocate</span>(gr1c(nhor,nlev))
  1235. <a name="l01146"></a>01146 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gr1c&#39;</span>,gr1c,nhor,nlev)
  1236. <a name="l01147"></a>01147 <span class="keyword">endif</span>
  1237. <a name="l01148"></a>01148 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gr2c&#39;</span>,ktmp)
  1238. <a name="l01149"></a>01149 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1239. <a name="l01150"></a>01150 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1240. <a name="l01151"></a>01151 <span class="keyword">allocate</span>(gr2c(nhor,nlev))
  1241. <a name="l01152"></a>01152 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gr2c&#39;</span>,gr2c,nhor,nlev)
  1242. <a name="l01153"></a>01153 <span class="keyword">endif</span>
  1243. <a name="l01154"></a>01154 <span class="keyword">if</span> (mypid == NROOT) call <a class="code" href="restartmod_8f90.html#a715f93e4ee50830196f64c403c7bdeed">varseek</a>(<span class="stringliteral">&#39;gtdampc&#39;</span>,ktmp)
  1244. <a name="l01155"></a>01155 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(ktmp)
  1245. <a name="l01156"></a>01156 <span class="keyword">if</span> (ktmp &gt; 0) <span class="keyword">then</span>
  1246. <a name="l01157"></a>01157 <span class="keyword">allocate</span>(gtdampc(nhor,nlev))
  1247. <a name="l01158"></a>01158 call <a class="code" href="mpimod_8f90.html#a58d54c2e0590e63a7459417831afe5cf">mpgetgp</a>(<span class="stringliteral">&#39;gtdampc&#39;</span>,gtdampc,nhor,nlev)
  1248. <a name="l01159"></a>01159 <span class="keyword">endif</span>
  1249. <a name="l01160"></a>01160
  1250. <a name="l01161"></a>01161 return
  1251. <a name="l01162"></a>01162 <span class="keyword"> end subroutine read_atmos_restart</span>
  1252. <a name="l01163"></a>01163
  1253. <a name="l01164"></a>01164 <span class="comment">! =================</span>
  1254. <a name="l01165"></a>01165 <span class="comment">! SUBROUTINE INITFD</span>
  1255. <a name="l01166"></a>01166 <span class="comment">! =================</span>
  1256. <a name="l01167"></a>01167
  1257. <a name="l01168"></a><a class="code" href="puma_8f90.html#a51f5938296dd343ce807dbb6d1a16e49">01168</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a51f5938296dd343ce807dbb6d1a16e49">initfd</a>
  1258. <a name="l01169"></a>01169 use <span class="keywordflow">pumamod</span>
  1259. <a name="l01170"></a>01170
  1260. <a name="l01171"></a>01171 <span class="keyword">if</span> (nkits &lt; 1) nkits = 1
  1261. <a name="l01172"></a>01172
  1262. <a name="l01173"></a>01173 <span class="comment">! Look for start data and read them if there</span>
  1263. <a name="l01174"></a>01174
  1264. <a name="l01175"></a>01175 call <a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">read_surf</a>(129,so, 1,iread1)
  1265. <a name="l01176"></a>01176 call <a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">read_surf</a>(134,sp, 1,iread2)
  1266. <a name="l01177"></a>01177 call <a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">read_surf</a>(121,sr1,NLEV,iread3)
  1267. <a name="l01178"></a>01178 call <a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">read_surf</a>(122,sr2,NLEV,iread4)
  1268. <a name="l01179"></a>01179 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(123,NLEV,iread123)
  1269. <a name="l01180"></a>01180 <span class="keyword">if</span> (mypid == NROOT .and. iread123 == 0) <span class="keyword">then</span>
  1270. <a name="l01181"></a>01181 <span class="keyword">if</span> (nhelsua &gt; 1) <span class="keyword">then</span>
  1271. <a name="l01182"></a>01182 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR no *_surf_0123.sra file for Held&amp;Suarez&quot;</span>
  1272. <a name="l01183"></a>01183 stop
  1273. <a name="l01184"></a>01184 <span class="keyword">endif</span>
  1274. <a name="l01185"></a>01185 <span class="keyword">endif</span>
  1275. <a name="l01186"></a>01186
  1276. <a name="l01187"></a>01187 <span class="keyword">if</span> (ndiagp &gt; 0) <span class="keyword">then</span>
  1277. <a name="l01188"></a>01188 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(121,NLEV,iread121)
  1278. <a name="l01189"></a>01189 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(122,NLEV,iread122)
  1279. <a name="l01190"></a>01190 <span class="keyword">if</span> (.not. <span class="keyword">allocated</span>(gtdamp)) <span class="keyword">then</span>
  1280. <a name="l01191"></a>01191 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(123,NLEV,iread123)
  1281. <a name="l01192"></a>01192 <span class="keyword">endif</span>
  1282. <a name="l01193"></a>01193 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1283. <a name="l01194"></a>01194 <span class="keyword">if</span> (iread121==0 .or. iread122==0 .or. iread123==0) <span class="keyword">then</span>
  1284. <a name="l01195"></a>01195 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR not all fields (121,122,123) for grid point heating found&quot;</span>
  1285. <a name="l01196"></a>01196 stop
  1286. <a name="l01197"></a>01197 <span class="keyword">endif</span>
  1287. <a name="l01198"></a>01198 <span class="keyword">endif</span>
  1288. <a name="l01199"></a>01199 <span class="keyword">endif</span>
  1289. <a name="l01200"></a>01200
  1290. <a name="l01201"></a>01201 <span class="keyword">if</span> (nconv &gt; 0) <span class="keyword">then</span>
  1291. <a name="l01202"></a>01202 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(124,NLEV,iread124)
  1292. <a name="l01203"></a>01203 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(125,NLEV,iread125)
  1293. <a name="l01204"></a>01204 call <a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(126,NLEV,iread126)
  1294. <a name="l01205"></a>01205 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1295. <a name="l01206"></a>01206 <span class="keyword">if</span> (iread124==0 .or. iread125==0 .or. iread126==0) <span class="keyword">then</span>
  1296. <a name="l01207"></a>01207 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR not all fields (124,125,126) for convective heating found&quot;</span>
  1297. <a name="l01208"></a>01208 stop
  1298. <a name="l01209"></a>01209 <span class="keyword">endif</span>
  1299. <a name="l01210"></a>01210 <span class="keyword">endif</span>
  1300. <a name="l01211"></a>01211 <span class="keyword">endif</span>
  1301. <a name="l01212"></a>01212
  1302. <a name="l01213"></a>01213 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1303. <a name="l01214"></a>01214 <span class="keyword">if</span> (iread1==0 .or. iread2==0 .or. iread3==0 .or. iread4==0) <span class="keyword">then</span>
  1304. <a name="l01215"></a>01215 call <a class="code" href="puma_8f90.html#a4a662c6d6619fc6405eb110f62653dc0">setzt</a> <span class="comment">! setup for aqua-planet</span>
  1305. <a name="l01216"></a>01216 <span class="keyword">else</span>
  1306. <a name="l01217"></a>01217 psmean = psurf * exp(spnorm(1) * sp(1))
  1307. <a name="l01218"></a>01218 sp(1) = 0.0
  1308. <a name="l01219"></a>01219 so(:) = so(:) / (cv * cv) <span class="comment">! descale from [m2/s2]</span>
  1309. <a name="l01220"></a>01220 sr1(:,:) = sr1(:,:) / ct <span class="comment">! descale from [K]</span>
  1310. <a name="l01221"></a>01221 sr2(:,:) = sr2(:,:) / ct <span class="comment">! descale from [K]</span>
  1311. <a name="l01222"></a>01222 sr1(1,:) = sr1(1,:) - t0(:) * sqrt(2.0) <span class="comment">! subtract profile</span>
  1312. <a name="l01223"></a>01223 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(a,f8.2,a)&#39;</span>) <span class="stringliteral">&#39; Mean of Ps = &#39;</span>,0.01*psmean, <span class="stringliteral">&#39;[hPa]&#39;</span>
  1313. <a name="l01224"></a>01224 <span class="keyword">endif</span>
  1314. <a name="l01225"></a>01225 <span class="keyword">endif</span>
  1315. <a name="l01226"></a>01226
  1316. <a name="l01227"></a>01227 <span class="comment">! Add initial noise if wanted</span>
  1317. <a name="l01228"></a>01228
  1318. <a name="l01229"></a>01229 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1319. <a name="l01230"></a>01230 call <a class="code" href="ppp_8f90.html#aa92d6879772b364173e13521d835895e">printprofile</a>
  1320. <a name="l01231"></a>01231 <span class="keyword">if</span> (kick &gt; 10) <span class="keyword">then</span>
  1321. <a name="l01232"></a>01232 call <a class="code" href="puma_8f90.html#abdcee9a4a4d07fc6e5b7a7f5768026ac">noise</a>(kick-10)
  1322. <a name="l01233"></a>01233 <span class="keyword">else</span>
  1323. <a name="l01234"></a>01234 call <a class="code" href="puma_8f90.html#abdcee9a4a4d07fc6e5b7a7f5768026ac">noise</a>(kick)
  1324. <a name="l01235"></a>01235 <span class="keyword">endif</span>
  1325. <a name="l01236"></a>01236 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  1326. <a name="l01237"></a>01237
  1327. <a name="l01238"></a>01238 call <a class="code" href="mpimod_8f90.html#a0c5adf4e8c7e39cf5a1038a1d34ebf30">mpscsp</a>(sp,spm,1)
  1328. <a name="l01239"></a>01239 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1329. <a name="l01240"></a>01240 st(1,:) = sr1(1,:)
  1330. <a name="l01241"></a>01241 stm(1,:) = sr1(1,:)
  1331. <a name="l01242"></a>01242 sz(3,:) = plavor
  1332. <a name="l01243"></a>01243 szm(3,:) = plavor
  1333. <a name="l01244"></a>01244 <span class="keyword">endif</span>
  1334. <a name="l01245"></a>01245 return
  1335. <a name="l01246"></a>01246 <span class="keyword"> end</span>
  1336. <a name="l01247"></a>01247
  1337. <a name="l01248"></a>01248
  1338. <a name="l01249"></a>01249 <span class="comment">! ==========================</span>
  1339. <a name="l01250"></a>01250 <span class="comment">! SUBROUTINE READ_RESOLUTION</span>
  1340. <a name="l01251"></a>01251 <span class="comment">! ==========================</span>
  1341. <a name="l01252"></a>01252
  1342. <a name="l01253"></a><a class="code" href="puma_8f90.html#a811c67568d6f12806d6b6f86813d2bc4">01253</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a811c67568d6f12806d6b6f86813d2bc4">read_resolution</a>
  1343. <a name="l01254"></a>01254 use <span class="keywordflow">pumamod</span>
  1344. <a name="l01255"></a>01255
  1345. <a name="l01256"></a>01256 <span class="keywordtype">character (80)</span> :: ylat
  1346. <a name="l01257"></a>01257 <span class="keywordtype">character (80)</span> :: ylev
  1347. <a name="l01258"></a>01258
  1348. <a name="l01259"></a>01259 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  1349. <a name="l01260"></a>01260 call get_command_argument(1,ylat)
  1350. <a name="l01261"></a>01261 call get_command_argument(2,ylev)
  1351. <a name="l01262"></a>01262 <span class="keyword">read</span>(ylat,*) nlat
  1352. <a name="l01263"></a>01263 <span class="keyword">read</span>(ylev,*) nlev
  1353. <a name="l01264"></a>01264 <span class="keyword">endif</span>
  1354. <a name="l01265"></a>01265
  1355. <a name="l01266"></a>01266 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nlat)
  1356. <a name="l01267"></a>01267 call <a class="code" href="mpimod_8f90.html#a89982355acc98319bfc191dab28da805">mpbci</a>(nlev)
  1357. <a name="l01268"></a>01268 return
  1358. <a name="l01269"></a>01269 <span class="keyword"> end</span>
  1359. <a name="l01270"></a>01270
  1360. <a name="l01271"></a>01271
  1361. <a name="l01272"></a>01272 <span class="comment">! =====================</span>
  1362. <a name="l01273"></a>01273 <span class="comment">! SUBROUTINE RESOLUTION</span>
  1363. <a name="l01274"></a>01274 <span class="comment">! =====================</span>
  1364. <a name="l01275"></a>01275
  1365. <a name="l01276"></a><a class="code" href="puma_8f90.html#a0952e51b37b6196b4f5d85a5cb93c75b">01276</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a0952e51b37b6196b4f5d85a5cb93c75b">resolution</a>
  1366. <a name="l01277"></a>01277 use <span class="keywordflow">pumamod</span>
  1367. <a name="l01278"></a>01278
  1368. <a name="l01279"></a>01279 nlem = nlev - 1
  1369. <a name="l01280"></a>01280 nlep = nlev + 1
  1370. <a name="l01281"></a>01281 nlsq = nlev * nlev
  1371. <a name="l01282"></a>01282
  1372. <a name="l01283"></a>01283 nlon = nlat + nlat <span class="comment">! Longitudes</span>
  1373. <a name="l01284"></a>01284 nlah = nlat / 2
  1374. <a name="l01285"></a>01285 nlpp = nlat / npro
  1375. <a name="l01286"></a>01286 nhpp = nlah / npro
  1376. <a name="l01287"></a>01287 nhor = nlon * nlpp
  1377. <a name="l01288"></a>01288 nugp = nlon * nlat
  1378. <a name="l01289"></a>01289 npgp = nugp / 2
  1379. <a name="l01290"></a>01290
  1380. <a name="l01291"></a>01291 ntru = (nlon - 1) / 3
  1381. <a name="l01292"></a>01292 ntp1 = ntru + 1
  1382. <a name="l01293"></a>01293 nzom = ntp1 + ntp1
  1383. <a name="l01294"></a>01294 nrsp = (ntru + 1) * (ntru + 2)
  1384. <a name="l01295"></a>01295 ncsp = nrsp / 2
  1385. <a name="l01296"></a>01296 nspp = (nrsp + npro - 1) / npro
  1386. <a name="l01297"></a>01297 nesp = nspp * npro
  1387. <a name="l01298"></a>01298
  1388. <a name="l01299"></a>01299 return
  1389. <a name="l01300"></a>01300 <span class="keyword"> end</span>
  1390. <a name="l01301"></a>01301
  1391. <a name="l01302"></a>01302
  1392. <a name="l01303"></a>01303 <span class="comment">! =================</span>
  1393. <a name="l01304"></a>01304 <span class="comment">! SUBROUTINE READNL</span>
  1394. <a name="l01305"></a>01305 <span class="comment">! =================</span>
  1395. <a name="l01306"></a>01306
  1396. <a name="l01307"></a><a class="code" href="puma_8f90.html#a8a75958ca9ba25aeec49db140b483871">01307</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a8a75958ca9ba25aeec49db140b483871">readnl</a>
  1397. <a name="l01308"></a>01308 use <span class="keywordflow">pumamod</span>
  1398. <a name="l01309"></a>01309
  1399. <a name="l01310"></a>01310 <span class="comment">! This workaround is necessaray, because allocatable arrays are</span>
  1400. <a name="l01311"></a>01311 <span class="comment">! not allowed in namelists for FORTRAN versions &lt; F2003</span>
  1401. <a name="l01312"></a>01312
  1402. <a name="l01313"></a>01313 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: MAXLEV = 100
  1403. <a name="l01314"></a>01314 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: MAXSELZW = 42
  1404. <a name="l01315"></a>01315 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: MAXSELSP = ((MAXSELZW+1) * (MAXSELZW+2)) / 2
  1405. <a name="l01316"></a>01316 <span class="keywordtype">integer</span> :: nselect(0:MAXSELZW) = 1 <span class="comment">! NSELECT can be used up tp T42</span>
  1406. <a name="l01317"></a>01317 <span class="keywordtype">integer</span> :: nspecsel(MAXSELSP) = 1 <span class="comment">! Default setting: all modes active</span>
  1407. <a name="l01318"></a>01318 <span class="keywordtype">integer</span> :: ndl(MAXLEV) = 0 <span class="comment">! Diagnostics off</span>
  1408. <a name="l01319"></a>01319 <span class="keywordtype">real</span> :: restim(MAXLEV) = 0.0 <span class="comment">! Tau R</span>
  1409. <a name="l01320"></a>01320 <span class="keywordtype">real</span> :: sigmah(MAXLEV) = 0.0 <span class="comment">! Half level sigma</span>
  1410. <a name="l01321"></a>01321 <span class="keywordtype">real</span> :: t0k(MAXLEV) = 250.0 <span class="comment">! Reference temperature</span>
  1411. <a name="l01322"></a>01322 <span class="keywordtype">real</span> :: tfrc(MAXLEV) = 0.0 <span class="comment">! Tau F</span>
  1412. <a name="l01323"></a>01323
  1413. <a name="l01324"></a>01324 namelist /inp/ &amp;
  1414. <a name="l01325"></a>01325 akap , alpha , alr , alrs , disp , dtep &amp;
  1415. <a name="l01326"></a>01326 , dtns , dtrop , dttrp , dtzz , dvdiff &amp;
  1416. <a name="l01327"></a>01327 , ga , gascon &amp;
  1417. <a name="l01328"></a>01328 , kick , mpstep , nafter , ncoeff , nconv , ncu &amp;
  1418. <a name="l01329"></a>01329 , ndel , ndheat , ndiag , ndiagp , ndl , nenergy &amp;
  1419. <a name="l01330"></a>01330 , nentropy, nextout , ngui , nguidbg , nhelsua , nkits &amp;
  1420. <a name="l01331"></a>01331 , nlevt , nmonths , noutput , nradcv , nruido , nrun &amp;
  1421. <a name="l01332"></a>01332 , nselect , nspecsel, nsponge , <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a> , nstop , nsync &amp;
  1422. <a name="l01333"></a>01333 , ntspd , nvg , nwpd , nwspini , nyears &amp;
  1423. <a name="l01334"></a>01334 , orofac , pac , plarad , pspon , psurf , restim &amp;
  1424. <a name="l01335"></a>01335 , rotspd , seed , sid_day , sigmah , sigmax , sponk &amp;
  1425. <a name="l01336"></a>01336 , syncstr , synctime, t0k &amp;
  1426. <a name="l01337"></a>01337 , tac , tauta , tauts , tdiss , tfrc , tgr
  1427. <a name="l01338"></a>01338
  1428. <a name="l01339"></a>01339 <span class="keyword">open</span>(13,file=puma_namelist,iostat=ios)
  1429. <a name="l01340"></a>01340 <span class="keyword">if</span> (ios == 0) <span class="keyword">then</span>
  1430. <a name="l01341"></a>01341 <span class="keyword">read</span> (13,inp)
  1431. <a name="l01342"></a>01342 <span class="keyword">close</span>(13)
  1432. <a name="l01343"></a>01343 <span class="keyword">endif</span>
  1433. <a name="l01344"></a>01344
  1434. <a name="l01345"></a>01345 <span class="comment">!--- modify basic scales according to namelist </span>
  1435. <a name="l01346"></a>01346 ww = TWOPI/sid_day <span class="comment">! reciprocal of time scale 1/Omega</span>
  1436. <a name="l01347"></a>01347 cv = plarad*ww <span class="comment">! velocity scale (velocity at the equator)</span>
  1437. <a name="l01348"></a>01348 ct = cv*cv/gascon <span class="comment">! temperature scale from hydrostatic equation </span>
  1438. <a name="l01349"></a>01349 <span class="keyword">if</span> (ntspd == 0) ntspd = (24 * nlat) / 32 <span class="comment">! automatic</span>
  1439. <a name="l01350"></a>01350 <span class="keyword">if</span> (mpstep &gt; 0) ntspd = 1440 / mpstep
  1440. <a name="l01351"></a>01351 mpstep = 1440 / ntspd
  1441. <a name="l01352"></a>01352 nafter = ntspd <span class="comment">! daily output</span>
  1442. <a name="l01353"></a>01353 <span class="keyword">if</span> (nwpd &gt; 0 .and. nwpd &lt;= ntspd) <span class="keyword">then</span>
  1443. <a name="l01354"></a>01354 nafter = ntspd / nwpd
  1444. <a name="l01355"></a>01355 <span class="keyword">endif</span>
  1445. <a name="l01356"></a>01356 <span class="keyword">if</span> (ndiag &lt; 1) ndiag = ntspd * 10 <span class="comment">! every 10th. day</span>
  1446. <a name="l01357"></a>01357
  1447. <a name="l01358"></a>01358 <span class="keyword">if</span> (synctime &gt; 0.0) syncstr = 1.0 / (TWOPI * synctime)
  1448. <a name="l01359"></a>01359
  1449. <a name="l01360"></a>01360 <span class="keyword">write</span>(nud,inp)
  1450. <a name="l01361"></a>01361
  1451. <a name="l01362"></a>01362 itru = ntru
  1452. <a name="l01363"></a>01363 <span class="keyword">if</span> (itru &gt; MAXSELZW) itru = MAXSELZW
  1453. <a name="l01364"></a>01364 icsp = ncsp
  1454. <a name="l01365"></a>01365 <span class="keyword">if</span> (icsp &gt; MAXSELSP) icsp = MAXSELSP
  1455. <a name="l01366"></a>01366 ilev = nlev
  1456. <a name="l01367"></a>01367 <span class="keyword">if</span> (ilev &gt; MAXLEV) ilev = MAXLEV
  1457. <a name="l01368"></a>01368
  1458. <a name="l01369"></a>01369 nselzw(0:itru) = nselect(0:itru) <span class="comment">! Copy values to allocated array</span>
  1459. <a name="l01370"></a>01370 nselsp(1:icsp) = nspecsel(1:icsp)
  1460. <a name="l01371"></a>01371 ndil(1:ilev) = ndl(1:ilev)
  1461. <a name="l01372"></a>01372 taur(1:ilev) = restim(1:ilev)
  1462. <a name="l01373"></a>01373 tauf(1:ilev) = tfrc(1:ilev)
  1463. <a name="l01374"></a>01374 sigmh(1:ilev) = sigmah(1:ilev)
  1464. <a name="l01375"></a>01375 t0(1:ilev) = t0k(1:ilev)
  1465. <a name="l01376"></a>01376
  1466. <a name="l01377"></a>01377 return
  1467. <a name="l01378"></a>01378 <span class="keyword"> end</span>
  1468. <a name="l01379"></a>01379
  1469. <a name="l01380"></a>01380
  1470. <a name="l01381"></a>01381 <span class="comment">! ======================</span>
  1471. <a name="l01382"></a>01382 <span class="comment">! SUBROUTINE PPP_DEF_INT</span>
  1472. <a name="l01383"></a>01383 <span class="comment">! ======================</span>
  1473. <a name="l01384"></a>01384
  1474. <a name="l01385"></a><a class="code" href="puma_8f90.html#ad3f0e22c057591beabda5d99c3f40c4c">01385</a> <span class="keyword">subroutine </span><a class="code" href="interfaceprepmod_1_1ppp__def__int.html">ppp_def_int</a>(pname,nvar,ndim)
  1475. <a name="l01386"></a>01386 use <span class="keywordflow">prepmod</span>
  1476. <a name="l01387"></a>01387
  1477. <a name="l01388"></a>01388 <span class="keywordtype">character (*)</span> :: pname
  1478. <a name="l01389"></a>01389 <span class="keywordtype">integer</span>,<span class="keywordtype">target</span> :: nvar
  1479. <a name="l01390"></a>01390
  1480. <a name="l01391"></a>01391 num_ppp = num_ppp + 1
  1481. <a name="l01392"></a>01392 ppp_tab(num_ppp)%name = <span class="stringliteral">&#39;[&#39;</span> // trim(pname) // <span class="stringliteral">&#39;]&#39;</span>
  1482. <a name="l01393"></a>01393 ppp_tab(num_ppp)%isint = .true.
  1483. <a name="l01394"></a>01394 ppp_tab(num_ppp)%n = ndim
  1484. <a name="l01395"></a>01395 ppp_tab(num_ppp)%pint =&gt; nvar
  1485. <a name="l01396"></a>01396 ppp_tab(num_ppp)%preal =&gt; null()
  1486. <a name="l01397"></a>01397 return
  1487. <a name="l01398"></a>01398 <span class="keyword"> end subroutine ppp_def_int</span>
  1488. <a name="l01399"></a>01399
  1489. <a name="l01400"></a>01400
  1490. <a name="l01401"></a>01401 <span class="comment">! =======================</span>
  1491. <a name="l01402"></a>01402 <span class="comment">! SUBROUTINE PPP_DEF_REAL</span>
  1492. <a name="l01403"></a>01403 <span class="comment">! =======================</span>
  1493. <a name="l01404"></a>01404
  1494. <a name="l01405"></a><a class="code" href="puma_8f90.html#a3e4cf6a68be16437f50762bf77e52370">01405</a> <span class="keyword">subroutine </span><a class="code" href="interfaceprepmod_1_1ppp__def__real.html">ppp_def_real</a>(pname,rvar,ndim)
  1495. <a name="l01406"></a>01406 use <span class="keywordflow">prepmod</span>
  1496. <a name="l01407"></a>01407 <span class="keywordtype">character (*)</span> :: pname
  1497. <a name="l01408"></a>01408 <span class="keywordtype">real</span> ,<span class="keywordtype">target</span> :: rvar
  1498. <a name="l01409"></a>01409
  1499. <a name="l01410"></a>01410 num_ppp = num_ppp + 1
  1500. <a name="l01411"></a>01411 ppp_tab(num_ppp)%name = <span class="stringliteral">&#39;[&#39;</span> // trim(pname) // <span class="stringliteral">&#39;]&#39;</span>
  1501. <a name="l01412"></a>01412 ppp_tab(num_ppp)%isint = .false.
  1502. <a name="l01413"></a>01413 ppp_tab(num_ppp)%n = ndim
  1503. <a name="l01414"></a>01414 ppp_tab(num_ppp)%pint =&gt; null()
  1504. <a name="l01415"></a>01415 ppp_tab(num_ppp)%preal =&gt; rvar
  1505. <a name="l01416"></a>01416 return
  1506. <a name="l01417"></a>01417 <span class="keyword"> end subroutine ppp_def_real</span>
  1507. <a name="l01418"></a>01418
  1508. <a name="l01419"></a>01419
  1509. <a name="l01420"></a><a class="code" href="puma_8f90.html#a4c83f2cca37be70c03946309fc4e2a52">01420</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a4c83f2cca37be70c03946309fc4e2a52">ppp_read_i</a>(a,ndim,nread)
  1510. <a name="l01421"></a>01421 <span class="keywordtype">integer</span> :: a(ndim)
  1511. <a name="l01422"></a>01422 <span class="keywordtype">integer</span> :: n
  1512. <a name="l01423"></a>01423
  1513. <a name="l01424"></a>01424 nread = 0
  1514. <a name="l01425"></a>01425 <span class="keyword">read</span> (15,*) n
  1515. <a name="l01426"></a>01426 <span class="keyword">if</span> (n &lt; 1 .or. n &gt; ndim) return
  1516. <a name="l01427"></a>01427 <span class="keyword">read</span> (15,*) a(1:n)
  1517. <a name="l01428"></a>01428 nread = n
  1518. <a name="l01429"></a>01429 return
  1519. <a name="l01430"></a>01430 <span class="keyword"> end</span>
  1520. <a name="l01431"></a>01431
  1521. <a name="l01432"></a>01432
  1522. <a name="l01433"></a><a class="code" href="puma_8f90.html#a1e7bdf5ee1faa40d34b6cc93ebc3acc3">01433</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a1e7bdf5ee1faa40d34b6cc93ebc3acc3">ppp_read_r</a>(a,ndim,nread)
  1523. <a name="l01434"></a>01434 <span class="keywordtype">real</span> :: a(ndim)
  1524. <a name="l01435"></a>01435 <span class="keywordtype">integer</span> :: n
  1525. <a name="l01436"></a>01436
  1526. <a name="l01437"></a>01437 nread = 0
  1527. <a name="l01438"></a>01438 <span class="keyword">read</span> (15,*) n
  1528. <a name="l01439"></a>01439 <span class="keyword">if</span> (n &lt; 1 .or. n &gt; ndim) return
  1529. <a name="l01440"></a>01440 <span class="keyword">read</span> (15,*) a(1:n)
  1530. <a name="l01441"></a>01441 nread = n
  1531. <a name="l01442"></a>01442 return
  1532. <a name="l01443"></a>01443 <span class="keyword"> end</span>
  1533. <a name="l01444"></a>01444
  1534. <a name="l01445"></a>01445
  1535. <a name="l01446"></a>01446 <span class="comment">! ========================</span>
  1536. <a name="l01447"></a>01447 <span class="comment">! SUBROUTINE PPP_INTERFACE</span>
  1537. <a name="l01448"></a>01448 <span class="comment">! ========================</span>
  1538. <a name="l01449"></a>01449
  1539. <a name="l01450"></a><a class="code" href="puma_8f90.html#a859f80933ca252bcc87f27d3996fea05">01450</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a859f80933ca252bcc87f27d3996fea05">ppp_interface</a>
  1540. <a name="l01451"></a>01451 use <span class="keywordflow">pumamod</span>
  1541. <a name="l01452"></a>01452 use <span class="keywordflow">prepmod</span>
  1542. <a name="l01453"></a>01453 <span class="keywordtype">logical</span> :: lexist
  1543. <a name="l01454"></a>01454 <span class="keywordtype">integer</span> :: iostat
  1544. <a name="l01455"></a>01455 <span class="keywordtype">integer</span> :: n
  1545. <a name="l01456"></a>01456 <span class="keywordtype">integer</span> :: ivar
  1546. <a name="l01457"></a>01457 <span class="keywordtype">character (80)</span> :: yname
  1547. <a name="l01458"></a>01458
  1548. <a name="l01459"></a>01459 <span class="keyword">inquire</span>(file=ppp_puma_txt,exist=lexist)
  1549. <a name="l01460"></a>01460 <span class="keyword">if</span> (.not. lexist) return
  1550. <a name="l01461"></a>01461
  1551. <a name="l01462"></a>01462 call <a class="code" href="interfaceprepmod_1_1ppp__def__int.html">ppp_def_int</a>(<span class="stringliteral">&#39;NLAT&#39;</span>,nlat_ppp,1)
  1552. <a name="l01463"></a>01463 call <a class="code" href="interfaceprepmod_1_1ppp__def__int.html">ppp_def_int</a>(<span class="stringliteral">&#39;NLEV&#39;</span>,nlev_ppp,1)
  1553. <a name="l01464"></a>01464
  1554. <a name="l01465"></a>01465 call <a class="code" href="interfaceprepmod_1_1ppp__def__real.html">ppp_def_real</a>(<span class="stringliteral">&#39;SIGMH&#39;</span>,sigmh,nlev)
  1555. <a name="l01466"></a>01466
  1556. <a name="l01467"></a>01467 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*******************************&quot;</span>
  1557. <a name="l01468"></a>01468 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;* Reading file &lt;&quot;</span>,trim(ppp_puma_txt),<span class="stringliteral">&quot;&gt; *&quot;</span>
  1558. <a name="l01469"></a>01469 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*******************************&quot;</span>
  1559. <a name="l01470"></a>01470 <span class="keyword">open</span> (15,file=ppp_puma_txt)
  1560. <a name="l01471"></a>01471 <span class="keyword">read</span> (15,<span class="stringliteral">&#39;(A)&#39;</span>,iostat=iostat) yname
  1561. <a name="l01472"></a>01472 <span class="keyword">do</span> <span class="keyword">while</span> (trim(yname) /= <span class="stringliteral">&#39;[END]&#39;</span> .and. iostat == 0)
  1562. <a name="l01473"></a>01473 <span class="keyword">do</span> j = 1 , num_ppp
  1563. <a name="l01474"></a>01474 <span class="keyword">if</span> (trim(yname) == ppp_tab(j)%name) <span class="keyword">then</span>
  1564. <a name="l01475"></a>01475 <span class="keyword">if</span> (ppp_tab(j)%isint) <span class="keyword">then</span>
  1565. <a name="l01476"></a>01476 call <a class="code" href="puma_8f90.html#a4c83f2cca37be70c03946309fc4e2a52">ppp_read_i</a>(ppp_tab(j)%pint,ppp_tab(j)%n,iread)
  1566. <a name="l01477"></a>01477 <span class="keyword">if</span> (iread == 0) <span class="keyword">then</span>
  1567. <a name="l01478"></a>01478 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR reading &quot;</span>,trim(yname),<span class="stringliteral">&quot; from &quot;</span>,trim(ppp_puma_txt)
  1568. <a name="l01479"></a>01479 stop
  1569. <a name="l01480"></a>01480 <span class="keyword">else</span> <span class="keyword">if</span> (iread == 1) <span class="keyword">then</span>
  1570. <a name="l01481"></a>01481 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* &quot;,A,&quot; = &quot;,I10,&quot; *&quot;)&#39;</span>) yname(1:15),ppp_tab(j)%pint
  1571. <a name="l01482"></a>01482 <span class="keyword">else</span>
  1572. <a name="l01483"></a>01483 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* &quot;,A,&quot; :&quot;,I5,&quot; items *&quot;)&#39;</span>) yname(1:15),iread
  1573. <a name="l01484"></a>01484 <span class="keyword">endif</span>
  1574. <a name="l01485"></a>01485 <span class="keyword">else</span>
  1575. <a name="l01486"></a>01486 call <a class="code" href="puma_8f90.html#a1e7bdf5ee1faa40d34b6cc93ebc3acc3">ppp_read_r</a>(ppp_tab(j)%preal,ppp_tab(j)%n,iread)
  1576. <a name="l01487"></a>01487 <span class="keyword">if</span> (iread == 0) <span class="keyword">then</span>
  1577. <a name="l01488"></a>01488 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR reading &quot;</span>,trim(yname),<span class="stringliteral">&quot; from &quot;</span>,trim(ppp_puma_txt)
  1578. <a name="l01489"></a>01489 stop
  1579. <a name="l01490"></a>01490 <span class="keyword">else</span> <span class="keyword">if</span> (iread == 1) <span class="keyword">then</span>
  1580. <a name="l01491"></a>01491 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* &quot;,A,&quot; = &quot;,G10.4,&quot; *&quot;)&#39;</span>) yname(1:15),ppp_tab(j)%preal
  1581. <a name="l01492"></a>01492 <span class="keyword">else</span>
  1582. <a name="l01493"></a>01493 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(&quot;* &quot;,A,&quot; :&quot;,I5,&quot; items *&quot;)&#39;</span>) yname(1:15),iread
  1583. <a name="l01494"></a>01494 <span class="keyword">endif</span>
  1584. <a name="l01495"></a>01495 <span class="keyword">endif</span>
  1585. <a name="l01496"></a>01496 exit
  1586. <a name="l01497"></a>01497 <span class="keyword">endif</span>
  1587. <a name="l01498"></a>01498 <span class="keyword">enddo</span>
  1588. <a name="l01499"></a>01499 <span class="keyword">read</span> (15,<span class="stringliteral">&#39;(A)&#39;</span>,iostat=iostat) yname
  1589. <a name="l01500"></a>01500 <span class="keyword">enddo</span>
  1590. <a name="l01501"></a>01501 <span class="keyword">if</span> (nlat_ppp /= 0 .and. nlat_ppp /= nlat) <span class="keyword">then</span>
  1591. <a name="l01502"></a>01502 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR *** ERROR *** ERROR *** ERROR ***&quot;</span>
  1592. <a name="l01503"></a>01503 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;# of latitudes mismatch in preprocessor PPP and PUMA&quot;</span>
  1593. <a name="l01504"></a>01504 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;NLAT in PPP : &quot;</span>,nlat_ppp,<span class="stringliteral">&quot; &lt;&quot;</span>,trim(ppp_puma_txt),<span class="stringliteral">&quot;&gt;&quot;</span>
  1594. <a name="l01505"></a>01505 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;NLAT in PUMA : &quot;</span>,nlat
  1595. <a name="l01506"></a>01506 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;Aborting ...&quot;</span>
  1596. <a name="l01507"></a>01507 stop
  1597. <a name="l01508"></a>01508 <span class="keyword">endif</span>
  1598. <a name="l01509"></a>01509 <span class="keyword">if</span> (nlev_ppp /= 0 .and. nlev_ppp /= nlev) <span class="keyword">then</span>
  1599. <a name="l01510"></a>01510 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*** ERROR *** ERROR *** ERROR *** ERROR ***&quot;</span>
  1600. <a name="l01511"></a>01511 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;# of levels mismatch in preprocessor PPP and PUMA&quot;</span>
  1601. <a name="l01512"></a>01512 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;NLEV in PPP : &quot;</span>,nlev_ppp,<span class="stringliteral">&quot; &lt;&quot;</span>,trim(ppp_puma_txt),<span class="stringliteral">&quot;&gt;&quot;</span>
  1602. <a name="l01513"></a>01513 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;NLEV in PUMA : &quot;</span>,nlev
  1603. <a name="l01514"></a>01514 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;Aborting ...&quot;</span>
  1604. <a name="l01515"></a>01515 stop
  1605. <a name="l01516"></a>01516 <span class="keyword">endif</span>
  1606. <a name="l01517"></a>01517 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;*******************************&quot;</span>
  1607. <a name="l01518"></a>01518
  1608. <a name="l01519"></a>01519 return
  1609. <a name="l01520"></a>01520 <span class="keyword"> end subroutine ppp_interface</span>
  1610. <a name="l01521"></a>01521
  1611. <a name="l01522"></a>01522
  1612. <a name="l01523"></a>01523 <span class="comment">! =============================</span>
  1613. <a name="l01524"></a>01524 <span class="comment">! SUBROUTINE SELECT_ZONAL_WAVES</span>
  1614. <a name="l01525"></a>01525 <span class="comment">! =============================</span>
  1615. <a name="l01526"></a>01526
  1616. <a name="l01527"></a><a class="code" href="puma_8f90.html#af1e6869836cefedb3f5cc8a574944d91">01527</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#af1e6869836cefedb3f5cc8a574944d91">select_zonal_waves</a>
  1617. <a name="l01528"></a>01528 use <span class="keywordflow">pumamod</span>
  1618. <a name="l01529"></a>01529
  1619. <a name="l01530"></a>01530 <span class="keyword">if</span> (sum(nselzw(:)) /= NTP1) <span class="keyword">then</span> <span class="comment">! some wavenumbers disabled</span>
  1620. <a name="l01531"></a>01531 lselect = .true.
  1621. <a name="l01532"></a>01532 <span class="keyword">endif</span>
  1622. <a name="l01533"></a>01533 return
  1623. <a name="l01534"></a>01534 <span class="keyword"> end</span>
  1624. <a name="l01535"></a>01535
  1625. <a name="l01536"></a>01536 <span class="comment">! ================================</span>
  1626. <a name="l01537"></a>01537 <span class="comment">! SUBROUTINE SELECT_SPECTRAL_MODES</span>
  1627. <a name="l01538"></a>01538 <span class="comment">! ================================</span>
  1628. <a name="l01539"></a>01539
  1629. <a name="l01540"></a><a class="code" href="puma_8f90.html#a01c0a9ea1eee2f86044600c5e81dbebd">01540</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a01c0a9ea1eee2f86044600c5e81dbebd">select_spectral_modes</a>
  1630. <a name="l01541"></a>01541 use <span class="keywordflow">pumamod</span>
  1631. <a name="l01542"></a>01542
  1632. <a name="l01543"></a>01543 <span class="keyword">if</span> (sum(nselsp(:)) /= NCSP) <span class="keyword">then</span> <span class="comment">! some modes disabled</span>
  1633. <a name="l01544"></a>01544 lspecsel = .true.
  1634. <a name="l01545"></a>01545 <span class="keyword">endif</span>
  1635. <a name="l01546"></a>01546 return
  1636. <a name="l01547"></a>01547 <span class="keyword"> end</span>
  1637. <a name="l01548"></a>01548
  1638. <a name="l01549"></a>01549 <span class="comment">! =====================</span>
  1639. <a name="l01550"></a>01550 <span class="comment">! * SET VERTICAL GRID *</span>
  1640. <a name="l01551"></a>01551 <span class="comment">! =====================</span>
  1641. <a name="l01552"></a>01552
  1642. <a name="l01553"></a><a class="code" href="puma_8f90.html#a00e3481744c3185f0f91d35c101f28e4">01553</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a00e3481744c3185f0f91d35c101f28e4">set_vertical_grid</a>
  1643. <a name="l01554"></a>01554
  1644. <a name="l01555"></a>01555 use <span class="keywordflow">pumamod</span>
  1645. <a name="l01556"></a>01556
  1646. <a name="l01557"></a>01557 <span class="keyword">if</span> (sigmh(NLEV) /= 0.0) return <span class="comment">! Already read in from namelist INP</span>
  1647. <a name="l01558"></a>01558
  1648. <a name="l01559"></a>01559 <span class="keyword">if</span> (nvg == 1) <span class="keyword">then</span> <span class="comment">! Scinocca &amp; Haynes sigma levels</span>
  1649. <a name="l01560"></a>01560
  1650. <a name="l01561"></a>01561 <span class="keyword">if</span> (nlevt &gt;= NLEV) <span class="keyword">then</span> <span class="comment">! Security check for &#39;nlevt&#39;</span>
  1651. <a name="l01562"></a>01562 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;*** ERROR *** nlevt &gt;= NLEV&#39;</span>
  1652. <a name="l01563"></a>01563 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Number of levels (NLEV): &#39;</span>,NLEV
  1653. <a name="l01564"></a>01564 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Number of tropospheric levels (nlevt): &#39;</span>,nlevt
  1654. <a name="l01565"></a>01565 <span class="keyword">endif</span>
  1655. <a name="l01566"></a>01566
  1656. <a name="l01567"></a>01567 <span class="comment">! troposphere: linear spacing in sigma</span>
  1657. <a name="l01568"></a>01568 <span class="comment">! stratosphere: linear spacing in log(sigma)</span>
  1658. <a name="l01569"></a>01569 <span class="comment">! after (see their Appendix):</span>
  1659. <a name="l01570"></a>01570 <span class="comment">! Scinocca, J. F. and P. H. Haynes (1998): Dynamical forcing of</span>
  1660. <a name="l01571"></a>01571 <span class="comment">! stratospheric planetary waves by tropospheric baroclinic eddies.</span>
  1661. <a name="l01572"></a>01572 <span class="comment">! J. Atmos. Sci., 55 (14), 2361-2392</span>
  1662. <a name="l01573"></a>01573
  1663. <a name="l01574"></a>01574 <span class="comment">! Here, zsigtran is set to sigma at dtrop (tropopause height for</span>
  1664. <a name="l01575"></a>01575 <span class="comment">! construction of restoration temperature field). If tgr=288.15K,</span>
  1665. <a name="l01576"></a>01576 <span class="comment">! ALR=0.0065K/km and dtrop=11.km, then zsigtran=0.223 (=0.1 in</span>
  1666. <a name="l01577"></a>01577 <span class="comment">! Scinocca and Haynes (1998)).</span>
  1667. <a name="l01578"></a>01578 <span class="comment">! A smoothing of the transition between linear and logarithmic</span>
  1668. <a name="l01579"></a>01579 <span class="comment">! spacing, as noted in Scinocca and Haynes (1998), is not yet</span>
  1669. <a name="l01580"></a>01580 <span class="comment">! implemented.</span>
  1670. <a name="l01581"></a>01581
  1671. <a name="l01582"></a>01582 zsigtran = (1. - alr * dtrop / tgr)**(ga/(gascon*alr))
  1672. <a name="l01583"></a>01583 zsigmin = 1. - (1. - zsigtran) / <span class="keywordtype">real</span>(nlevt)
  1673. <a name="l01584"></a>01584
  1674. <a name="l01585"></a>01585 <span class="keyword">do</span> jlev=1,NLEV
  1675. <a name="l01586"></a>01586 <span class="keyword">if</span> (jlev == 1) <span class="keyword">then</span>
  1676. <a name="l01587"></a>01587 sigmh(jlev) = SIGMAX
  1677. <a name="l01588"></a>01588 elseif (jlev &gt; 1 .and. jlev &lt; NLEV - nlevt) <span class="keyword">then</span>
  1678. <a name="l01589"></a>01589 sigmh(jlev) = exp((log(SIGMAX) - log(zsigtran)) &amp;
  1679. <a name="l01590"></a>01590 &amp; / <span class="keywordtype">real(NLEV - nlevt - 1)</span> * <span class="keywordtype">real(NLEV - nlevt - jlev)</span>
  1680. <a name="l01591"></a>01591 + log(zsigtran))
  1681. <a name="l01592"></a>01592 elseif (jlev &gt;= NLEV - nlevt .and. jlev &lt; NLEV - 1) then
  1682. <a name="l01593"></a>01593 sigmh(jlev) = (zsigtran - zsigmin) / <span class="keywordtype">real(nlevt - 1)</span>
  1683. <a name="l01594"></a>01594 * real(NLEV - 1 - jlev) + zsigmin
  1684. <a name="l01595"></a>01595 elseif (jlev == NLEV - 1) then
  1685. <a name="l01596"></a>01596 sigmh(jlev) = zsigmin
  1686. <a name="l01597"></a>01597 elseif (jlev == NLEV) <span class="keyword">then</span>
  1687. <a name="l01598"></a>01598 sigmh(jlev) = 1.
  1688. <a name="l01599"></a>01599 <span class="keyword">endif</span>
  1689. <a name="l01600"></a>01600 <span class="keyword">enddo</span>
  1690. <a name="l01601"></a>01601 return <span class="comment">! case nvg == 1 finished</span>
  1691. <a name="l01602"></a>01602 <span class="keyword">else</span> <span class="keyword">if</span> (nvg == 2) <span class="keyword">then</span> <span class="comment">! Polvani &amp; Kushner sigma levels</span>
  1692. <a name="l01603"></a>01603 inl = int(<span class="keywordtype">real</span>(NLEV)/(1.0 - sigmax**(1.0/5.0)))
  1693. <a name="l01604"></a>01604 <span class="keyword">do</span> jlev=1,NLEV
  1694. <a name="l01605"></a>01605 sigmh(jlev) = (<span class="keywordtype">real(jlev + inl - NLEV)</span> / <span class="keywordtype">real</span>(inl))**5
  1695. <a name="l01606"></a>01606 <span class="keyword">enddo</span>
  1696. <a name="l01607"></a>01607 return
  1697. <a name="l01608"></a>01608
  1698. <a name="l01609"></a>01609 <span class="comment">! Default (nvg == 0) : equidistant sigma levels</span>
  1699. <a name="l01610"></a>01610
  1700. <a name="l01611"></a>01611 <span class="keyword">else</span>
  1701. <a name="l01612"></a>01612 <span class="keyword">do</span> jlev = 1 , NLEV
  1702. <a name="l01613"></a>01613 sigmh(jlev) = <span class="keywordtype">real(jlev)</span> / <span class="keywordtype">real</span>(NLEV)
  1703. <a name="l01614"></a>01614 <span class="keyword">enddo</span>
  1704. <a name="l01615"></a>01615 <span class="keyword">endif</span>
  1705. <a name="l01616"></a>01616
  1706. <a name="l01617"></a>01617 return
  1707. <a name="l01618"></a>01618 <span class="keyword"> end</span>
  1708. <a name="l01619"></a>01619
  1709. <a name="l01620"></a>01620
  1710. <a name="l01621"></a>01621 <span class="comment">! =================</span>
  1711. <a name="l01622"></a>01622 <span class="comment">! SUBROUTINE INITPM</span>
  1712. <a name="l01623"></a>01623 <span class="comment">! =================</span>
  1713. <a name="l01624"></a>01624
  1714. <a name="l01625"></a><a class="code" href="puma_8f90.html#a5087a1dafe7b39d03c6547fde711b55a">01625</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a5087a1dafe7b39d03c6547fde711b55a">initpm</a>
  1715. <a name="l01626"></a>01626 use <span class="keywordflow">pumamod</span>
  1716. <a name="l01627"></a>01627
  1717. <a name="l01628"></a>01628 <span class="keywordtype">real (kind=8)</span> :: radea,zakk,zzakk
  1718. <a name="l01629"></a>01629 <span class="keywordtype">real</span> :: zsigb <span class="comment">! sigma_b for Held &amp; Suarez frictional</span>
  1719. <a name="l01630"></a>01630 <span class="comment">! and heating timescales</span>
  1720. <a name="l01631"></a>01631
  1721. <a name="l01632"></a>01632 radea = plarad <span class="comment">! Planet radius in high precision</span>
  1722. <a name="l01633"></a>01633 plavor = EZ * rotspd <span class="comment">! Planetary vorticity</span>
  1723. <a name="l01634"></a>01634
  1724. <a name="l01635"></a>01635 <span class="comment">! *************************************************************</span>
  1725. <a name="l01636"></a>01636 <span class="comment">! * carries out all initialisation of model prior to running. *</span>
  1726. <a name="l01637"></a>01637 <span class="comment">! * major sections identified with comments. *</span>
  1727. <a name="l01638"></a>01638 <span class="comment">! * this s/r sets the model parameters and all resolution *</span>
  1728. <a name="l01639"></a>01639 <span class="comment">! * dependent quantities. *</span>
  1729. <a name="l01640"></a>01640 <span class="comment">! *************************************************************</span>
  1730. <a name="l01641"></a>01641
  1731. <a name="l01642"></a>01642 <span class="keyword">if</span> (lrestart) nkits=0
  1732. <a name="l01643"></a>01643
  1733. <a name="l01644"></a>01644 <span class="comment">! ****************************************************</span>
  1734. <a name="l01645"></a>01645 <span class="comment">! * Check for enabling / disabling zonal wavenumbers *</span>
  1735. <a name="l01646"></a>01646 <span class="comment">! ****************************************************</span>
  1736. <a name="l01647"></a>01647
  1737. <a name="l01648"></a>01648 call <a class="code" href="puma_8f90.html#af1e6869836cefedb3f5cc8a574944d91">select_zonal_waves</a>
  1738. <a name="l01649"></a>01649 <span class="keyword">if</span> (npro == 1) call <a class="code" href="puma_8f90.html#a01c0a9ea1eee2f86044600c5e81dbebd">select_spectral_modes</a>
  1739. <a name="l01650"></a>01650
  1740. <a name="l01651"></a>01651 <span class="comment">! *********************</span>
  1741. <a name="l01652"></a>01652 <span class="comment">! * set vertical grid *</span>
  1742. <a name="l01653"></a>01653 <span class="comment">! *********************</span>
  1743. <a name="l01654"></a>01654
  1744. <a name="l01655"></a>01655 call <a class="code" href="ppp_8f90.html#a00e3481744c3185f0f91d35c101f28e4">set_vertical_grid</a>
  1745. <a name="l01656"></a>01656
  1746. <a name="l01657"></a>01657 dsigma(1 ) = sigmh(1)
  1747. <a name="l01658"></a>01658 dsigma(2:NLEV) = sigmh(2:NLEV) - sigmh(1:NLEM)
  1748. <a name="l01659"></a>01659
  1749. <a name="l01660"></a>01660 rdsig(:) = 0.5 / dsigma(:)
  1750. <a name="l01661"></a>01661
  1751. <a name="l01662"></a>01662 sigma(1 ) = 0.5 * sigmh(1)
  1752. <a name="l01663"></a>01663 sigma(2:NLEV) = 0.5 * (sigmh(1:NLEM) + sigmh(2:NLEV))
  1753. <a name="l01664"></a>01664
  1754. <a name="l01665"></a>01665 <span class="comment">! Initialize profile of tau R if not set in namelist</span>
  1755. <a name="l01666"></a>01666
  1756. <a name="l01667"></a>01667 <span class="keyword">if</span> (taur(NLEV) == 0.0) <span class="keyword">then</span>
  1757. <a name="l01668"></a>01668 <span class="keyword">do</span> jlev = 1 , NLEV
  1758. <a name="l01669"></a>01669 taur(jlev) = 158.0 / PI * atan(1.0 - sigma(jlev))
  1759. <a name="l01670"></a>01670 <span class="keyword">if</span> (taur(jlev) &gt; 30.0) taur(jlev) = 30.0
  1760. <a name="l01671"></a>01671 <span class="keyword">enddo</span>
  1761. <a name="l01672"></a>01672 <span class="keyword">endif</span>
  1762. <a name="l01673"></a>01673
  1763. <a name="l01674"></a>01674 <span class="comment">! Initialize profile of tau F if not set in namelist</span>
  1764. <a name="l01675"></a>01675
  1765. <a name="l01676"></a>01676 <span class="keyword">if</span> (tauf(NLEV) == 0.0) <span class="keyword">then</span>
  1766. <a name="l01677"></a>01677 <span class="keyword">do</span> jlev = 1 , NLEV
  1767. <a name="l01678"></a>01678 <span class="keyword">if</span> (sigma(jlev) &gt; 0.8) <span class="keyword">then</span>
  1768. <a name="l01679"></a>01679 tauf(jlev) = exp(10.0 * (1.0 - sigma(jlev))) / 2.718
  1769. <a name="l01680"></a>01680 <span class="keyword">endif</span>
  1770. <a name="l01681"></a>01681 <span class="keyword">enddo</span>
  1771. <a name="l01682"></a>01682 <span class="keyword">endif</span>
  1772. <a name="l01683"></a>01683
  1773. <a name="l01684"></a>01684 <span class="comment">! Compute 1.0 / (2 Pi * tau) for efficient use in calculations</span>
  1774. <a name="l01685"></a>01685 <span class="comment">! A day is 2 Pi in non dimensional units using omega as scaling</span>
  1775. <a name="l01686"></a>01686
  1776. <a name="l01687"></a>01687 <span class="keyword">where</span> (taur(:) &gt; 0.0)
  1777. <a name="l01688"></a>01688 damp(:) = 1.0 / (TWOPI * taur(:))
  1778. <a name="l01689"></a>01689 endwhere
  1779. <a name="l01690"></a>01690
  1780. <a name="l01691"></a>01691 <span class="keyword">where</span> (tauf(:) &gt; 0.0)
  1781. <a name="l01692"></a>01692 fric(:) = 1.0 / (TWOPI * tauf(:))
  1782. <a name="l01693"></a>01693 endwhere
  1783. <a name="l01694"></a>01694
  1784. <a name="l01695"></a>01695 <span class="keyword">if</span> (nsponge == 1) call <a class="code" href="puma_8f90.html#a0c040011dabc1b712353c37a4d90cc68">sponge</a>
  1785. <a name="l01696"></a>01696
  1786. <a name="l01697"></a>01697
  1787. <a name="l01698"></a>01698 <span class="comment">! annual cycle period and phase in timesteps</span>
  1788. <a name="l01699"></a>01699
  1789. <a name="l01700"></a>01700 <span class="keyword">if</span> (tac &gt; 0.0) tac = TWOPI / (ntspd * tac)
  1790. <a name="l01701"></a>01701 pac = pac * ntspd
  1791. <a name="l01702"></a>01702
  1792. <a name="l01703"></a>01703 <span class="comment">! compute internal diffusion parameter</span>
  1793. <a name="l01704"></a>01704
  1794. <a name="l01705"></a>01705 jdelh = ndel/2
  1795. <a name="l01706"></a>01706 <span class="keyword">if</span> (tdiss &gt; 0.0) <span class="keyword">then</span>
  1796. <a name="l01707"></a>01707 zakk = ww*(radea**ndel)/(TWOPI*tdiss*((NTRU*(NTRU+1.))**jdelh))
  1797. <a name="l01708"></a>01708 <span class="keyword">else</span>
  1798. <a name="l01709"></a>01709 zakk = 0.0
  1799. <a name="l01710"></a>01710 <span class="keyword">endif</span>
  1800. <a name="l01711"></a>01711 zzakk = zakk / (ww*(radea**ndel))
  1801. <a name="l01712"></a>01712
  1802. <a name="l01713"></a>01713 <span class="comment">! set coefficients which depend on wavenumber</span>
  1803. <a name="l01714"></a>01714
  1804. <a name="l01715"></a>01715 zrsq2 = 1.0 / sqrt(2.0)
  1805. <a name="l01716"></a>01716
  1806. <a name="l01717"></a>01717 jr =-1
  1807. <a name="l01718"></a>01718 jw = 0
  1808. <a name="l01719"></a>01719 <span class="keyword">do</span> jm=0,NTRU
  1809. <a name="l01720"></a>01720 <span class="keyword">do</span> jn=jm,NTRU
  1810. <a name="l01721"></a>01721 jr=jr+2
  1811. <a name="l01722"></a>01722 ji=jr+1
  1812. <a name="l01723"></a>01723 jw=jw+1
  1813. <a name="l01724"></a>01724 nindex(jr)=jn
  1814. <a name="l01725"></a>01725 nindex(ji)=jn
  1815. <a name="l01726"></a>01726 spnorm(jr)=zrsq2
  1816. <a name="l01727"></a>01727 spnorm(ji)=zrsq2
  1817. <a name="l01728"></a>01728 zsq = jn * (jn+1)
  1818. <a name="l01729"></a>01729 <span class="keyword">if</span> (jn &gt; 0) <span class="keyword">then</span>
  1819. <a name="l01730"></a>01730 srcn(jr) = 1.0 / zsq
  1820. <a name="l01731"></a>01731 srcn(ji) = srcn(jr)
  1821. <a name="l01732"></a>01732 <span class="keyword">endif</span>
  1822. <a name="l01733"></a>01733 sak(jr) = -zzakk * zsq**jdelh
  1823. <a name="l01734"></a>01734 sak(ji) = sak(jr)
  1824. <a name="l01735"></a>01735 <span class="keyword">enddo</span>
  1825. <a name="l01736"></a>01736 zrsq2=-zrsq2
  1826. <a name="l01737"></a>01737 <span class="keyword">enddo</span>
  1827. <a name="l01738"></a>01738
  1828. <a name="l01739"></a>01739 <span class="comment">! finally make temperatures dimensionless</span>
  1829. <a name="l01740"></a>01740
  1830. <a name="l01741"></a>01741 dtns = dtns / ct
  1831. <a name="l01742"></a>01742 dtep = dtep / ct
  1832. <a name="l01743"></a>01743 <span class="comment">! dttrp = dttrp / ct</span>
  1833. <a name="l01744"></a>01744 t0(:) = t0(:) / ct
  1834. <a name="l01745"></a>01745
  1835. <a name="l01746"></a>01746 <span class="comment">! print out</span>
  1836. <a name="l01747"></a>01747
  1837. <a name="l01748"></a>01748 <span class="keyword">write</span>(nud,8120)
  1838. <a name="l01749"></a>01749 <span class="keyword">write</span>(nud,8000)
  1839. <a name="l01750"></a>01750 <span class="keyword">write</span>(nud,8010) NLEV
  1840. <a name="l01751"></a>01751 <span class="keyword">write</span>(nud,8020) NTRU
  1841. <a name="l01752"></a>01752 <span class="keyword">write</span>(nud,8030) NLAT
  1842. <a name="l01753"></a>01753 <span class="keyword">write</span>(nud,8040) NLON
  1843. <a name="l01754"></a>01754 <span class="keyword">if</span> (zakk == 0.0) <span class="keyword">then</span>
  1844. <a name="l01755"></a>01755 <span class="keyword">write</span>(nud,8060)
  1845. <a name="l01756"></a>01756 <span class="keyword">else</span>
  1846. <a name="l01757"></a>01757 <span class="keyword">write</span>(nud,8070) ndel
  1847. <a name="l01758"></a>01758 <span class="keyword">write</span>(nud,8080)
  1848. <a name="l01759"></a>01759 <span class="keyword">write</span>(nud,8090) zakk,ndel
  1849. <a name="l01760"></a>01760 <span class="keyword">write</span>(nud,8100) tdiss
  1850. <a name="l01761"></a>01761 <span class="keyword">endif</span>
  1851. <a name="l01762"></a>01762 <span class="keyword">write</span>(nud,8110) PNU
  1852. <a name="l01763"></a>01763 <span class="keyword">write</span>(nud,8000)
  1853. <a name="l01764"></a>01764 <span class="keyword">write</span>(nud,8120)
  1854. <a name="l01765"></a>01765 return
  1855. <a name="l01766"></a>01766
  1856. <a name="l01767"></a>01767 8000 format(<span class="stringliteral">&#39;*****************************************************&#39;</span>)
  1857. <a name="l01768"></a>01768 8010 format(<span class="stringliteral">&#39;* NLEV = &#39;</span>,i6,<span class="stringliteral">&#39; Number of levels *&#39;</span>)
  1858. <a name="l01769"></a>01769 8020 format(<span class="stringliteral">&#39;* NTRU = &#39;</span>,i6,<span class="stringliteral">&#39; Triangular truncation *&#39;</span>)
  1859. <a name="l01770"></a>01770 8030 format(<span class="stringliteral">&#39;* NLAT = &#39;</span>,i6,<span class="stringliteral">&#39; Number of latitudes *&#39;</span>)
  1860. <a name="l01771"></a>01771 8040 format(<span class="stringliteral">&#39;* NLON = &#39;</span>,i6,<span class="stringliteral">&#39; Number of longitues *&#39;</span>)
  1861. <a name="l01772"></a>01772 8060 format(<span class="stringliteral">&#39;* No lateral dissipation *&#39;</span>)
  1862. <a name="l01773"></a>01773 8070 format(<span class="stringliteral">&#39;* ndel = &#39;</span>,i6,<span class="stringliteral">&#39; Lateral dissipation *&#39;</span>)
  1863. <a name="l01774"></a>01774 8080 format(<span class="stringliteral">&#39;* on vorticity, divergence and temperature *&#39;</span>)
  1864. <a name="l01775"></a>01775 8090 format(<span class="stringliteral">&#39;* with diffusion coefficient = &#39;</span>,e13.4,<span class="stringliteral">&#39; m**&#39;</span>,i1,<span class="stringliteral">&#39;/s *&#39;</span>)
  1865. <a name="l01776"></a>01776 8100 format(<span class="stringliteral">&#39;* e-folding time for smallest scale is &#39;</span>,f7.3,<span class="stringliteral">&#39; days *&#39;</span>)
  1866. <a name="l01777"></a>01777 8110 format(<span class="stringliteral">&#39;* Robert time filter with parameter PNU =&#39;</span>,f8.3,<span class="stringliteral">&#39; *&#39;</span>)
  1867. <a name="l01778"></a>01778 8120 format(/)
  1868. <a name="l01779"></a>01779 <span class="keyword"> end</span>
  1869. <a name="l01780"></a>01780
  1870. <a name="l01781"></a>01781
  1871. <a name="l01782"></a>01782 <span class="comment">! =================</span>
  1872. <a name="l01783"></a>01783 <span class="comment">! SUBROUTINE MAKEBM</span>
  1873. <a name="l01784"></a>01784 <span class="comment">! =================</span>
  1874. <a name="l01785"></a>01785
  1875. <a name="l01786"></a><a class="code" href="puma_8f90.html#aa2b3f98ff1c27bb557c695c15708ad1f">01786</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#aa2b3f98ff1c27bb557c695c15708ad1f">makebm</a>
  1876. <a name="l01787"></a>01787 use <span class="keywordflow">pumamod</span>
  1877. <a name="l01788"></a>01788
  1878. <a name="l01789"></a>01789 zdeltsq = delt * delt
  1879. <a name="l01790"></a>01790
  1880. <a name="l01791"></a>01791 <span class="keyword">do</span> jlev1 = 1 , NLEV
  1881. <a name="l01792"></a>01792 <span class="keyword">do</span> jlev2 = 1 , NLEV
  1882. <a name="l01793"></a>01793 zaq = zdeltsq * (t0(jlev1) * dsigma(jlev2)&amp;
  1883. <a name="l01794"></a>01794 &amp; + dot_product(xlphi(:,jlev1),xlt(jlev2,:)))
  1884. <a name="l01795"></a>01795 bm1(jlev2,jlev1,1:NTRU) = zaq
  1885. <a name="l01796"></a>01796 <span class="keyword">enddo</span>
  1886. <a name="l01797"></a>01797 <span class="keyword">enddo</span>
  1887. <a name="l01798"></a>01798
  1888. <a name="l01799"></a>01799 <span class="keyword">do</span> jn=1,NTRU
  1889. <a name="l01800"></a>01800 <span class="keyword">do</span> jlev = 1 , NLEV
  1890. <a name="l01801"></a>01801 bm1(jlev,jlev,jn) = bm1(jlev,jlev,jn) + 1.0 / (jn*(jn+1))
  1891. <a name="l01802"></a>01802 <span class="keyword">enddo</span>
  1892. <a name="l01803"></a>01803 call <a class="code" href="puma_8f90.html#ac5b1247975fc97ef45931e410766a417">minvers</a>(bm1(1,1,jn),NLEV)
  1893. <a name="l01804"></a>01804 <span class="keyword">enddo</span>
  1894. <a name="l01805"></a>01805 return
  1895. <a name="l01806"></a>01806 <span class="keyword"> end</span>
  1896. <a name="l01807"></a>01807
  1897. <a name="l01808"></a>01808 <span class="comment">! =================</span>
  1898. <a name="l01809"></a>01809 <span class="comment">! SUBROUTINE INITSI</span>
  1899. <a name="l01810"></a>01810 <span class="comment">! =================</span>
  1900. <a name="l01811"></a>01811
  1901. <a name="l01812"></a><a class="code" href="puma_8f90.html#a96b9223819624937b18b4e5b29e95a91">01812</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a96b9223819624937b18b4e5b29e95a91">initsi</a>
  1902. <a name="l01813"></a>01813 use <span class="keywordflow">pumamod</span>
  1903. <a name="l01814"></a>01814
  1904. <a name="l01815"></a>01815 <span class="comment">! **********************************************</span>
  1905. <a name="l01816"></a>01816 <span class="comment">! * Initialisation of the Semi Implicit scheme *</span>
  1906. <a name="l01817"></a>01817 <span class="comment">! **********************************************</span>
  1907. <a name="l01818"></a>01818
  1908. <a name="l01819"></a>01819 dimension zalp(NLEV),zh(NLEV)
  1909. <a name="l01820"></a>01820 dimension ztautk(NLEV,NLEV)
  1910. <a name="l01821"></a>01821 dimension ztaudt(NLEV,NLEV)
  1911. <a name="l01822"></a>01822
  1912. <a name="l01823"></a>01823 tkp(:) = akap * t0(:)
  1913. <a name="l01824"></a>01824 t0d(1:NLEM) = t0(2:NLEV) - t0(1:NLEM)
  1914. <a name="l01825"></a>01825
  1915. <a name="l01826"></a>01826 zalp(2:NLEV) = log(sigmh(2:NLEV)) - log(sigmh(1:NLEM))
  1916. <a name="l01827"></a>01827
  1917. <a name="l01828"></a>01828 xlphi(:,:) = 0.0
  1918. <a name="l01829"></a>01829 xlphi(1,1) = 1.0
  1919. <a name="l01830"></a>01830 <span class="keyword">do</span> jlev = 2 , NLEV
  1920. <a name="l01831"></a>01831 xlphi(jlev,jlev) = 1.0 - zalp(jlev)*sigmh(jlev-1)/dsigma(jlev)
  1921. <a name="l01832"></a>01832 xlphi(jlev,1:jlev-1) = zalp(jlev)
  1922. <a name="l01833"></a>01833 <span class="keyword">enddo</span>
  1923. <a name="l01834"></a>01834
  1924. <a name="l01835"></a>01835 <span class="keyword">do</span> jlev = 1 , NLEV
  1925. <a name="l01836"></a>01836 c(jlev,:) = xlphi(:,jlev) * (dsigma(jlev) / dsigma(:))
  1926. <a name="l01837"></a>01837 <span class="keyword">enddo</span>
  1927. <a name="l01838"></a>01838
  1928. <a name="l01839"></a>01839 <span class="comment">! *********************** tkp(i) = t0(i) * AKAP</span>
  1929. <a name="l01840"></a>01840 <span class="comment">! * matrix xlt - part 1 *</span>
  1930. <a name="l01841"></a>01841 <span class="comment">! ***********************</span>
  1931. <a name="l01842"></a>01842
  1932. <a name="l01843"></a>01843 <span class="keyword">do</span> jlev = 1 , NLEV
  1933. <a name="l01844"></a>01844 ztautk(:,jlev) = tkp(jlev) * c(:,jlev)
  1934. <a name="l01845"></a>01845 <span class="keyword">enddo</span>
  1935. <a name="l01846"></a>01846
  1936. <a name="l01847"></a>01847 <span class="comment">! ********************* dsigma(i) = sigmh(i) - sigmh(i-1)</span>
  1937. <a name="l01848"></a>01848 <span class="comment">! * matrix xlt part 2 * rdsig (i) = 0.5 / dsigma(i)</span>
  1938. <a name="l01849"></a>01849 <span class="comment">! *********************</span>
  1939. <a name="l01850"></a>01850
  1940. <a name="l01851"></a>01851 ztaudt(1,1) = 0.5 * t0d(1) * (sigmh(1) - 1.0)
  1941. <a name="l01852"></a>01852 ztaudt(2:NLEV,1) = 0.5 * t0d(1) * dsigma(2:NLEV)
  1942. <a name="l01853"></a>01853
  1943. <a name="l01854"></a>01854 <span class="keyword">do</span> j= 2 , NLEV
  1944. <a name="l01855"></a>01855 <span class="keyword">do</span> i = 1 , j-1
  1945. <a name="l01856"></a>01856 ztaudt(i,j) = dsigma(i) * rdsig(j) &amp;
  1946. <a name="l01857"></a>01857 * (t0d(j-1) * (sigmh(j-1)-1.0) + t0d(j) * (sigmh(j)-1.0))
  1947. <a name="l01858"></a>01858 <span class="keyword">enddo</span>
  1948. <a name="l01859"></a>01859 ztaudt(j,j) = 0.5 &amp;
  1949. <a name="l01860"></a>01860 * (t0d(j-1) * sigmh(j-1) + t0d(j) * (sigmh(j)-1.0))
  1950. <a name="l01861"></a>01861 <span class="keyword">do</span> i = j+1 , NLEV
  1951. <a name="l01862"></a>01862 ztaudt(i,j) = dsigma(i) * rdsig(j) &amp;
  1952. <a name="l01863"></a>01863 * (t0d(j-1) * sigmh(j-1) + t0d(j) * sigmh(j) )
  1953. <a name="l01864"></a>01864 <span class="keyword">enddo</span>
  1954. <a name="l01865"></a>01865 <span class="keyword">enddo</span>
  1955. <a name="l01866"></a>01866
  1956. <a name="l01867"></a>01867 xlt(:,:) = ztautk(:,:) + ztaudt(:,:)
  1957. <a name="l01868"></a>01868
  1958. <a name="l01869"></a>01869 <span class="comment">! xlt finished</span>
  1959. <a name="l01870"></a>01870
  1960. <a name="l01871"></a>01871 zfctr=0.001*cv*cv/ga
  1961. <a name="l01872"></a>01872 <span class="keyword">do</span> jlev=1,NLEV
  1962. <a name="l01873"></a>01873 zh(jlev) = dot_product(xlphi(:,jlev),t0(:)) * zfctr
  1963. <a name="l01874"></a>01874 <span class="keyword">enddo</span>
  1964. <a name="l01875"></a>01875
  1965. <a name="l01876"></a>01876 <span class="comment">! **********************************</span>
  1966. <a name="l01877"></a>01877 <span class="comment">! * write out vertical information *</span>
  1967. <a name="l01878"></a>01878 <span class="comment">! **********************************</span>
  1968. <a name="l01879"></a>01879
  1969. <a name="l01880"></a>01880 ilev = min(NLEV,5)
  1970. <a name="l01881"></a>01881 <span class="keyword">write</span>(nud,9001)
  1971. <a name="l01882"></a>01882 <span class="keyword">write</span>(nud,9002)
  1972. <a name="l01883"></a>01883 <span class="keyword">write</span>(nud,9003)
  1973. <a name="l01884"></a>01884 <span class="keyword">write</span>(nud,9002)
  1974. <a name="l01885"></a>01885 <span class="keyword">do</span> jlev=1,NLEV
  1975. <a name="l01886"></a>01886 <span class="keyword">write</span>(nud,9004) jlev,sigma(jlev),t0(jlev)*ct,zh(jlev)
  1976. <a name="l01887"></a>01887 <span class="keyword">enddo</span>
  1977. <a name="l01888"></a>01888 <span class="keyword">write</span>(nud,9002)
  1978. <a name="l01889"></a>01889 <span class="keyword">write</span>(nud,9001)
  1979. <a name="l01890"></a>01890
  1980. <a name="l01891"></a>01891 <span class="comment">! matrix c</span>
  1981. <a name="l01892"></a>01892
  1982. <a name="l01893"></a>01893 <span class="keyword">write</span>(nud,9012)
  1983. <a name="l01894"></a>01894 <span class="keyword">write</span>(nud,9013) <span class="stringliteral">&#39;c&#39;</span>,(jlev,jlev=1,ilev)
  1984. <a name="l01895"></a>01895 <span class="keyword">write</span>(nud,9012)
  1985. <a name="l01896"></a>01896 <span class="keyword">do</span> jlev=1,NLEV
  1986. <a name="l01897"></a>01897 <span class="keyword">write</span>(nud,9014) jlev,(c(i,jlev),i=1,ilev)
  1987. <a name="l01898"></a>01898 <span class="keyword">enddo</span>
  1988. <a name="l01899"></a>01899 <span class="keyword">write</span>(nud,9012)
  1989. <a name="l01900"></a>01900 <span class="keyword">write</span>(nud,9001)
  1990. <a name="l01901"></a>01901
  1991. <a name="l01902"></a>01902 <span class="comment">! matrix xlphi</span>
  1992. <a name="l01903"></a>01903
  1993. <a name="l01904"></a>01904 <span class="keyword">write</span>(nud,9012)
  1994. <a name="l01905"></a>01905 <span class="keyword">write</span>(nud,9013) <span class="stringliteral">&#39;xlphi&#39;</span>,(jlev,jlev=1,ilev)
  1995. <a name="l01906"></a>01906 <span class="keyword">write</span>(nud,9012)
  1996. <a name="l01907"></a>01907 <span class="keyword">do</span> jlev=1,NLEV
  1997. <a name="l01908"></a>01908 <span class="keyword">write</span>(nud,9014) jlev,(xlphi(i,jlev),i=1,ilev)
  1998. <a name="l01909"></a>01909 <span class="keyword">enddo</span>
  1999. <a name="l01910"></a>01910 <span class="keyword">write</span>(nud,9012)
  2000. <a name="l01911"></a>01911 <span class="keyword">write</span>(nud,9001)
  2001. <a name="l01912"></a>01912 return
  2002. <a name="l01913"></a>01913 9001 format(/)
  2003. <a name="l01914"></a>01914 9002 format(33(<span class="stringliteral">&#39;*&#39;</span>))
  2004. <a name="l01915"></a>01915 9003 format(<span class="stringliteral">&#39;* Lv * Sigma Basic-T Height *&#39;</span>)
  2005. <a name="l01916"></a>01916 9004 format(<span class="stringliteral">&#39;*&#39;</span>,i3,<span class="stringliteral">&#39; * &#39;</span>,3f8.3,<span class="stringliteral">&#39; *&#39;</span>)
  2006. <a name="l01917"></a>01917 9012 format(69(<span class="stringliteral">&#39;*&#39;</span>))
  2007. <a name="l01918"></a>01918 9013 format(<span class="stringliteral">&#39;* Lv * &#39;</span>,a5,i7,4i12,<span class="stringliteral">&#39; *&#39;</span>)
  2008. <a name="l01919"></a>01919 9014 format(<span class="stringliteral">&#39;*&#39;</span>,i3,<span class="stringliteral">&#39; * &#39;</span>,5f12.8,<span class="stringliteral">&#39; *&#39;</span>)
  2009. <a name="l01920"></a>01920 <span class="keyword"> end</span>
  2010. <a name="l01921"></a>01921
  2011. <a name="l01922"></a>01922 <span class="comment">! =====================</span>
  2012. <a name="l01923"></a>01923 <span class="comment">! SUBROUTINE INITRANDOM</span>
  2013. <a name="l01924"></a>01924 <span class="comment">! =====================</span>
  2014. <a name="l01925"></a>01925
  2015. <a name="l01926"></a><a class="code" href="puma_8f90.html#acbd8e7fdd2e1f60dbca741a700fb292a">01926</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#acbd8e7fdd2e1f60dbca741a700fb292a">initrandom</a>
  2016. <a name="l01927"></a>01927 use <span class="keywordflow">pumamod</span>
  2017. <a name="l01928"></a>01928 <span class="keywordtype">integer</span> :: i, clock
  2018. <a name="l01929"></a>01929
  2019. <a name="l01930"></a>01930 <span class="comment">! Set random number generator seed</span>
  2020. <a name="l01931"></a>01931
  2021. <a name="l01932"></a>01932 call random_seed(size=nseedlen)
  2022. <a name="l01933"></a>01933 <span class="keyword">allocate</span>(meed(nseedlen))
  2023. <a name="l01934"></a>01934
  2024. <a name="l01935"></a>01935 <span class="comment">! Take seed from namelist parameter &#39;SEED&#39; ?</span>
  2025. <a name="l01936"></a>01936
  2026. <a name="l01937"></a>01937 <span class="keyword">if</span> (seed(1) /= 0) <span class="keyword">then</span>
  2027. <a name="l01938"></a>01938 meed(:) = 0
  2028. <a name="l01939"></a>01939 i = nseedlen
  2029. <a name="l01940"></a>01940 <span class="keyword">if</span> (i &gt; 8) i = 8
  2030. <a name="l01941"></a>01941 meed(1:i) = seed(1:i)
  2031. <a name="l01942"></a>01942 <span class="keyword">else</span>
  2032. <a name="l01943"></a>01943 call system_clock(<a class="code" href="pumax_8c.html#ad43c3812e6d13e0518d9f8b8f463ffcf">count</a>=clock)
  2033. <a name="l01944"></a>01944 meed(:) = clock + 37 * (/(i,i=1,nseedlen)/)
  2034. <a name="l01945"></a>01945 <span class="keyword">endif</span>
  2035. <a name="l01946"></a>01946 call random_seed(put=meed)
  2036. <a name="l01947"></a>01947 return
  2037. <a name="l01948"></a>01948 <span class="keyword"> end</span>
  2038. <a name="l01949"></a>01949
  2039. <a name="l01950"></a>01950 <span class="comment">! ====================</span>
  2040. <a name="l01951"></a>01951 <span class="comment">! SUBROUTINE PRINTSEED</span>
  2041. <a name="l01952"></a>01952 <span class="comment">! ====================</span>
  2042. <a name="l01953"></a>01953
  2043. <a name="l01954"></a><a class="code" href="puma_8f90.html#a9a888c599145a63cdd108dffa553b509">01954</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a9a888c599145a63cdd108dffa553b509">printseed</a>
  2044. <a name="l01955"></a>01955 use <span class="keywordflow">pumamod</span>
  2045. <a name="l01956"></a>01956 <span class="keywordtype">integer</span> :: i
  2046. <a name="l01957"></a>01957
  2047. <a name="l01958"></a>01958 <span class="keyword">write</span> (nud,9020)
  2048. <a name="l01959"></a>01959 <span class="keyword">write</span> (nud,9010)
  2049. <a name="l01960"></a>01960 <span class="keyword">do</span> i = 1 , nseedlen
  2050. <a name="l01961"></a>01961 <span class="keyword">write</span> (nud,9000) i,meed(i)
  2051. <a name="l01962"></a>01962 <span class="keyword">enddo</span>
  2052. <a name="l01963"></a>01963 <span class="keyword">write</span> (nud,9010)
  2053. <a name="l01964"></a>01964 <span class="keyword">write</span> (nud,9020)
  2054. <a name="l01965"></a>01965 return
  2055. <a name="l01966"></a>01966 9000 format(<span class="stringliteral">&#39;* seed(&#39;</span>,i1,<span class="stringliteral">&#39;) = &#39;</span>,i10,<span class="stringliteral">&#39; *&#39;</span>)
  2056. <a name="l01967"></a>01967 9010 format(<span class="stringliteral">&#39;************************&#39;</span>)
  2057. <a name="l01968"></a>01968 9020 format(/)
  2058. <a name="l01969"></a>01969 <span class="keyword"> end</span>
  2059. <a name="l01970"></a>01970
  2060. <a name="l01971"></a>01971 <span class="comment">! ====================</span>
  2061. <a name="l01972"></a>01972 <span class="comment">! SUBROUTINE INITRUIDO</span>
  2062. <a name="l01973"></a>01973 <span class="comment">! ====================</span>
  2063. <a name="l01974"></a>01974
  2064. <a name="l01975"></a><a class="code" href="puma_8f90.html#aea6c13c68157972ea21768a5ea43e154">01975</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#aea6c13c68157972ea21768a5ea43e154">initruido</a>
  2065. <a name="l01976"></a>01976 use <span class="keywordflow">pumamod</span>
  2066. <a name="l01977"></a>01977 <span class="keyword">if</span> (nruido &gt; 0) <span class="keyword">then</span>
  2067. <a name="l01978"></a>01978 <span class="keyword">allocate</span>(ruido(nlon,nlat,nlev))
  2068. <a name="l01979"></a>01979 <span class="keyword">allocate</span>(ruidop(nhor,nlev))
  2069. <a name="l01980"></a>01980 ruido = 77
  2070. <a name="l01981"></a>01981 ruidop = 88
  2071. <a name="l01982"></a>01982 <span class="keyword">endif</span>
  2072. <a name="l01983"></a>01983 return
  2073. <a name="l01984"></a>01984 <span class="keyword"> end</span>
  2074. <a name="l01985"></a>01985
  2075. <a name="l01986"></a>01986 <span class="comment">! ====================</span>
  2076. <a name="l01987"></a>01987 <span class="comment">! SUBROUTINE STEPRUIDO</span>
  2077. <a name="l01988"></a>01988 <span class="comment">! ====================</span>
  2078. <a name="l01989"></a>01989
  2079. <a name="l01990"></a><a class="code" href="puma_8f90.html#ab257e27330a3ab13c9c90ebd985ef60e">01990</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ab257e27330a3ab13c9c90ebd985ef60e">stepruido</a>
  2080. <a name="l01991"></a>01991 use <span class="keywordflow">pumamod</span>
  2081. <a name="l01992"></a>01992 <span class="keywordtype">real</span> :: zr
  2082. <a name="l01993"></a>01993 <span class="keywordtype">integer</span> :: need(8)
  2083. <a name="l01994"></a>01994
  2084. <a name="l01995"></a>01995 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2085. <a name="l01996"></a>01996 <span class="keyword">if</span> (nruido == 1) <span class="keyword">then</span>
  2086. <a name="l01997"></a>01997 zr = disp*<a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a>()
  2087. <a name="l01998"></a>01998 ruido(:,:,:) = zr
  2088. <a name="l01999"></a>01999 elseif (nruido == 2) <span class="keyword">then</span>
  2089. <a name="l02000"></a>02000 <span class="keyword">do</span> jlev=1,NLEV
  2090. <a name="l02001"></a>02001 <span class="keyword">do</span> jlat=1,NLAT
  2091. <a name="l02002"></a>02002 <span class="keyword">do</span> jlon=1,NLON
  2092. <a name="l02003"></a>02003 ruido(jlon,jlat,jlev) = disp*<a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a>()
  2093. <a name="l02004"></a>02004 <span class="keyword">enddo</span>
  2094. <a name="l02005"></a>02005 <span class="keyword">enddo</span>
  2095. <a name="l02006"></a>02006 <span class="keyword">enddo</span>
  2096. <a name="l02007"></a>02007 elseif (nruido == 3) <span class="keyword">then</span>
  2097. <a name="l02008"></a>02008 <span class="keyword">do</span> jlev=1,NLEV
  2098. <a name="l02009"></a>02009 <span class="keyword">do</span> jlat=1,NLAT,2
  2099. <a name="l02010"></a>02010 <span class="keyword">do</span> jlon=1,NLON
  2100. <a name="l02011"></a>02011 ruido(jlon,jlat ,jlev) = disp*<a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a>()
  2101. <a name="l02012"></a>02012 ruido(jlon,jlat+1,jlev) = ruido(jlon,jlat,jlev)
  2102. <a name="l02013"></a>02013 <span class="keyword">enddo</span>
  2103. <a name="l02014"></a>02014 <span class="keyword">enddo</span>
  2104. <a name="l02015"></a>02015 <span class="keyword">enddo</span>
  2105. <a name="l02016"></a>02016 <span class="keyword">endif</span>
  2106. <a name="l02017"></a>02017 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  2107. <a name="l02018"></a>02018
  2108. <a name="l02019"></a>02019 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(ruido,ruidop,NLEV)
  2109. <a name="l02020"></a>02020 call random_seed(get=need)
  2110. <a name="l02021"></a>02021 return
  2111. <a name="l02022"></a>02022 <span class="keyword"> end</span>
  2112. <a name="l02023"></a>02023
  2113. <a name="l02024"></a>02024 <span class="comment">! ==================</span>
  2114. <a name="l02025"></a>02025 <span class="comment">! SUBROUTINE MINVERS</span>
  2115. <a name="l02026"></a>02026 <span class="comment">! ==================</span>
  2116. <a name="l02027"></a>02027
  2117. <a name="l02028"></a><a class="code" href="puma_8f90.html#ac5b1247975fc97ef45931e410766a417">02028</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ac5b1247975fc97ef45931e410766a417">minvers</a>(a,n)
  2118. <a name="l02029"></a>02029 dimension a(n,n),b(n,n),indx(n)
  2119. <a name="l02030"></a>02030
  2120. <a name="l02031"></a>02031 b = 0.0
  2121. <a name="l02032"></a>02032 <span class="keyword">do</span> j = 1 , n
  2122. <a name="l02033"></a>02033 b(j,j) = 1.0
  2123. <a name="l02034"></a>02034 <span class="keyword">enddo</span>
  2124. <a name="l02035"></a>02035 call <a class="code" href="puma_8f90.html#afa767a8d587c360ca92357e066b6bf22">ludcmp</a>(a,n,indx)
  2125. <a name="l02036"></a>02036 <span class="keyword">do</span> j = 1 , n
  2126. <a name="l02037"></a>02037 call <a class="code" href="puma_8f90.html#a13d49d9c008cbc01f37c0c31d2012ad4">lubksb</a>(a,n,indx,b(1,j))
  2127. <a name="l02038"></a>02038 <span class="keyword">enddo</span>
  2128. <a name="l02039"></a>02039 a = b
  2129. <a name="l02040"></a>02040 return
  2130. <a name="l02041"></a>02041 <span class="keyword"> end</span>
  2131. <a name="l02042"></a>02042
  2132. <a name="l02043"></a>02043 <span class="comment">! =================</span>
  2133. <a name="l02044"></a>02044 <span class="comment">! SUBROUTINE LUBKSB</span>
  2134. <a name="l02045"></a>02045 <span class="comment">! =================</span>
  2135. <a name="l02046"></a>02046
  2136. <a name="l02047"></a><a class="code" href="puma_8f90.html#a13d49d9c008cbc01f37c0c31d2012ad4">02047</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a13d49d9c008cbc01f37c0c31d2012ad4">lubksb</a>(a,n,indx,b)
  2137. <a name="l02048"></a>02048 dimension a(n,n),b(n),indx(n)
  2138. <a name="l02049"></a>02049 k = 0
  2139. <a name="l02050"></a>02050 <span class="keyword">do</span> i = 1 , n
  2140. <a name="l02051"></a>02051 l = indx(i)
  2141. <a name="l02052"></a>02052 sum = b(l)
  2142. <a name="l02053"></a>02053 b(l) = b(i)
  2143. <a name="l02054"></a>02054 <span class="keyword">if</span> (k &gt; 0) <span class="keyword">then</span>
  2144. <a name="l02055"></a>02055 <span class="keyword">do</span> j = k , i-1
  2145. <a name="l02056"></a>02056 sum = sum - a(i,j) * b(j)
  2146. <a name="l02057"></a>02057 <span class="keyword">enddo</span>
  2147. <a name="l02058"></a>02058 <span class="keyword">else</span> <span class="keyword">if</span> (sum /= 0.0) <span class="keyword">then</span>
  2148. <a name="l02059"></a>02059 k = i
  2149. <a name="l02060"></a>02060 <span class="keyword">endif</span>
  2150. <a name="l02061"></a>02061 b(i) = sum
  2151. <a name="l02062"></a>02062 <span class="keyword">enddo</span>
  2152. <a name="l02063"></a>02063
  2153. <a name="l02064"></a>02064 <span class="keyword">do</span> i = n , 1 , -1
  2154. <a name="l02065"></a>02065 sum = b(i)
  2155. <a name="l02066"></a>02066 <span class="keyword">do</span> j = i+1 , n
  2156. <a name="l02067"></a>02067 sum = sum - a(i,j) * b(j)
  2157. <a name="l02068"></a>02068 <span class="keyword">enddo</span>
  2158. <a name="l02069"></a>02069 b(i) = sum / a(i,i)
  2159. <a name="l02070"></a>02070 <span class="keyword">enddo</span>
  2160. <a name="l02071"></a>02071 return
  2161. <a name="l02072"></a>02072 <span class="keyword"> end</span>
  2162. <a name="l02073"></a>02073
  2163. <a name="l02074"></a>02074 <span class="comment">! =================</span>
  2164. <a name="l02075"></a>02075 <span class="comment">! SUBROUTINE LUDCMP</span>
  2165. <a name="l02076"></a>02076 <span class="comment">! =================</span>
  2166. <a name="l02077"></a>02077
  2167. <a name="l02078"></a><a class="code" href="puma_8f90.html#afa767a8d587c360ca92357e066b6bf22">02078</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#afa767a8d587c360ca92357e066b6bf22">ludcmp</a>(a,n,indx)
  2168. <a name="l02079"></a>02079 dimension a(n,n),indx(n),vv(n)
  2169. <a name="l02080"></a>02080
  2170. <a name="l02081"></a>02081 d = 1.0
  2171. <a name="l02082"></a>02082 vv = 1.0 / maxval(abs(a),2)
  2172. <a name="l02083"></a>02083
  2173. <a name="l02084"></a>02084 <span class="keyword">do</span> 19 j = 1 , n
  2174. <a name="l02085"></a>02085 <span class="keyword">do</span> i = 2 , j-1
  2175. <a name="l02086"></a>02086 a(i,j) = a(i,j) - dot_product(a(i,1:i-1),a(1:i-1,j))
  2176. <a name="l02087"></a>02087 <span class="keyword">enddo</span>
  2177. <a name="l02088"></a>02088 aamax = 0.0
  2178. <a name="l02089"></a>02089 <span class="keyword">do</span> i = j , n
  2179. <a name="l02090"></a>02090 <span class="keyword">if</span> (j &gt; 1) &amp;
  2180. <a name="l02091"></a>02091 &amp; a(i,j) = a(i,j) - dot_product(a(i,1:j-1),a(1:j-1,j))
  2181. <a name="l02092"></a>02092 dum = vv(i) * abs(a(i,j))
  2182. <a name="l02093"></a>02093 <span class="keyword">if</span> (dum .ge. aamax) <span class="keyword">then</span>
  2183. <a name="l02094"></a>02094 imax = i
  2184. <a name="l02095"></a>02095 aamax = dum
  2185. <a name="l02096"></a>02096 <span class="keyword">endif</span>
  2186. <a name="l02097"></a>02097 <span class="keyword">enddo</span>
  2187. <a name="l02098"></a>02098 <span class="keyword">if</span> (j .ne. imax) <span class="keyword">then</span>
  2188. <a name="l02099"></a>02099 <span class="keyword">do</span> 17 k = 1 , n
  2189. <a name="l02100"></a>02100 dum = a(imax,k)
  2190. <a name="l02101"></a>02101 a(imax,k) = a(j,k)
  2191. <a name="l02102"></a>02102 a(j,k) = dum
  2192. <a name="l02103"></a>02103 17 continue
  2193. <a name="l02104"></a>02104 d = -d
  2194. <a name="l02105"></a>02105 vv(imax) = vv(j)
  2195. <a name="l02106"></a>02106 <span class="keyword">endif</span>
  2196. <a name="l02107"></a>02107 indx(j) = imax
  2197. <a name="l02108"></a>02108 <span class="keyword">if</span> (a(j,j) == 0.0) a(j,j) = tiny(a(j,j))
  2198. <a name="l02109"></a>02109 <span class="keyword">if</span> (j &lt; n) a(j+1:n,j) = a(j+1:n,j) / a(j,j)
  2199. <a name="l02110"></a>02110 19 continue
  2200. <a name="l02111"></a>02111 return
  2201. <a name="l02112"></a>02112 <span class="keyword"> end</span>
  2202. <a name="l02113"></a>02113
  2203. <a name="l02114"></a>02114 <span class="comment">! =============================</span>
  2204. <a name="l02115"></a>02115 <span class="comment">! SUBROUTINE FILTER_ZONAL_WAVES</span>
  2205. <a name="l02116"></a>02116 <span class="comment">! =============================</span>
  2206. <a name="l02117"></a>02117
  2207. <a name="l02118"></a><a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">02118</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(pfc)
  2208. <a name="l02119"></a>02119 use <span class="keywordflow">pumamod</span>
  2209. <a name="l02120"></a>02120 dimension pfc(2,NLON/2,NLPP)
  2210. <a name="l02121"></a>02121
  2211. <a name="l02122"></a>02122 <span class="keyword">do</span> jlat = 1 , NLPP
  2212. <a name="l02123"></a>02123 pfc(1,1:NTP1,jlat) = pfc(1,1:NTP1,jlat) * nselzw(:)
  2213. <a name="l02124"></a>02124 pfc(2,1:NTP1,jlat) = pfc(2,1:NTP1,jlat) * nselzw(:)
  2214. <a name="l02125"></a>02125 <span class="keyword">enddo</span>
  2215. <a name="l02126"></a>02126
  2216. <a name="l02127"></a>02127 return
  2217. <a name="l02128"></a>02128 <span class="keyword"> end</span>
  2218. <a name="l02129"></a>02129
  2219. <a name="l02130"></a>02130
  2220. <a name="l02131"></a>02131 <span class="comment">! ================================</span>
  2221. <a name="l02132"></a>02132 <span class="comment">! SUBROUTINE FILTER_SPECTRAL_MODES</span>
  2222. <a name="l02133"></a>02133 <span class="comment">! ================================</span>
  2223. <a name="l02134"></a>02134
  2224. <a name="l02135"></a><a class="code" href="puma_8f90.html#a9a1e7493444984ad2c2161609dbb6e69">02135</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a9a1e7493444984ad2c2161609dbb6e69">filter_spectral_modes</a>
  2225. <a name="l02136"></a>02136 use <span class="keywordflow">pumamod</span>
  2226. <a name="l02137"></a>02137
  2227. <a name="l02138"></a>02138 j = 0
  2228. <a name="l02139"></a>02139 k = -1
  2229. <a name="l02140"></a>02140 <span class="keyword">do</span> m = 0 , NTRU
  2230. <a name="l02141"></a>02141 <span class="keyword">do</span> n = m , NTRU
  2231. <a name="l02142"></a>02142 k = k + 2
  2232. <a name="l02143"></a>02143 j = j + 1
  2233. <a name="l02144"></a>02144 <span class="keyword">if</span> (nselsp(j) == 0) <span class="keyword">then</span>
  2234. <a name="l02145"></a>02145 spp(k:k+1 ) = 0.0
  2235. <a name="l02146"></a>02146 sdp(k:k+1,:) = 0.0
  2236. <a name="l02147"></a>02147 stp(k:k+1,:) = 0.0
  2237. <a name="l02148"></a>02148 spt(k:k+1 ) = 0.0
  2238. <a name="l02149"></a>02149 sdt(k:k+1,:) = 0.0
  2239. <a name="l02150"></a>02150 stt(k:k+1,:) = 0.0
  2240. <a name="l02151"></a>02151 spm(k:k+1 ) = 0.0
  2241. <a name="l02152"></a>02152 sdm(k:k+1,:) = 0.0
  2242. <a name="l02153"></a>02153 stm(k:k+1,:) = 0.0
  2243. <a name="l02154"></a>02154 srp1(k:k+1,:) = 0.0
  2244. <a name="l02155"></a>02155 srp2(k:k+1,:) = 0.0
  2245. <a name="l02156"></a>02156 <span class="keyword">if</span> (n &lt; NTRU) <span class="keyword">then</span>
  2246. <a name="l02157"></a>02157 szp(k+2:k+3,:) = 0.0
  2247. <a name="l02158"></a>02158 szt(k+2:k+3,:) = 0.0
  2248. <a name="l02159"></a>02159 szm(k+2:k+3,:) = 0.0
  2249. <a name="l02160"></a>02160 <span class="keyword">endif</span>
  2250. <a name="l02161"></a>02161 <span class="keyword">endif</span>
  2251. <a name="l02162"></a>02162 <span class="keyword">enddo</span>
  2252. <a name="l02163"></a>02163 <span class="keyword">enddo</span>
  2253. <a name="l02164"></a>02164
  2254. <a name="l02165"></a>02165 return
  2255. <a name="l02166"></a>02166 <span class="keyword"> end</span>
  2256. <a name="l02167"></a>02167
  2257. <a name="l02168"></a>02168
  2258. <a name="l02169"></a>02169 <span class="comment">! ================</span>
  2259. <a name="l02170"></a>02170 <span class="comment">! SUBROUTINE NOISE</span>
  2260. <a name="l02171"></a>02171 <span class="comment">! ================</span>
  2261. <a name="l02172"></a>02172
  2262. <a name="l02173"></a><a class="code" href="puma_8f90.html#abdcee9a4a4d07fc6e5b7a7f5768026ac">02173</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#abdcee9a4a4d07fc6e5b7a7f5768026ac">noise</a>(kickval)
  2263. <a name="l02174"></a>02174 use <span class="keywordflow">pumamod</span>
  2264. <a name="l02175"></a>02175
  2265. <a name="l02176"></a>02176 <span class="comment">! kickval = -1 : read ln(ps) from puma_sp_init</span>
  2266. <a name="l02177"></a>02177 <span class="comment">! kickval = 0 : model runs zonally symmetric with no eddies</span>
  2267. <a name="l02178"></a>02178 <span class="comment">! kickval = 1 : add white noise to ln(Ps) asymmetric hemispheres</span>
  2268. <a name="l02179"></a>02179 <span class="comment">! kickval = 2 : add white noise to ln(Ps) symmetric to the equator</span>
  2269. <a name="l02180"></a>02180 <span class="comment">! kickval = 3 : force mode(1,2) of ln(Ps) allowing reproducable runs</span>
  2270. <a name="l02181"></a>02181 <span class="comment">! kickval = 4 : add white noise to symmetric zonal wavenumbers 7 of ln(Ps)</span>
  2271. <a name="l02182"></a>02182
  2272. <a name="l02183"></a>02183 <span class="keywordtype">integer</span> :: kickval
  2273. <a name="l02184"></a>02184 <span class="keywordtype">integer</span> :: jsp, jsp1, jn, jm
  2274. <a name="l02185"></a>02185 <span class="keywordtype">integer</span> :: jr, ji, ins
  2275. <a name="l02186"></a>02186 <span class="keywordtype">real</span> :: zr, zi, zscale, zrand
  2276. <a name="l02187"></a>02187
  2277. <a name="l02188"></a>02188 zscale = 0.000001 <span class="comment">! amplitude of noise</span>
  2278. <a name="l02189"></a>02189 zr = 0.01 <span class="comment">! kickval=3 value for mode(1,2) real</span>
  2279. <a name="l02190"></a>02190 zi = 0.005 <span class="comment">! kickval=3 value for mode(1,2) imag</span>
  2280. <a name="l02191"></a>02191
  2281. <a name="l02192"></a>02192 <span class="keyword">select</span> <span class="keyword">case</span> (kickval)
  2282. <a name="l02193"></a>02193 <span class="keyword">case</span> (-1)
  2283. <a name="l02194"></a>02194 <span class="keyword">open</span>(71, file=puma_sp_init,form=<span class="stringliteral">&#39;unformatted&#39;</span>,iostat=iostat)
  2284. <a name="l02195"></a>02195 <span class="keyword">if</span> (iostat /= 0) <span class="keyword">then</span>
  2285. <a name="l02196"></a>02196 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39; *** kick=-1: needs file &lt;&#39;</span>,trim(puma_sp_init),<span class="stringliteral">&#39;&gt; ***&#39;</span>
  2286. <a name="l02197"></a>02197 stop
  2287. <a name="l02198"></a>02198 <span class="keyword">endif</span>
  2288. <a name="l02199"></a>02199 <span class="keyword">read</span>(71,iostat=iostat) sp(:)
  2289. <a name="l02200"></a>02200 <span class="keyword">if</span> (iostat /= 0) <span class="keyword">then</span>
  2290. <a name="l02201"></a>02201 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39; *** error reading file &lt;&#39;</span>,trim(puma_sp_init),<span class="stringliteral">&#39;&gt; ***&#39;</span>
  2291. <a name="l02202"></a>02202 stop
  2292. <a name="l02203"></a>02203 <span class="keyword">endif</span>
  2293. <a name="l02204"></a>02204 <span class="keyword">close</span>(71)
  2294. <a name="l02205"></a>02205 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;initial ln(ps) field read from &lt;&#39;</span>,trim(puma_sp_init),<span class="stringliteral">&#39;&gt;&#39;</span>
  2295. <a name="l02206"></a>02206 return
  2296. <a name="l02207"></a>02207 <span class="keyword">case</span> (0) <span class="comment">! do nothing</span>
  2297. <a name="l02208"></a>02208 <span class="keyword">case</span> (1)
  2298. <a name="l02209"></a>02209 jsp1=2*NTP1+1
  2299. <a name="l02210"></a>02210 <span class="keyword">do</span> jsp=jsp1,NRSP
  2300. <a name="l02211"></a>02211 call random_number(zrand)
  2301. <a name="l02212"></a>02212 <span class="keyword">if</span> (mrpid &gt; 0) zrand = zrand + mrpid * 0.01
  2302. <a name="l02213"></a>02213 sp(jsp)=sp(jsp)+zscale*(zrand-0.5)
  2303. <a name="l02214"></a>02214 <span class="keyword">enddo</span>
  2304. <a name="l02215"></a>02215 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;white noise added&#39;</span>
  2305. <a name="l02216"></a>02216 <span class="keyword">case</span> (2)
  2306. <a name="l02217"></a>02217 jr=2*NTP1-1
  2307. <a name="l02218"></a>02218 <span class="keyword">do</span> jm=1,NTRU
  2308. <a name="l02219"></a>02219 <span class="keyword">do</span> jn=jm,NTRU
  2309. <a name="l02220"></a>02220 jr=jr+2
  2310. <a name="l02221"></a>02221 ji=jr+1
  2311. <a name="l02222"></a>02222 <span class="keyword">if</span> (mod(jn+jm,2) == 0) <span class="keyword">then</span>
  2312. <a name="l02223"></a>02223 call random_number(zrand)
  2313. <a name="l02224"></a>02224 <span class="keyword">if</span> (mrpid &gt; 0) zrand = zrand + mrpid * 0.01
  2314. <a name="l02225"></a>02225 sp(jr)=sp(jr)+zscale*(zrand-0.5)
  2315. <a name="l02226"></a>02226 sp(ji)=sp(ji)+zscale*(zrand-0.5)
  2316. <a name="l02227"></a>02227 <span class="keyword">endif</span>
  2317. <a name="l02228"></a>02228 <span class="keyword">enddo</span>
  2318. <a name="l02229"></a>02229 <span class="keyword">enddo</span>
  2319. <a name="l02230"></a>02230 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;symmetric white noise added&#39;</span>
  2320. <a name="l02231"></a>02231 <span class="keyword">case</span> (3)
  2321. <a name="l02232"></a>02232 sp(2*NTP1+3) = sp(2*NTP1+3) + zr
  2322. <a name="l02233"></a>02233 sp(2*NTP1+4) = sp(2*NTP1+4) + zi
  2323. <a name="l02234"></a>02234 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;mode(1,2) of ln(Ps) set to (&#39;</span>,sp(2*NTP1+3),<span class="stringliteral">&#39;,&#39;</span>,sp(2*NTP1+4),<span class="stringliteral">&#39;)&#39;</span>
  2324. <a name="l02235"></a>02235 <span class="keyword">case</span> (4)
  2325. <a name="l02236"></a>02236 jr=2*NTP1-1
  2326. <a name="l02237"></a>02237 <span class="keyword">do</span> jm=1,NTRU
  2327. <a name="l02238"></a>02238 <span class="keyword">do</span> jn=jm,NTRU
  2328. <a name="l02239"></a>02239 jr=jr+2
  2329. <a name="l02240"></a>02240 ji=jr+1
  2330. <a name="l02241"></a>02241 <span class="keyword">if</span> (mod(jn+jm,2) == 0 .and. jm == 7) <span class="keyword">then</span>
  2331. <a name="l02242"></a>02242 call random_number(zrand)
  2332. <a name="l02243"></a>02243 sp(jr)=sp(jr)+zscale*(zrand-0.5)
  2333. <a name="l02244"></a>02244 sp(ji)=sp(ji)+zscale*(zrand-0.5)
  2334. <a name="l02245"></a>02245 <span class="keyword">endif</span>
  2335. <a name="l02246"></a>02246 <span class="keyword">enddo</span>
  2336. <a name="l02247"></a>02247 <span class="keyword">enddo</span>
  2337. <a name="l02248"></a>02248 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;symmetric zonal wavenumbers 7 of ln(Ps) perturbed&#39;</span>, &amp;
  2338. <a name="l02249"></a>02249 &amp; <span class="stringliteral">&#39;with white noise.&#39;</span>
  2339. <a name="l02250"></a>02250 <span class="keyword">case</span> default
  2340. <a name="l02251"></a>02251 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Value &#39;</span>,kickval ,<span class="stringliteral">&#39; for kickval not implemented.&#39;</span>
  2341. <a name="l02252"></a>02252 stop
  2342. <a name="l02253"></a>02253 <span class="keyword">end select</span>
  2343. <a name="l02254"></a>02254
  2344. <a name="l02255"></a>02255 <span class="keyword">if</span> (nwspini == 1) <span class="keyword">then</span>
  2345. <a name="l02256"></a>02256 <span class="keyword">open</span>(71, file=puma_sp_init, form=<span class="stringliteral">&#39;unformatted&#39;</span>)
  2346. <a name="l02257"></a>02257 <span class="keyword">write</span>(71) sp(:)
  2347. <a name="l02258"></a>02258 <span class="keyword">close</span>(71)
  2348. <a name="l02259"></a>02259 <span class="keyword">endif</span>
  2349. <a name="l02260"></a>02260
  2350. <a name="l02261"></a>02261 return
  2351. <a name="l02262"></a>02262 <span class="keyword"> end</span>
  2352. <a name="l02263"></a>02263
  2353. <a name="l02264"></a>02264 <span class="comment">! ================</span>
  2354. <a name="l02265"></a>02265 <span class="comment">! SUBROUTINE SETZT</span>
  2355. <a name="l02266"></a>02266 <span class="comment">! ================</span>
  2356. <a name="l02267"></a><a class="code" href="puma_8f90.html#a4a662c6d6619fc6405eb110f62653dc0">02267</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a4a662c6d6619fc6405eb110f62653dc0">setzt</a>
  2357. <a name="l02268"></a>02268 use <span class="keywordflow">pumamod</span>
  2358. <a name="l02269"></a>02269
  2359. <a name="l02270"></a>02270 <span class="comment">! *************************************************************</span>
  2360. <a name="l02271"></a>02271 <span class="comment">! * Set up the restoration temperature fields sr1 and sr2 *</span>
  2361. <a name="l02272"></a>02272 <span class="comment">! * for aqua planet conditions. *</span>
  2362. <a name="l02273"></a>02273 <span class="comment">! * The temperature at sigma = 1 is &lt;tgr&gt;, entered in kelvin. *</span>
  2363. <a name="l02274"></a>02274 <span class="comment">! * The lapse rate of ALR K/m is assumed under the tropopause *</span>
  2364. <a name="l02275"></a>02275 <span class="comment">! * and zero above. The tropopause is defined by &lt;dtrop&gt;. *</span>
  2365. <a name="l02276"></a>02276 <span class="comment">! * The smoothing ot the tropopause depends on &lt;dttrp&gt;. *</span>
  2366. <a name="l02277"></a>02277 <span class="comment">! ************************************************************* </span>
  2367. <a name="l02278"></a>02278
  2368. <a name="l02279"></a>02279 dimension ztrs(NLEV) <span class="comment">! Mean profile</span>
  2369. <a name="l02280"></a>02280 dimension zfac(NLEV)
  2370. <a name="l02281"></a>02281
  2371. <a name="l02282"></a>02282 sr1(:,:) = 0.0 <span class="comment">! NESP,NLEV</span>
  2372. <a name="l02283"></a>02283 sr2(:,:) = 0.0 <span class="comment">! NESP,NLEV</span>
  2373. <a name="l02284"></a>02284
  2374. <a name="l02285"></a>02285 <span class="comment">! Temperatures in [K]</span>
  2375. <a name="l02286"></a>02286
  2376. <a name="l02287"></a>02287 zsigprev = 1.0 <span class="comment">! sigma value</span>
  2377. <a name="l02288"></a>02288 ztprev = tgr <span class="comment">! Temperature [K]</span>
  2378. <a name="l02289"></a>02289 zzprev = 0.0 <span class="comment">! Height [m]</span>
  2379. <a name="l02290"></a>02290
  2380. <a name="l02291"></a>02291 <span class="keyword">do</span> jlev = NLEV , 1 , -1 <span class="comment">! from bottom to top of atmosphere</span>
  2381. <a name="l02292"></a>02292 zzp=zzprev+(gascon*ztprev/ga)*log(zsigprev/sigma(jlev))
  2382. <a name="l02293"></a>02293 ztp=tgr-dtrop*alr <span class="comment">! temperature at tropopause</span>
  2383. <a name="l02294"></a>02294 ztp=ztp+sqrt((.5*alr*(zzp-dtrop))**2+dttrp**2)
  2384. <a name="l02295"></a>02295 ztp=ztp-.5*alr*(zzp-dtrop)
  2385. <a name="l02296"></a>02296 ztpm=.5*(ztprev+ztp)
  2386. <a name="l02297"></a>02297 zzpp=zzprev+(gascon*ztpm/ga)*log(zsigprev/sigma(jlev))
  2387. <a name="l02298"></a>02298 ztpp=tgr-dtrop*alr
  2388. <a name="l02299"></a>02299 ztpp=ztpp+sqrt((.5*alr*(zzpp-dtrop))**2+dttrp**2)
  2389. <a name="l02300"></a>02300 ztpp=ztpp-.5*alr*(zzpp-dtrop)
  2390. <a name="l02301"></a>02301 ztrs(jlev)=ztpp
  2391. <a name="l02302"></a>02302 zzprev=zzprev+(.5*(ztpp+ztprev)*gascon/ga)*log(zsigprev/sigma(jlev))
  2392. <a name="l02303"></a>02303 ztprev=ztpp
  2393. <a name="l02304"></a>02304 zsigprev=sigma(jlev)
  2394. <a name="l02305"></a>02305 <span class="keyword">enddo</span>
  2395. <a name="l02306"></a>02306
  2396. <a name="l02307"></a>02307 <span class="keyword">do</span> jlev=1,NLEV
  2397. <a name="l02308"></a>02308 ztrs(jlev)=ztrs(jlev)/ct
  2398. <a name="l02309"></a>02309 <span class="keyword">enddo</span>
  2399. <a name="l02310"></a>02310
  2400. <a name="l02311"></a>02311 <span class="comment">!******************************************************************</span>
  2401. <a name="l02312"></a>02312 <span class="comment">! loop to set array zfac - this controls temperature gradients as a</span>
  2402. <a name="l02313"></a>02313 <span class="comment">! function of sigma in tres. it is a sine wave from one at</span>
  2403. <a name="l02314"></a>02314 <span class="comment">! sigma = 1 to zero at stps (sigma at the tropopause) .</span>
  2404. <a name="l02315"></a>02315 <span class="comment">!******************************************************************</span>
  2405. <a name="l02316"></a>02316 <span class="comment">! first find sigma at dtrop</span>
  2406. <a name="l02317"></a>02317 <span class="comment">!</span>
  2407. <a name="l02318"></a>02318 zttrop=tgr-dtrop*alr
  2408. <a name="l02319"></a>02319 ztps=(zttrop/tgr)**(ga/(alr*gascon))
  2409. <a name="l02320"></a>02320 <span class="comment">!</span>
  2410. <a name="l02321"></a>02321 <span class="comment">! now the latitudinal variation in tres is set up ( this being in terms</span>
  2411. <a name="l02322"></a>02322 <span class="comment">! of a deviation from t0 which is usually constant with height)</span>
  2412. <a name="l02323"></a>02323 <span class="comment">!</span>
  2413. <a name="l02324"></a>02324 zsqrt2 = sqrt(2.0)
  2414. <a name="l02325"></a>02325 zsqrt04 = sqrt(0.4)
  2415. <a name="l02326"></a>02326 zsqrt6 = sqrt(6.0)
  2416. <a name="l02327"></a>02327 <span class="keyword">do</span> 2100 jlev=1,NLEV
  2417. <a name="l02328"></a>02328 zfac(jlev)=sin(0.5*PI*(sigma(jlev)-ztps)/(1.-ztps))
  2418. <a name="l02329"></a>02329 <span class="keyword">if</span> (zfac(jlev).lt.0.0) zfac(jlev)=0.0
  2419. <a name="l02330"></a>02330 sr1(1,jlev)=zsqrt2*(ztrs(jlev)-t0(jlev))
  2420. <a name="l02331"></a>02331 sr2(3,jlev)=(1./zsqrt6)*dtns*zfac(jlev)
  2421. <a name="l02332"></a>02332 sr1(5,jlev)=-2./3.*zsqrt04*dtep*zfac(jlev)
  2422. <a name="l02333"></a>02333 2100 continue
  2423. <a name="l02334"></a>02334 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;**************************************************&#39;</span>
  2424. <a name="l02335"></a>02335 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;* Restoration Temperature set up for aqua planet *&#39;</span>
  2425. <a name="l02336"></a>02336 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;**************************************************&#39;</span>
  2426. <a name="l02337"></a>02337 return
  2427. <a name="l02338"></a>02338 <span class="keyword"> end</span>
  2428. <a name="l02339"></a>02339
  2429. <a name="l02340"></a>02340 <span class="comment">! =======================</span>
  2430. <a name="l02341"></a>02341 <span class="comment">! SUBROUTINE PRINTPROFILE</span>
  2431. <a name="l02342"></a>02342 <span class="comment">! =======================</span>
  2432. <a name="l02343"></a>02343
  2433. <a name="l02344"></a><a class="code" href="puma_8f90.html#aa92d6879772b364173e13521d835895e">02344</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#aa92d6879772b364173e13521d835895e">printprofile</a>
  2434. <a name="l02345"></a>02345 use <span class="keywordflow">pumamod</span>
  2435. <a name="l02346"></a>02346
  2436. <a name="l02347"></a>02347 <span class="comment">! **********************************</span>
  2437. <a name="l02348"></a>02348 <span class="comment">! * write out vertical information *</span>
  2438. <a name="l02349"></a>02349 <span class="comment">! **********************************</span>
  2439. <a name="l02350"></a>02350
  2440. <a name="l02351"></a>02351 <span class="keyword">write</span>(nud,9001)
  2441. <a name="l02352"></a>02352 <span class="keyword">write</span>(nud,9002)
  2442. <a name="l02353"></a>02353 <span class="keyword">write</span>(nud,9003)
  2443. <a name="l02354"></a>02354 <span class="keyword">write</span>(nud,9002)
  2444. <a name="l02355"></a>02355
  2445. <a name="l02356"></a>02356 <span class="keyword">do</span> jlev=1,NLEV
  2446. <a name="l02357"></a>02357 zt = (sr1(1,jlev)/sqrt(2.0) + t0(jlev)) * ct
  2447. <a name="l02358"></a>02358 <span class="keyword">if</span> (tauf(jlev) &gt; 0.1) <span class="keyword">then</span>
  2448. <a name="l02359"></a>02359 <span class="keyword">write</span>(nud,9004) jlev,sigma(jlev),zt,taur(jlev),tauf(jlev)
  2449. <a name="l02360"></a>02360 <span class="keyword">else</span>
  2450. <a name="l02361"></a>02361 <span class="keyword">write</span>(nud,9005) jlev,sigma(jlev),zt,taur(jlev)
  2451. <a name="l02362"></a>02362 <span class="keyword">endif</span>
  2452. <a name="l02363"></a>02363 <span class="keyword">enddo</span>
  2453. <a name="l02364"></a>02364
  2454. <a name="l02365"></a>02365 <span class="keyword">write</span>(nud,9002)
  2455. <a name="l02366"></a>02366 <span class="keyword">write</span>(nud,9001)
  2456. <a name="l02367"></a>02367 return
  2457. <a name="l02368"></a>02368 9001 format(/)
  2458. <a name="l02369"></a>02369 9002 format(36(<span class="stringliteral">&#39;*&#39;</span>))
  2459. <a name="l02370"></a>02370 9003 format(<span class="stringliteral">&#39;* Lv * Sigma Restor-T tauR tauF *&#39;</span>)
  2460. <a name="l02371"></a>02371 9004 format(<span class="stringliteral">&#39;*&#39;</span>,i3,<span class="stringliteral">&#39; * &#39;</span>,f8.3,f9.3,2f5.1,<span class="stringliteral">&#39; *&#39;</span>)
  2461. <a name="l02372"></a>02372 9005 format(<span class="stringliteral">&#39;*&#39;</span>,i3,<span class="stringliteral">&#39; * &#39;</span>,f8.3,f9.3,f5.1,<span class="stringliteral">&#39; - *&#39;</span>)
  2462. <a name="l02373"></a>02373 <span class="keyword"> end</span>
  2463. <a name="l02374"></a>02374
  2464. <a name="l02375"></a>02375
  2465. <a name="l02376"></a>02376 <span class="comment">! ====================</span>
  2466. <a name="l02377"></a>02377 <span class="comment">! SUBROUTINE READ_SURF</span>
  2467. <a name="l02378"></a>02378 <span class="comment">! ====================</span>
  2468. <a name="l02379"></a>02379
  2469. <a name="l02380"></a><a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">02380</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#aa8533c8ebc4415ef95ca9c34c4ba7d6b">read_surf</a>(kcode,psp,klev,kread)
  2470. <a name="l02381"></a>02381 use <span class="keywordflow">pumamod</span>
  2471. <a name="l02382"></a>02382
  2472. <a name="l02383"></a>02383 <span class="keywordtype">logical</span> :: lexist
  2473. <a name="l02384"></a>02384 <span class="keywordtype">integer</span> :: kread
  2474. <a name="l02385"></a>02385 <span class="keywordtype">integer</span> :: ihead(8)
  2475. <a name="l02386"></a>02386 <span class="keywordtype">character(len=256)</span> :: yfilename
  2476. <a name="l02387"></a>02387 <span class="keywordtype">real</span> :: psp(NESP,klev)
  2477. <a name="l02388"></a>02388 <span class="keywordtype">real</span> :: zgp(NUGP,klev)
  2478. <a name="l02389"></a>02389 <span class="keywordtype">real</span> :: zpp(NHOR,klev)
  2479. <a name="l02390"></a>02390
  2480. <a name="l02391"></a>02391 kread = 0
  2481. <a name="l02392"></a>02392 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2482. <a name="l02393"></a>02393 <span class="keyword">if</span> (NLAT &lt; 1000) <span class="keyword">then</span>
  2483. <a name="l02394"></a>02394 <span class="keyword">write</span>(yfilename,<span class="stringliteral">&#39;(&quot;N&quot;,I3.3,&quot;_surf_&quot;,I4.4,&quot;.sra&quot;)&#39;</span>) NLAT,kcode
  2484. <a name="l02395"></a>02395 <span class="keyword">else</span>
  2485. <a name="l02396"></a>02396 <span class="keyword">write</span>(yfilename,<span class="stringliteral">&#39;(&quot;N&quot;,I4.4,&quot;_surf_&quot;,I4.4,&quot;.sra&quot;)&#39;</span>) NLAT,kcode
  2486. <a name="l02397"></a>02397 <span class="keyword">endif</span>
  2487. <a name="l02398"></a>02398 <span class="keyword">inquire</span>(file=yfilename,exist=lexist)
  2488. <a name="l02399"></a>02399 <span class="keyword">endif</span>
  2489. <a name="l02400"></a>02400 call <a class="code" href="mpimod_8f90.html#a40b910e38273e7f3c9dc4ed36d3e67a0">mpbcl</a>(lexist)
  2490. <a name="l02401"></a>02401 <span class="keyword">if</span> (.not. lexist) return
  2491. <a name="l02402"></a>02402
  2492. <a name="l02403"></a>02403 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2493. <a name="l02404"></a>02404 <span class="keyword">open</span>(65,file=yfilename,form=<span class="stringliteral">&#39;formatted&#39;</span>)
  2494. <a name="l02405"></a>02405 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Reading file &lt;&#39;</span>,trim(yfilename),<span class="stringliteral">&#39;&gt;&#39;</span>
  2495. <a name="l02406"></a>02406 <span class="keyword">do</span> jlev = 1 , klev
  2496. <a name="l02407"></a>02407 <span class="keyword">read</span> (65,*) ihead(:)
  2497. <a name="l02408"></a>02408 <span class="keyword">read</span> (65,*) zgp(:,jlev)
  2498. <a name="l02409"></a>02409 <span class="keyword">enddo</span>
  2499. <a name="l02410"></a>02410 <span class="keyword">close</span>(65)
  2500. <a name="l02411"></a>02411 <span class="keyword">if</span> (kcode == 134) <span class="keyword">then</span>
  2501. <a name="l02412"></a>02412 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&quot;Converting Ps to LnPs&quot;</span>
  2502. <a name="l02413"></a>02413 zscale = log(100.0) - log(psurf) <span class="comment">! Input [hPa] / PSURF [Pa]</span>
  2503. <a name="l02414"></a>02414 zgp(:,:) = log(zgp(:,:)) + zscale
  2504. <a name="l02415"></a>02415 <span class="keyword">endif</span>
  2505. <a name="l02416"></a>02416 call <a class="code" href="legsym_8f90.html#a4a468562c0549b4ca3ec6ea34f87545a">reg2alt</a>(zgp,klev)
  2506. <a name="l02417"></a>02417 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  2507. <a name="l02418"></a>02418 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,zpp,klev)
  2508. <a name="l02419"></a>02419 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zpp,NLON,NLPP*klev)
  2509. <a name="l02420"></a>02420 <span class="keyword">do</span> jlev = 1 , klev
  2510. <a name="l02421"></a>02421 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zpp(1,jlev),psp(1,jlev))
  2511. <a name="l02422"></a>02422 <span class="keyword">enddo</span>
  2512. <a name="l02423"></a>02423 call <a class="code" href="mpimod_8f90.html#af894efd9525c935f22415e017dcbc482">mpsum</a>(psp,klev)
  2513. <a name="l02424"></a>02424 kread = 1
  2514. <a name="l02425"></a>02425 return
  2515. <a name="l02426"></a>02426 <span class="keyword"> end subroutine read_surf</span>
  2516. <a name="l02427"></a>02427
  2517. <a name="l02428"></a>02428
  2518. <a name="l02429"></a>02429
  2519. <a name="l02430"></a>02430 <span class="comment">! =====================</span>
  2520. <a name="l02431"></a>02431 <span class="comment">! SUBROUTINE READ_VARGP</span>
  2521. <a name="l02432"></a>02432 <span class="comment">! =====================</span>
  2522. <a name="l02433"></a>02433
  2523. <a name="l02434"></a><a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">02434</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a9dfa3f46641f3df498d07ff40df08a57">read_vargp</a>(kcode,klev,kread)
  2524. <a name="l02435"></a>02435 use <span class="keywordflow">pumamod</span>
  2525. <a name="l02436"></a>02436
  2526. <a name="l02437"></a>02437 <span class="keywordtype">logical</span> :: lexist
  2527. <a name="l02438"></a>02438 <span class="keywordtype">integer</span> :: ihead(8)
  2528. <a name="l02439"></a>02439 <span class="keywordtype">character(len=256)</span> :: yfilename
  2529. <a name="l02440"></a>02440 <span class="keywordtype">real</span> :: zgp(NUGP,klev)
  2530. <a name="l02441"></a>02441
  2531. <a name="l02442"></a>02442 kread = 0
  2532. <a name="l02443"></a>02443 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2533. <a name="l02444"></a>02444 <span class="keyword">if</span> (NLAT &lt; 1000) <span class="keyword">then</span>
  2534. <a name="l02445"></a>02445 <span class="keyword">write</span>(yfilename,<span class="stringliteral">&#39;(&quot;N&quot;,I3.3,&quot;_surf_&quot;,I4.4,&quot;.sra&quot;)&#39;</span>) NLAT,kcode
  2535. <a name="l02446"></a>02446 <span class="keyword">else</span>
  2536. <a name="l02447"></a>02447 <span class="keyword">write</span>(yfilename,<span class="stringliteral">&#39;(&quot;N&quot;,I4.4,&quot;_surf_&quot;,I4.4,&quot;.sra&quot;)&#39;</span>) NLAT,kcode
  2537. <a name="l02448"></a>02448 <span class="keyword">endif</span>
  2538. <a name="l02449"></a>02449 <span class="keyword">inquire</span>(file=yfilename,exist=lexist)
  2539. <a name="l02450"></a>02450 <span class="keyword">endif</span>
  2540. <a name="l02451"></a>02451 call <a class="code" href="mpimod_8f90.html#a40b910e38273e7f3c9dc4ed36d3e67a0">mpbcl</a>(lexist)
  2541. <a name="l02452"></a>02452 <span class="keyword">if</span> (.not. lexist) <span class="keyword">then</span>
  2542. <a name="l02453"></a>02453 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2543. <a name="l02454"></a>02454 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;File &lt;&#39;</span>,trim(yfilename),<span class="stringliteral">&#39;&gt; not found&#39;</span>
  2544. <a name="l02455"></a>02455 <span class="keyword">endif</span>
  2545. <a name="l02456"></a>02456 return
  2546. <a name="l02457"></a>02457 <span class="keyword">endif</span>
  2547. <a name="l02458"></a>02458
  2548. <a name="l02459"></a>02459 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2549. <a name="l02460"></a>02460 <span class="keyword">open</span>(65,file=yfilename,form=<span class="stringliteral">&#39;formatted&#39;</span>)
  2550. <a name="l02461"></a>02461 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Reading file &lt;&#39;</span>,trim(yfilename),<span class="stringliteral">&#39;&gt;&#39;</span>
  2551. <a name="l02462"></a>02462 <span class="keyword">do</span> jlev = 1 , klev
  2552. <a name="l02463"></a>02463 <span class="keyword">read</span> (65,*) ihead(:)
  2553. <a name="l02464"></a>02464 <span class="keyword">read</span> (65,*) zgp(:,jlev)
  2554. <a name="l02465"></a>02465 <span class="keyword">enddo</span>
  2555. <a name="l02466"></a>02466 <span class="keyword">close</span>(65)
  2556. <a name="l02467"></a>02467 call <a class="code" href="legsym_8f90.html#a4a468562c0549b4ca3ec6ea34f87545a">reg2alt</a>(zgp,klev)
  2557. <a name="l02468"></a>02468 <span class="keyword">endif</span> <span class="comment">! (mypid == NROOT)</span>
  2558. <a name="l02469"></a>02469
  2559. <a name="l02470"></a>02470 <span class="keyword">select</span> <span class="keyword">case</span>(kcode)
  2560. <a name="l02471"></a>02471 <span class="keyword">case</span>(121)
  2561. <a name="l02472"></a>02472 <span class="comment">!--- non-dimensionalize and shift const radiative rest. temp.</span>
  2562. <a name="l02473"></a>02473 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2563. <a name="l02474"></a>02474 zgp(:,:) = zgp(:,:)/ct
  2564. <a name="l02475"></a>02475 <span class="keyword">do</span> jhor = 1,nugp
  2565. <a name="l02476"></a>02476 zgp(jhor,:) = zgp(jhor,:) - t0(:)
  2566. <a name="l02477"></a>02477 <span class="keyword">enddo</span>
  2567. <a name="l02478"></a>02478 <span class="keyword">endif</span>
  2568. <a name="l02479"></a>02479 <span class="keyword">allocate</span>(gr1(nhor,klev))
  2569. <a name="l02480"></a>02480 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2570. <a name="l02481"></a>02481 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gr1 allocated&#39;</span>
  2571. <a name="l02482"></a>02482 <span class="keyword">endif</span>
  2572. <a name="l02483"></a>02483 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gr1,klev)
  2573. <a name="l02484"></a>02484 <span class="keyword">case</span>(122)
  2574. <a name="l02485"></a>02485 <span class="comment">!--- non-dimensionalize variable. radiative rest. temp.</span>
  2575. <a name="l02486"></a>02486 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2576. <a name="l02487"></a>02487 zgp(:,:) = zgp(:,:)/ct
  2577. <a name="l02488"></a>02488 <span class="keyword">endif</span>
  2578. <a name="l02489"></a>02489 <span class="keyword">allocate</span>(gr2(nhor,klev))
  2579. <a name="l02490"></a>02490 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2580. <a name="l02491"></a>02491 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gr2 allocated&#39;</span>
  2581. <a name="l02492"></a>02492 <span class="keyword">endif</span>
  2582. <a name="l02493"></a>02493 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gr2,klev)
  2583. <a name="l02494"></a>02494 <span class="keyword">case</span>(123)
  2584. <a name="l02495"></a>02495 <span class="comment">!--- non-dimensionalize radiative relaxation time scale</span>
  2585. <a name="l02496"></a>02496 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2586. <a name="l02497"></a>02497 zgp(:,:) = zgp(:,:)/ww
  2587. <a name="l02498"></a>02498 <span class="keyword">endif</span>
  2588. <a name="l02499"></a>02499 <span class="keyword">allocate</span>(gtdamp(nhor,klev))
  2589. <a name="l02500"></a>02500 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2590. <a name="l02501"></a>02501 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gtdamp allocated&#39;</span>
  2591. <a name="l02502"></a>02502 <span class="keyword">endif</span>
  2592. <a name="l02503"></a>02503 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gtdamp,klev)
  2593. <a name="l02504"></a>02504 <span class="keyword">case</span>(124)
  2594. <a name="l02505"></a>02505 <span class="comment">!--- non-dimensionalize and shift const. convective rest. temp.</span>
  2595. <a name="l02506"></a>02506 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2596. <a name="l02507"></a>02507 zgp(:,:) = zgp(:,:)/ct
  2597. <a name="l02508"></a>02508 <span class="keyword">do</span> jhor = 1,nugp
  2598. <a name="l02509"></a>02509 zgp(jhor,:) = zgp(jhor,:) - t0(:)
  2599. <a name="l02510"></a>02510 <span class="keyword">enddo</span>
  2600. <a name="l02511"></a>02511 <span class="keyword">endif</span>
  2601. <a name="l02512"></a>02512 <span class="keyword">allocate</span>(gr1c(nhor,klev))
  2602. <a name="l02513"></a>02513 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2603. <a name="l02514"></a>02514 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gr1c allocated&#39;</span>
  2604. <a name="l02515"></a>02515 <span class="keyword">endif</span>
  2605. <a name="l02516"></a>02516 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gr1c,klev)
  2606. <a name="l02517"></a>02517 <span class="keyword">case</span>(125)
  2607. <a name="l02518"></a>02518 <span class="comment">!--- non-dimensionalize variable. convective rest. temp.</span>
  2608. <a name="l02519"></a>02519 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2609. <a name="l02520"></a>02520 zgp(:,:) = zgp(:,:)/ct
  2610. <a name="l02521"></a>02521 <span class="keyword">endif</span>
  2611. <a name="l02522"></a>02522 <span class="keyword">allocate</span>(gr2c(nhor,klev))
  2612. <a name="l02523"></a>02523 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2613. <a name="l02524"></a>02524 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gr2c allocated&#39;</span>
  2614. <a name="l02525"></a>02525 <span class="keyword">endif</span>
  2615. <a name="l02526"></a>02526 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gr2c,klev)
  2616. <a name="l02527"></a>02527 <span class="keyword">case</span>(126)
  2617. <a name="l02528"></a>02528 <span class="comment">!--- non-dimensionalize convective relaxation time scale</span>
  2618. <a name="l02529"></a>02529 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2619. <a name="l02530"></a>02530 zgp(:,:) = zgp(:,:)/ww
  2620. <a name="l02531"></a>02531 <span class="keyword">endif</span>
  2621. <a name="l02532"></a>02532 <span class="keyword">allocate</span>(gtdampc(nhor,klev))
  2622. <a name="l02533"></a>02533 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2623. <a name="l02534"></a>02534 <span class="keyword">write</span>(nud,*) <span class="stringliteral">&#39;Field gtdampc allocated&#39;</span>
  2624. <a name="l02535"></a>02535 <span class="keyword">endif</span>
  2625. <a name="l02536"></a>02536 call <a class="code" href="mpimod_8f90.html#ac66e76c6144dfeadbc03bc5817553250">mpscgp</a>(zgp,gtdampc,klev)
  2626. <a name="l02537"></a>02537 <span class="keyword">end select</span>
  2627. <a name="l02538"></a>02538 kread = 1
  2628. <a name="l02539"></a>02539 return
  2629. <a name="l02540"></a>02540 <span class="keyword"> end subroutine read_vargp</span>
  2630. <a name="l02541"></a>02541
  2631. <a name="l02542"></a>02542 <span class="comment">! ===============</span>
  2632. <a name="l02543"></a>02543 <span class="comment">! SUBROUTINE DIAG</span>
  2633. <a name="l02544"></a>02544 <span class="comment">! ===============</span>
  2634. <a name="l02545"></a>02545
  2635. <a name="l02546"></a><a class="code" href="puma_8f90.html#ad0981694b4fc7644f20d9ad785deba27">02546</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ad0981694b4fc7644f20d9ad785deba27">diag</a>
  2636. <a name="l02547"></a>02547 use <span class="keywordflow">pumamod</span>
  2637. <a name="l02548"></a>02548 <span class="keyword">if</span> (noutput &gt; 0 .and. mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,ndiag) == 0) <span class="keyword">then</span>
  2638. <a name="l02549"></a>02549 <span class="keyword">if</span> (ncoeff &gt; 0) call <a class="code" href="puma_8f90.html#a901150c868c1f2d65744ec49df0c24ed">prisp</a>
  2639. <a name="l02550"></a>02550 call <a class="code" href="puma_8f90.html#a8e59ae6d7b5a22b0e46c56187cdd62cf">xsect</a>
  2640. <a name="l02551"></a>02551 <span class="keyword">endif</span>
  2641. <a name="l02552"></a>02552 call <a class="code" href="puma_8f90.html#a9617b01410b9d0a76ca6ceb1b333bb96">energy</a>
  2642. <a name="l02553"></a>02553 return
  2643. <a name="l02554"></a>02554 <span class="keyword"> end</span>
  2644. <a name="l02555"></a>02555
  2645. <a name="l02556"></a>02556 <span class="comment">! ================</span>
  2646. <a name="l02557"></a>02557 <span class="comment">! SUBROUTINE PRISP</span>
  2647. <a name="l02558"></a>02558 <span class="comment">! ================</span>
  2648. <a name="l02559"></a>02559
  2649. <a name="l02560"></a><a class="code" href="puma_8f90.html#a901150c868c1f2d65744ec49df0c24ed">02560</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a901150c868c1f2d65744ec49df0c24ed">prisp</a>
  2650. <a name="l02561"></a>02561 use <span class="keywordflow">pumamod</span>
  2651. <a name="l02562"></a>02562
  2652. <a name="l02563"></a>02563 <span class="keywordtype">character(30)</span> :: title
  2653. <a name="l02564"></a>02564
  2654. <a name="l02565"></a>02565 scale = 100.0
  2655. <a name="l02566"></a>02566 title = <span class="stringliteral">&#39;Vorticity [10-2]&#39;</span>
  2656. <a name="l02567"></a>02567 <span class="keyword">do</span> 100 jlev=1,NLEV
  2657. <a name="l02568"></a>02568 <span class="keyword">if</span> (ndil(jlev).ne.0) call <a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">wrspam</a>(sz(1,jlev),jlev,title,scale)
  2658. <a name="l02569"></a>02569 100 continue
  2659. <a name="l02570"></a>02570
  2660. <a name="l02571"></a>02571 title = <span class="stringliteral">&#39;Divergence [10-2]&#39;</span>
  2661. <a name="l02572"></a>02572 <span class="keyword">do</span> 200 jlev=1,NLEV
  2662. <a name="l02573"></a>02573 <span class="keyword">if</span> (ndil(jlev).ne.0) call <a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">wrspam</a>(sd(1,jlev),jlev,title,scale)
  2663. <a name="l02574"></a>02574 200 continue
  2664. <a name="l02575"></a>02575
  2665. <a name="l02576"></a>02576 scale = 1000.0
  2666. <a name="l02577"></a>02577 title = <span class="stringliteral">&#39;Temperature [10-3]&#39;</span>
  2667. <a name="l02578"></a>02578 <span class="keyword">do</span> 300 jlev=1,NLEV
  2668. <a name="l02579"></a>02579 <span class="keyword">if</span> (ndil(jlev).ne.0) call <a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">wrspam</a>(st(1,jlev),jlev,title,scale)
  2669. <a name="l02580"></a>02580 300 continue
  2670. <a name="l02581"></a>02581
  2671. <a name="l02582"></a>02582 title = <span class="stringliteral">&#39;Pressure [10-3]&#39;</span>
  2672. <a name="l02583"></a>02583 call <a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">wrspam</a>(sp,0,title,scale)
  2673. <a name="l02584"></a>02584
  2674. <a name="l02585"></a>02585 return
  2675. <a name="l02586"></a>02586 <span class="keyword"> end</span>
  2676. <a name="l02587"></a>02587
  2677. <a name="l02588"></a>02588 <span class="comment">! ====================</span>
  2678. <a name="l02589"></a>02589 <span class="comment">! SUBROUTINE POWERSPEC</span>
  2679. <a name="l02590"></a>02590 <span class="comment">! ====================</span>
  2680. <a name="l02591"></a>02591
  2681. <a name="l02592"></a><a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">02592</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">powerspec</a>(pf,pspec)
  2682. <a name="l02593"></a>02593 use <span class="keywordflow">pumamod</span>
  2683. <a name="l02594"></a>02594 <span class="keywordtype">real</span> :: pf(2,NCSP)
  2684. <a name="l02595"></a>02595 <span class="keywordtype">real</span> :: pspec(NTP1)
  2685. <a name="l02596"></a>02596
  2686. <a name="l02597"></a>02597 <span class="keyword">do</span> j = 1 , NTP1
  2687. <a name="l02598"></a>02598 pspec(j) = 0.5 * (pf(1,j) * pf(1,j) + pf(2,j) * pf(2,j))
  2688. <a name="l02599"></a>02599 <span class="keyword">enddo</span>
  2689. <a name="l02600"></a>02600
  2690. <a name="l02601"></a>02601 j = NTP1 + 1
  2691. <a name="l02602"></a>02602 <span class="keyword">do</span> m = 2 , NTP1
  2692. <a name="l02603"></a>02603 <span class="keyword">do</span> l = m , NTP1
  2693. <a name="l02604"></a>02604 pspec(l) = pspec(l) + pf(1,j) * pf(1,j) + pf(2,j) * pf(2,j)
  2694. <a name="l02605"></a>02605 j = j + 1
  2695. <a name="l02606"></a>02606 <span class="keyword">enddo</span>
  2696. <a name="l02607"></a>02607 <span class="keyword">enddo</span>
  2697. <a name="l02608"></a>02608 return
  2698. <a name="l02609"></a>02609 <span class="keyword"> end</span>
  2699. <a name="l02610"></a>02610
  2700. <a name="l02611"></a>02611 <span class="comment">! =====================</span>
  2701. <a name="l02612"></a>02612 <span class="comment">! SUBROUTINE POWERPRINT</span>
  2702. <a name="l02613"></a>02613 <span class="comment">! =====================</span>
  2703. <a name="l02614"></a>02614
  2704. <a name="l02615"></a><a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">02615</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">powerprint</a>(text,pspec)
  2705. <a name="l02616"></a>02616 use <span class="keywordflow">pumamod</span>
  2706. <a name="l02617"></a>02617 <span class="keywordtype">character(3)</span> :: text
  2707. <a name="l02618"></a>02618 <span class="keywordtype">real</span> :: pspec(NTP1)
  2708. <a name="l02619"></a>02619
  2709. <a name="l02620"></a>02620 zmax = maxval(pspec(:))
  2710. <a name="l02621"></a>02621 <span class="keyword">if</span> (zmax &lt;= 1.0e-20) return
  2711. <a name="l02622"></a>02622 zsca = 10 ** (4 - int(log10(zmax)))
  2712. <a name="l02623"></a>02623 <span class="keyword">write</span>(nud,1000) text,(int(pspec(j)*zsca),j=2,13)
  2713. <a name="l02624"></a>02624 return
  2714. <a name="l02625"></a>02625 1000 format(<span class="stringliteral">&#39;* Power(&#39;</span>,a3,<span class="stringliteral">&#39;) &#39;</span>,i8,11i5,<span class="stringliteral">&#39; *&#39;</span>)
  2715. <a name="l02626"></a>02626 <span class="keyword"> end</span>
  2716. <a name="l02627"></a>02627
  2717. <a name="l02628"></a>02628
  2718. <a name="l02629"></a>02629
  2719. <a name="l02630"></a>02630
  2720. <a name="l02631"></a>02631 <span class="comment">! ==============</span>
  2721. <a name="l02632"></a>02632 <span class="comment">! FUNCTION RMSSP</span>
  2722. <a name="l02633"></a>02633 <span class="comment">! ==============</span>
  2723. <a name="l02634"></a>02634
  2724. <a name="l02635"></a><a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">02635</a> <span class="keyword">function </span><a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">rmssp</a>(pf)
  2725. <a name="l02636"></a>02636 use <span class="keywordflow">pumamod</span>
  2726. <a name="l02637"></a>02637 <span class="keywordtype">real</span> pf(NESP,NLEV)
  2727. <a name="l02638"></a>02638
  2728. <a name="l02639"></a>02639 zsum = 0.0
  2729. <a name="l02640"></a>02640 <span class="keyword">do</span> jlev = 1 , NLEV
  2730. <a name="l02641"></a>02641 zsum = zsum + dsigma(jlev)&amp;
  2731. <a name="l02642"></a>02642 &amp; * (dot_product(pf(1:NZOM,jlev),pf(1:NZOM,jlev)) * 0.5&amp;
  2732. <a name="l02643"></a>02643 &amp; + dot_product(pf(NZOM+1:NRSP,jlev),pf(NZOM+1:NRSP,jlev)))
  2733. <a name="l02644"></a>02644 <span class="keyword">enddo</span>
  2734. <a name="l02645"></a>02645 <a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">rmssp</a> = zsum
  2735. <a name="l02646"></a>02646 return
  2736. <a name="l02647"></a>02647 <span class="keyword"> end</span>
  2737. <a name="l02648"></a>02648
  2738. <a name="l02649"></a>02649 <span class="comment">! =================</span>
  2739. <a name="l02650"></a>02650 <span class="comment">! SUBROUTINE ENERGY</span>
  2740. <a name="l02651"></a>02651 <span class="comment">! =================</span>
  2741. <a name="l02652"></a>02652
  2742. <a name="l02653"></a><a class="code" href="puma_8f90.html#a9617b01410b9d0a76ca6ceb1b333bb96">02653</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a9617b01410b9d0a76ca6ceb1b333bb96">energy</a>
  2743. <a name="l02654"></a>02654 use <span class="keywordflow">pumamod</span>
  2744. <a name="l02655"></a>02655
  2745. <a name="l02656"></a>02656 parameter (idim=5) <span class="comment">! Number of scalars for GUI timeseries</span>
  2746. <a name="l02657"></a>02657
  2747. <a name="l02658"></a>02658 <span class="comment">! calculates various global diagnostic quantities</span>
  2748. <a name="l02659"></a>02659 <span class="comment">! remove planetary vorticity so sz contains relative vorticity</span>
  2749. <a name="l02660"></a>02660
  2750. <a name="l02661"></a>02661 <span class="keywordtype">real</span> :: spec(NTP1)
  2751. <a name="l02662"></a>02662 <span class="keywordtype">real (kind=4)</span> ziso(idim)
  2752. <a name="l02663"></a>02663
  2753. <a name="l02664"></a>02664 sz(3,:) = sz(3,:) - plavor
  2754. <a name="l02665"></a>02665
  2755. <a name="l02666"></a>02666 <span class="comment">! ***********************************************</span>
  2756. <a name="l02667"></a>02667 <span class="comment">! calculate means - zpsitot rms vorticity</span>
  2757. <a name="l02668"></a>02668 <span class="comment">! zchitot rms divergence</span>
  2758. <a name="l02669"></a>02669 <span class="comment">! ztmptot rms temperature</span>
  2759. <a name="l02670"></a>02670 <span class="comment">! ztotp ie+pe potential energy</span>
  2760. <a name="l02671"></a>02671 <span class="comment">! zamsp mean surface pressure</span>
  2761. <a name="l02672"></a>02672 <span class="comment">! ***********************************************</span>
  2762. <a name="l02673"></a>02673
  2763. <a name="l02674"></a>02674 zsqrt2 = sqrt(2.0)
  2764. <a name="l02675"></a>02675 zamsp = 1.0 + span(1) / zsqrt2
  2765. <a name="l02676"></a>02676 zst = dot_product(dsigma(:),st(1,:)) / zsqrt2
  2766. <a name="l02677"></a>02677 ztout1 = dot_product(dsigma(:),t0(:))
  2767. <a name="l02678"></a>02678
  2768. <a name="l02679"></a>02679 ztout2 = 0.0
  2769. <a name="l02680"></a>02680 zst2b = 0.0
  2770. <a name="l02681"></a>02681 ztoti = 0.0
  2771. <a name="l02682"></a>02682 <span class="keyword">do</span> jlev = 1 , NLEV
  2772. <a name="l02683"></a>02683 ztout2 = ztout2 + dsigma(jlev) * t0(jlev) * t0(jlev)
  2773. <a name="l02684"></a>02684 zst2b = zst2b + dsigma(jlev) * t0(jlev) * st(1,jlev)
  2774. <a name="l02685"></a>02685 ztoti = ztoti + dsigma(jlev)&amp;
  2775. <a name="l02686"></a>02686 &amp; * (dot_product(span(1:NZOM),st(1:NZOM,jlev)) * 0.5&amp;
  2776. <a name="l02687"></a>02687 &amp; + dot_product(span(NZOM+1:NRSP),st(NZOM+1:NRSP,jlev)))
  2777. <a name="l02688"></a>02688 <span class="keyword">enddo</span>
  2778. <a name="l02689"></a>02689
  2779. <a name="l02690"></a>02690 ztotp = dot_product(span(1:NZOM),so(1:NZOM)) * 0.5&amp;
  2780. <a name="l02691"></a>02691 &amp; + dot_product(span(NZOM+1:NRSP),so(NZOM+1:NRSP))&amp;
  2781. <a name="l02692"></a>02692 &amp; + so(1)/zsqrt2 + (zamsp*ztout1+ztoti+zst) / akap
  2782. <a name="l02693"></a>02693
  2783. <a name="l02694"></a>02694 zpsitot = sqrt(<a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">rmssp</a>(sz))
  2784. <a name="l02695"></a>02695 zchitot = sqrt(<a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">rmssp</a>(sd))
  2785. <a name="l02696"></a>02696 ztmptot = sqrt(<a class="code" href="puma_8f90.html#a87f2e4ed3831dc32e18d25fe42d0bfab">rmssp</a>(st)+ztout2+zst2b*zsqrt2)
  2786. <a name="l02697"></a>02697
  2787. <a name="l02698"></a>02698 ziso(1) = ct * (spnorm(1) * st(1,NLEV) + t0(NLEV)) - 273.16 <span class="comment">! T(NLEV) [C]</span>
  2788. <a name="l02699"></a>02699 ziso(2) = ww * zchitot * 1.0e6
  2789. <a name="l02700"></a>02700 ziso(3) = ztmptot
  2790. <a name="l02701"></a>02701 ziso(4) = ztotp
  2791. <a name="l02702"></a>02702 ziso(5) = sz(3,2)
  2792. <a name="l02703"></a>02703 call <a class="code" href="guimod__stub_8f90.html#a246c916d08a954310ea15d64816db13b">guiput</a>(<span class="stringliteral">&quot;SCALAR&quot;</span> // char(0) ,ziso,idim,1,1)
  2793. <a name="l02704"></a>02704
  2794. <a name="l02705"></a>02705 <span class="comment">! restore sz to absolute vorticity</span>
  2795. <a name="l02706"></a>02706
  2796. <a name="l02707"></a>02707 sz(3,:) = sz(3,:) + plavor
  2797. <a name="l02708"></a>02708
  2798. <a name="l02709"></a>02709 <span class="keyword">if</span> (mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,ndiag) /= 0) return <span class="comment">! was called for GUI only</span>
  2799. <a name="l02710"></a>02710 <span class="keyword">write</span>(nud,9001)
  2800. <a name="l02711"></a>02711 <span class="keyword">write</span>(nud,9002) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,zpsitot,zchitot,ztmptot,ztotp,zamsp
  2801. <a name="l02712"></a>02712 <span class="keyword">write</span>(nud,9002)
  2802. <a name="l02713"></a>02713 <span class="keyword">write</span>(nud,9011) (j,j=1,12)
  2803. <a name="l02714"></a>02714 <span class="keyword">write</span>(nud,9012)
  2804. <a name="l02715"></a>02715 call <a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">powerspec</a>(span,spec)
  2805. <a name="l02716"></a>02716 call <a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">powerprint</a>(<span class="stringliteral">&#39;Pre&#39;</span>,spec)
  2806. <a name="l02717"></a>02717 call <a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">powerspec</a>(sz(1,NLEV),spec)
  2807. <a name="l02718"></a>02718 call <a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">powerprint</a>(<span class="stringliteral">&#39;Vor&#39;</span>,spec)
  2808. <a name="l02719"></a>02719 call <a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">powerspec</a>(sd(1,NLEV),spec)
  2809. <a name="l02720"></a>02720 call <a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">powerprint</a>(<span class="stringliteral">&#39;Div&#39;</span>,spec)
  2810. <a name="l02721"></a>02721 call <a class="code" href="puma_8f90.html#a8625954404de5b08c55626c4f8a62972">powerspec</a>(st(1,NLEV),spec)
  2811. <a name="l02722"></a>02722 call <a class="code" href="puma_8f90.html#a53adeff6424dd4b2f124771625a47ca5">powerprint</a>(<span class="stringliteral">&#39;Tem&#39;</span>,spec)
  2812. <a name="l02723"></a>02723 return
  2813. <a name="l02724"></a>02724 9001 format(/,
  2814. <a name="l02725"></a>02725 <span class="stringliteral">&#39; nstep rms z rms d rms t &amp; &amp; pe+ie msp&#39;</span>)
  2815. <a name="l02726"></a>02726 9002 format(i10,4x,4g12.5,g15.8)
  2816. <a name="l02727"></a>02727 <span class="comment">!9009 format(&#39;*&#39;,75(&#39; &#39;),&#39; *&#39;)</span>
  2817. <a name="l02728"></a>02728 <span class="comment">!9010 format(&#39;* Power(&#39;,a,&#39;) &#39;,7e9.2,&#39; *&#39;)</span>
  2818. <a name="l02729"></a>02729 9011 format(<span class="stringliteral">&#39;* Wavenumber &#39;</span>,i8,11i5,<span class="stringliteral">&#39; *&#39;</span>)
  2819. <a name="l02730"></a>02730 9012 format(<span class="stringliteral">&#39;&#39;</span>,78(<span class="stringliteral">&#39;*&#39;</span>))
  2820. <a name="l02731"></a>02731 <span class="keyword"> end</span>
  2821. <a name="l02732"></a>02732
  2822. <a name="l02733"></a>02733 <span class="comment">! =================</span>
  2823. <a name="l02734"></a>02734 <span class="comment">! SUBROUTINE NTOMIN</span>
  2824. <a name="l02735"></a>02735 <span class="comment">! =================</span>
  2825. <a name="l02736"></a>02736
  2826. <a name="l02737"></a><a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">02737</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(kstep,imin,ihou,iday,imon,iyea)
  2827. <a name="l02738"></a>02738 use <span class="keywordflow">pumamod</span>
  2828. <a name="l02739"></a>02739 istep = kstep <span class="comment">! day [0-29] month [0-11]</span>
  2829. <a name="l02740"></a>02740 <span class="keyword">if</span> (istep .lt. 0) istep = 0 <span class="comment">! min [0-59] hour [0-23]</span>
  2830. <a name="l02741"></a>02741 imin = mod(istep,ntspd) * 1440 / ntspd <span class="comment">! minutes of current day</span>
  2831. <a name="l02742"></a>02742 ihou = imin / 60 <span class="comment">! hours of current day</span>
  2832. <a name="l02743"></a>02743 imin = imin - ihou * 60 <span class="comment">! minutes of current hour</span>
  2833. <a name="l02744"></a>02744 iday = istep / ntspd <span class="comment">! days in this run</span>
  2834. <a name="l02745"></a>02745 imon = iday / 30 <span class="comment">! months in this run</span>
  2835. <a name="l02746"></a>02746 iday = iday - imon * 30 <span class="comment">! days of current month</span>
  2836. <a name="l02747"></a>02747 iyea = imon / 12 <span class="comment">! years in this run</span>
  2837. <a name="l02748"></a>02748 imon = imon - iyea * 12 <span class="comment">! month of current year</span>
  2838. <a name="l02749"></a>02749 iday = iday + 1
  2839. <a name="l02750"></a>02750 imon = imon + 1
  2840. <a name="l02751"></a>02751 iyea = iyea + 1
  2841. <a name="l02752"></a>02752 return
  2842. <a name="l02753"></a>02753 <span class="keyword"> end</span>
  2843. <a name="l02754"></a>02754
  2844. <a name="l02755"></a>02755 <span class="comment">! =================</span>
  2845. <a name="l02756"></a>02756 <span class="comment">! SUBROUTINE NTODAT</span>
  2846. <a name="l02757"></a>02757 <span class="comment">! =================</span>
  2847. <a name="l02758"></a>02758
  2848. <a name="l02759"></a><a class="code" href="puma_8f90.html#a6b0de7569cc691823dd1104ff42a6993">02759</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a6b0de7569cc691823dd1104ff42a6993">ntodat</a>(istep,datch)
  2849. <a name="l02760"></a>02760 <span class="keywordtype">character(18)</span> :: datch
  2850. <a name="l02761"></a>02761 <span class="keywordtype">character(3)</span> :: mona(12)
  2851. <a name="l02762"></a>02762 <span class="keyword">data</span> mona /<span class="stringliteral">&#39;Jan&#39;</span>,<span class="stringliteral">&#39;Feb&#39;</span>,<span class="stringliteral">&#39;Mar&#39;</span>,<span class="stringliteral">&#39;Apr&#39;</span>,<span class="stringliteral">&#39;May&#39;</span>,<span class="stringliteral">&#39;Jun&#39;</span>,&amp;
  2852. <a name="l02763"></a>02763 &amp; <span class="stringliteral">&#39;Jul&#39;</span>,<span class="stringliteral">&#39;Aug&#39;</span>,<span class="stringliteral">&#39;Sep&#39;</span>,<span class="stringliteral">&#39;Oct&#39;</span>,<span class="stringliteral">&#39;Nov&#39;</span>,<span class="stringliteral">&#39;Dec&#39;</span>/
  2853. <a name="l02764"></a>02764 call <a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(istep,imin,ihou,iday,imon,iyea)
  2854. <a name="l02765"></a>02765 <span class="keyword">write</span>(datch,20030) iday,mona(imon),iyea,ihou,imin
  2855. <a name="l02766"></a>02766 20030 format(i2,<span class="stringliteral">&#39;-&#39;</span>,a3,<span class="stringliteral">&#39;-&#39;</span>,i4.4,2x,i2,<span class="stringliteral">&#39;:&#39;</span>,i2.2)
  2856. <a name="l02767"></a>02767 <span class="keyword"> end</span>
  2857. <a name="l02768"></a>02768
  2858. <a name="l02769"></a>02769
  2859. <a name="l02770"></a>02770 <span class="comment">! =================</span>
  2860. <a name="l02771"></a>02771 <span class="comment">! SUBROUTINE WRSPAM</span>
  2861. <a name="l02772"></a>02772 <span class="comment">! =================</span>
  2862. <a name="l02773"></a>02773
  2863. <a name="l02774"></a><a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">02774</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a7d2fe5c057c4ef8c0b7981ddeb0cce41">wrspam</a>(ps,klev,title,scale)
  2864. <a name="l02775"></a>02775 use <span class="keywordflow">pumamod</span>
  2865. <a name="l02776"></a>02776 <span class="comment">!</span>
  2866. <a name="l02777"></a>02777 dimension ps(NRSP)
  2867. <a name="l02778"></a>02778 <span class="keywordtype">character(30)</span> :: title
  2868. <a name="l02779"></a>02779 <span class="keywordtype">character(18)</span> :: datch
  2869. <a name="l02780"></a>02780
  2870. <a name="l02781"></a>02781 <span class="comment">! cab(i)=real(scale*sqrt(ps(i+i-1)*ps(i+i-1)+ps(i+i)*ps(i+i)))</span>
  2871. <a name="l02782"></a>02782
  2872. <a name="l02783"></a>02783 call <a class="code" href="puma_8f90.html#a6b0de7569cc691823dd1104ff42a6993">ntodat</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,datch)
  2873. <a name="l02784"></a>02784 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(1x)&#39;</span>)
  2874. <a name="l02785"></a>02785 <span class="keyword">write</span>(nud,20000)
  2875. <a name="l02786"></a>02786 <span class="keyword">write</span>(nud,20030) datch,title,klev
  2876. <a name="l02787"></a>02787 <span class="keyword">write</span>(nud,20000)
  2877. <a name="l02788"></a>02788 <span class="keyword">write</span>(nud,20020) (i,i=0,9)
  2878. <a name="l02789"></a>02789 <span class="keyword">write</span>(nud,20000)
  2879. <a name="l02790"></a>02790 <span class="keyword">write</span>(nud,20100) (<a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a>(i),i=1,10)
  2880. <a name="l02791"></a>02791 <span class="keyword">write</span>(nud,20200) (<a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a>(i),i=NTRU+2,NTRU+10)
  2881. <a name="l02792"></a>02792 <span class="keyword">write</span>(nud,20300) (<a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a>(i),i=2*NTRU+2,2*NTRU+9)
  2882. <a name="l02793"></a>02793 <span class="keyword">write</span>(nud,20400) (<a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a>(i),i=3*NTRU+1,3*NTRU+7)
  2883. <a name="l02794"></a>02794 <span class="keyword">write</span>(nud,20000)
  2884. <a name="l02795"></a>02795 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(1x)&#39;</span>)
  2885. <a name="l02796"></a>02796
  2886. <a name="l02797"></a>02797 20000 format(78(<span class="stringliteral">&#39;*&#39;</span>))
  2887. <a name="l02798"></a>02798 20020 format(<span class="stringliteral">&#39;* n * &#39;</span>,10i7,<span class="stringliteral">&#39; *&#39;</span>)
  2888. <a name="l02799"></a>02799 20030 format(<span class="stringliteral">&#39;* * &#39;</span>,a18,2x,a30,<span class="stringliteral">&#39; Level &#39;</span>,i2,11x,<span class="stringliteral">&#39;*&#39;</span>)
  2889. <a name="l02800"></a>02800 20100 format(<span class="stringliteral">&#39;* 0 *&#39;</span>,f8.2,9f7.2,<span class="stringliteral">&#39; *&#39;</span>)
  2890. <a name="l02801"></a>02801 20200 format(<span class="stringliteral">&#39;* 1 *&#39;</span>,8x,9f7.2,<span class="stringliteral">&#39; *&#39;</span>)
  2891. <a name="l02802"></a>02802 20300 format(<span class="stringliteral">&#39;* 2 *&#39;</span>,15x,8f7.2,<span class="stringliteral">&#39; *&#39;</span>)
  2892. <a name="l02803"></a>02803 20400 format(<span class="stringliteral">&#39;* 3 *&#39;</span>,22x,7f7.2,<span class="stringliteral">&#39; *&#39;</span>)
  2893. <a name="l02804"></a>02804 <span class="keyword">contains</span>
  2894. <a name="l02805"></a><a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">02805</a> <span class="keyword">function </span><a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a>(i)
  2895. <a name="l02806"></a>02806 <a class="code" href="puma_8f90.html#a41d141fdb78d222639310fec575eaea5">cab</a> = scale * sqrt(ps(i+i-1)*ps(i+i-1)+ps(i+i)*ps(i+i))
  2896. <a name="l02807"></a>02807 <span class="keyword"> end function cab</span>
  2897. <a name="l02808"></a>02808 <span class="keyword"> end</span>
  2898. <a name="l02809"></a>02809
  2899. <a name="l02810"></a>02810 <span class="comment">! ===============</span>
  2900. <a name="l02811"></a>02811 <span class="comment">! SUBROUTINE WRZS</span>
  2901. <a name="l02812"></a>02812 <span class="comment">! ===============</span>
  2902. <a name="l02813"></a>02813
  2903. <a name="l02814"></a><a class="code" href="puma_8f90.html#a03b2185c8a9dc75ed4169a7d9bf65863">02814</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a03b2185c8a9dc75ed4169a7d9bf65863">wrzs</a>(zs,title,scale)
  2904. <a name="l02815"></a>02815 use <span class="keywordflow">pumamod</span>
  2905. <a name="l02816"></a>02816 <span class="comment">!</span>
  2906. <a name="l02817"></a>02817 dimension zs(NLAT,NLEV)
  2907. <a name="l02818"></a>02818 <span class="keywordtype">character(30)</span> :: title
  2908. <a name="l02819"></a>02819 <span class="keywordtype">character(18)</span> :: datch
  2909. <a name="l02820"></a>02820
  2910. <a name="l02821"></a>02821 ip = NLAT / 16
  2911. <a name="l02822"></a>02822 ia = ip/2
  2912. <a name="l02823"></a>02823 ib = ia + 7 * ip
  2913. <a name="l02824"></a>02824 id = NLAT + 1 - ia
  2914. <a name="l02825"></a>02825 ic = id - 7 * ip
  2915. <a name="l02826"></a>02826
  2916. <a name="l02827"></a>02827 call <a class="code" href="puma_8f90.html#a6b0de7569cc691823dd1104ff42a6993">ntodat</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,datch)
  2917. <a name="l02828"></a>02828 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(1x)&#39;</span>)
  2918. <a name="l02829"></a>02829 <span class="keyword">write</span>(nud,20000)
  2919. <a name="l02830"></a>02830 <span class="keyword">write</span>(nud,20030) datch,title
  2920. <a name="l02831"></a>02831 <span class="keyword">write</span>(nud,20000)
  2921. <a name="l02832"></a>02832 <span class="keyword">write</span>(nud,20020) (chlat(i),i=ia,ib,ip),(chlat(j),j=ic,id,ip)
  2922. <a name="l02833"></a>02833 <span class="keyword">write</span>(nud,20000)
  2923. <a name="l02834"></a>02834 <span class="keyword">do</span> 200 jlev = 1 , NLEV
  2924. <a name="l02835"></a>02835 <span class="keyword">write</span>(nud,20100) jlev,((int(zs(i,jlev)*scale)),i=ia,ib,ip),&amp;
  2925. <a name="l02836"></a>02836 &amp; ((int(zs(j,jlev)*scale)),j=ic,id,ip),jlev
  2926. <a name="l02837"></a>02837 200 continue
  2927. <a name="l02838"></a>02838 <span class="keyword">write</span>(nud,20000)
  2928. <a name="l02839"></a>02839 <span class="keyword">write</span>(nud,<span class="stringliteral">&#39;(1x)&#39;</span>)
  2929. <a name="l02840"></a>02840
  2930. <a name="l02841"></a>02841 20000 format(78(<span class="stringliteral">&#39;*&#39;</span>))
  2931. <a name="l02842"></a>02842 20020 format(<span class="stringliteral">&#39;* Lv * &#39;</span>,16(1x,a3),<span class="stringliteral">&#39; * Lv *&#39;</span>)
  2932. <a name="l02843"></a>02843 20030 format(<span class="stringliteral">&#39;* * &#39;</span>,a18,2x,a30,20x,<span class="stringliteral">&#39;*&#39;</span>)
  2933. <a name="l02844"></a>02844 20100 format(<span class="stringliteral">&#39;* &#39;</span>,i2,<span class="stringliteral">&#39; * &#39;</span>,16i4,<span class="stringliteral">&#39; * &#39;</span>,i2,<span class="stringliteral">&#39; *&#39;</span>)
  2934. <a name="l02845"></a>02845 <span class="keyword"> end</span>
  2935. <a name="l02846"></a>02846
  2936. <a name="l02847"></a>02847 <span class="comment">! ================</span>
  2937. <a name="l02848"></a>02848 <span class="comment">! SUBROUTINE XSECT</span>
  2938. <a name="l02849"></a>02849 <span class="comment">! ================</span>
  2939. <a name="l02850"></a>02850
  2940. <a name="l02851"></a><a class="code" href="puma_8f90.html#a8e59ae6d7b5a22b0e46c56187cdd62cf">02851</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a8e59ae6d7b5a22b0e46c56187cdd62cf">xsect</a>
  2941. <a name="l02852"></a>02852 use <span class="keywordflow">pumamod</span>
  2942. <a name="l02853"></a>02853 <span class="keywordtype">character(30)</span> :: title
  2943. <a name="l02854"></a>02854
  2944. <a name="l02855"></a>02855 scale = 10.0
  2945. <a name="l02856"></a>02856 title = <span class="stringliteral">&#39;Zonal Wind [0.1 m/s]&#39;</span>
  2946. <a name="l02857"></a>02857 call <a class="code" href="puma_8f90.html#a03b2185c8a9dc75ed4169a7d9bf65863">wrzs</a>(csu,title,scale)
  2947. <a name="l02858"></a>02858 title = <span class="stringliteral">&#39;Meridional Wind [0.1 m/s]&#39;</span>
  2948. <a name="l02859"></a>02859 call <a class="code" href="puma_8f90.html#a03b2185c8a9dc75ed4169a7d9bf65863">wrzs</a>(csv,title,scale)
  2949. <a name="l02860"></a>02860 scale = 1.0
  2950. <a name="l02861"></a>02861 title = <span class="stringliteral">&#39;Temperature [C]&#39;</span>
  2951. <a name="l02862"></a>02862 call <a class="code" href="puma_8f90.html#a03b2185c8a9dc75ed4169a7d9bf65863">wrzs</a>(cst,title,scale)
  2952. <a name="l02863"></a>02863 return
  2953. <a name="l02864"></a>02864 <span class="keyword"> end</span>
  2954. <a name="l02865"></a>02865
  2955. <a name="l02866"></a>02866 <span class="comment">! ==================</span>
  2956. <a name="l02867"></a>02867 <span class="comment">! SUBROUTINE WRITESP</span>
  2957. <a name="l02868"></a>02868 <span class="comment">! ==================</span>
  2958. <a name="l02869"></a>02869
  2959. <a name="l02870"></a><a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">02870</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(kunit,pf,kcode,klev,pscale,poff)
  2960. <a name="l02871"></a>02871 use <span class="keywordflow">pumamod</span>
  2961. <a name="l02872"></a>02872 <span class="keywordtype">real</span> :: pf(NRSP)
  2962. <a name="l02873"></a>02873 <span class="keywordtype">real</span> :: zf(NRSP)
  2963. <a name="l02874"></a>02874 <span class="keywordtype">integer</span> :: ihead(8)
  2964. <a name="l02875"></a>02875
  2965. <a name="l02876"></a>02876 call <a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,nmin,nhour,nday,nmonth,nyear)
  2966. <a name="l02877"></a>02877
  2967. <a name="l02878"></a>02878 ihead(1) = kcode
  2968. <a name="l02879"></a>02879 ihead(2) = klev
  2969. <a name="l02880"></a>02880 ihead(3) = nday + 100 * nmonth + 10000 * nyear
  2970. <a name="l02881"></a>02881 ihead(4) = nmin + 100 * nhour
  2971. <a name="l02882"></a>02882 ihead(5) = NRSP
  2972. <a name="l02883"></a>02883 ihead(6) = 1
  2973. <a name="l02884"></a>02884 ihead(7) = 1
  2974. <a name="l02885"></a>02885 ihead(8) = 0
  2975. <a name="l02886"></a>02886
  2976. <a name="l02887"></a>02887 <span class="comment">! normalize ECHAM compatible and scale to physical dimensions</span>
  2977. <a name="l02888"></a>02888
  2978. <a name="l02889"></a>02889 zf(:) = pf(:) * spnorm(1:NRSP) * pscale
  2979. <a name="l02890"></a>02890 zf(1) = zf(1) + poff <span class="comment">! Add offset if necessary</span>
  2980. <a name="l02891"></a>02891 <span class="keyword">write</span>(kunit) ihead
  2981. <a name="l02892"></a>02892 <span class="keyword">write</span>(kunit) zf
  2982. <a name="l02893"></a>02893
  2983. <a name="l02894"></a>02894 return
  2984. <a name="l02895"></a>02895 <span class="keyword"> end</span>
  2985. <a name="l02896"></a>02896
  2986. <a name="l02897"></a>02897 <span class="comment">! ==================</span>
  2987. <a name="l02898"></a>02898 <span class="comment">! SUBROUTINE WRITEGP</span>
  2988. <a name="l02899"></a>02899 <span class="comment">! ==================</span>
  2989. <a name="l02900"></a>02900
  2990. <a name="l02901"></a><a class="code" href="puma_8f90.html#a8f8e06ff9c98bc44f6c356d5ffc0a426">02901</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a8f8e06ff9c98bc44f6c356d5ffc0a426">writegp</a>(kunit,pf,kcode,klev)
  2991. <a name="l02902"></a>02902 use <span class="keywordflow">pumamod</span>
  2992. <a name="l02903"></a>02903 <span class="keywordtype">real</span> :: pf(NHOR)
  2993. <a name="l02904"></a>02904 <span class="keywordtype">real</span> :: zf(NUGP)
  2994. <a name="l02905"></a>02905 <span class="keywordtype">integer</span> :: ihead(8)
  2995. <a name="l02906"></a>02906
  2996. <a name="l02907"></a>02907 call <a class="code" href="mpimod_8f90.html#aaa1210298789f4fd7b7702c276eb80a9">mpgagp</a>(zf,pf,1)
  2997. <a name="l02908"></a>02908
  2998. <a name="l02909"></a>02909 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  2999. <a name="l02910"></a>02910 call <a class="code" href="legsym_8f90.html#a308819246e409c8dbe1e778d304ef415">alt2reg</a>(zf,1)
  3000. <a name="l02911"></a>02911 call <a class="code" href="puma_8f90.html#a6628dcb7258ff7477a7bc7f3098cded3">ntomin</a>(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,nmin,nhour,nday,nmonth,nyear)
  3001. <a name="l02912"></a>02912
  3002. <a name="l02913"></a>02913 ihead(1) = kcode
  3003. <a name="l02914"></a>02914 ihead(2) = klev
  3004. <a name="l02915"></a>02915 ihead(3) = nday + 100 * nmonth + 10000 * nyear
  3005. <a name="l02916"></a>02916 ihead(4) = nmin + 100 * nhour
  3006. <a name="l02917"></a>02917 ihead(5) = NLON
  3007. <a name="l02918"></a>02918 ihead(6) = NLAT
  3008. <a name="l02919"></a>02919 ihead(7) = 1
  3009. <a name="l02920"></a>02920 ihead(8) = 0
  3010. <a name="l02921"></a>02921
  3011. <a name="l02922"></a>02922 <span class="keyword">write</span>(kunit) ihead
  3012. <a name="l02923"></a>02923 <span class="keyword">write</span>(kunit) zf
  3013. <a name="l02924"></a>02924 <span class="keyword">endif</span>
  3014. <a name="l02925"></a>02925
  3015. <a name="l02926"></a>02926 return
  3016. <a name="l02927"></a>02927 <span class="keyword"> end </span>
  3017. <a name="l02928"></a>02928
  3018. <a name="l02929"></a>02929
  3019. <a name="l02930"></a>02930 <span class="comment">! ================</span>
  3020. <a name="l02931"></a>02931 <span class="comment">! SUBROUTINE OUTSP</span>
  3021. <a name="l02932"></a>02932 <span class="comment">! ================</span>
  3022. <a name="l02933"></a>02933
  3023. <a name="l02934"></a><a class="code" href="puma_8f90.html#a0352cc6bbeedace31c54d9afba847ad6">02934</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a0352cc6bbeedace31c54d9afba847ad6">outsp</a>
  3024. <a name="l02935"></a>02935 use <span class="keywordflow">pumamod</span>
  3025. <a name="l02936"></a>02936 <span class="keywordtype">real</span> zsr(NESP)
  3026. <a name="l02937"></a>02937
  3027. <a name="l02938"></a>02938 <span class="keyword">if</span> (nwrioro == 1) <span class="keyword">then</span>
  3028. <a name="l02939"></a>02939 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,so,129,0,cv*cv,0.0)
  3029. <a name="l02940"></a>02940 nwrioro = 0
  3030. <a name="l02941"></a>02941 <span class="keyword">endif</span>
  3031. <a name="l02942"></a>02942
  3032. <a name="l02943"></a>02943 <span class="keyword">if</span> (nextout == 1) <span class="keyword">then</span>
  3033. <a name="l02944"></a>02944 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,sp2,40,0,1.0,log(psmean))
  3034. <a name="l02945"></a>02945 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,sp1,41,0,1.0,log(psmean))
  3035. <a name="l02946"></a>02946 <span class="keyword">do</span> jlev = 1,NLEV
  3036. <a name="l02947"></a>02947 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,st2(1,jlev),42,jlev,ct,t0(jlev)*ct)
  3037. <a name="l02948"></a>02948 <span class="keyword">enddo</span>
  3038. <a name="l02949"></a>02949 <span class="keyword">do</span> jlev = 1,NLEV
  3039. <a name="l02950"></a>02950 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,st1(1,jlev),43,jlev,ct,t0(jlev)*ct)
  3040. <a name="l02951"></a>02951 <span class="keyword">enddo</span>
  3041. <a name="l02952"></a>02952 <span class="keyword">endif</span>
  3042. <a name="l02953"></a>02953
  3043. <a name="l02954"></a>02954 <span class="comment">! ************</span>
  3044. <a name="l02955"></a>02955 <span class="comment">! * pressure *</span>
  3045. <a name="l02956"></a>02956 <span class="comment">! ************</span>
  3046. <a name="l02957"></a>02957
  3047. <a name="l02958"></a>02958 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,sp,152,0,1.0,log(psmean))
  3048. <a name="l02959"></a>02959
  3049. <a name="l02960"></a>02960 <span class="comment">! ***************</span>
  3050. <a name="l02961"></a>02961 <span class="comment">! * temperature *</span>
  3051. <a name="l02962"></a>02962 <span class="comment">! ***************</span>
  3052. <a name="l02963"></a>02963
  3053. <a name="l02964"></a>02964 <span class="keyword">do</span> jlev = 1 , NLEV
  3054. <a name="l02965"></a>02965 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,st(1,jlev),130,jlev,ct,t0(jlev)*ct)
  3055. <a name="l02966"></a>02966 <span class="keyword">enddo</span>
  3056. <a name="l02967"></a>02967
  3057. <a name="l02968"></a>02968 <span class="comment">! ********************</span>
  3058. <a name="l02969"></a>02969 <span class="comment">! * res. temperature *</span>
  3059. <a name="l02970"></a>02970 <span class="comment">! ********************</span>
  3060. <a name="l02971"></a>02971
  3061. <a name="l02972"></a>02972 zampl = cos((<span class="keywordtype">real</span>(nstep)-pac)*tac)
  3062. <a name="l02973"></a>02973 <span class="keyword">do</span> jlev = 1 , NLEV
  3063. <a name="l02974"></a>02974 zsr(:)=sr1(:,jlev)+sr2(:,jlev)*zampl
  3064. <a name="l02975"></a>02975 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,zsr,154,jlev,ct,t0(jlev)*ct)
  3065. <a name="l02976"></a>02976 <span class="keyword">enddo</span>
  3066. <a name="l02977"></a>02977
  3067. <a name="l02978"></a>02978 <span class="comment">! **************</span>
  3068. <a name="l02979"></a>02979 <span class="comment">! * divergence *</span>
  3069. <a name="l02980"></a>02980 <span class="comment">! **************</span>
  3070. <a name="l02981"></a>02981
  3071. <a name="l02982"></a>02982 <span class="keyword">do</span> jlev = 1 , NLEV
  3072. <a name="l02983"></a>02983 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,sd(1,jlev),155,jlev,ww,0.0)
  3073. <a name="l02984"></a>02984 <span class="keyword">enddo</span>
  3074. <a name="l02985"></a>02985
  3075. <a name="l02986"></a>02986 <span class="comment">! *************</span>
  3076. <a name="l02987"></a>02987 <span class="comment">! * vorticity *</span>
  3077. <a name="l02988"></a>02988 <span class="comment">! *************</span>
  3078. <a name="l02989"></a>02989
  3079. <a name="l02990"></a>02990 <span class="keyword">do</span> jlev = 1 , NLEV
  3080. <a name="l02991"></a>02991 zsave = sz(3,jlev)
  3081. <a name="l02992"></a>02992 sz(3,jlev) = sz(3,jlev) - plavor
  3082. <a name="l02993"></a>02993 call <a class="code" href="puma_8f90.html#a29f97b19d997b3a5c29df1fd4cdd4792">writesp</a>(40,sz(1,jlev),138,jlev,ww,0.0)
  3083. <a name="l02994"></a>02994 sz(3,jlev) = zsave
  3084. <a name="l02995"></a>02995 <span class="keyword">enddo</span>
  3085. <a name="l02996"></a>02996
  3086. <a name="l02997"></a>02997 return
  3087. <a name="l02998"></a>02998 <span class="keyword"> end</span>
  3088. <a name="l02999"></a>02999
  3089. <a name="l03000"></a>03000 <span class="comment">! ================</span>
  3090. <a name="l03001"></a>03001 <span class="comment">! SUBROUTINE OUTGP</span>
  3091. <a name="l03002"></a>03002 <span class="comment">! ================</span>
  3092. <a name="l03003"></a>03003
  3093. <a name="l03004"></a><a class="code" href="puma_8f90.html#a1f5ebb3d7ab8cc007a6ed2d81b858f03">03004</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a1f5ebb3d7ab8cc007a6ed2d81b858f03">outgp</a>
  3094. <a name="l03005"></a>03005 use <span class="keywordflow">pumamod</span>
  3095. <a name="l03006"></a>03006 <span class="keywordtype">real</span> zhelp(NHOR)
  3096. <a name="l03007"></a>03007 <span class="comment">! </span>
  3097. <a name="l03008"></a>03008 <span class="comment">! energy diagnostics</span>
  3098. <a name="l03009"></a>03009 <span class="comment">! </span>
  3099. <a name="l03010"></a>03010 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3100. <a name="l03011"></a>03011 <span class="keyword">do</span> je=1,9
  3101. <a name="l03012"></a>03012 jcode=300+je
  3102. <a name="l03013"></a>03013 zhelp(:)=denergy(:,je)
  3103. <a name="l03014"></a>03014 call <a class="code" href="puma_8f90.html#a8f8e06ff9c98bc44f6c356d5ffc0a426">writegp</a>(40,zhelp,jcode,0)
  3104. <a name="l03015"></a>03015 <span class="keyword">enddo</span>
  3105. <a name="l03016"></a>03016 <span class="keyword">endif</span>
  3106. <a name="l03017"></a>03017 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  3107. <a name="l03018"></a>03018 <span class="keyword">do</span> je=1,9
  3108. <a name="l03019"></a>03019 jcode=310+je
  3109. <a name="l03020"></a>03020 zhelp(:)=dentropy(:,je)
  3110. <a name="l03021"></a>03021 call <a class="code" href="puma_8f90.html#a8f8e06ff9c98bc44f6c356d5ffc0a426">writegp</a>(40,zhelp,jcode,0)
  3111. <a name="l03022"></a>03022 <span class="keyword">enddo</span>
  3112. <a name="l03023"></a>03023 <span class="keyword">endif</span>
  3113. <a name="l03024"></a>03024 <span class="comment">!</span>
  3114. <a name="l03025"></a>03025 return
  3115. <a name="l03026"></a>03026 <span class="keyword"> end</span>
  3116. <a name="l03027"></a>03027
  3117. <a name="l03028"></a>03028
  3118. <a name="l03029"></a>03029 <span class="comment">! ====================</span>
  3119. <a name="l03030"></a>03030 <span class="comment">! SUBROUTINE CHECKUNIT</span>
  3120. <a name="l03031"></a>03031 <span class="comment">! ====================</span>
  3121. <a name="l03032"></a>03032
  3122. <a name="l03033"></a><a class="code" href="puma_8f90.html#ab608e12bdff55ab600a9d975673c5a53">03033</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ab608e12bdff55ab600a9d975673c5a53">checkunit</a>
  3123. <a name="l03034"></a>03034 use <span class="keywordflow">pumamod</span>
  3124. <a name="l03035"></a>03035
  3125. <a name="l03036"></a>03036 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sp( 1 )&#39;</span>,sp(1),sp(1)*spnorm(1)+log(psmean)
  3126. <a name="l03037"></a>03037 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;st( 1,1)&#39;</span>,st(1,1),st(1,1)*spnorm(1)*ct+t0(1)*ct
  3127. <a name="l03038"></a>03038 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sd( 1,1)&#39;</span>,sd(1,1),sd(1,1)*spnorm(1)*ww
  3128. <a name="l03039"></a>03039 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sz( 1,1)&#39;</span>,sz(1,1),sz(1,1)*spnorm(1)*ww
  3129. <a name="l03040"></a>03040
  3130. <a name="l03041"></a>03041 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;st( 1,NLEV)&#39;</span>,st(1,NLEV),st(1,NLEV)*spnorm(1)*ct+t0(5)*ct
  3131. <a name="l03042"></a>03042 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sd( 1,NLEV)&#39;</span>,sd(1,NLEV),sd(1,NLEV)*spnorm(1)*ww
  3132. <a name="l03043"></a>03043 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sz( 1,NLEV)&#39;</span>,sz(1,NLEV),sz(1,NLEV)*spnorm(1)*ww
  3133. <a name="l03044"></a>03044
  3134. <a name="l03045"></a>03045 <span class="keyword">if</span> (100 &lt; NRSP) <span class="keyword">then</span>
  3135. <a name="l03046"></a>03046 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sp(100 )&#39;</span>,sp(100),sp(100)*spnorm(100)
  3136. <a name="l03047"></a>03047 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;st(100,NLEV)&#39;</span>,st(100,NLEV),st(100,NLEV)*spnorm(100)*ct
  3137. <a name="l03048"></a>03048 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sd(100,NLEV)&#39;</span>,sd(100,NLEV),sd(100,NLEV)*spnorm(100)*ww
  3138. <a name="l03049"></a>03049 <span class="keyword">write</span>(ncu,1000) <a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,<span class="stringliteral">&#39;sz(100,NLEV)&#39;</span>,sz(100,NLEV),sz(100,NLEV)*spnorm(100)*ww
  3139. <a name="l03050"></a>03050 <span class="keyword">endif</span>
  3140. <a name="l03051"></a>03051
  3141. <a name="l03052"></a>03052 return
  3142. <a name="l03053"></a>03053 1000 format(i5,1x,a,1x,2f14.7)
  3143. <a name="l03054"></a>03054 <span class="keyword"> end</span>
  3144. <a name="l03055"></a>03055
  3145. <a name="l03056"></a>03056
  3146. <a name="l03057"></a>03057 <span class="comment">! =====================</span>
  3147. <a name="l03058"></a>03058 <span class="comment">! * SUBROUTINE LEGPRI *</span>
  3148. <a name="l03059"></a>03059 <span class="comment">! =====================</span>
  3149. <a name="l03060"></a>03060
  3150. <a name="l03061"></a><a class="code" href="puma_8f90.html#a03d027a1b5f735efb9bce2396d5fc2b6">03061</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a03d027a1b5f735efb9bce2396d5fc2b6">legpri</a>
  3151. <a name="l03062"></a>03062 use <span class="keywordflow">pumamod</span>
  3152. <a name="l03063"></a>03063
  3153. <a name="l03064"></a>03064 <span class="keyword">write</span>(nud,231)
  3154. <a name="l03065"></a>03065 <span class="keyword">write</span>(nud,232)
  3155. <a name="l03066"></a>03066 <span class="keyword">write</span>(nud,233)
  3156. <a name="l03067"></a>03067 <span class="keyword">write</span>(nud,232)
  3157. <a name="l03068"></a>03068 <span class="keyword">do</span> 14 jlat = 1 , NLAT
  3158. <a name="l03069"></a>03069 zalat = asin(sid(jlat))*180.0/PI
  3159. <a name="l03070"></a>03070 <span class="keyword">write</span>(nud,234) jlat,zalat,csq(jlat),gwd(jlat)
  3160. <a name="l03071"></a>03071 14 continue
  3161. <a name="l03072"></a>03072 <span class="keyword">write</span>(nud,232)
  3162. <a name="l03073"></a>03073 <span class="keyword">write</span>(nud,231)
  3163. <a name="l03074"></a>03074 return
  3164. <a name="l03075"></a>03075 231 format(/)
  3165. <a name="l03076"></a>03076 232 format(37(<span class="stringliteral">&#39;*&#39;</span>))
  3166. <a name="l03077"></a>03077 233 format(<span class="stringliteral">&#39;* No * Lat * csq weight *&#39;</span>)
  3167. <a name="l03078"></a>03078 234 format(<span class="stringliteral">&#39;*&#39;</span>,i4,<span class="stringliteral">&#39; *&#39;</span>,f6.1,<span class="stringliteral">&#39; *&#39;</span>,2f10.4,<span class="stringliteral">&#39; *&#39;</span>)
  3168. <a name="l03079"></a>03079 <span class="keyword"> end</span>
  3169. <a name="l03080"></a>03080
  3170. <a name="l03081"></a>03081
  3171. <a name="l03082"></a>03082 <span class="comment">! =================</span>
  3172. <a name="l03083"></a>03083 <span class="comment">! SUBROUTINE INILAT</span>
  3173. <a name="l03084"></a>03084 <span class="comment">! =================</span>
  3174. <a name="l03085"></a>03085
  3175. <a name="l03086"></a><a class="code" href="puma_8f90.html#a7780f6c3a813605c014f7da964ff83d2">03086</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#a7780f6c3a813605c014f7da964ff83d2">inilat</a>
  3176. <a name="l03087"></a>03087 use <span class="keywordflow">pumamod</span>
  3177. <a name="l03088"></a>03088 <span class="keywordtype">real (kind=8)</span> :: zcsq
  3178. <a name="l03089"></a>03089
  3179. <a name="l03090"></a>03090 <span class="keyword">do</span> jlat = 1 , NLAT
  3180. <a name="l03091"></a>03091 zcsq = 1.0 - sid(jlat) * sid(jlat)
  3181. <a name="l03092"></a>03092 csq(jlat) = zcsq
  3182. <a name="l03093"></a>03093 rcs(jlat) = 1.0 / sqrt(zcsq)
  3183. <a name="l03094"></a>03094 <span class="keyword">enddo</span>
  3184. <a name="l03095"></a>03095 <span class="keyword">do</span> jlat = 1 , NLAT/2
  3185. <a name="l03096"></a>03096 ideg = nint(180.0/PI * asin(sid(jlat)))
  3186. <a name="l03097"></a>03097 <span class="keyword">write</span>(chlat(jlat),<span class="stringliteral">&#39;(i2,a1)&#39;</span>) ideg,<span class="stringliteral">&#39;N&#39;</span>
  3187. <a name="l03098"></a>03098 <span class="keyword">write</span>(chlat(NLAT+1-jlat),<span class="stringliteral">&#39;(i2,a1)&#39;</span>) ideg,<span class="stringliteral">&#39;S&#39;</span>
  3188. <a name="l03099"></a>03099 <span class="keyword">enddo</span>
  3189. <a name="l03100"></a>03100 return
  3190. <a name="l03101"></a>03101 <span class="keyword"> end</span>
  3191. <a name="l03102"></a>03102
  3192. <a name="l03103"></a>03103
  3193. <a name="l03104"></a>03104 <span class="comment">! ====================</span>
  3194. <a name="l03105"></a>03105 <span class="comment">! SUBROUTINE GRIDPOINT</span>
  3195. <a name="l03106"></a>03106 <span class="comment">! ====================</span>
  3196. <a name="l03107"></a>03107
  3197. <a name="l03108"></a><a class="code" href="puma_8f90.html#aefdbfd36b330ce29d344d428431119c9">03108</a> <span class="keyword">subroutine </span><a class="code" href="ppp_8f90.html#aefdbfd36b330ce29d344d428431119c9">gridpoint</a>
  3198. <a name="l03109"></a>03109 use <span class="keywordflow">pumamod</span>
  3199. <a name="l03110"></a>03110
  3200. <a name="l03111"></a>03111 <span class="keywordtype">real</span> gtn(NLON,NLPP,NLEV)
  3201. <a name="l03112"></a>03112 <span class="keywordtype">real</span> gvpp(NHOR)
  3202. <a name="l03113"></a>03113 <span class="keywordtype">real</span> gpmt(NLON,NLPP)
  3203. <a name="l03114"></a>03114 <span class="keywordtype">real</span> sdf(NESP,NLEV)
  3204. <a name="l03115"></a>03115 <span class="keywordtype">real</span> stf(NESP,NLEV)
  3205. <a name="l03116"></a>03116 <span class="keywordtype">real</span> szf(NESP,NLEV)
  3206. <a name="l03117"></a>03117 <span class="keywordtype">real</span> spf(NESP)
  3207. <a name="l03118"></a>03118 <span class="keywordtype">real</span> zgp(NLON,NLAT)
  3208. <a name="l03119"></a>03119 <span class="keywordtype">real</span> zgpp(NHOR)
  3209. <a name="l03120"></a>03120 <span class="keywordtype">real (kind=4)</span> :: zcs(NLAT,NLEV)
  3210. <a name="l03121"></a>03121 <span class="keywordtype">real (kind=4)</span> :: zsp(NRSP)
  3211. <a name="l03122"></a>03122
  3212. <a name="l03123"></a>03123 <span class="keyword">do</span> jlev = 1 , NLEV
  3213. <a name="l03124"></a>03124 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(sd(1,jlev),gd(1,jlev))
  3214. <a name="l03125"></a>03125 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(st(1,jlev),gt(1,jlev))
  3215. <a name="l03126"></a>03126 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(sz(1,jlev),gz(1,jlev))
  3216. <a name="l03127"></a>03127 <span class="keyword">enddo</span>
  3217. <a name="l03128"></a>03128
  3218. <a name="l03129"></a>03129 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(sp,gp) <span class="comment">! LnPs</span>
  3219. <a name="l03130"></a>03130 call <a class="code" href="legsym_8f90.html#ac25a3c42ee19118b299203d2747cb59e">sp2fcdmu</a>(sp,gpj) <span class="comment">! d(lnps) / d(mu)</span>
  3220. <a name="l03131"></a>03131 <span class="comment">! divergence, vorticity -&gt; u*cos(phi), v*cos(phi)</span>
  3221. <a name="l03132"></a>03132 <span class="keyword">do</span> jlev = 1 , NLEV
  3222. <a name="l03133"></a>03133 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(sd(1,jlev),sz(1,jlev),gu(1,jlev),gv(1,jlev))
  3223. <a name="l03134"></a>03134 <span class="keyword">enddo</span>
  3224. <a name="l03135"></a>03135 <span class="keyword">if</span> (lselect) <span class="keyword">then</span>
  3225. <a name="l03136"></a>03136 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gp)
  3226. <a name="l03137"></a>03137 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gpj)
  3227. <a name="l03138"></a>03138 <span class="keyword">do</span> jlev = 1 , NLEV
  3228. <a name="l03139"></a>03139 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gu(1,jlev))
  3229. <a name="l03140"></a>03140 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gv(1,jlev))
  3230. <a name="l03141"></a>03141 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gd(1,jlev))
  3231. <a name="l03142"></a>03142 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gt(1,jlev))
  3232. <a name="l03143"></a>03143 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gz(1,jlev))
  3233. <a name="l03144"></a>03144 <span class="keyword">enddo</span>
  3234. <a name="l03145"></a>03145 <span class="keyword">endif</span>
  3235. <a name="l03146"></a>03146
  3236. <a name="l03147"></a>03147 <span class="keyword">if</span> (ngui &gt; 0 .or. mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,ndiag) == 0) <span class="keyword">then</span>
  3237. <a name="l03148"></a>03148 <span class="keyword">do</span> jlev = 1 , NLEV
  3238. <a name="l03149"></a>03149 <span class="keyword">do</span> jlat = 1 , NLPP
  3239. <a name="l03150"></a>03150 sec = cv / sqrt(csq(jlat))
  3240. <a name="l03151"></a>03151 csu(jlat,jlev) = gu(1+(jlat-1)*NLON,jlev) * sec
  3241. <a name="l03152"></a>03152 csv(jlat,jlev) = gv(1+(jlat-1)*NLON,jlev) * sec
  3242. <a name="l03153"></a>03153 cst(jlat,jlev) =(gt(1+(jlat-1)*NLON,jlev) + t0(jlev))*ct-273.16
  3243. <a name="l03154"></a>03154 <span class="keyword">enddo</span>
  3244. <a name="l03155"></a>03155 <span class="keyword">enddo</span>
  3245. <a name="l03156"></a>03156 <span class="keyword">endif</span>
  3246. <a name="l03157"></a>03157
  3247. <a name="l03158"></a>03158 <span class="keyword">do</span> jlat = 1 , NLPP
  3248. <a name="l03159"></a>03159 <span class="keyword">do</span> jlon = 1 , NLON-1 , 2
  3249. <a name="l03160"></a>03160 gpmt(jlon ,jlat) = -gp(jlon+1+(jlat-1)*NLON) * ((jlon-1)/2)
  3250. <a name="l03161"></a>03161 gpmt(jlon+1,jlat) = gp(jlon +(jlat-1)*NLON) * ((jlon-1)/2)
  3251. <a name="l03162"></a>03162 <span class="keyword">end do</span>
  3252. <a name="l03163"></a>03163 <span class="keyword">end do</span>
  3253. <a name="l03164"></a>03164
  3254. <a name="l03165"></a>03165 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gu ,NLON,NLPP*NLEV)
  3255. <a name="l03166"></a>03166 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gv ,NLON,NLPP*NLEV)
  3256. <a name="l03167"></a>03167 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gt ,NLON,NLPP*NLEV)
  3257. <a name="l03168"></a>03168 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gd ,NLON,NLPP*NLEV)
  3258. <a name="l03169"></a>03169 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gz ,NLON,NLPP*NLEV)
  3259. <a name="l03170"></a>03170 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gpj,NLON,NLPP)
  3260. <a name="l03171"></a>03171 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gpmt,NLON,NLPP)
  3261. <a name="l03172"></a>03172
  3262. <a name="l03173"></a>03173 call <a class="code" href="puma_8f90.html#a0e2e6d98e219c0540bd78f5673a2dd57">calcgp</a>(gtn,gpmt,gvpp)
  3263. <a name="l03174"></a>03174
  3264. <a name="l03175"></a>03175 gut(:,:) = gu(:,:) * gt(:,:)
  3265. <a name="l03176"></a>03176 gvt(:,:) = gv(:,:) * gt(:,:)
  3266. <a name="l03177"></a>03177 gke(:,:) = gu(:,:) * gu(:,:) + gv(:,:) * gv(:,:)
  3267. <a name="l03178"></a>03178
  3268. <a name="l03179"></a>03179 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gtn ,NLON,NLPP*NLEV)
  3269. <a name="l03180"></a>03180 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gut ,NLON,NLPP*NLEV)
  3270. <a name="l03181"></a>03181 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gvt ,NLON,NLPP*NLEV)
  3271. <a name="l03182"></a>03182 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gfv ,NLON,NLPP*NLEV)
  3272. <a name="l03183"></a>03183 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gfu ,NLON,NLPP*NLEV)
  3273. <a name="l03184"></a>03184 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gke ,NLON,NLPP*NLEV)
  3274. <a name="l03185"></a>03185 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(gvpp,NLON,NLPP )
  3275. <a name="l03186"></a>03186
  3276. <a name="l03187"></a>03187 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(gvpp,spf)
  3277. <a name="l03188"></a>03188
  3278. <a name="l03189"></a>03189 <span class="keyword">if</span> (lselect) <span class="keyword">then</span>
  3279. <a name="l03190"></a>03190 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gvpp)
  3280. <a name="l03191"></a>03191 <span class="keyword">do</span> jlev = 1 , NLEV
  3281. <a name="l03192"></a>03192 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gtn(1,1,jlev))
  3282. <a name="l03193"></a>03193 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gut(1,jlev))
  3283. <a name="l03194"></a>03194 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gvt(1,jlev))
  3284. <a name="l03195"></a>03195 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gfv(1,jlev))
  3285. <a name="l03196"></a>03196 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gfu(1,jlev))
  3286. <a name="l03197"></a>03197 call <a class="code" href="puma_8f90.html#a7278b4e4c576939f77bc4055e51cdaef">filter_zonal_waves</a>(gke(1,jlev))
  3287. <a name="l03198"></a>03198 <span class="keyword">enddo</span>
  3288. <a name="l03199"></a>03199 <span class="keyword">endif</span>
  3289. <a name="l03200"></a>03200
  3290. <a name="l03201"></a>03201 <span class="keyword">do</span> jlev = 1 , NLEV
  3291. <a name="l03202"></a>03202 call <a class="code" href="legsym_8f90.html#ab97cf272bad63e9bdd87a01317bb71c9">mktend</a>(sdf(1,jlev),stf(1,jlev),szf(1,jlev),gtn(1,1,jlev),&amp;
  3292. <a name="l03203"></a>03203 gfu(1,jlev),gfv(1,jlev),gke(1,jlev),gut(1,jlev),gvt(1,jlev))
  3293. <a name="l03204"></a>03204 <span class="keyword">enddo</span>
  3294. <a name="l03205"></a>03205
  3295. <a name="l03206"></a>03206 <span class="keyword">if</span> (nruido &gt; 0) call <a class="code" href="puma_8f90.html#ab257e27330a3ab13c9c90ebd985ef60e">stepruido</a>
  3296. <a name="l03207"></a>03207 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(spf,spt,1)
  3297. <a name="l03208"></a>03208 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(stf,stt,NLEV)
  3298. <a name="l03209"></a>03209 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(sdf,sdt,NLEV)
  3299. <a name="l03210"></a>03210 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(szf,szt,NLEV)
  3300. <a name="l03211"></a>03211
  3301. <a name="l03212"></a>03212 <span class="keyword">if</span> (ngui &gt; 0 .or. mod(<a class="code" href="pumax_8c.html#a354c90bb46e1789fe52c4759474c2c89">nstep</a>,ndiag) == 0) <span class="keyword">then</span>
  3302. <a name="l03213"></a>03213 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gp,NLON,NLPP)
  3303. <a name="l03214"></a>03214 zgpp(:) = exp(gp) <span class="comment">! LnPs -&gt; Ps</span>
  3304. <a name="l03215"></a>03215 call <a class="code" href="mpimod_8f90.html#aaa1210298789f4fd7b7702c276eb80a9">mpgagp</a>(zgp,zgpp,1) <span class="comment">! zgp = Ps (full grid)</span>
  3305. <a name="l03216"></a>03216 <span class="keyword">if</span> (ngui &gt; 0) <span class="keyword">then</span>
  3306. <a name="l03217"></a>03217 call <a class="code" href="guimod_8f90.html#aef8771e5b34f33e37c1370ac60c41aea">guips</a>(zgp,psmean)
  3307. <a name="l03218"></a>03218 call <a class="code" href="guimod_8f90.html#ad4f84b3b48dfc55519b6072ba9a62e97">guigv</a>(<span class="stringliteral">&quot;GU&quot;</span> // char(0),gu)
  3308. <a name="l03219"></a>03219 call <a class="code" href="guimod_8f90.html#ad4f84b3b48dfc55519b6072ba9a62e97">guigv</a>(<span class="stringliteral">&quot;GV&quot;</span> // char(0),gv)
  3309. <a name="l03220"></a>03220 call <a class="code" href="guimod_8f90.html#a043a85f7d43cabc1814465b055b8da18">guigt</a>(gt)
  3310. <a name="l03221"></a>03221 <span class="keyword">endif</span>
  3311. <a name="l03222"></a>03222 zgpp(:) = zgpp(:) - 1.0 <span class="comment">! Mean(LnPs) = 0 &lt;-&gt; Mean(Ps) = 1</span>
  3312. <a name="l03223"></a>03223 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zgpp,NLON,NLPP)
  3313. <a name="l03224"></a>03224 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zgpp,span)
  3314. <a name="l03225"></a>03225
  3315. <a name="l03226"></a>03226 call <a class="code" href="mpimod_8f90.html#af894efd9525c935f22415e017dcbc482">mpsum</a>(span,1) <span class="comment">! span = Ps spectral</span>
  3316. <a name="l03227"></a>03227 call <a class="code" href="mpimod_8f90.html#a5aef7e33503e0c46b1d8c0b984c398d1">mpgacs</a>(csu)
  3317. <a name="l03228"></a>03228 call <a class="code" href="mpimod_8f90.html#a5aef7e33503e0c46b1d8c0b984c398d1">mpgacs</a>(csv)
  3318. <a name="l03229"></a>03229 call <a class="code" href="mpimod_8f90.html#a5aef7e33503e0c46b1d8c0b984c398d1">mpgacs</a>(cst)
  3319. <a name="l03230"></a>03230 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  3320. <a name="l03231"></a>03231 call <a class="code" href="legsym_8f90.html#a6ba5b0b99819bcbad73f2e2eb49c62bb">altcs</a>(csu)
  3321. <a name="l03232"></a>03232 call <a class="code" href="legsym_8f90.html#a6ba5b0b99819bcbad73f2e2eb49c62bb">altcs</a>(csv)
  3322. <a name="l03233"></a>03233 call <a class="code" href="legsym_8f90.html#a6ba5b0b99819bcbad73f2e2eb49c62bb">altcs</a>(cst)
  3323. <a name="l03234"></a>03234 <span class="keyword">if</span> (ngui &gt; 0) <span class="keyword">then</span>
  3324. <a name="l03235"></a>03235 zcs(:,:) = csu(:,:)
  3325. <a name="l03236"></a>03236 call <a class="code" href="guimod__stub_8f90.html#a246c916d08a954310ea15d64816db13b">guiput</a>(<span class="stringliteral">&quot;CSU&quot;</span> // char(0) ,zcs ,NLAT,NLEV,1)
  3326. <a name="l03237"></a>03237 zcs(:,:) = csv(:,:)
  3327. <a name="l03238"></a>03238 call <a class="code" href="guimod__stub_8f90.html#a246c916d08a954310ea15d64816db13b">guiput</a>(<span class="stringliteral">&quot;CSV&quot;</span> // char(0) ,zcs ,NLAT,NLEV,1)
  3328. <a name="l03239"></a>03239 zcs(:,:) = cst(:,:)
  3329. <a name="l03240"></a>03240 call <a class="code" href="guimod__stub_8f90.html#a246c916d08a954310ea15d64816db13b">guiput</a>(<span class="stringliteral">&quot;CST&quot;</span> // char(0) ,zcs ,NLAT,NLEV,1)
  3330. <a name="l03241"></a>03241 zsp(:) = span(1:NRSP)
  3331. <a name="l03242"></a>03242 call <a class="code" href="guimod__stub_8f90.html#a246c916d08a954310ea15d64816db13b">guiput</a>(<span class="stringliteral">&quot;SPAN&quot;</span> // char(0) ,zsp ,NCSP,-NTP1,1)
  3332. <a name="l03243"></a>03243 <span class="keyword">endif</span>
  3333. <a name="l03244"></a>03244 <span class="keyword">endif</span>
  3334. <a name="l03245"></a>03245 <span class="keyword">endif</span>
  3335. <a name="l03246"></a>03246 return
  3336. <a name="l03247"></a>03247 <span class="keyword"> end</span>
  3337. <a name="l03248"></a>03248
  3338. <a name="l03249"></a>03249 <span class="comment">! =================</span>
  3339. <a name="l03250"></a>03250 <span class="comment">! SUBROUTINE CALCGP</span>
  3340. <a name="l03251"></a>03251 <span class="comment">! =================</span>
  3341. <a name="l03252"></a><a class="code" href="puma_8f90.html#a0e2e6d98e219c0540bd78f5673a2dd57">03252</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a0e2e6d98e219c0540bd78f5673a2dd57">calcgp</a>(gtn,gpm,gvp)
  3342. <a name="l03253"></a>03253
  3343. <a name="l03254"></a>03254 use <span class="keywordflow">pumamod</span>
  3344. <a name="l03255"></a>03255
  3345. <a name="l03256"></a>03256 <span class="comment">! Comments by Torben Kunz and Guido Schroeder</span>
  3346. <a name="l03257"></a>03257
  3347. <a name="l03258"></a>03258 <span class="comment">! Compute nonlinear tendencies in grid point space.</span>
  3348. <a name="l03259"></a>03259 <span class="comment">! Hoskins and Simmons 1975 (Q.J.R.Meteorol.Soc.,101,637-655) (HS75)</span>
  3349. <a name="l03260"></a>03260
  3350. <a name="l03261"></a>03261 <span class="comment">! For terms calculated in this routine, see HS75, eqs. (8)-(10) and</span>
  3351. <a name="l03262"></a>03262 <span class="comment">! appendix I:</span>
  3352. <a name="l03263"></a>03263 <span class="comment">! - script Fu, Fv as contributions to script D: gl. arrays gfu, gfv</span>
  3353. <a name="l03264"></a>03264 <span class="comment">! - script T: returned as gtn</span>
  3354. <a name="l03265"></a>03265 <span class="comment">! - script P: returned as gvp</span>
  3355. <a name="l03266"></a>03266
  3356. <a name="l03267"></a>03267
  3357. <a name="l03268"></a>03268 <span class="comment">! parameters (in)</span>
  3358. <a name="l03269"></a>03269 <span class="comment">! ---------------</span>
  3359. <a name="l03270"></a>03270
  3360. <a name="l03271"></a>03271 <span class="comment">! gpm -- d(ln(ps)) / d(lambda)</span>
  3361. <a name="l03272"></a>03272
  3362. <a name="l03273"></a>03273 <span class="comment">! parameters (out)</span>
  3363. <a name="l03274"></a>03274 <span class="comment">! ---------------</span>
  3364. <a name="l03275"></a>03275
  3365. <a name="l03276"></a>03276 <span class="comment">! gtn -- temperature tendency</span>
  3366. <a name="l03277"></a>03277 <span class="comment">! gvp -- vertical integral of (u,v) * grad(ln(ps))</span>
  3367. <a name="l03278"></a>03278
  3368. <a name="l03279"></a>03279 <span class="comment">! global arrays variable in time</span>
  3369. <a name="l03280"></a>03280 <span class="comment">! ------------------------------</span>
  3370. <a name="l03281"></a>03281
  3371. <a name="l03282"></a>03282 <span class="comment">! gfu, gfv -- terms Fu, Fv in primitive equations,</span>
  3372. <a name="l03283"></a>03283 <span class="comment">! see HS75 (eqs. (1), (2))</span>
  3373. <a name="l03284"></a>03284 <span class="comment">! gu, gv -- components u, v of horizontal velocity vector</span>
  3374. <a name="l03285"></a>03285 <span class="comment">! gd -- divergence D</span>
  3375. <a name="l03286"></a>03286 <span class="comment">! gz -- absolute vorticity</span>
  3376. <a name="l03287"></a>03287 <span class="comment">! gt -- temperature deviation T&#39;</span>
  3377. <a name="l03288"></a>03288
  3378. <a name="l03289"></a>03289 <span class="comment">! global arrays constant in time</span>
  3379. <a name="l03290"></a>03290 <span class="comment">! ------------------------------</span>
  3380. <a name="l03291"></a>03291
  3381. <a name="l03292"></a>03292 <span class="comment">! t0d -- reference temperature difference between two adjacent</span>
  3382. <a name="l03293"></a>03293 <span class="comment">! full levels</span>
  3383. <a name="l03294"></a>03294 <span class="comment">! tkp -- reference temperature times kappa (global parameter AKAP)</span>
  3384. <a name="l03295"></a>03295 <span class="comment">! rdsig -- 1 / (2 * dsigma)</span>
  3385. <a name="l03296"></a>03296 <span class="comment">! rcsq -- 1 / (1 - mu^2) </span>
  3386. <a name="l03297"></a>03297
  3387. <a name="l03298"></a>03298 <span class="comment">! notations used in subsequent comments</span>
  3388. <a name="l03299"></a>03299 <span class="comment">! -------------------------------------</span>
  3389. <a name="l03300"></a>03300
  3390. <a name="l03301"></a>03301 <span class="comment">! aINTb(A)dsigma :&lt;=&gt; the integral of A over the interval [a,b]</span>
  3391. <a name="l03302"></a>03302 <span class="comment">! with respect to sigma</span>
  3392. <a name="l03303"></a>03303
  3393. <a name="l03304"></a>03304 <span class="keywordtype">real</span> gtn(NHOR,NLEV)
  3394. <a name="l03305"></a>03305 <span class="keywordtype">real</span> gpm(NHOR) , gvp(NHOR)
  3395. <a name="l03306"></a>03306 <span class="keywordtype">real</span> zsdotp(NHOR,NLEM),zsumd(NHOR),zsumvp(NHOR),zsumvpm(NHOR)
  3396. <a name="l03307"></a>03307 <span class="keywordtype">real</span> ztpta(NHOR),ztptb(NHOR)
  3397. <a name="l03308"></a>03308 <span class="keywordtype">real</span> zvgpg(NHOR,NLEV)
  3398. <a name="l03309"></a>03309 <span class="keywordtype">real</span> gtd(NHOR,NLEM)
  3399. <a name="l03310"></a>03310 <span class="keywordtype">real</span> gud(NHOR,NLEM)
  3400. <a name="l03311"></a>03311 <span class="keywordtype">real</span> gvd(NHOR,NLEM)
  3401. <a name="l03312"></a>03312
  3402. <a name="l03313"></a>03313 <span class="comment">! 1.</span>
  3403. <a name="l03314"></a>03314 <span class="comment">! 1.1 zvgpg: (u,v) * grad(ln(ps))</span>
  3404. <a name="l03315"></a>03315
  3405. <a name="l03316"></a>03316 <span class="keyword">do</span> jlev = 1 , NLEV
  3406. <a name="l03317"></a>03317 zvgpg(:,jlev) = rcsq * (gu(:,jlev)*gpm(:)+gv(:,jlev)*gpj(:))
  3407. <a name="l03318"></a>03318 <span class="keyword">enddo</span>
  3408. <a name="l03319"></a>03319
  3409. <a name="l03320"></a>03320 <span class="comment">! 1.2 Calculate vertical integral of A = D + (u,v) * grad(ln(ps)),</span>
  3410. <a name="l03321"></a>03321 <span class="comment">! separated into divergence and ln(ps) advection.</span>
  3411. <a name="l03322"></a>03322 <span class="comment">! zsumd : 0INT1(D)dsigma</span>
  3412. <a name="l03323"></a>03323 <span class="comment">! gvp : 0INT1[(u,v) * grad ln(ps)]dsigma</span>
  3413. <a name="l03324"></a>03324 <span class="comment">! zsdotp : 0INTsigma(A)dsigma</span>
  3414. <a name="l03325"></a>03325
  3415. <a name="l03326"></a>03326 zsumd = dsigma(1) * gd(:,1)
  3416. <a name="l03327"></a>03327 gvp = dsigma(1) * zvgpg(:,1)
  3417. <a name="l03328"></a>03328 zsdotp(:,1) = zsumd + gvp
  3418. <a name="l03329"></a>03329
  3419. <a name="l03330"></a>03330 <span class="keyword">do</span> jlev = 2 , NLEM
  3420. <a name="l03331"></a>03331 zsumd = zsumd + dsigma(jlev) * gd(:,jlev)
  3421. <a name="l03332"></a>03332 gvp = gvp + dsigma(jlev) * zvgpg(:,jlev)
  3422. <a name="l03333"></a>03333 zsdotp(:,jlev) = zsumd + gvp
  3423. <a name="l03334"></a>03334 <span class="keyword">enddo</span>
  3424. <a name="l03335"></a>03335
  3425. <a name="l03336"></a>03336 zsumd = zsumd + dsigma(NLEV) * gd(:,NLEV)
  3426. <a name="l03337"></a>03337 gvp = gvp + dsigma(NLEV) * zvgpg(:,NLEV)
  3427. <a name="l03338"></a>03338
  3428. <a name="l03339"></a>03339 <span class="comment">! 2. Calculate vertical velocity and vertical advection terms</span>
  3429. <a name="l03340"></a>03340 <span class="comment">! on half levels.</span>
  3430. <a name="l03341"></a>03341
  3431. <a name="l03342"></a>03342 <span class="keyword">do</span> jlev = 1 , NLEM
  3432. <a name="l03343"></a>03343 zsdotp(:,jlev) = (sigmh(jlev) * (zsumd+gvp) - zsdotp(:,jlev))
  3433. <a name="l03344"></a>03344 <span class="keyword">enddo</span>
  3434. <a name="l03345"></a>03345
  3435. <a name="l03346"></a>03346 gtd(:,:) = zsdotp(:,:) * (gt(:,2:NLEV) - gt(:,1:NLEM))
  3436. <a name="l03347"></a>03347 gud(:,:) = zsdotp(:,:) * (gu(:,2:NLEV) - gu(:,1:NLEM))
  3437. <a name="l03348"></a>03348 gvd(:,:) = zsdotp(:,:) * (gv(:,2:NLEV) - gv(:,1:NLEM))
  3438. <a name="l03349"></a>03349
  3439. <a name="l03350"></a>03350 <span class="comment">! 3. Calculate nonlinear contributions to temperature tendency and</span>
  3440. <a name="l03351"></a>03351 <span class="comment">! nonlinear terms Fu, Fv as used in vorticity and</span>
  3441. <a name="l03352"></a>03352 <span class="comment">! divergence equation.</span>
  3442. <a name="l03353"></a>03353
  3443. <a name="l03354"></a>03354 <span class="comment">! 3.1 top level:</span>
  3444. <a name="l03355"></a>03355
  3445. <a name="l03356"></a>03356 <span class="comment">! 3.1.1 zsumvp: 0INTsigma[(u,v) * grad(ln(ps))]dsigma</span>
  3446. <a name="l03357"></a>03357
  3447. <a name="l03358"></a>03358 zsumvp = zvgpg(:,1) * dsigma(1)
  3448. <a name="l03359"></a>03359
  3449. <a name="l03360"></a>03360 <span class="comment">! 3.1.2 Calculation of gtn, gfv and gfu as for inner levels (3.2),</span>
  3450. <a name="l03361"></a>03361 <span class="comment">! but somewhat simplified:</span>
  3451. <a name="l03362"></a>03362 <span class="comment">! a) For the top level the following equation holds in the</span>
  3452. <a name="l03363"></a>03363 <span class="comment">! discretized form: (1/sigma)*0INTsigma(A)dsigma == A</span>
  3453. <a name="l03364"></a>03364 <span class="comment">! (HS75, second equation following eq. (7)). Therefore,</span>
  3454. <a name="l03365"></a>03365 <span class="comment">! (3.2.3) simplifies to -kappa*T&#39; * D and (3.2.4) vanishes.</span>
  3455. <a name="l03366"></a>03366 <span class="comment">! b) Vertical advection terms (gtd, gud, gvd (see section 2)</span>
  3456. <a name="l03367"></a>03367 <span class="comment">! and vertical T0 advection (3.2.6)) vanish at upper</span>
  3457. <a name="l03368"></a>03368 <span class="comment">! boundary (sigma == 0).</span>
  3458. <a name="l03369"></a>03369
  3459. <a name="l03370"></a>03370 gtn(:,1) = (1.0-akap) * gt(:,1) * gd(:,1) - rdsig(1) * (gtd(:,1) &amp;
  3460. <a name="l03371"></a>03371 + t0d(1) * (sigmh(1)*gvp-zsumvp))
  3461. <a name="l03372"></a>03372
  3462. <a name="l03373"></a>03373 gfv(:,1) = - gu(:,1)*gz(:,1) - gpj(:)*gt(:,1) - rdsig(1)*gvd(:,1)
  3463. <a name="l03374"></a>03374 gfu(:,1) = gv(:,1)*gz(:,1) - gpm(:)*gt(:,1) - rdsig(1)*gud(:,1)
  3464. <a name="l03375"></a>03375
  3465. <a name="l03376"></a>03376 <span class="comment">! 3.2 inner levels:</span>
  3466. <a name="l03377"></a>03377
  3467. <a name="l03378"></a>03378 <span class="keyword">do</span> jlev = 2 , NLEM
  3468. <a name="l03379"></a>03379
  3469. <a name="l03380"></a>03380 <span class="comment">! 3.2.1 ztpta: (1/sigma)*0INTsigma(A-D)dsigma</span>
  3470. <a name="l03381"></a>03381 <span class="comment">! ztptb: (1/sigma)*0INTsigma(A)dsigma</span>
  3471. <a name="l03382"></a>03382 <span class="comment">! Matrix c contains factors for discretized integration, see</span>
  3472. <a name="l03383"></a>03383 <span class="comment">! HS75 (second equation following eq. (7)).</span>
  3473. <a name="l03384"></a>03384
  3474. <a name="l03385"></a>03385 ztpta = c(1,jlev) * zvgpg(:,1)
  3475. <a name="l03386"></a>03386 ztptb = c(1,jlev) * (zvgpg(:,1) + gd(:,1))
  3476. <a name="l03387"></a>03387
  3477. <a name="l03388"></a>03388 <span class="keyword">do</span> jlej = 2 , jlev
  3478. <a name="l03389"></a>03389 ztpta = ztpta + c(jlej,jlev) * zvgpg(:,jlej)
  3479. <a name="l03390"></a>03390 ztptb = ztptb + c(jlej,jlev) * (zvgpg(:,jlej) + gd(:,jlej))
  3480. <a name="l03391"></a>03391 <span class="keyword">enddo</span>
  3481. <a name="l03392"></a>03392
  3482. <a name="l03393"></a>03393 zsumvpm = zsumvp
  3483. <a name="l03394"></a>03394 zsumvp = zsumvp + zvgpg(:,jlev) * dsigma(jlev)
  3484. <a name="l03395"></a>03395
  3485. <a name="l03396"></a>03396 <span class="comment">! 3.2.2 D * T&#39; </span>
  3486. <a name="l03397"></a>03397
  3487. <a name="l03398"></a>03398 gtn(:,jlev) = gt(:,jlev) * gd(:,jlev)
  3488. <a name="l03399"></a>03399
  3489. <a name="l03400"></a>03400 <span class="comment">! 3.2.3 kappa*T&#39; *</span>
  3490. <a name="l03401"></a>03401 <span class="comment">! [(u,v)*grad(ln(ps)) - (1/sigma)*0INTsigma(A)dsigma]</span>
  3491. <a name="l03402"></a>03402
  3492. <a name="l03403"></a>03403 gtn(:,jlev) = gtn(:,jlev) &amp;
  3493. <a name="l03404"></a>03404 &amp; + akap * gt(:,jlev) * (zvgpg(:,jlev) - ztptb)
  3494. <a name="l03405"></a>03405
  3495. <a name="l03406"></a>03406 <span class="comment">! 3.2.4 kappa*T0 *</span>
  3496. <a name="l03407"></a>03407 <span class="comment">! [(u,v)*grad(ln(ps)) - (1/sigma)*0INTsigma(A-D)dsigma]</span>
  3497. <a name="l03408"></a>03408
  3498. <a name="l03409"></a>03409 gtn(:,jlev) = gtn(:,jlev) &amp;
  3499. <a name="l03410"></a>03410 &amp; + tkp(jlev) * (zvgpg(:,jlev) - ztpta)
  3500. <a name="l03411"></a>03411
  3501. <a name="l03412"></a>03412 <span class="comment">! 3.2.5 Calculate vertical T&#39; advection on full levels by</span>
  3502. <a name="l03413"></a>03413 <span class="comment">! averaging two half level advection terms (gtd, calculated</span>
  3503. <a name="l03414"></a>03414 <span class="comment">! in section 2).</span>
  3504. <a name="l03415"></a>03415
  3505. <a name="l03416"></a>03416 <span class="comment">! and</span>
  3506. <a name="l03417"></a>03417
  3507. <a name="l03418"></a>03418 <span class="comment">! 3.2.6 Calculate vertical T0 advection on full levels by</span>
  3508. <a name="l03419"></a>03419 <span class="comment">! averaging two half level advection terms.</span>
  3509. <a name="l03420"></a>03420
  3510. <a name="l03421"></a>03421 gtn(:,jlev) = gtn(:,jlev) &amp;
  3511. <a name="l03422"></a>03422 &amp; - rdsig(jlev) * (gtd(:,jlev) + gtd(:,jlev-1) &amp;
  3512. <a name="l03423"></a>03423 &amp; +(sigmh(jlev) * gvp - zsumvp) * t0d(jlev) &amp;
  3513. <a name="l03424"></a>03424 &amp; +(sigmh(jlev-1) * gvp - zsumvpm) * t0d(jlev-1))
  3514. <a name="l03425"></a>03425
  3515. <a name="l03426"></a>03426 <span class="comment">! 3.2.7 terms Fv, Fu, see HS75 (equations following eq. (5));</span>
  3516. <a name="l03427"></a>03427 <span class="comment">! vertical advection terms interpolated to full levels by</span>
  3517. <a name="l03428"></a>03428 <span class="comment">! averaging two half level advection terms.</span>
  3518. <a name="l03429"></a>03429
  3519. <a name="l03430"></a>03430 gfv(:,jlev) = - gu(:,jlev)*gz(:,jlev) - gpj(:)*gt(:,jlev) &amp;
  3520. <a name="l03431"></a>03431 &amp; - rdsig(jlev)*(gvd(:,jlev) + gvd(:,jlev-1))
  3521. <a name="l03432"></a>03432
  3522. <a name="l03433"></a>03433 gfu(:,jlev) = gv(:,jlev)*gz(:,jlev) - gpm(:)*gt(:,jlev) &amp;
  3523. <a name="l03434"></a>03434 &amp; - rdsig(jlev)*(gud(:,jlev) + gud(:,jlev-1))
  3524. <a name="l03435"></a>03435 <span class="keyword">enddo</span>
  3525. <a name="l03436"></a>03436
  3526. <a name="l03437"></a>03437 <span class="comment">! 3.3 bottom level</span>
  3527. <a name="l03438"></a>03438
  3528. <a name="l03439"></a>03439 <span class="comment">! 3.3.1 ztpta, ztptb: see 3.2.1</span>
  3529. <a name="l03440"></a>03440
  3530. <a name="l03441"></a>03441 ztpta = c(1,NLEV) * zvgpg(:,1)
  3531. <a name="l03442"></a>03442 ztptb = c(1,NLEV) * (zvgpg(:,1) + gd(:,1))
  3532. <a name="l03443"></a>03443
  3533. <a name="l03444"></a>03444 <span class="keyword">do</span> jlej = 2 , NLEV
  3534. <a name="l03445"></a>03445 ztpta = ztpta + c(jlej,NLEV) * zvgpg(:,jlej)
  3535. <a name="l03446"></a>03446 ztptb = ztptb + c(jlej,NLEV) * (zvgpg(:,jlej) + gd(:,jlej))
  3536. <a name="l03447"></a>03447 <span class="keyword">enddo</span>
  3537. <a name="l03448"></a>03448
  3538. <a name="l03449"></a>03449 <span class="comment">! 3.3.2 Calculation of gtn, gfv and gfu as for inner levels (3.2),</span>
  3539. <a name="l03450"></a>03450 <span class="comment">! but somewhat simplified:</span>
  3540. <a name="l03451"></a>03451 <span class="comment">! Vertical advection terms (gtd, gud, gvd (see section 2) and </span>
  3541. <a name="l03452"></a>03452 <span class="comment">! vertical T0 advection (3.2.6)) vanish at</span>
  3542. <a name="l03453"></a>03453 <span class="comment">! lower boundary (sigma == 1).</span>
  3543. <a name="l03454"></a>03454
  3544. <a name="l03455"></a>03455 gtn(:,NLEV) = gt(:,NLEV) * gd(:,NLEV) &amp;
  3545. <a name="l03456"></a>03456 &amp; + akap*gt(:,NLEV)*(zvgpg(:,NLEV)-ztptb) &amp;
  3546. <a name="l03457"></a>03457 &amp; + tkp(NLEV)*(zvgpg(:,NLEV)-ztpta) &amp;
  3547. <a name="l03458"></a>03458 &amp; - rdsig(NLEV) * (gtd(:,NLEM) &amp;
  3548. <a name="l03459"></a>03459 &amp; + t0d(NLEM)*(sigmh(NLEM)*gvp-zsumvp))
  3549. <a name="l03460"></a>03460
  3550. <a name="l03461"></a>03461 gfv(:,NLEV) = -gu(:,NLEV) * gz(:,NLEV) - gpj(:) * gt(:,NLEV) &amp;
  3551. <a name="l03462"></a>03462 &amp; - rdsig(NLEV) * gvd(:,NLEM)
  3552. <a name="l03463"></a>03463 gfu(:,NLEV) = gv(:,NLEV) * gz(:,NLEV) - gpm(:) * gt(:,NLEV) &amp;
  3553. <a name="l03464"></a>03464 &amp; - rdsig(NLEV) * gud(:,NLEM)
  3554. <a name="l03465"></a>03465
  3555. <a name="l03466"></a>03466 <span class="comment">! 3.3.3 Add gaussian noise to T (controlled by nruido)</span>
  3556. <a name="l03467"></a>03467
  3557. <a name="l03468"></a>03468 <span class="keyword">if</span> (nruido &gt; 0) gtn(:,:) = gtn(:,:) + ruidop(:,:)
  3558. <a name="l03469"></a>03469
  3559. <a name="l03470"></a>03470 return
  3560. <a name="l03471"></a>03471 <span class="keyword"> end</span>
  3561. <a name="l03472"></a>03472
  3562. <a name="l03473"></a>03473 <span class="comment">! ===================</span>
  3563. <a name="l03474"></a>03474 <span class="comment">! SUBROUTINE SPECTRAL</span>
  3564. <a name="l03475"></a>03475 <span class="comment">! ===================</span>
  3565. <a name="l03476"></a>03476
  3566. <a name="l03477"></a><a class="code" href="puma_8f90.html#a218b1f5483f314ea3a7eeba949933773">03477</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a218b1f5483f314ea3a7eeba949933773">spectral</a>
  3567. <a name="l03478"></a>03478 use <span class="keywordflow">pumamod</span>
  3568. <a name="l03479"></a>03479
  3569. <a name="l03480"></a>03480 <span class="comment">!* Add adiabatic and diabatic tendencies - perform leapfrog</span>
  3570. <a name="l03481"></a>03481
  3571. <a name="l03482"></a>03482 <span class="comment">! The adiabatic tendencies are added using the semi implicit scheme</span>
  3572. <a name="l03483"></a>03483 <span class="comment">! Hoskins and Simmons 1975 (Q.J.R.Meteorol.Soc.,101,637-655) (HS75)</span>
  3573. <a name="l03484"></a>03484 <span class="comment">! To compare the code directly with HS75 the following notes might</span>
  3574. <a name="l03485"></a>03485 <span class="comment">! be helpful (in addition to the comments below):</span>
  3575. <a name="l03486"></a>03486
  3576. <a name="l03487"></a>03487 <span class="comment">! Name rule for global arrays &lt;abc&gt;:</span>
  3577. <a name="l03488"></a>03488 <span class="comment">! a : representation (s=spectral, g=grid, z=local)</span>
  3578. <a name="l03489"></a>03489 <span class="comment">! b : variable (p=ln(ps), d=divergence, z=vorticity, t=temperature)</span>
  3579. <a name="l03490"></a>03490 <span class="comment">! c : modifier (m=previous timestep, p=present timestep, t=tendency)</span>
  3580. <a name="l03491"></a>03491
  3581. <a name="l03492"></a>03492 <span class="comment">! global arrays variable in time</span>
  3582. <a name="l03493"></a>03493 <span class="comment">! ------------------------------</span>
  3583. <a name="l03494"></a>03494
  3584. <a name="l03495"></a>03495 <span class="comment">! spt - pressure tendency HS75 (10)</span>
  3585. <a name="l03496"></a>03496 <span class="comment">! sdt - divergence tendency HS75 ( 8)</span>
  3586. <a name="l03497"></a>03497 <span class="comment">! szt - vorticity tendency</span>
  3587. <a name="l03498"></a>03498 <span class="comment">! stt - temperature tendency HS75 ( 9)</span>
  3588. <a name="l03499"></a>03499
  3589. <a name="l03500"></a>03500 <span class="comment">! spm - pressure at previous timestep</span>
  3590. <a name="l03501"></a>03501 <span class="comment">! sdm - divergence at previous timestep</span>
  3591. <a name="l03502"></a>03502 <span class="comment">! szm - vorticity at previous timestep</span>
  3592. <a name="l03503"></a>03503 <span class="comment">! stm - temperature at previous timestep</span>
  3593. <a name="l03504"></a>03504
  3594. <a name="l03505"></a>03505 <span class="comment">! spp - pressure at present timestep</span>
  3595. <a name="l03506"></a>03506 <span class="comment">! sdp - divergence at present timestep</span>
  3596. <a name="l03507"></a>03507 <span class="comment">! szp - vorticity at present timestep</span>
  3597. <a name="l03508"></a>03508 <span class="comment">! stp - temperature at present timestep</span>
  3598. <a name="l03509"></a>03509
  3599. <a name="l03510"></a>03510 <span class="comment">! global arrays constant in time</span>
  3600. <a name="l03511"></a>03511 <span class="comment">! ------------------------------</span>
  3601. <a name="l03512"></a>03512
  3602. <a name="l03513"></a>03513 <span class="comment">! sak(NSPP) - = hyper diffusion</span>
  3603. <a name="l03514"></a>03514 <span class="comment">! sop(NSPP) - g* = orography as geopotential</span>
  3604. <a name="l03515"></a>03515 <span class="comment">! srp1(NSPP,NLEV) - Tr = radiative equilibrium temperature (annual mean)</span>
  3605. <a name="l03516"></a>03516 <span class="comment">! srp2(NSPP,NLEV) - Tr = radiative equilibrium temperature (annual cycle)</span>
  3606. <a name="l03517"></a>03517 <span class="comment">! nindex(NSPP) - n = total wavenumber n for spectral modes</span>
  3607. <a name="l03518"></a>03518 <span class="comment">! srcn(NSPP) - 1/Cn = 1.0 / (n * (n+1))</span>
  3608. <a name="l03519"></a>03519 <span class="comment">! damp(NLEV) 1/tau R = time constant for newtonian cooling</span>
  3609. <a name="l03520"></a>03520 <span class="comment">! fric(NLEV) 1/tau F = time constant for Rayleigh friction</span>
  3610. <a name="l03521"></a>03521
  3611. <a name="l03522"></a>03522 <span class="keywordtype">real</span> zpm(NSPP) <span class="comment">! new spm</span>
  3612. <a name="l03523"></a>03523 <span class="keywordtype">real</span> zdm(NSPP,NLEV) <span class="comment">! new sdm</span>
  3613. <a name="l03524"></a>03524 <span class="keywordtype">real</span> zzm(NSPP,NLEV) <span class="comment">! new szm</span>
  3614. <a name="l03525"></a>03525 <span class="keywordtype">real</span> ztm(NSPP,NLEV) <span class="comment">! new stm</span>
  3615. <a name="l03526"></a>03526 <span class="keywordtype">real</span> zwp(NSPP) <span class="comment">! timefilter delta pm</span>
  3616. <a name="l03527"></a>03527 <span class="keywordtype">real</span> zwd(NSPP,NLEV) <span class="comment">! timefilter delta sd</span>
  3617. <a name="l03528"></a>03528 <span class="keywordtype">real</span> zwz(NSPP,NLEV) <span class="comment">! timefilter delta sz</span>
  3618. <a name="l03529"></a>03529 <span class="keywordtype">real</span> zwt(NSPP,NLEV) <span class="comment">! timefilter delta st</span>
  3619. <a name="l03530"></a>03530 <span class="keywordtype">real</span> zsrp(NSPP) <span class="comment">! restoring temperature (mean + annual cycle)</span>
  3620. <a name="l03531"></a>03531
  3621. <a name="l03532"></a>03532 <span class="keywordtype">real</span> zgt(NSPP,NLEV) <span class="comment">! work array</span>
  3622. <a name="l03533"></a>03533
  3623. <a name="l03534"></a>03534 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zstte(:,:,:) <span class="comment">! temp. tendencies for energy diag.</span>
  3624. <a name="l03535"></a>03535 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zszte(:,:,:) <span class="comment">! vort. tendencies for energy recycling</span>
  3625. <a name="l03536"></a>03536 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zsdte(:,:,:) <span class="comment">! div. tendencies for energy recycling</span>
  3626. <a name="l03537"></a>03537 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zdps(:) <span class="comment">! surf pressure for energy diag</span>
  3627. <a name="l03538"></a>03538 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zsp(:) <span class="comment">! surf pressure spectral</span>
  3628. <a name="l03539"></a>03539 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zspf(:) <span class="comment">! surf pressure spectral</span>
  3629. <a name="l03540"></a>03540 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zspt(:) <span class="comment">! surf pressure tendency </span>
  3630. <a name="l03541"></a>03541
  3631. <a name="l03542"></a>03542 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zst(:,:) <span class="comment">! temperature for entropy diagnostics</span>
  3632. <a name="l03543"></a>03543 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zstt(:,:) <span class="comment">! tem. tendencies for entropy diag.</span>
  3633. <a name="l03544"></a>03544 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: ztgp(:,:) <span class="comment">! </span>
  3634. <a name="l03545"></a>03545 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zdtgp(:,:) <span class="comment">! </span>
  3635. <a name="l03546"></a>03546 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zsum1(:)
  3636. <a name="l03547"></a>03547 <span class="keywordtype">real</span>,<span class="keywordtype">allocatable</span> :: zgw(:)
  3637. <a name="l03548"></a>03548
  3638. <a name="l03549"></a>03549 <span class="comment">! 0. Special code for experiments with mode filtering</span>
  3639. <a name="l03550"></a>03550
  3640. <a name="l03551"></a>03551 <span class="keyword">if</span> (lspecsel) call <a class="code" href="puma_8f90.html#a9a1e7493444984ad2c2161609dbb6e69">filter_spectral_modes</a>
  3641. <a name="l03552"></a>03552
  3642. <a name="l03553"></a>03553 <span class="comment">! 1. Initialize local arrays</span>
  3643. <a name="l03554"></a>03554
  3644. <a name="l03555"></a>03555 zpm(:) = spp(:)
  3645. <a name="l03556"></a>03556 zdm(:,:) = sdp(:,:)
  3646. <a name="l03557"></a>03557 zzm(:,:) = szp(:,:)
  3647. <a name="l03558"></a>03558 ztm(:,:) = stp(:,:)
  3648. <a name="l03559"></a>03559 <span class="comment">!</span>
  3649. <a name="l03560"></a>03560 <span class="comment">! allocate diagnostic arrays if needed</span>
  3650. <a name="l03561"></a>03561 <span class="comment">!</span>
  3651. <a name="l03562"></a>03562 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0) <span class="keyword">then</span>
  3652. <a name="l03563"></a>03563 <span class="keyword">allocate</span>(zstte(NSPP,NLEV,3))
  3653. <a name="l03564"></a>03564 <span class="keyword">endif</span>
  3654. <a name="l03565"></a>03565 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  3655. <a name="l03566"></a>03566 <span class="keyword">allocate</span>(zszte(NSPP,NLEV,2))
  3656. <a name="l03567"></a>03567 <span class="keyword">allocate</span>(zsdte(NSPP,NLEV,2))
  3657. <a name="l03568"></a>03568 <span class="keyword">endif</span>
  3658. <a name="l03569"></a>03569 <span class="comment">!</span>
  3659. <a name="l03570"></a>03570 <span class="comment">! allocate and compute surface pressure if needed</span>
  3660. <a name="l03571"></a>03571 <span class="comment">!</span>
  3661. <a name="l03572"></a>03572 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0 .or. ndheat &gt; 0) <span class="keyword">then</span>
  3662. <a name="l03573"></a>03573 <span class="keyword">allocate</span>(zspt(NSPP))
  3663. <a name="l03574"></a>03574 <span class="keyword">allocate</span>(zsp(NSPP))
  3664. <a name="l03575"></a>03575 <span class="keyword">endif</span>
  3665. <a name="l03576"></a>03576
  3666. <a name="l03577"></a>03577 <span class="comment">! 2. Calculate divergence on timelevel t (sdt) HS75 (17)</span>
  3667. <a name="l03578"></a>03578 <span class="comment">! which will replace the divergence tendency sdt</span>
  3668. <a name="l03579"></a>03579 <span class="comment">! (semi implicit scheme)</span>
  3669. <a name="l03580"></a>03580
  3670. <a name="l03581"></a>03581 <span class="comment">! The vertical scheme has being changed to the ECMWF scheme</span>
  3671. <a name="l03582"></a>03582 <span class="comment">! (see e.g. Simmons and Burridge 1981, Mon.Wea.Rev.,109,758-766).</span>
  3672. <a name="l03583"></a>03583 <span class="comment">! in this scheme, matrix xlphi (g) differs from that in HS75.</span>
  3673. <a name="l03584"></a>03584
  3674. <a name="l03585"></a>03585 <span class="comment">! z0 : reference temperature To</span>
  3675. <a name="l03586"></a>03586 <span class="comment">! zq : 1.0 / Cn</span>
  3676. <a name="l03587"></a>03587 <span class="comment">! zt : xlphi * script T - To * script P</span>
  3677. <a name="l03588"></a>03588 <span class="comment">! zm : xlphi * T + To * ln(Ps)(t-dt)</span>
  3678. <a name="l03589"></a>03589
  3679. <a name="l03590"></a>03590 <span class="comment">! (note that phi is needed in HS75 (17) and, therefore,</span>
  3680. <a name="l03591"></a>03591 <span class="comment">! the surface geopotential phi* [sop] is added</span>
  3681. <a name="l03592"></a>03592
  3682. <a name="l03593"></a>03593 <span class="keyword">do</span> jlev=1,NLEV
  3683. <a name="l03594"></a>03594 z0 = t0(jlev)
  3684. <a name="l03595"></a>03595 <span class="keyword">do</span> jsp=1,NSPP
  3685. <a name="l03596"></a>03596 zq = srcn(jsp) <span class="comment">! 1.0 / (n * (n + 1))</span>
  3686. <a name="l03597"></a>03597 zt = dot_product(xlphi(:,jlev),stt(jsp,:)) - z0 * spt(jsp)
  3687. <a name="l03598"></a>03598 zm = dot_product(xlphi(:,jlev),stm(jsp,:)) + z0 * spm(jsp)
  3688. <a name="l03599"></a>03599 za = sdt(jsp,jlev) * zq
  3689. <a name="l03600"></a>03600 zb = sdm(jsp,jlev) * zq
  3690. <a name="l03601"></a>03601 zgt(jsp,jlev) = zb + delt * (za + zm + sop(jsp) + zt * delt)
  3691. <a name="l03602"></a>03602 <span class="keyword">enddo</span>
  3692. <a name="l03603"></a>03603 <span class="keyword">enddo</span>
  3693. <a name="l03604"></a>03604
  3694. <a name="l03605"></a>03605 <span class="comment">! bm1 is the invers of matrix (1/cn I+B dt**2) (lhs HS75 (17))</span>
  3695. <a name="l03606"></a>03606
  3696. <a name="l03607"></a>03607 <span class="keyword">do</span> jlev = 1 , NLEV
  3697. <a name="l03608"></a>03608 <span class="keyword">do</span> jsp = 1 , NSPP
  3698. <a name="l03609"></a>03609 jn = nindex(jsp) <span class="comment">! total wavenumber n</span>
  3699. <a name="l03610"></a>03610 sdt(jsp,jlev) = dot_product(zgt(jsp,:),bm1(:,jlev,jn))
  3700. <a name="l03611"></a>03611 <span class="keyword">enddo</span>
  3701. <a name="l03612"></a>03612 <span class="keyword">enddo</span>
  3702. <a name="l03613"></a>03613
  3703. <a name="l03614"></a>03614 <span class="comment">! 3. Calculate surface pressure tendency -ln(ps) HS75 (15)</span>
  3704. <a name="l03615"></a>03615
  3705. <a name="l03616"></a>03616 <span class="keyword">do</span> jlev = 1 , NLEV
  3706. <a name="l03617"></a>03617 spt(:) = spt(:) + dsigma(jlev) * sdt(:,jlev)
  3707. <a name="l03618"></a>03618 <span class="keyword">enddo</span>
  3708. <a name="l03619"></a>03619
  3709. <a name="l03620"></a>03620 <span class="comment">! 4. Calculate temperature tendency HS75 (14)</span>
  3710. <a name="l03621"></a>03621
  3711. <a name="l03622"></a>03622 <span class="keyword">do</span> jlev = 1 , NLEV
  3712. <a name="l03623"></a>03623 <span class="keyword">do</span> jsp = 1 , NSPP
  3713. <a name="l03624"></a>03624 stt(jsp,jlev)=stt(jsp,jlev)-dot_product(xlt(:,jlev),sdt(jsp,:))
  3714. <a name="l03625"></a>03625 <span class="keyword">enddo</span>
  3715. <a name="l03626"></a>03626 <span class="keyword">enddo</span>
  3716. <a name="l03627"></a>03627
  3717. <a name="l03628"></a>03628 <span class="comment">! 5. Add tendencies</span>
  3718. <a name="l03629"></a>03629
  3719. <a name="l03630"></a>03630 spp(:) = spm(:) - delt2 * spt(:) <span class="comment">! spt = -ln(ps) tendency</span>
  3720. <a name="l03631"></a>03631 sdp(:,:) = 2.0 * sdt(:,:) - sdm(:,:) <span class="comment">! sdt = sdm + delt * tend.</span>
  3721. <a name="l03632"></a>03632 szp(:,:) = delt2 * szt(:,:) + szm(:,:) <span class="comment">! vorticity</span>
  3722. <a name="l03633"></a>03633 stp(:,:) = delt2 * stt(:,:) + stm(:,:) <span class="comment">! temperature</span>
  3723. <a name="l03634"></a>03634
  3724. <a name="l03635"></a>03635 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3725. <a name="l03636"></a>03636 zspt(:)=-spt(:)
  3726. <a name="l03637"></a>03637 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stm,stt,spm,zspt,denergy(:,1))
  3727. <a name="l03638"></a>03638 <span class="keyword">endif</span>
  3728. <a name="l03639"></a>03639 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  3729. <a name="l03640"></a>03640 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stm,stt,spm,dentropy(:,1))
  3730. <a name="l03641"></a>03641 <span class="keyword">endif</span>
  3731. <a name="l03642"></a>03642
  3732. <a name="l03643"></a>03643 <span class="comment">! 6. Calculate newtonian cooling, friction and biharmonic diffusion</span>
  3733. <a name="l03644"></a>03644 <span class="comment">! (srp - stp) * damp = (Tr&#39; -T&#39;) / tau R = newtonian cooling</span>
  3734. <a name="l03645"></a>03645 <span class="comment">! srp1 = annual mean component</span>
  3735. <a name="l03646"></a>03646 <span class="comment">! srp2 = annual cycle component</span>
  3736. <a name="l03647"></a>03647 <span class="comment">! sak = diffusion</span>
  3737. <a name="l03648"></a>03648 <span class="comment">! fric = friction</span>
  3738. <a name="l03649"></a>03649 <span class="comment">! zampl = annual cycle</span>
  3739. <a name="l03650"></a>03650
  3740. <a name="l03651"></a>03651 zampl = cos((<span class="keywordtype">real</span>(nstep)-pac)*tac)
  3741. <a name="l03652"></a>03652
  3742. <a name="l03653"></a>03653 <span class="keyword">if</span> (nhelsua == 0 .or. nhelsua == 1) <span class="keyword">then</span>
  3743. <a name="l03654"></a>03654 <span class="keyword">do</span> jlev=1,NLEV
  3744. <a name="l03655"></a>03655 zsrp(:)=srp1(:,jlev)+srp2(:,jlev)*zampl
  3745. <a name="l03656"></a>03656 sdt(:,jlev) = sdp(:,jlev) * (sak(1:NSPP) - fric(jlev))
  3746. <a name="l03657"></a>03657 szt(:,jlev) = szp(:,jlev) * (sak(1:NSPP) - fric(jlev))
  3747. <a name="l03658"></a>03658 stt(:,jlev) = (zsrp(:) - stp(:,jlev)) * damp(jlev) &amp;
  3748. <a name="l03659"></a>03659 &amp; + stp(:,jlev) * sak(1:NSPP)
  3749. <a name="l03660"></a>03660 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3750. <a name="l03661"></a>03661 zstte(:,jlev,2)=(zsrp(:)-stp(:,jlev))*damp(jlev)
  3751. <a name="l03662"></a>03662 zstte(:,jlev,3)=stp(:,jlev)*sak(1:NSPP)
  3752. <a name="l03663"></a>03663 <span class="keyword">endif</span>
  3753. <a name="l03664"></a>03664 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  3754. <a name="l03665"></a>03665 zsdte(:,jlev,1) = -sdp(:,jlev) * fric(jlev)
  3755. <a name="l03666"></a>03666 zszte(:,jlev,1) = -szp(:,jlev) * fric(jlev)
  3756. <a name="l03667"></a>03667 zsdte(:,jlev,2) = sdp(:,jlev) * sak(1:NSPP)
  3757. <a name="l03668"></a>03668 zszte(:,jlev,2) = szp(:,jlev) * sak(1:NSPP)
  3758. <a name="l03669"></a>03669 <span class="keyword">endif</span>
  3759. <a name="l03670"></a>03670 <span class="keyword">enddo</span>
  3760. <a name="l03671"></a>03671 elseif (nhelsua == 2 .or. nhelsua == 3 .or. ndiagp &gt; 0) <span class="keyword">then</span>
  3761. <a name="l03672"></a>03672 <span class="keyword">if</span> (ndiagp == 0) <span class="keyword">then</span>
  3762. <a name="l03673"></a>03673 call <a class="code" href="puma_8f90.html#a6cbd3f404dc5fbac334929a64cf2757f">heatgp</a>(zampl) <span class="comment">! stt(:,:) = Newtonian cooling</span>
  3763. <a name="l03674"></a>03674 <span class="keyword">else</span>
  3764. <a name="l03675"></a>03675 call <a class="code" href="puma_8f90.html#a28029d854398252d4d3b4eb9f161fed7">diagp</a>(zampl) <span class="comment">! stt(:,:) = Newtonian cooling</span>
  3765. <a name="l03676"></a>03676 <span class="keyword">endif</span>
  3766. <a name="l03677"></a>03677 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3767. <a name="l03678"></a>03678 zstte(:,:,2)=stt(:,:)
  3768. <a name="l03679"></a>03679 <span class="keyword">endif</span>
  3769. <a name="l03680"></a>03680 <span class="keyword">do</span> jlev=1,NLEV
  3770. <a name="l03681"></a>03681 sdt(:,jlev) = sdp(:,jlev) * (sak(1:NSPP) - fric(jlev))
  3771. <a name="l03682"></a>03682 szt(:,jlev) = szp(:,jlev) * (sak(1:NSPP) - fric(jlev))
  3772. <a name="l03683"></a>03683 stt(:,jlev) = stt(:,jlev) + stp(:,jlev) * sak(1:NSPP)
  3773. <a name="l03684"></a>03684 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3774. <a name="l03685"></a>03685 zstte(:,jlev,3)=stp(:,jlev)*sak(1:NSPP)
  3775. <a name="l03686"></a>03686 <span class="keyword">endif</span>
  3776. <a name="l03687"></a>03687 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  3777. <a name="l03688"></a>03688 zsdte(:,jlev,1) = -sdp(:,jlev) * fric(jlev)
  3778. <a name="l03689"></a>03689 zszte(:,jlev,1) = -szp(:,jlev) * fric(jlev)
  3779. <a name="l03690"></a>03690 zsdte(:,jlev,2) = sdp(:,jlev) * sak(1:NSPP)
  3780. <a name="l03691"></a>03691 zszte(:,jlev,2) = szp(:,jlev) * sak(1:NSPP)
  3781. <a name="l03692"></a>03692 <span class="keyword">endif</span>
  3782. <a name="l03693"></a>03693 <span class="keyword">enddo</span>
  3783. <a name="l03694"></a>03694 <span class="keyword">endif</span>
  3784. <a name="l03695"></a>03695
  3785. <a name="l03696"></a>03696 <span class="comment">! Conserve ln(ps) by forcing mode(0,0) to zero</span>
  3786. <a name="l03697"></a>03697 <span class="comment">! Correct vorticity by canceling the friction and diffusion</span>
  3787. <a name="l03698"></a>03698 <span class="comment">! applied to planetary vorticity</span>
  3788. <a name="l03699"></a>03699 <span class="comment">! Only root node processes the first NSPP modes</span>
  3789. <a name="l03700"></a>03700
  3790. <a name="l03701"></a>03701 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3791. <a name="l03702"></a>03702 zspt(:)=0.
  3792. <a name="l03703"></a>03703 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstte(:,:,2),spp,zspt,denergy(:,2))
  3793. <a name="l03704"></a>03704 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstte(:,:,3),spp,zspt,denergy(:,3))
  3794. <a name="l03705"></a>03705 <span class="keyword">endif</span>
  3795. <a name="l03706"></a>03706 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  3796. <a name="l03707"></a>03707 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstte(:,:,2),spp,dentropy(:,2))
  3797. <a name="l03708"></a>03708 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstte(:,:,3),spp,dentropy(:,3))
  3798. <a name="l03709"></a>03709 <span class="keyword">endif</span>
  3799. <a name="l03710"></a>03710 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0 .or. ndheat &gt; 0) <span class="keyword">then</span>
  3800. <a name="l03711"></a>03711 zsp(:)=spp(:)
  3801. <a name="l03712"></a>03712 zstte(:,:,1)=stt(:,:)
  3802. <a name="l03713"></a>03713 <span class="keyword">endif</span>
  3803. <a name="l03714"></a>03714
  3804. <a name="l03715"></a>03715 <span class="keyword">if</span> (mypid == NROOT) <span class="keyword">then</span>
  3805. <a name="l03716"></a>03716 spp(1) = 0.0
  3806. <a name="l03717"></a>03717 spp(2) = 0.0
  3807. <a name="l03718"></a>03718 szt(3,:) = szt(3,:) + plavor * (fric(:) - sak(3))
  3808. <a name="l03719"></a>03719 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  3809. <a name="l03720"></a>03720 zszte(3,:,1) = zszte(3,:,1) + plavor * fric(:)
  3810. <a name="l03721"></a>03721 zszte(3,:,2) = zszte(3,:,2) - plavor * sak(3)
  3811. <a name="l03722"></a>03722 <span class="keyword">endif</span>
  3812. <a name="l03723"></a>03723 <span class="keyword">endif</span>
  3813. <a name="l03724"></a>03724 <span class="comment">!</span>
  3814. <a name="l03725"></a>03725 <span class="comment">! 6b) call for vertical diffusion</span>
  3815. <a name="l03726"></a>03726 <span class="comment">!</span>
  3816. <a name="l03727"></a>03727
  3817. <a name="l03728"></a>03728 <span class="keyword">if</span>(dvdiff &gt; 0.) call <a class="code" href="puma_8f90.html#ad1bea0bb9fdda56c5251fa64e712b7b1">vdiff</a>(stp,szp,sdp,stt,szt,sdt)
  3818. <a name="l03729"></a>03729
  3819. <a name="l03730"></a>03730 <span class="comment">!</span>
  3820. <a name="l03731"></a>03731 <span class="comment">! recycle kin energy dissipation</span>
  3821. <a name="l03732"></a>03732 <span class="comment">! </span>
  3822. <a name="l03733"></a>03733
  3823. <a name="l03734"></a>03734 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  3824. <a name="l03735"></a>03735 call <a class="code" href="puma_8f90.html#a079a9ea6caa3eb9d5ef5e0c82f76a2b9">mkdheat</a>(zszte(:,:,1),zszte(:,:,2) &amp;
  3825. <a name="l03736"></a>03736 &amp; ,zsdte(:,:,1),zsdte(:,:,2),zsp)
  3826. <a name="l03737"></a>03737 <span class="keyword">endif</span>
  3827. <a name="l03738"></a>03738
  3828. <a name="l03739"></a>03739
  3829. <a name="l03740"></a>03740 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0) <span class="keyword">then</span>
  3830. <a name="l03741"></a>03741 zstte(:,:,1)=stt(:,:)-zstte(:,:,1)
  3831. <a name="l03742"></a>03742 <span class="keyword">endif</span>
  3832. <a name="l03743"></a>03743 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3833. <a name="l03744"></a>03744 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstte(:,:,1),zsp,zspt,denergy(:,4))
  3834. <a name="l03745"></a>03745 <span class="keyword">endif</span>
  3835. <a name="l03746"></a>03746 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  3836. <a name="l03747"></a>03747 zstte(:,:,1)=stt(:,:)-zstte(:,:,1)
  3837. <a name="l03748"></a>03748 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstte(:,:,1),zsp,dentropy(:,4))
  3838. <a name="l03749"></a>03749 <span class="keyword">endif</span>
  3839. <a name="l03750"></a>03750 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0) <span class="keyword">then</span>
  3840. <a name="l03751"></a>03751 zstte(:,:,1)=0.
  3841. <a name="l03752"></a>03752 zspt(:)=(spp(:)-zsp(:))/delt2
  3842. <a name="l03753"></a>03753 <span class="keyword">endif</span>
  3843. <a name="l03754"></a>03754 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3844. <a name="l03755"></a>03755 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstte(:,:,1),zsp,zspt,denergy(:,8))
  3845. <a name="l03756"></a>03756 <span class="keyword">endif</span>
  3846. <a name="l03757"></a>03757 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  3847. <a name="l03758"></a>03758 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstte(:,:,1),zsp,dentropy(:,8))
  3848. <a name="l03759"></a>03759 <span class="keyword">endif</span>
  3849. <a name="l03760"></a>03760
  3850. <a name="l03761"></a>03761 <span class="comment">!</span>
  3851. <a name="l03762"></a>03762 <span class="comment">! diagnostics of efficiency</span>
  3852. <a name="l03763"></a>03763 <span class="comment">!</span>
  3853. <a name="l03764"></a>03764
  3854. <a name="l03765"></a>03765 <span class="keyword">if</span>(ndheat &gt; 1) <span class="keyword">then</span>
  3855. <a name="l03766"></a>03766 zcp=gascon/akap
  3856. <a name="l03767"></a>03767 <span class="keyword">allocate</span>(zst(NESP,NLEV))
  3857. <a name="l03768"></a>03768 <span class="keyword">allocate</span>(zstt(NESP,NLEV))
  3858. <a name="l03769"></a>03769 <span class="keyword">allocate</span>(zspf(NESP))
  3859. <a name="l03770"></a>03770 <span class="keyword">allocate</span>(ztgp(NHOR,NLEV))
  3860. <a name="l03771"></a>03771 <span class="keyword">allocate</span>(zdtgp(NHOR,NLEV))
  3861. <a name="l03772"></a>03772 <span class="keyword">allocate</span>(zdps(NHOR))
  3862. <a name="l03773"></a>03773 <span class="keyword">allocate</span>(zsum1(4))
  3863. <a name="l03774"></a>03774 <span class="keyword">allocate</span>(zgw(NHOR))
  3864. <a name="l03775"></a>03775 jhor=0
  3865. <a name="l03776"></a>03776 <span class="keyword">do</span> jlat=1,NHPP
  3866. <a name="l03777"></a>03777 <span class="keyword">do</span> jlon=1,NLON*2
  3867. <a name="l03778"></a>03778 jhor=jhor+1
  3868. <a name="l03779"></a>03779 zgw(jhor)=gwd(jlat)
  3869. <a name="l03780"></a>03780 <span class="keyword">enddo</span>
  3870. <a name="l03781"></a>03781 <span class="keyword">enddo</span>
  3871. <a name="l03782"></a>03782 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zst,stp,NLEV)
  3872. <a name="l03783"></a>03783 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zstt,stt,NLEV)
  3873. <a name="l03784"></a>03784 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zspf,zsp,1)
  3874. <a name="l03785"></a>03785 <span class="keyword">do</span> jlev = 1 , NLEV
  3875. <a name="l03786"></a>03786 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zst(1,jlev),ztgp(1,jlev))
  3876. <a name="l03787"></a>03787 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zstt(1,jlev),zdtgp(1,jlev))
  3877. <a name="l03788"></a>03788 <span class="keyword">enddo</span>
  3878. <a name="l03789"></a>03789 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zspf,zdps)
  3879. <a name="l03790"></a>03790 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(ztgp,NLON,NLPP*NLEV)
  3880. <a name="l03791"></a>03791 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zdtgp,NLON,NLPP*NLEV)
  3881. <a name="l03792"></a>03792 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zdps,NLON,NLPP)
  3882. <a name="l03793"></a>03793 zdps(:)=psurf*exp(zdps(:))
  3883. <a name="l03794"></a>03794 zsum1(:)=0.
  3884. <a name="l03795"></a>03795 <span class="keyword">do</span> jlev=1,NLEV
  3885. <a name="l03796"></a>03796 ztgp(:,jlev)=ct*(ztgp(:,jlev)+t0(jlev))
  3886. <a name="l03797"></a>03797 zdtgp(:,jlev)=ct*ww*zdtgp(:,jlev)
  3887. <a name="l03798"></a>03798 zsum1(1)=zsum1(1)+SUM(zdtgp(:,jlev)*zgw(:) &amp;
  3888. <a name="l03799"></a>03799 &amp; *zcp*zdps(:)/ga*dsigma(jlev) &amp;
  3889. <a name="l03800"></a>03800 &amp; ,mask=(zdtgp(:,jlev) &gt;= 0.))
  3890. <a name="l03801"></a>03801 zsum1(2)=zsum1(2)+SUM(zdtgp(:,jlev)*zgw(:) &amp;
  3891. <a name="l03802"></a>03802 &amp; *zcp*zdps(:)/ga*dsigma(jlev) &amp;
  3892. <a name="l03803"></a>03803 &amp; ,mask=(zdtgp(:,jlev) &lt; 0.))
  3893. <a name="l03804"></a>03804 zsum1(3)=zsum1(3)+SUM(zdtgp(:,jlev)/ztgp(:,jlev)*zgw(:) &amp;
  3894. <a name="l03805"></a>03805 &amp; *zcp*zdps(:)/ga*dsigma(jlev) &amp;
  3895. <a name="l03806"></a>03806 &amp; ,mask=(zdtgp(:,jlev) &gt;= 0.))
  3896. <a name="l03807"></a>03807 zsum1(4)=zsum1(4)+SUM(zdtgp(:,jlev)/ztgp(:,jlev)*zgw(:) &amp;
  3897. <a name="l03808"></a>03808 &amp; *zcp*zdps(:)/ga*dsigma(jlev) &amp;
  3898. <a name="l03809"></a>03809 &amp; ,mask=(zdtgp(:,jlev) &lt; 0.))
  3899. <a name="l03810"></a>03810 <span class="keyword">enddo</span>
  3900. <a name="l03811"></a>03811 zsum3=SUM(zgw(:))
  3901. <a name="l03812"></a>03812 call <a class="code" href="mpimod_8f90.html#ad703e6ecd123e9b8280322e402d57d20">mpsumbcr</a>(zsum1,4)
  3902. <a name="l03813"></a>03813 call <a class="code" href="mpimod_8f90.html#ad703e6ecd123e9b8280322e402d57d20">mpsumbcr</a>(zsum3,1)
  3903. <a name="l03814"></a>03814 zsum1(:)=zsum1(:)/zsum3
  3904. <a name="l03815"></a>03815 <span class="keyword">if</span>(mypid == NROOT) <span class="keyword">then</span>
  3905. <a name="l03816"></a>03816 ztp=zsum1(1)/zsum1(3)
  3906. <a name="l03817"></a>03817 zztm=zsum1(2)/zsum1(4)
  3907. <a name="l03818"></a>03818 <span class="keyword">write</span>(9,*) zsum1(:),zsum1(1)/zsum1(3),zsum1(2)/zsum1(4) &amp;
  3908. <a name="l03819"></a>03819 &amp; ,(ztp-zztm)/ztp
  3909. <a name="l03820"></a>03820 <span class="keyword">endif</span>
  3910. <a name="l03821"></a>03821 <span class="keyword">deallocate</span>(zst)
  3911. <a name="l03822"></a>03822 <span class="keyword">deallocate</span>(zstt)
  3912. <a name="l03823"></a>03823 <span class="keyword">deallocate</span>(zspf)
  3913. <a name="l03824"></a>03824 <span class="keyword">deallocate</span>(ztgp)
  3914. <a name="l03825"></a>03825 <span class="keyword">deallocate</span>(zdps)
  3915. <a name="l03826"></a>03826 <span class="keyword">deallocate</span>(zdtgp)
  3916. <a name="l03827"></a>03827 <span class="keyword">deallocate</span>(zsum1)
  3917. <a name="l03828"></a>03828 <span class="keyword">deallocate</span>(zgw)
  3918. <a name="l03829"></a>03829 <span class="keyword">endif</span>
  3919. <a name="l03830"></a>03830
  3920. <a name="l03831"></a>03831 <span class="comment">! 7. Add newtonian cooling, friction and diffusion tendencies</span>
  3921. <a name="l03832"></a>03832
  3922. <a name="l03833"></a>03833 sdp(:,:) = sdp(:,:) + delt2 * sdt(:,:)
  3923. <a name="l03834"></a>03834 szp(:,:) = szp(:,:) + delt2 * szt(:,:)
  3924. <a name="l03835"></a>03835 stp(:,:) = stp(:,:) + delt2 * stt(:,:)
  3925. <a name="l03836"></a>03836
  3926. <a name="l03837"></a>03837 <span class="comment">! 11. Coupling for synchronization runs</span>
  3927. <a name="l03838"></a>03838
  3928. <a name="l03839"></a>03839 <span class="keyword">if</span> (mrnum == 2 .and. nsync &gt; 0) <span class="keyword">then</span>
  3929. <a name="l03840"></a>03840 call <a class="code" href="mpimod_8f90.html#af3212261e3ce775f26d09859c337b760">mrdiff</a>(stp,std,NESP,NLEV)
  3930. <a name="l03841"></a>03841 call <a class="code" href="mpimod_8f90.html#af3212261e3ce775f26d09859c337b760">mrdiff</a>(sdp,sdd,NESP,NLEV)
  3931. <a name="l03842"></a>03842 call <a class="code" href="mpimod_8f90.html#af3212261e3ce775f26d09859c337b760">mrdiff</a>(szp,szd,NESP,NLEV)
  3932. <a name="l03843"></a>03843 call <a class="code" href="mpimod_8f90.html#af3212261e3ce775f26d09859c337b760">mrdiff</a>(spp,spd,NESP, 1)
  3933. <a name="l03844"></a>03844 stp(:,:) = stp(:,:) + syncstr * std(:,:)
  3934. <a name="l03845"></a>03845 sdp(:,:) = sdp(:,:) + syncstr * sdd(:,:)
  3935. <a name="l03846"></a>03846 szp(:,:) = szp(:,:) + syncstr * szd(:,:)
  3936. <a name="l03847"></a>03847 spp(: ) = spp(: ) + syncstr * spd(: )
  3937. <a name="l03848"></a>03848
  3938. <a name="l03849"></a>03849 <span class="keyword">endif</span>
  3939. <a name="l03850"></a>03850
  3940. <a name="l03851"></a>03851 <span class="comment">! 8. Apply Robert Asselin time filter (not for short initial timesteps)</span>
  3941. <a name="l03852"></a>03852 <span class="comment">! d(t) = pnu * f(t-1) + pnu * f(t+1) - 2 * pnu * f(t)</span>
  3942. <a name="l03853"></a>03853
  3943. <a name="l03854"></a>03854 <span class="keyword">if</span> (nkits == 0) <span class="keyword">then</span>
  3944. <a name="l03855"></a>03855 zwp(:) = pnu * (spm(:) + spp(:) - 2.0 * zpm(:) )
  3945. <a name="l03856"></a>03856 zwd(:,:) = pnu * (sdm(:,:) + sdp(:,:) - 2.0 * zdm(:,:))
  3946. <a name="l03857"></a>03857 zwz(:,:) = pnu * (szm(:,:) + szp(:,:) - 2.0 * zzm(:,:))
  3947. <a name="l03858"></a>03858 zwt(:,:) = pnu * (stm(:,:) + stp(:,:) - 2.0 * ztm(:,:))
  3948. <a name="l03859"></a>03859
  3949. <a name="l03860"></a>03860 <span class="comment">! Add Robert-Asselin-Williams filter value to f(t)</span>
  3950. <a name="l03861"></a>03861
  3951. <a name="l03862"></a>03862 spm(:) = zpm(:) + alpha * zwp(:)
  3952. <a name="l03863"></a>03863 sdm(:,:) = zdm(:,:) + alpha * zwd(:,:)
  3953. <a name="l03864"></a>03864 szm(:,:) = zzm(:,:) + alpha * zwz(:,:)
  3954. <a name="l03865"></a>03865 stm(:,:) = ztm(:,:) + alpha * zwt(:,:)
  3955. <a name="l03866"></a>03866
  3956. <a name="l03867"></a>03867 <span class="comment">! Add filter value to f(t+1)</span>
  3957. <a name="l03868"></a>03868
  3958. <a name="l03869"></a>03869 spp(:) = spp(:) - (1.0 - alpha) * zwp(:)
  3959. <a name="l03870"></a>03870 sdp(:,:) = sdp(:,:) - (1.0 - alpha) * zwd(:,:)
  3960. <a name="l03871"></a>03871 szp(:,:) = szp(:,:) - (1.0 - alpha) * zwz(:,:)
  3961. <a name="l03872"></a>03872 stp(:,:) = stp(:,:) - (1.0 - alpha) * zwt(:,:)
  3962. <a name="l03873"></a>03873 <span class="keyword">endif</span>
  3963. <a name="l03874"></a>03874
  3964. <a name="l03875"></a>03875 <span class="keyword">if</span> (nenergy &gt; 0 .or. nentropy &gt; 0) <span class="keyword">then</span>
  3965. <a name="l03876"></a>03876 zstte(:,:,1)=(stm(:,:)-ztm(:,:))/delt2
  3966. <a name="l03877"></a>03877 zspt(:)=(spm(:)-zpm(:))/delt2
  3967. <a name="l03878"></a>03878 <span class="keyword">endif</span>
  3968. <a name="l03879"></a>03879 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  3969. <a name="l03880"></a>03880 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(ztm,zstte(:,:,1),zpm,zspt,denergy(:,9))
  3970. <a name="l03881"></a>03881 <span class="keyword">endif</span>
  3971. <a name="l03882"></a>03882 <span class="keyword">if</span> (nentropy &gt; 0) <span class="keyword">then</span>
  3972. <a name="l03883"></a>03883 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(ztm,zstte(:,:,1),zpm,dentropy(:,9))
  3973. <a name="l03884"></a>03884 <span class="keyword">endif</span>
  3974. <a name="l03885"></a>03885
  3975. <a name="l03886"></a>03886 <span class="comment">! 9. Save spectral arrays for extended output</span>
  3976. <a name="l03887"></a>03887
  3977. <a name="l03888"></a>03888 <span class="keyword">if</span> (nextout == 1 .and. mypid == NROOT) <span class="keyword">then</span>
  3978. <a name="l03889"></a>03889 <span class="keyword">if</span> (mod(nstep,nafter) == nafter - 2) <span class="keyword">then</span>
  3979. <a name="l03890"></a>03890 <span class="keyword">if</span> (.not. <span class="keyword">allocated</span>(st2)) <span class="keyword">allocate</span>(st2(nesp,nlev))
  3980. <a name="l03891"></a>03891 st2(:,:) = st(:,:)
  3981. <a name="l03892"></a>03892 <span class="keyword">if</span> (.not. <span class="keyword">allocated</span>(sp2)) <span class="keyword">allocate</span>(sp2(nesp))
  3982. <a name="l03893"></a>03893 sp2(:) = sp(:)
  3983. <a name="l03894"></a>03894 <span class="keyword">endif</span>
  3984. <a name="l03895"></a>03895 <span class="keyword">if</span> (mod(nstep,nafter) == nafter - 1) <span class="keyword">then</span>
  3985. <a name="l03896"></a>03896 <span class="keyword">if</span> (.not. <span class="keyword">allocated</span>(st1)) <span class="keyword">allocate</span>(st1(nesp,nlev))
  3986. <a name="l03897"></a>03897 st1(:,:) = st(:,:)
  3987. <a name="l03898"></a>03898 <span class="keyword">if</span> (.not. <span class="keyword">allocated</span>(sp1)) <span class="keyword">allocate</span>(sp1(nesp))
  3988. <a name="l03899"></a>03899 sp1(:) = sp(:)
  3989. <a name="l03900"></a>03900 <span class="keyword">endif</span>
  3990. <a name="l03901"></a>03901 <span class="keyword">endif</span>
  3991. <a name="l03902"></a>03902
  3992. <a name="l03903"></a>03903 <span class="comment">! 10. Gather spectral modes from all processes</span>
  3993. <a name="l03904"></a>03904
  3994. <a name="l03905"></a>03905 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(sp,spp, 1)
  3995. <a name="l03906"></a>03906 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(sd,sdp,NLEV)
  3996. <a name="l03907"></a>03907 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(sz,szp,NLEV)
  3997. <a name="l03908"></a>03908 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(st,stp,NLEV)
  3998. <a name="l03909"></a>03909
  3999. <a name="l03910"></a>03910 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0) <span class="keyword">then</span>
  4000. <a name="l03911"></a>03911 <span class="keyword">deallocate</span>(zstte)
  4001. <a name="l03912"></a>03912 <span class="keyword">endif</span>
  4002. <a name="l03913"></a>03913 <span class="keyword">if</span>(ndheat &gt; 0) <span class="keyword">then</span>
  4003. <a name="l03914"></a>03914 <span class="keyword">deallocate</span>(zszte)
  4004. <a name="l03915"></a>03915 <span class="keyword">deallocate</span>(zsdte)
  4005. <a name="l03916"></a>03916 <span class="keyword">endif</span>
  4006. <a name="l03917"></a>03917 <span class="keyword">if</span>(nenergy &gt; 0 .or. nentropy &gt; 0 .or. ndheat &gt; 0) <span class="keyword">then</span>
  4007. <a name="l03918"></a>03918 <span class="keyword">deallocate</span>(zsp)
  4008. <a name="l03919"></a>03919 <span class="keyword">deallocate</span>(zspt)
  4009. <a name="l03920"></a>03920 <span class="keyword">endif</span>
  4010. <a name="l03921"></a>03921
  4011. <a name="l03922"></a>03922 return
  4012. <a name="l03923"></a>03923 <span class="keyword"> end</span>
  4013. <a name="l03924"></a>03924
  4014. <a name="l03925"></a><a class="code" href="puma_8f90.html#a1ad2c0878e366bb7f12ca880fd36c654">03925</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a1ad2c0878e366bb7f12ca880fd36c654">mrcheck</a>(f)
  4015. <a name="l03926"></a>03926 use <span class="keywordflow">pumamod</span>
  4016. <a name="l03927"></a>03927 <span class="keywordtype">real</span> :: f(*)
  4017. <a name="l03928"></a>03928 <span class="keyword">write</span> (nud,<span class="stringliteral">&#39;(/,i3,8f8.4)&#39;</span>) 0,f(1:16:2)
  4018. <a name="l03929"></a>03929 <span class="keyword">write</span> (nud,<span class="stringliteral">&#39;( i3,8f8.4)&#39;</span>) 8,f(17:32:2)
  4019. <a name="l03930"></a>03930 <span class="keyword">write</span> (nud,<span class="stringliteral">&#39;( i3,8f8.4)&#39;</span>) 16,f(33:48:2)
  4020. <a name="l03931"></a>03931 <span class="keyword">write</span> (nud,<span class="stringliteral">&#39;( i3,8f8.4)&#39;</span>) 24,f(49:64:2)
  4021. <a name="l03932"></a>03932 <span class="keyword">write</span> (nud,<span class="stringliteral">&#39;( i3,8f8.4)&#39;</span>) 32,f(65:80:2)
  4022. <a name="l03933"></a>03933 return
  4023. <a name="l03934"></a>03934 <span class="keyword"> end </span>
  4024. <a name="l03935"></a>03935
  4025. <a name="l03936"></a>03936
  4026. <a name="l03937"></a>03937 <span class="comment">! ================</span>
  4027. <a name="l03938"></a>03938 <span class="comment">! SUBROUTINE DIAGP</span>
  4028. <a name="l03939"></a>03939 <span class="comment">! ================</span>
  4029. <a name="l03940"></a>03940
  4030. <a name="l03941"></a><a class="code" href="puma_8f90.html#a28029d854398252d4d3b4eb9f161fed7">03941</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a28029d854398252d4d3b4eb9f161fed7">diagp</a>(zampl)
  4031. <a name="l03942"></a>03942 use <span class="keywordflow">pumamod</span>
  4032. <a name="l03943"></a>03943
  4033. <a name="l03944"></a>03944 <span class="keywordtype">real</span> :: zstf(NESP,NLEV)
  4034. <a name="l03945"></a>03945 <span class="keywordtype">real</span> :: zgr12(NHOR,NLEV)
  4035. <a name="l03946"></a>03946 <span class="keywordtype">real</span> :: zgtt(NHOR,NLEV)
  4036. <a name="l03947"></a>03947 <span class="keywordtype">real</span> :: gr12(NHOR,NLEV)
  4037. <a name="l03948"></a>03948 <span class="keywordtype">real</span> :: gr12c(NHOR,NLEV)
  4038. <a name="l03949"></a>03949
  4039. <a name="l03950"></a>03950
  4040. <a name="l03951"></a>03951 <span class="keywordtype">real</span> :: gdtmp(NHOR)
  4041. <a name="l03952"></a>03952
  4042. <a name="l03953"></a>03953 <span class="keywordtype">real</span> :: zampl
  4043. <a name="l03954"></a>03954
  4044. <a name="l03955"></a>03955 <span class="comment">!--- transform temperature and divergence to grid point space</span>
  4045. <a name="l03956"></a>03956 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(st,stp,NLEV)
  4046. <a name="l03957"></a>03957 <span class="keyword">if</span> (nconv &gt; 0) <span class="keyword">then</span>
  4047. <a name="l03958"></a>03958 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(sd,sdp,NLEV)
  4048. <a name="l03959"></a>03959 <span class="keyword">endif</span>
  4049. <a name="l03960"></a>03960 <span class="keyword">do</span> jlev=1,NLEV
  4050. <a name="l03961"></a>03961 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(st(1,jlev) ,gt(1,jlev) )
  4051. <a name="l03962"></a>03962 <span class="keyword">if</span> (nconv &gt; 0) <span class="keyword">then</span>
  4052. <a name="l03963"></a>03963 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(sd(1,jlev) ,gd(1,jlev) )
  4053. <a name="l03964"></a>03964 <span class="keyword">endif</span>
  4054. <a name="l03965"></a>03965 <span class="keyword">enddo</span>
  4055. <a name="l03966"></a>03966 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gt ,NLON,NLPP*NLEV)
  4056. <a name="l03967"></a>03967 <span class="keyword">if</span> (nconv &gt; 0) <span class="keyword">then</span>
  4057. <a name="l03968"></a>03968 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gd ,NLON,NLPP*NLEV)
  4058. <a name="l03969"></a>03969 <span class="keyword">endif</span>
  4059. <a name="l03970"></a>03970
  4060. <a name="l03971"></a>03971
  4061. <a name="l03972"></a>03972 <span class="comment">!--- radiative temperature tendencies </span>
  4062. <a name="l03973"></a>03973 gr12(:,:) = gr1(:,:) + gr2(:,:)*zampl
  4063. <a name="l03974"></a>03974 zgtt(:,:) = (gr12(:,:) - gt(:,:))*gtdamp(:,:)
  4064. <a name="l03975"></a>03975
  4065. <a name="l03976"></a>03976 <span class="comment">!--- add convective temperature tendencies</span>
  4066. <a name="l03977"></a>03977 <span class="keyword">if</span> (nconv &gt; 0) <span class="keyword">then</span>
  4067. <a name="l03978"></a>03978 gdtmp(:) = gd(:,nlev)
  4068. <a name="l03979"></a>03979 <span class="keyword">do</span> jlev = 1,nlev
  4069. <a name="l03980"></a>03980 <span class="keyword">where</span> (gdtmp &lt; 0.0)
  4070. <a name="l03981"></a>03981 gr12c(:,jlev) = gr1c(:,jlev) + gr2c(:,jlev)*zampl
  4071. <a name="l03982"></a>03982 zgtt(:,jlev) = zgtt(:,jlev) + (gr12c(:,jlev) - gt(:,jlev))*gtdampc(:,jlev)
  4072. <a name="l03983"></a>03983 endwhere
  4073. <a name="l03984"></a>03984 <span class="keyword">enddo</span>
  4074. <a name="l03985"></a>03985 <span class="keyword">endif</span>
  4075. <a name="l03986"></a>03986
  4076. <a name="l03987"></a>03987 <span class="comment">!--- transform temperature tendencies to spectral space</span>
  4077. <a name="l03988"></a>03988 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zgtt ,NLON,NLPP*NLEV)
  4078. <a name="l03989"></a>03989 <span class="keyword">do</span> jlev=1,NLEV
  4079. <a name="l03990"></a>03990 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zgtt(1,jlev),zstf(1,jlev))
  4080. <a name="l03991"></a>03991 <span class="keyword">enddo</span>
  4081. <a name="l03992"></a>03992 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zstf,stt,NLEV)
  4082. <a name="l03993"></a>03993
  4083. <a name="l03994"></a>03994 return
  4084. <a name="l03995"></a>03995 <span class="keyword"> end subroutine diagp</span>
  4085. <a name="l03996"></a>03996
  4086. <a name="l03997"></a>03997 <span class="comment">! =================</span>
  4087. <a name="l03998"></a>03998 <span class="comment">! SUBROUTINE HEATGP</span>
  4088. <a name="l03999"></a>03999 <span class="comment">! =================</span>
  4089. <a name="l04000"></a>04000
  4090. <a name="l04001"></a><a class="code" href="puma_8f90.html#a6cbd3f404dc5fbac334929a64cf2757f">04001</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a6cbd3f404dc5fbac334929a64cf2757f">heatgp</a>(zampl)
  4091. <a name="l04002"></a>04002 use <span class="keywordflow">pumamod</span>
  4092. <a name="l04003"></a>04003
  4093. <a name="l04004"></a>04004 <span class="keywordtype">real</span> :: zsr12(NESP,NLEV)
  4094. <a name="l04005"></a>04005 <span class="keywordtype">real</span> :: zsrp12(NSPP,NLEV)
  4095. <a name="l04006"></a>04006 <span class="keywordtype">real</span> :: zstf(NESP,NLEV)
  4096. <a name="l04007"></a>04007 <span class="keywordtype">real</span> :: zgr12(NHOR,NLEV)
  4097. <a name="l04008"></a>04008 <span class="keywordtype">real</span> :: zgtt(NHOR,NLEV)
  4098. <a name="l04009"></a>04009
  4099. <a name="l04010"></a>04010 <span class="keywordtype">real</span> :: zampl
  4100. <a name="l04011"></a>04011
  4101. <a name="l04012"></a>04012 zsrp12(:,:)=srp1(:,:)+srp2(:,:)*zampl
  4102. <a name="l04013"></a>04013 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsr12,zsrp12,NLEV)
  4103. <a name="l04014"></a>04014 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(st,stp,NLEV)
  4104. <a name="l04015"></a>04015 <span class="keyword">do</span> jlev=1,NLEV
  4105. <a name="l04016"></a>04016 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsr12(1,jlev),zgr12(1,jlev))
  4106. <a name="l04017"></a>04017 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(st(1,jlev) ,gt(1,jlev) )
  4107. <a name="l04018"></a>04018 <span class="keyword">enddo</span>
  4108. <a name="l04019"></a>04019 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgr12,NLON,NLPP*NLEV)
  4109. <a name="l04020"></a>04020 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(gt ,NLON,NLPP*NLEV)
  4110. <a name="l04021"></a>04021
  4111. <a name="l04022"></a>04022 <span class="comment">! Newtonian cooling</span>
  4112. <a name="l04023"></a>04023
  4113. <a name="l04024"></a>04024 zgtt(:,:) = (zgr12(:,:) - gt(:,:)) * gtdamp(:,:)
  4114. <a name="l04025"></a>04025
  4115. <a name="l04026"></a>04026 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zgtt ,NLON,NLPP*NLEV)
  4116. <a name="l04027"></a>04027 <span class="keyword">do</span> jlev=1,NLEV
  4117. <a name="l04028"></a>04028 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zgtt(1,jlev),zstf(1,jlev))
  4118. <a name="l04029"></a>04029 <span class="keyword">enddo</span>
  4119. <a name="l04030"></a>04030 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zstf,stt,NLEV)
  4120. <a name="l04031"></a>04031
  4121. <a name="l04032"></a>04032 return
  4122. <a name="l04033"></a>04033 <span class="keyword"> end</span>
  4123. <a name="l04034"></a>04034
  4124. <a name="l04035"></a>04035 <span class="comment">! ================</span>
  4125. <a name="l04036"></a>04036 <span class="comment">! SUBROUTINE VDIFF</span>
  4126. <a name="l04037"></a>04037 <span class="comment">! ================</span>
  4127. <a name="l04038"></a>04038
  4128. <a name="l04039"></a><a class="code" href="puma_8f90.html#ad1bea0bb9fdda56c5251fa64e712b7b1">04039</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#ad1bea0bb9fdda56c5251fa64e712b7b1">vdiff</a>(pt,pz,pd,ptt,pzt,pdt)
  4129. <a name="l04040"></a>04040 use <span class="keywordflow">pumamod</span>
  4130. <a name="l04041"></a>04041 <span class="comment">!</span>
  4131. <a name="l04042"></a>04042 parameter(ztref=250.)
  4132. <a name="l04043"></a>04043 <span class="keywordtype">real</span> pt(NSPP,NLEV),pz(NSPP,NLEV),pd(NSPP,NLEV)
  4133. <a name="l04044"></a>04044 <span class="keywordtype">real</span> ptt(NSPP,NLEV),pzt(NSPP,NLEV),pdt(NSPP,NLEV)
  4134. <a name="l04045"></a>04045 <span class="keywordtype">real</span> ztn(NSPP,NLEV),zzn(NSPP,NLEV),zdn(NSPP,NLEV)
  4135. <a name="l04046"></a>04046 <span class="keywordtype">real</span> zebs(NLEM)
  4136. <a name="l04047"></a>04047 <span class="keywordtype">real</span> zskap(NLEV),zskaph(NLEV)
  4137. <a name="l04048"></a>04048 <span class="keywordtype">real</span> zkdiff(NLEM)
  4138. <a name="l04049"></a>04049 <span class="comment">!</span>
  4139. <a name="l04050"></a>04050 zdelt=delt2/ww
  4140. <a name="l04051"></a>04051 zkonst1=ga*zdelt/gascon
  4141. <a name="l04052"></a>04052 zkonst2=zkonst1*ga/gascon
  4142. <a name="l04053"></a>04053 <span class="comment">!</span>
  4143. <a name="l04054"></a>04054 zskap(:)=sigma(:)**akap
  4144. <a name="l04055"></a>04055 zskaph(:)=sigmh(:)**akap
  4145. <a name="l04056"></a>04056 <span class="comment">!</span>
  4146. <a name="l04057"></a>04057 <span class="comment">! 1) modified diffusion coefficents</span>
  4147. <a name="l04058"></a>04058 <span class="comment">!</span>
  4148. <a name="l04059"></a>04059 <span class="keyword">do</span> jlev=1,NLEM
  4149. <a name="l04060"></a>04060 jlp=jlev+1
  4150. <a name="l04061"></a>04061 zkdiff(jlev)=zkonst2*sigmh(jlev)*sigmh(jlev)/(ztref*ztref) &amp;
  4151. <a name="l04062"></a>04062 &amp; *dvdiff/(sigma(jlp)-sigma(jlev))
  4152. <a name="l04063"></a>04063 <span class="keyword">enddo</span>
  4153. <a name="l04064"></a>04064 <span class="comment">!</span>
  4154. <a name="l04065"></a>04065 <span class="comment">! 2. semi implicit scheme</span>
  4155. <a name="l04066"></a>04066 <span class="comment">!</span>
  4156. <a name="l04067"></a>04067 <span class="comment">! 2a momentum</span>
  4157. <a name="l04068"></a>04068 <span class="comment">!</span>
  4158. <a name="l04069"></a>04069 <span class="comment">! top layer elimination</span>
  4159. <a name="l04070"></a>04070 <span class="comment">!</span>
  4160. <a name="l04071"></a>04071 zebs(1)=zkdiff(1)/(dsigma(1)+zkdiff(1))
  4161. <a name="l04072"></a>04072 zdn(:,1)=dsigma(1)*pd(:,1)/(dsigma(1)+zkdiff(1))
  4162. <a name="l04073"></a>04073 zzn(:,1)=dsigma(1)*pz(:,1)/(dsigma(1)+zkdiff(1))
  4163. <a name="l04074"></a>04074 <span class="comment">!</span>
  4164. <a name="l04075"></a>04075 <span class="comment">! middle layer elimination</span>
  4165. <a name="l04076"></a>04076 <span class="comment">!</span>
  4166. <a name="l04077"></a>04077 <span class="keyword">do</span> jlev=2,NLEM
  4167. <a name="l04078"></a>04078 jlem=jlev-1
  4168. <a name="l04079"></a>04079 zebs(jlev)=zkdiff(jlev)/(dsigma(jlev)+zkdiff(jlev) &amp;
  4169. <a name="l04080"></a>04080 &amp; +zkdiff(jlem)*(1.-zebs(jlem)))
  4170. <a name="l04081"></a>04081 zdn(:,jlev)=(pd(:,jlev)*dsigma(jlev)+zkdiff(jlem)*zdn(:,jlem)) &amp;
  4171. <a name="l04082"></a>04082 &amp; /(dsigma(jlev)+zkdiff(jlev) &amp;
  4172. <a name="l04083"></a>04083 &amp; +zkdiff(jlem)*(1.-zebs(jlem)))
  4173. <a name="l04084"></a>04084 zzn(:,jlev)=(pz(:,jlev)*dsigma(jlev)+zkdiff(jlem)*zzn(:,jlem)) &amp;
  4174. <a name="l04085"></a>04085 &amp; /(dsigma(jlev)+zkdiff(jlev) &amp;
  4175. <a name="l04086"></a>04086 &amp; +zkdiff(jlem)*(1.-zebs(jlem)))
  4176. <a name="l04087"></a>04087 <span class="keyword">enddo</span>
  4177. <a name="l04088"></a>04088 <span class="comment">!</span>
  4178. <a name="l04089"></a>04089 <span class="comment">! bottom layer elimination</span>
  4179. <a name="l04090"></a>04090 <span class="comment">!</span>
  4180. <a name="l04091"></a>04091 zdn(:,NLEV)=(pd(:,NLEV)*dsigma(NLEV)+zkdiff(NLEM)*zdn(:,NLEM)) &amp;
  4181. <a name="l04092"></a>04092 &amp; /(dsigma(NLEV)+zkdiff(NLEM)*(1.-zebs(NLEM)))
  4182. <a name="l04093"></a>04093 zzn(:,NLEV)=(pz(:,NLEV)*dsigma(NLEV)+zkdiff(NLEM)*zzn(:,NLEM)) &amp;
  4183. <a name="l04094"></a>04094 &amp; /(dsigma(NLEV)+zkdiff(NLEM)*(1.-zebs(NLEM)))
  4184. <a name="l04095"></a>04095 <span class="comment">!</span>
  4185. <a name="l04096"></a>04096 <span class="comment">! back-substitution</span>
  4186. <a name="l04097"></a>04097 <span class="comment">!</span>
  4187. <a name="l04098"></a>04098 <span class="keyword">do</span> jlev=NLEM,1,-1
  4188. <a name="l04099"></a>04099 jlep=jlev+1
  4189. <a name="l04100"></a>04100 zdn(:,jlev)=zdn(:,jlev)+zebs(jlev)*zdn(:,jlep)
  4190. <a name="l04101"></a>04101 zzn(:,jlev)=zzn(:,jlev)+zebs(jlev)*zzn(:,jlep)
  4191. <a name="l04102"></a>04102 <span class="keyword">enddo</span>
  4192. <a name="l04103"></a>04103 <span class="comment">!</span>
  4193. <a name="l04104"></a>04104 <span class="comment">! tendencies</span>
  4194. <a name="l04105"></a>04105 <span class="comment">!</span>
  4195. <a name="l04106"></a>04106 pdt(:,1:NLEV)=pdt(:,1:NLEV)+(zdn(:,1:NLEV)-pd(:,1:NLEV))/delt2
  4196. <a name="l04107"></a>04107 pzt(:,1:NLEV)=pzt(:,1:NLEV)+(zzn(:,1:NLEV)-pz(:,1:NLEV))/delt2
  4197. <a name="l04108"></a>04108 <span class="comment">!</span>
  4198. <a name="l04109"></a>04109 <span class="comment">! 2c potential temperature</span>
  4199. <a name="l04110"></a>04110 <span class="comment">!</span>
  4200. <a name="l04111"></a>04111 <span class="keyword">do</span> jlev=1,NLEM
  4201. <a name="l04112"></a>04112 zkdiff(jlev)=zkdiff(jlev)*zskaph(jlev)
  4202. <a name="l04113"></a>04113 <span class="keyword">enddo</span>
  4203. <a name="l04114"></a>04114 <span class="comment">!</span>
  4204. <a name="l04115"></a>04115 <span class="comment">! semi implicit scheme</span>
  4205. <a name="l04116"></a>04116 <span class="comment">!</span>
  4206. <a name="l04117"></a>04117 <span class="comment">! top layer elimination</span>
  4207. <a name="l04118"></a>04118 <span class="comment">!</span>
  4208. <a name="l04119"></a>04119 zebs(1)=zkdiff(1)/(dsigma(1)+zkdiff(1)/zskap(1))
  4209. <a name="l04120"></a>04120 ztn(:,1)=dsigma(1)*pt(:,1)/(dsigma(1)+zkdiff(1)/zskap(1))
  4210. <a name="l04121"></a>04121 <span class="comment">!</span>
  4211. <a name="l04122"></a>04122 <span class="comment">! middle layer elimination</span>
  4212. <a name="l04123"></a>04123 <span class="comment">!</span>
  4213. <a name="l04124"></a>04124 <span class="keyword">do</span> jlev=2,NLEM
  4214. <a name="l04125"></a>04125 jlem=jlev-1
  4215. <a name="l04126"></a>04126 zebs(jlev)=zkdiff(jlev)/(dsigma(jlev)+(zkdiff(jlev) &amp;
  4216. <a name="l04127"></a>04127 &amp; +zkdiff(jlem)*(1.-zebs(jlem)/zskap(jlem)))/zskap(jlev))
  4217. <a name="l04128"></a>04128 ztn(:,jlev)=(pt(:,jlev)*dsigma(jlev) &amp;
  4218. <a name="l04129"></a>04129 &amp; +zkdiff(jlem)/zskap(jlem)*ztn(:,jlem)) &amp;
  4219. <a name="l04130"></a>04130 &amp; /(dsigma(jlev)+(zkdiff(jlev) &amp;
  4220. <a name="l04131"></a>04131 &amp; +zkdiff(jlem)*(1.-zebs(jlem)/zskap(jlem))) &amp;
  4221. <a name="l04132"></a>04132 &amp; /zskap(jlev))
  4222. <a name="l04133"></a>04133 <span class="keyword">enddo</span>
  4223. <a name="l04134"></a>04134 <span class="comment">!</span>
  4224. <a name="l04135"></a>04135 <span class="comment">! bottom layer elimination</span>
  4225. <a name="l04136"></a>04136 <span class="comment">!</span>
  4226. <a name="l04137"></a>04137 ztn(:,NLEV)=(pt(:,NLEV)*dsigma(NLEV) &amp;
  4227. <a name="l04138"></a>04138 &amp; +zkdiff(NLEM)*ztn(:,NLEM)/zskap(NLEM)) &amp;
  4228. <a name="l04139"></a>04139 &amp; /(dsigma(NLEV)+zkdiff(NLEM)/zskap(NLEV) &amp;
  4229. <a name="l04140"></a>04140 &amp; *(1.-zebs(NLEM)/zskap(NLEM)))
  4230. <a name="l04141"></a>04141 <span class="comment">!</span>
  4231. <a name="l04142"></a>04142 <span class="comment">! back-substitution</span>
  4232. <a name="l04143"></a>04143 <span class="comment">!</span>
  4233. <a name="l04144"></a>04144 <span class="keyword">do</span> jlev=NLEM,1,-1
  4234. <a name="l04145"></a>04145 jlep=jlev+1
  4235. <a name="l04146"></a>04146 ztn(:,jlev)=ztn(:,jlev)+zebs(jlev)*ztn(:,jlep)/zskap(jlep)
  4236. <a name="l04147"></a>04147 <span class="keyword">enddo</span>
  4237. <a name="l04148"></a>04148 <span class="comment">!</span>
  4238. <a name="l04149"></a>04149 <span class="comment">! tendencies</span>
  4239. <a name="l04150"></a>04150 <span class="comment">!</span>
  4240. <a name="l04151"></a>04151 ptt(:,1:NLEV)=ptt(:,1:NLEV)+(ztn(:,1:NLEV)-pt(:,1:NLEV))/delt2
  4241. <a name="l04152"></a>04152 <span class="comment">!</span>
  4242. <a name="l04153"></a>04153 return
  4243. <a name="l04154"></a>04154 <span class="keyword"> end subroutine vdiff</span>
  4244. <a name="l04155"></a>04155
  4245. <a name="l04156"></a>04156 <span class="comment">! =================</span>
  4246. <a name="l04157"></a>04157 <span class="comment">! SUBROUTINE GASDEV</span>
  4247. <a name="l04158"></a>04158 <span class="comment">! =================</span>
  4248. <a name="l04159"></a>04159
  4249. <a name="l04160"></a>04160 <span class="comment">! Gaussian noise generator with zero mean and unit variance.</span>
  4250. <a name="l04161"></a>04161
  4251. <a name="l04162"></a><a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">04162</a> <span class="keyword">real </span><span class="keyword">function </span><a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a>()
  4252. <a name="l04163"></a>04163 use <span class="keywordflow">pumamod</span>
  4253. <a name="l04164"></a>04164 <span class="keyword">implicit none</span>
  4254. <a name="l04165"></a>04165 <span class="keywordtype">real</span> :: fr, vx, vy, ra
  4255. <a name="l04166"></a>04166
  4256. <a name="l04167"></a>04167 <span class="keyword">if</span> (ganext == 0.0) <span class="keyword">then</span>
  4257. <a name="l04168"></a>04168 ra = 2.0
  4258. <a name="l04169"></a>04169 <span class="keyword">do</span> <span class="keyword">while</span> (ra &gt;= 1.0 .or. ra &lt; 1.0e-20)
  4259. <a name="l04170"></a>04170 call random_number(vx)
  4260. <a name="l04171"></a>04171 call random_number(vy)
  4261. <a name="l04172"></a>04172 vx = 2.0 * vx - 1.0
  4262. <a name="l04173"></a>04173 vy = 2.0 * vy - 1.0
  4263. <a name="l04174"></a>04174 ra = vx * vx + vy * vy
  4264. <a name="l04175"></a>04175 <span class="keyword">enddo</span>
  4265. <a name="l04176"></a>04176 fr = sqrt(-2.0 * log(ra) / ra)
  4266. <a name="l04177"></a>04177 <a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a> = vx * fr
  4267. <a name="l04178"></a>04178 ganext = vy * fr
  4268. <a name="l04179"></a>04179 <span class="keyword">else</span>
  4269. <a name="l04180"></a>04180 <a class="code" href="puma_8f90.html#abc1c514e88a9fc8af7e7fb69f67c2340">gasdev</a> = ganext
  4270. <a name="l04181"></a>04181 ganext = 0.0
  4271. <a name="l04182"></a>04182 <span class="keyword">endif</span>
  4272. <a name="l04183"></a>04183
  4273. <a name="l04184"></a>04184 return
  4274. <a name="l04185"></a>04185 <span class="keyword"> end</span>
  4275. <a name="l04186"></a>04186
  4276. <a name="l04187"></a>04187 <span class="comment">! =================</span>
  4277. <a name="l04188"></a>04188 <span class="comment">! SUBROUTINE SPONGE</span>
  4278. <a name="l04189"></a>04189 <span class="comment">! =================</span>
  4279. <a name="l04190"></a>04190
  4280. <a name="l04191"></a><a class="code" href="puma_8f90.html#a0c040011dabc1b712353c37a4d90cc68">04191</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a0c040011dabc1b712353c37a4d90cc68">sponge</a>
  4281. <a name="l04192"></a>04192 use <span class="keywordflow">pumamod</span>
  4282. <a name="l04193"></a>04193
  4283. <a name="l04194"></a>04194 <span class="keywordtype">real</span> :: zp
  4284. <a name="l04195"></a>04195
  4285. <a name="l04196"></a>04196 <span class="comment">! This introduces a simple sponge layer to the highest model levels</span>
  4286. <a name="l04197"></a>04197 <span class="comment">! by applying Rayleigh friction there, according to</span>
  4287. <a name="l04198"></a>04198 <span class="comment">! Polvani &amp; Kushner (2002, GRL), see their appendix.</span>
  4288. <a name="l04199"></a>04199
  4289. <a name="l04200"></a>04200 <span class="keyword">write</span>(nud,*)
  4290. <a name="l04201"></a>04201 <span class="keyword">write</span>(nud,9991)
  4291. <a name="l04202"></a>04202 <span class="keyword">write</span>(nud,9997)
  4292. <a name="l04203"></a>04203 <span class="keyword">write</span>(nud,9991)
  4293. <a name="l04204"></a>04204 <span class="keyword">write</span>(nud,9996)
  4294. <a name="l04205"></a>04205 <span class="keyword">write</span>(nud,9991)
  4295. <a name="l04206"></a>04206 <span class="keyword">do</span> jlev=1,NLEV
  4296. <a name="l04207"></a>04207 zp = sigma(jlev)*psurf
  4297. <a name="l04208"></a>04208 <span class="keyword">if</span> (zp &lt; pspon) <span class="keyword">then</span>
  4298. <a name="l04209"></a>04209 fric(jlev) = (sponk * ((pspon - zp) / pspon)**2) / TWOPI
  4299. <a name="l04210"></a>04210 <span class="keyword">endif</span>
  4300. <a name="l04211"></a>04211
  4301. <a name="l04212"></a>04212 <span class="comment">! some output</span>
  4302. <a name="l04213"></a>04213 <span class="keyword">if</span> (zp &gt; pspon) <span class="keyword">then</span>
  4303. <a name="l04214"></a>04214 <span class="keyword">if</span> (fric(jlev) == 0) <span class="keyword">then</span>
  4304. <a name="l04215"></a>04215 <span class="keyword">write</span>(nud,9992) jlev
  4305. <a name="l04216"></a>04216 <span class="keyword">else</span>
  4306. <a name="l04217"></a>04217 <span class="keyword">write</span>(nud,9993) jlev, fric(jlev)*TWOPI
  4307. <a name="l04218"></a>04218 <span class="keyword">endif</span>
  4308. <a name="l04219"></a>04219 <span class="keyword">else</span>
  4309. <a name="l04220"></a>04220 <span class="keyword">if</span> (fric(jlev) == 0) <span class="keyword">then</span>
  4310. <a name="l04221"></a>04221 <span class="keyword">write</span>(nud,9994) jlev
  4311. <a name="l04222"></a>04222 <span class="keyword">else</span>
  4312. <a name="l04223"></a>04223 <span class="keyword">write</span>(nud,9995) jlev, fric(jlev)*TWOPI
  4313. <a name="l04224"></a>04224 <span class="keyword">endif</span>
  4314. <a name="l04225"></a>04225 <span class="keyword">endif</span>
  4315. <a name="l04226"></a>04226 <span class="keyword">enddo</span>
  4316. <a name="l04227"></a>04227 <span class="keyword">write</span>(nud,9991)
  4317. <a name="l04228"></a>04228 <span class="keyword">write</span>(nud,*)
  4318. <a name="l04229"></a>04229 return
  4319. <a name="l04230"></a>04230 9991 format(33(<span class="stringliteral">&#39;*&#39;</span>))
  4320. <a name="l04231"></a>04231 9992 format(<span class="stringliteral">&#39;*&#39;</span>,i4,<span class="stringliteral">&#39; * &#39;</span>,7(<span class="stringliteral">&#39;-&#39;</span>),<span class="stringliteral">&#39; * *&#39;</span>)
  4321. <a name="l04232"></a>04232 9993 format(<span class="stringliteral">&#39;*&#39;</span>,i4,<span class="stringliteral">&#39; * &#39;</span>,f7.4,<span class="stringliteral">&#39; * *&#39;</span>)
  4322. <a name="l04233"></a>04233 9994 format(<span class="stringliteral">&#39;*&#39;</span>,i4,<span class="stringliteral">&#39; * &#39;</span>,7(<span class="stringliteral">&#39;-&#39;</span>),<span class="stringliteral">&#39; *&#39;</span>,<span class="stringliteral">&#39; SPONGE *&#39;</span>)
  4323. <a name="l04234"></a>04234 9995 format(<span class="stringliteral">&#39;*&#39;</span>,i4,<span class="stringliteral">&#39; * &#39;</span>,f7.4,<span class="stringliteral">&#39; *&#39;</span>,<span class="stringliteral">&#39; SPONGE *&#39;</span>)
  4324. <a name="l04235"></a>04235 9996 format(<span class="stringliteral">&#39;* Lv * [1/day] * *&#39;</span>)
  4325. <a name="l04236"></a>04236 9997 format(<span class="stringliteral">&#39;* Rayleigh damping coefficients *&#39;</span>)
  4326. <a name="l04237"></a>04237 <span class="keyword"> end</span>
  4327. <a name="l04238"></a>04238
  4328. <a name="l04239"></a>04239
  4329. <a name="l04240"></a>04240 <span class="comment">! =====================</span>
  4330. <a name="l04241"></a>04241 <span class="comment">! SUBROUTINE MKENERDIAG</span>
  4331. <a name="l04242"></a>04242 <span class="comment">! =====================</span>
  4332. <a name="l04243"></a>04243
  4333. <a name="l04244"></a><a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">04244</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(pst,pstt,psp,pspt,penergy)
  4334. <a name="l04245"></a>04245 use <span class="keywordflow">pumamod</span>
  4335. <a name="l04246"></a>04246 <span class="comment">!</span>
  4336. <a name="l04247"></a>04247 <span class="keywordtype">real</span> :: pst(NSPP,NLEV),pstt(NSPP,NLEV)
  4337. <a name="l04248"></a>04248 <span class="keywordtype">real</span> :: psp(NSPP),pspt(NSPP)
  4338. <a name="l04249"></a>04249 <span class="keywordtype">real</span> :: penergy(NHOR)
  4339. <a name="l04250"></a>04250 <span class="comment">!</span>
  4340. <a name="l04251"></a>04251 <span class="keywordtype">real</span> :: zsttf(NESP,NLEV),zstf(NESP,NLEV)
  4341. <a name="l04252"></a>04252 <span class="keywordtype">real</span> :: zsptf(NESP),zspf(NESP)
  4342. <a name="l04253"></a>04253 <span class="keywordtype">real</span> :: zgtt(NHOR,NLEV),zgt(NHOR,NLEV)
  4343. <a name="l04254"></a>04254 <span class="keywordtype">real</span> :: zgps(NHOR),zgpst(NHOR)
  4344. <a name="l04255"></a>04255 <span class="keywordtype">real</span> :: ztm(NHOR)
  4345. <a name="l04256"></a>04256 <span class="comment">!</span>
  4346. <a name="l04257"></a>04257 zcp=gascon/akap
  4347. <a name="l04258"></a>04258 zdelt=delt2/ww
  4348. <a name="l04259"></a>04259 <span class="comment">!</span>
  4349. <a name="l04260"></a>04260 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsttf,pstt,NLEV)
  4350. <a name="l04261"></a>04261 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zstf,pst,NLEV)
  4351. <a name="l04262"></a>04262 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsptf,pspt,1)
  4352. <a name="l04263"></a>04263 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zspf,psp,1)
  4353. <a name="l04264"></a>04264
  4354. <a name="l04265"></a>04265 <span class="keyword">do</span> jlev=1,NLEV
  4355. <a name="l04266"></a>04266 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsttf(:,jlev),zgtt(:,jlev))
  4356. <a name="l04267"></a>04267 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zstf(:,jlev),zgt(:,jlev))
  4357. <a name="l04268"></a>04268 <span class="keyword">enddo</span>
  4358. <a name="l04269"></a>04269 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsptf,zgpst)
  4359. <a name="l04270"></a>04270 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zspf,zgps)
  4360. <a name="l04271"></a>04271 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgtt,NLON,NLPP*NLEV)
  4361. <a name="l04272"></a>04272 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgt,NLON,NLPP*NLEV)
  4362. <a name="l04273"></a>04273 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgps,NLON,NLPP)
  4363. <a name="l04274"></a>04274 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgpst,NLON,NLPP)
  4364. <a name="l04275"></a>04275 zgpst(:)=psurf*(exp(zgps(:)+delt2*zgpst(:))-exp(zgps(:)))/zdelt
  4365. <a name="l04276"></a>04276 zgps(:)=psurf*exp(zgps(:))+zdelt*zgpst(:)
  4366. <a name="l04277"></a>04277 zgtt(:,:)=ct*ww*zgtt(:,:)
  4367. <a name="l04278"></a>04278 <span class="keyword">do</span> jlev=1,NLEV
  4368. <a name="l04279"></a>04279 zgt(:,jlev)=ct*(zgt(:,jlev)+t0(jlev))
  4369. <a name="l04280"></a>04280 <span class="keyword">enddo</span>
  4370. <a name="l04281"></a>04281 <span class="comment">!</span>
  4371. <a name="l04282"></a>04282 ztm(:)=0.
  4372. <a name="l04283"></a>04283 penergy(:)=0.
  4373. <a name="l04284"></a>04284 <span class="keyword">do</span> jlev=1,NLEV
  4374. <a name="l04285"></a>04285 ztm(:)=ztm(:)+zgt(:,jlev)*dsigma(jlev)
  4375. <a name="l04286"></a>04286 penergy(:)=penergy(:)+zgtt(:,jlev)*dsigma(jlev)
  4376. <a name="l04287"></a>04287 <span class="keyword">enddo</span>
  4377. <a name="l04288"></a>04288 penergy(:)=ztm(:)*zcp*zgpst(:)/ga &amp;
  4378. <a name="l04289"></a>04289 &amp; +penergy(:)*zcp*zgps(:)/ga
  4379. <a name="l04290"></a>04290 <span class="comment">!</span>
  4380. <a name="l04291"></a>04291 return
  4381. <a name="l04292"></a>04292 <span class="keyword"> end</span>
  4382. <a name="l04293"></a>04293
  4383. <a name="l04294"></a>04294 <span class="comment">! ======================</span>
  4384. <a name="l04295"></a>04295 <span class="comment">! SUBROUTINE MKENTRODIAG</span>
  4385. <a name="l04296"></a>04296 <span class="comment">! ======================</span>
  4386. <a name="l04297"></a>04297
  4387. <a name="l04298"></a><a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">04298</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(pst,pstt,psp,pentropy)
  4388. <a name="l04299"></a>04299 use <span class="keywordflow">pumamod</span>
  4389. <a name="l04300"></a>04300 <span class="comment">!</span>
  4390. <a name="l04301"></a>04301 <span class="keywordtype">real</span> :: pst(NSPP,NLEV),pstt(NSPP,NLEV)
  4391. <a name="l04302"></a>04302 <span class="keywordtype">real</span> :: psp(NSPP)
  4392. <a name="l04303"></a>04303 <span class="keywordtype">real</span> :: pentropy(NHOR)
  4393. <a name="l04304"></a>04304 <span class="comment">!</span>
  4394. <a name="l04305"></a>04305 <span class="keywordtype">real</span> :: zsttf(NESP,NLEV),zstf(NESP,NLEV)
  4395. <a name="l04306"></a>04306 <span class="keywordtype">real</span> :: zspf(NESP)
  4396. <a name="l04307"></a>04307 <span class="keywordtype">real</span> :: zgtt(NHOR,NLEV),zgt(NHOR,NLEV)
  4397. <a name="l04308"></a>04308 <span class="keywordtype">real</span> :: zgps(NHOR)
  4398. <a name="l04309"></a>04309 <span class="comment">!</span>
  4399. <a name="l04310"></a>04310 zcp=gascon/akap
  4400. <a name="l04311"></a>04311 <span class="comment">!</span>
  4401. <a name="l04312"></a>04312 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsttf,pstt,NLEV)
  4402. <a name="l04313"></a>04313 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zstf,pst,NLEV)
  4403. <a name="l04314"></a>04314 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zspf,psp,1)
  4404. <a name="l04315"></a>04315
  4405. <a name="l04316"></a>04316 <span class="keyword">do</span> jlev=1,NLEV
  4406. <a name="l04317"></a>04317 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsttf(:,jlev),zgtt(:,jlev))
  4407. <a name="l04318"></a>04318 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zstf(:,jlev),zgt(:,jlev))
  4408. <a name="l04319"></a>04319 <span class="keyword">enddo</span>
  4409. <a name="l04320"></a>04320 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zspf,zgps)
  4410. <a name="l04321"></a>04321 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgtt,NLON,NLPP*NLEV)
  4411. <a name="l04322"></a>04322 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgt,NLON,NLPP*NLEV)
  4412. <a name="l04323"></a>04323 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zgps,NLON,NLPP)
  4413. <a name="l04324"></a>04324 zgps(:)=psurf*exp(zgps(:))
  4414. <a name="l04325"></a>04325 zgtt(:,:)=ct*ww*zgtt(:,:)
  4415. <a name="l04326"></a>04326 <span class="keyword">do</span> jlev=1,NLEV
  4416. <a name="l04327"></a>04327 zgt(:,jlev)=ct*(zgt(:,jlev)+t0(jlev))
  4417. <a name="l04328"></a>04328 <span class="keyword">enddo</span>
  4418. <a name="l04329"></a>04329 <span class="comment">!</span>
  4419. <a name="l04330"></a>04330 pentropy(:)=0.
  4420. <a name="l04331"></a>04331 <span class="keyword">do</span> jlev=1,NLEV
  4421. <a name="l04332"></a>04332 pentropy(:)=pentropy(:)+zgtt(:,jlev)*dsigma(jlev)/zgt(:,jlev)
  4422. <a name="l04333"></a>04333 <span class="keyword">enddo</span>
  4423. <a name="l04334"></a>04334 pentropy(:)=pentropy(:)*zcp*zgps(:)/ga
  4424. <a name="l04335"></a>04335 <span class="comment">!</span>
  4425. <a name="l04336"></a>04336 return
  4426. <a name="l04337"></a>04337 <span class="keyword"> end</span>
  4427. <a name="l04338"></a>04338
  4428. <a name="l04339"></a>04339 <span class="comment">! ==================</span>
  4429. <a name="l04340"></a>04340 <span class="comment">! SUBROUTINE MKDHEAT</span>
  4430. <a name="l04341"></a>04341 <span class="comment">! ==================</span>
  4431. <a name="l04342"></a>04342
  4432. <a name="l04343"></a><a class="code" href="puma_8f90.html#a079a9ea6caa3eb9d5ef5e0c82f76a2b9">04343</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a079a9ea6caa3eb9d5ef5e0c82f76a2b9">mkdheat</a>(zszt1,zszt2,zsdt1,zsdt2,zsp)
  4433. <a name="l04344"></a>04344 use <span class="keywordflow">pumamod</span>
  4434. <a name="l04345"></a>04345 <span class="comment">!</span>
  4435. <a name="l04346"></a>04346 <span class="comment">! &#39;recycle&#39; kin. energy loss by heating the environment</span>
  4436. <a name="l04347"></a>04347 <span class="comment">!</span>
  4437. <a name="l04348"></a>04348 <span class="comment">! zszt1/zsdt1 : vorticity/divergence tendency due to friction</span>
  4438. <a name="l04349"></a>04349 <span class="comment">! zszt2/zsdt2 : vorticity/divergence tendency fue to diffusion </span>
  4439. <a name="l04350"></a>04350 <span class="comment">! zp : surface pressure</span>
  4440. <a name="l04351"></a>04351 <span class="comment">!</span>
  4441. <a name="l04352"></a>04352 <span class="keywordtype">real</span> zszt1(NSPP,NLEV),zszt2(NSPP,NLEV)
  4442. <a name="l04353"></a>04353 <span class="keywordtype">real</span> zsdt1(NSPP,NLEV),zsdt2(NSPP,NLEV)
  4443. <a name="l04354"></a>04354 <span class="keywordtype">real</span> zsp(NSPP)
  4444. <a name="l04355"></a>04355 <span class="keywordtype">real</span> zp(NHOR)
  4445. <a name="l04356"></a>04356 <span class="comment">!</span>
  4446. <a name="l04357"></a>04357 <span class="keywordtype">real</span> zsd(NESP,NLEV),zsz(NESP,NLEV)
  4447. <a name="l04358"></a>04358 <span class="keywordtype">real</span> zspf(NESP),zspt(NSPP)
  4448. <a name="l04359"></a>04359 <span class="keywordtype">real</span> zsdp(NSPP,NLEV),zszp(NSPP,NLEV)
  4449. <a name="l04360"></a>04360 <span class="keywordtype">real</span> zu(NHOR,NLEV),zun(NHOR,NLEV),zdu1(NHOR,NLEV),zdu2(NHOR,NLEV)
  4450. <a name="l04361"></a>04361 <span class="keywordtype">real</span> zv(NHOR,NLEV),zvn(NHOR,NLEV),zdv1(NHOR,NLEV),zdv2(NHOR,NLEV)
  4451. <a name="l04362"></a>04362 <span class="keywordtype">real</span> zdtdt1(NHOR,NLEV),zdtdt2(NHOR,NLEV),zdtdt3(NHOR,NLEV)
  4452. <a name="l04363"></a>04363 <span class="comment">!</span>
  4453. <a name="l04364"></a>04364 <span class="keywordtype">real</span> zdtdt(NHOR,NLEV),zdekin(NHOR,NLEV)
  4454. <a name="l04365"></a>04365 <span class="comment">!</span>
  4455. <a name="l04366"></a>04366 <span class="keywordtype">real</span> zsde(NSPP,NLEV),zsdef(NESP,NLEV)
  4456. <a name="l04367"></a>04367 <span class="keywordtype">real</span> zstt(NSPP,NLEV),zstf(NESP,NLEV)
  4457. <a name="l04368"></a>04368 <span class="keywordtype">real</span> zstt1(NSPP,NLEV),zstf1(NESP,NLEV),zstt3(NSPP,NLEV)
  4458. <a name="l04369"></a>04369 <span class="keywordtype">real</span> zstt2(NSPP,NLEV),zstf2(NESP,NLEV),zstf3(NESP,NLEV)
  4459. <a name="l04370"></a>04370 <span class="comment">!</span>
  4460. <a name="l04371"></a>04371 <span class="comment">! some constants</span>
  4461. <a name="l04372"></a>04372 <span class="comment">!</span>
  4462. <a name="l04373"></a>04373 zdelt=delt2/ww <span class="comment">! timestep in s</span>
  4463. <a name="l04374"></a>04374 zcp=gascon/akap <span class="comment">! heat capacity</span>
  4464. <a name="l04375"></a>04375 <span class="comment">!</span>
  4465. <a name="l04376"></a>04376 <span class="comment">! &#39;recycle&#39; friction</span>
  4466. <a name="l04377"></a>04377 <span class="comment">!</span>
  4467. <a name="l04378"></a>04378 <span class="comment">! a) gather the &#39;partial&#39; field of z and d, and make u and v </span>
  4468. <a name="l04379"></a>04379 <span class="comment">! at old time level</span>
  4469. <a name="l04380"></a>04380 <span class="comment">!</span>
  4470. <a name="l04381"></a>04381 zsdp(:,:)=sdp(:,:)
  4471. <a name="l04382"></a>04382 zszp(:,:)=szp(:,:)
  4472. <a name="l04383"></a>04383 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsd,zsdp,NLEV)
  4473. <a name="l04384"></a>04384 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsz,zszp,NLEV)
  4474. <a name="l04385"></a>04385 <span class="keyword">do</span> jlev = 1 , NLEV
  4475. <a name="l04386"></a>04386 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(zsd(1,jlev),zsz(1,jlev),zu(1,jlev),zv(1,jlev))
  4476. <a name="l04387"></a>04387 <span class="keyword">enddo</span>
  4477. <a name="l04388"></a>04388 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zu,NLON,NLPP*NLEV)
  4478. <a name="l04389"></a>04389 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zv,NLON,NLPP*NLEV)
  4479. <a name="l04390"></a>04390 <span class="comment">!</span>
  4480. <a name="l04391"></a>04391 <span class="comment">! b) add fricton tendencies and create new u and v</span>
  4481. <a name="l04392"></a>04392 <span class="comment">!</span>
  4482. <a name="l04393"></a>04393 zsdp(:,:)=sdp(:,:)+zsdt1(:,:)*delt2
  4483. <a name="l04394"></a>04394 zszp(:,:)=szp(:,:)+zszt1(:,:)*delt2
  4484. <a name="l04395"></a>04395 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsd,zsdp,NLEV)
  4485. <a name="l04396"></a>04396 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsz,zszp,NLEV)
  4486. <a name="l04397"></a>04397 <span class="keyword">do</span> jlev = 1 , NLEV
  4487. <a name="l04398"></a>04398 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(zsd(1,jlev),zsz(1,jlev),zun(1,jlev),zvn(1,jlev))
  4488. <a name="l04399"></a>04399 <span class="keyword">enddo</span>
  4489. <a name="l04400"></a>04400 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zun,NLON,NLPP*NLEV)
  4490. <a name="l04401"></a>04401 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zvn,NLON,NLPP*NLEV)
  4491. <a name="l04402"></a>04402 <span class="comment">!</span>
  4492. <a name="l04403"></a>04403 <span class="comment">! c) compute temperature tendency</span>
  4493. <a name="l04404"></a>04404 <span class="comment">!</span>
  4494. <a name="l04405"></a>04405 <span class="keyword">do</span> jlev=1,NLEV
  4495. <a name="l04406"></a>04406 zu(:,jlev)=cv*zu(:,jlev)*SQRT(rcsq(:))
  4496. <a name="l04407"></a>04407 zv(:,jlev)=cv*zv(:,jlev)*SQRT(rcsq(:))
  4497. <a name="l04408"></a>04408 zun(:,jlev)=cv*zun(:,jlev)*SQRT(rcsq(:))
  4498. <a name="l04409"></a>04409 zvn(:,jlev)=cv*zvn(:,jlev)*SQRT(rcsq(:))
  4499. <a name="l04410"></a>04410 zdu1(:,jlev)=zun(:,jlev)-zu(:,jlev)
  4500. <a name="l04411"></a>04411 zdv1(:,jlev)=zvn(:,jlev)-zv(:,jlev)
  4501. <a name="l04412"></a>04412 zdtdt1(:,jlev)=-(zun(:,jlev)*zun(:,jlev) &amp;
  4502. <a name="l04413"></a>04413 &amp; -zu(:,jlev)*zu(:,jlev) &amp;
  4503. <a name="l04414"></a>04414 &amp; +zvn(:,jlev)*zvn(:,jlev) &amp;
  4504. <a name="l04415"></a>04415 &amp; -zv(:,jlev)*zv(:,jlev))*0.5/zdelt/zcp
  4505. <a name="l04416"></a>04416 <span class="keyword">enddo</span>
  4506. <a name="l04417"></a>04417
  4507. <a name="l04418"></a>04418 <span class="comment">!</span>
  4508. <a name="l04419"></a>04419 <span class="comment">! &#39;recycle&#39; momentum diffusion </span>
  4509. <a name="l04420"></a>04420 <span class="comment">! </span>
  4510. <a name="l04421"></a>04421 <span class="comment">! a) add tendencies and create new u and v and get surface pressure</span>
  4511. <a name="l04422"></a>04422 <span class="comment">!</span>
  4512. <a name="l04423"></a>04423 <span class="comment">!</span>
  4513. <a name="l04424"></a>04424 zsdp(:,:)=sdp(:,:)+zsdt2(:,:)*delt2
  4514. <a name="l04425"></a>04425 zszp(:,:)=szp(:,:)+zszt2(:,:)*delt2
  4515. <a name="l04426"></a>04426 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsd,zsdp,NLEV)
  4516. <a name="l04427"></a>04427 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsz,zszp,NLEV)
  4517. <a name="l04428"></a>04428 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zspf,zsp,1)
  4518. <a name="l04429"></a>04429 <span class="keyword">do</span> jlev = 1 , NLEV
  4519. <a name="l04430"></a>04430 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(zsd(1,jlev),zsz(1,jlev),zun(1,jlev),zvn(1,jlev))
  4520. <a name="l04431"></a>04431 <span class="keyword">enddo</span>
  4521. <a name="l04432"></a>04432 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zun,NLON,NLPP*NLEV)
  4522. <a name="l04433"></a>04433 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zvn,NLON,NLPP*NLEV)
  4523. <a name="l04434"></a>04434 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zspf,zp)
  4524. <a name="l04435"></a>04435 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zp,NLON,NLPP)
  4525. <a name="l04436"></a>04436 zp(:)=psurf*exp(zp(:))
  4526. <a name="l04437"></a>04437 <span class="comment">!</span>
  4527. <a name="l04438"></a>04438 <span class="comment">! b) compute loss of kinetic energy</span>
  4528. <a name="l04439"></a>04439 <span class="comment">! (note: only the global average change of kin. e. is &#39;lost&#39;</span>
  4529. <a name="l04440"></a>04440 <span class="comment">! the other changes are just diffusion)</span>
  4530. <a name="l04441"></a>04441 <span class="comment">!</span>
  4531. <a name="l04442"></a>04442 <span class="keyword">do</span> jlev = 1 , NLEV
  4532. <a name="l04443"></a>04443 zun(:,jlev)=cv*zun(:,jlev)*SQRT(rcsq(:))
  4533. <a name="l04444"></a>04444 zvn(:,jlev)=cv*zvn(:,jlev)*SQRT(rcsq(:))
  4534. <a name="l04445"></a>04445 zdu2(:,jlev)=zun(:,jlev)-zu(:,jlev)
  4535. <a name="l04446"></a>04446 zdv2(:,jlev)=zvn(:,jlev)-zv(:,jlev)
  4536. <a name="l04447"></a>04447 zdekin(:,jlev)=(zun(:,jlev)*zun(:,jlev) &amp;
  4537. <a name="l04448"></a>04448 &amp; -zu(:,jlev)*zu(:,jlev) &amp;
  4538. <a name="l04449"></a>04449 &amp; +zvn(:,jlev)*zvn(:,jlev) &amp;
  4539. <a name="l04450"></a>04450 &amp; -zv(:,jlev)*zv(:,jlev))*0.5/zdelt &amp;
  4540. <a name="l04451"></a>04451 &amp; *zp(:)/ga*dsigma(jlev)
  4541. <a name="l04452"></a>04452 <span class="keyword">enddo</span>
  4542. <a name="l04453"></a>04453 <span class="comment">!</span>
  4543. <a name="l04454"></a>04454 <span class="comment">! c) get the global average and transform it back</span>
  4544. <a name="l04455"></a>04455 <span class="comment">!</span>
  4545. <a name="l04456"></a>04456 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zdekin,NLON,NLPP*NLEV)
  4546. <a name="l04457"></a>04457 <span class="keyword">do</span> jlev=1,NLEV
  4547. <a name="l04458"></a>04458 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zdekin(:,jlev),zsdef(:,jlev))
  4548. <a name="l04459"></a>04459 <span class="keyword">enddo</span>
  4549. <a name="l04460"></a>04460 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zsdef,zsde,NLEV)
  4550. <a name="l04461"></a>04461 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsdef,zsde,NLEV)
  4551. <a name="l04462"></a>04462 zsdef(2:NESP,:)=0.
  4552. <a name="l04463"></a>04463 <span class="keyword">do</span> jlev = 1 , NLEV
  4553. <a name="l04464"></a>04464 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsdef(1,jlev),zdekin(1,jlev))
  4554. <a name="l04465"></a>04465 <span class="keyword">enddo</span>
  4555. <a name="l04466"></a>04466 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zdekin,NLON,NLPP*NLEV)
  4556. <a name="l04467"></a>04467 <span class="comment">!</span>
  4557. <a name="l04468"></a>04468 <span class="comment">! d) compute temperature tendency</span>
  4558. <a name="l04469"></a>04469 <span class="comment">!</span>
  4559. <a name="l04470"></a>04470 <span class="keyword">do</span> jlev=1,NLEV
  4560. <a name="l04471"></a>04471 zdtdt2(:,jlev)=-zdekin(:,jlev)*ga/zp(:)/dsigma(jlev)/zcp
  4561. <a name="l04472"></a>04472 zdtdt3(:,jlev)=-(zdu1(:,jlev)*zdu2(:,jlev) &amp;
  4562. <a name="l04473"></a>04473 &amp; +zdv1(:,jlev)*zdv2(:,jlev))/zdelt/zcp
  4563. <a name="l04474"></a>04474 <span class="keyword">enddo</span>
  4564. <a name="l04475"></a>04475 <span class="comment">!</span>
  4565. <a name="l04476"></a>04476 zdtdt1(:,:)=zdtdt1(:,:)/ct/ww
  4566. <a name="l04477"></a>04477 zdtdt2(:,:)=zdtdt2(:,:)/ct/ww
  4567. <a name="l04478"></a>04478 zdtdt3(:,:)=zdtdt3(:,:)/ct/ww
  4568. <a name="l04479"></a>04479 <span class="comment">!</span>
  4569. <a name="l04480"></a>04480 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zdtdt1,NLON,NLPP*NLEV)
  4570. <a name="l04481"></a>04481 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zdtdt2,NLON,NLPP*NLEV)
  4571. <a name="l04482"></a>04482 call <a class="code" href="fft991mod_8f90.html#a8b611c69cc0d4f2c29a543e7903cb495">gp2fc</a>(zdtdt3,NLON,NLPP*NLEV)
  4572. <a name="l04483"></a>04483 <span class="keyword">do</span> jlev=1,NLEV
  4573. <a name="l04484"></a>04484 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zdtdt1(:,jlev),zstf1(:,jlev))
  4574. <a name="l04485"></a>04485 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zdtdt2(:,jlev),zstf2(:,jlev))
  4575. <a name="l04486"></a>04486 call <a class="code" href="legsym_8f90.html#a04d46a94caf6c743547ac25cfa3058d4">fc2sp</a>(zdtdt3(:,jlev),zstf3(:,jlev))
  4576. <a name="l04487"></a>04487 <span class="keyword">enddo</span>
  4577. <a name="l04488"></a>04488 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zstf1,zstt1,NLEV)
  4578. <a name="l04489"></a>04489 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zstf2,zstt2,NLEV)
  4579. <a name="l04490"></a>04490 call <a class="code" href="mpimod_8f90.html#a75a681a8d4b9ab5ba0d4fa97f909647b">mpsumsc</a>(zstf3,zstt3,NLEV)
  4580. <a name="l04491"></a>04491 <span class="comment">!</span>
  4581. <a name="l04492"></a>04492 <span class="comment">! add the temprature tendencies</span>
  4582. <a name="l04493"></a>04493 <span class="comment">!</span>
  4583. <a name="l04494"></a>04494 stt(:,:)=stt(:,:)+zstt1(:,:)+zstt2(:,:)+zstt3(:,:)
  4584. <a name="l04495"></a>04495 <span class="comment">!</span>
  4585. <a name="l04496"></a>04496 <span class="comment">! energy diagnostics</span>
  4586. <a name="l04497"></a>04497 <span class="comment">!</span>
  4587. <a name="l04498"></a>04498 <span class="keyword">if</span>(nenergy &gt; 0) <span class="keyword">then</span>
  4588. <a name="l04499"></a>04499 zspt(:)=0.
  4589. <a name="l04500"></a>04500 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstt1,zsp,zspt,denergy(:,5))
  4590. <a name="l04501"></a>04501 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstt2,zsp,zspt,denergy(:,6))
  4591. <a name="l04502"></a>04502 call <a class="code" href="puma_8f90.html#a4f476f8f243b066b52526d1a2696b48f">mkenerdiag</a>(stp,zstt3,zsp,zspt,denergy(:,7))
  4592. <a name="l04503"></a>04503 <span class="keyword">endif</span>
  4593. <a name="l04504"></a>04504 <span class="keyword">if</span>(nentropy &gt; 0) <span class="keyword">then</span>
  4594. <a name="l04505"></a>04505 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstt1,zsp,dentropy(:,5))
  4595. <a name="l04506"></a>04506 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstt2,zsp,dentropy(:,6))
  4596. <a name="l04507"></a>04507 call <a class="code" href="puma_8f90.html#a36962178b35132627d3f0c4a2b816a92">mkentrodiag</a>(stp,zstt3,zsp,dentropy(:,7))
  4597. <a name="l04508"></a>04508 <span class="keyword">endif</span>
  4598. <a name="l04509"></a>04509
  4599. <a name="l04510"></a>04510 <span class="comment">!</span>
  4600. <a name="l04511"></a>04511 return
  4601. <a name="l04512"></a>04512 <span class="keyword"> end subroutine mkdheat</span>
  4602. <a name="l04513"></a>04513
  4603. <a name="l04514"></a>04514 <span class="comment">! =================</span>
  4604. <a name="l04515"></a>04515 <span class="comment">! SUBROUTINE MKEKIN</span>
  4605. <a name="l04516"></a>04516 <span class="comment">! =================</span>
  4606. <a name="l04517"></a>04517
  4607. <a name="l04518"></a><a class="code" href="puma_8f90.html#a30cefc96eb08dde625692abb8eae576e">04518</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a30cefc96eb08dde625692abb8eae576e">mkekin</a>(zszp,zsdp,zp,zekin)
  4608. <a name="l04519"></a>04519 use <span class="keywordflow">pumamod</span>
  4609. <a name="l04520"></a>04520 <span class="comment">!</span>
  4610. <a name="l04521"></a>04521 <span class="keywordtype">real</span> zszp(NSPP,NLEV),zsdp(NSPP,NLEV)
  4611. <a name="l04522"></a>04522 <span class="keywordtype">real</span> zp(NHOR),zekin(NHOR)
  4612. <a name="l04523"></a>04523 <span class="comment">!</span>
  4613. <a name="l04524"></a>04524 <span class="keywordtype">real</span> zsd(NESP,NLEV),zsz(NESP,NLEV)
  4614. <a name="l04525"></a>04525 <span class="keywordtype">real</span> zu(NHOR,NLEV),zv(NHOR,NLEV)
  4615. <a name="l04526"></a>04526 <span class="comment">!</span>
  4616. <a name="l04527"></a>04527 <span class="comment">! some constants</span>
  4617. <a name="l04528"></a>04528 <span class="comment">!</span>
  4618. <a name="l04529"></a>04529 zdelt=delt2/ww <span class="comment">! timestep in s</span>
  4619. <a name="l04530"></a>04530 zcp=gascon/akap <span class="comment">! heat capacity</span>
  4620. <a name="l04531"></a>04531 <span class="comment">!</span>
  4621. <a name="l04532"></a>04532 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsd,zsdp,NLEV)
  4622. <a name="l04533"></a>04533 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsz,zszp,NLEV)
  4623. <a name="l04534"></a>04534 <span class="keyword">do</span> jlev = 1 , NLEV
  4624. <a name="l04535"></a>04535 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(zsd(1,jlev),zsz(1,jlev),zu(1,jlev),zv(1,jlev))
  4625. <a name="l04536"></a>04536 <span class="keyword">enddo</span>
  4626. <a name="l04537"></a>04537 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zu,NLON,NLPP*NLEV)
  4627. <a name="l04538"></a>04538 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zv,NLON,NLPP*NLEV)
  4628. <a name="l04539"></a>04539 <span class="comment">!</span>
  4629. <a name="l04540"></a>04540 zekin(:)=0.
  4630. <a name="l04541"></a>04541 <span class="keyword">do</span> jlev = 1 , NLEV
  4631. <a name="l04542"></a>04542 zu(:,jlev)=cv*zu(:,jlev)*SQRT(rcsq(:))
  4632. <a name="l04543"></a>04543 zv(:,jlev)=cv*zv(:,jlev)*SQRT(rcsq(:))
  4633. <a name="l04544"></a>04544 zekin(:)=(zu(:,jlev)*zu(:,jlev)+zv(:,jlev)*zv(:,jlev))*0.5 &amp;
  4634. <a name="l04545"></a>04545 &amp; *zp(:)/ga*dsigma(jlev)+zekin(:)
  4635. <a name="l04546"></a>04546 <span class="keyword">enddo</span>
  4636. <a name="l04547"></a>04547 <span class="comment">!</span>
  4637. <a name="l04548"></a>04548 return
  4638. <a name="l04549"></a>04549 <span class="keyword"> end</span>
  4639. <a name="l04550"></a><a class="code" href="puma_8f90.html#abc6f135f96d6f8c9636cef2d9c9dd796">04550</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#abc6f135f96d6f8c9636cef2d9c9dd796">mkekin2</a>(zszp,zsdp,zspp,zekin)
  4640. <a name="l04551"></a>04551 use <span class="keywordflow">pumamod</span>
  4641. <a name="l04552"></a>04552 <span class="comment">!</span>
  4642. <a name="l04553"></a>04553 <span class="keywordtype">real</span> zszp(NSPP,NLEV),zsdp(NSPP,NLEV),zspp(NSPP)
  4643. <a name="l04554"></a>04554 <span class="keywordtype">real</span> zp(NHOR),zekin(NHOR)
  4644. <a name="l04555"></a>04555 <span class="comment">!</span>
  4645. <a name="l04556"></a>04556 <span class="keywordtype">real</span> zsd(NESP,NLEV),zsz(NESP,NLEV),zsp(NESP)
  4646. <a name="l04557"></a>04557 <span class="keywordtype">real</span> zu(NHOR,NLEV),zv(NHOR,NLEV)
  4647. <a name="l04558"></a>04558 <span class="comment">!</span>
  4648. <a name="l04559"></a>04559 <span class="comment">! some constants</span>
  4649. <a name="l04560"></a>04560 <span class="comment">!</span>
  4650. <a name="l04561"></a>04561 zdelt=delt2/ww <span class="comment">! timestep in s</span>
  4651. <a name="l04562"></a>04562 zcp=gascon/akap <span class="comment">! heat capacity</span>
  4652. <a name="l04563"></a>04563 <span class="comment">!</span>
  4653. <a name="l04564"></a>04564 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsd,zsdp,NLEV)
  4654. <a name="l04565"></a>04565 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsz,zszp,NLEV)
  4655. <a name="l04566"></a>04566 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsp,zspp,NLEV)
  4656. <a name="l04567"></a>04567 <span class="keyword">do</span> jlev = 1 , NLEV
  4657. <a name="l04568"></a>04568 call <a class="code" href="legsym_8f90.html#af9cbedf7e87d9d5b2360c204237cc698">dv2uv</a>(zsd(1,jlev),zsz(1,jlev),zu(1,jlev),zv(1,jlev))
  4658. <a name="l04569"></a>04569 <span class="keyword">enddo</span>
  4659. <a name="l04570"></a>04570 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsp,zp)
  4660. <a name="l04571"></a>04571 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zu,NLON,NLPP*NLEV)
  4661. <a name="l04572"></a>04572 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zv,NLON,NLPP*NLEV)
  4662. <a name="l04573"></a>04573 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zp,NLON,NLPP)
  4663. <a name="l04574"></a>04574 <span class="comment">!</span>
  4664. <a name="l04575"></a>04575 zp(:)=psurf*exp(zp(:))
  4665. <a name="l04576"></a>04576 zekin(:)=0.
  4666. <a name="l04577"></a>04577 <span class="keyword">do</span> jlev = 1 , NLEV
  4667. <a name="l04578"></a>04578 zu(:,jlev)=cv*zu(:,jlev)*SQRT(rcsq(:))
  4668. <a name="l04579"></a>04579 zv(:,jlev)=cv*zv(:,jlev)*SQRT(rcsq(:))
  4669. <a name="l04580"></a>04580 zekin(:)=(zu(:,jlev)*zu(:,jlev)+zv(:,jlev)*zv(:,jlev))*0.5 &amp;
  4670. <a name="l04581"></a>04581 &amp; *zp(:)/ga*dsigma(jlev)+zekin(:)
  4671. <a name="l04582"></a>04582 <span class="keyword">enddo</span>
  4672. <a name="l04583"></a>04583 <span class="comment">!</span>
  4673. <a name="l04584"></a>04584 return
  4674. <a name="l04585"></a>04585 <span class="keyword"> end</span>
  4675. <a name="l04586"></a>04586
  4676. <a name="l04587"></a>04587
  4677. <a name="l04588"></a>04588 <span class="comment">! =================</span>
  4678. <a name="l04589"></a>04589 <span class="comment">! SUBROUTINE MKEPOT</span>
  4679. <a name="l04590"></a>04590 <span class="comment">! =================</span>
  4680. <a name="l04591"></a>04591
  4681. <a name="l04592"></a><a class="code" href="puma_8f90.html#a0af984bd0f7283956290a0964e69cf0e">04592</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a0af984bd0f7283956290a0964e69cf0e">mkepot</a>(zstp,zp,zepot)
  4682. <a name="l04593"></a>04593 use <span class="keywordflow">pumamod</span>
  4683. <a name="l04594"></a>04594 <span class="comment">!</span>
  4684. <a name="l04595"></a>04595 <span class="keywordtype">real</span> zstp(NSPP,NLEV)
  4685. <a name="l04596"></a>04596 <span class="keywordtype">real</span> zp(NHOR),zepot(NHOR)
  4686. <a name="l04597"></a>04597 <span class="comment">!</span>
  4687. <a name="l04598"></a>04598 <span class="keywordtype">real</span> zst(NESP,NLEV)
  4688. <a name="l04599"></a>04599 <span class="keywordtype">real</span> zt(NHOR,NLEV)
  4689. <a name="l04600"></a>04600 <span class="comment">!</span>
  4690. <a name="l04601"></a>04601 <span class="comment">! some constants</span>
  4691. <a name="l04602"></a>04602 <span class="comment">!</span>
  4692. <a name="l04603"></a>04603 zdelt=delt2/ww <span class="comment">! timestep in s</span>
  4693. <a name="l04604"></a>04604 zcp=gascon/akap <span class="comment">! heat capacity</span>
  4694. <a name="l04605"></a>04605 <span class="comment">!</span>
  4695. <a name="l04606"></a>04606 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zst,zstp,NLEV)
  4696. <a name="l04607"></a>04607 <span class="keyword">do</span> jlev = 1 , NLEV
  4697. <a name="l04608"></a>04608 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zst(1,jlev),zt(1,jlev))
  4698. <a name="l04609"></a>04609 <span class="keyword">enddo</span>
  4699. <a name="l04610"></a>04610 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zt,NLON,NLPP*NLEV)
  4700. <a name="l04611"></a>04611 <span class="comment">!</span>
  4701. <a name="l04612"></a>04612 zepot(:)=0.
  4702. <a name="l04613"></a>04613 <span class="keyword">do</span> jlev = 1 , NLEV
  4703. <a name="l04614"></a>04614 zt(:,jlev)=ct*(zt(:,jlev)+t0(jlev))
  4704. <a name="l04615"></a>04615 zepot(:)=zt(:,jlev)*zcp &amp;
  4705. <a name="l04616"></a>04616 &amp; *zp(:)/ga*dsigma(jlev)+zepot(:)
  4706. <a name="l04617"></a>04617 <span class="keyword">enddo</span>
  4707. <a name="l04618"></a>04618 <span class="comment">!</span>
  4708. <a name="l04619"></a>04619 return
  4709. <a name="l04620"></a>04620 <span class="keyword"> end</span>
  4710. <a name="l04621"></a><a class="code" href="puma_8f90.html#a23384f45e8ba553e7aaed8b22a9a80e8">04621</a> <span class="keyword">subroutine </span><a class="code" href="puma_8f90.html#a23384f45e8ba553e7aaed8b22a9a80e8">mkepot2</a>(zstp,zspp,zepot)
  4711. <a name="l04622"></a>04622 use <span class="keywordflow">pumamod</span>
  4712. <a name="l04623"></a>04623 <span class="comment">!</span>
  4713. <a name="l04624"></a>04624 <span class="keywordtype">real</span> zstp(NSPP,NLEV),zspp(NSPP)
  4714. <a name="l04625"></a>04625 <span class="keywordtype">real</span> zp(NHOR),zepot(NHOR)
  4715. <a name="l04626"></a>04626 <span class="comment">!</span>
  4716. <a name="l04627"></a>04627 <span class="keywordtype">real</span> zst(NESP,NLEV),zsp(NESP)
  4717. <a name="l04628"></a>04628 <span class="keywordtype">real</span> zt(NHOR,NLEV)
  4718. <a name="l04629"></a>04629 <span class="comment">!</span>
  4719. <a name="l04630"></a>04630 <span class="comment">! some constants</span>
  4720. <a name="l04631"></a>04631 <span class="comment">!</span>
  4721. <a name="l04632"></a>04632 zdelt=delt2/ww <span class="comment">! timestep in s</span>
  4722. <a name="l04633"></a>04633 zcp=gascon/akap <span class="comment">! heat capacity</span>
  4723. <a name="l04634"></a>04634 <span class="comment">!</span>
  4724. <a name="l04635"></a>04635 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zst,zstp,NLEV)
  4725. <a name="l04636"></a>04636 call <a class="code" href="mpimod_8f90.html#a54cf45feb57177de8eaab2e6b01a7aa2">mpgallsp</a>(zsp,zspp,1)
  4726. <a name="l04637"></a>04637 <span class="keyword">do</span> jlev = 1 , NLEV
  4727. <a name="l04638"></a>04638 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zst(1,jlev),zt(1,jlev))
  4728. <a name="l04639"></a>04639 <span class="keyword">enddo</span>
  4729. <a name="l04640"></a>04640 call <a class="code" href="legsym_8f90.html#aec404fc15930c6e4584c088a399ea099">sp2fc</a>(zsp,zp)
  4730. <a name="l04641"></a>04641 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zt,NLON,NLPP*NLEV)
  4731. <a name="l04642"></a>04642 call <a class="code" href="fft991mod_8f90.html#aa0cf4000171aaaf40d5e9850f73703db">fc2gp</a>(zp,NLON,NLPP)
  4732. <a name="l04643"></a>04643 <span class="comment">!</span>
  4733. <a name="l04644"></a>04644 zp(:)=psurf*exp(zp(:))
  4734. <a name="l04645"></a>04645 zepot(:)=0.
  4735. <a name="l04646"></a>04646 <span class="keyword">do</span> jlev = 1 , NLEV
  4736. <a name="l04647"></a>04647 zt(:,jlev)=ct*(zt(:,jlev)+t0(jlev))
  4737. <a name="l04648"></a>04648 zepot(:)=zt(:,jlev)*zcp &amp;
  4738. <a name="l04649"></a>04649 &amp; *zp(:)/ga*dsigma(jlev)+zepot(:)
  4739. <a name="l04650"></a>04650 <span class="keyword">enddo</span>
  4740. <a name="l04651"></a>04651 <span class="comment">!</span>
  4741. <a name="l04652"></a>04652 return
  4742. <a name="l04653"></a>04653 <span class="keyword"> end</span>
  4743. <a name="l04654"></a>04654
  4744. </pre></div></div>
  4745. </div>
  4746. <div id="nav-path" class="navpath">
  4747. <ul>
  4748. <li class="navelem"><a class="el" href="puma_8f90.html">puma.f90</a> </li>
  4749. <!-- window showing the filter options -->
  4750. <div id="MSearchSelectWindow"
  4751. onmouseover="return searchBox.OnSearchSelectShow()"
  4752. onmouseout="return searchBox.OnSearchSelectHide()"
  4753. onkeydown="return searchBox.OnSearchSelectKey(event)">
  4754. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Defines</a></div>
  4755. <!-- iframe showing the search results (closed by default) -->
  4756. <div id="MSearchResultsWindow">
  4757. <iframe src="javascript:void(0)" frameborder="0"
  4758. name="MSearchResults" id="MSearchResults">
  4759. </iframe>
  4760. </div>
  4761. <li class="footer">Generated on Wed Sep 21 2011 12:35:46 for PUMA by
  4762. <a href="http://www.doxygen.org/index.html">
  4763. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
  4764. </ul>
  4765. </div>
  4766. </body>
  4767. </html>