├── .clang-format ├── .clang-tidy ├── .flake8 ├── .gitattributes ├── .github └── workflows │ └── test_compile.yml ├── .gitignore ├── .gitmodules ├── .ipynb_strip_filter ├── CMakeLists.txt ├── Makefile ├── Makefile.conf.template ├── README.md ├── changelog.md ├── ic_special ├── gen_ic_deep │ ├── esp_initial.h5 │ └── esp_initial_planet.h5 └── gen_ic_earth │ ├── esp_initial.h5 │ └── esp_initial_planet.h5 ├── ifile ├── alf_wasp_alf.thr ├── deephj.thr ├── earth_acoustic_test.thr ├── earth_gwave_test.thr ├── earth_hstest.thr ├── earth_localRi_g5_dc.thr ├── earth_rt_dc_g5.thr ├── earth_sync.thr ├── esp_initial.h5 ├── esp_initial_planet.h5 ├── input_template.thr ├── picket_fence_wasp43b_hydro.thr ├── repo_benchmarks │ ├── earth_hstest.thr │ ├── earth_rt_dc_g5.thr │ ├── hd189b_constg.thr │ ├── hd189b_fullg.thr │ ├── sync_rot_pbl_test.thr │ ├── wasp43_ni_i2s.thr │ └── wasp43b_ex.thr ├── shallowhj.thr ├── wasp43b_ex.thr └── wasp43b_tsrt.thr ├── license.txt ├── mjolnir ├── custom_example.py ├── file_helpers.py ├── hamarr.py ├── hamarr_suppl.py ├── mjolnir ├── mjolnir.m ├── mjolnir.py ├── mjolnir_plot_helper.py ├── mjolnyr.ipynb ├── muninn ├── pgrid ├── pgrid.py ├── plot_test_fn.py ├── regrid ├── regrid.py ├── temperature.m ├── temperature_u_lev.m └── u.m ├── repo_benchmark_figures ├── Feb2022 │ ├── EarthHS_example │ │ ├── earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf │ │ ├── earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf │ │ ├── earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf │ │ └── earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf │ ├── EarthRT_example │ │ ├── earth_rt_mask_streamf_ver_i1_l1.pdf │ │ ├── earth_rt_mask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_BVprofPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_CFLPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfdowntotPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfdowntot_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfnetPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfnet_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfuptotPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_DGfuptot_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_DGqheatprofPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_PTPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_TPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_Tsurf_i1_l1.pdf │ │ ├── earth_rt_unmask_UPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_WPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_eddyKE_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_eddyMom_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_eddyTempVar_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_eddyTemp_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_insol_i1_l1.pdf │ │ ├── earth_rt_unmask_pot_vort_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_pot_vort_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_potential_temp_p_ver_i1_l1_lat-90+00-90+00.pdf │ │ ├── earth_rt_unmask_potential_temp_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_qheatprofPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_rela_vort_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_streamf_ver_i1_l1.pdf │ │ ├── earth_rt_unmask_tau_lwPprofile_i1_l1.pdf │ │ ├── earth_rt_unmask_temperature-uv_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_temperature_p_ver_i1_l1_lat-90+00-90+00.pdf │ │ ├── earth_rt_unmask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_u_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_u_p_ver_i1_l1_lat-90+00-90+00.pdf │ │ ├── earth_rt_unmask_u_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_v_lev250+000mbar_i1_l1.pdf │ │ ├── earth_rt_unmask_v_p_ver_i1_l1_lon0+00-360+00.pdf │ │ ├── earth_rt_unmask_w_p_ver_i1_l1_lat-90+00-90+00.pdf │ │ └── earth_rt_unmask_w_p_ver_i1_l1_lon0+00-360+00.pdf │ ├── HD189733b_constg │ │ ├── hd189b_constg_temperature-uv_lev10+000mbar_i30_l30.pdf │ │ ├── hd189b_constg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf │ │ └── hd189b_constg_u_p_ver_i30_l30_lon0+00-360+00.pdf │ ├── HD189733b_fullg │ │ ├── hd189b_fullg_temperature-uv_lev10+000mbar_i30_l30.pdf │ │ ├── hd189b_fullg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf │ │ └── hd189b_fullg_u_p_ver_i30_l30_lon0+00-360+00.pdf │ ├── WASP43b_HELIOS │ │ ├── wasp43b_helios_TSfdirprofPprofile_i1_l1.pdf │ │ ├── wasp43b_helios_TSfnetPprofile_i1_l1.pdf │ │ ├── wasp43b_helios_TSqheatprofPprofile_i1_l1.pdf │ │ ├── wasp43b_helios_qheatprofPprofile_i1_l1.pdf │ │ ├── wasp43b_helios_temperature-uv_lev100+000mbar_i1_l1.pdf │ │ ├── wasp43b_helios_temperature_p_ver_i1_l1_lon0+00-360+00.pdf │ │ └── wasp43b_helios_u_p_ver_i1_l1_lon0+00-360+00.pdf │ ├── WASP43b_example │ │ ├── wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_qheat_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf │ │ ├── wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf │ │ ├── wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf │ │ └── wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf │ └── sync_rot_pbl_test │ │ ├── sync_rot_pbl_Fsens_i10_l60.pdf │ │ ├── sync_rot_pbl_KHver_p_ver_i10_l60_lon0+00-360+00.pdf │ │ ├── sync_rot_pbl_KMver_p_ver_i10_l60_lon0+00-360+00.pdf │ │ ├── sync_rot_pbl_Tsurf_i10_l60.pdf │ │ ├── sync_rot_pbl_potential_temp_p_ver_i10_l60_lon0+00-360+00.pdf │ │ ├── sync_rot_pbl_streamf_ver_i10_l60.pdf │ │ ├── sync_rot_pbl_temperature-uv_lev160+000mbar_i10_l60.pdf │ │ ├── sync_rot_pbl_temperature-uv_lev20+000mbar_i10_l60.pdf │ │ ├── sync_rot_pbl_temperature_p_ver_i10_l60_lon0+00-360+00.pdf │ │ ├── sync_rot_pbl_v_p_ver_i10_l60_lon0+00-360+00.pdf │ │ └── sync_rot_pbl_w_p_ver_i10_l60_lon0+00-360+00.pdf └── Jun2020 │ ├── EarthHS_example │ ├── earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf │ ├── earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf │ ├── earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf │ └── earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf │ ├── EarthRT_example │ ├── earth_rt_mask_streamf_ver_i60_l60.pdf │ ├── earth_rt_mask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_BVprofPprofile_i60_l60.pdf │ ├── earth_rt_unmask_CFLPprofile_i60_l60.pdf │ ├── earth_rt_unmask_DGfdowntotPprofile_i60_l60.pdf │ ├── earth_rt_unmask_DGfdowntot_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_DGfnetPprofile_i60_l60.pdf │ ├── earth_rt_unmask_DGfnet_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_DGfuptotPprofile_i60_l60.pdf │ ├── earth_rt_unmask_DGfuptot_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_DGqheatprofPprofile_i60_l60.pdf │ ├── earth_rt_unmask_PTPprofile_i60_l60.pdf │ ├── earth_rt_unmask_TPprofile_i60_l60.pdf │ ├── earth_rt_unmask_Tsurf_i60_l60.pdf │ ├── earth_rt_unmask_UPprofile_i60_l60.pdf │ ├── earth_rt_unmask_WPprofile_i60_l60.pdf │ ├── earth_rt_unmask_eddyKE_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_eddyMom_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_eddyTempVar_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_eddyTemp_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_insol_i60_l60.pdf │ ├── earth_rt_unmask_pot_vort_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_pot_vort_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_potential_temp_p_ver_i60_l60_lat-90+00-90+00.pdf │ ├── earth_rt_unmask_potential_temp_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_qheatprofPprofile_i60_l60.pdf │ ├── earth_rt_unmask_rela_vort_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_streamf_ver_i60_l60.pdf │ ├── earth_rt_unmask_tau_lwPprofile_i60_l60.pdf │ ├── earth_rt_unmask_temperature-uv_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_temperature_p_ver_i60_l60_lat-90+00-90+00.pdf │ ├── earth_rt_unmask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_u_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_u_p_ver_i60_l60_lat-90+00-90+00.pdf │ ├── earth_rt_unmask_u_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_v_lev250+000mbar_i60_l60.pdf │ ├── earth_rt_unmask_v_p_ver_i60_l60_lon0+00-360+00.pdf │ ├── earth_rt_unmask_w_p_ver_i60_l60_lat-90+00-90+00.pdf │ └── earth_rt_unmask_w_p_ver_i60_l60_lon0+00-360+00.pdf │ └── WASP43b_example │ ├── wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf │ ├── wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf │ ├── wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf │ ├── wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf │ ├── wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf │ ├── wasp43b_qheat_lev1000+000km_i59_l60.pdf │ ├── wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf │ ├── wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf │ ├── wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf │ └── wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf ├── src ├── ESP │ ├── esp_initial.cu │ ├── esp_output.cu │ ├── grid.cu │ ├── insolation.cu │ ├── phy_modules_device.cu │ ├── profx_driver.cu │ ├── profx_globdiag.cu │ ├── profx_sponge.cu │ ├── reduction_add.cu │ ├── simulation_setup.cu │ ├── thor_driver.cu │ └── ultrahot_thermo.cu ├── esp.cu ├── headers │ ├── binary_test.h │ ├── cmdargs.h │ ├── config_file.h │ ├── cuda_device_memory.h │ ├── debug.h │ ├── debug_helpers.h │ ├── define.h │ ├── diagnostics.h │ ├── directories.h │ ├── dyn │ │ ├── phy_modules_device.h │ │ ├── thor_adv_cor.h │ │ ├── thor_auxiliary.h │ │ ├── thor_diff.h │ │ ├── thor_div.h │ │ ├── thor_fastmodes.h │ │ ├── thor_slowmodes.h │ │ └── thor_vertical_int.h │ ├── esp.h │ ├── grid.h │ ├── insolation.h │ ├── iteration_timer.h │ ├── kernel_halo_helpers.h │ ├── log_writer.h │ ├── parser_helpers.h │ ├── phy │ │ ├── GibbsH.txt │ │ ├── dry_conv_adj.h │ │ ├── init_PT_profile.h │ │ ├── profx_acoustic_test.h │ │ ├── profx_auxiliary.h │ │ ├── profx_deepHJ.h │ │ ├── profx_globdiag.h │ │ ├── profx_gwave_test.h │ │ ├── profx_held_suarez.h │ │ ├── profx_shallowHJ.h │ │ ├── profx_sponge.h │ │ ├── profx_tidalearth.h │ │ ├── ultrahot_thermo.h │ │ └── valkyrie_jet_steadystate.h │ ├── phy_modules.h │ ├── physical_constants.h │ ├── reduction_add.h │ ├── reduction_min.h │ ├── simulation_setup.h │ ├── storage.h │ ├── testing.h │ └── vector_operations.h ├── physics │ ├── managers │ │ ├── empty │ │ │ ├── CMakeLists.txt │ │ │ ├── Makefile │ │ │ └── src │ │ │ │ └── phy_modules.cu │ │ └── multi │ │ │ ├── CMakeLists.txt │ │ │ ├── Makefile │ │ │ └── src │ │ │ └── phy_modules.cu │ ├── modules │ │ ├── ifile │ │ │ ├── solar_chem_time.txt │ │ │ └── solar_fEQ_THOR.txt │ │ ├── inc │ │ │ ├── boundary_layer.h │ │ │ ├── chemistry.h │ │ │ ├── chemistry_device.h │ │ │ ├── chemistry_host.h │ │ │ ├── phy_module_base.h │ │ │ ├── profx_RT.h │ │ │ ├── radiative_transfer.h │ │ │ └── thor_chemistry.h │ │ └── src │ │ │ ├── OpaTableKappa.txt │ │ │ ├── OpaTablePressure.txt │ │ │ ├── OpaTableTemperature.txt │ │ │ ├── boundary_layer.cu │ │ │ ├── chemistry.cu │ │ │ └── radiative_transfer.cu │ └── physics_modules.org ├── test │ ├── cmdargs_test.cpp │ ├── cmdargs_test.py │ ├── codetest │ │ ├── test_fun_ptr.cpp │ │ ├── test_tmpl.cpp │ │ └── test_tmpl.h │ ├── config_test.cpp │ ├── directories_test.cpp │ ├── gen_init.cpp │ ├── grid_test.cpp │ ├── reduction_add_test.cu │ └── storage_test.cpp └── utils │ ├── binary_test.cpp │ ├── cmdargs.cpp │ ├── config_file.cpp │ ├── cuda_device_memory.cu │ ├── debug_helpers.cu │ ├── diagnostics.cu │ ├── directories.cpp │ ├── iteration_timer.cpp │ ├── log_writer.cpp │ └── storage.cpp └── tools ├── THORtestrunner.py ├── TPprof_Earth_N1e-2.dat ├── check_cuda.cu ├── compare_merge_dumps.py ├── extrap_top_pressure.py ├── file_helpers.py ├── gen_init_example.py ├── merge_dumps.py ├── postprocessingsteps.py ├── slurm_batch_run.py ├── thor_ic_gen.py └── thor_ic_tpprof_gen.py /.clang-format: -------------------------------------------------------------------------------- 1 | # clang-format configuration file to match THOR's coding conventions 2 | # following doc from 3 | # https://clang.llvm.org/docs/ClangFormatStyleOptions.html 4 | # should have all arguments from above doc valid for C++ 5 | 6 | IndentWidth: 4 7 | 8 | Language: Cpp 9 | 10 | 11 | AccessModifierOffset: -4 12 | 13 | 14 | AlignAfterOpenBracket: Align 15 | 16 | AlignConsecutiveAssignments: true 17 | AlignConsecutiveDeclarations: true 18 | AlignEscapedNewlines: Left 19 | 20 | AlignOperands: true 21 | 22 | AlignTrailingComments: true 23 | AllowAllParametersOfDeclarationOnNextLine: false 24 | 25 | AllowShortBlocksOnASingleLine: false 26 | AllowShortCaseLabelsOnASingleLine: false 27 | 28 | AllowShortFunctionsOnASingleLine: None 29 | 30 | AllowShortIfStatementsOnASingleLine: false 31 | AllowShortLoopsOnASingleLine: false 32 | 33 | AlwaysBreakAfterReturnType: None 34 | 35 | AlwaysBreakBeforeMultilineStrings: false 36 | 37 | # template declaration always on its own line 38 | #-clang-8 AlwaysBreakTemplateDeclarations: Yes 39 | 40 | # arguments and parameters all on one line or all on multiple lines 41 | BinPackArguments: false 42 | BinPackParameters: false 43 | 44 | BreakBeforeBraces: Custom 45 | BraceWrapping: 46 | AfterClass: true 47 | AfterControlStatement: false 48 | AfterEnum: false 49 | AfterFunction: false 50 | AfterNamespace: true 51 | AfterStruct: false 52 | AfterUnion: false 53 | AfterExternBlock: true 54 | BeforeCatch: false 55 | BeforeElse: true 56 | IndentBraces: false 57 | SplitEmptyFunction: false 58 | SplitEmptyRecord: false 59 | SplitEmptyNamespace: true 60 | 61 | BreakBeforeBinaryOperators: NonAssignment 62 | BreakBeforeTernaryOperators: true 63 | BreakConstructorInitializers: AfterColon 64 | #-clang-8 BreakInheritanceList: AfterColon 65 | 66 | BreakStringLiterals: true 67 | 68 | # limit of lign break 69 | # 0: no limit 70 | # the original code, didn't always use it (used for function calls and declarations, not for formulas), should we use one? 71 | ColumnLimit: 100 72 | 73 | # CommentPragmas: str 74 | CompactNamespaces: true 75 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 76 | ConstructorInitializerIndentWidth: 4 77 | 78 | # should we indent? we'd like to align on above line 79 | ContinuationIndentWidth: 4 80 | 81 | Cpp11BracedListStyle: true 82 | DerivePointerAlignment: true 83 | 84 | # DisableFormat: false 85 | 86 | # experimental, might disappear tries to decide bin (Arguments, params) packing with 87 | # what is found in the file. 88 | # disable if weird behaviour 89 | ExperimentalAutoDetectBinPacking: true 90 | 91 | FixNamespaceComments: true 92 | 93 | # ForEachMacros 94 | 95 | IncludeBlocks: Preserve 96 | 97 | # to use when IncludeBloscks: Regroup 98 | #IncludeCategories 99 | 100 | IndentCaseLabels: true 101 | 102 | IndentPPDirectives: AfterHash 103 | 104 | 105 | IndentWrappedFunctionNames: false 106 | 107 | KeepEmptyLinesAtTheStartOfBlocks: true 108 | 109 | MaxEmptyLinesToKeep: 2 110 | 111 | NamespaceIndentation: None 112 | 113 | # TODO: not sure how this is used 114 | # PenaltyBreakAssignment: 0 115 | # PenaltyBreakBeforeFirstCallParameter: 0 116 | # PenaltyBreakComment: 0 117 | # PenaltyBreakFirstLessLess: 0 118 | # PenaltyBreakString: 0 119 | # PenaltyBreakTemplateDeclaration: 0 120 | # PenaltyExcessCharacter: 0 121 | # PenaltyReturnTypeOnItsOwnLine: 0 122 | 123 | PointerAlignment: Right 124 | 125 | # not sure what this does 126 | # RawStringFormats 127 | 128 | # should we reflow long comments? 129 | ReflowComments: false 130 | 131 | 132 | SortIncludes: true 133 | SortUsingDeclarations: true 134 | SpaceAfterCStyleCast: false 135 | SpaceAfterTemplateKeyword: false 136 | SpaceBeforeAssignmentOperators: true 137 | #-clang-8 SpaceBeforeCpp11BracedList: true 138 | #-clang-8 SpaceBeforeCtorInitializerColon: false 139 | #-clang-8 SpaceBeforeInheritanceColon: false 140 | 141 | # looks like if has no space, for has space... 142 | SpaceBeforeParens: true 143 | #-clang-8 SpaceBeforeRangeBasedForLoopColon: true 144 | 145 | SpaceInEmptyParentheses: false 146 | 147 | SpacesBeforeTrailingComments: 1 148 | 149 | SpacesInAngles: false 150 | SpacesInCStyleCastParentheses: false 151 | SpacesInParentheses: false 152 | SpacesInSquareBrackets: false 153 | 154 | Standard: Cpp11 155 | 156 | 157 | # StatementMacros 158 | 159 | TabWidth: 4 160 | UseTab: Never 161 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: 'readability-' 2 | # 'clang-diagnostic-*,clang-analyzer-*,bugprone-*,cppcoreguidelines-*,misc-*,modernize-*,performance-*,readability-*' 3 | WarningsAsErrors: '' 4 | HeaderFilterRegex: '' 5 | CheckOptions: 6 | - { key: readability-identifier-naming.NamespaceCase, value: lower_case } 7 | - { key: readability-identifier-naming.ClassCase, value: CamelCase } 8 | - { key: readability-identifier-naming.EnumCase, value: CamelCase } 9 | - { key: readability-identifier-naming.StructCase, value: CamelCase } 10 | - { key: readability-identifier-naming.StructPrefix, value: struct } 11 | - { key: readability-identifier-naming.ClassMethod, value: lower_case } 12 | - { key: readability-identifier-naming.Constant, value: UPPER_CASE } 13 | - { key: readability-identifier-naming.GlobalFunction, value: lower_case } 14 | - { key: readability-identifier-naming.ClassMethod, value: lower_case } 15 | - { key: readability-identifier-naming.Method, value: lower_case } 16 | 17 | # - { key: readability-identifier-naming.PrivateMemberPrefix, value: } 18 | # - { key: readability-identifier-naming.StructCase, value: CamelCase } 19 | # - { key: readability-identifier-naming.FunctionCase, value: lower_case } 20 | # - { key: readability-identifier-naming.VariableCase, value: lower_case } 21 | # - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } 22 | 23 | # m(Namespace) \ 24 | # m(InlineNamespace) \ 25 | # m(EnumConstant) \ 26 | # m(ConstexprVariable) \ 27 | # m(ConstantMember) \ 28 | # m(PrivateMember) \ 29 | # m(ProtectedMember) \ 30 | # m(PublicMember) \ 31 | # m(Member) \ 32 | # m(ClassConstant) \ 33 | # m(ClassMember) \ 34 | # m(GlobalConstant) \ 35 | # m(GlobalVariable) \ 36 | # m(LocalConstant) \ 37 | # m(LocalVariable) \ 38 | # m(StaticConstant) \ 39 | # m(StaticVariable) \ 40 | # m(Constant) \ 41 | # m(Variable) \ 42 | # m(ConstantParameter) \ 43 | # m(ParameterPack) \ 44 | # m(Parameter) \ 45 | # m(AbstractClass) \ 46 | # m(Struct) \ 47 | # m(Class) \ 48 | # m(Union) \ 49 | # m(Enum) \ 50 | # m(GlobalFunction) \ 51 | # m(ConstexprFunction) \ 52 | # m(Function) \ 53 | # m(ConstexprMethod) \ 54 | # m(VirtualMethod) \ 55 | # m(ClassMethod) \ 56 | # m(PrivateMethod) \ 57 | # m(ProtectedMethod) \ 58 | # m(PublicMethod) \ 59 | # m(Method) \ 60 | # m(Typedef) \ 61 | # m(TypeTemplateParameter) \ 62 | # m(ValueTemplateParameter) \ 63 | # m(TemplateTemplateParameter) \ 64 | # m(TemplateParameter) \ 65 | # m(TypeAlias) \ 66 | # m(MacroDefinition) \ 67 | 68 | 69 | # AnalyzeTemporaryDtors: false 70 | # FormatStyle: none 71 | # User: nab 72 | # CheckOptions: 73 | # - key: google-readability-braces-around-statements.ShortStatementLines 74 | # value: '1' 75 | # - key: google-readability-function-size.StatementThreshold 76 | # value: '800' 77 | # - key: google-readability-namespace-comments.ShortNamespaceLines 78 | # value: '10' 79 | # - key: google-readability-namespace-comments.SpacesBeforeComments 80 | # value: '2' 81 | # - key: modernize-loop-convert.MaxCopySize 82 | # value: '16' 83 | # - key: modernize-loop-convert.MinConfidence 84 | # value: reasonable 85 | # - key: modernize-loop-convert.NamingStyle 86 | # value: CamelCase 87 | # - key: modernize-pass-by-value.IncludeStyle 88 | # value: llvm 89 | # - key: modernize-replace-auto-ptr.IncludeStyle 90 | # value: llvm 91 | # - key: modernize-use-nullptr.NullMacros 92 | # value: 'NULL' -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | 3 | select = E,W,F,C90 4 | ignore = E501,W503 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # from http://timstaley.co.uk/posts/making-git-and-jupyter-notebooks-play-nice/ 2 | # attribute to clean up jupyther notebook with jq before submitting 3 | # add this to your ~/.gitconfig or .git/config 4 | # 5 | # 6 | 7 | # [filter "nbstrip_full"] 8 | # clean = "jq --indent 1 \ 9 | # '(.cells[] | select(has(\"outputs\")) | .outputs) = [] \ 10 | # | (.cells[] | select(has(\"execution_count\")) | .execution_count) = null \ 11 | # | .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \ 12 | # | .cells[].metadata = {} \ 13 | # '" 14 | # # use filter file in root dir 15 | # clean = "jq --indent 1 -f .ipynb_strip_filter " 16 | # 17 | # smudge = cat 18 | # required = true 19 | 20 | # 21 | # can whitelist specific notebooks in a directory with another .gitattributes file 22 | # in that dir with 23 | # *.ipynb -filter 24 | 25 | 26 | *.ipynb filter=nbstrip_full 27 | -------------------------------------------------------------------------------- /.github/workflows/test_compile.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the main branch 8 | push: 9 | branches: [ '*' ] 10 | pull_request: 11 | branches: [ '*' ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-20.04 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | 28 | 29 | # Runs a set of commands using the runners shell 30 | - name: Test compile 31 | run: | 32 | sudo apt-get install libhdf5-dev libhdf5-103 libhdf5-serial-dev libhdf5-cpp-103 cmake g++-8 33 | export CUDA=10.1.105-1 34 | export CUDA_SHORT=10.1 35 | export UBUNTU_VERSION=ubuntu1804 36 | INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb 37 | wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} 38 | sudo dpkg -i ${INSTALLER} 39 | wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub 40 | sudo apt-key add 7fa2af80.pub 41 | sudo apt update -qq 42 | sudo apt install -y cuda-core-${CUDA_SHORT/./-} cuda-cudart-dev-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-} 43 | sudo apt clean 44 | CUDA_HOME=/usr/local/cuda-${CUDA_SHORT} 45 | LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} 46 | PATH=${CUDA_HOME}/bin:${PATH} 47 | PATH=${PATH}:${PWD} 48 | make release ccbin:='-ccbin g++-8' 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build files from cmake 2 | build/* 3 | # python temporary files 4 | *.pyc 5 | *.py~ 6 | *__pycache__/* 7 | # editor temporary files 8 | *~ 9 | *# 10 | # object and binaries 11 | obj/* 12 | bin/* 13 | # local config 14 | Makefile.conf 15 | # submodule binary and object files 16 | src/physics/managers/empty/libphy_modules.a 17 | src/physics/managers/empty/obj/* 18 | src/physics/managers/empty/*.o 19 | src/physics/managers/multi/libphy_modules.a 20 | src/physics/managers/multi/obj/* 21 | src/physics/managers/multi/*.o 22 | # output data 23 | results*/ 24 | # profiling data 25 | profiling/* 26 | # compile command database 27 | compile_commands.json 28 | # version information generated at compile time 29 | include/git-rev.h 30 | # jupyter notebooks temp checkpoints directories 31 | **/.ipynb_checkpoints/ 32 | 33 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Alfrodull"] 2 | path = Alfrodull 3 | url = https://github.com/exoclime/Alfrodull.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /.ipynb_strip_filter: -------------------------------------------------------------------------------- 1 | (.cells[] | select(has("outputs")) | .outputs) = [] | (.cells[] | select(has("execution_count")) | .execution_count) = null | .metadata = {"language_info": {"name": "python", "pygments_lexer": "ipython3"}} | .cells[].metadata = {} 2 | -------------------------------------------------------------------------------- /Makefile.conf.template: -------------------------------------------------------------------------------- 1 | # Local makefile configuration 2 | $(info Local Config) 3 | 4 | SM:=35 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # THOR # 2 | 3 | ![CI](https://github.com/exoclime/THOR/workflows/CI/badge.svg) 4 | 5 | ### Flexible Global Circulation Model to Explore Planetary Atmospheres 6 | 7 | *THOR* is a GCM that solves the three-dimensional non-hydrostatic Euler equations on an icosahedral grid. *THOR* was designed to run on Graphics Processing Units (GPUs). 8 | 9 | If you use this code please cite: [Mendonça, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016](http://iopscience.iop.org/article/10.3847/0004-637X/829/2/115/meta) 10 | 11 | If using version 2.0 or later, please also cite: [Deitrick, R., Mendonça, J.M., Schroffenegger, U., Grimm, S.L., Tsai, S.-M., & Heng, K., ApJS, 248, 2, 2020](https://iopscience.iop.org/article/10.3847/1538-4365/ab930e) 12 | 13 | Current code owners: Joao Mendonca: joao.mendonca@space.dtu.dk, Russell Deitrick: russell.deitrick@csh.unibe.ch, Urs Schroffenegger: urs.schroffenegger@csh.unibe.ch 14 | 15 | ###### Copyright (C) 2017-2021 Exoclimes Simulation Platform ###### 16 | 17 | ### BUILD & RUN THOR (TL;DR instructions) 18 | 19 | ``` 20 | $ sudo apt-get install git make gcc g++ cmake nvidia-cuda-toolkit nvidia-utils-390 libhdf5-dev libhdf5-100 libhdf5-serial-dev libhdf5-cpp-100 21 | $ git clone https://github.com/exoclime/THOR.git 22 | $ cd THOR 23 | $ cp Makefile.conf.template Makefile.conf 24 | ``` 25 | 26 | Find the `SM` value of your Nvidia GPU. Decide if you want to run without any physics module `empty` physics module, or the one with radiative transfer, the `multi` module. Then open `Makefile.conf` in a text editor and edit like so: 27 | 28 | ``` 29 | MODULES_SRC := src/physics/managers// 30 | SM:= 31 | ``` 32 | 33 | Set `module_type`to `empty` (default) or `multi`. 34 | 35 | Then head back to the command line and 36 | 37 | ``` 38 | $ make -j8 release 39 | ``` 40 | 41 | Finally, run 42 | ``` 43 | $ bin/esp ifile/ 44 | ``` 45 | 46 | ### Furthur information 47 | 48 | [View our wiki pages here](https://github.com/exoclime/THOR/wiki) 49 | 50 | [Tutorial from ESP Summer School 2019](https://github.com/exoclime/THOR/wiki/tutorial/usingthor.pdf) 51 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # changes since v2.0.0 2 | 3 | * argument parser fails and complains when wrong number of argument for keys 4 | * added test script to run multiple sims 5 | * fix conservation output (was not copied back before output) 6 | * clean up RT module startup output 7 | * added new routines to mjolnir/hamarr (KE, SR) 8 | * fixed issues in regrid 9 | * changed many of the plot functions to use regrid data (some still need work) 10 | * added entropy to global & grid conservation outputs 11 | * fixed pot temp update error in Density_Pressure_Eqs_Poles *major* 12 | * started generalizing plot functions in hamarr to make adding new quantities easier 13 | * added acoustic wave experiment from Tomita & Satoh 2004 14 | * added gravity wave experiment from Tomita & Satoh 2004 15 | * added python scripts to allow editing of initial h5 files (preliminary) 16 | * removed TPprof option, which didn't work as desired anyway: users should use the python tools to edit initial h5 files if non-isothermal initial state is needed 17 | * removal of spurious vertical component of horizontal momentum diffusion has been moved 18 | to a separate function "Correct_Horizontal" to avoid potential issues related to the order 19 | in which threads are called 20 | * incorrect diffusion quantity (diffmh_d) was being passed to Momentum_Eq in the dynamical core, changed now to correct value (DivM_d) 21 | * added crash_report tool that dumps location of nans when the model crashes 22 | * further updates to python plotting tools to make them more flexible 23 | * added "custom_example.py" to mjolnir to demonstrate how to make multipanel plots with the python tools 24 | * grid output now contains differential operators grad, div, and vertical component of curl (the latter is not used by the model, but may be useful in post-processing) 25 | * added new features to double-grey RT: latitude variations, power law scaling of optical 26 | depth, and surface heating 27 | * added boundary layer module which calculates drag against the lower surface (rayleigh drag only for now) 28 | * changed name of 'diff_fac' input parameter to 'diff_ang' to be more consistent ('diff_ang' = 1/diffusivity factor) 29 | * fixed incompatibility with recent versions (> 1.10.1) of hdf5 libraries 30 | * updated behavior of NonHydro = false and DeepModel = false model options to be consistent with White+ 2005 31 | * smoothed temperature forcing of deep hj test (still is not extremely reliable, however) 32 | * added numerous features to Mjolnir python code, including a separate regrid script that takes additional arguments 33 | * added option to output mean values of main diagnostics over an output interval 34 | * moved sponge layer from profx (end of time step) to dynamical core (slow modes), which allows damping to work more effectively 35 | * moved heating from RT into dynamical core (fast modes and slow modes) 36 | * added output of sw flux in RT module, which was missing before 37 | * fixed bugs in RT module, including an important one that led to spurious extra heating and cooling of surface 38 | * deprecated Tlow in favor of Tint, which is treated as an additional flux rather than a boundary condition 39 | * corrected heat capacity in RT calculation, as appropriate for updating pressure rather than temperature 40 | * added pgrid utility to mjolnir/regrid, which must be used to determine a fixed pressure grid to use for interpolation before doing regrid operation (this ensures that all regrid files are utilizing the same pressure grid) 41 | * changed regrid to open only one file at a time to prevent overloading memory 42 | * corrected volume calculation for shallow model conservation outputs 43 | * computing sponge averages only once per time step to speed up model (testing this!) 44 | -------------------------------------------------------------------------------- /ic_special/gen_ic_deep/esp_initial.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ic_special/gen_ic_deep/esp_initial.h5 -------------------------------------------------------------------------------- /ic_special/gen_ic_deep/esp_initial_planet.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ic_special/gen_ic_deep/esp_initial_planet.h5 -------------------------------------------------------------------------------- /ic_special/gen_ic_earth/esp_initial.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ic_special/gen_ic_earth/esp_initial.h5 -------------------------------------------------------------------------------- /ic_special/gen_ic_earth/esp_initial_planet.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ic_special/gen_ic_earth/esp_initial_planet.h5 -------------------------------------------------------------------------------- /ifile/esp_initial.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ifile/esp_initial.h5 -------------------------------------------------------------------------------- /ifile/esp_initial_planet.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/ifile/esp_initial_planet.h5 -------------------------------------------------------------------------------- /mjolnir/custom_example.py: -------------------------------------------------------------------------------- 1 | #---- example of creating custom plots with the mjolnir library---------------- 2 | #---- code by Russell Deitrick ------------------------------------------------ 3 | 4 | import hamarr as ham 5 | import matplotlib.pyplot as plt 6 | import numpy as np 7 | 8 | outall = ham.GetOutput('earth_hs','Earth',10,10,openrg=1) 9 | 10 | input = outall.input 11 | grid = outall.grid 12 | output = outall.output 13 | rg = outall.rg 14 | 15 | sigmaref = np.linspace(input.P_Ref,np.float(50)*100,20)/input.P_Ref 16 | 17 | fig, ax = plt.subplots(nrows=2, ncols=2) 18 | fig.set_size_inches(16,14) 19 | 20 | # plot zonal mean temperature 21 | z = {'value':rg.Temperature, 'label':r'Temperature (K)', 'name':'temperature', 'cmap':'magma'} 22 | ham.vertical_lat(input,grid,output,rg,sigmaref,z,slice=(0,360),save=False,axis=ax[0,0]) 23 | ax[0,0].set_ylim(1,0.05) #manually adjust axis range 24 | 25 | # plot zonal mean potential temperature (first we gotta calculate it) 26 | kappa_ad = input.Rd/input.Cp # adiabatic coefficient 27 | pt = rg.Temperature*(rg.Pressure/input.P_Ref)**(-kappa_ad) 28 | z = {'value':pt, 'label':r'Potential Temperature (K)', 'name':'PT', 'cmap':'magma'} 29 | ham.vertical_lat(input,grid,output,rg,sigmaref,z,slice=(0,360),save=False,axis=ax[1,0]) 30 | ax[1,0].set_ylim(1,0.05) 31 | 32 | # zonal mean zonal wind 33 | z = {'value':rg.U, 'label':r'Zonal Wind Speed (m s$^{-1}$)', 'name':'u', 'cmap':'viridis'} 34 | ham.vertical_lat(input,grid,output,rg,sigmaref,z,slice=(0,360),axis=ax[0,1],save=False) 35 | ax[0,1].set_ylim(1,0.05) 36 | 37 | # zonal mean vertical wind over one hemisphere 38 | ham.vertical_lat(input,grid,output,rg,sigmaref,z,slice=(-90,90),axis=ax[1,1],save=False) 39 | ax[1,1].set_ylim(1,0.05) 40 | 41 | plt.savefig('custom_figure.pdf') 42 | plt.close() 43 | -------------------------------------------------------------------------------- /mjolnir/file_helpers.py: -------------------------------------------------------------------------------- 1 | #---- code by Urs Schroffenegger ----------------------------------------------- 2 | 3 | import re 4 | import pathlib 5 | 6 | 7 | def get_path_matching_regex(root_dir_, pattern): 8 | """ 9 | Find all files or directories with name matching the regex in directory 10 | 11 | Parameters 12 | ---------- 13 | root_dir_: path to directory to search 14 | pattern: regexp pattern to match, as used by `re` module 15 | 16 | Returns 17 | ------- 18 | files: list of pathlib Path files path matching the pattern 19 | """ 20 | matched = get_path_matching_regex_with_groups(root_dir_, pattern) 21 | files = [] 22 | for m in matched: 23 | files.append(m['path']) 24 | 25 | return files 26 | 27 | 28 | def get_path_matching_regex_with_groups(root_dir_, pattern): 29 | """ 30 | Find all files or directories with name matching the regex in directory, 31 | returning the groups of match. 32 | 33 | Parameters 34 | ---------- 35 | root_dir_: path to directory to search 36 | pattern: regexp pattern to match, as used by `re` module 37 | 38 | Returns 39 | ------- 40 | files: list of dictionnaries for files matching the pattern 41 | * 'path': pathlib.Path object for matching groups 42 | * 'groups': re.Match groups for groups in regexp 43 | 44 | Example 45 | ------- 46 | in directory with 47 | 48 | README.txt 49 | file_00.txt 50 | file_01.txt 51 | file_42.doc 52 | file_AA.txt 53 | 54 | calling 55 | 56 | get_path_matching_regex_with_groups(".", "file_(\d+).txt") 57 | 58 | 59 | returns: 60 | 61 | 62 | [{'path': PosixPath('/.../files_00.txt'), 'groups': ('00',)}, 63 | {'path': PosixPath('/.../files_01.txt'), 'groups': ('01',)}] 64 | 65 | 66 | 67 | """ 68 | search_regex = re.compile(pattern) 69 | root_dir = pathlib.Path(root_dir_) 70 | 71 | files = [] 72 | for p in sorted(root_dir.glob("*")): 73 | m = search_regex.fullmatch(p.name) 74 | if m is not None: 75 | files.append({'path': p, 'groups': m.groups()}) 76 | 77 | return files 78 | -------------------------------------------------------------------------------- /mjolnir/mjolnir: -------------------------------------------------------------------------------- 1 | mjolnir.py -------------------------------------------------------------------------------- /mjolnir/mjolnir.m: -------------------------------------------------------------------------------- 1 | %------ code by Joao Mendonca --------------------------------------------- 2 | 3 | function mjolnir 4 | 5 | format long; 6 | 7 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 | % 9 | % Options 10 | % 11 | % nview plot 12 | % 1 Averaged (time and longitude) zonal winds. 13 | % 2D Map Latitude Vs Pressure. 14 | % 15 | % 2 Averaged (time and longitude) temperatures. 16 | % 2D Map Latitude Vs Pressure. 17 | % 18 | % 3 Averaged (time) temperature and wind field. 19 | % 2D Map Longitude Vs Latitude. 20 | % 21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 22 | 23 | nview = 3 ; % type of plot 24 | ntsi = 10 ; % initial file id number 25 | nts = 10 ; % last file id number 26 | 27 | simulation_ID = 'Earth'; 28 | 29 | %%%%%%%%%% 30 | % Planet % 31 | %%%%%%%%%% 32 | 33 | fileh5 = ['../results/esp_output_' simulation_ID '.h5']; 34 | % h5disp(fileh5) 35 | A = h5read(fileh5,'/A' ); 36 | Rd = h5read(fileh5,'/Rd' ); 37 | Omega = h5read(fileh5,'/Omega' ); 38 | P_Ref = h5read(fileh5,'/P_Ref' ); 39 | Top_altitude = h5read(fileh5,'/Top_altitude'); 40 | Cp = h5read(fileh5,'/Cp' ); 41 | 42 | %%%%%%%% 43 | % Grid % 44 | %%%%%%%% 45 | 46 | fileh5 = ['../results/esp_output_grid_' simulation_ID '.h5']; 47 | % h5disp(fileh5) 48 | Altitude = h5read(fileh5,'/Altitude' ); 49 | Altitudeh = h5read(fileh5,'/Altitudeh'); 50 | areasT = h5read(fileh5,'/areasT'); 51 | lonlat = h5read(fileh5,'/lonlat'); 52 | point_num = h5read(fileh5,'/point_num'); 53 | nv = h5read(fileh5,'/nv'); 54 | nvi= nv+1; 55 | 56 | lon = zeros(point_num,1); 57 | lat = zeros(point_num,1); 58 | for i = 1:point_num 59 | lon(i) = lonlat((i-1)*2 + 1); 60 | if(lon(i) < 0) 61 | lon(i) = lonlat((i-1)*2 + 1) + 2*pi; 62 | end 63 | lat(i) = lonlat((i-1)*2 + 2); 64 | end 65 | 66 | %%%%%%%%%%%%%%% 67 | % Diagnostics % 68 | % %%%%%%%%%%%%% 69 | 70 | 71 | % Initialize arrays 72 | Rho = zeros(point_num,nv,ntsi-nts+1); 73 | Pressure = zeros(point_num,nv,ntsi-nts+1); 74 | Mh = zeros(3,point_num,nv,ntsi-nts+1); 75 | Wh = zeros(point_num,nvi,ntsi-nts+1); 76 | 77 | % Read model results 78 | for t = ntsi:nts 79 | ts= num2str(t); 80 | fileh5 = ['../results/esp_output_' simulation_ID '_' ts '.h5']; 81 | % h5disp(fileh5) 82 | Rhoi = h5read(fileh5,'/Rho' ); 83 | Pressurei= h5read(fileh5,'/Pressure' ); 84 | Mhi = h5read(fileh5,'/Mh' ); 85 | Whi = h5read(fileh5,'/Wh' ); 86 | 87 | for i = 1:point_num 88 | for j = 1:nv 89 | Rho(i,j,t-ntsi+1) = Rhoi((i-1)*nv + j); 90 | Pressure(i,j,t-ntsi+1) = Pressurei((i-1)*nv + j); 91 | for k = 1:3 92 | Mh(k,i,j,t-ntsi+1) = Mhi((i-1)*nv*3 + (j-1)*3 + k); 93 | end 94 | end 95 | end 96 | 97 | for i = 1:point_num 98 | for j = 1:nv+1 99 | Wh(i,j,t-ntsi+1) = Whi((i-1)*nvi + j); 100 | end 101 | end 102 | end 103 | 104 | %%%%%%%%% 105 | % Plots % 106 | %%%%%%%%% 107 | 108 | % Sigma values for the plotting. 109 | sigmaref = [1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.05]; 110 | 111 | if(nview == 1) 112 | % Averaged Zonal winds (latitude vs pressure) 113 | u(Mh, Rho, Pressure, lon, lat, point_num, nts-ntsi+1, P_Ref, nv, sigmaref); 114 | elseif(nview == 2) 115 | % Averaged temperature (latitude vs pressure) 116 | temperature(Rho, Pressure, lon, lat, point_num, nts-ntsi+1, Rd, P_Ref, nv, sigmaref); 117 | elseif(nview == 3) 118 | % Averaged temperature and wind field (longitude vs latitude) 119 | % PR_LV - Pressure level (Pa) 120 | PR_LV = 25000.0; 121 | temperature_u_lev(Mh, Rho, Pressure, lon, lat, point_num, nts-ntsi+1, Rd, nv, PR_LV); 122 | end 123 | 124 | end 125 | -------------------------------------------------------------------------------- /mjolnir/mjolnir.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | #---- code by Russell Deitrick ------------------------------------------------ 4 | 5 | import numpy as np 6 | import argparse 7 | from importlib import reload 8 | import time 9 | import mjolnir_plot_helper as mph 10 | 11 | first = time.time() 12 | ########################################################################### 13 | # 14 | # Options 15 | # 16 | # pview plot 17 | # uver Averaged (time and longitude) zonal winds. 18 | # 2D Map Latitude Vs Pressure. 19 | # 20 | # Tver Averaged (time and longitude) temperatures. 21 | # 2D Map Latitude Vs Pressure. 22 | # 23 | # Tulev Averaged (time) temperature and wind field. 24 | # 2D Map Longitude Vs Latitude. 25 | # 26 | # PTver Averaged (time and longitude) potential temperatures. 27 | # 2D Map Latitude Vs Pressure. 28 | # 29 | # ulev Averaged (time) wind fields in long and lat. 30 | # 2D Map Longitude Vs Latitude. 31 | # 32 | # PVver Averaged (time and longitude) potential vorticity. 33 | # 2D Map Latitude Vs Pressure. 34 | # 35 | # PVlev Averaged (time) potential vorticity. 36 | # 2D Map Longitude Vs Latitude. 37 | ########################################################################### 38 | 39 | parser = argparse.ArgumentParser() 40 | parser.add_argument('pview', metavar='nview', nargs='*', help='Type of plot to make') 41 | parser.add_argument("-f", "--file", nargs=1, default=['results'], help='Results folder to use for plotting') 42 | parser.add_argument("-s", "--simulation_ID", nargs=1, default=['auto'], help='Name of simulation (e.g., planet name)') 43 | parser.add_argument("-i", "--initial_file", nargs=1, default=[10], type=int, help='Initial file id number (integer)') 44 | parser.add_argument("-l", "--last_file", nargs=1, default=['init'], type=int, help='Last file id number (integer)') 45 | parser.add_argument("-lev", "--horizontal_lev", nargs=1, default=[2.5e2], help='Horizonal level to plot in temperature/velocity/vorticity field (mbar or km)') 46 | parser.add_argument("-vtop", "--vertical_top", nargs=1, default=['default'], help='Location of top of plot (vertical type) in mbar (pressure) or fractional height (height)') 47 | parser.add_argument("-coord", "--coordinate_sys", nargs=1, default=['icoh'], help='For KE spectrum, use either icoh grid or llp grid') 48 | parser.add_argument("-ladj", "--lmax_adjust", nargs=1, default=[0], help='For KE spectrum, icoh grid, adjust number of wave numbers to fit') 49 | parser.add_argument("-slice", "--slice", nargs='+', default=['default'], help='Plot a long/lat slice or average over all values') 50 | parser.add_argument("-mt", "--maketable", action='store_true', help='Print a table in text file of plot data') 51 | parser.add_argument("-no-log", "--no_pressure_log", action='store_true', help='Switch off log coordinates in pressure (vertical)') 52 | parser.add_argument("-llswap", "--latlonswap", action='store_true', help='Swap latitude and longitude axes (horizontal plots)') 53 | parser.add_argument("-vc", "--vcoord", nargs=1, default=['pressure'], help='Vertical coordinate to use (pressure or height)') 54 | parser.add_argument("-pgrid", "--pgrid_ref", nargs=1, default=['auto'], help='Reference file for pressure grid') 55 | parser.add_argument("-clevs", "--clevels", nargs='+', default=[40], help='Set color contour levels') 56 | args = parser.parse_args() 57 | 58 | mph.make_plot(args) 59 | 60 | 61 | last = time.time() 62 | print(last - first) 63 | -------------------------------------------------------------------------------- /mjolnir/muninn: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | #---- code by Urs Schroffenegger ---------------------------------------------- 5 | 6 | """Script to run the jupyter notebooks to create a report.""" 7 | 8 | import argparse 9 | 10 | import nbformat 11 | 12 | from traitlets.config import Config 13 | from jupyter_contrib_nbextensions.nbconvert_support import TocExporter 14 | 15 | from nbparameterise import ( 16 | extract_parameters, replace_definitions, parameter_values 17 | ) 18 | 19 | import pathlib 20 | 21 | import datetime 22 | import os 23 | 24 | parser = argparse.ArgumentParser(description='THOR report builder') 25 | 26 | parser.add_argument("data_folder", 27 | action='store', 28 | default="./Alfrodull/experiments/ubelix/walf_spinup", 29 | help="folder to look for data") 30 | parser.add_argument('-j', '--jupnb', 31 | default="./mjolnir/mjolnyr.ipynb", 32 | action='store', 33 | help="jupyter notebook to run") 34 | parser.add_argument('--title', 35 | default="Report", action='store', 36 | type=str, 37 | help="notebook title appearing in browser") 38 | parser.add_argument('-t', '--timeout', 39 | default=5400, action='store', 40 | type=int, 41 | help="notebook cell execution timeout") 42 | 43 | args = parser.parse_args() 44 | 45 | base_folder = pathlib.Path(args.data_folder).resolve() 46 | notebook_file = pathlib.Path(args.jupnb).resolve() 47 | 48 | notebook_folder = notebook_file.parent.resolve() 49 | output_path_abs = base_folder / "report" 50 | if not output_path_abs.exists(): 51 | output_path_abs.mkdir(exist_ok=True, parents=True) 52 | 53 | nb_timeout = args.timeout 54 | 55 | start_time = datetime.datetime.now() 56 | print(f"started {notebook_file} on {start_time} on {base_folder}") 57 | notebook_code = notebook_file.open().read() 58 | 59 | notebook = nbformat.reads(notebook_code, as_version=4) 60 | if args.title == "Report": 61 | try: 62 | notebook['metadata']['title'] = base_folder.resolve().parts[-1] 63 | except: 64 | print("Failed guessing target directory name for title, using default") 65 | notebook['metadata']['title'] = args.title 66 | else: 67 | notebook['metadata']['title'] = args.title 68 | 69 | c = Config({'ExecutePreprocessor': {'enabled': True, 70 | 'timeout': nb_timeout}, 71 | 'ExtractOutputPreprocessor': {'enabled': True}, 72 | 'TemplateExporter': { 73 | # 'exclude_code_cell': True, 74 | 'exclude_input': True 75 | } 76 | } 77 | ) 78 | 79 | html_exporter = TocExporter(config=c, timeout=-1) 80 | 81 | orig_parameters = extract_parameters(notebook) 82 | 83 | config_dict = dict( 84 | data_path=str(base_folder), 85 | mjolnir_path=str(notebook_folder), 86 | output_path="./", 87 | FIGSIZE_x=15, 88 | FIGSIZE_y=12 89 | ) 90 | 91 | params = parameter_values(orig_parameters, 92 | **config_dict) 93 | 94 | # Make a notebook object with these definitions, and execute it. 95 | new_nb = replace_definitions(notebook, params, execute=False) 96 | 97 | os.chdir(output_path_abs) 98 | (body, resources) = html_exporter.from_notebook_node(new_nb) 99 | # print("Resources keys") 100 | # print(resources.keys()) 101 | 102 | # print("Resources outputs keys") 103 | # print(resources['outputs'].keys()) 104 | # print("inlining") 105 | # print(resources["inlining"]) 106 | # print("metadata") 107 | # print(resources["metadata"]) 108 | for k, v in resources['outputs'].items(): 109 | print("saving ", k) 110 | f = open(k, "wb") 111 | f.write(v) 112 | f.close() 113 | 114 | 115 | output_file = output_path_abs / "mjolnyr_report.html" 116 | output_file.open("w").write(body) 117 | stop_time = datetime.datetime.now() 118 | 119 | delta = stop_time - start_time 120 | 121 | print(f"ran muninn in {delta}") 122 | -------------------------------------------------------------------------------- /mjolnir/pgrid: -------------------------------------------------------------------------------- 1 | pgrid.py -------------------------------------------------------------------------------- /mjolnir/pgrid.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | #---- code by Russell Deitrick ------------------------------------------------ 4 | 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | import hamarr as ham 8 | import sys 9 | import argparse 10 | import h5py 11 | from imp import reload 12 | reload(ham) 13 | import time 14 | import subprocess as spr 15 | 16 | first = time.time() 17 | ########################################################################### 18 | # Script function purely for setting up the pressure levels used in 19 | # regridding. 20 | # This makes it so that the pressure grid is uniform in time in the 21 | # regridded files. 22 | # Reads in files and computes the average pressure in each level, then 23 | # averages them in time. Writes the resulting mean pressures 24 | # to a plain text file. 25 | ########################################################################### 26 | 27 | 28 | parser = argparse.ArgumentParser() 29 | parser.add_argument('resultsf',metavar='nview',nargs='*',help='Results directory') 30 | parser.add_argument("-s","--simulation_ID",nargs=1,default=['auto'],help='Name of simulation (e.g., planet name)') 31 | parser.add_argument("-i","--initial_file",nargs=1,default=[10],type=int,help='Initial file id number (integer)') 32 | parser.add_argument("-l","--last_file",nargs=1,default=['init'],type=int,help='Last file id number (integer)') 33 | parser.add_argument("-stride","--stride",nargs=1,default=[1],type=int,help='Stride (cadence) of files to use to set grid') 34 | parser.add_argument("-w","--overwrite",action='store_true',help='force overwrite existing pgrid file') 35 | args = parser.parse_args() 36 | resultsf = args.resultsf[0] 37 | ntsi = args.initial_file[0] # initial file id number 38 | 39 | if args.last_file[0] == 'init': 40 | nts = ntsi 41 | else: 42 | nts = args.last_file[0] # last file id number 43 | 44 | if ntsi > nts: 45 | nts = ntsi 46 | 47 | if args.simulation_ID[0] == 'auto': 48 | outname = spr.check_output('ls '+resultsf+'/esp_output_*_0.h5',shell=True) 49 | file0 = outname.decode().split(sep='/')[-1] 50 | simulation_ID = file0.split(sep='_')[2] 51 | else: 52 | simulation_ID = args.simulation_ID[0] 53 | 54 | stride = args.stride[0] 55 | 56 | ham.define_Pgrid(resultsf,simulation_ID,ntsi,nts,stride,overwrite=args.overwrite) 57 | 58 | last = time.time() 59 | print(last-first) 60 | -------------------------------------------------------------------------------- /mjolnir/regrid: -------------------------------------------------------------------------------- 1 | regrid.py -------------------------------------------------------------------------------- /mjolnir/regrid.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | #---- code by Russell Deitrick ------------------------------------------------ 4 | 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | import hamarr as ham 8 | import sys 9 | import argparse 10 | import h5py 11 | from imp import reload 12 | reload(ham) 13 | import time 14 | import subprocess as spr 15 | import scipy.interpolate as interp 16 | 17 | 18 | first = time.time() 19 | ########################################################################### 20 | # Script function purely for regridding the icosahedral grid. 21 | # Provides more control/options than mjolnir's regrid function 22 | # -t, --type 23 | # type of horizontal interpolation to use: 24 | # gd or GD = scipy.interpolate.griddata (fastest, but noisy) 25 | # sh or SH = spherical harmonics from pySHTools (slower, but very smooth) 26 | # spl or SPL = scipy.interpolate.SmoothSphereBivariateSpline (currently not working: 27 | # very fussy about smoothing factor and often produces artifacts near poles. 28 | # if you've some idea how to fix, please let me know!) 29 | ########################################################################### 30 | 31 | parser = argparse.ArgumentParser() 32 | parser.add_argument('resultsf',metavar='nview',nargs='*',help='Results directory') 33 | parser.add_argument("-s","--simulation_ID",nargs=1,default=['auto'],help='Name of simulation (e.g., planet name)') 34 | parser.add_argument("-t","--type",nargs=1,default=['gd'],choices=['gd','GD','sh','SH'],help='Horizontal interpolation type (cpu regrid only!)') 35 | parser.add_argument("-pgrid","--pgrid_ref",nargs=1,default=['auto'],help='Reference file for pressure grid') 36 | parser.add_argument("-i","--initial_file",nargs=1,default=[10],type=int,help='Initial file id number (integer)') 37 | parser.add_argument("-l","--last_file",nargs=1,default=['init'],type=int,help='Last file id number (integer)') 38 | parser.add_argument("-rot","--rotation",action='store_true',help='apply a set of rotations to grid (theta_z,theta_y) about (z,y)') 39 | parser.add_argument("-rot-ang","--rotation_angles",nargs='+',default=[0,0],help='values of rotation angles in degrees (theta_z,theta_y)', type =float) 40 | parser.add_argument("-w","--overwrite",action='store_true',help='force overwrite existing regrid files') 41 | parser.add_argument("-lmax","--lmax",nargs=1,default=['grid'],type=int, help = "Manually set lmax for sh/SH regrid type (cpu regrid only!)") 42 | parser.add_argument("-unmask","--unmask_surf",action='store_true',help='Unmask surface, ie., allow extrapolation below surface') 43 | parser.add_argument("-vc","--vcoord",nargs=1,default=['pressure'],help='Vertical coordinate to use (pressure or height)--only used for old CPU regrid') 44 | parser.add_argument("-cpu","--cpu",action='store_true',help='use old cpu code for regridding (super slow!)') 45 | args = parser.parse_args() 46 | resultsf = args.resultsf[0] 47 | ntsi = args.initial_file[0] # initial file id number 48 | 49 | if args.last_file[0] == 'init': 50 | nts = ntsi 51 | else: 52 | nts = args.last_file[0] # last file id number 53 | 54 | if ntsi > nts: 55 | nts = ntsi 56 | 57 | # resultsf = args.file[0] 58 | if args.simulation_ID[0] == 'auto': 59 | outname = spr.check_output('ls ' + resultsf + '/esp_output_planet_*.h5', shell=True) 60 | file0 = outname.decode().split(sep='/')[-1] 61 | simulation_ID = file0.split(sep='_')[3].split(sep='.')[0] 62 | else: 63 | simulation_ID = args.simulation_ID[0] 64 | 65 | if args.vcoord[0] == 'pressure': 66 | use_p = True 67 | elif args.vcoord[0] == 'height': 68 | use_p = False 69 | plog = False #enforce this on height grid 70 | else: 71 | raise ValueError('%s not a valid vcoord. Valid options are "pressure" or "height"'%args.vcoord[0]) 72 | 73 | if args.unmask_surf: 74 | mask = False 75 | else: 76 | mask = True 77 | 78 | if args.overwrite: 79 | print('Warning! Overwriting existing regrid files!') 80 | 81 | if args.cpu: 82 | import hamarr_suppl as hams 83 | hams.regrid_old(resultsf,simulation_ID,ntsi,nts,pgrid_ref=args.pgrid_ref[0], 84 | rotation=args.rotation,theta_z=args.rotation_angles[0]*np.pi/180,theta_y = args.rotation_angles[1]*np.pi/180, 85 | overwrite=args.overwrite,mask_surf=mask,pressure_vert=use_p,lmax_set=args.lmax[0],type=args.type[0]) 86 | else: 87 | ham.regrid(resultsf,simulation_ID,ntsi,nts,pgrid_ref=args.pgrid_ref[0], 88 | rotation=args.rotation,theta_z=args.rotation_angles[0]*np.pi/180,theta_y = args.rotation_angles[1]*np.pi/180, 89 | overwrite=args.overwrite,mask_surf=mask) 90 | 91 | last = time.time() 92 | print(last-first) 93 | -------------------------------------------------------------------------------- /mjolnir/temperature.m: -------------------------------------------------------------------------------- 1 | %------ code by Joao Mendonca --------------------------------------------- 2 | 3 | function temperature(Rho, Pressure, lon, lat, num, tsp, Rd, ps0, nv, sigmaref) 4 | 5 | format long 6 | 7 | % Set the reference pressure. 8 | Pref = ps0*sigmaref; 9 | d_sig = size(sigmaref); 10 | 11 | % Set the latitude-longitude grid. 12 | res_deg = 0.005; 13 | [loni,lati] = meshgrid(0:res_deg:2*pi, -pi/2:res_deg:pi/2); 14 | d_lon = size(loni); 15 | 16 | %%%%%%%%%%%%%%% 17 | % Temperature % 18 | %%%%%%%%%%%%%%% 19 | 20 | % Initialize arrays 21 | Temperatureii = zeros(nv); 22 | Temperaturei = zeros(num, d_sig(2)); 23 | Temperature = zeros(d_lon(1),d_lon(2),d_sig(2), tsp); 24 | 25 | % Compute temperatures 26 | for t = 1:tsp 27 | for i = 1:num 28 | sigma = Pressure(i,:,t); 29 | for lev = 1:nv 30 | Temperatureii(lev) = Pressure(i,lev,t)/(Rd*Rho(i,lev,t)); 31 | end 32 | % Interpolate atmospheric column to the reference pressure. 33 | aux = interp1(sigma, Temperatureii, Pref,'PCHIP'); 34 | for lev = 1:d_sig(2) 35 | Temperaturei(i,lev) = aux(lev); 36 | end 37 | end 38 | % Convert icosahedral grid into lon-lat grid 39 | for lev = 1:d_sig(2) 40 | Temperature(:,:,lev,t) = griddata(lon, lat, Temperaturei(:,lev), loni, lati,'nearest'); 41 | end 42 | end 43 | 44 | clear Temperatureii Temperaturei; 45 | 46 | % Initialize arrays 47 | d_z = size(Temperature); 48 | Temperaturel = zeros(d_z(1), d_sig(2), tsp); 49 | Temperaturelt = zeros(d_z(1), d_sig(2)); 50 | 51 | % Averaging in time and longitude. 52 | if(tsp>1) 53 | for j = 1:d_z(1) 54 | for lev = 1:d_sig(2) 55 | for t = 1:d_z(4) 56 | Temperaturel(j,lev,t) = mean(Temperature(j,:,lev,t)); 57 | end 58 | end 59 | end 60 | clear Temperature; 61 | for lev = 1:d_sig(2) 62 | for j = 1:d_z(1) 63 | Temperaturelt(j,lev) = mean(Temperaturel(j,lev,:)); 64 | end 65 | end 66 | clear Temperaturel; 67 | else 68 | for j = 1:d_z(1) 69 | for lev = 1:d_sig(2) 70 | Temperaturelt(j,lev) = mean(Temperature(j,:,lev)); 71 | end 72 | end 73 | clear Temperature; 74 | end 75 | 76 | %%%%%%%%%%%%%%%%% 77 | % Create figure % 78 | %%%%%%%%%%%%%%%%% 79 | 80 | % Latitude 81 | latp = -pi/2:res_deg:pi/2; 82 | 83 | % Contour plot. 84 | [C,h]=contourf(latp*180/pi, Pref/100, Temperaturelt', 40,'LineColor','none'); 85 | h = colorbar; 86 | grid on 87 | colormap(jet); 88 | caxis([180 310]); 89 | set(h,'ytick',[190:10:300]); 90 | set(gca,'YTick',[0:100:1000]) 91 | set(gca,'XTick',[-80:20:80]) 92 | set(get(gca,'XLabel'),'String','Latitude (deg)','FontSize',20); 93 | set(gca,'YDir','reverse'); 94 | set(get(gca,'YLabel'),'String','Pressure (mba)','FontSize',20); 95 | set(gca,'FontSize',20); 96 | set(get(gca,'XLabel'),'FontSize',20); 97 | set(get(gca,'YLabel'),'FontSize',20); 98 | ylim([1 1000]); 99 | xlim([-87 87]); 100 | 101 | %%%%%%%%% 102 | % Print % 103 | %%%%%%%%% 104 | 105 | print('-djpeg100','-zbuffer',['figures/temperature_ref.jpg']); 106 | % print('-depsc2','-zbuffer','-r150',['figures/temperature_ref.eps']); 107 | 108 | end 109 | -------------------------------------------------------------------------------- /mjolnir/u.m: -------------------------------------------------------------------------------- 1 | %------ code by Joao Mendonca --------------------------------------------- 2 | 3 | function u(Mh, Rho, Pressure, lon, lat, num, tsp, ps0, nv, sigmaref) 4 | 5 | format long 6 | 7 | % Set the reference pressure. 8 | Pref = ps0*sigmaref; 9 | d_sig = size(sigmaref); 10 | 11 | % Set the latitude-longitude grid. 12 | res_deg = 0.005; 13 | [loni,lati] = meshgrid(0:res_deg:2*pi, -pi/2:res_deg:pi/2); 14 | d_lon = size(loni); 15 | 16 | %%%%%%%%%%%%%%%%%% 17 | % Zonal Momentum % 18 | %%%%%%%%%%%%%%%%%% 19 | 20 | % Initialize arrays 21 | ZonalMii = zeros(nv); 22 | ZonalMi = zeros(num, d_sig(2)); 23 | ZonalM = zeros(d_lon(1),d_lon(2),d_sig(2), tsp); 24 | 25 | % Compute zonal winds 26 | for t = 1:tsp 27 | for i = 1:num 28 | sigma = Pressure(i,:,t); 29 | for lev = 1:nv 30 | ZonalMii(lev) = (Mh(1,i,lev,t) * (-sin(lon(i))) +... 31 | Mh(2,i,lev,t) * ( cos(lon(i))) +... 32 | Mh(3,i,lev,t) * (0))/Rho(i,lev,t); 33 | end 34 | % Interpolate atmospheric column to the reference pressure. 35 | aux = interp1(sigma, ZonalMii, Pref,'PCHIP'); 36 | for lev = 1:d_sig(2) 37 | ZonalMi(i,lev) = aux(lev); 38 | end 39 | end 40 | % Convert icosahedral grid into lon-lat grid 41 | for lev = 1:d_sig(2) 42 | ZonalM(:,:,lev,t) = griddata(lon,lat, ZonalMi(:,lev), loni, lati,'nearest'); 43 | end 44 | end 45 | 46 | clear zonalMii ZonalMi; 47 | 48 | % Initialize arrays 49 | d_z = size(ZonalM); 50 | ZonalMl = zeros(d_z(1), d_sig(2), tsp); 51 | ZonalMlt = zeros(d_z(1), d_sig(2)); 52 | 53 | % Averaging in time and longitude. 54 | if(tsp>1) 55 | for j = 1:d_z(1) 56 | for lev = 1:d_sig(2) 57 | for t = 1:d_z(4) 58 | ZonalMl(j,lev,t) = mean(ZonalM(j,:,lev,t)); 59 | end 60 | end 61 | end 62 | clear ZonalM; 63 | for lev = 1:d_sig(2) 64 | for j = 1:d_z(1) 65 | ZonalMlt(j,lev) = mean(ZonalMl(j,lev,:)); 66 | end 67 | end 68 | clear ZonalMl; 69 | else 70 | for j = 1:d_z(1) 71 | for lev = 1:d_sig(2) 72 | ZonalMlt(j,lev) = mean(ZonalM(j,:,lev)); 73 | end 74 | end 75 | clear ZonalM; 76 | end 77 | 78 | %%%%%%%%%%%%%%%%% 79 | % Create figure % 80 | %%%%%%%%%%%%%%%%% 81 | 82 | % Latitude 83 | latp = -pi/2:res_deg:pi/2; 84 | 85 | % Contour plot. 86 | [C,h]=contourf(latp*180/pi, Pref/100, ZonalMlt', 40,'LineColor','none'); 87 | h = colorbar; 88 | grid on 89 | colormap(jet); 90 | caxis([-10 30]); 91 | set(h,'ytick',[-10:5:30]); 92 | set(gca,'YTick',[0:100:1000]) 93 | set(gca,'XTick',[-80:20:80]) 94 | set(get(gca,'XLabel'),'String','Latitude (deg)','FontSize',20); 95 | set(gca,'YDir','reverse'); 96 | set(get(gca,'YLabel'),'String','Pressure (mba)','FontSize',20); 97 | set(gca,'FontSize',20); 98 | set(get(gca,'XLabel'),'FontSize',20); 99 | set(get(gca,'YLabel'),'FontSize',20); 100 | ylim([1 1000]); 101 | xlim([-87 87]); 102 | 103 | %%%%%%%%% 104 | % Print % 105 | %%%%%%%%% 106 | 107 | print('-djpeg100','-zbuffer',['figures/u_ref.jpg']); 108 | % print('-depsc2','-zbuffer','-r150',['figures/u_ref.eps']); 109 | 110 | end 111 | -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthHS_example/earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_mask_streamf_ver_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_mask_streamf_ver_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_mask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_mask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_BVprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_BVprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_CFLPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_CFLPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfdowntotPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfdowntotPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfdowntot_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfdowntot_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfnetPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfnetPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfnet_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfnet_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfuptotPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfuptotPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfuptot_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGfuptot_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGqheatprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_DGqheatprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_PTPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_PTPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_TPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_TPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_Tsurf_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_Tsurf_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_UPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_UPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_WPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_WPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyKE_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyKE_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyMom_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyMom_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyTempVar_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyTempVar_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyTemp_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_eddyTemp_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_insol_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_insol_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_pot_vort_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_pot_vort_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_pot_vort_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_pot_vort_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i1_l1_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i1_l1_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_qheatprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_qheatprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_rela_vort_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_rela_vort_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_streamf_ver_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_streamf_ver_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_tau_lwPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_tau_lwPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature-uv_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature-uv_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature_p_ver_i1_l1_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature_p_ver_i1_l1_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_temperature_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_p_ver_i1_l1_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_p_ver_i1_l1_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_u_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_v_lev250+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_v_lev250+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_v_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_v_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_w_p_ver_i1_l1_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_w_p_ver_i1_l1_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_w_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/EarthRT_example/earth_rt_unmask_w_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_temperature-uv_lev10+000mbar_i30_l30.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_temperature-uv_lev10+000mbar_i30_l30.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_u_p_ver_i30_l30_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_constg/hd189b_constg_u_p_ver_i30_l30_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_temperature-uv_lev10+000mbar_i30_l30.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_temperature-uv_lev10+000mbar_i30_l30.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_temperature_p_ver_i30_l30_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_u_p_ver_i30_l30_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/HD189733b_fullg/hd189b_fullg_u_p_ver_i30_l30_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSfdirprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSfdirprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSfnetPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSfnetPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSqheatprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_TSqheatprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_qheatprofPprofile_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_qheatprofPprofile_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_temperature-uv_lev100+000mbar_i1_l1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_temperature-uv_lev100+000mbar_i1_l1.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_temperature_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_temperature_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_u_p_ver_i1_l1_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_HELIOS/wasp43b_helios_u_p_ver_i1_l1_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_qheat_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_qheat_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/WASP43b_example/wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_Fsens_i10_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_Fsens_i10_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_KHver_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_KHver_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_KMver_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_KMver_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_Tsurf_i10_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_Tsurf_i10_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_potential_temp_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_potential_temp_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_streamf_ver_i10_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_streamf_ver_i10_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature-uv_lev160+000mbar_i10_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature-uv_lev160+000mbar_i10_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature-uv_lev20+000mbar_i10_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature-uv_lev20+000mbar_i10_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_temperature_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_v_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_v_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_w_p_ver_i10_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Feb2022/sync_rot_pbl_test/sync_rot_pbl_w_p_ver_i10_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_eddyKE_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_eddyMom_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_temperature_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthHS_example/earth_hs_u_p_ver_i9_l54_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_mask_streamf_ver_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_mask_streamf_ver_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_mask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_mask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_BVprofPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_BVprofPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_CFLPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_CFLPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfdowntotPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfdowntotPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfdowntot_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfdowntot_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfnetPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfnetPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfnet_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfnet_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfuptotPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfuptotPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfuptot_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGfuptot_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGqheatprofPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_DGqheatprofPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_PTPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_PTPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_TPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_TPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_Tsurf_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_Tsurf_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_UPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_UPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_WPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_WPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyKE_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyKE_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyMom_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyMom_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyTempVar_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyTempVar_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyTemp_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_eddyTemp_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_insol_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_insol_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_pot_vort_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_pot_vort_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_pot_vort_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_pot_vort_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i60_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i60_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_potential_temp_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_qheatprofPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_qheatprofPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_rela_vort_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_rela_vort_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_streamf_ver_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_streamf_ver_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_tau_lwPprofile_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_tau_lwPprofile_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature-uv_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature-uv_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature_p_ver_i60_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature_p_ver_i60_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_temperature_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_p_ver_i60_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_p_ver_i60_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_u_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_v_lev250+000mbar_i60_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_v_lev250+000mbar_i60_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_v_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_v_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_w_p_ver_i60_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_w_p_ver_i60_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_w_p_ver_i60_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/EarthRT_example/earth_rt_unmask_w_p_ver_i60_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-ch4-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-co-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-co2-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-h2o-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_chem-nh3-uv1_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_qheat_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_qheat_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_temperature-uv_lev1000+000km_i59_l60.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-10+00-10+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lat-90+00-90+00.pdf -------------------------------------------------------------------------------- /repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exoclime/THOR/0778a7db4c6b90700b3bd8ab64ab0487cba36200/repo_benchmark_figures/Jun2020/WASP43b_example/wasp43b_u_h_ver_i59_l60_lon0+00-360+00.pdf -------------------------------------------------------------------------------- /src/ESP/phy_modules_device.cu: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Manager routines for physics modules that need direct access to dynamical core 20 | // 21 | // Known limitations: - Runs in a single GPU. 22 | // 23 | // Known issues: None 24 | // 25 | // 26 | // If you use this code please cite the following reference: 27 | // 28 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 29 | // 30 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 31 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 32 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 33 | // 34 | // History: 35 | // Version Date Comment 36 | // ======= ==== ======= 37 | // 2.0 30/11/2018 Released version (RD & US) 38 | // 1.0 16/08/2017 Released version (JM) 39 | // 40 | //////////////////////////////////////////////////////////////////////// 41 | 42 | 43 | #include "dyn/phy_modules_device.h" 44 | #include "log_writer.h" 45 | 46 | 47 | __constant__ device_RK_array dynamical_core_phy_modules_arrays[NUM_PHY_MODULES_DYN_CORE_ARRAYS]; 48 | __constant__ int num_dynamical_arrays[1]; 49 | 50 | device_RK_array_manager::device_RK_array_manager() { 51 | } 52 | 53 | bool device_RK_array_manager::register_array(double* array_d, 54 | double* arrayk_d, 55 | double* arrayi_d, 56 | int dimensions) { 57 | 58 | if (data.size() == NUM_PHY_MODULES_DYN_CORE_ARRAYS) { 59 | log::printf("Not enough space to allocate array definitions for phy_modules\n" 60 | " increase NUM_PHY_MODULES_DYN_CORE_ARRAYS\n"); 61 | return false; 62 | } 63 | 64 | data.emplace_back(array_d, arrayk_d, arrayi_d, dimensions); 65 | 66 | return true; 67 | } 68 | 69 | void device_RK_array_manager::allocate_device_array() { 70 | cudaMemcpyToSymbol( 71 | dynamical_core_phy_modules_arrays, data.data(), data.size() * sizeof(device_RK_array)); 72 | { 73 | cudaError_t err = cudaGetLastError(); 74 | 75 | // Check device query 76 | if (err != cudaSuccess) { 77 | log::printf("phy: array cuda error: %s\n", cudaGetErrorString(err)); 78 | } 79 | } 80 | 81 | int datasize = data.size(); 82 | #ifdef __DEBUG 83 | log::printf("Num data: %d\n", datasize); 84 | 85 | for (auto& d : data) 86 | log::printf( 87 | "%d %p %p %p\n", d.dimensions, (void*)d.array_d, (void*)d.arrayk_d, (void*)d.arrayi_d); 88 | #endif // __DEBUG 89 | 90 | 91 | // maybe this needs a pointer ? 92 | cudaMemcpyToSymbol(num_dynamical_arrays, &datasize, sizeof(int)); 93 | { 94 | cudaError_t err = cudaGetLastError(); 95 | 96 | // Check device query 97 | if (err != cudaSuccess) { 98 | log::printf("'phy: num' cuda error: %s\n", cudaGetErrorString(err)); 99 | } 100 | } 101 | 102 | // wait for copy to finish before deallocating local memory 103 | cudaDeviceSynchronize(); 104 | } 105 | -------------------------------------------------------------------------------- /src/ESP/reduction_add.cu: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // 22 | // Description: Computes the reduction sum of an array 23 | // 24 | // 25 | // Method: - 26 | // 27 | // Known limitations: None. 28 | // 29 | // Known issues: None. 30 | // 31 | // 32 | // If you use this code please cite the following reference: 33 | // 34 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 35 | // 36 | // Current Code Owner: Joao Mendonca, EEG. joao.mendonca@csh.unibe.ch, 37 | // Russell Deitrick, russell.deitrick@csh.unibe.ch 38 | // Urs Schroffenegger, urs.schroffenegger@csh.unibe.ch 39 | // 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | 49 | #include "reduction_add.h" 50 | 51 | 52 | double cpu_reduction_sum(double* d, long length) { 53 | 54 | for (int stride = length; stride > 0; stride /= 2) { 55 | for (int i = 0; i < stride; i++) 56 | d[i] += d[i + stride]; 57 | } 58 | 59 | return d[0]; 60 | } 61 | -------------------------------------------------------------------------------- /src/ESP/simulation_setup.cu: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Defines Planet's properties 20 | // 21 | // 22 | // Description: Planet parameters. 23 | // 24 | // Method: - 25 | // 26 | // 27 | // Known limitations: None 28 | // 29 | // 30 | // Known issues: None 31 | // 32 | // 33 | // If you use this code please cite the following reference: 34 | // 35 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 36 | // 37 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 38 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 39 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | #include "simulation_setup.h" 55 | 56 | SimulationSetup::SimulationSetup() { 57 | // 58 | // Earth 59 | // ID 60 | sprintf(simulation_ID, "%s", "Earth"); 61 | ////////////// 62 | // BULK // 63 | ////////////// 64 | A = 72427000.0; // Radius [m] 65 | Omega = 9.09E-5; // Rotation rate [s-1] 66 | Gravit = 47.0; // Gravitational acceleration [m/s^2] 67 | //////////////// 68 | // ATMOSPHERE // 69 | //////////////// 70 | Rd = 3714; // Gas constant [J/(Kg K)] 71 | Cp = 13000; // Specific heat capacities [J/(Kg K)] 72 | Tmean = 1400; // Mean atmospheric temperature [K] 73 | P_Ref = 10000000.0; // Reference surface pressure [Pa] 74 | Top_altitude = 1235376.0; // Altitude of the top of the model domain [m] 75 | Diffc = 0.009973; // Strength of diffusion 76 | DivDampc = Diffc; 77 | 78 | HyDiff = true; 79 | DivDampP = true; 80 | increased_damping_for_n_steps = 0; 81 | 82 | NonHydro = true; 83 | DeepModel = true; 84 | RayleighSponge = false; 85 | RayleighSpongeT = false; 86 | DiffSponge = false; 87 | conv_adj = true; 88 | 89 | gcm_off = false; 90 | globdiag = false; 91 | 92 | rest = true; 93 | } 94 | -------------------------------------------------------------------------------- /src/headers/config_file.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: basic config file parsing class 20 | // 21 | // 22 | // Method: parses a config file and reads it's value to defined variables 23 | // 24 | // Known limitations: None. 25 | // 26 | // 27 | // Known issues: None. 28 | // 29 | // 30 | // If you use this code please cite the following reference: 31 | // 32 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 33 | // 34 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 35 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 36 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 37 | // 38 | // History: 39 | // Version Date Comment 40 | // ======= ==== ======= 41 | // 2.0 30/11/2018 Released version (RD & US) 42 | // 1.0 16/08/2017 Released version (JM) 43 | // 44 | //////////////////////////////////////////////////////////////////////// 45 | #pragma once 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include "parser_helpers.h" 54 | 55 | 56 | using std::map; 57 | using std::string; 58 | 59 | // Base interface class for config storage class 60 | class config_entry_interface 61 | { 62 | public: 63 | virtual bool parse(string value) = 0; 64 | 65 | virtual void set_default() = 0; 66 | 67 | virtual string to_str() = 0; 68 | }; 69 | 70 | 71 | // config entry class, storing data, default value and calling the 72 | // parsing function 73 | template class config_entry : public config_entry_interface 74 | { 75 | public: 76 | config_entry(T& target_, T default_val_) : target(target_), default_val(default_val_) { 77 | } 78 | 79 | bool parse(string value) { 80 | if (parse_data(value, target)) { 81 | return true; 82 | } 83 | else { 84 | target = default_val; 85 | 86 | return false; 87 | } 88 | } 89 | 90 | void set_default() { 91 | target = default_val; 92 | } 93 | 94 | string to_str() { 95 | return to_strg(target); 96 | } 97 | 98 | 99 | private: 100 | T& target; 101 | T default_val; 102 | }; 103 | 104 | // Config file parsing class ,storing the entries and parsing files 105 | class config_file 106 | { 107 | public: 108 | config_file(); 109 | 110 | // config vars definition functions 111 | template 112 | bool append_config_var(const string& name, T& target_, const T& default_val_); 113 | 114 | // parsing functions 115 | bool parse_config(std::basic_istream& config); 116 | bool parse_file(const string& filename); 117 | 118 | private: 119 | // internal parsing function 120 | bool append_config_var(const string& name, std::unique_ptr entry); 121 | 122 | // Storage map as key value pair 123 | map>> config_vars; 124 | 125 | int version = -1; 126 | }; 127 | 128 | template 129 | bool config_file::append_config_var(const string& name, T& target_, const T& default_val_) { 130 | return append_config_var( 131 | name, std::unique_ptr>(new config_entry(target_, default_val_))); 132 | } 133 | -------------------------------------------------------------------------------- /src/headers/debug.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // Description: Defines debug parameters and enable helper functions 22 | // 23 | // Method: - 24 | // 25 | // Known limitations: None 26 | // 27 | // 28 | // Known issues: None 29 | // 30 | // 31 | // If you use this code please cite the following reference: 32 | // 33 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 34 | // 35 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 36 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 37 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 38 | // 39 | // History: 40 | // Version Date Comment 41 | // ======= ==== ======= 42 | // 2.0 30/11/2018 Released version (RD & US) 43 | // 1.0 16/08/2017 Released version (JM) 44 | // 45 | //////////////////////////////////////////////////////////////////////// 46 | 47 | // benchmarking 48 | // if defined run benchmark functions? 49 | // #define BENCHMARKING 50 | 51 | // *************************************** 52 | // * binary comparison 53 | // compare benchmark point to references 54 | // use --bincompare option 55 | // write reference benchmark point 56 | // use --binwrite option 57 | // print out more debug info, by default, only print out failures 58 | // #define BENCH_PRINT_DEBUG 59 | // print out comparisaon statistics 60 | // #define BENCH_COMPARE_PRINT_STATISTICS 61 | // use an epsilon value for fuzzy compare on relative value 62 | // #define BENCH_COMPARE_USE_EPSILON 63 | // #define BENCH_COMPARE_EPSILON_VALUE 1e-14 64 | // *************************************** 65 | // * check for NaNs 66 | // #define BENCH_NAN_CHECK 67 | // * below adds checks on device functions (useful for device memory bugs) 68 | // #define BENCH_CHECK_LAST_CUDA_ERROR 69 | 70 | // path to benchmark result directory 71 | #define BENCHMARK_DUMP_REF_PATH "results/ref/" 72 | #define BENCHMARK_DUMP_BASENAME "bindata_" 73 | 74 | //***************************************************************************** 75 | //#define STEP_TIMING_INFO 76 | 77 | //***************************************************************************** 78 | // diagnostics tests 79 | // test that matrix used in vertical implicit solver in thor_vertical_int.h is 80 | // diagonaly dominant 81 | 82 | // magnitude factor mag for comparison in diagonal dominance 83 | // a_ii > mag * sum(a_ij, i!=j) 84 | #define THOMAS_DIAG_DOM_FACTOR 1.0 85 | 86 | 87 | // diagnostics levels 88 | // general enabler of checks 89 | #define DIAGNOSTICS_LEVEL1 90 | //#define DIAGNOSTICS_LEVEL2 91 | //#define DIAGNOSTICS_LEVEL3 92 | // #define DIAGNOSTICS_LEVEL4 93 | 94 | #ifdef DIAGNOSTICS_LEVEL4 95 | # define DIAGNOSTICS_LEVEL3 96 | # define DIAG_CHECK_THOR_VERTICAL_INT_THOMAS_RESULT 97 | #endif // DIAGNOSTICS_LEVEL3 98 | 99 | #ifdef DIAGNOSTICS_LEVEL3 100 | # define DIAGNOSTICS_LEVEL2 101 | # define DIAG_CHECK_THOR_VERTICAL_INT_THOMAS_DIAG_DOM 102 | #endif // DIAGNOSTICS_LEVEL3 103 | 104 | 105 | #ifdef DIAGNOSTICS_LEVEL2 106 | # define DIAGNOSTICS_LEVEL1 107 | # define DIAG_CHECK_DENSITY_PRESSURE_EQ_AUX 108 | #endif // DIAGNOSTICS_LEVEL2 109 | 110 | #ifdef DIAGNOSTICS_LEVEL1 111 | # define DIAG_CHECK_DENSITY_PRESSURE_EQ_P_NAN 112 | # define DIAG_CHECK_BL_THOMAS_DIAG_DOM 113 | #endif // DIAGNOSTICS_LEVEL1 114 | -------------------------------------------------------------------------------- /src/headers/debug_helpers.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: binary correctness test of output, enabled with compile time switches 20 | // 21 | // 22 | // 23 | // Method: [1] - Dumps output to binary file on a flag 24 | // [2] - Reads data from binary files on a flag and compare to 25 | // dumped output 26 | // 27 | // Known limitations: None. 28 | // 29 | // 30 | // Known issues: None. 31 | // 32 | // 33 | // If you use this code please cite the following reference: 34 | // 35 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 36 | // 37 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 38 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 39 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | 49 | 50 | #pragma once 51 | #include "binary_test.h" 52 | #include 53 | using std::string; 54 | 55 | 56 | // check array for NaNs on device 57 | void isnan_check_device(double *array, int width, int height, bool *check); 58 | 59 | // helper to copy data from device to host (from any place, without cuda dependencies) 60 | void getDeviceData(const double *device, double *host, int size); 61 | 62 | //define device mem check ptr 63 | bool *init_device_mem_check(bool *ptr); 64 | void deinit_device_mem_check(bool *ptr); 65 | // check array for nan on device array or host array 66 | bool check_array_for_nan(double *ptr, int size, bool on_device, bool *device_mem_check_b); 67 | 68 | #ifdef BENCHMARKING 69 | void crash_report(const output_def &def, std::string output_dir, const std::string &iteration); 70 | #endif 71 | 72 | void check_last_cuda_error(string ref_name); 73 | 74 | void cuda_check_status_or_exit(); 75 | void cuda_check_status_or_exit(const char *filename, const int &line); 76 | -------------------------------------------------------------------------------- /src/headers/diagnostics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cuda_device_memory.h" 4 | #include "debug.h" 5 | #include 6 | 7 | // forward declare ESP 8 | class ESP; 9 | 10 | using std::string; 11 | 12 | struct diag_data { 13 | unsigned int flag; 14 | double4 data; 15 | }; 16 | 17 | 18 | // Build a list of flags with a value for each bit, so that we can uses a binary mask 19 | typedef enum { 20 | NAN_VALUE = 1 << 0, 21 | NEGATIVE_VALUE = 1 << 1, 22 | THOMAS_NOT_DD = 1 << 2, 23 | THOMAS_BAD_SOLUTION = 1 << 3, 24 | BL_THOMAS_NOT_DD = 1 << 4 25 | } sim_error_flag; 26 | 27 | const int DIAG_NUM_FLAGS = 3; 28 | 29 | class kernel_diagnostics 30 | { 31 | public: 32 | kernel_diagnostics(ESP& esp); 33 | 34 | // The device memory for diagnostics 35 | // array of diag_data structure, contains diagnostics per element 36 | cuda_device_memory diagnostics; 37 | // globaal flag for the whole grid 38 | cuda_device_memory diagnostics_global_flag; 39 | // set the global flag to 0, to use before calling a kernel to diagnose 40 | void reset_flag(); 41 | // reset thhe global flag and the diagnostic memory for the full grid 42 | void reset(); 43 | 44 | // check if a flag is enabled in global flag 45 | bool check_flag(); 46 | // return global flag 47 | unsigned int get_flag(); 48 | 49 | // dump data to file 50 | // checks the diagnostics array, element by element, to see if flags are set and print out flag and values. 51 | // Iterates on the full array. 52 | // specify the size of the grid, (as number of columns and number of levels) 53 | // that is used for diagnostics, depending if diagnosing a kernel computing one column value (point_num, 1), 54 | // or a volume element value (point_num, nv), or interface value (point_num, nvi) 55 | void dump_data(string name, // base name of the checl, used to generate filename 56 | int iteration, // iteration, for filename 57 | int subiteration, // subiteration, for filename 58 | int subsubiteration, // subsubiteration, for filename 59 | ESP& esp, // esp reference 60 | int grid_num_points, // size of grid 61 | int vertical_num_points); // number of levels 62 | }; 63 | -------------------------------------------------------------------------------- /src/headers/directories.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // directories - helper to check and create directories 20 | // 21 | // 22 | // 23 | // Known limitations: - Runs in a single GPU. 24 | // 25 | // Known issues: None 26 | // 27 | // 28 | // If you use this code please cite the following reference: 29 | // 30 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 31 | // 32 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 33 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 34 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 35 | // 36 | // History: 37 | // Version Date Comment 38 | // ======= ==== ======= 39 | // 2.0 30/11/2018 Released version (RD & US) 40 | // 1.0 16/08/2017 Released version (JM) 41 | // 42 | //////////////////////////////////////////////////////////////////////// 43 | 44 | #pragma once 45 | 46 | #include 47 | #include 48 | 49 | using std::string; 50 | 51 | 52 | std::vector get_files_in_directory(const string& dir_name); 53 | 54 | bool match_output_file_numbering_scheme(const string& file_path, string& basename, int& number); 55 | 56 | bool create_output_dir(const string& output_dir); 57 | 58 | bool path_exists(const string& path); 59 | 60 | bool find_continue_file(string& initial_conditions, 61 | string& planet_filename, 62 | bool continue_sim, 63 | int& output_file_idx); 64 | 65 | bool overwrite_check(string& output_path, 66 | string& simulation_ID, 67 | int output_file_idx, 68 | bool force_overwrite); 69 | 70 | class path 71 | { 72 | public: 73 | path(const string& path); 74 | 75 | bool is_absolute() { 76 | return is_absolute_path; 77 | } 78 | 79 | // last file extension separated by a '.' 80 | string suffix(); 81 | // vector of file extensions separated by a '.' 82 | std::vector suffixes(); 83 | // parts 84 | std::vector parts(); 85 | 86 | // final part of the path 87 | string name(); 88 | // final part of path, without suffix 89 | string stem(); 90 | 91 | // parent of last element 92 | string parent(); 93 | 94 | string to_string(); 95 | const char* c_str(); 96 | 97 | 98 | path& operator/=(const string& rhs) // compound assignment (does not need to be a member, 99 | { // but often is, to modify the private members) 100 | elements.push_back(rhs); 101 | 102 | return *this; // return the result by reference 103 | } 104 | 105 | // friends defined inside class body are inline and are hidden from non-ADL lookup 106 | friend path operator/(path lhs, // passing lhs by value helps optimize chained a+b+c 107 | const string& rhs) // otherwise, both parameters may be const references 108 | { 109 | lhs /= rhs; // reuse compound assignment 110 | return lhs; // return the result by value (uses move constructor) 111 | } 112 | 113 | private: 114 | string element_name; 115 | std::vector elements; 116 | 117 | bool is_absolute_path = false; 118 | }; 119 | -------------------------------------------------------------------------------- /src/headers/dyn/phy_modules_device.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // datatype to store values to update on device in THOR loop 20 | // 21 | // 22 | // Known limitations: - Runs in a single GPU. 23 | // 24 | // Known issues: None 25 | // 26 | // 27 | // If you use this code please cite the following reference: 28 | // 29 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 30 | // 31 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 32 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 33 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 34 | // 35 | // History: 36 | // Version Date Comment 37 | // ======= ==== ======= 38 | // 2.0 30/11/2018 Released version (RD & US) 39 | // 1.0 16/08/2017 Released version (JM) 40 | // 41 | //////////////////////////////////////////////////////////////////////// 42 | 43 | 44 | #pragma once 45 | #include 46 | 47 | #define NUM_PHY_MODULES_DYN_CORE_ARRAYS 10 48 | 49 | struct device_RK_array { 50 | double* array_d; 51 | double* arrayk_d; 52 | double* arrayi_d; 53 | int dimensions; 54 | device_RK_array(){}; 55 | 56 | device_RK_array(double* array_d_, double* arrayk_d_, double* arrayi_d_, int dimensions_) : 57 | array_d(array_d_), 58 | arrayk_d(arrayk_d_), 59 | arrayi_d(arrayi_d_), 60 | dimensions(dimensions_){}; 61 | }; 62 | 63 | class device_RK_array_manager 64 | { 65 | public: 66 | device_RK_array_manager(); 67 | 68 | bool register_array(double* array_d, double* arrayk_d, double* arrayi, int dimensions); 69 | 70 | void allocate_device_array(); 71 | 72 | private: 73 | std::vector data; 74 | }; 75 | -------------------------------------------------------------------------------- /src/headers/iteration_timer.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Timer helper to measure time for iterations, elapsed time and time remaining 20 | // 21 | 22 | // 23 | // Known limitations: 24 | // 25 | // Known issues: None 26 | // 27 | // 28 | // If you use this code please cite the following reference: 29 | // 30 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 31 | // 32 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 33 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 34 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 35 | // 36 | // History: 37 | // Version Date Comment 38 | // ======= ==== ======= 39 | // 2.0 30/11/2018 Released version (RD & US) 40 | // 1.0 16/08/2017 Released version (JM) 41 | // 42 | //////////////////////////////////////////////////////////////////////// 43 | 44 | #pragma once 45 | 46 | #include 47 | 48 | class iteration_timer 49 | { 50 | public: 51 | iteration_timer(int initial_num_steps, int max_steps); 52 | 53 | void iteration(int nstep, 54 | double& mean_delta_per_step, 55 | double& step_delta, 56 | double& elapsed_time, 57 | double& time_left, 58 | std::time_t& end_time); 59 | 60 | private: 61 | int max_steps = 1; 62 | int initial_num_steps = 0; 63 | std::chrono::system_clock::time_point start_sim; 64 | std::chrono::system_clock::time_point previous_sim_step; 65 | }; 66 | -------------------------------------------------------------------------------- /src/headers/kernel_halo_helpers.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // Description: Helper functions to load variables to memory with halos 22 | // 23 | // 24 | // Method: 25 | // 26 | // Known limitations: None. 27 | // 28 | // Known issues: None. 29 | // 30 | // If you use this code please cite the following reference: 31 | // 32 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 33 | // 34 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 35 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 36 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 37 | // 38 | // History: 39 | // Version Date Comment 40 | // ======= ==== ======= 41 | // 2.0 30/11/2018 Released version (RD & US) 42 | // 1.0 16/08/2017 Released version (JM) 43 | // 44 | //////////////////////////////////////////////////////////////////////// 45 | #pragma once 46 | 47 | __device__ __forceinline__ bool compute_mem_idx(int* maps_d, 48 | const int& nhl, 49 | const int& nhl2, 50 | int& ig, 51 | int& igh, 52 | int& ir, 53 | int& ir2, 54 | bool& pent_ind) { 55 | int x = threadIdx.x; 56 | int y = threadIdx.y; 57 | int ib = blockIdx.x; 58 | // int nv = gridDim.y; 59 | // int lev = blockIdx.y; 60 | 61 | bool load_halo = false; 62 | 63 | ir = (y + 1) * nhl + x + 1; // Region index 64 | ig = maps_d[ib * nhl2 + ir]; 65 | 66 | if (x == 0 && y == 0) 67 | if (maps_d[ib * nhl2] == -1) 68 | pent_ind = true; 69 | 70 | /////////////////////////////// 71 | //////////// Halo ///////////// 72 | /////////////////////////////// 73 | 74 | // x: 0 halo 75 | // if (x == 0) { 76 | // ir2 = (y + 1) * nhl + x; 77 | if (y == 0) { 78 | ir2 = (x + 1) * nhl; 79 | load_halo = true; 80 | } 81 | // x: nhl halo 82 | //if (x == nhl - 3){ 83 | // ir2 = (y + 1) * nhl + x + 2; 84 | else if (y == 3) { 85 | ir2 = (x + 1) * nhl + nhl - 3 + 2; 86 | load_halo = true; 87 | } 88 | // y: 0 halo 89 | //if (y == 0){ 90 | // ir2 = y * nhl + (x + 1); 91 | else if (y == 7) { 92 | ir2 = x + 1; 93 | load_halo = true; 94 | } 95 | 96 | 97 | // x: 0, y: 0 corner point 98 | // if (y == 0 && x == 0) { 99 | // ir2 = y * nhl + x; 100 | else if (x == 4 && y == 4) { 101 | ir2 = 0; 102 | load_halo = true; 103 | } 104 | 105 | // y: nhl halo 106 | // if (y == nhl - 3) { 107 | // ir2 = (y + 2) * nhl + (x + 1); 108 | else if (y == 11) { 109 | 110 | ir2 = (nhl - 3 + 2) * nhl + (x + 1); 111 | load_halo = true; 112 | } 113 | // x: nhl, y: nhl corner point 114 | // if (y == nhl - 3 && x == nhl - 3) { 115 | // ir2 = (y + 2) * nhl + (x + 2); 116 | else if (y == 4 && x == 5) { 117 | 118 | ir2 = (nhl - 3 + 2) * nhl + (nhl - 3 + 2); 119 | load_halo = true; 120 | } 121 | 122 | if (load_halo) 123 | igh = maps_d[ib * nhl2 + ir2]; 124 | else 125 | igh = 0; 126 | 127 | return load_halo; 128 | } 129 | -------------------------------------------------------------------------------- /src/headers/phy/GibbsH.txt: -------------------------------------------------------------------------------- 1 | 0.000 216.035 2 | 100.000 212.450 3 | 200.000 208.004 4 | 300.000 203.186 5 | 400.000 198.150 6 | 500.000 192.957 7 | 600.000 187.640 8 | 700.000 182.220 9 | 800.000 176.713 10 | 900.000 171.132 11 | 1000.000 165.485 12 | 1100.000 159.782 13 | 1200.000 154.028 14 | 1300.000 148.230 15 | 1400.000 142.394 16 | 1500.000 136.522 17 | 1600.000 130.620 18 | 1700.000 124.689 19 | 1800.000 118.734 20 | 1900.000 112.757 21 | 2000.000 106.760 22 | 2100.000 100.744 23 | 2200.000 94.712 24 | 2300.000 88.664 25 | 2400.000 82.603 26 | 2500.000 76.530 27 | 2600.000 70.444 28 | 2700.000 64.349 29 | 2800.000 58.243 30 | 2900.000 52.129 31 | 3000.000 46.007 32 | 3100.000 39.877 33 | 3200.000 33.741 34 | 3300.000 27.598 35 | 3400.000 21.449 36 | 3500.000 15.295 37 | 3600.000 9.136 38 | 3700.000 2.973 39 | 3800.000 -3.195 40 | 3900.000 -9.366 41 | 4000.000 -15.541 42 | 4100.000 -21.718 43 | 4200.000 -27.899 44 | 4300.000 -34.082 45 | 4400.000 -40.267 46 | 4500.000 -46.454 47 | 4600.000 -52.643 48 | 4700.000 -58.834 49 | 4800.000 -65.025 50 | 4900.000 -71.218 51 | 5000.000 -77.412 52 | 5100.000 -83.606 53 | 5200.000 -89.801 54 | 5300.000 -95.997 55 | 5400.000 -102.192 56 | 5500.000 -108.389 57 | 5600.000 -114.584 58 | 5700.000 -120.780 59 | 5800.000 -126.976 60 | 5900.000 -133.172 61 | 6000.000 -139.368 62 | -------------------------------------------------------------------------------- /src/headers/phy/profx_acoustic_test.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // 22 | // Description: Test of acoustic wave behavior 23 | // 24 | // 25 | // Method: 26 | // 27 | // Known limitations: None. 28 | // 29 | // Known issues: None. 30 | // 31 | // If you use this code please cite the following references: 32 | // 33 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 34 | // 35 | // [2] Tomita & Satoh 2004 36 | // 37 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 38 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 39 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | 49 | __global__ void acoustic_test(double *pressure_d, 50 | double *Rho_d, 51 | double *temperature_d, 52 | double Rd, 53 | double *Altitude_d, 54 | double *lonlat_d, 55 | double Top_altitude, 56 | int num) { 57 | 58 | int id = blockIdx.x * blockDim.x + threadIdx.x; 59 | int nv = gridDim.y; 60 | int lev = blockIdx.y; 61 | 62 | if (id < num) { 63 | double dp, R, lambda0, phi0, vmode, r, g, f; 64 | double lat = lonlat_d[id * 2 + 1]; 65 | double lon = lonlat_d[id * 2]; 66 | 67 | vmode = 1; // vertical mode 68 | dp = 100.0; // pressure perturbation (Pa) 69 | R = 1.0 / 3.0; // distance cutoff of perturbation 70 | lambda0 = 0; //longitude of perturbation 71 | phi0 = 0; //latitude of perturbation 72 | r = acos(sin(phi0) * sin(lat) + cos(phi0) * cos(lat) * cos(lon - lambda0)); 73 | g = sin(vmode * M_PI * Altitude_d[lev] / Top_altitude); 74 | if (r < R) { 75 | f = 0.5 * (1 + cos(M_PI * r / R)); 76 | } 77 | else { 78 | f = 0.0; 79 | } 80 | 81 | pressure_d[id * nv + lev] += dp * f * g; 82 | Rho_d[id * nv + lev] = pressure_d[id * nv + lev] / Rd / temperature_d[id * nv + lev]; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/headers/phy/profx_held_suarez.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // 22 | // Description: Earth benchmark test. 23 | // 24 | // 25 | // Method: The temperature is forced using a Newtonian cooling code, and the 26 | // boundary layer is represented by a Rayleigh friction scheme. 27 | // 28 | // Known limitations: None. 29 | // 30 | // Known issues: None. 31 | // 32 | // If you use this code please cite the following references: 33 | // 34 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 35 | // 36 | // [2] Held, I. M., & Suarez, M. J. 1994, Bullentin of the American 37 | // Meteorological Society 38 | // 39 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 40 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 41 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 42 | // 43 | // History: 44 | // Version Date Comment 45 | // ======= ==== ======= 46 | // 2.0 30/11/2018 Released version (RD & US) 47 | // 1.0 16/08/2017 Released version (JM) 48 | // 49 | //////////////////////////////////////////////////////////////////////// 50 | 51 | __global__ void held_suarez(double *Mh_d, 52 | double *pressure_d, 53 | double *Rho_d, 54 | double *temperature_d, 55 | double Gravit, 56 | double Cp, 57 | double Rd, 58 | double *Altitude_d, 59 | double *Altitudeh_d, 60 | double *lonlat_d, 61 | double time_step, 62 | int num) { 63 | 64 | int id = blockIdx.x * blockDim.x + threadIdx.x; 65 | int nv = gridDim.y; 66 | int lev = blockIdx.y; 67 | 68 | if (id < num) { 69 | 70 | // Parameters for the forcing and dissipation 71 | double sigma; 72 | double sigma0; 73 | double sigmab = 0.7; 74 | double ka = (1.0 / 40.0) * (1.0 / 86400.0); 75 | double kf = 1.0 / 86400.0; 76 | double ks = (1.0 / 4.0) * (1.0 / 86400.0); 77 | double kappa = Rd / Cp; 78 | double dTy = 60.0; 79 | double dthetaz = 10.0; 80 | double ps, pre; 81 | double psm1; 82 | double p0 = 100000.0; 83 | double lat = lonlat_d[id * 2 + 1]; 84 | 85 | double Teq_hs; 86 | double kv_hs, kt_hs; 87 | //////////// 88 | // Calculates surface pressure 89 | psm1 = pressure_d[id * nv + 1] 90 | - Rho_d[id * nv + 0] * Gravit * (-Altitude_d[0] - Altitude_d[1]); 91 | ps = 0.5 * (pressure_d[id * nv + 0] + psm1); 92 | 93 | pre = pressure_d[id * nv + lev]; 94 | 95 | sigma = (pre / ps); 96 | sigma0 = (pre / p0); 97 | 98 | // Equilibrium temperature. 99 | Teq_hs = max(200.0, 100 | (315.0 - dTy * pow(sin(lat), 2.0) - dthetaz * log(sigma0) * pow(cos(lat), 2.0)) 101 | * pow(sigma0, kappa)); 102 | 103 | // Temperature forcing constant. 104 | kt_hs = ka + (ks - ka) * max(0.0, (sigma - sigmab) / (1.0 - sigmab)) * pow(cos(lat), 4.0); 105 | 106 | // Momentum dissipation constant. 107 | kv_hs = kf * max(0.0, (sigma - sigmab) / (1.0 - sigmab)); 108 | 109 | // Update momenta 110 | for (int k = 0; k < 3; k++) 111 | Mh_d[id * 3 * nv + lev * 3 + k] = 112 | Mh_d[id * 3 * nv + lev * 3 + k] / (1.0 + kv_hs * time_step); 113 | 114 | // Update temperature 115 | temperature_d[id * nv + lev] -= kt_hs * time_step * (temperature_d[id * nv + lev] - Teq_hs); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/headers/phy/profx_sponge.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // 22 | // Description: Sponge Layer 23 | // 24 | // 25 | // 26 | // Known limitations: None 27 | // 28 | // Known issues: None. 29 | // 30 | // 31 | // If you use this code please cite the following reference: 32 | // 33 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 34 | // 35 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 36 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 37 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 38 | // 39 | // History: 40 | // Version Date Comment 41 | // ======= ==== ======= 42 | // 2.0 30/11/2018 Released version (RD & US) 43 | // 1.0 16/08/2017 Released version (JM) 44 | // 45 | //////////////////////////////////////////////////////////////////////// 46 | #pragma once 47 | 48 | __global__ void zonal_uv(double *M_d, 49 | double *Rho_d, 50 | int * zonal_mean_tab_d, 51 | double *lonlat_d, 52 | int num, 53 | double *utmp, 54 | double *vtmp, 55 | int max_count); 56 | 57 | __global__ void 58 | zonal_w(double *W_d, double *Rho_d, int *zonal_mean_tab_d, int num, double *wtmp, int max_count); 59 | 60 | __global__ void zonal_temp(double *pressure_d, 61 | double *Rho_d, 62 | double *Tbar_d, 63 | int * zonal_mean_tab_d, 64 | double *lonlat_d, 65 | int num, 66 | double *Ttmp, 67 | double *Rd_d, 68 | int max_count); 69 | 70 | void print_vbar(double *vbar_h, int nlat, int nv); 71 | 72 | __global__ void sponge_layer(double *M_d, 73 | double *Rho_d, 74 | double *W_d, 75 | double *Wh_d, 76 | double *pressure_d, 77 | double *vbar_d, 78 | double *Tbar_d, 79 | int * zonal_mean_tab_d, 80 | double *lonlat_d, 81 | double *Altitude_d, 82 | double *Altitudeh_d, 83 | double Ruv, 84 | double Rw, 85 | double RT, 86 | double Rv_fac, 87 | double nsi, 88 | bool damp_uv_to_mean, 89 | bool damp_w_to_mean, 90 | bool implicit, 91 | double dt, 92 | double *Rd_d, 93 | int nlat, 94 | int num, 95 | int nv, 96 | bool temp_sponge, 97 | double *profx_dMh_d, 98 | double *profx_dWh_d, 99 | double *profx_dW_d, 100 | double *profx_Qheat_d); 101 | -------------------------------------------------------------------------------- /src/headers/phy_modules.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // physics module interface 20 | // 21 | // 22 | // Known limitations: - Runs in a single GPU. 23 | // 24 | // Known issues: None 25 | // 26 | // 27 | // If you use this code please cite the following reference: 28 | // 29 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 30 | // 31 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 32 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 33 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 34 | // 35 | // History: 36 | // Version Date Comment 37 | // ======= ==== ======= 38 | // 2.0 30/11/2018 Released version (RD & US) 39 | // 1.0 16/08/2017 Released version (JM) 40 | // 41 | //////////////////////////////////////////////////////////////////////// 42 | 43 | #pragma once 44 | 45 | #include 46 | 47 | #include "config_file.h" 48 | #include "define.h" 49 | #include "esp.h" 50 | #include "grid.h" 51 | #include "log_writer.h" 52 | #include "simulation_setup.h" 53 | #include "storage.h" 54 | 55 | class ESP; 56 | 57 | // return name of module for storage to output files 58 | std::string phy_modules_get_name(); 59 | 60 | // can print out configurations 61 | void phy_modules_print_config(); 62 | 63 | // add config variables for this module to main config reader 64 | bool phy_modules_generate_config(config_file& config_reader); 65 | 66 | // allocate and free memory locally and on device for this module 67 | // register arrays that need to be updated in the dynamical core RK update steps 68 | bool phy_modules_init_mem(const ESP& esp, device_RK_array_manager& phy_modules_core_arrays); 69 | bool phy_modules_free_mem(); 70 | 71 | // initialise data 72 | bool phy_modules_init_data(const ESP& esp, const SimulationSetup& sim, storage* s); 73 | 74 | 75 | // Dynamical core loop functions 76 | bool phy_modules_dyn_core_loop_init(const ESP& esp); 77 | bool phy_modules_dyn_core_loop_slow_modes(const ESP& esp, 78 | const SimulationSetup& sim, 79 | int nstep, // Step number 80 | double times); // Time-step [s] 81 | bool phy_modules_dyn_core_loop_fast_modes(const ESP& esp, 82 | const SimulationSetup& sim, 83 | int nstep, // Step number 84 | double time_step); // Time-step [s] 85 | 86 | bool phy_modules_dyn_core_loop_end(const ESP& esp); 87 | 88 | // Physics loop 89 | bool phy_modules_phy_loop(ESP& esp, 90 | const SimulationSetup& sim, 91 | kernel_diagnostics& diag, 92 | int nstep, // Step number 93 | double time_step); // Time-step [s] 94 | 95 | 96 | bool phy_modules_store(const ESP& esp, storage& s); 97 | 98 | bool phy_modules_store_init(storage& s); 99 | -------------------------------------------------------------------------------- /src/headers/physical_constants.h: -------------------------------------------------------------------------------- 1 | // Constants borrowed from Astropy 2 | 3 | // constants in MKS 4 | const double C_th = 299792458.0; // speed of light in m / s 5 | const double K_B_th = 1.38064852e-23; // Boltzmann constant in J / K 6 | const double H_th = 6.62607015e-34; // Planck constant in J s 7 | const double R_UNIV_th = 8.31446261815324; // universal gas constant in J / ( K mol ) 8 | const double SIGMA_SB_th = 5.6703744191844314e-08; // Stefan-Boltzmann constant in W / (K^4 m^2) 9 | const double AU_th = 149597870700.0; // astronomical unit in m 10 | const double AMU_th = 1.6605390666e-27; // atomic mass unit in kg 11 | 12 | const double Mass_E_th = 9.1093837015e-31; // mass of electron in kg 13 | 14 | const double Q_E_th = 1.602176634e-19; // charge of electron in Coulomb 15 | const double R_SUN_th = 695700000.0; // solar radius in m 16 | const double M_SUN_th = 1.988409870698051e+30; // solar mass in kg 17 | const double R_JUP_th = 71492000.0; // radius Jupiter in m 18 | const double M_JUP_th = 1.8981245973360505e+27; // mass Jupiter in kg 19 | const double R_EARTH_th = 6378100.0; // radius Earth in m 20 | const double M_EARTH_th = 5.972167867791379e+24; // mass Earth in kg 21 | const double G_th = 6.6743e-11; // gravitational constant m^3 / ( kg s^2) 22 | const double GAMMA_th = 0.5772156649; // Euler-Mascheroni constant 23 | -------------------------------------------------------------------------------- /src/headers/reduction_min.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // 22 | // Description: Computes the reduction minimum value of an array 23 | // 24 | // 25 | // Method: - 26 | // 27 | // Known limitations: None. 28 | // 29 | // Known issues: None. 30 | // 31 | // 32 | // If you use this code please cite the following reference: 33 | // 34 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 35 | // 36 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 37 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 38 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 39 | // 40 | // History: 41 | // Version Date Comment 42 | // ======= ==== ======= 43 | // 2.0 30/11/2018 Released version (RD & US) 44 | // 1.0 16/08/2017 Released version (JM) 45 | // 46 | //////////////////////////////////////////////////////////////////////// 47 | #pragma once 48 | 49 | #include 50 | #include 51 | 52 | #include "log_writer.h" 53 | 54 | const double dmax = std::numeric_limits::max(); 55 | 56 | // GPU reduction sum kernel 57 | template __global__ void gpu_reduction_min(double *d, double *o, long length) { 58 | // temporary memory for all tiles in that thread 59 | __shared__ double ds_in[2 * BLOCK_SIZE]; 60 | 61 | // import all the data from global memory 62 | int mem_offset1 = 2 * (blockDim.x * blockIdx.x + threadIdx.x); 63 | 64 | if (mem_offset1 + 1 < length) { 65 | *((double2 *)(&(ds_in[2 * threadIdx.x]))) = *((double2 *)(&(d[mem_offset1]))); 66 | } 67 | 68 | else if (mem_offset1 < length) { 69 | ds_in[2 * threadIdx.x] = d[mem_offset1]; 70 | ds_in[2 * threadIdx.x + 1] = dmax; 71 | } 72 | else { 73 | ds_in[2 * threadIdx.x] = dmax; 74 | ds_in[2 * threadIdx.x + 1] = dmax; 75 | } 76 | 77 | 78 | // loop on stride and add 79 | for (int stride = blockDim.x; stride > 0; stride /= 2) { 80 | __syncthreads(); 81 | if (threadIdx.x < stride) { 82 | ds_in[threadIdx.x] = min(ds_in[threadIdx.x + stride], ds_in[threadIdx.x]); 83 | } 84 | } 85 | 86 | __syncthreads(); 87 | 88 | // copy to output 89 | 90 | if (threadIdx.x == 0) 91 | o[blockIdx.x] = ds_in[0]; 92 | }; 93 | 94 | // host function running reduction add on data from device 95 | template __host__ double gpu_min_on_device(double *in_d, long length) { 96 | int num_blocks = ceil(double(length) / double(2 * BLOCK_SIZE)); 97 | 98 | double *out_h = new double[num_blocks]; 99 | double *out_d; 100 | // create device temp array 101 | cudaMalloc((void **)&out_d, num_blocks * sizeof(double)); 102 | cudaError_t err = cudaGetLastError(); 103 | if (err != cudaSuccess) 104 | log::printf("Malloc: %s\n", cudaGetErrorString(err)); 105 | 106 | 107 | gpu_reduction_min<<>>(in_d, out_d, length); 108 | err = cudaGetLastError(); 109 | if (err != cudaSuccess) 110 | log::printf("krnl: %s\n", cudaGetErrorString(err)); 111 | 112 | cudaMemcpy(out_h, out_d, num_blocks * sizeof(double), cudaMemcpyDeviceToHost); 113 | err = cudaGetLastError(); 114 | if (err != cudaSuccess) 115 | log::printf("cpyD2H: %s\n", cudaGetErrorString(err)); 116 | 117 | double out = std::numeric_limits::max(); 118 | for (int i = 0; i < num_blocks; i++) { 119 | out = std::min(out, out_h[i]); 120 | } 121 | 122 | cudaFree(out_d); 123 | delete[] out_h; 124 | 125 | 126 | return out; 127 | }; 128 | -------------------------------------------------------------------------------- /src/headers/simulation_setup.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // 20 | // 21 | // Description: Defines simulation parameters and switches that are used throughout the sim 22 | // 23 | // 24 | // Method: - 25 | // 26 | // 27 | // Known limitations: None 28 | // 29 | // 30 | // Known issues: None 31 | // 32 | // 33 | // If you use this code please cite the following reference: 34 | // 35 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 36 | // 37 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 38 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 39 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | #pragma once 49 | 50 | // Physical Constants 51 | #define kb_constant 1.38e-23 // Boltzmann constant [J/K] 52 | #define mu_constant 1.660e-27 // Atomic mass unit [kg] 53 | 54 | 55 | class SimulationSetup 56 | { 57 | 58 | public: 59 | char simulation_ID[160]; 60 | 61 | ////////////// 62 | // BULK // 63 | ////////////// 64 | 65 | double A; 66 | double Omega; 67 | double Gravit; 68 | bool GravHeightVar; 69 | 70 | //////////////// 71 | // ATMOSPHERE // 72 | //////////////// 73 | 74 | double Rd; 75 | 76 | double Cp; 77 | double Tmean; 78 | double P_Ref; 79 | double Top_altitude; 80 | double Diffc; 81 | double Diffc_v; 82 | double DivDampc; 83 | 84 | // Sim 85 | bool DeepModel; 86 | bool HyDiff; // Turn on/off hyper-diffusion. 87 | int HyDiffOrder; 88 | bool DivDampP; // Turn on/off divergence damping. 89 | bool VertHyDiff; // vertical hyper diffusion 90 | int VertHyDiffOrder; 91 | bool NonHydro; // Turn on/off non-hydrostatic. 92 | bool globdiag; // calc/output globdiag quantities 93 | 94 | int increased_damping_for_n_steps; //increase all forms of damping for first n steps 95 | 96 | 97 | // top sponge layer master switches 98 | bool RayleighSponge; // Use sponge layer (rayleigh drag)? 99 | bool RayleighSpongeT; // include thermal term in sponge layer? 100 | bool DiffSponge; // Diffusive sponge 101 | 102 | bool output_mean; //whether or not to output time mean quantities 103 | bool 104 | out_interm_momentum; //output intermediate momentum values (start of time step & after profx) 105 | bool output_diffusion; //output hyperdiffusion operators, etc 106 | 107 | bool conv_adj; 108 | int conv_adj_iter; 109 | bool soft_adjustment; 110 | 111 | bool gcm_off; 112 | bool single_column; 113 | 114 | bool rest; 115 | 116 | int n_out; 117 | 118 | SimulationSetup(); 119 | }; 120 | -------------------------------------------------------------------------------- /src/headers/testing.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: helpers for unit testing 20 | // 21 | // 22 | // Known limitations: None. 23 | // 24 | // 25 | // Known issues: None. 26 | // 27 | // 28 | // If you use this code please cite the following reference: 29 | // 30 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 31 | // 32 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 33 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 34 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 35 | // 36 | // History: 37 | // Version Date Comment 38 | // ======= ==== ======= 39 | // 2.0 30/11/2018 Released version (RD & US) 40 | // 1.0 16/08/2017 Released version (JM) 41 | // 42 | //////////////////////////////////////////////////////////////////////// 43 | #pragma once 44 | 45 | #include 46 | #include 47 | 48 | using std::cout; 49 | using std::endl; 50 | 51 | // helper function to check a variable against a reference and write 52 | // out to console if they are not equaly. 53 | template bool test_val(const string& txt, const T& val, const T& ref) { 54 | if (val == ref) 55 | return true; 56 | else { 57 | cout << "wrong value: " << txt << " expected: " << ref << " got: " << val << endl; 58 | return false; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/physics/managers/empty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | project (phy_modules) 3 | 4 | set(MODULES_SRCS 5 | src/phy_modules.cu 6 | ) 7 | 8 | 9 | include_directories(${THOR_ROOT_INCLUDES} ${SHARED_PHY_MODULES_INC_DIR}) 10 | include_directories(inc) 11 | add_library(phy_modules STATIC ${MODULES_SRCS}) 12 | -------------------------------------------------------------------------------- /src/physics/managers/empty/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for phy modules tempalte, called from main makefile 2 | # must create libphy_modules.a in its root directory 3 | 4 | $(info Modules Template Makefile ) 5 | 6 | # set some variables if not set 7 | includedir ?= unset 8 | h5include ?= unset 9 | cpp_flags ?= unset 10 | cuda_flags ?= unset 11 | arch ?= unset 12 | 13 | $(info Some variables inherited from parent makefiles) 14 | $(info includes: $(includedir)) 15 | $(info h5includes: $(h5include)) 16 | $(info cpp_flags: $(cpp_flags)) 17 | $(info cuda_flags: $(cuda_flags)) 18 | $(info arch: $(arch)) 19 | $(info CC compile flag: $(CC_comp_flag)) 20 | $(info Sub Makefile variables) 21 | 22 | ###################################################################### 23 | # Directories 24 | THOR_ROOT = ../../../../ 25 | 26 | # Includes 27 | LOCAL_INCLUDE = inc 28 | 29 | # shared modules 30 | SHARED_MODULES_INCLUDE = $(THOR_ROOT)src/physics/modules/inc/ 31 | 32 | # thor root include if we want to use code from there 33 | THOR_INCLUDE = $(THOR_ROOT)src/headers 34 | 35 | # source dirs 36 | LOCAL_SOURCES = src 37 | SHARED_MODULES_DIR = $(THOR_ROOT)src/physics/modules/src/ 38 | 39 | # object directory 40 | BUILDDIR = obj 41 | 42 | 43 | all: libphy_modules.a 44 | 45 | # path to local module code 46 | vpath %.cu $(LOCAL_SOURCES) 47 | vpath %.cpp $(LOCAL_SOURCES) 48 | vpath %.h $(LOCAL_INCLUDE) 49 | # path to thor headers 50 | vpath %.h $(THOR_INCLUDE) 51 | # path to phy_modules 52 | vpath %.h $(SHARED_MODULES_INCLUDE) 53 | vpath %.cu $(SHARED_MODULES_DIR) 54 | vpath %.cpp $(SHARED_MODULES_DIR) 55 | 56 | 57 | ifndef VERBOSE 58 | .SILENT: 59 | endif 60 | 61 | ####################################################################### 62 | # create directory 63 | $(BUILDDIR): 64 | mkdir $@ 65 | ####################################################################### 66 | # build objects 67 | 68 | INCLUDE_DIRS = -I$(SHARED_MODULES_INCLUDE) -I$(THOR_INCLUDE) -I$(LOCAL_INCLUDE) 69 | 70 | $(BUILDDIR)/phy_modules.o: phy_modules.cu phy_modules.h phy_module_base.h | $(BUILDDIR) 71 | @echo -e '$(YELLOW)creating $@ $(END)' 72 | $(CC) $(CC_comp_flag) $(arch) $(cuda_flags) $(h5include) $(INCLUDE_DIRS) $(CDB) -o $@ $<; \ 73 | 74 | 75 | libphy_modules.a: $(BUILDDIR)/phy_modules.o | $(BUILDDIR) 76 | @echo -e '$(YELLOW)creating $@ $(END)' 77 | @echo -e '$(GREEN)Linking Modules into static lib $(END)' 78 | ar rcs $@ $(BUILDDIR)/phy_modules.o 79 | 80 | ####################################################################### 81 | # Cleanup 82 | .phony: clean,ar 83 | clean: 84 | @echo -e '$(CYAN)clean up library $(END)' 85 | -$(RM) libphy_modules.a 86 | @echo -e '$(CYAN)clean up modules objects $(END)' 87 | -$(RM) $(BUILDDIR)/phy_modules.o 88 | -$(RM) $(BUILDDIR)/phy_modules.o.json 89 | @echo -e '$(CYAN)remove modules object dir $(END)' 90 | -$(RM) -d $(BUILDDIR) 91 | -------------------------------------------------------------------------------- /src/physics/managers/empty/src/phy_modules.cu: -------------------------------------------------------------------------------- 1 | // empty physical modules template 2 | // copy to your module folder and fill in the blanks. 3 | // see examples in modules_simple_template 4 | // and modules_complex_template 5 | 6 | #include "phy_modules.h" 7 | 8 | std::string phy_modules_get_name() { 9 | return std::string("empty"); 10 | } 11 | 12 | void phy_modules_print_config() { 13 | log::printf(" empty physics module\n"); 14 | } 15 | 16 | bool phy_modules_init_mem(const ESP& esp, device_RK_array_manager& phy_modules_core_arrays) { 17 | 18 | // initialise memory on device and host 19 | 20 | // register with 21 | // -> phy_modules_core_arrays(double* array, double* arrayk, double* arrayi, int dimensions) 22 | // the device arrays that need to be updated by Runge Kutta scheme in main dynamical core loop 23 | return true; 24 | } 25 | 26 | bool phy_modules_init_data(const ESP& esp, const SimulationSetup& sim, storage* s) { 27 | 28 | // initialise the initial conditions 29 | 30 | // if storage * s pointer is not a nullptr, reload your initial conditions from that file 31 | 32 | return true; 33 | } 34 | 35 | bool phy_modules_generate_config(config_file& config_reader) { 36 | 37 | // register configuration variables with config_reader. 38 | // define variable to be written to, as global or as variale in a subclass 39 | // config_reader.append_config_var("name_in_config_file", , 40 | // ); 41 | 42 | return true; 43 | } 44 | 45 | // *********************************************************************************************** 46 | // Dynamical core update steps 47 | 48 | bool phy_modules_dyn_core_loop_init(const ESP& esp) { 49 | 50 | // called before starting dynamical core update to swap buffers, zero out arrays, etc... 51 | 52 | return true; 53 | } 54 | 55 | // Slow modes, called after hyperdiffusion step 56 | bool phy_modules_dyn_core_loop_slow_modes(const ESP& esp, 57 | const SimulationSetup& sim, 58 | int nstep, // Step number 59 | double times) { // Time-step [s] 60 | 61 | return true; 62 | } 63 | 64 | // fast mode 65 | bool phy_modules_dyn_core_loop_fast_modes(const ESP& esp, 66 | const SimulationSetup& sim, 67 | int nstep, // Step number 68 | double time_step) { // Time-step [s] 69 | 70 | return true; 71 | } 72 | 73 | 74 | bool phy_modules_dyn_core_loop_end(const ESP& esp) { 75 | 76 | // called after dynamical core to update buffers 77 | 78 | return true; 79 | } 80 | 81 | bool phy_modules_phy_loop(ESP& esp, const SimulationSetup& sim, int nstep, double time_step) { 82 | 83 | 84 | return true; 85 | } 86 | 87 | bool phy_modules_store_init(storage& s) { 88 | // store initial conditions to initial file 89 | return true; 90 | } 91 | 92 | 93 | bool phy_modules_store(const ESP& esp, storage& s) { 94 | // store state to output file 95 | return true; 96 | } 97 | 98 | 99 | bool phy_modules_free_mem() { 100 | // free memory at end of run 101 | return true; 102 | } 103 | -------------------------------------------------------------------------------- /src/physics/managers/multi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | project (phy_modules) 3 | 4 | set(MODULES_SRCS 5 | src/phy_modules.cu 6 | ${SHARED_PHY_MODULES_SRC_DIR}/radiative_transfer.cu 7 | ${SHARED_PHY_MODULES_SRC_DIR}/boundary_layer.cu 8 | ) 9 | 10 | 11 | include_directories(${THOR_ROOT_INCLUDES} ${SHARED_PHY_MODULES_INC_DIR}) 12 | include_directories(inc) 13 | add_library(phy_modules STATIC ${MODULES_SRCS}) 14 | -------------------------------------------------------------------------------- /src/physics/modules/inc/chemistry.h: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // ESP - Exoclimes Simulation Platform. (version 1.0) 20 | // 21 | // 22 | // 23 | // Method: Chemistry physics module 24 | // 25 | // 26 | // Known limitations: - Runs in a single GPU. 27 | // 28 | // Known issues: None 29 | // 30 | // 31 | // If you use this code please cite the following reference: 32 | // 33 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 34 | // 35 | // Current Code Owner: Joao Mendonca, EEG. joao.mendonca@csh.unibe.ch 36 | // 37 | // History: 38 | // Version Date Comment 39 | // ======= ==== ======= 40 | // 41 | // 1.0 16/08/2017 Released version (JM) 42 | // 43 | //////////////////////////////////////////////////////////////////////// 44 | 45 | #pragma once 46 | 47 | #include "phy_module_base.h" 48 | 49 | class chemistry : public phy_module_base 50 | { 51 | public: 52 | chemistry(); 53 | ~chemistry(); 54 | 55 | bool initialise_memory(const ESP &esp, device_RK_array_manager &phy_modules_core_arrays); 56 | 57 | bool initial_conditions(const ESP &esp, const SimulationSetup &sim, storage *s); 58 | 59 | bool dyn_core_loop_init(const ESP &esp); 60 | 61 | bool dyn_core_loop_slow_modes(const ESP & esp, 62 | const SimulationSetup &sim, 63 | int nstep, // Step number 64 | double time_step); // Time-step [s] 65 | 66 | bool dyn_core_loop_fast_modes(const ESP & esp, 67 | const SimulationSetup &sim, 68 | int nstep, // Step number 69 | double times); // Time-step [s] 70 | 71 | bool dyn_core_loop_end(const ESP &esp); 72 | 73 | bool phy_loop(ESP & esp, 74 | const SimulationSetup &sim, 75 | kernel_diagnostics & diag, 76 | int nstep, // Step number 77 | double time_step); // Time-step [s] 78 | 79 | bool store(const ESP &esp, storage &s); 80 | 81 | bool store_init(storage &s); 82 | 83 | bool configure(config_file &config_reader); 84 | 85 | virtual bool free_memory(); 86 | 87 | void print_config(); 88 | 89 | private: 90 | int ntr = 5; 91 | 92 | // host array 93 | double *tauch4_h; 94 | double *tauco_h; 95 | double *tauh2o_h; 96 | double *tauco2_h; 97 | double *taunh3_h; 98 | 99 | double *ch4eq_h; 100 | double *coeq_h; 101 | double *h2oeq_h; 102 | double *co2eq_h; 103 | double *nh3eq_h; 104 | 105 | double *P_che_h; 106 | double *T_che_h; 107 | 108 | double *tracer_h; 109 | 110 | // device arrays 111 | double *tauch4_d; 112 | double *tauco_d; 113 | double *tauh2o_d; 114 | double *tauco2_d; 115 | double *taunh3_d; 116 | 117 | double *ch4eq_d; 118 | double *coeq_d; 119 | double *h2oeq_d; 120 | double *co2eq_d; 121 | double *nh3eq_d; 122 | 123 | double *tracer_d; 124 | double *tracers_d; 125 | double *tracerk_d; 126 | 127 | double *P_che_d; 128 | double *T_che_d; 129 | 130 | double *difftr_d; 131 | 132 | // filename parameters 133 | std::string chem_time_filename; 134 | std::string fEQ_filename; 135 | }; 136 | -------------------------------------------------------------------------------- /src/physics/modules/inc/chemistry_host.h: -------------------------------------------------------------------------------- 1 | __host__ double BilinearInterpolation_host(double q11, 2 | double q12, 3 | double q21, 4 | double q22, 5 | double x1, 6 | double x2, 7 | double y1, 8 | double y2, 9 | double x, 10 | double y) { 11 | 12 | float x2x1, y2y1, x2x, y2y, yy1, xx1; 13 | 14 | x2x1 = x2 - x1; 15 | y2y1 = y2 - y1; 16 | x2x = x2 - x; 17 | y2y = y2 - y; 18 | yy1 = y - y1; 19 | xx1 = x - x1; 20 | 21 | return 1.0 / (x2x1 * y2y1) * (q11 * x2x * y2y + q21 * xx1 * y2y + q12 * x2x * yy1 + q22 * xx1 * yy1); 22 | } 23 | 24 | 25 | __host__ int locate_min_i_host(double *array_d, 26 | int N, 27 | double val) { 28 | 29 | int id = -1; 30 | if (val >= array_d[N - 1]) { 31 | id = N - 2; 32 | } 33 | else if (val < array_d[0]) { 34 | id = 0; 35 | } 36 | else { 37 | for (int j = 1; j < N; j++) { 38 | if (val >= array_d[j - 1] && val < array_d[j]) { 39 | id = j - 1; 40 | break; 41 | } 42 | } 43 | } 44 | return id; 45 | } 46 | 47 | __host__ int locate_max_i_host(double *array_d, 48 | int N, 49 | double val) { 50 | 51 | int id = -1; 52 | if (val >= array_d[N - 1]) { 53 | id = N - 1; 54 | } 55 | else if (val < array_d[0]) { 56 | id = 1; 57 | } 58 | else { 59 | for (int j = 1; j < N; j++) { 60 | if (val >= array_d[j - 1] && val < array_d[j]) { 61 | id = j; 62 | break; 63 | } 64 | } 65 | } 66 | return id; 67 | } 68 | 69 | __host__ double Compute_tracer_host(double *treq, 70 | double *P_che, 71 | double *T_che, 72 | double temperature, 73 | double pressure) { 74 | 75 | // 76 | // Description: 77 | // 78 | // 79 | // 80 | // Input: . 81 | // 82 | // Output: 83 | // 84 | 85 | 86 | double T, lP, P; 87 | 88 | int NT = 55; 89 | int NP = 135; 90 | 91 | int TMIN, TMAX; 92 | int PMIN, PMAX; 93 | 94 | double q11, q12, q21, q22; 95 | double x1, x2, y1, y2; 96 | double x, y; 97 | double tr; 98 | 99 | 100 | P = pressure / 100000.0; 101 | lP = log(P); 102 | T = temperature; 103 | 104 | if (lP < P_che[0]) lP = P_che[0]; 105 | if (lP > P_che[NP - 1]) lP = P_che[NP - 1]; 106 | if (T < T_che[0]) T = T_che[0]; 107 | if (T > T_che[NT - 1]) T = T_che[NT - 1]; 108 | 109 | // Find the 4 nearst points. 110 | TMIN = locate_min_i_host(T_che, 111 | NT, 112 | T); 113 | TMAX = locate_max_i_host(T_che, 114 | NT, 115 | T); 116 | 117 | PMIN = locate_min_i_host(P_che, 118 | NP, 119 | lP); 120 | PMAX = locate_max_i_host(P_che, 121 | NP, 122 | lP); 123 | 124 | // Interpolate timescale. 125 | q11 = treq[PMIN * NT + TMIN]; 126 | q12 = treq[PMIN * NT + TMAX]; 127 | q21 = treq[PMAX * NT + TMIN]; 128 | q22 = treq[PMAX * NT + TMAX]; 129 | x1 = T_che[TMIN]; 130 | x2 = T_che[TMAX]; 131 | y1 = P_che[PMIN]; 132 | y2 = P_che[PMAX]; 133 | x = T; 134 | y = lP; 135 | 136 | tr = BilinearInterpolation_host(q11, 137 | q12, 138 | q21, 139 | q22, 140 | x1, 141 | x2, 142 | y1, 143 | y2, 144 | x, 145 | y); 146 | 147 | return tr; 148 | } -------------------------------------------------------------------------------- /src/physics/modules/inc/phy_module_base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config_file.h" 4 | #include "define.h" 5 | #include "dyn/phy_modules_device.h" 6 | #include "esp.h" 7 | #include "log_writer.h" 8 | #include "simulation_setup.h" 9 | #include "storage.h" 10 | 11 | class phy_module_base 12 | { 13 | public: 14 | phy_module_base(){}; 15 | 16 | ~phy_module_base(){}; 17 | 18 | 19 | virtual bool initialise_memory(const ESP& esp, 20 | device_RK_array_manager& phy_modules_core_arrays) = 0; 21 | virtual bool initial_conditions(const ESP& esp, const SimulationSetup& sim, storage* s) = 0; 22 | 23 | virtual bool dyn_core_loop_init(const ESP& esp) { 24 | return true; 25 | }; 26 | virtual bool dyn_core_loop_slow_modes(const ESP& esp, 27 | const SimulationSetup& sim, 28 | 29 | int nstep, // Step number 30 | double times) // Time-step [s] 31 | { 32 | return true; 33 | }; 34 | virtual bool dyn_core_loop_fast_modes(const ESP& esp, 35 | const SimulationSetup& sim, 36 | int nstep, // Step number 37 | double time_step) // Time-step [s] 38 | { 39 | return true; 40 | }; 41 | virtual bool dyn_core_loop_end(const ESP& esp) { 42 | return true; 43 | }; 44 | 45 | virtual bool phy_loop(ESP& esp, 46 | const SimulationSetup& sim, 47 | kernel_diagnostics& diag, 48 | int nstep, // Step number 49 | double time_step // Time-step [s] 50 | ) = 0; 51 | 52 | 53 | virtual bool store(const ESP& esp, storage& s) = 0; 54 | 55 | virtual bool configure(config_file& config_reader) = 0; 56 | 57 | virtual bool free_memory() = 0; 58 | }; 59 | -------------------------------------------------------------------------------- /src/physics/physics_modules.org: -------------------------------------------------------------------------------- 1 | 2 | * Physics 3 | THOR runs the GCM dynamical core and can then run specific physics function for various simulations. Different users will want to use the dynamical core with different physics, thus, it is possible to compile physics outside of the THOR directory tree, to keep it separated from the dynamical core code. 4 | 5 | 6 | ** Code structure for Physics code 7 | The code is separated in a physics manager, that can live in an external code repository, separate from the GCM Core. 8 | 9 | They are compiled as a library that the THOR makefile integrates, and must provide an interface defined by [[src/headers/phy_modules.h][src/headers/phy_modules.h]]. 10 | 11 | 12 | *** Physics manager interface 13 | The manager code is called by THOR at various points along the run of the simulation, to perform what's needed from the sim. 14 | 15 | They will receive the state from the dynamical core and should define their own variables for simulation. 16 | 17 | **** Initialise and Configure 18 | 19 | **** Allocate and free memory 20 | Called at start and end to allocate and free memory used by on host and device 21 | 22 | **** Initialise Data 23 | TBD: should probably also receive startupfile? 24 | **** loop 25 | called after the dynamical core update in the main loop, receives the GCM state data and update their state. 26 | 27 | **** Store 28 | storage function receives a reference to a ~storage~ object, that points to the output file for the current timestep, already containing the dumps of the dynamic core. It has function to output tables and values, as ~int~ or ~double~. 29 | 30 | Using this, the physics module data gets automatically added to the dynamical core data. 31 | 32 | 33 | 34 | 35 | *** Physics 36 | Some shared physics examples are implemented in the ~modules~ directory, providing a standard interface, so that they can be easily reused in diverse managers implementing different combination of physics. 37 | 38 | ** Compiling modules 39 | The physics module should build a static library in its root directory, with the name libphy_modules.a. This will be linked into the main THOR code. 40 | The main Makefile calls the Makefile in the root of the physics module directory. This directory is found by the variable ~MODULES_SRC~, set in the ~Makefile.conf~ configuration makefile, used by the main makfile at the root of the project. 41 | It should also have a ~clean~ target, to clean up the build files. See the example directories. 42 | 43 | *NOTE* 44 | 45 | Physics modules are linked as a static library from the main makefile, so if you use any of the routines and classes provided by the main executable (e.g. ~storage~ class for output), you do not need to compile it and link it to the physics modules library, or you'll end up with errors about multiple definitions of some objects. 46 | 47 | ** Examples 48 | 49 | *** empty 50 | Bare skelton to implement your own basic module, this contains the minimum interface that is called by the dynamical core to run physics functions and does nothing. 51 | *** simple 52 | Simple example implementing radiative transfer directly in the physics module. 53 | *** multi 54 | Example that can use multiple physics modules. Currently contains radiative transfer example, using modules in an external directory, showing how modules can be implemented to be reused in multiple physical modules constructs. 55 | -------------------------------------------------------------------------------- /src/test/cmdargs_test.cpp: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: test for command line args 20 | // 21 | // 22 | // Method: reads command line args and does stuff in return. Needs 23 | // external calling 24 | // 25 | // Known limitations: None. 26 | // 27 | // 28 | // Known issues: None. 29 | // 30 | // 31 | // Current Code Owner: Joao Mendonca, EEG. joao.mendonca@csh.unibe.ch 32 | // 33 | // If you use this code please cite the following reference: 34 | // 35 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 36 | // 37 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 38 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 39 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 40 | // 41 | // History: 42 | // Version Date Comment 43 | // ======= ==== ======= 44 | // 2.0 30/11/2018 Released version (RD & US) 45 | // 1.0 16/08/2017 Released version (JM) 46 | // 47 | //////////////////////////////////////////////////////////////////////// 48 | 49 | 50 | #include 51 | #include 52 | 53 | #include "cmdargs.h" 54 | #include "testing.h" 55 | 56 | using namespace std; 57 | 58 | 59 | int main(int argc, char** argv) { 60 | cout << "commandline file test" << endl; 61 | 62 | cmdargs argparser("cmdargs_test", "tester for argument parser"); 63 | 64 | argparser.add_positional_arg(string("positional"), "positional argument"); 65 | 66 | argparser.add_arg("i", "int", -1, "int argument"); 67 | argparser.add_arg("b", "bool", true, "boolean argument"); 68 | argparser.add_arg("n", "negbool", false, "negative boolean argument"); 69 | argparser.add_arg("d", "double", 1e-5, "double argument"); 70 | argparser.add_arg("s", "string", string("test"), "string argument"); 71 | argparser.parse(argc, argv); 72 | 73 | // positional args 74 | string positional_arg_string = "fart"; 75 | bool positional_arg_string_set = argparser.get_positional_arg(positional_arg_string); 76 | printf("# positional argument - value: %s\tset: %d\n", 77 | positional_arg_string.c_str(), 78 | positional_arg_string_set); 79 | 80 | 81 | // keyqord args 82 | int test_arg_int = -100; 83 | bool test_arg_int_set = argparser.get_arg("int", test_arg_int); 84 | printf("int - value: %d\tset: %d\n", test_arg_int, test_arg_int_set); 85 | 86 | // In this example case, boolean is false by default and key puts it to true 87 | bool test_arg_bool = false; 88 | bool test_arg_bool_set = argparser.get_arg("bool", test_arg_bool); 89 | printf("bool - value: %d\tset: %d\n", test_arg_bool, test_arg_bool_set); 90 | 91 | // In this example case, boolean is true by default and key puts it to false 92 | bool test_arg_negbool = true; 93 | bool test_arg_negbool_set = argparser.get_arg("negbool", test_arg_negbool); 94 | printf("negbool - value: %d\tset: %d\n", test_arg_negbool, test_arg_negbool_set); 95 | 96 | double test_arg_double = -1e5; 97 | bool test_arg_double_set = argparser.get_arg("double", test_arg_double); 98 | printf("double - value: %e\tset: %d\n", test_arg_double, test_arg_double_set); 99 | 100 | string test_arg_string = "fart"; 101 | bool test_arg_string_set = argparser.get_arg("string", test_arg_string); 102 | printf("string - value: %s\tset: %d\n", test_arg_string.c_str(), test_arg_string_set); 103 | } 104 | -------------------------------------------------------------------------------- /src/test/codetest/test_fun_ptr.cpp: -------------------------------------------------------------------------------- 1 | // short example to test function callback objects 2 | // compile with: 3 | // $ g++ -Wall --std=c++11 test_fun_ptr.cpp -o fun 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std::placeholders; // for _1, _2 etc. 12 | 13 | // define our container structure 14 | struct data_def { 15 | std::string name; 16 | float* array_ptr; 17 | int array_size; 18 | std::function fun; 19 | }; 20 | 21 | 22 | // define a class that knows how to print stuff 23 | class knowsaboutdata 24 | { 25 | public: 26 | knowsaboutdata(){ 27 | 28 | }; 29 | // define some functions 30 | 31 | // how to handle 1D index 32 | std::string index_1d(int idx) { 33 | char buff[100]; 34 | snprintf(buff, sizeof(buff), "%d", idx); 35 | std::string buff_string = buff; 36 | 37 | return buff_string; 38 | } 39 | 40 | // how to handle 2d index 41 | std::string index_2d(int c) { 42 | std::ostringstream string_stream; 43 | 44 | string_stream << c / array2d_size_x << "\t" << c % array2d_size_y; 45 | 46 | //std::string copy_of_str = string_stream.str(); 47 | 48 | //return copy_of_str; 49 | return string_stream.str(); 50 | } 51 | 52 | // some data arrays 53 | float array1d[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; 54 | const int array1d_size = 13; 55 | float array2d[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; 56 | const int array2d_size_x = 3; 57 | const int array2d_size_y = 3; 58 | }; 59 | 60 | 61 | void print_def(data_def& d, int i) { 62 | std::string coord = ""; 63 | if (d.fun != nullptr) coord = d.fun(i); 64 | 65 | std::cout << d.name << "\t" << i << "\t" << coord << std::endl; 66 | } 67 | 68 | 69 | int main(int argc, char* argv[]) { 70 | knowsaboutdata kad; 71 | // define array of definitions 72 | std::vector data_definitions = { 73 | {std::string("array1d"), 74 | kad.array1d, 75 | kad.array1d_size, 76 | std::bind(&knowsaboutdata::index_1d, &kad, _1)}, 77 | {std::string("array2d"), 78 | kad.array2d, 79 | kad.array2d_size_x * kad.array2d_size_y, 80 | std::bind(&knowsaboutdata::index_2d, &kad, _1)}, 81 | // the empty function case 82 | {"array1d_nofun", kad.array1d, kad.array1d_size, std::function()}}; 83 | 84 | // loop on definitions and print out index 4 85 | for (auto& def : data_definitions) { print_def(def, 7); } 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /src/test/codetest/test_tmpl.cpp: -------------------------------------------------------------------------------- 1 | #include "test_tmpl.h" 2 | 3 | int main() { 4 | std::cout << "start" << std::endl; 5 | 6 | // This prints standard base class 7 | test t; 8 | 9 | t.print(42); 10 | t.print2(); 11 | 12 | //try template specialisation 13 | test t2; 14 | 15 | t2.print(true); 16 | t2.print2(); 17 | 18 | std::cout << "done" << std::endl; 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/codetest/test_tmpl.h: -------------------------------------------------------------------------------- 1 | // Simple test for template specialisation, with just one specialised function 2 | // build with g++ test_tmpl.cpp -o test_tmpl 3 | 4 | #include 5 | 6 | 7 | class test_interface 8 | { 9 | public: 10 | virtual void print2() = 0; 11 | }; 12 | 13 | 14 | template 15 | class test: public test_interface 16 | { 17 | public: 18 | void print(T in) { 19 | std::cout << "Test: " << in << std::endl; 20 | }; 21 | 22 | void print2() { 23 | std::cout << "Test2 " << std::endl; 24 | }; 25 | }; 26 | 27 | template<> 28 | void test::print2() { 29 | std::cout << "Test2 specialised " << std::endl; 30 | }; 31 | -------------------------------------------------------------------------------- /src/test/storage_test.cpp: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: test for storage class 20 | // 21 | // 22 | // Method: writes an array to a file and reloads it 23 | // 24 | // Known limitations: None. 25 | // 26 | // 27 | // Known issues: None. 28 | // 29 | // 30 | // 31 | // If you use this code please cite the following reference: 32 | // 33 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 34 | // 35 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 36 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 37 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 38 | // 39 | // History: 40 | // Version Date Comment 41 | // ======= ==== ======= 42 | // 2.0 30/11/2018 Released version (RD & US) 43 | // 1.0 16/08/2017 Released version (JM) 44 | // 45 | //////////////////////////////////////////////////////////////////////// 46 | 47 | 48 | #include 49 | 50 | #include "storage.h" 51 | #include 52 | 53 | using namespace std; 54 | 55 | 56 | const int num_d = 1024; 57 | const int num_i = 100; 58 | 59 | 60 | int main() { 61 | cout << "Storage test" << endl; 62 | 63 | { 64 | 65 | storage f("out.h5"); 66 | 67 | uint32_t s = num_d; 68 | 69 | double d[s]; 70 | 71 | for (int i = 0; i < num_d; i++) 72 | d[i] = double(i) / double(s); 73 | 74 | f.append_table(d, s, "Numbers", "m", "Number table"); 75 | 76 | uint32_t s2 = num_i; 77 | 78 | int d2[s2]; 79 | for (int i = 0; i < num_i; i++) 80 | d2[i] = i; 81 | 82 | f.append_table(d2, s2, "Indices", "m^2", "indices table"); 83 | } 84 | 85 | { 86 | 87 | storage f("out.h5", true); 88 | 89 | { 90 | 91 | int size_out = 0; 92 | 93 | std::unique_ptr data_ptr = nullptr; 94 | 95 | f.read_table("Numbers", data_ptr, size_out); 96 | if (size_out != num_d) 97 | cout << "error on size of table. Got: " << size_out << "\texpected: " << num_d 98 | << endl; 99 | else { 100 | int cnt = 0; 101 | 102 | for (int i = 0; i < size_out; i++) { 103 | double dat = double(i) / double(size_out); 104 | 105 | if (data_ptr[i] != dat) { 106 | 107 | cout << "wrong data(" << i << ")" 108 | << "\tGot:\t" << data_ptr[i] << "\texpected:\t" << dat << endl; 109 | cnt++; 110 | } 111 | } 112 | if (cnt > 0) 113 | cout << "got " << cnt << " wrong data points" << endl; 114 | } 115 | } 116 | 117 | { 118 | int size_out = 0; 119 | 120 | std::unique_ptr data_ptr = nullptr; 121 | 122 | f.read_table("Indices", data_ptr, size_out); 123 | if (size_out != num_i) 124 | cout << "error on size of table. Got: " << size_out << "\texpected: " << num_i 125 | << endl; 126 | else { 127 | int cnt = 0; 128 | 129 | for (int i = 0; i < size_out; i++) { 130 | if (data_ptr[i] != i) 131 | cout << "wrong data(" << i << ")" 132 | << "\tGot:\t" << data_ptr[i] << "\texpected:\t" << i << endl; 133 | } 134 | if (cnt > 0) 135 | cout << "got " << cnt << " wrong data points" << endl; 136 | } 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/utils/cuda_device_memory.cu: -------------------------------------------------------------------------------- 1 | #include "cuda_device_memory.h" 2 | 3 | 4 | cuda_device_memory_manager& cuda_device_memory_manager::get_instance() { 5 | static cuda_device_memory_manager cdmm; 6 | 7 | return cdmm; 8 | } 9 | 10 | cuda_device_memory_manager::cuda_device_memory_manager() { 11 | 12 | }; 13 | 14 | cuda_device_memory_manager::~cuda_device_memory_manager() { 15 | deallocate(); 16 | }; 17 | 18 | void cuda_device_memory_manager::register_mem(cuda_device_memory_interface * cdm) 19 | { 20 | device_memory.push_back(cdm); 21 | }; 22 | 23 | void cuda_device_memory_manager::unregister_mem(cuda_device_memory_interface * cdm) 24 | { 25 | 26 | vector::iterator position = std::find(device_memory.begin(), device_memory.end(), cdm); 27 | if (position != device_memory.end()) // == myVector.end() means the element was not found 28 | device_memory.erase(position); 29 | }; 30 | 31 | void cuda_device_memory_manager::deallocate() 32 | { 33 | for (auto & cdm: device_memory) 34 | { 35 | cdm->deallocate(); 36 | } 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /src/utils/diagnostics.cu: -------------------------------------------------------------------------------- 1 | #include "diagnostics.h" 2 | #include "directories.h" 3 | #include "esp.h" 4 | #include 5 | 6 | kernel_diagnostics::kernel_diagnostics(ESP& esp) { 7 | // use number of points times number of interfaces, to fit all data sizes 8 | diagnostics.allocate(esp.point_num * esp.nvi); 9 | diagnostics_global_flag.allocate(1); 10 | } 11 | 12 | void kernel_diagnostics::reset_flag() { 13 | diagnostics_global_flag.zero(); 14 | } 15 | 16 | void kernel_diagnostics::reset() { 17 | diagnostics_global_flag.zero(); 18 | diagnostics.zero(); 19 | } 20 | 21 | bool kernel_diagnostics::check_flag() { 22 | std::shared_ptr global_flag_h = diagnostics_global_flag.get_host_data(); 23 | return global_flag_h[0] != 0; 24 | } 25 | 26 | unsigned int kernel_diagnostics::get_flag() { 27 | std::shared_ptr global_flag_h = diagnostics_global_flag.get_host_data(); 28 | return global_flag_h[0]; 29 | } 30 | 31 | 32 | // Dump data for grid, following grid config passed as argument 33 | void kernel_diagnostics::dump_data(string name, 34 | int iteration, 35 | int subiteration, 36 | int subsubiteration, 37 | ESP& esp, 38 | int grid_num_points, 39 | int vertical_num_points) { 40 | string output_dir = esp.get_output_dir(); 41 | path o(output_dir); 42 | o /= string("diagnostics"); 43 | 44 | create_output_dir(o.to_string()); 45 | o /= (string("diag_") + name + "_" + std::to_string(iteration) + "_" 46 | + std::to_string(subiteration) + "_" + std::to_string(subsubiteration) + ".txt"); 47 | FILE* pFile = fopen(o.to_string().c_str(), "w"); 48 | 49 | std::shared_ptr diag_data_h = diagnostics.get_host_data(); 50 | 51 | for (int p = 0; p < grid_num_points; p++) { 52 | for (int lev = 0; lev < vertical_num_points; lev++) { 53 | int idx = p * vertical_num_points + lev; 54 | if (diag_data_h[idx].flag != 0) { 55 | if ((diag_data_h[idx].flag & NAN_VALUE) != 0) 56 | fprintf(pFile, "NAN_VALUE - idx: %d - lev: %d\n", p, lev); 57 | if ((diag_data_h[idx].flag & NEGATIVE_VALUE) != 0) 58 | fprintf(pFile, 59 | "NEGATIVE_VALUE - idx: %d - lev: %d - value: %g\n", 60 | p, 61 | lev, 62 | diag_data_h[idx].data.x); 63 | if ((diag_data_h[idx].flag & THOMAS_NOT_DD) != 0) 64 | fprintf(pFile, 65 | "THOMAS_NOT_DD - idx: %d - lev: %d - aa: %g - bb: %g - cc_s: %g - sum: " 66 | "%g\n", 67 | p, 68 | lev, 69 | diag_data_h[idx].data.x, 70 | diag_data_h[idx].data.y, 71 | diag_data_h[idx].data.z, 72 | diag_data_h[idx].data.w); 73 | if ((diag_data_h[idx].flag & THOMAS_BAD_SOLUTION) != 0) { 74 | fprintf( 75 | pFile, 76 | "THOMAS_BAD_SOLUTION - idx: %d - lev: %d, DDvalue: %g, DDcomputed: %g \n", 77 | p, 78 | lev, 79 | diag_data_h[idx].data.x, 80 | diag_data_h[idx].data.y); 81 | } 82 | if ((diag_data_h[idx].flag & BL_THOMAS_NOT_DD) != 0) 83 | fprintf(pFile, 84 | "BL_THOMAS_NOT_DD - idx: %d - lev: %d - a: %g - b: %g - c: %g\n", 85 | p, 86 | lev, 87 | diag_data_h[idx].data.x, 88 | diag_data_h[idx].data.y, 89 | diag_data_h[idx].data.z); 90 | } 91 | } 92 | } 93 | fclose(pFile); 94 | } 95 | -------------------------------------------------------------------------------- /src/utils/iteration_timer.cpp: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Timer helper to measure time for iterations, elapsed time and time remaining 20 | // 21 | // 22 | // Known limitations: 23 | // 24 | // Known issues: None 25 | // 26 | // 27 | // If you use this code please cite the following reference: 28 | // 29 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 30 | // 31 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 32 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 33 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 34 | // 35 | // History: 36 | // Version Date Comment 37 | // ======= ==== ======= 38 | // 2.0 30/11/2018 Released version (RD & US) 39 | // 1.0 16/08/2017 Released version (JM) 40 | // 41 | //////////////////////////////////////////////////////////////////////// 42 | 43 | #include "iteration_timer.h" 44 | 45 | 46 | iteration_timer::iteration_timer(int initial_num_steps_, int max_steps_) : 47 | max_steps(max_steps_), 48 | initial_num_steps(initial_num_steps_) 49 | 50 | { 51 | start_sim = std::chrono::system_clock::now(); 52 | previous_sim_step = start_sim; 53 | } 54 | 55 | void iteration_timer::iteration(int nstep, 56 | double& mean_delta_per_step, 57 | double& step_delta, 58 | double& elapsed_time, 59 | double& time_left_, 60 | std::time_t& end_time) { 61 | // Get current time 62 | std::chrono::system_clock::time_point end_step = std::chrono::system_clock::now(); 63 | 64 | // time since simulation start 65 | std::chrono::duration> sim_delta = end_step - start_sim; 66 | std::chrono::duration> this_step_delta = 67 | end_step - previous_sim_step; 68 | 69 | // number of steps since simulation start and to end of simulation 70 | long num_steps_elapsed = nstep - initial_num_steps + 1; 71 | long num_steps_left = max_steps - (nstep + 1); 72 | 73 | // mean length of step 74 | mean_delta_per_step = sim_delta.count() / double(num_steps_elapsed); 75 | 76 | // time left to end of simulation 77 | std::chrono::duration> time_left(double(num_steps_left) 78 | * mean_delta_per_step); 79 | 80 | // estimated time of simulation 81 | std::chrono::system_clock::time_point sim_end = 82 | end_step + std::chrono::duration_cast(time_left); 83 | // format output 84 | end_time = std::chrono::system_clock::to_time_t(sim_end); 85 | 86 | step_delta = 87 | std::chrono::duration_cast(this_step_delta).count() * 1e-6; 88 | elapsed_time = sim_delta.count(); 89 | time_left_ = time_left.count(); 90 | previous_sim_step = end_step; 91 | } 92 | -------------------------------------------------------------------------------- /src/utils/storage.cpp: -------------------------------------------------------------------------------- 1 | // ============================================================================== 2 | // This file is part of THOR. 3 | // 4 | // THOR is free software : you can redistribute it and / or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // THOR is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 12 | // GNU General Public License for more details. 13 | // 14 | // You find a copy of the GNU General Public License in the main 15 | // THOR directory under .If not, see 16 | // . 17 | // ============================================================================== 18 | // 19 | // Description: Store binary arrays to a file, currently HDF5 20 | // abstracts storage type 21 | // 22 | // 23 | // 24 | // Method: Reads and write to files using names for output data 25 | // 26 | // Known limitations: None. 27 | // 28 | // 29 | // Known issues: None. 30 | // 31 | // 32 | // Current Code Owner: Joao Mendonca, EEG. joao.mendonca@csh.unibe.ch 33 | // 34 | // If you use this code please cite the following reference: 35 | // 36 | // [1] Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016 37 | // 38 | // Current Code Owners: Joao Mendonca (joao.mendonca@space.dtu.dk) 39 | // Russell Deitrick (russell.deitrick@csh.unibe.ch) 40 | // Urs Schroffenegger (urs.schroffenegger@csh.unibe.ch) 41 | // 42 | // History: 43 | // Version Date Comment 44 | // ======= ==== ======= 45 | // 2.0 30/11/2018 Released version (RD & US) 46 | // 1.0 16/08/2017 Released version (JM) 47 | // 48 | //////////////////////////////////////////////////////////////////////// 49 | 50 | 51 | #include "storage.h" 52 | #include "hdf5.h" 53 | #include 54 | 55 | using namespace std; 56 | 57 | 58 | storage::storage(const string& filename, const bool& read) : file(nullptr) { 59 | if (read) 60 | file = std::unique_ptr(new H5File(filename, H5F_ACC_RDONLY)); 61 | else 62 | file = std::unique_ptr(new H5File(filename, H5F_ACC_TRUNC)); 63 | 64 | // Avoid H5 to print all its exceptions to the console, as we want to handle them correctly 65 | Exception::dontPrint(); 66 | } 67 | -------------------------------------------------------------------------------- /tools/check_cuda.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) { 4 | cudaDeviceProp dP; 5 | float min_cc = 3.0; 6 | 7 | int rc = cudaGetDeviceProperties(&dP, 0); 8 | if (rc != cudaSuccess) { 9 | cudaError_t error = cudaGetLastError(); 10 | printf("CUDA error: %s", cudaGetErrorString(error)); 11 | return rc; /* Failure */ 12 | } 13 | if ((dP.major + (dP.minor / 10)) < min_cc) { 14 | printf("Min Compute Capability of %2.1f required: %d.%d found\n Not Building CUDA Code", 15 | min_cc, 16 | dP.major, 17 | dP.minor); 18 | return 1; /* Failure */ 19 | } 20 | else { 21 | printf("-arch=sm_%d%d\n", dP.major, dP.minor); 22 | return 0; /* Success */ 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/compare_merge_dumps.py: -------------------------------------------------------------------------------- 1 | 2 | import pathlib 3 | 4 | import h5py 5 | import numpy as np 6 | 7 | from tools.file_helpers import get_path_matching_regex_with_groups 8 | 9 | basepath_ref = pathlib.Path("rd_test/ref/") 10 | basepath_cmp = pathlib.Path("rd_test_258/ref/") 11 | 12 | patterns = ['bindata_Alf_comp_trans_1-{}.h5', 13 | 'bindata_Alf_dir_beam_trans_1-{}.h5', 14 | 'bindata_Alf_interpTnP_1-{}.h5', 15 | 'bindata_Alf_int_flx_1-{}.h5', 16 | 'bindata_Alf_pop_spec_flx_thomas_1-{}.h5', 17 | 'bindata_Alf_prep_flx_1-{}.h5', 18 | 'bindata_Alf_prep_II_1-{}.h5'] 19 | 20 | 21 | def compare_data(base_ref, base_cmp, fname, keys_in=None): 22 | keys = [] 23 | file_ref = base_ref / fname.format("merged") 24 | file_cmp = base_cmp / fname.format("merged") 25 | with h5py.File(file_ref, "r") as f_ref: 26 | with h5py.File(file_cmp, "r") as f_cmp: 27 | if keys_in is not None: 28 | keys = keys_in 29 | else: 30 | keys = f_ref.keys() 31 | 32 | for k in keys: 33 | data_ref = f_ref[k][...] 34 | data_cmp = f_cmp[k][...] 35 | 36 | l_r = len(data_ref) 37 | l_c = len(data_cmp) 38 | 39 | min_l = min(l_r, l_c) 40 | diffs = 0 41 | diff_zones = [] 42 | last_diff = -5 43 | diff_start = -5 44 | 45 | for i in range(min_l): 46 | difference = data_ref[i] != data_cmp[i] 47 | if difference: 48 | if last_diff != i-1: 49 | if diff_start != -5: 50 | diff_zones.append((diff_start, last_diff)) 51 | diff_start = i 52 | last_diff = i 53 | 54 | diffs += 1 55 | # if diffs < 100: 56 | # print( 57 | # f"difference[{i}]: {data_ref[i]} != {data_cmp[i]}") 58 | # break 59 | # for start, end in diff_zones: 60 | # print(f"\tzone: ({start}, {end}) d: {end - start}") 61 | print(f"dataset[{k}] - length ({l_r}, {l_c}) - diffs: {diffs}") 62 | 63 | 64 | for p in patterns: 65 | print(f"comparing: {p}") 66 | compare_data(basepath_ref, basepath_cmp, p) 67 | print() 68 | 69 | #compare_data(basepath_ref, basepath_cmp, patterns[0], keys_in=['w0u', 'w0l']) 70 | -------------------------------------------------------------------------------- /tools/file_helpers.py: -------------------------------------------------------------------------------- 1 | import re 2 | import pathlib 3 | 4 | 5 | def get_path_matching_regex(root_dir_, pattern): 6 | """ 7 | Find all files or directories with name matching the regex in directory 8 | 9 | Parameters 10 | ---------- 11 | root_dir_: path to directory to search 12 | pattern: regexp pattern to match, as used by `re` module 13 | 14 | Returns 15 | ------- 16 | files: list of pathlib Path files path matching the pattern 17 | """ 18 | matched = get_path_matching_regex_with_groups(root_dir_, pattern) 19 | files = [] 20 | for m in matched: 21 | files.append(m['path']) 22 | 23 | return files 24 | 25 | 26 | def get_path_matching_regex_with_groups(root_dir_, pattern): 27 | """ 28 | Find all files or directories with name matching the regex in directory, 29 | returning the groups of match. 30 | 31 | Parameters 32 | ---------- 33 | root_dir_: path to directory to search 34 | pattern: regexp pattern to match, as used by `re` module 35 | 36 | Returns 37 | ------- 38 | files: list of dictionnaries for files matching the pattern 39 | * 'path': pathlib.Path object for matching groups 40 | * 'groups': re.Match groups for groups in regexp 41 | 42 | Example 43 | ------- 44 | in directory with 45 | 46 | README.txt 47 | file_00.txt 48 | file_01.txt 49 | file_42.doc 50 | file_AA.txt 51 | 52 | calling 53 | 54 | get_path_matching_regex_with_groups(".", "file_(\d+).txt") 55 | 56 | 57 | returns: 58 | 59 | 60 | [{'path': PosixPath('/.../files_00.txt'), 'groups': ('00',)}, 61 | {'path': PosixPath('/.../files_01.txt'), 'groups': ('01',)}] 62 | 63 | 64 | 65 | """ 66 | search_regex = re.compile(pattern) 67 | root_dir = pathlib.Path(root_dir_) 68 | 69 | files = [] 70 | for p in sorted(root_dir.glob("*")): 71 | m = search_regex.fullmatch(p.name) 72 | if m is not None: 73 | files.append({'path': p, 'groups': m.groups()}) 74 | 75 | return files 76 | -------------------------------------------------------------------------------- /tools/gen_init_example.py: -------------------------------------------------------------------------------- 1 | # 2 | # example of how to use thor_ic_gen to generate and edit initial conditions 3 | # this sets up the initial conditions for earth_gwave_test.thr 4 | # 5 | 6 | import thor_ic_gen as ic 7 | 8 | base_file = {'name': 'gen_ic_earth', 9 | 'base_ifile': 'ifile/earth_gwave_test.thr', 10 | 'command_options': [], 11 | 'override': {'num_steps': '1', 12 | 'n_out': '10', 13 | 'glevel': '5', 14 | 'vlevel': '20', 15 | 'rest': 'true'}, 16 | 'status': 0, 17 | 'vertical_file': 'tools/TPprof_Earth_N1e-2.dat'} 18 | 19 | #run to make thor generate the h5 files 20 | ic.gen_h5_files(base_file) 21 | 22 | #now edit the h5 files 23 | ic.edit_init_file(base_file) 24 | -------------------------------------------------------------------------------- /tools/merge_dumps.py: -------------------------------------------------------------------------------- 1 | """quick and dirty debugging tool to merge multiple h5 files that get dumped in a loop over columns in Alfrodull""" 2 | 3 | import pathlib 4 | 5 | import h5py 6 | import numpy as np 7 | 8 | from tools.file_helpers import get_path_matching_regex_with_groups 9 | 10 | 11 | import argparse 12 | 13 | parser = argparse.ArgumentParser(description='merge multiple h5 dump files.') 14 | parser.add_argument('path', metavar='PATH', type=str, 15 | help='path of data') 16 | 17 | args = parser.parse_args() 18 | 19 | 20 | basepath = pathlib.Path(args.path) 21 | 22 | 23 | def merge_pattern(basepath, pattern): 24 | print('looking for files with pattern ' + pattern.format("(\d+)")) 25 | files = get_path_matching_regex_with_groups( 26 | basepath, pattern.format("(\d+)")) 27 | 28 | files = sorted(files, key=lambda d: int(d['groups'][0])) 29 | 30 | for f in files: 31 | print(f) 32 | 33 | # get keys from first file 34 | keys = [] 35 | with h5py.File(files[0]['path'], "r") as f: 36 | for k in f.keys(): 37 | keys.append((k, f[k].dtype)) 38 | 39 | outfile = h5py.File(basepath / pattern.format("merged"), "w") 40 | 41 | for k, dtype in keys: 42 | 43 | data = [] 44 | for f in files: 45 | 46 | p = f['path'] 47 | inpt = h5py.File(p, "r") 48 | data.append(inpt[k][...]) 49 | 50 | dataset = np.concatenate(data) 51 | 52 | dset = outfile.create_dataset(k, (len(dataset),), dtype=dtype) 53 | dset[...] = dataset 54 | 55 | outfile.close() 56 | 57 | 58 | patterns = ['bindata_Alf_comp_trans_1-{}.h5', 59 | 'bindata_Alf_dir_beam_trans_1-{}.h5', 60 | 'bindata_Alf_interpTnP_1-{}.h5', 61 | 'bindata_Alf_int_flx_1-{}.h5', 62 | 'bindata_Alf_pop_spec_flx_thomas_1-{}.h5', 63 | 'bindata_Alf_prep_flx_1-{}.h5', 64 | 'bindata_Alf_prep_II_1-{}.h5'] 65 | 66 | for p in patterns: 67 | merge_pattern(basepath, p) 68 | -------------------------------------------------------------------------------- /tools/thor_ic_tpprof_gen.py: -------------------------------------------------------------------------------- 1 | """Quick script to create the vertical altitude/pressure/density 2 | profiles needed for setting initial conditions for a THOR run. Just 3 | set the several variables below (including specifiying the name of the 4 | desired profile file), run the script, and you'll create an 5 | approximately-valid set of profiles. 6 | 7 | 8 | 2020-06-17 09:45 IJMC: Created and uploaded to THOR. 9 | """ 10 | 11 | 12 | import numpy as np 13 | 14 | #### Set initial parameters: 15 | 16 | # Parameters for Earth: 17 | rplanet = 1.0 * 6378136 # meters 18 | mplanet = 1.0 * 5.974e24 # kg 19 | pmin, psurf = 1e-6, 1 # bars 20 | MMW = 30 # atomic mass units 21 | temp = 270 # typical atmospheric temperature, in Kelvin 22 | nlayers = 1000 23 | outputfile = 'TPprof_Earth_simple.dat' 24 | 25 | 26 | # Parameters for a hot Neputune: 27 | rplanet = 4.72 * 6378136 # meters 28 | mplanet = 29.32 * 5.974e24 # kg 29 | pmin, psurf = 1e-4, 300 # bars 30 | MMW = 2.3 # atomic mass units 31 | temp = 2000 # typical atmospheric temperature, in Kelvin 32 | nlayers = 1000 33 | outputfile = 'TPprof_ltt9779b_simple_P300-1e-4.dat' 34 | 35 | 36 | #### Set up grids and constants: 37 | pressure = 1e5 * np.logspace(np.log10(psurf), np.log10(pmin), nlayers+1) # Pa 38 | gsurf = 6.673e-11*mplanet/rplanet**2 39 | scaleheight = 1.38e-23 * temp / (gsurf * MMW * 1.67e-27) # in meters 40 | altitude = np.abs(-scaleheight * np.log(pressure/pressure.max())) # in meters 41 | 42 | 43 | #### Calculate density via hydrostatic equilibrium: 44 | dpdz = np.diff(pressure)/np.diff(altitude) 45 | density = -dpdz * (rplanet + altitude[0:-1])**2/(6.673e-11 * mplanet) # SI units 46 | 47 | 48 | #### Write the file to disk: 49 | f = open(outputfile, 'w') 50 | f.write('Height Pressure Rho\n') 51 | for ii in range(nlayers): 52 | layervals = (altitude[ii], pressure[ii], density[ii]) 53 | f.write('%1.6e %1.6e %1.6e\n' % layervals) 54 | 55 | f.close() 56 | 57 | --------------------------------------------------------------------------------